your-cto-jev 0.9.6 → 0.9.7
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 +4 -14
- package/dist/index.js +4 -7
- package/dist/setup.js +1 -1
- package/dist/setupui.js +2 -8
- 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
|
|
103
|
+
`cto setup` walks you through four steps with arrow keys: coding agents, Jev providers, API keys, 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
|
@@ -78,11 +78,10 @@ const messages = {
|
|
|
78
78
|
setup_gitignore: () => '[cto] .gitignore 已加入 .cto-brain.json 與 debug_stdin.json',
|
|
79
79
|
setup_config: () => '[cto] 已建立 .cto.json(請 commit 給團隊共用)',
|
|
80
80
|
setup_sprint: () => '[cto] 提示:在 .cto.json 填入 sprint_goal 以啟用架構對齊檢查。',
|
|
81
|
-
setup_goal_bad_json: () => '[cto] .cto.json 不是合法 JSON,sprint goal 沒有寫入,檔案保持原樣。請先修正該檔。',
|
|
82
81
|
setup_done: () => '[cto] 安裝完成。',
|
|
83
82
|
setup_flow_docs: (v) => `[cto] 已建立 docs/cto_jev/ 骨架:${v.list}`,
|
|
84
83
|
setup_flow_bad_json: () => '[cto] .cto.json 不是合法 JSON,開發流程的選擇沒有寫入,檔案保持原樣。請先修正該檔。',
|
|
85
|
-
setup_flow_next: () =>
|
|
84
|
+
setup_flow_next: (v) => `[cto] 下一步:打開你的 agent,${v.claude ? '在 Claude Code 打 /cto-jev init,或' : ''}跟它說「set up PRODUCT.md and ARCHITECTURE.md」,它會掃 repo 填好再問你剩下的。`,
|
|
86
85
|
setup_flow_publish: (v) => `[cto] 偵測到 ${v.file}:docs/cto_jev/ 不要跟著文件網站一起發布(PRODUCT.md 寫著定價和商業規則),請在 ${v.file} 把這個資料夾排除。`,
|
|
87
86
|
uninstall_hook: (v) => `[cto] 已從 ${v.path} 移除 cto 區塊`,
|
|
88
87
|
uninstall_gitignore: () => '[cto] 已從 .gitignore 移除 cto 區塊',
|
|
@@ -94,7 +93,7 @@ const messages = {
|
|
|
94
93
|
wiz_ok: (v) => ` ${v.name} 驗證成功`,
|
|
95
94
|
wiz_fail: (v) => ` ${v.name} 驗證失敗 (${v.status}) ${v.msg}`,
|
|
96
95
|
ui_title: () => 'cto 設定',
|
|
97
|
-
ui_first_run: () => '
|
|
96
|
+
ui_first_run: () => '共四步:coding agent、Jev provider、API key、開發流程。↑↓ 移動,Enter 確認,Esc 回上一步。完成後會回到總覽,之後也能單獨修改任何一項。',
|
|
98
97
|
ui_agents_q: () => '要攔截哪些 coding agent 的指令?',
|
|
99
98
|
ui_agents_help: () => '↑↓ 移動 · 空白鍵勾選 · Enter 確認 · Esc 返回',
|
|
100
99
|
ui_always: () => '一律安裝',
|
|
@@ -129,8 +128,6 @@ const messages = {
|
|
|
129
128
|
ui_retry: () => '重新輸入',
|
|
130
129
|
ui_save_anyway: () => '仍然儲存(之後用 cto doctor 再確認)',
|
|
131
130
|
ui_drop: (v) => `不使用 ${v.name}`,
|
|
132
|
-
ui_goal_q: () => 'Sprint goal(選填,填了才會檢查 commit 是否偏離目標)',
|
|
133
|
-
ui_goal_ph: () => '例如:完成 Stripe 金流,不新增服務',
|
|
134
131
|
ui_flow_q: () => '要用 cto 開發流程嗎?你的 agent 當 CTO:在 docs/cto_jev/ 規劃、派工、驗收;cto 檢查簽核和漂移。',
|
|
135
132
|
ui_flow_yes: () => '要,寫入 cto-jev skill(/cto-jev)和 docs/cto_jev/ 骨架',
|
|
136
133
|
ui_flow_no: () => '不用,只守關卡',
|
|
@@ -142,12 +139,10 @@ const messages = {
|
|
|
142
139
|
ui_m_agents: () => 'Coding agents',
|
|
143
140
|
ui_m_providers: () => 'Jev providers 與順序',
|
|
144
141
|
ui_m_keys: () => '更換 API key',
|
|
145
|
-
ui_m_goal: () => 'Sprint goal',
|
|
146
142
|
ui_m_flow: () => '開發流程',
|
|
147
143
|
ui_m_lang: () => '語言',
|
|
148
144
|
ui_m_save: () => '儲存並完成',
|
|
149
145
|
ui_m_quit: () => '不儲存離開',
|
|
150
|
-
ui_unset: () => '未設定',
|
|
151
146
|
ui_saved: () => '設定完成。之後執行 cto setup 可以回到這個總覽,cto doctor 可以確認是否正常運作。',
|
|
152
147
|
ui_quit: () => '已離開,沒有修改任何設定。',
|
|
153
148
|
check_nothing: () => '[cto] 沒有可檢查的改動。',
|
|
@@ -267,11 +262,10 @@ const messages = {
|
|
|
267
262
|
setup_gitignore: () => '[cto] Added .cto-brain.json and debug_stdin.json to .gitignore',
|
|
268
263
|
setup_config: () => '[cto] Created .cto.json (commit it for the team)',
|
|
269
264
|
setup_sprint: () => '[cto] Tip: set sprint_goal in .cto.json to enable the architecture alignment check.',
|
|
270
|
-
setup_goal_bad_json: () => '[cto] .cto.json is not valid JSON, so the sprint goal was not saved and the file was left untouched. Fix it first.',
|
|
271
265
|
setup_done: () => '[cto] Setup complete.',
|
|
272
266
|
setup_flow_docs: (v) => `[cto] Created the docs/cto_jev/ skeleton: ${v.list}`,
|
|
273
267
|
setup_flow_bad_json: () => '[cto] .cto.json is not valid JSON, so the development flow choice was not saved and the file was left untouched. Fix it first.',
|
|
274
|
-
setup_flow_next: () =>
|
|
268
|
+
setup_flow_next: (v) => `[cto] Next: open your agent and ${v.claude ? 'type /cto-jev init in Claude Code, or ' : ''}say "set up PRODUCT.md and ARCHITECTURE.md". It scans the repo, fills what it can, and asks you the rest.`,
|
|
275
269
|
setup_flow_publish: (v) => `[cto] ${v.file} found: keep docs/cto_jev/ out of the published site (PRODUCT.md holds pricing and business rules); exclude the folder in ${v.file}.`,
|
|
276
270
|
uninstall_hook: (v) => `[cto] Removed the cto block from ${v.path}`,
|
|
277
271
|
uninstall_gitignore: () => '[cto] Removed the cto block from .gitignore',
|
|
@@ -283,7 +277,7 @@ const messages = {
|
|
|
283
277
|
wiz_ok: (v) => ` ${v.name} OK`,
|
|
284
278
|
wiz_fail: (v) => ` ${v.name} failed (${v.status}) ${v.msg}`,
|
|
285
279
|
ui_title: () => 'cto setup',
|
|
286
|
-
ui_first_run: () => '
|
|
280
|
+
ui_first_run: () => 'Four steps: coding agents, Jev providers, API keys, 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.',
|
|
287
281
|
ui_agents_q: () => 'Which coding agents should have their commands checked?',
|
|
288
282
|
ui_agents_help: () => 'Up/Down move · Space toggles · Enter confirms · Esc goes back',
|
|
289
283
|
ui_always: () => 'always installed',
|
|
@@ -318,8 +312,6 @@ const messages = {
|
|
|
318
312
|
ui_retry: () => 'Enter it again',
|
|
319
313
|
ui_save_anyway: () => 'Save anyway (check later with cto doctor)',
|
|
320
314
|
ui_drop: (v) => `Do not use ${v.name}`,
|
|
321
|
-
ui_goal_q: () => 'Sprint goal (optional; enables the check for commits that drift from it)',
|
|
322
|
-
ui_goal_ph: () => 'e.g. Ship Stripe billing, no new services',
|
|
323
315
|
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.',
|
|
324
316
|
ui_flow_yes: () => 'Yes, write the cto-jev skill (/cto-jev) and a docs/cto_jev/ skeleton',
|
|
325
317
|
ui_flow_no: () => 'No, gatekeeping only',
|
|
@@ -331,12 +323,10 @@ const messages = {
|
|
|
331
323
|
ui_m_agents: () => 'Coding agents',
|
|
332
324
|
ui_m_providers: () => 'Jev providers and order',
|
|
333
325
|
ui_m_keys: () => 'Change API keys',
|
|
334
|
-
ui_m_goal: () => 'Sprint goal',
|
|
335
326
|
ui_m_flow: () => 'Development flow',
|
|
336
327
|
ui_m_lang: () => 'Language',
|
|
337
328
|
ui_m_save: () => 'Save and finish',
|
|
338
329
|
ui_m_quit: () => 'Quit without saving',
|
|
339
|
-
ui_unset: () => 'not set',
|
|
340
330
|
ui_saved: () => 'Done. Run cto setup to come back to this overview, and cto doctor to check that it works.',
|
|
341
331
|
ui_quit: () => 'Left without changing anything.',
|
|
342
332
|
check_nothing: () => '[cto] Nothing to check.',
|
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, planSetup,
|
|
13
|
+
import { detectAgents, gitRoot, planSetup, setup, wiredAgents } from './setup.js';
|
|
14
14
|
async function readStdin() {
|
|
15
15
|
if (process.stdin.isTTY)
|
|
16
16
|
return '';
|
|
@@ -107,7 +107,7 @@ if (args[0] === '--hook' && args[1]) {
|
|
|
107
107
|
else if (args[0] === 'setup') {
|
|
108
108
|
const uninstall = args.includes('--uninstall');
|
|
109
109
|
let chosen;
|
|
110
|
-
let
|
|
110
|
+
let interactive = false; // the menu lists every agent, so what is left unticked loses its cto hooks (exact mode)
|
|
111
111
|
let flow = args.includes('--flow') ? true : args.includes('--no-flow') ? false : undefined;
|
|
112
112
|
const root = gitRoot(process.cwd());
|
|
113
113
|
const list = flag('--agents');
|
|
@@ -142,16 +142,13 @@ else if (args[0] === 'setup') {
|
|
|
142
142
|
saveCredentials(s.keys);
|
|
143
143
|
savePrefs({ provider_order: s.providers, ...(s.lang && { lang: s.lang }) });
|
|
144
144
|
chosen = s.agents;
|
|
145
|
-
|
|
145
|
+
interactive = true;
|
|
146
146
|
flow = s.flow ?? false;
|
|
147
147
|
}
|
|
148
148
|
else if (!uninstall) {
|
|
149
149
|
chosen = detectAgents();
|
|
150
150
|
}
|
|
151
|
-
const r = setup(process.cwd(), lang, { uninstall, agents: chosen, exact:
|
|
152
|
-
if (!r.code && root && goal !== undefined && goal !== loadConfig(root).sprint_goal && !setSprintGoal(root, goal)) {
|
|
153
|
-
r.lines.push(t(lang, 'setup_goal_bad_json'));
|
|
154
|
-
}
|
|
151
|
+
const r = setup(process.cwd(), lang, { uninstall, agents: chosen, exact: interactive, flow });
|
|
155
152
|
const latest = r.code ? undefined : await checkUpdate();
|
|
156
153
|
if (latest)
|
|
157
154
|
r.lines.push(t(lang, 'update_available', { latest, current: currentVersion() }));
|
package/dist/setup.js
CHANGED
|
@@ -357,7 +357,7 @@ export function setup(cwd, lang, opts = {}) {
|
|
|
357
357
|
return true;
|
|
358
358
|
} });
|
|
359
359
|
if (flow && !savedFlow && owed)
|
|
360
|
-
lines.push(t(lang, 'setup_flow_next'));
|
|
360
|
+
lines.push(t(lang, 'setup_flow_next', { claude: claude ? 1 : 0 }));
|
|
361
361
|
// PRODUCT.md holds pricing and business rules: a docs site must not publish docs/cto_jev/. Warn only; config is the user's.
|
|
362
362
|
const publisher = flow ? docsPublisher(root) : undefined;
|
|
363
363
|
if (publisher)
|
package/dist/setupui.js
CHANGED
|
@@ -14,7 +14,7 @@ const WIDE = /[\u1100-\u115f\u2e80-\ua4cf\uac00-\ud7a3\uf900-\ufaff\ufe30-\ufe4f
|
|
|
14
14
|
export const displayWidth = (s) => [...s].reduce((w, ch) => w + (WIDE.test(ch) ? 2 : 1), 0);
|
|
15
15
|
const pad = (s, w) => s + ' '.repeat(Math.max(0, w - displayWidth(s)));
|
|
16
16
|
/**
|
|
17
|
-
* Interactive setup. First run walks agents -> providers -> keys ->
|
|
17
|
+
* Interactive setup. First run walks agents -> providers -> keys -> flow (Esc goes back one step), then
|
|
18
18
|
* shows the menu. Later runs open the menu directly, pre-filled with the current setup, so any single item can be
|
|
19
19
|
* changed without touching the rest. Returns the final state, or null if the user quits without saving.
|
|
20
20
|
*/
|
|
@@ -120,10 +120,6 @@ export async function setupUI(initial, firstRun, lang, o = {}) {
|
|
|
120
120
|
}
|
|
121
121
|
return { ...s, keys: keys, providers: kept };
|
|
122
122
|
};
|
|
123
|
-
const goalStep = async (s) => {
|
|
124
|
-
const r = await text({ ...io, message: t(lang, 'ui_goal_q'), placeholder: t(lang, 'ui_goal_ph'), initialValue: s.goal });
|
|
125
|
-
return isCancel(r) ? BACK : { ...s, goal: (r ?? '').trim() };
|
|
126
|
-
};
|
|
127
123
|
const flowStep = async (s) => {
|
|
128
124
|
const r = await select({
|
|
129
125
|
...io,
|
|
@@ -164,7 +160,7 @@ export async function setupUI(initial, firstRun, lang, o = {}) {
|
|
|
164
160
|
intro(t(lang, 'ui_title'), io);
|
|
165
161
|
if (firstRun) {
|
|
166
162
|
log.info(t(lang, 'ui_first_run'), io);
|
|
167
|
-
const r = await walk([agentsStep, providersStep, keysStepFor(initial.providers),
|
|
163
|
+
const r = await walk([agentsStep, providersStep, keysStepFor(initial.providers), flowStep]);
|
|
168
164
|
if (r === BACK) {
|
|
169
165
|
outro(t(lang, 'ui_quit'), io);
|
|
170
166
|
return null;
|
|
@@ -176,7 +172,6 @@ export async function setupUI(initial, firstRun, lang, o = {}) {
|
|
|
176
172
|
['agents', t(lang, 'ui_m_agents'), state.agents.map((n) => agents[n].label).join(', ') || t(lang, 'doc_none')],
|
|
177
173
|
['providers', t(lang, 'ui_m_providers'), state.providers.map((p, i) => `${i + 1}. ${providers[p].label}`).join(' ') || t(lang, 'doc_none')],
|
|
178
174
|
['keys', t(lang, 'ui_m_keys'), state.providers.map((p) => { const v = providers[p].keys.map((k) => state.keys[k] ?? env[k]).filter(Boolean).pop(); return v ? `${providers[p].label} ${tail(v)}` : ''; }).filter(Boolean).join(' ') || t(lang, 'doc_none')],
|
|
179
|
-
['goal', t(lang, 'ui_m_goal'), state.goal || t(lang, 'ui_unset')],
|
|
180
175
|
['flow', t(lang, 'ui_m_flow'), t(lang, state.flow ? 'ui_on' : 'ui_off')],
|
|
181
176
|
['lang', t(lang, 'ui_m_lang'), state.lang ?? t(lang, 'ui_lang_auto')],
|
|
182
177
|
];
|
|
@@ -206,7 +201,6 @@ export async function setupUI(initial, firstRun, lang, o = {}) {
|
|
|
206
201
|
agents: [agentsStep],
|
|
207
202
|
providers: [providersStep, keysStepFor(state.providers)],
|
|
208
203
|
keys: [keysStepFor(null)],
|
|
209
|
-
goal: [goalStep],
|
|
210
204
|
flow: [flowStep],
|
|
211
205
|
lang: [langStep],
|
|
212
206
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "your-cto-jev",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.7",
|
|
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",
|