carrick 0.3.145 → 0.3.147

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 (101) hide show
  1. package/bin/carrick.mjs +4 -4
  2. package/dist/cli.d.ts +8 -1
  3. package/dist/cli.js +14 -2
  4. package/dist/cli.js.map +1 -1
  5. package/dist/contract.d.ts +31 -0
  6. package/dist/contract.js +29 -3
  7. package/dist/contract.js.map +1 -1
  8. package/dist/diagnostics.js +1 -9
  9. package/dist/diagnostics.js.map +1 -1
  10. package/dist/fs-util.d.ts +6 -0
  11. package/dist/fs-util.js +29 -0
  12. package/dist/fs-util.js.map +1 -0
  13. package/dist/global-install.js +1 -8
  14. package/dist/global-install.js.map +1 -1
  15. package/dist/hook/apply-patch.js +3 -4
  16. package/dist/hook/apply-patch.js.map +1 -1
  17. package/dist/hook/checked.d.ts +3 -1
  18. package/dist/hook/checked.js +9 -2
  19. package/dist/hook/checked.js.map +1 -1
  20. package/dist/hook/late.js +9 -2
  21. package/dist/hook/late.js.map +1 -1
  22. package/dist/hook/post-edit.js +33 -24
  23. package/dist/hook/post-edit.js.map +1 -1
  24. package/dist/hook/post-read.js +1 -6
  25. package/dist/hook/post-read.js.map +1 -1
  26. package/dist/hook/rechecks.d.ts +45 -1
  27. package/dist/hook/rechecks.js +116 -10
  28. package/dist/hook/rechecks.js.map +1 -1
  29. package/dist/hook/reuse.d.ts +31 -58
  30. package/dist/hook/reuse.js +48 -112
  31. package/dist/hook/reuse.js.map +1 -1
  32. package/dist/hook/session-start.d.ts +9 -0
  33. package/dist/hook/session-start.js +43 -16
  34. package/dist/hook/session-start.js.map +1 -1
  35. package/dist/hook/stdin.d.ts +2 -0
  36. package/dist/hook/stdin.js +8 -0
  37. package/dist/hook/stdin.js.map +1 -0
  38. package/dist/hook/stop-wait.d.ts +24 -1
  39. package/dist/hook/stop-wait.js +163 -28
  40. package/dist/hook/stop-wait.js.map +1 -1
  41. package/dist/hook/stop.js +17 -36
  42. package/dist/hook/stop.js.map +1 -1
  43. package/dist/hook/user-prompt.js +13 -30
  44. package/dist/hook/user-prompt.js.map +1 -1
  45. package/dist/hosted-snapshot.d.ts +37 -0
  46. package/dist/hosted-snapshot.js +49 -0
  47. package/dist/hosted-snapshot.js.map +1 -0
  48. package/dist/init/agents-section.d.ts +16 -2
  49. package/dist/init/agents-section.js +43 -7
  50. package/dist/init/agents-section.js.map +1 -1
  51. package/dist/init/codex.js +8 -7
  52. package/dist/init/codex.js.map +1 -1
  53. package/dist/init/mcp.js +1 -3
  54. package/dist/init/mcp.js.map +1 -1
  55. package/dist/init/remove.d.ts +2 -0
  56. package/dist/init/remove.js +18 -4
  57. package/dist/init/remove.js.map +1 -1
  58. package/dist/init/repo-copies.js +2 -10
  59. package/dist/init/repo-copies.js.map +1 -1
  60. package/dist/init/repos.d.ts +0 -2
  61. package/dist/init/repos.js +1 -9
  62. package/dist/init/repos.js.map +1 -1
  63. package/dist/init/run.js +14 -4
  64. package/dist/init/run.js.map +1 -1
  65. package/dist/init/self-update.d.ts +2 -2
  66. package/dist/init/self-update.js +89 -3
  67. package/dist/init/self-update.js.map +1 -1
  68. package/dist/init/settings.js +5 -7
  69. package/dist/init/settings.js.map +1 -1
  70. package/dist/native.js +1 -9
  71. package/dist/native.js.map +1 -1
  72. package/dist/render.d.ts +54 -11
  73. package/dist/render.js +188 -34
  74. package/dist/render.js.map +1 -1
  75. package/dist/root.d.ts +1 -2
  76. package/dist/root.js +1 -9
  77. package/dist/root.js.map +1 -1
  78. package/dist/surfaces.js +1 -3
  79. package/dist/surfaces.js.map +1 -1
  80. package/package.json +6 -6
  81. package/plugin/.claude-plugin/plugin.json +1 -1
  82. package/sidecar/dist/src/bundler.js +30 -28
  83. package/sidecar/dist/src/capture/service-config.d.ts +6 -0
  84. package/sidecar/dist/src/capture/service-config.js +11 -1
  85. package/sidecar/dist/src/library-claims.js +14 -0
  86. package/sidecar/dist/src/platform-body-read.d.ts +46 -0
  87. package/sidecar/dist/src/platform-body-read.js +82 -0
  88. package/sidecar/dist/src/response-modes.d.ts +5 -4
  89. package/sidecar/dist/src/response-modes.js +21 -25
  90. package/sidecar/dist/src/retype.js +11 -16
  91. package/sidecar/dist/src/stated-params.d.ts +6 -0
  92. package/sidecar/dist/src/stated-params.js +13 -0
  93. package/sidecar/dist/src/type-inferrer.d.ts +47 -14
  94. package/sidecar/dist/src/type-inferrer.js +119 -62
  95. package/sidecar/dist/src/types.d.ts +20 -3
  96. package/templates/skills/carrick-census.md +24 -3
  97. package/templates/skills/carrick-drift.md +11 -3
  98. package/templates/skills/carrick-impact.md +8 -3
  99. package/dist/hook/edited.d.ts +0 -22
  100. package/dist/hook/edited.js +0 -84
  101. package/dist/hook/edited.js.map +0 -1
@@ -1,84 +0,0 @@
1
- // What one edited file is, shared by the post-edit hook and the background
2
- // re-check runner: whether the scan reads it, which checkout it sits in, and
3
- // which functions a re-check says it newly declares.
4
- //
5
- // Split out of `post-edit.ts` because that file runs `main` on import, so
6
- // nothing else could import from it.
7
- import fs from "node:fs";
8
- import path from "node:path";
9
- /**
10
- * The files `carrick check --changed` judges: the scanner's own source
11
- * extensions (`SOURCE_EXTENSIONS` in `src/file_finder.rs`, carrick#904). An API
12
- * spec file is not counted: the hook cannot tell a spec the scan reads from any
13
- * other `.json` or `.yaml` without reading the repo, and a config file that
14
- * moves no contract is what the line used to be wrong about.
15
- */
16
- const CHECKED_EXTENSIONS = new Set([".ts", ".tsx", ".mts", ".cts", ".js", ".jsx", ".mjs", ".cjs"]);
17
- /** `TEST_FILE_INFIXES` in `src/file_finder.rs`: a test or story file name ends its stem in one. */
18
- const TEST_FILE_INFIXES = [".test", ".spec", ".stories"];
19
- /** `TEST_DIR_NAMES` in `src/file_finder.rs` (plus `.storybook`): trees the scan does not read. */
20
- const TEST_DIR_NAMES = new Set([
21
- "__tests__",
22
- "__mocks__",
23
- "__fixtures__",
24
- "tests",
25
- "test",
26
- "fixtures",
27
- "e2e",
28
- ".storybook",
29
- ]);
30
- /** Whether `carrick check --changed` would judge this edited file: source, and not a test or story. */
31
- export function isCheckedSource(file) {
32
- const extension = path.extname(file).toLowerCase();
33
- if (!CHECKED_EXTENSIONS.has(extension))
34
- return false;
35
- const stem = path.basename(file, extension).toLowerCase();
36
- if (TEST_FILE_INFIXES.some((infix) => stem.endsWith(infix)))
37
- return false;
38
- // Directory names above the file. The scanner reads them relative to the
39
- // scan root; the hook does not know it, so a checkout under a directory
40
- // named `test` hides its source here: the line is then missing, not wrong.
41
- const directories = path.dirname(file).split(/[\\/]/);
42
- return !directories.some((name) => TEST_DIR_NAMES.has(name.toLowerCase()));
43
- }
44
- /**
45
- * What the re-check said this file declares and the index does not
46
- * (carrick#1330).
47
- *
48
- * Nothing is printed about it here. This hook fires on every edit and most
49
- * edits add no function; the one line about the ones that did belongs at the
50
- * end of the task, where it costs one model turn instead of one per edit. All
51
- * this does is put the names somewhere the Stop hook can find them.
52
- */
53
- export function newFunctions(result, file) {
54
- // Test, spec and story files never warrant a reuse check (carrick#2936).
55
- if (!isCheckedSource(file))
56
- return [];
57
- return (result.recheck?.new_functions ?? []).map((entry) => ({
58
- name: entry.name,
59
- // The path this hook computed, not the one the binary echoes: it is the
60
- // checkout-relative path the index holds, whatever root the edit ran from.
61
- file,
62
- indexCommit: result.index_commit ?? "",
63
- }));
64
- }
65
- /**
66
- * `file` relative to the nearest checkout top at or below `root`: the nearest
67
- * directory holding `.git` (a folder, or the file a linked worktree has). An
68
- * edit inside a nested worktree is then keyed as the index keys it, not with
69
- * the worktree's own prefix (carrick#2936). With no nested checkout it is
70
- * relative to `root`, as before.
71
- */
72
- export function checkoutRelative(root, file) {
73
- let dir = path.dirname(file);
74
- while (dir !== root && path.relative(root, dir) && !path.relative(root, dir).startsWith("..")) {
75
- if (fs.existsSync(path.join(dir, ".git")))
76
- return path.relative(dir, file);
77
- const parent = path.dirname(dir);
78
- if (parent === dir)
79
- break;
80
- dir = parent;
81
- }
82
- return path.relative(root, file);
83
- }
84
- //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