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,232 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
loadDocsModule
|
|
4
|
+
} from "./outfitter-svts4wk2.js";
|
|
5
|
+
|
|
6
|
+
// apps/outfitter/src/commands/repo.ts
|
|
7
|
+
import { existsSync } from "fs";
|
|
8
|
+
import { createRequire } from "module";
|
|
9
|
+
import { dirname, join, resolve } from "path";
|
|
10
|
+
import {
|
|
11
|
+
booleanFlagPreset,
|
|
12
|
+
composePresets,
|
|
13
|
+
cwdPreset,
|
|
14
|
+
stringListFlagPreset
|
|
15
|
+
} from "@outfitter/cli/flags";
|
|
16
|
+
import { Command } from "commander";
|
|
17
|
+
var require2 = createRequire(import.meta.url);
|
|
18
|
+
var DOCS_COMMON_OPTION_FLAGS = [
|
|
19
|
+
"--cwd <path>",
|
|
20
|
+
"--packages-dir <path>",
|
|
21
|
+
"--output-dir <path>",
|
|
22
|
+
"--mdx-mode <mode>"
|
|
23
|
+
];
|
|
24
|
+
var DOCS_EXPORT_OPTION_FLAGS = [
|
|
25
|
+
"--llms-file <path>",
|
|
26
|
+
"--llms-full-file <path>",
|
|
27
|
+
"--target <target>"
|
|
28
|
+
];
|
|
29
|
+
function withDocsCommonOptions(command) {
|
|
30
|
+
return command.option(DOCS_COMMON_OPTION_FLAGS[0], "Workspace root to operate in").option(DOCS_COMMON_OPTION_FLAGS[1], "Packages directory relative to workspace").option(DOCS_COMMON_OPTION_FLAGS[2], "Output directory relative to workspace").option(DOCS_COMMON_OPTION_FLAGS[3], "MDX handling mode: strict or lossy");
|
|
31
|
+
}
|
|
32
|
+
function withDocsExportOptions(command) {
|
|
33
|
+
return withDocsCommonOptions(command).option(DOCS_EXPORT_OPTION_FLAGS[0], "llms.txt output path relative to workspace").option(DOCS_EXPORT_OPTION_FLAGS[1], "llms-full.txt output path relative to workspace").option(DOCS_EXPORT_OPTION_FLAGS[2], "Export target: packages, llms, llms-full, all", "all");
|
|
34
|
+
}
|
|
35
|
+
function resolveDocsCliOptions(options) {
|
|
36
|
+
if (typeof options.cwd !== "string" || options.cwd.length === 0) {
|
|
37
|
+
return options;
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
...options,
|
|
41
|
+
cwd: resolve(process.cwd(), options.cwd)
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function getIo(options) {
|
|
45
|
+
return {
|
|
46
|
+
out: options?.io?.out ?? ((line) => process.stdout.write(`${line}
|
|
47
|
+
`)),
|
|
48
|
+
err: options?.io?.err ?? ((line) => process.stderr.write(`${line}
|
|
49
|
+
`))
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function resolveToolingCliEntrypoint() {
|
|
53
|
+
const packageJsonPath = require2.resolve("@outfitter/tooling/package.json");
|
|
54
|
+
const packageRoot = dirname(packageJsonPath);
|
|
55
|
+
const srcEntrypoint = join(packageRoot, "src", "cli", "index.ts");
|
|
56
|
+
if (existsSync(srcEntrypoint)) {
|
|
57
|
+
return srcEntrypoint;
|
|
58
|
+
}
|
|
59
|
+
const distEntrypoint = join(packageRoot, "dist", "cli", "index.js");
|
|
60
|
+
if (existsSync(distEntrypoint)) {
|
|
61
|
+
return distEntrypoint;
|
|
62
|
+
}
|
|
63
|
+
throw new Error("Unable to resolve @outfitter/tooling CLI entrypoint (expected dist/cli/index.js or src/cli/index.ts).");
|
|
64
|
+
}
|
|
65
|
+
async function runDocsCheckDefault(options, io) {
|
|
66
|
+
const docsModule = await loadDocsModule();
|
|
67
|
+
return await docsModule.executeCheckCommand(options, io);
|
|
68
|
+
}
|
|
69
|
+
async function runDocsSyncDefault(options, io) {
|
|
70
|
+
const docsModule = await loadDocsModule();
|
|
71
|
+
return await docsModule.executeSyncCommand(options, io);
|
|
72
|
+
}
|
|
73
|
+
async function runDocsExportDefault(options, io) {
|
|
74
|
+
const docsModule = await loadDocsModule();
|
|
75
|
+
return await docsModule.executeExportCommand(options, io);
|
|
76
|
+
}
|
|
77
|
+
async function runToolingCommandDefault(input) {
|
|
78
|
+
const toolingCliEntrypoint = resolveToolingCliEntrypoint();
|
|
79
|
+
const child = Bun.spawn([process.execPath, toolingCliEntrypoint, input.command, ...input.args], {
|
|
80
|
+
cwd: input.cwd,
|
|
81
|
+
stdin: "inherit",
|
|
82
|
+
stdout: "inherit",
|
|
83
|
+
stderr: "inherit"
|
|
84
|
+
});
|
|
85
|
+
return await child.exited;
|
|
86
|
+
}
|
|
87
|
+
function applyExitCode(code) {
|
|
88
|
+
if (code !== 0) {
|
|
89
|
+
process.exitCode = code;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function applyPresetOptions(command, preset) {
|
|
93
|
+
for (const option of preset.options) {
|
|
94
|
+
command.option(option.flags, option.description, option.defaultValue);
|
|
95
|
+
}
|
|
96
|
+
return command;
|
|
97
|
+
}
|
|
98
|
+
function addDocsCheckSubcommand(command, options) {
|
|
99
|
+
const docsCheckCommand = command.command("docs").description("Check whether assembled package docs are in sync");
|
|
100
|
+
withDocsCommonOptions(docsCheckCommand).action(async (cmdOptions) => {
|
|
101
|
+
const code = await options.runDocsCheck(resolveDocsCliOptions(cmdOptions), options.io);
|
|
102
|
+
applyExitCode(code);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
function addDocsSyncSubcommand(command, options) {
|
|
106
|
+
const docsSyncCommand = command.command("docs").description("Assemble package docs mirrors locally");
|
|
107
|
+
withDocsCommonOptions(docsSyncCommand).action(async (cmdOptions) => {
|
|
108
|
+
const code = await options.runDocsSync(resolveDocsCliOptions(cmdOptions), options.io);
|
|
109
|
+
applyExitCode(code);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
function addDocsExportSubcommand(command, options) {
|
|
113
|
+
const docsExportCommand = command.command("docs").description("Export docs artifacts for packages and LLM targets");
|
|
114
|
+
withDocsExportOptions(docsExportCommand).action(async (cmdOptions) => {
|
|
115
|
+
const code = await options.runDocsExport(resolveDocsCliOptions(cmdOptions), options.io);
|
|
116
|
+
applyExitCode(code);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
function addToolingCheckSubcommands(command, runToolingCommand) {
|
|
120
|
+
const cwdFlag = cwdPreset();
|
|
121
|
+
const jsonFlag = booleanFlagPreset({
|
|
122
|
+
id: "repo-check-json",
|
|
123
|
+
key: "json",
|
|
124
|
+
flags: "--json",
|
|
125
|
+
description: "Output results as JSON"
|
|
126
|
+
});
|
|
127
|
+
const skipFlag = booleanFlagPreset({
|
|
128
|
+
id: "repo-check-skip",
|
|
129
|
+
key: "skip",
|
|
130
|
+
flags: "-s, --skip",
|
|
131
|
+
description: "Skip changeset check"
|
|
132
|
+
});
|
|
133
|
+
const pathsFlag = stringListFlagPreset({
|
|
134
|
+
id: "repo-check-paths",
|
|
135
|
+
key: "paths",
|
|
136
|
+
flags: "--paths <paths...>",
|
|
137
|
+
description: "Limit check to specific paths"
|
|
138
|
+
});
|
|
139
|
+
const toolingWithCwd = composePresets(cwdFlag);
|
|
140
|
+
const toolingWithJsonAndCwd = composePresets(jsonFlag, cwdFlag);
|
|
141
|
+
const toolingWithSkipAndCwd = composePresets(skipFlag, cwdFlag);
|
|
142
|
+
const toolingWithPathsAndCwd = composePresets(pathsFlag, cwdFlag);
|
|
143
|
+
function registerToolingCheckSubcommand(config) {
|
|
144
|
+
const subcommand = command.command(config.name).description(config.description);
|
|
145
|
+
applyPresetOptions(subcommand, config.preset);
|
|
146
|
+
subcommand.action(async (cmdOptions) => {
|
|
147
|
+
const resolved = config.preset.resolve(cmdOptions);
|
|
148
|
+
const cwd = resolveDocsCliOptions({ cwd: resolved.cwd }).cwd || process.cwd();
|
|
149
|
+
const code = await runToolingCommand({
|
|
150
|
+
command: config.toolingCommand,
|
|
151
|
+
args: config.buildArgs(resolved),
|
|
152
|
+
cwd
|
|
153
|
+
});
|
|
154
|
+
applyExitCode(code);
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
registerToolingCheckSubcommand({
|
|
158
|
+
name: "exports",
|
|
159
|
+
description: "Validate package.json exports match source entry points",
|
|
160
|
+
toolingCommand: "check-exports",
|
|
161
|
+
preset: toolingWithJsonAndCwd,
|
|
162
|
+
buildArgs: (resolved) => resolved["json"] ? ["--json"] : []
|
|
163
|
+
});
|
|
164
|
+
registerToolingCheckSubcommand({
|
|
165
|
+
name: "readme",
|
|
166
|
+
description: "Validate README import examples match package exports",
|
|
167
|
+
toolingCommand: "check-readme-imports",
|
|
168
|
+
preset: toolingWithJsonAndCwd,
|
|
169
|
+
buildArgs: (resolved) => resolved["json"] ? ["--json"] : []
|
|
170
|
+
});
|
|
171
|
+
registerToolingCheckSubcommand({
|
|
172
|
+
name: "registry",
|
|
173
|
+
description: "Validate packages with bunup --filter are registered in bunup.config.ts",
|
|
174
|
+
toolingCommand: "check-bunup-registry",
|
|
175
|
+
preset: toolingWithCwd,
|
|
176
|
+
buildArgs: () => []
|
|
177
|
+
});
|
|
178
|
+
registerToolingCheckSubcommand({
|
|
179
|
+
name: "changeset",
|
|
180
|
+
description: "Validate PRs touching package source include a changeset",
|
|
181
|
+
toolingCommand: "check-changeset",
|
|
182
|
+
preset: toolingWithSkipAndCwd,
|
|
183
|
+
buildArgs: (resolved) => resolved["skip"] ? ["--skip"] : []
|
|
184
|
+
});
|
|
185
|
+
registerToolingCheckSubcommand({
|
|
186
|
+
name: "tree",
|
|
187
|
+
description: "Assert working tree is clean (no modified or untracked files)",
|
|
188
|
+
toolingCommand: "check-clean-tree",
|
|
189
|
+
preset: toolingWithPathsAndCwd,
|
|
190
|
+
buildArgs: (resolved) => Array.isArray(resolved["paths"]) && resolved["paths"].length > 0 ? ["--paths", ...resolved["paths"]] : []
|
|
191
|
+
});
|
|
192
|
+
registerToolingCheckSubcommand({
|
|
193
|
+
name: "boundary-invocations",
|
|
194
|
+
description: "Validate root/app scripts do not execute packages/*/src entrypoints directly",
|
|
195
|
+
toolingCommand: "check-boundary-invocations",
|
|
196
|
+
preset: toolingWithCwd,
|
|
197
|
+
buildArgs: () => []
|
|
198
|
+
});
|
|
199
|
+
registerToolingCheckSubcommand({
|
|
200
|
+
name: "markdown-links",
|
|
201
|
+
description: "Validate relative links in markdown files resolve to existing files",
|
|
202
|
+
toolingCommand: "check-markdown-links",
|
|
203
|
+
preset: toolingWithCwd,
|
|
204
|
+
buildArgs: () => []
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
function createRepoCommand(options) {
|
|
208
|
+
const io = getIo(options);
|
|
209
|
+
const runDocsCheck = options?.runDocsCheck ?? runDocsCheckDefault;
|
|
210
|
+
const runDocsSync = options?.runDocsSync ?? runDocsSyncDefault;
|
|
211
|
+
const runDocsExport = options?.runDocsExport ?? runDocsExportDefault;
|
|
212
|
+
const runToolingCommand = options?.runToolingCommand ?? runToolingCommandDefault;
|
|
213
|
+
const command = new Command(options?.commandName ?? "repo");
|
|
214
|
+
command.description("Repository maintenance commands");
|
|
215
|
+
const checkCommand = command.command("check").description("Run repository checks by subject");
|
|
216
|
+
addDocsCheckSubcommand(checkCommand, { io, runDocsCheck });
|
|
217
|
+
addToolingCheckSubcommands(checkCommand, runToolingCommand);
|
|
218
|
+
const syncCommand = command.command("sync").description("Synchronize repository artifacts by subject");
|
|
219
|
+
addDocsSyncSubcommand(syncCommand, { io, runDocsSync });
|
|
220
|
+
const exportCommand = command.command("export").description("Export repository artifacts by subject");
|
|
221
|
+
addDocsExportSubcommand(exportCommand, { io, runDocsExport });
|
|
222
|
+
return command;
|
|
223
|
+
}
|
|
224
|
+
async function main() {
|
|
225
|
+
const command = createRepoCommand({ commandName: "repo" });
|
|
226
|
+
await command.parseAsync(process.argv, { from: "node" });
|
|
227
|
+
}
|
|
228
|
+
if (import.meta.main) {
|
|
229
|
+
main();
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export { DOCS_COMMON_OPTION_FLAGS, DOCS_EXPORT_OPTION_FLAGS, createRepoCommand };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// apps/outfitter/src/actions/docs-output-mode.ts
|
|
3
|
+
function resolveDocsOutputMode(flags, presetOutputMode) {
|
|
4
|
+
const explicitOutput = typeof flags["output"] === "string";
|
|
5
|
+
if (explicitOutput) {
|
|
6
|
+
return presetOutputMode === "json" || presetOutputMode === "jsonl" ? presetOutputMode : "human";
|
|
7
|
+
}
|
|
8
|
+
if (process.env["OUTFITTER_JSONL"] === "1") {
|
|
9
|
+
return "jsonl";
|
|
10
|
+
}
|
|
11
|
+
if (process.env["OUTFITTER_JSON"] === "1") {
|
|
12
|
+
return "json";
|
|
13
|
+
}
|
|
14
|
+
return "human";
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { resolveDocsOutputMode };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// apps/outfitter/src/create/presets.ts
|
|
3
|
+
var CREATE_PRESETS = {
|
|
4
|
+
basic: {
|
|
5
|
+
id: "basic",
|
|
6
|
+
presetDir: "basic",
|
|
7
|
+
summary: "Minimal Bun + TypeScript project.",
|
|
8
|
+
defaultBlocks: ["scaffolding"]
|
|
9
|
+
},
|
|
10
|
+
cli: {
|
|
11
|
+
id: "cli",
|
|
12
|
+
presetDir: "cli",
|
|
13
|
+
summary: "CLI starter with Outfitter command ergonomics.",
|
|
14
|
+
defaultBlocks: ["scaffolding"]
|
|
15
|
+
},
|
|
16
|
+
daemon: {
|
|
17
|
+
id: "daemon",
|
|
18
|
+
presetDir: "daemon",
|
|
19
|
+
summary: "Daemon + control CLI starter.",
|
|
20
|
+
defaultBlocks: ["scaffolding"]
|
|
21
|
+
},
|
|
22
|
+
mcp: {
|
|
23
|
+
id: "mcp",
|
|
24
|
+
presetDir: "mcp",
|
|
25
|
+
summary: "MCP server starter.",
|
|
26
|
+
defaultBlocks: ["scaffolding"]
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var CREATE_PRESET_IDS = Object.keys(CREATE_PRESETS);
|
|
30
|
+
function getCreatePreset(id) {
|
|
31
|
+
const presets = CREATE_PRESETS;
|
|
32
|
+
return presets[id];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { CREATE_PRESETS, CREATE_PRESET_IDS, getCreatePreset };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
outputModeSchema,
|
|
4
|
+
resolveCwdFromPreset
|
|
5
|
+
} from "./outfitter-7n7vsz95.js";
|
|
6
|
+
import {
|
|
7
|
+
printDoctorResults,
|
|
8
|
+
runDoctor
|
|
9
|
+
} from "./outfitter-px5sv5gn.js";
|
|
10
|
+
import {
|
|
11
|
+
resolveOutputModeFromContext
|
|
12
|
+
} from "./outfitter-7r12fj7f.js";
|
|
13
|
+
|
|
14
|
+
// apps/outfitter/src/actions/doctor.ts
|
|
15
|
+
import { cwdPreset } from "@outfitter/cli/flags";
|
|
16
|
+
import { defineAction, Result } from "@outfitter/contracts";
|
|
17
|
+
import { z } from "zod";
|
|
18
|
+
var doctorInputSchema = z.object({
|
|
19
|
+
cwd: z.string(),
|
|
20
|
+
outputMode: outputModeSchema
|
|
21
|
+
});
|
|
22
|
+
var doctorCwd = cwdPreset();
|
|
23
|
+
var doctorAction = defineAction({
|
|
24
|
+
id: "doctor",
|
|
25
|
+
description: "Validate environment and dependencies",
|
|
26
|
+
surfaces: ["cli"],
|
|
27
|
+
input: doctorInputSchema,
|
|
28
|
+
cli: {
|
|
29
|
+
command: "doctor",
|
|
30
|
+
description: "Validate environment and dependencies",
|
|
31
|
+
options: [...doctorCwd.options],
|
|
32
|
+
mapInput: (context) => {
|
|
33
|
+
const outputMode = resolveOutputModeFromContext(context.flags);
|
|
34
|
+
return {
|
|
35
|
+
cwd: resolveCwdFromPreset(context.flags, doctorCwd),
|
|
36
|
+
outputMode
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
handler: async (input) => {
|
|
41
|
+
const { outputMode, ...doctorInput } = input;
|
|
42
|
+
const result = await runDoctor(doctorInput);
|
|
43
|
+
await printDoctorResults(result, { mode: outputMode });
|
|
44
|
+
if (result.exitCode !== 0) {
|
|
45
|
+
process.exit(result.exitCode);
|
|
46
|
+
}
|
|
47
|
+
return Result.ok(result);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
export { doctorAction };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// apps/outfitter/src/commands/upgrade-apply.ts
|
|
3
|
+
import { readFileSync } from "fs";
|
|
4
|
+
import { join } from "path";
|
|
5
|
+
import { InternalError, Result } from "@outfitter/contracts";
|
|
6
|
+
function getVersionPrefix(specifier) {
|
|
7
|
+
if (specifier.startsWith("workspace:")) {
|
|
8
|
+
const inner = specifier.slice("workspace:".length);
|
|
9
|
+
return `workspace:${getVersionPrefix(inner)}`;
|
|
10
|
+
}
|
|
11
|
+
const match = specifier.match(/^([\^~>=<]+)/);
|
|
12
|
+
return match?.[1] ?? "";
|
|
13
|
+
}
|
|
14
|
+
async function applyUpdates(cwd, updates) {
|
|
15
|
+
const pkgPath = join(cwd, "package.json");
|
|
16
|
+
let raw;
|
|
17
|
+
try {
|
|
18
|
+
raw = readFileSync(pkgPath, "utf-8");
|
|
19
|
+
} catch {
|
|
20
|
+
return Result.err(InternalError.create("Failed to read package.json for apply", { cwd }));
|
|
21
|
+
}
|
|
22
|
+
let pkg;
|
|
23
|
+
try {
|
|
24
|
+
pkg = JSON.parse(raw);
|
|
25
|
+
} catch {
|
|
26
|
+
return Result.err(InternalError.create("Invalid JSON in package.json", { cwd }));
|
|
27
|
+
}
|
|
28
|
+
const updateMap = new Map;
|
|
29
|
+
for (const update of updates) {
|
|
30
|
+
updateMap.set(update.name, update.latestVersion);
|
|
31
|
+
}
|
|
32
|
+
for (const section of ["dependencies", "devDependencies"]) {
|
|
33
|
+
const deps = pkg[section];
|
|
34
|
+
if (!deps)
|
|
35
|
+
continue;
|
|
36
|
+
for (const name of Object.keys(deps)) {
|
|
37
|
+
const newVersion = updateMap.get(name);
|
|
38
|
+
if (newVersion === undefined)
|
|
39
|
+
continue;
|
|
40
|
+
const currentSpecifier = deps[name];
|
|
41
|
+
if (currentSpecifier === undefined)
|
|
42
|
+
continue;
|
|
43
|
+
const prefix = getVersionPrefix(currentSpecifier);
|
|
44
|
+
deps[name] = `${prefix}${newVersion}`;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
const updated = `${JSON.stringify(pkg, null, 2)}
|
|
49
|
+
`;
|
|
50
|
+
await Bun.write(pkgPath, updated);
|
|
51
|
+
} catch {
|
|
52
|
+
return Result.err(InternalError.create("Failed to write updated package.json", { cwd }));
|
|
53
|
+
}
|
|
54
|
+
try {
|
|
55
|
+
const proc = Bun.spawn(["bun", "install"], {
|
|
56
|
+
cwd,
|
|
57
|
+
stdout: "pipe",
|
|
58
|
+
stderr: "pipe"
|
|
59
|
+
});
|
|
60
|
+
const exitCode = await proc.exited;
|
|
61
|
+
if (exitCode !== 0) {
|
|
62
|
+
const stderr = await new Response(proc.stderr).text();
|
|
63
|
+
return Result.err(InternalError.create("bun install failed", {
|
|
64
|
+
cwd,
|
|
65
|
+
exitCode,
|
|
66
|
+
stderr: stderr.trim()
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
} catch {
|
|
70
|
+
return Result.err(InternalError.create("Failed to run bun install", { cwd }));
|
|
71
|
+
}
|
|
72
|
+
return Result.ok(undefined);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export { applyUpdates };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { copyPresetFiles, replacePlaceholders } from "./outfitter-6rtcemk7.js";
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Use `getPresetsBaseDir` instead.
|
|
4
|
+
*/
|
|
5
|
+
declare function getTemplatesDir(): string;
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Use `copyPresetFiles` instead.
|
|
8
|
+
*/
|
|
9
|
+
declare function copyTemplateFiles(...args: Parameters<typeof copyPresetFiles>): ReturnType<typeof copyPresetFiles>;
|
|
10
|
+
declare function getOutputFilename(templateFilename: string): string;
|
|
11
|
+
declare function isBinaryFile(filename: string): boolean;
|
|
12
|
+
declare function replacePlaceholders2(content: string, values: Parameters<typeof replacePlaceholders>[1]): string;
|
|
13
|
+
export { getTemplatesDir, copyTemplateFiles, getOutputFilename, isBinaryFile, replacePlaceholders2 as replacePlaceholders };
|
|
@@ -0,0 +1,165 @@
|
|
|
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/check-docs-sentinel.ts
|
|
10
|
+
import { readFile } from "fs/promises";
|
|
11
|
+
import { join, resolve } from "path";
|
|
12
|
+
import { Result } from "@outfitter/contracts";
|
|
13
|
+
var SECTION_ID = "PACKAGE_LIST";
|
|
14
|
+
var BEGIN_TAG = `<!-- BEGIN:GENERATED:${SECTION_ID} -->`;
|
|
15
|
+
var END_TAG = `<!-- END:GENERATED:${SECTION_ID} -->`;
|
|
16
|
+
function escapeRegExpLiteral(value) {
|
|
17
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
18
|
+
}
|
|
19
|
+
function replaceSentinelSectionFallback(input, sentinelId, replacement) {
|
|
20
|
+
const beginTag = `<!-- BEGIN:GENERATED:${sentinelId} -->`;
|
|
21
|
+
const endTag = `<!-- END:GENERATED:${sentinelId} -->`;
|
|
22
|
+
const pattern = new RegExp(`${escapeRegExpLiteral(beginTag)}[\\s\\S]*?${escapeRegExpLiteral(endTag)}`);
|
|
23
|
+
if (!pattern.test(input)) {
|
|
24
|
+
return input;
|
|
25
|
+
}
|
|
26
|
+
return input.replace(pattern, `${beginTag}
|
|
27
|
+
${replacement}
|
|
28
|
+
${endTag}`);
|
|
29
|
+
}
|
|
30
|
+
function extractSentinelBodies(input, sentinelId) {
|
|
31
|
+
const beginTag = `<!-- BEGIN:GENERATED:${sentinelId} -->`;
|
|
32
|
+
const endTag = `<!-- END:GENERATED:${sentinelId} -->`;
|
|
33
|
+
const pattern = new RegExp(`${escapeRegExpLiteral(beginTag)}[\\s\\n\\r]*([\\s\\S]*?)[\\s\\n\\r]*${escapeRegExpLiteral(endTag)}`, "g");
|
|
34
|
+
const bodies = [];
|
|
35
|
+
for (const match of input.matchAll(pattern)) {
|
|
36
|
+
const body = match[1];
|
|
37
|
+
if (typeof body === "string") {
|
|
38
|
+
bodies.push(body);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return bodies;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
class CheckDocsSentinelError extends Error {
|
|
45
|
+
_tag = "CheckDocsSentinelError";
|
|
46
|
+
constructor(message) {
|
|
47
|
+
super(message);
|
|
48
|
+
this.name = "CheckDocsSentinelError";
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function checkDocsReadmeSentinelContent(readmeContent, packageListContent, replaceSentinelSection = replaceSentinelSectionFallback) {
|
|
52
|
+
if (!(readmeContent.includes(BEGIN_TAG) && readmeContent.includes(END_TAG))) {
|
|
53
|
+
return { reason: "missing-markers", updatedContent: readmeContent };
|
|
54
|
+
}
|
|
55
|
+
const currentBodies = extractSentinelBodies(readmeContent, SECTION_ID);
|
|
56
|
+
const expectedBody = packageListContent.trim();
|
|
57
|
+
if (currentBodies.length > 0 && currentBodies.every((body) => body.trim() === expectedBody)) {
|
|
58
|
+
return { reason: "up-to-date", updatedContent: readmeContent };
|
|
59
|
+
}
|
|
60
|
+
const updatedContent = replaceSentinelSection(readmeContent, SECTION_ID, packageListContent);
|
|
61
|
+
if (updatedContent !== readmeContent) {
|
|
62
|
+
return { reason: "out-of-date", updatedContent };
|
|
63
|
+
}
|
|
64
|
+
return { reason: "up-to-date", updatedContent };
|
|
65
|
+
}
|
|
66
|
+
async function runCheckDocsSentinel(options) {
|
|
67
|
+
try {
|
|
68
|
+
const workspaceRoot = resolve(options.cwd);
|
|
69
|
+
const readmePath = join(workspaceRoot, "docs", "README.md");
|
|
70
|
+
const docsModule = await loadDocsModule();
|
|
71
|
+
const [readmeContent, packageListContent] = await Promise.all([
|
|
72
|
+
readFile(readmePath, "utf8"),
|
|
73
|
+
docsModule.generatePackageListSection(workspaceRoot)
|
|
74
|
+
]);
|
|
75
|
+
const result = checkDocsReadmeSentinelContent(readmeContent, packageListContent, docsModule.replaceSentinelSection);
|
|
76
|
+
return Result.ok({
|
|
77
|
+
readmePath,
|
|
78
|
+
reason: result.reason,
|
|
79
|
+
updatedContent: result.updatedContent,
|
|
80
|
+
ok: result.reason === "up-to-date"
|
|
81
|
+
});
|
|
82
|
+
} catch (error) {
|
|
83
|
+
const message = error instanceof Error ? error.message : "Failed to check docs README sentinel";
|
|
84
|
+
return Result.err(new CheckDocsSentinelError(message));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
async function printCheckDocsSentinelResult(result, options) {
|
|
88
|
+
const structuredMode = resolveStructuredOutputMode(options?.mode);
|
|
89
|
+
if (structuredMode) {
|
|
90
|
+
const serialized = structuredMode === "json" ? JSON.stringify(result, null, 2) : JSON.stringify(result);
|
|
91
|
+
process.stdout.write(`${serialized}
|
|
92
|
+
`);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (result.reason === "up-to-date") {
|
|
96
|
+
process.stdout.write(`docs/README.md PACKAGE_LIST sentinel is up to date.
|
|
97
|
+
`);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
if (result.reason === "missing-markers") {
|
|
101
|
+
process.stderr.write(`docs/README.md is missing PACKAGE_LIST sentinel markers.
|
|
102
|
+
Run 'bun run docs:sync:readme' to regenerate sentinel sections.
|
|
103
|
+
`);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
process.stderr.write(`docs/README.md PACKAGE_LIST sentinel is stale.
|
|
107
|
+
Run 'bun run docs:sync:readme' to regenerate sentinel sections.
|
|
108
|
+
`);
|
|
109
|
+
}
|
|
110
|
+
function parseCliArgs(argv) {
|
|
111
|
+
let cwd = process.cwd();
|
|
112
|
+
let outputMode = "human";
|
|
113
|
+
for (let index = 0;index < argv.length; index++) {
|
|
114
|
+
const arg = argv[index];
|
|
115
|
+
if (arg === "--cwd") {
|
|
116
|
+
const value = argv[index + 1];
|
|
117
|
+
if (!value) {
|
|
118
|
+
throw new CheckDocsSentinelError("Missing value for --cwd");
|
|
119
|
+
}
|
|
120
|
+
cwd = value;
|
|
121
|
+
index += 1;
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
if (arg === "--json") {
|
|
125
|
+
outputMode = "json";
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
if (arg === "--jsonl") {
|
|
129
|
+
outputMode = "jsonl";
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
cwd: resolve(cwd),
|
|
135
|
+
outputMode
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
async function runCheckDocsSentinelFromArgv(argv) {
|
|
139
|
+
let parsed;
|
|
140
|
+
try {
|
|
141
|
+
parsed = parseCliArgs(argv);
|
|
142
|
+
} catch (error) {
|
|
143
|
+
const message = error instanceof Error ? error.message : "Invalid command arguments";
|
|
144
|
+
process.stderr.write(`${message}
|
|
145
|
+
`);
|
|
146
|
+
return 1;
|
|
147
|
+
}
|
|
148
|
+
const result = await runCheckDocsSentinel({ cwd: parsed.cwd });
|
|
149
|
+
if (result.isErr()) {
|
|
150
|
+
process.stderr.write(`${result.error.message}
|
|
151
|
+
`);
|
|
152
|
+
return 1;
|
|
153
|
+
}
|
|
154
|
+
await printCheckDocsSentinelResult(result.value, {
|
|
155
|
+
mode: parsed.outputMode
|
|
156
|
+
});
|
|
157
|
+
return result.value.ok ? 0 : 1;
|
|
158
|
+
}
|
|
159
|
+
if (import.meta.main) {
|
|
160
|
+
runCheckDocsSentinelFromArgv(process.argv.slice(2)).then((exitCode) => {
|
|
161
|
+
process.exit(exitCode);
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export { CheckDocsSentinelError, checkDocsReadmeSentinelContent, runCheckDocsSentinel, printCheckDocsSentinelResult, runCheckDocsSentinelFromArgv };
|