your-cto-jev 0.9.0 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -100,7 +100,7 @@ cto setup
100
100
 
101
101
  To update later, run `cto update`. Projects you already set up pick up the new version automatically: every hook only calls `cto`, and all the logic lives in the package. `cto` checks npm for a new version at most once a day and mentions it in its once-per-session notice, never on its own.
102
102
 
103
- `cto setup` walks you through five steps with arrow keys: coding agents, Jev providers, API keys, an optional sprint goal, and whether to use the [development flow](#the-development-flow-optional). Esc goes back a step. Providers are ticked in priority order, so the numbers you see are the failover order. Press a number to move the item under the cursor straight to that position:
103
+ `cto setup` walks you through five steps with arrow keys: coding agents, Jev providers, API keys, an optional sprint goal, and whether to use the [development flow](#the-development-flow-optional). Esc goes back a step. The agent list shows what is always installed (the git hooks, `.cto.json`) and the files each agent adds; before anything is written, setup lists every file it will create, update or remove and asks once. Providers are ticked in priority order, so the numbers you see are the failover order. Press a number to move the item under the cursor straight to that position:
104
104
 
105
105
  ```text
106
106
  ◆ Which Jev providers should cto use?
@@ -130,7 +130,7 @@ Other forms:
130
130
  cto setup --agents claude,cursor --yes # non-interactive (scripts, CI); only adds, never removes
131
131
  cto setup --refresh # re-write hooks and rules for the agents already set up
132
132
  cto setup --uninstall # remove every cto hook, rules block and skill again
133
- cto setup --flow # turn on the development flow (docs/cto_jev, cto-flow skill); --no-flow removes the skill and rule
133
+ cto setup --flow # turn on the development flow (docs/cto_jev, cto-jev skill, /cto-jev); --no-flow removes the skill and rule
134
134
  cto doctor # is it actually working?
135
135
  cto brief # what an agent should know before it starts here
136
136
  cto check # preview the commit checks on your current changes
@@ -207,7 +207,7 @@ The lessons are collected without anyone writing them down. Every failed agent c
207
207
 
208
208
  Everything above says no after the fact. The flow is the part before: your agent acts as the CTO of the repo (plans, breaks work down, dispatches, accepts), and `cto` keeps it honest. It is off by default; `cto setup --flow` (or the question at the end of interactive setup) turns it on, and repos that never enable it see no change.
209
209
 
210
- The agent does not get a new tool. It gets a skill (`.agents/skills/cto-flow/SKILL.md`), a fixed place for plans, and a few more checks:
210
+ The agent does not get a new tool. It gets one skill, `cto-jev` (`.agents/skills/cto-jev/SKILL.md`; in Claude Code also the `/cto-jev` command), a fixed place for plans, and a few more checks:
211
211
 
212
212
  ```text
213
213
  docs/cto_jev/
@@ -246,7 +246,7 @@ Blocked · 1
246
246
  CUST-1.3 Shared types waiting on PERM-9 (missing), CUST-1.2
247
247
  ```
248
248
 
249
- The skill gives the agent seven named jobs, so they cannot be confused with another skill's steps; say the name and it does that job:
249
+ The skill gives the agent seven named jobs, so they cannot be confused with another skill's steps. In Claude Code type `/cto-jev <job>` (for example `/cto-jev init`); bare `/cto-jev` runs `cto brief` and names the job to run next. In other agents say the name, for example "cto-jev init" (Codex also takes `$cto-jev`):
250
250
 
251
251
  | Say | The agent |
252
252
  |---|---|
@@ -356,7 +356,7 @@ Nothing else is uploaded, and nothing is logged unless you set `CTO_DEBUG=1`. Th
356
356
  Defaults: `credential_leak` 0.5, `destructive_command` 0.7, `infinite_loop` 0.6, `test_tampering` 0.8, `done_unverified` 0.6, `architecture_violation` 0.85, `architecture_undocumented` 0.85, `code_complexity` 2.
357
357
 
358
358
  - **`sprint_goal`**: fill it in to enable the architecture check, for example `"Ship Stripe billing, no new services"`. Under the development flow a commit that falls inside a feature's code scope is judged against that feature's SPEC instead; the goal is the fallback.
359
- - **`flow`**: `true` turns on the [development flow](#the-development-flow-optional). `cto setup --flow` / `--no-flow` set it; `cto setup --refresh` follows the saved value. `--no-flow` removes the cto-flow skill and its rule but keeps `docs/cto_jev/`; while `docs/cto_jev/features/` exists, the sign-off, index and drift checks keep running. Delete or archive that folder to stop them.
359
+ - **`flow`**: `true` turns on the [development flow](#the-development-flow-optional). `cto setup --flow` / `--no-flow` set it; `cto setup --refresh` follows the saved value. `--no-flow` removes the cto-jev skill, `/cto-jev` and its rule but keeps `docs/cto_jev/`; while `docs/cto_jev/features/` exists, the sign-off, index and drift checks keep running. Delete or archive that folder to stop them.
360
360
  - **`test_command`**: what `cto brief` tells the agent to verify with, for example `"pnpm test"`. Detected from the project when empty.
361
361
  - **`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.
362
362
  - **Thresholds**: Jev returns a probability from 0 to 1. `code_complexity` is the exception: it is a score from 0 (clean) to 4 (unmaintainable).
package/dist/i18n.js CHANGED
@@ -94,7 +94,21 @@ const messages = {
94
94
  wiz_fail: (v) => ` ${v.name} 驗證失敗 (${v.status}) ${v.msg}`,
95
95
  ui_title: () => 'cto 設定',
96
96
  ui_first_run: () => '共五步:coding agent、Jev provider、API key、sprint goal、開發流程。↑↓ 移動,Enter 確認,Esc 回上一步。完成後會回到總覽,之後也能單獨修改任何一項。',
97
- ui_agents_q: () => '要攔截哪些 coding agent 的指令?(git commit 檢查一律安裝)\n ↑↓ 移動 · 空白鍵勾選 · Enter 確認 · Esc 返回',
97
+ ui_agents_q: () => '要攔截哪些 coding agent 的指令?',
98
+ ui_agents_help: () => '↑↓ 移動 · 空白鍵勾選 · Enter 確認 · Esc 返回',
99
+ ui_always: () => '一律安裝',
100
+ ui_always_git: () => 'git 檢查',
101
+ ui_always_cfg: () => '共用設定',
102
+ ui_choose: () => '選擇 agent',
103
+ ui_selected: () => '已選:',
104
+ ui_plan_title: () => '將寫入',
105
+ ui_plan_new: () => '新增',
106
+ ui_plan_update: () => '更新 cto 的部分',
107
+ ui_plan_remove: () => '移除 cto 的部分',
108
+ ui_plan_none: () => '沒有檔案需要改',
109
+ ui_plan_q: () => '確定寫入?(否 = 回到設定總覽)',
110
+ ui_yes: () => '是',
111
+ ui_no: () => '否',
98
112
  ui_detected: () => '已偵測到',
99
113
  ui_providers_q: () => '要用哪些 Jev provider?',
100
114
  ui_providers_help: () => '↑↓ 移動 · 空白鍵勾選 · 按數字鍵把游標所在項目移到該順位 · Enter 確認 · Esc 返回\n│ 數字是優先順序:1 先用,失敗才換下一個',
@@ -117,7 +131,7 @@ const messages = {
117
131
  ui_goal_q: () => 'Sprint goal(選填,填了才會檢查 commit 是否偏離目標)',
118
132
  ui_goal_ph: () => '例如:完成 Stripe 金流,不新增服務',
119
133
  ui_flow_q: () => '要用 cto 開發流程嗎?你的 agent 當 CTO:在 docs/cto_jev/ 規劃、派工、驗收;cto 檢查簽核和漂移。',
120
- ui_flow_yes: () => '要,寫入 cto-flow skill 和 docs/cto_jev/ 骨架',
134
+ ui_flow_yes: () => '要,寫入 cto-jev skill(/cto-jev)和 docs/cto_jev/ 骨架',
121
135
  ui_flow_no: () => '不用,只守關卡',
122
136
  ui_on: () => '啟用',
123
137
  ui_off: () => '未啟用',
@@ -268,7 +282,21 @@ const messages = {
268
282
  wiz_fail: (v) => ` ${v.name} failed (${v.status}) ${v.msg}`,
269
283
  ui_title: () => 'cto setup',
270
284
  ui_first_run: () => 'Five steps: coding agents, Jev providers, API keys, sprint goal, development flow. Up/Down to move, Enter to confirm, Esc to go back. You land on an overview at the end and can change any single item later.',
271
- ui_agents_q: () => 'Which coding agents should have their commands checked? (the git commit check is always installed)\n Up/Down move · Space toggles · Enter confirms · Esc goes back',
285
+ ui_agents_q: () => 'Which coding agents should have their commands checked?',
286
+ ui_agents_help: () => 'Up/Down move · Space toggles · Enter confirms · Esc goes back',
287
+ ui_always: () => 'always installed',
288
+ ui_always_git: () => 'git checks',
289
+ ui_always_cfg: () => 'shared config',
290
+ ui_choose: () => 'pick agents',
291
+ ui_selected: () => 'Selected:',
292
+ ui_plan_title: () => 'Will write',
293
+ ui_plan_new: () => 'new',
294
+ ui_plan_update: () => "update cto's part",
295
+ ui_plan_remove: () => "remove cto's part",
296
+ ui_plan_none: () => 'Nothing to change',
297
+ ui_plan_q: () => 'Write these files? (No goes back to the overview)',
298
+ ui_yes: () => 'Yes',
299
+ ui_no: () => 'No',
272
300
  ui_detected: () => 'detected',
273
301
  ui_providers_q: () => 'Which Jev providers should cto use?',
274
302
  ui_providers_help: () => 'Up/Down move · Space toggles · press a number to move the item under the cursor to that position · Enter confirms · Esc goes back\n│ Numbers are priority: 1 first, the next one only on failure',
@@ -291,7 +319,7 @@ const messages = {
291
319
  ui_goal_q: () => 'Sprint goal (optional; enables the check for commits that drift from it)',
292
320
  ui_goal_ph: () => 'e.g. Ship Stripe billing, no new services',
293
321
  ui_flow_q: () => 'Use the cto development flow? Your agent acts as CTO: plans in docs/cto_jev/, dispatches, accepts; cto checks sign-off and drift.',
294
- ui_flow_yes: () => 'Yes, write the cto-flow skill and a docs/cto_jev/ skeleton',
322
+ ui_flow_yes: () => 'Yes, write the cto-jev skill (/cto-jev) and a docs/cto_jev/ skeleton',
295
323
  ui_flow_no: () => 'No, gatekeeping only',
296
324
  ui_on: () => 'on',
297
325
  ui_off: () => 'off',
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ import { checkUpdate, currentVersion, runUpdate } from './update.js';
10
10
  import { doctor } from './doctor.js';
11
11
  import { detectLang, t } from './i18n.js';
12
12
  import { maskDiff, maskSensitiveState } from './masker.js';
13
- import { detectAgents, gitRoot, setSprintGoal, setup, wiredAgents } from './setup.js';
13
+ import { detectAgents, gitRoot, planSetup, setSprintGoal, setup, wiredAgents } from './setup.js';
14
14
  async function readStdin() {
15
15
  if (process.stdin.isTTY)
16
16
  return '';
@@ -136,7 +136,7 @@ else if (args[0] === 'setup') {
136
136
  };
137
137
  const firstRun = !wired.length && !providerOrder().length;
138
138
  const { setupUI } = await import('./setupui.js'); // clack loads only for interactive setup, never on the hook path
139
- const s = await setupUI(initial, firstRun, lang, { detected: detectAgents() });
139
+ const s = await setupUI(initial, firstRun, lang, { detected: detectAgents(), plan: (st) => planSetup(root, st.agents, st.flow ?? false, st.goal) });
140
140
  if (!s)
141
141
  process.exit(0); // quit without saving: nothing was written
142
142
  saveCredentials(s.keys);
package/dist/setup.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { execFileSync } from 'node:child_process';
2
- import { chmodSync, existsSync, mkdirSync, readdirSync, readFileSync, rmdirSync, unlinkSync, writeFileSync } from 'node:fs';
2
+ import { chmodSync, existsSync, mkdirSync, readdirSync, readFileSync, realpathSync, rmdirSync, unlinkSync, writeFileSync } from 'node:fs';
3
3
  import { homedir } from 'node:os';
4
4
  import { basename, dirname, join, relative } from 'node:path';
5
5
  import { PHASES, agentNames, agents, hookCommand } from './agents.js';
6
6
  import { t } from './i18n.js';
7
7
  import { loadConfig } from './brain.js';
8
- import { FLOW_SKILL_PATH, guidancePaths, syncFlowSkill, syncGuidance } from './skill.js';
8
+ import { FLOW_COMMAND_PATH, FLOW_SKILL_PATH, guidancePaths, syncFlowSkill, syncGuidance } from './skill.js';
9
9
  import { findConflicts } from './conflicts.js';
10
10
  import { FLOW_DIR } from './flow.js';
11
11
  const START = '# >>> YOUR CTO JEV START >>>';
@@ -133,6 +133,72 @@ export const FLOW_SKELETON = {
133
133
  'docs/cto_jev/features/platform/REVIEW.md': '# platform REVIEW\n\nNot reviewed yet.\n',
134
134
  'docs/cto_jev/decisions/.gitkeep': '',
135
135
  };
136
+ /**
137
+ * What an interactive (exact) setup with these choices would write, without writing: the summary shown before "Proceed?".
138
+ * Same decisions as `setup`: files already current are left out. A settings file setup would refuse (bad JSON) is listed
139
+ * as an update; setup itself then stops before writing anything.
140
+ */
141
+ export function planSetup(root, chosenAgents, flow, goal) {
142
+ const out = [];
143
+ const at = (p, change, abs = join(root, p)) => out.push({ path: p, change: change === 'remove' ? 'remove' : existsSync(abs) ? 'update' : 'new' });
144
+ const chosen = new Set(chosenAgents);
145
+ // git reports the hooks dir with long names; a Windows temp root may be 8.3 (ERICHS~1). Compare real paths.
146
+ const real = (p) => { try {
147
+ return realpathSync.native(p);
148
+ }
149
+ catch {
150
+ return p;
151
+ } };
152
+ const dir = hooksDir(root);
153
+ for (const [name, body] of GIT_HOOKS) {
154
+ const p = join(dir, name);
155
+ const c = existsSync(p) ? readFileSync(p, 'utf8') : '';
156
+ if (!c || appendBlock(c, body) !== c)
157
+ at(join(relative(real(root), real(dir)), name).replace(/\\/g, '/'), 'write', p);
158
+ }
159
+ for (const name of agentNames) {
160
+ const p = agents[name].settings;
161
+ const json = readSettings(join(root, p));
162
+ // A file setup would refuse (bad JSON or shape) is listed so the user sees it; setup then stops before writing anything.
163
+ const bad = json === null || !validShape(json, name);
164
+ if (chosen.has(name)) {
165
+ if (bad) {
166
+ at(p, 'write');
167
+ continue;
168
+ }
169
+ const before = JSON.stringify(json);
170
+ installAgent(json, name);
171
+ if (JSON.stringify(json) !== before || !existsSync(join(root, p)))
172
+ at(p, 'write');
173
+ }
174
+ else if (bad) {
175
+ if (readFileSync(join(root, p), 'utf8').includes('cto --hook '))
176
+ at(p, 'remove');
177
+ }
178
+ else if (uninstallHooks(json))
179
+ at(p, 'remove');
180
+ }
181
+ const g = syncGuidance(root, chosen, true, flow, true);
182
+ const f = syncFlowSkill(root, flow, true, chosen.has('claude'));
183
+ for (const p of [...g.written, ...f.written])
184
+ at(p, 'write');
185
+ for (const p of [...g.removed, ...f.removed])
186
+ at(p, 'remove');
187
+ if (flow)
188
+ for (const p of Object.keys(FLOW_SKELETON))
189
+ if (!existsSync(join(root, p)))
190
+ at(p, 'write');
191
+ const ignore = join(root, '.gitignore');
192
+ const ignoreText = existsSync(ignore) ? readFileSync(ignore, 'utf8') : '';
193
+ const have = new Set(removeBlock(ignoreText).split(/\r?\n/).map((l) => l.trim()));
194
+ const missing = IGNORE_BODY.split('\n').filter((l) => l && !have.has(l));
195
+ if (missing.length && appendBlock(ignoreText, missing.join('\n') + '\n') !== ignoreText)
196
+ at('.gitignore', 'write');
197
+ const cfg = loadConfig(root);
198
+ if (!existsSync(join(root, '.cto.json')) || cfg.flow !== flow || cfg.sprint_goal !== goal)
199
+ at('.cto.json', 'write');
200
+ return out;
201
+ }
136
202
  export function setup(cwd, lang, opts = {}) {
137
203
  const lines = [];
138
204
  let root;
@@ -233,10 +299,12 @@ export function setup(cwd, lang, opts = {}) {
233
299
  const savedFlow = loadConfig(root).flow;
234
300
  const flow = opts.flow ?? savedFlow;
235
301
  const skills = syncGuidance(root, chosen, !!opts.exact, flow);
236
- const flowSkill = syncFlowSkill(root, flow);
302
+ // Not exact: an agent left unpicked keeps its cto wiring, so Claude Code keeps /cto-jev too.
303
+ const claude = chosen.has('claude') || (!opts.exact && wiredAgents(root).includes('claude'));
304
+ const flowSkill = syncFlowSkill(root, flow, false, claude);
237
305
  for (const p of [...skills.written, ...flowSkill.written])
238
306
  lines.push(t(lang, 'setup_skill', { path: p }));
239
- const hidden = ignoredByGit(root, [...guidancePaths(chosen), ...(flow ? [FLOW_SKILL_PATH] : [])]);
307
+ const hidden = ignoredByGit(root, [...guidancePaths(chosen), ...(flow ? [FLOW_SKILL_PATH] : []), ...(flow && claude ? [FLOW_COMMAND_PATH] : [])]);
240
308
  // Advise git add -f: a .gitignore negation cannot re-include a file whose parent folder is excluded (git rule).
241
309
  if (hidden.length)
242
310
  lines.push(t(lang, 'setup_ignored', { list: hidden.join(', '), cmd: `git add -f ${hidden.join(' ')}` }));
package/dist/setupui.js CHANGED
@@ -1,9 +1,10 @@
1
1
  import { MultiSelectPrompt } from '@clack/core';
2
- import { S_BAR, S_BAR_END, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_SUBMIT, intro, isCancel, log, multiselect, outro, password, select, spinner, text } from '@clack/prompts';
2
+ import { S_BAR, S_BAR_END, S_STEP_ACTIVE, S_STEP_CANCEL, S_STEP_SUBMIT, confirm, intro, isCancel, log, note, outro, password, select, spinner, text } from '@clack/prompts';
3
3
  import { styleText } from 'node:util';
4
4
  import { agentNames, agents } from './agents.js';
5
5
  import { DEFAULT_ORDER, probeProvider, providers } from './api.js';
6
6
  import { t } from './i18n.js';
7
+ import { MEMORY_FILES } from './skill.js';
7
8
  const BACK = Symbol('back');
8
9
  const PROVIDER_ORDER = DEFAULT_ORDER;
9
10
  const dim = (s) => styleText('dim', s);
@@ -24,15 +25,8 @@ export async function setupUI(initial, firstRun, lang, o = {}) {
24
25
  const detected = o.detected ?? [];
25
26
  let state = { ...initial, keys: { ...initial.keys } };
26
27
  const agentsStep = async (s) => {
27
- const r = await multiselect({
28
- ...io,
29
- showInstructions: false,
30
- message: t(lang, 'ui_agents_q'),
31
- options: agentNames.map((n) => ({ value: n, label: agents[n].label, ...(detected.includes(n) && { hint: t(lang, 'ui_detected') }) })),
32
- initialValues: s.agents,
33
- required: false,
34
- });
35
- return isCancel(r) ? BACK : { ...s, agents: r };
28
+ const r = await agentPicker(lang, io, s.agents, detected);
29
+ return typeof r === 'symbol' ? BACK : { ...s, agents: r };
36
30
  };
37
31
  const providersStep = async (s) => {
38
32
  const r = await orderedMultiselect(lang, io, PROVIDER_ORDER, s.providers);
@@ -203,6 +197,8 @@ export async function setupUI(initial, firstRun, lang, o = {}) {
203
197
  return null;
204
198
  }
205
199
  if (choice === 'save') {
200
+ if (o.plan && !(await confirmPlan(lang, io, o.plan(state))))
201
+ continue; // "No" goes back to the overview
206
202
  outro(t(lang, 'ui_saved'), io);
207
203
  return state;
208
204
  }
@@ -219,6 +215,63 @@ export async function setupUI(initial, firstRun, lang, o = {}) {
219
215
  state = r;
220
216
  }
221
217
  }
218
+ /**
219
+ * Agent checklist. Above it, what is installed whatever you pick (the git hooks and the shared config); next to each
220
+ * agent, the files it adds; under it, the current picks and the keys. Space toggles, Enter confirms, Esc goes back.
221
+ */
222
+ async function agentPicker(lang, io, initial, detected) {
223
+ const files = (n) => [agents[n].settings, ...MEMORY_FILES.filter((m) => m.agents.includes(n)).map((m) => m.path)].join(', ');
224
+ const labelW = Math.max(...agentNames.map((n) => displayWidth(agents[n].label)));
225
+ const filesW = Math.max(...agentNames.map((n) => files(n).length));
226
+ const rule = (title) => `${S_BAR} ${dim('──')} ${title} ${dim('─'.repeat(Math.max(4, 34 - displayWidth(title))))}`;
227
+ const p = new MultiSelectPrompt({
228
+ ...io,
229
+ options: agentNames.map((n) => ({ value: n, label: agents[n].label })),
230
+ initialValues: initial,
231
+ required: false,
232
+ render() {
233
+ const head = t(lang, 'ui_agents_q');
234
+ const picked = (this.value ?? []);
235
+ const names = picked.map((n) => agents[n].label).join(', ');
236
+ if (this.state === 'submit')
237
+ return `${S_STEP_SUBMIT} ${head}\n${S_BAR} ${dim(names || t(lang, 'doc_none'))}\n`;
238
+ if (this.state === 'cancel')
239
+ return `${S_STEP_CANCEL} ${head}\n${S_BAR}\n`;
240
+ const rows = this.options.map((opt, i) => {
241
+ const mark = picked.includes(opt.value) ? styleText('green', '●') : dim('○');
242
+ const tag = detected.includes(opt.value) ? ` ${t(lang, 'ui_detected')}` : '';
243
+ const line = `${mark} ${pad(opt.label, labelW)} ${dim(tag ? files(opt.value).padEnd(filesW) : files(opt.value))}${tag}`;
244
+ return `${S_BAR} ${i === this.cursor ? styleText('cyan', '› ') : ' '}${line}`;
245
+ });
246
+ return [
247
+ `${S_STEP_ACTIVE} ${head}`,
248
+ rule(t(lang, 'ui_always')),
249
+ `${S_BAR} • ${pad(t(lang, 'ui_always_git'), labelW)} ${dim('pre-commit, pre-push')}`, // the folder may be .husky/ or core.hooksPath; the save summary shows it
250
+ `${S_BAR} • ${pad(t(lang, 'ui_always_cfg'), labelW)} ${dim('.cto.json, .gitignore')}`,
251
+ rule(t(lang, 'ui_choose')),
252
+ ...rows,
253
+ S_BAR,
254
+ `${S_BAR} ${names ? `${styleText('green', t(lang, 'ui_selected'))} ${names}` : dim(`${t(lang, 'ui_selected')} ${t(lang, 'doc_none')}`)}`,
255
+ `${S_BAR} ${dim(t(lang, 'ui_agents_help'))}`,
256
+ S_BAR_END,
257
+ '',
258
+ ].join('\n');
259
+ },
260
+ });
261
+ return p.prompt();
262
+ }
263
+ /** The files a save will write, then "Proceed?". True to save; false (No or Esc) goes back to the overview. */
264
+ async function confirmPlan(lang, io, plan) {
265
+ if (!plan.length) {
266
+ log.info(t(lang, 'ui_plan_none'), io);
267
+ return true;
268
+ }
269
+ const w = Math.max(...plan.map((f) => f.path.length));
270
+ const tag = (c) => (c === 'new' ? styleText('green', t(lang, 'ui_plan_new')) : c === 'remove' ? styleText('yellow', t(lang, 'ui_plan_remove')) : dim(t(lang, 'ui_plan_update')));
271
+ note(plan.map((f) => `${f.path.padEnd(w)} ${tag(f.change)}`).join('\n'), t(lang, 'ui_plan_title'), { ...io, format: (l) => l });
272
+ const ok = await confirm({ ...io, message: t(lang, 'ui_plan_q'), active: t(lang, 'ui_yes'), inactive: t(lang, 'ui_no') });
273
+ return ok === true;
274
+ }
222
275
  /**
223
276
  * Checkbox list whose marks are numbers: the order you tick items is their priority (failover order).
224
277
  * Up/Down move, Space toggles, a digit moves the item under the cursor to that position (ticking it if needed),
package/dist/skill.js CHANGED
@@ -17,7 +17,21 @@ export const MEMORY_FILES = [
17
17
  { path: 'AGENTS.md', agents: ['codex', 'cursor'] },
18
18
  { path: 'GEMINI.md', agents: ['gemini'] },
19
19
  ];
20
- export const FLOW_SKILL_PATH = '.agents/skills/cto-flow/SKILL.md';
20
+ export const FLOW_SKILL_PATH = '.agents/skills/cto-jev/SKILL.md';
21
+ const LEGACY_FLOW_SKILL = '.agents/skills/cto-flow/SKILL.md'; // 0.9.x name, removed on sync
22
+ // Claude Code reads neither .agents/skills nor (safely) .claude/skills, since Cursor scans .claude/skills too and would
23
+ // list the skill twice. A slash command is Claude-only and only points at the one skill file, so `/cto-jev init` works.
24
+ export const FLOW_COMMAND_PATH = '.claude/commands/cto-jev.md';
25
+ export const FLOW_COMMAND_TEXT = `---
26
+ description: The cto development flow - init, feature, tasks, work, release, docs, decision
27
+ argument-hint: "[init | feature <request> | tasks | work | release | docs | decision]"
28
+ ---
29
+ ${SKILL_MARK}
30
+
31
+ Read \`${FLOW_SKILL_PATH}\` in full, then do the job named here: $ARGUMENTS
32
+
33
+ No job named: run \`cto brief\`, say in two lines where this repo stands in the flow, and name the one job to run next.
34
+ `;
21
35
  /** The one extra rule when `cto setup` chose the development flow: the plan lives in docs/cto_jev/. */
22
36
  export const FLOW_RULE = `- **Work is planned in \`docs/cto_jev/\`.** Before planning, breaking down, dispatching or accepting work, read \`${FLOW_SKILL_PATH}\`; \`cto brief\` lists what is ready.`;
23
37
  export const rulesBlock = (flow) => `${MD_START}
@@ -90,16 +104,16 @@ turns it into a calibration case; you do not run that yourself.
90
104
  // The flow skill: how the host agent plans, dispatches and accepts work under docs/cto_jev/. Written only when
91
105
  // `cto setup` chose the flow; the body mirrors docs/cto_jev/features/cto-flow/SPEC.md.
92
106
  export const FLOW_SKILL_TEXT = `---
93
- name: cto-flow
94
- description: The development flow of this repo, kept in docs/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 an approved spec down), "cto-jev work" (dispatch, accept, review, commit), "cto-jev release" (review everything unreleased, then merge to main), "cto-jev docs" (clean up old documents), "cto-jev decision" (record an architecture decision). Load it when the user names one of them, and whenever you are about to plan, dispatch, tick a task or commit.
107
+ name: cto-jev
108
+ 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 an approved spec down), "cto-jev work" (dispatch, accept, review, commit), "cto-jev release" (review everything unreleased, then merge to main), "cto-jev docs" (clean up old documents), "cto-jev decision" (record an architecture decision). Load it when the user names one of them, and whenever you are about to plan, dispatch, tick a task or commit.
95
109
  ---
96
110
  ${SKILL_MARK}
97
111
 
98
- # cto-flow
112
+ # cto-jev
99
113
 
100
114
  You are the CTO of this repo. You plan, break down, dispatch, accept and review; sub-agents write the code. The plan lives in \`docs/cto_jev/\`; the only state is the checkboxes in TASKS.md. cto checks what you claim: a tick without a passing check is sent back, a commit on a feature without sign-off is blocked.
101
115
 
102
- Seven jobs, each named \`cto-jev <job>\`. When the user says the name, do that job and nothing else. Each says when it applies, the steps, and where you stop.
116
+ Seven jobs, each named \`cto-jev <job>\`. When the user says the name (or types \`/cto-jev <job>\`), do that job and nothing else. Each says when it applies, the steps, and where you stop. Invoked with no job: run \`cto brief\`, say in two lines where the repo stands, and name the one job to run next.
103
117
 
104
118
  ## cto-jev init
105
119
 
@@ -274,7 +288,8 @@ function removeFileAndEmptyDirs(root, path) {
274
288
  * removeOthers (exact mode or uninstall) take cto's content out of files no chosen agent reads. Only cto-marked
275
289
  * content is ever removed or overwritten. With flow, the rules block carries the extra docs/cto_jev/ rule.
276
290
  */
277
- export function syncGuidance(root, chosen, removeOthers, flow = false) {
291
+ /** `dry`: decide exactly as a real run would, write nothing (the setup summary lists these before asking). */
292
+ export function syncGuidance(root, chosen, removeOthers, flow = false, dry = false) {
278
293
  const written = [];
279
294
  const removed = [];
280
295
  for (const m of MEMORY_FILES) {
@@ -283,52 +298,75 @@ export function syncGuidance(root, chosen, removeOthers, flow = false) {
283
298
  if (m.agents.some((a) => chosen.has(a))) {
284
299
  const next = appendMd(current, flow);
285
300
  if (next !== current) {
286
- writeFileSync(path, next);
301
+ if (!dry)
302
+ writeFileSync(path, next);
287
303
  written.push(m.path);
288
304
  }
289
305
  }
290
306
  else if (removeOthers && mdBlockRe.test(current)) {
291
307
  const rest = removeMd(current);
292
- if (rest.trim())
293
- writeFileSync(path, rest);
294
- else
295
- unlinkSync(path);
308
+ if (!dry) {
309
+ if (rest.trim())
310
+ writeFileSync(path, rest);
311
+ else
312
+ unlinkSync(path);
313
+ }
296
314
  removed.push(m.path);
297
315
  }
298
316
  }
299
317
  const skill = join(root, SKILL_PATH);
300
318
  if (chosen.size) {
301
319
  if (!existsSync(skill) || readFileSync(skill, 'utf8') !== SKILL_TEXT) {
302
- mkdirSync(dirname(skill), { recursive: true });
303
- writeFileSync(skill, SKILL_TEXT);
320
+ if (!dry) {
321
+ mkdirSync(dirname(skill), { recursive: true });
322
+ writeFileSync(skill, SKILL_TEXT);
323
+ }
304
324
  written.push(SKILL_PATH);
305
325
  }
306
326
  }
307
327
  else if (removeOthers && existsSync(skill) && readFileSync(skill, 'utf8').includes(SKILL_MARK)) {
308
- removeFileAndEmptyDirs(root, skill);
328
+ if (!dry)
329
+ removeFileAndEmptyDirs(root, skill);
309
330
  removed.push(SKILL_PATH);
310
331
  }
311
332
  const legacy = join(root, LEGACY_SKILL);
312
- if (existsSync(legacy) && readFileSync(legacy, 'utf8').includes(SKILL_MARK))
313
- removeFileAndEmptyDirs(root, legacy);
333
+ if (existsSync(legacy) && readFileSync(legacy, 'utf8').includes(SKILL_MARK)) {
334
+ if (!dry)
335
+ removeFileAndEmptyDirs(root, legacy);
336
+ else
337
+ removed.push(LEGACY_SKILL); // only the plan lists it; a real run removes it silently, as before
338
+ }
314
339
  return { written, removed };
315
340
  }
316
- /** Write or refresh the cto-flow skill when the flow is enabled; remove it (only if cto-marked) when not. */
317
- export function syncFlowSkill(root, enabled) {
341
+ /**
342
+ * Write or refresh the cto-jev skill when the flow is enabled, plus the `/cto-jev` command when Claude Code is one of the
343
+ * agents; remove each (only if cto-marked) when not. The 0.9.x `cto-flow` skill is always removed.
344
+ */
345
+ export function syncFlowSkill(root, enabled, dry = false, claude = false) {
318
346
  const written = [];
319
347
  const removed = [];
320
- const skill = join(root, FLOW_SKILL_PATH);
321
- if (enabled) {
322
- if (!existsSync(skill) || readFileSync(skill, 'utf8') !== FLOW_SKILL_TEXT) {
323
- mkdirSync(dirname(skill), { recursive: true });
324
- writeFileSync(skill, FLOW_SKILL_TEXT);
325
- written.push(FLOW_SKILL_PATH);
348
+ const sync = (rel, text, want) => {
349
+ const path = join(root, rel);
350
+ const current = existsSync(path) ? readFileSync(path, 'utf8') : undefined;
351
+ if (want) {
352
+ // A file of the same name without the marker is the user's own (e.g. their own /cto-jev command): never overwrite it.
353
+ if (current === text || (current !== undefined && !current.includes(SKILL_MARK)))
354
+ return;
355
+ if (!dry) {
356
+ mkdirSync(dirname(path), { recursive: true });
357
+ writeFileSync(path, text);
358
+ }
359
+ written.push(rel);
326
360
  }
327
- }
328
- else if (existsSync(skill) && readFileSync(skill, 'utf8').includes(SKILL_MARK)) {
329
- removeFileAndEmptyDirs(root, skill);
330
- removed.push(FLOW_SKILL_PATH);
331
- }
361
+ else if (current?.includes(SKILL_MARK)) {
362
+ if (!dry)
363
+ removeFileAndEmptyDirs(root, path);
364
+ removed.push(rel);
365
+ }
366
+ };
367
+ sync(FLOW_SKILL_PATH, FLOW_SKILL_TEXT, enabled);
368
+ sync(FLOW_COMMAND_PATH, FLOW_COMMAND_TEXT, enabled && claude);
369
+ sync(LEGACY_FLOW_SKILL, '', false);
332
370
  return { written, removed };
333
371
  }
334
372
  /** The guidance files the given agents use (what should be committed for them). */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "your-cto-jev",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
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",