@ironbee-ai/cli 0.8.1 → 0.8.3
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/CHANGELOG.md +12 -0
- package/README.md +6 -0
- package/dist/clients/claude/hooks/clear-verdict.d.ts.map +1 -1
- package/dist/clients/claude/hooks/clear-verdict.js +25 -4
- package/dist/clients/claude/hooks/clear-verdict.js.map +1 -1
- package/dist/clients/claude/hooks/require-verdict.d.ts.map +1 -1
- package/dist/clients/claude/hooks/require-verdict.js +21 -3
- package/dist/clients/claude/hooks/require-verdict.js.map +1 -1
- package/dist/clients/cursor/hooks/clear-verdict.d.ts.map +1 -1
- package/dist/clients/cursor/hooks/clear-verdict.js +31 -5
- package/dist/clients/cursor/hooks/clear-verdict.js.map +1 -1
- package/dist/clients/cursor/hooks/require-verdict.d.ts.map +1 -1
- package/dist/clients/cursor/hooks/require-verdict.js +24 -3
- package/dist/clients/cursor/hooks/require-verdict.js.map +1 -1
- package/dist/commands/backend-toggle.d.ts +20 -9
- package/dist/commands/backend-toggle.d.ts.map +1 -1
- package/dist/commands/backend-toggle.js +33 -26
- package/dist/commands/backend-toggle.js.map +1 -1
- package/dist/commands/config.d.ts +40 -5
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +67 -17
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/disable-backend.d.ts.map +1 -1
- package/dist/commands/disable-backend.js +6 -2
- package/dist/commands/disable-backend.js.map +1 -1
- package/dist/commands/disable-verification.d.ts.map +1 -1
- package/dist/commands/disable-verification.js +5 -2
- package/dist/commands/disable-verification.js.map +1 -1
- package/dist/commands/enable-backend.d.ts.map +1 -1
- package/dist/commands/enable-backend.js +6 -2
- package/dist/commands/enable-backend.js.map +1 -1
- package/dist/commands/enable-verification.d.ts.map +1 -1
- package/dist/commands/enable-verification.js +5 -2
- package/dist/commands/enable-verification.js.map +1 -1
- package/dist/commands/update.d.ts +23 -0
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +189 -0
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/verification-toggle.d.ts +18 -1
- package/dist/commands/verification-toggle.d.ts.map +1 -1
- package/dist/commands/verification-toggle.js +96 -21
- package/dist/commands/verification-toggle.js.map +1 -1
- package/dist/hooks/core/actions.d.ts +9 -0
- package/dist/hooks/core/actions.d.ts.map +1 -1
- package/dist/hooks/core/actions.js.map +1 -1
- package/dist/hooks/core/file-diff.d.ts +17 -0
- package/dist/hooks/core/file-diff.d.ts.map +1 -1
- package/dist/hooks/core/file-diff.js +72 -0
- package/dist/hooks/core/file-diff.js.map +1 -1
- package/dist/hooks/core/tool-use-stash.d.ts +7 -1
- package/dist/hooks/core/tool-use-stash.d.ts.map +1 -1
- package/dist/hooks/core/tool-use-stash.js.map +1 -1
- package/dist/lib/config.d.ts +87 -6
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +124 -29
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/gitignore.d.ts +26 -11
- package/dist/lib/gitignore.d.ts.map +1 -1
- package/dist/lib/gitignore.js +71 -24
- package/dist/lib/gitignore.js.map +1 -1
- package/package.json +1 -1
package/dist/lib/gitignore.js
CHANGED
|
@@ -1,34 +1,73 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Project `.gitignore` helper. Idempotently ensures
|
|
4
|
-
*
|
|
5
|
-
* state, action logs, queue files, …) don't accidentally get committed.
|
|
3
|
+
* Project `.gitignore` helper. Idempotently ensures the IronBee per-project
|
|
4
|
+
* artifacts that must NOT be committed land in `.gitignore`:
|
|
6
5
|
*
|
|
7
|
-
*
|
|
6
|
+
* - `.ironbee/sessions/` — per-session runtime artifacts (marker
|
|
7
|
+
* files, session state, action logs,
|
|
8
|
+
* queue files, …).
|
|
9
|
+
* - `.ironbee/config.local.json` — personal / per-machine config override
|
|
10
|
+
* (intentionally local-only, see
|
|
11
|
+
* `lib/config.ts` for the merge order).
|
|
12
|
+
*
|
|
13
|
+
* Called from three places:
|
|
8
14
|
* - `ironbee install` — once per project, alongside `.ironbee/` mkdir.
|
|
9
|
-
* - `ironbee import`
|
|
15
|
+
* - `ironbee import` — before writing each session marker, so import-only
|
|
10
16
|
* usage (skipping install) still leaves the gitignore in a clean state.
|
|
17
|
+
* - `ironbee config set/unset` — re-renders artifacts, including this file.
|
|
18
|
+
*
|
|
19
|
+
* Each entry is added independently — if an older `.gitignore` already
|
|
20
|
+
* contains `.ironbee/sessions/` but not the new local-config line, the
|
|
21
|
+
* helper appends only the missing entry rather than re-adding the whole
|
|
22
|
+
* block. This keeps the upgrade path quiet for users who already had
|
|
23
|
+
* `ironbee install` in place before this feature shipped.
|
|
11
24
|
*
|
|
12
|
-
* No-op when the line already
|
|
13
|
-
* exist on disk (synthetic projectDir from undecoded
|
|
14
|
-
* folder names).
|
|
25
|
+
* No-op when the line is already present, or when `projectDir` itself
|
|
26
|
+
* doesn't exist on disk (synthetic projectDir from undecoded
|
|
27
|
+
* `--all-projects` folder names).
|
|
15
28
|
*/
|
|
16
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
30
|
exports.ensureIronBeeGitignored = ensureIronBeeGitignored;
|
|
18
31
|
const fs_1 = require("fs");
|
|
19
32
|
const path_1 = require("path");
|
|
20
33
|
const logger_1 = require("./logger");
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
34
|
+
const IRONBEE_HEADER = "# IronBee runtime artifacts";
|
|
35
|
+
const IGNORE_ENTRIES = [
|
|
36
|
+
{
|
|
37
|
+
pattern: ".ironbee/sessions/",
|
|
38
|
+
lines: ["", IRONBEE_HEADER, ".ironbee/sessions/"],
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
pattern: ".ironbee/config.local.json",
|
|
42
|
+
// Standalone append — do NOT re-print the header, the sessions
|
|
43
|
+
// entry above (or whatever the user already has) is enough context.
|
|
44
|
+
lines: [".ironbee/config.local.json"],
|
|
45
|
+
},
|
|
25
46
|
];
|
|
26
|
-
/** Pattern used to detect "already ignored" — substring match on this exact line. */
|
|
27
|
-
const IGNORE_MARKER = ".ironbee/sessions/";
|
|
28
47
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
48
|
+
* True when `existing` already contains a line that matches `pattern`
|
|
49
|
+
* exactly (after stripping CR + leading whitespace). Comments and
|
|
50
|
+
* negations don't count as matches — they're either explanatory or
|
|
51
|
+
* deliberately UNDOing our rule.
|
|
52
|
+
*/
|
|
53
|
+
function gitignoreContainsLine(existing, pattern) {
|
|
54
|
+
for (const rawLine of existing.split("\n")) {
|
|
55
|
+
const line = rawLine.replace(/\r$/, "").trim();
|
|
56
|
+
if (line.length === 0 || line.startsWith("#") || line.startsWith("!")) {
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
if (line === pattern) {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Append all IronBee gitignore entries to `<projectDir>/.gitignore`,
|
|
67
|
+
* creating the file if needed. Each entry is added independently —
|
|
68
|
+
* partial state (sessions/ already there, config.local.json missing) is
|
|
69
|
+
* resolved by appending only the missing entries. No-op for entries that
|
|
70
|
+
* already match line-exact.
|
|
32
71
|
*/
|
|
33
72
|
function ensureIronBeeGitignored(projectDir) {
|
|
34
73
|
if (!(0, fs_1.existsSync)(projectDir)) {
|
|
@@ -37,15 +76,23 @@ function ensureIronBeeGitignored(projectDir) {
|
|
|
37
76
|
}
|
|
38
77
|
const gitignorePath = (0, path_1.join)(projectDir, ".gitignore");
|
|
39
78
|
try {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
79
|
+
let existing = (0, fs_1.existsSync)(gitignorePath) ? (0, fs_1.readFileSync)(gitignorePath, "utf-8") : "";
|
|
80
|
+
let mutated = false;
|
|
81
|
+
for (const entry of IGNORE_ENTRIES) {
|
|
82
|
+
if (gitignoreContainsLine(existing, entry.pattern)) {
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
// Ensure a single trailing newline before our block so we don't
|
|
86
|
+
// glom onto whatever the last user-written line was.
|
|
87
|
+
if (existing.length > 0 && !existing.endsWith("\n")) {
|
|
88
|
+
existing += "\n";
|
|
89
|
+
}
|
|
90
|
+
existing += entry.lines.join("\n") + "\n";
|
|
91
|
+
mutated = true;
|
|
43
92
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return;
|
|
93
|
+
if (mutated) {
|
|
94
|
+
(0, fs_1.writeFileSync)(gitignorePath, existing);
|
|
47
95
|
}
|
|
48
|
-
(0, fs_1.writeFileSync)(gitignorePath, existing + IGNORE_BLOCK.join("\n") + "\n");
|
|
49
96
|
}
|
|
50
97
|
catch (e) {
|
|
51
98
|
logger_1.logger.debug(`gitignore: write ${gitignorePath} failed: ${e instanceof Error ? e.message : e}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitignore.js","sourceRoot":"","sources":["../../src/lib/gitignore.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"gitignore.js","sourceRoot":"","sources":["../../src/lib/gitignore.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;;AAiEH,0DA2BC;AA1FD,2BAA6D;AAC7D,+BAA4B;AAC5B,qCAAkC;AAoBlC,MAAM,cAAc,GAAW,6BAA6B,CAAC;AAE7D,MAAM,cAAc,GAAkB;IAClC;QACI,OAAO,EAAE,oBAAoB;QAC7B,KAAK,EAAE,CAAC,EAAE,EAAE,cAAc,EAAE,oBAAoB,CAAC;KACpD;IACD;QACI,OAAO,EAAE,4BAA4B;QACrC,+DAA+D;QAC/D,oEAAoE;QACpE,KAAK,EAAE,CAAC,4BAA4B,CAAC;KACxC;CACJ,CAAC;AAEF;;;;;GAKG;AACH,SAAS,qBAAqB,CAAC,QAAgB,EAAE,OAAe;IAC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