ctxr-cli 0.8.0 → 0.10.0

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 (250) hide show
  1. package/README.md +313 -22
  2. package/dist/adapters/types.d.ts +0 -5
  3. package/dist/adapters/types.d.ts.map +1 -1
  4. package/dist/commands/adapters-generate.d.ts.map +1 -1
  5. package/dist/commands/adapters-generate.js +2 -3
  6. package/dist/commands/adapters-generate.js.map +1 -1
  7. package/dist/commands/context-gather.d.ts +22 -0
  8. package/dist/commands/context-gather.d.ts.map +1 -0
  9. package/dist/commands/context-gather.js +36 -0
  10. package/dist/commands/context-gather.js.map +1 -0
  11. package/dist/commands/graph-query.d.ts.map +1 -1
  12. package/dist/commands/graph-query.js +6 -8
  13. package/dist/commands/graph-query.js.map +1 -1
  14. package/dist/commands/ingest.d.ts +22 -9
  15. package/dist/commands/ingest.d.ts.map +1 -1
  16. package/dist/commands/ingest.js +86 -24
  17. package/dist/commands/ingest.js.map +1 -1
  18. package/dist/commands/init.d.ts.map +1 -1
  19. package/dist/commands/init.js +22 -5
  20. package/dist/commands/init.js.map +1 -1
  21. package/dist/commands/publish-check.d.ts.map +1 -1
  22. package/dist/commands/publish-check.js +8 -0
  23. package/dist/commands/publish-check.js.map +1 -1
  24. package/dist/commands/publish-new.d.ts.map +1 -1
  25. package/dist/commands/publish-new.js +15 -0
  26. package/dist/commands/publish-new.js.map +1 -1
  27. package/dist/commands/serve.d.ts.map +1 -1
  28. package/dist/commands/serve.js +33 -11
  29. package/dist/commands/serve.js.map +1 -1
  30. package/dist/commands/session-start.d.ts.map +1 -1
  31. package/dist/commands/session-start.js +9 -1
  32. package/dist/commands/session-start.js.map +1 -1
  33. package/dist/commands/source-check.d.ts.map +1 -1
  34. package/dist/commands/source-check.js +52 -9
  35. package/dist/commands/source-check.js.map +1 -1
  36. package/dist/commands/source-stamp.d.ts +6 -5
  37. package/dist/commands/source-stamp.d.ts.map +1 -1
  38. package/dist/commands/source-stamp.js +8 -7
  39. package/dist/commands/source-stamp.js.map +1 -1
  40. package/dist/commands/update.d.ts.map +1 -1
  41. package/dist/commands/update.js +7 -1
  42. package/dist/commands/update.js.map +1 -1
  43. package/dist/commands/verify.d.ts +11 -2
  44. package/dist/commands/verify.d.ts.map +1 -1
  45. package/dist/commands/verify.js +86 -5
  46. package/dist/commands/verify.js.map +1 -1
  47. package/dist/commands/version.d.ts +31 -0
  48. package/dist/commands/version.d.ts.map +1 -0
  49. package/dist/commands/version.js +87 -0
  50. package/dist/commands/version.js.map +1 -0
  51. package/dist/config/defaults.d.ts +113 -4
  52. package/dist/config/defaults.d.ts.map +1 -1
  53. package/dist/config/defaults.js +83 -4
  54. package/dist/config/defaults.js.map +1 -1
  55. package/dist/config/load.d.ts +2 -2
  56. package/dist/config/load.d.ts.map +1 -1
  57. package/dist/config/load.js +13 -3
  58. package/dist/config/load.js.map +1 -1
  59. package/dist/config/render.d.ts +5 -0
  60. package/dist/config/render.d.ts.map +1 -1
  61. package/dist/config/render.js +62 -3
  62. package/dist/config/render.js.map +1 -1
  63. package/dist/config/schema.d.ts +47 -76
  64. package/dist/config/schema.d.ts.map +1 -1
  65. package/dist/config/schema.js +171 -134
  66. package/dist/config/schema.js.map +1 -1
  67. package/dist/core/agents-doc.d.ts.map +1 -1
  68. package/dist/core/agents-doc.js +4 -1
  69. package/dist/core/agents-doc.js.map +1 -1
  70. package/dist/core/browse/nav.d.ts.map +1 -1
  71. package/dist/core/browse/nav.js +4 -1
  72. package/dist/core/browse/nav.js.map +1 -1
  73. package/dist/core/browse/preferences.d.ts +26 -0
  74. package/dist/core/browse/preferences.d.ts.map +1 -0
  75. package/dist/core/browse/preferences.js +74 -0
  76. package/dist/core/browse/preferences.js.map +1 -0
  77. package/dist/core/browse/routes.d.ts +10 -8
  78. package/dist/core/browse/routes.d.ts.map +1 -1
  79. package/dist/core/browse/routes.js +113 -24
  80. package/dist/core/browse/routes.js.map +1 -1
  81. package/dist/core/browse/templates.d.ts +14 -4
  82. package/dist/core/browse/templates.d.ts.map +1 -1
  83. package/dist/core/browse/templates.js +22 -4
  84. package/dist/core/browse/templates.js.map +1 -1
  85. package/dist/core/checks/harness-portability-checks.d.ts +22 -1
  86. package/dist/core/checks/harness-portability-checks.d.ts.map +1 -1
  87. package/dist/core/checks/harness-portability-checks.js +48 -4
  88. package/dist/core/checks/harness-portability-checks.js.map +1 -1
  89. package/dist/core/checks/integrity-checks.d.ts +0 -2
  90. package/dist/core/checks/integrity-checks.d.ts.map +1 -1
  91. package/dist/core/checks/integrity-checks.js +2 -27
  92. package/dist/core/checks/integrity-checks.js.map +1 -1
  93. package/dist/core/checks/manifest.d.ts.map +1 -1
  94. package/dist/core/checks/manifest.js +2 -0
  95. package/dist/core/checks/manifest.js.map +1 -1
  96. package/dist/core/checks/organize-checks.d.ts +11 -1
  97. package/dist/core/checks/organize-checks.d.ts.map +1 -1
  98. package/dist/core/checks/organize-checks.js +42 -12
  99. package/dist/core/checks/organize-checks.js.map +1 -1
  100. package/dist/core/checks/retrieval-checks.d.ts +9 -0
  101. package/dist/core/checks/retrieval-checks.d.ts.map +1 -0
  102. package/dist/core/checks/retrieval-checks.js +30 -0
  103. package/dist/core/checks/retrieval-checks.js.map +1 -0
  104. package/dist/core/command.d.ts +6 -0
  105. package/dist/core/command.d.ts.map +1 -1
  106. package/dist/core/content/canonicalize.d.ts +10 -0
  107. package/dist/core/content/canonicalize.d.ts.map +1 -1
  108. package/dist/core/content/canonicalize.js +12 -0
  109. package/dist/core/content/canonicalize.js.map +1 -1
  110. package/dist/core/env.d.ts +5 -0
  111. package/dist/core/env.d.ts.map +1 -1
  112. package/dist/core/env.js +3 -0
  113. package/dist/core/env.js.map +1 -1
  114. package/dist/core/environment/probe.d.ts +12 -0
  115. package/dist/core/environment/probe.d.ts.map +1 -0
  116. package/dist/core/environment/probe.js +36 -0
  117. package/dist/core/environment/probe.js.map +1 -0
  118. package/dist/core/errors.d.ts +32 -0
  119. package/dist/core/errors.d.ts.map +1 -1
  120. package/dist/core/errors.js +81 -3
  121. package/dist/core/errors.js.map +1 -1
  122. package/dist/core/fs/prefix.d.ts +13 -0
  123. package/dist/core/fs/prefix.d.ts.map +1 -0
  124. package/dist/core/fs/prefix.js +22 -0
  125. package/dist/core/fs/prefix.js.map +1 -0
  126. package/dist/core/git/worktree.d.ts +22 -0
  127. package/dist/core/git/worktree.d.ts.map +1 -1
  128. package/dist/core/git/worktree.js +34 -0
  129. package/dist/core/git/worktree.js.map +1 -1
  130. package/dist/core/graph/persist.d.ts +13 -0
  131. package/dist/core/graph/persist.d.ts.map +1 -1
  132. package/dist/core/graph/persist.js +24 -0
  133. package/dist/core/graph/persist.js.map +1 -1
  134. package/dist/core/harness/isolated-run.d.ts +52 -0
  135. package/dist/core/harness/isolated-run.d.ts.map +1 -0
  136. package/dist/core/harness/isolated-run.js +100 -0
  137. package/dist/core/harness/isolated-run.js.map +1 -0
  138. package/dist/core/hooks.d.ts +3 -12
  139. package/dist/core/hooks.d.ts.map +1 -1
  140. package/dist/core/hooks.js +24 -20
  141. package/dist/core/hooks.js.map +1 -1
  142. package/dist/core/ingest/capture-hash.d.ts +16 -0
  143. package/dist/core/ingest/capture-hash.d.ts.map +1 -0
  144. package/dist/core/ingest/capture-hash.js +34 -0
  145. package/dist/core/ingest/capture-hash.js.map +1 -0
  146. package/dist/core/ingest/identity.d.ts +7 -1
  147. package/dist/core/ingest/identity.d.ts.map +1 -1
  148. package/dist/core/ingest/identity.js +16 -1
  149. package/dist/core/ingest/identity.js.map +1 -1
  150. package/dist/core/ingest/model.d.ts +17 -2
  151. package/dist/core/ingest/model.d.ts.map +1 -1
  152. package/dist/core/ingest/model.js +5 -0
  153. package/dist/core/ingest/model.js.map +1 -1
  154. package/dist/core/install-kind.d.ts +25 -0
  155. package/dist/core/install-kind.d.ts.map +1 -0
  156. package/dist/core/install-kind.js +56 -0
  157. package/dist/core/install-kind.js.map +1 -0
  158. package/dist/core/notes/list.d.ts +20 -0
  159. package/dist/core/notes/list.d.ts.map +1 -1
  160. package/dist/core/notes/list.js +27 -6
  161. package/dist/core/notes/list.js.map +1 -1
  162. package/dist/core/publish/script-check.d.ts +5 -2
  163. package/dist/core/publish/script-check.d.ts.map +1 -1
  164. package/dist/core/publish/script-check.js +5 -2
  165. package/dist/core/publish/script-check.js.map +1 -1
  166. package/dist/core/records.d.ts +7 -0
  167. package/dist/core/records.d.ts.map +1 -1
  168. package/dist/core/records.js +12 -2
  169. package/dist/core/records.js.map +1 -1
  170. package/dist/core/registry.d.ts +40 -0
  171. package/dist/core/registry.d.ts.map +1 -0
  172. package/dist/core/registry.js +55 -0
  173. package/dist/core/registry.js.map +1 -0
  174. package/dist/core/retrieval/pass.d.ts +66 -0
  175. package/dist/core/retrieval/pass.d.ts.map +1 -0
  176. package/dist/core/retrieval/pass.js +171 -0
  177. package/dist/core/retrieval/pass.js.map +1 -0
  178. package/dist/core/root.d.ts +11 -5
  179. package/dist/core/root.d.ts.map +1 -1
  180. package/dist/core/root.js +20 -8
  181. package/dist/core/root.js.map +1 -1
  182. package/dist/core/skills.d.ts.map +1 -1
  183. package/dist/core/skills.js +7 -0
  184. package/dist/core/skills.js.map +1 -1
  185. package/dist/core/version-check.d.ts +63 -0
  186. package/dist/core/version-check.d.ts.map +1 -0
  187. package/dist/core/version-check.js +181 -0
  188. package/dist/core/version-check.js.map +1 -0
  189. package/dist/core/write-lifecycle/path-gate.d.ts +2 -2
  190. package/dist/core/write-lifecycle/path-gate.d.ts.map +1 -1
  191. package/dist/core/write-lifecycle/path-gate.js +9 -10
  192. package/dist/core/write-lifecycle/path-gate.js.map +1 -1
  193. package/dist/run.d.ts +1 -6
  194. package/dist/run.d.ts.map +1 -1
  195. package/dist/run.js +76 -19
  196. package/dist/run.js.map +1 -1
  197. package/dist/version.d.ts +8 -1
  198. package/dist/version.d.ts.map +1 -1
  199. package/dist/version.js +8 -1
  200. package/dist/version.js.map +1 -1
  201. package/package.json +12 -4
  202. package/templates/agents/canonical.md +1 -1
  203. package/templates/agents/capture-and-ingest.md +27 -8
  204. package/templates/agents/retrieval-leg-routing.md +34 -8
  205. package/templates/hooks/_resolve-ctxr.sh +37 -0
  206. package/templates/hooks/claude-code-write-gate.sh +34 -6
  207. package/templates/hooks/pre-commit.sh +15 -8
  208. package/templates/serve/shell.html +16 -2
  209. package/templates/serve/style.css +145 -3
  210. package/templates/skills/ctxr-connection-finding.md +7 -5
  211. package/templates/skills/ctxr-ingest-orchestration.md +15 -9
  212. package/templates/skills/ctxr-publish.md +7 -8
  213. package/templates/skills/ctxr-session-lifecycle.md +20 -0
  214. package/templates/skills/ctxr-upgrade.md +44 -0
  215. package/dist/commands/migrate.d.ts +0 -30
  216. package/dist/commands/migrate.d.ts.map +0 -1
  217. package/dist/commands/migrate.js +0 -56
  218. package/dist/commands/migrate.js.map +0 -1
  219. package/dist/core/migrations/add-explanation-craft-skill.d.ts +0 -26
  220. package/dist/core/migrations/add-explanation-craft-skill.d.ts.map +0 -1
  221. package/dist/core/migrations/add-explanation-craft-skill.js +0 -94
  222. package/dist/core/migrations/add-explanation-craft-skill.js.map +0 -1
  223. package/dist/core/migrations/archive-destination-from-taxonomy.d.ts +0 -35
  224. package/dist/core/migrations/archive-destination-from-taxonomy.d.ts.map +0 -1
  225. package/dist/core/migrations/archive-destination-from-taxonomy.js +0 -109
  226. package/dist/core/migrations/archive-destination-from-taxonomy.js.map +0 -1
  227. package/dist/core/migrations/drop-access-axes.d.ts +0 -24
  228. package/dist/core/migrations/drop-access-axes.d.ts.map +0 -1
  229. package/dist/core/migrations/drop-access-axes.js +0 -54
  230. package/dist/core/migrations/drop-access-axes.js.map +0 -1
  231. package/dist/core/migrations/drop-forge-and-workspaces-external.d.ts +0 -19
  232. package/dist/core/migrations/drop-forge-and-workspaces-external.d.ts.map +0 -1
  233. package/dist/core/migrations/drop-forge-and-workspaces-external.js +0 -49
  234. package/dist/core/migrations/drop-forge-and-workspaces-external.js.map +0 -1
  235. package/dist/core/migrations/registry.d.ts +0 -16
  236. package/dist/core/migrations/registry.d.ts.map +0 -1
  237. package/dist/core/migrations/registry.js +0 -30
  238. package/dist/core/migrations/registry.js.map +0 -1
  239. package/dist/core/migrations/rename-conventions-path.d.ts +0 -26
  240. package/dist/core/migrations/rename-conventions-path.d.ts.map +0 -1
  241. package/dist/core/migrations/rename-conventions-path.js +0 -86
  242. package/dist/core/migrations/rename-conventions-path.js.map +0 -1
  243. package/dist/core/migrations/rename-procedures-path.d.ts +0 -17
  244. package/dist/core/migrations/rename-procedures-path.d.ts.map +0 -1
  245. package/dist/core/migrations/rename-procedures-path.js +0 -45
  246. package/dist/core/migrations/rename-procedures-path.js.map +0 -1
  247. package/dist/core/migrations/types.d.ts +0 -27
  248. package/dist/core/migrations/types.d.ts.map +0 -1
  249. package/dist/core/migrations/types.js +0 -2
  250. package/dist/core/migrations/types.js.map +0 -1
@@ -2,29 +2,35 @@ import { chmod, mkdir, readFile } from 'node:fs/promises';
2
2
  import path from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
4
  import { writeFileAtomic } from './fs/atomic.js';
5
- /**
6
- * Absolute path to THIS installation's built CLI entrypoint, baked into the
7
- * generated hooks so they invoke the exact contexture that installed them —
8
- * sidestepping the global/local/npx distribution question entirely. If this
9
- * install is later replaced, `doctor`'s self-heal (below) regenerates the
10
- * hook with the new path.
11
- */
12
- export function resolveOwnBinPath() {
13
- return fileURLToPath(new URL('../bin.js', import.meta.url));
14
- }
15
5
  function templatesDir() {
16
6
  return fileURLToPath(new URL('../../templates/hooks', import.meta.url));
17
7
  }
8
+ const RESOLVE_PARTIAL_FILE = '_resolve-ctxr.sh';
9
+ const RESOLVE_TOKEN = '__RESOLVE_CTXR__';
10
+ /**
11
+ * One render path for every shipped hook script. Splices in the shared
12
+ * ctxr-resolution partial first — the resolution ladder is a security
13
+ * decision that must be identical in every hook, so it is authored once
14
+ * (templates/hooks/_resolve-ctxr.sh) and inlined here, never copied into
15
+ * each template — then applies the caller's own literal substitutions. The
16
+ * partial's own trailing newline is dropped so the token's line ending is
17
+ * the only one in the rendered file.
18
+ */
19
+ async function renderTemplate(templateFileName, substitutions = {}) {
20
+ let text = await readFile(path.join(templatesDir(), templateFileName), 'utf8');
21
+ if (text.includes(RESOLVE_TOKEN)) {
22
+ const partial = await readFile(path.join(templatesDir(), RESOLVE_PARTIAL_FILE), 'utf8');
23
+ text = text.replaceAll(RESOLVE_TOKEN, partial.replace(/\n$/, ''));
24
+ }
25
+ return Object.entries(substitutions).reduce((acc, [k, v]) => acc.replaceAll(k, v), text);
26
+ }
18
27
  const HOOKS_DIR_NAME = '.githooks';
19
28
  const HOOK_SPECS = [
20
29
  { fileName: 'pre-commit', templateFileName: 'pre-commit.sh' },
21
30
  { fileName: 'pre-push', templateFileName: 'pre-push.sh' },
22
31
  ];
23
32
  async function renderHook(spec, defaultBranch) {
24
- const templateText = await readFile(path.join(templatesDir(), spec.templateFileName), 'utf8');
25
- return templateText
26
- .replaceAll('__CONTEXTURE_BIN__', resolveOwnBinPath())
27
- .replaceAll('__DEFAULT_BRANCH__', defaultBranch);
33
+ return renderTemplate(spec.templateFileName, { __DEFAULT_BRANCH__: defaultBranch });
28
34
  }
29
35
  /**
30
36
  * The idempotent render+chmod discipline every generated executable script
@@ -69,13 +75,11 @@ export async function installHooks(root, defaultBranch) {
69
75
  /**
70
76
  * A harness adapter's own generated hook script (e.g. Claude Code's
71
77
  * PreToolUse write-gate) — same idempotent render+chmod discipline as git
72
- * hooks, without assuming git-hook-specific substitutions or the
73
- * `.githooks` directory. `substitutions` are applied as literal
74
- * find-and-replace, the same convention `renderHook` uses.
78
+ * hooks, without assuming the `.githooks` directory. Shares `renderTemplate`
79
+ * with `renderHook`, so it gets the same `__RESOLVE_CTXR__` inlining.
75
80
  */
76
- export async function installTemplatedHookScript(root, relativeTargetPath, templateFileName, substitutions) {
77
- const templateText = await readFile(path.join(templatesDir(), templateFileName), 'utf8');
78
- const rendered = Object.entries(substitutions).reduce((text, [k, v]) => text.replaceAll(k, v), templateText);
81
+ export async function installTemplatedHookScript(root, relativeTargetPath, templateFileName) {
82
+ const rendered = await renderTemplate(templateFileName);
79
83
  const targetPath = path.join(root, relativeTargetPath);
80
84
  const changed = await writeRenderedScript(targetPath, rendered);
81
85
  return { changed };
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../src/core/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGjD;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO,aAAa,CAAC,IAAI,GAAG,CAAC,WAAW,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC9D,CAAC;AAED,SAAS,YAAY;IACnB,OAAO,aAAa,CAAC,IAAI,GAAG,CAAC,uBAAuB,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC1E,CAAC;AAED,MAAM,cAAc,GAAG,WAAW,CAAC;AAOnC,MAAM,UAAU,GAAwB;IACtC,EAAE,QAAQ,EAAE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE;IAC7D,EAAE,QAAQ,EAAE,UAAU,EAAE,gBAAgB,EAAE,aAAa,EAAE;CAC1D,CAAC;AAEF,KAAK,UAAU,UAAU,CAAC,IAAc,EAAE,aAAqB;IAC7D,MAAM,YAAY,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,IAAI,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC,CAAC;IAC9F,OAAO,YAAY;SAChB,UAAU,CAAC,oBAAoB,EAAE,iBAAiB,EAAE,CAAC;SACrD,UAAU,CAAC,o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,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;QACvD,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QAClE,IAAI,QAA4B,CAAC;QACjC,IAAI,CAAC;YACH,QAAQ,GAAG,MAAM,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QAChD,CAAC;QAAC,MAAM,CAAC;YACP,QAAQ,GAAG,SAAS,CAAC;QACvB,CAAC;QACD,IAAI,QAAQ,KAAK,QAAQ;YAAE,KAAK,CAAC,IAAI,CAAC,GAAG,cAAc,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC9E,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,16 @@
1
+ export interface CaptureHash {
2
+ hash: string;
3
+ /** The file the hash was actually taken over — the sidecar's subject when there is one, otherwise the capture itself. */
4
+ hashedPath: string;
5
+ }
6
+ /**
7
+ * context-ingest spec: one place that answers "what is this capture's content
8
+ * hash", so `source check` and `ingest` can never disagree about it.
9
+ *
10
+ * A markdown capture hashes its own canonicalized body. A capture that is not
11
+ * markdown cannot carry frontmatter, so it is represented by a sidecar naming
12
+ * it, and the hash is taken over the named file's bytes — the sidecar's own
13
+ * prose is a description of the capture, not the capture.
14
+ */
15
+ export declare function hashOfCapture(storeRoot: string, relativePath: string): Promise<CaptureHash>;
16
+ //# sourceMappingURL=capture-hash.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capture-hash.d.ts","sourceRoot":"","sources":["../../../src/core/ingest/capture-hash.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,yHAAyH;IACzH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAgBjG"}
@@ -0,0 +1,34 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import { contentHash, contentHashOfBytes } from '../content/canonicalize.js';
4
+ import { CaptureFileMissingError } from '../errors.js';
5
+ import { parseNoteText } from '../notes/parse.js';
6
+ import { CAPTURE_FILE_FIELD } from './identity.js';
7
+ /**
8
+ * context-ingest spec: one place that answers "what is this capture's content
9
+ * hash", so `source check` and `ingest` can never disagree about it.
10
+ *
11
+ * A markdown capture hashes its own canonicalized body. A capture that is not
12
+ * markdown cannot carry frontmatter, so it is represented by a sidecar naming
13
+ * it, and the hash is taken over the named file's bytes — the sidecar's own
14
+ * prose is a description of the capture, not the capture.
15
+ */
16
+ export async function hashOfCapture(storeRoot, relativePath) {
17
+ const raw = await readFile(path.join(storeRoot, relativePath), 'utf8');
18
+ const captureFile = parseNoteText(raw, relativePath).frontmatter?.[CAPTURE_FILE_FIELD];
19
+ if (typeof captureFile !== 'string' || captureFile === '') {
20
+ return { hash: contentHash(raw, relativePath), hashedPath: relativePath };
21
+ }
22
+ const subjectPath = path.posix.join(path.posix.dirname(relativePath), captureFile);
23
+ let bytes;
24
+ try {
25
+ bytes = await readFile(path.join(storeRoot, subjectPath));
26
+ }
27
+ catch (err) {
28
+ if (err.code === 'ENOENT')
29
+ throw new CaptureFileMissingError(relativePath, subjectPath);
30
+ throw err;
31
+ }
32
+ return { hash: contentHashOfBytes(bytes), hashedPath: subjectPath };
33
+ }
34
+ //# sourceMappingURL=capture-hash.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capture-hash.js","sourceRoot":"","sources":["../../../src/core/ingest/capture-hash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,4BAA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 @@ export declare const SOURCE_HASH_FIELD = "source_hash";
12
12
  export declare const INGESTED_FIELD = "ingested";
13
13
  /** store-primitives-from-migration-audit spec (D2): alternative source identities `source add-alt` appends — a later check against any of them reports `duplicate`. */
14
14
  export declare const SOURCE_ALT_IDS_FIELD = "source_alt_ids";
15
- /** Whether a note already carries any source-identity field — a re-ingest guard, and capture's own invariant. */
15
+ /** retain-captures-as-provenance: the capture paths a note was synthesized from — a list, because a note may cite many. */
16
+ export declare const SOURCES_FIELD = "sources";
17
+ /** retain-captures-as-provenance: on a sidecar, the non-markdown capture beside it whose bytes the hash is taken over. */
18
+ export declare const CAPTURE_FILE_FIELD = "capture_file";
19
+ /** Whether a record carries any source-identity field at all — what makes it a dedupe record. */
16
20
  export declare function hasSourceIdentity(note: Pick<Note, 'frontmatter'>): boolean;
21
+ /** Whether ingest has already run against this capture — the re-ingest guard. */
22
+ export declare function hasAssignedIdentity(note: Pick<Note, 'frontmatter'>): boolean;
17
23
  //# sourceMappingURL=identity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../src/core/ingest/identity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,gBAAgB,CAAC;AAC/C,eAAO,MAAM,eAAe,cAAc,CAAC;AAC3C,eAAO,MAAM,iBAAiB,gBAAgB,CAAC;AAC/C,eAAO,MAAM,cAAc,aAAa,CAAC;AACzC,uKAAuK;AACvK,eAAO,MAAM,oBAAoB,mBAAmB,CAAC;AAIrD,iHAAiH;AACjH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,GAAG,OAAO,CAE1E"}
1
+ {"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../src/core/ingest/identity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,gBAAgB,CAAC;AAC/C,eAAO,MAAM,eAAe,cAAc,CAAC;AAC3C,eAAO,MAAM,iBAAiB,gBAAgB,CAAC;AAC/C,eAAO,MAAM,cAAc,aAAa,CAAC;AACzC,uKAAuK;AACvK,eAAO,MAAM,oBAAoB,mBAAmB,CAAC;AACrD,2HAA2H;AAC3H,eAAO,MAAM,aAAa,YAAY,CAAC;AACvC,0HAA0H;AAC1H,eAAO,MAAM,kBAAkB,iBAAiB,CAAC;AAYjD,iGAAiG;AACjG,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,GAAG,OAAO,CAE1E;AAED,iFAAiF;AACjF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,GAAG,OAAO,CAE5E"}
@@ -11,9 +11,24 @@ export const SOURCE_HASH_FIELD = 'source_hash';
11
11
  export const INGESTED_FIELD = 'ingested';
12
12
  /** store-primitives-from-migration-audit spec (D2): alternative source identities `source add-alt` appends — a later check against any of them reports `duplicate`. */
13
13
  export const SOURCE_ALT_IDS_FIELD = 'source_alt_ids';
14
+ /** retain-captures-as-provenance: the capture paths a note was synthesized from — a list, because a note may cite many. */
15
+ export const SOURCES_FIELD = 'sources';
16
+ /** retain-captures-as-provenance: on a sidecar, the non-markdown capture beside it whose bytes the hash is taken over. */
17
+ export const CAPTURE_FILE_FIELD = 'capture_file';
14
18
  const IDENTITY_FIELDS = [SOURCE_TYPE_FIELD, SOURCE_ID_FIELD, SOURCE_HASH_FIELD, INGESTED_FIELD];
15
- /** Whether a note already carries any source-identity field — a re-ingest guard, and capture's own invariant. */
19
+ /**
20
+ * retain-captures-as-provenance: the two fields ingest itself assigns, as
21
+ * opposed to the two a capture pipeline commonly already knows when it writes
22
+ * the file. Splitting them is what lets a fetcher record where something came
23
+ * from without pretending it has been ingested.
24
+ */
25
+ const ASSIGNED_AT_INGEST_FIELDS = [SOURCE_HASH_FIELD, INGESTED_FIELD];
26
+ /** Whether a record carries any source-identity field at all — what makes it a dedupe record. */
16
27
  export function hasSourceIdentity(note) {
17
28
  return IDENTITY_FIELDS.some((field) => note.frontmatter?.[field] !== undefined);
18
29
  }
30
+ /** Whether ingest has already run against this capture — the re-ingest guard. */
31
+ export function hasAssignedIdentity(note) {
32
+ return ASSIGNED_AT_INGEST_FIELDS.some((field) => note.frontmatter?.[field] !== undefined);
33
+ }
19
34
  //# sourceMappingURL=identity.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"identity.js","sourceRoot":"","sources":["../../../src/core/ingest/identity.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAAC;AAC/C,MAAM,CAAC,MAAM,eAAe,GAAG,WAAW,CAAC;AAC3C,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAAC;AAC/C,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;AACzC,uKAAuK;AACvK,MAAM,CAAC,MAAM,oBAAoB,GAAG,gBAAgB,CAAC;AAErD,MAAM,eAAe,GAAG,CAAC,iBAAiB,EAAE,eAAe,EAAE,iBAAiB,EAAE,cAAc,CAAU,CAAC;AAEzG,iHAAiH;AACjH,MAAM,UAAU,iBAAiB,CAAC,IAA+B;IAC/D,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,KAAK,SAAS,CAAC,CAAC;AAClF,CAAC"}
1
+ {"version":3,"file":"identity.js","sourceRoot":"","sources":["../../../src/core/ingest/identity.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAAC;AAC/C,MAAM,CAAC,MAAM,eAAe,GAAG,WAAW,CAAC;AAC3C,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAAC;AAC/C,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;AACzC,uKAAuK;AACvK,MAAM,CAAC,MAAM,oBAAoB,GAAG,gBAAgB,CAAC;AACrD,2HAA2H;AAC3H,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC;AACvC,0HAA0H;AAC1H,MAAM,CAAC,MAAM,kBAAkB,GAAG,cAAc,CAAC;AAEjD,MAAM,eAAe,GAAG,CAAC,iBAAiB,EAAE,eAAe,EAAE,iBAAiB,EAAE,cAAc,CAAU,CAAC;AAEzG;;;;;GAKG;AACH,MAAM,yBAAyB,GAAG,CAAC,iBAAiB,EAAE,cAAc,CAAU,CAAC;AAE/E,iGAAiG;AACjG,MAAM,UAAU,iBAAiB,CAAC,IAA+B;IAC/D,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,KAAK,SAAS,CAAC,CAAC;AAClF,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,mBAAmB,CAAC,IAA+B;IACjE,OAAO,yBAAyB,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,KAAK,SAAS,CAAC,CAAC;AAC5F,CAAC"}
@@ -1,4 +1,14 @@
1
- import type { Note } from '../notes/list.js';
1
+ /**
2
+ * retain-captures-as-provenance: dedupe compares identity records, not notes.
3
+ * A record is a retained capture (where identity lives now) or a note stamped
4
+ * before the capture tier existed (where it used to). `Note` satisfies this
5
+ * structurally, so both lists feed the same evaluation unchanged.
6
+ */
7
+ export interface IdentityRecord {
8
+ /** Path relative to the store root, forward-slash separated. */
9
+ path: string;
10
+ frontmatter: Record<string, unknown> | undefined;
11
+ }
2
12
  export type SourceCheckVerdict = 'new' | 'already_ingested' | 'drift' | 'alternate_source_match' | 'multiple_matches';
3
13
  export interface SourceCheckResult {
4
14
  verdict: SourceCheckVerdict;
@@ -13,6 +23,11 @@ export interface SourceCheckResult {
13
23
  * order, stopping (and reporting `multiple_matches` rather than guessing)
14
24
  * the moment either stage finds more than one match.
15
25
  *
26
+ * retain-captures-as-provenance: `notes` is the store's identity records —
27
+ * every retained capture plus every note stamped before identity moved onto
28
+ * the capture — so excluding the capture tier from retrieval never narrows
29
+ * what dedupe can see.
30
+ *
16
31
  * store-primitives-from-migration-audit spec (D2): a source-id match
17
32
  * (primary OR an alternate `source add-alt` recorded) whose recorded hash
18
33
  * differs from the candidate's is `drift`, not `already_ingested` — the
@@ -20,5 +35,5 @@ export interface SourceCheckResult {
20
35
  * canonicalized form (D2), so a URL varying only in case, tracking
21
36
  * parameters, or a trailing slash still matches.
22
37
  */
23
- export declare function evaluateSourceCheck(notes: readonly Note[], candidateHash: string, sourceId: string, trackingParams?: readonly string[]): SourceCheckResult;
38
+ export declare function evaluateSourceCheck(notes: readonly IdentityRecord[], candidateHash: string, sourceId: string, trackingParams?: readonly string[]): SourceCheckResult;
24
39
  //# sourceMappingURL=model.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/core/ingest/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAI7C,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,kBAAkB,GAAG,OAAO,GAAG,wBAAwB,GAAG,kBAAkB,CAAC;AAEtH,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,kBAAkB,CAAC;IAC5B,kFAAkF;IAClF,KAAK,CAAC,EAAE,WAAW,GAAG,cAAc,CAAC;IACrC,2EAA2E;IAC3E,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAaD;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,SAAS,IAAI,EAAE,EACtB,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,MAAM,EAChB,cAAc,GAAE,SAAS,MAAM,EAAO,GACrC,iBAAiB,CA2BnB"}
1
+ {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/core/ingest/model.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;CAClD;AAID,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,kBAAkB,GAAG,OAAO,GAAG,wBAAwB,GAAG,kBAAkB,CAAC;AAEtH,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,kBAAkB,CAAC;IAC5B,kFAAkF;IAClF,KAAK,CAAC,EAAE,WAAW,GAAG,cAAc,CAAC;IACrC,2EAA2E;IAC3E,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAaD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,SAAS,cAAc,EAAE,EAChC,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,MAAM,EAChB,cAAc,GAAE,SAAS,MAAM,EAAO,GACrC,iBAAiB,CA2BnB"}
@@ -18,6 +18,11 @@ function recordedIds(note) {
18
18
  * order, stopping (and reporting `multiple_matches` rather than guessing)
19
19
  * the moment either stage finds more than one match.
20
20
  *
21
+ * retain-captures-as-provenance: `notes` is the store's identity records —
22
+ * every retained capture plus every note stamped before identity moved onto
23
+ * the capture — so excluding the capture tier from retrieval never narrows
24
+ * what dedupe can see.
25
+ *
21
26
  * store-primitives-from-migration-audit spec (D2): a source-id match
22
27
  * (primary OR an alternate `source add-alt` recorded) whose recorded hash
23
28
  * differs from the candidate's is `drift`, not `already_ingested` — the
@@ -1 +1 @@
1
- {"version":3,"file":"model.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AAC,CAAC;IACjH,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC3B,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;IAC3G,CAAC;IACD,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO,EAAE,OAAO,EAAE,wBAAwB,EAAE,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;IACjH,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;AAC9D,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * How this executable got onto the path — a FACT the CLI computes, so the
3
+ * upgrade skill can branch on it instead of shelling around to work it out in
4
+ * markdown, where it could not be tested (design.md D12).
5
+ *
6
+ * `undetermined` is a real third answer, never a synonym for `global`: a local
7
+ * dependency install is inside node_modules exactly like a global one, and
8
+ * telling its operator to run a global install would upgrade something other
9
+ * than the executable they are running. The skill stops on both non-global
10
+ * answers.
11
+ */
12
+ export type InstallKind = 'global' | 'linked' | 'undetermined';
13
+ /**
14
+ * Pure so every layout is testable without installing anything. A path with no
15
+ * node_modules segment at all is a working copy — which is what `npm link` and
16
+ * a dev checkout both resolve to, because Node resolves the symlink before
17
+ * import.meta.url is derived.
18
+ */
19
+ export declare function classifyInstallPath(binPath: string, execPath: string): InstallKind;
20
+ export interface InstallLocation {
21
+ path: string;
22
+ kind: InstallKind;
23
+ }
24
+ export declare function resolveInstallLocation(execPath: string): InstallLocation;
25
+ //# sourceMappingURL=install-kind.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install-kind.d.ts","sourceRoot":"","sources":["../../src/core/install-kind.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,cAAc,CAAC;AAwB/D;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,WAAW,CAMlF;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,WAAW,CAAC;CACnB;AAkBD,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe,CAGxE"}
@@ -0,0 +1,56 @@
1
+ import path from 'node:path';
2
+ import { fileURLToPath } from 'node:url';
3
+ const NODE_MODULES = 'node_modules';
4
+ /**
5
+ * Global installs live under the Node prefix's node_modules:
6
+ * POSIX `<prefix>/lib/node_modules`, where execPath is `<prefix>/bin/node`;
7
+ * Windows `<dir of node.exe>/node_modules`.
8
+ */
9
+ function globalRootsFor(execPath) {
10
+ const binDir = path.dirname(execPath);
11
+ const prefix = path.dirname(binDir);
12
+ return [
13
+ path.join(prefix, 'lib', NODE_MODULES),
14
+ path.join(prefix, NODE_MODULES),
15
+ path.join(binDir, NODE_MODULES),
16
+ ];
17
+ }
18
+ function isUnder(child, parent) {
19
+ const relative = path.relative(parent, child);
20
+ return relative.length > 0 && !relative.startsWith('..') && !path.isAbsolute(relative);
21
+ }
22
+ /**
23
+ * Pure so every layout is testable without installing anything. A path with no
24
+ * node_modules segment at all is a working copy — which is what `npm link` and
25
+ * a dev checkout both resolve to, because Node resolves the symlink before
26
+ * import.meta.url is derived.
27
+ */
28
+ export function classifyInstallPath(binPath, execPath) {
29
+ const resolved = path.resolve(binPath);
30
+ const segments = resolved.split(path.sep);
31
+ if (!segments.includes(NODE_MODULES))
32
+ return 'linked';
33
+ if (globalRootsFor(path.resolve(execPath)).some((root) => isUnder(resolved, root)))
34
+ return 'global';
35
+ return 'undetermined';
36
+ }
37
+ /**
38
+ * The entrypoint of the process running right now.
39
+ *
40
+ * Deliberately NOT the thing resolve-hook-cli-at-runtime removed. That change
41
+ * deleted a baked path from *generated hook scripts*, which are written to disk
42
+ * and committed — so a path resolved when the file was generated is wrong on
43
+ * every other machine that later checks the store out. This resolves at the
44
+ * moment it is asked, is never written anywhere, and describes only the
45
+ * process asking. Reintroducing a persisted path here would be the antipattern;
46
+ * reporting the live one is what lets the upgrade skill tell whether
47
+ * `npm install -g` would affect the executable actually in use.
48
+ */
49
+ function runningEntrypoint() {
50
+ return fileURLToPath(new URL('../bin.js', import.meta.url));
51
+ }
52
+ export function resolveInstallLocation(execPath) {
53
+ const binPath = runningEntrypoint();
54
+ return { path: binPath, kind: classifyInstallPath(binPath, execPath) };
55
+ }
56
+ //# sourceMappingURL=install-kind.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install-kind.js","sourceRoot":"","sources":["../../src/core/install-kind.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAezC,MAAM,YAAY,GAAG,cAAc,CAAC;AAEpC;;;;GAIG;AACH,SAAS,cAAc,CAAC,QAAgB;IACtC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACtC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACpC,OAAO;QACL,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,YAAY,CAAC;QACtC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,YAAY,CAAC;QAC/B,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,YAAY,CAAC;KAChC,CAAC;AACJ,CAAC;AAED,SAAS,OAAO,CAAC,KAAa,EAAE,MAAc;IAC5C,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC9C,OAAO,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;AACzF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAe,EAAE,QAAgB;IACnE,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACvC,MAAM,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC1C,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC;QAAE,OAAO,QAAQ,CAAC;IACtD,IAAI,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAAE,OAAO,QAAQ,CAAC;IACpG,OAAO,cAAc,CAAC;AACxB,CAAC;AAOD;;;;;;;;;;;GAWG;AACH,SAAS,iBAAiB;IACxB,OAAO,aAAa,CAAC,IAAI,GAAG,CAAC,WAAW,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,QAAgB;IACrD,MAAM,OAAO,GAAG,iBAAiB,EAAE,CAAC;IACpC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,mBAAmB,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAC;AACzE,CAAC"}
@@ -9,7 +9,27 @@ export interface Note {
9
9
  frontmatter: Record<string, unknown> | undefined;
10
10
  body: string;
11
11
  }
12
+ /**
13
+ * The one prefix rule every path-prefix declaration reads — exclusions,
14
+ * `--under`, the pass's demotion tier, and the write-path gate. Re-exported
15
+ * rather than defined here: it now lives in `core/fs/prefix.ts` so the gate
16
+ * can read the same implementation without importing note enumeration.
17
+ */
18
+ export { isUnderAnyPrefix } from '../fs/prefix.js';
12
19
  export declare function excludedPrefixesFor(config: StoreConfig): string[];
20
+ /**
21
+ * retain-captures-as-provenance: every markdown capture in the tier, which is
22
+ * exactly the set `listNotes` refuses to return — the capture root is a
23
+ * declared retrieval exclusion, so the same walk that hides captures from
24
+ * retrieval is what enumerates them here. Dedupe needs this list and
25
+ * retrieval must never see it, so the two callers share the walker and
26
+ * differ only in which side of the exclusion they ask for.
27
+ *
28
+ * Non-markdown captures are skipped for the same reason `listNotes` skips
29
+ * them: only markdown can carry the frontmatter an identity lives in. A
30
+ * binary capture is represented here by its sidecar.
31
+ */
32
+ export declare function listCaptures(storeRoot: string, config: StoreConfig): Promise<Note[]>;
13
33
  /** Every retrievable note in the store: everything under a .md path, minus every declared exclusion. */
14
34
  export declare function listNotes(storeRoot: string, config: StoreConfig, query?: NoteQuery): Promise<Note[]>;
15
35
  //# sourceMappingURL=list.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/core/notes/list.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAG1D,+DAA+D;AAC/D,MAAM,WAAW,SAAS;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,IAAI;IACnB,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IACjD,IAAI,EAAE,MAAM,CAAC;CACd;AA0CD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,EAAE,CAYjE;AAkCD,wGAAwG;AACxG,wBAAsB,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,GAAE,SAAc,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAO9G"}
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/core/notes/list.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAI1D,+DAA+D;AAC/D,MAAM,WAAW,SAAS;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,IAAI;IACnB,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IACjD,IAAI,EAAE,MAAM,CAAC;CACd;AAmCD;;;;;GAKG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,EAAE,CAYjE;AAkCD;;;;;;;;;;;GAWG;AACH,wBAAsB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAM1F;AAED,wGAAwG;AACxG,wBAAsB,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,GAAE,SAAc,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAO9G"}
@@ -1,6 +1,7 @@
1
1
  import { readdir } from 'node:fs/promises';
2
2
  import path from 'node:path';
3
3
  import { configuredAdapters } from '../../adapters/registry.js';
4
+ import { isUnderAnyPrefix } from '../fs/prefix.js';
4
5
  import { parseNote } from './parse.js';
5
6
  /** Infrastructure directories intrinsic to contexture itself — never configurable content locations. */
6
7
  const ALWAYS_SKIP_DIRS = new Set(['.git', '.githooks', '.queue']);
@@ -31,12 +32,13 @@ function harnessEntryFiles(config) {
31
32
  return new Set();
32
33
  }
33
34
  }
34
- function isUnderAnyPrefix(relativePath, prefixes) {
35
- return prefixes.some((prefix) => {
36
- const trimmed = prefix.replace(/\/+$/, '');
37
- return relativePath === trimmed || relativePath.startsWith(`${trimmed}/`);
38
- });
39
- }
35
+ /**
36
+ * The one prefix rule every path-prefix declaration reads — exclusions,
37
+ * `--under`, the pass's demotion tier, and the write-path gate. Re-exported
38
+ * rather than defined here: it now lives in `core/fs/prefix.ts` so the gate
39
+ * can read the same implementation without importing note enumeration.
40
+ */
41
+ export { isUnderAnyPrefix } from '../fs/prefix.js';
40
42
  export function excludedPrefixesFor(config) {
41
43
  return [
42
44
  ...config.retrieval.exclude_paths,
@@ -81,6 +83,25 @@ async function walk(dir, root, excludePrefixes, skipRootFiles, results) {
81
83
  }
82
84
  }
83
85
  }
86
+ /**
87
+ * retain-captures-as-provenance: every markdown capture in the tier, which is
88
+ * exactly the set `listNotes` refuses to return — the capture root is a
89
+ * declared retrieval exclusion, so the same walk that hides captures from
90
+ * retrieval is what enumerates them here. Dedupe needs this list and
91
+ * retrieval must never see it, so the two callers share the walker and
92
+ * differ only in which side of the exclusion they ask for.
93
+ *
94
+ * Non-markdown captures are skipped for the same reason `listNotes` skips
95
+ * them: only markdown can carry the frontmatter an identity lives in. A
96
+ * binary capture is represented here by its sidecar.
97
+ */
98
+ export async function listCaptures(storeRoot, config) {
99
+ const captureRoot = path.join(storeRoot, config.ingest.capture_root);
100
+ const relativePaths = [];
101
+ await walk(captureRoot, storeRoot, [], new Set(), relativePaths);
102
+ relativePaths.sort();
103
+ return Promise.all(relativePaths.map((relativePath) => parseNote(path.join(storeRoot, relativePath), relativePath)));
104
+ }
84
105
  /** Every retrievable note in the store: everything under a .md path, minus every declared exclusion. */
85
106
  export async function listNotes(storeRoot, config, query = {}) {
86
107
  const relativePaths = [];
@@ -1 +1 @@
1
- {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/core/notes/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,EAAE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AC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;AAChH,CAAC"}
@@ -5,8 +5,11 @@ export interface ScriptSyntaxError {
5
5
  /**
6
6
  * publish spec: the sole spawn site for `node --check` (single-source-
7
7
  * literals guard), the same discipline core/git/exec.ts applies to git and
8
- * adapters/forge/github.ts applies to gh — one dedicated module per
9
- * external tool, never ad hoc subprocess spawning scattered across commands.
8
+ * core/harness/isolated-run.ts applies to re-executing this CLI — one
9
+ * dedicated module per external process, never ad hoc subprocess spawning
10
+ * scattered across commands. (The former gh spawn site went with the forge
11
+ * adapter; nothing in src/ spawns gh, and the portability test only resolves
12
+ * it on PATH.)
10
13
  */
11
14
  export declare function checkScriptSyntax(scripts: readonly string[]): Promise<ScriptSyntaxError[]>;
12
15
  //# sourceMappingURL=script-check.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"script-check.d.ts","sourceRoot":"","sources":["../../../src/core/publish/script-check.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAuBhG"}
1
+ {"version":3,"file":"script-check.d.ts","sourceRoot":"","sources":["../../../src/core/publish/script-check.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAuBhG"}
@@ -7,8 +7,11 @@ const execFileAsync = promisify(execFile);
7
7
  /**
8
8
  * publish spec: the sole spawn site for `node --check` (single-source-
9
9
  * literals guard), the same discipline core/git/exec.ts applies to git and
10
- * adapters/forge/github.ts applies to gh — one dedicated module per
11
- * external tool, never ad hoc subprocess spawning scattered across commands.
10
+ * core/harness/isolated-run.ts applies to re-executing this CLI — one
11
+ * dedicated module per external process, never ad hoc subprocess spawning
12
+ * scattered across commands. (The former gh spawn site went with the forge
13
+ * adapter; nothing in src/ spawns gh, and the portability test only resolves
14
+ * it on PATH.)
12
15
  */
13
16
  export async function checkScriptSyntax(scripts) {
14
17
  if (scripts.length === 0)
@@ -1 +1 @@
1
- {"version":3,"file":"script-check.js","sourceRoot":"","sources":["../../../src/core/publish/script-check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAO1C;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,OAA0B;IAChE,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEpC,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,qBAAqB,CAAC,CAAC,CAAC;IACtE,IAAI,CAAC;QACH,MAAM,MAAM,GAAwB,EAAE,CAAC;QACvC,KAAK,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;YAChD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,KAAK,KAAK,CAAC,CAAC;YACjD,MAAM,SA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E,CAAC;gBAChC,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;gBAC7F,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,QAAQ,MAAM,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACvE,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;YAAS,CAAC;QACT,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAClD,CAAC;AACH,CAAC"}
@@ -11,5 +11,12 @@ export interface PerNoteRecord {
11
11
  gloss: string;
12
12
  hash: string;
13
13
  }
14
+ /**
15
+ * Every authored gloss in the catalog, keyed by note path. Split out so a
16
+ * caller that already holds the note list — the retrieval pass — can join
17
+ * against it without enumerating the store a second time, which would risk
18
+ * the two enumerations disagreeing.
19
+ */
20
+ export declare function readCatalogGlosses(store: Store): Promise<Map<string, string>>;
14
21
  export declare function buildPerNoteRecords(store: Store): Promise<PerNoteRecord[]>;
15
22
  //# sourceMappingURL=records.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"records.d.ts","sourceRoot":"","sources":["../../src/core/records.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAWD,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAmBhF"}
1
+ {"version":3,"file":"records.d.ts","sourceRoot":"","sources":["../../src/core/records.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAWD;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAYnF;AAED,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC,CAUhF"}
@@ -13,8 +13,13 @@ async function readIfExists(filePath) {
13
13
  throw err;
14
14
  }
15
15
  }
16
- export async function buildPerNoteRecords(store) {
17
- const notes = await listNotes(store.root, store.config);
16
+ /**
17
+ * Every authored gloss in the catalog, keyed by note path. Split out so a
18
+ * caller that already holds the note list — the retrieval pass — can join
19
+ * against it without enumerating the store a second time, which would risk
20
+ * the two enumerations disagreeing.
21
+ */
22
+ export async function readCatalogGlosses(store) {
18
23
  const sections = catalogSectionsFor(store.config);
19
24
  const catalogDir = path.join(store.root, store.config.catalog.path);
20
25
  const glosses = new Map();
@@ -24,6 +29,11 @@ export async function buildPerNoteRecords(store) {
24
29
  glosses.set(notePath, entry.gloss);
25
30
  }
26
31
  }
32
+ return glosses;
33
+ }
34
+ export async function buildPerNoteRecords(store) {
35
+ const notes = await listNotes(store.root, store.config);
36
+ const glosses = await readCatalogGlosses(store);
27
37
  return notes.map((note) => ({
28
38
  id: note.path,
29
39
  path: note.path,
@@ -1 +1 @@
1
- {"version":3,"file":"records.js","sourceRoot":"","sources":["../../src/core/records.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,M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