@medicine-wheel/developer-repository-mapping 0.27.19 → 0.27.21
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 +45 -1
- package/dist/capability-file.d.ts +108 -5
- package/dist/capability-file.d.ts.map +1 -1
- package/dist/capability-file.js +193 -20
- package/dist/capability-file.js.map +1 -1
- package/dist/capability-scan.d.ts +43 -9
- package/dist/capability-scan.d.ts.map +1 -1
- package/dist/capability-scan.js +90 -14
- package/dist/capability-scan.js.map +1 -1
- package/dist/check.d.ts.map +1 -1
- package/dist/check.js +16 -0
- package/dist/check.js.map +1 -1
- package/dist/cli.d.ts +11 -3
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +166 -15
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/dist/merge.d.ts.map +1 -1
- package/dist/merge.js +9 -0
- package/dist/merge.js.map +1 -1
- package/dist/node/capability-index.d.ts +65 -0
- package/dist/node/capability-index.d.ts.map +1 -0
- package/dist/node/capability-index.js +127 -0
- package/dist/node/capability-index.js.map +1 -0
- package/dist/node/capability-scan.d.ts +28 -2
- package/dist/node/capability-scan.d.ts.map +1 -1
- package/dist/node/capability-scan.js +104 -11
- package/dist/node/capability-scan.js.map +1 -1
- package/dist/node/fs.d.ts +10 -0
- package/dist/node/fs.d.ts.map +1 -1
- package/dist/node/fs.js +28 -0
- package/dist/node/fs.js.map +1 -1
- package/dist/node/index.d.ts +7 -3
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +13 -1
- package/dist/node/index.js.map +1 -1
- package/dist/node/skills.d.ts +37 -0
- package/dist/node/skills.d.ts.map +1 -0
- package/dist/node/skills.js +99 -0
- package/dist/node/skills.js.map +1 -0
- package/dist/package-evidence.d.ts +10 -10
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +7 -0
- package/dist/read.js.map +1 -1
- package/dist/schemas.d.ts +20 -20
- package/dist/types.d.ts +10 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -1
- package/package.json +4 -3
- package/schema/repository-capabilities.v5.schema.json +748 -0
- package/skills/capability-hub/SKILL.md +105 -0
- package/skills/capability-mapping/SKILL.md +162 -0
package/dist/index.js
CHANGED
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
*/
|
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
24
|
exports.capabilityAddress = exports.CODE_READERS = exports.CAPABILITY_KINDS = exports.readMapping = exports.toWheelEdges = exports.toWheelNodes = exports.mappingCapabilityClaims = exports.summarize = exports.mergeMappings = exports.relationKey = exports.hasErrors = exports.checkMapping = exports.toJsonl = exports.parseJsonDocument = exports.parseJsonl = exports.reconcileLifecycle = exports.classifyActivity = exports.daysSinceLastCommit = exports.transition = exports.ACTIVITY_THRESHOLDS = exports.LIFECYCLE_TRANSITIONS = exports.MappingManifestSchema = exports.OwnerRegistrationSchema = exports.RelationRowSchema = exports.FeatureFacetSchema = exports.RepositoryFacetSchema = exports.ActivityReadingSchema = exports.PrototypeNodeIdSchema = exports.ResearchFieldNodeIdSchema = exports.FeatureNodeIdSchema = exports.RepositoryNodeIdSchema = exports.DeveloperEdgeNameSchema = exports.OriginSchema = exports.LifecycleEventSchema = exports.LifecycleSchema = exports.parseGithubRemote = exports.repositoryUrl = exports.featureRepository = exports.featureNodeId = exports.toRepositoryNodeId = exports.parseRepositoryNodeId = exports.repositoryNodeId = exports.PROTOTYPE_ID = exports.RESEARCH_FIELD_ID = exports.FEATURE_ID = exports.REPOSITORY_ID = exports.PROTOTYPE_CORE_FEATURES = exports.MAPPING_SCHEMA = exports.MAPPING_FILES = exports.MAPPING_DIR = void 0;
|
|
25
|
-
exports.
|
|
26
|
-
exports.REPOSITORY_NAME = exports.CapabilityInputError = void 0;
|
|
25
|
+
exports.CapabilityFileHeaderSchema = exports.CapabilityNameSchema = exports.stagedWithoutCode = exports.specificationAddress = exports.SpecificationInFileSchema = exports.commandFileIn = exports.commandCliName = exports.builtElsewhere = exports.appManifestOf = exports.appManifestIn = exports.PackageFolderSchema = exports.CAPABILITY_FILE_V5_KEYS = exports.CAPABILITY_FILE_V4_KINDS = exports.CAPABILITY_FILE_V4_KEYS = exports.CAPABILITY_FILE_V3_KINDS = exports.CAPABILITY_FILE_V3_KEYS = exports.CAPABILITY_FILE_V2_KEYS = exports.CAPABILITY_FILE_VERSION = exports.CAPABILITY_FILE_SCHEMA = exports.CAPABILITY_FILE_ROW_KEYS = exports.CAPABILITY_FILE = exports.parsePackageEvidence = exports.PackageEvidenceSchema = exports.satisfies = exports.readingKey = exports.impactOf = exports.consumesEdges = exports.bumpVersion = exports.PackageReadingSchema = exports.statementFromFiles = exports.STATEMENT_MAX_CHARACTERS = exports.codePoints = exports.holdsUnsafeCharacter = exports.UNSAFE_CHARACTER = exports.workspaceGlobs = exports.skillFiles = exports.providesEdges = exports.parseSkillFrontMatter = exports.parsePackageJson = exports.unreadPackageManifests = exports.shipsFile = exports.packageFolder = exports.packageManifests = exports.mergeCapabilityRows = exports.miadiModelRouting = exports.medicineWheelSkills = exports.kindOf = exports.capabilitiesOf = exports.capabilityRows = exports.capabilityId = void 0;
|
|
26
|
+
exports.REPOSITORY_NAME = exports.CapabilityInputError = exports.stateCapabilityRow = exports.renderCapabilityFile = exports.parseCapabilityFile = exports.mergeCapabilityFile = exports.capabilityFileRows = exports.capabilityFileFacets = exports.SCAN_AUTHOR = exports.CapabilityFileRowSchema = void 0;
|
|
27
27
|
var types_1 = require("./types");
|
|
28
28
|
Object.defineProperty(exports, "MAPPING_DIR", { enumerable: true, get: function () { return types_1.MAPPING_DIR; } });
|
|
29
29
|
Object.defineProperty(exports, "MAPPING_FILES", { enumerable: true, get: function () { return types_1.MAPPING_FILES; } });
|
|
@@ -101,6 +101,9 @@ Object.defineProperty(exports, "medicineWheelSkills", { enumerable: true, get: f
|
|
|
101
101
|
Object.defineProperty(exports, "miadiModelRouting", { enumerable: true, get: function () { return capability_scan_1.miadiModelRouting; } });
|
|
102
102
|
Object.defineProperty(exports, "mergeCapabilityRows", { enumerable: true, get: function () { return capability_scan_1.mergeCapabilityRows; } });
|
|
103
103
|
Object.defineProperty(exports, "packageManifests", { enumerable: true, get: function () { return capability_scan_1.packageManifests; } });
|
|
104
|
+
Object.defineProperty(exports, "packageFolder", { enumerable: true, get: function () { return capability_scan_1.packageFolder; } });
|
|
105
|
+
Object.defineProperty(exports, "shipsFile", { enumerable: true, get: function () { return capability_scan_1.shipsFile; } });
|
|
106
|
+
Object.defineProperty(exports, "unreadPackageManifests", { enumerable: true, get: function () { return capability_scan_1.unreadPackageManifests; } });
|
|
104
107
|
Object.defineProperty(exports, "parsePackageJson", { enumerable: true, get: function () { return capability_scan_1.parsePackageJson; } });
|
|
105
108
|
Object.defineProperty(exports, "parseSkillFrontMatter", { enumerable: true, get: function () { return capability_scan_1.parseSkillFrontMatter; } });
|
|
106
109
|
Object.defineProperty(exports, "providesEdges", { enumerable: true, get: function () { return capability_scan_1.providesEdges; } });
|
|
@@ -131,8 +134,13 @@ Object.defineProperty(exports, "CAPABILITY_FILE_V3_KEYS", { enumerable: true, ge
|
|
|
131
134
|
Object.defineProperty(exports, "CAPABILITY_FILE_V3_KINDS", { enumerable: true, get: function () { return capability_file_1.CAPABILITY_FILE_V3_KINDS; } });
|
|
132
135
|
Object.defineProperty(exports, "CAPABILITY_FILE_V4_KEYS", { enumerable: true, get: function () { return capability_file_1.CAPABILITY_FILE_V4_KEYS; } });
|
|
133
136
|
Object.defineProperty(exports, "CAPABILITY_FILE_V4_KINDS", { enumerable: true, get: function () { return capability_file_1.CAPABILITY_FILE_V4_KINDS; } });
|
|
137
|
+
Object.defineProperty(exports, "CAPABILITY_FILE_V5_KEYS", { enumerable: true, get: function () { return capability_file_1.CAPABILITY_FILE_V5_KEYS; } });
|
|
138
|
+
Object.defineProperty(exports, "PackageFolderSchema", { enumerable: true, get: function () { return capability_file_1.PackageFolderSchema; } });
|
|
134
139
|
Object.defineProperty(exports, "appManifestIn", { enumerable: true, get: function () { return capability_file_1.appManifestIn; } });
|
|
135
140
|
Object.defineProperty(exports, "appManifestOf", { enumerable: true, get: function () { return capability_file_1.appManifestOf; } });
|
|
141
|
+
Object.defineProperty(exports, "builtElsewhere", { enumerable: true, get: function () { return capability_file_1.builtElsewhere; } });
|
|
142
|
+
Object.defineProperty(exports, "commandCliName", { enumerable: true, get: function () { return capability_file_1.commandCliName; } });
|
|
143
|
+
Object.defineProperty(exports, "commandFileIn", { enumerable: true, get: function () { return capability_file_1.commandFileIn; } });
|
|
136
144
|
Object.defineProperty(exports, "SpecificationInFileSchema", { enumerable: true, get: function () { return capability_file_1.SpecificationInFileSchema; } });
|
|
137
145
|
Object.defineProperty(exports, "specificationAddress", { enumerable: true, get: function () { return capability_file_1.specificationAddress; } });
|
|
138
146
|
Object.defineProperty(exports, "stagedWithoutCode", { enumerable: true, get: function () { return capability_file_1.stagedWithoutCode; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;AAoBH,iCAA8F;AAArF,oGAAA,WAAW,OAAA;AAAE,sGAAA,aAAa,OAAA;AAAE,uGAAA,cAAc,OAAA;AAAE,gHAAA,uBAAuB,OAAA;AAE5E,+EAA+E;AAC/E,6BAYe;AAXb,oGAAA,aAAa,OAAA;AACb,iGAAA,UAAU,OAAA;AACV,wGAAA,iBAAiB,OAAA;AACjB,mGAAA,YAAY,OAAA;AACZ,uGAAA,gBAAgB,OAAA;AAChB,4GAAA,qBAAqB,OAAA;AACrB,yGAAA,kBAAkB,OAAA;AAClB,oGAAA,aAAa,OAAA;AACb,wGAAA,iBAAiB,OAAA;AACjB,oGAAA,aAAa,OAAA;AACb,wGAAA,iB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IACjF,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,MAAM,EAAE,YAAY,EAAE,CAAC;CACxB;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,SAAS,UAAU,EAAE,GAAG,aAAa,
|
|
1
|
+
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../src/merge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE/D,MAAM,WAAW,UAAU;IACzB,wBAAwB;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,iBAAiB,CAAC;CAC5B;AAED,MAAM,WAAW,aAAc,SAAQ,iBAAiB;IACtD,0DAA0D;IAC1D,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,iFAAiF;IACjF,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,MAAM,EAAE,YAAY,EAAE,CAAC;CACxB;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,SAAS,UAAU,EAAE,GAAG,aAAa,CAqF5E"}
|
package/dist/merge.js
CHANGED
|
@@ -76,6 +76,15 @@ function mergeMappings(readings) {
|
|
|
76
76
|
capabilityJson.set(c.nodeId, json);
|
|
77
77
|
sources[c.nodeId] = hub;
|
|
78
78
|
}
|
|
79
|
+
// Each hub speaks for what its own repositories provide.
|
|
80
|
+
const acceptedFolded = new Set([...accepted].map((id) => id.toLowerCase()));
|
|
81
|
+
for (const c of mapping.provided ?? []) {
|
|
82
|
+
if (!c.providedBy.every((p) => acceptedFolded.has(p.toLowerCase()))) {
|
|
83
|
+
issues.push({ severity: 'warning', file: hub, nodeId: c.nodeId, message: `${hub} holds ${c.nodeId} of ${c.providedBy.join(', ')}, which is not read from ${hub}; skipped` });
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
(merged.provided ??= []).push(c);
|
|
87
|
+
}
|
|
79
88
|
for (const rel of mapping.relations) {
|
|
80
89
|
const key = (0, check_1.relationKey)(rel);
|
|
81
90
|
const speaker = (0, check_1.speakingOwner)(rel.from)?.toLowerCase();
|
package/dist/merge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge.js","sourceRoot":"","sources":["../src/merge.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAoBH,
|
|
1
|
+
{"version":3,"file":"merge.js","sourceRoot":"","sources":["../src/merge.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAoBH,sCAqFC;AAvGD,mCAAqD;AACrD,+BAA8C;AAiB9C,SAAgB,aAAa,CAAC,QAA+B;IAC3D,IAAI,CAAC,QAAQ,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IACnF,MAAM,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC;IACzB,MAAM,MAAM,GAAkB;QAC5B,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,QAAQ;QAChC,YAAY,EAAE,EAAE;QAChB,QAAQ,EAAE,EAAE;QACZ,YAAY,EAAE,EAAE;QAChB,SAAS,EAAE,EAAE;QACb,MAAM,EAAE,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;QACjC,IAAI,EAAE,EAAE;QACR,OAAO,EAAE,EAAE;QACX,MAAM,EAAE,EAAE;KACX,CAAC;IACF,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IACnC,MAAM,cAAc,GAAG,IAAI,GAAG,EAAkB,CAAC;IAEjD,KAAK,MAAM,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,IAAI,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC;QAC3D,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACtB,MAAM,KAAK,GA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CAAC,CAAC,CAAC,GAAG,OAAO,IAAI,OAAO,EAAE,CAAC,CAAC,CAAC,cAAc,sBAAsB,EAAE,CAAC,CAAC;gBACnL,SAAS;YACX,CAAC;YACD,IAAI,OAAO,CAAC,GAAG,CAAC;gBAAE,SAAS;YAC3B,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC3B,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;QACrB,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A hub's index of what its repositories provide.
|
|
3
|
+
*
|
|
4
|
+
* Each repository says what it provides in its own committed
|
|
5
|
+
* `.miadi/capabilities.jsonl`. A hub copies those rows into `provided.jsonl`
|
|
6
|
+
* so that whoever reads the hub, on GitHub or through a tool, sees what its
|
|
7
|
+
* owner's repositories offer without cloning each one.
|
|
8
|
+
*
|
|
9
|
+
* Two rules keep the copy answerable to its sources:
|
|
10
|
+
*
|
|
11
|
+
* - Only a repository the hub lists is indexed. A public hub has no row for a
|
|
12
|
+
* private repository, so nothing a private repository provides is ever
|
|
13
|
+
* written into it, whatever clones are given.
|
|
14
|
+
* - Only a repository that holds its own committed capability file is
|
|
15
|
+
* indexed. The hub repeats what a repository said of itself; it never
|
|
16
|
+
* writes a reading of its own in a repository's name.
|
|
17
|
+
*
|
|
18
|
+
* Rows of repositories that were not read this time stay as they are, so
|
|
19
|
+
* indexing three clones never erases the others.
|
|
20
|
+
*/
|
|
21
|
+
import type { CapabilityFacet } from '@medicine-wheel/capabilities';
|
|
22
|
+
import { type MappingIssue } from '../types';
|
|
23
|
+
export interface CapabilityIndexResult {
|
|
24
|
+
/** the hub's mapping folder */
|
|
25
|
+
dir: string;
|
|
26
|
+
file: string;
|
|
27
|
+
/** repositories read this time and written into the index */
|
|
28
|
+
indexed: {
|
|
29
|
+
repository: string;
|
|
30
|
+
clone: string;
|
|
31
|
+
commit: string;
|
|
32
|
+
capabilities: number;
|
|
33
|
+
}[];
|
|
34
|
+
/** clones whose repository this hub does not list: nothing of theirs is written */
|
|
35
|
+
notListed: {
|
|
36
|
+
clone: string;
|
|
37
|
+
repository: string;
|
|
38
|
+
}[];
|
|
39
|
+
/** clones of a listed repository that holds no capability file of its own: nothing is written for them */
|
|
40
|
+
noFile: {
|
|
41
|
+
clone: string;
|
|
42
|
+
repository: string;
|
|
43
|
+
}[];
|
|
44
|
+
/** clones that could not be read */
|
|
45
|
+
failed: {
|
|
46
|
+
clone: string;
|
|
47
|
+
error: string;
|
|
48
|
+
}[];
|
|
49
|
+
/** repositories already in the index and not read this time: their rows stay */
|
|
50
|
+
kept: string[];
|
|
51
|
+
/** every row the index holds after this reading */
|
|
52
|
+
rows: CapabilityFacet[];
|
|
53
|
+
text: string;
|
|
54
|
+
/** the file would change (or does not exist yet) */
|
|
55
|
+
differs: boolean;
|
|
56
|
+
wrote: boolean;
|
|
57
|
+
issues: MappingIssue[];
|
|
58
|
+
}
|
|
59
|
+
export declare function indexProvidedCapabilities(dir: string, clones: readonly string[], options: {
|
|
60
|
+
observedBy: string;
|
|
61
|
+
ref?: string;
|
|
62
|
+
now?: Date;
|
|
63
|
+
write: boolean;
|
|
64
|
+
}): Promise<CapabilityIndexResult>;
|
|
65
|
+
//# sourceMappingURL=capability-index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capability-index.d.ts","sourceRoot":"","sources":["../../src/node/capability-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAI5D,MAAM,WAAW,qBAAqB;IACpC,+BAA+B;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,6DAA6D;IAC7D,OAAO,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACvF,mFAAmF;IACnF,SAAS,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACnD,0GAA0G;IAC1G,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAChD,oCAAoC;IACpC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC3C,gFAAgF;IAChF,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,mDAAmD;IACnD,IAAI,EAAE,eAAe,EAAE,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,YAAY,EAAE,CAAC;CACxB;AAED,wBAAsB,yBAAyB,CAC7C,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,OAAO,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GACxE,OAAO,CAAC,qBAAqB,CAAC,CA6DhC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* A hub's index of what its repositories provide.
|
|
4
|
+
*
|
|
5
|
+
* Each repository says what it provides in its own committed
|
|
6
|
+
* `.miadi/capabilities.jsonl`. A hub copies those rows into `provided.jsonl`
|
|
7
|
+
* so that whoever reads the hub, on GitHub or through a tool, sees what its
|
|
8
|
+
* owner's repositories offer without cloning each one.
|
|
9
|
+
*
|
|
10
|
+
* Two rules keep the copy answerable to its sources:
|
|
11
|
+
*
|
|
12
|
+
* - Only a repository the hub lists is indexed. A public hub has no row for a
|
|
13
|
+
* private repository, so nothing a private repository provides is ever
|
|
14
|
+
* written into it, whatever clones are given.
|
|
15
|
+
* - Only a repository that holds its own committed capability file is
|
|
16
|
+
* indexed. The hub repeats what a repository said of itself; it never
|
|
17
|
+
* writes a reading of its own in a repository's name.
|
|
18
|
+
*
|
|
19
|
+
* Rows of repositories that were not read this time stay as they are, so
|
|
20
|
+
* indexing three clones never erases the others.
|
|
21
|
+
*/
|
|
22
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
23
|
+
if (k2 === undefined) k2 = k;
|
|
24
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
25
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
26
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
27
|
+
}
|
|
28
|
+
Object.defineProperty(o, k2, desc);
|
|
29
|
+
}) : (function(o, m, k, k2) {
|
|
30
|
+
if (k2 === undefined) k2 = k;
|
|
31
|
+
o[k2] = m[k];
|
|
32
|
+
}));
|
|
33
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
34
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
35
|
+
}) : function(o, v) {
|
|
36
|
+
o["default"] = v;
|
|
37
|
+
});
|
|
38
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
39
|
+
var ownKeys = function(o) {
|
|
40
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
41
|
+
var ar = [];
|
|
42
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
43
|
+
return ar;
|
|
44
|
+
};
|
|
45
|
+
return ownKeys(o);
|
|
46
|
+
};
|
|
47
|
+
return function (mod) {
|
|
48
|
+
if (mod && mod.__esModule) return mod;
|
|
49
|
+
var result = {};
|
|
50
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
51
|
+
__setModuleDefault(result, mod);
|
|
52
|
+
return result;
|
|
53
|
+
};
|
|
54
|
+
})();
|
|
55
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
56
|
+
exports.indexProvidedCapabilities = indexProvidedCapabilities;
|
|
57
|
+
const promises_1 = require("node:fs/promises");
|
|
58
|
+
const path = __importStar(require("node:path"));
|
|
59
|
+
const check_1 = require("../check");
|
|
60
|
+
const types_1 = require("../types");
|
|
61
|
+
const capability_scan_1 = require("./capability-scan");
|
|
62
|
+
const fs_1 = require("./fs");
|
|
63
|
+
async function indexProvidedCapabilities(dir, clones, options) {
|
|
64
|
+
const read = await (0, fs_1.readMappingDir)(dir);
|
|
65
|
+
if (!read.mapping || (0, check_1.hasErrors)(read.issues)) {
|
|
66
|
+
throw new Error(`${dir}: rows fail to parse; fix them before indexing (mw-repomap validate)`);
|
|
67
|
+
}
|
|
68
|
+
// GitHub names are case-insensitive: a clone of JGWill/miadi is jgwill/Miadi's row, written as the hub spells it.
|
|
69
|
+
const listed = new Map(read.mapping.repositories.map((r) => [r.nodeId.toLowerCase(), r.nodeId]));
|
|
70
|
+
const map = await (0, capability_scan_1.buildCapabilityMap)(clones, { observedBy: options.observedBy, ...(options.ref ? { ref: options.ref } : {}), ...(options.now ? { now: options.now } : {}) });
|
|
71
|
+
const indexed = [];
|
|
72
|
+
const notListed = [];
|
|
73
|
+
const noFile = [];
|
|
74
|
+
const failed = [];
|
|
75
|
+
const issues = [];
|
|
76
|
+
const readNow = new Map();
|
|
77
|
+
for (const r of map.repositories) {
|
|
78
|
+
if (r.error || !r.repository || !r.commit) {
|
|
79
|
+
failed.push({ clone: r.clone, error: r.error ?? 'no repository read' });
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
const spelled = listed.get(r.repository.toLowerCase());
|
|
83
|
+
if (!spelled) {
|
|
84
|
+
notListed.push({ clone: r.clone, repository: r.repository });
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
if (r.source !== 'file') {
|
|
88
|
+
noFile.push({ clone: r.clone, repository: spelled });
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
if (readNow.has(spelled.toLowerCase())) {
|
|
92
|
+
issues.push({ severity: 'warning', file: r.clone, message: `${spelled} was already read from another clone; this one is not indexed` });
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
readNow.set(spelled.toLowerCase(), spelled);
|
|
96
|
+
indexed.push({ repository: spelled, clone: r.clone, commit: r.commit, capabilities: 0 });
|
|
97
|
+
issues.push(...r.issues.map((i) => ({ ...i, file: `${spelled.replace(/^repository:/, '')}:${i.file ?? ''}` })));
|
|
98
|
+
}
|
|
99
|
+
const fresh = [];
|
|
100
|
+
for (const c of map.capabilities) {
|
|
101
|
+
const spelled = c.providedBy.length === 1 ? readNow.get(c.providedBy[0].toLowerCase()) : undefined;
|
|
102
|
+
if (!spelled)
|
|
103
|
+
continue;
|
|
104
|
+
fresh.push({ ...c, providedBy: [spelled] });
|
|
105
|
+
const entry = indexed.find((i) => i.repository === spelled);
|
|
106
|
+
if (entry)
|
|
107
|
+
entry.capabilities += 1;
|
|
108
|
+
}
|
|
109
|
+
// What the index already holds for repositories not read this time stays; a repository the hub no longer lists goes.
|
|
110
|
+
const keptRows = (read.mapping.provided ?? []).filter((c) => c.providedBy.every((p) => listed.has(p.toLowerCase()) && !readNow.has(p.toLowerCase())));
|
|
111
|
+
const kept = [...new Set(keptRows.flatMap((c) => c.providedBy))].sort();
|
|
112
|
+
const rows = [...keptRows, ...fresh];
|
|
113
|
+
const text = (0, fs_1.renderProvided)(rows);
|
|
114
|
+
const file = path.join(dir, types_1.MAPPING_FILES.provided);
|
|
115
|
+
let current;
|
|
116
|
+
try {
|
|
117
|
+
current = await (0, promises_1.readFile)(file, 'utf8');
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
current = undefined;
|
|
121
|
+
}
|
|
122
|
+
const differs = current !== text;
|
|
123
|
+
if (differs && options.write)
|
|
124
|
+
await (0, fs_1.writeProvided)(dir, rows);
|
|
125
|
+
return { dir, file, indexed, notListed, noFile, failed, kept, rows, text, differs, wrote: differs && options.write, issues };
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=capability-index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capability-index.js","sourceRoot":"","sources":["../../src/node/capability-index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCH,8DAiEC;AAhGD,+CAA4C;AAC5C,gDAAkC;AAElC,oCAAqC;AACrC,oCAA4D;AAC5D,uDAAuD;AACvD,6BAAqE;AAyB9D,KAAK,UAAU,yBAAyB,CAC7C,GAAW,EACX,MAAyB,EACzB,OAAyE;IAEzE,MAAM,IAAI,GAAG,MAAM,IAAA,mBAAc,EAAC,GAAG,CAAC,CAAC;IACvC,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,IAAA,iBAAS,EAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CAAC,GAAG,GAAG,sEAAsE,CAAC,CAAC;IAChG,CAAC;IACD,kHAAkH;IAClH,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACjG,MAAM,GAAG,GAAG,MAAM,IAAA,oCAAkB,EAAC,MAAM,EAAE,EAA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AI,CAAC;IACjC,IAAI,OAAO,IAAI,OAAO,CAAC,KAAK;QAAE,MAAM,IAAA,kBAAa,EAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC7D,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,IAAI,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;AAC/H,CAAC"}
|
|
@@ -17,8 +17,10 @@ export interface ScanOptions {
|
|
|
17
17
|
ref?: string;
|
|
18
18
|
/** `owner/name` or `repository:owner/name`; default from the `origin` remote */
|
|
19
19
|
repository?: string;
|
|
20
|
-
/** For preparing the working file: use its plugin enrollments with committed evidence. */
|
|
20
|
+
/** For preparing the working file: use its plugin and command enrollments and its declared package folders, with committed evidence. */
|
|
21
21
|
includeWorkingPluginEnrollments?: boolean;
|
|
22
|
+
/** The package folders to read beside the workspace's, instead of the ones the capability file's header declares. */
|
|
23
|
+
packageFolders?: readonly string[];
|
|
22
24
|
observedBy: string;
|
|
23
25
|
now?: Date;
|
|
24
26
|
}
|
|
@@ -31,6 +33,8 @@ export interface ScanResult {
|
|
|
31
33
|
packages: PackageReading[];
|
|
32
34
|
/** the rows this commit's files make, as the repository's own file would hold them */
|
|
33
35
|
fileRows: CapabilityFileRow[];
|
|
36
|
+
/** the package folders read beside the workspace's: the header's, or the ones given */
|
|
37
|
+
packageFolders: string[];
|
|
34
38
|
/** what could not be read: a package.json that is not JSON, a name no id can be made from */
|
|
35
39
|
issues: MappingIssue[];
|
|
36
40
|
}
|
|
@@ -95,7 +99,7 @@ export declare function stateCapability(clone: string, input: {
|
|
|
95
99
|
stageGrounding?: string[];
|
|
96
100
|
specifications?: string[];
|
|
97
101
|
issues?: string[];
|
|
98
|
-
/** For an app or plugin: its folder, whose manifest must name it. */
|
|
102
|
+
/** For an app or plugin: its folder, whose manifest must name it. For a command of a CLI: the file that defines it. */
|
|
99
103
|
path?: string;
|
|
100
104
|
hosting?: {
|
|
101
105
|
urls?: string[];
|
|
@@ -107,6 +111,10 @@ export declare function stateCapability(clone: string, input: {
|
|
|
107
111
|
episodes?: string[];
|
|
108
112
|
systems?: string[];
|
|
109
113
|
components?: string[];
|
|
114
|
+
/** What reads it: capability addresses or https:// URLs. */
|
|
115
|
+
consumers?: string[];
|
|
116
|
+
/** What those consumers read, at most 55 words. */
|
|
117
|
+
reads?: string;
|
|
110
118
|
now?: Date;
|
|
111
119
|
}): Promise<{
|
|
112
120
|
file: string;
|
|
@@ -151,7 +159,25 @@ export interface CapabilityMap {
|
|
|
151
159
|
consumes: ConsumesEdge[];
|
|
152
160
|
/** what each repository's file says its capabilities serve */
|
|
153
161
|
realizes: RealizesEdge[];
|
|
162
|
+
/** what each repository's file says reads its capabilities, where no package.json declares it */
|
|
163
|
+
consumedBy: ConsumedByEdge[];
|
|
154
164
|
}
|
|
165
|
+
/** Something reads a capability, said by a person or an agent in the provider's own file. */
|
|
166
|
+
export interface ConsumedByEdge {
|
|
167
|
+
/** the capability read, `capability:<kind>-<slug>` */
|
|
168
|
+
from: string;
|
|
169
|
+
/** what reads it: a capability address or an https:// URL */
|
|
170
|
+
to: string;
|
|
171
|
+
type: 'consumed-by';
|
|
172
|
+
/** the repository that provides the capability and says so */
|
|
173
|
+
repository: string;
|
|
174
|
+
/** what the consumer reads, when it was said */
|
|
175
|
+
reads?: string;
|
|
176
|
+
statedBy: string;
|
|
177
|
+
statedAt: string;
|
|
178
|
+
}
|
|
179
|
+
/** The `consumed-by` edges a set of capability rows holds, one per consumer. */
|
|
180
|
+
export declare function consumedByEdges(capabilities: readonly CapabilityFacet[]): ConsumedByEdge[];
|
|
155
181
|
/**
|
|
156
182
|
* Go through clones and answer one map of what they provide. A clone that
|
|
157
183
|
* cannot be read is reported and the others are still read.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capability-scan.d.ts","sourceRoot":"","sources":["../../src/node/capability-scan.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAErF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,
|
|
1
|
+
{"version":3,"file":"capability-scan.d.ts","sourceRoot":"","sources":["../../src/node/capability-scan.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAErF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAkBL,KAAK,cAAc,EACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAiB,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC7F,OAAO,EAkBL,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACvB,MAAM,oBAAoB,CAAC;AAsB5B,MAAM,WAAW,WAAW;IAC1B,sFAAsF;IACtF,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,gFAAgF;IAChF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wIAAwI;IACxI,+BAA+B,CAAC,EAAE,OAAO,CAAC;IAC1C,qHAAqH;IACrH,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,IAAI,CAAC;CACZ;AAED,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,eAAe,EAAE,CAAC;IAChC,4FAA4F;IAC5F,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,sFAAsF;IACtF,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAC9B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;AAED,6FAA6F;AAC7F,MAAM,WAAW,cAAc;IAC7B,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAC;IACb,6DAA6D;IAC7D,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,aAAa,CAAC;IACpB,8DAA8D;IAC9D,UAAU,EAAE,MAAM,CAAC;IACnB,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,gFAAgF;AAChF,wBAAgB,eAAe,CAAC,YAAY,EAAE,SAAS,eAAe,EAAE,GAAG,cAAc,EAAE,CAc1F;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,IAAI,CAAA;CAAE,GAAG,OAAO,CAAC,aAAa,CAAC,CAmCrJ"}
|
|
@@ -47,6 +47,7 @@ exports.readRepositoryCapabilities = readRepositoryCapabilities;
|
|
|
47
47
|
exports.writeCapabilityFile = writeCapabilityFile;
|
|
48
48
|
exports.stateCapability = stateCapability;
|
|
49
49
|
exports.findClones = findClones;
|
|
50
|
+
exports.consumedByEdges = consumedByEdges;
|
|
50
51
|
exports.buildCapabilityMap = buildCapabilityMap;
|
|
51
52
|
const node_child_process_1 = require("node:child_process");
|
|
52
53
|
const node_fs_1 = require("node:fs");
|
|
@@ -96,11 +97,27 @@ async function scanRepository(clone, options) {
|
|
|
96
97
|
// -z: a path with a character git would quote (é, a space, a tab) is read as it is.
|
|
97
98
|
const files = ((await git(clone, ['ls-tree', '-r', '-z', '--name-only', commit])) ?? '').split('\0').filter(Boolean);
|
|
98
99
|
const show = (file) => git(clone, ['show', `${commit}:${file}`]);
|
|
99
|
-
|
|
100
|
+
// The repository's own file: the committed one, and for a scan that prepares the working file, the working one.
|
|
101
|
+
const committedFile = files.includes(capability_file_1.CAPABILITY_FILE) ? (0, capability_file_1.parseCapabilityFile)((await show(capability_file_1.CAPABILITY_FILE)) ?? '') : undefined;
|
|
102
|
+
const workingFile = options.includeWorkingPluginEnrollments ? readWorkingFile(path.join(await workingRoot(clone), capability_file_1.CAPABILITY_FILE)) : undefined;
|
|
103
|
+
const enrolled = workingFile ?? committedFile;
|
|
104
|
+
const packageFolders = [...new Set(options.packageFolders ?? enrolled?.header?.packages ?? [])];
|
|
105
|
+
const badFolder = packageFolders.find((folder) => !capability_file_1.PackageFolderSchema.safeParse(folder).success);
|
|
106
|
+
if (badFolder !== undefined)
|
|
107
|
+
throw new capability_file_1.CapabilityInputError(`${JSON.stringify(badFolder)} is not a package folder: write dir, or dir/* for each folder under it (nothing was written)`);
|
|
108
|
+
const globs = (0, capability_scan_1.workspaceGlobs)(await show('package.json'), files.includes('pnpm-workspace.yaml') ? await show('pnpm-workspace.yaml') : undefined, packageFolders);
|
|
100
109
|
const artefacts = [];
|
|
101
110
|
const packages = [];
|
|
102
111
|
const issues = [];
|
|
103
|
-
|
|
112
|
+
const manifests = (0, capability_scan_1.packageManifests)(globs, files);
|
|
113
|
+
// A declared folder that holds no package.json is said: a misspelled folder would otherwise read as nothing.
|
|
114
|
+
for (const folder of packageFolders) {
|
|
115
|
+
if (!(0, capability_scan_1.packageManifests)([folder], files).length)
|
|
116
|
+
issues.push({ severity: 'warning', file: capability_file_1.CAPABILITY_FILE, message: `the declared package folder ${folder} holds no package.json in this commit` });
|
|
117
|
+
}
|
|
118
|
+
/** Each published package read: its folder, and what its `files` list ships. */
|
|
119
|
+
const shipping = [];
|
|
120
|
+
for (const manifest of manifests) {
|
|
104
121
|
const text = (await show(manifest)) ?? '';
|
|
105
122
|
try {
|
|
106
123
|
JSON.parse(text);
|
|
@@ -126,17 +143,21 @@ async function scanRepository(clone, options) {
|
|
|
126
143
|
});
|
|
127
144
|
if (pkg.private)
|
|
128
145
|
continue;
|
|
146
|
+
shipping.push({ folder: (0, capability_scan_1.packageFolder)(manifest), name: pkg.name, ...(pkg.files ? { files: pkg.files } : {}) });
|
|
129
147
|
artefacts.push({ kind: 'package', name: pkg.name, ...(pkg.description ? { description: pkg.description } : {}), path: manifest });
|
|
130
148
|
for (const bin of pkg.bins) {
|
|
131
149
|
artefacts.push({ kind: 'cli', name: bin, description: `The ${bin} command, shipped by ${pkg.name}.`, path: manifest, package: pkg.name });
|
|
132
150
|
}
|
|
133
151
|
}
|
|
152
|
+
// A SKILL.md inside a package's folder that the package's `files` ship is that package's skill: innermost package first.
|
|
153
|
+
const innermostFirst = [...shipping].sort((a, b) => b.folder.length - a.folder.length);
|
|
134
154
|
for (const file of (0, capability_scan_1.skillFiles)(files)) {
|
|
135
155
|
const front = (0, capability_scan_1.parseSkillFrontMatter)((await show(file)) ?? '');
|
|
136
156
|
const name = front.name ?? file.split('/').slice(-2, -1)[0];
|
|
137
157
|
if (!name)
|
|
138
158
|
continue;
|
|
139
|
-
|
|
159
|
+
const shippedBy = innermostFirst.find((p) => (p.folder === '' ? (0, capability_scan_1.shipsFile)(p.files, file) : file.startsWith(`${p.folder}/`) && (0, capability_scan_1.shipsFile)(p.files, file.slice(p.folder.length + 1))));
|
|
160
|
+
artefacts.push({ kind: 'skill', name, ...(front.description ? { description: front.description } : {}), path: file, ...(shippedBy ? { package: shippedBy.name } : {}) });
|
|
140
161
|
}
|
|
141
162
|
// Capabilities defined in code, each by the reader written for its repository's file.
|
|
142
163
|
for (const reader of capability_scan_1.CODE_READERS) {
|
|
@@ -145,7 +166,7 @@ async function scanRepository(clone, options) {
|
|
|
145
166
|
artefacts.push(...reader.read((await show(reader.path)) ?? ''));
|
|
146
167
|
}
|
|
147
168
|
// Applications, from the folders the repository's own file names: never guessed.
|
|
148
|
-
const committed =
|
|
169
|
+
const committed = committedFile?.rows ?? [];
|
|
149
170
|
for (const row of committed) {
|
|
150
171
|
const manifest = (0, capability_file_1.appManifestOf)(row);
|
|
151
172
|
if (!manifest || !files.includes(manifest))
|
|
@@ -157,10 +178,54 @@ async function scanRepository(clone, options) {
|
|
|
157
178
|
}
|
|
158
179
|
artefacts.push({ kind: 'app', name: row.name, ...(pkg.description ? { description: pkg.description } : {}), path: manifest });
|
|
159
180
|
}
|
|
160
|
-
const pluginRows = options.includeWorkingPluginEnrollments
|
|
161
|
-
? readWorkingFile(path.join(await workingRoot(clone), capability_file_1.CAPABILITY_FILE))?.rows ?? []
|
|
162
|
-
: committed;
|
|
181
|
+
const pluginRows = options.includeWorkingPluginEnrollments ? workingFile?.rows ?? [] : committed;
|
|
163
182
|
await (0, plugin_capabilities_1.scanPlugins)(repository, pluginRows, new Set(files), show, artefacts, issues);
|
|
183
|
+
// The commands of a CLI, from the rows that enroll them: each names the file that defines it, and its CLI is one this commit ships.
|
|
184
|
+
for (const row of pluginRows) {
|
|
185
|
+
const owner = row.kind === 'command' && row.cli ? (0, capability_file_1.commandCliName)(row.name) : undefined;
|
|
186
|
+
if (!owner)
|
|
187
|
+
continue;
|
|
188
|
+
const file = row.grounding.map((g) => (0, capability_file_1.commandFileIn)(g)).find((g) => g !== undefined && files.includes(g));
|
|
189
|
+
const cli = artefacts.find((a) => a.kind === 'cli' && a.name === owner);
|
|
190
|
+
if (!file || !cli) {
|
|
191
|
+
// A command still being built, or one written down before its code, is the file's to say; any other is reported.
|
|
192
|
+
if (!(0, capability_file_1.stagedWithoutCode)(row) && !(0, capability_file_1.builtElsewhere)(row)) {
|
|
193
|
+
issues.push({ severity: 'warning', file: capability_file_1.CAPABILITY_FILE, message: !cli ? `command/${row.name}: this commit ships no ${owner} command line, so it is not read` : `command/${row.name}: the file that defines it (${row.grounding.join(', ')}) is not in this commit, so it is not read` });
|
|
194
|
+
}
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
if (artefacts.some((a) => a.kind === 'command' && a.name === row.name)) {
|
|
198
|
+
issues.push({ severity: 'warning', file, message: `command/${row.name} is already a plugin's command: the CLI's is not read` });
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
const address = (0, capability_scan_1.capabilityAddress)(repository, 'command', row.name);
|
|
202
|
+
artefacts.push({ kind: 'command', name: row.name, path: file, cli: (0, capability_scan_1.capabilityAddress)(repository, 'cli', owner) });
|
|
203
|
+
cli.commands = [...new Set([...(cli.commands ?? []), address])].sort();
|
|
204
|
+
}
|
|
205
|
+
// A package.json nobody declared names a package this scan did not read: said, with the declaration that reads it.
|
|
206
|
+
// Said to whoever prepares the file (capabilities scan), not to every reader of the repository.
|
|
207
|
+
const readManifests = [
|
|
208
|
+
...manifests,
|
|
209
|
+
...committed.map((row) => (0, capability_file_1.appManifestOf)(row)).filter((m) => m !== undefined),
|
|
210
|
+
...pluginRows.filter((row) => row.kind === 'plugin').map((row) => (0, plugin_capabilities_1.pluginManifestOf)(row.grounding)).filter((m) => m !== undefined),
|
|
211
|
+
];
|
|
212
|
+
const unread = options.includeWorkingPluginEnrollments ? (0, capability_scan_1.unreadPackageManifests)(files, readManifests) : [];
|
|
213
|
+
const published = [];
|
|
214
|
+
for (const manifest of unread.slice(0, UNREAD_MANIFESTS_OPENED)) {
|
|
215
|
+
const pkg = (0, capability_scan_1.parsePackageJson)((await show(manifest)) ?? '');
|
|
216
|
+
if (pkg.name && !pkg.private)
|
|
217
|
+
published.push({ folder: (0, capability_scan_1.packageFolder)(manifest), name: pkg.name });
|
|
218
|
+
}
|
|
219
|
+
if (published.length) {
|
|
220
|
+
const shown = published.slice(0, 5).map((p) => `${p.name} in ${p.folder}`).join(', ');
|
|
221
|
+
const more = published.length > 5 ? `, and ${published.length - 5} more` : '';
|
|
222
|
+
const unopened = unread.length > UNREAD_MANIFESTS_OPENED ? ` (${unread.length - UNREAD_MANIFESTS_OPENED} more package.json files were not opened)` : '';
|
|
223
|
+
issues.push({
|
|
224
|
+
severity: 'warning',
|
|
225
|
+
file: capability_file_1.CAPABILITY_FILE,
|
|
226
|
+
message: `${published.length} package.json file${published.length === 1 ? ' names a package' : 's name packages'} this scan did not read (${shown}${more})${unopened}: no workspace declares ${published.length === 1 ? 'its folder' : 'their folders'}. To read ${published.length === 1 ? 'it' : 'them'}: capabilities scan --write --package-folders ${[...packageFolders, ...published.map((p) => p.folder)].join(',')}`,
|
|
227
|
+
});
|
|
228
|
+
}
|
|
164
229
|
// A name no id can be made from, or a name, a path or a shipping package carrying control characters, is reported and not read.
|
|
165
230
|
const readable = artefacts.filter((a) => {
|
|
166
231
|
const named = capability_file_1.CapabilityNameSchema.safeParse(a.name);
|
|
@@ -184,9 +249,12 @@ async function scanRepository(clone, options) {
|
|
|
184
249
|
capabilities: (0, capability_scan_1.capabilityRows)(readable, { repository, commit, observedBy: options.observedBy, observedAt }),
|
|
185
250
|
packages,
|
|
186
251
|
fileRows: (0, capability_file_1.capabilityFileRows)(readable, { repository, statedAt: observedAt }),
|
|
252
|
+
packageFolders,
|
|
187
253
|
issues,
|
|
188
254
|
};
|
|
189
255
|
}
|
|
256
|
+
/** How many undeclared package.json files a scan opens to see whether each names a published package. */
|
|
257
|
+
const UNREAD_MANIFESTS_OPENED = 64;
|
|
190
258
|
/** Move only locally scoped capability references when reading or adopting a fork. */
|
|
191
259
|
function withRepositoryAddress(row, from, to) {
|
|
192
260
|
const prefix = `miadi-capability://${from.replace(/^repository:/, '')}/`;
|
|
@@ -200,6 +268,9 @@ function withRepositoryAddress(row, from, to) {
|
|
|
200
268
|
...(row.components ? { components: row.components.map(rewrite) } : {}),
|
|
201
269
|
...(row.declaredComponents ? { declaredComponents: row.declaredComponents.map(rewrite) } : {}),
|
|
202
270
|
...(row.plugin ? { plugin: rewrite(row.plugin) } : {}),
|
|
271
|
+
...(row.cli ? { cli: rewrite(row.cli) } : {}),
|
|
272
|
+
...(row.commands ? { commands: row.commands.map(rewrite) } : {}),
|
|
273
|
+
...(row.consumers ? { consumers: row.consumers.map((c) => ({ ...c, consumer: rewrite(c.consumer) })) } : {}),
|
|
203
274
|
};
|
|
204
275
|
}
|
|
205
276
|
/**
|
|
@@ -223,9 +294,10 @@ async function readRepositoryCapabilities(clone, options) {
|
|
|
223
294
|
}
|
|
224
295
|
// A row the commit does not provide is the file's claim, not the repository's: reported, never read as a capability.
|
|
225
296
|
// Unless its stage says no code is expected: specified (not yet) or retired (no longer). It is read at that stage, under this repository's address.
|
|
297
|
+
// Or its stage says it is being built somewhere else, and names the issue, the pull request or the branch.
|
|
226
298
|
const grounded = merge.rows.filter((r) => {
|
|
227
299
|
const found = scan.fileRows.some((s) => s.kind === r.kind && s.name === r.name);
|
|
228
|
-
if (!found && (0, capability_file_1.stagedWithoutCode)(r))
|
|
300
|
+
if (!found && ((0, capability_file_1.stagedWithoutCode)(r) || (0, capability_file_1.builtElsewhere)(r)))
|
|
229
301
|
return true;
|
|
230
302
|
if (!found)
|
|
231
303
|
issues.push({ severity: 'warning', file: capability_file_1.CAPABILITY_FILE, message: `${r.kind}/${r.name} is in the file but this commit provides no such ${r.kind}; it is not read` });
|
|
@@ -273,7 +345,7 @@ async function writeCapabilityFile(clone, scan, options) {
|
|
|
273
345
|
const scanned = scan.fileRows.map((row) => withRepositoryAddress(row, scan.repository, named));
|
|
274
346
|
const existing = current?.rows.map((row) => withRepositoryAddress(row, current.header?.repository ?? named, named)) ?? [];
|
|
275
347
|
const merge = (0, capability_file_1.mergeCapabilityFile)(existing, scanned);
|
|
276
|
-
const text = (0, capability_file_1.renderCapabilityFile)(named, merge.rows);
|
|
348
|
+
const text = (0, capability_file_1.renderCapabilityFile)(named, merge.rows, { packages: scan.packageFolders });
|
|
277
349
|
// Never write a file the next reader refuses.
|
|
278
350
|
const unreadable = (0, capability_file_1.parseCapabilityFile)(text, { mode: 'write' }).issues.find((i) => i.severity === 'error');
|
|
279
351
|
if (unreadable)
|
|
@@ -308,6 +380,13 @@ async function stateCapability(clone, input) {
|
|
|
308
380
|
if (named !== input.name)
|
|
309
381
|
throw new capability_file_1.CapabilityInputError(`${manifest} names ${JSON.stringify(named ?? '')}, not ${JSON.stringify(input.name)} (nothing was written)`);
|
|
310
382
|
}
|
|
383
|
+
if (input.path !== undefined && input.kind === 'command') {
|
|
384
|
+
// A command is defined by a file the working tree holds: a person names it, and the scan confirms it at each commit.
|
|
385
|
+
const named = (0, capability_file_1.commandFileIn)(input.path);
|
|
386
|
+
const full = named ? path.join(root, named) : undefined;
|
|
387
|
+
if (!full || !(0, node_fs_1.lstatSync)(full, { throwIfNoEntry: false })?.isFile())
|
|
388
|
+
throw new capability_file_1.CapabilityInputError(`${input.path} is not a file in this repository (nothing was written)`);
|
|
389
|
+
}
|
|
311
390
|
let pluginManifest;
|
|
312
391
|
if (input.kind === 'plugin' && input.path !== undefined) {
|
|
313
392
|
for (const candidate of (0, plugin_capabilities_1.pluginManifestCandidates)(input.path)) {
|
|
@@ -342,11 +421,13 @@ async function stateCapability(clone, input) {
|
|
|
342
421
|
...(input.episodes ? { episodes: input.episodes } : {}),
|
|
343
422
|
...(input.systems ? { systems: input.systems } : {}),
|
|
344
423
|
...(input.components ? { components: input.components } : {}),
|
|
424
|
+
...(input.consumers ? { consumers: input.consumers } : {}),
|
|
425
|
+
...(input.reads !== undefined ? { reads: input.reads } : {}),
|
|
345
426
|
repository: current.header.repository,
|
|
346
427
|
});
|
|
347
428
|
if ('error' in answer)
|
|
348
429
|
throw new capability_file_1.CapabilityInputError(answer.error);
|
|
349
|
-
const text = (0, capability_file_1.renderCapabilityFile)(current.header.repository, answer.rows);
|
|
430
|
+
const text = (0, capability_file_1.renderCapabilityFile)(current.header.repository, answer.rows, { packages: current.header.packages });
|
|
350
431
|
const unreadable = (0, capability_file_1.parseCapabilityFile)(text, { mode: 'write' }).issues.find((i) => i.severity === 'error');
|
|
351
432
|
if (unreadable)
|
|
352
433
|
throw new capability_file_1.CapabilityInputError(`line ${unreadable.line} would not be readable: ${unreadable.message} (nothing was written)`);
|
|
@@ -415,6 +496,18 @@ function findClones(root, options = {}) {
|
|
|
415
496
|
}
|
|
416
497
|
return clones.sort();
|
|
417
498
|
}
|
|
499
|
+
/** The `consumed-by` edges a set of capability rows holds, one per consumer. */
|
|
500
|
+
function consumedByEdges(capabilities) {
|
|
501
|
+
return capabilities.flatMap((c) => (c.consumers ?? []).flatMap((x) => c.providedBy.map((repository) => ({
|
|
502
|
+
from: c.nodeId,
|
|
503
|
+
to: x.consumer,
|
|
504
|
+
type: 'consumed-by',
|
|
505
|
+
repository,
|
|
506
|
+
...(x.reads ? { reads: x.reads } : {}),
|
|
507
|
+
statedBy: x.statedBy,
|
|
508
|
+
statedAt: x.statedAt,
|
|
509
|
+
}))));
|
|
510
|
+
}
|
|
418
511
|
/**
|
|
419
512
|
* Go through clones and answer one map of what they provide. A clone that
|
|
420
513
|
* cannot be read is reported and the others are still read.
|
|
@@ -458,6 +551,6 @@ async function buildCapabilityMap(clones, options) {
|
|
|
458
551
|
for (const p of c.providedBy)
|
|
459
552
|
providers.set(c.nodeId, (providers.get(c.nodeId) ?? new Set()).add(p));
|
|
460
553
|
const shared = [...providers].filter(([, r]) => r.size > 1).map(([nodeId, r]) => ({ nodeId, repositories: [...r].sort() }));
|
|
461
|
-
return { repositories, collisions, shared, capabilities, packages: unique, consumes: (0, capability_impact_1.consumesEdges)(unique), realizes };
|
|
554
|
+
return { repositories, collisions, shared, capabilities, packages: unique, consumes: (0, capability_impact_1.consumesEdges)(unique), realizes, consumedBy: consumedByEdges(capabilities) };
|
|
462
555
|
}
|
|
463
556
|
//# sourceMappingURL=capability-scan.js.map
|