syntaxai/tdd.md · main · tools / sama-cli / src / a31_constants.sh
# a31 — model: constants and pure data shared across the shell
# verifier. No I/O, no side effects, no exported functions — just
# variable assignments. Sourced by every other file.
#
# Mirrors the constants in src/a31_sama_v2.ts so the two verifiers
# agree on the same operational definitions (§4.5 Atomic line cap,
# §5 working-set bounds, the parse-boundary patterns from §4.4).
# — §4.5 Atomic line cap -------------------------------------------
# Files exceeding this LOC count fail the Atomic check. Matches
# ATOMIC_LINE_CAP in src/b32_sama_v2_verify.ts.
MAX_LINES=700
# — §5 working-set bounds -----------------------------------------
# Files within [WORKING_SET_MIN_LOC, WORKING_SET_MAX_LOC] are in the
# "sweet spot." Used by metrics, not by the §4 checks. Match
# src/a31_sama_v2.ts so polyglot working-set measurements agree.
WORKING_SET_MIN_LOC=50
WORKING_SET_MAX_LOC=500
# — §4.4 parse-boundary patterns -----------------------------------
# Regex sources that count as "external input parsed at the
# boundary." Layer 2 is the legitimate site; anywhere else fails
# the Modeled-boundary check.
#
# Patterns are extension-aware:
# .ts files → JSON.parse(, new URL( (mirrors PARSE_BOUNDARY_PATTERNS
# in src/a31_sama_v2.ts)
# .sh files → no boundary patterns defined yet (the shell verifier's
# own source tree has no analog of JSON.parse / new URL)
PARSE_BOUNDARY_PATTERNS_TS_NAMES="JSON.parse new URL"
PARSE_BOUNDARY_PATTERN_TS_JSON_PARSE='\bJSON\.parse[[:space:]]*\('
PARSE_BOUNDARY_PATTERN_TS_NEW_URL='\bnew[[:space:]]+URL[[:space:]]*\('
PARSE_BOUNDARY_PATTERNS_SH_NAMES=""
# — Output styling -------------------------------------------------
# ANSI escape codes for terminal output. Disabled when stdout is not
# a TTY (the dispatcher handles that — these are the raw codes).
COLOR_RESET=$'\033[0m'
COLOR_GREEN=$'\033[32m'
COLOR_RED=$'\033[31m'
COLOR_YELLOW=$'\033[33m'
COLOR_DIM=$'\033[2m'
COLOR_BOLD=$'\033[1m'
# Verdict glyphs. Match the TS verifier's "✓" / "✗" so cross-verify
# diff'ing the two summaries is trivial.
GLYPH_PASS="✓"
GLYPH_FAIL="✗"
# — Tool list ------------------------------------------------------
# Used by `sama doctor`. Each entry is "tool:required" — `dot` is
# the only optional one (graphviz; only needed for `sama graph`).
SAMA_CLI_TOOLS="bash:required find:required grep:required awk:required wc:required sed:required sort:required dot:optional"