outfitter 0.3.2 → 0.3.3
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 +33 -5
- package/dist/actions/add.d.ts +18 -0
- package/dist/actions/add.js +14 -0
- package/dist/actions/check-automation.d.ts +20 -0
- package/dist/actions/check-automation.js +27 -0
- package/dist/actions/check.d.ts +34 -0
- package/dist/actions/check.js +19 -0
- package/dist/actions/demo.d.ts +12 -0
- package/dist/actions/demo.js +11 -0
- package/dist/actions/docs-output-mode.d.ts +4 -0
- package/dist/actions/docs-output-mode.js +8 -0
- package/dist/actions/docs.d.ts +25 -0
- package/dist/actions/docs.js +31 -0
- package/dist/actions/doctor.d.ts +10 -0
- package/dist/actions/doctor.js +15 -0
- package/dist/actions/init.d.ts +28 -0
- package/dist/actions/init.js +31 -0
- package/dist/actions/scaffold.d.ts +19 -0
- package/dist/actions/scaffold.js +21 -0
- package/dist/actions/shared.d.ts +61 -0
- package/dist/actions/shared.js +30 -0
- package/dist/actions/upgrade.d.ts +17 -0
- package/dist/actions/upgrade.js +21 -0
- package/dist/actions.d.ts +2 -0
- package/dist/actions.js +66 -0
- package/dist/cli.js +66 -4
- package/dist/commands/add.d.ts +54 -0
- package/dist/commands/add.js +16 -0
- package/dist/commands/check-action-ceremony.d.ts +55 -0
- package/dist/commands/check-action-ceremony.js +15 -0
- package/dist/commands/check-docs-sentinel.d.ts +27 -0
- package/dist/commands/check-docs-sentinel.js +18 -0
- package/dist/commands/check-orchestrator.d.ts +2 -0
- package/dist/commands/check-orchestrator.js +17 -0
- package/dist/commands/check-preset-versions.d.ts +20 -0
- package/dist/commands/check-preset-versions.js +15 -0
- package/dist/commands/check-publish-guardrails.d.ts +38 -0
- package/dist/commands/check-publish-guardrails.js +19 -0
- package/dist/commands/check-surface-map-format.d.ts +29 -0
- package/dist/commands/check-surface-map-format.js +19 -0
- package/dist/commands/check-surface-map.d.ts +20 -0
- package/dist/commands/check-surface-map.js +15 -0
- package/dist/commands/check-tsdoc.d.ts +3 -0
- package/dist/commands/check-tsdoc.js +9 -0
- package/dist/commands/check.d.ts +93 -0
- package/dist/commands/check.js +14 -0
- package/dist/commands/demo.d.ts +21 -0
- package/dist/commands/demo.js +8 -0
- package/dist/commands/docs-api.d.ts +4 -0
- package/dist/commands/docs-api.js +13 -0
- package/dist/commands/docs-export.d.ts +4 -0
- package/dist/commands/docs-export.js +12 -0
- package/dist/commands/docs-list.d.ts +3 -0
- package/dist/commands/docs-list.js +13 -0
- package/dist/commands/docs-module-loader.d.ts +2 -0
- package/dist/commands/docs-module-loader.js +8 -0
- package/dist/commands/docs-search.d.ts +3 -0
- package/dist/commands/docs-search.js +13 -0
- package/dist/commands/docs-show.d.ts +3 -0
- package/dist/commands/docs-show.js +13 -0
- package/dist/commands/docs-types.d.ts +21 -0
- package/dist/commands/docs-types.js +1 -0
- package/dist/commands/doctor.d.ts +2 -0
- package/dist/commands/doctor.js +17 -0
- package/dist/commands/init-execution.d.ts +8 -0
- package/dist/commands/init-execution.js +11 -0
- package/dist/commands/init-option-resolution.d.ts +5 -0
- package/dist/commands/init-option-resolution.js +14 -0
- package/dist/commands/init-output.d.ts +9 -0
- package/dist/commands/init-output.js +11 -0
- package/dist/commands/init.d.ts +9 -0
- package/dist/commands/init.js +24 -0
- package/dist/commands/jq-utils.d.ts +17 -0
- package/dist/commands/jq-utils.js +8 -0
- package/dist/commands/repo.d.ts +3 -0
- package/dist/commands/repo.js +13 -0
- package/dist/commands/scaffold-output.d.ts +4 -0
- package/dist/commands/scaffold-output.js +11 -0
- package/dist/commands/scaffold-planning.d.ts +65 -0
- package/dist/commands/scaffold-planning.js +20 -0
- package/dist/commands/scaffold.d.ts +4 -0
- package/dist/commands/scaffold.js +26 -0
- package/dist/commands/shared-deps.d.ts +22 -0
- package/dist/commands/shared-deps.js +11 -0
- package/dist/commands/upgrade-apply.d.ts +14 -0
- package/dist/commands/upgrade-apply.js +8 -0
- package/dist/commands/upgrade-codemods.d.ts +47 -0
- package/dist/commands/upgrade-codemods.js +14 -0
- package/dist/commands/upgrade-latest-version.d.ts +8 -0
- package/dist/commands/upgrade-latest-version.js +8 -0
- package/dist/commands/upgrade-migration-docs.d.ts +3 -0
- package/dist/commands/upgrade-migration-docs.js +15 -0
- package/dist/commands/upgrade-migration-frontmatter.d.ts +2 -0
- package/dist/commands/upgrade-migration-frontmatter.js +10 -0
- package/dist/commands/upgrade-migration-guides.d.ts +5 -0
- package/dist/commands/upgrade-migration-guides.js +10 -0
- package/dist/commands/upgrade-output.d.ts +5 -0
- package/dist/commands/upgrade-output.js +11 -0
- package/dist/commands/upgrade-planner.d.ts +58 -0
- package/dist/commands/upgrade-planner.js +8 -0
- package/dist/commands/upgrade-report.d.ts +5 -0
- package/dist/commands/upgrade-report.js +8 -0
- package/dist/commands/upgrade-workspace.d.ts +2 -0
- package/dist/commands/upgrade-workspace.js +16 -0
- package/dist/commands/upgrade.d.ts +5 -0
- package/dist/commands/upgrade.js +37 -0
- package/dist/create/index.d.ts +5 -0
- package/dist/create/index.js +2 -0
- package/dist/create/planner.d.ts +3 -0
- package/dist/create/planner.js +85 -0
- package/dist/create/presets.d.ts +3 -0
- package/dist/create/presets.js +12 -0
- package/dist/create/types.d.ts +2 -0
- package/dist/create/types.js +1 -0
- package/dist/engine/blocks.d.ts +3 -0
- package/dist/engine/blocks.js +12 -0
- package/dist/engine/collector.d.ts +2 -0
- package/dist/engine/collector.js +8 -0
- package/dist/engine/config.d.ts +3 -0
- package/dist/engine/config.js +15 -0
- package/dist/engine/dependency-versions.d.ts +17 -0
- package/dist/engine/dependency-versions.js +12 -0
- package/dist/engine/executor.d.ts +3 -0
- package/dist/engine/executor.js +156 -0
- package/dist/engine/index.d.ts +10 -0
- package/dist/engine/index.js +54 -0
- package/dist/engine/names.d.ts +2 -0
- package/dist/engine/names.js +24 -0
- package/dist/engine/post-scaffold.d.ts +3 -0
- package/dist/engine/post-scaffold.js +8 -0
- package/dist/engine/preset.d.ts +3 -0
- package/dist/engine/preset.js +17 -0
- package/dist/engine/render-plan.d.ts +7 -0
- package/dist/engine/render-plan.js +9 -0
- package/dist/engine/template.d.ts +4 -0
- package/dist/engine/template.js +34 -0
- package/dist/engine/types.d.ts +2 -0
- package/dist/engine/types.js +8 -0
- package/dist/engine/workspace.d.ts +3 -0
- package/dist/engine/workspace.js +20 -0
- package/dist/index.d.ts +17 -397
- package/dist/index.js +7 -165
- package/dist/manifest.d.ts +71 -0
- package/dist/manifest.js +16 -0
- package/dist/output-mode.d.ts +2 -0
- package/dist/output-mode.js +10 -0
- package/dist/shared/outfitter-109s75x0.d.ts +76 -0
- package/dist/shared/outfitter-1fy7byz5.js +170 -0
- package/dist/shared/outfitter-1h7k8xxt.js +29 -0
- package/dist/shared/outfitter-1tfa9hke.d.ts +55 -0
- package/dist/shared/outfitter-2nx0k4b3.d.ts +4 -0
- package/dist/shared/outfitter-2ysjerp6.d.ts +44 -0
- package/dist/shared/outfitter-2z61gp5w.js +29 -0
- package/dist/shared/outfitter-34vg353f.d.ts +82 -0
- package/dist/shared/outfitter-3dq4r10s.d.ts +24 -0
- package/dist/shared/outfitter-3rcrvva8.js +103 -0
- package/dist/shared/outfitter-3tx3adgj.js +278 -0
- package/dist/shared/outfitter-4q1zfmvc.js +154 -0
- package/dist/shared/outfitter-4s9meh3j.js +221 -0
- package/dist/shared/outfitter-507ra35w.js +285 -0
- package/dist/shared/outfitter-56jq0rh2.d.ts +42 -0
- package/dist/shared/outfitter-58rn1sj1.d.ts +30 -0
- package/dist/shared/outfitter-5d9wbzhh.d.ts +19 -0
- package/dist/shared/outfitter-5j7zee11.d.ts +180 -0
- package/dist/shared/outfitter-5r6q2749.d.ts +18 -0
- package/dist/shared/outfitter-5vx1bp7h.js +41 -0
- package/dist/shared/outfitter-6ddf91vh.js +190 -0
- package/dist/shared/outfitter-6mpkh3zn.js +432 -0
- package/dist/shared/outfitter-6rtcemk7.d.ts +18 -0
- package/dist/shared/outfitter-6t7xeyg1.js +159 -0
- package/dist/shared/outfitter-738z4c37.js +262 -0
- package/dist/shared/outfitter-76k25svs.js +322 -0
- package/dist/shared/outfitter-7n7vsz95.js +101 -0
- package/dist/shared/outfitter-7q9fnbwa.js +60 -0
- package/dist/shared/outfitter-7r12fj7f.js +30 -0
- package/dist/shared/outfitter-84chvazx.js +480 -0
- package/dist/shared/outfitter-8ggmja91.js +301 -0
- package/dist/shared/outfitter-8kmak0wc.d.ts +4 -0
- package/dist/shared/outfitter-8y2dfx6n.js +11 -0
- package/dist/shared/outfitter-940h0x7b.js +71 -0
- package/dist/shared/outfitter-954y4mzx.d.ts +5 -0
- package/dist/shared/outfitter-a79xrm12.d.ts +17 -0
- package/dist/shared/outfitter-b9cpnr7e.js +110 -0
- package/dist/shared/outfitter-bpr28y54.js +70 -0
- package/dist/shared/outfitter-c7sbs7es.js +92 -0
- package/dist/shared/outfitter-cyhzstz0.js +93 -0
- package/dist/shared/outfitter-cyvr4r8d.d.ts +67 -0
- package/dist/shared/outfitter-d0kqashd.d.ts +98 -0
- package/dist/shared/outfitter-dx4hn4ta.js +325 -0
- package/dist/shared/outfitter-e84cr97g.js +232 -0
- package/dist/shared/outfitter-ec83h4v2.js +17 -0
- package/dist/shared/outfitter-eepj7rf7.js +4 -0
- package/dist/shared/outfitter-ekb6t1zz.js +35 -0
- package/dist/shared/outfitter-ex8gn945.js +51 -0
- package/dist/shared/outfitter-f3a70135.js +75 -0
- package/dist/shared/outfitter-fbvfd5zq.d.ts +13 -0
- package/dist/shared/outfitter-fj2v5ffz.js +165 -0
- package/dist/shared/outfitter-fx1m251y.js +122 -0
- package/dist/shared/outfitter-fxry5n58.js +254 -0
- package/dist/shared/outfitter-g3hvjshg.js +1 -0
- package/dist/shared/outfitter-gdc7b7de.d.ts +5 -0
- package/dist/shared/outfitter-gyayfx5r.js +156 -0
- package/dist/shared/outfitter-h0wmtxw8.d.ts +23 -0
- package/dist/shared/outfitter-hcexcvxe.d.ts +25 -0
- package/dist/shared/outfitter-hf5bj2gq.js +117 -0
- package/dist/shared/outfitter-hsp8vy5m.d.ts +146 -0
- package/dist/shared/outfitter-htx4asgr.d.ts +52 -0
- package/dist/shared/outfitter-jkct38dh.js +53 -0
- package/dist/shared/outfitter-jwxggvz4.js +42 -0
- package/dist/shared/outfitter-k6zyvg2n.js +306 -0
- package/dist/shared/outfitter-ksyvwmb5.js +191 -0
- package/dist/shared/outfitter-m3ehh37q.d.ts +22 -0
- package/dist/shared/outfitter-mstr60zz.js +215 -0
- package/dist/shared/outfitter-n0ed012k.js +101 -0
- package/dist/shared/outfitter-n13pqaft.js +19 -0
- package/dist/shared/outfitter-nxvjxrmw.d.ts +48 -0
- package/dist/shared/outfitter-p2wn07b7.js +160 -0
- package/dist/shared/outfitter-px5sv5gn.js +321 -0
- package/dist/shared/outfitter-q1g58t85.js +8 -0
- package/dist/shared/outfitter-qsd5638j.js +378 -0
- package/dist/shared/outfitter-qsrx7m4w.js +72 -0
- package/dist/shared/outfitter-r2awqszh.d.ts +52 -0
- package/dist/shared/outfitter-rdpw2sbp.d.ts +77 -0
- package/dist/shared/outfitter-rp89dafm.js +109 -0
- package/dist/shared/outfitter-s1c0whzj.js +121 -0
- package/dist/shared/outfitter-ssrtakh3.js +342 -0
- package/dist/shared/outfitter-ssynegbs.js +167 -0
- package/dist/shared/outfitter-svts4wk2.js +36 -0
- package/dist/shared/outfitter-tavatb5p.js +166 -0
- package/dist/shared/outfitter-tqznjgbm.js +44 -0
- package/dist/shared/outfitter-ttjr95y9.js +98 -0
- package/dist/shared/outfitter-wcrp7d7m.d.ts +5 -0
- package/dist/shared/outfitter-wkt0a0ra.js +67 -0
- package/dist/shared/outfitter-wrcqq29p.js +132 -0
- package/dist/shared/outfitter-wyg1tpp5.d.ts +43 -0
- package/dist/shared/outfitter-x0vpb7tj.js +126 -0
- package/dist/shared/outfitter-x39awx8g.js +146 -0
- package/dist/shared/outfitter-x4cc5xsq.js +168 -0
- package/dist/shared/outfitter-x8w5sjnd.d.ts +39 -0
- package/dist/shared/outfitter-xr6g13nz.d.ts +50 -0
- package/dist/shared/outfitter-xs94pkfe.js +106 -0
- package/dist/shared/outfitter-y37yfehn.d.ts +37 -0
- package/dist/shared/outfitter-y6ee0k45.d.ts +18 -0
- package/dist/shared/outfitter-ydw7x6bh.js +61 -0
- package/dist/shared/outfitter-yhb23pjc.js +89 -0
- package/dist/shared/outfitter-ypcvwg1s.js +91 -0
- package/dist/shared/outfitter-znbqe5zy.d.ts +45 -0
- package/dist/shared/outfitter-zng6w0t9.d.ts +4 -0
- package/dist/targets/index.d.ts +4 -0
- package/dist/targets/index.js +28 -0
- package/dist/targets/registry.d.ts +3 -0
- package/dist/targets/registry.js +221 -0
- package/dist/targets/types.d.ts +2 -0
- package/dist/targets/types.js +1 -0
- package/package.json +194 -35
- package/dist/shared/chunk-3pwh8ys4.js +0 -6461
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { VersionConflict } from "./outfitter-109s75x0.js";
|
|
2
|
+
import { MigrationChange } from "./outfitter-y37yfehn.js";
|
|
3
|
+
import { OutputMode as OutputMode3 } from "@outfitter/cli/types";
|
|
4
|
+
import { OutfitterError as OutfitterError2 } from "@outfitter/contracts";
|
|
5
|
+
import { Result } from "@outfitter/contracts";
|
|
6
|
+
import { OutputMode } from "@outfitter/cli/types";
|
|
7
|
+
/** Options controlling how upgrade results are rendered. */
|
|
8
|
+
interface PrintUpgradeResultsOptions {
|
|
9
|
+
readonly all?: boolean;
|
|
10
|
+
readonly cwd?: string;
|
|
11
|
+
readonly dryRun?: boolean;
|
|
12
|
+
readonly guide?: boolean;
|
|
13
|
+
readonly mode?: OutputMode;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Format and output upgrade results.
|
|
17
|
+
*
|
|
18
|
+
* @param result - Upgrade scan/apply result to render
|
|
19
|
+
* @param options - Display options (output mode, guide, dry-run hints)
|
|
20
|
+
*/
|
|
21
|
+
declare function printUpgradeResults(result: UpgradeResult, options?: PrintUpgradeResultsOptions): Promise<void>;
|
|
22
|
+
import { OutputMode as OutputMode2 } from "@outfitter/cli/types";
|
|
23
|
+
import { OutfitterError } from "@outfitter/contracts";
|
|
24
|
+
/** Terminal disposition of an upgrade run (written into the report). */
|
|
25
|
+
type UpgradeReportStatus = "dry_run" | "no_updates" | "cancelled" | "skipped_non_interactive" | "applied" | "failed";
|
|
26
|
+
/** Snapshot of effective flags for this upgrade run. */
|
|
27
|
+
interface UpgradeReportFlags {
|
|
28
|
+
readonly all: boolean;
|
|
29
|
+
readonly dryRun: boolean;
|
|
30
|
+
readonly interactive: boolean;
|
|
31
|
+
readonly noCodemods: boolean;
|
|
32
|
+
readonly outputMode: OutputMode2 | null;
|
|
33
|
+
readonly yes: boolean;
|
|
34
|
+
}
|
|
35
|
+
/** Machine-readable upgrade report written to `.outfitter/reports/upgrade.json`. */
|
|
36
|
+
interface UpgradeReport {
|
|
37
|
+
readonly $schema: "https://outfitter.dev/reports/upgrade/v1";
|
|
38
|
+
readonly applied: boolean;
|
|
39
|
+
readonly checkedAt: string;
|
|
40
|
+
readonly codemods?: CodemodSummary;
|
|
41
|
+
readonly conflicts?: readonly VersionConflict[];
|
|
42
|
+
readonly cwd: string;
|
|
43
|
+
readonly error?: {
|
|
44
|
+
readonly message: string;
|
|
45
|
+
readonly category: string;
|
|
46
|
+
readonly context?: Record<string, unknown>;
|
|
47
|
+
};
|
|
48
|
+
readonly excluded: {
|
|
49
|
+
readonly breaking: readonly string[];
|
|
50
|
+
};
|
|
51
|
+
readonly finishedAt: string;
|
|
52
|
+
readonly flags: UpgradeReportFlags;
|
|
53
|
+
readonly packages: readonly PackageVersionInfo[];
|
|
54
|
+
readonly startedAt: string;
|
|
55
|
+
readonly status: UpgradeReportStatus;
|
|
56
|
+
readonly summary: {
|
|
57
|
+
readonly total: number;
|
|
58
|
+
readonly available: number;
|
|
59
|
+
readonly breaking: number;
|
|
60
|
+
readonly applied: number;
|
|
61
|
+
};
|
|
62
|
+
readonly unknownPackages?: readonly string[];
|
|
63
|
+
readonly workspaceRoot: string | null;
|
|
64
|
+
}
|
|
65
|
+
/** Contextual metadata passed alongside the result when writing a report. */
|
|
66
|
+
interface WriteUpgradeReportMeta {
|
|
67
|
+
readonly error?: OutfitterError;
|
|
68
|
+
readonly options: UpgradeOptions;
|
|
69
|
+
readonly startedAt: Date;
|
|
70
|
+
readonly status: UpgradeReportStatus;
|
|
71
|
+
readonly workspaceRoot: string | null;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Best-effort report writer.
|
|
75
|
+
*
|
|
76
|
+
* Report I/O failures should not change the primary command result.
|
|
77
|
+
*/
|
|
78
|
+
declare function writeUpgradeReportSafely(cwd: string, result: UpgradeResult, meta: WriteUpgradeReportMeta): void;
|
|
79
|
+
/** Input options for `runUpgrade`. */
|
|
80
|
+
interface UpgradeOptions {
|
|
81
|
+
/** Include breaking changes in the upgrade */
|
|
82
|
+
readonly all?: boolean;
|
|
83
|
+
/** Working directory (defaults to cwd) */
|
|
84
|
+
readonly cwd: string;
|
|
85
|
+
/** Preview only — no mutations, no prompt */
|
|
86
|
+
readonly dryRun?: boolean;
|
|
87
|
+
/** Show migration guide */
|
|
88
|
+
readonly guide?: boolean;
|
|
89
|
+
/** Filter to specific package names (scan + guides) */
|
|
90
|
+
readonly guidePackages?: readonly string[];
|
|
91
|
+
/** Whether interactive prompts are enabled (false in CI) */
|
|
92
|
+
readonly interactive?: boolean;
|
|
93
|
+
/** Skip automatic codemod execution during upgrade */
|
|
94
|
+
readonly noCodemods?: boolean;
|
|
95
|
+
/** Output mode */
|
|
96
|
+
readonly outputMode?: OutputMode3;
|
|
97
|
+
/** Auto-confirm without prompting */
|
|
98
|
+
readonly yes?: boolean;
|
|
99
|
+
}
|
|
100
|
+
/** Version metadata for a single installed @outfitter/* package. */
|
|
101
|
+
interface PackageVersionInfo {
|
|
102
|
+
/** Whether the update contains breaking changes (major bump) */
|
|
103
|
+
readonly breaking: boolean;
|
|
104
|
+
/** Currently installed version */
|
|
105
|
+
readonly current: string;
|
|
106
|
+
/** Latest available version from npm (null if query failed) */
|
|
107
|
+
readonly latest: string | null;
|
|
108
|
+
/** Full package name */
|
|
109
|
+
readonly name: string;
|
|
110
|
+
/** Whether an update is available */
|
|
111
|
+
readonly updateAvailable: boolean;
|
|
112
|
+
}
|
|
113
|
+
/** Summary of codemods executed during --apply. */
|
|
114
|
+
interface CodemodSummary {
|
|
115
|
+
/** Total files changed across all codemods */
|
|
116
|
+
readonly changedFiles: readonly string[];
|
|
117
|
+
/** Number of codemods executed */
|
|
118
|
+
readonly codemodCount: number;
|
|
119
|
+
/** Errors encountered during codemod execution */
|
|
120
|
+
readonly errors: readonly string[];
|
|
121
|
+
}
|
|
122
|
+
/** Complete output of a single upgrade run. */
|
|
123
|
+
interface UpgradeResult {
|
|
124
|
+
/** Whether mutations were made (--apply was used and changes were written) */
|
|
125
|
+
readonly applied: boolean;
|
|
126
|
+
/** Package names that were updated in package.json */
|
|
127
|
+
readonly appliedPackages: string[];
|
|
128
|
+
/** Codemod execution summary (populated when --apply runs codemods) */
|
|
129
|
+
readonly codemods?: CodemodSummary;
|
|
130
|
+
/** Version conflicts found across workspace manifests */
|
|
131
|
+
readonly conflicts?: readonly VersionConflict[];
|
|
132
|
+
/** Structured migration guides (populated when --guide is used) */
|
|
133
|
+
readonly guides?: readonly MigrationGuide[];
|
|
134
|
+
/** Whether any update is a breaking change */
|
|
135
|
+
readonly hasBreaking: boolean;
|
|
136
|
+
/** Package version info */
|
|
137
|
+
readonly packages: PackageVersionInfo[];
|
|
138
|
+
/** Package names skipped because they contain breaking changes */
|
|
139
|
+
readonly skippedBreaking: string[];
|
|
140
|
+
/** Total packages checked */
|
|
141
|
+
readonly total: number;
|
|
142
|
+
/** Package names that were requested but not found in the workspace */
|
|
143
|
+
readonly unknownPackages?: readonly string[];
|
|
144
|
+
/** Number of packages with updates available */
|
|
145
|
+
readonly updatesAvailable: number;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Run the upgrade command — detect installed versions and query npm for latest.
|
|
149
|
+
*
|
|
150
|
+
* Default flow: scan → classify → prompt → apply.
|
|
151
|
+
* `--dry-run` returns a report without mutation.
|
|
152
|
+
* `--all` includes breaking changes.
|
|
153
|
+
* `--yes` or `--non-interactive` bypasses the prompt.
|
|
154
|
+
*/
|
|
155
|
+
declare function runUpgrade(options: UpgradeOptions): Promise<Result<UpgradeResult, OutfitterError2>>;
|
|
156
|
+
type GuidePackageVersionInfo = PackageVersionInfo;
|
|
157
|
+
/** Structured migration guide for a single package upgrade. */
|
|
158
|
+
interface MigrationGuide {
|
|
159
|
+
/** Whether this is a breaking change */
|
|
160
|
+
readonly breaking: boolean;
|
|
161
|
+
/** Structured changes from migration frontmatter, if available */
|
|
162
|
+
readonly changes?: readonly MigrationChange[];
|
|
163
|
+
/** Currently installed version */
|
|
164
|
+
readonly fromVersion: string;
|
|
165
|
+
/** The @outfitter/* package name */
|
|
166
|
+
readonly packageName: string;
|
|
167
|
+
/** Migration step strings (empty if no guide exists) */
|
|
168
|
+
readonly steps: readonly string[];
|
|
169
|
+
/** Latest available version */
|
|
170
|
+
readonly toVersion: string;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Build structured migration guides for packages with available updates.
|
|
174
|
+
*
|
|
175
|
+
* For each package with an update, produces a `MigrationGuide` with steps
|
|
176
|
+
* extracted from migration docs (if a migrations directory is available).
|
|
177
|
+
* Packages without updates or without a resolved latest version are skipped.
|
|
178
|
+
*/
|
|
179
|
+
declare function buildMigrationGuides(packages: readonly GuidePackageVersionInfo[], migrationsDir: string | null): MigrationGuide[];
|
|
180
|
+
export { MigrationGuide, buildMigrationGuides, PrintUpgradeResultsOptions, printUpgradeResults, UpgradeOptions, PackageVersionInfo, CodemodSummary, UpgradeResult, runUpgrade, UpgradeReportStatus, UpgradeReportFlags, UpgradeReport, WriteUpgradeReportMeta, writeUpgradeReportSafely };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TargetCategory, TargetDefinition, TargetId, TargetScope, TargetStatus } from "./outfitter-58rn1sj1.js";
|
|
2
|
+
import { NotFoundError, Result, ValidationError } from "@outfitter/contracts";
|
|
3
|
+
declare const TARGET_REGISTRY: ReadonlyMap<TargetId, TargetDefinition>;
|
|
4
|
+
declare const TARGET_IDS: readonly TargetId[];
|
|
5
|
+
declare const READY_TARGET_IDS: readonly TargetId[];
|
|
6
|
+
declare const INIT_TARGET_IDS: readonly TargetId[];
|
|
7
|
+
declare const SCAFFOLD_TARGET_IDS: readonly TargetId[];
|
|
8
|
+
declare function getTarget(id: string): Result<TargetDefinition, NotFoundError>;
|
|
9
|
+
declare function getReadyTarget(id: string): Result<TargetDefinition, NotFoundError | ValidationError>;
|
|
10
|
+
declare function getInitTarget(id: string): Result<TargetDefinition, NotFoundError | ValidationError>;
|
|
11
|
+
declare function getScaffoldTarget(id: string): Result<TargetDefinition, NotFoundError | ValidationError>;
|
|
12
|
+
declare function resolvePlacement(target: TargetDefinition): "apps" | "packages";
|
|
13
|
+
declare function listTargets(filter?: {
|
|
14
|
+
readonly status?: TargetStatus;
|
|
15
|
+
readonly scope?: TargetScope;
|
|
16
|
+
readonly category?: TargetCategory;
|
|
17
|
+
}): readonly TargetDefinition[];
|
|
18
|
+
export { TARGET_REGISTRY, TARGET_IDS, READY_TARGET_IDS, INIT_TARGET_IDS, SCAFFOLD_TARGET_IDS, getTarget, getReadyTarget, getInitTarget, getScaffoldTarget, resolvePlacement, listTargets };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// apps/outfitter/src/commands/jq-utils.ts
|
|
3
|
+
async function applyJq(data, expr, options) {
|
|
4
|
+
try {
|
|
5
|
+
const json = JSON.stringify(data);
|
|
6
|
+
const args = ["jq", ...options?.compact ? ["-c"] : [], expr];
|
|
7
|
+
const proc = Bun.spawn(args, {
|
|
8
|
+
stdin: new Response(json),
|
|
9
|
+
stdout: "pipe",
|
|
10
|
+
stderr: "pipe"
|
|
11
|
+
});
|
|
12
|
+
const [stdout, stderr, exitCode] = await Promise.all([
|
|
13
|
+
new Response(proc.stdout).text(),
|
|
14
|
+
new Response(proc.stderr).text(),
|
|
15
|
+
proc.exited
|
|
16
|
+
]);
|
|
17
|
+
if (exitCode !== 0) {
|
|
18
|
+
process.stderr.write(`jq error: ${stderr.trim()}
|
|
19
|
+
`);
|
|
20
|
+
return options?.compact ? `${JSON.stringify(data)}
|
|
21
|
+
` : `${JSON.stringify(data, null, 2)}
|
|
22
|
+
`;
|
|
23
|
+
}
|
|
24
|
+
return stdout;
|
|
25
|
+
} catch (error) {
|
|
26
|
+
const message = error instanceof Error ? error.message : "unknown jq execution error";
|
|
27
|
+
const missingBinary = /enoent|not found/i.test(message);
|
|
28
|
+
if (missingBinary) {
|
|
29
|
+
process.stderr.write(`jq is not installed. Install jq or omit --jq to continue.
|
|
30
|
+
`);
|
|
31
|
+
} else {
|
|
32
|
+
process.stderr.write(`jq execution error: ${message}
|
|
33
|
+
`);
|
|
34
|
+
}
|
|
35
|
+
return options?.compact ? `${JSON.stringify(data)}
|
|
36
|
+
` : `${JSON.stringify(data, null, 2)}
|
|
37
|
+
`;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { applyJq };
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
buildScaffoldPlan,
|
|
4
|
+
convertToWorkspace,
|
|
5
|
+
detectProjectStructure,
|
|
6
|
+
ensureWorkspacePattern,
|
|
7
|
+
validateScaffoldTargetName
|
|
8
|
+
} from "./outfitter-qsd5638j.js";
|
|
9
|
+
import {
|
|
10
|
+
getScaffoldTarget
|
|
11
|
+
} from "./outfitter-g3hvjshg.js";
|
|
12
|
+
import {
|
|
13
|
+
deriveProjectName,
|
|
14
|
+
executePlan,
|
|
15
|
+
isPathWithin
|
|
16
|
+
} from "./outfitter-q1g58t85.js";
|
|
17
|
+
import {
|
|
18
|
+
printScaffoldResults
|
|
19
|
+
} from "./outfitter-qsrx7m4w.js";
|
|
20
|
+
import {
|
|
21
|
+
runPostScaffold
|
|
22
|
+
} from "./outfitter-4s9meh3j.js";
|
|
23
|
+
import {
|
|
24
|
+
scaffoldWorkspaceRoot
|
|
25
|
+
} from "./outfitter-1fy7byz5.js";
|
|
26
|
+
import {
|
|
27
|
+
OperationCollector
|
|
28
|
+
} from "./outfitter-1h7k8xxt.js";
|
|
29
|
+
|
|
30
|
+
// apps/outfitter/src/commands/scaffold.ts
|
|
31
|
+
import { existsSync } from "fs";
|
|
32
|
+
import { basename, join, resolve } from "path";
|
|
33
|
+
import { exitWithError } from "@outfitter/cli";
|
|
34
|
+
import { Result } from "@outfitter/contracts";
|
|
35
|
+
class ScaffoldCommandError extends Error {
|
|
36
|
+
_tag = "ScaffoldCommandError";
|
|
37
|
+
constructor(message) {
|
|
38
|
+
super(message);
|
|
39
|
+
this.name = "ScaffoldCommandError";
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
async function runScaffold(options) {
|
|
43
|
+
const targetResult = getScaffoldTarget(options.target);
|
|
44
|
+
if (targetResult.isErr()) {
|
|
45
|
+
return Result.err(new ScaffoldCommandError(targetResult.error.message));
|
|
46
|
+
}
|
|
47
|
+
const target = targetResult.value;
|
|
48
|
+
const targetName = deriveProjectName(options.name ?? target.id);
|
|
49
|
+
const targetNameValidation = validateScaffoldTargetName(targetName);
|
|
50
|
+
if (targetNameValidation.isErr()) {
|
|
51
|
+
return Result.err(new ScaffoldCommandError(targetNameValidation.error));
|
|
52
|
+
}
|
|
53
|
+
const dryRun = options.dryRun;
|
|
54
|
+
const collector = dryRun ? new OperationCollector : undefined;
|
|
55
|
+
const structureResult = detectProjectStructure(options.cwd);
|
|
56
|
+
if (structureResult.isErr()) {
|
|
57
|
+
return Result.err(new ScaffoldCommandError(structureResult.error));
|
|
58
|
+
}
|
|
59
|
+
let rootDir = resolve(options.cwd);
|
|
60
|
+
let converted = false;
|
|
61
|
+
let movedExisting;
|
|
62
|
+
let workspacePatternsUpdated = false;
|
|
63
|
+
if (structureResult.value.kind === "workspace") {
|
|
64
|
+
rootDir = structureResult.value.rootDir;
|
|
65
|
+
const patternResult = ensureWorkspacePattern(rootDir, target.placement, dryRun, collector);
|
|
66
|
+
if (patternResult.isErr()) {
|
|
67
|
+
return Result.err(new ScaffoldCommandError(patternResult.error));
|
|
68
|
+
}
|
|
69
|
+
workspacePatternsUpdated = patternResult.value;
|
|
70
|
+
} else if (structureResult.value.kind === "single-package") {
|
|
71
|
+
const conversionResult = convertToWorkspace(structureResult.value.rootDir, structureResult.value.packageJson, dryRun, collector);
|
|
72
|
+
if (conversionResult.isErr()) {
|
|
73
|
+
return Result.err(new ScaffoldCommandError(conversionResult.error));
|
|
74
|
+
}
|
|
75
|
+
rootDir = structureResult.value.rootDir;
|
|
76
|
+
converted = true;
|
|
77
|
+
movedExisting = conversionResult.value.movedExisting;
|
|
78
|
+
} else {
|
|
79
|
+
const workspaceName = `${basename(rootDir)}-workspace`;
|
|
80
|
+
if (dryRun) {
|
|
81
|
+
const packageJsonPath = join(rootDir, "package.json");
|
|
82
|
+
if (existsSync(packageJsonPath) && !options.force) {
|
|
83
|
+
return Result.err(new ScaffoldCommandError(`Directory '${rootDir}' already has a package.json. Use --force to overwrite.`));
|
|
84
|
+
}
|
|
85
|
+
collector?.add({
|
|
86
|
+
type: "dir-create",
|
|
87
|
+
path: join(rootDir, "apps")
|
|
88
|
+
});
|
|
89
|
+
collector?.add({
|
|
90
|
+
type: "dir-create",
|
|
91
|
+
path: join(rootDir, "packages")
|
|
92
|
+
});
|
|
93
|
+
collector?.add(existsSync(packageJsonPath) ? {
|
|
94
|
+
type: "file-overwrite",
|
|
95
|
+
path: packageJsonPath,
|
|
96
|
+
source: "generated"
|
|
97
|
+
} : {
|
|
98
|
+
type: "file-create",
|
|
99
|
+
path: packageJsonPath,
|
|
100
|
+
source: "generated"
|
|
101
|
+
});
|
|
102
|
+
const gitignorePath = join(rootDir, ".gitignore");
|
|
103
|
+
if (options.force || !existsSync(gitignorePath)) {
|
|
104
|
+
collector?.add(existsSync(gitignorePath) ? {
|
|
105
|
+
type: "file-overwrite",
|
|
106
|
+
path: gitignorePath,
|
|
107
|
+
source: "generated"
|
|
108
|
+
} : {
|
|
109
|
+
type: "file-create",
|
|
110
|
+
path: gitignorePath,
|
|
111
|
+
source: "generated"
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
} else {
|
|
115
|
+
const workspaceResult = scaffoldWorkspaceRoot(rootDir, workspaceName, options.force);
|
|
116
|
+
if (workspaceResult.isErr()) {
|
|
117
|
+
return Result.err(new ScaffoldCommandError(workspaceResult.error.message));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
converted = true;
|
|
121
|
+
}
|
|
122
|
+
const targetBaseDir = resolve(rootDir, target.placement);
|
|
123
|
+
const targetDir = resolve(targetBaseDir, targetName);
|
|
124
|
+
if (!isPathWithin(targetBaseDir, targetDir)) {
|
|
125
|
+
return Result.err(new ScaffoldCommandError(`Invalid target name '${targetName}': path escapes '${targetBaseDir}'`));
|
|
126
|
+
}
|
|
127
|
+
if (existsSync(targetDir) && !options.force && !dryRun) {
|
|
128
|
+
return Result.err(new ScaffoldCommandError(`'${target.placement}/${targetName}/' already exists. Use --force to overwrite.`));
|
|
129
|
+
}
|
|
130
|
+
const plan = buildScaffoldPlan(target, rootDir, targetName, options);
|
|
131
|
+
const executeResult = await executePlan(plan, {
|
|
132
|
+
force: options.force,
|
|
133
|
+
...collector ? { collector } : {}
|
|
134
|
+
});
|
|
135
|
+
if (executeResult.isErr()) {
|
|
136
|
+
return Result.err(new ScaffoldCommandError(executeResult.error.message));
|
|
137
|
+
}
|
|
138
|
+
const postScaffoldResult = await runPostScaffold({
|
|
139
|
+
rootDir,
|
|
140
|
+
projectDir: targetDir,
|
|
141
|
+
origin: "scaffold",
|
|
142
|
+
target: target.id,
|
|
143
|
+
structure: "workspace",
|
|
144
|
+
skipInstall: options.skipInstall,
|
|
145
|
+
skipGit: true,
|
|
146
|
+
skipCommit: true,
|
|
147
|
+
dryRun,
|
|
148
|
+
installTimeoutMs: options.installTimeout ?? 60000
|
|
149
|
+
}, collector);
|
|
150
|
+
if (postScaffoldResult.isErr()) {
|
|
151
|
+
return Result.err(new ScaffoldCommandError("Post-scaffold step failed"));
|
|
152
|
+
}
|
|
153
|
+
return Result.ok({
|
|
154
|
+
target: target.id,
|
|
155
|
+
rootDir,
|
|
156
|
+
targetDir,
|
|
157
|
+
converted,
|
|
158
|
+
movedExisting,
|
|
159
|
+
workspacePatternsUpdated,
|
|
160
|
+
blocksAdded: executeResult.value.blocksAdded,
|
|
161
|
+
postScaffold: postScaffoldResult.value,
|
|
162
|
+
...collector ? { dryRunPlan: collector.toJSON() } : {}
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
function scaffoldCommand(program) {
|
|
166
|
+
program.command("scaffold <target> [name]").description("Add a capability to an existing project").option("-f, --force", "Overwrite existing files", false).option("--skip-install", "Skip bun install", false).option("--dry-run", "Preview changes without executing", false).option("--with <blocks>", "Comma-separated tooling blocks to add").option("--no-tooling", "Skip default tooling blocks").option("--local", "Use workspace:* for @outfitter dependencies").option("--install-timeout <ms>", "bun install timeout in ms").action(async (target, name, _flags, command) => {
|
|
167
|
+
const resolvedFlags = command.optsWithGlobals();
|
|
168
|
+
const mode = resolvedFlags.json ? "json" : undefined;
|
|
169
|
+
const outputOptions = mode ? { mode } : undefined;
|
|
170
|
+
const result = await runScaffold({
|
|
171
|
+
target,
|
|
172
|
+
name,
|
|
173
|
+
force: Boolean(resolvedFlags.force),
|
|
174
|
+
skipInstall: Boolean(resolvedFlags.skipInstall),
|
|
175
|
+
dryRun: Boolean(resolvedFlags.dryRun),
|
|
176
|
+
with: resolvedFlags.with,
|
|
177
|
+
noTooling: resolvedFlags.noTooling,
|
|
178
|
+
local: resolvedFlags.local,
|
|
179
|
+
cwd: process.cwd(),
|
|
180
|
+
...resolvedFlags.installTimeout !== undefined ? { installTimeout: resolvedFlags.installTimeout } : {}
|
|
181
|
+
});
|
|
182
|
+
if (result.isErr()) {
|
|
183
|
+
exitWithError(result.error, outputOptions);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
await printScaffoldResults(result.value, outputOptions);
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export { ScaffoldCommandError, runScaffold, scaffoldCommand };
|