@boopkit/cli 0.1.13 → 0.1.15
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/cli.js +1 -0
- package/dist/commands/add.js +21 -0
- package/dist/commands/status.js +2 -3
- package/dist/commands/update.d.ts +1 -0
- package/dist/commands/update.js +9 -4
- package/dist/lib/capability.d.ts +7 -0
- package/dist/lib/capability.js +9 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -89,6 +89,7 @@ program
|
|
|
89
89
|
.option('--restore', 'Restore locally deleted scaffold files')
|
|
90
90
|
.option('--prune', 'Remove deprecated scaffold files from disk (creates .bak backup)')
|
|
91
91
|
.option('--skip-npm', 'Skip npm update (only re-scaffold from installed versions)')
|
|
92
|
+
.option('--tag <tag>', 'Use a specific npm dist-tag instead of major-version pinning (e.g. beta)')
|
|
92
93
|
.option('--json', 'Output structured JSON')
|
|
93
94
|
.action(update_1.runUpdate);
|
|
94
95
|
program
|
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/commands/status.js
CHANGED
|
@@ -117,11 +117,10 @@ function getStatusData(manifest, dir) {
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
if (allRequiredSet) {
|
|
120
|
-
// Env vars are set — check if capability has setup checks
|
|
120
|
+
// Env vars are set — check if capability has setup checks that enrichWithSetupChecks can resolve
|
|
121
121
|
const capDef = (0, capability_1.getCapability)(capName, [dir]);
|
|
122
122
|
const hasSetupChecks = capDef?.postInstall?.setupChecks?.length;
|
|
123
|
-
|
|
124
|
-
if (hasSetupChecks || hasPostInstall) {
|
|
123
|
+
if (hasSetupChecks) {
|
|
125
124
|
// Mark as 'setup' — dynamic checks will populate steps during enrichment
|
|
126
125
|
capabilities[capName] = { status: 'setup', type: capType, env: envStatus, optionalSteps: optionalSteps.length > 0 ? optionalSteps : undefined };
|
|
127
126
|
}
|
package/dist/commands/update.js
CHANGED
|
@@ -61,7 +61,7 @@ function runUpdate(capabilityName, options) {
|
|
|
61
61
|
}
|
|
62
62
|
// Step 1: npm install capability packages at latest within current major (unless --skip-npm or --dry-run)
|
|
63
63
|
if (!options.skipNpm && !options.dryRun) {
|
|
64
|
-
const packageSpecs = resolveNpmPackageSpecs(capsToUpdate, targetDir);
|
|
64
|
+
const packageSpecs = resolveNpmPackageSpecs(capsToUpdate, targetDir, options.tag);
|
|
65
65
|
if (packageSpecs.length > 0) {
|
|
66
66
|
if (!options.json) {
|
|
67
67
|
console.log(`Updating npm packages: ${packageSpecs.join(', ')}`);
|
|
@@ -224,7 +224,7 @@ function diagnoseMissingPlans(capsToUpdate, requestedCap, targetDir) {
|
|
|
224
224
|
* This allows minor+patch updates within the same major (including 0.x → 0.y)
|
|
225
225
|
* without crossing a major version boundary.
|
|
226
226
|
*/
|
|
227
|
-
function resolveNpmPackageSpecs(capabilities, targetDir) {
|
|
227
|
+
function resolveNpmPackageSpecs(capabilities, targetDir, tag) {
|
|
228
228
|
const specs = [];
|
|
229
229
|
for (const cap of capabilities) {
|
|
230
230
|
const pkgDir = (0, capability_1.getPackageDir)(cap, [targetDir]);
|
|
@@ -235,8 +235,13 @@ function resolveNpmPackageSpecs(capabilities, targetDir) {
|
|
|
235
235
|
continue;
|
|
236
236
|
const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf-8'));
|
|
237
237
|
if (pkgJson.name && pkgJson.boopkit?.capability && pkgJson.version) {
|
|
238
|
-
|
|
239
|
-
|
|
238
|
+
if (tag) {
|
|
239
|
+
specs.push(`${pkgJson.name}@${tag}`);
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
const major = pkgJson.version.split('.')[0];
|
|
243
|
+
specs.push(`${pkgJson.name}@${major}`);
|
|
244
|
+
}
|
|
240
245
|
}
|
|
241
246
|
}
|
|
242
247
|
return specs;
|
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.
|