shipgate-cli 0.0.0-stage → 0.2.2

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.
Files changed (123) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +261 -2
  3. package/agents/context-builder.md +158 -0
  4. package/agents/debug-executor.md +234 -0
  5. package/assets/gates/classifier.js +245 -0
  6. package/assets/gates/dsh/index.js +767 -0
  7. package/assets/gates/dsh/policy.json +93 -0
  8. package/assets/gates/index.js +3 -0
  9. package/assets/gates/pi/index.js +1131 -0
  10. package/assets/gates/pi/policy.json +93 -0
  11. package/assets/gates/policy.js +4267 -0
  12. package/assets/gates/profiles/ai4s-dry-lab.json +64 -0
  13. package/assets/gates/profiles/ai4s-quant.json +36 -0
  14. package/assets/pi-extensions/auto-continue.ts +176 -0
  15. package/assets/pi-extensions/goal-mode.ts +313 -0
  16. package/bin/shipgate.mjs +9 -0
  17. package/commands/ai-spec.md +9 -0
  18. package/commands/api-first.md +33 -0
  19. package/commands/code-review.md +7 -0
  20. package/commands/codebase-context.md +19 -0
  21. package/commands/debug-ui.md +147 -0
  22. package/commands/debug.md +101 -0
  23. package/commands/dev-env-scan.md +18 -0
  24. package/commands/dev-host-init.md +28 -0
  25. package/commands/discover-skill-opportunities.md +33 -0
  26. package/commands/fork-sync.md +17 -0
  27. package/commands/gh-actions.md +26 -0
  28. package/commands/goal-driven-development.md +7 -0
  29. package/commands/intent-grill.md +7 -0
  30. package/commands/iteration-manager.md +7 -0
  31. package/commands/loop-engineer.md +21 -0
  32. package/commands/nodejs-npm-auto-release.md +12 -0
  33. package/commands/prd.md +7 -0
  34. package/commands/project-health-audit.md +7 -0
  35. package/commands/ralph-yolo.md +346 -0
  36. package/commands/ralph.md +226 -0
  37. package/commands/security-audit.md +7 -0
  38. package/commands/ux-experience-audit.md +133 -0
  39. package/docs/ARCHITECTURE.md +63 -0
  40. package/docs/GATES.md +106 -0
  41. package/docs/HARNESS.md +257 -0
  42. package/package.json +48 -4
  43. package/references/ADR-FORMAT.md +67 -0
  44. package/references/CONTEXT-FORMAT.md +62 -0
  45. package/references/mcp-config-template.json +54 -0
  46. package/scripts/fix-skill-frontmatter.mjs +66 -0
  47. package/scripts/migrate-skillpack.mjs +257 -0
  48. package/skills/ai-spec/SKILL.md +90 -0
  49. package/skills/api-first-modular/SKILL.md +411 -0
  50. package/skills/code-debugger/SKILL.md +379 -0
  51. package/skills/code-review/SKILL.md +62 -0
  52. package/skills/codebase-context/SKILL.md +139 -0
  53. package/skills/debug-ui/SKILL.md +220 -0
  54. package/skills/dev-env-scan/SKILL.md +147 -0
  55. package/skills/dev-host-init/SKILL.md +198 -0
  56. package/skills/dev-host-init/scripts/fill-placeholders.py +226 -0
  57. package/skills/dev-host-init/scripts/host-scan.ps1 +159 -0
  58. package/skills/dev-host-init/scripts/host-scan.sh +201 -0
  59. package/skills/dev-host-init/scripts/render-now.py +488 -0
  60. package/skills/dev-host-init/scripts/tools-catalog.py +229 -0
  61. package/skills/dev-host-init/templates/graph-first-gate.ts +291 -0
  62. package/skills/dev-host-init/templates/host-injection.template.md +725 -0
  63. package/skills/discover-skill-opportunities/SKILL.md +145 -0
  64. package/skills/discover-skill-opportunities/references/accounting-finance-ops.md +24 -0
  65. package/skills/discover-skill-opportunities/references/business-consulting.md +24 -0
  66. package/skills/discover-skill-opportunities/references/evidence-and-privacy.md +39 -0
  67. package/skills/discover-skill-opportunities/references/finance-investment.md +24 -0
  68. package/skills/discover-skill-opportunities/references/legal-and-compliance.md +24 -0
  69. package/skills/discover-skill-opportunities/references/output-contract.md +75 -0
  70. package/skills/discover-skill-opportunities/references/product-and-operations.md +24 -0
  71. package/skills/discover-skill-opportunities/references/quant-trading.md +24 -0
  72. package/skills/discover-skill-opportunities/references/scientific-research.md +24 -0
  73. package/skills/discover-skill-opportunities/references/scoring-rubric.md +45 -0
  74. package/skills/discover-skill-opportunities/references/session-skill-review.md +78 -0
  75. package/skills/discover-skill-opportunities/references/software-development.md +24 -0
  76. package/skills/fork-sync/SKILL.md +86 -0
  77. package/skills/gh-actions-architect/SKILL.md +395 -0
  78. package/skills/goal-driven-development/SKILL.md +132 -0
  79. package/skills/intent-grill/SKILL.md +46 -0
  80. package/skills/iteration-manager/SKILL.md +53 -0
  81. package/skills/loop-engineer/SKILL.md +108 -0
  82. package/skills/nodejs-npm-auto-release/SKILL.md +141 -0
  83. package/skills/prd/SKILL.md +63 -0
  84. package/skills/project-health-audit/SKILL.md +64 -0
  85. package/skills/ralph/SKILL.md +329 -0
  86. package/skills/ralph-yolo/SKILL.md +623 -0
  87. package/skills/security-audit/SKILL.md +114 -0
  88. package/skills/security-audit/references/audit-checklist.md +135 -0
  89. package/skills/security-audit/references/evidence-conventions.md +54 -0
  90. package/skills/security-audit/references/findings-schema.md +37 -0
  91. package/skills/security-audit/references/stack-signatures.md +66 -0
  92. package/skills/shipgate/SKILL.md +40 -0
  93. package/skills/shipgate-install/SKILL.md +87 -0
  94. package/skills/shipgate-quality/SKILL.md +80 -0
  95. package/skills/shipgate-security/SKILL.md +97 -0
  96. package/skills/shipgate-spec/SKILL.md +67 -0
  97. package/skills/ux-experience-audit/SKILL.md +202 -0
  98. package/src/cli.mjs +118 -0
  99. package/src/commands/ask.mjs +82 -0
  100. package/src/commands/deploy.mjs +587 -0
  101. package/src/commands/gates.mjs +83 -0
  102. package/src/commands/policy.mjs +116 -0
  103. package/src/gates/quality.mjs +123 -0
  104. package/src/gates/security.mjs +92 -0
  105. package/src/gates/ship.mjs +74 -0
  106. package/src/gates/spec.mjs +88 -0
  107. package/src/harness/index.mjs +203 -0
  108. package/src/inject/render.mjs +75 -0
  109. package/src/lib/cfg.mjs +66 -0
  110. package/src/lib/duration.mjs +41 -0
  111. package/src/lib/engines.mjs +182 -0
  112. package/src/lib/exec.mjs +80 -0
  113. package/src/lib/fsx.mjs +119 -0
  114. package/src/lib/gate.mjs +329 -0
  115. package/src/lib/log.mjs +31 -0
  116. package/src/lib/skills.mjs +347 -0
  117. package/src/lib/state.mjs +50 -0
  118. package/src/lib/update.mjs +67 -0
  119. package/src/version.mjs +14 -0
  120. package/templates/agents-snippet.md +82 -0
  121. package/templates/dev-profile.schema.json +119 -0
  122. package/templates/prd.json.example +64 -0
  123. package/templates/rule.json.example +28 -0
@@ -0,0 +1,93 @@
1
+ {
2
+ "name": "graph-first-gate",
3
+ "version": 6,
4
+ "description": "Enforce the rules document instead of trusting the model to follow it. v4 (2026-10-31) closes the gaps found in a full audit of a real host: (1) a turn-level no-slack rule at turn_end catches 'I'll do it later' replies that use no tools at all; (2) read evidence now expires (inspected_ttl_ms) instead of unlocking a file for the whole session; (3) Layer 2 index freshness works without a repo-local .codebase-memory marker by using the session's successful index_repository/detect_changes timestamp; (4) the block cap is a 30-minute sliding window of 200, not a lifetime 30; (5) PowerShell and MCP-gateway calls go through the same read/write/destructive checks as bash; (6) machine-local project_roots can override the policy from ~/.config/agent-config-bridge/gate-policy.json without putting paths in this public repo; (7) a bare email is no longer treated as a credential, only a credential field next to one; (8) an unreadable policy degrades to safety-only checks instead of disappearing. v5 (2026-11-04) adds domain profiles: a three-level classifier (fingerprint, strong keyword, injected model) picks ai4s-dry-lab / ai4s-quant / general-dev once per user turn and the gate applies that profile's extra checks. general-dev means base checks only - the v4 behaviour exactly. Any classification failure degrades to general-dev instead of blocking. v6 (2026-11-16) turns the CHG-contract rule from 'opened one contract file' into 'a standing contract': the tasks/CHG-<id>/ directory must actually contain SPEC.md + PRD.md + TRACEABILITY.md, the SPEC must name an acceptance condition, an explicitly declared draft status is refused, and the contract must belong to the repository being edited (reading another repo's CHG no longer unlocks this one).",
5
+ "reminder": "[system-reminder · 三层代码阅读 + 动脑子 + 不偷懒 · 每轮生效]\nLayer 0 动脑子:改代码前先回答五问——项目约定?环境现状?字面背后的真实需求?任务目的?产出价值?没读过目标文件、没判根因,不要动手。\nLayer 1 图谱:read 代码文件前先用 codebase-memory MCP(search_graph / trace_path / get_code_snippet / query_graph / get_architecture / search_code)查结构与调用关系。空结果不算合规:先查 index_status / 重新索引,回图谱重查。\nLayer 2 索引:项目未索引或索引过期(代码比索引新)时,先 index_repository / detect_changes,完成后回到 Layer 1——不允许索引完直接 read。\nLayer 3 直读:仅当重索引后图谱仍无法满足(非代码文件、图谱查不到、本会话自己改动的文件)才直读。\n闸门强度:有内容的图谱查询给 10 分钟窗口;查询点名的文件/包另给 30 分钟作用域解锁。bash 的 cat / grep -r / git show / find -exec / sed -i / 重定向写文件同样受管;PowerShell 的 Get-Content / Set-Content / Remove-Item 同样受管。\n改已存在文件需要:本会话在有效期内读过它(默认 30 分钟),或图谱点名过它;改之前还要读项目约定(AGENTS.md / CLAUDE.md / CONTRIBUTING.md / .cursorrules,存在才要求)。\n破坏性命令分两档:删 $HOME / 删 cwd / 含 .. 的路径 / 磁盘格式化 / 裸设备写入是红线,任何授权都不放行;受保护工作区(config.protected_worktrees 登记的目录,未提交的内容就是正在运行的状态)里的 git stash / reset --hard / clean -f / checkout -- . 等清场命令同样是红线、任何模式都不放行——git status 看着「脏」不等于可以收拾,普通仓库的 git stash 不受影响;普通删除、git 历史重写、强推、DDL 等按类别授权(默认询问,主人可用 /gate grant|ask|deny 调整,agent 不能自己改授权表);被确认弹窗卡住(尤其彻夜跑)时可提示主人 /gate mode bypass 8h 临时放开破坏性命令——到期自动回 enforce,红线仍拦,其他门控不受影响;同一条失败命令原样重试第 3 次也会被拦。\n轮次级不偷懒:一轮结束时只输出「稍后再补 / 后续再做 / 先不实现」而不动工具,会被要求继续做完;确实阻塞就写清阻塞点。\n拦截上限只作用于研究规则,且按 30 分钟窗口重置;凭据写入、越界写入、破坏性命令永远生效。门控配置读不出来时降级为安全底线并显式告警。\n\n[ai-spec 门控 · 改代码前必过]\n改任何代码文件前,本会话必须读过**本项目**一份**成立**的 CHG 契约:tasks/CHG-<id>/ 下 SPEC.md + PRD.md + TRACEABILITY.md 三件齐全、SPEC 写明验收判据、status 不是 draft。只写一个 SPEC.md 不算立项;读别的仓库的 CHG 不算数。\n五问:属于哪个 CHG?四件套齐吗?目标文件在独占清单里吗?改完哪条 AC 变绿?先判根因还是打补丁?\n开发中发现的问题当场修,不许留给「后续」;收尾必须达成该 CHG 的预定功能目标,而不是「大部分做完」。",
6
+ "checks": [
7
+ "no-write-outside",
8
+ "no-secret-write",
9
+ "no-destructive-bash",
10
+ "no-self-grant",
11
+ "index-freshness-before-read",
12
+ "graph-before-read",
13
+ "bash-graph-before-read",
14
+ "think-before-write",
15
+ "chg-contract-before-edit",
16
+ "no-blind-retry"
17
+ ],
18
+ "default_profile": "general-dev",
19
+ "profiles": ["ai4s-dry-lab", "ai4s-quant"],
20
+ "classifier": {
21
+ "enabled": true,
22
+ "model_judge": false,
23
+ "timeout_ms": 8000,
24
+ "external_judge": {
25
+ "enabled": false,
26
+ "note": "kept as a field only; calling an external judge is out of scope for v5"
27
+ }
28
+ },
29
+ "config": {
30
+ "project_roots": [],
31
+ "exclude_globs": [
32
+ "**/node_modules/**",
33
+ "**/vendor/**",
34
+ "**/dist/**",
35
+ "**/build/**",
36
+ "**/.git/**",
37
+ "**/site-packages/**",
38
+ "**/.venv/**",
39
+ "**/target/**"
40
+ ],
41
+ "max_blocks_per_session": 200,
42
+ "block_cap_reset_ms": 1800000,
43
+ "signal_ttl_ms": 600000,
44
+ "unlock_ttl_ms": 1800000,
45
+ "inspected_ttl_ms": 1800000,
46
+ "bash_read_check": true,
47
+ "index_marker": ".codebase-memory",
48
+ "index_mtime_epsilon_ms": 2000,
49
+ "index_mtime_ttl_ms": 30000,
50
+ "graph_signal_requires_content": true,
51
+ "graph_signal_min_chars": 40,
52
+ "require_target_evidence": true,
53
+ "require_conventions": true,
54
+ "convention_files": ["AGENTS.md", "CLAUDE.md", "CONTRIBUTING.md", ".cursorrules"],
55
+ "require_chg_contract": true,
56
+ "chg_contract_globs": [
57
+ "**/tasks/CHG-*/SPEC.md",
58
+ "**/tasks/CHG-*/PRD.md",
59
+ "**/tasks/CHG-*/CHANGE.md",
60
+ "**/tasks/CHG-*/TRACEABILITY.md"
61
+ ],
62
+ "chg_contract_scope_globs": [],
63
+ "chg_contract_required_files": ["SPEC.md", "PRD.md", "TRACEABILITY.md"],
64
+ "chg_acceptance_markers": ["验收", "AC-", "断言", "可判定", "Acceptance"],
65
+ "chg_status_allow": ["approved", "executing", "active", "in-progress", "in_progress"],
66
+ "chg_status_fields": ["status", "state"],
67
+ "max_identical_failures": 2,
68
+ "retry_window_ms": 600000,
69
+ "slack_check": true,
70
+ "slack_max_continues": 2,
71
+ "slack_patterns": [],
72
+ "destructive_allow_patterns": [],
73
+ "destructive_confirm_mode": true,
74
+ "destructive_grants": {
75
+ "delete": "confirm",
76
+ "git-history": "confirm",
77
+ "git-force-push": "confirm",
78
+ "db-ddl": "deny",
79
+ "perm-recursive": "confirm",
80
+ "process-kill": "confirm",
81
+ "raw-write": "confirm"
82
+ },
83
+ "destructive_mode": "enforce",
84
+ "destructive_mode_until": 0,
85
+ "protected_worktrees": [],
86
+ "profiles_dir": "profiles",
87
+ "worklog_path": "docs/WORKLOG.md",
88
+ "worklog_ttl_ms": 1800000,
89
+ "result_dirs": [],
90
+ "readme_prefix": "README_",
91
+ "script_log_check": true
92
+ }
93
+ }