Command Rule Constants (rules/constants.ts)

cc-safety-net · src/core/rules/constants.ts · typescript · MIT
dev-tools, security, cli, tag:regex, tag:constants, tag:command-parsing

Defines shared constants and regex patterns (command name patterns, shell wrappers, interpreters, display commands) used by command-safety rule evaluation logic.

// Source: https://github.com/kenryu42/cc-safety-net | License: MIT | Copyright 2026 J Liew
// Provided via justclaw.it.com; keep this notice with the code.
export const GIT_GLOBAL_OPTS_WITH_VALUE: ReadonlySet<string> = new Set([
  '-c',
  '-C',
  '--git-dir',
  '--work-tree',
  '--namespace',
  '--super-prefix',
  '--config-env',
]);

export const COMMAND_PATTERN = /^[a-zA-Z][a-zA-Z0-9_-]*$/;
export const MAX_REASON_LENGTH = 256;

export const SHELL_WRAPPERS = new Set(['bash', 'sh', 'zsh', 'ksh', 'dash', 'fish', 'csh', 'tcsh']);

export const INTERPRETERS = new Set(['python', 'python3', 'python2', 'node', 'ruby', 'perl']);
export const PYTHON_INTERPRETER_PATTERN = /^python(?:[23](?:\.\d+)*)?$/;

export const AWK_INTERPRETERS = new Set(['awk', 'gawk', 'nawk', 'mawk']);

export const DISPLA

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key