your-cto-jev 0.13.1 → 0.15.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
@@ -146,11 +146,11 @@ cto docs # suggest what to do with old planning
146
146
 
147
147
  ## The rules, written down for the agent
148
148
 
149
- `cto setup` also writes the development rules of the repo for coding agents, where every rule names the check that enforces it. Agents read them before they work, so they get blocked less, and when they are blocked they know why and how to fix it.
149
+ `cto setup` also writes the development rules of the repo for coding agents, where every rule names the check that enforces it, if it has one. Agents read them before they work, so they get blocked less, and when they are blocked they know why and how to fix it.
150
150
 
151
151
  The rules go where agents always look: a short marked block appended to `CLAUDE.md` (Claude Code), `AGENTS.md` (Codex, Cursor) and `GEMINI.md` (Gemini CLI), only for the agents you picked. Your own content in those files is left alone, and uninstall takes out exactly the block. The details, including what each check looks for and how to handle a block, live in one skill at `.agents/skills/cto/SKILL.md`; the rules block points every agent there.
152
152
 
153
- | Rule | Enforced by |
153
+ | Rule | Check |
154
154
  |---|---|
155
155
  | Secrets stay out of code | `credential_leak` blocks the commit |
156
156
  | Fix the code, not the tests | `test_tampering` blocks the commit |
@@ -159,6 +159,7 @@ The rules go where agents always look: a short marked block appended to `CLAUDE.
159
159
  | Ask before anything irreversible | `destructive_command` blocks the command |
160
160
  | Stay on the sprint goal, or inside the feature's SPEC | `architecture_violation` warns |
161
161
  | Keep it simple | `code_complexity` warns |
162
+ | A TODO in the code is not the task | not checked |
162
163
  | Work is planned in `docs/cto_jev/` (flow only); no work without sign-off | `flow_signoff` blocks the commit |
163
164
 
164
165
  The rules also tell the agent to run `cto check` before committing, and never to bypass a block with `--no-verify` or by editing thresholds. Commit these files so the whole team's agents follow the same rules. `cto update` refreshes them (and any new hooks) in the repo you run it from; `cto doctor` flags a repo whose rules or hooks are older than the installed version, and `cto setup --refresh` brings it up to date.
@@ -417,7 +418,7 @@ Defaults: `credential_leak` 0.5, `destructive_command` 0.7, `infinite_loop` 0.6,
417
418
  On Claude Code, `cto setup` writes a model split:
418
419
 
419
420
  - **Fable** advises the main agent.
420
- - **Sonnet** is the main model.
421
+ - **Sonnet** is the main model by default; `cto models main opus` switches it to Opus (better on long multi-step work, uses more of your plan).
421
422
  - **Haiku** runs the sub-agents.
422
423
  - **Opus** runs `cto-reviewer`, which reviews code with none of the main agent's context.
423
424
 
@@ -425,6 +426,7 @@ The split is written to your user settings (`global`, the default, every project
425
426
 
426
427
  ```sh
427
428
  cto models # status: the split, its scope, and what would change
429
+ cto models main sonnet|opus # the main model
428
430
  cto models advisor fable|opus # the advisor model
429
431
  cto models autofix on|off # let cto write the split (session start, setup, refresh, update)
430
432
  cto models scope global|local # where the split is written, for every project (local in a folder without cto only clears the user level)
package/dist/brain.js CHANGED
@@ -111,13 +111,14 @@ export function saveCredentials(c) {
111
111
  delete raw[k];
112
112
  return writeUserFile({ ...raw, ...c });
113
113
  }
114
- export const DEFAULT_MODELS = { scope: 'global', advisor: 'fable', autoFix: true };
114
+ export const DEFAULT_MODELS = { scope: 'global', main: 'sonnet', advisor: 'fable', autoFix: true };
115
115
  export const modelsPrefs = (p = loadPrefs()) => ({ ...DEFAULT_MODELS, ...p.models });
116
116
  export function loadPrefs() {
117
117
  const raw = readJson(credentialsPath()) ?? {};
118
118
  const m = raw.models;
119
119
  const models = m && typeof m === 'object' && !Array.isArray(m) && {
120
120
  ...((m.scope === 'global' || m.scope === 'local') && { scope: m.scope }),
121
+ ...((m.main === 'sonnet' || m.main === 'opus') && { main: m.main }),
121
122
  ...((m.advisor === 'fable' || m.advisor === 'opus') && { advisor: m.advisor }),
122
123
  ...(typeof m.autoFix === 'boolean' && { autoFix: m.autoFix }),
123
124
  ...((m.seenUserAdvisor === 'fable' || m.seenUserAdvisor === 'opus') && { seenUserAdvisor: m.seenUserAdvisor }),
package/dist/i18n.js CHANGED
@@ -309,17 +309,18 @@ const messages = {
309
309
  models_fable: () => '沒同意 Fable 時顧問不會跑,先在 /model fable 同意;不想用 Fable 就執行 cto models advisor opus。',
310
310
  models_line: (v) => `[cto] 設定檢查:${v.items}`,
311
311
  models_error: (v) => `[cto] 設定檢查失敗:${v.msg}`,
312
- models_split: (v) => `模型分工:主模型 sonnet · 顧問 ${v.advisor} · 子代理 haiku · 審核 cto-reviewer(opus)`,
312
+ models_split: (v) => `模型分工:主模型 ${v.main} · 顧問 ${v.advisor} · 子代理 haiku · 審核 cto-reviewer(opus)`,
313
313
  models_scope: (v) => `範圍:${v.scope}(寫在 ${v.file})`,
314
314
  models_autofix: (v) => `自動修:${v.state}`,
315
315
  models_review: (v) => `審核關卡:${v.state}`,
316
316
  models_no_drift: () => '漂移:無',
317
317
  models_drift_head: () => '漂移:',
318
318
  models_set: (v) => `[cto] ${v.what} 設為 ${v.value}`,
319
- models_usage: () => '用法:cto models [advisor fable|opus | autofix on|off | scope global|local | review on|off]',
319
+ models_usage: () => '用法:cto models [main sonnet|opus | advisor fable|opus | autofix on|off | scope global|local | review on|off]',
320
320
  ui_m_models: () => '模型分工',
321
- ui_models_row: (v) => `Sonnet · 顧問 ${v.advisor} · ${v.scope} · 自動修${v.autofix}`,
322
- ui_models_advisor_q: () => '顧問模型(Sonnet 做事,顧問給建議)',
321
+ ui_models_row: (v) => `${v.main} · 顧問 ${v.advisor} · ${v.scope} · 自動修${v.autofix}`,
322
+ ui_models_main_q: () => '主模型(回訊息、做事;Opus 品質較好、較耗額度)',
323
+ ui_models_advisor_q: () => '顧問模型(主模型做事,顧問給建議)',
323
324
  ui_models_scope_q: () => '分工寫在哪裡',
324
325
  ui_models_global: () => '全域:~/.claude/settings.json(每個 project)',
325
326
  ui_models_local: () => '只有這個 project:.claude/settings.local.json',
@@ -590,17 +591,18 @@ const messages = {
590
591
  models_fable: () => 'The advisor does not run until you agree to Fable: agree first in `/model fable`; to not use Fable, run `cto models advisor opus`.',
591
592
  models_line: (v) => `[cto] Settings check: ${v.items}`,
592
593
  models_error: (v) => `[cto] Settings check failed: ${v.msg}`,
593
- models_split: (v) => `Model split: main sonnet · advisor ${v.advisor} · sub-agents haiku · review cto-reviewer (opus)`,
594
+ models_split: (v) => `Model split: main ${v.main} · advisor ${v.advisor} · sub-agents haiku · review cto-reviewer (opus)`,
594
595
  models_scope: (v) => `Scope: ${v.scope} (written to ${v.file})`,
595
596
  models_autofix: (v) => `Auto-fix: ${v.state}`,
596
597
  models_review: (v) => `Review gate: ${v.state}`,
597
598
  models_no_drift: () => 'Drift: none',
598
599
  models_drift_head: () => 'Drift:',
599
600
  models_set: (v) => `[cto] ${v.what} set to ${v.value}`,
600
- models_usage: () => 'Usage: cto models [advisor fable|opus | autofix on|off | scope global|local | review on|off]',
601
+ models_usage: () => 'Usage: cto models [main sonnet|opus | advisor fable|opus | autofix on|off | scope global|local | review on|off]',
601
602
  ui_m_models: () => 'Model split',
602
- ui_models_row: (v) => `Sonnet · advisor ${v.advisor} · ${v.scope} · auto-fix ${v.autofix}`,
603
- ui_models_advisor_q: () => 'Advisor model (Sonnet does the work, the advisor advises)',
603
+ ui_models_row: (v) => `${v.main} · advisor ${v.advisor} · ${v.scope} · auto-fix ${v.autofix}`,
604
+ ui_models_main_q: () => 'Main model (answers and does the work; Opus does better, uses more usage)',
605
+ ui_models_advisor_q: () => 'Advisor model (the main model does the work, the advisor advises)',
604
606
  ui_models_scope_q: () => 'Where the split is written',
605
607
  ui_models_global: () => 'Global: ~/.claude/settings.json (every project)',
606
608
  ui_models_local: () => 'This project only: .claude/settings.local.json',
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ import { doctor } from './doctor.js';
11
11
  import { detectLang, t } from './i18n.js';
12
12
  import { maskDiff, maskSensitiveState } from './masker.js';
13
13
  import { setModelsLang } from './models.js';
14
- import { applyModelsChange, claudeModels, claudeStart, detectAgents, gitRoot, isSetUp, modelsCommand, planSetup, prefsSaveError, setup, wiredAgents } from './setup.js';
14
+ import { applyModelsChange, claudeModels, claudeStart, detectAgents, gitRoot, isSetUp, modelsChange, modelsCommand, planSetup, prefsSaveError, setup, wiredAgents } from './setup.js';
15
15
  async function readStdin() {
16
16
  if (process.stdin.isTTY)
17
17
  return '';
@@ -190,7 +190,7 @@ else if (args[0] === 'setup') {
190
190
  const firstRun = !wired.length && !providerOrder().length;
191
191
  const { setupUI } = await import('./setupui.js'); // clack loads only for interactive setup, never on the hook path
192
192
  const before = initial.models;
193
- const changed = (m) => m.advisor !== before.advisor || m.scope !== before.scope || m.autoFix !== before.autoFix;
193
+ const changed = (m) => Object.keys(modelsChange(before, m)).length > 0;
194
194
  // Same rule as the save: setup writes the split when the saved profile's auto-fix is on, a menu change writes it anyway.
195
195
  const plan = (st) => planSetup(root, st.agents, st.flow ?? false, st.goal, { prefs: st.models ?? before, before, write: before.autoFix || changed(st.models ?? before) });
196
196
  const s = await setupUI(initial, firstRun, lang, { detected: detectAgents(), plan });
@@ -302,7 +302,7 @@ else if (args[0] === 'index' || args[0] === 'docs') {
302
302
  else if (args[0] === 'models') {
303
303
  const root = gitRoot(process.cwd());
304
304
  // These write into a project (.cto.json, or the project's settings in scope local): only inside a git repo.
305
- const needsProject = args[1] === 'review' || args[1] === 'scope' || ((args[1] === 'advisor' || args[1] === 'autofix') && modelsPrefs().scope === 'local');
305
+ const needsProject = args[1] === 'review' || args[1] === 'scope' || ((args[1] === 'main' || args[1] === 'advisor' || args[1] === 'autofix') && modelsPrefs().scope === 'local');
306
306
  if (!root && needsProject) {
307
307
  process.stderr.write(t(lang, 'setup_not_git') + '\n');
308
308
  process.exitCode = 1;
package/dist/models.js CHANGED
@@ -7,7 +7,7 @@ import { appendBlock, isObj, missingIgnores, readSettings, refreshClaudeHooks, w
7
7
  import { AGENT_FILES, FLOW_COMMAND_PATH, FLOW_SKILL_PATH, SKILL_MARK, SKILL_PATH, fileVersion, syncFlowSkill, syncGuidance, tooNew } from './skill.js';
8
8
  import { currentVersion } from './update.js';
9
9
  import { t } from './i18n.js';
10
- // The model split for Claude Code (docs/cto_jev/features/models/SPEC.md): Sonnet does the work, Fable or Opus advises,
10
+ // The model split for Claude Code (docs/cto_jev/features/models/SPEC.md): Sonnet (or Opus, profile.main) does the work, Fable or Opus advises,
11
11
  // Haiku runs sub-agents, an Opus agent reviews. cto keeps the settings in line and says what it fixed.
12
12
  // Every user-visible item in one place; the text is in i18n.ts. English unless the CLI sets the language (tests stay English).
13
13
  let lang = 'en';
@@ -42,7 +42,15 @@ export const MSG = {
42
42
  /** Shown by `cto models` and the setup menu when the advisor is Fable; never at SessionStart (noise). */
43
43
  export const fableReminder = (p = modelsPrefs()) => (p.advisor === 'fable' ? MSG.fable : undefined);
44
44
  // ---------- model matchers (case-insensitive) ----------
45
- export const isMainModel = (v) => typeof v === 'string' && /^(sonnet|claude-sonnet-[\w.-]+)(\[1m\])?$/i.test(v);
45
+ /** sonnet or opus (Opus 5 and up), with or without `[1m]`; anything else undefined. */
46
+ export function mainOf(v) {
47
+ if (typeof v !== 'string')
48
+ return undefined;
49
+ const base = v.replace(/\[1m\]$/i, '');
50
+ if (/^(sonnet|claude-sonnet-[\w.-]+)$/i.test(base))
51
+ return 'sonnet';
52
+ return advisorOf(base) === 'opus' ? 'opus' : undefined;
53
+ }
46
54
  export const isSubagentModel = (v) => typeof v === 'string' && (/^haiku$/i.test(v) || /^claude-haiku-[\w.-]+$/i.test(v));
47
55
  /** fable or opus (Opus 5 and up; the bare alias counts), anything else undefined. */
48
56
  export function advisorOf(v) {
@@ -54,7 +62,7 @@ export function advisorOf(v) {
54
62
  return m && (m[2] === undefined || Number(m[2]) >= 5) ? 'opus' : undefined;
55
63
  }
56
64
  export const MODEL_KEYS = [
57
- { label: 'model', path: ['model'], ok: isMainModel, want: () => 'sonnet' },
65
+ { label: 'model', path: ['model'], ok: (v, p) => mainOf(v) === p.main, want: (p) => p.main },
58
66
  { label: 'advisorModel', path: ['advisorModel'], ok: (v, p) => advisorOf(v) === p.advisor, want: (p) => p.advisor },
59
67
  // Never CLAUDE_CODE_SUBAGENT_MODEL_FORCE: with it Claude Code ignores cto-reviewer's own `model: opus`.
60
68
  { label: 'CLAUDE_CODE_SUBAGENT_MODEL', path: ['env', 'CLAUDE_CODE_SUBAGENT_MODEL'], ok: isSubagentModel, want: () => 'haiku' },
@@ -385,15 +393,18 @@ function checkFiles(root, autoFix, out) {
385
393
  }
386
394
  // ---------- changing the split ----------
387
395
  /**
388
- * A value cto wrote, so clearing a scope may remove it: model sonnet, sub-agents haiku, and any fable or opus advisor
389
- * (whichever one the profile holds now, or one switched with /advisor; the same rule switchScope carries over).
396
+ * A value cto wrote, so clearing a scope may remove it: model equal to the cleared scope's main (`main`, so a user's
397
+ * own `opus` under a sonnet split stays), sub-agents haiku, and any fable or opus advisor (whichever one the profile
398
+ * holds now, or one switched with /advisor; the same rule switchScope carries over).
390
399
  */
391
- export const isOurs = (k, v) => k.label === 'advisorModel' ? advisorOf(v) !== undefined : v === k.want(DEFAULT_MODELS);
400
+ export const isOurs = (k, v, main = modelsPrefs().main) => k.label === 'advisorModel' ? advisorOf(v) !== undefined
401
+ : k.label === 'model' ? v === main
402
+ : v === k.want(DEFAULT_MODELS);
392
403
  /**
393
404
  * Take the split out of one scope: the three keys (only where they still hold the profile's values) and cto's agent
394
405
  * files there. Used when switching scope and when cto is removed.
395
406
  */
396
- export function clearScope(root, scope, opts = {}) {
407
+ export function clearScope(root, scope, opts = {}, main = modelsPrefs().main) {
397
408
  const out = empty();
398
409
  const home = opts.home ?? homedir();
399
410
  const show = display(root, home);
@@ -402,7 +413,7 @@ export function clearScope(root, scope, opts = {}) {
402
413
  if (t.json === null)
403
414
  out.reported.push(fileProblem(t, show(path)));
404
415
  else {
405
- const mine = MODEL_KEYS.filter((k) => isOurs(k, getAt(t.json, k.path)));
416
+ const mine = MODEL_KEYS.filter((k) => isOurs(k, getAt(t.json, k.path), main));
406
417
  for (const k of mine)
407
418
  delAt(t.json, k.path);
408
419
  if (mine.length && writeJsonIfUnchanged(path, t.text, t.json))
@@ -446,11 +457,11 @@ export function switchScope(root, to, opts = {}, also = {}) {
446
457
  const a = p.scope === 'global' ? advisorOf(getAt(readSettings(targetPath(root, p.scope, opts.home ?? homedir())), ['advisorModel'])) : undefined;
447
458
  if (!saveModels({ ...p, ...(a && { advisor: a }), ...also, scope: to }, out))
448
459
  return out; // prefs first: a failed save changes no file
449
- const cleared = clearScope(root, p.scope, opts);
460
+ const cleared = clearScope(root, p.scope, opts, p.main); // the old scope holds the old main
450
461
  const written = driftCheck(root, { ...opts, autoFix: true, files: false, adopt: false });
451
462
  return { fixed: [...cleared.fixed, ...written.fixed], reported: [...cleared.reported, ...written.reported] };
452
463
  }
453
- /** `cto models advisor|autofix|scope`: save the change, then write it at once (turning autofix off writes nothing). */
464
+ /** `cto models main|advisor|autofix|scope`: save the change, then write it at once (turning autofix off writes nothing). */
454
465
  export function applyModels(root, change, opts = {}) {
455
466
  const p = modelsPrefs();
456
467
  const out = empty();
@@ -460,7 +471,7 @@ export function applyModels(root, change, opts = {}) {
460
471
  }
461
472
  if (!saveModels({ ...p, ...change, scope: p.scope }, out))
462
473
  return out;
463
- if (change.advisor !== undefined || change.autoFix === true)
474
+ if (change.main !== undefined || change.advisor !== undefined || change.autoFix === true)
464
475
  return driftCheck(root, { ...opts, autoFix: true, files: false, adopt: false });
465
476
  return out;
466
477
  }
package/dist/setup.js CHANGED
@@ -320,7 +320,7 @@ function planModels(root, claude, wasWired, m, at) {
320
320
  const planClear = (scope) => {
321
321
  const shown = shownIn(scope), target = targetPath(root, scope, home), s = readSettings(target);
322
322
  const hook = scope === 'global' && Array.isArray(s?.hooks?.SessionStart) && s.hooks.SessionStart.some(hasModelsHook);
323
- if (isObj(s) && (hook || MODEL_KEYS.some((k) => isOurs(k, valueAt(s, k.path)))))
323
+ if (isObj(s) && (hook || MODEL_KEYS.some((k) => isOurs(k, valueAt(s, k.path), (m.before ?? p).main))))
324
324
  at(shown(target), 'write', target);
325
325
  for (const n of Object.keys(AGENT_FILES)) {
326
326
  const f = join(agentsDir(root, scope, home), n);
@@ -724,14 +724,21 @@ export function prefsSaveError(e, lang, path) {
724
724
  }
725
725
  /** Apply a model split chosen in the setup menu: only what changed, through the same function as `cto models`. */
726
726
  export function applyModelsChange(root, before, after, opts = {}) {
727
+ const change = modelsChange(before, after);
728
+ return Object.keys(change).length ? applyAndHook(root, change, opts) : [];
729
+ }
730
+ /** What the menu changed in the split; the setup preview and the save both read it, so they agree. */
731
+ export function modelsChange(before, after) {
727
732
  const change = {};
733
+ if (after.main !== before.main)
734
+ change.main = after.main;
728
735
  if (after.advisor !== before.advisor)
729
736
  change.advisor = after.advisor;
730
737
  if (after.autoFix !== before.autoFix)
731
738
  change.autoFix = after.autoFix;
732
739
  if (after.scope !== before.scope)
733
740
  change.scope = after.scope;
734
- return Object.keys(change).length ? applyAndHook(root, change, opts) : [];
741
+ return change;
735
742
  }
736
743
  function applyAndHook(root, change, opts) {
737
744
  const lines = modelsLines(applyModels(root, change, opts));
@@ -742,7 +749,7 @@ function applyAndHook(root, change, opts) {
742
749
  }
743
750
  return lines;
744
751
  }
745
- /** `cto models [advisor fable|opus | autofix on|off | scope global|local | review on|off]`. */
752
+ /** `cto models [main sonnet|opus | advisor fable|opus | autofix on|off | scope global|local | review on|off]`. */
746
753
  export function modelsCommand(root, args, lang, opts = {}) {
747
754
  const [what, value] = args;
748
755
  const onoff = (b) => t(lang, b ? 'ui_on' : 'ui_off');
@@ -761,7 +768,7 @@ export function modelsCommand(root, args, lang, opts = {}) {
761
768
  return {
762
769
  code: 0,
763
770
  lines: [
764
- t(lang, 'models_split', { advisor: p.advisor }),
771
+ t(lang, 'models_split', { main: p.main, advisor: p.advisor }),
765
772
  t(lang, 'models_scope', { scope: t(lang, `models_scope_${p.scope}`), file: p.scope === 'global' ? USER_SETTINGS_SHOWN : '.claude/settings.local.json' }),
766
773
  t(lang, 'models_autofix', { state: onoff(p.autoFix) }),
767
774
  t(lang, 'models_review', { state: onoff(loadConfig(root).review_gate) }),
@@ -777,10 +784,11 @@ export function modelsCommand(root, args, lang, opts = {}) {
777
784
  return { code: 1, lines: [t(lang, 'models_bad_json', { file: '.cto.json' })] };
778
785
  return { code: 0, lines: [t(lang, 'models_set', { what: 'review_gate', value })] };
779
786
  }
780
- const change = what === 'advisor' && (value === 'fable' || value === 'opus') ? { advisor: value }
781
- : what === 'autofix' && (value === 'on' || value === 'off') ? { autoFix: value === 'on' }
782
- : what === 'scope' && (value === 'global' || value === 'local') ? { scope: value }
783
- : undefined;
787
+ const change = what === 'main' && (value === 'sonnet' || value === 'opus') ? { main: value }
788
+ : what === 'advisor' && (value === 'fable' || value === 'opus') ? { advisor: value }
789
+ : what === 'autofix' && (value === 'on' || value === 'off') ? { autoFix: value === 'on' }
790
+ : what === 'scope' && (value === 'global' || value === 'local') ? { scope: value }
791
+ : undefined;
784
792
  if (!change)
785
793
  return { code: 1, lines: [t(lang, 'models_usage')] };
786
794
  // Scope local in a folder without cto's Claude wiring (e.g. right after uninstall): clear the user level, write nothing here.
package/dist/setupui.js CHANGED
@@ -131,8 +131,13 @@ export async function setupUI(initial, firstRun, lang, o = {}) {
131
131
  });
132
132
  return isCancel(r) ? BACK : { ...s, flow: r === 'yes' };
133
133
  };
134
- // Three questions in a row (Esc goes back one); index.ts applies the result with the same function as `cto models`.
134
+ // Four questions in a row (Esc goes back one); index.ts applies the result with the same function as `cto models`.
135
135
  const pick = (message, initialValue, options) => select({ ...io, showInstructions: false, message, initialValue, options: options });
136
+ const mainStep = async (s) => {
137
+ const m = s.models ?? DEFAULT_MODELS;
138
+ const r = await pick(t(lang, 'ui_models_main_q'), m.main, [{ value: 'sonnet', label: 'Sonnet' }, { value: 'opus', label: 'Opus' }]);
139
+ return isCancel(r) ? BACK : { ...s, models: { ...m, main: r } };
140
+ };
136
141
  const advisorStep = async (s) => {
137
142
  const m = s.models ?? DEFAULT_MODELS;
138
143
  const r = await pick(t(lang, 'ui_models_advisor_q'), m.advisor, [{ value: 'fable', label: 'Fable' }, { value: 'opus', label: 'Opus' }]);
@@ -187,7 +192,7 @@ export async function setupUI(initial, firstRun, lang, o = {}) {
187
192
  }
188
193
  for (let first = firstRun;; first = false) {
189
194
  const m = state.models ?? DEFAULT_MODELS;
190
- const modelsNow = t(lang, 'ui_models_row', { advisor: m.advisor === 'fable' ? 'Fable' : 'Opus', scope: t(lang, `models_scope_${m.scope}`), autofix: t(lang, m.autoFix ? 'ui_on' : 'ui_off') });
195
+ const modelsNow = t(lang, 'ui_models_row', { main: m.main === 'opus' ? 'Opus' : 'Sonnet', advisor: m.advisor === 'fable' ? 'Fable' : 'Opus', scope: t(lang, `models_scope_${m.scope}`), autofix: t(lang, m.autoFix ? 'ui_on' : 'ui_off') });
191
196
  const rows = [
192
197
  ['agents', t(lang, 'ui_m_agents'), state.agents.map((n) => agents[n].label).join(', ') || t(lang, 'doc_none')],
193
198
  ['providers', t(lang, 'ui_m_providers'), state.providers.map((p, i) => `${i + 1}. ${providers[p].label}`).join(' ') || t(lang, 'doc_none')],
@@ -224,7 +229,7 @@ export async function setupUI(initial, firstRun, lang, o = {}) {
224
229
  providers: [providersStep, keysStepFor(state.providers)],
225
230
  keys: [keysStepFor(null)],
226
231
  flow: [flowStep],
227
- models: [advisorStep, scopeStep, autoFixStep],
232
+ models: [mainStep, advisorStep, scopeStep, autoFixStep],
228
233
  lang: [langStep],
229
234
  };
230
235
  const r = await walk(steps[choice]);
package/dist/skill.js CHANGED
@@ -6,7 +6,7 @@ import { currentVersion, newer } from './update.js';
6
6
  // only when the agent decides they are relevant, so rules that must always hold live here.
7
7
  // 2. One detailed skill at .agents/skills/cto (read by Codex, Gemini CLI and Cursor; the rules block points Claude
8
8
  // Code to the same file). A single copy, so Cursor (which also scans .claude/skills) never sees two.
9
- // Every rule names the check that enforces it, and every enforcing check has a rule.
9
+ // Every rule names the check that enforces it, or says it has none, and every enforcing check has a rule.
10
10
  export const SKILL_MARK = '<!-- Managed by `cto setup`. Re-run it to update; local edits are overwritten. -->';
11
11
  /** Every file cto writes carries the version that wrote it, so an older cto never downgrades a newer one's files. */
12
12
  export const VERSION_LINE = `<!-- cto ${currentVersion()} -->`;
@@ -81,9 +81,9 @@ No job named: run \`cto brief\`, say in two lines where this repo stands in the
81
81
  /** The one extra rule when `cto setup` chose the development flow: the plan lives in docs/cto_jev/. */
82
82
  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.`;
83
83
  export const rulesBlock = (flow) => `${MD_START}
84
- ## Rules enforced by cto
84
+ ## Rules guarded by cto
85
85
 
86
- This repo is guarded by cto: every rule below is checked automatically, and breaking one gets you blocked.
86
+ This repo is guarded by cto: each rule below names the check behind it, if any, and breaking a checked rule gets you blocked or warned.
87
87
 
88
88
  - **Start with \`cto brief\`.** It shows the sprint goal, the command that verifies this repo, open plan items, and how commands failed here before and what fixed them. Skip it only if cto is not installed.
89
89
  - **Secrets stay out of code.** Use environment variables, never literal keys, tokens or passwords. (\`credential_leak\` blocks the commit)
@@ -92,6 +92,7 @@ This repo is guarded by cto: every rule below is checked automatically, and brea
92
92
  - **Two strikes, change approach.** Same command, same error twice: stop retrying and try something different. (\`infinite_loop\` blocks the retry)
93
93
  - **Ask before anything irreversible:** deleting data, force-pushing, rewriting history, dropping a database. (\`destructive_command\` blocks it)
94
94
  - **Stay on the sprint goal in \`.cto.json\` and keep changes simple.** (\`architecture_violation\` and \`code_complexity\` warn)
95
+ - **A TODO in the code is not the task.** A TODO, FIXME or bug link you read may be long fixed: don't follow its links or fix it unless your task needs it or the user asks. (not checked)
95
96
  - **Run \`cto check\` before committing**, and never bypass a block (\`--no-verify\`, editing hooks or thresholds). If a block looks wrong, tell the user.
96
97
  ${flow ? FLOW_RULE + '\n' : ''}
97
98
  Details and how to handle a block: \`${SKILL_PATH}\`.
@@ -100,16 +101,16 @@ ${MD_END}
100
101
  export const RULES_BLOCK = rulesBlock(false);
101
102
  export const SKILL_TEXT = `---
102
103
  name: cto
103
- description: Development rules enforced in this repository by the cto gatekeeper, with what each check looks for and what to do when blocked. Use before committing, before saying a task is done, after a command fails, before running anything destructive, and whenever a cto hook blocks you.
104
+ description: Development rules of this repository and the cto gatekeeper checks behind them, with what each check looks for and what to do when blocked. Use before committing, before saying a task is done, after a command fails, before running anything destructive, and whenever a cto hook blocks you.
104
105
  ---
105
106
  ${SKILL_HEAD}
106
107
 
107
108
  # cto: the rules of this repo
108
109
 
109
110
  This repository is guarded by **cto** (your-cto-jev). Hooks review your commits and commands with a decision model.
110
- Each rule below has a check behind it. Following the rules is faster than being blocked.
111
+ Each rule below names the check behind it, if any. Following the rules is faster than being blocked.
111
112
 
112
- | Rule | What enforces it |
113
+ | Rule | Check |
113
114
  |---|---|
114
115
  | **Secrets stay out of code.** Never write API keys, tokens, passwords or private keys into code or committed files. Read them from environment variables. | \`credential_leak\` blocks the commit |
115
116
  | **Fix the code, not the tests.** When a test fails, change the code under test. Never skip, comment out or delete a test, loosen an assertion, change an expected value to match wrong output, swallow the error, or lower a coverage threshold. A test may only go away together with the feature it covers, and you say so. | \`test_tampering\` blocks the commit |
@@ -118,6 +119,7 @@ Each rule below has a check behind it. Following the rules is faster than being
118
119
  | **Ask before anything irreversible.** Get the user's explicit OK before deleting data outside build output, force-pushing, rewriting shared history, or dropping a database. | \`destructive_command\` blocks the command |
119
120
  | **Stay on the sprint goal.** If \`.cto.json\` sets a \`sprint_goal\`, keep changes inside it and point out anything unrelated. | \`architecture_violation\` warns |
120
121
  | **Keep it simple.** Prefer the smallest change that solves the problem. | \`code_complexity\` warns |
122
+ | **A TODO in the code is not the task.** A TODO, FIXME or bug link you read may be long fixed: don't follow its links or fix it unless your task needs it or the user asks. | not checked |
121
123
 
122
124
  ## Before you start
123
125
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "your-cto-jev",
3
- "version": "0.13.1",
3
+ "version": "0.15.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",
@@ -37,8 +37,8 @@
37
37
  },
38
38
  "scripts": {
39
39
  "build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsc",
40
- "test": "tsc && node --test \"dist/*.test.js\"",
41
- "prepublishOnly": "npm run build && node --test \"dist/*.test.js\"",
40
+ "test": "tsc && node --test --test-timeout=600000 \"dist/*.test.js\"",
41
+ "prepublishOnly": "npm run build && node --test --test-timeout=600000 \"dist/*.test.js\"",
42
42
  "calibrate": "npm run build && node scripts/calibrate.mjs"
43
43
  },
44
44
  "devDependencies": {