@miadi/relational-git-repository-mapper 0.2.0 → 0.4.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.
- package/README.md +62 -4
- package/dist/capabilities.d.ts +71 -0
- package/dist/capabilities.js +210 -0
- package/dist/cli.js +139 -7
- package/dist/index.d.ts +6 -1
- package/dist/index.js +32 -1
- package/dist/join.d.ts +7 -5
- package/dist/join.js +25 -9
- package/dist/lineage.d.ts +105 -0
- package/dist/lineage.js +94 -0
- package/dist/read.d.ts +65 -1
- package/dist/read.js +102 -2
- package/dist/scan.d.ts +16 -0
- package/dist/scan.js +65 -0
- package/dist/shipped-capabilities.d.ts +7 -0
- package/dist/shipped-capabilities.js +2371 -0
- package/dist/shipped-lineage.d.ts +2 -0
- package/dist/shipped-lineage.js +15 -0
- package/dist/types.d.ts +11 -0
- package/package.json +7 -3
package/README.md
CHANGED
|
@@ -29,26 +29,84 @@ keeper's descriptions and file lists stay in the record.
|
|
|
29
29
|
When no hub is configured, or the hub clone holds no mapping folder yet, every repository
|
|
30
30
|
reads "no mapping yet" and still lists its sessions.
|
|
31
31
|
|
|
32
|
+
## Lineage: which git repository learned from which
|
|
33
|
+
|
|
34
|
+
A lineage is not a dependency. `learned-from` says that one repository took what another
|
|
35
|
+
explored and carries it on its own, sometimes with another way of knowing, without
|
|
36
|
+
importing it. Dependencies (`consumes`) stay in the owner hubs.
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
miadi-repomap lineage jgwill/medicine-wheel # what did the medicine wheel learn from?
|
|
40
|
+
miadi-repomap lineage # every lineage, the whole forest
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The rows this package ships come from William's word in Episode 297
|
|
44
|
+
(screenwalk 2610221013, 10:03–11:21): `jgwill/coaiajs` learned from
|
|
45
|
+
`avadisabelle/coaia-narrative`, and `jgwill/medicine-wheel` learned from both. None
|
|
46
|
+
depends on another. Every row is `pending` until William reads it. A host adds or corrects
|
|
47
|
+
rows with a JSONL file (`--lineage <file>` or `MIADI_REPOSITORY_LINEAGE`), read first: the
|
|
48
|
+
first file to name a pair speaks for it. Each row carries the attribution of
|
|
49
|
+
`@medicine-wheel/capabilities`, a `description` of at most 55 words, and
|
|
50
|
+
`"type": "learned-from"`.
|
|
51
|
+
|
|
52
|
+
In the app: `GET /api/repositories/lineage[?repository=owner/name]`, and the `lineage`
|
|
53
|
+
field of `GET /api/repositories/{owner}/{name}`, shown as a Lineage card on its page.
|
|
54
|
+
|
|
55
|
+
## Capabilities: what a git repository provides
|
|
56
|
+
|
|
57
|
+
Each repository's packages, CLIs and skills are `capability` nodes of
|
|
58
|
+
`@medicine-wheel/capabilities` (`capability:package-…`, `capability:cli-…`,
|
|
59
|
+
`capability:skill-…`), and the repository `provides` each one.
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
miadi-repomap capabilities jgwill/medicine-wheel # what does the medicine wheel provide?
|
|
63
|
+
miadi-repomap capabilities # every capability, and who provides it
|
|
64
|
+
miadi-repomap scan <clone>... --by "<who>" # read a clone's default branch, print JSONL rows
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
`scan` reads a repository's default branch (`origin/HEAD`) from git objects, never its
|
|
68
|
+
working tree, so a clone on another branch or with edits of its own reads the same. It reads
|
|
69
|
+
the packages the repository declares (`workspaces`, or `pnpm-workspace.yaml`), each
|
|
70
|
+
package's `bin`, and every `SKILL.md` outside `node_modules` and archives. A statement is the
|
|
71
|
+
file's own description, kept only within 55 words; longer, the row is `needs-resolution`
|
|
72
|
+
without one. Every row names the commit it was read at and stays `pending` until a person
|
|
73
|
+
reads it.
|
|
74
|
+
|
|
75
|
+
The package ships a scan of `jgwill/Miadi` and the three lineages (`avadisabelle/coaia-narrative`,
|
|
76
|
+
`jgwill/coaiajs`, `jgwill/medicine-wheel`), regenerated with
|
|
77
|
+
`node scripts/ship-capabilities.mjs <scan.jsonl> <scan.log>`. A host's JSONL
|
|
78
|
+
(`--capabilities` or `MIADI_REPOSITORY_CAPABILITIES`) is read first; the first source to name
|
|
79
|
+
a capability speaks for it.
|
|
80
|
+
|
|
81
|
+
In the app: `GET /api/repositories/capabilities[?repository=owner/name]` answers with the
|
|
82
|
+
capabilities and their `provides` edges, `GET /api/repositories/{owner}/{name}` carries them,
|
|
83
|
+
and the repository page's Lineage card lists them by kind.
|
|
84
|
+
|
|
32
85
|
## Configuration
|
|
33
86
|
|
|
34
87
|
| variable | default | |
|
|
35
88
|
|---|---|---|
|
|
36
89
|
| `MIADI_REPOSITORY_MAPPING_HUB` | none | a hub clone (`…/jgwill/jgwill`) or its mapping folder |
|
|
37
90
|
| `MIADI_SESSION_INVENTORY_DIR` | `~/workspace/.mino/session-inventory` | the inventory records |
|
|
91
|
+
| `MIADI_REPOSITORY_LINEAGE` | none | a lineage JSONL read before the shipped rows |
|
|
92
|
+
| `MIADI_REPOSITORY_CAPABILITIES` | none | a capability JSONL read before the shipped rows |
|
|
38
93
|
|
|
39
94
|
## CLI
|
|
40
95
|
|
|
41
96
|
```bash
|
|
42
|
-
miadi-repomap list [--hub <path>] [--inventory <dir>] [--json]
|
|
43
|
-
miadi-repomap show <owner/name> [--hub <path>] [--inventory <dir>] [--json]
|
|
97
|
+
miadi-repomap list [--hub <path>] [--inventory <dir>] [--lineage <file>] [--json]
|
|
98
|
+
miadi-repomap show <owner/name> [--hub <path>] [--inventory <dir>] [--lineage <file>] [--json]
|
|
99
|
+
miadi-repomap lineage [<owner/name>] [--lineage <file>] [--json]
|
|
100
|
+
miadi-repomap capabilities [<owner/name>] [--capabilities <file>] [--json]
|
|
101
|
+
miadi-repomap scan <clone>... [--ref <ref>] [--repository <owner/name>] [--by <who>]
|
|
44
102
|
```
|
|
45
103
|
|
|
46
|
-
Exit codes: 0 done, 1 the repository is in no hub and no
|
|
104
|
+
Exit codes: 0 done, 1 `show`: the repository is in no hub, no record and no lineage, 2 usage error.
|
|
47
105
|
|
|
48
106
|
## Library
|
|
49
107
|
|
|
50
108
|
```ts
|
|
51
|
-
import { repositoryListing, repositoryDetail, sessionsByRepository, repositoryView } from "@miadi/relational-repository-mapper"
|
|
109
|
+
import { repositoryListing, repositoryDetail, sessionsByRepository, repositoryView } from "@miadi/relational-git-repository-mapper"
|
|
52
110
|
```
|
|
53
111
|
|
|
54
112
|
`sessionsByRepository`, `repositoryView` and `listRepositories` are pure;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { type CapabilityFacet } from "@medicine-wheel/capabilities";
|
|
2
|
+
export type CapabilityKind = "package" | "cli" | "skill";
|
|
3
|
+
export declare const CAPABILITY_KINDS: readonly CapabilityKind[];
|
|
4
|
+
/** `capability:<kind>-<slug>`: `@miadi/inquiry-weave` → `capability:package-miadi-inquiry-weave`. */
|
|
5
|
+
export declare function capabilityId(kind: CapabilityKind, name: string): string;
|
|
6
|
+
/** The kind a capability id names, or undefined for a capability no scan wrote. */
|
|
7
|
+
export declare function kindOf(nodeId: string): CapabilityKind | undefined;
|
|
8
|
+
/** One thing a repository's files say it provides. */
|
|
9
|
+
export interface Artefact {
|
|
10
|
+
kind: CapabilityKind;
|
|
11
|
+
name: string;
|
|
12
|
+
/** what the files say it is, uncut */
|
|
13
|
+
description?: string;
|
|
14
|
+
/** the file that says so, relative to the repository */
|
|
15
|
+
path: string;
|
|
16
|
+
}
|
|
17
|
+
/** The fields of a package.json the scan reads. Never throws: an unreadable manifest has no name. */
|
|
18
|
+
export declare function parsePackageJson(text: string): {
|
|
19
|
+
name?: string;
|
|
20
|
+
description?: string;
|
|
21
|
+
bins: string[];
|
|
22
|
+
};
|
|
23
|
+
/** `name` and `description` from a SKILL.md front matter, plain, quoted or folded (`>`, `|`). */
|
|
24
|
+
export declare function parseSkillFrontMatter(text: string): {
|
|
25
|
+
name?: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The folders a repository declares as its packages: `workspaces` of the root
|
|
30
|
+
* package.json (an array, or `{ packages }`), else the `packages:` list of
|
|
31
|
+
* pnpm-workspace.yaml. `.` is the root. Only `dir` and `dir/*` are expanded.
|
|
32
|
+
*/
|
|
33
|
+
export declare function workspaceGlobs(rootPackageJson?: string, pnpmWorkspace?: string): string[];
|
|
34
|
+
/** The package.json paths of a repository's declared packages, among the files it holds. */
|
|
35
|
+
export declare function packageManifests(globs: readonly string[], files: readonly string[]): string[];
|
|
36
|
+
/** The SKILL.md files a repository holds, outside dependencies and archives. */
|
|
37
|
+
export declare function skillFiles(files: readonly string[]): string[];
|
|
38
|
+
export interface CapabilityRowContext {
|
|
39
|
+
/** `repository:<owner>/<name>` */
|
|
40
|
+
repository: string;
|
|
41
|
+
/** the commit the files were read at */
|
|
42
|
+
commit: string;
|
|
43
|
+
observedBy: string;
|
|
44
|
+
/** ISO 8601 */
|
|
45
|
+
observedAt: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Capability rows for one repository. One row per id: two files naming the
|
|
49
|
+
* same skill are one capability with both files as its grounding.
|
|
50
|
+
*/
|
|
51
|
+
export declare function capabilityRows(artefacts: readonly Artefact[], ctx: CapabilityRowContext): CapabilityFacet[];
|
|
52
|
+
/**
|
|
53
|
+
* Rows from several repositories as one inventory: a capability two
|
|
54
|
+
* repositories provide is one row that both provide, with both files as its
|
|
55
|
+
* grounding. The first row read keeps its name and statement.
|
|
56
|
+
*/
|
|
57
|
+
export declare function mergeCapabilityRows(rows: readonly CapabilityFacet[]): CapabilityFacet[];
|
|
58
|
+
/** One `provides` edge: a repository provides a capability, said by whoever said the capability. */
|
|
59
|
+
export interface ProvidesEdge {
|
|
60
|
+
from: string;
|
|
61
|
+
to: string;
|
|
62
|
+
type: "provides";
|
|
63
|
+
statedBy: string;
|
|
64
|
+
statedAt: string;
|
|
65
|
+
grounding: string[];
|
|
66
|
+
revision: CapabilityFacet["revision"];
|
|
67
|
+
}
|
|
68
|
+
/** The `provides` edges a set of capability rows holds, one per provider. */
|
|
69
|
+
export declare function providesEdges(capabilities: readonly CapabilityFacet[]): ProvidesEdge[];
|
|
70
|
+
/** The capabilities a repository provides, matched case-folded, by kind then id. */
|
|
71
|
+
export declare function capabilitiesOf(repository: string, capabilities: readonly CapabilityFacet[]): CapabilityFacet[];
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Capabilities, pure: what a git repository provides, read from its own files.
|
|
3
|
+
// Its packages (package.json), its CLIs (a package's `bin`) and its skills
|
|
4
|
+
// (SKILL.md) become `capability` nodes of @medicine-wheel/capabilities, and the
|
|
5
|
+
// repository `provides` each one. A row states what the files say, never what
|
|
6
|
+
// a model guesses: a description over 55 words is not cut, the row is
|
|
7
|
+
// `needs-resolution` without a statement. Every row is pending until a person
|
|
8
|
+
// reads it.
|
|
9
|
+
// Lane K7c (William, review d04556fd: "inventory and organize capabilities,
|
|
10
|
+
// repositories and recently missions related sessions").
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CAPABILITY_KINDS = void 0;
|
|
13
|
+
exports.capabilityId = capabilityId;
|
|
14
|
+
exports.kindOf = kindOf;
|
|
15
|
+
exports.parsePackageJson = parsePackageJson;
|
|
16
|
+
exports.parseSkillFrontMatter = parseSkillFrontMatter;
|
|
17
|
+
exports.workspaceGlobs = workspaceGlobs;
|
|
18
|
+
exports.packageManifests = packageManifests;
|
|
19
|
+
exports.skillFiles = skillFiles;
|
|
20
|
+
exports.capabilityRows = capabilityRows;
|
|
21
|
+
exports.mergeCapabilityRows = mergeCapabilityRows;
|
|
22
|
+
exports.providesEdges = providesEdges;
|
|
23
|
+
exports.capabilitiesOf = capabilitiesOf;
|
|
24
|
+
const capabilities_1 = require("@medicine-wheel/capabilities");
|
|
25
|
+
exports.CAPABILITY_KINDS = ["package", "cli", "skill"];
|
|
26
|
+
const slug = (value) => value
|
|
27
|
+
.toLowerCase()
|
|
28
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
29
|
+
.replace(/^-+|-+$/g, "");
|
|
30
|
+
/** `capability:<kind>-<slug>`: `@miadi/inquiry-weave` → `capability:package-miadi-inquiry-weave`. */
|
|
31
|
+
function capabilityId(kind, name) {
|
|
32
|
+
return `capability:${kind}-${slug(name)}`;
|
|
33
|
+
}
|
|
34
|
+
/** The kind a capability id names, or undefined for a capability no scan wrote. */
|
|
35
|
+
function kindOf(nodeId) {
|
|
36
|
+
const m = /^capability:(package|cli|skill)-/.exec(nodeId);
|
|
37
|
+
return m ? m[1] : undefined;
|
|
38
|
+
}
|
|
39
|
+
/** The fields of a package.json the scan reads. Never throws: an unreadable manifest has no name. */
|
|
40
|
+
function parsePackageJson(text) {
|
|
41
|
+
try {
|
|
42
|
+
const p = JSON.parse(text);
|
|
43
|
+
const name = typeof p.name === "string" && p.name.trim() ? p.name.trim() : undefined;
|
|
44
|
+
const description = typeof p.description === "string" && p.description.trim() ? p.description.trim() : undefined;
|
|
45
|
+
let bins = [];
|
|
46
|
+
if (typeof p.bin === "string" && name)
|
|
47
|
+
bins = [name.replace(/^@[^/]+\//, "")];
|
|
48
|
+
else if (p.bin && typeof p.bin === "object")
|
|
49
|
+
bins = Object.keys(p.bin);
|
|
50
|
+
return { ...(name ? { name } : {}), ...(description ? { description } : {}), bins };
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return { bins: [] };
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/** `name` and `description` from a SKILL.md front matter, plain, quoted or folded (`>`, `|`). */
|
|
57
|
+
function parseSkillFrontMatter(text) {
|
|
58
|
+
const m = /^---\r?\n([\s\S]*?)\r?\n---/.exec(text);
|
|
59
|
+
if (!m)
|
|
60
|
+
return {};
|
|
61
|
+
const lines = m[1].split(/\r?\n/);
|
|
62
|
+
const field = (key) => {
|
|
63
|
+
const i = lines.findIndex((l) => new RegExp(`^${key}:`).test(l));
|
|
64
|
+
if (i < 0)
|
|
65
|
+
return undefined;
|
|
66
|
+
let value = lines[i].slice(key.length + 1).trim();
|
|
67
|
+
if (/^[>|][+-]?$/.test(value)) {
|
|
68
|
+
const folded = [];
|
|
69
|
+
for (const l of lines.slice(i + 1)) {
|
|
70
|
+
if (/^\S/.test(l))
|
|
71
|
+
break;
|
|
72
|
+
folded.push(l.trim());
|
|
73
|
+
}
|
|
74
|
+
value = folded.join(" ").trim();
|
|
75
|
+
}
|
|
76
|
+
value = value.replace(/^(["'])([\s\S]*)\1$/, "$2").trim();
|
|
77
|
+
return value || undefined;
|
|
78
|
+
};
|
|
79
|
+
const name = field("name");
|
|
80
|
+
const description = field("description");
|
|
81
|
+
return { ...(name ? { name } : {}), ...(description ? { description } : {}) };
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The folders a repository declares as its packages: `workspaces` of the root
|
|
85
|
+
* package.json (an array, or `{ packages }`), else the `packages:` list of
|
|
86
|
+
* pnpm-workspace.yaml. `.` is the root. Only `dir` and `dir/*` are expanded.
|
|
87
|
+
*/
|
|
88
|
+
function workspaceGlobs(rootPackageJson, pnpmWorkspace) {
|
|
89
|
+
try {
|
|
90
|
+
const root = rootPackageJson ? JSON.parse(rootPackageJson) : {};
|
|
91
|
+
const w = root.workspaces;
|
|
92
|
+
const list = Array.isArray(w) ? w : w && typeof w === "object" ? w.packages : undefined;
|
|
93
|
+
if (Array.isArray(list) && list.length)
|
|
94
|
+
return [".", ...list.filter((x) => typeof x === "string")];
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
// an unreadable root manifest declares nothing
|
|
98
|
+
}
|
|
99
|
+
if (pnpmWorkspace) {
|
|
100
|
+
const block = /(^|\n)packages:\s*\n((?:[ \t]+-[^\n]*\n?)+)/.exec(pnpmWorkspace);
|
|
101
|
+
if (block) {
|
|
102
|
+
return block[2]
|
|
103
|
+
.split("\n")
|
|
104
|
+
.map((l) => l.replace(/^[ \t]+-\s*/, "").replace(/\s+#.*$/, "").replace(/^['"]|['"]$/g, "").trim())
|
|
105
|
+
.filter(Boolean);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return ["."];
|
|
109
|
+
}
|
|
110
|
+
/** The package.json paths of a repository's declared packages, among the files it holds. */
|
|
111
|
+
function packageManifests(globs, files) {
|
|
112
|
+
const manifests = new Set();
|
|
113
|
+
const held = new Set(files);
|
|
114
|
+
for (const glob of globs) {
|
|
115
|
+
const dir = glob.replace(/^\.\//, "").replace(/\/+$/, "");
|
|
116
|
+
if (dir === "." || dir === "") {
|
|
117
|
+
if (held.has("package.json"))
|
|
118
|
+
manifests.add("package.json");
|
|
119
|
+
}
|
|
120
|
+
else if (dir.endsWith("/*")) {
|
|
121
|
+
const base = `${dir.slice(0, -2)}/`;
|
|
122
|
+
for (const f of files) {
|
|
123
|
+
const rest = f.startsWith(base) ? f.slice(base.length) : "";
|
|
124
|
+
if (/^[^/]+\/package\.json$/.test(rest))
|
|
125
|
+
manifests.add(f);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
else if (held.has(`${dir}/package.json`)) {
|
|
129
|
+
manifests.add(`${dir}/package.json`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return [...manifests].sort();
|
|
133
|
+
}
|
|
134
|
+
/** The SKILL.md files a repository holds, outside dependencies and archives. */
|
|
135
|
+
function skillFiles(files) {
|
|
136
|
+
return files
|
|
137
|
+
.filter((f) => /(^|\/)SKILL\.md$/.test(f))
|
|
138
|
+
.filter((f) => !/(^|\/)(node_modules|archives?|archived-[^/]*|dist|\.next)\//.test(f))
|
|
139
|
+
.sort();
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Capability rows for one repository. One row per id: two files naming the
|
|
143
|
+
* same skill are one capability with both files as its grounding.
|
|
144
|
+
*/
|
|
145
|
+
function capabilityRows(artefacts, ctx) {
|
|
146
|
+
const where = `${ctx.repository.replace(/^repository:/, "")}@${ctx.commit.slice(0, 12)}`;
|
|
147
|
+
const rows = new Map();
|
|
148
|
+
for (const a of artefacts) {
|
|
149
|
+
const nodeId = capabilityId(a.kind, a.name);
|
|
150
|
+
const grounding = `${where}:${a.path}`;
|
|
151
|
+
const existing = rows.get(nodeId);
|
|
152
|
+
if (existing) {
|
|
153
|
+
if (!existing.grounding.includes(grounding))
|
|
154
|
+
existing.grounding.push(grounding);
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
const fits = a.description ? (0, capabilities_1.checkStatement)(a.description).fits : false;
|
|
158
|
+
rows.set(nodeId, {
|
|
159
|
+
nodeId,
|
|
160
|
+
name: a.name,
|
|
161
|
+
...(fits ? { statement: a.description } : {}),
|
|
162
|
+
status: fits ? "clear" : "needs-resolution",
|
|
163
|
+
providedBy: [ctx.repository],
|
|
164
|
+
statedBy: ctx.observedBy,
|
|
165
|
+
statedAt: ctx.observedAt,
|
|
166
|
+
grounding: [grounding],
|
|
167
|
+
revision: "pending",
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
return [...rows.values()];
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Rows from several repositories as one inventory: a capability two
|
|
174
|
+
* repositories provide is one row that both provide, with both files as its
|
|
175
|
+
* grounding. The first row read keeps its name and statement.
|
|
176
|
+
*/
|
|
177
|
+
function mergeCapabilityRows(rows) {
|
|
178
|
+
const merged = new Map();
|
|
179
|
+
for (const row of rows) {
|
|
180
|
+
const existing = merged.get(row.nodeId);
|
|
181
|
+
if (!existing) {
|
|
182
|
+
merged.set(row.nodeId, { ...row, providedBy: [...row.providedBy], grounding: [...row.grounding] });
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
for (const p of row.providedBy)
|
|
186
|
+
if (!existing.providedBy.includes(p))
|
|
187
|
+
existing.providedBy.push(p);
|
|
188
|
+
for (const g of row.grounding)
|
|
189
|
+
if (!existing.grounding.includes(g))
|
|
190
|
+
existing.grounding.push(g);
|
|
191
|
+
}
|
|
192
|
+
return [...merged.values()].sort((a, b) => (a.nodeId < b.nodeId ? -1 : a.nodeId > b.nodeId ? 1 : 0));
|
|
193
|
+
}
|
|
194
|
+
/** The `provides` edges a set of capability rows holds, one per provider. */
|
|
195
|
+
function providesEdges(capabilities) {
|
|
196
|
+
return capabilities.flatMap((c) => c.providedBy.map((from) => ({
|
|
197
|
+
from,
|
|
198
|
+
to: c.nodeId,
|
|
199
|
+
type: "provides",
|
|
200
|
+
statedBy: c.statedBy,
|
|
201
|
+
statedAt: c.statedAt,
|
|
202
|
+
grounding: c.grounding,
|
|
203
|
+
revision: c.revision,
|
|
204
|
+
})));
|
|
205
|
+
}
|
|
206
|
+
/** The capabilities a repository provides, matched case-folded, by kind then id. */
|
|
207
|
+
function capabilitiesOf(repository, capabilities) {
|
|
208
|
+
const id = (repository.startsWith("repository:") ? repository : `repository:${repository}`).toLowerCase();
|
|
209
|
+
return capabilities.filter((c) => c.providedBy.some((p) => p.toLowerCase() === id));
|
|
210
|
+
}
|
package/dist/cli.js
CHANGED
|
@@ -2,21 +2,81 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
// miadi-repomap — a repository's mapping rows beside the sessions that worked in it.
|
|
4
4
|
//
|
|
5
|
-
// miadi-repomap list [--hub <path>] [--inventory <dir>] [--json]
|
|
6
|
-
// miadi-repomap show <owner/name> [--hub <path>] [--inventory <dir>] [--json]
|
|
5
|
+
// miadi-repomap list [--hub <path>] [--inventory <dir>] [--lineage <file>] [--json]
|
|
6
|
+
// miadi-repomap show <owner/name> [--hub <path>] [--inventory <dir>] [--lineage <file>] [--json]
|
|
7
|
+
// miadi-repomap lineage [<owner/name>] [--lineage <file>] [--json]
|
|
8
|
+
// miadi-repomap capabilities [<owner/name>] [--capabilities <file>] [--json]
|
|
9
|
+
// miadi-repomap scan <clone>... [--ref <ref>] [--repository <owner/name>] [--by <who>]
|
|
7
10
|
//
|
|
11
|
+
// `lineage <owner/name>` answers "what did this repository learn from", and
|
|
12
|
+
// who learned from it; with no repository it prints every lineage. A lineage
|
|
13
|
+
// is not a dependency: `learned-from` names what a repository took from
|
|
14
|
+
// another that it carries on its own. --lineage adds a host's JSONL before
|
|
15
|
+
// the rows this package ships (default MIADI_REPOSITORY_LINEAGE).
|
|
16
|
+
//
|
|
17
|
+
// `capabilities <owner/name>` answers what a repository provides: its
|
|
18
|
+
// packages, CLIs and skills as capability nodes, each with a `provides` edge.
|
|
19
|
+
// `scan` reads a clone's default branch from git objects (never its working
|
|
20
|
+
// tree) and prints those rows as JSONL, pending until a person reads them.
|
|
21
|
+
// --capabilities adds a host's JSONL before the shipped rows (default
|
|
22
|
+
// MIADI_REPOSITORY_CAPABILITIES).
|
|
8
23
|
// --hub defaults to MIADI_REPOSITORY_MAPPING_HUB (a jgwill/jgwill clone, or a
|
|
9
24
|
// mapping folder); --inventory to MIADI_SESSION_INVENTORY_DIR, else
|
|
10
25
|
// ~/workspace/.mino/session-inventory. Read-only.
|
|
11
26
|
//
|
|
12
|
-
// Exit codes: 0 done, 1 the repository is in no hub and no
|
|
27
|
+
// Exit codes: 0 done, 1 `show`: the repository is in no hub, no record and no lineage, 2 usage error.
|
|
28
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
29
|
+
if (k2 === undefined) k2 = k;
|
|
30
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
31
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
32
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
33
|
+
}
|
|
34
|
+
Object.defineProperty(o, k2, desc);
|
|
35
|
+
}) : (function(o, m, k, k2) {
|
|
36
|
+
if (k2 === undefined) k2 = k;
|
|
37
|
+
o[k2] = m[k];
|
|
38
|
+
}));
|
|
39
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
40
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
41
|
+
}) : function(o, v) {
|
|
42
|
+
o["default"] = v;
|
|
43
|
+
});
|
|
44
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
45
|
+
var ownKeys = function(o) {
|
|
46
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
47
|
+
var ar = [];
|
|
48
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
49
|
+
return ar;
|
|
50
|
+
};
|
|
51
|
+
return ownKeys(o);
|
|
52
|
+
};
|
|
53
|
+
return function (mod) {
|
|
54
|
+
if (mod && mod.__esModule) return mod;
|
|
55
|
+
var result = {};
|
|
56
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
57
|
+
__setModuleDefault(result, mod);
|
|
58
|
+
return result;
|
|
59
|
+
};
|
|
60
|
+
})();
|
|
13
61
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
|
+
const os = __importStar(require("node:os"));
|
|
63
|
+
const capabilities_1 = require("./capabilities");
|
|
14
64
|
const read_1 = require("./read");
|
|
65
|
+
const scan_1 = require("./scan");
|
|
15
66
|
const USAGE = [
|
|
16
|
-
"usage: miadi-repomap list [--hub <path>] [--inventory <dir>] [--json]",
|
|
17
|
-
" miadi-repomap show <owner/name> [--hub <path>] [--inventory <dir>] [--json]",
|
|
67
|
+
"usage: miadi-repomap list [--hub <path>] [--inventory <dir>] [--lineage <file>] [--json]",
|
|
68
|
+
" miadi-repomap show <owner/name> [--hub <path>] [--inventory <dir>] [--lineage <file>] [--json]",
|
|
69
|
+
" miadi-repomap lineage [<owner/name>] [--lineage <file>] [--json]",
|
|
70
|
+
" miadi-repomap capabilities [<owner/name>] [--capabilities <file>] [--json]",
|
|
71
|
+
" miadi-repomap scan <clone>... [--ref <ref>] [--repository <owner/name>] [--by <who>]",
|
|
18
72
|
].join("\n");
|
|
19
|
-
const FLAGS = {
|
|
73
|
+
const FLAGS = {
|
|
74
|
+
list: ["hub", "inventory", "lineage", "capabilities", "json"],
|
|
75
|
+
show: ["hub", "inventory", "lineage", "capabilities", "json"],
|
|
76
|
+
lineage: ["lineage", "json"],
|
|
77
|
+
capabilities: ["capabilities", "json"],
|
|
78
|
+
scan: ["ref", "repository", "by"],
|
|
79
|
+
};
|
|
20
80
|
class UsageError extends Error {
|
|
21
81
|
}
|
|
22
82
|
function parse(argv) {
|
|
@@ -57,6 +117,10 @@ function hubLine(hub) {
|
|
|
57
117
|
return `mapping read from ${hub.hubs.length} hub(s): ${hub.errors} errors, ${hub.warnings} warnings`;
|
|
58
118
|
}
|
|
59
119
|
}
|
|
120
|
+
const short = (id) => id.replace(/^repository:/, "");
|
|
121
|
+
function linkLines(links) {
|
|
122
|
+
return links.map((l) => ` ${short(l.repository)}${l.description ? ` — ${l.description}` : ""} [${l.revision}]`);
|
|
123
|
+
}
|
|
60
124
|
function sessionLine(s) {
|
|
61
125
|
const ending = s.disposition ? ` ending ${s.disposition.decided ?? `${s.disposition.proposed} (proposed)`}` : "";
|
|
62
126
|
return ` ${s.date ?? "?"} ${(s.tmux_session_name ?? s.session_id).padEnd(36)} ${(s.team ?? "-").padEnd(10)} ${s.status ?? "-"}${ending} ${s.session_id}`;
|
|
@@ -68,7 +132,69 @@ async function main() {
|
|
|
68
132
|
console.log(USAGE);
|
|
69
133
|
return 0;
|
|
70
134
|
}
|
|
71
|
-
const options = {
|
|
135
|
+
const options = {
|
|
136
|
+
hub: value(flags, "hub"),
|
|
137
|
+
inventory: value(flags, "inventory"),
|
|
138
|
+
lineage: value(flags, "lineage"),
|
|
139
|
+
capabilities: value(flags, "capabilities"),
|
|
140
|
+
};
|
|
141
|
+
if (command === "scan") {
|
|
142
|
+
const clones = positional.slice(1);
|
|
143
|
+
if (!clones.length)
|
|
144
|
+
throw new UsageError("scan needs at least one clone");
|
|
145
|
+
if (clones.length > 1 && value(flags, "repository"))
|
|
146
|
+
throw new UsageError("--repository names one clone's repository: scan one clone with it");
|
|
147
|
+
const observedBy = value(flags, "by") ?? `miadi-repomap scan (${os.userInfo().username}@${os.hostname()})`;
|
|
148
|
+
const rows = [];
|
|
149
|
+
for (const clone of clones) {
|
|
150
|
+
const result = await (0, scan_1.scanRepository)(clone, { ref: value(flags, "ref"), repository: value(flags, "repository"), observedBy });
|
|
151
|
+
console.error(`${result.repository.replace(/^repository:/, "")} @ ${result.commit.slice(0, 12)} (${result.ref}): ${result.capabilities.length} capabilities`);
|
|
152
|
+
rows.push(...result.capabilities);
|
|
153
|
+
}
|
|
154
|
+
for (const row of (0, capabilities_1.mergeCapabilityRows)(rows))
|
|
155
|
+
console.log(JSON.stringify(row));
|
|
156
|
+
return 0;
|
|
157
|
+
}
|
|
158
|
+
if (command === "capabilities") {
|
|
159
|
+
const answer = (0, read_1.repositoryCapabilities)(positional[1], { capabilities: options.capabilities });
|
|
160
|
+
for (const i of answer.issues)
|
|
161
|
+
console.error(`${i.severity} ${i.file ?? ""}${i.line ? `:${i.line}` : ""} — ${i.message}`);
|
|
162
|
+
if (flags.json) {
|
|
163
|
+
console.log(JSON.stringify(answer, null, 2));
|
|
164
|
+
return 0;
|
|
165
|
+
}
|
|
166
|
+
const subject = answer.repository ? short(answer.repository) : "every repository";
|
|
167
|
+
console.log(`${subject} provides ${answer.capabilities.length}: ${answer.counts.package} packages, ${answer.counts.cli} CLIs, ${answer.counts.skill} skills`);
|
|
168
|
+
for (const c of answer.capabilities) {
|
|
169
|
+
const by = answer.repository ? "" : ` (${c.providedBy.map(short).join(", ")})`;
|
|
170
|
+
console.log(` ${(c.kind ?? "other").padEnd(8)} ${c.name}${by}${c.statement ? ` — ${c.statement}` : ` [${c.status}]`}`);
|
|
171
|
+
}
|
|
172
|
+
return 0;
|
|
173
|
+
}
|
|
174
|
+
if (command === "lineage") {
|
|
175
|
+
const answer = (0, read_1.repositoryLineage)(positional[1], { lineage: options.lineage });
|
|
176
|
+
for (const i of answer.issues)
|
|
177
|
+
console.error(`${i.severity} ${i.file ?? ""}${i.line ? `:${i.line}` : ""} — ${i.message}`);
|
|
178
|
+
if (flags.json) {
|
|
179
|
+
console.log(JSON.stringify(answer, null, 2));
|
|
180
|
+
return 0;
|
|
181
|
+
}
|
|
182
|
+
if (answer.graph) {
|
|
183
|
+
for (const e of answer.graph.edges)
|
|
184
|
+
console.log(`${short(e.from)} learned from ${short(e.to)}${e.description ? ` — ${e.description}` : ""}`);
|
|
185
|
+
console.error(`${answer.graph.edges.length} lineages among ${answer.graph.nodes.length} repositories, read from ${answer.from.join(", ")}`);
|
|
186
|
+
return 0;
|
|
187
|
+
}
|
|
188
|
+
const l = answer.lineage;
|
|
189
|
+
const lines = [
|
|
190
|
+
`${short(answer.repository)} learned from (${l.learned_from.length}):`,
|
|
191
|
+
...(l.learned_from.length ? linkLines(l.learned_from) : [" no lineage recorded"]),
|
|
192
|
+
`${short(answer.repository)} taught (${l.taught.length}):`,
|
|
193
|
+
...(l.taught.length ? linkLines(l.taught) : [" no lineage recorded"]),
|
|
194
|
+
];
|
|
195
|
+
console.log(lines.join("\n"));
|
|
196
|
+
return 0;
|
|
197
|
+
}
|
|
72
198
|
if (command === "list") {
|
|
73
199
|
const listing = await (0, read_1.repositoryListing)(options);
|
|
74
200
|
if (flags.json) {
|
|
@@ -107,6 +233,12 @@ async function main() {
|
|
|
107
233
|
...r.features.map((f) => ` ${f.nodeId} [${f.status}]${f.statement ? ` ${f.statement}` : ""}`),
|
|
108
234
|
r.relations.length ? ` relations (${r.relations.length}):` : "",
|
|
109
235
|
...r.relations.map((x) => ` ${x.from} ${x.type} ${x.to}`),
|
|
236
|
+
r.lineage.learned_from.length ? ` learned from (${r.lineage.learned_from.length}):` : "",
|
|
237
|
+
...linkLines(r.lineage.learned_from),
|
|
238
|
+
r.lineage.taught.length ? ` taught (${r.lineage.taught.length}):` : "",
|
|
239
|
+
...linkLines(r.lineage.taught),
|
|
240
|
+
r.capabilities.length ? ` provides (${r.capabilities.length}):` : "",
|
|
241
|
+
...r.capabilities.map((c) => ` ${(c.kind ?? "other").padEnd(8)} ${c.name}${c.statement ? ` — ${c.statement}` : ` [${c.status}]`}`),
|
|
110
242
|
` sessions (${r.sessions.length}):`,
|
|
111
243
|
...r.sessions.map(sessionLine),
|
|
112
244
|
];
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
export type { RepositorySession, MappingState, HubState, RepositoryView, RepositorySummary, InventoryState, RepositoryListing, } from "./types";
|
|
2
2
|
export { dayOf, teamOf, dispositionOf, sessionOf, repositoryKey, sessionsByRepository, repositoryView, listRepositories, type SessionsByRepository, } from "./join";
|
|
3
|
-
export {
|
|
3
|
+
export { LineageRowSchema, parseLineage, lineageOf, lineageGraph, type LineageRow, type LineageEdge, type LineageLink, type RepositoryLineage, type LineageGraph, } from "./lineage";
|
|
4
|
+
export { SHIPPED_LINEAGE_JSONL, SHIPPED_LINEAGE_SOURCE } from "./shipped-lineage";
|
|
5
|
+
export { CAPABILITY_KINDS, capabilityId, kindOf, parsePackageJson, parseSkillFrontMatter, workspaceGlobs, packageManifests, skillFiles, capabilityRows, mergeCapabilityRows, providesEdges, capabilitiesOf, type CapabilityKind, type Artefact, type CapabilityRowContext, type ProvidesEdge, } from "./capabilities";
|
|
6
|
+
export { SHIPPED_CAPABILITIES, SHIPPED_CAPABILITIES_SCANS, SHIPPED_CAPABILITIES_SOURCE } from "./shipped-capabilities";
|
|
7
|
+
export { scanRepository, type ScanOptions, type ScanResult } from "./scan";
|
|
8
|
+
export { inventoryDir, hubPath, readHubState, readMapper, repositoryListing, repositoryDetail, readLineage, repositoryLineage, readCapabilities, repositoryCapabilities, type ReadOptions, type MapperRead, type LineageRead, type LineageAnswer, type CapabilitiesRead, type CapabilitiesAnswer, } from "./read";
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// "Repository" here is always a git repository, never the DDD Repository or a
|
|
5
5
|
// Data Mapper. Formerly @miadi/relational-repository-mapper (deprecated).
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.repositoryDetail = exports.repositoryListing = exports.readMapper = exports.readHubState = exports.hubPath = exports.inventoryDir = exports.listRepositories = exports.repositoryView = exports.sessionsByRepository = exports.repositoryKey = exports.sessionOf = exports.dispositionOf = exports.teamOf = exports.dayOf = void 0;
|
|
7
|
+
exports.repositoryCapabilities = exports.readCapabilities = exports.repositoryLineage = exports.readLineage = exports.repositoryDetail = exports.repositoryListing = exports.readMapper = exports.readHubState = exports.hubPath = exports.inventoryDir = exports.scanRepository = exports.SHIPPED_CAPABILITIES_SOURCE = exports.SHIPPED_CAPABILITIES_SCANS = exports.SHIPPED_CAPABILITIES = exports.capabilitiesOf = exports.providesEdges = exports.mergeCapabilityRows = exports.capabilityRows = exports.skillFiles = exports.packageManifests = exports.workspaceGlobs = exports.parseSkillFrontMatter = exports.parsePackageJson = exports.kindOf = exports.capabilityId = exports.CAPABILITY_KINDS = exports.SHIPPED_LINEAGE_SOURCE = exports.SHIPPED_LINEAGE_JSONL = exports.lineageGraph = exports.lineageOf = exports.parseLineage = exports.LineageRowSchema = exports.listRepositories = exports.repositoryView = exports.sessionsByRepository = exports.repositoryKey = exports.sessionOf = exports.dispositionOf = exports.teamOf = exports.dayOf = void 0;
|
|
8
8
|
var join_1 = require("./join");
|
|
9
9
|
Object.defineProperty(exports, "dayOf", { enumerable: true, get: function () { return join_1.dayOf; } });
|
|
10
10
|
Object.defineProperty(exports, "teamOf", { enumerable: true, get: function () { return join_1.teamOf; } });
|
|
@@ -14,6 +14,33 @@ Object.defineProperty(exports, "repositoryKey", { enumerable: true, get: functio
|
|
|
14
14
|
Object.defineProperty(exports, "sessionsByRepository", { enumerable: true, get: function () { return join_1.sessionsByRepository; } });
|
|
15
15
|
Object.defineProperty(exports, "repositoryView", { enumerable: true, get: function () { return join_1.repositoryView; } });
|
|
16
16
|
Object.defineProperty(exports, "listRepositories", { enumerable: true, get: function () { return join_1.listRepositories; } });
|
|
17
|
+
var lineage_1 = require("./lineage");
|
|
18
|
+
Object.defineProperty(exports, "LineageRowSchema", { enumerable: true, get: function () { return lineage_1.LineageRowSchema; } });
|
|
19
|
+
Object.defineProperty(exports, "parseLineage", { enumerable: true, get: function () { return lineage_1.parseLineage; } });
|
|
20
|
+
Object.defineProperty(exports, "lineageOf", { enumerable: true, get: function () { return lineage_1.lineageOf; } });
|
|
21
|
+
Object.defineProperty(exports, "lineageGraph", { enumerable: true, get: function () { return lineage_1.lineageGraph; } });
|
|
22
|
+
var shipped_lineage_1 = require("./shipped-lineage");
|
|
23
|
+
Object.defineProperty(exports, "SHIPPED_LINEAGE_JSONL", { enumerable: true, get: function () { return shipped_lineage_1.SHIPPED_LINEAGE_JSONL; } });
|
|
24
|
+
Object.defineProperty(exports, "SHIPPED_LINEAGE_SOURCE", { enumerable: true, get: function () { return shipped_lineage_1.SHIPPED_LINEAGE_SOURCE; } });
|
|
25
|
+
var capabilities_1 = require("./capabilities");
|
|
26
|
+
Object.defineProperty(exports, "CAPABILITY_KINDS", { enumerable: true, get: function () { return capabilities_1.CAPABILITY_KINDS; } });
|
|
27
|
+
Object.defineProperty(exports, "capabilityId", { enumerable: true, get: function () { return capabilities_1.capabilityId; } });
|
|
28
|
+
Object.defineProperty(exports, "kindOf", { enumerable: true, get: function () { return capabilities_1.kindOf; } });
|
|
29
|
+
Object.defineProperty(exports, "parsePackageJson", { enumerable: true, get: function () { return capabilities_1.parsePackageJson; } });
|
|
30
|
+
Object.defineProperty(exports, "parseSkillFrontMatter", { enumerable: true, get: function () { return capabilities_1.parseSkillFrontMatter; } });
|
|
31
|
+
Object.defineProperty(exports, "workspaceGlobs", { enumerable: true, get: function () { return capabilities_1.workspaceGlobs; } });
|
|
32
|
+
Object.defineProperty(exports, "packageManifests", { enumerable: true, get: function () { return capabilities_1.packageManifests; } });
|
|
33
|
+
Object.defineProperty(exports, "skillFiles", { enumerable: true, get: function () { return capabilities_1.skillFiles; } });
|
|
34
|
+
Object.defineProperty(exports, "capabilityRows", { enumerable: true, get: function () { return capabilities_1.capabilityRows; } });
|
|
35
|
+
Object.defineProperty(exports, "mergeCapabilityRows", { enumerable: true, get: function () { return capabilities_1.mergeCapabilityRows; } });
|
|
36
|
+
Object.defineProperty(exports, "providesEdges", { enumerable: true, get: function () { return capabilities_1.providesEdges; } });
|
|
37
|
+
Object.defineProperty(exports, "capabilitiesOf", { enumerable: true, get: function () { return capabilities_1.capabilitiesOf; } });
|
|
38
|
+
var shipped_capabilities_1 = require("./shipped-capabilities");
|
|
39
|
+
Object.defineProperty(exports, "SHIPPED_CAPABILITIES", { enumerable: true, get: function () { return shipped_capabilities_1.SHIPPED_CAPABILITIES; } });
|
|
40
|
+
Object.defineProperty(exports, "SHIPPED_CAPABILITIES_SCANS", { enumerable: true, get: function () { return shipped_capabilities_1.SHIPPED_CAPABILITIES_SCANS; } });
|
|
41
|
+
Object.defineProperty(exports, "SHIPPED_CAPABILITIES_SOURCE", { enumerable: true, get: function () { return shipped_capabilities_1.SHIPPED_CAPABILITIES_SOURCE; } });
|
|
42
|
+
var scan_1 = require("./scan");
|
|
43
|
+
Object.defineProperty(exports, "scanRepository", { enumerable: true, get: function () { return scan_1.scanRepository; } });
|
|
17
44
|
var read_1 = require("./read");
|
|
18
45
|
Object.defineProperty(exports, "inventoryDir", { enumerable: true, get: function () { return read_1.inventoryDir; } });
|
|
19
46
|
Object.defineProperty(exports, "hubPath", { enumerable: true, get: function () { return read_1.hubPath; } });
|
|
@@ -21,3 +48,7 @@ Object.defineProperty(exports, "readHubState", { enumerable: true, get: function
|
|
|
21
48
|
Object.defineProperty(exports, "readMapper", { enumerable: true, get: function () { return read_1.readMapper; } });
|
|
22
49
|
Object.defineProperty(exports, "repositoryListing", { enumerable: true, get: function () { return read_1.repositoryListing; } });
|
|
23
50
|
Object.defineProperty(exports, "repositoryDetail", { enumerable: true, get: function () { return read_1.repositoryDetail; } });
|
|
51
|
+
Object.defineProperty(exports, "readLineage", { enumerable: true, get: function () { return read_1.readLineage; } });
|
|
52
|
+
Object.defineProperty(exports, "repositoryLineage", { enumerable: true, get: function () { return read_1.repositoryLineage; } });
|
|
53
|
+
Object.defineProperty(exports, "readCapabilities", { enumerable: true, get: function () { return read_1.readCapabilities; } });
|
|
54
|
+
Object.defineProperty(exports, "repositoryCapabilities", { enumerable: true, get: function () { return read_1.repositoryCapabilities; } });
|
package/dist/join.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type RepositoryMapping } from "@medicine-wheel/developer-repository-mapping";
|
|
2
2
|
import type { InventorySnapshot } from "@miadi/hooks-interpreter";
|
|
3
|
+
import type { CapabilityFacet } from "@medicine-wheel/capabilities";
|
|
4
|
+
import { type LineageEdge } from "./lineage";
|
|
3
5
|
import type { RepositorySession, RepositorySummary, RepositoryView } from "./types";
|
|
4
6
|
/** A record's `date` as YYYY-MM-DD: older records write a full timestamp, newer ones the day. */
|
|
5
7
|
export declare function dayOf(date: string | undefined): string | undefined;
|
|
@@ -19,9 +21,9 @@ export interface SessionsByRepository {
|
|
|
19
21
|
}
|
|
20
22
|
export declare function sessionsByRepository(records: ReadonlyMap<string, InventorySnapshot>): SessionsByRepository;
|
|
21
23
|
/**
|
|
22
|
-
* One repository: its rows when a hub holds them,
|
|
23
|
-
* when
|
|
24
|
+
* One repository: its rows when a hub holds them, its sessions, and its
|
|
25
|
+
* lineage. Undefined when no hub, no record and no lineage names it.
|
|
24
26
|
*/
|
|
25
|
-
export declare function repositoryView(repository: string, mapping: RepositoryMapping | undefined, bySessions: SessionsByRepository, sources?: Record<string, string
|
|
26
|
-
/** Every repository a hub holds or a
|
|
27
|
-
export declare function listRepositories(mapping: RepositoryMapping | undefined, bySessions: SessionsByRepository): RepositorySummary[];
|
|
27
|
+
export declare function repositoryView(repository: string, mapping: RepositoryMapping | undefined, bySessions: SessionsByRepository, sources?: Record<string, string>, lineageEdges?: readonly LineageEdge[], capabilityRows?: readonly CapabilityFacet[]): RepositoryView | undefined;
|
|
28
|
+
/** Every repository a hub holds, a record names or a lineage names, most sessions first. */
|
|
29
|
+
export declare function listRepositories(mapping: RepositoryMapping | undefined, bySessions: SessionsByRepository, lineageEdges?: readonly LineageEdge[], capabilityRows?: readonly CapabilityFacet[]): RepositorySummary[];
|