@distributionos/cli 0.1.2 → 0.1.4

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.
Files changed (3) hide show
  1. package/package.json +1 -1
  2. package/src/cli.js +2 -1
  3. package/src/plan.js +51 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@distributionos/cli",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "DistributionOS repo setup CLI for agent onboarding and first-party analytics.",
5
5
  "homepage": "https://distributionos.dev",
6
6
  "repository": {
package/src/cli.js CHANGED
@@ -344,7 +344,8 @@ function helpText() {
344
344
  ' distributionos verify --app <appId> --url <liveUrl> [--content-id <id>]',
345
345
  ' distributionos report-implementation --app <appId> --artifact <artifactId> [--url <liveUrl>] [--summary <text>]',
346
346
  '',
347
- 'Default mode prints a dry-run plan. Interactive terminals can confirm the plan before mutation; non-interactive runs need --apply or --yes.',
347
+ 'Default mode reviews the setup plan without changing files. Run again with --apply after the plan looks right.',
348
+ 'If the repo has existing uncommitted changes, commit/stash first or use --allow-dirty when you recognize them.',
348
349
  '',
349
350
  'Authentication:',
350
351
  ' Happy path uses DistributionOS MCP OAuth and stores app-scoped credentials outside the repo.',
package/src/plan.js CHANGED
@@ -89,11 +89,11 @@ function sanitizePackageJson(packageJson) {
89
89
 
90
90
  export function formatPlanText(plan) {
91
91
  const lines = [
92
- 'DistributionOS CLI setup plan',
93
- `App: ${plan.appId}`,
94
- plan.mode === 'apply'
95
- ? 'Mode: apply'
96
- : 'Mode: dry-run (no files changed)',
92
+ 'DistributionOS CLI setup plan',
93
+ `App: ${plan.appId}`,
94
+ plan.mode === 'apply'
95
+ ? 'Step: apply approved setup'
96
+ : 'Step: review setup plan (no files changed yet)',
97
97
  `Package: ${plan.packageName}`,
98
98
  `Future command: ${plan.futureCommand}`,
99
99
  `Local command: ${plan.localCommand}`,
@@ -139,12 +139,47 @@ export function formatPlanText(plan) {
139
139
  lines.push('', 'Future-compatible route gate config', plan.analytics.configSnippet);
140
140
  }
141
141
 
142
- if (plan.warnings.length > 0) {
143
- lines.push('', 'Warnings', ...plan.warnings.map(item => `- ${item}`));
144
- }
145
-
146
- return `${lines.join('\n')}\n`;
147
- }
142
+ if (plan.warnings.length > 0) {
143
+ lines.push('', 'Warnings', ...plan.warnings.map(item => `- ${item}`));
144
+ }
145
+
146
+ lines.push(...nextStepLines(plan));
147
+
148
+ return `${lines.join('\n')}\n`;
149
+ }
150
+
151
+ function nextStepLines(plan) {
152
+ if (plan.mode === 'apply') return [];
153
+
154
+ const applyCommand = `${plan.futureCommand} --apply`;
155
+ const lines = [
156
+ '',
157
+ 'Next step: install approved setup',
158
+ ];
159
+
160
+ if (plan.repo.git.dirty) {
161
+ lines.push(
162
+ 'This repo has existing uncommitted changes.',
163
+ 'Recommended: commit or stash those changes, then run:',
164
+ ` ${applyCommand}`,
165
+ '',
166
+ 'If you recognize the existing changes and want DistributionOS to edit only its managed files, run:',
167
+ ` ${applyCommand} --allow-dirty`,
168
+ );
169
+ } else {
170
+ lines.push(
171
+ 'If the planned changes look right, run:',
172
+ ` ${applyCommand}`,
173
+ );
174
+ }
175
+
176
+ lines.push(
177
+ '',
178
+ 'DistributionOS expects to edit only the managed agent instruction block and the supported analytics layout. Review git diff before committing or deploying.',
179
+ );
180
+
181
+ return lines;
182
+ }
148
183
 
149
184
  function buildAnalyticsPlan({ analyticsContract, repo, instructionPackVersion }) {
150
185
  const layoutTarget = selectAnalyticsLayoutTarget(repo);
@@ -249,9 +284,9 @@ function remoteSummary(plan) {
249
284
  return `- Used ${plan.remote.tokenName}, but one or more DistributionOS requests failed.`;
250
285
  }
251
286
  if (plan.remote.status === 'skipped') {
252
- return '- Remote fetch skipped. Dry-run used local fallback instructions and did not call DistributionOS APIs.';
287
+ return '- Remote fetch skipped. The setup plan used local fallback instructions and did not call DistributionOS APIs.';
253
288
  }
254
- return '- No OAuth or env token found. Dry-run used local fallback instructions and did not call DistributionOS APIs.';
289
+ return '- No OAuth or env token found. The setup plan used local fallback instructions and did not call DistributionOS APIs.';
255
290
  }
256
291
 
257
292
  function usageSummary(usage) {
@@ -276,9 +311,9 @@ function analyticsSummary(analytics) {
276
311
  if (analytics.status === 'enabled') {
277
312
  return `contract ${analytics.contractVersion}; install script in ${analytics.layoutTarget ?? 'reviewed shared layout'}`;
278
313
  }
279
- if (analytics.status === 'disabled') {
280
- return 'tracker is not enabled yet; create tracker in DistributionOS first';
281
- }
314
+ if (analytics.status === 'disabled') {
315
+ return 'tracker will be created or fetched during apply before analytics is installed';
316
+ }
282
317
  return 'contract not fetched; print manual guidance only';
283
318
  }
284
319