rungate 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +14 -3
- package/.claude/agents/aditi.md +0 -47
- package/.claude/agents/marcus.md +0 -50
- package/.claude/agents/quinn.md +0 -58
- package/.claude/agents/rook.md +0 -47
- package/.claude/agents/serena.md +0 -46
- package/.claude/rungate.json +0 -11
- package/.fallowrc.json +0 -28
- package/.github/copilot-instructions.md +0 -20
- package/.rungate/conformity-findings.json +0 -648
- package/AGENTS.md +0 -106
- package/CODE-MAP.md +0 -50
- package/HARNESS.md +0 -88
- package/bun.lock +0 -26
- package/bunfig.toml +0 -2
- package/config/brief-policies.json +0 -28
- package/config/ceremony-profiles.json +0 -212
- package/config/consumer-cascade-map.json +0 -24
- package/config/doc-cascade-map.json +0 -24
- package/config/eval.json +0 -84
- package/config/profiles/account-plan.yaml +0 -36
- package/config/profiles/campaign.yaml +0 -94
- package/config/prove-evidence.schema.json +0 -65
- package/config/spec-policies.json +0 -36
- package/config/workflow-schema.json +0 -281
- package/gates/SCHEMA-GUIDE.md +0 -121
- package/gates/ac-quality.test.ts +0 -106
- package/gates/adversarial.test.ts +0 -274
- package/gates/brief-assembler.test.ts +0 -429
- package/gates/brief-assembler.ts +0 -334
- package/gates/bunfig.toml +0 -2
- package/gates/chain.test.ts +0 -91
- package/gates/e2e-smoke.test.ts +0 -234
- package/gates/error-classifier.test.ts +0 -249
- package/gates/error-classifier.ts +0 -89
- package/gates/orchestrator.test.ts +0 -950
- package/gates/orchestrator.ts +0 -569
- package/gates/preload.ts +0 -77
- package/gates/prompts/ac-adversary.md +0 -20
- package/gates/prompts/evidence-validator.md +0 -22
- package/gates/prompts/prove-reproducer.md +0 -53
- package/gates/prove.test.ts +0 -164
- package/gates/run-gate.ts +0 -936
- package/gates/schema-parity.test.ts +0 -197
- package/gates/schema.ts +0 -362
- package/gates/self-heal.test.ts +0 -511
- package/gates/self-heal.ts +0 -121
- package/gates/ship-orchestrator.test.ts +0 -379
- package/gates/ship-orchestrator.ts +0 -363
- package/gates/test-fixtures/broken-no-environments.json +0 -60
- package/gates/test-fixtures/valid-standard.json +0 -54
- package/gates/test-utils.ts +0 -43
- package/gates/witness.ts +0 -220
- package/gates/workflow.test.ts +0 -1053
- package/hooks/AgentBriefGuard.hook.ts +0 -586
- package/hooks/AgentVerdictCapture.hook.ts +0 -134
- package/hooks/AutoVerifyGate.hook.ts +0 -76
- package/hooks/GateEnforcement.hook.ts +0 -273
- package/hooks/IssueCloseGuard.hook.ts +0 -116
- package/hooks/MergeGuard.hook.ts +0 -55
- package/hooks/StaleTTLCleanup.hook.ts +0 -133
- package/hooks/VerifyPhaseLock.hook.ts +0 -81
- package/hooks/WorkflowStateGuard.hook.ts +0 -37
- package/hooks/lib/agentDetection.ts +0 -70
- package/hooks/lib/findWorkflow.ts +0 -101
- package/hooks/lib/parseStdin.ts +0 -37
- package/hooks/lib/paths.ts +0 -111
- package/hooks/lib/utils.ts +0 -81
- package/reference/migration-manifest.json +0 -554
- package/reference/prompts/agent-aditi.md +0 -38
- package/reference/prompts/agent-marcus.md +0 -38
- package/reference/prompts/agent-quinn.md +0 -38
- package/reference/prompts/agent-rook.md +0 -37
- package/reference/prompts/agent-serena.md +0 -37
- package/reference/prompts/council-skill.md +0 -170
- package/reference/prompts/goal-skill.md +0 -235
- package/reference/prompts/prove-skill.md +0 -283
- package/reference/prompts/quinn-standard.md +0 -246
- package/reference/prompts/ship-convergence.md +0 -65
- package/reference/prompts/ship-escalation.md +0 -43
- package/reference/prompts/ship-iteration.md +0 -382
- package/reference/prompts/ship-pending-patches.md +0 -246
- package/reference/prompts/ship-reference.md +0 -250
- package/reference/prompts/ship-skill.md +0 -347
- package/reference/prompts/ship-templates.md +0 -215
- package/reference/scripts/batch-status.sh +0 -68
- package/reference/scripts/chain-compat-check.sh +0 -67
- package/reference/scripts/context-audit.sh +0 -314
- package/reference/scripts/dead-export-check.sh +0 -61
- package/reference/scripts/generate-qc-tables.sh +0 -92
- package/reference/scripts/harness-init.sh +0 -111
- package/reference/scripts/pai-054-baseline-check.sh +0 -40
- package/reference/scripts/prove-smoke-test.sh +0 -112
- package/reference/scripts/setup-keychain-salt.sh +0 -12
- package/reference/scripts/skill-optimizer-friday.sh +0 -88
- package/reference/scripts/skill-qc-test.sh +0 -351
- package/reference/scripts/skill-synthesize-tonight.sh +0 -66
- package/reference/specs/HARNESS-EXTRACTION-SPEC.md +0 -263
- package/reference/specs/harness-v3-bash-deletion-plan.md +0 -65
- package/reference/specs/harness-v3-migration-plan.md +0 -188
- package/scripts/decision-reconcile.sh +0 -74
- package/scripts/decision-reconcile.ts +0 -152
- package/scripts/git-hooks/pre-commit +0 -76
- package/scripts/git-hooks/pre-push +0 -271
- package/scripts/harness-skill-check.sh +0 -52
- package/scripts/lib/gap-emit.sh +0 -65
- package/scripts/lib/jq-update.sh +0 -30
- package/scripts/lib/resolve-slug.sh +0 -30
- package/scripts/lib/verify-spec-compliance.sh +0 -102
- package/scripts/prove-backfill.sh +0 -87
- package/scripts/scaffold-rungate-config.ts +0 -91
- package/scripts/self-containment-check.sh +0 -109
- package/scripts/skill-qc-validator.sh +0 -402
- package/scripts/slug-resolver.sh +0 -14
- package/specs/BOOTSTRAP-DATA-FLOW-SPEC.md +0 -2493
- package/specs/BOOTSTRAP-TEST-PLAN.md +0 -571
- package/specs/HARNESS-GATES.md +0 -256
- package/specs/HARNESS-SKILL-CHAIN.md +0 -286
- package/specs/HARNESS-SKILL-CONTRACT.md +0 -93
- package/specs/HARNESS-STANDARD.md +0 -488
- package/specs/SPEC-TEMPLATE.md +0 -53
- package/specs/bootstrap-data-flow.png +0 -0
- package/specs/harness-automation-matrix.md +0 -314
- package/specs/harness-automation-matrix.rules.json +0 -64
- package/test/anti.test.ts +0 -80
- package/test/contract-negative.test.ts +0 -86
- package/test/contract.test.ts +0 -158
- package/test/external-deps.test.ts +0 -48
- package/test/fixtures/golden-project/.env.example +0 -3
- package/test/fixtures/golden-project/Makefile +0 -7
- package/test/fixtures/golden-project/docs/adr/ADR-001-framework.md +0 -23
- package/test/fixtures/golden-project/docs/setup-guide.md +0 -10
- package/test/fixtures/golden-project/package.json +0 -10
- package/test/fixtures/golden-project/specs/api-spec.md +0 -20
- package/test/fixtures/golden-project/src/auth.ts +0 -8
- package/test/fixtures/golden-project/src/db.ts +0 -11
- package/test/fixtures/golden-project/src/index.ts +0 -19
- package/test/fixtures/golden-project/src/utils/format.ts +0 -3
- package/test/fixtures/golden-project/test/auth.test.ts +0 -15
- package/test/fixtures/golden-project/tsconfig.json +0 -12
- package/test/meta-sc-coverage.test.ts +0 -159
- package/test/phase-0.test.ts +0 -846
- package/test/phase-1.test.ts +0 -617
- package/test/phase-2.test.ts +0 -620
- package/test/phase-3.test.ts +0 -99
- package/test/scaffold-conformity.test.ts +0 -8
- package/test/schema-canary.test.ts +0 -51
- package/test/spec-compliance-auto.test.ts +0 -64
- package/test/spec-compliance.test.ts +0 -295
- package/test/spec-discovery.test.ts +0 -68
- package/test/spec-drift.test.ts +0 -5
- package/test/structure.test.ts +0 -165
- package/test/unit/agent-brief-guard-ship.test.ts +0 -293
- package/test/unit/extract-constraints.test.ts +0 -145
- package/test/unit/issue-close-guard.test.ts +0 -204
- package/test/unit/scaffold-project.test.ts +0 -417
- package/test/unit/skill-cooccurrence.test.ts +0 -177
- package/test/unit/skill-sequence-logger.test.ts +0 -244
- package/test/unit/workflow-state-guard.test.ts +0 -95
- package/workflows/batch-ship.js +0 -295
- package/workflows/council.js +0 -481
- package/workflows/prove.js +0 -560
- package/workflows/ship.js +0 -789
- package/workflows/verify.js +0 -236
|
@@ -1,402 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# skill-qc-validator.sh — Data-driven QC validator
|
|
3
|
-
# Reads check definitions from skill-qc-checks.json, runs them generically.
|
|
4
|
-
# The script never hardcodes skill names — all skill-specific logic lives in the JSON config.
|
|
5
|
-
#
|
|
6
|
-
# Usage: skill-qc-validator.sh --skill SKILL --issue NUM --slug SLUG [--repo REPO] [--project-root PATH]
|
|
7
|
-
set -u
|
|
8
|
-
|
|
9
|
-
# ─── Arg parsing ───────────────────────────────────────────────
|
|
10
|
-
SKILL="" ISSUE="" SLUG="" REPO="hornjason/pai-config" PROJECT_ROOT="$HOME/.claude"
|
|
11
|
-
|
|
12
|
-
while [[ $# -gt 0 ]]; do
|
|
13
|
-
case "$1" in
|
|
14
|
-
--skill) SKILL="$2"; shift 2 ;;
|
|
15
|
-
--issue) ISSUE="$2"; shift 2 ;;
|
|
16
|
-
--slug) SLUG="$2"; shift 2 ;;
|
|
17
|
-
--repo) REPO="$2"; shift 2 ;;
|
|
18
|
-
--project-root) PROJECT_ROOT="$2"; shift 2 ;;
|
|
19
|
-
*) echo "Unknown arg: $1" >&2; exit 1 ;;
|
|
20
|
-
esac
|
|
21
|
-
done
|
|
22
|
-
|
|
23
|
-
if [[ -z "$SKILL" || -z "$ISSUE" || -z "$SLUG" ]]; then
|
|
24
|
-
echo "Usage: skill-qc-validator.sh --skill SKILL --issue NUM --slug SLUG [--repo REPO] [--project-root PATH]" >&2
|
|
25
|
-
exit 1
|
|
26
|
-
fi
|
|
27
|
-
|
|
28
|
-
WORK_DIR="${RUNGATE_WORK_DIR:-$HOME/.rungate}/$SLUG"
|
|
29
|
-
|
|
30
|
-
# Auto-detect repo from workflow-state.json if not explicitly provided
|
|
31
|
-
if [[ "$REPO" == "hornjason/pai-config" && -f "$WORK_DIR/workflow-state.json" ]]; then
|
|
32
|
-
DETECTED_REPO=$(jq -r '.issueRepo // .repo // empty' "$WORK_DIR/workflow-state.json" 2>/dev/null)
|
|
33
|
-
if [[ -n "$DETECTED_REPO" ]]; then
|
|
34
|
-
REPO="$DETECTED_REPO"
|
|
35
|
-
fi
|
|
36
|
-
fi
|
|
37
|
-
|
|
38
|
-
CONFIG="$(cd "$(dirname "$0")/.." && pwd)/schemas/skill-qc-checks.json"
|
|
39
|
-
|
|
40
|
-
# Fallback: try home dir
|
|
41
|
-
if [[ ! -f "$CONFIG" ]]; then
|
|
42
|
-
CONFIG="$HOME/.claude/schemas/skill-qc-checks.json"
|
|
43
|
-
fi
|
|
44
|
-
|
|
45
|
-
[[ -f "$CONFIG" ]] || { echo "ERROR: Config not found: $CONFIG" >&2; exit 1; }
|
|
46
|
-
command -v jq >/dev/null 2>&1 || { echo "ERROR: jq is required" >&2; exit 1; }
|
|
47
|
-
|
|
48
|
-
# ─── Temp dir for jq filter files ──────────────────────────────
|
|
49
|
-
QC_TMPDIR=$(mktemp -d)
|
|
50
|
-
trap 'rm -rf "$QC_TMPDIR"' EXIT
|
|
51
|
-
|
|
52
|
-
# ─── Counters ──────────────────────────────────────────────────
|
|
53
|
-
PASS_COUNT=0
|
|
54
|
-
FAIL_COUNT=0
|
|
55
|
-
SKIP_COUNT=0
|
|
56
|
-
WARN_COUNT=0
|
|
57
|
-
|
|
58
|
-
# ─── Variable substitution in command strings ──────────────────
|
|
59
|
-
subst_vars() {
|
|
60
|
-
local s="$1"
|
|
61
|
-
s="${s//\$ISSUE/$ISSUE}"
|
|
62
|
-
s="${s//\$SLUG/$SLUG}"
|
|
63
|
-
s="${s//\$REPO/$REPO}"
|
|
64
|
-
s="${s//\$WORK_DIR/$WORK_DIR}"
|
|
65
|
-
s="${s//\$PROJECT_ROOT/$PROJECT_ROOT}"
|
|
66
|
-
printf '%s' "$s"
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
# ─── Run jq filter from string (avoids shell quoting issues) ──
|
|
70
|
-
run_jq_filter() {
|
|
71
|
-
local filter="$1" file="$2"
|
|
72
|
-
printf '%s\n' "$filter" > "$QC_TMPDIR/jqf"
|
|
73
|
-
jq -rf "$QC_TMPDIR/jqf" "$file" 2>/dev/null
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
# ─── Result recording ─────────────────────────────────────────
|
|
77
|
-
do_result() {
|
|
78
|
-
local status="$1" id="$2" desc="$3" sev="$4" detail="$5"
|
|
79
|
-
|
|
80
|
-
# WARN severity always prints WARN regardless of pass/fail
|
|
81
|
-
if [[ "$sev" == "WARN" ]]; then
|
|
82
|
-
if [[ -n "$detail" ]]; then
|
|
83
|
-
printf "%-4s WARN %s -- %s\n" "$id" "$desc" "$detail"
|
|
84
|
-
else
|
|
85
|
-
printf "%-4s WARN %s\n" "$id" "$desc"
|
|
86
|
-
fi
|
|
87
|
-
WARN_COUNT=$((WARN_COUNT + 1))
|
|
88
|
-
return
|
|
89
|
-
fi
|
|
90
|
-
|
|
91
|
-
if [[ "$status" == "PASS" ]]; then
|
|
92
|
-
printf "%-4s PASS %s\n" "$id" "$desc"
|
|
93
|
-
PASS_COUNT=$((PASS_COUNT + 1))
|
|
94
|
-
else
|
|
95
|
-
if [[ -n "$detail" ]]; then
|
|
96
|
-
printf "%-4s FAIL %s -- %s\n" "$id" "$desc" "$detail"
|
|
97
|
-
else
|
|
98
|
-
printf "%-4s FAIL %s\n" "$id" "$desc"
|
|
99
|
-
fi
|
|
100
|
-
FAIL_COUNT=$((FAIL_COUNT + 1))
|
|
101
|
-
fi
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
do_skip() {
|
|
105
|
-
local id="$1" desc="$2"
|
|
106
|
-
printf "%-4s SKIP %s\n" "$id" "$desc"
|
|
107
|
-
SKIP_COUNT=$((SKIP_COUNT + 1))
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
# ─── Expect evaluation for command-type checks ────────────────
|
|
111
|
-
eval_expect() {
|
|
112
|
-
local op="$1" value="$2" raw_output="$3" exit_code="$4"
|
|
113
|
-
local trimmed
|
|
114
|
-
trimmed=$(printf '%s' "$raw_output" | tail -1 | tr -d '[:space:]')
|
|
115
|
-
|
|
116
|
-
case "$op" in
|
|
117
|
-
exit-0)
|
|
118
|
-
[[ "$exit_code" -eq 0 ]]
|
|
119
|
-
;;
|
|
120
|
-
non-empty)
|
|
121
|
-
[[ -n "$trimmed" ]]
|
|
122
|
-
;;
|
|
123
|
-
contains)
|
|
124
|
-
printf '%s' "$raw_output" | grep -qF "$value"
|
|
125
|
-
;;
|
|
126
|
-
">=")
|
|
127
|
-
local num="${trimmed:-0}"
|
|
128
|
-
# Ensure numeric
|
|
129
|
-
[[ "$num" =~ ^-?[0-9]+$ ]] || num=0
|
|
130
|
-
[[ "$num" -ge "${value:-0}" ]] 2>/dev/null
|
|
131
|
-
;;
|
|
132
|
-
"==")
|
|
133
|
-
[[ "$trimmed" == "$value" ]]
|
|
134
|
-
;;
|
|
135
|
-
"!=")
|
|
136
|
-
[[ "$trimmed" != "$value" ]]
|
|
137
|
-
;;
|
|
138
|
-
*)
|
|
139
|
-
return 1
|
|
140
|
-
;;
|
|
141
|
-
esac
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
# ─── Verify checks exist for this skill ───────────────────────
|
|
145
|
-
check_count=$(jq "[.checks[] | select(.skill == \"$SKILL\")] | length" "$CONFIG")
|
|
146
|
-
if [[ "$check_count" -eq 0 ]]; then
|
|
147
|
-
echo "No checks found for skill: $SKILL" >&2
|
|
148
|
-
exit 1
|
|
149
|
-
fi
|
|
150
|
-
|
|
151
|
-
echo "=== Skill QC: $SKILL ($check_count checks) ==="
|
|
152
|
-
|
|
153
|
-
# ─── Main loop: process each check ────────────────────────────
|
|
154
|
-
while IFS= read -r check || [[ -n "$check" ]]; do
|
|
155
|
-
id=$(jq -r '.id' <<< "$check")
|
|
156
|
-
desc=$(jq -r '.description' <<< "$check")
|
|
157
|
-
chk_type=$(jq -r '.type' <<< "$check")
|
|
158
|
-
severity=$(jq -r '.severity // "FAIL"' <<< "$check")
|
|
159
|
-
|
|
160
|
-
# ── Skip gate-runner checks when called from within a gate (prevents recursion) ──
|
|
161
|
-
chk_cmd=$(jq -r '.command // empty' <<< "$check")
|
|
162
|
-
if [[ -n "${GATE_RUNNER_ACTIVE:-}" && "$chk_cmd" == *"gate-runner.sh"* ]]; then
|
|
163
|
-
do_skip "$id" "$desc (gate-runner recursion guard)"
|
|
164
|
-
continue
|
|
165
|
-
fi
|
|
166
|
-
|
|
167
|
-
# ── Evaluate skipWhen ──
|
|
168
|
-
skip_kind=$(jq -r '.skipWhen | type' <<< "$check")
|
|
169
|
-
if [[ "$skip_kind" == "object" ]]; then
|
|
170
|
-
skip_cmd=$(jq -r '.skipWhen.command // empty' <<< "$check")
|
|
171
|
-
if [[ -n "$skip_cmd" ]]; then
|
|
172
|
-
skip_cmd=$(subst_vars "$skip_cmd")
|
|
173
|
-
if eval "$skip_cmd" 2>/dev/null; then
|
|
174
|
-
do_skip "$id" "$desc"
|
|
175
|
-
continue
|
|
176
|
-
fi
|
|
177
|
-
fi
|
|
178
|
-
fi
|
|
179
|
-
|
|
180
|
-
# ── Run check by type ──
|
|
181
|
-
case "$chk_type" in
|
|
182
|
-
|
|
183
|
-
command)
|
|
184
|
-
cmd=$(jq -r '.command' <<< "$check")
|
|
185
|
-
cmd=$(subst_vars "$cmd")
|
|
186
|
-
op=$(jq -r '.expect.op' <<< "$check")
|
|
187
|
-
value=$(jq -r '.expect.value // empty' <<< "$check")
|
|
188
|
-
|
|
189
|
-
raw_output=$(eval "$cmd" 2>/dev/null)
|
|
190
|
-
cmd_exit=$?
|
|
191
|
-
|
|
192
|
-
if eval_expect "$op" "$value" "$raw_output" "$cmd_exit"; then
|
|
193
|
-
do_result "PASS" "$id" "$desc" "$severity" ""
|
|
194
|
-
else
|
|
195
|
-
# Build detail from output
|
|
196
|
-
detail_line=$(printf '%s' "$raw_output" | tail -1 | tr -d '[:space:]')
|
|
197
|
-
case "$op" in
|
|
198
|
-
">="| "=="|"!=") do_result "FAIL" "$id" "$desc" "$severity" "got $detail_line" ;;
|
|
199
|
-
contains) do_result "FAIL" "$id" "$desc" "$severity" "output missing expected string" ;;
|
|
200
|
-
non-empty) do_result "FAIL" "$id" "$desc" "$severity" "empty output" ;;
|
|
201
|
-
exit-0) do_result "FAIL" "$id" "$desc" "$severity" "exit code $cmd_exit" ;;
|
|
202
|
-
*) do_result "FAIL" "$id" "$desc" "$severity" "" ;;
|
|
203
|
-
esac
|
|
204
|
-
fi
|
|
205
|
-
;;
|
|
206
|
-
|
|
207
|
-
jq)
|
|
208
|
-
source_name=$(jq -r '.source' <<< "$check")
|
|
209
|
-
query=$(jq -r '.query' <<< "$check")
|
|
210
|
-
op=$(jq -r '.expect.op' <<< "$check")
|
|
211
|
-
value=$(jq -r '.expect.value // empty' <<< "$check")
|
|
212
|
-
source_file="$WORK_DIR/$source_name"
|
|
213
|
-
|
|
214
|
-
if [[ ! -f "$source_file" ]]; then
|
|
215
|
-
do_result "FAIL" "$id" "$desc" "$severity" "source file not found: $source_name"
|
|
216
|
-
continue
|
|
217
|
-
fi
|
|
218
|
-
|
|
219
|
-
result=$(run_jq_filter "$query" "$source_file")
|
|
220
|
-
|
|
221
|
-
case "$op" in
|
|
222
|
-
not-null)
|
|
223
|
-
if [[ "$result" != "null" && -n "$result" ]]; then
|
|
224
|
-
do_result "PASS" "$id" "$desc" "$severity" ""
|
|
225
|
-
else
|
|
226
|
-
do_result "FAIL" "$id" "$desc" "$severity" "got null"
|
|
227
|
-
fi
|
|
228
|
-
;;
|
|
229
|
-
length-gte)
|
|
230
|
-
result_clean=$(printf '%s' "$result" | tr -d '[:space:]')
|
|
231
|
-
if [[ ${#result_clean} -ge ${value:-0} ]]; then
|
|
232
|
-
do_result "PASS" "$id" "$desc" "$severity" ""
|
|
233
|
-
else
|
|
234
|
-
do_result "FAIL" "$id" "$desc" "$severity" "length ${#result_clean} < $value"
|
|
235
|
-
fi
|
|
236
|
-
;;
|
|
237
|
-
*)
|
|
238
|
-
do_result "FAIL" "$id" "$desc" "$severity" "unknown jq op: $op"
|
|
239
|
-
;;
|
|
240
|
-
esac
|
|
241
|
-
;;
|
|
242
|
-
|
|
243
|
-
jq-count)
|
|
244
|
-
source_name=$(jq -r '.source' <<< "$check")
|
|
245
|
-
query=$(jq -r '.query' <<< "$check")
|
|
246
|
-
op=$(jq -r '.expect.op' <<< "$check")
|
|
247
|
-
value=$(jq -r '.expect.value // empty' <<< "$check")
|
|
248
|
-
source_file="$WORK_DIR/$source_name"
|
|
249
|
-
|
|
250
|
-
if [[ ! -f "$source_file" ]]; then
|
|
251
|
-
do_result "FAIL" "$id" "$desc" "$severity" "source file not found: $source_name"
|
|
252
|
-
continue
|
|
253
|
-
fi
|
|
254
|
-
|
|
255
|
-
count=$(run_jq_filter "$query | length" "$source_file")
|
|
256
|
-
count="${count:-0}"
|
|
257
|
-
[[ "$count" =~ ^[0-9]+$ ]] || count=0
|
|
258
|
-
|
|
259
|
-
if eval_expect "$op" "$value" "$count" "0"; then
|
|
260
|
-
do_result "PASS" "$id" "$desc" "$severity" ""
|
|
261
|
-
else
|
|
262
|
-
do_result "FAIL" "$id" "$desc" "$severity" "count=$count"
|
|
263
|
-
fi
|
|
264
|
-
;;
|
|
265
|
-
|
|
266
|
-
jq-each)
|
|
267
|
-
source_name=$(jq -r '.source' <<< "$check")
|
|
268
|
-
query=$(jq -r '.query' <<< "$check")
|
|
269
|
-
test_kind=$(jq -r '.test' <<< "$check")
|
|
270
|
-
source_file="$WORK_DIR/$source_name"
|
|
271
|
-
|
|
272
|
-
if [[ ! -f "$source_file" ]]; then
|
|
273
|
-
do_result "FAIL" "$id" "$desc" "$severity" "source file not found: $source_name"
|
|
274
|
-
continue
|
|
275
|
-
fi
|
|
276
|
-
|
|
277
|
-
elements=$(run_jq_filter "$query" "$source_file")
|
|
278
|
-
|
|
279
|
-
if [[ -z "$elements" ]]; then
|
|
280
|
-
do_result "FAIL" "$id" "$desc" "$severity" "no elements returned by query"
|
|
281
|
-
continue
|
|
282
|
-
fi
|
|
283
|
-
|
|
284
|
-
all_pass=true
|
|
285
|
-
fail_detail=""
|
|
286
|
-
|
|
287
|
-
while IFS= read -r elem; do
|
|
288
|
-
[[ -z "$elem" ]] && continue
|
|
289
|
-
|
|
290
|
-
if [[ "$elem" == "null" ]]; then
|
|
291
|
-
all_pass=false
|
|
292
|
-
fail_detail="null or missing field"
|
|
293
|
-
break
|
|
294
|
-
fi
|
|
295
|
-
|
|
296
|
-
case "$test_kind" in
|
|
297
|
-
file-exists)
|
|
298
|
-
# Resolve relative paths against WORK_DIR
|
|
299
|
-
check_path="$elem"
|
|
300
|
-
if [[ "$check_path" != /* ]]; then
|
|
301
|
-
check_path="$WORK_DIR/$check_path"
|
|
302
|
-
fi
|
|
303
|
-
if [[ ! -f "$check_path" ]]; then
|
|
304
|
-
all_pass=false
|
|
305
|
-
fail_detail="file not found: $elem"
|
|
306
|
-
break
|
|
307
|
-
fi
|
|
308
|
-
;;
|
|
309
|
-
in-enum)
|
|
310
|
-
found=false
|
|
311
|
-
while IFS= read -r enum_val; do
|
|
312
|
-
if [[ "$elem" == "$enum_val" ]]; then
|
|
313
|
-
found=true
|
|
314
|
-
break
|
|
315
|
-
fi
|
|
316
|
-
done < <(jq -r '.enum[]' <<< "$check")
|
|
317
|
-
if ! $found; then
|
|
318
|
-
all_pass=false
|
|
319
|
-
fail_detail="'$elem' not in allowed enum"
|
|
320
|
-
break
|
|
321
|
-
fi
|
|
322
|
-
;;
|
|
323
|
-
*)
|
|
324
|
-
all_pass=false
|
|
325
|
-
fail_detail="unknown test type: $test_kind"
|
|
326
|
-
break
|
|
327
|
-
;;
|
|
328
|
-
esac
|
|
329
|
-
done <<< "$elements"
|
|
330
|
-
|
|
331
|
-
if $all_pass; then
|
|
332
|
-
do_result "PASS" "$id" "$desc" "$severity" ""
|
|
333
|
-
else
|
|
334
|
-
do_result "FAIL" "$id" "$desc" "$severity" "$fail_detail"
|
|
335
|
-
fi
|
|
336
|
-
;;
|
|
337
|
-
|
|
338
|
-
computed)
|
|
339
|
-
source_name=$(jq -r '.source' <<< "$check")
|
|
340
|
-
jq_test=$(jq -r '.jq_test' <<< "$check")
|
|
341
|
-
source_file="$WORK_DIR/$source_name"
|
|
342
|
-
|
|
343
|
-
if [[ ! -f "$source_file" ]]; then
|
|
344
|
-
do_result "FAIL" "$id" "$desc" "$severity" "source file not found: $source_name"
|
|
345
|
-
continue
|
|
346
|
-
fi
|
|
347
|
-
|
|
348
|
-
result=$(run_jq_filter "$jq_test" "$source_file")
|
|
349
|
-
|
|
350
|
-
if [[ -z "$result" ]]; then
|
|
351
|
-
do_result "FAIL" "$id" "$desc" "$severity" "jq evaluation failed"
|
|
352
|
-
elif [[ "$result" == "PASS" ]]; then
|
|
353
|
-
do_result "PASS" "$id" "$desc" "$severity" ""
|
|
354
|
-
else
|
|
355
|
-
do_result "FAIL" "$id" "$desc" "$severity" "computed: $result"
|
|
356
|
-
fi
|
|
357
|
-
;;
|
|
358
|
-
|
|
359
|
-
grep)
|
|
360
|
-
source_name=$(jq -r '.source' <<< "$check")
|
|
361
|
-
pattern=$(jq -r '.pattern' <<< "$check")
|
|
362
|
-
op=$(jq -r '.expect.op' <<< "$check")
|
|
363
|
-
value=$(jq -r '.expect.value // empty' <<< "$check")
|
|
364
|
-
source_file="$WORK_DIR/$source_name"
|
|
365
|
-
|
|
366
|
-
if [[ ! -f "$source_file" ]]; then
|
|
367
|
-
do_result "FAIL" "$id" "$desc" "$severity" "source file not found: $source_name"
|
|
368
|
-
continue
|
|
369
|
-
fi
|
|
370
|
-
|
|
371
|
-
pattern=$(subst_vars "$pattern")
|
|
372
|
-
count=$(grep -c "$pattern" "$source_file" 2>/dev/null || echo "0")
|
|
373
|
-
|
|
374
|
-
if eval_expect "$op" "$value" "$count" "0"; then
|
|
375
|
-
do_result "PASS" "$id" "$desc" "$severity" ""
|
|
376
|
-
else
|
|
377
|
-
do_result "FAIL" "$id" "$desc" "$severity" "matches=$count"
|
|
378
|
-
fi
|
|
379
|
-
;;
|
|
380
|
-
|
|
381
|
-
file-exists)
|
|
382
|
-
path=$(jq -r '.path' <<< "$check")
|
|
383
|
-
path=$(subst_vars "$path")
|
|
384
|
-
|
|
385
|
-
if [[ -f "$path" ]]; then
|
|
386
|
-
do_result "PASS" "$id" "$desc" "$severity" ""
|
|
387
|
-
else
|
|
388
|
-
do_result "FAIL" "$id" "$desc" "$severity" "not found: $path"
|
|
389
|
-
fi
|
|
390
|
-
;;
|
|
391
|
-
|
|
392
|
-
*)
|
|
393
|
-
do_result "FAIL" "$id" "$desc" "$severity" "unknown check type: $chk_type"
|
|
394
|
-
;;
|
|
395
|
-
esac
|
|
396
|
-
|
|
397
|
-
done < <(jq -c ".checks[] | select(.skill == \"$SKILL\")" "$CONFIG")
|
|
398
|
-
|
|
399
|
-
# ─── Summary ──────────────────────────────────────────────────
|
|
400
|
-
echo ""
|
|
401
|
-
echo "$SKILL QC: $PASS_COUNT pass, $FAIL_COUNT fail, $SKIP_COUNT skip, $WARN_COUNT warn"
|
|
402
|
-
[[ $FAIL_COUNT -eq 0 ]]
|
package/scripts/slug-resolver.sh
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# slug-resolver.sh — Maps repo identifier to short slug. Deterministic — no LLM judgment.
|
|
3
|
-
# Usage: bash slug-resolver.sh <repo-identifier>
|
|
4
|
-
# Input: "hornjason/pai-config" or "hornjason/asaCommandCenter" or full git URL
|
|
5
|
-
# Output: short name (e.g., "pai", "ddb")
|
|
6
|
-
# Thin caller — mapping logic lives in scripts/lib/resolve-slug.sh
|
|
7
|
-
set -euo pipefail
|
|
8
|
-
|
|
9
|
-
REPO="${1:?Usage: slug-resolver.sh <repo-identifier>}"
|
|
10
|
-
|
|
11
|
-
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
12
|
-
source "$SCRIPT_DIR/lib/resolve-slug.sh"
|
|
13
|
-
|
|
14
|
-
resolve_slug_from_repo "$REPO"
|