ctxr-cli 0.4.1 → 0.6.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 (235) hide show
  1. package/dist/adapter.d.ts +0 -1
  2. package/dist/adapter.d.ts.map +1 -1
  3. package/dist/adapter.js.map +1 -1
  4. package/dist/adapters/builtin/index.d.ts.map +1 -1
  5. package/dist/adapters/builtin/index.js +2 -2
  6. package/dist/adapters/builtin/index.js.map +1 -1
  7. package/dist/adapters/harness/claude-code.d.ts.map +1 -1
  8. package/dist/adapters/harness/claude-code.js +30 -14
  9. package/dist/adapters/harness/claude-code.js.map +1 -1
  10. package/dist/adapters/harness/hermes-agent.d.ts +9 -0
  11. package/dist/adapters/harness/hermes-agent.d.ts.map +1 -0
  12. package/dist/adapters/harness/hermes-agent.js +13 -0
  13. package/dist/adapters/harness/hermes-agent.js.map +1 -0
  14. package/dist/adapters/types.d.ts +39 -18
  15. package/dist/adapters/types.d.ts.map +1 -1
  16. package/dist/adapters/types.js +3 -3
  17. package/dist/adapters/types.js.map +1 -1
  18. package/dist/commands/adapters-generate.d.ts +4 -2
  19. package/dist/commands/adapters-generate.d.ts.map +1 -1
  20. package/dist/commands/adapters-generate.js +14 -6
  21. package/dist/commands/adapters-generate.js.map +1 -1
  22. package/dist/commands/archive.d.ts +4 -2
  23. package/dist/commands/archive.d.ts.map +1 -1
  24. package/dist/commands/archive.js +5 -3
  25. package/dist/commands/archive.js.map +1 -1
  26. package/dist/commands/check.d.ts.map +1 -1
  27. package/dist/commands/check.js +1 -6
  28. package/dist/commands/check.js.map +1 -1
  29. package/dist/commands/init.d.ts +2 -0
  30. package/dist/commands/init.d.ts.map +1 -1
  31. package/dist/commands/init.js +132 -18
  32. package/dist/commands/init.js.map +1 -1
  33. package/dist/commands/publish-check.d.ts +23 -0
  34. package/dist/commands/publish-check.d.ts.map +1 -0
  35. package/dist/commands/publish-check.js +116 -0
  36. package/dist/commands/publish-check.js.map +1 -0
  37. package/dist/commands/publish-gather.d.ts +37 -0
  38. package/dist/commands/publish-gather.d.ts.map +1 -0
  39. package/dist/commands/publish-gather.js +92 -0
  40. package/dist/commands/publish-gather.js.map +1 -0
  41. package/dist/commands/publish-new.d.ts +18 -0
  42. package/dist/commands/publish-new.d.ts.map +1 -0
  43. package/dist/commands/publish-new.js +86 -0
  44. package/dist/commands/publish-new.js.map +1 -0
  45. package/dist/commands/rollup-write.d.ts.map +1 -1
  46. package/dist/commands/rollup-write.js +8 -0
  47. package/dist/commands/rollup-write.js.map +1 -1
  48. package/dist/commands/serve.d.ts +32 -0
  49. package/dist/commands/serve.d.ts.map +1 -0
  50. package/dist/commands/serve.js +170 -0
  51. package/dist/commands/serve.js.map +1 -0
  52. package/dist/commands/update.js +3 -3
  53. package/dist/commands/update.js.map +1 -1
  54. package/dist/commands/verify.d.ts +9 -2
  55. package/dist/commands/verify.d.ts.map +1 -1
  56. package/dist/commands/verify.js +46 -23
  57. package/dist/commands/verify.js.map +1 -1
  58. package/dist/config/defaults.d.ts +53 -15
  59. package/dist/config/defaults.d.ts.map +1 -1
  60. package/dist/config/defaults.js +54 -19
  61. package/dist/config/defaults.js.map +1 -1
  62. package/dist/config/schema.d.ts +49 -12
  63. package/dist/config/schema.d.ts.map +1 -1
  64. package/dist/config/schema.js +115 -23
  65. package/dist/config/schema.js.map +1 -1
  66. package/dist/core/agents-doc.d.ts +63 -12
  67. package/dist/core/agents-doc.d.ts.map +1 -1
  68. package/dist/core/agents-doc.js +191 -41
  69. package/dist/core/agents-doc.js.map +1 -1
  70. package/dist/core/browse/link-resolver.d.ts +12 -0
  71. package/dist/core/browse/link-resolver.d.ts.map +1 -0
  72. package/dist/core/browse/link-resolver.js +12 -0
  73. package/dist/core/browse/link-resolver.js.map +1 -0
  74. package/dist/core/browse/render.d.ts +5 -0
  75. package/dist/core/browse/render.d.ts.map +1 -0
  76. package/dist/core/browse/render.js +66 -0
  77. package/dist/core/browse/render.js.map +1 -0
  78. package/dist/core/browse/routes.d.ts +31 -0
  79. package/dist/core/browse/routes.d.ts.map +1 -0
  80. package/dist/core/browse/routes.js +56 -0
  81. package/dist/core/browse/routes.js.map +1 -0
  82. package/dist/core/browse/templates.d.ts +4 -0
  83. package/dist/core/browse/templates.d.ts.map +1 -0
  84. package/dist/core/browse/templates.js +26 -0
  85. package/dist/core/browse/templates.js.map +1 -0
  86. package/dist/core/checks/harness-portability-checks.d.ts +12 -0
  87. package/dist/core/checks/harness-portability-checks.d.ts.map +1 -0
  88. package/dist/core/checks/harness-portability-checks.js +39 -0
  89. package/dist/core/checks/harness-portability-checks.js.map +1 -0
  90. package/dist/core/checks/integrity-checks.d.ts +43 -3
  91. package/dist/core/checks/integrity-checks.d.ts.map +1 -1
  92. package/dist/core/checks/integrity-checks.js +191 -13
  93. package/dist/core/checks/integrity-checks.js.map +1 -1
  94. package/dist/core/checks/manifest.d.ts.map +1 -1
  95. package/dist/core/checks/manifest.js +2 -0
  96. package/dist/core/checks/manifest.js.map +1 -1
  97. package/dist/core/checks/organize-checks.d.ts +21 -1
  98. package/dist/core/checks/organize-checks.d.ts.map +1 -1
  99. package/dist/core/checks/organize-checks.js +64 -4
  100. package/dist/core/checks/organize-checks.js.map +1 -1
  101. package/dist/core/convention-doc.d.ts +32 -0
  102. package/dist/core/convention-doc.d.ts.map +1 -0
  103. package/dist/core/convention-doc.js +137 -0
  104. package/dist/core/convention-doc.js.map +1 -0
  105. package/dist/core/conventions.d.ts +25 -5
  106. package/dist/core/conventions.d.ts.map +1 -1
  107. package/dist/core/conventions.js +65 -3
  108. package/dist/core/conventions.js.map +1 -1
  109. package/dist/core/disclosure/model.d.ts +11 -0
  110. package/dist/core/disclosure/model.d.ts.map +1 -1
  111. package/dist/core/disclosure/model.js +24 -0
  112. package/dist/core/disclosure/model.js.map +1 -1
  113. package/dist/core/errors.d.ts +27 -41
  114. package/dist/core/errors.d.ts.map +1 -1
  115. package/dist/core/errors.js +76 -119
  116. package/dist/core/errors.js.map +1 -1
  117. package/dist/core/fs/fenced-region.d.ts +38 -0
  118. package/dist/core/fs/fenced-region.d.ts.map +1 -1
  119. package/dist/core/fs/fenced-region.js +88 -2
  120. package/dist/core/fs/fenced-region.js.map +1 -1
  121. package/dist/core/git/repo.d.ts +0 -6
  122. package/dist/core/git/repo.d.ts.map +1 -1
  123. package/dist/core/git/repo.js +0 -13
  124. package/dist/core/git/repo.js.map +1 -1
  125. package/dist/core/git/worktree.d.ts +4 -7
  126. package/dist/core/git/worktree.d.ts.map +1 -1
  127. package/dist/core/git/worktree.js +4 -10
  128. package/dist/core/git/worktree.js.map +1 -1
  129. package/dist/core/graph/model.d.ts +14 -0
  130. package/dist/core/graph/model.d.ts.map +1 -1
  131. package/dist/core/graph/model.js +30 -14
  132. package/dist/core/graph/model.js.map +1 -1
  133. package/dist/core/harness/bridge.d.ts +30 -0
  134. package/dist/core/harness/bridge.d.ts.map +1 -0
  135. package/dist/core/harness/bridge.js +178 -0
  136. package/dist/core/harness/bridge.js.map +1 -0
  137. package/dist/core/json-config-merge.d.ts.map +1 -1
  138. package/dist/core/json-config-merge.js +30 -7
  139. package/dist/core/json-config-merge.js.map +1 -1
  140. package/dist/core/migrations/archive-destination-from-taxonomy.d.ts +35 -0
  141. package/dist/core/migrations/archive-destination-from-taxonomy.d.ts.map +1 -0
  142. package/dist/core/migrations/archive-destination-from-taxonomy.js +109 -0
  143. package/dist/core/migrations/archive-destination-from-taxonomy.js.map +1 -0
  144. package/dist/core/migrations/drop-forge-and-workspaces-external.d.ts +19 -0
  145. package/dist/core/migrations/drop-forge-and-workspaces-external.d.ts.map +1 -0
  146. package/dist/core/migrations/drop-forge-and-workspaces-external.js +49 -0
  147. package/dist/core/migrations/drop-forge-and-workspaces-external.js.map +1 -0
  148. package/dist/core/migrations/registry.d.ts.map +1 -1
  149. package/dist/core/migrations/registry.js +10 -1
  150. package/dist/core/migrations/registry.js.map +1 -1
  151. package/dist/core/migrations/rename-conventions-path.d.ts +26 -0
  152. package/dist/core/migrations/rename-conventions-path.d.ts.map +1 -0
  153. package/dist/core/migrations/rename-conventions-path.js +86 -0
  154. package/dist/core/migrations/rename-conventions-path.js.map +1 -0
  155. package/dist/core/notes/list.d.ts.map +1 -1
  156. package/dist/core/notes/list.js +7 -3
  157. package/dist/core/notes/list.js.map +1 -1
  158. package/dist/core/publish/script-check.d.ts +12 -0
  159. package/dist/core/publish/script-check.d.ts.map +1 -0
  160. package/dist/core/publish/script-check.js +39 -0
  161. package/dist/core/publish/script-check.js.map +1 -0
  162. package/dist/core/reconcile.d.ts +3 -0
  163. package/dist/core/reconcile.d.ts.map +1 -1
  164. package/dist/core/reconcile.js +43 -6
  165. package/dist/core/reconcile.js.map +1 -1
  166. package/dist/core/rollup.d.ts +2 -2
  167. package/dist/core/rollup.d.ts.map +1 -1
  168. package/dist/core/rollup.js +24 -3
  169. package/dist/core/rollup.js.map +1 -1
  170. package/dist/core/session.d.ts +9 -9
  171. package/dist/core/session.js +9 -9
  172. package/dist/core/skills.d.ts +36 -0
  173. package/dist/core/skills.d.ts.map +1 -1
  174. package/dist/core/skills.js +154 -29
  175. package/dist/core/skills.js.map +1 -1
  176. package/dist/core/write-lifecycle/path-gate.d.ts.map +1 -1
  177. package/dist/core/write-lifecycle/path-gate.js +5 -3
  178. package/dist/core/write-lifecycle/path-gate.js.map +1 -1
  179. package/dist/prompt/inquirer-prompter.d.ts.map +1 -1
  180. package/dist/prompt/inquirer-prompter.js +11 -1
  181. package/dist/prompt/inquirer-prompter.js.map +1 -1
  182. package/dist/prompt/prompter.d.ts +16 -0
  183. package/dist/prompt/prompter.d.ts.map +1 -1
  184. package/dist/run.d.ts.map +1 -1
  185. package/dist/run.js +61 -55
  186. package/dist/run.js.map +1 -1
  187. package/dist/taxonomy/profiles.d.ts +11 -0
  188. package/dist/taxonomy/profiles.d.ts.map +1 -1
  189. package/dist/taxonomy/profiles.js +1 -0
  190. package/dist/taxonomy/profiles.js.map +1 -1
  191. package/dist/version.d.ts +1 -1
  192. package/dist/version.js +1 -1
  193. package/package.json +3 -1
  194. package/templates/agents/canonical.md +2 -8
  195. package/templates/agents/{store-conventions.md → conventions.md} +2 -4
  196. package/templates/agents/mission.md +5 -0
  197. package/templates/conventions/baseline-conventions.md +60 -0
  198. package/templates/conventions/house-conventions-seed.md +34 -0
  199. package/templates/hooks/pre-push.sh +1 -1
  200. package/templates/serve/shell.html +15 -0
  201. package/templates/serve/style.css +88 -0
  202. package/templates/skills/ctxr-land.md +32 -18
  203. package/templates/skills/ctxr-organize-audit.md +1 -1
  204. package/templates/skills/ctxr-publish.md +79 -0
  205. package/templates/skills/ctxr-session-capture.md +44 -1
  206. package/templates/skills/ctxr-session-lifecycle.md +20 -1
  207. package/templates/skills/ctxr-submit.md +15 -11
  208. package/templates/vendor/frontend-design/LICENSE.txt +177 -0
  209. package/templates/vendor/frontend-design/SKILL.md +55 -0
  210. package/templates/vendor/frontend-design/provenance.json +7 -0
  211. package/dist/adapters/forge/github.d.ts +0 -12
  212. package/dist/adapters/forge/github.d.ts.map +0 -1
  213. package/dist/adapters/forge/github.js +0 -76
  214. package/dist/adapters/forge/github.js.map +0 -1
  215. package/dist/adapters/forge/types.d.ts +0 -46
  216. package/dist/adapters/forge/types.d.ts.map +0 -1
  217. package/dist/adapters/forge/types.js +0 -2
  218. package/dist/adapters/forge/types.js.map +0 -1
  219. package/dist/commands/session-abandon.d.ts +0 -13
  220. package/dist/commands/session-abandon.d.ts.map +0 -1
  221. package/dist/commands/session-abandon.js +0 -22
  222. package/dist/commands/session-abandon.js.map +0 -1
  223. package/dist/commands/session-land.d.ts +0 -45
  224. package/dist/commands/session-land.d.ts.map +0 -1
  225. package/dist/commands/session-land.js +0 -171
  226. package/dist/commands/session-land.js.map +0 -1
  227. package/dist/commands/session-reap.d.ts +0 -22
  228. package/dist/commands/session-reap.d.ts.map +0 -1
  229. package/dist/commands/session-reap.js +0 -52
  230. package/dist/commands/session-reap.js.map +0 -1
  231. package/dist/commands/session-submit.d.ts +0 -29
  232. package/dist/commands/session-submit.d.ts.map +0 -1
  233. package/dist/commands/session-submit.js +0 -72
  234. package/dist/commands/session-submit.js.map +0 -1
  235. package/templates/agents/store-conventions-empty.md +0 -7
@@ -1,4 +1,7 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { AGENTS_MD_SECTION_ORDER, agentsMdPath } from '../agents-doc.js';
1
3
  import { checkCatalogCoverage } from '../catalog/build.js';
4
+ import { reorderFencedRegions } from '../fs/fenced-region.js';
2
5
  import { orphans } from '../graph/query.js';
3
6
  import { hasSourceIdentity } from '../ingest/identity.js';
4
7
  import { findStaleRollups } from '../rollup.js';
@@ -24,7 +27,15 @@ export const orphanNotesCheck = defineCheck({
24
27
  return { status: findings.length > 0 ? 'fail' : 'pass', findings };
25
28
  },
26
29
  });
27
- /** context-organize spec: "broken links" — the graph's dangling links (not_found or ambiguous), reported not failed. Shares detection with the doctor-facing invariant checks/integrity-checks.ts:graphDanglingLinksCheck under a different id (task 9.4: two ids, two severity lanes, one condition, never double-counted within a single run). */
30
+ /**
31
+ * context-organize spec: "broken links" — a link that resolves to no note at all
32
+ * (`not_found`), reported not failed. `graph.dangling` also carries `ambiguous`-reason
33
+ * records (a link matching two or more notes' basenames), but those are
34
+ * checks/integrity-checks.ts:graphAmbiguousLinksCheck's alone (doctor, invariant): resolution
35
+ * is mechanically broken there, with an always-applicable fix, unlike a `not_found` link,
36
+ * which can't be told apart from a healthy forward reference — so this check filters
37
+ * `ambiguous` out rather than sharing it.
38
+ */
28
39
  export const brokenLinksCheck = defineCheck({
29
40
  id: 'organize.broken_links',
30
41
  title: 'Notes with dangling wikilinks',
@@ -35,10 +46,12 @@ export const brokenLinksCheck = defineCheck({
35
46
  const graph = await ctx.graph();
36
47
  if (!graph)
37
48
  return { status: 'skip', skipReason: GRAPH_SKIP_REASON, findings: [] };
38
- const findings = graph.dangling.map((d) => ({
49
+ const findings = graph.dangling
50
+ .filter((d) => d.reason === 'not_found')
51
+ .map((d) => ({
39
52
  code: 'organize.broken_link',
40
53
  severity: 'info',
41
- message: `"${d.from}" links to "${d.target}", which is ${d.reason === 'ambiguous' ? 'ambiguous' : 'not found'}.`,
54
+ message: `"${d.from}" links to "${d.target}", which is not found.`,
42
55
  subject: d.from,
43
56
  details: { target: d.target, reason: d.reason },
44
57
  }));
@@ -116,5 +129,52 @@ export const rollupStaleCheck = defineCheck({
116
129
  return { status: findings.length > 0 ? 'fail' : 'pass', findings };
117
130
  },
118
131
  });
119
- export const ORGANIZE_CHECKS = [orphanNotesCheck, brokenLinksCheck, uningestedInboxCheck, catalogGapsLintCheck, rollupStaleCheck];
132
+ /**
133
+ * harness-portability spec (inline-conventions-and-mission): "Generated
134
+ * sections render in a fixed order" — hand-written content interrupting the
135
+ * managed fences' contiguity blocks `ctxr update` from reordering them to
136
+ * the fixed layout (`reorderFencedRegions`' own conservative rule: never
137
+ * relocate content it can't be sure sits outside every managed section).
138
+ * Reported here as an observation, not by `doctor`: `doctor` runs only
139
+ * `severity: 'invariant'` checks (`src/commands/doctor.ts`), and a store
140
+ * whose sections are merely out of the preferred order still functions —
141
+ * this is exactly the report-don't-block condition lint exists for.
142
+ */
143
+ export const agentsMdSectionOrderBlockedCheck = defineCheck({
144
+ id: 'harness_portability.agents_md_section_order_blocked',
145
+ title: "AGENTS.md's managed sections can be reordered to the standard layout",
146
+ severity: 'observation',
147
+ capability: 'harness-portability',
148
+ scopes: ['store'],
149
+ async run(ctx) {
150
+ let content;
151
+ try {
152
+ content = await readFile(agentsMdPath(ctx.storeRoot), 'utf8');
153
+ }
154
+ catch (err) {
155
+ if (err.code !== 'ENOENT')
156
+ throw err;
157
+ return { status: 'skip', skipReason: 'AGENTS.md has not been generated yet — run `ctxr update`', findings: [] };
158
+ }
159
+ const { blocked } = reorderFencedRegions(content, AGENTS_MD_SECTION_ORDER);
160
+ const findings = blocked
161
+ ? [
162
+ {
163
+ code: 'harness_portability.agents_md_section_order_blocked',
164
+ severity: 'info',
165
+ message: 'AGENTS.md has hand-written content between two managed sections, so `ctxr update` cannot reorder them to the standard layout. Move the hand-written content outside every managed section, then re-run `ctxr update`.',
166
+ },
167
+ ]
168
+ : [];
169
+ return { status: findings.length > 0 ? 'fail' : 'pass', findings };
170
+ },
171
+ });
172
+ export const ORGANIZE_CHECKS = [
173
+ orphanNotesCheck,
174
+ brokenLinksCheck,
175
+ uningestedInboxCheck,
176
+ catalogGapsLintCheck,
177
+ rollupStaleCheck,
178
+ agentsMdSectionOrderBlockedCheck,
179
+ ];
120
180
  //# sourceMappingURL=organize-checks.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"organize-checks.js","sourceRoot":"","sources":["../../../src/core/checks/organize-checks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,iBAAiB,GAAG,uDAAuD,CAAC;AAElF,0FAA0F;AAC1F,MAAM,CAAC,MAAM,gBAAgB,GAAG,WAAW,CAAC;IAC1C,EAAE,EAAE,uBAAuB;IAC3B,KAAK,EAAE,+BAA+B;IACtC,QAAQ,EAAE,aAAa;IACvB,UAAU,EAAE,kBAAkB;IAC9B,MAAM,EAAE,CAAC,OAAO,CAAC;IACjB,KAAK,CAAC,GAAG,CAAC,GAAG;QACX,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,KAAK,EAAE,CAAC;QAChC,IAAI,CAAC,KAAK;YAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;QACnF,MAAM,QAAQ,GAAc,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE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B;IAChB,oBAAoB;IACpB,oBAAoB;IACpB,gBAAgB;IAChB,gCAAgC;CACjC,CAAC"}
@@ -0,0 +1,32 @@
1
+ import type { StoreConfig } from '../config/schema.js';
2
+ /**
3
+ * compose-store-guidance-documents: the shipped baseline conventions,
4
+ * rendered from this store's own configuration — never a shipped profile's
5
+ * or one deployment's names. This is what `syncBaselineConventions` writes;
6
+ * it is never composed with anything else. `AGENTS.md`'s "Store
7
+ * conventions" section (inline-conventions-and-mission's
8
+ * `scanConventions`/`renderConventionsSection`) inlines it as one of
9
+ * however many convention files the guidance directory holds, exactly like
10
+ * any operator-authored one.
11
+ */
12
+ export declare function renderBaselineConventions(config: StoreConfig): string;
13
+ /**
14
+ * compose-store-guidance-documents: contexture-owned, the same way a
15
+ * shipped skill copy is (`syncShippedSkills` in skills.ts) — written by
16
+ * `ctxr init`, rewritten wholesale by `ctxr update` on drift, never
17
+ * hand-edited. A single file, so this is simpler than the skills sync (no
18
+ * directory scan, no orphan cleanup): read-compare-write, reporting whether
19
+ * it changed.
20
+ */
21
+ export declare function syncBaselineConventions(root: string, config: StoreConfig): Promise<{
22
+ changed: boolean;
23
+ }>;
24
+ /**
25
+ * This store's own conventions — its house rules — seeded once with heading
26
+ * prompts only, no content contexture would be guessing at, and never touched
27
+ * again once it exists (unlike the baseline file, this one is operator-owned).
28
+ */
29
+ export declare function seedHouseConventionsFile(root: string, config: StoreConfig): Promise<{
30
+ created: boolean;
31
+ }>;
32
+ //# sourceMappingURL=convention-doc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convention-doc.d.ts","sourceRoot":"","sources":["../../src/core/convention-doc.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AA+CvD;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAYrE;AAED;;;;;;;GAOG;AACH,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAe9G;AAyBD;;;;GAIG;AACH,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAW/G"}
@@ -0,0 +1,137 @@
1
+ import { mkdir, readFile, rm } from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import { DEFAULT_BASELINE_CONVENTIONS_FILE_NAME, DEFAULT_HOUSE_CONVENTIONS_FILE_NAME, LEGACY_BASELINE_CONVENTION_FILE_NAME, } from '../config/defaults.js';
4
+ import { writeFileAtomic } from './fs/atomic.js';
5
+ import { packagedTemplate, substituteBlock } from './templates.js';
6
+ /** The header every contexture-owned guidance file carries; the guard on removing one. */
7
+ const MANAGED_OWNER_MARKER = '<!-- Owned by contexture —';
8
+ function conventionTemplate(name) {
9
+ return packagedTemplate('conventions', name);
10
+ }
11
+ function directoryDefaultsList(config) {
12
+ const entries = Object.entries(config.visibility.directory_defaults);
13
+ if (entries.length === 0) {
14
+ return ['- (none configured — every note without an explicit value resolves to the store default context)'];
15
+ }
16
+ return entries.map(([prefix, value]) => `- \`${prefix}\` → \`${value}\``);
17
+ }
18
+ function hardWallsList(config) {
19
+ const { hard_walls: hardWalls } = config.disclosure;
20
+ if (hardWalls.length === 0)
21
+ return ['- (none configured)'];
22
+ return hardWalls.map((wall) => {
23
+ const scope = wall.note_path_prefix ? `under \`${wall.note_path_prefix}\`` : '(every path)';
24
+ const audience = wall.audience === '*' ? 'every audience' : `\`${wall.audience}\``;
25
+ const except = wall.except && wall.except.length > 0 ? `, except ${wall.except.map((a) => `\`${a}\``).join(', ')}` : '';
26
+ return `- ${audience} ${scope} → **${wall.verdict.toUpperCase()}**${except}`;
27
+ });
28
+ }
29
+ function internalAudiencesList(config) {
30
+ const { internal_audiences: internalAudiences } = config.disclosure;
31
+ if (internalAudiences.length === 0)
32
+ return ['- (none configured — every audience is external)'];
33
+ return internalAudiences.map((name) => `- \`${name}\``);
34
+ }
35
+ function relationVocabularyLines(config) {
36
+ const { relations } = config.retrieval;
37
+ if (relations.length === 0) {
38
+ return ['This store declares no relation vocabulary (`retrieval.relations`) — every link is untyped.'];
39
+ }
40
+ const named = relations.map((name) => `**${name}**`).join(', ');
41
+ return [
42
+ `This store's configured relation vocabulary, in link-section order: ${named}. A link under one of these section headings in a note's body is typed accordingly; a link under any other heading is untyped.`,
43
+ ];
44
+ }
45
+ /**
46
+ * compose-store-guidance-documents: the shipped baseline conventions,
47
+ * rendered from this store's own configuration — never a shipped profile's
48
+ * or one deployment's names. This is what `syncBaselineConventions` writes;
49
+ * it is never composed with anything else. `AGENTS.md`'s "Store
50
+ * conventions" section (inline-conventions-and-mission's
51
+ * `scanConventions`/`renderConventionsSection`) inlines it as one of
52
+ * however many convention files the guidance directory holds, exactly like
53
+ * any operator-authored one.
54
+ */
55
+ export function renderBaselineConventions(config) {
56
+ let text = conventionTemplate('baseline-conventions')
57
+ .replaceAll('__VISIBILITY_FIELD__', config.fields.visibility)
58
+ .replaceAll('__DEFAULT_CONTEXT__', config.visibility.default_context)
59
+ .replaceAll('__ARCHIVE_DESTINATION__', config.organize.archive_destination)
60
+ .replaceAll('__DEFAULT_BRANCH__', config.git.default_branch)
61
+ .replaceAll('__WORKTREES_PATH__', config.session.worktrees_path);
62
+ text = substituteBlock(text, '__DIRECTORY_DEFAULTS_TABLE__', directoryDefaultsList(config));
63
+ text = substituteBlock(text, '__HARD_WALLS_LIST__', hardWallsList(config));
64
+ text = substituteBlock(text, '__INTERNAL_AUDIENCES_LIST__', internalAudiencesList(config));
65
+ text = substituteBlock(text, '__RELATION_VOCABULARY__', relationVocabularyLines(config));
66
+ return `${text}\n`;
67
+ }
68
+ /**
69
+ * compose-store-guidance-documents: contexture-owned, the same way a
70
+ * shipped skill copy is (`syncShippedSkills` in skills.ts) — written by
71
+ * `ctxr init`, rewritten wholesale by `ctxr update` on drift, never
72
+ * hand-edited. A single file, so this is simpler than the skills sync (no
73
+ * directory scan, no orphan cleanup): read-compare-write, reporting whether
74
+ * it changed.
75
+ */
76
+ export async function syncBaselineConventions(root, config) {
77
+ const guidanceDir = path.join(root, config.harness.guidance_path);
78
+ const target = path.join(guidanceDir, DEFAULT_BASELINE_CONVENTIONS_FILE_NAME);
79
+ const content = renderBaselineConventions(config);
80
+ const removedLegacy = await removeLegacyBaselineFile(guidanceDir);
81
+ let existing;
82
+ try {
83
+ existing = await readFile(target, 'utf8');
84
+ }
85
+ catch {
86
+ existing = undefined;
87
+ }
88
+ if (existing === content)
89
+ return { changed: removedLegacy };
90
+ await mkdir(path.dirname(target), { recursive: true });
91
+ await writeFileAtomic(target, content);
92
+ return { changed: true };
93
+ }
94
+ /**
95
+ * The baseline file was `baseline-convention.md` before the rename to the
96
+ * plural. Left in place it would not merely sit unused: `scanConventions`
97
+ * reads the guidance directory wholesale, so the stale copy would be inlined
98
+ * into AGENTS.md a second time alongside the current one.
99
+ *
100
+ * Guarded on the managed-owner header the same way `syncShippedSkills` guards
101
+ * its own orphan cleanup — a file an operator happens to have written at that
102
+ * name is never removed.
103
+ */
104
+ async function removeLegacyBaselineFile(guidanceDir) {
105
+ const legacy = path.join(guidanceDir, LEGACY_BASELINE_CONVENTION_FILE_NAME);
106
+ let existing;
107
+ try {
108
+ existing = await readFile(legacy, 'utf8');
109
+ }
110
+ catch {
111
+ return false;
112
+ }
113
+ if (!existing.includes(MANAGED_OWNER_MARKER))
114
+ return false;
115
+ await rm(legacy);
116
+ return true;
117
+ }
118
+ /**
119
+ * This store's own conventions — its house rules — seeded once with heading
120
+ * prompts only, no content contexture would be guessing at, and never touched
121
+ * again once it exists (unlike the baseline file, this one is operator-owned).
122
+ */
123
+ export async function seedHouseConventionsFile(root, config) {
124
+ const target = path.join(root, config.harness.guidance_path, DEFAULT_HOUSE_CONVENTIONS_FILE_NAME);
125
+ try {
126
+ await readFile(target, 'utf8');
127
+ return { created: false };
128
+ }
129
+ catch (err) {
130
+ if (err.code !== 'ENOENT')
131
+ throw err;
132
+ }
133
+ await mkdir(path.dirname(target), { recursive: true });
134
+ await writeFileAtomic(target, `${conventionTemplate('house-conventions-seed')}\n`);
135
+ return { created: true };
136
+ }
137
+ //# sourceMappingURL=convention-doc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convention-doc.js","sourceRoot":"","sources":["../../src/core/convention-doc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,sCAAsC,EACtC,mCAAmC,EACnC,oCAAoC,GACrC,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEnE,0FAA0F;AAC1F,MAAM,oBAAoB,GAAG,4BAA4B,CAAC;AAE1D,SAAS,kBAAkB,CAAC,IAAY;IACtC,OAAO,gBAAgB,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;AAC/C,CAAC;AAED,SAAS,qBAAqB,CAAC,MAAmB;IAChD,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;IACrE,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,CAAC,kGAAkG,CAAC,CAAC;IAC9G,CAAC;IACD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,OAAO,MAAM,UAAU,KAAK,IAAI,CAAC,CAAC;AAC5E,CAAC;AAED,SAAS,aAAa,CAAC,MAAmB;IACxC,MAAM,EAAE,UAAU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CAAC,oBAAoB,CAAC;QAAE,OAAO,KAAK,CAAC;IAC3D,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC;IACjB,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,IAAY,EAAE,MAAmB;IAC9E,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,aAAa,EAAE,mCAAmC,CAAC,CAAC;IAClG,IAAI,CAAC;QACH,MAAM,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC/B,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAK,GAA6B,CAAC,IAAI,KAAK,QAAQ;YAAE,MAAM,GAAG,CAAC;IAClE,CAAC;IACD,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACvD,MAAM,eAAe,CAAC,MAAM,EAAE,GAAG,kBAAkB,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;IACnF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC3B,CAAC"}
@@ -1,21 +1,41 @@
1
1
  import type { StoreConfig } from '../config/schema.js';
2
2
  /**
3
- * harness-portability spec (entry-doc-generation): operator-authored
4
- * convention documents and (via scanSkills in skills.ts) skill
5
- * files are indexed from what is actually on disk — adding a file is the
6
- * entire integration. Metadata extraction order: frontmatter title →
3
+ * harness-portability spec (entry-doc-generation, inline-conventions-and-mission):
4
+ * operator-authored convention documents and (via scanSkills in skills.ts)
5
+ * skill files are scanned from what is actually on disk — adding a file is
6
+ * the entire integration. Metadata extraction order: frontmatter title →
7
7
  * first `# ` heading → filename stem; description only from frontmatter.
8
+ * `body` is the frontmatter-stripped content, kept alongside the metadata so
9
+ * `inlineDocBody` never has to re-read or re-parse the source file.
8
10
  */
9
11
  export interface ScannedDoc {
10
12
  /** Path relative to the store root, forward-slash separated. */
11
13
  path: string;
12
14
  title: string;
13
15
  description: string | null;
16
+ /** Frontmatter stripped, otherwise verbatim. */
17
+ body: string;
14
18
  }
15
19
  /** The skill-layout filename: `<slug>/SKILL.md` — what harnesses with skill auto-discovery read. */
16
20
  export declare const SKILL_FILE_NAME = "SKILL.md";
17
21
  export declare function extractDocMetadata(raw: string, relativePath: string): ScannedDoc;
22
+ /**
23
+ * inline-conventions-and-mission: renders a scanned doc's body for inlining
24
+ * into a generated `AGENTS.md` section — a leading `# <title>` heading
25
+ * dropped when it duplicates the section heading the caller already
26
+ * provides, every remaining ATX heading demoted by `headingOffset` levels
27
+ * (capped at H6), and any nested `contexture:<region>` fence marker line
28
+ * stripped (its body kept, only the marker comment removed) so a fence
29
+ * copied out of a source file — e.g. mission.md's own rollup fence — never
30
+ * leaves an orphaned marker inside AGENTS.md's fence.
31
+ */
32
+ export declare function inlineDocBody(doc: ScannedDoc, headingOffset: number): string[];
18
33
  export declare function scanDocsDir(root: string, dirRelativePath: string): Promise<ScannedDoc[]>;
19
- /** Every operator convention doc currently at the configured path. */
34
+ /**
35
+ * Every convention doc currently at the configured guidance path —
36
+ * contexture's own shipped baseline (see `templates/conventions/baseline-conventions.md`,
37
+ * synced by `syncBaselineConventions` in `convention-doc.ts`) alongside
38
+ * whatever the operator has added — minus the mission document.
39
+ */
20
40
  export declare function scanConventions(root: string, config: StoreConfig): Promise<ScannedDoc[]>;
21
41
  //# sourceMappingURL=conventions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"conventions.d.ts","sourceRoot":"","sources":["../../src/core/conventions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGvD;;;;;;GAMG;AACH,MAAM,WAAW,UAAU;IACzB,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,K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AAE,WAAW,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAI9F"}
@@ -1,5 +1,6 @@
1
1
  import { readdir, readFile } from 'node:fs/promises';
2
2
  import path from 'node:path';
3
+ import { GENERIC_END_RE, GENERIC_START_RE } from './fs/fenced-region.js';
3
4
  import { parseNoteText } from './notes/parse.js';
4
5
  const HEADING_RE = /^#\s+(.+)$/m;
5
6
  /** The skill-layout filename: `<slug>/SKILL.md` — what harnesses with skill auto-discovery read. */
@@ -27,8 +28,48 @@ export function extractDocMetadata(raw, relativePath) {
27
28
  (heading && heading.length > 0 ? heading : undefined) ??
28
29
  fallback,
29
30
  description: typeof fmDescription === 'string' && fmDescription.length > 0 ? fmDescription : null,
31
+ body,
30
32
  };
31
33
  }
34
+ const ATX_HEADING_RE = /^(#{1,6})(\s+.*)$/;
35
+ /**
36
+ * inline-conventions-and-mission: renders a scanned doc's body for inlining
37
+ * into a generated `AGENTS.md` section — a leading `# <title>` heading
38
+ * dropped when it duplicates the section heading the caller already
39
+ * provides, every remaining ATX heading demoted by `headingOffset` levels
40
+ * (capped at H6), and any nested `contexture:<region>` fence marker line
41
+ * stripped (its body kept, only the marker comment removed) so a fence
42
+ * copied out of a source file — e.g. mission.md's own rollup fence — never
43
+ * leaves an orphaned marker inside AGENTS.md's fence.
44
+ */
45
+ export function inlineDocBody(doc, headingOffset) {
46
+ const lines = doc.body.split('\n');
47
+ let start = 0;
48
+ while (start < lines.length && lines[start].trim() === '')
49
+ start += 1;
50
+ const firstHeading = start < lines.length ? ATX_HEADING_RE.exec(lines[start]) : null;
51
+ if (firstHeading && firstHeading[1].length === 1 && firstHeading[2].trim().toLowerCase() === doc.title.trim().toLowerCase()) {
52
+ start += 1;
53
+ while (start < lines.length && lines[start].trim() === '')
54
+ start += 1;
55
+ }
56
+ const out = [];
57
+ for (const line of lines.slice(start)) {
58
+ if (GENERIC_START_RE.test(line) || GENERIC_END_RE.test(line))
59
+ continue;
60
+ const heading = ATX_HEADING_RE.exec(line);
61
+ if (heading) {
62
+ const level = Math.min(heading[1].length + headingOffset, 6);
63
+ out.push(`${'#'.repeat(level)}${heading[2]}`);
64
+ }
65
+ else {
66
+ out.push(line);
67
+ }
68
+ }
69
+ while (out.length > 0 && out[out.length - 1].trim() === '')
70
+ out.pop();
71
+ return out;
72
+ }
32
73
  export async function scanDocsDir(root, dirRelativePath) {
33
74
  const dir = path.join(root, dirRelativePath);
34
75
  let entries;
@@ -66,8 +107,29 @@ export async function scanDocsDir(root, dirRelativePath) {
66
107
  }
67
108
  return docs;
68
109
  }
69
- /** Every operator convention doc currently at the configured path. */
70
- export function scanConventions(root, config) {
71
- return scanDocsDir(root, config.harness.conventions_path);
110
+ /**
111
+ * compose-store-guidance-documents: the mission document, when configured,
112
+ * commonly lives in the same guidance directory as convention files (its
113
+ * shipped default is `<guidance_path>/mission.md`) but is never itself a
114
+ * convention — it already gets its own "Mission" section
115
+ * (inline-conventions-and-mission's `renderMissionSection`). Excluded by
116
+ * basename so inlining conventions never double-renders it.
117
+ */
118
+ function reservedGuidanceFileNames(config) {
119
+ const names = new Set();
120
+ if (config.organize.mission_path)
121
+ names.add(path.basename(config.organize.mission_path));
122
+ return names;
123
+ }
124
+ /**
125
+ * Every convention doc currently at the configured guidance path —
126
+ * contexture's own shipped baseline (see `templates/conventions/baseline-conventions.md`,
127
+ * synced by `syncBaselineConventions` in `convention-doc.ts`) alongside
128
+ * whatever the operator has added — minus the mission document.
129
+ */
130
+ export async function scanConventions(root, config) {
131
+ const docs = await scanDocsDir(root, config.harness.guidance_path);
132
+ const reserved = reservedGuidanceFileNames(config);
133
+ return docs.filter((doc) => !reserved.has(path.basename(doc.path)));
72
134
  }
73
135
  //# sourceMappingURL=conventions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"conventions.js","sourceRoot":"","sources":["../../src/core/conventions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,IAAI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AC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC;IACzF,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,IAAY,EAAE,MAAmB;IACrE,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IACnE,MAAM,QAAQ,GAAG,yBAAyB,CAAC,MAAM,CAAC,CAAC;IACnD,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACtE,CAAC"}
@@ -1,6 +1,9 @@
1
1
  import type { StoreConfig } from '../../config/schema.js';
2
+ import { ExitCode } from '../exit-codes.js';
2
3
  import type { Note } from '../notes/list.js';
3
4
  export type DisclosureVerdict = 'allow' | 'deny' | 'ask';
5
+ /** disclosure-policy spec: each tri-state verdict's own distinct, documented exit code — defined once for every caller (single-note or aggregate). */
6
+ export declare const VERDICT_EXIT_CODE: Record<DisclosureVerdict, ExitCode>;
4
7
  export type DisclosureRung = 'hard_wall' | 'explicit_tag' | 'internal_visibility' | 'external_default';
5
8
  export interface DisclosureResult {
6
9
  verdict: DisclosureVerdict;
@@ -15,4 +18,12 @@ export interface DisclosureResult {
15
18
  * external verdict is never derived from visibility alone.
16
19
  */
17
20
  export declare function evaluateDisclosure(config: StoreConfig, note: Note, audience: string): DisclosureResult;
21
+ /**
22
+ * disclosure-policy spec: a set of verdicts aggregates to its most
23
+ * restrictive member — DENY outranks ASK, which outranks ALLOW. An empty
24
+ * set aggregates to ALLOW; callers that need to distinguish "nothing was
25
+ * evaluated" from "everything was evaluated and allowed" report the set's
26
+ * size separately, per the publish spec's empty-set scenario.
27
+ */
28
+ export declare function worstVerdict(verdicts: readonly DisclosureVerdict[]): DisclosureVerdict;
18
29
  //# sourceMappingURL=model.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/core/disclosure/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAG7C,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC;AAEzD,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,cAAc,GAAG,qBAAqB,GAAG,kBAAkB,CAAC;AAEvG,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,iBAAiB,CAAC;IAC3B,IAAI,EAAE,cAAc,CAAC;CACtB;AAoBD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,gBAAgB,CAkBtG"}
1
+ {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/core/disclosure/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAG7C,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC;AAEzD,sJAAsJ;AACtJ,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,iBAAiB,EAAE,QAAQ,CAIjE,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,cAAc,GAAG,qBAAqB,GAAG,kBAAkB,CAAC;AAEvG,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,iBAAiB,CAAC;IAC3B,IAAI,EAAE,cAAc,CAAC;CACtB;AAoBD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,gBAAgB,CAkBtG;AAKD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,SAAS,iBAAiB,EAAE,GAAG,iBAAiB,CAMtF"}
@@ -1,4 +1,11 @@
1
+ import { ExitCode } from '../exit-codes.js';
1
2
  import { canSee, resolveVisibility } from '../notes/visibility.js';
3
+ /** disclosure-policy spec: each tri-state verdict's own distinct, documented exit code — defined once for every caller (single-note or aggregate). */
4
+ export const VERDICT_EXIT_CODE = {
5
+ allow: ExitCode.Ok,
6
+ deny: ExitCode.DisclosureDeny,
7
+ ask: ExitCode.DisclosureAsk,
8
+ };
2
9
  /**
3
10
  * The frontmatter key a note uses to explicitly declare which audiences may
4
11
  * see it disclosed (rung 2). Unlike the visibility field (context-store
@@ -42,4 +49,21 @@ export function evaluateDisclosure(config, note, audience) {
42
49
  }
43
50
  return { verdict: 'ask', rung: 'external_default' };
44
51
  }
52
+ /** disclosure-policy spec: most-restrictive-member ordering, defined once for reuse by any caller batching verdicts across a set of notes. */
53
+ const VERDICT_RESTRICTIVENESS = { deny: 2, ask: 1, allow: 0 };
54
+ /**
55
+ * disclosure-policy spec: a set of verdicts aggregates to its most
56
+ * restrictive member — DENY outranks ASK, which outranks ALLOW. An empty
57
+ * set aggregates to ALLOW; callers that need to distinguish "nothing was
58
+ * evaluated" from "everything was evaluated and allowed" report the set's
59
+ * size separately, per the publish spec's empty-set scenario.
60
+ */
61
+ export function worstVerdict(verdicts) {
62
+ let worst = 'allow';
63
+ for (const verdict of verdicts) {
64
+ if (VERDICT_RESTRICTIVENESS[verdict] > VERDICT_RESTRICTIVENESS[worst])
65
+ worst = verdict;
66
+ }
67
+ return worst;
68
+ }
45
69
  //# sourceMappingURL=model.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"model.js","source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KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,qBAAqB,EAAE,CAAC;IAC/G,CAAC;IAED,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC;AACtD,CAAC;AAED,8IAA8I;AAC9I,MAAM,uBAAuB,GAAsC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AAEjG;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,QAAsC;IACjE,IAAI,KAAK,GAAsB,OAAO,CAAC;IACvC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,IAAI,uBAAuB,CAAC,OAAO,CAAC,GAAG,uBAAuB,CAAC,KAAK,CAAC;YAAE,KAAK,GAAG,OAAO,CAAC;IACzF,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -36,47 +36,6 @@ export declare class InvalidConfigError extends ContextureError {
36
36
  export declare class InvalidNoteFrontmatterError extends ContextureError {
37
37
  constructor(notePath: string, detail: string);
38
38
  }
39
- export declare class SessionNotFoundError extends ContextureError {
40
- constructor(branch: string);
41
- }
42
- export declare class SessionValidationFailedError extends ContextureError {
43
- constructor(findings: Finding[]);
44
- }
45
- /**
46
- * write-lifecycle spec: `session.workspaces_external: true` marks a store
47
- * whose worktrees are created/removed by a process outside `ctxr` — `ctxr
48
- * session reap` refuses before inspecting or modifying any worktree, rather
49
- * than reclaiming something it does not own.
50
- */
51
- export declare class SessionReapWorkspacesExternalError extends ContextureError {
52
- constructor();
53
- }
54
- export declare class NoRemoteConfiguredError extends ContextureError {
55
- constructor();
56
- }
57
- /** session-submit-and-land spec (D1): the gate fails loud, before any forge read, when nothing can consent to a merge. */
58
- export declare class SessionLandConsentRequiredError extends ContextureError {
59
- constructor();
60
- }
61
- export declare class SessionLandOnDefaultBranchError extends ContextureError {
62
- constructor(branch: string);
63
- }
64
- export declare class NoForgeConfiguredError extends ContextureError {
65
- constructor();
66
- }
67
- export declare class PullRequestHeadMismatchError extends ContextureError {
68
- constructor(requested: string, actual: string);
69
- }
70
- export declare class PullRequestClosedError extends ContextureError {
71
- constructor(number: number);
72
- }
73
- /** session-submit-and-land spec (D1): conflicting AND unknown-after-one-retry share this stop — both need a reader, not a retry. */
74
- export declare class PullRequestNotMergeableError extends ContextureError {
75
- constructor(number: number, reason: 'conflicting' | 'unknown');
76
- }
77
- export declare class MergeNotConfirmedError extends ContextureError {
78
- constructor(number: number);
79
- }
80
39
  /**
81
40
  * session-capture-command spec (D2): a proposal file that cannot even be
82
41
  * read or parsed fails the whole command — there is nothing to apply item
@@ -146,4 +105,31 @@ export declare class InvalidTaxonomyFileError extends ContextureError {
146
105
  export declare class UnknownTaxonomyProfileError extends ContextureError {
147
106
  constructor(given: string, knownIds: readonly string[]);
148
107
  }
108
+ /** vendored-craft-skills spec: `--harness` names a harness this release does not ship an adapter for. */
109
+ export declare class UnknownHarnessError extends ContextureError {
110
+ constructor(given: string, knownIds: readonly string[]);
111
+ }
112
+ /** publish spec: `ctxr publish gather` accepts exactly one subject selector. */
113
+ export declare class PublishSelectorRequiredError extends ContextureError {
114
+ constructor();
115
+ }
116
+ export declare class PublishSelectorConflictError extends ContextureError {
117
+ constructor(given: readonly string[]);
118
+ }
119
+ /** publish spec: the disclosure gate requires knowing the requesting audience, same as `ctxr check`. */
120
+ export declare class PublishAudienceRequiredError extends ContextureError {
121
+ constructor();
122
+ }
123
+ /** publish spec: a living page's slug must not collide with the reserved dated-snapshot naming pattern. */
124
+ export declare class PublishReservedSlugError extends ContextureError {
125
+ constructor(slug: string);
126
+ }
127
+ /** publish spec: a page folder is never silently overwritten. */
128
+ export declare class PublishSlugExistsError extends ContextureError {
129
+ constructor(slug: string, relativePath: string);
130
+ }
131
+ /** publish spec: `ctxr publish check` needs a page's index.html to exist before it can check anything. */
132
+ export declare class PublishPageNotFoundError extends ContextureError {
133
+ constructor(relativePath: string);
134
+ }
149
135
  //# sourceMappingURL=errors.d.ts.map