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
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
resolveStructuredOutputMode
|
|
4
|
+
} from "./outfitter-7r12fj7f.js";
|
|
5
|
+
|
|
6
|
+
// apps/outfitter/src/commands/check-preset-versions.ts
|
|
7
|
+
import { existsSync, readFileSync } from "fs";
|
|
8
|
+
import { join, resolve } from "path";
|
|
9
|
+
import { Result } from "@outfitter/contracts";
|
|
10
|
+
import { getResolvedVersions } from "@outfitter/presets";
|
|
11
|
+
import { isTypesBunVersionCompatible } from "@outfitter/tooling";
|
|
12
|
+
var DEPENDENCY_SECTIONS = [
|
|
13
|
+
"dependencies",
|
|
14
|
+
"devDependencies",
|
|
15
|
+
"peerDependencies",
|
|
16
|
+
"optionalDependencies"
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
class CheckPresetVersionsError extends Error {
|
|
20
|
+
_tag = "CheckPresetVersionsError";
|
|
21
|
+
constructor(message) {
|
|
22
|
+
super(message);
|
|
23
|
+
this.name = "CheckPresetVersionsError";
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function isRecord(value) {
|
|
27
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
28
|
+
}
|
|
29
|
+
function normalizeVersionRange(version) {
|
|
30
|
+
const trimmed = version.trim();
|
|
31
|
+
const semverMatch = trimmed.match(/\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?/);
|
|
32
|
+
if (semverMatch) {
|
|
33
|
+
return semverMatch[0];
|
|
34
|
+
}
|
|
35
|
+
return trimmed.replace(/^[\^~>=<]+/, "");
|
|
36
|
+
}
|
|
37
|
+
function validatePresetDeps(workspaceRoot, resolvedVersions, problems) {
|
|
38
|
+
const templateRoots = ["templates", "packages/presets/presets"];
|
|
39
|
+
const glob = new Bun.Glob("**/package.json.template");
|
|
40
|
+
for (const rootPath of templateRoots) {
|
|
41
|
+
const absoluteRoot = join(workspaceRoot, rootPath);
|
|
42
|
+
if (!existsSync(absoluteRoot)) {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
for (const relativePath of glob.scanSync({
|
|
46
|
+
cwd: absoluteRoot,
|
|
47
|
+
absolute: false
|
|
48
|
+
})) {
|
|
49
|
+
const templatePath = join(rootPath, relativePath);
|
|
50
|
+
const absoluteTemplatePath = join(absoluteRoot, relativePath);
|
|
51
|
+
const parsed = JSON.parse(readFileSync(absoluteTemplatePath, "utf-8"));
|
|
52
|
+
if (!isRecord(parsed)) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
for (const section of DEPENDENCY_SECTIONS) {
|
|
56
|
+
const deps = parsed[section];
|
|
57
|
+
if (!isRecord(deps)) {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
for (const [name, value] of Object.entries(deps)) {
|
|
61
|
+
if (typeof value !== "string") {
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
if (name.startsWith("@outfitter/")) {
|
|
65
|
+
if (value !== "workspace:*") {
|
|
66
|
+
problems.push(`${templatePath}: ${name} must use workspace:* (found ${value})`);
|
|
67
|
+
}
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
if (name.includes("{{") || value.startsWith("workspace:")) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
const expected = resolvedVersions[name];
|
|
74
|
+
if (!expected) {
|
|
75
|
+
problems.push(`${templatePath}: external dependency "${name}" is not declared in @outfitter/presets`);
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
if (normalizeVersionRange(value) !== normalizeVersionRange(expected)) {
|
|
79
|
+
problems.push(`${templatePath}: ${name} expected ${expected} (found ${value})`);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function validateRegistryVersions(workspaceRoot, resolvedVersions, problems) {
|
|
87
|
+
const registryPath = "packages/tooling/registry/registry.json";
|
|
88
|
+
const absoluteRegistryPath = join(workspaceRoot, registryPath);
|
|
89
|
+
let registry;
|
|
90
|
+
try {
|
|
91
|
+
registry = JSON.parse(readFileSync(absoluteRegistryPath, "utf-8"));
|
|
92
|
+
} catch {
|
|
93
|
+
problems.push(`Registry not found or unreadable: ${registryPath}`);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
if (!isRecord(registry)) {
|
|
97
|
+
problems.push(`Registry has invalid shape (expected object): ${registryPath}`);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
if (!isRecord(registry["blocks"])) {
|
|
101
|
+
problems.push(`Registry has invalid shape (missing object "blocks" field): ${registryPath}`);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
for (const [blockName, block] of Object.entries(registry["blocks"])) {
|
|
105
|
+
if (!isRecord(block)) {
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
const devDeps = block["devDependencies"];
|
|
109
|
+
if (!isRecord(devDeps)) {
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
for (const [name, value] of Object.entries(devDeps)) {
|
|
113
|
+
if (typeof value !== "string") {
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
if (name.startsWith("@outfitter/")) {
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
const expected = resolvedVersions[name];
|
|
120
|
+
if (expected && normalizeVersionRange(value) !== normalizeVersionRange(expected)) {
|
|
121
|
+
problems.push(`registry block "${blockName}": ${name} expected ${expected} (found ${value})`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
function readDependencyVersion(packageJson, section, name) {
|
|
127
|
+
const container = packageJson[section];
|
|
128
|
+
if (!isRecord(container)) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
const value = container[name];
|
|
132
|
+
return typeof value === "string" ? value : undefined;
|
|
133
|
+
}
|
|
134
|
+
function validateBunVersionConsistency(workspaceRoot, problems) {
|
|
135
|
+
const bunVersionPath = join(workspaceRoot, ".bun-version");
|
|
136
|
+
const bunVersionFile = readFileSync(bunVersionPath, "utf-8").trim();
|
|
137
|
+
const rootPackagePath = join(workspaceRoot, "package.json");
|
|
138
|
+
const parsedRootPackage = JSON.parse(readFileSync(rootPackagePath, "utf-8"));
|
|
139
|
+
if (!isRecord(parsedRootPackage)) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
const engines = parsedRootPackage["engines"];
|
|
143
|
+
if (isRecord(engines) && typeof engines["bun"] === "string") {
|
|
144
|
+
const engineBun = normalizeVersionRange(engines["bun"]);
|
|
145
|
+
if (engineBun !== bunVersionFile) {
|
|
146
|
+
problems.push(`Bun version drift: .bun-version is ${bunVersionFile} but engines.bun is ${engines["bun"]}`);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
const packageManager = parsedRootPackage["packageManager"];
|
|
150
|
+
if (typeof packageManager === "string" && packageManager.startsWith("bun@")) {
|
|
151
|
+
const packageManagerVersion = normalizeVersionRange(packageManager);
|
|
152
|
+
if (packageManagerVersion !== bunVersionFile) {
|
|
153
|
+
problems.push(`Bun version drift: .bun-version is ${bunVersionFile} but packageManager is ${packageManager}`);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
let bunTypesVersion;
|
|
157
|
+
const catalog = parsedRootPackage["catalog"];
|
|
158
|
+
if (isRecord(catalog) && typeof catalog["@types/bun"] === "string") {
|
|
159
|
+
bunTypesVersion = catalog["@types/bun"];
|
|
160
|
+
}
|
|
161
|
+
if (!bunTypesVersion) {
|
|
162
|
+
bunTypesVersion = readDependencyVersion(parsedRootPackage, "devDependencies", "@types/bun") ?? undefined;
|
|
163
|
+
}
|
|
164
|
+
if (bunTypesVersion) {
|
|
165
|
+
const normalizedTypesVersion = normalizeVersionRange(bunTypesVersion);
|
|
166
|
+
if (!isTypesBunVersionCompatible(bunVersionFile, normalizedTypesVersion)) {
|
|
167
|
+
problems.push(`Bun version drift: .bun-version is ${bunVersionFile} but @types/bun is ${bunTypesVersion}`);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
const docsToValidate = [
|
|
171
|
+
"README.md",
|
|
172
|
+
"apps/outfitter/README.md",
|
|
173
|
+
"docs/getting-started.md"
|
|
174
|
+
];
|
|
175
|
+
for (const docPath of docsToValidate) {
|
|
176
|
+
const absoluteDocPath = join(workspaceRoot, docPath);
|
|
177
|
+
if (!existsSync(absoluteDocPath)) {
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
const content = readFileSync(absoluteDocPath, "utf-8");
|
|
181
|
+
const match = content.match(/\bbun\b\s*(?:>=|>|=)\s*([\d.]+)/i);
|
|
182
|
+
if (match && match[1] !== bunVersionFile) {
|
|
183
|
+
problems.push(`Bun version drift: ${docPath} references Bun ${match[1]} but .bun-version is ${bunVersionFile}`);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
function validateNoStaleFallbacks(workspaceRoot, problems) {
|
|
188
|
+
const filesToCheck = [
|
|
189
|
+
"apps/outfitter/src/commands/shared-deps.ts",
|
|
190
|
+
"packages/tooling/src/registry/build.ts"
|
|
191
|
+
];
|
|
192
|
+
const fallbackPattern = /(?:\?\?|\|\|)\s*["']\^?[\d]+\.[\d]+\.[\d]+["']/;
|
|
193
|
+
for (const filePath of filesToCheck) {
|
|
194
|
+
const absoluteFilePath = join(workspaceRoot, filePath);
|
|
195
|
+
if (!existsSync(absoluteFilePath)) {
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
const content = readFileSync(absoluteFilePath, "utf-8");
|
|
199
|
+
for (const [index, line] of content.split(`
|
|
200
|
+
`).entries()) {
|
|
201
|
+
if (fallbackPattern.test(line)) {
|
|
202
|
+
problems.push(`stale fallback: ${filePath}:${index + 1} contains hardcoded version fallback`);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
async function runCheckPresetVersions(options) {
|
|
208
|
+
try {
|
|
209
|
+
const workspaceRoot = resolve(options.cwd);
|
|
210
|
+
const { all: resolvedVersions } = getResolvedVersions();
|
|
211
|
+
const problems = [];
|
|
212
|
+
validatePresetDeps(workspaceRoot, resolvedVersions, problems);
|
|
213
|
+
validateRegistryVersions(workspaceRoot, resolvedVersions, problems);
|
|
214
|
+
validateBunVersionConsistency(workspaceRoot, problems);
|
|
215
|
+
validateNoStaleFallbacks(workspaceRoot, problems);
|
|
216
|
+
return Result.ok({
|
|
217
|
+
workspaceRoot,
|
|
218
|
+
problems,
|
|
219
|
+
ok: problems.length === 0
|
|
220
|
+
});
|
|
221
|
+
} catch (error) {
|
|
222
|
+
const message = error instanceof Error ? error.message : "Failed to check preset versions";
|
|
223
|
+
return Result.err(new CheckPresetVersionsError(message));
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
async function printCheckPresetVersionsResult(result, options) {
|
|
227
|
+
const structuredMode = resolveStructuredOutputMode(options?.mode);
|
|
228
|
+
if (structuredMode) {
|
|
229
|
+
const serialized = structuredMode === "json" ? JSON.stringify(result, null, 2) : JSON.stringify(result);
|
|
230
|
+
process.stdout.write(`${serialized}
|
|
231
|
+
`);
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
if (result.ok) {
|
|
235
|
+
process.stdout.write(`All version checks passed.
|
|
236
|
+
`);
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
process.stderr.write(`Version drift detected (${result.problems.length} issue(s)):
|
|
240
|
+
`);
|
|
241
|
+
for (const problem of result.problems) {
|
|
242
|
+
process.stderr.write(`- ${problem}
|
|
243
|
+
`);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
function parseCliArgs(argv) {
|
|
247
|
+
let cwd = process.cwd();
|
|
248
|
+
let outputMode = "human";
|
|
249
|
+
for (let index = 0;index < argv.length; index++) {
|
|
250
|
+
const arg = argv[index];
|
|
251
|
+
if (arg === "--cwd") {
|
|
252
|
+
const value = argv[index + 1];
|
|
253
|
+
if (!value) {
|
|
254
|
+
throw new CheckPresetVersionsError("Missing value for --cwd");
|
|
255
|
+
}
|
|
256
|
+
cwd = value;
|
|
257
|
+
index += 1;
|
|
258
|
+
continue;
|
|
259
|
+
}
|
|
260
|
+
if (arg === "--json") {
|
|
261
|
+
outputMode = "json";
|
|
262
|
+
continue;
|
|
263
|
+
}
|
|
264
|
+
if (arg === "--jsonl") {
|
|
265
|
+
outputMode = "jsonl";
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return {
|
|
270
|
+
cwd: resolve(cwd),
|
|
271
|
+
outputMode
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
async function runCheckPresetVersionsFromArgv(argv) {
|
|
275
|
+
let parsed;
|
|
276
|
+
try {
|
|
277
|
+
parsed = parseCliArgs(argv);
|
|
278
|
+
} catch (error) {
|
|
279
|
+
const message = error instanceof Error ? error.message : "Invalid command arguments";
|
|
280
|
+
process.stderr.write(`${message}
|
|
281
|
+
`);
|
|
282
|
+
return 1;
|
|
283
|
+
}
|
|
284
|
+
const result = await runCheckPresetVersions({ cwd: parsed.cwd });
|
|
285
|
+
if (result.isErr()) {
|
|
286
|
+
process.stderr.write(`${result.error.message}
|
|
287
|
+
`);
|
|
288
|
+
return 1;
|
|
289
|
+
}
|
|
290
|
+
await printCheckPresetVersionsResult(result.value, {
|
|
291
|
+
mode: parsed.outputMode
|
|
292
|
+
});
|
|
293
|
+
return result.value.ok ? 0 : 1;
|
|
294
|
+
}
|
|
295
|
+
if (import.meta.main) {
|
|
296
|
+
runCheckPresetVersionsFromArgv(process.argv.slice(2)).then((exitCode) => {
|
|
297
|
+
process.exit(exitCode);
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export { CheckPresetVersionsError, runCheckPresetVersions, printCheckPresetVersionsResult, runCheckPresetVersionsFromArgv };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EngineOptions, ScaffoldError, ScaffoldPlan, ScaffoldResult } from "./outfitter-
|
|
1
|
+
import { EngineOptions, ScaffoldError, ScaffoldPlan, ScaffoldResult } from "./outfitter-cyvr4r8d.js";
|
|
2
2
|
import { Result } from "@outfitter/contracts";
|
|
3
3
|
declare function executePlan(plan: ScaffoldPlan, options: EngineOptions): Promise<Result<ScaffoldResult, ScaffoldError>>;
|
|
4
4
|
export { executePlan };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
loadDocsModule
|
|
4
|
+
} from "./outfitter-svts4wk2.js";
|
|
5
|
+
import {
|
|
6
|
+
resolveStructuredOutputMode
|
|
7
|
+
} from "./outfitter-7r12fj7f.js";
|
|
8
|
+
|
|
9
|
+
// apps/outfitter/src/commands/docs-export.ts
|
|
10
|
+
import { resolve } from "path";
|
|
11
|
+
import { output } from "@outfitter/cli";
|
|
12
|
+
import { InternalError, Result } from "@outfitter/contracts";
|
|
13
|
+
async function runDocsExport(input, dependencies) {
|
|
14
|
+
try {
|
|
15
|
+
const loadDocs = dependencies?.loadDocsModule ?? loadDocsModule;
|
|
16
|
+
const cwd = resolve(input.cwd);
|
|
17
|
+
const docsModule = await loadDocs();
|
|
18
|
+
const messages = [];
|
|
19
|
+
const warnings = [];
|
|
20
|
+
const exitCode = await docsModule.executeExportCommand({
|
|
21
|
+
cwd,
|
|
22
|
+
target: input.target
|
|
23
|
+
}, {
|
|
24
|
+
out: (line) => messages.push(line),
|
|
25
|
+
err: (line) => warnings.push(line)
|
|
26
|
+
});
|
|
27
|
+
if (exitCode !== 0) {
|
|
28
|
+
return Result.err(new InternalError({
|
|
29
|
+
message: warnings.join(`
|
|
30
|
+
`) || "Export failed",
|
|
31
|
+
context: { action: "docs.export", target: input.target }
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
return Result.ok({
|
|
35
|
+
target: input.target,
|
|
36
|
+
messages,
|
|
37
|
+
warnings,
|
|
38
|
+
exitCode
|
|
39
|
+
});
|
|
40
|
+
} catch (error) {
|
|
41
|
+
return Result.err(new InternalError({
|
|
42
|
+
message: error instanceof Error ? error.message : "Failed to export docs",
|
|
43
|
+
context: { action: "docs.export" }
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async function printDocsExportResults(result, options) {
|
|
48
|
+
const structuredMode = resolveStructuredOutputMode(options?.mode);
|
|
49
|
+
if (structuredMode) {
|
|
50
|
+
await output(result, { mode: structuredMode });
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const lines = [];
|
|
54
|
+
if (result.messages.length > 0) {
|
|
55
|
+
for (const msg of result.messages) {
|
|
56
|
+
lines.push(msg);
|
|
57
|
+
}
|
|
58
|
+
} else {
|
|
59
|
+
lines.push("Export completed.");
|
|
60
|
+
}
|
|
61
|
+
if (result.warnings.length > 0) {
|
|
62
|
+
lines.push("");
|
|
63
|
+
lines.push("Warnings:");
|
|
64
|
+
for (const warning of result.warnings) {
|
|
65
|
+
lines.push(` ${warning}`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
await output(lines, { mode: "human" });
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export { runDocsExport, printDocsExportResults };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EngineOptions, ScaffoldError } from "./outfitter-
|
|
1
|
+
import { EngineOptions, ScaffoldError } from "./outfitter-cyvr4r8d.js";
|
|
2
2
|
import { Result } from "@outfitter/contracts";
|
|
3
3
|
import { AddBlockResult } from "@outfitter/tooling";
|
|
4
4
|
declare function addBlocks(targetDir: string, blocks: readonly string[], options: EngineOptions): Promise<Result<AddBlockResult, ScaffoldError>>;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
resolveStructuredOutputMode
|
|
4
|
+
} from "./outfitter-7r12fj7f.js";
|
|
5
|
+
|
|
6
|
+
// apps/outfitter/src/commands/check-surface-map.ts
|
|
7
|
+
import { resolve } from "path";
|
|
8
|
+
import { Result } from "@outfitter/contracts";
|
|
9
|
+
var LEGACY_SURFACE_MAP_PATH = "apps/outfitter/.outfitter/surface.json";
|
|
10
|
+
var CANONICAL_SURFACE_MAP_PATH = ".outfitter/surface.json";
|
|
11
|
+
|
|
12
|
+
class CheckSurfaceMapError extends Error {
|
|
13
|
+
_tag = "CheckSurfaceMapError";
|
|
14
|
+
constructor(message) {
|
|
15
|
+
super(message);
|
|
16
|
+
this.name = "CheckSurfaceMapError";
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function isLegacySurfaceMapTracked(cwd) {
|
|
20
|
+
const check = Bun.spawnSync(["git", "ls-files", "--error-unmatch", LEGACY_SURFACE_MAP_PATH], {
|
|
21
|
+
cwd,
|
|
22
|
+
stdout: "ignore",
|
|
23
|
+
stderr: "ignore"
|
|
24
|
+
});
|
|
25
|
+
return check.exitCode === 0;
|
|
26
|
+
}
|
|
27
|
+
async function runCheckSurfaceMap(options) {
|
|
28
|
+
try {
|
|
29
|
+
const cwd = resolve(options.cwd);
|
|
30
|
+
const tracked = isLegacySurfaceMapTracked(cwd);
|
|
31
|
+
return Result.ok({
|
|
32
|
+
canonicalPath: CANONICAL_SURFACE_MAP_PATH,
|
|
33
|
+
legacyTrackedPath: LEGACY_SURFACE_MAP_PATH,
|
|
34
|
+
ok: !tracked
|
|
35
|
+
});
|
|
36
|
+
} catch (error) {
|
|
37
|
+
const message = error instanceof Error ? error.message : "Failed to check canonical surface map path";
|
|
38
|
+
return Result.err(new CheckSurfaceMapError(message));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
async function printCheckSurfaceMapResult(result, options) {
|
|
42
|
+
const structuredMode = resolveStructuredOutputMode(options?.mode);
|
|
43
|
+
if (structuredMode) {
|
|
44
|
+
const serialized = structuredMode === "json" ? JSON.stringify(result, null, 2) : JSON.stringify(result);
|
|
45
|
+
process.stdout.write(`${serialized}
|
|
46
|
+
`);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (result.ok) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
process.stderr.write(`${result.legacyTrackedPath} must not be tracked. Canonical surface map is ${result.canonicalPath}.
|
|
53
|
+
`);
|
|
54
|
+
}
|
|
55
|
+
function parseCliArgs(argv) {
|
|
56
|
+
let cwd = process.cwd();
|
|
57
|
+
let outputMode = "human";
|
|
58
|
+
for (let index = 0;index < argv.length; index++) {
|
|
59
|
+
const arg = argv[index];
|
|
60
|
+
if (arg === "--cwd") {
|
|
61
|
+
const value = argv[index + 1];
|
|
62
|
+
if (!value) {
|
|
63
|
+
throw new CheckSurfaceMapError("Missing value for --cwd");
|
|
64
|
+
}
|
|
65
|
+
cwd = value;
|
|
66
|
+
index += 1;
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
if (arg === "--json") {
|
|
70
|
+
outputMode = "json";
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
if (arg === "--jsonl") {
|
|
74
|
+
outputMode = "jsonl";
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
cwd: resolve(cwd),
|
|
80
|
+
outputMode
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
async function runCheckSurfaceMapFromArgv(argv) {
|
|
84
|
+
let parsed;
|
|
85
|
+
try {
|
|
86
|
+
parsed = parseCliArgs(argv);
|
|
87
|
+
} catch (error) {
|
|
88
|
+
const message = error instanceof Error ? error.message : "Invalid command arguments";
|
|
89
|
+
process.stderr.write(`${message}
|
|
90
|
+
`);
|
|
91
|
+
return 1;
|
|
92
|
+
}
|
|
93
|
+
const result = await runCheckSurfaceMap({ cwd: parsed.cwd });
|
|
94
|
+
if (result.isErr()) {
|
|
95
|
+
process.stderr.write(`${result.error.message}
|
|
96
|
+
`);
|
|
97
|
+
return 1;
|
|
98
|
+
}
|
|
99
|
+
await printCheckSurfaceMapResult(result.value, {
|
|
100
|
+
mode: parsed.outputMode
|
|
101
|
+
});
|
|
102
|
+
return result.value.ok ? 0 : 1;
|
|
103
|
+
}
|
|
104
|
+
if (import.meta.main) {
|
|
105
|
+
runCheckSurfaceMapFromArgv(process.argv.slice(2)).then((exitCode) => {
|
|
106
|
+
process.exit(exitCode);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export { CheckSurfaceMapError, runCheckSurfaceMap, printCheckSurfaceMapResult, runCheckSurfaceMapFromArgv };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
applyJq
|
|
4
|
+
} from "./outfitter-5vx1bp7h.js";
|
|
5
|
+
import {
|
|
6
|
+
loadDocsModule
|
|
7
|
+
} from "./outfitter-svts4wk2.js";
|
|
8
|
+
import {
|
|
9
|
+
resolveStructuredOutputMode
|
|
10
|
+
} from "./outfitter-7r12fj7f.js";
|
|
11
|
+
|
|
12
|
+
// apps/outfitter/src/commands/docs-show.ts
|
|
13
|
+
import { readFile } from "fs/promises";
|
|
14
|
+
import { resolve } from "path";
|
|
15
|
+
import { output } from "@outfitter/cli";
|
|
16
|
+
import { InternalError, NotFoundError, Result } from "@outfitter/contracts";
|
|
17
|
+
async function runDocsShow(input) {
|
|
18
|
+
try {
|
|
19
|
+
const cwd = resolve(input.cwd);
|
|
20
|
+
const docsModule = await loadDocsModule();
|
|
21
|
+
const mapResult = await docsModule.generateDocsMap({ workspaceRoot: cwd });
|
|
22
|
+
if (mapResult.isErr()) {
|
|
23
|
+
return Result.err(new InternalError({
|
|
24
|
+
message: mapResult.error.message,
|
|
25
|
+
context: { action: "docs.show" }
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
const rawMap = mapResult.value;
|
|
29
|
+
const entry = rawMap.entries.find((e) => e.id === input.id);
|
|
30
|
+
if (!entry) {
|
|
31
|
+
return Result.err(NotFoundError.create("doc", input.id, {
|
|
32
|
+
action: "docs.show",
|
|
33
|
+
availableIds: rawMap.entries.map((e) => e.id).slice(0, 10)
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
const sourcePath = resolve(cwd, entry.sourcePath);
|
|
37
|
+
const content = await readFile(sourcePath, "utf8");
|
|
38
|
+
return Result.ok({
|
|
39
|
+
entry: {
|
|
40
|
+
id: entry.id,
|
|
41
|
+
kind: entry.kind,
|
|
42
|
+
title: entry.title,
|
|
43
|
+
sourcePath: entry.sourcePath,
|
|
44
|
+
outputPath: entry.outputPath,
|
|
45
|
+
...entry.package !== undefined ? { package: entry.package } : {},
|
|
46
|
+
tags: entry.tags
|
|
47
|
+
},
|
|
48
|
+
content
|
|
49
|
+
});
|
|
50
|
+
} catch (error) {
|
|
51
|
+
return Result.err(new InternalError({
|
|
52
|
+
message: error instanceof Error ? error.message : "Failed to show doc",
|
|
53
|
+
context: { action: "docs.show" }
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
async function printDocsShowResults(result, options) {
|
|
58
|
+
const structuredMode = resolveStructuredOutputMode(options?.mode);
|
|
59
|
+
if (structuredMode) {
|
|
60
|
+
if (options?.jq) {
|
|
61
|
+
const filtered = await applyJq(result, options.jq, {
|
|
62
|
+
compact: structuredMode === "jsonl"
|
|
63
|
+
});
|
|
64
|
+
process.stdout.write(filtered);
|
|
65
|
+
} else {
|
|
66
|
+
await output(result, { mode: structuredMode });
|
|
67
|
+
}
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const lines = [];
|
|
71
|
+
lines.push("");
|
|
72
|
+
lines.push(result.entry.title);
|
|
73
|
+
lines.push("=".repeat(60));
|
|
74
|
+
lines.push("");
|
|
75
|
+
lines.push(` ID: ${result.entry.id}`);
|
|
76
|
+
lines.push(` Kind: ${result.entry.kind}`);
|
|
77
|
+
lines.push(` Source: ${result.entry.sourcePath}`);
|
|
78
|
+
lines.push(` Output: ${result.entry.outputPath}`);
|
|
79
|
+
if (result.entry.package) {
|
|
80
|
+
lines.push(` Package: ${result.entry.package}`);
|
|
81
|
+
}
|
|
82
|
+
if (result.entry.tags.length > 0) {
|
|
83
|
+
lines.push(` Tags: ${result.entry.tags.join(", ")}`);
|
|
84
|
+
}
|
|
85
|
+
lines.push("");
|
|
86
|
+
lines.push("-".repeat(60));
|
|
87
|
+
lines.push("");
|
|
88
|
+
lines.push(result.content);
|
|
89
|
+
await output(lines, { mode: "human" });
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export { runDocsShow, printDocsShowResults };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
runCheckTsdoc
|
|
4
|
+
} from "./outfitter-507ra35w.js";
|
|
5
|
+
import {
|
|
6
|
+
applyJq
|
|
7
|
+
} from "./outfitter-5vx1bp7h.js";
|
|
8
|
+
import {
|
|
9
|
+
resolveStructuredOutputMode
|
|
10
|
+
} from "./outfitter-7r12fj7f.js";
|
|
11
|
+
|
|
12
|
+
// apps/outfitter/src/commands/docs-api.ts
|
|
13
|
+
import { relative } from "path";
|
|
14
|
+
import { output } from "@outfitter/cli";
|
|
15
|
+
import { InternalError, Result, ValidationError } from "@outfitter/contracts";
|
|
16
|
+
import { createTheme } from "@outfitter/tui/render";
|
|
17
|
+
async function runDocsApi(input, dependencies) {
|
|
18
|
+
const runCheck = dependencies?.runCheckTsdoc ?? runCheckTsdoc;
|
|
19
|
+
const result = await runCheck({
|
|
20
|
+
cwd: input.cwd,
|
|
21
|
+
emitOutput: false,
|
|
22
|
+
jq: input.jq,
|
|
23
|
+
level: input.level,
|
|
24
|
+
minCoverage: 0,
|
|
25
|
+
outputMode: input.outputMode,
|
|
26
|
+
packages: input.packages,
|
|
27
|
+
strict: false,
|
|
28
|
+
summary: false
|
|
29
|
+
});
|
|
30
|
+
if (result.isErr()) {
|
|
31
|
+
if (result.error instanceof ValidationError) {
|
|
32
|
+
return Result.err(result.error);
|
|
33
|
+
}
|
|
34
|
+
if (result.error instanceof InternalError) {
|
|
35
|
+
return Result.err(result.error);
|
|
36
|
+
}
|
|
37
|
+
return Result.err(new InternalError({
|
|
38
|
+
message: result.error.message,
|
|
39
|
+
context: { action: "docs.api" }
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
return Result.ok(result.value);
|
|
43
|
+
}
|
|
44
|
+
async function printDocsApiResults(result, options) {
|
|
45
|
+
const structuredMode = resolveStructuredOutputMode(options?.mode);
|
|
46
|
+
if (structuredMode) {
|
|
47
|
+
if (options?.jq) {
|
|
48
|
+
const filtered = await applyJq(result, options.jq, {
|
|
49
|
+
compact: structuredMode === "jsonl"
|
|
50
|
+
});
|
|
51
|
+
process.stdout.write(filtered);
|
|
52
|
+
} else {
|
|
53
|
+
await output(result, { mode: structuredMode });
|
|
54
|
+
}
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const theme = createTheme();
|
|
58
|
+
const lines = [];
|
|
59
|
+
const totalDeclarations = result.summary.total;
|
|
60
|
+
if (totalDeclarations === 0) {
|
|
61
|
+
lines.push(theme.muted("No API declarations found."));
|
|
62
|
+
await output(lines, { mode: "human" });
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
lines.push("");
|
|
66
|
+
lines.push(`API Reference (${totalDeclarations} declarations)`);
|
|
67
|
+
lines.push("=".repeat(60));
|
|
68
|
+
const sortedPackages = [...result.packages].toSorted((a, b) => a.name.localeCompare(b.name));
|
|
69
|
+
for (const pkg of sortedPackages) {
|
|
70
|
+
if (pkg.declarations.length === 0) {
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
lines.push("");
|
|
74
|
+
lines.push(`${pkg.name} ${theme.muted(`(${pkg.percentage}% documented)`)}`);
|
|
75
|
+
lines.push("-".repeat(40));
|
|
76
|
+
for (const decl of pkg.declarations) {
|
|
77
|
+
let levelTag;
|
|
78
|
+
if (decl.level === "documented") {
|
|
79
|
+
levelTag = theme.success("[doc]");
|
|
80
|
+
} else if (decl.level === "partial") {
|
|
81
|
+
levelTag = theme.warning("[partial]");
|
|
82
|
+
} else {
|
|
83
|
+
levelTag = theme.error("[none]");
|
|
84
|
+
}
|
|
85
|
+
const location = theme.muted(`${relative(pkg.path, decl.file)}:${decl.line}`);
|
|
86
|
+
lines.push(` ${levelTag} ${decl.kind} ${decl.name} ${location}`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
lines.push("");
|
|
90
|
+
await output(lines, { mode: "human" });
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export { runDocsApi, printDocsApiResults };
|
|
@@ -16,9 +16,10 @@ interface PlaceholderValues {
|
|
|
16
16
|
* A single change operation in a scaffold plan.
|
|
17
17
|
*/
|
|
18
18
|
type ScaffoldChange = {
|
|
19
|
-
readonly type: "copy-
|
|
20
|
-
readonly
|
|
19
|
+
readonly type: "copy-preset";
|
|
20
|
+
readonly preset: string;
|
|
21
21
|
readonly targetDir: string;
|
|
22
|
+
readonly includeTooling: boolean;
|
|
22
23
|
readonly overlayBaseTemplate: boolean;
|
|
23
24
|
} | {
|
|
24
25
|
readonly type: "inject-shared-config";
|