@b64hub/sfpm-cli 0.3.0 → 0.5.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 +174 -56
- package/dist/commands/add.js +29 -2
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/build/index.js +5 -7
- package/dist/commands/build/index.js.map +1 -1
- package/dist/commands/package/create.d.ts +3 -0
- package/dist/commands/package/create.js +67 -16
- package/dist/commands/package/create.js.map +1 -1
- package/dist/commands/pool/clean.d.ts +18 -0
- package/dist/commands/pool/clean.js +28 -0
- package/dist/commands/pool/clean.js.map +1 -0
- package/dist/commands/pool/delete.d.ts +1 -1
- package/dist/commands/pool/delete.js +12 -7
- package/dist/commands/pool/delete.js.map +1 -1
- package/dist/commands/pool/fetch.d.ts +0 -1
- package/dist/commands/pool/fetch.js +0 -2
- package/dist/commands/pool/fetch.js.map +1 -1
- package/dist/commands/project/init/turbo.js +2 -2
- package/dist/commands/project/init/turbo.js.map +1 -1
- package/dist/commands/project/sync.js +4 -2
- package/dist/commands/project/sync.js.map +1 -1
- package/dist/commands/release/create.d.ts +25 -0
- package/dist/commands/release/create.js +291 -0
- package/dist/commands/release/create.js.map +1 -0
- package/dist/commands/release/run.d.ts +13 -0
- package/dist/commands/release/run.js +142 -0
- package/dist/commands/release/run.js.map +1 -0
- package/dist/types/release.d.ts +110 -0
- package/dist/types/release.js +142 -0
- package/dist/types/release.js.map +1 -0
- package/oclif.manifest.json +490 -172
- package/package.json +19 -16
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import { readLatestPackageVersionTags, RELEASE_DIR, writeReleaseDefinition, } from '@b64hub/sfpm-core';
|
|
2
|
+
import { Git, WorkspaceProvider } from '@b64hub/sfpm-core';
|
|
3
|
+
import { checkbox, confirm, input, select, } from '@inquirer/prompts';
|
|
4
|
+
import { Args, Flags } from '@oclif/core';
|
|
5
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
import SfpmCommand from '../../sfpm-command.js';
|
|
8
|
+
import { getDistinctTags, isBareInvocation, resolveSelectionMode, selectPackageNames, } from '../../types/release.js';
|
|
9
|
+
import { infoBox, successBox } from '../../ui/boxes.js';
|
|
10
|
+
import { resolvePackageInputs } from '../../utils/package-resolver.js';
|
|
11
|
+
import { resolveCliProjectDir } from '../../utils/project-dir.js';
|
|
12
|
+
export default class ReleaseCreate extends SfpmCommand {
|
|
13
|
+
static args = {
|
|
14
|
+
packages: Args.string({
|
|
15
|
+
description: 'Package names to include (scoped or unscoped)',
|
|
16
|
+
required: false,
|
|
17
|
+
}),
|
|
18
|
+
};
|
|
19
|
+
static description = [
|
|
20
|
+
'Create a release definition by resolving package versions from git tags.',
|
|
21
|
+
'Run with no arguments in an interactive terminal for a guided walkthrough.',
|
|
22
|
+
].join(' ');
|
|
23
|
+
static examples = [
|
|
24
|
+
'<%= config.bin %> <%= command.id %>',
|
|
25
|
+
'<%= config.bin %> <%= command.id %> -n summer-2025 pkg-a pkg-b',
|
|
26
|
+
'<%= config.bin %> <%= command.id %> -n summer-2025 --tag core,sales',
|
|
27
|
+
'<%= config.bin %> <%= command.id %> -n summer-2025 --path packages/core',
|
|
28
|
+
'<%= config.bin %> <%= command.id %> -n summer-2025',
|
|
29
|
+
];
|
|
30
|
+
static flags = {
|
|
31
|
+
force: Flags.boolean({
|
|
32
|
+
char: 'f',
|
|
33
|
+
description: 'Overwrite existing release file',
|
|
34
|
+
}),
|
|
35
|
+
name: Flags.string({
|
|
36
|
+
char: 'n',
|
|
37
|
+
description: 'Release name (used for filename). Omit along with all selection flags to launch the guided walkthrough.',
|
|
38
|
+
}),
|
|
39
|
+
output: Flags.string({
|
|
40
|
+
char: 'o',
|
|
41
|
+
description: 'Output file path (overrides default release/<name>.yaml)',
|
|
42
|
+
}),
|
|
43
|
+
path: Flags.string({
|
|
44
|
+
char: 'p',
|
|
45
|
+
description: 'Include only packages in this directory (and descendants)',
|
|
46
|
+
}),
|
|
47
|
+
ref: Flags.string({
|
|
48
|
+
char: 'r',
|
|
49
|
+
default: 'main',
|
|
50
|
+
description: 'Git ref to resolve package versions from',
|
|
51
|
+
}),
|
|
52
|
+
tag: Flags.string({
|
|
53
|
+
char: 't',
|
|
54
|
+
description: 'Include packages carrying this tag — an sfpm package tag stored in package.json keywords (repeatable, comma-separated)',
|
|
55
|
+
multiple: true,
|
|
56
|
+
}),
|
|
57
|
+
};
|
|
58
|
+
static strict = false;
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any,complexity
|
|
60
|
+
async execute() {
|
|
61
|
+
const { argv, flags } = await this.parse(ReleaseCreate);
|
|
62
|
+
const projectDir = resolveCliProjectDir();
|
|
63
|
+
// Step 1: Load workspace packages
|
|
64
|
+
const provider = new WorkspaceProvider({ logger: this.sfpmLogger, projectDir });
|
|
65
|
+
// Step 2: Build candidates with keywords
|
|
66
|
+
const candidates = [];
|
|
67
|
+
for (const name of provider.getAllPackageNames()) {
|
|
68
|
+
const pkgDir = provider.getPackageDir(name);
|
|
69
|
+
if (!pkgDir)
|
|
70
|
+
continue;
|
|
71
|
+
let keywords = [];
|
|
72
|
+
try {
|
|
73
|
+
const pkgJsonPath = path.join(pkgDir, 'package.json');
|
|
74
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
75
|
+
const pkgJson = JSON.parse(readFileSync(pkgJsonPath, 'utf8'));
|
|
76
|
+
if (Array.isArray(pkgJson.keywords)) {
|
|
77
|
+
keywords = pkgJson.keywords;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
// If we can't read keywords, just use empty array
|
|
82
|
+
this.sfpmLogger.debug(`Could not read keywords for ${name}: ${error instanceof Error ? error.message : String(error)}`);
|
|
83
|
+
}
|
|
84
|
+
candidates.push({ dir: pkgDir, keywords, name });
|
|
85
|
+
}
|
|
86
|
+
// Step 3: Bare invocation (no selection/name signal at all) -> guided walkthrough
|
|
87
|
+
const isBare = isBareInvocation(argv, { name: flags.name, path: flags.path, tag: flags.tag });
|
|
88
|
+
let releaseName;
|
|
89
|
+
let ref;
|
|
90
|
+
let mode;
|
|
91
|
+
if (isBare) {
|
|
92
|
+
if (this.outputMode !== 'interactive') {
|
|
93
|
+
this.error([
|
|
94
|
+
'No packages specified. Provide package names, --tag, --path, and --name,',
|
|
95
|
+
'or run this command in an interactive terminal for the guided walkthrough.',
|
|
96
|
+
].join(' '));
|
|
97
|
+
}
|
|
98
|
+
if (candidates.length === 0) {
|
|
99
|
+
this.error('No workspace packages found.');
|
|
100
|
+
}
|
|
101
|
+
({ mode, ref, releaseName } = await this.runInteractiveWizard(candidates));
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
if (!flags.name) {
|
|
105
|
+
this.error('Missing required flag name (-n, --name)');
|
|
106
|
+
}
|
|
107
|
+
releaseName = flags.name;
|
|
108
|
+
ref = flags.ref;
|
|
109
|
+
// Step 4: Resolve selection mode
|
|
110
|
+
mode = resolveSelectionMode(argv.length > 0 ? argv : [], flags.tag?.length ? flags.tag : undefined, flags.path);
|
|
111
|
+
// Step 5: If explicit, resolve package names via resolvePackageInputs
|
|
112
|
+
if (mode.kind === 'explicit') {
|
|
113
|
+
try {
|
|
114
|
+
const resolved = await resolvePackageInputs(mode.names, provider, { json: this.outputMode === 'json' });
|
|
115
|
+
mode = { kind: 'explicit', names: resolved };
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
this.error(error instanceof Error ? error.message : String(error));
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
// Step 6: Select packages
|
|
123
|
+
const selected = selectPackageNames(candidates, mode);
|
|
124
|
+
if (selected.length === 0) {
|
|
125
|
+
this.error('No packages matched the selection.');
|
|
126
|
+
}
|
|
127
|
+
// Step 7: Read git tags
|
|
128
|
+
const git = new Git(projectDir, this.sfpmLogger);
|
|
129
|
+
let latest;
|
|
130
|
+
try {
|
|
131
|
+
latest = await readLatestPackageVersionTags(git, ref);
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
this.error(error instanceof Error ? error.message : String(error));
|
|
135
|
+
}
|
|
136
|
+
// Step 8 & 9: Resolve versions for selected packages
|
|
137
|
+
const packages = [];
|
|
138
|
+
const skipped = [];
|
|
139
|
+
for (const name of selected) {
|
|
140
|
+
const version = latest.get(name);
|
|
141
|
+
if (!version) {
|
|
142
|
+
if (mode.kind === 'explicit') {
|
|
143
|
+
this.error(`No package tag found for "${name}" merged into "${ref}".`);
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
this.sfpmLogger.warn(`Skipping ${name}: no package tag merged into "${ref}"`);
|
|
147
|
+
skipped.push(name);
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
packages.push({ name, version });
|
|
152
|
+
}
|
|
153
|
+
// Step 10: Ensure we have at least some packages
|
|
154
|
+
if (packages.length === 0) {
|
|
155
|
+
this.error(`No tagged packages found for ref "${ref}".`);
|
|
156
|
+
}
|
|
157
|
+
// Step 11: Determine output path
|
|
158
|
+
const outPath = flags.output
|
|
159
|
+
? path.resolve(flags.output)
|
|
160
|
+
: path.join(projectDir, RELEASE_DIR, `${releaseName}.yaml`);
|
|
161
|
+
// Step 12: Check if file exists
|
|
162
|
+
if (existsSync(outPath) && !flags.force) {
|
|
163
|
+
if (isBare) {
|
|
164
|
+
const overwrite = await confirm({ default: false, message: `${outPath} already exists. Overwrite?` });
|
|
165
|
+
if (!overwrite)
|
|
166
|
+
this.error('Aborted — release file already exists.');
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
this.error(`${outPath} already exists. Use --force to overwrite.`);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
// Step 13: Confirm before writing (wizard only — flag-driven invocations stay scriptable)
|
|
173
|
+
if (isBare) {
|
|
174
|
+
this.log(infoBox('Release Summary', {
|
|
175
|
+
Packages: packages.map(p => `${p.name}@${p.version}`).join('\n'),
|
|
176
|
+
Ref: ref,
|
|
177
|
+
Release: releaseName,
|
|
178
|
+
...(skipped.length > 0 && { Skipped: skipped.join(', ') }),
|
|
179
|
+
}));
|
|
180
|
+
const proceed = await confirm({ default: true, message: `Write ${outPath}?` });
|
|
181
|
+
if (!proceed)
|
|
182
|
+
this.error('Aborted.');
|
|
183
|
+
}
|
|
184
|
+
// Step 14: Write release definition
|
|
185
|
+
const definition = {
|
|
186
|
+
packages,
|
|
187
|
+
ref,
|
|
188
|
+
release: releaseName,
|
|
189
|
+
};
|
|
190
|
+
try {
|
|
191
|
+
writeReleaseDefinition(outPath, definition);
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
this.error(error instanceof Error ? error.message : String(error));
|
|
195
|
+
}
|
|
196
|
+
// Step 15: Return result
|
|
197
|
+
const result = {
|
|
198
|
+
packageCount: packages.length,
|
|
199
|
+
path: outPath,
|
|
200
|
+
release: releaseName,
|
|
201
|
+
...(skipped.length > 0 && { skipped }),
|
|
202
|
+
};
|
|
203
|
+
if (isBare) {
|
|
204
|
+
this.log(successBox('Release Created', {
|
|
205
|
+
File: outPath,
|
|
206
|
+
Packages: String(packages.length),
|
|
207
|
+
}));
|
|
208
|
+
}
|
|
209
|
+
else if (this.outputMode !== 'json') {
|
|
210
|
+
this.log(`Release manifest created: ${outPath}`);
|
|
211
|
+
this.log(` Release: ${releaseName}`);
|
|
212
|
+
this.log(` Packages: ${packages.length}`);
|
|
213
|
+
if (skipped.length > 0) {
|
|
214
|
+
this.log(` Skipped: ${skipped.length}`);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return result;
|
|
218
|
+
}
|
|
219
|
+
// ====================================================================
|
|
220
|
+
// Private helpers
|
|
221
|
+
// ====================================================================
|
|
222
|
+
/**
|
|
223
|
+
* Guided, step-by-step walkthrough for `release create` when invoked with
|
|
224
|
+
* no package-selection or naming signal at all. Reuses the same
|
|
225
|
+
* SelectionMode/selectPackageNames engine as the flag-driven path — only
|
|
226
|
+
* how the mode gets built differs.
|
|
227
|
+
*/
|
|
228
|
+
async runInteractiveWizard(candidates) {
|
|
229
|
+
this.log(infoBox('Release Create — Guided Walkthrough', {
|
|
230
|
+
'Workspace packages': String(candidates.length),
|
|
231
|
+
}));
|
|
232
|
+
const strategy = await select({
|
|
233
|
+
choices: [
|
|
234
|
+
{ name: 'All packages', value: 'all' },
|
|
235
|
+
{ name: 'Pick packages individually', value: 'explicit' },
|
|
236
|
+
{ name: 'Filter by tag', value: 'tag' },
|
|
237
|
+
{ name: 'Filter by workspace path', value: 'path' },
|
|
238
|
+
],
|
|
239
|
+
message: 'How do you want to select packages for this release?',
|
|
240
|
+
});
|
|
241
|
+
let mode;
|
|
242
|
+
switch (strategy) {
|
|
243
|
+
case 'explicit': {
|
|
244
|
+
const names = await checkbox({
|
|
245
|
+
choices: candidates.map(c => ({
|
|
246
|
+
name: c.keywords.length > 0 ? `${c.name} (${c.keywords.join(', ')})` : c.name,
|
|
247
|
+
value: c.name,
|
|
248
|
+
})),
|
|
249
|
+
message: 'Select packages to include:',
|
|
250
|
+
required: true,
|
|
251
|
+
});
|
|
252
|
+
mode = { kind: 'explicit', names };
|
|
253
|
+
break;
|
|
254
|
+
}
|
|
255
|
+
case 'path': {
|
|
256
|
+
const dir = await input({
|
|
257
|
+
message: 'Workspace path (packages under this directory will be included):',
|
|
258
|
+
validate: (value) => value.trim().length > 0 || 'A path is required',
|
|
259
|
+
});
|
|
260
|
+
mode = { dir, kind: 'path' };
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
case 'tag': {
|
|
264
|
+
const tags = getDistinctTags(candidates);
|
|
265
|
+
if (tags.length === 0) {
|
|
266
|
+
this.error('No workspace packages have any tags (package.json keywords) yet — pick a different selection strategy.');
|
|
267
|
+
}
|
|
268
|
+
const selectedTags = await checkbox({
|
|
269
|
+
choices: tags.map(t => ({ name: t, value: t })),
|
|
270
|
+
message: 'Select tag(s) to include:',
|
|
271
|
+
required: true,
|
|
272
|
+
});
|
|
273
|
+
mode = { kind: 'tag', tags: selectedTags };
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
default: {
|
|
277
|
+
mode = { kind: 'all' };
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
const releaseName = await input({
|
|
281
|
+
message: 'Release name:',
|
|
282
|
+
validate: (value) => value.trim().length > 0 || 'A release name is required',
|
|
283
|
+
});
|
|
284
|
+
const ref = await input({
|
|
285
|
+
default: 'main',
|
|
286
|
+
message: 'Git ref to resolve package versions from:',
|
|
287
|
+
});
|
|
288
|
+
return { mode, ref, releaseName };
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/commands/release/create.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAAE,WAAW,EAA0B,sBAAsB,GAC1F,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAC,GAAG,EAAE,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AACzD,OAAO,EACL,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GACjC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAC,IAAI,EAAE,KAAK,EAAC,MAAM,aAAa,CAAC;AACxC,OAAO,EAAC,UAAU,EAAE,YAAY,EAAC,MAAM,SAAS,CAAC;AACjD,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,EACL,eAAe,EAAE,gBAAgB,EAAE,oBAAoB,EAAsB,kBAAkB,GAChG,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAC,OAAO,EAAE,UAAU,EAAC,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAC,oBAAoB,EAAC,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAC,oBAAoB,EAAC,MAAM,4BAA4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CAAC,CAAC;gBACvH,CAAC;gBAED,MAAM,YAAY,GAAG,MAAM,QAAQ,CAAC;oBAClC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAC,CAAC,CAAC;oBAC7C,OAAO,EAAE,2BAA2B;oBACpC,QAAQ,EAAE,IAAI;iBACf,CAAC,CAAC;gBACH,IAAI,GAAG,EAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAC,CAAC;gBAEzC,MAAM;YACR,CAAC;YAED,OAAO,CAAC,CAAC,CAAC;gBACR,IAAI,GAAG,EAAC,IAAI,EAAE,KAAK,EAAC,CAAC;YACvB,CAAC;QACD,CAAC;QAED,MAAM,WAAW,GAAG,MAAM,KAAK,CAAC;YAC9B,OAAO,EAAE,eAAe;YACxB,QAAQ,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,IAAI,4BAA4B;SACrF,CAAC,CAAC;QAEH,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC;YACtB,OAAO,EAAE,MAAM;YACf,OAAO,EAAE,2CAA2C;SACrD,CAAC,CAAC;QAEH,OAAO,EAAC,IAAI,EAAE,GAAG,EAAE,WAAW,EAAC,CAAC;IAClC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import SfpmCommand from '../../sfpm-command.js';
|
|
2
|
+
export default class ReleaseRun extends SfpmCommand {
|
|
3
|
+
static args: {
|
|
4
|
+
file: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
5
|
+
};
|
|
6
|
+
static description: string;
|
|
7
|
+
static examples: string[];
|
|
8
|
+
static flags: {
|
|
9
|
+
'skip-version-check': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
'target-org': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
};
|
|
12
|
+
execute(): Promise<any>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { ArtifactProvider, InstallOrchestrator, LifecycleEngine, ProjectService, readReleaseDefinition, } from '@b64hub/sfpm-core';
|
|
2
|
+
import { createTracer } from '@b64hub/sfpm-telemetry';
|
|
3
|
+
import { Args, Flags } from '@oclif/core';
|
|
4
|
+
import { Org } from '@salesforce/core';
|
|
5
|
+
import EventEmitter from 'node:events';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
import SfpmCommand from '../../sfpm-command.js';
|
|
8
|
+
import { reconcileManifest } from '../../types/release.js';
|
|
9
|
+
import { attachInstallBridge } from '../../ui/adapters/install-event-bridge.js';
|
|
10
|
+
import { renderApp } from '../../ui/renderers/run-orchestrator.js';
|
|
11
|
+
import { resolveCliProjectDir } from '../../utils/project-dir.js';
|
|
12
|
+
export default class ReleaseRun extends SfpmCommand {
|
|
13
|
+
static args = {
|
|
14
|
+
file: Args.string({
|
|
15
|
+
description: 'Path to the release YAML file',
|
|
16
|
+
required: true,
|
|
17
|
+
}),
|
|
18
|
+
};
|
|
19
|
+
static description = 'Run a release by installing packages from a release definition';
|
|
20
|
+
static examples = [
|
|
21
|
+
'<%= config.bin %> <%= command.id %> release/summer-2025.yaml -o my-sandbox',
|
|
22
|
+
'<%= config.bin %> <%= command.id %> release/summer-2025.yaml -o my-sandbox --json',
|
|
23
|
+
];
|
|
24
|
+
static flags = {
|
|
25
|
+
'skip-version-check': Flags.boolean({
|
|
26
|
+
description: 'Skip version mismatch checks (still validates packages are present)',
|
|
27
|
+
}),
|
|
28
|
+
'target-org': Flags.string({
|
|
29
|
+
char: 'o',
|
|
30
|
+
description: 'Target org username',
|
|
31
|
+
env: 'SF_TARGET_ORG',
|
|
32
|
+
required: true,
|
|
33
|
+
}),
|
|
34
|
+
};
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any,complexity
|
|
36
|
+
async execute() {
|
|
37
|
+
const { args, flags } = await this.parse(ReleaseRun);
|
|
38
|
+
const projectDir = resolveCliProjectDir();
|
|
39
|
+
// Step 1 & 2: Read and parse release definition
|
|
40
|
+
let definition;
|
|
41
|
+
try {
|
|
42
|
+
definition = readReleaseDefinition(path.resolve(args.file));
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
this.error(error instanceof Error ? error.message : String(error));
|
|
46
|
+
}
|
|
47
|
+
// Step 3: Extract package names
|
|
48
|
+
const names = definition.packages.map(p => p.name);
|
|
49
|
+
// Step 4: Create ArtifactProvider
|
|
50
|
+
const artifactProvider = new ArtifactProvider({ logger: this.sfpmLogger, packages: names, projectDir });
|
|
51
|
+
// Step 5: Create ProjectService and resolve graph
|
|
52
|
+
let projectService;
|
|
53
|
+
try {
|
|
54
|
+
projectService = await ProjectService.create(projectDir, artifactProvider);
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
this.error(error instanceof Error ? error.message : String(error));
|
|
58
|
+
}
|
|
59
|
+
const projectConfig = projectService.getDefinitionProvider();
|
|
60
|
+
const projectGraph = projectService.getProjectGraph();
|
|
61
|
+
// Step 6: TRUST BOUNDARY GATE — reconcile manifest vs node_modules
|
|
62
|
+
const resolvedVersions = new Map(projectConfig.getAllPackageDefinitions().map(p => [p.name, p.version]));
|
|
63
|
+
const { mismatched, missing } = reconcileManifest(definition.packages, resolvedVersions, { skipVersionCheck: flags['skip-version-check'] });
|
|
64
|
+
if (missing.length > 0) {
|
|
65
|
+
const msg = [
|
|
66
|
+
`Release "${definition.release}" declares packages not present in node_modules: ${missing.join(', ')}.`,
|
|
67
|
+
"Run 'npm ci' (or 'npm install --no-save <name>@<version>') before 'release run'.",
|
|
68
|
+
].join(' ');
|
|
69
|
+
this.error(msg);
|
|
70
|
+
}
|
|
71
|
+
if (mismatched.length > 0) {
|
|
72
|
+
const msg = [
|
|
73
|
+
`Version mismatch for: ${mismatched.map(m => `${m.name} (expected ${m.expected}, found ${m.actual})`).join('; ')}.`,
|
|
74
|
+
'Re-install the declared versions or pass --skip-version-check.',
|
|
75
|
+
].join(' ');
|
|
76
|
+
this.error(msg);
|
|
77
|
+
}
|
|
78
|
+
// Step 7: Resolve all packages (includes transitive sfpm deps)
|
|
79
|
+
const resolvedPackages = projectConfig.getAllPackageNames();
|
|
80
|
+
// Step 8: Load sfpm config and lifecycle hooks
|
|
81
|
+
const sfpmConfig = projectService.getSfpmConfig();
|
|
82
|
+
const lifecycle = LifecycleEngine.stage('install');
|
|
83
|
+
for (const hooks of sfpmConfig.hooks ?? []) {
|
|
84
|
+
lifecycle.use(hooks);
|
|
85
|
+
}
|
|
86
|
+
// Step 9: Create target org
|
|
87
|
+
let targetOrg;
|
|
88
|
+
try {
|
|
89
|
+
targetOrg = await Org.create({ aliasOrUsername: flags['target-org'] });
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
this.error(error instanceof Error ? error.message : String(error));
|
|
93
|
+
}
|
|
94
|
+
// Step 10: Setup logging and UI
|
|
95
|
+
const mode = this.outputMode;
|
|
96
|
+
const isInk = mode !== 'json';
|
|
97
|
+
const uiBus = isInk ? new EventEmitter() : undefined;
|
|
98
|
+
const { logger: pinoLogger, logPath } = this.createRunLogger(uiBus);
|
|
99
|
+
// Step 11: Create orchestrator with manifest options
|
|
100
|
+
const orchestrator = InstallOrchestrator.forArtifact(targetOrg, projectConfig, projectGraph, {
|
|
101
|
+
force: definition.options?.force,
|
|
102
|
+
includeDependencies: definition.options?.includeDependencies ?? true,
|
|
103
|
+
regressionTest: definition.options?.regressionTest,
|
|
104
|
+
testLevel: definition.options?.testLevel,
|
|
105
|
+
unlocked: definition.options?.unlocked,
|
|
106
|
+
}, pinoLogger);
|
|
107
|
+
// Step 12: Setup ink UI bridge if needed
|
|
108
|
+
let inkInstance;
|
|
109
|
+
if (isInk) {
|
|
110
|
+
attachInstallBridge(orchestrator.installBus, orchestrator.orchestrationBus, uiBus);
|
|
111
|
+
inkInstance = renderApp(uiBus, { logPath, mode: mode === 'interactive' ? 'interactive' : 'plain' });
|
|
112
|
+
}
|
|
113
|
+
// Setup telemetry tracer
|
|
114
|
+
const tracer = createTracer({ serviceName: 'sfpm-cli' });
|
|
115
|
+
tracer.subscribe({ install: orchestrator.installBus, orchestration: orchestrator.orchestrationBus });
|
|
116
|
+
try {
|
|
117
|
+
// Run installation
|
|
118
|
+
const result = await orchestrator.installAll(resolvedPackages);
|
|
119
|
+
await tracer.shutdown();
|
|
120
|
+
// Let the app self-exit after rendering its terminal state
|
|
121
|
+
if (inkInstance) {
|
|
122
|
+
await inkInstance.waitUntilExit();
|
|
123
|
+
inkInstance = undefined;
|
|
124
|
+
}
|
|
125
|
+
if (!result.success) {
|
|
126
|
+
const failedNames = result.failedPackages.join(', ');
|
|
127
|
+
this.error(`Install failed for: ${failedNames}`, { exit: 2 });
|
|
128
|
+
}
|
|
129
|
+
return { release: definition.release, ...result };
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
if (error instanceof Error) {
|
|
133
|
+
this.error(error.message, { exit: 2 });
|
|
134
|
+
}
|
|
135
|
+
throw error;
|
|
136
|
+
}
|
|
137
|
+
finally {
|
|
138
|
+
inkInstance?.unmount();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../../src/commands/release/run.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAAE,mBAAmB,EAAE,eAAe,EAAE,cAAc,EAAE,qBAAqB,GAC9F,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAC,YAAY,EAAC,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAC,IAAI,EAAE,KAAK,EAAC,MAAM,aAAa,CAAC;AACxC,OAAO,EAAC,GAAG,EAAC,MAAM,kBAAkB,CAAC;AACrC,OAA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G,YAAY,CAAC,EAAC,WAAW,EAAE,UAAU,EAAC,CAAC,CAAC;QACvD,MAAM,CAAC,SAAS,CAAC,EAAC,OAAO,EAAE,YAAY,CAAC,UAAU,EAAE,aAAa,EAAE,YAAY,CAAC,gBAAgB,EAAC,CAAC,CAAC;QAEnG,IAAI,CAAC;YACH,mBAAmB;YACnB,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC;YAE/D,MAAM,MAAM,CAAC,QAAQ,EAAE,CAAC;YAExB,2DAA2D;YAC3D,IAAI,WAAW,EAAE,CAAC;gBAChB,MAAM,WAAW,CAAC,aAAa,EAAE,CAAC;gBAClC,WAAW,GAAG,SAAS,CAAC;YAC1B,CAAC;YAED,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;gBACpB,MAAM,WAAW,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACrD,IAAI,CAAC,KAAK,CAAC,uBAAuB,WAAW,EAAE,EAAE,EAAC,IAAI,EAAE,CAAC,EAAC,CAAC,CAAC;YAC9D,CAAC;YAED,OAAO,EAAC,OAAO,EAAE,UAAW,CAAC,OAAO,EAAE,GAAG,MAAM,EAAC,CAAC;QACnD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;gBAC3B,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,EAAC,IAAI,EAAE,CAAC,EAAC,CAAC,CAAC;YACvC,CAAC;YAED,MAAM,KAAK,CAAC;QACd,CAAC;gBAAS,CAAC;YACT,WAAW,EAAE,OAAO,EAAE,CAAC;QACzB,CAAC;IACH,CAAC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace candidate for package selection.
|
|
3
|
+
* Combines a package's identity with its keywords, which double as sfpm's
|
|
4
|
+
* package tags (an arbitrary, user-assigned label — no reserved prefix,
|
|
5
|
+
* no enforced vocabulary), for tag-based filtering.
|
|
6
|
+
*/
|
|
7
|
+
export interface WorkspaceCandidate {
|
|
8
|
+
/** Absolute path to the package directory */
|
|
9
|
+
dir: string;
|
|
10
|
+
/** Keywords from package.json — the storage field backing sfpm's package tags */
|
|
11
|
+
keywords: string[];
|
|
12
|
+
/** Package name (scoped or unscoped) */
|
|
13
|
+
name: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A selection mode: which strategy to use for picking packages.
|
|
17
|
+
*/
|
|
18
|
+
export type SelectionMode = {
|
|
19
|
+
dir: string;
|
|
20
|
+
kind: 'path';
|
|
21
|
+
} | {
|
|
22
|
+
kind: 'all';
|
|
23
|
+
} | {
|
|
24
|
+
kind: 'explicit';
|
|
25
|
+
names: string[];
|
|
26
|
+
} | {
|
|
27
|
+
kind: 'tag';
|
|
28
|
+
tags: string[];
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Determine the package selection mode from supplied flags.
|
|
32
|
+
*
|
|
33
|
+
* Ensures exactly one selection strategy is active; throws if multiple are specified.
|
|
34
|
+
*
|
|
35
|
+
* @param names - Explicitly named packages from argv
|
|
36
|
+
* @param tags - Package tags specified via --tag (matched against package.json keywords)
|
|
37
|
+
* @param dir - Directory path specified via --path
|
|
38
|
+
* @returns SelectionMode configured for the active strategy
|
|
39
|
+
* @throws Error if more than one selection mode is active
|
|
40
|
+
*/
|
|
41
|
+
export declare function resolveSelectionMode(names: string[], tags?: string[], dir?: string): SelectionMode;
|
|
42
|
+
/**
|
|
43
|
+
* Decide whether `release create` was invoked with no selection or naming
|
|
44
|
+
* signal at all — i.e. bare `sfpm release create`, which should launch the
|
|
45
|
+
* interactive guided walkthrough instead of failing on a missing --name.
|
|
46
|
+
*
|
|
47
|
+
* @param argv - Positional package name arguments
|
|
48
|
+
* @param flags - The subset of flags that count as a selection/naming signal
|
|
49
|
+
* @param flags.name - The --name flag value, if supplied
|
|
50
|
+
* @param flags.path - The --path flag value, if supplied
|
|
51
|
+
* @param flags.tag - The --tag flag value(s), if supplied
|
|
52
|
+
* @returns true when nothing was supplied and the wizard should run
|
|
53
|
+
*/
|
|
54
|
+
export declare function isBareInvocation(argv: string[], flags: {
|
|
55
|
+
name?: string;
|
|
56
|
+
path?: string;
|
|
57
|
+
tag?: string[];
|
|
58
|
+
}): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Collect the distinct package tags (package.json keywords) present across
|
|
61
|
+
* a set of workspace candidates, sorted for stable prompt/display order.
|
|
62
|
+
*
|
|
63
|
+
* @param candidates - Available workspace packages with metadata
|
|
64
|
+
* @returns Sorted array of distinct tag values
|
|
65
|
+
*/
|
|
66
|
+
export declare function getDistinctTags(candidates: WorkspaceCandidate[]): string[];
|
|
67
|
+
/**
|
|
68
|
+
* Select package names from candidates using the specified selection mode.
|
|
69
|
+
*
|
|
70
|
+
* @param candidates - Available workspace packages with metadata
|
|
71
|
+
* @param mode - The selection strategy to apply
|
|
72
|
+
* @returns Array of selected package names
|
|
73
|
+
*/
|
|
74
|
+
export declare function selectPackageNames(candidates: WorkspaceCandidate[], mode: SelectionMode): string[];
|
|
75
|
+
/**
|
|
76
|
+
* Version mismatch detail in reconciliation.
|
|
77
|
+
*/
|
|
78
|
+
export interface ReconcileMismatch {
|
|
79
|
+
actual: string;
|
|
80
|
+
expected: string;
|
|
81
|
+
name: string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Result of manifest reconciliation.
|
|
85
|
+
*/
|
|
86
|
+
export interface ReconcileResult {
|
|
87
|
+
mismatched: ReconcileMismatch[];
|
|
88
|
+
missing: string[];
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Reconcile a release manifest against what's currently in node_modules.
|
|
92
|
+
*
|
|
93
|
+
* Checks for:
|
|
94
|
+
* - Missing packages (declared but not installed)
|
|
95
|
+
* - Version mismatches (unless --skip-version-check is set)
|
|
96
|
+
*
|
|
97
|
+
* Uses exact string comparison, not semver.eq — a release pins an exact artifact.
|
|
98
|
+
*
|
|
99
|
+
* @param declared - Packages and versions from the release manifest
|
|
100
|
+
* @param resolved - Packages and versions currently in node_modules (from ArtifactProvider)
|
|
101
|
+
* @param options - Control behavior
|
|
102
|
+
* @param options.skipVersionCheck - Skip version mismatch checks (still validates packages are present)
|
|
103
|
+
* @returns Reconciliation result with missing and mismatched arrays
|
|
104
|
+
*/
|
|
105
|
+
export declare function reconcileManifest(declared: {
|
|
106
|
+
name: string;
|
|
107
|
+
version: string;
|
|
108
|
+
}[], resolved: Map<string, string>, options?: {
|
|
109
|
+
skipVersionCheck?: boolean;
|
|
110
|
+
}): ReconcileResult;
|