your-cto-jev 0.20.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 +4 -2
- package/dist/docs.js +86 -16
- package/dist/flow.js +14 -4
- package/dist/i18n.js +22 -0
- package/dist/setup.js +3 -1
- package/dist/skill.js +12 -10
- package/dist/tests.js +1 -1
- package/dist/turn.js +2 -2
- package/package.json +1 -1
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
|
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
|
-
|
|
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
|
-
/**
|
|
29
|
-
function
|
|
30
|
-
let fenced = false
|
|
31
|
-
|
|
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
|
-
|
|
37
|
+
return [];
|
|
35
38
|
}
|
|
36
|
-
|
|
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
|
-
|
|
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(
|
|
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
|
@@ -42,6 +42,8 @@ export function appendBlock(content, body) {
|
|
|
42
42
|
export function hasEarlyExit(content) {
|
|
43
43
|
return /^\s*exit\s+0\b/m.test(removeBlock(content));
|
|
44
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)$/;
|
|
45
47
|
const git = (cwd, ...args) => execFileSync('git', args, { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim();
|
|
46
48
|
/**
|
|
47
49
|
* IGNORE_BODY entries the repo's own .gitignore does not already cover outside our block: an exact line, or any rule there
|
|
@@ -513,7 +515,7 @@ export function setup(cwd, lang, opts = {}) {
|
|
|
513
515
|
tracked = git(root, 'ls-files', '-z').split('\0');
|
|
514
516
|
}
|
|
515
517
|
catch { /* not a git repo yet: nothing tracked */ }
|
|
516
|
-
const fresh = flow && !tracked.some((f) => TEST_FILE.test(f));
|
|
518
|
+
const fresh = flow && !tracked.some((f) => TEST_FILE.test(f) || ANY_LANG_TEST.test(f));
|
|
517
519
|
writeFileSync(cfgPath, JSON.stringify({ sprint_goal: '', ...(fresh ? { stage: 'prototype' } : {}), thresholds: {} }, null, 2) + '\n');
|
|
518
520
|
lines.push(t(lang, 'setup_config'));
|
|
519
521
|
}
|
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. If the prompt says \`stage: prototype\`, a missing or thin test is no finding at all; the rest of this rule still applies.
|
|
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
|
|
|
@@ -322,14 +322,14 @@ Without sub-agents: do the Ready tasks yourself in brief's order, one at a time,
|
|
|
322
322
|
|
|
323
323
|
## Review findings
|
|
324
324
|
|
|
325
|
-
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.
|
|
326
326
|
|
|
327
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.
|
|
328
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.
|
|
329
329
|
- A reviewer who could not follow the docs found missing context. Never contest that.
|
|
330
330
|
- Never change a severity yourself. A P1 that looks like a P2 is contested like any finding, with evidence, and the user decides.
|
|
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
|
|
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
|
|
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").
|
|
333
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.
|
|
334
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.
|
|
335
335
|
|
|
@@ -356,15 +356,17 @@ Whatever the row, one rule holds: the branch that reaches users receives nothing
|
|
|
356
356
|
|
|
357
357
|
**Stop:** before the merge, with the P1/P2/P3 lists in front of the user.
|
|
358
358
|
|
|
359
|
-
**After the user merges:** \`git fetch --prune\`, then delete
|
|
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
360
|
|
|
361
361
|
## cto-jev docs
|
|
362
362
|
|
|
363
363
|
**When:** the user says "cto-jev docs", before opening a feature, or when the user asks to tidy the repo.
|
|
364
364
|
|
|
365
|
-
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.
|
|
366
|
-
2. Show the list to the user with one line per file; they decide.
|
|
367
|
-
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.
|
|
368
370
|
|
|
369
371
|
## cto-jev decision
|
|
370
372
|
|
package/dist/tests.js
CHANGED
|
@@ -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 (
|
|
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.
|
|
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",
|