@boopkit/cli 0.1.13 → 0.1.14
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/dist/commands/add.js +21 -0
- package/dist/lib/capability.d.ts +7 -0
- package/dist/lib/capability.js +9 -0
- package/package.json +1 -1
package/dist/commands/add.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.runAdd = runAdd;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
4
5
|
const preflight_1 = require("../lib/preflight");
|
|
5
6
|
const execute_1 = require("../lib/execute");
|
|
6
7
|
const interpolate_1 = require("../lib/interpolate");
|
|
7
8
|
const list_1 = require("./list");
|
|
9
|
+
const capability_1 = require("../lib/capability");
|
|
8
10
|
function runAdd(capabilityName, options) {
|
|
9
11
|
// 0. Validate capability argument is provided
|
|
10
12
|
if (!capabilityName) {
|
|
@@ -15,6 +17,25 @@ function runAdd(capabilityName, options) {
|
|
|
15
17
|
return;
|
|
16
18
|
}
|
|
17
19
|
const targetDir = process.cwd();
|
|
20
|
+
// --- Phase 0: Ensure capability package is available locally ---
|
|
21
|
+
// When the CLI is installed globally, capability packages aren't in
|
|
22
|
+
// node_modules yet. Install the package so preflight can read its
|
|
23
|
+
// capability.json, scaffold files, etc.
|
|
24
|
+
if (!(0, capability_1.getPackageDir)(capabilityName, [targetDir])) {
|
|
25
|
+
const catalogEntry = (0, capability_1.getCatalogEntry)(capabilityName);
|
|
26
|
+
if (catalogEntry?.package) {
|
|
27
|
+
const spec = catalogEntry.package;
|
|
28
|
+
console.error(`Installing ${spec}...`);
|
|
29
|
+
try {
|
|
30
|
+
(0, child_process_1.execSync)(`npm install ${spec}`, { cwd: targetDir, stdio: 'pipe' });
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
console.error(`\x1b[31mERR\x1b[0m Failed to install ${spec}: ${err.message}`);
|
|
34
|
+
process.exitCode = 1;
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
18
39
|
// --- Phase 1: Pre-flight (read-only) ---
|
|
19
40
|
let plan;
|
|
20
41
|
try {
|
package/dist/lib/capability.d.ts
CHANGED
|
@@ -5,6 +5,13 @@ import { CapabilityMetadata } from './config';
|
|
|
5
5
|
* Returns null if not found.
|
|
6
6
|
*/
|
|
7
7
|
export declare function getPackageDir(name: string, searchPaths?: string[]): string | null;
|
|
8
|
+
/**
|
|
9
|
+
* Look up a capability in the baked-in catalog by name.
|
|
10
|
+
* Returns the catalog entry (with package field) or null if not found.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getCatalogEntry(name: string): (CapabilityMetadata & {
|
|
13
|
+
package?: string;
|
|
14
|
+
}) | null;
|
|
8
15
|
/**
|
|
9
16
|
* List all capabilities by scanning package directory and capabilities/ source tree (test fixtures only).
|
|
10
17
|
* Package resolution takes priority. Returns metadata for each valid capability.
|
package/dist/lib/capability.js
CHANGED
|
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.getPackageDir = getPackageDir;
|
|
37
|
+
exports.getCatalogEntry = getCatalogEntry;
|
|
37
38
|
exports.listCapabilities = listCapabilities;
|
|
38
39
|
exports.getCapability = getCapability;
|
|
39
40
|
const fs = __importStar(require("fs"));
|
|
@@ -127,6 +128,14 @@ function loadCatalog() {
|
|
|
127
128
|
return [];
|
|
128
129
|
}
|
|
129
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* Look up a capability in the baked-in catalog by name.
|
|
133
|
+
* Returns the catalog entry (with package field) or null if not found.
|
|
134
|
+
*/
|
|
135
|
+
function getCatalogEntry(name) {
|
|
136
|
+
const catalog = loadCatalog();
|
|
137
|
+
return catalog.find(c => c.name === name) ?? null;
|
|
138
|
+
}
|
|
130
139
|
/**
|
|
131
140
|
* List all capabilities by scanning package directory and capabilities/ source tree (test fixtures only).
|
|
132
141
|
* Package resolution takes priority. Returns metadata for each valid capability.
|