@jeiemgi/cckit 0.11.0 → 0.13.0
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/.claude-plugin/plugin.json +4 -2
- package/AGENTS.md +22 -238
- package/README.md +66 -56
- package/SECURITY.md +4 -4
- package/bin/PROMPTS.md +12 -0
- package/bin/cckit +181 -140
- package/cckit.config.json +1 -1
- package/kit/PROMPTS.md +14 -0
- package/{commands → kit/commands}/kit-doctor.md +3 -4
- package/{commands → kit/commands}/kit-export-project.md +1 -1
- package/{commands → kit/commands}/kit-init.md +8 -20
- package/{commands → kit/commands}/kit-routines.md +1 -1
- package/{commands → kit/commands}/kit-update.md +3 -3
- package/kit/completions/cckit.bash +9 -0
- package/{databases → kit/databases}/supabase.json +1 -1
- package/{integrations → kit/integrations}/integration.schema.json +3 -3
- package/kit/interview/global.json +54 -0
- package/kit/interview/project.json +133 -0
- package/kit/modules/qa.json +63 -0
- package/kit/modules/software.json +48 -0
- package/{profiles → kit/profiles}/automation.json +1 -3
- package/{profiles → kit/profiles}/content.json +0 -2
- package/{profiles → kit/profiles}/marketing.json +0 -2
- package/{profiles → kit/profiles}/minimal.json +1 -3
- package/{profiles → kit/profiles}/research.json +1 -3
- package/{profiles → kit/profiles}/software.json +0 -2
- package/kit/routines/catalogue.json +84 -0
- package/{skills → kit/skills}/kit-add/SKILL.md +4 -4
- package/kit/skills/kit-advisor/SKILL.md +75 -0
- package/kit/skills/kit-advisor/references/close.md +53 -0
- package/kit/skills/kit-advisor/references/grill.md +69 -0
- package/kit/skills/kit-advisor/references/orchestrate.md +56 -0
- package/kit/skills/kit-advisor/references/plan.md +64 -0
- package/kit/skills/kit-advisor/references/review.md +47 -0
- package/kit/skills/kit-advisor/references/step-report.md +61 -0
- package/{skills → kit/skills}/kit-annotate/SKILL.md +2 -4
- package/{skills → kit/skills}/kit-autopilot/SKILL.md +7 -7
- package/{skills → kit/skills}/kit-cleanup/SKILL.md +4 -4
- package/{skills → kit/skills}/kit-contribute/SKILL.md +8 -12
- package/{skills → kit/skills}/kit-customize/SKILL.md +5 -8
- package/{skills → kit/skills}/kit-dev/SKILL.md +1 -1
- package/{skills → kit/skills}/kit-digest/SKILL.md +3 -3
- package/{skills → kit/skills}/kit-effort-close/SKILL.md +20 -12
- package/{skills → kit/skills}/kit-effort-new/SKILL.md +17 -14
- package/{skills → kit/skills}/kit-effort-pr/SKILL.md +7 -7
- package/{skills → kit/skills}/kit-effort-start/SKILL.md +3 -3
- package/{skills → kit/skills}/kit-gc/SKILL.md +3 -3
- package/{skills → kit/skills}/kit-next/SKILL.md +7 -7
- package/{skills → kit/skills}/kit-page/SKILL.md +1 -1
- package/{skills → kit/skills}/kit-plan-next/SKILL.md +10 -11
- package/{skills → kit/skills}/kit-status/SKILL.md +6 -6
- package/{skills → kit/skills}/kit-task-close/SKILL.md +5 -5
- package/{skills → kit/skills}/kit-task-new/SKILL.md +5 -5
- package/{skills → kit/skills}/kit-task-pr/SKILL.md +5 -5
- package/{skills → kit/skills}/kit-task-pr-auto/SKILL.md +1 -1
- package/{skills → kit/skills}/kit-task-pr-merge/SKILL.md +10 -10
- package/{skills → kit/skills}/kit-task-start/SKILL.md +1 -1
- package/{skills → kit/skills}/kit-task-sync/SKILL.md +5 -3
- package/{skills → kit/skills}/kit-ux-audit/SKILL.md +16 -35
- package/{skills → kit/skills}/kit-ux-audit/references/graph-model.md +7 -26
- package/{skills → kit/skills}/kit-ux-audit/references/report.md +2 -3
- package/{skills → kit/skills}/routing.yaml +6 -1
- package/kit/statusline/kit-statusline.sh +82 -0
- package/{templates → kit/templates}/agents/analyst.md +0 -11
- package/{templates → kit/templates}/agents/auto-dev.md +0 -13
- package/{templates → kit/templates}/agents/backend.md +0 -11
- package/{templates → kit/templates}/agents/designer.md +0 -11
- package/{templates → kit/templates}/agents/devops.md +0 -11
- package/{templates → kit/templates}/agents/editor.md +0 -11
- package/{templates → kit/templates}/agents/frontend.md +0 -11
- package/{templates → kit/templates}/agents/generalist.md +0 -11
- package/{templates → kit/templates}/agents/local-delegate.md +0 -13
- package/{templates → kit/templates}/agents/n8n.md +0 -11
- package/{templates → kit/templates}/agents/pm.md +0 -11
- package/{templates → kit/templates}/agents/qa.md +0 -11
- package/{templates → kit/templates}/agents/researcher.md +0 -11
- package/{templates → kit/templates}/agents/security.md +0 -11
- package/{templates → kit/templates}/agents/tech-lead.md +0 -11
- package/{templates → kit/templates}/agents/ux.md +3 -14
- package/{templates → kit/templates}/hooks/kit-mail-check.sh.tmpl +1 -1
- package/{templates → kit/templates}/instructions.md.tmpl +4 -21
- package/{templates → kit/templates}/kit.config.json.tmpl +0 -6
- package/{templates → kit/templates}/rules/authoring.md +7 -3
- package/{templates → kit/templates}/rules/branch-naming.md +3 -2
- package/{templates → kit/templates}/rules/delegation-brief.md +4 -0
- package/{templates → kit/templates}/rules/effort-model.md +34 -31
- package/{templates → kit/templates}/rules/gate-and-review.md +1 -1
- package/{templates → kit/templates}/rules/merge-safety.md +12 -9
- package/{templates → kit/templates}/rules/naming-and-ids.md +20 -24
- package/{templates → kit/templates}/rules/plan-next.md +5 -5
- package/{templates → kit/templates}/rules/react-annotate.md +0 -8
- package/{templates → kit/templates}/skills/campaign/SKILL.md +2 -2
- package/kit.config.schema.json +11 -11
- package/lib/PROMPTS.md +14 -0
- package/{scripts/lib → lib/core}/adapter-select-test.sh +7 -7
- package/lib/core/advisor-test.sh +55 -0
- package/{scripts/lib → lib/core}/agent-def-test.sh +1 -1
- package/{scripts/lib → lib/core}/agent-def.sh +2 -2
- package/{scripts/lib → lib/core}/agent-launch-test.sh +3 -3
- package/{scripts/lib → lib/core}/agent-profile-test.sh +2 -2
- package/{scripts/lib → lib/core}/agent-resolve-test.sh +4 -2
- package/{scripts/lib → lib/core}/agent-resolve.sh +5 -4
- package/{scripts → lib/core}/agent-skills-external.txt +3 -3
- package/{scripts → lib/core}/agent-skills-lint-test.sh +17 -17
- package/lib/core/agent-skills-lint.sh +115 -0
- package/{scripts → lib/core}/agent-template-lint-test.sh +7 -7
- package/lib/core/agent-template-lint.sh +58 -0
- package/{scripts/lib → lib/core}/board-view-test.sh +3 -3
- package/lib/core/board-view.sh +97 -0
- package/{scripts/lib → lib/core}/branch-owner-test.sh +3 -3
- package/lib/core/branch-owner.sh +201 -0
- package/lib/core/check.sh +125 -0
- package/{scripts/lib → lib/core}/codex-hooks-test.sh +3 -3
- package/{scripts → lib/core}/commitlint-test.sh +6 -6
- package/lib/core/commitlint.sh +54 -0
- package/{scripts/config-path-test.sh → lib/core/config-path-scan-test.sh} +2 -2
- package/{scripts/lib → lib/core}/config-path-test.sh +3 -3
- package/lib/core/config-path.sh +30 -0
- package/{scripts → lib/core}/content-skills-test.sh +17 -17
- package/{scripts → lib/core}/docs-marketing-words-test.sh +2 -2
- package/{scripts → lib/core}/docs-record-tables-test.sh +2 -2
- package/{scripts/lib → lib/core}/effort-metrics-test.sh +6 -6
- package/lib/core/effort-metrics.sh +591 -0
- package/{scripts/lib → lib/core}/effort-slug-test.sh +8 -4
- package/{scripts/lib → lib/core}/effort-slug.sh +8 -7
- package/lib/core/effort.sh +339 -0
- package/{scripts/lib → lib/core}/errors-header-test.sh +19 -9
- package/lib/core/errors-header.exempt +49 -0
- package/{scripts → lib/core}/exec-targets-test.sh +3 -3
- package/lib/core/feature-map.sh +76 -0
- package/lib/core/force-push-fence-test.sh +44 -0
- package/lib/core/force-push-fence.baseline +1 -0
- package/lib/core/force-push-fence.sh +51 -0
- package/{scripts → lib/core}/forge-fence-test.sh +13 -13
- package/{scripts → lib/core}/forge-fence.sh +14 -14
- package/{scripts → lib/core}/forge-report-test.sh +5 -5
- package/{scripts → lib/core}/forge-report.sh +18 -14
- package/{scripts/lib → lib/core}/git-core-test.sh +7 -7
- package/{scripts/lib → lib/core}/git-remote-test.sh +3 -3
- package/{scripts → lib/core}/guard-raw-git-ops-test.sh +4 -4
- package/{scripts → lib/core}/hook-adapter-test.sh +5 -5
- package/{scripts/lib → lib/core}/hook-refresh-test.sh +5 -5
- package/{scripts → lib/core}/instruction-budget-baseline.txt +2 -2
- package/lib/core/instruction-budget-lint.sh +238 -0
- package/{scripts/lib → lib/core}/integration-install-test.sh +12 -12
- package/lib/core/integration-install.sh +257 -0
- package/{scripts/lib → lib/core}/integrations-test.sh +38 -45
- package/lib/core/integrations.sh +244 -0
- package/{scripts/lib → lib/core}/kinds-test.sh +5 -5
- package/lib/core/kinds.sh +66 -0
- package/{scripts/lib → lib/core}/kit-cli-test.sh +1 -1
- package/{scripts/lib → lib/core}/kit-cli.sh +1 -1
- package/{scripts/lib → lib/core}/kit-config-resolve.sh +2 -2
- package/{scripts/lib → lib/core}/kit-config-test.sh +11 -11
- package/lib/core/kit-config.sh +164 -0
- package/{scripts/lib → lib/core}/kit-engine-test.sh +1 -1
- package/lib/core/kit-events.sh +72 -0
- package/lib/core/kit-local.sh +87 -0
- package/{scripts/lib → lib/core}/kit-manifest.sh +1 -1
- package/{scripts/lib → lib/core}/kit-mode-test.sh +1 -1
- package/{scripts/lib → lib/core}/kit-mode.sh +3 -3
- package/{scripts/lib → lib/core}/kit-operate.sh +1 -1
- package/{scripts/lib → lib/core}/kit-profile-test.sh +1 -1
- package/{scripts/lib → lib/core}/kit-profile.sh +2 -2
- package/{scripts/lib → lib/core}/kit-state-test.sh +1 -1
- package/lib/core/knowledge-lint.sh +106 -0
- package/lib/core/layout-fence-test.sh +35 -0
- package/lib/core/layout-fence.allow +15 -0
- package/lib/core/layout-fence.baseline +4 -0
- package/lib/core/layout-fence.sh +50 -0
- package/{scripts → lib/core}/leak-fence-test.sh +10 -10
- package/{scripts/lib → lib/core}/leak-fence.sh +1 -1
- package/lib/core/loose-issues-test.sh +102 -0
- package/lib/core/loose-issues.baseline +5 -0
- package/lib/core/loose-issues.sh +65 -0
- package/{scripts → lib/core}/marketing-walkthrough-test.sh +7 -7
- package/lib/core/naming-test.sh +112 -0
- package/lib/core/naming-verbs-test.sh +126 -0
- package/lib/core/naming.sh +172 -0
- package/{scripts/lib → lib/core}/orchestration-runtime-test.sh +4 -4
- package/{scripts → lib/core}/portable-test.sh +11 -7
- package/{scripts/lib → lib/core}/pr-evidence-test.sh +5 -5
- package/lib/core/pr-evidence.sh +361 -0
- package/{scripts/lib → lib/core}/qa-lane-test.sh +7 -7
- package/{scripts/lib → lib/core}/qa-lane.sh +4 -4
- package/{scripts/lib → lib/core}/qa-lanes-test.sh +5 -5
- package/lib/core/react-detect.sh +79 -0
- package/{scripts/lib → lib/core}/render-test.sh +1 -1
- package/lib/core/resident-context-test.sh +42 -0
- package/lib/core/resident-context.baseline +1 -0
- package/lib/core/resident-context.sh +56 -0
- package/lib/core/review-lint-baseline.txt +28 -0
- package/lib/core/review-lint.sh +266 -0
- package/{scripts → lib/core}/review-rules.conf +1 -1
- package/{scripts/lib → lib/core}/review-stage-test.sh +2 -2
- package/{scripts/lib → lib/core}/role-identity-test.sh +3 -3
- package/lib/core/role-identity.sh +71 -0
- package/{scripts → lib/core}/rule-recipes-test.sh +5 -5
- package/lib/core/secret-guard.sh +116 -0
- package/{scripts → lib/core}/self-install-test.sh +15 -16
- package/{scripts/lib → lib/core}/session-registry-test.sh +1 -1
- package/lib/core/session-registry.sh +233 -0
- package/{scripts → lib/core}/skill-frontmatter-baseline.txt +1 -1
- package/lib/core/skill-frontmatter-lint.sh +189 -0
- package/lib/core/spec-lint-test.sh +63 -0
- package/lib/core/spec-lint.sh +95 -0
- package/{scripts/lib → lib/core}/stage-receipt-test.sh +136 -4
- package/{scripts/lib → lib/core}/stage-receipt.sh +186 -7
- package/{scripts → lib/core}/terms-check-test.sh +6 -6
- package/lib/core/terms-check.sh +244 -0
- package/{scripts/lib → lib/core}/test-env-test.sh +2 -2
- package/{scripts/lib → lib/core}/test-env.sh +1 -1
- package/{scripts → lib/core}/test-runner-test.sh +11 -11
- package/{scripts → lib/core}/test.sh +12 -12
- package/{scripts → lib/core}/update-path-test.sh +3 -3
- package/{scripts → lib/core}/verbs-gen.sh +9 -9
- package/{scripts → lib/core}/verbs-help-test.sh +4 -4
- package/{scripts → lib/core}/verbs-ratchet-test.sh +24 -19
- package/{scripts → lib/core}/verbs-ratchet.sh +8 -8
- package/{scripts → lib/core}/verbs-test.sh +23 -23
- package/lib/core/verbs.baseline +5 -0
- package/{scripts/lib → lib/core}/verbs.sh +3 -3
- package/{scripts/lib → lib/core}/verbs.tsv +22 -20
- package/{scripts/lib → lib/core}/version-bump-test.sh +29 -8
- package/{scripts/lib → lib/core}/version-bump.sh +15 -2
- package/{scripts/lib → lib/core}/wave-result-test.sh +2 -2
- package/{scripts/lib → lib/core}/wave-result.sh +1 -1
- package/{scripts/lib → lib/core}/worker-brief-test.sh +4 -4
- package/{scripts/lib → lib/core}/worker-brief.sh +1 -1
- package/{scripts/lib → lib/core}/worktree-bootstrap-test.sh +1 -1
- package/{scripts/lib → lib/core}/worktree-issue-test.sh +2 -2
- package/lib/core/worktree-issue.sh +172 -0
- package/{scripts/lib → lib/core}/worktree-ports-test.sh +1 -1
- package/{scripts/lib → lib/core}/worktree-start-test.sh +2 -2
- package/lib/core/worktree-start.sh +790 -0
- package/{scripts/lib → lib/core}/zsh-safety-test.sh +11 -11
- package/{scripts/lib → lib/forge}/forge-github.sh +18 -7
- package/{scripts/lib → lib/forge}/forge-test.sh +4 -4
- package/{scripts/lib → lib/forge}/forge.sh +1 -1
- package/lib/forge/gh-board-add-test.sh +118 -0
- package/lib/forge/gh-log.sh +59 -0
- package/lib/forge/gh-project-test.sh +251 -0
- package/lib/forge/gh-project.sh +379 -0
- package/{scripts/lib → lib/forge}/gh-rest-test.sh +17 -13
- package/{scripts/lib → lib/forge}/gh-rest.sh +190 -16
- package/{scripts/lib → lib/forge}/init-github.sh +18 -8
- package/{scripts/lib → lib/forge}/test-forge-shim.sh +2 -1
- package/lib/verbs/PROMPTS.md +146 -0
- package/lib/verbs/annotate-setup.sh +149 -0
- package/{scripts → lib/verbs}/autopilot-run-test.sh +9 -9
- package/{scripts → lib/verbs}/autopilot-run.sh +9 -9
- package/{scripts → lib/verbs}/autopilot-test.sh +7 -6
- package/{scripts → lib/verbs}/autopilot.sh +7 -7
- package/{scripts/lib → lib/verbs}/captain-test.sh +1 -1
- package/{scripts/lib → lib/verbs}/captain.sh +8 -8
- package/lib/verbs/capture-project-ids.sh +99 -0
- package/{scripts/lib → lib/verbs}/content-kinds-gc-test.sh +7 -7
- package/{scripts/lib → lib/verbs}/contribute-root-test.sh +4 -4
- package/{scripts/lib → lib/verbs}/contribute-root.sh +1 -1
- package/{scripts → lib/verbs}/contribute.sh +8 -8
- package/{scripts → lib/verbs}/copilot-loop-test.sh +12 -12
- package/{scripts/lib → lib/verbs}/copilot-test.sh +15 -14
- package/{scripts/lib → lib/verbs}/copilot.sh +19 -19
- package/{scripts → lib/verbs}/database-supabase-test.sh +6 -6
- package/lib/verbs/effort-close-subs-test.sh +96 -0
- package/{scripts/lib → lib/verbs}/effort-dispatch-test.sh +5 -5
- package/{scripts/lib → lib/verbs}/effort-flows-test.sh +5 -5
- package/{scripts/lib → lib/verbs}/effort-ops-test.sh +111 -22
- package/lib/verbs/effort-ops.sh +1571 -0
- package/{scripts/lib → lib/verbs}/effort-parity-test.sh +47 -41
- package/{scripts/lib → lib/verbs}/effort-plan-test.sh +7 -7
- package/lib/verbs/effort-plan.sh +289 -0
- package/lib/verbs/effort-review-test.sh +107 -0
- package/lib/verbs/effort-review.sh +93 -0
- package/lib/verbs/grill-record-test.sh +49 -0
- package/lib/verbs/grill-record.sh +88 -0
- package/{scripts/lib → lib/verbs}/handoff.sh +3 -3
- package/{scripts → lib/verbs}/init-content-test.sh +14 -14
- package/{scripts/lib → lib/verbs}/init-guide.sh +6 -6
- package/{scripts → lib/verbs}/init-guided-test.sh +9 -9
- package/{scripts → lib/verbs}/init-recipes-test.sh +7 -7
- package/{scripts → lib/verbs}/init-upgrade-test.sh +9 -10
- package/lib/verbs/init.sh +1598 -0
- package/{scripts → lib/verbs}/install-test.sh +5 -5
- package/lib/verbs/install.sh +31 -0
- package/{scripts → lib/verbs}/integrations-check-test.sh +9 -9
- package/lib/verbs/integrations-check.sh +157 -0
- package/{scripts → lib/verbs}/kit-add-test.sh +8 -8
- package/lib/verbs/kit-add.sh +415 -0
- package/{scripts → lib/verbs}/kit-adopt-test.sh +4 -4
- package/{scripts → lib/verbs}/kit-adopt.sh +6 -6
- package/{scripts/lib → lib/verbs}/kit-brief-test.sh +44 -15
- package/{scripts/lib → lib/verbs}/kit-brief.sh +101 -16
- package/lib/verbs/kit-bump-version.sh +79 -0
- package/lib/verbs/kit-digest.sh +126 -0
- package/{scripts → lib/verbs}/kit-doctor-test.sh +57 -32
- package/lib/verbs/kit-doctor.sh +991 -0
- package/{scripts → lib/verbs}/kit-export-project-test.sh +4 -4
- package/lib/verbs/kit-export-project.sh +245 -0
- package/{scripts → lib/verbs}/kit-export-training-test.sh +3 -3
- package/lib/verbs/kit-export-training.sh +175 -0
- package/{scripts/lib → lib/verbs}/kit-gc-test.sh +5 -5
- package/lib/verbs/kit-gc.sh +804 -0
- package/{scripts/lib → lib/verbs}/kit-hotfix.sh +3 -3
- package/{scripts/lib → lib/verbs}/kit-interview-test.sh +2 -2
- package/lib/verbs/kit-interview.sh +319 -0
- package/{scripts/lib → lib/verbs}/kit-lib-test.sh +2 -2
- package/{scripts/lib → lib/verbs}/kit-lib.sh +10 -10
- package/{scripts → lib/verbs}/kit-migrate-test.sh +4 -4
- package/{scripts → lib/verbs}/kit-migrate.sh +5 -5
- package/{scripts/lib → lib/verbs}/kit-msg-test.sh +2 -2
- package/{scripts/lib → lib/verbs}/kit-msg.sh +5 -5
- package/{scripts → lib/verbs}/kit-onboard-test.sh +2 -3
- package/lib/verbs/kit-onboard.sh +69 -0
- package/{scripts → lib/verbs}/kit-promote-test.sh +4 -4
- package/{scripts → lib/verbs}/kit-promote.sh +4 -4
- package/{scripts → lib/verbs}/kit-remove-test.sh +4 -4
- package/{scripts → lib/verbs}/kit-remove.sh +5 -5
- package/lib/verbs/kit-routines.sh +322 -0
- package/lib/verbs/kit-self-update.sh +55 -0
- package/{scripts/lib → lib/verbs}/kit-status-test.sh +2 -2
- package/lib/verbs/kit-status.sh +650 -0
- package/{scripts/lib → lib/verbs}/kit-task-ops-test.sh +25 -2
- package/lib/verbs/kit-task-ops.sh +793 -0
- package/{scripts → lib/verbs}/kit-version-check-test.sh +3 -3
- package/lib/verbs/kit-version-check.sh +121 -0
- package/{scripts → lib/verbs}/kit-wire-test.sh +6 -6
- package/{scripts → lib/verbs}/kit-wire.sh +8 -8
- package/{scripts/lib → lib/verbs}/kto-hotfix-test.sh +3 -3
- package/{scripts/lib → lib/verbs}/kto-task-close-test.sh +2 -2
- package/{scripts/lib → lib/verbs}/kto-task-new-test.sh +20 -2
- package/{scripts/lib → lib/verbs}/kto-task-pr-merge-test.sh +46 -2
- package/{scripts/lib → lib/verbs}/kto-task-pr-test.sh +6 -6
- package/{scripts/lib → lib/verbs}/light-task-run-test.sh +4 -4
- package/{scripts/lib → lib/verbs}/light-task-test.sh +9 -9
- package/{scripts/lib → lib/verbs}/light-task.sh +26 -11
- package/{scripts/lib → lib/verbs}/next-test.sh +3 -3
- package/{scripts/lib → lib/verbs}/next.sh +10 -10
- package/{scripts → lib/verbs}/night-grant-test.sh +4 -4
- package/lib/verbs/night-grant.sh +454 -0
- package/{scripts → lib/verbs}/night-run-test.sh +3 -3
- package/{scripts → lib/verbs}/night-run.mjs +2 -2
- package/{scripts → lib/verbs}/orchestrate-test.sh +5 -5
- package/{scripts → lib/verbs}/orchestrate.sh +15 -15
- package/{scripts/lib → lib/verbs}/plan-machine-test.sh +1 -1
- package/{scripts/lib → lib/verbs}/plan-machine.sh +13 -13
- package/{scripts/lib → lib/verbs}/plan-next-test.sh +1 -1
- package/lib/verbs/plan-next.sh +213 -0
- package/{scripts → lib/verbs}/publish.sh +10 -10
- package/{scripts/lib → lib/verbs}/review-page-test.sh +4 -4
- package/lib/verbs/review-page.sh +375 -0
- package/lib/verbs/setup-labels.sh +96 -0
- package/lib/verbs/setup-milestones.sh +34 -0
- package/{scripts → lib/verbs}/showcase.sh +2 -2
- package/lib/verbs/sprint-test.sh +96 -0
- package/lib/verbs/sprint.sh +216 -0
- package/{scripts → lib/verbs}/status-test.sh +8 -8
- package/{scripts → lib/verbs}/status.sh +16 -16
- package/{scripts → lib/verbs}/task-sync-test.sh +40 -6
- package/lib/verbs/task-sync.sh +462 -0
- package/{scripts/lib → lib/verbs}/upgrade-report-test.sh +4 -4
- package/lib/verbs/ux-a11y-scan.sh +96 -0
- package/lib/verbs/ux-ds-audit.sh +146 -0
- package/lib/verbs/ux-graph-scan.sh +188 -0
- package/{scripts → lib/verbs}/wave-worker.sh +2 -2
- package/lib/verbs/web-install.sh +22 -0
- package/package.json +3 -10
- package/scripts/PROMPTS.md +13 -0
- package/scripts/agent-skills-lint.sh +12 -113
- package/scripts/agent-template-lint.sh +12 -56
- package/scripts/annotate-setup.sh +11 -151
- package/scripts/benchmark/checkpoint-test.sh +1 -1
- package/scripts/benchmark/checkpoint.sh +1 -1
- package/scripts/benchmark/gate.sh +2 -2
- package/scripts/benchmark/lib/bench-common.sh +1 -1
- package/scripts/capture-project-ids.sh +12 -70
- package/scripts/check.sh +12 -106
- package/scripts/force-push-fence.sh +14 -0
- package/scripts/init.sh +13 -1637
- package/scripts/install.sh +12 -29
- package/scripts/instruction-budget-lint.sh +13 -218
- package/scripts/integrations-check.sh +12 -155
- package/scripts/kit-add.sh +12 -413
- package/scripts/kit-bump-version.sh +13 -78
- package/scripts/kit-digest.sh +13 -125
- package/scripts/kit-doctor.sh +13 -971
- package/scripts/kit-export-project.sh +12 -243
- package/scripts/kit-export-training.sh +12 -173
- package/scripts/kit-onboard.sh +12 -67
- package/scripts/kit-routines.sh +12 -320
- package/scripts/kit-self-update.sh +12 -53
- package/scripts/kit-version-check.sh +12 -106
- package/scripts/knowledge-lint.sh +13 -98
- package/scripts/lib/board-view.sh +13 -96
- package/scripts/lib/branch-owner.sh +12 -199
- package/scripts/lib/commitlint.sh +12 -52
- package/scripts/lib/config-path.sh +13 -29
- package/scripts/lib/effort-metrics.sh +12 -589
- package/scripts/lib/effort-ops.sh +13 -1243
- package/scripts/lib/effort-plan.sh +12 -287
- package/scripts/lib/effort.sh +13 -365
- package/scripts/lib/gh-log.sh +14 -59
- package/scripts/lib/gh-project.sh +13 -254
- package/scripts/lib/grill-record.sh +14 -0
- package/scripts/lib/integration-install.sh +12 -255
- package/scripts/lib/integrations.sh +12 -242
- package/scripts/lib/kinds.sh +13 -65
- package/scripts/lib/kit-config.sh +12 -165
- package/scripts/lib/kit-events.sh +13 -71
- package/scripts/lib/kit-gc.sh +12 -802
- package/scripts/lib/kit-interview.sh +11 -316
- package/scripts/lib/kit-local.sh +12 -85
- package/scripts/lib/kit-status.sh +12 -648
- package/scripts/lib/kit-task-ops.sh +13 -738
- package/scripts/lib/naming.sh +14 -0
- package/scripts/lib/plan-next.sh +13 -212
- package/scripts/lib/pr-evidence.sh +12 -359
- package/scripts/lib/react-detect.sh +12 -77
- package/scripts/lib/review-page.sh +11 -372
- package/scripts/lib/role-identity.sh +13 -70
- package/scripts/lib/secret-guard.sh +12 -114
- package/scripts/lib/session-registry.sh +13 -232
- package/scripts/lib/spec-lint.sh +14 -0
- package/scripts/lib/worktree-issue.sh +12 -170
- package/scripts/lib/worktree-start.sh +13 -748
- package/scripts/night-grant.sh +12 -452
- package/scripts/review-lint.sh +13 -258
- package/scripts/setup-labels.sh +11 -82
- package/scripts/setup-milestones.sh +12 -21
- package/scripts/skill-frontmatter-lint.sh +13 -181
- package/scripts/task-sync.sh +13 -370
- package/scripts/terms-check.sh +13 -241
- package/scripts/ux-a11y-scan.sh +13 -95
- package/scripts/ux-ds-audit.sh +12 -144
- package/scripts/ux-graph-scan.sh +12 -186
- package/scripts/web-install.sh +16 -20
- package/docs/kit-annotate/01-explainer.html +0 -225
- package/docs/kit-annotate/02-implementation-plan.html +0 -196
- package/docs/media/.onboarding-capture.cast +0 -5
- package/docs/media/README.md +0 -43
- package/docs/media/build-demo.sh +0 -63
- package/docs/media/build-kit-init.sh +0 -51
- package/docs/media/build-onboarding.sh +0 -51
- package/docs/media/kit-dry-run.cast +0 -107
- package/docs/media/kit-dry-run.gif +0 -0
- package/docs/media/kit-init.cast +0 -56
- package/docs/media/kit-init.gif +0 -0
- package/docs/media/kit-onboarding.cast +0 -148
- package/docs/media/kit-onboarding.gif +0 -0
- package/integrations/mempalace.json +0 -28
- package/scripts/lib/gh-project-test.sh +0 -135
- package/scripts/review-lint-baseline.txt +0 -28
- package/scripts/verbs.baseline +0 -5
- package/templates/hooks/mempal_followup.sh.tmpl +0 -97
- package/templates/hooks/mempal_precompact.sh.tmpl +0 -4
- package/templates/hooks/mempal_save.sh.tmpl +0 -4
- package/templates/hooks/mempal_session_start.sh.tmpl +0 -42
- package/templates/rules/mempalace.md +0 -111
- /package/{commands → kit/commands}/kit-docs.md +0 -0
- /package/{commands → kit/commands}/kit-export-training.md +0 -0
- /package/{databases → kit/databases}/supabase/guide.html +0 -0
- /package/{databases → kit/databases}/supabase/nextjs/lib/supabase/client.ts +0 -0
- /package/{databases → kit/databases}/supabase/nextjs/lib/supabase/server.ts +0 -0
- /package/{githooks → kit/githooks}/pre-commit +0 -0
- /package/{integrations → kit/integrations}/emil-design-eng.json +0 -0
- /package/{integrations → kit/integrations}/graft.json +0 -0
- /package/{integrations → kit/integrations}/impeccable.json +0 -0
- /package/{integrations → kit/integrations}/lavish.json +0 -0
- /package/{integrations → kit/integrations}/mlx-lm.json +0 -0
- /package/{integrations → kit/integrations}/web-design-guidelines.json +0 -0
- /package/{recipes → kit/recipes}/nextjs-shadcn.json +0 -0
- /package/{skills → kit/skills}/kit-docs-writer/SKILL.md +0 -0
- /package/{skills → kit/skills}/kit-onboard/SKILL.md +0 -0
- /package/{skills → kit/skills}/kit-security-sweep/SKILL.md +0 -0
- /package/{skills → kit/skills}/kit-ship/SKILL.md +0 -0
- /package/{skills → kit/skills}/kit-ux-audit/references/a11y.md +0 -0
- /package/{skills → kit/skills}/kit-ux-audit/references/consistency.md +0 -0
- /package/{skills → kit/skills}/kit-ux-audit/references/heuristics.md +0 -0
- /package/{templates → kit/templates}/benchmarks/SCHEMA.md +0 -0
- /package/{templates → kit/templates}/benchmarks/abstain.jsonl +0 -0
- /package/{templates → kit/templates}/benchmarks/adversarial.jsonl +0 -0
- /package/{templates → kit/templates}/benchmarks/benchmark.config.json +0 -0
- /package/{templates → kit/templates}/benchmarks/quality.jsonl +0 -0
- /package/{templates → kit/templates}/benchmarks/retrieval.jsonl +0 -0
- /package/{templates → kit/templates}/codex/hooks.json.tmpl +0 -0
- /package/{templates → kit/templates}/hooks/guard-base-branch-commit.sh.tmpl +0 -0
- /package/{templates → kit/templates}/hooks/guard-raw-git-ops.sh.tmpl +0 -0
- /package/{templates → kit/templates}/hooks/kit-local-status.sh.tmpl +0 -0
- /package/{templates → kit/templates}/hooks/kit_version_check.sh.tmpl +0 -0
- /package/{templates → kit/templates}/hooks/prepush_gate.sh.tmpl +0 -0
- /package/{templates → kit/templates}/hooks/repo-hygiene.sh.tmpl +0 -0
- /package/{templates → kit/templates}/knowledge-INDEX.md.tmpl +0 -0
- /package/{templates → kit/templates}/lib/kit-sigil.sh.tmpl +0 -0
- /package/{templates → kit/templates}/rules/code-retrieval.md +0 -0
- /package/{templates → kit/templates}/rules/communication-style.md +0 -0
- /package/{templates → kit/templates}/rules/design-routing.md +0 -0
- /package/{templates → kit/templates}/rules/issue-lifecycle.md +0 -0
- /package/{templates → kit/templates}/rules/knowledge-base.md +0 -0
- /package/{templates → kit/templates}/rules/plain-language.md +0 -0
- /package/{templates → kit/templates}/rules/plan-output-format.md +0 -0
- /package/{templates → kit/templates}/rules/review-pages.md +0 -0
- /package/{templates → kit/templates}/rules/risk-tiered-review.md +0 -0
- /package/{templates → kit/templates}/rules/shared-checkout.md +0 -0
- /package/{templates → kit/templates}/rules/skill-gaps.md +0 -0
- /package/{templates → kit/templates}/rules/task-management.md +0 -0
- /package/{templates → kit/templates}/settings/settings.json.tmpl +0 -0
- /package/{templates → kit/templates}/settings/settings.local.json.tmpl +0 -0
- /package/{templates → kit/templates}/skills/NAMESPACED +0 -0
- /package/{templates → kit/templates}/skills/brand-voice/SKILL.md +0 -0
- /package/{templates → kit/templates}/skills/brand-voice/references/voice-template.md +0 -0
- /package/{templates → kit/templates}/skills/campaign/references/plan-template.md +0 -0
- /package/{templates → kit/templates}/skills/concrete/SKILL.md +0 -0
- /package/{templates → kit/templates}/skills/copywriting/SKILL.md +0 -0
- /package/{templates → kit/templates}/skills/copywriting/references/copy-frameworks.md +0 -0
- /package/{templates → kit/templates}/skills/copywriting/references/natural-transitions.md +0 -0
- /package/{templates → kit/templates}/skills/feature-build-refine/SKILL.md +0 -0
- /package/{templates → kit/templates}/skills/karpathy-guidelines/SKILL.md +0 -0
- /package/{templates → kit/templates}/skills/morning-briefing/SKILL.md +0 -0
- /package/{templates → kit/templates}/skills/page-design/SKILL.md +0 -0
- /package/{templates → kit/templates}/skills/page-design/add.json +0 -0
- /package/{templates → kit/templates}/skills/page-design/references/design-file-template.md +0 -0
- /package/{templates → kit/templates}/skills/page-design/references/generic-page-patterns.md +0 -0
- /package/{templates → kit/templates}/skills/page-design/references/minimum-rules.md +0 -0
- /package/{templates → kit/templates}/skills/speckit/SKILL.md +0 -0
- /package/{templates → kit/templates}/skills/supabase-patterns/SKILL.md +0 -0
- /package/{scripts/lib → lib/core}/adapter-select.sh +0 -0
- /package/{scripts/lib → lib/core}/agent-launch.sh +0 -0
- /package/{scripts/lib → lib/core}/agent-profile.sh +0 -0
- /package/{scripts/lib → lib/core}/cckit-output.sh +0 -0
- /package/{scripts/lib → lib/core}/codex-hooks.sh +0 -0
- /package/{scripts → lib/core}/forge-fence.baseline +0 -0
- /package/{scripts/lib → lib/core}/git-remote.sh +0 -0
- /package/{scripts/lib → lib/core}/hook-refresh.sh +0 -0
- /package/{scripts → lib/core}/instruction-budget-lint-test.sh +0 -0
- /package/{scripts/lib → lib/core}/kit-state.sh +0 -0
- /package/{scripts/lib → lib/core}/orchestration-runtime.sh +0 -0
- /package/{scripts/lib → lib/core}/project-scan.sh +0 -0
- /package/{scripts/lib → lib/core}/render.sh +0 -0
- /package/{scripts → lib/core}/review-lint-test.sh +0 -0
- /package/{scripts/lib → lib/core}/review-stage.sh +0 -0
- /package/{scripts → lib/core}/skill-frontmatter-lint-test.sh +0 -0
- /package/{scripts/lib → lib/core}/task-source-file.sh +0 -0
- /package/{scripts/lib → lib/core}/task-source.sh +0 -0
- /package/{scripts/lib → lib/core}/toon.sh +0 -0
- /package/{scripts/lib → lib/core}/ui.sh +0 -0
- /package/{scripts/lib → lib/forge}/forge-none.sh +0 -0
- /package/{scripts → lib/verbs}/debug.sh +0 -0
- /package/{scripts → lib/verbs}/night-run.test.mjs +0 -0
- /package/{scripts/lib → lib/verbs}/upgrade-report.sh +0 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# resident-context.sh — the resident-context ratchet for this repository.
|
|
3
|
+
#
|
|
4
|
+
# Resident context is what an agent session loads before it reads a single file of the task:
|
|
5
|
+
# AGENTS.md, a root CLAUDE.md if there is one, and every `.claude/rules/*.md` with no `paths:`
|
|
6
|
+
# frontmatter (counted by instruction-budget-lint.sh --resident-bytes). The total may not grow past
|
|
7
|
+
# the number in lib/core/resident-context.baseline. Lower the baseline in the change that shrinks
|
|
8
|
+
# the total; raise it only on purpose.
|
|
9
|
+
#
|
|
10
|
+
# lib/core/resident-context.sh check against the baseline (rc 1 one byte over)
|
|
11
|
+
# lib/core/resident-context.sh --bytes the current total, a bare number
|
|
12
|
+
# lib/core/resident-context.sh --update write the current total as the baseline
|
|
13
|
+
#
|
|
14
|
+
# RESIDENT_CONTEXT_ROOT measures another directory (the test points it at a fixture).
|
|
15
|
+
# errors: strict — rc 1 over the baseline, rc 2 on a missing or unreadable baseline
|
|
16
|
+
set -uo pipefail
|
|
17
|
+
LC_ALL=C
|
|
18
|
+
export LC_ALL
|
|
19
|
+
|
|
20
|
+
HERE="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
|
21
|
+
ROOT="${RESIDENT_CONTEXT_ROOT:-$(cd "$HERE/../.." && pwd)}"
|
|
22
|
+
BASELINE="$ROOT/lib/core/resident-context.baseline"
|
|
23
|
+
|
|
24
|
+
resident_bytes() {
|
|
25
|
+
local total=0 rules
|
|
26
|
+
[ -f "$ROOT/AGENTS.md" ] && total="$(wc -c < "$ROOT/AGENTS.md" | tr -d ' ')"
|
|
27
|
+
# CLAUDE.md, CLAUDE.local.md, .claude/CLAUDE.md and the resident rules.
|
|
28
|
+
rules="$(INSTRUCTION_BUDGET_ROOT="$ROOT" bash "$HERE/instruction-budget-lint.sh" --resident-bytes)" || return 1
|
|
29
|
+
printf '%s\n' "$(( total + ${rules:-0} ))"
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
case "${1:-check}" in
|
|
33
|
+
--bytes) resident_bytes; exit $? ;;
|
|
34
|
+
--update)
|
|
35
|
+
now="$(resident_bytes)" || exit 2
|
|
36
|
+
printf '%s\n' "$now" > "$BASELINE"
|
|
37
|
+
echo "ok wrote $BASELINE ($now bytes)"; exit 0 ;;
|
|
38
|
+
check) ;;
|
|
39
|
+
*) echo "usage: resident-context.sh [--bytes|--update]" >&2; exit 2 ;;
|
|
40
|
+
esac
|
|
41
|
+
|
|
42
|
+
[ -r "$BASELINE" ] || { echo "x no baseline at $BASELINE — run: lib/core/resident-context.sh --update" >&2; exit 2; }
|
|
43
|
+
base="$(tr -d ' \n' < "$BASELINE")"
|
|
44
|
+
case "$base" in ''|*[!0-9]*) echo "x baseline is not a number: $BASELINE" >&2; exit 2 ;; esac
|
|
45
|
+
now="$(resident_bytes)" || exit 2
|
|
46
|
+
if [ "$now" -gt "$base" ]; then
|
|
47
|
+
echo "x resident context grew to $now bytes, over the baseline of $base"
|
|
48
|
+
echo " move a section out of AGENTS.md, or give a rule a paths: frontmatter; raise the baseline only on purpose"
|
|
49
|
+
exit 1
|
|
50
|
+
fi
|
|
51
|
+
if [ "$now" -lt "$base" ]; then
|
|
52
|
+
echo "ok resident context $now bytes, under the baseline of $base — lower it: lib/core/resident-context.sh --update"
|
|
53
|
+
else
|
|
54
|
+
echo "ok resident context $now bytes (baseline $base)"
|
|
55
|
+
fi
|
|
56
|
+
exit 0
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# review-lint-baseline.txt — generated by lib/core/review-lint.sh --update
|
|
2
|
+
# Pre-existing hits, GRANDFATHERED per file: they may stay, but may never grow, and a
|
|
3
|
+
# file not listed here must have zero hits. Fix a file and re-run --update to tighten.
|
|
4
|
+
#
|
|
5
|
+
# <RULE>\t<path>\t<count> (TAB-separated: a path may contain a space)
|
|
6
|
+
refs-word-splitting lib/verbs/effort-ops-test.sh 1
|
|
7
|
+
fence-missing-language .claude/rules/branch-naming.md 1
|
|
8
|
+
fence-missing-language .claude/rules/effort-model.md 1
|
|
9
|
+
fence-missing-language .claude/skills/karpathy-guidelines/SKILL.md 1
|
|
10
|
+
fence-missing-language CONTRIBUTING.md 1
|
|
11
|
+
fence-missing-language README.md 1
|
|
12
|
+
fence-missing-language kit/skills/kit-autopilot/SKILL.md 2
|
|
13
|
+
fence-missing-language kit/skills/kit-dev/SKILL.md 1
|
|
14
|
+
fence-missing-language kit/skills/kit-next/SKILL.md 3
|
|
15
|
+
fence-missing-language kit/skills/kit-plan-next/SKILL.md 2
|
|
16
|
+
fence-missing-language kit/skills/kit-task-sync/SKILL.md 1
|
|
17
|
+
fence-missing-language kit/skills/kit-ux-audit/references/graph-model.md 2
|
|
18
|
+
fence-missing-language kit/skills/kit-ux-audit/references/heuristics.md 1
|
|
19
|
+
fence-missing-language kit/templates/agents/security.md 1
|
|
20
|
+
fence-missing-language kit/templates/agents/ux.md 1
|
|
21
|
+
fence-missing-language kit/templates/rules/branch-naming.md 1
|
|
22
|
+
fence-missing-language kit/templates/rules/effort-model.md 1
|
|
23
|
+
fence-missing-language kit/templates/rules/plan-next.md 1
|
|
24
|
+
fence-missing-language kit/templates/rules/plan-output-format.md 1
|
|
25
|
+
fence-missing-language kit/templates/skills/copywriting/references/copy-frameworks.md 5
|
|
26
|
+
fence-missing-language kit/templates/skills/feature-build-refine/SKILL.md 2
|
|
27
|
+
fence-missing-language kit/templates/skills/karpathy-guidelines/SKILL.md 1
|
|
28
|
+
fence-missing-language kit/templates/skills/speckit/SKILL.md 2
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# review-lint.sh — codified review findings as a deterministic gate (kit-owned).
|
|
3
|
+
#
|
|
4
|
+
# WHY: an AI reviewer (CodeRabbit) finds the same classes of defect over and over, but its findings
|
|
5
|
+
# live in PR threads and die there. Anything MECHANICAL in that stream — a pattern that is wrong
|
|
6
|
+
# every time it appears, regardless of intent — belongs in a gate that runs in under a second and
|
|
7
|
+
# never forgets. This file is that gate; `review-rules.conf` is the rule table, one block per rule,
|
|
8
|
+
# each carrying the PR it was earned from.
|
|
9
|
+
#
|
|
10
|
+
# WHAT IT IS NOT: a replacement for review. Only the mechanical slice maps here. Findings that need
|
|
11
|
+
# intent — doc-vs-code drift, architectural contracts, "is this the right abstraction" — stay with
|
|
12
|
+
# the reviewer. Do not force those into regexes; a noisy gate is worse than no gate.
|
|
13
|
+
#
|
|
14
|
+
# scripts/review-lint.sh lint against the baseline (the gate)
|
|
15
|
+
# scripts/review-lint.sh --report every rule's current hit count; never fails
|
|
16
|
+
# scripts/review-lint.sh --rule <ID> show every hit for one rule, with context
|
|
17
|
+
# scripts/review-lint.sh --update re-baseline from current hits
|
|
18
|
+
#
|
|
19
|
+
# Baseline: scripts/review-lint-baseline.txt ("<RULE> <path> <count>"). Grandfathers today's hits
|
|
20
|
+
# per file so adding a rule never forces a repo-wide fix; only NEW or GROWN hits fail.
|
|
21
|
+
# bash 3.2 compatible (no associative arrays, no mapfile).
|
|
22
|
+
set -uo pipefail
|
|
23
|
+
|
|
24
|
+
# This script ships to projects as scripts/review-lint.sh and lives in lib/core/ in the cckit repo
|
|
25
|
+
# (#600): the project root is one level up there, two levels up here.
|
|
26
|
+
_kit_self="$(cd "$(dirname "$0")" && pwd)"
|
|
27
|
+
case "$_kit_self" in
|
|
28
|
+
*/lib/core) ROOT="$(cd "$_kit_self/../.." && pwd)" ;;
|
|
29
|
+
*) ROOT="$(cd "$_kit_self/.." && pwd)" ;;
|
|
30
|
+
esac
|
|
31
|
+
_kit_home="${_kit_self#"$ROOT"/}" # scripts in a project, lib/core in the cckit repo
|
|
32
|
+
cd "$ROOT"
|
|
33
|
+
|
|
34
|
+
RULES="$_kit_home/review-rules.conf"
|
|
35
|
+
BASELINE="$_kit_home/review-lint-baseline.txt"
|
|
36
|
+
|
|
37
|
+
FAIL=0
|
|
38
|
+
err() { echo "x $1"; FAIL=1; }
|
|
39
|
+
ok() { echo "ok $1"; }
|
|
40
|
+
note() { echo " $1"; }
|
|
41
|
+
|
|
42
|
+
[ -f "$RULES" ] || { echo "review-lint: no $RULES — nothing to enforce"; exit 0; }
|
|
43
|
+
|
|
44
|
+
# ---- rule table access ------------------------------------------------------
|
|
45
|
+
rule_ids() { awk '/^\[.+\]$/ { gsub(/^\[|\]$/, ""); print }' "$RULES"; }
|
|
46
|
+
|
|
47
|
+
# rule_field <id> <key> — value of one key inside one [id] block ("" if unset).
|
|
48
|
+
rule_field() {
|
|
49
|
+
awk -v id="$1" -v key="$2" '
|
|
50
|
+
/^\[.+\]$/ { cur = $0; gsub(/^\[|\]$/, "", cur); inblk = (cur == id); next }
|
|
51
|
+
!inblk { next }
|
|
52
|
+
index($0, key ":") == 1 { sub("^" key ":[ \t]*", ""); print; exit }
|
|
53
|
+
' "$RULES"
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
# ---- file selection ---------------------------------------------------------
|
|
57
|
+
# Scope/exclude are comma-separated shell patterns matched with `case`, where `*` DOES cross `/`
|
|
58
|
+
# (case patterns are not pathname expansion). So `scripts/*` matches `scripts/lib/foo.sh`.
|
|
59
|
+
# Tracked files when there are any; otherwise a filesystem walk. The fallback matters for a
|
|
60
|
+
# freshly scaffolded project, where the kit has written files but nothing is staged yet -
|
|
61
|
+
# `git ls-files` is empty there, and without this the gate would silently scan nothing.
|
|
62
|
+
#
|
|
63
|
+
# KIT_LINT_WALK=1 forces the walk. Seeding a baseline needs it: init.sh scaffolds into a repo that
|
|
64
|
+
# usually ALREADY has commits, so `git ls-files` is non-empty and the just-written kit files are
|
|
65
|
+
# invisible to it. `--update` then grandfathers nothing, and the gate turns red the moment the user
|
|
66
|
+
# commits the scaffold - failing on templates the kit itself shipped. "Seed once so a fresh project
|
|
67
|
+
# starts green" only holds if the seed can see the whole tree, tracked or not.
|
|
68
|
+
list_files() {
|
|
69
|
+
local tracked
|
|
70
|
+
if [ "${KIT_LINT_WALK:-0}" != "1" ]; then
|
|
71
|
+
tracked="$(git ls-files 2>/dev/null)"
|
|
72
|
+
if [ -n "$tracked" ]; then printf '%s\n' "$tracked"; return 0; fi
|
|
73
|
+
fi
|
|
74
|
+
find . -type f \
|
|
75
|
+
-not -path './.git/*' -not -path '*/node_modules/*' \
|
|
76
|
+
-not -path './dist/*' -not -path './.cckit/*' 2>/dev/null | sed 's|^\./||'
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
files_for_rule() {
|
|
80
|
+
local scope exclude f keep pat
|
|
81
|
+
scope="$(rule_field "$1" scope)"
|
|
82
|
+
exclude="$(rule_field "$1" exclude)"
|
|
83
|
+
[ -n "$scope" ] || scope='*'
|
|
84
|
+
list_files | while IFS= read -r f; do
|
|
85
|
+
# Never lint the rule table or the baseline: both quote the very patterns they describe,
|
|
86
|
+
# so scanning them makes every rule match itself.
|
|
87
|
+
case "$f" in "$RULES"|"$BASELINE") continue ;; esac
|
|
88
|
+
keep=0
|
|
89
|
+
IFS=',' read -r -a _scopes <<< "$(printf '%s' "$scope" | tr -d ' ')"
|
|
90
|
+
for pat in "${_scopes[@]}"; do
|
|
91
|
+
[ -n "$pat" ] || continue
|
|
92
|
+
case "$f" in $pat) keep=1; break ;; esac
|
|
93
|
+
done
|
|
94
|
+
[ "$keep" -eq 1 ] || continue
|
|
95
|
+
if [ -n "$exclude" ]; then
|
|
96
|
+
IFS=',' read -r -a _excl <<< "$(printf '%s' "$exclude" | tr -d ' ')"
|
|
97
|
+
for pat in "${_excl[@]}"; do
|
|
98
|
+
[ -n "$pat" ] || continue
|
|
99
|
+
case "$f" in $pat) keep=0; break ;; esac
|
|
100
|
+
done
|
|
101
|
+
fi
|
|
102
|
+
[ "$keep" -eq 1 ] && printf '%s\n' "$f"
|
|
103
|
+
done
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
# ---- matching ---------------------------------------------------------------
|
|
107
|
+
# Emits "path:line:text" for every hit of one rule.
|
|
108
|
+
#
|
|
109
|
+
# code_only drops FULL-LINE comments only (first non-blank char is `#`). It deliberately does not
|
|
110
|
+
# strip trailing comments: in shell `#` is ambiguous (`${v#p}`, `$#`, `'#'`), so stripping it would
|
|
111
|
+
# corrupt real code lines. Use `ignore:` for the rest.
|
|
112
|
+
hits_for_rule() {
|
|
113
|
+
local id="$1" kind pattern prog ignore code_only flist
|
|
114
|
+
kind="$(rule_field "$id" kind)"
|
|
115
|
+
ignore="$(rule_field "$id" ignore)"
|
|
116
|
+
code_only="$(rule_field "$id" code_only)"
|
|
117
|
+
|
|
118
|
+
flist="$(files_for_rule "$id")"
|
|
119
|
+
[ -n "$flist" ] || return 0
|
|
120
|
+
|
|
121
|
+
# Two rule kinds. `regex` (the default) is a per-line grep — enough for most findings. `awk` is
|
|
122
|
+
# for rules that need STATE across lines, such as fence parity: a bare ``` is only a defect when
|
|
123
|
+
# it OPENS a block, and no per-line pattern can know that. An awk rule supplies a one-line program
|
|
124
|
+
# that prints FILENAME":"FNR":"$0 for each hit and resets its state on FNR==1.
|
|
125
|
+
if [ "$kind" = "awk" ]; then
|
|
126
|
+
prog="$(rule_field "$id" awk)"
|
|
127
|
+
[ -n "$prog" ] || return 0
|
|
128
|
+
printf '%s\n' "$flist" \
|
|
129
|
+
| tr '\n' '\0' \
|
|
130
|
+
| xargs -0 awk "$prog" 2>/dev/null
|
|
131
|
+
else
|
|
132
|
+
pattern="$(rule_field "$id" pattern)"
|
|
133
|
+
[ -n "$pattern" ] || return 0
|
|
134
|
+
printf '%s\n' "$flist" \
|
|
135
|
+
| tr '\n' '\0' \
|
|
136
|
+
| xargs -0 grep -nE -- "$pattern" /dev/null 2>/dev/null
|
|
137
|
+
fi \
|
|
138
|
+
| awk -v co="${code_only:-false}" -v ig="${ignore:-}" '
|
|
139
|
+
{
|
|
140
|
+
body = $0
|
|
141
|
+
sub(/^[^:]*:[0-9]+:/, "", body)
|
|
142
|
+
if (co == "true") { t = body; sub(/^[ \t]+/, "", t); if (substr(t, 1, 1) == "#") next }
|
|
143
|
+
if (ig != "" && body ~ ig) next
|
|
144
|
+
print
|
|
145
|
+
}
|
|
146
|
+
'
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
# count_by_file — read "path:line:text" hits on stdin, emit "<path><TAB><count>", path-sorted.
|
|
150
|
+
#
|
|
151
|
+
# The obvious `uniq -c | awk '{ print $2, $1 }'` keeps only the FIRST whitespace token of the path,
|
|
152
|
+
# so `docs/my file.md` is recorded as `docs/my`. Two offending files sharing that prefix then
|
|
153
|
+
# collapse onto one row and are both compared against a single baseline entry - the second file's
|
|
154
|
+
# hits pass unnoticed. Counting in awk, keyed on the whole path, and separating with a TAB (which
|
|
155
|
+
# cannot occur in the paths git reports) keeps the field boundary unambiguous for every reader.
|
|
156
|
+
count_by_file() {
|
|
157
|
+
awk -F: '{ c[$1]++ } END { for (p in c) printf "%s\t%s\n", p, c[p] }' | LC_ALL=C sort
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
# baseline_count <rule> <path> — the recorded count, 0 when absent.
|
|
161
|
+
#
|
|
162
|
+
# Reads BOTH layouts. Rows are written TAB-separated so a path with a space survives, but a project
|
|
163
|
+
# upgrading from an earlier kit still has a space-separated baseline on disk; refusing to read it
|
|
164
|
+
# would report every grandfathered file as a new hit and turn the gate red on upgrade.
|
|
165
|
+
baseline_count() {
|
|
166
|
+
[ -f "$BASELINE" ] || { echo 0; return; }
|
|
167
|
+
grep -v '^[[:space:]]*#' "$BASELINE" 2>/dev/null \
|
|
168
|
+
| awk -v r="$1" -v p="$2" '
|
|
169
|
+
{ n = index($0, "\t") ? split($0, F, "\t") : split($0, F, " ") }
|
|
170
|
+
n >= 3 && F[1] == r && F[2] == p { print F[3]; found = 1; exit }
|
|
171
|
+
END { if (!found) print 0 }
|
|
172
|
+
'
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
MODE="${1:-lint}"
|
|
176
|
+
ARG="${2:-}"
|
|
177
|
+
|
|
178
|
+
# The one place the baseline filename is spelled, so init.sh's "seed once" guard cannot go looking
|
|
179
|
+
# for a name that does not exist.
|
|
180
|
+
if [ "$MODE" = "--baseline-path" ]; then
|
|
181
|
+
printf '%s\n' "$BASELINE"
|
|
182
|
+
exit 0
|
|
183
|
+
fi
|
|
184
|
+
|
|
185
|
+
# ---- --rule <ID> ------------------------------------------------------------
|
|
186
|
+
if [ "$MODE" = "--rule" ]; then
|
|
187
|
+
[ -n "$ARG" ] || { echo "usage: review-lint.sh --rule <ID>"; exit 2; }
|
|
188
|
+
grep -qx "$ARG" <<<"$(rule_ids)" || { echo "x unknown rule '$ARG'"; exit 2; }
|
|
189
|
+
echo "[$ARG] $(rule_field "$ARG" title)"
|
|
190
|
+
echo " why: $(rule_field "$ARG" why)"
|
|
191
|
+
echo " source: $(rule_field "$ARG" source)"
|
|
192
|
+
echo
|
|
193
|
+
hits_for_rule "$ARG" | sed 's/^/ /'
|
|
194
|
+
echo
|
|
195
|
+
echo " $(hits_for_rule "$ARG" | grep -c . | tr -d ' ') hit(s)"
|
|
196
|
+
exit 0
|
|
197
|
+
fi
|
|
198
|
+
|
|
199
|
+
# ---- --report ---------------------------------------------------------------
|
|
200
|
+
if [ "$MODE" = "--report" ]; then
|
|
201
|
+
printf '%-26s %5s %s\n' RULE HITS TITLE
|
|
202
|
+
rule_ids | while IFS= read -r id; do
|
|
203
|
+
[ -n "$id" ] || continue
|
|
204
|
+
printf '%-26s %5s %s\n' "$id" "$(hits_for_rule "$id" | grep -c . | tr -d ' ')" "$(rule_field "$id" title)"
|
|
205
|
+
done
|
|
206
|
+
exit 0
|
|
207
|
+
fi
|
|
208
|
+
|
|
209
|
+
# ---- --update ---------------------------------------------------------------
|
|
210
|
+
if [ "$MODE" = "--update" ]; then
|
|
211
|
+
{
|
|
212
|
+
echo "# review-lint-baseline.txt — generated by scripts/review-lint.sh --update"
|
|
213
|
+
echo "# Pre-existing hits, GRANDFATHERED per file: they may stay, but may never grow, and a"
|
|
214
|
+
echo "# file not listed here must have zero hits. Fix a file and re-run --update to tighten."
|
|
215
|
+
echo "#"
|
|
216
|
+
echo "# <RULE>\t<path>\t<count> (TAB-separated: a path may contain a space)"
|
|
217
|
+
rule_ids | while IFS= read -r id; do
|
|
218
|
+
[ -n "$id" ] || continue
|
|
219
|
+
hits_for_rule "$id" | count_by_file \
|
|
220
|
+
| awk -v r="$id" -F"\t" '{ printf "%s\t%s\t%s\n", r, $1, $2 }'
|
|
221
|
+
done
|
|
222
|
+
} > "$BASELINE"
|
|
223
|
+
echo "ok wrote $BASELINE ($(grep -cv '^[[:space:]]*#' "$BASELINE" | tr -d ' ') grandfathered file(s))"
|
|
224
|
+
exit 0
|
|
225
|
+
fi
|
|
226
|
+
|
|
227
|
+
# ---- lint (the gate) --------------------------------------------------------
|
|
228
|
+
total=0
|
|
229
|
+
grandfathered=0
|
|
230
|
+
while IFS= read -r id; do
|
|
231
|
+
[ -n "$id" ] || continue
|
|
232
|
+
title="$(rule_field "$id" title)"
|
|
233
|
+
why="$(rule_field "$id" why)"
|
|
234
|
+
src="$(rule_field "$id" source)"
|
|
235
|
+
|
|
236
|
+
# Per-file counts for this rule, "<path><TAB><count>".
|
|
237
|
+
counts="$(hits_for_rule "$id" | count_by_file)"
|
|
238
|
+
[ -n "$counts" ] || continue
|
|
239
|
+
|
|
240
|
+
while IFS="$(printf '\t')" read -r path n; do
|
|
241
|
+
[ -n "$path" ] || continue
|
|
242
|
+
[ "$n" -ge 0 ] 2>/dev/null || continue
|
|
243
|
+
total=$(( total + n ))
|
|
244
|
+
base="$(baseline_count "$id" "$path")"
|
|
245
|
+
if [ "$n" -gt "$base" ]; then
|
|
246
|
+
if [ "$base" -eq 0 ]; then
|
|
247
|
+
err "[$id] $path: $n hit(s) — $title"
|
|
248
|
+
else
|
|
249
|
+
err "[$id] $path: grew to $n hit(s) (baseline $base) — $title"
|
|
250
|
+
fi
|
|
251
|
+
note "why: $why"
|
|
252
|
+
note "source: $src"
|
|
253
|
+
hits_for_rule "$id" | awk -F: -v p="$path" '$1 == p' | sed -n 1,3p | sed 's/^/ /'
|
|
254
|
+
note "see all: scripts/review-lint.sh --rule $id"
|
|
255
|
+
else
|
|
256
|
+
grandfathered=$(( grandfathered + n ))
|
|
257
|
+
fi
|
|
258
|
+
done <<EOF
|
|
259
|
+
$counts
|
|
260
|
+
EOF
|
|
261
|
+
done < <(rule_ids)
|
|
262
|
+
|
|
263
|
+
if [ "$FAIL" -eq 0 ]; then
|
|
264
|
+
ok "review rules clean ($(rule_ids | grep -c . | tr -d ' ') rule(s), $grandfathered grandfathered hit(s))"
|
|
265
|
+
fi
|
|
266
|
+
exit "$FAIL"
|
|
@@ -52,7 +52,7 @@ scope: *.md, *.mdx
|
|
|
52
52
|
exclude: docs-site/node_modules/*, CHANGELOG.md, .github/*
|
|
53
53
|
awk: FNR==1{inb=0;fence=""} match($0,/^[ \t]*(`{3,}|~{3,})/){m=substr($0,RSTART,RLENGTH);sub(/^[ \t]+/,"",m);rest=substr($0,RSTART+RLENGTH);sub(/^[ \t]+/,"",rest);sub(/[ \t]+$/,"",rest);if(!inb){inb=1;fence=m;if(rest=="")print FILENAME":"FNR":"$0}else if(substr(m,1,1)==substr(fence,1,1)&&length(m)>=length(fence)&&rest==""){inb=0;fence=""}}
|
|
54
54
|
note: tracks the OPENING fence's char and length. A parity counter (n%2) breaks on a 4-backtick outer fence - the normal way to show a fenced block inside a fenced block: it counts the ```` line but never reports it, leaving n odd so every later CLOSING fence is reported as a bare opener. ~~~ fences were invisible to it entirely.
|
|
55
|
-
source: coderabbit PR#276 (templates/rules/naming-and-ids.md, "Add language identifiers to the fenced code blocks")
|
|
55
|
+
source: coderabbit PR#276 (kit/templates/rules/naming-and-ids.md, "Add language identifiers to the fenced code blocks")
|
|
56
56
|
|
|
57
57
|
[pipe-into-early-exit-reader]
|
|
58
58
|
title: do not pipe into a reader that stops early (`| grep -q`, `| head -N`) — read from a variable, or use a reader that consumes all input
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
# end to end — brief on stdin, report on stdout, receipt on disk — with no agent, no gh and no
|
|
6
6
|
# network. The one thing stubbed is ap_pr_context, which is the gh-touching half of resolution and
|
|
7
7
|
# already has its own coverage in agent-resolve-test.sh.
|
|
8
|
-
# Run: bash
|
|
8
|
+
# Run: bash lib/core/review-stage-test.sh
|
|
9
9
|
# errors: strict — a test runner: rc 1 on any failed assertion
|
|
10
10
|
# shellcheck shell=bash
|
|
11
11
|
set -u
|
|
@@ -17,7 +17,7 @@ tmp="$(mktemp -d)"; trap 'rm -rf "$tmp"' EXIT
|
|
|
17
17
|
# Point the receipt store at the temp dir BEFORE sourcing, so nothing writes into the real .cckit/.
|
|
18
18
|
export KIT_STATE_DIR="$tmp/state"
|
|
19
19
|
# shellcheck source=/dev/null
|
|
20
|
-
source "$ROOT/
|
|
20
|
+
source "$ROOT/lib/core/review-stage.sh"
|
|
21
21
|
|
|
22
22
|
fail=0
|
|
23
23
|
t() { if [ "$2" = "$3" ]; then echo "ok: $1"; else echo "FAIL: $1 -> got '[$2]' want '[$3]'"; fail=1; fi; }
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# role-identity-test.sh — every role a shipped profile declares resolves to a display name, so the
|
|
3
3
|
# commit author, the PR signature and the board Role are never empty for it (#416).
|
|
4
4
|
# Runs the helpers under bash AND zsh. Hermetic: no network, no gh, no files written.
|
|
5
|
-
# Run: bash
|
|
5
|
+
# Run: bash lib/core/role-identity-test.sh
|
|
6
6
|
# errors: strict — a test runner: rc 1 on any failed assertion
|
|
7
7
|
|
|
8
8
|
dir=$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd)
|
|
@@ -11,7 +11,7 @@ root=$(CDPATH='' cd -- "$dir/../.." && pwd)
|
|
|
11
11
|
if [ -n "${ROLE_TEST_INNER:-}" ]; then
|
|
12
12
|
unset KIT_ROLES KIT_ROLE_EMAIL_DOMAIN KIT_AGENT_LABEL
|
|
13
13
|
. "$dir/role-identity.sh"
|
|
14
|
-
. "$dir/gh-project.sh"
|
|
14
|
+
. "$dir/../forge/gh-project.sh"
|
|
15
15
|
fail=0
|
|
16
16
|
eq() { if [ "$2" != "$3" ]; then echo "FAIL($ROLE_TEST_INNER): $1 -> '[$2]', want '[$3]'"; fail=1; fi; }
|
|
17
17
|
|
|
@@ -51,7 +51,7 @@ done
|
|
|
51
51
|
# Every role of every shipped profile has a display name equal to the profile's own spelling.
|
|
52
52
|
command -v jq >/dev/null 2>&1 || { echo "skip: jq missing — profile roles not checked"; exit "$fail"; }
|
|
53
53
|
. "$dir/role-identity.sh"
|
|
54
|
-
for f in "$root"/profiles/*.json; do
|
|
54
|
+
for f in "$root"/kit/profiles/*.json; do
|
|
55
55
|
roles="$(jq -r '.roles[]' "$f")"
|
|
56
56
|
old_ifs="$IFS"; IFS='
|
|
57
57
|
'
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# role-identity.sh — cheap per-role identity (NO separate GitHub accounts).
|
|
3
|
+
#
|
|
4
|
+
# Maps a role slug (designer, backend, tech-lead, …) to a git commit AUTHOR and a
|
|
5
|
+
# one-line signature. The GitHub actor stays the maintainer's token — this only sets
|
|
6
|
+
# the commit *author* and a signature line so a role's work READS as that role.
|
|
7
|
+
# Real distinct handles/avatars are a separate, heavier effort (bot accounts / GitHub App).
|
|
8
|
+
#
|
|
9
|
+
# Source it: source scripts/lib/role-identity.sh
|
|
10
|
+
#
|
|
11
|
+
# Tunables (env):
|
|
12
|
+
# KIT_ROLE_EMAIL_DOMAIN synthetic author-email domain (default: agents.local — not a real inbox)
|
|
13
|
+
# KIT_AGENT_LABEL suffix in the author/sig label (default: agent)
|
|
14
|
+
# errors: pure — maps a role slug to an author + signature; an unknown slug prints an empty line
|
|
15
|
+
KIT_ROLE_EMAIL_DOMAIN="${KIT_ROLE_EMAIL_DOMAIN:-agents.local}"
|
|
16
|
+
KIT_AGENT_LABEL="${KIT_AGENT_LABEL:-agent}"
|
|
17
|
+
|
|
18
|
+
# role_display <slug> -> human label (empty for unknown/blank)
|
|
19
|
+
# The fixed list covers every role a shipped profile declares. A slug outside it resolves through
|
|
20
|
+
# the project's own roles (KIT_ROLES, newline-delimited display names from `roles` in the config,
|
|
21
|
+
# exported by load_kit_config): "Brand Lead" answers for `brand-lead`. So a role a project adds to
|
|
22
|
+
# its config signs its commits and pull requests without a code change here (#416).
|
|
23
|
+
role_display() {
|
|
24
|
+
local _rd_role _rd_slug
|
|
25
|
+
case "$1" in
|
|
26
|
+
editor) echo "Editor"; return 0 ;;
|
|
27
|
+
researcher) echo "Researcher"; return 0 ;;
|
|
28
|
+
analyst) echo "Analyst"; return 0 ;;
|
|
29
|
+
automation) echo "Automation"; return 0 ;;
|
|
30
|
+
generalist) echo "Generalist"; return 0 ;;
|
|
31
|
+
esac
|
|
32
|
+
case "$1" in
|
|
33
|
+
designer) echo "Designer" ;;
|
|
34
|
+
devops) echo "DevOps" ;;
|
|
35
|
+
pm) echo "PM" ;;
|
|
36
|
+
frontend) echo "Frontend" ;;
|
|
37
|
+
tauri) echo "Tauri" ;;
|
|
38
|
+
ai-eng) echo "AI Eng" ;;
|
|
39
|
+
security) echo "Security" ;;
|
|
40
|
+
qa) echo "QA" ;;
|
|
41
|
+
tech-lead) echo "Tech Lead" ;;
|
|
42
|
+
research) echo "Research" ;;
|
|
43
|
+
backend) echo "Backend" ;;
|
|
44
|
+
'') echo "" ;;
|
|
45
|
+
*)
|
|
46
|
+
# No pipe and no `<<<`: this file is sourced by bash 3.2 and zsh, and the loop must set the
|
|
47
|
+
# answer in this shell.
|
|
48
|
+
while IFS= read -r _rd_role; do
|
|
49
|
+
[ -n "$_rd_role" ] || continue
|
|
50
|
+
_rd_slug="$(printf '%s' "$_rd_role" | tr '[:upper:]' '[:lower:]' | tr ' ' '-')"
|
|
51
|
+
if [ "$_rd_slug" = "$1" ]; then printf '%s\n' "$_rd_role"; return 0; fi
|
|
52
|
+
done <<_RD_EOF
|
|
53
|
+
${KIT_ROLES:-}
|
|
54
|
+
_RD_EOF
|
|
55
|
+
echo "" ;;
|
|
56
|
+
esac
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
# role_git_author <slug> -> "Name|email" (empty when no/unknown role: caller keeps the default identity)
|
|
60
|
+
role_git_author() {
|
|
61
|
+
local d; d="$(role_display "$1")"
|
|
62
|
+
[[ -z "$d" ]] && return 0
|
|
63
|
+
printf '%s (%s)|%s@%s' "$d" "$KIT_AGENT_LABEL" "$1" "$KIT_ROLE_EMAIL_DOMAIN"
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
# role_signature <slug> -> one markdown line for issue/PR bodies (empty when no role)
|
|
67
|
+
role_signature() {
|
|
68
|
+
local d; d="$(role_display "$1")"
|
|
69
|
+
[[ -z "$d" ]] && return 0
|
|
70
|
+
printf -- '— %s · %s (acting via the maintainer account)' "$d" "$KIT_AGENT_LABEL"
|
|
71
|
+
}
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
# scaffolded project, is the project's own scripts/lib, where `cckit init` never copied it.
|
|
11
11
|
#
|
|
12
12
|
# The recipe lines are READ OUT OF the rule files and executed, so the rule and the test cannot
|
|
13
|
-
# drift apart. Network-free. Run: bash
|
|
13
|
+
# drift apart. Network-free. Run: bash lib/core/rule-recipes-test.sh
|
|
14
14
|
|
|
15
15
|
set -uo pipefail
|
|
16
|
-
ROOT=$(CDPATH='' cd -- "$(dirname -- "$0")
|
|
16
|
+
ROOT=$(CDPATH='' cd -- "$(dirname -- "$0")/../.." && pwd)
|
|
17
17
|
|
|
18
18
|
fail=0
|
|
19
19
|
t() { # t <label> <got> <want>
|
|
@@ -41,7 +41,7 @@ git -C "$repo" -c user.email=t@example.com -c user.name=t commit -q --allow-empt
|
|
|
41
41
|
git -C "$repo" worktree add -q "$work/linked" -b linked >/dev/null 2>&1
|
|
42
42
|
mkdir -p "$work/linked/deep"
|
|
43
43
|
|
|
44
|
-
for rule in templates/rules/shared-checkout.md .claude/rules/shared-checkout.md; do
|
|
44
|
+
for rule in kit/templates/rules/shared-checkout.md .claude/rules/shared-checkout.md; do
|
|
45
45
|
recipe="$(primary_recipe "$ROOT/$rule")"
|
|
46
46
|
t "$rule: recipe found" "$([ -n "$recipe" ] && echo yes || echo no)" "yes"
|
|
47
47
|
[ -n "$recipe" ] || continue
|
|
@@ -68,7 +68,7 @@ else
|
|
|
68
68
|
}
|
|
69
69
|
JSON
|
|
70
70
|
# The --upgrade path is the network-free scaffold (no doctor, no gh) init-upgrade-test.sh uses.
|
|
71
|
-
CLAUDE_PLUGIN_ROOT="$ROOT" bash "$ROOT/
|
|
71
|
+
CLAUDE_PLUGIN_ROOT="$ROOT" bash "$ROOT/lib/verbs/init.sh" --upgrade --target "$proj" --force >/dev/null 2>&1 \
|
|
72
72
|
|| { echo "FAIL: scaffold exited non-zero"; exit 1; }
|
|
73
73
|
|
|
74
74
|
rule="$proj/.claude/rules/gate-and-review.md"
|
|
@@ -83,7 +83,7 @@ JSON
|
|
|
83
83
|
|
|
84
84
|
# The row above the recipe says `cckit lib` lists the helper: that is the directory kit_lib_dir
|
|
85
85
|
# resolves for this project, so the helper has to be in it.
|
|
86
|
-
libdir="$(cd "$proj" && env -u KIT_LIB_DIR bash -c '. "$1/
|
|
86
|
+
libdir="$(cd "$proj" && env -u KIT_LIB_DIR bash -c '. "$1/lib/verbs/kit-lib.sh"; kit_lib_dir "$2"' _ "$ROOT" "$proj")"
|
|
87
87
|
t "kit_lib_dir resolves the project's own library" "$libdir" "$proj/scripts/lib"
|
|
88
88
|
t "that library holds pr-evidence.sh" "$([ -f "$libdir/pr-evidence.sh" ] && echo yes || echo no)" "yes"
|
|
89
89
|
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# secret-guard.sh — agnostic secret + privacy guard. Ensures cckit never publishes secrets,
|
|
3
|
+
# key material, env files, or YOUR private project data. NOTHING project-specific is hardcoded:
|
|
4
|
+
# the secret/key patterns are universal, and "what is private to me" is supplied by the user via
|
|
5
|
+
# an optional, gitignored denylist (.cckit/privacy-denylist) — cckit ships only an .example.
|
|
6
|
+
#
|
|
7
|
+
# Applies to EVERYTHING publishable — code, docs, cookbook, examples, templates.
|
|
8
|
+
# Usage: source secret-guard.sh && secret_guard_scan [file...] (default: git-tracked files)
|
|
9
|
+
# exit 0 = clean, 1 = a finding (with a report on stderr).
|
|
10
|
+
# errors: strict — rc 1 on a finding — a scan that cannot run is not a clean scan
|
|
11
|
+
|
|
12
|
+
# kit-state.sh resolves the shared .cckit/ so the private denylist is found from any worktree.
|
|
13
|
+
# BASH_SOURCE is bash-only and empty in zsh (#313), hence the portable self-locate.
|
|
14
|
+
if [ -n "${BASH_SOURCE:-}" ]; then
|
|
15
|
+
_sg_self="$BASH_SOURCE"
|
|
16
|
+
elif [ -n "${ZSH_VERSION:-}" ]; then
|
|
17
|
+
eval '_sg_self="${(%):-%x}"'
|
|
18
|
+
else
|
|
19
|
+
_sg_self="$0"
|
|
20
|
+
fi
|
|
21
|
+
if [ -f "$(dirname "$_sg_self")/kit-state.sh" ]; then
|
|
22
|
+
# shellcheck source=kit-state.sh
|
|
23
|
+
. "$(dirname "$_sg_self")/kit-state.sh"
|
|
24
|
+
fi
|
|
25
|
+
unset _sg_self
|
|
26
|
+
|
|
27
|
+
# Files that must never be committed (by basename). Env files include .env.example/.sample —
|
|
28
|
+
# even an example leaks your variable *names* and structure, so it stays local.
|
|
29
|
+
_sg_forbidden_name() {
|
|
30
|
+
case "$1" in
|
|
31
|
+
.env|.env.*|*.env) return 0 ;;
|
|
32
|
+
*.pem|*.key|*.p12|*.pfx|*.keystore|*.jks|id_rsa|id_rsa.*|id_ed25519|id_ed25519.*) return 0 ;;
|
|
33
|
+
.netrc|.pgpass|.npmrc|credentials|credentials.*|secrets.json|secrets.yaml|secrets.yml|*.tfvars) return 0 ;;
|
|
34
|
+
*.project-ids*|.project-ids.env) return 0 ;;
|
|
35
|
+
*) return 1 ;;
|
|
36
|
+
esac
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
# Universal high-signal secret content patterns (provider key prefixes, private-key blocks).
|
|
40
|
+
# Written so the patterns do not match their own literal text.
|
|
41
|
+
_sg_secret_patterns() {
|
|
42
|
+
cat <<'PAT'
|
|
43
|
+
-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----
|
|
44
|
+
AKIA[0-9A-Z]{16}
|
|
45
|
+
ASIA[0-9A-Z]{16}
|
|
46
|
+
sk-[A-Za-z0-9]{20,}
|
|
47
|
+
sk-proj-[A-Za-z0-9_-]{20,}
|
|
48
|
+
gh[pousr]_[A-Za-z0-9]{36,}
|
|
49
|
+
github_pat_[A-Za-z0-9_]{50,}
|
|
50
|
+
AIza[0-9A-Za-z_-]{35}
|
|
51
|
+
xox[baprs]-[0-9A-Za-z-]{10,}
|
|
52
|
+
sk_live_[0-9A-Za-z]{24,}
|
|
53
|
+
rk_live_[0-9A-Za-z]{24,}
|
|
54
|
+
glpat-[0-9A-Za-z_-]{20,}
|
|
55
|
+
eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}
|
|
56
|
+
PAT
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
# Generic "assignment of a real-looking secret value" — allows placeholders (<...>, ${...},
|
|
60
|
+
# YOUR_, example, changeme, xxxx, redacted, placeholder).
|
|
61
|
+
_sg_assign_pattern='(api[_-]?key|secret|password|passwd|access[_-]?token|auth[_-]?token|client[_-]?secret|private[_-]?key)["'"'"' ]*[:=]+[ ]*["'"'"'][^"'"'"'$<{ ]{8,}'
|
|
62
|
+
|
|
63
|
+
secret_guard_scan() {
|
|
64
|
+
local files findings=0 f line denylist
|
|
65
|
+
if [ "$#" -gt 0 ]; then files=("$@"); else
|
|
66
|
+
# default: git-tracked + staged, minus this guard + the example denylist (avoid self-match)
|
|
67
|
+
mapfile -t files < <(git ls-files 2>/dev/null | grep -vE '(scripts/lib|lib/core)/secret-guard\.sh|privacy-denylist\.example' || true)
|
|
68
|
+
fi
|
|
69
|
+
|
|
70
|
+
# (a) forbidden filenames
|
|
71
|
+
for f in "${files[@]:-}"; do
|
|
72
|
+
[ -z "$f" ] && continue
|
|
73
|
+
if _sg_forbidden_name "$(basename "$f")"; then
|
|
74
|
+
echo "x secret-guard: forbidden file must not be committed: $f" >&2; findings=$((findings+1))
|
|
75
|
+
fi
|
|
76
|
+
done
|
|
77
|
+
|
|
78
|
+
# (b) universal secret content patterns
|
|
79
|
+
local pat
|
|
80
|
+
while IFS= read -r pat; do
|
|
81
|
+
[ -z "$pat" ] && continue
|
|
82
|
+
while IFS= read -r line; do
|
|
83
|
+
[ -z "$line" ] && continue
|
|
84
|
+
echo "x secret-guard: secret-like content: $line" >&2; findings=$((findings+1))
|
|
85
|
+
done < <(printf '%s\n' "${files[@]:-}" | tr '\n' '\0' | xargs -0 grep -nIE "$pat" 2>/dev/null | sed -n 1,20p)
|
|
86
|
+
done < <(_sg_secret_patterns)
|
|
87
|
+
|
|
88
|
+
# (c) generic secret assignment (placeholders allowed)
|
|
89
|
+
while IFS= read -r line; do
|
|
90
|
+
[ -z "$line" ] && continue
|
|
91
|
+
case "$line" in *YOUR_*|*example*|*EXAMPLE*|*placeholder*|*changeme*|*xxxx*|*redacted*|*'<'*|*'${'*) continue ;; esac
|
|
92
|
+
echo "x secret-guard: secret-like assignment: $line" >&2; findings=$((findings+1))
|
|
93
|
+
done < <(printf '%s\n' "${files[@]:-}" | tr '\n' '\0' | xargs -0 grep -niIE "$_sg_assign_pattern" 2>/dev/null | sed -n 1,20p)
|
|
94
|
+
|
|
95
|
+
# (d) user-supplied privacy denylist (agnostic: YOU declare what is yours; file stays local)
|
|
96
|
+
# Resolve against the shared .cckit/, not the CWD: the denylist is the user's declaration of what
|
|
97
|
+
# is private, and a CWD-relative path meant it was silently NOT loaded from any worktree — the
|
|
98
|
+
# scan ran weaker there than in the primary checkout, with no indication it had.
|
|
99
|
+
if command -v kit_state_file >/dev/null 2>&1; then denylist="$(kit_state_file privacy-denylist)"
|
|
100
|
+
else denylist=".cckit/privacy-denylist"; fi
|
|
101
|
+
if [ -f "$denylist" ]; then
|
|
102
|
+
while IFS= read -r term; do
|
|
103
|
+
term="$(printf '%s' "$term" | sed 's/#.*//;s/^[[:space:]]*//;s/[[:space:]]*$//')"
|
|
104
|
+
[ -z "$term" ] && continue
|
|
105
|
+
while IFS= read -r line; do
|
|
106
|
+
[ -z "$line" ] && continue
|
|
107
|
+
echo "x secret-guard: private term '$term' present: $line" >&2; findings=$((findings+1))
|
|
108
|
+
done < <(printf '%s\n' "${files[@]:-}" | tr '\n' '\0' | xargs -0 grep -nIF "$term" 2>/dev/null | sed -n 1,10p)
|
|
109
|
+
done < "$denylist"
|
|
110
|
+
fi
|
|
111
|
+
|
|
112
|
+
if [ "$findings" -gt 0 ]; then
|
|
113
|
+
echo "✗ secret-guard: $findings finding(s) — refusing to proceed" >&2; return 1
|
|
114
|
+
fi
|
|
115
|
+
return 0
|
|
116
|
+
}
|