your-cto-jev 0.19.0 → 0.21.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/README.md CHANGED
@@ -139,7 +139,7 @@ cto brief # what an agent should know before it s
139
139
  cto check # preview the commit checks on your current changes
140
140
  cto log # recent decisions with scores; cto report [n] flags a wrong one
141
141
  cto index # regenerate docs/cto_jev/INDEX.md (brief does this too)
142
- cto docs # suggest what to do with old planning markdown; changes nothing
142
+ cto docs # suggest what to do with old planning markdown, and check docs/cto_jev/ for alignment; changes nothing
143
143
  cto tests # Jev screens test files against their SPEC and for repeats; changes nothing
144
144
  ```
145
145
 
@@ -268,7 +268,7 @@ The skill gives the agent seven named jobs, so they cannot be confused with anot
268
268
  | `cto-jev work` | dispatches Ready tasks to sub-agents with the narrowest brief, runs each acceptance command itself before ticking (only the wave's own tasks and the `e2e/<slug>/` tests of the features it touches; the whole suites run once per feature cleanup and at release; until a repo's e2e tests are split into `e2e/<slug>/`, each wave runs the whole e2e suite; `cto brief` flags tests outside every feature folder (the `e2e/` root or a flat `e2e/tests/`) and the final report asks whether to split them, `"e2e_folders": false` in `.cto.json` keeps them flat), never opens a question menu mid-run, has a zero-context reviewer read the diff **before every commit**: P1 findings are fixed first, then the whole change reviewed again by `cto-reviewer` (at most three rounds in all; P1s left after that go to you), P2 findings become tasks that wait until the feature has nothing else Ready and then run as one cleanup wave with one review (what that review finds below P1 is written into REVIEW.md and listed for you, not filed as tasks, so findings never chain), a finding is contested only with evidence the reviewer could read; a review with no P1 left is committed with no code change in between, a fix made in conversation is reviewed and committed before new work, and no new wave starts while code waits for review; sub-agents and the reviewer never run a whole test suite; then it commits the wave to the review branch and starts the next one, without asking, until nothing is Ready; tasks that need you (credentials, money, anything irreversible, a drop) are parked, not waited on; ends with one report of what is done and everything for you to look at. Never releases |
269
269
  | `cto-jev work all` | for a new project or a big batch: the same run on a `work-all` branch, every wave reviewed by a zero-context `cto-reviewer` before its commit, then hands over to `cto-jev release`, never merges. Never releases |
270
270
  | `cto-jev release` | reviews the whole unreleased diff against the SPECs (looking hardest at waves marked `self-review`), files P1/P2/P3 tasks under the same findings rules, requires every P1 ticked and `cto check --base <release branch>` green, audits the tests (`cto tests` screens with Jev, an agent proposes keep, merge, delete or lighter for the flagged and slowest files, you decide), then prepares the merge, PR or tag for you to perform |
271
- | `cto-jev docs` | runs `cto docs` and brings you the list; acts only on what you decide |
271
+ | `cto-jev docs` | runs `cto docs` and brings you the old-plan list; acts only on what you decide. It also runs the alignment checks on `docs/cto_jev/` (five rules), has a reviewer look for duplicated rules, contradictions, docs that disagree with the code and SPEC behavior with no test, and fixes the findings: P1 now, P2 and P3 as tasks |
272
272
 
273
273
  "Release" adapts to the branches you have. A solo repo with only `main`: the wave review before each commit is the gate, and a release is a tag. `main` plus feature branches: the PR is the release. `main` plus `review`/`develop`/`staging`: merging the integration branch into `main`. `staging` and `live`: promoting one to the other. In every case the branch that reaches users takes nothing without a release review, and that is the branch to put in `protected_branches`. Changes inside an existing feature only add tasks; only a new module gets a new folder. The first time it runs it scans the repo, fills PRODUCT.md and ARCHITECTURE.md with what it can prove, asks you the rest a few questions at a time, and walks you through the result until you say it is complete. `unknown` is an allowed answer.
274
274
 
@@ -309,6 +309,8 @@ Agreeing covers what is written, `Assumed:` lines included. A signed-off CONCEPT
309
309
 
310
310
  `cto docs` deals with the rest of the repo: it finds markdown outside `docs/cto_jev/` that looks like an old plan (tool output under `.planning/`, `specs/`, `.kiro/`, fully ticked `TODO.md`s, checklists untouched for a month), asks Jev about the ambiguous ones, and prints merge / archive / delete suggestions. It changes nothing; the agent acts only after you decide.
311
311
 
312
+ `cto docs` also checks `docs/cto_jev/` against itself: five rules that need no judgment (a task's `(files:)` path that never existed, a task checked by a command that cannot fail, a parent not ticked over ticked children, a parent that carries its own acceptance, SPEC sections out of order). Each finding shows file:line, the rule and the fix. The agent handles them without asking you: a finding is P2 unless the doc it sits in would make an agent do wrong work (P1, fixed now); a P2 or P3 becomes a task, and REVIEW.md lists them. A reviewer then looks for what needs reading (the same rule written twice, contradicting docs, docs that disagree with the code, SPEC behavior with no test).
313
+
312
314
  If a docs site generator is configured (`mkdocs.yml`, `docusaurus.config.*`, `_config.yml`, ...), setup reminds you to keep `docs/cto_jev/` out of it: PRODUCT.md holds your pricing and business rules.
313
315
 
314
316
  ## Supported agents
@@ -397,6 +399,7 @@ Defaults: `credential_leak` 0.5, `destructive_command` 0.7, `infinite_loop` 0.6,
397
399
  - **`test_command`**: what `cto brief` tells the agent to verify with, for example `"pnpm test"`. Detected from the project when empty.
398
400
  - **`protected_branches`**: for example `["main", "release"]`. Commits on them and pushes that delete or rewrite them are blocked locally, no key needed. Empty by default.
399
401
  - **`turn_limits`**: `{ "minutes": 20, "tool_calls": 150, "agents": 4 }` by default; a turn past any one of them gets one reminder to stop and report. `0` turns that limit off; a key you leave out keeps its default.
402
+ - **`stage`**: `"prototype"` or `"build"`; a file without it is `build`, and `cto setup` writes `prototype` for a new project (the flow on and no test file tracked yet). In prototype, `cto brief` shows `Stage prototype` and the flow gets the main path running for you to try first: acceptance is the lightest command that shows a task works (a build, a smoke test) or a `manual` check, no end-to-end harness is built, test-setup trouble waits for build, and the reviewer does not ask for missing tests. When you can walk the main path, the run's report asks whether to switch to `build`.
400
403
  - **`e2e_folders`**: `true` by default. `false` means you chose to keep e2e tests flat in `e2e/`: `cto brief` stops asking to split them into `e2e/<slug>/`, and every wave runs the whole e2e suite.
401
404
  - **Thresholds**: Jev returns a probability from 0 to 1. `code_complexity` is the exception: it is a score from 0 (clean) to 4 (unmaintainable).
402
405
  - **Calibration**: on 32 hand-written diffs, every one scoring above 0.8 for `test_tampering` really weakened the tests, and no legitimate change scored above 0.37. The 0.8 default caught 13 of 16 weakening diffs; the misses were subtle ones such as a meaningless float tolerance or a skip hidden behind an env var. Lower it to 0.5 to catch 15 of 16, at a higher risk of blocking honest commits.
package/dist/brain.js CHANGED
@@ -34,6 +34,7 @@ export const DEFAULT_CONFIG = {
34
34
  review_gate: true,
35
35
  turn_limits: { minutes: 20, tool_calls: 150, agents: 4 },
36
36
  e2e_folders: true,
37
+ stage: 'build',
37
38
  };
38
39
  const emptyBrain = () => ({
39
40
  recent_errors: [],
@@ -81,6 +82,7 @@ export function loadConfig(root) {
81
82
  review_gate: raw.review_gate !== false,
82
83
  turn_limits: turnLimits(raw.turn_limits),
83
84
  e2e_folders: raw.e2e_folders !== false,
85
+ stage: raw.stage === 'prototype' ? 'prototype' : 'build',
84
86
  };
85
87
  }
86
88
  /** Corrupt or missing state rebuilds as empty: the gate must never crash on its own bookkeeping. */
package/dist/brief.js CHANGED
@@ -234,6 +234,8 @@ export function brief(root, now = Date.now()) {
234
234
  L.push(`Sprint goal ${cfg.sprint_goal.trim() || '(none set in .cto.json)'}`);
235
235
  const test = cfg.test_command.trim() || detectTestCommand(root);
236
236
  L.push(`Verify with ${test || '(unknown: set test_command in .cto.json)'}${test && !cfg.test_command.trim() ? ' (detected; pin it as test_command in .cto.json)' : ''}`);
237
+ if (cfg.stage === 'prototype')
238
+ L.push('Stage prototype: get the main path running for the user; tests stay light (see Stage in the cto-jev skill)');
237
239
  L.push(...flowLines(root));
238
240
  const plans = openPlanItems(root);
239
241
  if (plans.length) {
package/dist/docs.js CHANGED
@@ -1,39 +1,49 @@
1
1
  import { execFileSync } from 'node:child_process';
2
- import { readFileSync } from 'node:fs';
2
+ import { existsSync, readFileSync } from 'node:fs';
3
3
  import { join } from 'node:path';
4
+ import { detectTestCommand } from './brief.js';
4
5
  import { evaluate } from './api.js';
5
- import { loadBrain, saveKeeping } from './brain.js';
6
+ import { loadBrain, loadConfig, saveKeeping } from './brain.js';
6
7
  import { estimateTokens } from './diff.js';
7
- import { featureIndex, renderIndex } from './flow.js';
8
+ import { FLOW_DIR, featureIndex, listFeatures, loadTasks, renderIndex } from './flow.js';
8
9
  import { t } from './i18n.js';
9
10
  import { maskSensitiveState } from './masker.js';
10
- import { BOX } from './turn.js';
11
+ import { BOX, isDropped } from './turn.js';
11
12
  const PLANNING_MIN = 0.6;
12
13
  const FINISHED_MIN = 0.6;
13
14
  const CONFLICTS_MIN = 0.6;
14
15
  const STATE_TOKENS = 6000;
15
16
  const UNAVAILABLE = 'Jev unavailable; decide by hand';
16
- const git = (cwd, ...args) => {
17
+ /** Output of a git command; undefined when git failed (no git, not a repo). '' means it ran and printed nothing. */
18
+ const gitOut = (cwd, ...args) => {
17
19
  try {
18
20
  return execFileSync('git', args, { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim();
19
21
  }
20
22
  catch {
21
- return '';
23
+ return undefined;
22
24
  }
23
25
  };
26
+ const git = (cwd, ...args) => gitOut(cwd, ...args) ?? '';
24
27
  const EXCLUDED = /^(README|CONTRIBUTING|CHANGELOG|SECURITY)\.md$|^LICENSE/i;
25
28
  const TOOL_DIR = /(^|\/)(\.planning|specs|\.kiro)\//;
26
29
  const TOOL_FILE = /^(PLAN|TODO|NOTES)\.md$|-plan\.md$/i;
27
30
  const STALE_DAYS = 30;
28
- /** Checkbox counts, ignoring boxes inside ``` fences exactly like openPlanItems. */
29
- function countBoxes(text) {
30
- let fenced = false, open = 0, done = 0;
31
- for (const l of text.split(/\r?\n/)) {
31
+ /** Lines outside ``` and ~~~ fences, with their 1-based line numbers. */
32
+ function unfenced(text) {
33
+ let fenced = false;
34
+ return text.split(/\r?\n/).flatMap((l, i) => {
32
35
  if (/^\s*(```|~~~)/.test(l)) {
33
36
  fenced = !fenced;
34
- continue;
37
+ return [];
35
38
  }
36
- const m = fenced ? null : BOX.exec(l);
39
+ return fenced ? [] : [{ l, n: i + 1 }];
40
+ });
41
+ }
42
+ /** Checkbox counts, ignoring boxes inside fences exactly like openPlanItems. */
43
+ function countBoxes(text) {
44
+ let open = 0, done = 0;
45
+ for (const { l } of unfenced(text)) {
46
+ const m = BOX.exec(l);
37
47
  if (m)
38
48
  m[2] === ' ' ? open++ : done++;
39
49
  }
@@ -120,7 +130,62 @@ export async function judgeDocs(root, candidates, ctx) {
120
130
  }
121
131
  /** The whole `cto docs` report: rules, then Jev on what the rules left open. No network call when nothing is `ask`. */
122
132
  export async function docsReport(root, ctx) {
123
- return renderDocs(await judgeDocs(root, docCandidates(root), ctx), ctx.lang);
133
+ return renderDocs(await judgeDocs(root, docCandidates(root), ctx), ctx.lang, renderAlignment(alignmentIssues(root), ctx.lang));
134
+ }
135
+ const SPEC_ORDER = ['Interface', 'Constraints', 'Acceptance', 'Internals'];
136
+ const SPEC_HEAD = /^## (Interface|Constraints|Acceptance|Internals)\s*$/;
137
+ const tickedTask = (t) => t.done || isDropped(t);
138
+ export function alignmentIssues(root) {
139
+ const tasks = loadTasks(root);
140
+ const byId = new Map(tasks.map((t) => [t.id, t]));
141
+ const verify = loadConfig(root).test_command.trim() || detectTestCommand(root);
142
+ // Fail open: a shallow clone (or no git) cannot tell a path that never existed from one whose history was cut off.
143
+ const history = gitOut(root, 'rev-parse', '--is-shallow-repository') === 'false';
144
+ const out = [];
145
+ const add = (t, rule) => out.push({ file: t.file, line: t.line, rule });
146
+ for (const t of tasks) {
147
+ const kids = t.children.map((id) => byId.get(id)).filter((k) => !!k);
148
+ if (t.done && !isDropped(t) && history) {
149
+ const gone = t.files.some((f) => {
150
+ const p = f.replace(/\/$/, '');
151
+ return !f.includes('*') && !existsSync(join(root, p)) && gitOut(root, 'log', '--all', '--format=%H', '-n', '1', '--', p) === '';
152
+ });
153
+ if (gone)
154
+ add(t, 'never_existed');
155
+ }
156
+ if (!t.done && verify && t.files.length && t.files.every((f) => f.endsWith('.md')) && t.accept === verify)
157
+ add(t, 'acceptance');
158
+ if (!t.done && kids.length && kids.every(tickedTask))
159
+ add(t, 'parent_unticked');
160
+ if (!t.done && kids.length && (t.files.length || t.accept))
161
+ add(t, 'parent_acceptance');
162
+ }
163
+ for (const slug of listFeatures(root)) {
164
+ const rel = `${FLOW_DIR}/features/${slug}/SPEC.md`;
165
+ let text = '';
166
+ try {
167
+ text = readFileSync(join(root, rel), 'utf8');
168
+ }
169
+ catch {
170
+ continue;
171
+ }
172
+ const heads = unfenced(text).flatMap(({ l, n }) => {
173
+ const m = SPEC_HEAD.exec(l);
174
+ return m ? [{ rank: SPEC_ORDER.indexOf(m[1]), line: n }] : [];
175
+ });
176
+ const bad = heads.find((h, i) => heads.slice(0, i).some((p) => p.rank > h.rank));
177
+ if (bad)
178
+ out.push({ file: rel, line: bad.line, rule: 'spec_order' });
179
+ }
180
+ return out;
181
+ }
182
+ export function renderAlignment(issues, lang = 'en') {
183
+ if (!issues.length)
184
+ return [];
185
+ return [
186
+ t(lang, 'docs_align_title'),
187
+ ...issues.map((i) => ` ${i.file}:${i.line} ${t(lang, `align_${i.rule}`)} — ${t(lang, `align_fix_${i.rule}`)}`),
188
+ ];
124
189
  }
125
190
  /** `cto docs`: the report, then the brain saved with what other hooks wrote during the Jev calls (saveKeeping). */
126
191
  export async function runDocs(root, lang) {
@@ -130,10 +195,10 @@ export async function runDocs(root, lang) {
130
195
  return lines;
131
196
  }
132
197
  const GROUPS = ['delete', 'merge', 'archive', 'ask'];
133
- export function renderDocs(c, lang = 'en') {
134
- if (!c.length)
198
+ export function renderDocs(c, lang = 'en', align = []) {
199
+ if (!c.length && !align.length)
135
200
  return [t(lang, 'docs_none')];
136
- const L = [];
201
+ const L = c.length ? [] : [t(lang, 'docs_none')];
137
202
  for (const verdict of GROUPS) {
138
203
  const rows = c.filter((d) => d.verdict === verdict);
139
204
  if (!rows.length)
@@ -146,6 +211,11 @@ export function renderDocs(c, lang = 'en') {
146
211
  L.push(` ${d.file} ${d.open} open · ${d.done} done · ${age} — ${d.reason}`);
147
212
  }
148
213
  }
214
+ if (align.length) {
215
+ if (L.length)
216
+ L.push('');
217
+ L.push(...align);
218
+ }
149
219
  L.push('', t(lang, 'docs_footer'));
150
220
  return L;
151
221
  }
package/dist/flow.js CHANGED
@@ -6,7 +6,8 @@ import { ACCEPT, acceptValue, BOX } from './turn.js';
6
6
  export const FLOW_DIR = 'docs/cto_jev';
7
7
  export const FEATURE_FILES = ['CONCEPT.md', 'SPEC.md', 'TASKS.md', 'REVIEW.md'];
8
8
  const ID = /^([A-Z][A-Z0-9]*-\d+(?:\.\d+)*)\b\s*/;
9
- const TAG = /\s*\((after|files):\s*([^)]*)\)/g;
9
+ // A code span is matched first so a tag quoted in one is left alone; a tag value may hold one level of parens (`(tabs)`) and backticked paths.
10
+ const CODE_OR_TAG = /(`[^`]*`)|\s*\((after|files):\s*((?:[^()`]|`[^`]*`|`(?![^`]*`)|\([^()]*\))*)\)/g; // a lone backtick only when no closing one follows: otherwise `a` could match two ways and backtrack exponentially
10
11
  const PRIORITY = /\s*\((P[123])\)/;
11
12
  const SEQ = /\s*\(seq\)/;
12
13
  const list = (s) => s.split(/[,,]/).map((x) => x.trim()).filter(Boolean);
@@ -53,14 +54,23 @@ export function parseTasks(text, feature, file) {
53
54
  let priority;
54
55
  let seq = false;
55
56
  const text = m[3].slice(idm[0].length)
56
- .replace(TAG, (_, k, v) => { (k === 'after' ? after : files).push(...list(v)); return ''; })
57
+ .replace(CODE_OR_TAG, (s, code, kind, v) => {
58
+ if (code)
59
+ return code;
60
+ (kind === 'after' ? after : files).push(...list(v.replace(/`([^`]*)`/g, '$1'))); // a lone backtick stays a character
61
+ return '';
62
+ })
63
+ // Odd parts of the split are inline code: a tag quoted there ("quotes `(seq)`") is text, not a tag.
64
+ .split(/(`[^`]*`)/)
65
+ .map((s, k) => (k % 2 ? s : s
57
66
  .replace(PRIORITY, (_, p) => { priority = p; return ''; })
58
- .replace(SEQ, () => { seq = true; return ''; })
67
+ .replace(SEQ, () => { seq = true; return ''; })))
68
+ .join('')
59
69
  .trim();
60
70
  while (stack.length && stack[stack.length - 1].indent >= indent)
61
71
  stack.pop();
62
72
  const parent = stack[stack.length - 1]?.id;
63
- const t = { id: idm[1], text, done: m[2] !== ' ', feature, file, line: i + 1, parent, children: [], after, files, ...(priority ? { priority } : {}), ...(seq ? { seq } : {}) };
73
+ const t = { id: idm[1], text, done: m[2] !== ' ', feature, file, line: i + 1, parent, children: [], after, files: files.filter((f) => f !== '-'), ...(priority ? { priority } : {}), ...(seq ? { seq } : {}) };
64
74
  if (parent)
65
75
  tasks.find((p) => p.id === parent)?.children.push(t.id);
66
76
  tasks.push(t);
package/dist/i18n.js CHANGED
@@ -125,6 +125,17 @@ const messages = {
125
125
  docs_group_archive: () => '封存到 docs/cto_jev/archive/',
126
126
  docs_group_ask: () => '要看一下',
127
127
  docs_footer: () => 'cto 只給建議:沒有移動或刪除任何檔案。',
128
+ docs_align_title: () => 'docs/cto_jev/ 對齊檢查(只用規則)',
129
+ align_never_existed: () => '路徑從沒存在過',
130
+ align_fix_never_existed: () => '改成真正改到的路徑',
131
+ align_acceptance: () => '驗收不會失敗',
132
+ align_fix_acceptance: () => '改成會因內容錯而失敗的指令,例如 grep -q \'<新寫的那句>\' <檔>',
133
+ align_parent_unticked: () => '上層漏勾',
134
+ align_fix_parent_unticked: () => '勾上層',
135
+ align_parent_acceptance: () => '上層自帶驗收',
136
+ align_fix_parent_acceptance: () => '移到一個子項',
137
+ align_spec_order: () => 'SPEC 段落順序',
138
+ align_fix_spec_order: () => '照順序排',
128
139
  local_flow_interface: (v) => `[cto] ${v.detail}:SPEC 的 Interface 改了。依賴它的 feature 要重看自己的 task;這次不擋。`,
129
140
  setup_not_git: () => '[cto] 這裡不是 git repository,setup 中止。',
130
141
  setup_bad_json: (v) => `[cto] ${v.path} 不是合法 JSON 或 hooks 格式不符,未修改任何檔案。請先修正該檔。`,
@@ -407,6 +418,17 @@ const messages = {
407
418
  docs_group_archive: () => 'Archive to docs/cto_jev/archive/',
408
419
  docs_group_ask: () => 'Needs a look',
409
420
  docs_footer: () => 'cto only suggests: nothing was moved or deleted.',
421
+ docs_align_title: () => 'Alignment checks for docs/cto_jev/ (rules only)',
422
+ align_never_existed: () => 'path never existed',
423
+ align_fix_never_existed: () => 'change it to the path actually changed',
424
+ align_acceptance: () => 'acceptance cannot fail',
425
+ align_fix_acceptance: () => 'use a check that fails on wrong content, e.g. grep -q \'<new sentence>\' <file>',
426
+ align_parent_unticked: () => 'parent unticked',
427
+ align_fix_parent_unticked: () => 'tick the parent',
428
+ align_parent_acceptance: () => 'parent with own acceptance',
429
+ align_fix_parent_acceptance: () => 'move it to a child',
430
+ align_spec_order: () => 'SPEC section order',
431
+ align_fix_spec_order: () => 'reorder to match',
410
432
  local_flow_interface: (v) => `[cto] ${v.detail}: the SPEC's Interface changed. Dependent features must re-check their tasks; not blocking.`,
411
433
  setup_not_git: () => '[cto] Not a git repository, setup aborted.',
412
434
  setup_bad_json: (v) => `[cto] ${v.path} is not valid JSON or has an unexpected hooks shape. Nothing was changed. Fix it first.`,
package/dist/setup.js CHANGED
@@ -9,6 +9,7 @@ import { MODEL_KEYS, MSG, advisorOf, agentsDir, applyModels, clearScope, driftCh
9
9
  import { AGENT_FILES, FLOW_COMMAND_PATH, FLOW_SKILL_PATH, SKILL_MARK, guidancePaths, syncFlowSkill, syncGuidance } from './skill.js';
10
10
  import { findConflicts } from './conflicts.js';
11
11
  import { FLOW_DIR } from './flow.js';
12
+ import { TEST_FILE } from './tests.js';
12
13
  const START = '# >>> YOUR CTO JEV START >>>';
13
14
  const END = '# <<< YOUR CTO JEV END <<<';
14
15
  // Keep the block minimal: all logic (including the git diff call) lives in the package, so npm update upgrades every repo.
@@ -41,6 +42,8 @@ export function appendBlock(content, body) {
41
42
  export function hasEarlyExit(content) {
42
43
  return /^\s*exit\s+0\b/m.test(removeBlock(content));
43
44
  }
45
+ // Test file names outside JS/TS, so a mature Python, Go, Ruby, JVM, .NET or Rust repo is not taken for a new project.
46
+ const ANY_LANG_TEST = /(^|\/)(test_[^/]*\.py|[^/]*_test\.(py|go)|[^/]*_spec\.rb|[^/]*Tests?\.(java|kt|cs)|tests\/[^/]*\.rs)$/;
44
47
  const git = (cwd, ...args) => execFileSync('git', args, { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim();
45
48
  /**
46
49
  * IGNORE_BODY entries the repo's own .gitignore does not already cover outside our block: an exact line, or any rule there
@@ -506,7 +509,14 @@ export function setup(cwd, lang, opts = {}) {
506
509
  let goal = '';
507
510
  if (!existsSync(cfgPath)) {
508
511
  // Thresholds are left out on purpose: the package defaults apply and improve with each release. Add only overrides.
509
- writeFileSync(cfgPath, JSON.stringify({ sprint_goal: '', thresholds: {} }, null, 2) + '\n');
512
+ // A new project starts as a prototype (CONCEPT: 專案分兩個階段). New = flow on and no tracked test file yet.
513
+ let tracked = [];
514
+ try {
515
+ tracked = git(root, 'ls-files', '-z').split('\0');
516
+ }
517
+ catch { /* not a git repo yet: nothing tracked */ }
518
+ const fresh = flow && !tracked.some((f) => TEST_FILE.test(f) || ANY_LANG_TEST.test(f));
519
+ writeFileSync(cfgPath, JSON.stringify({ sprint_goal: '', ...(fresh ? { stage: 'prototype' } : {}), thresholds: {} }, null, 2) + '\n');
510
520
  lines.push(t(lang, 'setup_config'));
511
521
  }
512
522
  else {
package/dist/skill.js CHANGED
@@ -34,7 +34,7 @@ ${SKILL_HEAD}
34
34
  You review changes you have never seen, with no context beyond the repository and the request. Do not trust the author's intent or the request's claims; check the code.
35
35
 
36
36
  1. Run \`git status\` and \`git diff HEAD\` to see what changed, then read the changed files and the code that calls them.
37
- 2. Look for wrong logic, missed edge cases, broken callers, security holes, data loss, and tests that were skipped, deleted or loosened. A new test that repeats what an existing test already checks, a new test file where the existing test file for that code would do, or a test heavier than it needs (a real database or server where a unit test would check the same thing) is a P2.
37
+ 2. Look for wrong logic, missed edge cases, broken callers, security holes, data loss, and tests that were skipped, deleted or loosened. A new test that repeats what an existing test already checks, a new test file where the existing test file for that code would do, or a test heavier than it needs (a real database or server where a unit test would check the same thing) is a P2. If the prompt says \`stage: prototype\`, a missing or thin test is no finding at all; the rest of this rule still applies, and so does the question every acceptance test answers (would it fail if its scenario were broken): a test that is there must not pass on broken behavior.
38
38
  3. Never edit, write or delete anything. Use Bash only for read-only commands (git diff, git log, git show, running a single test file of the changed code). Never run a whole test suite: the author already ran the acceptance commands, and a whole suite run beside another one can share its test database and break both.
39
39
 
40
40
  Output one finding per line, each starting with P1 (must fix: a bug, a security hole, data loss), P2 (should fix) or P3 (minor), then \`file:line\` and the problem in one sentence. A P1 or P2 about behaviour names the input or state that produces the wrong result; a behaviour concern you cannot tie to one is not reported. A test that was skipped, deleted or loosened, a broken Constraint or Interface, and code that does something the CONCEPT does not say need no such input: report them as they are. Nothing else before or after. No findings: write \`No findings.\`
@@ -147,13 +147,13 @@ turns it into a calibration case; you do not run that yourself.
147
147
  - \`cto check\`: preview the commit checks on your current changes.
148
148
  - \`cto doctor\`: show whether cto is working here (keys, hooks, recent checks).
149
149
  - \`cto index\`: regenerate \`docs/cto_jev/INDEX.md\` (only in a repo that uses the development flow).
150
- - \`cto docs\`: list stale planning markdown outside \`docs/cto_jev/\` with a suggestion per file; changes nothing.
150
+ - \`cto docs\`: list stale planning markdown outside \`docs/cto_jev/\` with a suggestion per file, and the alignment checks of \`docs/cto_jev/\` itself; changes nothing.
151
151
  `;
152
152
  // The flow skill: how the host agent plans, dispatches and accepts work under docs/cto_jev/. Written only when
153
153
  // `cto setup` chose the flow.
154
154
  export const FLOW_SKILL_TEXT = `---
155
155
  name: cto-jev
156
- description: The development flow of this repo, kept in docs/cto_jev/. Invoked by saying the job's name (in Claude Code: /cto-jev <job>; in Codex: $cto-jev). Its jobs are named so they cannot be confused with another skill's steps - "cto-jev init" (first-time setup, also "set up PRODUCT.md and ARCHITECTURE.md"), "cto-jev feature" (a request bigger than one edit), "cto-jev tasks" (break a signed-off concept down), "cto-jev work" (dispatch, accept, review and commit every wave, without stopping in between), "cto-jev work all" (the same on a branch, every wave reviewed, then the hand-over to release), "cto-jev release" (review everything unreleased, then merge to main), "cto-jev docs" (clean up old documents), "cto-jev decision" (record an architecture decision), "cto-jev decide" (put everything waiting on the user in one menu). Load it when the user names one of them, and whenever you are about to plan, dispatch, tick a task or commit.
156
+ description: The development flow of this repo, kept in docs/cto_jev/. Invoked by saying the job's name (in Claude Code: /cto-jev <job>; in Codex: $cto-jev). Its jobs are named so they cannot be confused with another skill's steps - "cto-jev init" (first-time setup, also "set up PRODUCT.md and ARCHITECTURE.md"), "cto-jev feature" (a request bigger than one edit), "cto-jev tasks" (break a signed-off concept down), "cto-jev work" (dispatch, accept, review and commit every wave, without stopping in between), "cto-jev work all" (the same on a branch, every wave reviewed, then the hand-over to release), "cto-jev release" (review everything unreleased, then merge to main), "cto-jev docs" (clean up old documents, and check that docs/cto_jev/ agrees with itself, the code and the tests), "cto-jev decision" (record an architecture decision), "cto-jev decide" (put everything waiting on the user in one menu). Load it when the user names one of them, and whenever you are about to plan, dispatch, tick a task or commit.
157
157
  ---
158
158
  ${SKILL_HEAD}
159
159
 
@@ -275,6 +275,15 @@ Two more tags, on any task:
275
275
  驗收: npx playwright test e2e/customers/tier.spec.ts
276
276
  \`\`\`
277
277
 
278
+ ## Stage
279
+
280
+ \`cto brief\` shows \`Stage prototype\` when \`.cto.json\` has \`"stage": "prototype"\` (\`cto setup\` writes it for a new project); without it the stage is \`build\`. In prototype, these rules take precedence over the rest of this skill:
281
+ - The goal is an app the user can try. Plan and run the main path first, from the first screen to the result the product promises, before anything else is hardened.
282
+ - A task's acceptance is the lightest command that shows it works (a build, a smoke test that the app starts and answers), or \`manual: <what to try> @ <where>\` for what the user sees. Write no end-to-end harness, and no unit or database test beyond what that acceptance needs.
283
+ - Trouble with the test setup itself (a flaky harness, a test database that crashes) becomes a \`platform\` task for the build stage, not work now.
284
+ - Every \`cto-reviewer\` dispatch prompt says \`stage: prototype\`. Wrong behavior, security holes, secrets and data loss are still P1.
285
+ - When the user can walk the main path, put "switch to build?" in the run's final report. The user decides; only then set \`"stage": "build"\` and plan the tests the main path needs.
286
+
278
287
  ## cto-jev work
279
288
 
280
289
  **When:** the user says "cto-jev work" or "continue", or \`cto brief\` shows Ready tasks.
@@ -287,7 +296,7 @@ Every wave, one after another, until nothing is Ready. Do not ask before a wave
287
296
  2. One sub-agent per task. Give it only: the task line, the feature's SPEC.md, the \`## Interface\` of each feature it depends on, the list of files it may touch, and "do not edit anything else, write nothing outside this repo (no notes, no lesson logs), no git commands, run only your task's acceptance command and the test file you wrote, never a whole test suite (other agents run tests at the same time, and whole suites can share one test database); report what you changed and what you found ambiguous". Each sub-agent writes its own new test file; nobody appends to a shared one. A task accepted by an end-to-end test also gets the Acceptance lines it covers: the test is written from them first and seen failing, then the code.
288
297
  3. When they return: \`git status\`; revert anything outside the union of their \`(files:)\`. Integrate the shared files yourself. Fix any existing test their change broke. A sub-agent's "the SPEC does not say" goes into the SPEC now, not into the code's comments.
289
298
  4. Accept by running the task's acceptance command yourself; never trust the report. Tick only on a pass. A wave runs only its own tasks' acceptance commands plus the end-to-end tests of the features it touches (\`e2e/<slug>/\`); when it changes a \`platform\` file or a shared file you integrated (step 3), run the whole end-to-end suite instead. The whole unit and end-to-end suites run once in a feature's cleanup wave and once in the release, never in every wave. Like a wave that changes a \`platform\` or shared file, a wave that touches a feature whose end-to-end tests are not yet in \`e2e/<slug>/\` runs the whole end-to-end suite. When \`cto brief\` lists test files outside every feature folder (in the \`e2e/\` root or a flat folder such as \`e2e/tests/\`), do not move them on your own: put "split the end-to-end tests into feature folders?" in the run's final report menu, with how many files and how long the whole suite takes. If the user says yes, add a \`platform\` task for the split whose text starts exactly \`Split the end-to-end tests into feature folders\`, in English whatever language the rest of TASKS.md uses (brief knows it by that text and stops asking while it is open), tagged \`(seq)\`, whose \`(files:)\` hold \`e2e/\` plus each file that holds the test runner's file pattern (\`playwright.config.ts\`, \`package.json\`); it runs as a wave of its own, reviewed and committed alone. The split goes test by test, not file by file: a test goes into the folder of the feature whose task ids or Acceptance scenario it tests; a test that walks through several features goes to the feature whose SPEC holds its scenario; a check of the whole app (smoke, error page, layout of every page, the test harness) goes to \`e2e/platform/\`; shared helpers stay in the root. Update imports, the test runner's file pattern (a root-only glob such as \`e2e/*.test.ts\` finds nothing in subfolders) and open tasks' acceptance paths; the whole end-to-end suite must pass with as many tests as before. If the user says no, set \`"e2e_folders": false\` in \`.cto.json\`: brief stops listing them, and every wave keeps running the whole end-to-end suite. A failing end-to-end test means the code is wrong. If you think the expectation is wrong instead, the CONCEPT decides: where it backs the scenario, the code is wrong after all; where it says otherwise, fix the SPEC's Acceptance first, then the test, and note it in the wave's REVIEW.md entry; where it is silent, do the same and add an \`Assumed: ...\` line. Never change a test to match the code without changing the Acceptance line it came from. \`manual\` does not wait for the user: build it, run what can be run, take screenshots at each width the Acceptance names, and tick it. cto reminds the user with the text on its acceptance line, and your final report lists every manual task of the run with that text and the screenshot paths. A task the user decided not to do: add \`(dropped: <reason>)\` to its line, tick it, and say "<id> dropped" in your final message. Dropping is the user's call: a task you think is no longer needed (what it checks is gone) is parked and listed in your report with that reason, never dropped by you; never drop a task to get past a block. A dropped task counts as closed, so the tasks that wait on it (\`(after:)\`) become Ready: drop or re-plan them first. Tick the parent when its last child is ticked.
290
- 5. **Review before you commit.** Before dispatching, run the project's formatter, if any, so the review sees the final tree. Then dispatch \`subagent_type: "cto-reviewer"\` with no model parameter (it runs on Opus), with none of your context: it reads the feature's CONCEPT.md and SPEC.md and the whole uncommitted change of the wave, and returns findings each marked P1 (wrong, unsafe, breaks a Constraint or the Interface, does something the CONCEPT does not say or contradicts, or an acceptance test that would still pass with its scenario broken), P2 (should improve, can wait) or P3 (minor). You wrote both the code and its tests, so the reviewer answers one question per acceptance test: if the scenario were not met, would this test fail. Handle them as under "Review findings": fix every P1 now and re-run acceptance; write every P2 and P3 as a task with its severity (\`(P2)\`, \`(P3)\`) in TASKS.md whose text starts with exactly \`Review finding (wave <ids>):\`, in English whatever language the rest of TASKS.md uses. A cleanup wave's review is the exception: its P2s and P3s become no task and go under \`Left for the user:\` instead (see "Review findings"). Append one entry to REVIEW.md: date, scope (the task ids of the wave), how many P1/P2, which task ids they became, what was contested or escalated. The dispatch prompt names the wave's task ids, every changed path, and the acceptance commands you ran with their results (the reviewer runs no whole suite, so it is never asked to run the verify command from \`cto brief\`); it never dictates the verdict and never drops a changed path. After fixing P1s, run the formatter again before every re-dispatch; then dispatch again on the whole change, never on the fix alone. Where Claude Code is wired and the review gate is on, only a Claude Code session can satisfy the gate, so other agents (with or without sub-agents) hand the wave over as below.
299
+ 5. **Review before you commit.** Before dispatching, run the project's formatter, if any, so the review sees the final tree. Then dispatch \`subagent_type: "cto-reviewer"\` with no model parameter (it runs on Opus), with none of your context: it reads the feature's CONCEPT.md and SPEC.md and the whole uncommitted change of the wave, and returns findings each marked P1 (wrong, unsafe, breaks a Constraint or the Interface, does something the CONCEPT does not say or contradicts, or an acceptance test that would still pass with its scenario broken), P2 (should improve, can wait) or P3 (minor). You wrote both the code and its tests, so the reviewer answers one question per acceptance test: if the scenario were not met, would this test fail. Handle them as under "Review findings": fix every P1 now and re-run acceptance; write every P2 and P3 as a task with its severity (\`(P2)\`, \`(P3)\`) in TASKS.md whose text starts with exactly \`Review finding (wave <ids>):\`, in English whatever language the rest of TASKS.md uses. A cleanup wave's review is the exception: its P2s and P3s become no task and go under \`Left for the user:\` instead (see "Review findings"). Append one entry to REVIEW.md: date, scope (the task ids of the wave), how many P1/P2, which task ids they became, what was contested or escalated. The dispatch prompt names the wave's task ids, \`stage: prototype\` when brief shows it, every changed path, and the acceptance commands you ran with their results (the reviewer runs no whole suite, so it is never asked to run the verify command from \`cto brief\`); it never dictates the verdict and never drops a changed path. After fixing P1s, run the formatter again before every re-dispatch; then dispatch again on the whole change, never on the fix alone. Where Claude Code is wired and the review gate is on, only a Claude Code session can satisfy the gate, so other agents (with or without sub-agents) hand the wave over as below.
291
300
  6. \`cto check\`, then commit the wave to the review branch. A review with no P1 left to fix (none found, or every one contested or escalated in REVIEW.md) is committed as it stands: change no code between it and the commit (REVIEW.md and TASKS.md are not code), since a change to any file the gate counts as code makes it ask for another whole review. A P2 or P3 is a task (in a cleanup wave, a line under \`Left for the user:\`), never a fix made now. Only when \`cto check\` or a git hook blocks the commit and its fix changes code is the whole change reviewed again; that review counts toward the three rounds under "Review findings". The same holds for fixes made in conversation (the user reports a bug and you fix it on the spot): give them a task line with an acceptance command as in step 1, then review and commit them before the user moves on to other work, not at the next run.
292
301
 
293
302
  Without sub-agents: do the Ready tasks yourself in brief's order, one at a time, accepting each before the next; review your own diff against the SPEC before each commit. That is not a review by a fresh reader: write \`self-review\` in its REVIEW.md entry, so the release review looks harder at those waves. Where Claude Code is wired and the review gate is on, a self-review cannot pass the commit gate (the gate needs a cto-reviewer review of the exact tree): keep the wave's tasks ticked, leave the tree uncommitted, stop the run, and say in the final report that the wave is waiting for a cto-reviewer review in a Claude Code session.
@@ -313,14 +322,14 @@ Without sub-agents: do the Ready tasks yourself in brief's order, one at a time,
313
322
 
314
323
  ## Review findings
315
324
 
316
- Every review (docs, wave, release) ends here. You wrote what was reviewed, so wanting to disagree is not evidence.
325
+ Every review (docs, alignment, wave, release) ends here. You wrote what was reviewed, so wanting to disagree is not evidence.
317
326
 
318
327
  - **Contest** a finding only by citing something the reviewer could read: a file and symbol, or a decision written in the docs. "It was intentional" is not evidence.
319
328
  - **Escalate** to the user when the evidence is outside anything the reviewer could read (a verbal decision, a team convention). Do not dismiss it yourself; if the user confirms, write the fact into the docs.
320
329
  - A reviewer who could not follow the docs found missing context. Never contest that.
321
330
  - Never change a severity yourself. A P1 that looks like a P2 is contested like any finding, with evidence, and the user decides.
322
- - An escalated finding, or a contest the user has not decided, does not stop a run: leave that finding unfixed, write it into the REVIEW.md entry, go on, and list it in your final report and the release report. In a docs review it goes into the handoff's "might be missing" instead, since that job stops for sign-off anyway. Before escalating, read the CONCEPT: what it decides is not the user's to decide again.
323
- - After fixing P1s, a new \`cto-reviewer\` (no model parameter, none of your context) re-reviews the whole current change, never the fix alone: the commit gate matches a review to the exact working tree, so a review of the fix alone does not cover what is committed. Run the formatter again before every re-dispatch. At most three rounds per review: the first plus up to two whole-change re-reviews. If P1s remain after round three, stop fixing: write each one into the REVIEW.md entry marked as escalated to the user (the commit gate accepts that), leave it unfixed, and hand it to the user. Anything below P1 becomes a task with its severity, except in a cleanup review (next rule) (in a docs review, where no tasks may exist yet: fixed in the docs or put in the handoff's "might be missing").
331
+ - An escalated finding, or a contest the user has not decided, does not stop a run: leave that finding unfixed, write it into the REVIEW.md entry, go on, and list it in your final report and the release report. In the pre-sign-off docs review of \`cto-jev init\` and \`feature\` (not the alignment review of \`cto-jev docs\`) it goes into the handoff's "might be missing" instead, since that job stops for sign-off anyway. Before escalating, read the CONCEPT: what it decides is not the user's to decide again.
332
+ - After fixing P1s, a new \`cto-reviewer\` (no model parameter, none of your context) re-reviews the whole current change, never the fix alone: the commit gate matches a review to the exact working tree, so a review of the fix alone does not cover what is committed. Run the formatter again before every re-dispatch. At most three rounds per review: the first plus up to two whole-change re-reviews. If P1s remain after round three, stop fixing: write each one into the REVIEW.md entry marked as escalated to the user (the commit gate accepts that), leave it unfixed, and hand it to the user. Anything below P1 becomes a task with its severity, except in a cleanup review (next rule) (in the pre-sign-off docs review, where no tasks may exist yet: fixed in the docs or put in the handoff's "might be missing").
324
333
  - **Findings below P1 are batched, not chained.** A finding task is one whose text starts \`Review finding (\`, or, for one filed before that marker existed, whose text says it came from a review in any wording. Finding tasks wait while their feature has any other Ready task you would dispatch; parked tasks, finding tasks and tasks blocked on a finding task do not count. Then all of the feature's Ready finding tasks run as one cleanup wave: dispatched as usual (\`(seq)\` and overlapping \`(files:)\` still run one after another), each accepted, then one review over the whole cleanup and one commit. A finding task's test is a unit or database test, unless the finding is an Acceptance scenario that is broken for the user; then it is that scenario's end-to-end test. What that cleanup review finds below P1 does not become a task: write it into the cleanup's REVIEW.md entry under \`Left for the user:\` and list it in the final report and the release report. It becomes a task only when the user asks for it.
325
334
  - Without sub-agents every review here, the re-review included, is your own: say \`self-review\` in its REVIEW.md entry. Where Claude Code is wired and the review gate is on, that self-review cannot pass the commit gate: keep its tasks ticked, leave the tree uncommitted, stop the run, and say in the final report that it is waiting for a cto-reviewer review in a Claude Code session.
326
335
 
@@ -347,13 +356,17 @@ Whatever the row, one rule holds: the branch that reaches users receives nothing
347
356
 
348
357
  **Stop:** before the merge, with the P1/P2/P3 lists in front of the user.
349
358
 
359
+ **After the user merges:** if the tree has uncommitted changes, skip this and say so in your report; never stash or discard them for it. Otherwise \`git checkout <release branch>\` and \`git pull\` (a merge on the host leaves the local copy behind, and the branch you stand on cannot be deleted), \`git fetch --prune\`, then delete the local branches whose work is merged, never the release branch, the integration branch or the deploy branches. On GitHub these are the head branches of merged PRs (\`gh pr list --state merged --json headRefName,headRefOid\`) whose local tip is still that \`headRefOid\`, deleted with \`git branch -D\`: a squash or rebase merge leaves commits \`git branch -d\` does not recognise. Elsewhere, delete only the branch this release merged, with \`git branch -d\`. A branch with no merged PR (one just created and not yet committed to) stays. On the remote, delete the merged feature or \`work-all\` branch only if the host did not already (on GitHub, the repo setting "Automatically delete head branches" does it; if it is off, put "turn it on?" in your report).
360
+
350
361
  ## cto-jev docs
351
362
 
352
363
  **When:** the user says "cto-jev docs", before opening a feature, or when the user asks to tidy the repo.
353
364
 
354
- 1. \`cto docs\`. It lists markdown outside \`docs/cto_jev/\` that looks like an old plan, grouped as Delete / Merge into a feature / Archive / Needs a look. It changes nothing.
355
- 2. Show the list to the user with one line per file; they decide.
356
- 3. Then act: merge = fold the still-open items into the right TASKS.md or SPEC.md and delete the file; archive = move to \`docs/cto_jev/archive/<YYYYMM>-<name>/\`; delete = \`git rm\`. Never act before the user answers.
365
+ 1. \`cto docs\`. It lists two things and changes nothing. First, markdown outside \`docs/cto_jev/\` that looks like an old plan, grouped as Delete / Merge into a feature / Archive / Needs a look. Second, the alignment checks on \`docs/cto_jev/\` itself: five rule-based checks, each finding with file:line, the rule and how to fix it (a \`(files:)\` path that never existed, a task verified only by a command that cannot fail, a parent not ticked over ticked children, a parent that carries its own acceptance, SPEC sections out of order).
366
+ 2. Show the old-plan list to the user with one line per file; they decide.
367
+ 3. Then act on that list: merge = fold the still-open items into the right TASKS.md or SPEC.md and delete the file; archive = move to \`docs/cto_jev/archive/<YYYYMM>-<name>/\`; delete = \`git rm\`. Never act before the user answers.
368
+ 4. Alignment: handle every item \`cto docs\` listed, without waiting for the user (step 5 says how each one is handled). Then dispatch \`subagent_type: "cto-reviewer"\` with no model parameter and none of your context, over \`docs/cto_jev/\`, README.md and the test files. It answers four questions: the same rule written in two docs (name the doc that owns it), docs that contradict each other, docs that disagree with the code, and SPEC behavior with no test. Also run \`cto tests\` and add the files it flags to that list.
369
+ 5. Findings follow "Review findings", except where this step says otherwise. Severity of a \`cto docs\` rule finding: P2 by default, P1 when the doc it sits in tells an agent something false that would lead it to wrong work. None of the five rules is P1 by itself, so judge each case on what the doc says. A reviewer's finding keeps the severity the reviewer gave. P1 is fixed now. Every P2 and P3 becomes a task whose text starts \`Review finding (docs):\`, in the feature whose doc holds the problem, or in \`platform\` when the finding spans features or sits in PRODUCT, ARCHITECTURE, INDEX or README. Write one REVIEW.md entry in each feature that got a fix or a task, listing them. An alignment fix does not wait for the user, except an edit to a sign-off doc (CONCEPT, PRODUCT or ARCHITECTURE): that goes through draft and sign-off as usual, with \`Status: draft\` set by the Edit tool first.
357
370
 
358
371
  ## cto-jev decision
359
372
 
package/dist/tests.js CHANGED
@@ -13,7 +13,7 @@ const UNTRACED_MIN = 0.6;
13
13
  const REPEATS_MIN = 0.6;
14
14
  const PART_TOKENS = 7000; // a test file; two of them for a pair
15
15
  const SPEC_TOKENS = 12000; // with a test file, inside Jev's 24k chunk
16
- const TEST_FILE = /\.(test|spec|cy)\.[cm]?[jt]sx?$/;
16
+ export const TEST_FILE = /\.(test|spec|cy)\.[cm]?[jt]sx?$/;
17
17
  const UNTRACED = {
18
18
  untraced: { type: 'noul', instructions: 'Do several tests in this test file check behaviour that no line of this SPEC (Interface, Constraints, Acceptance) asks for?' },
19
19
  };
@@ -51,7 +51,7 @@ const terms = (s) => new Set([
51
51
  ...[...s.matchAll(/(?=([ -鿿]{2}))/g)].map((m) => m[1]),
52
52
  ]);
53
53
  /**
54
- * The SPEC sections a test should trace to. A big SPEC (meantte's chart: 22k tokens) does not fit beside the test, and a
54
+ * The SPEC sections a test should trace to. A big SPEC (22k tokens seen in practice) does not fit beside the test, and a
55
55
  * clipped one hides the lines the test traces to, so then only the lines sharing a word or a CJK pair with the test go,
56
56
  * the most shared first, kept in SPEC order.
57
57
  */
package/dist/turn.js CHANGED
@@ -228,8 +228,8 @@ const MANUAL = /^manual(?![\w./-])/i;
228
228
  export const isManualAccept = (accept) => MANUAL.test(squash(accept ?? ''));
229
229
  const TASK_ID = /^[A-Z][A-Z0-9]*-\d+(?:\.\d+)*\b/;
230
230
  const DROPPED = /[((]dropped[::]\s*[^))\s][^))]*[))]/i;
231
- /** A task closed without doing it: `(dropped: reason)` on its line, then ticked. */
232
- export const isDropped = (t) => DROPPED.test(t.text);
231
+ /** A task closed without doing it: `(dropped: reason)` on its line, then ticked. A marker quoted in inline code is text. */
232
+ export const isDropped = (t) => DROPPED.test(t.text.replace(/`[^`]*`/g, ''));
233
233
  /** The task's id, or its first words when it has none: how messages name it. */
234
234
  export const taskName = (t) => TASK_ID.exec(t.text)?.[0] ?? squash(t.text.replace(DROPPED, '')).slice(0, 30);
235
235
  const esc = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "your-cto-jev",
3
- "version": "0.19.0",
3
+ "version": "0.21.0",
4
4
  "description": "A sharp-tongued CTO gatekeeper for AI coding agents: blocks leaked secrets in git commits and destructive shell commands in Claude Code, Cursor, Gemini CLI and Codex, using TypeSafe Jev.",
5
5
  "keywords": [
6
6
  "claude-code",
@@ -49,7 +49,7 @@
49
49
  "access": "public"
50
50
  },
51
51
  "dependencies": {
52
- "@clack/core": "1.5.1",
53
- "@clack/prompts": "1.8.1"
52
+ "@clack/core": "1.6.0",
53
+ "@clack/prompts": "1.9.0"
54
54
  }
55
55
  }