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,24 +1,38 @@
1
1
  The land half of the session lifecycle, after review. `ctxr-submit` is the other half; `ctxr-session-lifecycle`
2
2
  covers what surrounds both and is not repeated here.
3
3
 
4
- 1. Name the target — `--branch <name>` or `--pr <n>` — rather than letting it fall back to the current
5
- checkout: the checkout you are standing in is as likely to be the canonical clone on
4
+ 1. Name the target explicitly — a branch name or a pull-request number — rather than relying on whichever
5
+ checkout you happen to be standing in: that checkout is as likely to be the canonical clone on
6
6
  `__DEFAULT_BRANCH__`, which has no session to infer, as the session itself. Never land
7
7
  `__DEFAULT_BRANCH__` itself; a pull request whose head is `__DEFAULT_BRANCH__` is refused too.
8
- 2. Run `ctxr session land` (add `--yes` only when you already have explicit approval from elsewhere in
9
- this conversation; otherwise let it prompt). It reads the pull request's state, gates the merge behind
10
- an explicit confirmation, merges with `--merge-method` (default squash), confirms the forge reports
11
- merged, and fast-forwards `__DEFAULT_BRANCH__` in the store's canonical clone — whichever checkout you
12
- ran it from, including a session worktree. A clone on another branch or one that cannot fast-forward
13
- is reported, never forced.
14
- 3. Conflicting or unknown mergeability stops the command; follow `ctxr-session-lifecycle`'s conflict
15
- playbook, then retry — a retry re-reads state and performs only what remains.
16
- 4. Add `--reap` to remove the session worktree in the same run, once it is clean and merged — and run it
17
- from outside that worktree, since no command can remove the directory it is running from (`git worktree
18
- list` names the canonical clone first). Otherwise run `ctxr session reap` afterward, or leave cleanup to
19
- whoever owns the worktree.
20
- 5. Report exactly what the command reported — merged or not, synced or not (with why not), reaped or not
21
- (with why not). Never claim a merge or a cleanup the command itself did not confirm.
8
+ 2. Read state before any side effect: `gh pr view <target> --json number,url,title,state,mergeable,headRefName`.
9
+ Refuse if the head branch is `__DEFAULT_BRANCH__`, or if the target you named doesn't match the head
10
+ branch this reports. A closed pull request stops here — report it, do nothing further.
11
+ 3. Check mergeability. `MERGEABLE` proceeds to the gate below. `UNKNOWN` re-queries once (`gh pr view`
12
+ again) before treating it as still unknown. `CONFLICTING` or still-`UNKNOWN` after the re-query stops
13
+ the command — follow `ctxr-session-lifecycle`'s conflict playbook, then retry from step 1; a retry
14
+ re-reads state and performs only what remains.
15
+ 4. Gate: merging is an external side effect, and plan consent is not fire consent. Present the pull
16
+ request's number, title, and url; wait for an explicit go (already having explicit approval from
17
+ elsewhere in this conversation satisfies this — don't ask twice).
18
+ 5. Merge: `gh pr merge <number> --squash` (or `--merge` / `--rebase` if the operator asked for a different
19
+ method). Then re-read state (`gh pr view` again) to confirm the forge reports `MERGED` — never claim a
20
+ merge from the merge command's exit code alone; a transport error can arrive after the merge already
21
+ succeeded.
22
+ 6. Synchronize the default branch in the store's canonical clone — the repository's main worktree, not
23
+ necessarily the checkout you're running this from. From the canonical clone: `git fetch origin` then
24
+ `git merge --ff-only origin/__DEFAULT_BRANCH__`. If that clone is on another branch, or the fast-forward
25
+ fails (diverged from origin), report exactly that and stop — never check it out, reset it, or force the
26
+ merge to make it comply.
27
+ 7. Reclaim the worktree: see `ctxr-session-lifecycle`'s Reclaiming section (`ctxr session list` to scope,
28
+ then `git worktree remove` / `git branch -d`) — run it from outside the worktree being removed. This is
29
+ the default action, not an optional extra: nothing sweeps up afterward, so a worktree left here is left
30
+ indefinitely. Skip it only for a reason you can name — you are standing inside it, it is not yours to
31
+ reclaim, or the operator asked you to leave it — and report that reason in step 8.
32
+ 8. Report exactly what happened — merged or not, synced or not (with why not), reclaimed or not (with why
33
+ not). Never claim a merge or a cleanup you did not confirm yourself.
22
34
 
23
- Never merge by hand (a raw forge-CLI merge, the forge's web UI on this agent's behalf): `ctxr session land`
24
- is the only merge path, so every landing leaves the same audit trail and passes through the same gate.
35
+ Merging with `gh pr merge` (step 5) is the mechanism, not a shortcut around one: the pull request and its
36
+ merge commit are the audit trail. What step 4's gate protects against is merging without having actually
37
+ read the state in steps 2-3 first, or without an explicit go — never skip the read, the mergeability check,
38
+ or the confirmation to save a round trip.
@@ -1,7 +1,7 @@
1
1
  1. Run `ctxr lint` for the full health report — orphan notes, broken links, uningested inbox material,
2
2
  catalog gaps. It always exits 0; its findings are observations for judgment, never a block.
3
3
  2. Run `ctxr doctor` for the invariants that DO block: catalog coverage, fail-closed visibility, hook
4
- health, and more. Address doctor's failures before `ctxr session submit`; it runs the same checks.
4
+ health, and more. Address doctor's failures before `ctxr-submit`; it runs the same checks.
5
5
 
6
6
  ## Placement review
7
7
 
@@ -0,0 +1,79 @@
1
+ Turn store content into a shareable HTML page for a subject — a store subtree, a single note, a
2
+ concept whose sources aren't co-located, or everything a named context admits. The gate below is the
3
+ one step no convention can enforce by itself; everything else here is a decision procedure, not a
4
+ mechanism.
5
+
6
+ ## 1. Does this earn a page over a note?
7
+
8
+ Reach for a page when the reader needs to compare options side by side, see spatial structure, manipulate
9
+ something, navigate non-linearly, or share a link — and the store's own notes genuinely can't. A page
10
+ costs several times the effort of the markdown it's drawn from; don't build one to restate a note in a
11
+ different font. If a note would do the job, the note is the deliverable.
12
+
13
+ ## 2. Name the subject, let the selector produce the set
14
+
15
+ `ctxr publish gather` resolves a subject to its source notes — never a hand-picked list, which is how a
16
+ walled note slips in unnoticed:
17
+
18
+ - `--under <prefix>` — a store subtree
19
+ - `--note <path>` — a single note
20
+ - `--entity <name>` — every note linking to a concept, the same enumeration `ctxr rollup gather` uses
21
+ - `--as <context>` — everything a named context can see
22
+
23
+ ## 3. Gate before copying anything out
24
+
25
+ `ctxr publish gather --audience <audience>` evaluates every resolved note through the same tri-state
26
+ disclosure verdict `ctxr check` uses, and reports the worst verdict in the set. Run it FIRST, before
27
+ reading a single note for content:
28
+
29
+ - **DENY** notes contribute nothing — not a title, not a count, not a paraphrase.
30
+ - **ASK** stops the build; name the note to the operator and wait.
31
+ - Only **ALLOW** content may be quoted or summarized into the page.
32
+
33
+ Never infer a verdict from a note's resolved visibility on your own — an external audience's verdict
34
+ requires an explicit tag or a human answer, not an inference from how widely a note is already visible.
35
+
36
+ ## 4. Fix the identity once
37
+
38
+ `ctxr publish new <slug>` creates the page's folder. A slug starting with a date (`YYYY-` or
39
+ `YYYY-MM-DD-`) is reserved for a frozen snapshot — never used for a page you intend to keep updating.
40
+ The command refuses to overwrite an existing folder; if one already exists for this subject, edit its
41
+ files directly rather than re-running `publish new` — a rename or an overwrite breaks any link already
42
+ handed out.
43
+
44
+ ## 5. Choose the form, then delegate the craft
45
+
46
+ Pick the shape the content actually needs — a status board, a timeline, a side-by-side comparison, an
47
+ explainer with a live demo — not a rendering of the source notes in reading order. Contexture ships no
48
+ renderer of its own: for visual direction, load the `frontend-design` skill this store carries by
49
+ default (or whichever design-focused skill it's configured or installed instead), and follow it for the
50
+ actual HTML, CSS, and visual language. If a sibling page already exists, read its stylesheet and
51
+ inherit its palette and type scale before inventing a new one.
52
+
53
+ ## 6. Verify the output invariants
54
+
55
+ `ctxr publish check <path>` runs the mechanical half of the checklist — no external network address,
56
+ a viewport meta tag, at least one print rule, a provenance line, a sibling README, balanced tags, and
57
+ valid syntax in every embedded script. It exits non-zero naming every failing check; fix all of them
58
+ before reporting the page as ready. It answers only what's derivable from the file itself — the DO-test
59
+ in step 1, the form choice in step 5, and factual accuracy stay judgment calls, not checker output.
60
+
61
+ ## 7. It's a page, not a note
62
+
63
+ The published-pages location is excluded from retrieval by default — a page never becomes a source for
64
+ anything else the store retrieves, and it never carries the visibility field (that would falsely signal
65
+ it's indexed). Confirm with `ctxr lint` after landing.
66
+
67
+ ## 8. Provenance and drift
68
+
69
+ The source notes are the fact of record. When a fact changes, change the note first, then the page —
70
+ and grep the page for every place that fact was echoed (a summary line, a total, a status badge) before
71
+ declaring the update done; a page that repeats a number in three places goes stale in all three if only
72
+ one is touched.
73
+
74
+ ## 9. Landing
75
+
76
+ A page's files are ordinary tracked content — they land via `ctxr-submit` like any other change. If a
77
+ change also touches a derived artifact in the sense `ctxr-derived-artifacts` covers (catalog, graph,
78
+ generated document sections), follow that skill's check-before-build discipline for those separately;
79
+ a published page is authored content, not something `ctxr-derived-artifacts` rebuilds.
@@ -1,6 +1,11 @@
1
1
  End-of-session capture: propose what the session produced that is durable, write only what is approved.
2
2
  The approval gate is what keeps the blast radius low — nothing is written without it.
3
3
 
4
+ A session produces durable material in two shapes, and they go to different places: a **fact** about
5
+ what happened is a note; a **rule** for how future work should go is a convention, and belongs in this
6
+ store's house conventions at `__HOUSE_CONVENTIONS_PATH__`, which is inlined into AGENTS.md and so loads
7
+ at the start of every session. One pass proposes both.
8
+
4
9
  ## When
5
10
 
6
11
  Fires on the user's own closing utterance ("done", "ship it", "that's all", a sign-off) or an explicit
@@ -25,6 +30,29 @@ scratch work that landed on no decision.
25
30
 
26
31
  Unsure → propose (the user can decline).
27
32
 
33
+ ## What is a convention
34
+
35
+ A convention is a rule for future work. The test that separates it from a note: a note records that
36
+ something happened, a convention changes what happens next. "We chose Postgres, because X" is a note.
37
+ "Name migrations with the date first, because they sort" is a convention.
38
+
39
+ The default answer is NO — a store that gains a convention every session ends with a bloated,
40
+ self-contradicting document nobody reads. Propose one only when all four hold:
41
+
42
+ - It is a rule for future work, not a fact about past work.
43
+ - It applied more than once, or the user stated it as a correction.
44
+ - It is store-wide. A rule about one folder belongs in that folder's `README.md`, not here.
45
+ - It is not already in the shipped baseline — read that file first. Restating contexture's own
46
+ behavior as a house rule is the most likely way to get this wrong.
47
+
48
+ Propose REMOVALS on the same bar: a convention the session contradicted, or that no longer matches how
49
+ work actually goes, is worse than none — it teaches the next agent something false. The inlined section
50
+ also has a hard ceiling (`harness.convention_max_bytes`), so growth-only is not a maintenance strategy.
51
+
52
+ Each entry states the rule, why it exists, and how to apply it. The Why is not decoration: without the
53
+ observation that earned it, no future reader can tell whether a rule still holds or whether a one-off
54
+ calcified, so it never gets retired.
55
+
28
56
  ## Proposal — ONE message, empty proposal omitted
29
57
 
30
58
  ```
@@ -32,6 +60,12 @@ Unsure → propose (the user can decline).
32
60
  - A1 path: <layer>/<location>/<Title>.md
33
61
  visibility: <value> — <one-line rationale; `ctxr note resolve` on a sibling shows the default>
34
62
  sketch: bullets
63
+
64
+ ### House conventions
65
+ - C1 add · <section> — <the rule, as an imperative>
66
+ why: <what goes wrong without it — the observation this session produced>
67
+ apply: <what to do concretely>
68
+ - C2 remove · <the rule, quoted> — <what contradicted it>
35
69
  ```
36
70
 
37
71
  Secret-marker pass: any item whose content looks like a credential gets `⚠ suspected-secret:` on its
@@ -59,7 +93,16 @@ Then run `ctxr session capture --proposal <file>`. It validates and writes every
59
93
  one bad path never blocks the rest. These note commits ride the session pull request
60
94
  (`ctxr-session-lifecycle`).
61
95
 
96
+ Approved conventions are a direct edit to `__HOUSE_CONVENTIONS_PATH__`, never the YAML above: `ctxr
97
+ session capture` writes NOTES — it takes a path, a visibility, and a body, and stamps the visibility
98
+ field — and a guidance file is not a note and carries no visibility. Edit it under the matching
99
+ section, then run `ctxr update` so AGENTS.md re-inlines it, and stage BOTH in the same commit: a staged
100
+ guidance change without a matching staged AGENTS.md regeneration fails `doctor --staged` and the
101
+ pre-commit hook refuses it. If the file does not exist yet (a store migrated in from before it was
102
+ seeded), say so in the proposal and create it with the approved entries — never unasked.
103
+
62
104
  ## Report from actual writes
63
105
 
64
106
  Report exactly what the command reported — wrote / appended / refused (with reason) / skipped, by ID —
65
- never from the proposal itself. A refused item is surfaced prominently with its reason.
107
+ never from the proposal itself. A refused item is surfaced prominently with its reason. For conventions,
108
+ report the section each entry landed in or was removed from, and that `ctxr update` re-inlined them.
@@ -35,4 +35,23 @@ time regardless — sequence those.
35
35
 
36
36
  ## Reclaiming
37
37
 
38
- __RECLAIMING_STEP__
38
+ Scope with `ctxr session list` — it reports every worktree and branch this store recognizes as a session,
39
+ whichever checkout you run it from. Reclaiming is always an explicit go, never automatic; never claim a
40
+ worktree or branch was removed without having run the command yourself.
41
+
42
+ Establish that the pull request actually merged before removing anything, and get that from the forge —
43
+ `gh pr view <branch> --json state` reporting `MERGED` — not from git. If the store squash-merges (GitHub's
44
+ default), the squashed commit is not the branch's tip, so git's ancestry test calls a landed branch
45
+ unmerged forever: `git log <default>..<branch>` never empties and `git branch -d` never succeeds. Reading
46
+ a refusal there as "unmerged work" strands every session the store has ever landed.
47
+
48
+ With `MERGED` confirmed: `git worktree remove <path>`, then `git branch -d <branch>` — run from outside
49
+ that worktree (no command can remove the directory it is running from — `git worktree list` names the
50
+ canonical clone first). Leave the worktree removal unforced: it refuses on uncommitted work, and that
51
+ refusal is real, so stop and look rather than reaching for `--force`. If `git branch -d` refuses on a
52
+ pull request the forge says is merged, that is the squash case above, and `git branch -D` is the correct
53
+ finish — the forge, not the ancestry graph, is what established the work is safe.
54
+
55
+ To deliberately discard a session instead — abandoning unmerged work — `git worktree remove --force <path>`
56
+ then `git branch -D <branch>`. State plainly, before running it, that this destroys any uncommitted or
57
+ unmerged work in that worktree; it needs its own explicit go, distinct from the merged-and-clean case above.
@@ -13,14 +13,18 @@ a session, the conflict playbook, sequencing several pull requests) and is not r
13
13
  staged set matches the intended unit. Derived artifacts under the cache paths never stage.
14
14
  4. One coherent unit per pull request. If the session produced two disjoint units, say so and ask
15
15
  whether to split.
16
- 5. Fire gate: `ctxr session submit` commits, pushes, and opens the pull request — an external side
17
- effect, and plan consent is not fire consent. Present the branch, the title, and what rides it; wait
18
- for an explicit go before running it.
19
- 6. Run: `ctxr session submit --branch "<name>" --title "<title>" --body "<why / what changed /
20
- verification / follow-ups>"`. Name a real branch with `--branch` — never let a generated name reach
21
- the forge. It runs the full store validation first; fix a failure, never bypass it. If no forge is
22
- reachable it still pushes and prints the manual pull-request instructions.
23
- 7. Verify before any retry: a transport error can arrive AFTER the push or the pull-request open already
24
- succeeded. Before retrying anything, `git ls-remote origin <branch>` and the forge's pull-request list
25
- for the branch — never replay a push or a pull-request open blindly.
26
- 8. Hand off: report the pull request, then point at `ctxr-land` for after review.
16
+ 5. Validate: run `ctxr doctor` (store scope, not `--staged` — a session's job is to leave the whole store
17
+ healthy, not merely pass one commit's gate). Fix a failure; never bypass it, and never proceed past it.
18
+ 6. Commit: `git commit -m "<message>"`, describing the unit staged in step 3.
19
+ 7. Name the branch: if it still carries a generated name, `git branch -m "<name>"` before pushing — never
20
+ let a generated name reach the forge.
21
+ 8. Run: `git push -u origin "<branch>"`, then `gh pr create --base __DEFAULT_BRANCH__ --title "<title>" --body
22
+ "<why / what changed / verification / follow-ups>"`. Do not stop to confirm first — the request to
23
+ submit is the consent for both, and `ctxr doctor` in step 5 is the gate on this path. If `gh` has no
24
+ reachable GitHub remote for this repository, `git push` still succeeds on its own — report the pushed
25
+ branch and give the operator the manual pull-request instructions instead of retrying `gh`.
26
+ 9. Verify before any retry: a transport error can arrive AFTER the push or the pull-request open already
27
+ succeeded. Before retrying anything, `git ls-remote origin <branch>` and `gh pr list --head <branch>` —
28
+ never replay a push or a pull-request open blindly.
29
+ 10. Hand off: report the pull request, then point at `ctxr-land` for after review — landing is a separate
30
+ decision and keeps its own explicit confirmation.
@@ -0,0 +1,177 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,55 @@
1
+ ---
2
+ name: frontend-design
3
+ description: Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.
4
+ license: Complete terms in LICENSE.txt
5
+ ---
6
+
7
+ # Frontend Design
8
+
9
+ Approach this as the design lead at a small studio known for giving every client a visual identity that could not be mistaken for anyone else's. This client has already rejected proposals that felt templated, and is paying for a distinctive point of view: make deliberate, opinionated choices about palette, typography, and layout that are specific to this brief, and take one real aesthetic risk you can justify.
10
+
11
+ ## Ground it in the subject
12
+
13
+ If the brief does not pin down what the product or subject is, pin it yourself before designing: name one concrete subject, its audience, and the page's single job, and state your choice. If there's any information in your memory about the human's preferences, context about what they're building, or designs you've made before – use that as a hint. The subject's own world, its materials, instruments, artifacts, and vernacular, is where distinctive choices come from. Build with the brief's real content and subject matter throughout.
14
+
15
+ ## Design principles
16
+
17
+ For web designs, the hero is a thesis. Open with the most characteristic thing in the subject's world, in whatever form makes sense for it: a headline, an image, an animation, a live demo, an interactive moment. Be deliberate with your choice: a big number with a small label, supporting stats, and a gradient accent is the template answer, only use if that's truly the best option.
18
+
19
+ Typography carries the personality of the page. Pair the display and body faces deliberately, not the same families you would reach for on any other project, and set a clear type scale with intentional weights, widths, and spacing. Make the type treatment itself a memorable part of the design, not a neutral delivery vehicle for the content.
20
+
21
+ Structure is information. Structural devices, numbering, eyebrows, dividers, labels, should encode something true about the content, not decorate it. Many generic designs use numbered markers (01 / 02 / 03), but that's only appropriate if the content actually is a sequence - like a real process or a typed timeline where order carries information the reader needs. Question if choices like numbered markers actually make sense before incorporating them.
22
+
23
+ Leverage motion deliberately. Think about where and if animation can serve the subject: a page-load sequence, a scroll-triggered reveal, hover micro-interactions, ambient atmosphere. An orchestrated moment usually lands harder than scattered effects; choose what the direction calls for. However, sometimes less is more, and extra animation contributes to the feeling that the design is AI-generated.
24
+
25
+ Match complexity to the vision. Maximalist directions need elaborate execution; minimal directions need precision in spacing, type, and detail. Elegance is executing the chosen vision well.
26
+
27
+ Consider written content carefully. Often a design brief may not contain real content, and it's up to you to come up with copy. Copy can make a design feel as templated as the design itself. See the below section on writing for more guidance.
28
+
29
+ ## Process: brainstorm, explore, plan, critique, build, critique again
30
+
31
+ For calibration: AI-generated design right now clusters around three looks: (1) a warm cream background (near #F4F1EA) with a high-contrast serif display and a terracotta accent; (2) a near-black background with a single bright acid-green or vermilion accent; (3) a broadsheet-style layout with hairline rules, zero border-radius, and dense newspaper-like columns. All three are legitimate for some briefs, but they are defaults rather than choices, and they appear regardless of subject. Where the brief pins down a visual direction, follow it exactly — the brief's own words always win, including when it asks for one of these looks. Where it leaves an axis free, don't spend that freedom on one of these defaults. Just like a human designer who's hired, there's often a careful balance between doing what you're good at and taking each project as a chance to experiment and learn.
32
+
33
+ Work in two passes. First, brainstorm a short design plan based on the human's design brief: create a compact token system with color, type, layout, and signature. Color: describe the palette as 4–6 named hex values. Type: the typefaces for 2+ roles (a characterful display face that's used with restraint, a complementary body face, and a utility face for captions or data if needed). Layout: a layout concept, using one-sentence prose descriptions and ASCII wireframes to ideate and compare. Signature: the single unique element this page will be remembered by that embodies the brief in an appropriate way.
34
+
35
+ Then review that plan against the brief before building: if any part of it reads like the generic default you would produce for any similar page (work through a similar prompt to see if you arrive somewhere similar) rather than a choice made for this specific brief — revise that part, say what you changed and why. Only after you've confirmed the relative uniqueness of your design plan should you start to write the code, following the revised plan exactly and deriving every color and type decision from it.
36
+
37
+ When writing the code, be careful of structuring your CSS selector specificities. It's easy to generate CSS classes that cancel each other out (especially with a type-based selector like .section and a element-based selector like .cta). This can happen often with paddings/margins between sections.
38
+
39
+ Try to do a lot of this planning and iteration in your thinking, and only show ideas to the user when you have higher confidence it'll delight them.
40
+
41
+ ## Restraint and self-critique
42
+
43
+ Spend your boldness in one place. Let the signature element be the one memorable thing, keep everything around it quiet and disciplined, and cut any decoration that does not serve the brief. Not taking a risk can be a risk itself! Build to a quality floor without announcing it: responsive down to mobile, visible keyboard focus, reduced motion respected. Critique your own work as you build, taking screenshots if your environment supports it – a picture is worth 1000 tokens. Consider Chanel's advice: before leaving the house, take a look in the mirror and remove one accessory. Human creators have memory and always try to do something new, so if you have a space to quickly jot down notes about what you've tried, it can help you in future passes.
44
+
45
+ ## More on writing in design
46
+
47
+ Words appear in a design for one reason: to make it easier to understand, and therefore easier to use. They are design material, not decoration. Bring the same intentionality to copy that you would bring to spacing and color. Before writing anything, ask what the design needs to say, and how it can best be said to help the person navigate the experience.
48
+
49
+ Write from the end user's side of the screen. Name things by what people control and recognize, never by how the system is built. A person manages notifications, not webhook config. Describe what something does in plain terms rather than selling it. Being specific is always better than being clever.
50
+
51
+ Use active voice as default. A control should say exactly what happens when it's used: "Save changes," not "Submit." An action keeps the same name through the whole flow, so the button that says "Publish" produces a toast that says "Published." The vocabulary of an interface is the signposting for someone navigating the product. Cohesion and consistency are how people learn their way around.
52
+
53
+ Treat failure and emptiness as moments for direction, not mood. Explain what went wrong and how to fix it, in the interface's voice rather than a person's. Errors don't apologize, and they are never vague about what happened. An empty screen is an invitation to act.
54
+
55
+ Keep the register conversational and tuned: plain verbs, sentence case, no filler, with tone matched to the brand and the audience. Let each element do exactly one job. A label labels, an example demonstrates, and nothing quietly does double duty.
@@ -0,0 +1,7 @@
1
+ {
2
+ "source": "anthropics/skills",
3
+ "subpath": "skills/frontend-design",
4
+ "ref": "53048666b05b4799081517d00e09e0a2dd688678",
5
+ "license": "Apache-2.0",
6
+ "sha256": "1608ea77fbb6fc30d13a97d12cfa8ebf31358d40f0dd97beed24829d6b3f45dd"
7
+ }
@@ -1,12 +0,0 @@
1
- import type { ForgeAdapter, PullRequestLifecycleState, PullRequestMergeability } from './types.js';
2
- /** GitHub's own vocabulary, normalized to the adapter interface's small unions — kept pure and exported so tests exercise the mapping without a subprocess. */
3
- export declare function mapPullRequestState(ghState: string): PullRequestLifecycleState;
4
- export declare function mapMergeability(ghMergeable: string): PullRequestMergeability;
5
- /**
6
- * The reference forge adapter, shelling out to `gh` (same tool, same
7
- * pattern as `git` itself) rather than a token-based REST client — simpler
8
- * to implement correctly, and consistent with how every other git-adjacent
9
- * operation in this codebase is invoked.
10
- */
11
- export declare const githubForgeAdapter: ForgeAdapter;
12
- //# sourceMappingURL=github.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../../src/adapters/forge/github.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,yBAAyB,EAAE,uBAAuB,EAAoB,MAAM,YAAY,CAAC;AAMrH,+JAA+J;AAC/J,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,yBAAyB,CAW9E;AAED,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,uBAAuB,CAW5E;AAWD;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,EAAE,YAkDhC,CAAC"}
@@ -1,76 +0,0 @@
1
- import { execFile } from 'node:child_process';
2
- import { promisify } from 'node:util';
3
- const execFileAsync = promisify(execFile);
4
- const PR_NUMBER_RE = /\/pull\/(\d+)/;
5
- /** GitHub's own vocabulary, normalized to the adapter interface's small unions — kept pure and exported so tests exercise the mapping without a subprocess. */
6
- export function mapPullRequestState(ghState) {
7
- switch (ghState) {
8
- case 'OPEN':
9
- return 'open';
10
- case 'MERGED':
11
- return 'merged';
12
- case 'CLOSED':
13
- return 'closed';
14
- default:
15
- throw new Error(`Internal error: unrecognized GitHub pull request state "${ghState}".`);
16
- }
17
- }
18
- export function mapMergeability(ghMergeable) {
19
- switch (ghMergeable) {
20
- case 'MERGEABLE':
21
- return 'mergeable';
22
- case 'CONFLICTING':
23
- return 'conflicting';
24
- case 'UNKNOWN':
25
- return 'unknown';
26
- default:
27
- throw new Error(`Internal error: unrecognized GitHub mergeable status "${ghMergeable}".`);
28
- }
29
- }
30
- /**
31
- * The reference forge adapter, shelling out to `gh` (same tool, same
32
- * pattern as `git` itself) rather than a token-based REST client — simpler
33
- * to implement correctly, and consistent with how every other git-adjacent
34
- * operation in this codebase is invoked.
35
- */
36
- export const githubForgeAdapter = {
37
- id: 'github',
38
- kind: 'forge',
39
- interfaceVersion: 2,
40
- async isAvailable(cwd) {
41
- try {
42
- // `gh auth status` alone only proves SOME host has stored credentials —
43
- // it says nothing about whether THIS repo's remote is even a GitHub
44
- // remote. `gh repo view` fails unless the current repo's remote
45
- // resolves to a real, reachable GitHub repository, which is the
46
- // actual question `session submit` needs answered.
47
- await execFileAsync('gh', ['repo', 'view'], { cwd });
48
- return true;
49
- }
50
- catch {
51
- return false;
52
- }
53
- },
54
- async openPullRequest(input) {
55
- const { stdout } = await execFileAsync('gh', ['pr', 'create', '--head', input.branch, '--base', input.baseBranch, '--title', input.title, '--body', input.body], { cwd: input.cwd });
56
- const url = stdout.trim();
57
- const match = PR_NUMBER_RE.exec(url);
58
- return { url, number: match?.[1] ? Number(match[1]) : null };
59
- },
60
- async pullRequest(cwd, ref) {
61
- const { stdout } = await execFileAsync('gh', ['pr', 'view', ref, '--json', 'number,url,title,state,mergeable,headRefName'], { cwd });
62
- const data = JSON.parse(stdout);
63
- return {
64
- number: data.number,
65
- url: data.url,
66
- title: data.title,
67
- state: mapPullRequestState(data.state),
68
- mergeable: mapMergeability(data.mergeable),
69
- headBranch: data.headRefName,
70
- };
71
- },
72
- async mergePullRequest(cwd, number, method) {
73
- await execFileAsync('gh', ['pr', 'merge', String(number), `--${method}`], { cwd });
74
- },
75
- };
76
- //# sourceMappingURL=github.js.map