your-cto-jev 0.22.0 → 0.22.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/setup.js +36 -23
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -298,7 +298,7 @@ Might be missing: what the agent is unsure of, pointing to the `Assumed:` lines
|
|
|
298
298
|
Data: which tables or stores change, whether old data migrates; "none" if nothing
|
|
299
299
|
```
|
|
300
300
|
|
|
301
|
-
- **Claude Code:** just agree in the chat. cto's `UserPromptSubmit` hook asks Jev whether your reply agrees to every listed file and, if so, sets the listed drafts to `Status: approved` and tells you which files it signed. "OK, but change X", a question or a free-text reply that agrees to only some files signs nothing; to sign some, name them (next line). A reply that opens with a yes to all and then turns to something unrelated ("ok all, also CI is red") still signs; when Jev turns down a reply that opens with a yes, cto says it signed nothing and how to sign. When Jev cannot sign, it signs nothing and says why: no API key yet (run `cto setup`), the service failed a moment ago and is paused (reply again later), or it is unreachable. In each case you can also edit the line yourself.
|
|
301
|
+
- **Claude Code:** just agree in the chat. cto's `UserPromptSubmit` hook asks Jev whether your reply agrees to every listed file and, if so, sets the listed drafts to `Status: approved` and tells you which files it signed. "OK, but change X", a question or a free-text reply that agrees to only some files signs nothing; to sign some, name them (next line). A reply that opens with a yes to all and then turns to something unrelated ("ok all, also CI is red") still signs; when Jev turns down a reply that opens with a yes and goes on, cto says it signed nothing and how to sign. When Jev cannot sign, it signs nothing and says why: no API key yet (run `cto setup`), the service failed a moment ago and is paused (reply again later), or it is unreachable. In each case you can also edit the line yourself.
|
|
302
302
|
- **Claude Code, by name:** a reply that is only names from the `Review:` line plus a yes signs just those, without asking Jev: "imports ok", "imports、catalog 好". A feature is named by its slug, PRODUCT and ARCHITECTURE by their own names. "ok all" or "全部 ok" signs every listed draft; a bare "都可以" goes to Jev, since it may answer another question. The rest stay on the `Review:` line for later.
|
|
303
303
|
- **Claude Code, from a menu:** whenever the agent stops for you, the skill has it put everything waiting on you in one menu (`/cto-jev decide` lists it all at once): docs to sign, decisions, parked tasks, `manual` checks. Each item has a short summary and 2–3 options with pros and cons, the recommended one first, plus "之後再選" (later). A sign-off question covers one doc and its summary lists every `Assumed:` line and data change; picking `Approve` signs that doc at once (a `PostToolUse` hook on `AskUserQuestion`, no Jev call). Anything typed under "Other" is a follow-up question and signs nothing. cto blocks a sign-off menu the agent prefilled with answers, and ignores menus from sub-agents.
|
|
304
304
|
- **Codex, Cursor, Gemini CLI:** edit the `Status:` line yourself.
|
package/dist/setup.js
CHANGED
|
@@ -50,6 +50,12 @@ const git = (cwd, ...args) => execFileSync('git', args, { cwd, encoding: 'utf8',
|
|
|
50
50
|
* git says matches (`.claude/` covers `.claude/settings.local.json`). Global excludesFile and .git/info/exclude do not
|
|
51
51
|
* count; linters like biome never read them. shortcut: a rule in a nested .gitignore does not count either.
|
|
52
52
|
*/
|
|
53
|
+
// The scratch repo's answer depends only on the user's lines, so each distinct text is asked once per process.
|
|
54
|
+
const ignoreAnswers = new Map();
|
|
55
|
+
/** Tests that reach the git-free fallback need an empty cache: an earlier answer for the same text would skip it. */
|
|
56
|
+
export function clearIgnoreCache() {
|
|
57
|
+
ignoreAnswers.clear();
|
|
58
|
+
}
|
|
53
59
|
export function missingIgnores(text) {
|
|
54
60
|
const outside = removeBlock(text);
|
|
55
61
|
const have = new Set(outside.split(/\r?\n/).map((l) => l.trim()));
|
|
@@ -57,23 +63,27 @@ export function missingIgnores(text) {
|
|
|
57
63
|
// Ask about a real file name: brain.ts writes `.cto-brain.json.<pid>.tmp`, which a user's `*.tmp` covers; a long odd pid
|
|
58
64
|
// so a rule like `*.1.tmp`, which matches one pid only, does not pass for covering them all.
|
|
59
65
|
const sample = (e) => e.replace('*', '9876543210.');
|
|
60
|
-
let out;
|
|
66
|
+
let out = ignoreAnswers.get(outside);
|
|
61
67
|
// check-ignore names only the last matching rule, which would be our block's own line, so ask a scratch repo whose
|
|
62
68
|
// .gitignore is the user's lines alone; it also honours a later `!` rule. Exit 1 means nothing matched.
|
|
63
69
|
let tmp; // an unwritable tmp dir falls back below instead of crashing setup
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
70
|
+
if (out === undefined) {
|
|
71
|
+
try {
|
|
72
|
+
tmp = mkdtempSync(join(tmpdir(), 'cto-ignore-'));
|
|
73
|
+
git(tmp, 'init', '-q');
|
|
74
|
+
writeFileSync(join(tmp, '.gitignore'), outside);
|
|
75
|
+
out = git(tmp, 'check-ignore', '--no-index', '-v', ...entries.map(sample));
|
|
76
|
+
}
|
|
77
|
+
catch (e) {
|
|
78
|
+
if (e.status === 1)
|
|
79
|
+
out = '';
|
|
80
|
+
}
|
|
81
|
+
finally {
|
|
82
|
+
if (tmp)
|
|
83
|
+
rmSync(tmp, { recursive: true, force: true });
|
|
84
|
+
}
|
|
85
|
+
if (out !== undefined)
|
|
86
|
+
ignoreAnswers.set(outside, out); // a git failure is not cached: the next call asks again
|
|
77
87
|
}
|
|
78
88
|
// git failed: fall back to exact lines.
|
|
79
89
|
if (out === undefined)
|
|
@@ -581,15 +591,18 @@ export function missingHooks(root) {
|
|
|
581
591
|
* .gitignore that excludes them (often a broad rule like .agents/skills/) silently keeps them on one machine.
|
|
582
592
|
*/
|
|
583
593
|
export function ignoredByGit(root, paths) {
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
594
|
+
if (!paths.length)
|
|
595
|
+
return [];
|
|
596
|
+
// One git call for all paths: -z keeps odd names unquoted. Exit 1 (none ignored) and any git failure both mean none.
|
|
597
|
+
let out;
|
|
598
|
+
try {
|
|
599
|
+
out = execFileSync('git', ['check-ignore', '-z', '--stdin'], { cwd: root, input: paths.join('\0'), encoding: 'utf8', stdio: ['pipe', 'pipe', 'ignore'] });
|
|
600
|
+
}
|
|
601
|
+
catch {
|
|
602
|
+
return [];
|
|
603
|
+
}
|
|
604
|
+
const ignored = new Set(out.split('\0'));
|
|
605
|
+
return paths.filter((p) => ignored.has(p));
|
|
593
606
|
}
|
|
594
607
|
/** Agents whose config in this repo currently calls cto. */
|
|
595
608
|
export function wiredAgents(root) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "your-cto-jev",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.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",
|