outfitter 0.2.7 → 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 +34 -7
- 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 +1 -1
- package/dist/actions.js +53 -22
- package/dist/cli.js +66 -4
- package/dist/commands/add.js +3 -3
- 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 +2 -21
- package/dist/commands/check-tsdoc.js +3 -2
- package/dist/commands/check.d.ts +2 -0
- package/dist/commands/check.js +3 -3
- package/dist/commands/demo.js +1 -1
- 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 -2
- package/dist/commands/docs-module-loader.js +2 -2
- 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/doctor.js +4 -12
- 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 +7 -5
- package/dist/commands/init.js +10 -18
- package/dist/commands/jq-utils.d.ts +17 -0
- package/dist/commands/jq-utils.js +8 -0
- package/dist/commands/repo.d.ts +3 -3
- package/dist/commands/repo.js +8 -4
- 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 +3 -3
- package/dist/commands/scaffold.js +10 -16
- package/dist/commands/shared-deps.d.ts +5 -4
- package/dist/commands/shared-deps.js +3 -3
- package/dist/commands/upgrade-apply.d.ts +14 -0
- package/dist/commands/upgrade-apply.js +8 -0
- package/dist/commands/upgrade-codemods.d.ts +5 -0
- package/dist/commands/upgrade-codemods.js +4 -5
- 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.js +1 -1
- package/dist/commands/upgrade-report.d.ts +5 -0
- package/dist/commands/upgrade-report.js +8 -0
- package/dist/commands/upgrade-workspace.js +2 -2
- package/dist/commands/upgrade.d.ts +4 -220
- package/dist/commands/upgrade.js +21 -9
- package/dist/create/index.d.ts +3 -3
- package/dist/create/index.js +2 -30
- package/dist/create/planner.d.ts +2 -2
- package/dist/create/planner.js +80 -17
- package/dist/create/presets.d.ts +2 -2
- package/dist/create/presets.js +2 -2
- package/dist/create/types.d.ts +1 -1
- package/dist/engine/blocks.d.ts +2 -2
- package/dist/engine/blocks.js +5 -5
- package/dist/engine/collector.d.ts +1 -1
- package/dist/engine/collector.js +1 -1
- package/dist/engine/config.d.ts +2 -2
- package/dist/engine/config.js +4 -4
- package/dist/engine/dependency-versions.d.ts +13 -8
- package/dist/engine/dependency-versions.js +4 -4
- package/dist/engine/executor.d.ts +2 -2
- package/dist/engine/executor.js +149 -12
- package/dist/engine/index.d.ts +9 -7
- package/dist/engine/index.js +17 -31
- package/dist/engine/names.js +1 -1
- package/dist/engine/post-scaffold.d.ts +2 -2
- package/dist/engine/post-scaffold.js +1 -1
- package/dist/engine/preset.d.ts +3 -0
- package/dist/engine/preset.js +17 -0
- package/dist/engine/render-plan.d.ts +1 -1
- package/dist/engine/render-plan.js +1 -1
- package/dist/engine/template.d.ts +3 -2
- package/dist/engine/template.js +24 -7
- package/dist/engine/types.d.ts +1 -1
- package/dist/engine/types.js +1 -1
- package/dist/engine/workspace.d.ts +2 -2
- package/dist/engine/workspace.js +1 -1
- package/dist/index.d.ts +17 -398
- package/dist/index.js +7 -164
- package/dist/manifest.js +2 -2
- package/dist/output-mode.js +1 -1
- package/dist/shared/{outfitter-6fgk6adm.d.ts → outfitter-1tfa9hke.d.ts} +16 -1
- package/dist/shared/{outfitter-6bkqjk86.d.ts → outfitter-2nx0k4b3.d.ts} +1 -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-5yjr404v.d.ts → outfitter-3dq4r10s.d.ts} +5 -3
- package/dist/shared/outfitter-3rcrvva8.js +103 -0
- package/dist/shared/{outfitter-79vfxt6y.js → outfitter-3tx3adgj.js} +12 -3
- package/dist/shared/{outfitter-63gse8fv.js → outfitter-507ra35w.js} +33 -64
- package/dist/shared/outfitter-56jq0rh2.d.ts +42 -0
- package/dist/shared/{outfitter-r419zfgs.d.ts → outfitter-58rn1sj1.d.ts} +1 -1
- package/dist/shared/outfitter-5d9wbzhh.d.ts +19 -0
- package/dist/shared/outfitter-5j7zee11.d.ts +180 -0
- package/dist/shared/{outfitter-s7jetkge.d.ts → outfitter-5r6q2749.d.ts} +1 -1
- package/dist/shared/outfitter-5vx1bp7h.js +41 -0
- package/dist/shared/outfitter-6ddf91vh.js +190 -0
- package/dist/shared/{outfitter-mt7d1ek2.js → outfitter-6mpkh3zn.js} +39 -305
- package/dist/shared/{outfitter-ybbazsxq.d.ts → outfitter-6rtcemk7.d.ts} +8 -4
- package/dist/shared/{outfitter-9x1brcmq.js → outfitter-6t7xeyg1.js} +13 -38
- package/dist/shared/outfitter-738z4c37.js +262 -0
- package/dist/shared/{outfitter-yvksv5qb.js → outfitter-76k25svs.js} +4 -4
- package/dist/shared/outfitter-7n7vsz95.js +101 -0
- package/dist/shared/outfitter-7q9fnbwa.js +60 -0
- package/dist/shared/outfitter-84chvazx.js +480 -0
- package/dist/shared/outfitter-8ggmja91.js +301 -0
- package/dist/shared/{outfitter-qakwgrrh.d.ts → outfitter-8kmak0wc.d.ts} +1 -1
- package/dist/shared/outfitter-940h0x7b.js +71 -0
- package/dist/shared/{outfitter-fn20r49x.d.ts → outfitter-954y4mzx.d.ts} +1 -1
- package/dist/shared/outfitter-b9cpnr7e.js +110 -0
- package/dist/shared/outfitter-c7sbs7es.js +92 -0
- package/dist/shared/outfitter-cyhzstz0.js +93 -0
- package/dist/shared/{outfitter-n9g1zk4x.d.ts → outfitter-cyvr4r8d.d.ts} +3 -2
- package/dist/shared/outfitter-d0kqashd.d.ts +98 -0
- package/dist/shared/outfitter-dx4hn4ta.js +325 -0
- package/dist/shared/{outfitter-bn9c8p2e.js → outfitter-e84cr97g.js} +37 -9
- package/dist/shared/outfitter-ec83h4v2.js +17 -0
- package/dist/shared/{outfitter-vh4xgb93.js → outfitter-ekb6t1zz.js} +4 -4
- 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-f9znfhkn.d.ts → outfitter-gdc7b7de.d.ts} +1 -1
- package/dist/shared/outfitter-gyayfx5r.js +156 -0
- package/dist/shared/outfitter-h0wmtxw8.d.ts +23 -0
- package/dist/shared/{outfitter-z5sx06qe.d.ts → outfitter-hcexcvxe.d.ts} +1 -1
- package/dist/shared/outfitter-hf5bj2gq.js +117 -0
- package/dist/shared/{outfitter-e9rrfekb.d.ts → outfitter-htx4asgr.d.ts} +4 -3
- 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-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-5y646xzk.js → outfitter-px5sv5gn.js} +29 -9
- package/dist/shared/outfitter-q1g58t85.js +8 -0
- package/dist/shared/{outfitter-pj9vp00r.js → outfitter-qsd5638j.js} +26 -249
- 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-w1j80j1r.js → outfitter-ssrtakh3.js} +21 -5
- package/dist/shared/outfitter-ssynegbs.js +167 -0
- package/dist/shared/{outfitter-zwyvewr1.js → outfitter-svts4wk2.js} +1 -1
- package/dist/shared/outfitter-tavatb5p.js +166 -0
- package/dist/shared/outfitter-tqznjgbm.js +44 -0
- package/dist/shared/{outfitter-yraebrmw.d.ts → outfitter-wcrp7d7m.d.ts} +1 -1
- package/dist/shared/outfitter-wkt0a0ra.js +67 -0
- package/dist/shared/{outfitter-ha89qf8q.js → outfitter-wrcqq29p.js} +4 -4
- package/dist/shared/outfitter-wyg1tpp5.d.ts +43 -0
- package/dist/shared/outfitter-x0vpb7tj.js +126 -0
- package/dist/shared/{outfitter-m44n0qzw.js → outfitter-x39awx8g.js} +11 -26
- package/dist/shared/outfitter-x4cc5xsq.js +168 -0
- package/dist/shared/outfitter-x8w5sjnd.d.ts +39 -0
- package/dist/shared/{outfitter-amc4jbs1.d.ts → outfitter-xr6g13nz.d.ts} +2 -2
- package/dist/shared/outfitter-xs94pkfe.js +106 -0
- package/dist/shared/outfitter-y37yfehn.d.ts +37 -0
- package/dist/shared/{outfitter-fhnjpjwc.d.ts → outfitter-y6ee0k45.d.ts} +1 -1
- package/dist/shared/{outfitter-j833sxws.js → outfitter-ydw7x6bh.js} +1 -1
- package/dist/shared/outfitter-yhb23pjc.js +89 -0
- package/dist/shared/{outfitter-mtbpabf3.js → outfitter-ypcvwg1s.js} +1 -1
- package/dist/shared/outfitter-znbqe5zy.d.ts +45 -0
- package/dist/shared/{outfitter-dpj9erew.d.ts → outfitter-zng6w0t9.d.ts} +1 -1
- package/dist/targets/index.d.ts +2 -2
- package/dist/targets/index.js +2 -3
- package/dist/targets/registry.d.ts +2 -2
- package/dist/targets/registry.js +207 -14
- package/dist/targets/types.d.ts +1 -1
- package/package.json +203 -40
- package/dist/shared/chunk-x6644tk8.js +0 -6491
- package/dist/shared/outfitter-20f6a2n4.js +0 -35
- package/dist/shared/outfitter-5akzvppx.js +0 -125
- package/dist/shared/outfitter-7ch26yq8.js +0 -885
- package/dist/shared/outfitter-ehp18x1n.js +0 -1
- package/dist/shared/outfitter-h3q6ae6d.d.ts +0 -48
- package/dist/shared/outfitter-hvsaxgcp.js +0 -1
- package/dist/shared/outfitter-p71qb0f0.js +0 -82
- package/dist/shared/outfitter-pcj9gg2g.js +0 -909
- package/dist/shared/outfitter-xe5mzgdc.js +0 -208
- package/dist/shared/outfitter-z0we32cp.d.ts +0 -63
- package/template-versions.json +0 -22
- package/templates/.gitkeep +0 -0
- package/templates/basic/.gitignore.template +0 -30
- package/templates/basic/.lefthook.yml.template +0 -26
- package/templates/basic/package.json.template +0 -46
- package/templates/basic/src/index.ts.template +0 -26
- package/templates/basic/tsconfig.json.template +0 -34
- package/templates/cli/.gitignore.template +0 -4
- package/templates/cli/.lefthook.yml.template +0 -26
- package/templates/cli/README.md.template +0 -35
- package/templates/cli/biome.json.template +0 -4
- package/templates/cli/package.json.template +0 -53
- package/templates/cli/src/cli.ts.template +0 -8
- package/templates/cli/src/index.ts.template +0 -7
- package/templates/cli/src/program.ts.template +0 -31
- package/templates/cli/tsconfig.json.template +0 -34
- package/templates/daemon/.gitignore.template +0 -4
- package/templates/daemon/.lefthook.yml.template +0 -26
- package/templates/daemon/README.md.template +0 -67
- package/templates/daemon/biome.json.template +0 -4
- package/templates/daemon/package.json.template +0 -56
- package/templates/daemon/src/cli.ts.template +0 -96
- package/templates/daemon/src/daemon-main.ts.template +0 -79
- package/templates/daemon/src/daemon.ts.template +0 -11
- package/templates/daemon/src/index.ts.template +0 -7
- package/templates/daemon/tsconfig.json.template +0 -23
- package/templates/full-stack/.gitignore.template +0 -30
- package/templates/full-stack/README.md.template +0 -30
- package/templates/full-stack/apps/cli/package.json.template +0 -39
- package/templates/full-stack/apps/cli/src/cli.ts.template +0 -24
- package/templates/full-stack/apps/cli/src/index.test.ts.template +0 -18
- package/templates/full-stack/apps/cli/src/index.ts.template +0 -5
- package/templates/full-stack/apps/cli/tsconfig.json.template +0 -37
- package/templates/full-stack/apps/mcp/package.json.template +0 -40
- package/templates/full-stack/apps/mcp/src/index.test.ts.template +0 -18
- package/templates/full-stack/apps/mcp/src/index.ts.template +0 -6
- package/templates/full-stack/apps/mcp/src/mcp.ts.template +0 -22
- package/templates/full-stack/apps/mcp/src/server.ts.template +0 -10
- package/templates/full-stack/apps/mcp/tsconfig.json.template +0 -37
- package/templates/full-stack/package.json.template +0 -16
- package/templates/full-stack/packages/core/package.json.template +0 -36
- package/templates/full-stack/packages/core/src/handlers.ts.template +0 -31
- package/templates/full-stack/packages/core/src/index.test.ts.template +0 -30
- package/templates/full-stack/packages/core/src/index.ts.template +0 -8
- package/templates/full-stack/packages/core/src/types.ts.template +0 -13
- package/templates/full-stack/packages/core/tsconfig.json.template +0 -34
- package/templates/library/.gitignore.template +0 -30
- package/templates/library/README.md.template +0 -29
- package/templates/library/bunup.config.ts.template +0 -20
- package/templates/library/package.json.template +0 -55
- package/templates/library/src/handlers.ts.template +0 -31
- package/templates/library/src/index.test.ts.template +0 -35
- package/templates/library/src/index.ts.template +0 -8
- package/templates/library/src/types.ts.template +0 -13
- package/templates/library/tsconfig.json.template +0 -34
- package/templates/mcp/.gitignore.template +0 -4
- package/templates/mcp/.lefthook.yml.template +0 -26
- package/templates/mcp/README.md.template +0 -54
- package/templates/mcp/biome.json.template +0 -4
- package/templates/mcp/package.json.template +0 -53
- package/templates/mcp/src/index.ts.template +0 -7
- package/templates/mcp/src/mcp.ts.template +0 -33
- package/templates/mcp/src/server.ts.template +0 -8
- package/templates/mcp/tsconfig.json.template +0 -23
- package/templates/minimal/.gitignore.template +0 -30
- package/templates/minimal/.lefthook.yml.template +0 -26
- package/templates/minimal/package.json.template +0 -53
- package/templates/minimal/src/index.ts.template +0 -26
- package/templates/minimal/tsconfig.json.template +0 -34
- /package/dist/{shared/outfitter-344t1r38.js → commands/docs-types.js} +0 -0
- /package/dist/shared/{outfitter-mdt37hqm.js → outfitter-eepj7rf7.js} +0 -0
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
ScaffoldError
|
|
4
4
|
} from "./outfitter-8y2dfx6n.js";
|
|
5
5
|
|
|
6
|
-
// apps/outfitter/src/engine/
|
|
6
|
+
// apps/outfitter/src/engine/preset.ts
|
|
7
7
|
import {
|
|
8
8
|
existsSync,
|
|
9
9
|
mkdirSync,
|
|
@@ -12,9 +12,9 @@ import {
|
|
|
12
12
|
statSync,
|
|
13
13
|
writeFileSync
|
|
14
14
|
} from "fs";
|
|
15
|
-
import {
|
|
16
|
-
import { fileURLToPath } from "url";
|
|
15
|
+
import { extname, join } from "path";
|
|
17
16
|
import { Result } from "@outfitter/contracts";
|
|
17
|
+
import { getPresetsDir } from "@outfitter/presets";
|
|
18
18
|
var BINARY_EXTENSIONS = new Set([
|
|
19
19
|
".png",
|
|
20
20
|
".jpg",
|
|
@@ -53,33 +53,8 @@ var BINARY_EXTENSIONS = new Set([
|
|
|
53
53
|
".sqlite",
|
|
54
54
|
".sqlite3"
|
|
55
55
|
]);
|
|
56
|
-
function
|
|
57
|
-
|
|
58
|
-
if (!existsSync(packageJsonPath)) {
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
try {
|
|
62
|
-
const content = readFileSync(packageJsonPath, "utf-8");
|
|
63
|
-
const parsed = JSON.parse(content);
|
|
64
|
-
return parsed.name === "outfitter";
|
|
65
|
-
} catch {
|
|
66
|
-
return false;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
function getTemplatesDir() {
|
|
70
|
-
let currentDir = dirname(fileURLToPath(import.meta.url));
|
|
71
|
-
for (let i = 0;i < 10; i++) {
|
|
72
|
-
const templatesPath = join(currentDir, "templates");
|
|
73
|
-
if (existsSync(templatesPath) && hasOutfitterPackage(currentDir)) {
|
|
74
|
-
return templatesPath;
|
|
75
|
-
}
|
|
76
|
-
currentDir = dirname(currentDir);
|
|
77
|
-
}
|
|
78
|
-
const fallback = join(process.cwd(), "apps/outfitter/templates");
|
|
79
|
-
if (existsSync(fallback)) {
|
|
80
|
-
return fallback;
|
|
81
|
-
}
|
|
82
|
-
return join(process.cwd(), "templates");
|
|
56
|
+
function getPresetsBaseDir() {
|
|
57
|
+
return getPresetsDir();
|
|
83
58
|
}
|
|
84
59
|
function getOutputFilename(templateFilename) {
|
|
85
60
|
return templateFilename.endsWith(".template") ? templateFilename.slice(0, -".template".length) : templateFilename;
|
|
@@ -95,7 +70,7 @@ function replacePlaceholders(content, values) {
|
|
|
95
70
|
return match;
|
|
96
71
|
});
|
|
97
72
|
}
|
|
98
|
-
function
|
|
73
|
+
function copyPresetFiles(presetDir, targetDir, values, options, copyOptions) {
|
|
99
74
|
const allowOverwrite = copyOptions?.allowOverwrite ?? false;
|
|
100
75
|
const relativePrefix = copyOptions?.relativePrefix ?? "";
|
|
101
76
|
try {
|
|
@@ -109,9 +84,9 @@ function copyTemplateFiles(templateDir, targetDir, values, options, copyOptions)
|
|
|
109
84
|
mkdirSync(targetDir, { recursive: true });
|
|
110
85
|
}
|
|
111
86
|
}
|
|
112
|
-
const entries = readdirSync(
|
|
87
|
+
const entries = readdirSync(presetDir);
|
|
113
88
|
for (const entry of entries) {
|
|
114
|
-
const sourcePath = join(
|
|
89
|
+
const sourcePath = join(presetDir, entry);
|
|
115
90
|
const sourceStat = statSync(sourcePath);
|
|
116
91
|
const relativePath = relativePrefix ? `${relativePrefix}/${entry}` : entry;
|
|
117
92
|
if (copyOptions?.skipFilter?.(relativePath)) {
|
|
@@ -119,7 +94,7 @@ function copyTemplateFiles(templateDir, targetDir, values, options, copyOptions)
|
|
|
119
94
|
}
|
|
120
95
|
if (sourceStat.isDirectory()) {
|
|
121
96
|
const targetSubDir = join(targetDir, entry);
|
|
122
|
-
const nestedResult =
|
|
97
|
+
const nestedResult = copyPresetFiles(sourcePath, targetSubDir, values, options, {
|
|
123
98
|
...copyOptions,
|
|
124
99
|
relativePrefix: relativePath
|
|
125
100
|
});
|
|
@@ -151,13 +126,13 @@ function copyTemplateFiles(templateDir, targetDir, values, options, copyOptions)
|
|
|
151
126
|
options.collector.add({
|
|
152
127
|
type: "file-overwrite",
|
|
153
128
|
path: targetPath,
|
|
154
|
-
source: "
|
|
129
|
+
source: "preset"
|
|
155
130
|
});
|
|
156
131
|
} else {
|
|
157
132
|
options.collector.add({
|
|
158
133
|
type: "file-create",
|
|
159
134
|
path: targetPath,
|
|
160
|
-
source: "
|
|
135
|
+
source: "preset"
|
|
161
136
|
});
|
|
162
137
|
}
|
|
163
138
|
copyOptions?.writtenPaths?.add(targetPath);
|
|
@@ -177,8 +152,8 @@ function copyTemplateFiles(templateDir, targetDir, values, options, copyOptions)
|
|
|
177
152
|
return Result.ok(undefined);
|
|
178
153
|
} catch (error) {
|
|
179
154
|
const message = error instanceof Error ? error.message : "Unknown error";
|
|
180
|
-
return Result.err(new ScaffoldError(`Failed to copy
|
|
155
|
+
return Result.err(new ScaffoldError(`Failed to copy preset files: ${message}`));
|
|
181
156
|
}
|
|
182
157
|
}
|
|
183
158
|
|
|
184
|
-
export {
|
|
159
|
+
export { getPresetsBaseDir, getOutputFilename, isBinaryFile, replacePlaceholders, copyPresetFiles };
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
actionInternalErr,
|
|
4
|
+
outputModeSchema,
|
|
5
|
+
resolveBooleanFlagAlias,
|
|
6
|
+
resolveInstallTimeoutFlag,
|
|
7
|
+
resolveLocalFlag,
|
|
8
|
+
resolveNoToolingFlag,
|
|
9
|
+
resolveStringFlag
|
|
10
|
+
} from "./outfitter-7n7vsz95.js";
|
|
11
|
+
import {
|
|
12
|
+
runInit
|
|
13
|
+
} from "./outfitter-6mpkh3zn.js";
|
|
14
|
+
import {
|
|
15
|
+
printInitResults
|
|
16
|
+
} from "./outfitter-n0ed012k.js";
|
|
17
|
+
import {
|
|
18
|
+
resolveOutputModeFromContext
|
|
19
|
+
} from "./outfitter-7r12fj7f.js";
|
|
20
|
+
|
|
21
|
+
// apps/outfitter/src/actions/init.ts
|
|
22
|
+
import { actionCliPresets } from "@outfitter/cli/actions";
|
|
23
|
+
import {
|
|
24
|
+
booleanFlagPreset,
|
|
25
|
+
dryRunPreset,
|
|
26
|
+
forcePreset
|
|
27
|
+
} from "@outfitter/cli/flags";
|
|
28
|
+
import {
|
|
29
|
+
defineAction,
|
|
30
|
+
InternalError,
|
|
31
|
+
Result
|
|
32
|
+
} from "@outfitter/contracts";
|
|
33
|
+
import { z } from "zod";
|
|
34
|
+
var initPresetValues = [
|
|
35
|
+
"minimal",
|
|
36
|
+
"cli",
|
|
37
|
+
"mcp",
|
|
38
|
+
"daemon",
|
|
39
|
+
"library",
|
|
40
|
+
"full-stack",
|
|
41
|
+
"lib"
|
|
42
|
+
];
|
|
43
|
+
function normalizeInitPreset(preset) {
|
|
44
|
+
if (preset === undefined) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
return preset === "lib" ? "library" : preset;
|
|
48
|
+
}
|
|
49
|
+
var initInputSchema = z.object({
|
|
50
|
+
targetDir: z.string(),
|
|
51
|
+
name: z.string().optional(),
|
|
52
|
+
bin: z.string().optional(),
|
|
53
|
+
preset: z.enum(initPresetValues).optional(),
|
|
54
|
+
structure: z.enum(["single", "workspace"]).optional(),
|
|
55
|
+
workspaceName: z.string().optional(),
|
|
56
|
+
local: z.boolean().optional(),
|
|
57
|
+
force: z.boolean(),
|
|
58
|
+
with: z.string().optional(),
|
|
59
|
+
noTooling: z.boolean().optional(),
|
|
60
|
+
yes: z.boolean().optional(),
|
|
61
|
+
dryRun: z.boolean().optional(),
|
|
62
|
+
skipInstall: z.boolean().optional(),
|
|
63
|
+
skipGit: z.boolean().optional(),
|
|
64
|
+
skipCommit: z.boolean().optional(),
|
|
65
|
+
installTimeout: z.number().optional(),
|
|
66
|
+
outputMode: outputModeSchema
|
|
67
|
+
});
|
|
68
|
+
var commonInitOptions = [
|
|
69
|
+
{
|
|
70
|
+
flags: "-n, --name <name>",
|
|
71
|
+
description: "Package name (defaults to directory name)"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
flags: "-b, --bin <name>",
|
|
75
|
+
description: "Binary name (defaults to project name)"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
flags: "--local",
|
|
79
|
+
description: "Use workspace:* for @outfitter dependencies"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
flags: "--workspace",
|
|
83
|
+
description: "Alias for --local"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
flags: "--with <blocks>",
|
|
87
|
+
description: "Tooling to add (comma-separated: scaffolding, claude, linter, lefthook, bootstrap)"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
flags: "--no-tooling",
|
|
91
|
+
description: "Skip tooling setup"
|
|
92
|
+
}
|
|
93
|
+
];
|
|
94
|
+
var initSharedFlags = actionCliPresets(forcePreset(), dryRunPreset(), booleanFlagPreset({
|
|
95
|
+
id: "initYes",
|
|
96
|
+
key: "yes",
|
|
97
|
+
flags: "-y, --yes",
|
|
98
|
+
description: "Skip prompts and use defaults for missing values"
|
|
99
|
+
}));
|
|
100
|
+
function resolveInitOptions(context, presetOverride) {
|
|
101
|
+
const flags = context.flags;
|
|
102
|
+
const { force, dryRun, yes } = initSharedFlags.resolve(context);
|
|
103
|
+
const targetDir = context.args[0] ?? process.cwd();
|
|
104
|
+
const name = resolveStringFlag(flags.name);
|
|
105
|
+
const bin = resolveStringFlag(flags.bin);
|
|
106
|
+
const preset = normalizeInitPreset(presetOverride ?? resolveStringFlag(flags.preset));
|
|
107
|
+
const structure = resolveStringFlag(flags.structure);
|
|
108
|
+
const workspaceName = resolveStringFlag(flags.workspaceName);
|
|
109
|
+
const local = resolveLocalFlag(flags);
|
|
110
|
+
const withBlocks = resolveStringFlag(flags.with);
|
|
111
|
+
const noTooling = resolveNoToolingFlag(flags);
|
|
112
|
+
const skipInstall = resolveBooleanFlagAlias(context.flags, "skipInstall", "skip-install");
|
|
113
|
+
const skipGit = resolveBooleanFlagAlias(context.flags, "skipGit", "skip-git");
|
|
114
|
+
const skipCommit = resolveBooleanFlagAlias(context.flags, "skipCommit", "skip-commit");
|
|
115
|
+
const installTimeout = resolveInstallTimeoutFlag(flags.installTimeout);
|
|
116
|
+
const outputMode = resolveOutputModeFromContext(context.flags);
|
|
117
|
+
return {
|
|
118
|
+
targetDir,
|
|
119
|
+
name,
|
|
120
|
+
...preset ? { preset } : {},
|
|
121
|
+
...structure ? { structure } : {},
|
|
122
|
+
...workspaceName ? { workspaceName } : {},
|
|
123
|
+
force,
|
|
124
|
+
...local !== undefined ? { local } : {},
|
|
125
|
+
...withBlocks ? { with: withBlocks } : {},
|
|
126
|
+
...noTooling !== undefined ? { noTooling } : {},
|
|
127
|
+
...bin ? { bin } : {},
|
|
128
|
+
...yes ? { yes } : {},
|
|
129
|
+
...dryRun ? { dryRun } : {},
|
|
130
|
+
...skipInstall ? { skipInstall } : {},
|
|
131
|
+
...skipGit ? { skipGit } : {},
|
|
132
|
+
...skipCommit ? { skipCommit } : {},
|
|
133
|
+
...installTimeout !== undefined ? { installTimeout } : {},
|
|
134
|
+
outputMode
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function createInitAction(options) {
|
|
138
|
+
const presetOption = {
|
|
139
|
+
flags: "-p, --preset <preset>",
|
|
140
|
+
description: "Preset to use (minimal, cli, mcp, daemon, library, full-stack, lib)"
|
|
141
|
+
};
|
|
142
|
+
const initOptions = [...commonInitOptions];
|
|
143
|
+
initOptions.push(...initSharedFlags.options);
|
|
144
|
+
initOptions.push({
|
|
145
|
+
flags: "-s, --structure <mode>",
|
|
146
|
+
description: "Project structure (single|workspace)"
|
|
147
|
+
});
|
|
148
|
+
initOptions.push({
|
|
149
|
+
flags: "--workspace-name <name>",
|
|
150
|
+
description: "Workspace root package name"
|
|
151
|
+
});
|
|
152
|
+
initOptions.push({
|
|
153
|
+
flags: "--skip-install",
|
|
154
|
+
description: "Skip bun install",
|
|
155
|
+
defaultValue: false
|
|
156
|
+
});
|
|
157
|
+
initOptions.push({
|
|
158
|
+
flags: "--skip-git",
|
|
159
|
+
description: "Skip git init and initial commit",
|
|
160
|
+
defaultValue: false
|
|
161
|
+
});
|
|
162
|
+
initOptions.push({
|
|
163
|
+
flags: "--skip-commit",
|
|
164
|
+
description: "Skip initial commit only",
|
|
165
|
+
defaultValue: false
|
|
166
|
+
});
|
|
167
|
+
initOptions.push({
|
|
168
|
+
flags: "--install-timeout <ms>",
|
|
169
|
+
description: "bun install timeout in milliseconds"
|
|
170
|
+
});
|
|
171
|
+
if (options.includePresetOption) {
|
|
172
|
+
initOptions.push(presetOption);
|
|
173
|
+
}
|
|
174
|
+
return defineAction({
|
|
175
|
+
id: options.id,
|
|
176
|
+
description: options.description,
|
|
177
|
+
surfaces: ["cli"],
|
|
178
|
+
input: initInputSchema,
|
|
179
|
+
cli: {
|
|
180
|
+
group: "init",
|
|
181
|
+
command: options.command,
|
|
182
|
+
description: options.description,
|
|
183
|
+
options: initOptions,
|
|
184
|
+
mapInput: (context) => resolveInitOptions(context, options.presetOverride)
|
|
185
|
+
},
|
|
186
|
+
handler: async (input) => {
|
|
187
|
+
const { outputMode, ...initInput } = input;
|
|
188
|
+
const result = await runInit(initInput);
|
|
189
|
+
if (result.isErr()) {
|
|
190
|
+
return actionInternalErr(options.id, result.error);
|
|
191
|
+
}
|
|
192
|
+
await printInitResults(result.value, { mode: outputMode });
|
|
193
|
+
return Result.ok(result.value);
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
var createAction = defineAction({
|
|
198
|
+
id: "create",
|
|
199
|
+
description: "Removed - use 'outfitter init' instead",
|
|
200
|
+
surfaces: ["cli"],
|
|
201
|
+
input: z.object({}).passthrough(),
|
|
202
|
+
cli: {
|
|
203
|
+
command: "create [directory]",
|
|
204
|
+
description: "Removed - use 'outfitter init' instead",
|
|
205
|
+
options: [],
|
|
206
|
+
mapInput: () => ({})
|
|
207
|
+
},
|
|
208
|
+
handler: async () => Result.err(new InternalError({
|
|
209
|
+
message: [
|
|
210
|
+
"The 'create' command has been removed.",
|
|
211
|
+
"",
|
|
212
|
+
"Use 'outfitter init' instead. It supports everything 'create' did:",
|
|
213
|
+
"",
|
|
214
|
+
" Interactive mode: outfitter init my-project",
|
|
215
|
+
" With preset: outfitter init my-project --preset cli",
|
|
216
|
+
" Skip prompts: outfitter init my-project --preset cli --yes",
|
|
217
|
+
" Workspace: outfitter init my-project --preset cli --structure workspace",
|
|
218
|
+
"",
|
|
219
|
+
"See 'outfitter init --help' for full options."
|
|
220
|
+
].join(`
|
|
221
|
+
`),
|
|
222
|
+
context: { action: "create" }
|
|
223
|
+
}))
|
|
224
|
+
});
|
|
225
|
+
var initAction = createInitAction({
|
|
226
|
+
id: "init",
|
|
227
|
+
description: "Create a new Outfitter project",
|
|
228
|
+
command: "[directory]",
|
|
229
|
+
includePresetOption: true
|
|
230
|
+
});
|
|
231
|
+
var initCliAction = createInitAction({
|
|
232
|
+
id: "init.cli",
|
|
233
|
+
description: "Create a new CLI project",
|
|
234
|
+
command: "cli [directory]",
|
|
235
|
+
presetOverride: "cli"
|
|
236
|
+
});
|
|
237
|
+
var initMcpAction = createInitAction({
|
|
238
|
+
id: "init.mcp",
|
|
239
|
+
description: "Create a new MCP server",
|
|
240
|
+
command: "mcp [directory]",
|
|
241
|
+
presetOverride: "mcp"
|
|
242
|
+
});
|
|
243
|
+
var initDaemonAction = createInitAction({
|
|
244
|
+
id: "init.daemon",
|
|
245
|
+
description: "Create a new daemon project",
|
|
246
|
+
command: "daemon [directory]",
|
|
247
|
+
presetOverride: "daemon"
|
|
248
|
+
});
|
|
249
|
+
var initLibraryAction = createInitAction({
|
|
250
|
+
id: "init.library",
|
|
251
|
+
description: "Create a new library project",
|
|
252
|
+
command: "library [directory]",
|
|
253
|
+
presetOverride: "library"
|
|
254
|
+
});
|
|
255
|
+
var initFullStackAction = createInitAction({
|
|
256
|
+
id: "init.full-stack",
|
|
257
|
+
description: "Create a full-stack workspace",
|
|
258
|
+
command: "full-stack [directory]",
|
|
259
|
+
presetOverride: "full-stack"
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
export { createAction, initAction, initCliAction, initMcpAction, initDaemonAction, initLibraryAction, initFullStackAction };
|
|
@@ -103,7 +103,7 @@ function collectWorkspaceManifests(rootDir) {
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
return Result.ok(Array.from(files).
|
|
106
|
+
return Result.ok(Array.from(files).toSorted((a, b) => a.localeCompare(b)));
|
|
107
107
|
}
|
|
108
108
|
function extractOutfitterDeps(manifestPath) {
|
|
109
109
|
let pkg;
|
|
@@ -116,8 +116,8 @@ function extractOutfitterDeps(manifestPath) {
|
|
|
116
116
|
}));
|
|
117
117
|
}
|
|
118
118
|
const deps = {
|
|
119
|
-
...pkg.dependencies
|
|
120
|
-
...pkg.devDependencies
|
|
119
|
+
...pkg.dependencies,
|
|
120
|
+
...pkg.devDependencies
|
|
121
121
|
};
|
|
122
122
|
const packages = [];
|
|
123
123
|
for (const [name, version] of Object.entries(deps)) {
|
|
@@ -198,7 +198,7 @@ function getInstalledPackagesFromWorkspace(rootDir) {
|
|
|
198
198
|
const packages = [];
|
|
199
199
|
const conflicts = [];
|
|
200
200
|
for (const [name, versionMap] of packageVersionMap) {
|
|
201
|
-
const versions = Array.from(versionMap.entries()).map(([version, manifests]) => ({ version, manifests })).
|
|
201
|
+
const versions = Array.from(versionMap.entries()).map(([version, manifests]) => ({ version, manifests })).toSorted((a, b) => {
|
|
202
202
|
try {
|
|
203
203
|
return Bun.semver.order(a.version, b.version);
|
|
204
204
|
} catch {
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// apps/outfitter/src/actions/shared.ts
|
|
3
|
+
import { resolve } from "path";
|
|
4
|
+
import { InternalError, Result } from "@outfitter/contracts";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
var outputModeSchema = z.enum(["human", "json", "jsonl"]).default("human");
|
|
7
|
+
function argvContainsOutputFlag(argv) {
|
|
8
|
+
for (let index = 0;index < argv.length; index++) {
|
|
9
|
+
const arg = argv[index];
|
|
10
|
+
if (!arg) {
|
|
11
|
+
continue;
|
|
12
|
+
}
|
|
13
|
+
if (arg === "-o" || arg === "--output") {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
if (arg.startsWith("--output=") || arg.startsWith("-o=")) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
function hasExplicitOutputFlag(flags, options = {}) {
|
|
23
|
+
const mode = flags["output"];
|
|
24
|
+
if (typeof mode !== "string") {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
const defaultMode = options.defaultMode ?? "human";
|
|
28
|
+
if (mode !== defaultMode) {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
return argvContainsOutputFlag(options.argv ?? process.argv.slice(2));
|
|
32
|
+
}
|
|
33
|
+
function resolveStringFlag(value) {
|
|
34
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
35
|
+
}
|
|
36
|
+
function resolveNoToolingFlag(flags) {
|
|
37
|
+
if (typeof flags.noTooling === "boolean") {
|
|
38
|
+
return !flags.noTooling;
|
|
39
|
+
}
|
|
40
|
+
if (typeof flags.tooling === "boolean") {
|
|
41
|
+
if (!flags.tooling) {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
return process.argv.includes("--tooling") ? false : undefined;
|
|
45
|
+
}
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
function resolveLocalFlag(flags) {
|
|
49
|
+
if (flags.local === true || flags.workspace === true) {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
function resolveInstallTimeoutFlag(value) {
|
|
55
|
+
if (typeof value === "string") {
|
|
56
|
+
return Number.parseInt(value, 10);
|
|
57
|
+
}
|
|
58
|
+
if (typeof value === "number") {
|
|
59
|
+
return value;
|
|
60
|
+
}
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
function resolveCwdFromPreset(flags, cwdPreset) {
|
|
64
|
+
const { cwd: rawCwd } = cwdPreset.resolve(flags);
|
|
65
|
+
return resolve(process.cwd(), rawCwd);
|
|
66
|
+
}
|
|
67
|
+
function resolveOutputModeWithEnvFallback(flags, explicitMode, options = {}) {
|
|
68
|
+
if (hasExplicitOutputFlag(flags)) {
|
|
69
|
+
return explicitMode;
|
|
70
|
+
}
|
|
71
|
+
if (options.forceHumanWhenImplicit) {
|
|
72
|
+
return "human";
|
|
73
|
+
}
|
|
74
|
+
if (process.env["OUTFITTER_JSONL"] === "1") {
|
|
75
|
+
return "jsonl";
|
|
76
|
+
}
|
|
77
|
+
if (process.env["OUTFITTER_JSON"] === "1") {
|
|
78
|
+
return "json";
|
|
79
|
+
}
|
|
80
|
+
return "human";
|
|
81
|
+
}
|
|
82
|
+
function resolveBooleanFlagAlias(flags, key, alias) {
|
|
83
|
+
return Boolean(flags[key] ?? flags[alias]);
|
|
84
|
+
}
|
|
85
|
+
function toActionInternalError(action, error) {
|
|
86
|
+
return new InternalError({
|
|
87
|
+
message: error.message,
|
|
88
|
+
context: { action }
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
function actionInternalErr(action, error) {
|
|
92
|
+
return Result.err(toActionInternalError(action, error));
|
|
93
|
+
}
|
|
94
|
+
function toActionInternalErrorFromUnknown(action, error, fallbackMessage) {
|
|
95
|
+
return new InternalError({
|
|
96
|
+
message: error instanceof Error ? error.message : fallbackMessage,
|
|
97
|
+
context: { action }
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export { outputModeSchema, hasExplicitOutputFlag, resolveStringFlag, resolveNoToolingFlag, resolveLocalFlag, resolveInstallTimeoutFlag, resolveCwdFromPreset, resolveOutputModeWithEnvFallback, resolveBooleanFlagAlias, toActionInternalError, actionInternalErr, toActionInternalErrorFromUnknown };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// apps/outfitter/src/commands/upgrade-report.ts
|
|
3
|
+
import { mkdirSync, writeFileSync } from "fs";
|
|
4
|
+
import { join } from "path";
|
|
5
|
+
function writeUpgradeReport(cwd, result, meta) {
|
|
6
|
+
const reportsDir = join(cwd, ".outfitter", "reports");
|
|
7
|
+
mkdirSync(reportsDir, { recursive: true });
|
|
8
|
+
const finishedAtIso = new Date().toISOString();
|
|
9
|
+
const errorContext = meta.error !== undefined && "context" in meta.error && meta.error.context !== undefined && typeof meta.error.context === "object" ? meta.error.context : undefined;
|
|
10
|
+
const report = {
|
|
11
|
+
$schema: "https://outfitter.dev/reports/upgrade/v1",
|
|
12
|
+
status: meta.status,
|
|
13
|
+
checkedAt: finishedAtIso,
|
|
14
|
+
startedAt: meta.startedAt.toISOString(),
|
|
15
|
+
finishedAt: finishedAtIso,
|
|
16
|
+
cwd,
|
|
17
|
+
workspaceRoot: meta.workspaceRoot,
|
|
18
|
+
flags: {
|
|
19
|
+
dryRun: meta.options.dryRun === true,
|
|
20
|
+
yes: meta.options.yes === true,
|
|
21
|
+
interactive: meta.options.interactive !== false,
|
|
22
|
+
all: meta.options.all === true,
|
|
23
|
+
noCodemods: meta.options.noCodemods === true,
|
|
24
|
+
outputMode: meta.options.outputMode ?? null
|
|
25
|
+
},
|
|
26
|
+
applied: result.applied,
|
|
27
|
+
summary: {
|
|
28
|
+
total: result.total,
|
|
29
|
+
available: result.updatesAvailable,
|
|
30
|
+
breaking: result.packages.filter((p) => p.breaking).length,
|
|
31
|
+
applied: result.appliedPackages.length
|
|
32
|
+
},
|
|
33
|
+
packages: result.packages,
|
|
34
|
+
excluded: {
|
|
35
|
+
breaking: result.skippedBreaking
|
|
36
|
+
},
|
|
37
|
+
...result.unknownPackages !== undefined && result.unknownPackages.length > 0 ? { unknownPackages: result.unknownPackages } : {},
|
|
38
|
+
...result.conflicts !== undefined && result.conflicts.length > 0 ? { conflicts: result.conflicts } : {},
|
|
39
|
+
...result.codemods !== undefined ? { codemods: result.codemods } : {},
|
|
40
|
+
...meta.error !== undefined ? {
|
|
41
|
+
error: {
|
|
42
|
+
message: meta.error.message,
|
|
43
|
+
category: meta.error.category,
|
|
44
|
+
...errorContext !== undefined ? { context: errorContext } : {}
|
|
45
|
+
}
|
|
46
|
+
} : {}
|
|
47
|
+
};
|
|
48
|
+
writeFileSync(join(reportsDir, "upgrade.json"), JSON.stringify(report, null, 2));
|
|
49
|
+
}
|
|
50
|
+
function writeUpgradeReportSafely(cwd, result, meta) {
|
|
51
|
+
try {
|
|
52
|
+
writeUpgradeReport(cwd, result, meta);
|
|
53
|
+
} catch (error) {
|
|
54
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
55
|
+
process.stderr.write(`[outfitter upgrade] Failed to write report: ${reason}
|
|
56
|
+
`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export { writeUpgradeReportSafely };
|