@miadi/inquiry-weave 0.16.3 → 0.16.5

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.
package/README.md CHANGED
@@ -53,23 +53,33 @@ aliases for older environments.
53
53
  everywhere. `MW_API_URL_OVERRIDE` and `MW_API_URL` are legacy fallbacks, read
54
54
  only when it is unset.
55
55
 
56
- ## Give an inquiry folder its thread, before any episode
56
+ ## Words
57
+
58
+ - **artefact**: a folder on the shelf (`MIADI_INQUIRY_DIR`) where research is saved.
59
+ - **inquiry**: what an artefact pursues. It is followed in one GitHub **issue**,
60
+ recorded in the artefact's `.weave.yaml`.
61
+ - **weave**: make an artefact part of an episode. The episode keeps a copy under
62
+ `inquiry/<artefact>/`, both sides record the weave, and the wheel registers it.
63
+ `weave` (CLI), the episode door and the room's Inquiries card all do it. `relate`
64
+ is its first half (the records without the copy). `promote` is its older name.
65
+
66
+ ## Give an artefact its issue, before any episode
57
67
 
58
68
  ```bash
59
69
  cd "$MIADI_INQUIRY_DIR/a-question"
60
70
  inquiry-weave issue # --title, --body/--body-file, --repo, --dry-run
61
71
  ```
62
72
 
63
- Creates the GitHub issue the folder is followed in (its thread) in
64
- `MIADI_INQUIRY_GITHUB_REPO` and records it in the folder's `.weave.yaml` with no
65
- episode. When the folder is later attached to an episode (the room's Inquiries
66
- card, the door, or `relate`), the thread comes with it. A folder whose
73
+ Creates the GitHub issue the artefact's inquiry is followed in, in
74
+ `MIADI_INQUIRY_GITHUB_REPO`, and records it in the artefact's `.weave.yaml` with no
75
+ episode. When the artefact is later woven into an episode (the room's Inquiries
76
+ card, the door, `weave` or `relate`), the issue comes with it. An artefact whose
67
77
  `.weave.yaml` already names its issue is left as it is. `--issue owner/repo#N`
68
- records an issue that already exists. A folder whose `.hch/issue_<N>.env` (left by
78
+ records an issue that already exists. An artefact whose `.hch/issue_<N>.env` (left by
69
79
  `issue_add`) names an issue is refused with that issue named, so it is recorded with
70
80
  `--issue` rather than duplicated. `--force` creates another anyway.
71
81
 
72
- The thread is then read and answered by the folder alone, with no issue number:
82
+ The issue is then read and answered by the artefact alone, with no issue number:
73
83
 
74
84
  ```bash
75
85
  inquiry-weave issue view # title, state, body, comments, episodes woven
@@ -81,7 +91,7 @@ inquiry-weave issue comment --body "…" # or --body-file notes.md; --dry-
81
91
  | `issue_add "<title>" "<body>"` | `issue [--title] [--body]` | `.weave.yaml` `issue`, `issue_url` |
82
92
  | `issue_info <id>` / `iuit` | `issue view` | reads `.weave.yaml` |
83
93
  | `issue_comment <id> "<body>"` | `issue comment --body` | the comment on GitHub |
84
- | `iut`, `iutg` (all issues of a repo) | MCP `inquiry_list_threads` | the IAIP app at `MIADI_INQUIRY_THREADS_BASE` |
94
+ | `iut`, `iutg` (all issues of a repo) | MCP `inquiry_list_issues` | the IAIP app at `MIADI_INQUIRY_ISSUES_BASE` |
85
95
 
86
96
  The shell functions leave `.hch/` side files that no reader treats as a record.
87
97
 
@@ -258,13 +268,15 @@ the next authoring. `MIADI_EPISODE_DOOR=http` sends the MCP's episode tools
258
268
  through the app at `MIADI_INQUIRY_API_BASE` even on a host that holds the
259
269
  chronicle.
260
270
 
261
- ## Inquiry threads over MCP
271
+ ## Inquiry issues over MCP
262
272
 
263
- `inquiry_list_threads` and `inquiry_get_thread` read the threads (the GitHub issues an
264
- inquiry is followed in) from the app that serves `/api/inquiry`, the IAIP app. Set
265
- `MIADI_INQUIRY_THREADS_BASE` to it, for example `http://127.0.0.1:9946`. The episode tools
273
+ `inquiry_list_issues` and `inquiry_get_issue` read the GitHub issues inquiries are
274
+ followed in from the app that serves `/api/inquiry`, the IAIP app. Set
275
+ `MIADI_INQUIRY_ISSUES_BASE` to it, for example `http://127.0.0.1:9946`. The episode tools
266
276
  keep `MIADI_INQUIRY_API_BASE`, the Miadi episode door, which has no `/api/inquiry`. Without
267
- `MIADI_INQUIRY_THREADS_BASE` the threads tools fall back to `MIADI_INQUIRY_API_BASE`.
277
+ it the issue tools read `MIADI_INQUIRY_THREADS_BASE` (the 0.16.2 name), then
278
+ `MIADI_INQUIRY_API_BASE`. The 0.16.2 tool names `inquiry_list_threads` and
279
+ `inquiry_get_thread` still answer, unlisted.
268
280
 
269
281
  ## Reviews in an episode
270
282
 
@@ -0,0 +1,87 @@
1
+ /**
2
+ * An artefact's issue: the GitHub issue the inquiry an artefact pursues is
3
+ * followed in. (An artefact is a folder on the shelf; the inquiry is what it
4
+ * pursues. Vocabulary decided 2026-10-06: issue, weave, artefact.)
5
+ *
6
+ * `openArtefactIssue` creates that issue from the artefact and records it in
7
+ * the artefact's `.weave.yaml`, the record every reader of the weave uses: the
8
+ * episode room, the episode door, `status`, `relate`. It needs no episode.
9
+ * When the artefact is later woven into an episode, `relate` (and the door's
10
+ * weave or sync) carries the issue into the episode's `inquiry/weave.yaml`.
11
+ *
12
+ * `viewArtefactIssue` and `commentOnArtefactIssue` read and answer that issue
13
+ * by the artefact alone: the issue number comes from `.weave.yaml`.
14
+ *
15
+ * Together they do for an inquiry folder what `issue_add`, `issue_info` and
16
+ * `issue_comment` in fn_github_issue.sh did. Those leave `.hch/` side files,
17
+ * which nothing reads as a record. Ref: jgwill/Miadi#722.
18
+ */
19
+ import type { ArtefactIdentity } from "./artefact.js";
20
+ import { type IssueView } from "./issue.js";
21
+ export interface OpenArtefactIssueInput {
22
+ artefact: ArtefactIdentity;
23
+ /** owner/repo the issue is created in. */
24
+ repo: string;
25
+ /** Defaults to the artefact's absolute path, as `inquire` and `issue_add` title it. */
26
+ title?: string;
27
+ /** Defaults to the artefact's text documents (the body `inquire` derives). */
28
+ body?: string;
29
+ /** An issue that already exists (owner/repo#N): recorded, nothing is created. */
30
+ issue?: string;
31
+ /** Create even when a CLI side file names an issue for this artefact. */
32
+ force?: boolean;
33
+ dryRun?: boolean;
34
+ env?: NodeJS.ProcessEnv;
35
+ }
36
+ export interface OpenArtefactIssueResult {
37
+ artefact: string;
38
+ artefactDir: string;
39
+ /** `created`, `recorded` (an existing issue, given), `already-recorded` (nothing changed), or `dry-run`. */
40
+ status: "created" | "recorded" | "already-recorded" | "dry-run";
41
+ repo: string;
42
+ title: string;
43
+ issue?: string;
44
+ issue_url?: string;
45
+ bodyBytes?: number;
46
+ /** Episodes the artefact is already woven into; each still needs `relate` to carry the issue. */
47
+ episodes: Array<{
48
+ path: string;
49
+ number?: number;
50
+ }>;
51
+ dryRun: boolean;
52
+ }
53
+ export declare function openArtefactIssue(input: OpenArtefactIssueInput): Promise<OpenArtefactIssueResult>;
54
+ /** Issues that `.hch/issue_<N>.env` files (fn_github_issue.sh's issue_add) name, newest number first. */
55
+ export declare function issuesNamedBySideFiles(artefactDir: string): Promise<Array<{
56
+ issue: string;
57
+ file: string;
58
+ }>>;
59
+ export interface ArtefactIssueView {
60
+ artefact: string;
61
+ artefactDir: string;
62
+ issue: string;
63
+ episodes: Array<{
64
+ path: string;
65
+ number?: number;
66
+ }>;
67
+ view: IssueView;
68
+ }
69
+ export declare function viewArtefactIssue(artefact: ArtefactIdentity, env?: NodeJS.ProcessEnv): Promise<ArtefactIssueView>;
70
+ export interface ArtefactIssueComment {
71
+ artefact: string;
72
+ issue: string;
73
+ url?: string;
74
+ dryRun: boolean;
75
+ bodyBytes: number;
76
+ }
77
+ export declare function commentOnArtefactIssue(artefact: ArtefactIdentity, body: string, options?: {
78
+ dryRun?: boolean;
79
+ env?: NodeJS.ProcessEnv;
80
+ }): Promise<ArtefactIssueComment>;
81
+ /** @deprecated 0.16.2 names, before "thread" gave way to "issue" (2026-10-06). */
82
+ export declare const openArtefactThread: typeof openArtefactIssue;
83
+ /** @deprecated */
84
+ export declare const viewArtefactThread: typeof viewArtefactIssue;
85
+ /** @deprecated */
86
+ export declare const commentOnArtefactThread: typeof commentOnArtefactIssue;
87
+ //# sourceMappingURL=artefact-issue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artefact-issue.d.ts","sourceRoot":"","sources":["../src/artefact-issue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;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AAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAejH;AAaD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAClD,IAAI,EAAE,SAAS,CAAA;CAChB;AAED,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,gBAAgB,EAC1B,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,GACtB,OAAO,CAAC,iBAAiB,CAAC,CAU5B;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,OAAO,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,wBAAsB,sBAAsB,CAC1C,QAAQ,EAAE,gBAAgB,EAC1B,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAA;CAAO,GAC1D,OAAO,CAAC,oBAAoB,CAAC,CAO/B;AAED,kFAAkF;AAClF,eAAO,MAAM,kBAAkB,0BAAoB,CAAA;AACnD,kBAAkB;AAClB,eAAO,MAAM,kBAAkB,0BAAoB,CAAA;AACnD,kBAAkB;AAClB,eAAO,MAAM,uBAAuB,+BAAyB,CAAA"}
@@ -1,14 +1,16 @@
1
1
  /**
2
- * An inquiry's thread: the GitHub issue the inquiry is followed in.
2
+ * An artefact's issue: the GitHub issue the inquiry an artefact pursues is
3
+ * followed in. (An artefact is a folder on the shelf; the inquiry is what it
4
+ * pursues. Vocabulary decided 2026-10-06: issue, weave, artefact.)
3
5
  *
4
- * `openArtefactThread` creates that issue from the folder and records it in
5
- * the folder's `.weave.yaml`, the record every reader of the weave uses: the
6
+ * `openArtefactIssue` creates that issue from the artefact and records it in
7
+ * the artefact's `.weave.yaml`, the record every reader of the weave uses: the
6
8
  * episode room, the episode door, `status`, `relate`. It needs no episode.
7
- * When the folder is later woven into an episode, `relate` (and the door's
8
- * attach or sync) carries the thread into the episode's `inquiry/weave.yaml`.
9
+ * When the artefact is later woven into an episode, `relate` (and the door's
10
+ * weave or sync) carries the issue into the episode's `inquiry/weave.yaml`.
9
11
  *
10
- * `viewArtefactThread` and `commentOnArtefactThread` read and answer that
11
- * thread by the folder alone: the issue number comes from `.weave.yaml`.
12
+ * `viewArtefactIssue` and `commentOnArtefactIssue` read and answer that issue
13
+ * by the artefact alone: the issue number comes from `.weave.yaml`.
12
14
  *
13
15
  * Together they do for an inquiry folder what `issue_add`, `issue_info` and
14
16
  * `issue_comment` in fn_github_issue.sh did. Those leave `.hch/` side files,
@@ -20,7 +22,7 @@ import { formatIssueRef, issueRefFromUrl, issueUrlFromRef, parseIssueRef } from
20
22
  import { commentOnIssue, createIssue, viewIssue } from "./issue.js";
21
23
  import { issueBodyFromArtefact } from "./issue-content.js";
22
24
  import { newArtefactWeave, readArtefactWeave, writeArtefactWeave, WeaveError } from "./weave.js";
23
- export async function openArtefactThread(input) {
25
+ export async function openArtefactIssue(input) {
24
26
  const weave = await readArtefactWeave(input.artefact.dir);
25
27
  const title = input.title?.trim() || input.artefact.dir;
26
28
  const base = {
@@ -31,7 +33,7 @@ export async function openArtefactThread(input) {
31
33
  episodes: (weave?.episodes ?? []).map((e) => ({ path: e.path, number: e.number })),
32
34
  dryRun: input.dryRun === true,
33
35
  };
34
- // One folder, one thread: a recorded issue is never duplicated.
36
+ // One artefact, one issue: a recorded issue is never duplicated.
35
37
  if (weave?.issue) {
36
38
  return { ...base, status: "already-recorded", issue: weave.issue, issue_url: weave.issue_url };
37
39
  }
@@ -49,7 +51,7 @@ export async function openArtefactThread(input) {
49
51
  await writeArtefactWeave(input.artefact.dir, next);
50
52
  return { ...base, status: "recorded", issue, issue_url };
51
53
  }
52
- // A folder `issue_add` already gave an issue would get a second one.
54
+ // An artefact `issue_add` already gave an issue would get a second one.
53
55
  if (!input.force) {
54
56
  const named = await issuesNamedBySideFiles(input.artefact.dir);
55
57
  if (named.length > 0) {
@@ -88,33 +90,39 @@ export async function issuesNamedBySideFiles(artefactDir) {
88
90
  }
89
91
  return [...found.values()].sort((a, b) => b.number - a.number).map(({ issue, file }) => ({ issue, file }));
90
92
  }
91
- /** The thread a folder's .weave.yaml records, or a WeaveError that says how to give it one. */
92
- async function recordedThread(artefact) {
93
+ /** The issue an artefact's .weave.yaml records, or a WeaveError that says how to give it one. */
94
+ async function recordedIssue(artefact) {
93
95
  const weave = await readArtefactWeave(artefact.dir);
94
96
  if (!weave?.issue) {
95
- throw new WeaveError(`${artefact.name} has no thread recorded in .weave.yaml — run 'inquiry-weave issue' in the folder to create one`);
97
+ throw new WeaveError(`${artefact.name} has no issue recorded in .weave.yaml — run 'inquiry-weave issue' in the artefact to create one`);
96
98
  }
97
99
  return { weave, issue: weave.issue };
98
100
  }
99
- export async function viewArtefactThread(artefact, env) {
100
- const { weave, issue } = await recordedThread(artefact);
101
- const thread = await viewIssue(issue, { cwd: artefact.dir, env });
101
+ export async function viewArtefactIssue(artefact, env) {
102
+ const { weave, issue } = await recordedIssue(artefact);
103
+ const view = await viewIssue(issue, { cwd: artefact.dir, env });
102
104
  return {
103
105
  artefact: artefact.name,
104
106
  artefactDir: artefact.dir,
105
107
  issue,
106
108
  episodes: weave.episodes.map((e) => ({ path: e.path, number: e.number })),
107
- thread,
109
+ view,
108
110
  };
109
111
  }
110
- export async function commentOnArtefactThread(artefact, body, options = {}) {
112
+ export async function commentOnArtefactIssue(artefact, body, options = {}) {
111
113
  if (!body.trim())
112
114
  throw new WeaveError("a comment needs a body (--body or --body-file)");
113
- const { issue } = await recordedThread(artefact);
115
+ const { issue } = await recordedIssue(artefact);
114
116
  const base = { artefact: artefact.name, issue, dryRun: options.dryRun === true, bodyBytes: Buffer.byteLength(body, "utf8") };
115
117
  if (options.dryRun)
116
118
  return base;
117
119
  const posted = await commentOnIssue(issue, body, { cwd: artefact.dir, env: options.env });
118
120
  return { ...base, url: posted.url };
119
121
  }
120
- //# sourceMappingURL=thread.js.map
122
+ /** @deprecated 0.16.2 names, before "thread" gave way to "issue" (2026-10-06). */
123
+ export const openArtefactThread = openArtefactIssue;
124
+ /** @deprecated */
125
+ export const viewArtefactThread = viewArtefactIssue;
126
+ /** @deprecated */
127
+ export const commentOnArtefactThread = commentOnArtefactIssue;
128
+ //# sourceMappingURL=artefact-issue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artefact-issue.js","sourceRoot":"","sources":["../src/artefact-issue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAChG,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,SAAS,EAAkB,MAAM,YAAY,CAAA;AACnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAiChG,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,KAA6B;IACnE,MAAM,KAAK,GAAG,MAAM,iBAAiB,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;IACzD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAA;IACvD,MAAM,IA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AAClB,MAAM,CAAC,MAAM,uBAAuB,GAAG,sBAAsB,CAAA"}
@@ -12,7 +12,7 @@
12
12
  * schema's own observer, which is the single declaration of that shape, so
13
13
  * enumerating a bundle costs nothing more than reading its descriptor.
14
14
  */
15
- import { type CaptureManifestEntry, type CompatibilityDiagnostic } from "@miadi/episodic-memory-schema";
15
+ import { type CaptureManifestEntry, type CompatibilityDiagnostic, type ScreenwalkRecord } from "@miadi/episodic-memory-schema";
16
16
  /** The folder captures live under, inside an episode. */
17
17
  export declare const CAPTURES_FOLDER = "captures";
18
18
  export interface BuildCaptureIndexOptions {
@@ -38,4 +38,22 @@ export declare function readEpisodeCaptures(episodeDir: string, options?: BuildC
38
38
  */
39
39
  export declare function buildEpisodeCaptureIndex(chronicleRoot: string, options?: BuildCaptureIndexOptions): Promise<Map<string, CaptureManifestEntry[]>>;
40
40
  export type { CaptureManifestEntry };
41
+ /** A screenwalk as an episode holds it, with the file it was read from. */
42
+ export interface EpisodeScreenwalk {
43
+ record: ScreenwalkRecord;
44
+ /** `captures/screenwalk-<id>/screenwalk.json`, or the `capture.json` written there by hand before that file existed. */
45
+ relativePath: string;
46
+ /** True when the record was read from the early hand-written `capture.json`. */
47
+ early: boolean;
48
+ }
49
+ /**
50
+ * Every screenwalk under one episode directory (`captures/screenwalk-<id>/`), in folder order.
51
+ * `screenwalk.json` is read first; a folder that has only the early hand-written `capture.json`
52
+ * is read through the same reader and marked `early`. A folder whose file names no screenwalk
53
+ * is reported and skipped.
54
+ */
55
+ export declare function readEpisodeScreenwalks(episodeDir: string, options?: {
56
+ diagnostics?: CompatibilityDiagnostic[];
57
+ episode?: string;
58
+ }): Promise<EpisodeScreenwalk[]>;
41
59
  //# sourceMappingURL=captures.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"captures.d.ts","sourceRoot":"","sources":["../src/captures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH,OAAO,EAIL,KAAK,oBAAoB,EACzB,KAAK,uB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GAAG,CAAC,MAAM,EAAE,oBAAoB,EAAE,CAAC,CAAC,CAmB9C;AAED,YAAY,EAAE,oBAAoB,EAAE,CAAA;AAEpC,2EAA2E;AAC3E,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,gBAAgB,CAAA;IACxB,wHAAwH;IACxH,YAAY,EAAE,MAAM,CAAA;IACpB,gFAAgF;IAChF,KAAK,EAAE,OAAO,CAAA;CACf;AAED;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAC1C,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE;IAAE,WAAW,CAAC,EAAE,uBAAuB,EAAE,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAO,GAC1E,OAAO,CAAC,iBAAiB,EAAE,CAAC,CA6C9B"}
package/dist/captures.js CHANGED
@@ -14,7 +14,7 @@
14
14
  */
15
15
  import { readdir, readFile } from "node:fs/promises";
16
16
  import { join } from "node:path";
17
- import { EPISODE_CAPTURE_MANIFEST_FILENAME, captureManifestEntry, isEpisodeCaptureDescriptor, } from "@miadi/episodic-memory-schema";
17
+ import { EPISODE_CAPTURE_MANIFEST_FILENAME, SCREENWALK_FILE, SCREENWALK_FOLDER_PREFIX, captureManifestEntry, isEpisodeCaptureDescriptor, toScreenwalkRecord, } from "@miadi/episodic-memory-schema";
18
18
  /** The folder captures live under, inside an episode. */
19
19
  export const CAPTURES_FOLDER = "captures";
20
20
  /**
@@ -38,6 +38,9 @@ export async function readEpisodeCaptures(episodeDir, options = {}) {
38
38
  }
39
39
  const entries = [];
40
40
  for (const stem of stems) {
41
+ // A screenwalk folder holds a screenwalk record, not a capture bundle (readEpisodeScreenwalks).
42
+ if (stem.startsWith(SCREENWALK_FOLDER_PREFIX))
43
+ continue;
41
44
  const relativePath = `${CAPTURES_FOLDER}/${stem}/${EPISODE_CAPTURE_MANIFEST_FILENAME}`;
42
45
  let descriptor;
43
46
  try {
@@ -96,4 +99,57 @@ export async function buildEpisodeCaptureIndex(chronicleRoot, options = {}) {
96
99
  }
97
100
  return index;
98
101
  }
102
+ /**
103
+ * Every screenwalk under one episode directory (`captures/screenwalk-<id>/`), in folder order.
104
+ * `screenwalk.json` is read first; a folder that has only the early hand-written `capture.json`
105
+ * is read through the same reader and marked `early`. A folder whose file names no screenwalk
106
+ * is reported and skipped.
107
+ */
108
+ export async function readEpisodeScreenwalks(episodeDir, options = {}) {
109
+ const capturesDir = join(episodeDir, CAPTURES_FOLDER);
110
+ let folders;
111
+ try {
112
+ folders = (await readdir(capturesDir, { withFileTypes: true }))
113
+ .filter((entry) => entry.isDirectory() && entry.name.startsWith(SCREENWALK_FOLDER_PREFIX))
114
+ .map((entry) => entry.name)
115
+ .sort();
116
+ }
117
+ catch {
118
+ return [];
119
+ }
120
+ const screenwalks = [];
121
+ for (const folder of folders) {
122
+ for (const file of [SCREENWALK_FILE, EPISODE_CAPTURE_MANIFEST_FILENAME]) {
123
+ const relativePath = `${CAPTURES_FOLDER}/${folder}/${file}`;
124
+ let raw;
125
+ try {
126
+ raw = JSON.parse(await readFile(join(capturesDir, folder, file), "utf8"));
127
+ }
128
+ catch (error) {
129
+ if (error.code !== "ENOENT") {
130
+ options.diagnostics?.push({
131
+ level: "warning",
132
+ code: "chronicle.screenwalk-unreadable",
133
+ message: `${file} is present but could not be read (${String(error.message).split("\n")[0]})`,
134
+ path: relativePath,
135
+ });
136
+ }
137
+ continue;
138
+ }
139
+ const record = toScreenwalkRecord(raw, { id: folder, episode: options.episode });
140
+ if (!record) {
141
+ options.diagnostics?.push({
142
+ level: "warning",
143
+ code: "chronicle.screenwalk-unrecognized",
144
+ message: `${file} names no screenwalk`,
145
+ path: relativePath,
146
+ });
147
+ continue;
148
+ }
149
+ screenwalks.push({ record, relativePath, early: file !== SCREENWALK_FILE });
150
+ break;
151
+ }
152
+ }
153
+ return screenwalks;
154
+ }
99
155
  //# sourceMappingURL=captures.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"captures.js","sourceRoot":"","sources":["../src/captures.ts"],"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E,MAAM,EAAE,EAAE,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAkEzF;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAA"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAaH,OAAO,EAIL,gBAAgB,EAIjB,MAAM,cAAc,CAAA;AAkCrB,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE;QAAE,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAA;IACzC,MAAM,EAAE;QAAE,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAA;CAC1C;AAED,MAAM,WAAW,aAAc,SAAQ,OAAO,CAAC,UAAU,CAAC;IACxD,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAA;IACvB,GAAG,CAAC,EAAE,MAAM,IAAI,CAAA;CACjB;AAinCD,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAkEzF;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAA"}
package/dist/cli.js CHANGED
@@ -23,7 +23,7 @@ import { episodeNodeId, registerEpisodeNode, } from "./episode-node.js";
23
23
  import { installSkill, skillMarkdown, SkillInstallError } from "./skill.js";
24
24
  import { syncArtefact } from "./sync.js";
25
25
  import { artefactStatus, episodeStatus } from "./status.js";
26
- import { commentOnArtefactThread, openArtefactThread, viewArtefactThread } from "./thread.js";
26
+ import { commentOnArtefactIssue, openArtefactIssue, viewArtefactIssue } from "./artefact-issue.js";
27
27
  import { registerArtefact, registerEpisode } from "./register.js";
28
28
  import { readArtefactWeave, readEpisodeWeave, WeaveError } from "./weave.js";
29
29
  class UsageError extends Error {
@@ -31,8 +31,12 @@ class UsageError extends Error {
31
31
  const USAGE = `Usage: inquiry-weave <command> [flags]
32
32
 
33
33
  Commands:
34
+ weave --artefact <name|path> (--episode <ref> | --new-episode <slug> [--title <t>])
35
+ Weaves an artefact into an episode: records the weave on both sides
36
+ and copies the artefact into the episode's inquiry/ folder.
37
+ (promote is its older name.)
34
38
  relate --artefact <name|path> --episode <num|name|path> [--issue owner/repo#N]
35
- promote --artefact <name|path> (--episode <ref> | --new-episode <slug> [--title <t>])
39
+ Records the weave on both sides without copying (weave's first half).
36
40
  inquire (--episode <ref> | --new-episode <slug>)
37
41
  (--artefact <name|path> | --slug <new-artefact-slug>)
38
42
  [--title <t>] [--body <text> | --body-file <path>]
@@ -42,17 +46,17 @@ Commands:
42
46
  empty artefact vessel under the inquiry root.
43
47
  issue [create] [--artefact <name|path>] [--title <t>] [--body <text> | --body-file <path>]
44
48
  [--repo owner/repo] [--issue owner/repo#N] [--force] [--dry-run]
45
- Creates the GitHub issue an inquiry folder is followed in (its thread)
46
- and records it in the folder's .weave.yaml. The folder defaults to the
47
- current one, and no episode is needed. A folder whose .weave.yaml
49
+ Creates the GitHub issue the artefact's inquiry is followed in and
50
+ records it in the artefact's .weave.yaml. The artefact defaults to the
51
+ current folder, and no episode is needed. An artefact whose .weave.yaml
48
52
  already names its issue is left as it is. --issue records an issue
49
- that already exists. A folder whose .hch/issue_<N>.env (issue_add)
53
+ that already exists. An artefact whose .hch/issue_<N>.env (issue_add)
50
54
  names an issue is refused unless --issue or --force is given.
51
55
  issue view [--artefact <name|path>] [--json]
52
- The folder's recorded thread: title, state, body, comments, and the
53
- episodes the folder is woven into.
56
+ The artefact's recorded issue: title, state, body, comments, and the
57
+ episodes the artefact is woven into.
54
58
  issue comment (--body <text> | --body-file <path>) [--artefact <name|path>] [--dry-run]
55
- Adds a comment to the folder's recorded thread.
59
+ Adds a comment to the artefact's recorded issue.
56
60
  sync (--artefact <ref> [--episode <ref>] | --episode <ref> [--all])
57
61
  status (--episode <ref> | --artefact <ref>) [--json]
58
62
  register (--episode <ref> | --artefact <ref>) [--dry-run]
@@ -230,7 +234,7 @@ async function commandPromote(context) {
230
234
  const newSlug = stringFlag(context.flags, "new-episode");
231
235
  const episodeRef = stringFlag(context.flags, "episode");
232
236
  if ((newSlug === undefined) === (episodeRef === undefined)) {
233
- throw new UsageError("promote needs exactly one of --episode or --new-episode <slug>");
237
+ throw new UsageError("weave (promote) needs exactly one of --episode or --new-episode <slug>");
234
238
  }
235
239
  const dryRun = context.flags.get("dry-run") === true;
236
240
  const episode = newSlug
@@ -249,7 +253,7 @@ async function commandPromote(context) {
249
253
  });
250
254
  emit(context, { related, synced }, [
251
255
  ...(newSlug ? [`${dryRun ? "would scaffold" : "scaffolded"} episode: ${episode.dir}`] : []),
252
- ...relateLines(related, "promoted"),
256
+ ...relateLines(related, "woven"),
253
257
  ...syncLines(synced),
254
258
  ]);
255
259
  return 0;
@@ -395,7 +399,7 @@ async function commandSync(context) {
395
399
  else {
396
400
  const weave = await readArtefactWeave(artefact.dir);
397
401
  if (!weave || weave.episodes.length === 0) {
398
- throw new WeaveError(`artefact ${artefact.name} has no related episodes — run 'relate' or 'promote' first`);
402
+ throw new WeaveError(`artefact ${artefact.name} is woven into no episode — run 'weave' or 'relate' first`);
399
403
  }
400
404
  for (const link of weave.episodes) {
401
405
  const episodeDir = isAbsolute(link.path)
@@ -951,11 +955,11 @@ async function commandIssue(context) {
951
955
  throw new UsageError("use only one of --body or --body-file");
952
956
  }
953
957
  if (action === "view") {
954
- const view = await viewArtefactThread(artefact, context.processEnv);
955
- const t = view.thread;
958
+ const view = await viewArtefactIssue(artefact, context.processEnv);
959
+ const t = view.view;
956
960
  const lines = [
957
961
  `# ${t.title} (${t.state})`,
958
- ` thread: ${view.issue} ${t.url}`,
962
+ ` issue: ${view.issue} ${t.url}`,
959
963
  ` artefact: ${view.artefactDir}`,
960
964
  ` author: ${t.author?.login ?? "?"} · created ${t.createdAt ?? "?"} · updated ${t.updatedAt ?? "?"}`,
961
965
  ...(t.labels?.length ? [` labels: ${t.labels.map((l) => l.name).join(", ")}`] : []),
@@ -971,7 +975,7 @@ async function commandIssue(context) {
971
975
  const text = bodyFile !== undefined ? await readFile(resolve(bodyFile), "utf8") : body;
972
976
  if (text === undefined)
973
977
  throw new UsageError("issue comment needs --body <text> or --body-file <path>");
974
- const posted = await commentOnArtefactThread(artefact, text, {
978
+ const posted = await commentOnArtefactIssue(artefact, text, {
975
979
  dryRun: context.flags.get("dry-run") === true,
976
980
  env: context.processEnv,
977
981
  });
@@ -984,7 +988,7 @@ async function commandIssue(context) {
984
988
  if (action !== "create") {
985
989
  throw new UsageError(`issue knows 'create' (the default), 'view' and 'comment', not '${action}'`);
986
990
  }
987
- const result = await openArtefactThread({
991
+ const result = await openArtefactIssue({
988
992
  artefact,
989
993
  repo: context.env.repo,
990
994
  title: stringFlag(context.flags, "title"),
@@ -1005,7 +1009,7 @@ async function commandIssue(context) {
1005
1009
  if (result.status === "created" || result.status === "recorded")
1006
1010
  lines.push(` recorded in ${result.artefactDir}/.weave.yaml`);
1007
1011
  for (const episode of result.episodes) {
1008
- lines.push(` woven into ${episode.number !== undefined ? `episode ${episode.number}` : episode.path}: carry the thread there with \`inquiry-weave relate --artefact ${result.artefact} --episode ${episode.number ?? episode.path}\`, or Sync in the episode room`);
1012
+ lines.push(` woven into ${episode.number !== undefined ? `episode ${episode.number}` : episode.path}: carry the issue there with \`inquiry-weave relate --artefact ${result.artefact} --episode ${episode.number ?? episode.path}\`, or Sync in the episode room`);
1009
1013
  }
1010
1014
  emit(context, result, lines);
1011
1015
  return 0;
@@ -1013,6 +1017,7 @@ async function commandIssue(context) {
1013
1017
  const COMMANDS = {
1014
1018
  relate: commandRelate,
1015
1019
  issue: commandIssue,
1020
+ weave: commandPromote,
1016
1021
  promote: commandPromote,
1017
1022
  inquire: commandInquire,
1018
1023
  sync: commandSync,