@miadi/inquiry-weave 0.7.0 → 0.8.1

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 (62) hide show
  1. package/README.md +159 -188
  2. package/dist/artefact.d.ts +8 -0
  3. package/dist/artefact.d.ts.map +1 -1
  4. package/dist/artefact.js +18 -2
  5. package/dist/artefact.js.map +1 -1
  6. package/dist/bin.js +0 -0
  7. package/dist/chronicle-dsl.d.ts +191 -0
  8. package/dist/chronicle-dsl.d.ts.map +1 -0
  9. package/dist/chronicle-dsl.js +327 -0
  10. package/dist/chronicle-dsl.js.map +1 -0
  11. package/dist/chronicle-terminal.d.ts +305 -0
  12. package/dist/chronicle-terminal.d.ts.map +1 -0
  13. package/dist/chronicle-terminal.js +449 -0
  14. package/dist/chronicle-terminal.js.map +1 -0
  15. package/dist/cli.d.ts.map +1 -1
  16. package/dist/cli.js +335 -34
  17. package/dist/cli.js.map +1 -1
  18. package/dist/env.d.ts +1 -3
  19. package/dist/env.d.ts.map +1 -1
  20. package/dist/env.js +4 -5
  21. package/dist/env.js.map +1 -1
  22. package/dist/index.d.ts +2 -1
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +2 -1
  25. package/dist/index.js.map +1 -1
  26. package/dist/issue-content.d.ts +2 -0
  27. package/dist/issue-content.d.ts.map +1 -0
  28. package/dist/issue-content.js +45 -0
  29. package/dist/issue-content.js.map +1 -0
  30. package/dist/issue-ref.d.ts +10 -0
  31. package/dist/issue-ref.d.ts.map +1 -0
  32. package/dist/issue-ref.js +20 -0
  33. package/dist/issue-ref.js.map +1 -0
  34. package/dist/issue.d.ts +2 -11
  35. package/dist/issue.d.ts.map +1 -1
  36. package/dist/issue.js +6 -34
  37. package/dist/issue.js.map +1 -1
  38. package/dist/mcp-server.js +0 -0
  39. package/dist/register.d.ts +1 -1
  40. package/dist/register.d.ts.map +1 -1
  41. package/dist/relate.d.ts +1 -3
  42. package/dist/relate.d.ts.map +1 -1
  43. package/dist/relate.js +1 -12
  44. package/dist/relate.js.map +1 -1
  45. package/dist/skill.d.ts.map +1 -1
  46. package/dist/skill.js +8 -2
  47. package/dist/skill.js.map +1 -1
  48. package/dist/terminal-install.d.ts +84 -0
  49. package/dist/terminal-install.d.ts.map +1 -0
  50. package/dist/terminal-install.js +306 -0
  51. package/dist/terminal-install.js.map +1 -0
  52. package/dist/weave.d.ts +0 -2
  53. package/dist/weave.d.ts.map +1 -1
  54. package/dist/weave.js +0 -2
  55. package/dist/weave.js.map +1 -1
  56. package/package.json +11 -9
  57. package/rispecs/medicine-wheel-registration.spec.md +1 -4
  58. package/LICENSE +0 -21
  59. package/dist/legacy-hch.d.ts +0 -28
  60. package/dist/legacy-hch.d.ts.map +0 -1
  61. package/dist/legacy-hch.js +0 -120
  62. package/dist/legacy-hch.js.map +0 -1
package/README.md CHANGED
@@ -1,237 +1,208 @@
1
1
  # @miadi/inquiry-weave
2
2
 
3
- Relate and sync three identities of one inquiry — and never write the inquiry itself.
3
+ `inquiry-weave` keeps three identities in relation:
4
4
 
5
- ```
6
- ┌────────────────────────────┐ inquire (vessel + issue) ┌──────────────────────┐
7
- │ Inquiry artefact │ ◄─────────────────────────── │ Chronicle episode │
8
- │ $MIADI_INQUIRY_ROOT/<dir> │ │ <chronicle>/<date>- │
9
- │ (IAIP tree — │ ───────────────────────────► │ episode-NNN-<slug>/ │
10
- │ system-of-record) │ promote / sync (mirror) │ inquiry/<dir>/ │
11
- └─────────────┬──────────────┘ └──────────┬───────────┘
12
- │ │
13
- │ ┌────────────────────────┐ │
14
- └──────────► │ GitHub issue │ ◄────────────────┘
15
- .weave.yaml│ owner/repo#N │ inquiry/weave.yaml
16
- └────────────────────────┘
17
- ```
18
-
19
- ## The three identities (worked example: ep126 / #245)
20
-
21
- | Identity | Example |
22
- |---|---|
23
- | Inquiry artefact | `/src/IAIP/prototypes/artefacts/ep126-mila-ai-event-260715-b08218a8-…` |
24
- | GitHub issue | `miadisabelle/Etuaptmumk-RSM#245` |
25
- | Chronicle episode | `…/miadi-chronicle/2026-07-13-episode-126-mila-ai-indigenous-gathering/` |
5
+ - an inquiry artefact in the IAIP artefact shelf;
6
+ - its GitHub issue;
7
+ - the Chronicle episode that carries it.
26
8
 
27
- This package generalizes the manual prior art (`<episode>/inquiry/_sync.sh`, a one-way tar
28
- copy) into a repeatable workflow: `relate`, `promote`, `inquire`, `sync`, `status`.
9
+ It creates issues with the portable `gh` CLI, records both shores of the
10
+ relation, syncs the artefact into the episode, and registers the weave. It does
11
+ not depend on private host scripts or private cache folders.
29
12
 
30
- ## The mystery boundary
13
+ ## Install
31
14
 
32
- **The package never generates inquiry content.** Creating an inquiry's substance — the
33
- question, the search, the listening — is human work and stays that way. `inquire` creates
34
- only the *vessel*: a named empty directory, its GitHub issue, and the relation metadata.
35
- This boundary is enforced by an executable test (the vessel must contain relation
36
- metadata only).
37
-
38
- ## CLI
39
-
40
- ```
41
- inquiry-weave relate --artefact <name|path> --episode <num|name|path> [--issue owner/repo#N]
42
- inquiry-weave promote --artefact <name|path> (--episode <ref> | --new-episode <slug> [--title <t>])
43
- inquiry-weave inquire --episode <ref> --slug <slug> [--title <t>] [--repo owner/repo] [--no-issue]
44
- inquiry-weave sync (--artefact <ref> [--episode <ref>] | --episode <ref> [--all])
45
- inquiry-weave status (--episode <ref> | --artefact <ref>) [--json]
46
- inquiry-weave register (--episode <ref> | --artefact <ref>) [--dry-run]
47
- inquiry-weave lineage --from <ref> --to <ref> --relation <text> [--kind …] [--reverse]
48
- inquiry-weave catalog [--chronicle-root <dir>] [--series <name>] [--json]
49
- inquiry-weave stories [--stories-root <dir>] [--json]
15
+ ```bash
16
+ npm install -g @miadi/inquiry-weave passages
17
+ gh auth status
50
18
  ```
51
19
 
52
- Global flags: `--inquiry-root`, `--chronicle-root`, `--stories-root`, `--repo`, `--mw-url`,
53
- `--dry-run`, `--json`.
54
- Exit codes: `0` ok, `1` operational error, `2` usage/resolution error (ambiguous episode
55
- numbers list their candidates — duplicates exist in the wild).
20
+ `passages` owns canonical episode birth through `mkepisode`. `inquiry-weave`
21
+ owns issue/artefact/episode relation and offers a compatibility episode
22
+ scaffold for combined one-command inquiry flows.
56
23
 
57
- `--dry-run` is **global**: every mutating command (`relate`, `promote`, `inquire`, `sync`,
58
- `register`) previews its plan and returns exit 0 without writing to the IAIP tree,
59
- the chronicle, GitHub, or medicine-wheel. The projected plan matches the live output
60
- apart from its prefix (`would <verb>:` on relation lines, `dry-run:` on sync lines), and
61
- — like a live run — a standalone `sync` still refuses an artefact that is not related to
62
- the episode. Fixed in v0.4.1 — prior to v0.4.1, `inquire`/`relate`/`promote` mutated real
63
- state during a dry run. v0.4.2 restores the not-related guard on `sync --dry-run` (only
64
- `promote` previews an as-yet-unpersisted relation).
65
-
66
- ## The two catalogs
67
-
68
- `catalog` and `stories` expose the package's two read-models — the same manifests
69
- `app/chronicle` renders — so a person can ask what exists without reading TypeScript.
70
- Both are read-only: they walk a root and print, and write nothing anywhere.
24
+ ## Environment
71
25
 
72
- ```
73
- $ inquiry-weave stories
74
- stories: /home/mia/Documents/Twine/Stories
75
- 14 on the shelf · 4 episode(s) indexed · 4 carrying no episode number
76
- 131 html Episode 131 _ Every Device_ One Song.html
77
- 44 directory Episode-044-Decompose-and-Begin-Again
78
- -- html the-room-lent-it-ears.html
79
- …
80
- episodes: 40(1) 44(2) 131(3) 311(4)
26
+ ```bash
27
+ export MIADI_CHRONICLE_ROOT=/srv/miadi/episodes/miadi-chronicle
28
+ export MIADI_INQUIRY_DIR=/a/src/IAIP/prototypes/artefacts
29
+ export MIADI_INQUIRY_GITHUB_REPO=miadisabelle/Etuaptmumk-RSM
30
+ export MW_API_URL="${MW_API_URL:-${MIADI_CHRONICLE_MW_URL:-http://127.0.0.1:8040}}"
81
31
  ```
82
32
 
83
- The `--` rows are the finding, not noise: `linkStoryForms` attaches a story to an episode
84
- by the number parsed from its name, so a story carrying none is reachable from no episode
85
- room. The count is printed on its own line for exactly that reason.
33
+ | Flag | Environment |
34
+ | --- | --- |
35
+ | `--chronicle-root` | `MIADI_CHRONICLE_ROOT` |
36
+ | `--inquiry-root` | `MIADI_INQUIRY_DIR` |
37
+ | `--repo` | `MIADI_INQUIRY_GITHUB_REPO` |
38
+ | `--mw-url` | `MW_API_URL` |
39
+ | `--stories-root` | `MIADI_STORIES_ROOT` |
86
40
 
87
- `catalog` prints the chronicle the same way — episode number, `yaml` (structured) or
88
- `name` (the older `script.md` era), folder, title — followed by the manifest's diagnostics
89
- (`episode-number-collision`, `unsafe-artifact-path`, …) as `note:` lines.
41
+ `MIADI_INQUIRY_ROOT`, `INQUIRY_ROOT`, and `MIADI_INQUIRY_REPO` remain fallback
42
+ aliases for older environments.
90
43
 
91
- **Ownership.** `@miadi/episodic-memory-schema` declares the chronicle→book edge
92
- (`StoryManifestEntry`, `linkStoryForms`, `EpisodeManifestEntry.stories`); this package
93
- *enumerates* it (`buildStoryLibraryCatalog`) and relates it. It never authors a story —
94
- deriving a book from a vessel belongs to `packages/passages`.
44
+ ## Create an issue and weave the current folder
95
45
 
96
- ## Environment
46
+ From an existing inquiry artefact:
47
+
48
+ ```bash
49
+ cd "$MIADI_INQUIRY_DIR/ep133-honcho-eval"
97
50
 
98
- | Variable | Fallback chain | Default |
99
- |---|---|---|
100
- | `MIADI_INQUIRY_ROOT` | → `INQUIRY_ROOT` | `/src/IAIP/prototypes/artefacts` |
101
- | `MIADI_CHRONICLE_ROOT` | — | `/srv/miadi/episodes/miadi-chronicle` |
102
- | `MIADI_STORIES_ROOT` | — | `/home/mia/Documents/Twine/Stories` |
103
- | `MIADI_INQUIRY_REPO` | — | `miadisabelle/Etuaptmumk-RSM` |
104
- | `INQUIRY_WEAVE_ISSUE_LIB` | → `/a/src/scripts/fn_github_issue.sh` → `/src/scripts/fn_github_issue.sh` | — |
105
- | `MW_API_URL` | — | `http://127.0.0.1:8040` |
51
+ inquiry-weave inquire \
52
+ --artefact . \
53
+ --episode 133 \
54
+ --title "Honcho evaluation inquiry"
55
+ ```
106
56
 
107
- ## Metadata contract
57
+ This creates the issue in `MIADI_INQUIRY_GITHUB_REPO`, writes its identity to
58
+ `.weave.yaml`, writes the matching relation to
59
+ `<episode>/inquiry/weave.yaml`, and adds the episode backlink to `AGENTS.md`.
60
+ Before those writes, an unprefixed folder is renamed to
61
+ `ep<episode-number>-<existing-folder-name>`. The prefix is mandatory once the
62
+ episode identity is known; a destination collision stops the command.
63
+ By default, the artefact's Markdown, text, YAML, and JSON documents become the
64
+ issue body. Generated weave metadata, `AGENTS.md`, hidden directories, and
65
+ binary files are excluded. Use `--body <text>` or `--body-file <path>` to
66
+ override that derived body.
67
+
68
+ ## Create a new inquiry vessel and issue
69
+
70
+ ```bash
71
+ inquiry-weave inquire \
72
+ --slug honcho-eval \
73
+ --episode 133 \
74
+ --title "Honcho evaluation inquiry"
75
+ ```
108
76
 
109
- `weave.yaml` / `.weave.yaml` — written and owned by this package — is the authoritative
110
- record of the relation. Sync state lives episode-side only, so the artefact-side file can
111
- be mirrored verbatim without a self-invalidating hash loop.
77
+ The new directory is named `ep<NNN>-<slug>-<YYMMDD>-<uuid>` beneath
78
+ `MIADI_INQUIRY_DIR`. It begins with relation metadata only; inquiry content is
79
+ written afterward by the people and practices conducting the inquiry.
112
80
 
113
- **Episode side, `<episode>/inquiry/weave.yaml`:**
81
+ ## Create the issue and a new episode together
114
82
 
115
- ```yaml
116
- weave: 1
117
- episode:
118
- number: 126
119
- slug: mila-ai-indigenous-gathering
120
- path: 2026-07-13-episode-126-mila-ai-indigenous-gathering
121
- inquiries:
122
- - artefact: ep126-mila-ai-event-260715-b08218a8-0441-4596-a16e-47483d3ab57c
123
- issue: miadisabelle/Etuaptmumk-RSM#245
124
- issue_url: https://github.com/miadisabelle/Etuaptmumk-RSM/issues/245
125
- related_at: 2026-07-15T00:00:00.000Z
126
- last_sync:
127
- at: 2026-07-15T00:00:00.000Z
128
- tree_sha256: <sha256 of the sorted relpath:filehash:size manifest>
129
- file_count: 4
130
- bytes_total: 341001
131
- ```
83
+ Use an existing artefact:
132
84
 
133
- **Artefact side, `<artefact>/.weave.yaml`:**
134
-
135
- ```yaml
136
- weave: 1
137
- artefact: ep126-mila-ai-event-260715-b08218a8-0441-4596-a16e-47483d3ab57c
138
- issue: miadisabelle/Etuaptmumk-RSM#245
139
- issue_url: https://github.com/miadisabelle/Etuaptmumk-RSM/issues/245
140
- episodes:
141
- - path: 2026-07-13-episode-126-mila-ai-indigenous-gathering
142
- number: 126
143
- related_at: 2026-07-15T00:00:00.000Z
85
+ ```bash
86
+ inquiry-weave inquire \
87
+ --artefact . \
88
+ --new-episode honcho-eval-adequate-memories \
89
+ --title "Honcho evaluation inquiry"
144
90
  ```
145
91
 
146
- `relate` also appends the ep090-style back-link into the artefact's `AGENTS.md`
147
- (episode path + `related issue owner/repo#N`) — append-if-missing, never overwriting.
148
-
149
- ### `.hch/` is legacy input — and an open decision
92
+ Or create the artefact vessel, issue, episode, and weave in one command:
150
93
 
151
- `.hch/` (the issue-harness cache written by `fn_github_issue.sh` and its predecessors) is
152
- read **best-effort, once**, to seed `.weave.yaml` when relating a pre-existing artefact.
153
- Tolerated shapes: the correct `issue_<N>.env`, the V2-era bug shape (literal `issue_.env`
154
- with no `issue_url`), and the newest `issue_add__*.json` as fallback. This package never
155
- writes `.hch`.
94
+ ```bash
95
+ inquiry-weave inquire \
96
+ --slug honcho-eval \
97
+ --new-episode honcho-eval-adequate-memories \
98
+ --title "Honcho evaluation inquiry"
99
+ ```
156
100
 
157
- **Open decision (deliberately not settled in v0):** does `.hch` get (a) formalized as a
158
- shared contract across tools, (b) kept as `fn_github_issue.sh`'s private cache and mapped
159
- into `.weave.yaml` at relate time — v0's de-facto behavior — or (c) retired? v0 is
160
- compatible with all three outcomes.
101
+ Both combined forms also sync the artefact snapshot into the new episode. When
102
+ `MW_API_URL` (or `--mw-url`) is present, the command registers the episode card
103
+ and writes its `.mw-registration.json` receipt in the same run.
161
104
 
162
- ## IAIP is the external system-of-record
105
+ The combined form uses inquiry-weave's compatibility scaffold. For a fully
106
+ governed episode with an explicit goal and references, create it first with
107
+ `mkepisode`, then use `inquire --episode`:
163
108
 
164
- The inquiry root lives in the IAIP tree (a checkout of `miadisabelle/Etuaptmumk-RSM`).
165
- Sync is one-way (artefact → episode): the episode copy is a snapshot, deletions
166
- propagate, and local edits to the copy are flagged as `episode-copy-diverged` before
167
- being overwritten.
109
+ ```bash
110
+ mkepisode \
111
+ -n 133 \
112
+ -t "honcho eval adequate memories" \
113
+ -g "Establish adequate memories for the honcho evaluation." \
114
+ -r "jgwill/Miadi#133"
115
+ ```
168
116
 
169
- **Deployment API evaluation note:** the deployment evaluated for this exposed only
170
- `/api/articles` and `/api/articles/seed` (which read `prototypes/artefacts` markdown into
171
- Redis) — there is no inquiry CRUD. It is a documented future interface; **v0 has no
172
- dependency on it**, so no host is named here: the URL belongs to a deployment, not to the
173
- package, and hard-coding one into a published README ships someone's infrastructure to
174
- everybody who installs it. Set `INQUIRY_WEAVE_API_URL` if a future version needs it.
117
+ ## Weave an issue that already exists
175
118
 
176
- **Deferred decision, explicitly named:** absorbing IAIP into Miadi packages is out of
177
- scope and not planned here.
119
+ ```bash
120
+ inquiry-weave relate \
121
+ --artefact "$MIADI_INQUIRY_DIR/ep133-honcho-eval" \
122
+ --episode 133 \
123
+ --issue jgwill/Miadi#133
124
+ ```
178
125
 
179
- ## GitHub issues via fn_github_issue.sh
126
+ To weave the artefact and its already-recorded issue into a newly scaffolded
127
+ episode:
180
128
 
181
- `inquire` delegates issue creation to the sourced `issue_add` function of
182
- `fn_github_issue.sh` (a `gh` CLI wrapper), invoked with cwd = the artefact directory and
183
- an explicit `owner/repo`. The created identity is parsed from stdout (`* owner/repo#N`)
184
- and recorded straight into `.weave.yaml`. Issue title convention: the artefact's absolute
185
- path (as with #245). `--no-issue` skips creation.
129
+ ```bash
130
+ inquiry-weave promote \
131
+ --artefact "$MIADI_INQUIRY_DIR/ep133-honcho-eval" \
132
+ --new-episode honcho-eval-adequate-memories
133
+ ```
186
134
 
187
- ## Medicine-wheel registration & forgewright visibility
135
+ ## Sync, inspect, and register
188
136
 
189
- `inquiry-weave register` (v0.2) projects each woven relation into medicine-wheel:
190
- `POST {MW_API_URL}/api/inquiry-weaves`, upsert key
191
- `inquiry-weave:<episode.path>:<artefact.id>`. Registration moves metadata only —
192
- weave files on disk stay authoritative; an unreachable medicine-wheel reports and
193
- exits `1` without touching them. Forgewright renders the registered weaves in its
194
- episode views. The contract lives in the RISE specs:
137
+ ```bash
138
+ inquiry-weave sync --episode 133 --all
139
+ inquiry-weave status --episode 133
140
+ inquiry-weave register --episode 133
141
+ ```
195
142
 
196
- - `rispecs/medicine-wheel-registration.spec.md` (this package)
197
- - `medicine-wheel:rispecs/inquiry-weave-registration.spec.md`
198
- - `forgewright:rispecs/09-inquiry-weave-visibility.spec.md` (branch `4-plan-episode-visibility`)
143
+ Sync is one-way from the IAIP artefact to the episode snapshot. The source
144
+ artefact remains authoritative. Registration projects relation metadata to the
145
+ Chronicle medicine wheel; it does not move inquiry content.
146
+
147
+ `--dry-run` previews mutating commands without filesystem, GitHub, or
148
+ medicine-wheel writes. `--no-issue` creates or relates the artefact without
149
+ opening GitHub.
150
+
151
+ ## Command surface
152
+
153
+ ```text
154
+ inquiry-weave inquire (--episode <ref> | --new-episode <slug>)
155
+ (--artefact <path> | --slug <new-artefact-slug>)
156
+ [--title <text>] [--body <text> | --body-file <path>]
157
+ [--repo owner/repo] [--no-issue]
158
+ inquiry-weave relate --artefact <path> --episode <ref> [--issue owner/repo#N]
159
+ inquiry-weave promote --artefact <path> (--episode <ref> | --new-episode <slug>)
160
+ inquiry-weave sync (--artefact <path> [--episode <ref>] | --episode <ref> --all)
161
+ inquiry-weave status (--episode <ref> | --artefact <path>) [--json]
162
+ inquiry-weave register (--episode <ref> | --artefact <path>) [--dry-run]
163
+ inquiry-weave lineage --from <ref> --to <ref> --relation <sentence>
164
+ [--kind continues-from|relates-to] [--reverse]
165
+ inquiry-weave catalog [--series <name>] [--json]
166
+ inquiry-weave stories [--stories-root <dir>] [--json]
167
+ inquiry-weave resolve <miadi-chronicle:...> [--verify] [--json]
168
+ ```
199
169
 
200
- ### Episode nodes — cards visible at birth (v0.3)
170
+ Exit codes are `0` success, `1` operational failure, and `2` usage or identity
171
+ resolution failure.
201
172
 
202
- The Chronicle UI hangs perspectives off **episode cards**; cards come from
203
- `/api/nodes` artifact references (`miadi.artifact-ref.v1`, kind
204
- `chronicle_episode`). `registerEpisodeNode(mwUrl, input)` registers that card:
205
- it preflights `GET /api/nodes/chronicle:<episode-dir-name>` (an existing card is
206
- `already-registered` success, never overwritten — medicine-wheel's POST upserts)
207
- and otherwise POSTs the ep137-proven record. Failure is fail-open: the outcome
208
- is `{ state: "registered" | "already-registered" | "pending", node_id, error? }`
209
- and the function never throws, so vessel creation can never fail because of
210
- registration (jgwill/Miadi#490).
173
+ ## Relation records
211
174
 
212
- ## Kinship with @miadi/passages
175
+ The artefact owns `.weave.yaml`; the episode owns `inquiry/weave.yaml`, which
176
+ also records sync hashes and counts. These files are authoritative. The
177
+ medicine wheel is their registered projection.
213
178
 
214
- Episode *creation* as a first-class command (`mkepisode -n 133 -t <slug> -g "<goal>"`)
215
- likely belongs to `packages/passages` ("Narrative Formulations for the Miadi Chronicle").
216
- This package keeps its `--new-episode` scaffolding inside one exported function
217
- (`scaffoldEpisode`) so passages can own creation later, and inquiry-weave consumes any
218
- pre-existing episode regardless of its creator.
179
+ ## Episode lineage
219
180
 
220
- ## Chronicle repo rule
181
+ ```bash
182
+ inquiry-weave lineage \
183
+ --from 132 \
184
+ --to 133 \
185
+ --kind relates-to \
186
+ --relation "The evaluation carries the prior memory contract into practice." \
187
+ --reverse \
188
+ --dry-run
189
+ ```
221
190
 
222
- All work in `miadi-chronicle/` is committed directly to `main` (per its `AGENTS.md`) —
223
- this package writes there only when you run it, and never commits anything itself.
191
+ Drop `--dry-run` to write both shores. The relation sentence must read
192
+ truthfully from both episode rooms.
224
193
 
225
194
  ## Development
226
195
 
227
- ```
196
+ ```bash
228
197
  pnpm --filter @miadi/inquiry-weave build
229
198
  pnpm --filter @miadi/inquiry-weave test
230
199
  ```
231
200
 
232
- Tests are fixture-based (`node --test` in temp roots), with no network and no real `gh`
233
- calls (`INQUIRY_WEAVE_ISSUE_LIB` injects a fake issue lib).
201
+ Tests use temporary roots and a fake `gh` executable. They make no network or
202
+ real GitHub calls.
234
203
 
235
204
  ---
236
- 🌸: A loom, not a pen — the weave holds artefact, issue, and episode in relation so none
237
- drifts from the others, while the question itself stays yours to ask.
205
+
206
+ 🌸 `passages` opens the governed episode vessel. `inquiry-weave` ties the
207
+ living inquiry, its issue, and that episode together without pretending they
208
+ are the same thing.
@@ -11,6 +11,14 @@ export interface ArtefactIdentity {
11
11
  }
12
12
  export declare class ArtefactResolutionError extends Error {
13
13
  }
14
+ export interface PrefixArtefactResult {
15
+ artefact: ArtefactIdentity;
16
+ renamedFrom?: string;
17
+ }
18
+ /** Give a prepared artefact its episode identity before issue/weave writes. */
19
+ export declare function ensureEpisodePrefix(artefact: ArtefactIdentity, episodeNumber: number, options?: {
20
+ dryRun?: boolean;
21
+ }): Promise<PrefixArtefactResult>;
14
22
  export declare function resolveArtefact(inquiryRoot: string, ref: string): ArtefactIdentity;
15
23
  export interface ArtefactNameParts {
16
24
  episodeNumber: number;
@@ -1 +1 @@
1
- {"version":3,"file":"artefact.d.ts","sourceRoot":"","sources":["../src/artefact.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,qBAAa,uBAAwB,SAAQ,KAAK;CAAG;AAErD,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAclF;AAED,MAAM,WAAW,iBAAiB;IAChC,aAAa,EAAE,MAAM,CAAA;IACrB,IAAI,EAAE,MAAM,CAAA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A;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,8EAA8E;AAC9E,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,CAIlE;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED,wBAAsB,cAAc,CAClC,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,gBAAgB,CAAC,CAU3B;AAED,MAAM,WAAW,aAAa;IAC5B,cAAc,EAAE,MAAM,CAAA;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAClC,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,aAAa,GACnB,OAAO,CAAC,OAAO,CAAC,CAUlB"}
package/dist/artefact.js CHANGED
@@ -5,12 +5,28 @@
5
5
  * directory and nothing else. The inquiry's substance is written by humans
6
6
  * (and their chosen ceremonies), never by this package.
7
7
  */
8
- import { appendFile, mkdir, readFile } from "node:fs/promises";
8
+ import { appendFile, mkdir, readFile, rename } from "node:fs/promises";
9
9
  import { existsSync, statSync } from "node:fs";
10
10
  import { randomUUID } from "node:crypto";
11
- import { basename, isAbsolute, join, resolve } from "node:path";
11
+ import { basename, dirname, isAbsolute, join, resolve } from "node:path";
12
12
  export class ArtefactResolutionError extends Error {
13
13
  }
14
+ /** Give a prepared artefact its episode identity before issue/weave writes. */
15
+ export async function ensureEpisodePrefix(artefact, episodeNumber, options = {}) {
16
+ if (/^ep\d+-/.test(artefact.name))
17
+ return { artefact };
18
+ const targetName = `ep${episodeNumber}-${artefact.name}`;
19
+ const targetDir = join(dirname(artefact.dir), targetName);
20
+ if (existsSync(targetDir)) {
21
+ throw new ArtefactResolutionError(`cannot prefix artefact: destination already exists: ${targetDir}`);
22
+ }
23
+ if (!options.dryRun)
24
+ await rename(artefact.dir, targetDir);
25
+ return {
26
+ artefact: { name: targetName, dir: targetDir },
27
+ renamedFrom: artefact.dir,
28
+ };
29
+ }
14
30
  export function resolveArtefact(inquiryRoot, ref) {
15
31
  const trimmed = ref.trim().replace(/\/+$/, "");
16
32
  const candidates = [
@@ -1 +1 @@
1
- {"version":3,"file":"artefact.js","sourceRoot":"","sources":["../src/artefact.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC9D,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAO/D,MAAM,OAAO,uBAAwB,SAAQ,KAAK;CAAG;AAErD,MAAM,UAAU,eAAe,CAAC,WAAmB,EAAE,GAAW;IAC9D,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;IAC9C,MAAM,UAAU,GAAG;QACjB,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC;QAC1B,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;KACjD,CAAA;IACD,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,IAAI,UAAU,CAAC,SAAS,CAAC,IAAI,QAAQ,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;YAC/D,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,CAAA;QACtD,CAAC;IACH,CAAC;IACD,MAAM,IAAI,uBAA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