@distributionos/cli 0.1.8 → 0.1.9
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/package.json +1 -1
- package/src/cli.js +42 -17
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -226,8 +226,8 @@ export async function runCli(argv, runtime) {
|
|
|
226
226
|
: null;
|
|
227
227
|
|
|
228
228
|
stdout.write(args.json
|
|
229
|
-
? `${JSON.stringify({ plan, changes, initialization, validation, inspection }, null, 2)}\n`
|
|
230
|
-
: formatApplyResult(plan, changes, initialization, validation, inspection, args.skipValidate));
|
|
229
|
+
? `${JSON.stringify({ plan, changes, initialization, validation, inspection }, null, 2)}\n`
|
|
230
|
+
: formatApplyResult(plan, changes, initialization, validation, inspection, args.skipValidate, args.apiBase ?? DEFAULT_API_BASE));
|
|
231
231
|
return hasBlockingApplyFailure(validation, inspection) ? 1 : 0;
|
|
232
232
|
} catch (error) {
|
|
233
233
|
stderr.write(`${error instanceof Error ? error.message : 'Setup apply failed'}\n`);
|
|
@@ -449,10 +449,13 @@ function formatReportResult(result) {
|
|
|
449
449
|
return `${lines.join('\n')}\n`;
|
|
450
450
|
}
|
|
451
451
|
|
|
452
|
-
function formatApplyResult(plan, changes, initialization, validation, inspection, skipValidate) {
|
|
453
|
-
const
|
|
454
|
-
|
|
455
|
-
|
|
452
|
+
function formatApplyResult(plan, changes, initialization, validation, inspection, skipValidate, apiBase = DEFAULT_API_BASE) {
|
|
453
|
+
const reviewUrl = initialization?.reviewUrl
|
|
454
|
+
? absoluteDistributionOsUrl(initialization.reviewUrl, apiBase)
|
|
455
|
+
: null;
|
|
456
|
+
const lines = [
|
|
457
|
+
formatPlanText({ ...plan, mode: 'apply' }).trimEnd(),
|
|
458
|
+
'',
|
|
456
459
|
'Applied changes',
|
|
457
460
|
];
|
|
458
461
|
|
|
@@ -466,9 +469,9 @@ function formatApplyResult(plan, changes, initialization, validation, inspection
|
|
|
466
469
|
}
|
|
467
470
|
}
|
|
468
471
|
|
|
469
|
-
lines.push(
|
|
470
|
-
? `- Initialization submitted. Review URL: ${
|
|
471
|
-
: '- Initialization was not submitted because no auth token was available.');
|
|
472
|
+
lines.push(reviewUrl
|
|
473
|
+
? `- Initialization submitted. Review URL: ${reviewUrl}`
|
|
474
|
+
: '- Initialization was not submitted because no auth token was available.');
|
|
472
475
|
|
|
473
476
|
lines.push('', 'Validation');
|
|
474
477
|
if (skipValidate) {
|
|
@@ -497,11 +500,33 @@ function formatApplyResult(plan, changes, initialization, validation, inspection
|
|
|
497
500
|
for (const result of inspection) {
|
|
498
501
|
lines.push(`- ${result.name}: ${result.status} - ${result.message}`);
|
|
499
502
|
}
|
|
500
|
-
}
|
|
501
|
-
lines.push('- Nothing was committed, pushed, or deployed.');
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
503
|
+
}
|
|
504
|
+
lines.push('- Nothing was committed, pushed, or deployed.');
|
|
505
|
+
lines.push('', 'Next step');
|
|
506
|
+
if (reviewUrl) {
|
|
507
|
+
lines.push(
|
|
508
|
+
'- Open this DistributionOS review page now:',
|
|
509
|
+
` ${reviewUrl}`,
|
|
510
|
+
'- Review the generated Brain Doc and Brain Vault context before asking your agent to keep working.',
|
|
511
|
+
'- After review, come back to this repo and inspect git diff before committing, pushing, or deploying.',
|
|
512
|
+
);
|
|
513
|
+
} else {
|
|
514
|
+
lines.push(
|
|
515
|
+
'- Reconnect DistributionOS OAuth or provide an app-scoped token, then rerun setup so initialization can be submitted.',
|
|
516
|
+
'- No DistributionOS review page is ready yet.',
|
|
517
|
+
);
|
|
518
|
+
}
|
|
519
|
+
return `${lines.join('\n')}\n`;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
function oneLine(value) {
|
|
523
|
+
return String(value).split(/\r?\n/).filter(Boolean).slice(-1)[0]?.slice(0, 240) ?? '';
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
function absoluteDistributionOsUrl(pathOrUrl, apiBase) {
|
|
527
|
+
try {
|
|
528
|
+
return new URL(pathOrUrl, apiBase || DEFAULT_API_BASE).toString();
|
|
529
|
+
} catch {
|
|
530
|
+
return String(pathOrUrl);
|
|
531
|
+
}
|
|
532
|
+
}
|