@miadi/relational-git-repository-mapper 0.4.0 → 0.5.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.
@@ -0,0 +1,2 @@
1
+ export declare const SHIPPED_HOSTS_SOURCE = "@miadi/relational-git-repository-mapper (shipped hosts)";
2
+ export declare const SHIPPED_HOSTS: readonly unknown[];
@@ -0,0 +1,190 @@
1
+ "use strict";
2
+ // Generated by scripts/ship-hosts.mjs from `miadi-repomap where --write`. Do not edit by hand:
3
+ // check again and regenerate. Where each repository lives, as checked then.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.SHIPPED_HOSTS = exports.SHIPPED_HOSTS_SOURCE = void 0;
6
+ exports.SHIPPED_HOSTS_SOURCE = "@miadi/relational-git-repository-mapper (shipped hosts)";
7
+ exports.SHIPPED_HOSTS = [
8
+ {
9
+ "repository": "repository:jgwill/Miadi",
10
+ "checkedBy": "miadi-repomap where (mw-rwl-repo, claude-opus-5-5)",
11
+ "checkedAt": "2026-11-01T12:44:30.691Z",
12
+ "host": "github",
13
+ "url": "https://github.com/jgwill/Miadi",
14
+ "private": true
15
+ },
16
+ {
17
+ "repository": "repository:jgwill/episodes",
18
+ "checkedBy": "miadi-repomap where (mw-rwl-repo, claude-opus-5-5)",
19
+ "checkedAt": "2026-11-01T12:44:30.691Z",
20
+ "host": "host-git",
21
+ "url": "gaia:/srv/git/jgwill/episodes.git",
22
+ "note": "not on GitHub (404); a bare repository on gaia"
23
+ },
24
+ {
25
+ "repository": "repository:jgwill/src",
26
+ "checkedBy": "miadi-repomap where (mw-rwl-repo, claude-opus-5-5)",
27
+ "checkedAt": "2026-11-01T12:44:30.691Z",
28
+ "host": "github",
29
+ "url": "https://github.com/jgwill/src",
30
+ "private": true
31
+ },
32
+ {
33
+ "repository": "repository:jgwill/miadi-orchestration-kit",
34
+ "checkedBy": "miadi-repomap where (mw-rwl-repo, claude-opus-5-5)",
35
+ "checkedAt": "2026-11-01T12:44:30.691Z",
36
+ "host": "github",
37
+ "url": "https://github.com/jgwill/miadi-orchestration-kit"
38
+ },
39
+ {
40
+ "repository": "repository:jgwill/gaia",
41
+ "checkedBy": "miadi-repomap where (mw-rwl-repo, claude-opus-5-5)",
42
+ "checkedAt": "2026-11-01T12:44:30.691Z",
43
+ "host": "github",
44
+ "url": "https://github.com/jgwill/gaia",
45
+ "private": true
46
+ },
47
+ {
48
+ "repository": "repository:jgwill/smcraft",
49
+ "checkedBy": "miadi-repomap where (mw-rwl-repo, claude-opus-5-5)",
50
+ "checkedAt": "2026-11-01T12:44:30.691Z",
51
+ "host": "github",
52
+ "url": "https://github.com/jgwill/smcraft"
53
+ },
54
+ {
55
+ "repository": "repository:miadisabelle/kherix-hermeneia",
56
+ "checkedBy": "miadi-repomap where (mw-rwl-repo, claude-opus-5-5)",
57
+ "checkedAt": "2026-11-01T12:44:30.691Z",
58
+ "host": "github",
59
+ "url": "https://github.com/miadisabelle/kherix-hermeneia",
60
+ "private": true
61
+ },
62
+ {
63
+ "repository": "repository:miadisabelle/workspace",
64
+ "checkedBy": "miadi-repomap where (mw-rwl-repo, claude-opus-5-5)",
65
+ "checkedAt": "2026-11-01T12:44:30.691Z",
66
+ "host": "github",
67
+ "url": "https://github.com/miadisabelle/workspace",
68
+ "private": true
69
+ },
70
+ {
71
+ "repository": "repository:jgwill/jgtsrc",
72
+ "checkedBy": "miadi-repomap where (mw-rwl-repo, claude-opus-5-5)",
73
+ "checkedAt": "2026-11-01T12:44:30.691Z",
74
+ "host": "github",
75
+ "url": "https://github.com/jgwill/jgtsrc",
76
+ "private": true
77
+ },
78
+ {
79
+ "repository": "repository:jgwill/medicine-wheel",
80
+ "checkedBy": "miadi-repomap where (mw-rwl-repo, claude-opus-5-5)",
81
+ "checkedAt": "2026-11-01T12:44:30.691Z",
82
+ "host": "github",
83
+ "url": "https://github.com/jgwill/medicine-wheel"
84
+ },
85
+ {
86
+ "repository": "repository:jgwill/mia-code",
87
+ "checkedBy": "miadi-repomap where (mw-rwl-repo, claude-opus-5-5)",
88
+ "checkedAt": "2026-11-01T12:44:30.691Z",
89
+ "host": "github",
90
+ "url": "https://github.com/jgwill/mia-code",
91
+ "private": true
92
+ },
93
+ {
94
+ "repository": "repository:miadisabelle/Etuaptmumk-RSM",
95
+ "checkedBy": "miadi-repomap where (mw-rwl-repo, claude-opus-5-5)",
96
+ "checkedAt": "2026-11-01T12:44:30.691Z",
97
+ "host": "github",
98
+ "url": "https://github.com/miadisabelle/Etuaptmumk-RSM",
99
+ "private": true
100
+ },
101
+ {
102
+ "repository": "repository:avadisabelle/coaia-narrative",
103
+ "checkedBy": "miadi-repomap where (mw-rwl-repo, claude-opus-5-5)",
104
+ "checkedAt": "2026-11-01T12:44:30.691Z",
105
+ "host": "github",
106
+ "url": "https://github.com/avadisabelle/coaia-narrative"
107
+ },
108
+ {
109
+ "repository": "repository:jgwill/eury",
110
+ "checkedBy": "miadi-repomap where (mw-rwl-repo, claude-opus-5-5)",
111
+ "checkedAt": "2026-11-01T12:44:30.691Z",
112
+ "host": "github",
113
+ "url": "https://github.com/jgwill/eury",
114
+ "private": true
115
+ },
116
+ {
117
+ "repository": "repository:miadisabelle/deepdiver",
118
+ "checkedBy": "miadi-repomap where (mw-rwl-repo, claude-opus-5-5)",
119
+ "checkedAt": "2026-11-01T12:44:30.691Z",
120
+ "host": "github",
121
+ "url": "https://github.com/miadisabelle/deepdiver"
122
+ },
123
+ {
124
+ "repository": "repository:jgwill/coaiajs",
125
+ "checkedBy": "miadi-repomap where (mw-rwl-repo, claude-opus-5-5)",
126
+ "checkedAt": "2026-11-01T12:44:30.691Z",
127
+ "host": "github",
128
+ "url": "https://github.com/jgwill/coaiajs"
129
+ },
130
+ {
131
+ "repository": "repository:jgwill/miadi-passages",
132
+ "checkedBy": "miadi-repomap where (mw-rwl-repo, claude-opus-5-5)",
133
+ "checkedAt": "2026-11-01T12:44:30.691Z",
134
+ "host": "github",
135
+ "url": "https://github.com/jgwill/miadi-passages",
136
+ "private": true
137
+ },
138
+ {
139
+ "repository": "repository:jgwill/trading-platform",
140
+ "checkedBy": "miadi-repomap where (mw-rwl-repo, claude-opus-5-5)",
141
+ "checkedAt": "2026-11-01T12:44:30.691Z",
142
+ "host": "missing",
143
+ "note": "404 from GitHub with a token; no bare repository under /srv/git"
144
+ },
145
+ {
146
+ "repository": "repository:jgwill/workspace",
147
+ "checkedBy": "miadi-repomap where (mw-rwl-repo, claude-opus-5-5)",
148
+ "checkedAt": "2026-11-01T12:44:30.691Z",
149
+ "host": "github",
150
+ "url": "https://github.com/jgwill/workspace",
151
+ "private": true
152
+ },
153
+ {
154
+ "repository": "repository:miadisabelle/asterion",
155
+ "checkedBy": "miadi-repomap where (mw-rwl-repo, claude-opus-5-5)",
156
+ "checkedAt": "2026-11-01T12:44:30.691Z",
157
+ "host": "github",
158
+ "url": "https://github.com/miadisabelle/asterion"
159
+ },
160
+ {
161
+ "repository": "repository:miadisabelle/gmtermux",
162
+ "checkedBy": "miadi-repomap where (mw-rwl-repo, claude-opus-5-5)",
163
+ "checkedAt": "2026-11-01T12:44:30.691Z",
164
+ "host": "github",
165
+ "url": "https://github.com/miadisabelle/gmtermux",
166
+ "private": true
167
+ },
168
+ {
169
+ "repository": "repository:miadisabelle/home",
170
+ "checkedBy": "miadi-repomap where (mw-rwl-repo, claude-opus-5-5)",
171
+ "checkedAt": "2026-11-01T12:44:30.691Z",
172
+ "host": "github",
173
+ "url": "https://github.com/miadisabelle/home",
174
+ "private": true
175
+ },
176
+ {
177
+ "repository": "repository:miadisabelle/mia-honcho",
178
+ "checkedBy": "miadi-repomap where (mw-rwl-repo, claude-opus-5-5)",
179
+ "checkedAt": "2026-11-01T12:44:30.691Z",
180
+ "host": "github",
181
+ "url": "https://github.com/miadisabelle/mia-honcho"
182
+ },
183
+ {
184
+ "repository": "repository:miadisabelle/mia-retext",
185
+ "checkedBy": "miadi-repomap where (mw-rwl-repo, claude-opus-5-5)",
186
+ "checkedAt": "2026-11-01T12:44:30.691Z",
187
+ "host": "github",
188
+ "url": "https://github.com/miadisabelle/mia-retext"
189
+ }
190
+ ];
package/dist/types.d.ts CHANGED
@@ -2,6 +2,7 @@ import type { FeatureFacet, LifecycleReading, RelationRow, RepositoryFacet } fro
2
2
  import type { HubStatus } from "@medicine-wheel/developer-repository-mapping/node";
3
3
  import type { CapabilityFacet } from "@medicine-wheel/capabilities";
4
4
  import type { CapabilityKind } from "./capabilities";
5
+ import type { RepositoryHost } from "./hosts";
5
6
  import type { RepositoryLineage } from "./lineage";
6
7
  /** One session that worked in a repository, as its inventory record says it, by title. */
7
8
  export interface RepositorySession {
@@ -22,6 +23,12 @@ export interface RepositorySession {
22
23
  };
23
24
  /** `links.evidence` refs: what the session started from */
24
25
  evidence?: string[];
26
+ /** the episode the record names */
27
+ episode?: {
28
+ number?: number;
29
+ title?: string;
30
+ folder?: string;
31
+ };
25
32
  /** the record file's modification time */
26
33
  modified_at: string;
27
34
  }
@@ -46,7 +53,16 @@ export interface RepositoryView {
46
53
  nodeId: string;
47
54
  owner: string;
48
55
  name: string;
49
- url: string;
56
+ /** its web page: only a repository found on GitHub has one */
57
+ url?: string;
58
+ /** where it lives: github, host-git (a host's own git server), missing, or unchecked */
59
+ where: {
60
+ host: RepositoryHost;
61
+ url?: string;
62
+ note?: string;
63
+ private?: boolean;
64
+ archived?: boolean;
65
+ };
50
66
  /** whether a hub holds the repository's row */
51
67
  mapped: boolean;
52
68
  repository?: RepositoryFacet;
@@ -64,12 +80,21 @@ export interface RepositoryView {
64
80
  capabilities: (CapabilityFacet & {
65
81
  kind?: CapabilityKind;
66
82
  })[];
83
+ /** the episodes its sessions worked in, most sessions first */
84
+ episodes: {
85
+ number?: number;
86
+ title?: string;
87
+ folder?: string;
88
+ sessions: number;
89
+ }[];
67
90
  }
68
91
  export interface RepositorySummary {
69
92
  nodeId: string;
70
93
  owner: string;
71
94
  name: string;
72
95
  mapped: boolean;
96
+ host: RepositoryHost;
97
+ url?: string;
73
98
  lifecycle?: string;
74
99
  drift?: string;
75
100
  sessions: number;
@@ -91,4 +116,6 @@ export interface RepositoryListing {
91
116
  hub: HubState;
92
117
  inventory: InventoryState;
93
118
  repositories: RepositorySummary[];
119
+ /** named only where no repository was found: on GitHub (checked with a token) or on a host's git server */
120
+ missing: RepositorySummary[];
94
121
  }
@@ -0,0 +1,11 @@
1
+ import type { RepositoryWhere } from "./hosts";
2
+ export interface CheckWhereOptions {
3
+ checkedBy: string;
4
+ now?: Date;
5
+ /** folders holding `<owner>/<name>.git`; default MIADI_HOST_GIT_ROOTS (colon-separated), else /srv/git */
6
+ hostGitRoots?: string[];
7
+ /** default GH_TOKEN, GITHUB_TOKEN, else `gh auth token`; null checks without one */
8
+ githubToken?: string | null;
9
+ fetch?: typeof globalThis.fetch;
10
+ }
11
+ export declare function checkWhere(repositories: readonly string[], options: CheckWhereOptions): Promise<RepositoryWhere[]>;
package/dist/where.js ADDED
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ // Checking where repositories live, on Node: GitHub's API (with a token from
3
+ // GH_TOKEN, GITHUB_TOKEN or `gh auth token`, so a private repository is seen)
4
+ // and a host's bare repositories (`<root>/<owner>/<name>.git`, /srv/git by
5
+ // default). Read-only. Without a token, a 404 cannot tell a private
6
+ // repository from a missing one, and the reading says `unchecked`.
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.checkWhere = checkWhere;
9
+ const node_child_process_1 = require("node:child_process");
10
+ const node_fs_1 = require("node:fs");
11
+ const node_os_1 = require("node:os");
12
+ const node_path_1 = require("node:path");
13
+ const node_util_1 = require("node:util");
14
+ const developer_repository_mapping_1 = require("@medicine-wheel/developer-repository-mapping");
15
+ const run = (0, node_util_1.promisify)(node_child_process_1.execFile);
16
+ async function tokenOf(given) {
17
+ if (given === null)
18
+ return undefined;
19
+ if (given)
20
+ return given;
21
+ const env = process.env.GH_TOKEN?.trim() || process.env.GITHUB_TOKEN?.trim();
22
+ if (env)
23
+ return env;
24
+ try {
25
+ const { stdout } = await run("gh", ["auth", "token"], { timeout: 10_000 });
26
+ return stdout.trim() || undefined;
27
+ }
28
+ catch {
29
+ return undefined;
30
+ }
31
+ }
32
+ async function checkWhere(repositories, options) {
33
+ const roots = options.hostGitRoots ?? (process.env.MIADI_HOST_GIT_ROOTS?.split(":").filter(Boolean) || ["/srv/git"]);
34
+ const token = await tokenOf(options.githubToken);
35
+ const fetchImpl = options.fetch ?? globalThis.fetch;
36
+ const checkedAt = (options.now ?? new Date()).toISOString();
37
+ const host = (0, node_os_1.hostname)();
38
+ const out = [];
39
+ for (const raw of repositories) {
40
+ const id = raw.startsWith("repository:") ? raw : `repository:${raw}`;
41
+ const repo = (0, developer_repository_mapping_1.parseRepositoryNodeId)(id);
42
+ if (!repo)
43
+ continue;
44
+ const base = { repository: id, checkedBy: options.checkedBy, checkedAt };
45
+ let github = { status: 0 };
46
+ try {
47
+ const res = await fetchImpl(`https://api.github.com/repos/${repo.owner}/${repo.name}`, {
48
+ headers: { accept: "application/vnd.github+json", "user-agent": "miadi-repomap", ...(token ? { authorization: `Bearer ${token}` } : {}) },
49
+ signal: AbortSignal.timeout(15_000),
50
+ });
51
+ github = { status: res.status, ...(res.ok ? { body: (await res.json()) } : {}) };
52
+ }
53
+ catch {
54
+ github = { status: 0 };
55
+ }
56
+ if (github.body) {
57
+ out.push({
58
+ ...base,
59
+ host: "github",
60
+ url: github.body.html_url ?? `https://github.com/${repo.owner}/${repo.name}`,
61
+ ...(github.body.private ? { private: true } : {}),
62
+ ...(github.body.archived ? { archived: true } : {}),
63
+ });
64
+ continue;
65
+ }
66
+ const bare = roots
67
+ .flatMap((root) => [(0, node_path_1.join)(root, repo.owner, `${repo.name}.git`), (0, node_path_1.join)(root, repo.owner, repo.name)])
68
+ .find((path) => (0, node_fs_1.existsSync)((0, node_path_1.join)(path, "HEAD")));
69
+ if (bare) {
70
+ out.push({ ...base, host: "host-git", url: `${host}:${bare}`, note: `not on GitHub (${github.status || "no answer"}); a bare repository on ${host}` });
71
+ continue;
72
+ }
73
+ if (github.status === 404 && token) {
74
+ out.push({ ...base, host: "missing", note: `404 from GitHub with a token; no bare repository under ${roots.join(", ")}` });
75
+ }
76
+ else {
77
+ out.push({
78
+ ...base,
79
+ host: "unchecked",
80
+ note: github.status === 404 ? "404 from GitHub without a token: private or missing" : `GitHub did not answer (${github.status || "no answer"})`,
81
+ });
82
+ }
83
+ }
84
+ return out;
85
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@miadi/relational-git-repository-mapper",
3
- "version": "0.4.0",
4
- "description": "A git repository as Miadi sees it (git, never a database Repository or Data Mapper): the rows its owner hub holds (@medicine-wheel/developer-repository-mapping) beside the agent sessions that worked in it (the witness team's session inventory), joined by owner/name; which git repository learned from which (a lineage, never a dependency); and what each provides, its packages, CLIs and skills as capability nodes.",
3
+ "version": "0.5.0",
4
+ "description": "A git repository as Miadi sees it (git, never a database Repository or Data Mapper): the rows its owner hub holds (@medicine-wheel/developer-repository-mapping) beside the agent sessions that worked in it (the witness team's session inventory), joined by owner/name; which git repository learned from which (a lineage, never a dependency); what each provides, its packages, CLIs and skills as capability nodes; where each lives; and what a version bump touches downstream.",
5
5
  "license": "MIT",
6
6
  "author": "Miadi",
7
7
  "homepage": "https://github.com/jgwill/Miadi/tree/main/packages/relational-git-repository-mapper",
@@ -28,9 +28,9 @@
28
28
  "README.md"
29
29
  ],
30
30
  "dependencies": {
31
- "@medicine-wheel/capabilities": "^0.25.0",
32
- "@medicine-wheel/developer-repository-mapping": "^0.25.0",
33
- "@miadi/hooks-interpreter": "^0.8.0",
31
+ "@medicine-wheel/capabilities": "^0.27.3",
32
+ "@medicine-wheel/developer-repository-mapping": "^0.27.3",
33
+ "@miadi/hooks-interpreter": "^0.9.0",
34
34
  "zod": "^3.23.0"
35
35
  },
36
36
  "devDependencies": {