your-cto-jev 0.9.0 → 0.9.1
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 +1 -1
- package/dist/i18n.js +30 -2
- package/dist/index.js +2 -2
- package/dist/setup.js +67 -1
- package/dist/setupui.js +63 -10
- package/dist/skill.js +29 -15
- package/package.json +1 -1
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?
|
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
|
|
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 先用,失敗才換下一個',
|
|
@@ -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?
|
|
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',
|
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,5 +1,5 @@
|
|
|
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';
|
|
@@ -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);
|
|
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;
|
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,
|
|
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
|
|
28
|
-
|
|
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
|
@@ -274,7 +274,8 @@ function removeFileAndEmptyDirs(root, path) {
|
|
|
274
274
|
* removeOthers (exact mode or uninstall) take cto's content out of files no chosen agent reads. Only cto-marked
|
|
275
275
|
* content is ever removed or overwritten. With flow, the rules block carries the extra docs/cto_jev/ rule.
|
|
276
276
|
*/
|
|
277
|
-
|
|
277
|
+
/** `dry`: decide exactly as a real run would, write nothing (the setup summary lists these before asking). */
|
|
278
|
+
export function syncGuidance(root, chosen, removeOthers, flow = false, dry = false) {
|
|
278
279
|
const written = [];
|
|
279
280
|
const removed = [];
|
|
280
281
|
for (const m of MEMORY_FILES) {
|
|
@@ -283,50 +284,63 @@ export function syncGuidance(root, chosen, removeOthers, flow = false) {
|
|
|
283
284
|
if (m.agents.some((a) => chosen.has(a))) {
|
|
284
285
|
const next = appendMd(current, flow);
|
|
285
286
|
if (next !== current) {
|
|
286
|
-
|
|
287
|
+
if (!dry)
|
|
288
|
+
writeFileSync(path, next);
|
|
287
289
|
written.push(m.path);
|
|
288
290
|
}
|
|
289
291
|
}
|
|
290
292
|
else if (removeOthers && mdBlockRe.test(current)) {
|
|
291
293
|
const rest = removeMd(current);
|
|
292
|
-
if (
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
294
|
+
if (!dry) {
|
|
295
|
+
if (rest.trim())
|
|
296
|
+
writeFileSync(path, rest);
|
|
297
|
+
else
|
|
298
|
+
unlinkSync(path);
|
|
299
|
+
}
|
|
296
300
|
removed.push(m.path);
|
|
297
301
|
}
|
|
298
302
|
}
|
|
299
303
|
const skill = join(root, SKILL_PATH);
|
|
300
304
|
if (chosen.size) {
|
|
301
305
|
if (!existsSync(skill) || readFileSync(skill, 'utf8') !== SKILL_TEXT) {
|
|
302
|
-
|
|
303
|
-
|
|
306
|
+
if (!dry) {
|
|
307
|
+
mkdirSync(dirname(skill), { recursive: true });
|
|
308
|
+
writeFileSync(skill, SKILL_TEXT);
|
|
309
|
+
}
|
|
304
310
|
written.push(SKILL_PATH);
|
|
305
311
|
}
|
|
306
312
|
}
|
|
307
313
|
else if (removeOthers && existsSync(skill) && readFileSync(skill, 'utf8').includes(SKILL_MARK)) {
|
|
308
|
-
|
|
314
|
+
if (!dry)
|
|
315
|
+
removeFileAndEmptyDirs(root, skill);
|
|
309
316
|
removed.push(SKILL_PATH);
|
|
310
317
|
}
|
|
311
318
|
const legacy = join(root, LEGACY_SKILL);
|
|
312
|
-
if (existsSync(legacy) && readFileSync(legacy, 'utf8').includes(SKILL_MARK))
|
|
313
|
-
|
|
319
|
+
if (existsSync(legacy) && readFileSync(legacy, 'utf8').includes(SKILL_MARK)) {
|
|
320
|
+
if (!dry)
|
|
321
|
+
removeFileAndEmptyDirs(root, legacy);
|
|
322
|
+
else
|
|
323
|
+
removed.push(LEGACY_SKILL); // only the plan lists it; a real run removes it silently, as before
|
|
324
|
+
}
|
|
314
325
|
return { written, removed };
|
|
315
326
|
}
|
|
316
327
|
/** 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) {
|
|
328
|
+
export function syncFlowSkill(root, enabled, dry = false) {
|
|
318
329
|
const written = [];
|
|
319
330
|
const removed = [];
|
|
320
331
|
const skill = join(root, FLOW_SKILL_PATH);
|
|
321
332
|
if (enabled) {
|
|
322
333
|
if (!existsSync(skill) || readFileSync(skill, 'utf8') !== FLOW_SKILL_TEXT) {
|
|
323
|
-
|
|
324
|
-
|
|
334
|
+
if (!dry) {
|
|
335
|
+
mkdirSync(dirname(skill), { recursive: true });
|
|
336
|
+
writeFileSync(skill, FLOW_SKILL_TEXT);
|
|
337
|
+
}
|
|
325
338
|
written.push(FLOW_SKILL_PATH);
|
|
326
339
|
}
|
|
327
340
|
}
|
|
328
341
|
else if (existsSync(skill) && readFileSync(skill, 'utf8').includes(SKILL_MARK)) {
|
|
329
|
-
|
|
342
|
+
if (!dry)
|
|
343
|
+
removeFileAndEmptyDirs(root, skill);
|
|
330
344
|
removed.push(FLOW_SKILL_PATH);
|
|
331
345
|
}
|
|
332
346
|
return { written, removed };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "your-cto-jev",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1",
|
|
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",
|