repo-harness 0.2.3 → 0.2.4
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/README.es.md +1 -1
- package/README.fr.md +1 -1
- package/README.ja.md +1 -1
- package/README.md +42 -43
- package/README.zh-CN.md +33 -31
- package/SKILL.md +32 -20
- package/assets/hooks/prompt-guard.sh +166 -3
- package/assets/initializer-question-pack.v4.json +81 -1
- package/assets/initializer-question-pack.v4.schema.json +36 -2
- package/assets/partials/04-project-structure.partial.md +10 -0
- package/assets/partials/06-cloudflare.partial.md +10 -5
- package/assets/partials-agents/07-cloudflare.partial.md +4 -5
- package/assets/plan-map.json +52 -7
- package/assets/project-structures/tanstack-start-workers.txt +51 -0
- package/assets/project-structures/vite-tanstack.txt +8 -1
- package/assets/reference-configs/agentic-development-flow.md +1 -1
- package/assets/reference-configs/development-protocol.md +2 -1
- package/assets/reference-configs/document-generation.md +1 -1
- package/assets/reference-configs/harness-overview.md +1 -1
- package/assets/reference-configs/release-deploy.md +20 -2
- package/assets/skill-commands/repo-harness-architecture/SKILL.md +6 -0
- package/assets/skill-commands/repo-harness-autoplan/SKILL.md +10 -0
- package/assets/skill-commands/repo-harness-capability/SKILL.md +6 -0
- package/assets/skill-commands/repo-harness-check/SKILL.md +18 -1
- package/assets/skill-commands/repo-harness-deploy/SKILL.md +6 -0
- package/assets/skill-commands/repo-harness-handoff/SKILL.md +6 -0
- package/assets/skill-commands/repo-harness-init/SKILL.md +6 -0
- package/assets/skill-commands/repo-harness-migrate/SKILL.md +10 -0
- package/assets/skill-commands/repo-harness-plan/SKILL.md +6 -0
- package/assets/skill-commands/repo-harness-repair/SKILL.md +6 -0
- package/assets/skill-commands/repo-harness-review/SKILL.md +6 -0
- package/assets/skill-commands/repo-harness-scaffold/SKILL.md +6 -0
- package/assets/skill-commands/repo-harness-ship/SKILL.md +10 -0
- package/assets/skill-commands/repo-harness-upgrade/SKILL.md +10 -0
- package/assets/templates/helpers/check-agent-tooling.sh +9 -2
- package/assets/templates/helpers/check-task-workflow.sh +49 -0
- package/assets/templates/helpers/codex-handoff-resume.sh +2 -4
- package/assets/templates/helpers/prepare-codex-handoff.sh +1 -1
- package/assets/templates/helpers/prepare-handoff.sh +6 -0
- package/assets/templates/tech-stack.template.md +14 -0
- package/docs/reference-configs/agentic-development-flow.md +1 -1
- package/docs/reference-configs/development-protocol.md +2 -1
- package/docs/reference-configs/document-generation.md +1 -1
- package/docs/reference-configs/harness-overview.md +1 -1
- package/docs/reference-configs/release-deploy.md +20 -2
- package/package.json +2 -2
- package/scripts/assemble-template.ts +153 -6
- package/scripts/check-agent-tooling.sh +9 -2
- package/scripts/check-npm-release.sh +3 -0
- package/scripts/check-task-workflow.sh +49 -0
- package/scripts/codex-handoff-resume.sh +2 -4
- package/scripts/initializer-question-pack.ts +26 -0
- package/scripts/prepare-codex-handoff.sh +1 -1
- package/scripts/prepare-handoff.sh +6 -0
- package/scripts/repo-harness.sh +5 -7
- package/scripts/run-skill-evals.ts +51 -0
- package/src/cli/commands/status.ts +1 -1
- package/src/cli/index.ts +2 -2
package/README.es.md
CHANGED
|
@@ -326,7 +326,7 @@ Guards habituales:
|
|
|
326
326
|
|
|
327
327
|
## Release actual
|
|
328
328
|
|
|
329
|
-
- npm package: `repo-harness@0.2.
|
|
329
|
+
- npm package: `repo-harness@0.2.4`
|
|
330
330
|
- Generated workflow compatibility: `5.2.3`
|
|
331
331
|
- GitHub repository: `Ancienttwo/repo-harness`
|
|
332
332
|
- Release history: [`docs/CHANGELOG.md`](docs/CHANGELOG.md)
|
package/README.fr.md
CHANGED
|
@@ -330,7 +330,7 @@ Guards courants :
|
|
|
330
330
|
|
|
331
331
|
## Release actuelle
|
|
332
332
|
|
|
333
|
-
- npm package : `repo-harness@0.2.
|
|
333
|
+
- npm package : `repo-harness@0.2.4`
|
|
334
334
|
- Generated workflow compatibility : `5.2.3`
|
|
335
335
|
- GitHub repository : `Ancienttwo/repo-harness`
|
|
336
336
|
- Release history : [`docs/CHANGELOG.md`](docs/CHANGELOG.md)
|
package/README.ja.md
CHANGED
|
@@ -293,7 +293,7 @@ hook がブロックしたときは、まず terminal の構造化された出
|
|
|
293
293
|
|
|
294
294
|
## 現在の Release
|
|
295
295
|
|
|
296
|
-
- npm package:`repo-harness@0.2.
|
|
296
|
+
- npm package:`repo-harness@0.2.4`
|
|
297
297
|
- Generated workflow compatibility:`5.2.3`
|
|
298
298
|
- GitHub repository:`Ancienttwo/repo-harness`
|
|
299
299
|
- Release history:[`docs/CHANGELOG.md`](docs/CHANGELOG.md)
|
package/README.md
CHANGED
|
@@ -34,40 +34,30 @@ This repository now dogfoods its own tasks-first contract. It is both:
|
|
|
34
34
|
read a 1KB capability contract or query the index instead of spending thousands of
|
|
35
35
|
tokens rediscovering structure.
|
|
36
36
|
|
|
37
|
-
## What's New in 0.2.
|
|
38
|
-
|
|
39
|
-
- **
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
never mutates config. The `SessionStart` sentinel fingerprints the set and re-scans
|
|
62
|
-
only when a fingerprint changes, so there is no session-start noise. Audit on demand:
|
|
63
|
-
`repo-harness security scan --json`.
|
|
64
|
-
- **Claude/Codex draft-plan lifecycle.** Plan mode is explicitly two-stage: Draft vs
|
|
65
|
-
Approved. Hooks detect plan-creation intent and track pending orchestration; a stop gate
|
|
66
|
-
(`stop-orchestrator.sh`) requires one self-review pass before a session ends mid-plan.
|
|
67
|
-
Capture a draft with `scripts/capture-plan.sh --slug <slug> --title <title> --status
|
|
68
|
-
Draft`, then promote to Approved and project into execution with `--execute` or
|
|
69
|
-
`scripts/plan-to-todo.sh --plan <plan>`. Plans become the file-backed source of truth in
|
|
70
|
-
`plans/`.
|
|
37
|
+
## What's New in 0.2.4
|
|
38
|
+
|
|
39
|
+
- **Plan consultation stays advisory.** Questions and status reports that mention
|
|
40
|
+
plans, workflows, hooks, `new plan`, or `方案` no longer fall into
|
|
41
|
+
`PlanStatusGuard` or create plan files unless they explicitly start execution.
|
|
42
|
+
- **Autoresearch is no longer a background hook.** The self-host-only
|
|
43
|
+
`autoresearch-advisory.sh` route is retired from `.ai/hooks`, generated hook
|
|
44
|
+
installers, and user-level adapters. Autoresearch evidence is now gathered by
|
|
45
|
+
an explicit agent-run workflow, not by an always-on hook.
|
|
46
|
+
- **Hook parity is stricter.** Self-host `.ai/hooks/` and installable
|
|
47
|
+
`assets/hooks/` now match without maintainer-only hook exceptions.
|
|
48
|
+
- **Copied hook fallback.** Installed prompt hooks now keep PlanCaptureGate
|
|
49
|
+
guidance working even when the copied runtime cannot reach the TypeScript
|
|
50
|
+
decision engine.
|
|
51
|
+
- **Darwin readiness gates.** Workflow checks now catch stale handoff/resume
|
|
52
|
+
plan references, and public action-command skills have static quality gates
|
|
53
|
+
for failure modes, boundaries, and high-risk checkpoints.
|
|
54
|
+
- **Authoritative eval evidence.** Benchmark reports now include
|
|
55
|
+
`full_test_count`, `dry_run_ratio`, `grader_pass_rate`, and
|
|
56
|
+
`effectiveness_authority`, so dry-run smoke output cannot be mistaken for
|
|
57
|
+
release-grade skill effectiveness proof.
|
|
58
|
+
- **Tooling freshness.** The self-host CodeGraph dev dependency is refreshed to
|
|
59
|
+
`0.9.9`, and gbrain readiness probes try `doctor --json --fast` before the
|
|
60
|
+
full doctor path.
|
|
71
61
|
|
|
72
62
|
## What repo-harness Does
|
|
73
63
|
|
|
@@ -194,13 +184,13 @@ repository to install or refresh workflow files, hook assets, host adapters,
|
|
|
194
184
|
skill aliases, and repo-local verification surfaces from the current npm package.
|
|
195
185
|
|
|
196
186
|
The npm package release line is now `0.2.x`; generated workflow compatibility is
|
|
197
|
-
tracked separately as the `5.x` model line. The `0.2.
|
|
198
|
-
global bootstrap (`repo-harness init`) from repo-local refresh
|
|
199
|
-
(`repo-harness update`),
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
and adds
|
|
203
|
-
|
|
187
|
+
tracked separately as the `5.x` model line. The `0.2.4` package keeps first-run
|
|
188
|
+
global bootstrap (`repo-harness init`) separate from repo-local refresh
|
|
189
|
+
(`repo-harness update`), preserves the typed global bootstrap and read-only
|
|
190
|
+
config security sentinel, tightens hook parity, retires the self-host
|
|
191
|
+
autoresearch advisory hook, prevents consultative plan/workflow prompts from
|
|
192
|
+
being mistaken for execution, and adds copied-hook fallback, readiness checks,
|
|
193
|
+
and skill-eval authority reporting.
|
|
204
194
|
These sit on top of the renamed `repo-harness` CLI, user-level hook
|
|
205
195
|
adapter bootstrap, AI-native scaffold overlays, the typed prompt-guard decision
|
|
206
196
|
engine, plan-stem task artifact naming, `REPO_HARNESS_*` runtime aliases, Waza
|
|
@@ -340,7 +330,7 @@ Most common guards:
|
|
|
340
330
|
|
|
341
331
|
## Current Release
|
|
342
332
|
|
|
343
|
-
- npm package: `repo-harness@0.2.
|
|
333
|
+
- npm package: `repo-harness@0.2.4`
|
|
344
334
|
- Generated workflow compatibility: `5.2.3`
|
|
345
335
|
- GitHub repository: `Ancienttwo/repo-harness`
|
|
346
336
|
- Release history: [`docs/CHANGELOG.md`](docs/CHANGELOG.md)
|
|
@@ -428,6 +418,12 @@ UI runtime, Bun/Hono gateway, shared contracts, observability, and MCP/HTTP
|
|
|
428
418
|
sidecar rules without installing model providers or making Python, Go, Rust, or
|
|
429
419
|
A2UI mandatory defaults.
|
|
430
420
|
|
|
421
|
+
Webapp rendering is a separate overlay. Client-only Vite remains Plan B, while
|
|
422
|
+
React webapps that need public SEO/SSR plus an authenticated workspace should
|
|
423
|
+
use Plan C: one TanStack Start + Vite app deployed as a Cloudflare Worker under
|
|
424
|
+
`apps/web`, with `/` SSR/prerender-capable and `/app` client-only. The scaffold
|
|
425
|
+
does not default to separate `apps/marketing` and `apps/web` frontend deploys.
|
|
426
|
+
|
|
431
427
|
Use `repo-harness-capability` when the harness already exists and only selected
|
|
432
428
|
capability boundaries should be added. It updates `.ai/context/capabilities.json`,
|
|
433
429
|
syncs the requested local `AGENTS.md` / `CLAUDE.md` contract files, and validates
|
|
@@ -480,6 +476,9 @@ bun scripts/assemble-template.ts --target agents --plan C --name "MyProject"
|
|
|
480
476
|
bun run benchmark:skills --dry-run
|
|
481
477
|
```
|
|
482
478
|
|
|
479
|
+
Dry-run benchmark output is a wiring smoke only. Release or readiness evidence
|
|
480
|
+
needs a non-dry-run eval with grader output.
|
|
481
|
+
|
|
483
482
|
### Run one eval across both Claude and Codex
|
|
484
483
|
|
|
485
484
|
```bash
|
|
@@ -534,5 +533,5 @@ bash scripts/check-task-workflow.sh --strict
|
|
|
534
533
|
bun scripts/inspect-project-state.ts --repo . --format text
|
|
535
534
|
bash scripts/migrate-project-template.sh --repo . --dry-run
|
|
536
535
|
bash scripts/check-agent-tooling.sh --host both --check-updates
|
|
537
|
-
bun run benchmark:skills --
|
|
536
|
+
bun run benchmark:skills --eval route-workflow-check
|
|
538
537
|
```
|
package/README.zh-CN.md
CHANGED
|
@@ -23,31 +23,25 @@ repo-local workflow 的自托管样例。
|
|
|
23
23
|
做渐进式上下文加载:一份小而稳定的 root context(约 12KB),加上只在改到对应文件时才加载的
|
|
24
24
|
capability 块。agent 读一份 1KB 的 capability 合约或查索引,而不是花上千 token 重新摸清结构。
|
|
25
25
|
|
|
26
|
-
## 0.2.
|
|
27
|
-
|
|
28
|
-
-
|
|
29
|
-
|
|
30
|
-
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
-
|
|
36
|
-
|
|
37
|
-
- **
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
session-start 噪音。按需审计:`repo-harness security scan --json`。
|
|
46
|
-
- **Claude/Codex draft-plan 生命周期。** Plan mode 显式分两段:Draft 与 Approved。hooks 识别建 plan 的
|
|
47
|
-
意图并追踪 pending orchestration;stop 门(`stop-orchestrator.sh`)要求会话在 plan 未定时结束前先做
|
|
48
|
-
一次自审。用 `scripts/capture-plan.sh --slug <slug> --title <title> --status Draft` 落草稿,审批后改
|
|
49
|
-
Approved 并用 `--execute` 或 `scripts/plan-to-todo.sh --plan <plan>` 投射到执行。plans/ 成为文件级
|
|
50
|
-
事实来源。
|
|
26
|
+
## 0.2.4 新特性
|
|
27
|
+
|
|
28
|
+
- **计划咨询保持 advisory。** 提到 plans、workflow、hooks、`new plan` 或 `方案` 的问题和状态报告,
|
|
29
|
+
不再因为包含执行相关词就进入 `PlanStatusGuard` 或创建 plan 文件;只有明确开始执行时才触发执行门。
|
|
30
|
+
- **Autoresearch 不再是后台 hook。** 自托管专用的 `autoresearch-advisory.sh` route 已从
|
|
31
|
+
`.ai/hooks`、生成的 hook installer 和 user-level adapters 里退休。需要 autoresearch 证据时,
|
|
32
|
+
由 agent 显式运行实验流程,而不是靠常驻 hook 提示。
|
|
33
|
+
- **Hook parity 更严格。** 自托管 `.ai/hooks/` 和可安装的 `assets/hooks/` 现在必须完全一致,
|
|
34
|
+
不再保留 maintainer-only hook exception。
|
|
35
|
+
- **复制版 hook fallback。** 已安装的 prompt hook 即使找不到 TypeScript decision
|
|
36
|
+
engine,也会保留 PlanCaptureGate guidance,而不是直接报 engine unavailable。
|
|
37
|
+
- **Darwin readiness gates。** Workflow checks 现在会抓 stale handoff/resume plan
|
|
38
|
+
references;公共 action-command skills 也增加 failure modes、boundaries 和高风险
|
|
39
|
+
checkpoint 的静态质量门。
|
|
40
|
+
- **权威 eval evidence。** Benchmark report 现在输出 `full_test_count`、
|
|
41
|
+
`dry_run_ratio`、`grader_pass_rate` 和 `effectiveness_authority`,避免把 dry-run
|
|
42
|
+
smoke 当成 release-grade skill effectiveness 证明。
|
|
43
|
+
- **Tooling freshness。** self-host CodeGraph dev dependency 刷到 `0.9.9`,gbrain
|
|
44
|
+
readiness 会先尝试 `doctor --json --fast`,再 fallback 到完整 doctor。
|
|
51
45
|
|
|
52
46
|
## 产品做什么
|
|
53
47
|
|
|
@@ -166,10 +160,11 @@ npx -y repo-harness update
|
|
|
166
160
|
repo-local verification surfaces。
|
|
167
161
|
|
|
168
162
|
npm package release line 现在是 `0.2.x`;生成的 workflow compatibility model line
|
|
169
|
-
单独以 `5.x` 追踪。`repo-harness@0.2.
|
|
170
|
-
和 repo-local 刷新(`repo-harness update
|
|
171
|
-
|
|
172
|
-
|
|
163
|
+
单独以 `5.x` 追踪。`repo-harness@0.2.4` 继续把首次全局引导(`repo-harness init`)
|
|
164
|
+
和 repo-local 刷新(`repo-harness update`)拆开,保留 typed global bootstrap 与只读
|
|
165
|
+
配置安全哨兵,同时收紧 hook parity,退休自托管 autoresearch advisory hook,避免
|
|
166
|
+
计划/工作流咨询 prompt 被误判成执行请求,并增加复制版 hook fallback、readiness checks
|
|
167
|
+
和 skill-eval authority reporting。
|
|
173
168
|
这些能力叠加在改名后的 CLI、user-level hook adapter bootstrap、AI-native scaffold overlays、
|
|
174
169
|
typed prompt-guard decision engine、plan-stem task artifact 命名、`REPO_HARNESS_*`
|
|
175
170
|
runtime aliases、Waza runtime skill sync,以及 maintainer 发布 npm 前使用的 release gate 之上。
|
|
@@ -302,7 +297,7 @@ hook block 工作时,先看 terminal 里的结构化输出。核心字段是
|
|
|
302
297
|
|
|
303
298
|
## 当前 Release
|
|
304
299
|
|
|
305
|
-
- npm package:`repo-harness@0.2.
|
|
300
|
+
- npm package:`repo-harness@0.2.4`
|
|
306
301
|
- Generated workflow compatibility:`5.2.3`
|
|
307
302
|
- GitHub repository:`Ancienttwo/repo-harness`
|
|
308
303
|
- Release history:[`docs/CHANGELOG.md`](docs/CHANGELOG.md)
|
|
@@ -339,6 +334,13 @@ hook block 工作时,先看 terminal 里的结构化输出。核心字段是
|
|
|
339
334
|
`repo-harness update` 用于已有仓库;`repo-harness-scaffold` 作为支线 command 创建新项目或模块。
|
|
340
335
|
`hooks-init`、`docs-init` 和 `create-project-dirs` 是内部步骤,不是公共 commands。
|
|
341
336
|
|
|
337
|
+
`repo-harness-scaffold` 保持 A-K plan catalog 作为项目类型 authority;AI-native
|
|
338
|
+
能力通过可选 `ai_native_profile` overlay 叠加。Webapp rendering 也是独立 overlay:
|
|
339
|
+
Plan B 保留为 client-only Vite;需要 public SEO/SSR landing 加 authenticated
|
|
340
|
+
workspace 的 React webapp 使用 Plan C,也就是一个部署在 Cloudflare Workers 上的
|
|
341
|
+
TanStack Start + Vite `apps/web`。`/` 走 SSR/prerender,`/app` 保持 client-only。
|
|
342
|
+
scaffold 不默认生成 `apps/marketing` + `apps/web` 两个前端部署。
|
|
343
|
+
|
|
342
344
|
## Maintainer Reference
|
|
343
345
|
|
|
344
346
|
### 检查本仓库 workflow contract
|
|
@@ -366,7 +368,7 @@ bash scripts/check-task-workflow.sh --strict
|
|
|
366
368
|
bun scripts/inspect-project-state.ts --repo . --format text
|
|
367
369
|
bash scripts/migrate-project-template.sh --repo . --dry-run
|
|
368
370
|
bash scripts/check-agent-tooling.sh --host both --check-updates
|
|
369
|
-
bun run benchmark:skills --
|
|
371
|
+
bun run benchmark:skills --eval route-workflow-check
|
|
370
372
|
```
|
|
371
373
|
|
|
372
374
|
## Key Files
|
package/SKILL.md
CHANGED
|
@@ -70,6 +70,13 @@ Read the result fields:
|
|
|
70
70
|
|
|
71
71
|
### Step 2. Choose one path
|
|
72
72
|
|
|
73
|
+
If the request maps to a public command facade, name that route before running
|
|
74
|
+
checks or edits, then read the matching
|
|
75
|
+
`assets/skill-commands/<repo-harness-command>/SKILL.md` and follow that
|
|
76
|
+
facade's protocol. For example, pre-merge or release readiness requests route
|
|
77
|
+
to `repo-harness-check`, while broken task sync, hook routing, handoff, context,
|
|
78
|
+
policy, or helper surfaces route to `repo-harness-repair`.
|
|
79
|
+
|
|
73
80
|
1. **Scaffold**
|
|
74
81
|
- use only when creating a new project, app, or module skeleton
|
|
75
82
|
- route to `repo-harness-scaffold`
|
|
@@ -152,17 +159,20 @@ such as finance, CRM, Web3, healthcare, and commerce are overlays.
|
|
|
152
159
|
Core Plans (A-F), routed as stack families:
|
|
153
160
|
- Plan A: Astro-first SSR/content shell. Use Astro for SSR, content, docs,
|
|
154
161
|
marketing, and mostly-static app shells with islands where needed.
|
|
155
|
-
- Plan B: Vite 8 client app shell. Use Vite + React + TanStack
|
|
156
|
-
plus shadcn/Radix-style UI for dense interactive apps and
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
162
|
+
- Plan B: Vite 8 client-only app shell. Use Vite + React + TanStack
|
|
163
|
+
Router/Query plus shadcn/Radix-style UI for dense interactive apps and
|
|
164
|
+
internal tools that do not need crawler-visible SSR landing HTML.
|
|
165
|
+
- Plan C: TanStack Start Workers webapp. Prefer TanStack Start + Vite +
|
|
166
|
+
Cloudflare Workers when the same React webapp needs public SEO/SSR at `/`
|
|
167
|
+
and authenticated or browser-heavy workspace routes under `/app`. Use
|
|
168
|
+
route-level `ssr: false` for `/app`; Next.js is not a default recommendation.
|
|
160
169
|
- Plan D: Shared frontend/backend monorepo. Prefer Bun workspaces with apps,
|
|
161
170
|
packages, shared contracts, a Hono gateway, and optional Turborepo only when
|
|
162
171
|
repo scale needs orchestration.
|
|
163
|
-
- Plan E: Cloudflare edge web stack. Prefer
|
|
164
|
-
|
|
165
|
-
|
|
172
|
+
- Plan E: Cloudflare edge web stack. Prefer Workers for TanStack Start SSR
|
|
173
|
+
webapps, Pages only for static/client-only assets or content shells, and R2,
|
|
174
|
+
KV, Queues, Durable Objects, and Hyperdrive where they fit. Do not default to
|
|
175
|
+
D1; use Postgres/Supabase or SQLite/Turso unless the D1 tradeoff is explicit.
|
|
166
176
|
- Plan F: Mobile/realtime companion. Use Expo Router on React Native New
|
|
167
177
|
Architecture, with NativeWind where useful and explicit voice/media/realtime
|
|
168
178
|
boundaries when needed.
|
|
@@ -201,9 +211,14 @@ Current stack guidance:
|
|
|
201
211
|
|
|
202
212
|
- Use Astro for SSR/content/docs shells and Vite 8 for rich interactive
|
|
203
213
|
surfaces. Prefer a shared monorepo over disconnected frontend/backend repos.
|
|
204
|
-
- Use TanStack Start
|
|
205
|
-
|
|
206
|
-
|
|
214
|
+
- Use TanStack Start + Vite + Cloudflare Workers when a SaaS webapp needs
|
|
215
|
+
public landing SEO/SSR and a client-heavy workspace in the same product
|
|
216
|
+
surface. Keep `/` SSR/prerender-capable and `/app` client-only.
|
|
217
|
+
- Do not scaffold `apps/marketing` plus `apps/web` as the default answer to
|
|
218
|
+
SEO/SSR. Treat a static marketing app as explicit legacy/rollback or content
|
|
219
|
+
scope, not as the normal SaaS webapp split.
|
|
220
|
+
- Use React Router Framework Mode or Vike only as fallback evaluations if the
|
|
221
|
+
Start + Workers thin scaffold gate fails. Do not default to Next.js.
|
|
207
222
|
- Use Expo Router for mobile and keep React Native New Architecture
|
|
208
223
|
compatibility visible in the scaffold.
|
|
209
224
|
- Use assistant-ui or AI SDK UI for chat and generative UI primitives; use
|
|
@@ -333,19 +348,16 @@ or `.claude/.trace.jsonl` evidence.
|
|
|
333
348
|
|
|
334
349
|
Hooks are accelerators and guards. They do not replace `plans/`, `tasks/`,
|
|
335
350
|
contracts, reviews, policy, checks, or handoff artifacts. Heavy workflows such as
|
|
336
|
-
autoresearch must not silently run as background hook mutations.
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
must remain in the workspace.
|
|
342
|
-
`autoresearch-advisory.sh` is a self-host maintainer hook for this repo, not a
|
|
343
|
-
default installable user hook.
|
|
351
|
+
autoresearch must not silently run as background hook mutations. The retired
|
|
352
|
+
`autoresearch-advisory.sh` hook is not part of `.ai/hooks`, user-level adapters,
|
|
353
|
+
or installable hook templates. If autoresearch evidence is needed, the agent
|
|
354
|
+
runs it explicitly and keeps local run products under ignored `autoresearch/`
|
|
355
|
+
when they must remain in the workspace.
|
|
344
356
|
|
|
345
357
|
Verify hook workflow changes with hook-specific evidence:
|
|
346
358
|
|
|
347
359
|
- default hook asset parity between `assets/hooks/` and `.ai/hooks/`, with
|
|
348
|
-
|
|
360
|
+
no self-host-only hook exclusions
|
|
349
361
|
- `bun test tests/hook-runtime.test.ts tests/workflow-contract.test.ts`
|
|
350
362
|
- `bash scripts/check-task-sync.sh`
|
|
351
363
|
- `bash scripts/check-task-workflow.sh --strict`
|
|
@@ -14,7 +14,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
14
14
|
. "$SCRIPT_DIR/lib/session-state.sh"
|
|
15
15
|
|
|
16
16
|
is_execution_approval_intent() {
|
|
17
|
-
echo "$PROMPT_TEXT" | grep -qEi "^[[:space:][:punct:]]*(please[[:space:][:punct:]]+)?(go ahead([[:space:]]+(with[[:space:]]+(it|this|that)|please))?|go|proceed([[:space:]]+(with[[:space:]]+(it|this|that)|please))?|approved|approve([[:space:]]+(it|this|that))?|ship it|let'?s go
|
|
17
|
+
echo "$PROMPT_TEXT" | grep -qEi "^[[:space:][:punct:]]*(please[[:space:][:punct:]]+)?(go ahead([[:space:]]+(with[[:space:]]+(it|this|that)|please))?|go|proceed([[:space:]]+(with[[:space:]]+(it|this|that)|please))?|approved|approve([[:space:]]+(it|this|that))?|ship it|let'?s go|继续执行|批准执行|批准|同意(了)?[[:space:][:punct:],。!?!]*(执行|开干|开始|动手|做|干)(了|吧)?|可以干(了|吧)?|可以(开始|执行)(了|吧)?|直接改(了|吧)?|整|整吧|开干|干吧|做吧|走起)([[:space:][:punct:]]+please)?[[:space:][:punct:]]*$"
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
prompt_has_explicit_execution_command_line() {
|
|
@@ -39,6 +39,9 @@ is_implement_intent() {
|
|
|
39
39
|
if is_next_slice_or_status_advisory_intent; then
|
|
40
40
|
return 1
|
|
41
41
|
fi
|
|
42
|
+
if is_plan_consultation_intent; then
|
|
43
|
+
return 1
|
|
44
|
+
fi
|
|
42
45
|
if is_plan_discussion_continuation_intent; then
|
|
43
46
|
return 1
|
|
44
47
|
fi
|
|
@@ -109,6 +112,7 @@ is_plan_creation_intent() {
|
|
|
109
112
|
is_plan_discussion_continuation_intent && return 1
|
|
110
113
|
is_plan_refinement_intent && return 1
|
|
111
114
|
is_diagnostic_question_intent && return 1
|
|
115
|
+
is_plan_consultation_intent && return 1
|
|
112
116
|
echo "$PROMPT_INTENT_TEXT" | grep -qEi "(new plan|create plan|write plan|draft plan|新建计划|创建计划|写计划|制定计划|补计划)"
|
|
113
117
|
}
|
|
114
118
|
|
|
@@ -121,6 +125,7 @@ is_plain_feature_plan_start_intent() {
|
|
|
121
125
|
is_plan_discussion_continuation_intent && return 1
|
|
122
126
|
is_plan_refinement_intent && return 1
|
|
123
127
|
is_diagnostic_question_intent && return 1
|
|
128
|
+
is_plan_consultation_intent && return 1
|
|
124
129
|
is_bug_or_hunt_intent && return 1
|
|
125
130
|
is_execution_approval_intent && return 1
|
|
126
131
|
|
|
@@ -308,6 +313,16 @@ is_plan_discussion_continuation_intent() {
|
|
|
308
313
|
printf '%s\n' "$PROMPT_INTENT_TEXT" | grep -qEi "(继续讨论|讨论|追问|疑问|补充|调整|完善|优化|评审|review|refine|怎么|如何|为什么|为啥|不要.*机械|不能.*机械|过于机械|多轮|中断|状态|边界|弱点|补充|改一下|修一下|不合理|有风险|我觉得|是否|是不是|能不能|应该|设计)"
|
|
309
314
|
}
|
|
310
315
|
|
|
316
|
+
is_plan_consultation_intent() {
|
|
317
|
+
is_execution_approval_intent && return 1
|
|
318
|
+
is_embedded_approved_plan_intent && return 1
|
|
319
|
+
is_plan_shaped_markdown_intent && return 1
|
|
320
|
+
is_explicit_execution_start_line && return 1
|
|
321
|
+
|
|
322
|
+
printf '%s\n' "$PROMPT_INTENT_TEXT" | grep -qEi "(plan|方案|计划|workflow|hook|hooks|codex[[:space:]-]*plan|claude[[:space:]-]*plan|active[[:space:]-]*plan|PlanStatusGuard|PlanCaptureGate|PlanStartGate|执行门禁|new[[:space:]]+plan|create[[:space:]]+(a[[:space:]]+)?(new[[:space:]]+)?plan|write[[:space:]]+plan|draft[[:space:]]+plan|新建计划|创建计划|写计划|制定计划|补计划)" || return 1
|
|
323
|
+
printf '%s\n' "$PROMPT_INTENT_TEXT" | grep -qEi "(为什么|为啥|怎么回事|怎么.*(看|理解|处理|判断|选|选择|创建)|如何.*(看|理解|处理|判断|选|选择|创建)|是否|是不是|能不能|可不可以|该不该|应该|哪个|哪种|哪条|选择哪个|咨询|讨论|追问|疑问|问一下|会不会|会触发吗|被拦|拦截|why|how[[:space:]]+(do|should|can|would|could)|should[[:space:]]+(i|we)|would|could|can[[:space:]]+(i|we)|which|what[[:space:]]+if|is[[:space:]]+it|question|consult|discuss)"
|
|
324
|
+
}
|
|
325
|
+
|
|
311
326
|
is_diagnostic_question_intent() {
|
|
312
327
|
is_execution_approval_intent && return 1
|
|
313
328
|
is_embedded_approved_plan_intent && return 1
|
|
@@ -371,6 +386,9 @@ is_think_plan_start_intent() {
|
|
|
371
386
|
if echo "$PROMPT_INTENT_TEXT" | grep -qEi '^[[:space:][:punct:]]*(/think|[$]think|\[[$]think\])'; then
|
|
372
387
|
return 0
|
|
373
388
|
fi
|
|
389
|
+
if is_plan_consultation_intent; then
|
|
390
|
+
return 1
|
|
391
|
+
fi
|
|
374
392
|
echo "$PROMPT_INTENT_TEXT" | grep -qEi '(plan this|plan it|how should i|how should we|出方案|给方案|怎么设计|用什么方案|制定计划|写计划|新建计划|创建计划)' || is_plain_feature_plan_start_intent
|
|
375
393
|
}
|
|
376
394
|
|
|
@@ -876,6 +894,142 @@ prompt_guard_decision_command() {
|
|
|
876
894
|
return 127
|
|
877
895
|
}
|
|
878
896
|
|
|
897
|
+
prompt_guard_env_truthy() {
|
|
898
|
+
case "${1:-}" in
|
|
899
|
+
1|true) return 0 ;;
|
|
900
|
+
*) return 1 ;;
|
|
901
|
+
esac
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
prompt_guard_fallback_intent() {
|
|
905
|
+
if prompt_guard_env_truthy "${PROMPT_GUARD_DONE_INTENT:-}"; then
|
|
906
|
+
printf '%s' "done"
|
|
907
|
+
elif prompt_guard_env_truthy "${PROMPT_GUARD_PLAN_START_INTENT:-}" && ! prompt_guard_env_truthy "${PROMPT_GUARD_IMPLEMENT_INTENT:-}"; then
|
|
908
|
+
printf '%s' "planning_start"
|
|
909
|
+
elif prompt_guard_env_truthy "${PROMPT_GUARD_PLANNING_DISCUSSION_INTENT:-}"; then
|
|
910
|
+
printf '%s' "planning_discussion"
|
|
911
|
+
elif prompt_guard_env_truthy "${PROMPT_GUARD_REVIEW_RELEASE_INTENT:-}"; then
|
|
912
|
+
printf '%s' "review_release"
|
|
913
|
+
elif prompt_guard_env_truthy "${PROMPT_GUARD_PASSIVE_WORKTREE_STATUS_INTENT:-}"; then
|
|
914
|
+
printf '%s' "passive_worktree_status"
|
|
915
|
+
elif prompt_guard_env_truthy "${PROMPT_GUARD_PASSIVE_COMPLETION_REPORT_INTENT:-}"; then
|
|
916
|
+
printf '%s' "passive_completion_report"
|
|
917
|
+
elif prompt_guard_env_truthy "${PROMPT_GUARD_PASSIVE_NEXT_SLICE_REPORT_INTENT:-}"; then
|
|
918
|
+
printf '%s' "passive_next_slice_report"
|
|
919
|
+
elif ! prompt_guard_env_truthy "${PROMPT_GUARD_IMPLEMENT_INTENT:-}"; then
|
|
920
|
+
printf '%s' "none"
|
|
921
|
+
elif prompt_guard_env_truthy "${PROMPT_GUARD_EMBEDDED_APPROVED_PLAN_INTENT:-}" || prompt_guard_env_truthy "${PROMPT_GUARD_PLAN_SHAPED_MARKDOWN_INTENT:-}"; then
|
|
922
|
+
printf '%s' "embedded_approved_plan"
|
|
923
|
+
elif prompt_guard_env_truthy "${PROMPT_GUARD_BUG_OR_HUNT_INTENT:-}"; then
|
|
924
|
+
printf '%s' "bug_fix_execution"
|
|
925
|
+
elif prompt_guard_env_truthy "${PROMPT_GUARD_PLAN_EXECUTION_PROJECTION_INTENT:-}"; then
|
|
926
|
+
printf '%s' "plan_execution_projection"
|
|
927
|
+
else
|
|
928
|
+
printf '%s' "general_execution"
|
|
929
|
+
fi
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
prompt_guard_fallback_is_execution_intent() {
|
|
933
|
+
case "$1" in
|
|
934
|
+
embedded_approved_plan|bug_fix_execution|plan_execution_projection|general_execution) return 0 ;;
|
|
935
|
+
*) return 1 ;;
|
|
936
|
+
esac
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
prompt_guard_fallback_no_active_plan_action() {
|
|
940
|
+
local intent="$1"
|
|
941
|
+
if [[ "$intent" != "bug_fix_execution" && "${PROMPT_GUARD_PENDING_STATE:-none}" == "fresh" ]]; then
|
|
942
|
+
printf '%s' "plan_capture_pending_advice"
|
|
943
|
+
elif [[ "${PROMPT_GUARD_WORKTREE_STATE:-current}" == "linked_target" ]]; then
|
|
944
|
+
printf '%s' "worktree_execution_advice"
|
|
945
|
+
elif [[ "$intent" == "plan_execution_projection" ]]; then
|
|
946
|
+
printf '%s' "plan_capture_missing_active_advice"
|
|
947
|
+
else
|
|
948
|
+
printf '%s' "plan_status_no_active_block"
|
|
949
|
+
fi
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
prompt_guard_fallback_draft_plan_action() {
|
|
953
|
+
if [[ "$1" == "plan_execution_projection" ]]; then
|
|
954
|
+
printf '%s' "plan_capture_draft_advice"
|
|
955
|
+
else
|
|
956
|
+
printf '%s' "plan_status_not_approved_block"
|
|
957
|
+
fi
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
prompt_guard_fallback_approved_plan_action() {
|
|
961
|
+
local intent="$1"
|
|
962
|
+
if [[ "${PROMPT_GUARD_EVIDENCE_STATE:-unchecked}" == "incomplete" ]]; then
|
|
963
|
+
printf '%s' "evidence_contract_block"
|
|
964
|
+
elif [[ "${PROMPT_GUARD_PLAN_STATE:-none}" == "approved" && "$intent" == "plan_execution_projection" && "${PROMPT_GUARD_CONTRACT_STATE:-missing}" != "present" ]]; then
|
|
965
|
+
printf '%s' "plan_execution_scaffold_advice"
|
|
966
|
+
elif [[ "${PROMPT_GUARD_CONTRACT_STATE:-missing}" != "present" ]]; then
|
|
967
|
+
printf '%s' "contract_missing_block"
|
|
968
|
+
else
|
|
969
|
+
printf '%s' "allow"
|
|
970
|
+
fi
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
prompt_guard_fallback_done_action() {
|
|
974
|
+
case "${PROMPT_GUARD_PLAN_STATE:-none}" in
|
|
975
|
+
none|stale_marker|foreign_worktree)
|
|
976
|
+
printf '%s' "done_missing_active_plan"
|
|
977
|
+
return 0
|
|
978
|
+
;;
|
|
979
|
+
esac
|
|
980
|
+
|
|
981
|
+
if [[ "${PROMPT_GUARD_CONTRACT_PATH_STATE:-missing}" != "present" ]]; then
|
|
982
|
+
printf '%s' "done_contract_path_missing"
|
|
983
|
+
elif [[ "${PROMPT_GUARD_CONTRACT_STATE:-missing}" != "present" ]]; then
|
|
984
|
+
printf '%s' "done_missing_contract"
|
|
985
|
+
elif [[ "${PROMPT_GUARD_EVIDENCE_STATE:-unchecked}" == "incomplete" ]]; then
|
|
986
|
+
printf '%s' "done_evidence_contract_block"
|
|
987
|
+
else
|
|
988
|
+
printf '%s' "done_gate"
|
|
989
|
+
fi
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
prompt_guard_decide_fallback() {
|
|
993
|
+
local intent
|
|
994
|
+
intent="$(prompt_guard_fallback_intent)"
|
|
995
|
+
|
|
996
|
+
if [[ "$intent" == "done" ]]; then
|
|
997
|
+
prompt_guard_fallback_done_action
|
|
998
|
+
return 0
|
|
999
|
+
fi
|
|
1000
|
+
|
|
1001
|
+
if ! prompt_guard_fallback_is_execution_intent "$intent"; then
|
|
1002
|
+
printf '%s' "allow"
|
|
1003
|
+
return 0
|
|
1004
|
+
fi
|
|
1005
|
+
|
|
1006
|
+
if [[ "${PROMPT_GUARD_SPEC_STATE:-missing}" == "missing" ]]; then
|
|
1007
|
+
printf '%s' "spec_block"
|
|
1008
|
+
return 0
|
|
1009
|
+
fi
|
|
1010
|
+
|
|
1011
|
+
case "${PROMPT_GUARD_PLAN_STATE:-none}" in
|
|
1012
|
+
none)
|
|
1013
|
+
prompt_guard_fallback_no_active_plan_action "$intent"
|
|
1014
|
+
;;
|
|
1015
|
+
stale_marker|foreign_worktree)
|
|
1016
|
+
printf '%s' "stale_active_plan_advice"
|
|
1017
|
+
;;
|
|
1018
|
+
draft|annotating)
|
|
1019
|
+
prompt_guard_fallback_draft_plan_action "$intent"
|
|
1020
|
+
;;
|
|
1021
|
+
approved|executing)
|
|
1022
|
+
prompt_guard_fallback_approved_plan_action "$intent"
|
|
1023
|
+
;;
|
|
1024
|
+
unknown)
|
|
1025
|
+
printf '%s' "allow"
|
|
1026
|
+
;;
|
|
1027
|
+
*)
|
|
1028
|
+
prompt_guard_fallback_no_active_plan_action "$intent"
|
|
1029
|
+
;;
|
|
1030
|
+
esac
|
|
1031
|
+
}
|
|
1032
|
+
|
|
879
1033
|
prompt_guard_refresh_state() {
|
|
880
1034
|
prompt_guard_spec_state="missing"
|
|
881
1035
|
prompt_guard_plan_state="none"
|
|
@@ -976,7 +1130,16 @@ prompt_guard_decide() {
|
|
|
976
1130
|
export PROMPT_GUARD_CONTRACT_PATH_STATE="$prompt_guard_contract_path_state"
|
|
977
1131
|
export PROMPT_GUARD_EVIDENCE_STATE="$prompt_guard_evidence_state"
|
|
978
1132
|
|
|
979
|
-
if
|
|
1133
|
+
if decision_output="$(prompt_guard_decision_command)"; then
|
|
1134
|
+
:
|
|
1135
|
+
else
|
|
1136
|
+
decision_status=$?
|
|
1137
|
+
if [[ "$decision_status" -eq 127 ]]; then
|
|
1138
|
+
decision_output="$(prompt_guard_decide_fallback)"
|
|
1139
|
+
printf '%s\n' "$decision_output" | head -n1 | xargs
|
|
1140
|
+
return 0
|
|
1141
|
+
fi
|
|
1142
|
+
|
|
980
1143
|
echo "[PromptGuard] Decision engine unavailable or failed."
|
|
981
1144
|
hook_structured_error \
|
|
982
1145
|
"PromptGuard" \
|
|
@@ -1356,7 +1519,7 @@ if echo "$PROMPT_TEXT" | grep -qEi "(fix|patch|bug|修复|修bug|修 bug|改bug)
|
|
|
1356
1519
|
echo " 检测到修复请求:先写失败测试复现问题,再重写实现。"
|
|
1357
1520
|
emit_cross_review_hint debug
|
|
1358
1521
|
fi
|
|
1359
|
-
if ! is_diagnostic_question_intent && ! is_review_release_advisory_intent && ! is_passive_worktree_status_intent && ! is_next_slice_or_status_advisory_intent && ! is_retrospective_completion_report_intent && echo "$PROMPT_TEXT" | grep -qEi "(new feature|feature|implement|build|新功能|实现|开发功能|执行)"; then
|
|
1522
|
+
if ! is_diagnostic_question_intent && ! is_plan_consultation_intent && ! is_review_release_advisory_intent && ! is_passive_worktree_status_intent && ! is_next_slice_or_status_advisory_intent && ! is_retrospective_completion_report_intent && echo "$PROMPT_TEXT" | grep -qEi "(new feature|feature|implement|build|新功能|实现|开发功能|执行)"; then
|
|
1360
1523
|
echo "[BDD] Feature intent detected. Define Given-When-Then acceptance scenarios first."
|
|
1361
1524
|
echo " 检测到新功能请求:先定义 Given-When-Then 验收场景。"
|
|
1362
1525
|
fi
|