@miadi/relational-git-repository-mapper 0.5.0 → 0.5.2
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 +24 -1
- package/dist/capabilities.d.ts +2 -74
- package/dist/capabilities.js +20 -219
- package/dist/cli.js +8 -3
- package/dist/impact.d.ts +2 -89
- package/dist/impact.js +8 -167
- package/dist/index.d.ts +3 -3
- package/dist/index.js +7 -2
- package/dist/lineage.d.ts +4 -4
- package/dist/read.d.ts +38 -1
- package/dist/read.js +62 -4
- package/dist/scan.d.ts +2 -19
- package/dist/scan.js +7 -74
- package/dist/shipped-capabilities.js +1237 -787
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -29,6 +29,24 @@ 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
|
+
## The address of a capability
|
|
33
|
+
|
|
34
|
+
Each capability has an address that an episode, an issue, an inquiry, a ceremony
|
|
35
|
+
diary entry or a circle turn cites it by (Episode 568, decided by William on
|
|
36
|
+
2026-11-01): `miadi-capability://<owner>/<repo>/<kind>/<name>`, for example
|
|
37
|
+
`miadi-capability://jgwill/medicine-wheel/skill/fire-keeper-check`. `capabilities`
|
|
38
|
+
prints it under each row, `capabilityAddress()` makes it, and `findCapability()`
|
|
39
|
+
reads the row an address names. In the app it opens
|
|
40
|
+
`/capabilities/<owner>/<repo>/<kind>/<name>`; the grammar is
|
|
41
|
+
`@miadi/inquiry-weave/references` (`parseCapabilityUri`).
|
|
42
|
+
|
|
43
|
+
## Capabilities defined in code
|
|
44
|
+
|
|
45
|
+
A repository that defines capabilities in code, not in files of their own, is read
|
|
46
|
+
by a reader written for that file (`CODE_READERS`), never guessed. The first is the
|
|
47
|
+
medicine wheel's `cli/skills.ts`, whose 13 skills `mw skill install` writes out as
|
|
48
|
+
SKILL.md files.
|
|
49
|
+
|
|
32
50
|
## Lineage: which git repository learned from which
|
|
33
51
|
|
|
34
52
|
A lineage is not a dependency. `learned-from` says that one repository took what another
|
|
@@ -64,7 +82,11 @@ miadi-repomap capabilities # every capability, and who
|
|
|
64
82
|
miadi-repomap scan <clone>... --by "<who>" # read a clone's default branch, print JSONL rows
|
|
65
83
|
```
|
|
66
84
|
|
|
67
|
-
`scan`
|
|
85
|
+
`scan` takes a repository's own `.miadi/capabilities.jsonl` first when the commit holds one,
|
|
86
|
+
merged with what the commit's files say. Anyone writes that file with
|
|
87
|
+
`npx @medicine-wheel/developer-repository-mapping capabilities scan --write`, which is where the
|
|
88
|
+
scan now lives, so it runs without the Factory. `scan` reads a repository's default branch
|
|
89
|
+
(`origin/HEAD`) from git objects, never its
|
|
68
90
|
working tree, so a clone on another branch or with edits of its own reads the same. It reads
|
|
69
91
|
the packages the repository declares (`workspaces`, or `pnpm-workspace.yaml`), each
|
|
70
92
|
package's `bin`, and every `SKILL.md` outside `node_modules` and archives. A statement is the
|
|
@@ -121,6 +143,7 @@ name them (`miadi-chronicle://<number>`), linked to the chronicle page.
|
|
|
121
143
|
| `MIADI_REPOSITORY_LINEAGE` | none | a lineage JSONL read before the shipped rows |
|
|
122
144
|
| `MIADI_REPOSITORY_CAPABILITIES` | none | a capability JSONL read before the shipped rows |
|
|
123
145
|
| `MIADI_REPOSITORY_HOSTS` | none | a where JSONL (`where --write`) read before the shipped readings |
|
|
146
|
+
| `MIADI_REPOSITORY_PACKAGES` | none | a package readings JSONL (`mw-repomap capabilities map --packages`) read before the shipped ones |
|
|
124
147
|
| `MIADI_HOST_GIT_ROOTS` | `/srv/git` | where `where` looks for bare repositories, colon-separated |
|
|
125
148
|
|
|
126
149
|
## CLI
|
package/dist/capabilities.d.ts
CHANGED
|
@@ -1,74 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export type CapabilityKind
|
|
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
|
-
version?: string;
|
|
21
|
-
description?: string;
|
|
22
|
-
bins: string[];
|
|
23
|
-
/** runtime dependencies (dependencies, peerDependencies, optionalDependencies): name → range */
|
|
24
|
-
dependsOn: Record<string, string>;
|
|
25
|
-
};
|
|
26
|
-
/** `name` and `description` from a SKILL.md front matter, plain, quoted or folded (`>`, `|`). */
|
|
27
|
-
export declare function parseSkillFrontMatter(text: string): {
|
|
28
|
-
name?: string;
|
|
29
|
-
description?: string;
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* The folders a repository declares as its packages: `workspaces` of the root
|
|
33
|
-
* package.json (an array, or `{ packages }`), else the `packages:` list of
|
|
34
|
-
* pnpm-workspace.yaml. `.` is the root. Only `dir` and `dir/*` are expanded.
|
|
35
|
-
*/
|
|
36
|
-
export declare function workspaceGlobs(rootPackageJson?: string, pnpmWorkspace?: string): string[];
|
|
37
|
-
/** The package.json paths of a repository's declared packages, among the files it holds. */
|
|
38
|
-
export declare function packageManifests(globs: readonly string[], files: readonly string[]): string[];
|
|
39
|
-
/** The SKILL.md files a repository holds, outside dependencies and archives. */
|
|
40
|
-
export declare function skillFiles(files: readonly string[]): string[];
|
|
41
|
-
export interface CapabilityRowContext {
|
|
42
|
-
/** `repository:<owner>/<name>` */
|
|
43
|
-
repository: string;
|
|
44
|
-
/** the commit the files were read at */
|
|
45
|
-
commit: string;
|
|
46
|
-
observedBy: string;
|
|
47
|
-
/** ISO 8601 */
|
|
48
|
-
observedAt: string;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Capability rows for one repository. One row per id: two files naming the
|
|
52
|
-
* same skill are one capability with both files as its grounding.
|
|
53
|
-
*/
|
|
54
|
-
export declare function capabilityRows(artefacts: readonly Artefact[], ctx: CapabilityRowContext): CapabilityFacet[];
|
|
55
|
-
/**
|
|
56
|
-
* Rows from several repositories as one inventory: a capability two
|
|
57
|
-
* repositories provide is one row that both provide, with both files as its
|
|
58
|
-
* grounding. The first row read keeps its name and statement.
|
|
59
|
-
*/
|
|
60
|
-
export declare function mergeCapabilityRows(rows: readonly CapabilityFacet[]): CapabilityFacet[];
|
|
61
|
-
/** One `provides` edge: a repository provides a capability, said by whoever said the capability. */
|
|
62
|
-
export interface ProvidesEdge {
|
|
63
|
-
from: string;
|
|
64
|
-
to: string;
|
|
65
|
-
type: "provides";
|
|
66
|
-
statedBy: string;
|
|
67
|
-
statedAt: string;
|
|
68
|
-
grounding: string[];
|
|
69
|
-
revision: CapabilityFacet["revision"];
|
|
70
|
-
}
|
|
71
|
-
/** The `provides` edges a set of capability rows holds, one per provider. */
|
|
72
|
-
export declare function providesEdges(capabilities: readonly CapabilityFacet[]): ProvidesEdge[];
|
|
73
|
-
/** The capabilities a repository provides, matched case-folded, by kind then id. */
|
|
74
|
-
export declare function capabilitiesOf(repository: string, capabilities: readonly CapabilityFacet[]): CapabilityFacet[];
|
|
1
|
+
export { CAPABILITY_KINDS, CODE_READERS, capabilitiesOf, capabilityAddress, capabilityId, capabilityRows, kindOf, medicineWheelSkills, mergeCapabilityRows, packageManifests, parsePackageJson, parseSkillFrontMatter, providesEdges, skillFiles, workspaceGlobs, } from "@medicine-wheel/developer-repository-mapping";
|
|
2
|
+
export type { Artefact, CapabilityKind, CapabilityRowContext, CodeReader, ProvidesEdge } from "@medicine-wheel/developer-repository-mapping";
|
package/dist/capabilities.js
CHANGED
|
@@ -1,221 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
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").
|
|
2
|
+
// The capability scan's pure half lives in @medicine-wheel/developer-repository-mapping
|
|
3
|
+
// (P20), so anyone can run it without the Factory. Re-exported here so this
|
|
4
|
+
// package's surface stays what it was.
|
|
11
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.CAPABILITY_KINDS = void 0;
|
|
13
|
-
|
|
14
|
-
exports.
|
|
15
|
-
exports.
|
|
16
|
-
exports.
|
|
17
|
-
exports.
|
|
18
|
-
exports.
|
|
19
|
-
exports.
|
|
20
|
-
exports.
|
|
21
|
-
exports.
|
|
22
|
-
exports.
|
|
23
|
-
exports.
|
|
24
|
-
|
|
25
|
-
exports
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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 str = (v) => (typeof v === "string" && v.trim() ? v.trim() : undefined);
|
|
44
|
-
const name = str(p.name);
|
|
45
|
-
const version = str(p.version);
|
|
46
|
-
const description = str(p.description);
|
|
47
|
-
let bins = [];
|
|
48
|
-
if (typeof p.bin === "string" && name)
|
|
49
|
-
bins = [name.replace(/^@[^/]+\//, "")];
|
|
50
|
-
else if (p.bin && typeof p.bin === "object")
|
|
51
|
-
bins = Object.keys(p.bin);
|
|
52
|
-
const dependsOn = {};
|
|
53
|
-
for (const key of ["optionalDependencies", "peerDependencies", "dependencies"]) {
|
|
54
|
-
const deps = p[key];
|
|
55
|
-
if (deps && typeof deps === "object") {
|
|
56
|
-
for (const [dep, range] of Object.entries(deps))
|
|
57
|
-
if (typeof range === "string")
|
|
58
|
-
dependsOn[dep] = range;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return { ...(name ? { name } : {}), ...(version ? { version } : {}), ...(description ? { description } : {}), bins, dependsOn };
|
|
62
|
-
}
|
|
63
|
-
catch {
|
|
64
|
-
return { bins: [], dependsOn: {} };
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
/** `name` and `description` from a SKILL.md front matter, plain, quoted or folded (`>`, `|`). */
|
|
68
|
-
function parseSkillFrontMatter(text) {
|
|
69
|
-
const m = /^---\r?\n([\s\S]*?)\r?\n---/.exec(text);
|
|
70
|
-
if (!m)
|
|
71
|
-
return {};
|
|
72
|
-
const lines = m[1].split(/\r?\n/);
|
|
73
|
-
const field = (key) => {
|
|
74
|
-
const i = lines.findIndex((l) => new RegExp(`^${key}:`).test(l));
|
|
75
|
-
if (i < 0)
|
|
76
|
-
return undefined;
|
|
77
|
-
let value = lines[i].slice(key.length + 1).trim();
|
|
78
|
-
if (/^[>|][+-]?$/.test(value)) {
|
|
79
|
-
const folded = [];
|
|
80
|
-
for (const l of lines.slice(i + 1)) {
|
|
81
|
-
if (/^\S/.test(l))
|
|
82
|
-
break;
|
|
83
|
-
folded.push(l.trim());
|
|
84
|
-
}
|
|
85
|
-
value = folded.join(" ").trim();
|
|
86
|
-
}
|
|
87
|
-
value = value.replace(/^(["'])([\s\S]*)\1$/, "$2").trim();
|
|
88
|
-
return value || undefined;
|
|
89
|
-
};
|
|
90
|
-
const name = field("name");
|
|
91
|
-
const description = field("description");
|
|
92
|
-
return { ...(name ? { name } : {}), ...(description ? { description } : {}) };
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* The folders a repository declares as its packages: `workspaces` of the root
|
|
96
|
-
* package.json (an array, or `{ packages }`), else the `packages:` list of
|
|
97
|
-
* pnpm-workspace.yaml. `.` is the root. Only `dir` and `dir/*` are expanded.
|
|
98
|
-
*/
|
|
99
|
-
function workspaceGlobs(rootPackageJson, pnpmWorkspace) {
|
|
100
|
-
try {
|
|
101
|
-
const root = rootPackageJson ? JSON.parse(rootPackageJson) : {};
|
|
102
|
-
const w = root.workspaces;
|
|
103
|
-
const list = Array.isArray(w) ? w : w && typeof w === "object" ? w.packages : undefined;
|
|
104
|
-
if (Array.isArray(list) && list.length)
|
|
105
|
-
return [".", ...list.filter((x) => typeof x === "string")];
|
|
106
|
-
}
|
|
107
|
-
catch {
|
|
108
|
-
// an unreadable root manifest declares nothing
|
|
109
|
-
}
|
|
110
|
-
if (pnpmWorkspace) {
|
|
111
|
-
const block = /(^|\n)packages:\s*\n((?:[ \t]+-[^\n]*\n?)+)/.exec(pnpmWorkspace);
|
|
112
|
-
if (block) {
|
|
113
|
-
return block[2]
|
|
114
|
-
.split("\n")
|
|
115
|
-
.map((l) => l.replace(/^[ \t]+-\s*/, "").replace(/\s+#.*$/, "").replace(/^['"]|['"]$/g, "").trim())
|
|
116
|
-
.filter(Boolean);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
return ["."];
|
|
120
|
-
}
|
|
121
|
-
/** The package.json paths of a repository's declared packages, among the files it holds. */
|
|
122
|
-
function packageManifests(globs, files) {
|
|
123
|
-
const manifests = new Set();
|
|
124
|
-
const held = new Set(files);
|
|
125
|
-
for (const glob of globs) {
|
|
126
|
-
const dir = glob.replace(/^\.\//, "").replace(/\/+$/, "");
|
|
127
|
-
if (dir === "." || dir === "") {
|
|
128
|
-
if (held.has("package.json"))
|
|
129
|
-
manifests.add("package.json");
|
|
130
|
-
}
|
|
131
|
-
else if (dir.endsWith("/*")) {
|
|
132
|
-
const base = `${dir.slice(0, -2)}/`;
|
|
133
|
-
for (const f of files) {
|
|
134
|
-
const rest = f.startsWith(base) ? f.slice(base.length) : "";
|
|
135
|
-
if (/^[^/]+\/package\.json$/.test(rest))
|
|
136
|
-
manifests.add(f);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
else if (held.has(`${dir}/package.json`)) {
|
|
140
|
-
manifests.add(`${dir}/package.json`);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
return [...manifests].sort();
|
|
144
|
-
}
|
|
145
|
-
/** The SKILL.md files a repository holds, outside dependencies and archives. */
|
|
146
|
-
function skillFiles(files) {
|
|
147
|
-
return files
|
|
148
|
-
.filter((f) => /(^|\/)SKILL\.md$/.test(f))
|
|
149
|
-
.filter((f) => !/(^|\/)(node_modules|archives?|archived-[^/]*|dist|\.next)\//.test(f))
|
|
150
|
-
.sort();
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Capability rows for one repository. One row per id: two files naming the
|
|
154
|
-
* same skill are one capability with both files as its grounding.
|
|
155
|
-
*/
|
|
156
|
-
function capabilityRows(artefacts, ctx) {
|
|
157
|
-
const where = `${ctx.repository.replace(/^repository:/, "")}@${ctx.commit.slice(0, 12)}`;
|
|
158
|
-
const rows = new Map();
|
|
159
|
-
for (const a of artefacts) {
|
|
160
|
-
const nodeId = capabilityId(a.kind, a.name);
|
|
161
|
-
const grounding = `${where}:${a.path}`;
|
|
162
|
-
const existing = rows.get(nodeId);
|
|
163
|
-
if (existing) {
|
|
164
|
-
if (!existing.grounding.includes(grounding))
|
|
165
|
-
existing.grounding.push(grounding);
|
|
166
|
-
continue;
|
|
167
|
-
}
|
|
168
|
-
const fits = a.description ? (0, capabilities_1.checkStatement)(a.description).fits : false;
|
|
169
|
-
rows.set(nodeId, {
|
|
170
|
-
nodeId,
|
|
171
|
-
name: a.name,
|
|
172
|
-
...(fits ? { statement: a.description } : {}),
|
|
173
|
-
status: fits ? "clear" : "needs-resolution",
|
|
174
|
-
providedBy: [ctx.repository],
|
|
175
|
-
statedBy: ctx.observedBy,
|
|
176
|
-
statedAt: ctx.observedAt,
|
|
177
|
-
grounding: [grounding],
|
|
178
|
-
revision: "pending",
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
return [...rows.values()];
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Rows from several repositories as one inventory: a capability two
|
|
185
|
-
* repositories provide is one row that both provide, with both files as its
|
|
186
|
-
* grounding. The first row read keeps its name and statement.
|
|
187
|
-
*/
|
|
188
|
-
function mergeCapabilityRows(rows) {
|
|
189
|
-
const merged = new Map();
|
|
190
|
-
for (const row of rows) {
|
|
191
|
-
const existing = merged.get(row.nodeId);
|
|
192
|
-
if (!existing) {
|
|
193
|
-
merged.set(row.nodeId, { ...row, providedBy: [...row.providedBy], grounding: [...row.grounding] });
|
|
194
|
-
continue;
|
|
195
|
-
}
|
|
196
|
-
for (const p of row.providedBy)
|
|
197
|
-
if (!existing.providedBy.includes(p))
|
|
198
|
-
existing.providedBy.push(p);
|
|
199
|
-
for (const g of row.grounding)
|
|
200
|
-
if (!existing.grounding.includes(g))
|
|
201
|
-
existing.grounding.push(g);
|
|
202
|
-
}
|
|
203
|
-
return [...merged.values()].sort((a, b) => (a.nodeId < b.nodeId ? -1 : a.nodeId > b.nodeId ? 1 : 0));
|
|
204
|
-
}
|
|
205
|
-
/** The `provides` edges a set of capability rows holds, one per provider. */
|
|
206
|
-
function providesEdges(capabilities) {
|
|
207
|
-
return capabilities.flatMap((c) => c.providedBy.map((from) => ({
|
|
208
|
-
from,
|
|
209
|
-
to: c.nodeId,
|
|
210
|
-
type: "provides",
|
|
211
|
-
statedBy: c.statedBy,
|
|
212
|
-
statedAt: c.statedAt,
|
|
213
|
-
grounding: c.grounding,
|
|
214
|
-
revision: c.revision,
|
|
215
|
-
})));
|
|
216
|
-
}
|
|
217
|
-
/** The capabilities a repository provides, matched case-folded, by kind then id. */
|
|
218
|
-
function capabilitiesOf(repository, capabilities) {
|
|
219
|
-
const id = (repository.startsWith("repository:") ? repository : `repository:${repository}`).toLowerCase();
|
|
220
|
-
return capabilities.filter((c) => c.providedBy.some((p) => p.toLowerCase() === id));
|
|
221
|
-
}
|
|
6
|
+
exports.workspaceGlobs = exports.skillFiles = exports.providesEdges = exports.parseSkillFrontMatter = exports.parsePackageJson = exports.packageManifests = exports.mergeCapabilityRows = exports.medicineWheelSkills = exports.kindOf = exports.capabilityRows = exports.capabilityId = exports.capabilityAddress = exports.capabilitiesOf = exports.CODE_READERS = exports.CAPABILITY_KINDS = void 0;
|
|
7
|
+
var developer_repository_mapping_1 = require("@medicine-wheel/developer-repository-mapping");
|
|
8
|
+
Object.defineProperty(exports, "CAPABILITY_KINDS", { enumerable: true, get: function () { return developer_repository_mapping_1.CAPABILITY_KINDS; } });
|
|
9
|
+
Object.defineProperty(exports, "CODE_READERS", { enumerable: true, get: function () { return developer_repository_mapping_1.CODE_READERS; } });
|
|
10
|
+
Object.defineProperty(exports, "capabilitiesOf", { enumerable: true, get: function () { return developer_repository_mapping_1.capabilitiesOf; } });
|
|
11
|
+
Object.defineProperty(exports, "capabilityAddress", { enumerable: true, get: function () { return developer_repository_mapping_1.capabilityAddress; } });
|
|
12
|
+
Object.defineProperty(exports, "capabilityId", { enumerable: true, get: function () { return developer_repository_mapping_1.capabilityId; } });
|
|
13
|
+
Object.defineProperty(exports, "capabilityRows", { enumerable: true, get: function () { return developer_repository_mapping_1.capabilityRows; } });
|
|
14
|
+
Object.defineProperty(exports, "kindOf", { enumerable: true, get: function () { return developer_repository_mapping_1.kindOf; } });
|
|
15
|
+
Object.defineProperty(exports, "medicineWheelSkills", { enumerable: true, get: function () { return developer_repository_mapping_1.medicineWheelSkills; } });
|
|
16
|
+
Object.defineProperty(exports, "mergeCapabilityRows", { enumerable: true, get: function () { return developer_repository_mapping_1.mergeCapabilityRows; } });
|
|
17
|
+
Object.defineProperty(exports, "packageManifests", { enumerable: true, get: function () { return developer_repository_mapping_1.packageManifests; } });
|
|
18
|
+
Object.defineProperty(exports, "parsePackageJson", { enumerable: true, get: function () { return developer_repository_mapping_1.parsePackageJson; } });
|
|
19
|
+
Object.defineProperty(exports, "parseSkillFrontMatter", { enumerable: true, get: function () { return developer_repository_mapping_1.parseSkillFrontMatter; } });
|
|
20
|
+
Object.defineProperty(exports, "providesEdges", { enumerable: true, get: function () { return developer_repository_mapping_1.providesEdges; } });
|
|
21
|
+
Object.defineProperty(exports, "skillFiles", { enumerable: true, get: function () { return developer_repository_mapping_1.skillFiles; } });
|
|
22
|
+
Object.defineProperty(exports, "workspaceGlobs", { enumerable: true, get: function () { return developer_repository_mapping_1.workspaceGlobs; } });
|
package/dist/cli.js
CHANGED
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
//
|
|
19
19
|
// `capabilities <owner/name>` answers what a repository provides: its
|
|
20
20
|
// packages, CLIs and skills as capability nodes, each with a `provides` edge.
|
|
21
|
-
// `scan` reads a clone's default branch from git objects
|
|
21
|
+
// `scan` reads a clone's default branch from git objects, its own
|
|
22
|
+
// .miadi/capabilities.jsonl first when it holds one (never its working
|
|
22
23
|
// tree) and prints those rows as JSONL, pending until a person reads them.
|
|
23
24
|
// --capabilities adds a host's JSONL before the shipped rows (default
|
|
24
25
|
// MIADI_REPOSITORY_CAPABILITIES).
|
|
@@ -207,8 +208,10 @@ async function main() {
|
|
|
207
208
|
const rows = [];
|
|
208
209
|
const packages = [];
|
|
209
210
|
for (const clone of clones) {
|
|
210
|
-
const result = await (0, scan_1.
|
|
211
|
-
|
|
211
|
+
const result = await (0, scan_1.readRepositoryCapabilities)(clone, { ref: value(flags, "ref"), repository: value(flags, "repository"), observedBy });
|
|
212
|
+
for (const i of result.issues)
|
|
213
|
+
console.error(`${i.severity} ${result.repository.replace(/^repository:/, "")} ${i.file ?? ""}${i.line ? `:${i.line}` : ""} — ${i.message}`);
|
|
214
|
+
console.error(`${result.repository.replace(/^repository:/, "")} @ ${result.commit.slice(0, 12)} (${result.ref}): ${result.capabilities.length} capabilities, from ${result.source === "file" ? "its own .miadi/capabilities.jsonl" : "its files"}`);
|
|
212
215
|
rows.push(...result.capabilities);
|
|
213
216
|
packages.push(...result.packages);
|
|
214
217
|
}
|
|
@@ -232,6 +235,8 @@ async function main() {
|
|
|
232
235
|
for (const c of answer.capabilities) {
|
|
233
236
|
const by = answer.repository ? "" : ` (${c.providedBy.map(short).join(", ")})`;
|
|
234
237
|
console.log(` ${(c.kind ?? "other").padEnd(8)} ${c.name}${by}${c.statement ? ` — ${c.statement}` : ` [${c.status}]`}`);
|
|
238
|
+
if (c.address)
|
|
239
|
+
console.log(` ${c.address}`);
|
|
235
240
|
}
|
|
236
241
|
return 0;
|
|
237
242
|
}
|
package/dist/impact.d.ts
CHANGED
|
@@ -1,89 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
/** `capability:package-…` */
|
|
4
|
-
capability: z.ZodString;
|
|
5
|
-
name: z.ZodString;
|
|
6
|
-
version: z.ZodOptional<z.ZodString>;
|
|
7
|
-
repository: z.ZodString;
|
|
8
|
-
path: z.ZodString;
|
|
9
|
-
commit: z.ZodString;
|
|
10
|
-
/** runtime dependencies as declared (dependencies, peer, optional): name → range */
|
|
11
|
-
dependsOn: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
12
|
-
}, "strict", z.ZodTypeAny, {
|
|
13
|
-
name: string;
|
|
14
|
-
capability: string;
|
|
15
|
-
repository: string;
|
|
16
|
-
path: string;
|
|
17
|
-
commit: string;
|
|
18
|
-
dependsOn: Record<string, string>;
|
|
19
|
-
version?: string | undefined;
|
|
20
|
-
}, {
|
|
21
|
-
name: string;
|
|
22
|
-
capability: string;
|
|
23
|
-
repository: string;
|
|
24
|
-
path: string;
|
|
25
|
-
commit: string;
|
|
26
|
-
dependsOn: Record<string, string>;
|
|
27
|
-
version?: string | undefined;
|
|
28
|
-
}>;
|
|
29
|
-
export type PackageReading = z.infer<typeof PackageReadingSchema>;
|
|
30
|
-
export interface ConsumesEdge {
|
|
31
|
-
/** the consuming package's capability */
|
|
32
|
-
from: string;
|
|
33
|
-
/** the consumed package's capability */
|
|
34
|
-
to: string;
|
|
35
|
-
type: "consumes";
|
|
36
|
-
fromName: string;
|
|
37
|
-
toName: string;
|
|
38
|
-
/** the range `from` declares on `to` */
|
|
39
|
-
range: string;
|
|
40
|
-
}
|
|
41
|
-
/** `consumes` edges between the packages read, first-party only. */
|
|
42
|
-
export declare function consumesEdges(packages: readonly PackageReading[]): ConsumesEdge[];
|
|
43
|
-
export type BumpLevel = "major" | "minor" | "patch";
|
|
44
|
-
export declare function bumpVersion(version: string, level: BumpLevel): string | undefined;
|
|
45
|
-
/**
|
|
46
|
-
* Whether `version` satisfies `range`, for the forms first-party manifests
|
|
47
|
-
* use: exact, `^`, `~`, `>=`, `*`/`latest`/empty, and pnpm's `workspace:`
|
|
48
|
-
* forms, read as pnpm publishes them against `published` (the consumed
|
|
49
|
-
* package's version when the consumer was released). Undefined for anything
|
|
50
|
-
* else (`||`, `<`, `file:`, git URLs): read it by hand.
|
|
51
|
-
*/
|
|
52
|
-
export declare function satisfies(version: string, range: string, published?: string): boolean | undefined;
|
|
53
|
-
export interface ImpactLink {
|
|
54
|
-
name: string;
|
|
55
|
-
capability: string;
|
|
56
|
-
repository: string;
|
|
57
|
-
version?: string;
|
|
58
|
-
/** the range the consumer declares (downstream) or this package declares (upstream) */
|
|
59
|
-
range: string;
|
|
60
|
-
}
|
|
61
|
-
export interface ImpactConsumer extends ImpactLink {
|
|
62
|
-
/** 1 for a direct consumer, 2 for a consumer of a consumer, … */
|
|
63
|
-
depth: number;
|
|
64
|
-
/** the consumer it is reached through, from depth 2 */
|
|
65
|
-
via?: string;
|
|
66
|
-
/** with a bump, depth 1: whether its range reaches the new version */
|
|
67
|
-
accepts?: boolean;
|
|
68
|
-
/** with a bump: what the consumer needs */
|
|
69
|
-
action?: string;
|
|
70
|
-
}
|
|
71
|
-
export interface ImpactAnswer {
|
|
72
|
-
package: {
|
|
73
|
-
name: string;
|
|
74
|
-
capability: string;
|
|
75
|
-
version?: string;
|
|
76
|
-
repository: string;
|
|
77
|
-
};
|
|
78
|
-
bump?: {
|
|
79
|
-
level: BumpLevel;
|
|
80
|
-
from: string;
|
|
81
|
-
to: string;
|
|
82
|
-
};
|
|
83
|
-
/** upstream: the first-party packages it consumes */
|
|
84
|
-
consumes: ImpactLink[];
|
|
85
|
-
/** downstream: who consumes it, directly or through others */
|
|
86
|
-
consumers: ImpactConsumer[];
|
|
87
|
-
}
|
|
88
|
-
/** The impact of a package, found by name (`@miadi/x`) or capability id; undefined when no reading names it. */
|
|
89
|
-
export declare function impactOf(packageOrCapability: string, packages: readonly PackageReading[], bump?: BumpLevel): ImpactAnswer | undefined;
|
|
1
|
+
export { PackageReadingSchema, bumpVersion, consumesEdges, impactOf, satisfies } from "@medicine-wheel/developer-repository-mapping";
|
|
2
|
+
export type { BumpLevel, ConsumesEdge, ImpactAnswer, ImpactConsumer, ImpactLink, PackageReading } from "@medicine-wheel/developer-repository-mapping";
|