@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.
Files changed (61) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +6 -0
  3. package/dist/clients/claude/hooks/clear-verdict.d.ts.map +1 -1
  4. package/dist/clients/claude/hooks/clear-verdict.js +25 -4
  5. package/dist/clients/claude/hooks/clear-verdict.js.map +1 -1
  6. package/dist/clients/claude/hooks/require-verdict.d.ts.map +1 -1
  7. package/dist/clients/claude/hooks/require-verdict.js +21 -3
  8. package/dist/clients/claude/hooks/require-verdict.js.map +1 -1
  9. package/dist/clients/cursor/hooks/clear-verdict.d.ts.map +1 -1
  10. package/dist/clients/cursor/hooks/clear-verdict.js +31 -5
  11. package/dist/clients/cursor/hooks/clear-verdict.js.map +1 -1
  12. package/dist/clients/cursor/hooks/require-verdict.d.ts.map +1 -1
  13. package/dist/clients/cursor/hooks/require-verdict.js +24 -3
  14. package/dist/clients/cursor/hooks/require-verdict.js.map +1 -1
  15. package/dist/commands/backend-toggle.d.ts +20 -9
  16. package/dist/commands/backend-toggle.d.ts.map +1 -1
  17. package/dist/commands/backend-toggle.js +33 -26
  18. package/dist/commands/backend-toggle.js.map +1 -1
  19. package/dist/commands/config.d.ts +40 -5
  20. package/dist/commands/config.d.ts.map +1 -1
  21. package/dist/commands/config.js +67 -17
  22. package/dist/commands/config.js.map +1 -1
  23. package/dist/commands/disable-backend.d.ts.map +1 -1
  24. package/dist/commands/disable-backend.js +6 -2
  25. package/dist/commands/disable-backend.js.map +1 -1
  26. package/dist/commands/disable-verification.d.ts.map +1 -1
  27. package/dist/commands/disable-verification.js +5 -2
  28. package/dist/commands/disable-verification.js.map +1 -1
  29. package/dist/commands/enable-backend.d.ts.map +1 -1
  30. package/dist/commands/enable-backend.js +6 -2
  31. package/dist/commands/enable-backend.js.map +1 -1
  32. package/dist/commands/enable-verification.d.ts.map +1 -1
  33. package/dist/commands/enable-verification.js +5 -2
  34. package/dist/commands/enable-verification.js.map +1 -1
  35. package/dist/commands/update.d.ts +23 -0
  36. package/dist/commands/update.d.ts.map +1 -1
  37. package/dist/commands/update.js +189 -0
  38. package/dist/commands/update.js.map +1 -1
  39. package/dist/commands/verification-toggle.d.ts +18 -1
  40. package/dist/commands/verification-toggle.d.ts.map +1 -1
  41. package/dist/commands/verification-toggle.js +96 -21
  42. package/dist/commands/verification-toggle.js.map +1 -1
  43. package/dist/hooks/core/actions.d.ts +9 -0
  44. package/dist/hooks/core/actions.d.ts.map +1 -1
  45. package/dist/hooks/core/actions.js.map +1 -1
  46. package/dist/hooks/core/file-diff.d.ts +17 -0
  47. package/dist/hooks/core/file-diff.d.ts.map +1 -1
  48. package/dist/hooks/core/file-diff.js +72 -0
  49. package/dist/hooks/core/file-diff.js.map +1 -1
  50. package/dist/hooks/core/tool-use-stash.d.ts +7 -1
  51. package/dist/hooks/core/tool-use-stash.d.ts.map +1 -1
  52. package/dist/hooks/core/tool-use-stash.js.map +1 -1
  53. package/dist/lib/config.d.ts +87 -6
  54. package/dist/lib/config.d.ts.map +1 -1
  55. package/dist/lib/config.js +124 -29
  56. package/dist/lib/config.js.map +1 -1
  57. package/dist/lib/gitignore.d.ts +26 -11
  58. package/dist/lib/gitignore.d.ts.map +1 -1
  59. package/dist/lib/gitignore.js +71 -24
  60. package/dist/lib/gitignore.js.map +1 -1
  61. package/package.json +1 -1
@@ -1,34 +1,73 @@
1
1
  "use strict";
2
2
  /**
3
- * Project `.gitignore` helper. Idempotently ensures `.ironbee/sessions/`
4
- * is gitignored so per-session runtime artifacts (marker files, session
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
- * Called from two places:
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` — before writing each session marker, so import-only
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 exists, or when `projectDir` itself doesn't
13
- * exist on disk (synthetic projectDir from undecoded `--all-projects`
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 IGNORE_BLOCK = [
22
- "",
23
- "# IronBee runtime artifacts",
24
- ".ironbee/sessions/",
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
- * Append `.ironbee/sessions/` to `<projectDir>/.gitignore`, creating the
30
- * file if needed. No-op when the line is already present or when
31
- * `projectDir` doesn't exist.
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
- if (!(0, fs_1.existsSync)(gitignorePath)) {
41
- (0, fs_1.writeFileSync)(gitignorePath, IGNORE_BLOCK.join("\n") + "\n");
42
- return;
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
- const existing = (0, fs_1.readFileSync)(gitignorePath, "utf-8");
45
- if (existing.includes(IGNORE_MARKER)) {
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;;;;;;;;;;;;;GAaG;;AAoBH,0DAmBC;AArCD,2BAA6D;AAC7D,+BAA4B;AAC5B,qCAAkC;AAElC,MAAM,YAAY,GAAa;IAC3B,EAAE;IACF,6BAA6B;IAC7B,oBAAoB;CACvB,CAAC;AAEF,qFAAqF;AACrF,MAAM,aAAa,GAAW,oBAAoB,CAAC;AAEnD;;;;GAIG;AACH,SAAgB,uBAAuB,CAAC,UAAkB;IACtD,IAAI,CAAC,IAAA,eAAU,EAAC,UAAU,CAAC,EAAE,CAAC;QAC1B,eAAM,CAAC,KAAK,CAAC,yBAAyB,UAAU,4BAA4B,CAAC,CAAC;QAC9E,OAAO;IACX,CAAC;IACD,MAAM,aAAa,GAAW,IAAA,WAAI,EAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IAC7D,IAAI,CAAC;QACD,IAAI,CAAC,IAAA,eAAU,EAAC,aAAa,CAAC,EAAE,CAAC;YAC7B,IAAA,kBAAa,EAAC,aAAa,EAAE,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;YAC7D,OAAO;QACX,CAAC;QACD,MAAM,QAAQ,GAAW,IAAA,iBAAY,EAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QAC9D,IAAI,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;YACnC,OAAO;QACX,CAAC;QACD,IAAA,kBAAa,EAAC,aAAa,EAAE,QAAQ,GAAG,YAAY,CAAC,IAAI,CAAC,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;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ironbee-ai/cli",
3
- "version": "0.8.1",
3
+ "version": "0.8.3",
4
4
  "description": "The CLI for IronBee — Verification and Intelligence Layer for Agentic Development",
5
5
  "main": "dist/index.js",
6
6
  "bin": {