@forge-ts/cli 0.6.0 → 0.6.2

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/dist/index.d.ts CHANGED
@@ -65,9 +65,13 @@ interface OutputFlags {
65
65
  /**
66
66
  * Wraps a command result in a LAFS envelope and emits it.
67
67
  *
68
- * - JSON mode: writes the projected envelope to stdout as JSON.
69
- * - Human mode: calls the provided formatter function.
70
- * - Quiet mode: suppresses all output regardless of format.
68
+ * Output format is determined by LAFS flag resolution:
69
+ * - TTY terminals default to human-readable output.
70
+ * - Non-TTY (piped, CI, agents) defaults to JSON.
71
+ * - Explicit `--json` or `--human` flags always take precedence.
72
+ *
73
+ * On failure, the full result is included alongside the error so agents
74
+ * get actionable data (e.g., suggestedFix) in a single response.
71
75
  *
72
76
  * @param output - Typed result from the command.
73
77
  * @param flags - Output format flags from citty args.
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/index.ts
4
+ import { createRequire } from "module";
4
5
  import { defineCommand as defineCommand6, runMain } from "citty";
5
6
 
6
7
  // src/commands/build.ts
7
- import { join } from "path";
8
8
  import { generateApi } from "@forge-ts/api";
9
9
  import { loadConfig } from "@forge-ts/core";
10
10
  import { generate } from "@forge-ts/gen";
@@ -52,7 +52,6 @@ function createLogger(options) {
52
52
  import { randomUUID } from "crypto";
53
53
  import {
54
54
  createEnvelope,
55
- projectEnvelope,
56
55
  resolveFlags
57
56
  } from "@cleocode/lafs-protocol";
58
57
  function emitResult(output, flags, humanFormatter) {
@@ -60,7 +59,10 @@ function emitResult(output, flags, humanFormatter) {
60
59
  json: flags.json,
61
60
  human: flags.human,
62
61
  quiet: flags.quiet,
63
- mvi: flags.mvi
62
+ mvi: flags.mvi,
63
+ // LAFS 1.8.0: TTY detection drives the default format.
64
+ // Terminals get human output, pipes/agents get JSON.
65
+ tty: process.stdout.isTTY ?? false
64
66
  };
65
67
  const resolved = resolveFlags(flagInput);
66
68
  const format = resolved.format.format;
@@ -68,41 +70,30 @@ function emitResult(output, flags, humanFormatter) {
68
70
  if (quiet) {
69
71
  return;
70
72
  }
71
- const envelope = createEnvelope(
72
- output.success ? {
73
- success: true,
74
- result: output.data,
75
- meta: {
76
- operation: `forge-ts.${output.operation}`,
77
- requestId: randomUUID(),
78
- transport: "cli",
79
- mvi: flags.mvi ?? "standard"
80
- }
81
- } : {
82
- success: false,
83
- error: {
84
- code: output.errors?.[0]?.code ?? "FORGE_ERROR",
85
- message: output.errors?.[0]?.message ?? "Command failed",
86
- category: "VALIDATION",
87
- retryable: false,
88
- retryAfterMs: null,
89
- details: {
90
- errors: output.errors ?? [],
91
- warnings: output.warnings ?? []
92
- }
93
- },
94
- meta: {
95
- operation: `forge-ts.${output.operation}`,
96
- requestId: randomUUID(),
97
- transport: "cli",
98
- mvi: flags.mvi ?? "standard"
99
- }
100
- }
101
- );
73
+ const meta = {
74
+ operation: `forge-ts.${output.operation}`,
75
+ requestId: randomUUID(),
76
+ transport: "cli",
77
+ mvi: flags.mvi ?? "full"
78
+ };
79
+ const envelope = output.success ? createEnvelope({
80
+ success: true,
81
+ result: output.data,
82
+ meta
83
+ }) : createEnvelope({
84
+ success: false,
85
+ result: output.data,
86
+ error: {
87
+ code: output.errors?.[0]?.code ?? "FORGE_CHECK_FAILED",
88
+ message: output.errors?.[0]?.message ?? "Check failed \u2014 see result for actionable fixes",
89
+ category: "VALIDATION",
90
+ retryable: true,
91
+ retryAfterMs: null
92
+ },
93
+ meta
94
+ });
102
95
  if (format === "json") {
103
- const mviLevel = flags.mvi ?? "standard";
104
- const projected = projectEnvelope(envelope, mviLevel);
105
- process.stdout.write(`${JSON.stringify(projected, null, 2)}
96
+ process.stdout.write(`${JSON.stringify(envelope, null, 2)}
106
97
  `);
107
98
  } else {
108
99
  const formatted = humanFormatter(output.data, output);
@@ -180,13 +171,8 @@ async function runBuild(args) {
180
171
  status: "success",
181
172
  duration: result.duration
182
173
  });
183
- for (const format of config.gen.formats) {
184
- const ext = format === "mdx" ? "mdx" : "md";
185
- generatedFiles.push(join(config.outDir, `api-reference.${ext}`));
186
- }
187
- if (config.gen.llmsTxt) {
188
- generatedFiles.push(join(config.outDir, "llms.txt"));
189
- generatedFiles.push(join(config.outDir, "llms-full.txt"));
174
+ if (result.writtenFiles) {
175
+ generatedFiles.push(...result.writtenFiles);
190
176
  }
191
177
  }
192
178
  } else if (!config.gen.enabled || args.skipGen) {
@@ -355,7 +341,7 @@ function buildCheckResult(rawErrors, rawWarnings, _symbolCount, exportedSymbolCo
355
341
  if (mviLevel === "minimal") {
356
342
  return { success, summary };
357
343
  }
358
- const byFile = groupByFile(rawErrors, rawWarnings, mviLevel === "full");
344
+ const byFile = groupByFile(rawErrors, rawWarnings, mviLevel !== "minimal");
359
345
  return { success, summary, byFile };
360
346
  }
361
347
  async function runCheck(args) {
@@ -364,7 +350,7 @@ async function runCheck(args) {
364
350
  config.enforce.strict = args.strict;
365
351
  }
366
352
  const result = await enforce(config);
367
- const mviLevel = args.mvi ?? "standard";
353
+ const mviLevel = args.mvi ?? "full";
368
354
  const exportedSymbolCount = result.symbols.filter((s) => s.exported).length;
369
355
  const data = buildCheckResult(
370
356
  result.errors,
@@ -375,10 +361,17 @@ async function runCheck(args) {
375
361
  result.success,
376
362
  mviLevel
377
363
  );
364
+ const cliErrors = result.success ? void 0 : [
365
+ {
366
+ code: "FORGE_CHECK_FAILED",
367
+ message: `TSDoc coverage check failed: ${result.errors.length} error(s), ${result.warnings.length} warning(s) across ${data.summary.files} file(s)`
368
+ }
369
+ ];
378
370
  return {
379
371
  operation: "check",
380
372
  success: result.success,
381
373
  data,
374
+ errors: cliErrors,
382
375
  duration: result.duration
383
376
  };
384
377
  }
@@ -402,6 +395,11 @@ function formatCheckHuman(result) {
402
395
  for (const err of group.errors) {
403
396
  const symbolPart = err.symbol ? `${err.symbol} (${err.kind}:${err.line})` : `line ${err.line}`;
404
397
  lines.push(` ${err.code} ${symbolPart} \u2014 ${err.message}`);
398
+ if (err.suggestedFix) {
399
+ for (const fixLine of err.suggestedFix.split("\n")) {
400
+ lines.push(` ${fixLine}`);
401
+ }
402
+ }
405
403
  }
406
404
  }
407
405
  if (group.warnings.length > 0) {
@@ -411,9 +409,7 @@ function formatCheckHuman(result) {
411
409
  }
412
410
  }
413
411
  }
414
- lines.push("");
415
412
  }
416
- lines.push(" Run with --json --mvi full for exact fix suggestions.");
417
413
  return lines.join("\n");
418
414
  }
419
415
  var checkCommand = defineCommand2({
@@ -538,7 +534,7 @@ var docsDevCommand = defineCommand3({
538
534
 
539
535
  // src/commands/init-docs.ts
540
536
  import { mkdir, writeFile } from "fs/promises";
541
- import { join as join2, resolve as resolve2 } from "path";
537
+ import { join, resolve as resolve2 } from "path";
542
538
  import { loadConfig as loadConfig4 } from "@forge-ts/core";
543
539
  import {
544
540
  DEFAULT_TARGET as DEFAULT_TARGET2,
@@ -616,7 +612,7 @@ async function runInitDocs(args) {
616
612
  const manifest = adapter.scaffold(context);
617
613
  const writtenFiles = [];
618
614
  for (const file of manifest.files) {
619
- const filePath = join2(outDir, file.path);
615
+ const filePath = join(outDir, file.path);
620
616
  const fileDir = filePath.substring(0, filePath.lastIndexOf("/"));
621
617
  await mkdir(fileDir, { recursive: true });
622
618
  await writeFile(filePath, file.content, "utf8");
@@ -681,7 +677,7 @@ function formatInitDocsHuman(result) {
681
677
  }
682
678
  var initDocsCommand = defineCommand4({
683
679
  meta: {
684
- name: "docs",
680
+ name: "init",
685
681
  description: "Scaffold a documentation site"
686
682
  },
687
683
  args: {
@@ -784,10 +780,15 @@ async function runTest(args) {
784
780
  message: e.message
785
781
  }));
786
782
  }
783
+ const cliErrors = result.success ? void 0 : result.errors.map((e) => ({
784
+ code: e.code,
785
+ message: e.message
786
+ }));
787
787
  return {
788
788
  operation: "test",
789
789
  success: result.success,
790
790
  data,
791
+ errors: cliErrors,
791
792
  duration: result.duration
792
793
  };
793
794
  }
@@ -845,6 +846,8 @@ var testCommand = defineCommand5({
845
846
  });
846
847
 
847
848
  // src/index.ts
849
+ var require2 = createRequire(import.meta.url);
850
+ var pkg = require2("../package.json");
848
851
  var docsCommand = defineCommand6({
849
852
  meta: {
850
853
  name: "docs",
@@ -858,7 +861,7 @@ var docsCommand = defineCommand6({
858
861
  var main = defineCommand6({
859
862
  meta: {
860
863
  name: "forge-ts",
861
- version: "0.5.0",
864
+ version: pkg.version,
862
865
  description: "Universal TypeScript Documentation Compiler"
863
866
  },
864
867
  subCommands: {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/commands/build.ts","../src/logger.ts","../src/output.ts","../src/commands/check.ts","../src/commands/docs-dev.ts","../src/commands/init-docs.ts","../src/commands/test.ts"],"sourcesContent":["/**\n * @forge-ts/cli — Command-line interface for the forge-ts toolchain.\n *\n * Usage:\n * forge-ts check [--cwd <dir>] [--strict] [--verbose]\n * forge-ts test [--cwd <dir>]\n * forge-ts build [--cwd <dir>] [--skip-api] [--skip-gen]\n * forge-ts docs init [--target <ssg>] [--out-dir <dir>] [--force]\n * forge-ts docs dev [--target <ssg>] [--port <port>]\n *\n * @packageDocumentation\n * @public\n */\n\nimport { defineCommand, runMain } from \"citty\";\nimport { buildCommand } from \"./commands/build.js\";\nimport { checkCommand } from \"./commands/check.js\";\nimport { docsDevCommand } from \"./commands/docs-dev.js\";\nimport { initDocsCommand } from \"./commands/init-docs.js\";\nimport { testCommand } from \"./commands/test.js\";\n\nexport { type BuildResult, type BuildStep, buildCommand } from \"./commands/build.js\";\nexport {\n\ttype CheckFileError,\n\ttype CheckFileGroup,\n\ttype CheckFileWarning,\n\ttype CheckResult,\n\tcheckCommand,\n} from \"./commands/check.js\";\nexport { docsDevCommand, runDocsDev } from \"./commands/docs-dev.js\";\nexport {\n\ttype InitDocsResult,\n\tinitDocsCommand,\n} from \"./commands/init-docs.js\";\nexport { type TestFailure, type TestResult, testCommand } from \"./commands/test.js\";\nexport { createLogger, type Logger } from \"./logger.js\";\nexport {\n\ttype CommandOutput,\n\temitResult,\n\ttype ForgeCliError,\n\ttype ForgeCliWarning,\n\ttype OutputFlags,\n\tresolveExitCode,\n} from \"./output.js\";\n\n/**\n * The `docs` parent command with `init` and `dev` subcommands.\n *\n * @example\n * ```typescript\n * // forge-ts docs init --target mintlify\n * // forge-ts docs dev\n * ```\n * @public\n */\nconst docsCommand = defineCommand({\n\tmeta: {\n\t\tname: \"docs\",\n\t\tdescription: \"Documentation site management\",\n\t},\n\tsubCommands: {\n\t\tinit: initDocsCommand,\n\t\tdev: docsDevCommand,\n\t},\n});\n\nconst main = defineCommand({\n\tmeta: {\n\t\tname: \"forge-ts\",\n\t\tversion: \"0.5.0\",\n\t\tdescription: \"Universal TypeScript Documentation Compiler\",\n\t},\n\tsubCommands: {\n\t\tcheck: checkCommand,\n\t\ttest: testCommand,\n\t\tbuild: buildCommand,\n\t\tdocs: docsCommand,\n\t},\n});\n\nrunMain(main);\n","import { join } from \"node:path\";\nimport { generateApi } from \"@forge-ts/api\";\nimport { loadConfig } from \"@forge-ts/core\";\nimport { generate, type GenerateOptions } from \"@forge-ts/gen\";\nimport { defineCommand } from \"citty\";\nimport { createLogger } from \"../logger.js\";\nimport {\n\ttype CommandOutput,\n\temitResult,\n\ttype ForgeCliError,\n\ttype OutputFlags,\n\tresolveExitCode,\n} from \"../output.js\";\n\n/**\n * Arguments for the `build` command.\n * @internal\n */\nexport interface BuildArgs {\n\t/** Project root directory (default: cwd). */\n\tcwd?: string;\n\t/** Skip API generation even if enabled in config. */\n\tskipApi?: boolean;\n\t/** Skip doc generation even if enabled in config. */\n\tskipGen?: boolean;\n\t/**\n\t * Overwrite stub pages even if they already exist on disk.\n\t * Normally stub pages (concepts, guides, faq, contributing, changelog)\n\t * are only created on the first build to preserve manual edits.\n\t * Use this to reset stubs to their scaffolding state.\n\t */\n\tforceStubs?: boolean;\n\t/** MVI verbosity level for structured output. */\n\tmvi?: string;\n}\n\n/**\n * A single step in the build pipeline.\n * @public\n */\nexport interface BuildStep {\n\t/** Internal step name, e.g. \"api\" or \"gen\". */\n\tname: string;\n\t/** Outcome of this step. */\n\tstatus: \"success\" | \"skipped\" | \"failed\";\n\t/** Path to the primary output file produced by this step, if applicable. */\n\toutputPath?: string;\n\t/** Wall-clock duration of this step in milliseconds. */\n\tduration?: number;\n\t/** Errors produced by this step when status is \"failed\". */\n\terrors?: ForgeCliError[];\n}\n\n/**\n * Typed result for the `build` command.\n * @public\n */\nexport interface BuildResult {\n\t/** Whether the build succeeded. */\n\tsuccess: boolean;\n\t/** Aggregate pipeline counts — always present. */\n\tsummary: {\n\t\t/** Total number of pipeline steps. */\n\t\tsteps: number;\n\t\t/** Steps that completed successfully. */\n\t\tsucceeded: number;\n\t\t/** Steps that failed. */\n\t\tfailed: number;\n\t\t/** Wall-clock duration in milliseconds. */\n\t\tduration: number;\n\t};\n\t/** Per-step details. */\n\tsteps: BuildStep[];\n\t/** Files written during the build — present at standard and full MVI levels. */\n\tgeneratedFiles?: string[];\n}\n\n// ---------------------------------------------------------------------------\n// Public API\n// ---------------------------------------------------------------------------\n\n/**\n * Runs the full build pipeline and returns a typed command output.\n *\n * @param args - CLI arguments for the build command.\n * @returns A typed `CommandOutput<BuildResult>`.\n * @example\n * ```typescript\n * import { runBuild } from \"@forge-ts/cli/commands/build\";\n * const output = await runBuild({ cwd: process.cwd() });\n * console.log(output.success); // true if all steps succeeded\n * ```\n * @public\n */\nexport async function runBuild(args: BuildArgs): Promise<CommandOutput<BuildResult>> {\n\tconst config = await loadConfig(args.cwd);\n\tconst buildStart = Date.now();\n\tconst mviLevel = args.mvi ?? \"standard\";\n\n\tconst steps: BuildStep[] = [];\n\tconst allErrors: ForgeCliError[] = [];\n\tconst generatedFiles: string[] = [];\n\tlet success = true;\n\n\tif (config.api.enabled && !args.skipApi) {\n\t\tconst result = await generateApi(config);\n\t\tif (!result.success) {\n\t\t\tconst errors: ForgeCliError[] = result.errors.map((e) => ({\n\t\t\t\tcode: e.code,\n\t\t\t\tmessage: e.message,\n\t\t\t\tfilePath: e.filePath,\n\t\t\t\tline: e.line,\n\t\t\t\tcolumn: e.column,\n\t\t\t}));\n\t\t\tallErrors.push(...errors);\n\t\t\tsuccess = false;\n\t\t\tsteps.push({\n\t\t\t\tname: \"api\",\n\t\t\t\tstatus: \"failed\",\n\t\t\t\toutputPath: config.api.openapiPath,\n\t\t\t\tduration: result.duration,\n\t\t\t\terrors,\n\t\t\t});\n\t\t} else {\n\t\t\tsteps.push({\n\t\t\t\tname: \"api\",\n\t\t\t\tstatus: \"success\",\n\t\t\t\toutputPath: config.api.openapiPath,\n\t\t\t\tduration: result.duration,\n\t\t\t});\n\t\t\tgeneratedFiles.push(config.api.openapiPath);\n\t\t}\n\t} else if (!config.api.enabled || args.skipApi) {\n\t\tsteps.push({ name: \"api\", status: \"skipped\" });\n\t}\n\n\tif (config.gen.enabled && !args.skipGen) {\n\t\tconst result = await generate(config, { forceStubs: args.forceStubs });\n\t\tif (!result.success) {\n\t\t\tconst errors: ForgeCliError[] = result.errors.map((e) => ({\n\t\t\t\tcode: e.code,\n\t\t\t\tmessage: e.message,\n\t\t\t\tfilePath: e.filePath,\n\t\t\t\tline: e.line,\n\t\t\t\tcolumn: e.column,\n\t\t\t}));\n\t\t\tallErrors.push(...errors);\n\t\t\tsuccess = false;\n\t\t\tsteps.push({\n\t\t\t\tname: \"gen\",\n\t\t\t\tstatus: \"failed\",\n\t\t\t\tduration: result.duration,\n\t\t\t\terrors,\n\t\t\t});\n\t\t} else {\n\t\t\tsteps.push({\n\t\t\t\tname: \"gen\",\n\t\t\t\tstatus: \"success\",\n\t\t\t\tduration: result.duration,\n\t\t\t});\n\t\t\t// Track the generated output directory and standard files\n\t\t\tfor (const format of config.gen.formats) {\n\t\t\t\tconst ext = format === \"mdx\" ? \"mdx\" : \"md\";\n\t\t\t\tgeneratedFiles.push(join(config.outDir, `api-reference.${ext}`));\n\t\t\t}\n\t\t\tif (config.gen.llmsTxt) {\n\t\t\t\tgeneratedFiles.push(join(config.outDir, \"llms.txt\"));\n\t\t\t\tgeneratedFiles.push(join(config.outDir, \"llms-full.txt\"));\n\t\t\t}\n\t\t}\n\t} else if (!config.gen.enabled || args.skipGen) {\n\t\tsteps.push({ name: \"gen\", status: \"skipped\" });\n\t}\n\n\tconst totalMs = Date.now() - buildStart;\n\n\tconst succeededCount = steps.filter((s) => s.status === \"success\").length;\n\tconst failedCount = steps.filter((s) => s.status === \"failed\").length;\n\n\tconst data: BuildResult = {\n\t\tsuccess,\n\t\tsummary: {\n\t\t\tsteps: steps.length,\n\t\t\tsucceeded: succeededCount,\n\t\t\tfailed: failedCount,\n\t\t\tduration: totalMs,\n\t\t},\n\t\tsteps,\n\t};\n\n\tif (mviLevel !== \"minimal\") {\n\t\tdata.generatedFiles = generatedFiles;\n\t}\n\n\treturn {\n\t\toperation: \"build\",\n\t\tsuccess,\n\t\tdata,\n\t\terrors: allErrors,\n\t\tduration: totalMs,\n\t};\n}\n\n/**\n * Citty command definition for `forge-ts build`.\n * @public\n */\nexport const buildCommand = defineCommand({\n\tmeta: {\n\t\tname: \"build\",\n\t\tdescription: \"Generate API reference and documentation\",\n\t},\n\targs: {\n\t\tcwd: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"Project root directory\",\n\t\t},\n\t\t\"skip-api\": {\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Skip OpenAPI generation\",\n\t\t\tdefault: false,\n\t\t},\n\t\t\"skip-gen\": {\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Skip doc generation\",\n\t\t\tdefault: false,\n\t\t},\n\t\t\"force-stubs\": {\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Overwrite stub pages even if they exist (reset to scaffolding)\",\n\t\t\tdefault: false,\n\t\t},\n\t\tjson: {\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Output as LAFS JSON envelope (agent-friendly)\",\n\t\t\tdefault: false,\n\t\t},\n\t\thuman: {\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Output as formatted text (default for TTY)\",\n\t\t\tdefault: false,\n\t\t},\n\t\tquiet: {\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Suppress non-essential output\",\n\t\t\tdefault: false,\n\t\t},\n\t\tmvi: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"MVI verbosity level: minimal, standard, full\",\n\t\t},\n\t},\n\tasync run({ args }) {\n\t\tconst output = await runBuild({\n\t\t\tcwd: args.cwd,\n\t\t\tskipApi: args[\"skip-api\"],\n\t\t\tskipGen: args[\"skip-gen\"],\n\t\t\tforceStubs: args[\"force-stubs\"],\n\t\t\tmvi: args.mvi,\n\t\t});\n\n\t\tconst flags: OutputFlags = {\n\t\t\tjson: args.json,\n\t\t\thuman: args.human,\n\t\t\tquiet: args.quiet,\n\t\t\tmvi: args.mvi,\n\t\t};\n\n\t\temitResult(output, flags, (data) => {\n\t\t\tconst logger = createLogger();\n\t\t\tfor (const step of data.steps) {\n\t\t\t\tif (step.status === \"failed\") {\n\t\t\t\t\tfor (const err of step.errors ?? []) {\n\t\t\t\t\t\tlogger.error(`[${step.name}] ${err.message}`);\n\t\t\t\t\t}\n\t\t\t\t} else if (step.status === \"success\") {\n\t\t\t\t\tconst detail =\n\t\t\t\t\t\tstep.name === \"api\" && step.outputPath != null\n\t\t\t\t\t\t\t? `Generated OpenAPI spec \\u2192 ${step.outputPath}`\n\t\t\t\t\t\t\t: `Step complete`;\n\t\t\t\t\tlogger.step(step.name.toUpperCase(), detail, step.duration);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (output.success) {\n\t\t\t\treturn ` Done in ${data.summary.duration}ms`;\n\t\t\t}\n\t\t\treturn \"\";\n\t\t});\n\n\t\tprocess.exit(resolveExitCode(output));\n\t},\n});\n","/**\n * Simple TTY-aware logger for forge-ts CLI output.\n *\n * Uses ANSI escape codes directly — no external colour library.\n *\n * @packageDocumentation\n * @internal\n */\n\n// ---------------------------------------------------------------------------\n// ANSI constants\n// ---------------------------------------------------------------------------\n\nconst GREEN = \"\\x1b[32m\";\nconst YELLOW = \"\\x1b[33m\";\nconst RED = \"\\x1b[31m\";\nconst BOLD = \"\\x1b[1m\";\nconst RESET = \"\\x1b[0m\";\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\n/**\n * A minimal structured logger used throughout the CLI commands.\n * @internal\n */\nexport interface Logger {\n\t/** Print an informational message. */\n\tinfo(msg: string): void;\n\t/** Print a success message (green ✓ prefix when colours are on). */\n\tsuccess(msg: string): void;\n\t/** Print a warning message (yellow prefix when colours are on). */\n\twarn(msg: string): void;\n\t/** Print an error message (red ✗ prefix when colours are on). */\n\terror(msg: string): void;\n\t/**\n\t * Print a build-step line.\n\t *\n\t * @param label - Short category label (e.g. \"API\", \"Gen\").\n\t * @param detail - Description of what was produced.\n\t * @param duration - Optional wall-clock time in milliseconds.\n\t */\n\tstep(label: string, detail: string, duration?: number): void;\n}\n\n// ---------------------------------------------------------------------------\n// Implementation\n// ---------------------------------------------------------------------------\n\n/**\n * Creates a {@link Logger} instance.\n *\n * @param options - Optional configuration.\n * @param options.colors - Emit ANSI colour codes. Defaults to `process.stdout.isTTY`.\n * @returns A configured logger.\n * @internal\n */\nexport function createLogger(options?: { colors?: boolean }): Logger {\n\tconst useColors = options?.colors ?? process.stdout.isTTY ?? false;\n\n\tfunction colorize(text: string, code: string): string {\n\t\treturn useColors ? `${code}${text}${RESET}` : text;\n\t}\n\n\tfunction bold(text: string): string {\n\t\treturn useColors ? `${BOLD}${text}${RESET}` : text;\n\t}\n\n\treturn {\n\t\tinfo(msg: string): void {\n\t\t\tconsole.log(msg);\n\t\t},\n\n\t\tsuccess(msg: string): void {\n\t\t\tconst prefix = colorize(\"✓\", GREEN);\n\t\t\tconsole.log(`${prefix} ${msg}`);\n\t\t},\n\n\t\twarn(msg: string): void {\n\t\t\tconst prefix = colorize(\"warn\", YELLOW);\n\t\t\tconsole.warn(`${bold(prefix)} ${msg}`);\n\t\t},\n\n\t\terror(msg: string): void {\n\t\t\tconst prefix = colorize(\"error\", RED);\n\t\t\tconsole.error(`${bold(prefix)} ${msg}`);\n\t\t},\n\n\t\tstep(label: string, detail: string, duration?: number): void {\n\t\t\tconst check = colorize(\"✓\", GREEN);\n\t\t\tconst durationStr = duration !== undefined ? ` (${duration}ms)` : \"\";\n\t\t\tconsole.log(` ${check} ${bold(label)}: ${detail}${durationStr}`);\n\t\t},\n\t};\n}\n","/**\n * Central output layer for forge-ts CLI.\n *\n * Wraps all command results in LAFS envelopes for agent-first output, while\n * preserving human-readable formatting for TTY consumers.\n *\n * @packageDocumentation\n * @internal\n */\n\nimport { randomUUID } from \"node:crypto\";\nimport {\n\tcreateEnvelope,\n\ttype MVILevel,\n\tprojectEnvelope,\n\tresolveFlags,\n\ttype UnifiedFlagInput,\n} from \"@cleocode/lafs-protocol\";\n\n// ---------------------------------------------------------------------------\n// Public types\n// ---------------------------------------------------------------------------\n\n/** Typed result from a forge-ts command. */\nexport interface CommandOutput<T> {\n\t/** Name of the command that produced this output (e.g., \"check\", \"build\"). */\n\toperation: string;\n\t/** Whether the command completed successfully. */\n\tsuccess: boolean;\n\t/** Strongly-typed command-specific result payload. */\n\tdata: T;\n\t/** Structured errors produced by the command, if any. */\n\terrors?: ForgeCliError[];\n\t/** Structured warnings produced by the command, if any. */\n\twarnings?: ForgeCliWarning[];\n\t/** Wall-clock duration of the command in milliseconds. */\n\tduration?: number;\n}\n\n/** Structured error for CLI commands. */\nexport interface ForgeCliError {\n\t/** Machine-readable error code (e.g., \"E004\"). */\n\tcode: string;\n\t/** Human-readable error description. */\n\tmessage: string;\n\t/** Absolute path to the source file containing the error, if applicable. */\n\tfilePath?: string;\n\t/** 1-based line number of the error, if applicable. */\n\tline?: number;\n\t/** 0-based column number of the error, if applicable. */\n\tcolumn?: number;\n}\n\n/** Structured warning for CLI commands. */\nexport interface ForgeCliWarning {\n\t/** Machine-readable warning code. */\n\tcode: string;\n\t/** Human-readable warning description. */\n\tmessage: string;\n\t/** Absolute path to the source file containing the warning, if applicable. */\n\tfilePath?: string;\n\t/** 1-based line number of the warning, if applicable. */\n\tline?: number;\n\t/** 0-based column number of the warning, if applicable. */\n\tcolumn?: number;\n}\n\n/** Output format flags passed through from citty args. */\nexport interface OutputFlags {\n\t/** Emit output as a LAFS JSON envelope instead of human-readable text. */\n\tjson?: boolean;\n\t/** Emit output as formatted human-readable text. */\n\thuman?: boolean;\n\t/** Suppress all output regardless of format. */\n\tquiet?: boolean;\n\t/** MVI verbosity level: \"minimal\", \"standard\", or \"full\". */\n\tmvi?: string;\n}\n\n// ---------------------------------------------------------------------------\n// emitResult\n// ---------------------------------------------------------------------------\n\n/**\n * Wraps a command result in a LAFS envelope and emits it.\n *\n * - JSON mode: writes the projected envelope to stdout as JSON.\n * - Human mode: calls the provided formatter function.\n * - Quiet mode: suppresses all output regardless of format.\n *\n * @param output - Typed result from the command.\n * @param flags - Output format flags from citty args.\n * @param humanFormatter - Produces a human-readable string for TTY consumers.\n * @example\n * ```typescript\n * import { emitResult } from \"@forge-ts/cli/output\";\n * emitResult(output, { human: true }, (data) => `Done: ${data.summary.duration}ms`);\n * ```\n * @internal\n */\nexport function emitResult<T>(\n\toutput: CommandOutput<T>,\n\tflags: OutputFlags,\n\thumanFormatter: (data: T, output: CommandOutput<T>) => string,\n): void {\n\tconst flagInput: UnifiedFlagInput = {\n\t\tjson: flags.json,\n\t\thuman: flags.human,\n\t\tquiet: flags.quiet,\n\t\tmvi: flags.mvi,\n\t};\n\n\tconst resolved = resolveFlags(flagInput);\n\tconst format = resolved.format.format;\n\tconst quiet = resolved.format.quiet;\n\n\t// Quiet mode: suppress all output, just let exit code speak.\n\tif (quiet) {\n\t\treturn;\n\t}\n\n\t// Build the LAFS envelope\n\tconst envelope = createEnvelope(\n\t\toutput.success\n\t\t\t? {\n\t\t\t\t\tsuccess: true,\n\t\t\t\t\tresult: output.data as Record<string, unknown>,\n\t\t\t\t\tmeta: {\n\t\t\t\t\t\toperation: `forge-ts.${output.operation}`,\n\t\t\t\t\t\trequestId: randomUUID(),\n\t\t\t\t\t\ttransport: \"cli\",\n\t\t\t\t\t\tmvi: (flags.mvi as MVILevel) ?? \"standard\",\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t: {\n\t\t\t\t\tsuccess: false,\n\t\t\t\t\terror: {\n\t\t\t\t\t\tcode: output.errors?.[0]?.code ?? \"FORGE_ERROR\",\n\t\t\t\t\t\tmessage: output.errors?.[0]?.message ?? \"Command failed\",\n\t\t\t\t\t\tcategory: \"VALIDATION\",\n\t\t\t\t\t\tretryable: false,\n\t\t\t\t\t\tretryAfterMs: null,\n\t\t\t\t\t\tdetails: {\n\t\t\t\t\t\t\terrors: output.errors ?? [],\n\t\t\t\t\t\t\twarnings: output.warnings ?? [],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tmeta: {\n\t\t\t\t\t\toperation: `forge-ts.${output.operation}`,\n\t\t\t\t\t\trequestId: randomUUID(),\n\t\t\t\t\t\ttransport: \"cli\",\n\t\t\t\t\t\tmvi: (flags.mvi as MVILevel) ?? \"standard\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t);\n\n\tif (format === \"json\") {\n\t\t// MVI projection reduces token cost for agents\n\t\tconst mviLevel: MVILevel = (flags.mvi as MVILevel) ?? \"standard\";\n\t\tconst projected = projectEnvelope(envelope, mviLevel);\n\t\tprocess.stdout.write(`${JSON.stringify(projected, null, 2)}\\n`);\n\t} else {\n\t\t// Human-readable output\n\t\tconst formatted = humanFormatter(output.data, output);\n\t\tif (formatted) {\n\t\t\tconsole.log(formatted);\n\t\t}\n\t}\n}\n\n// ---------------------------------------------------------------------------\n// resolveExitCode\n// ---------------------------------------------------------------------------\n\n/**\n * Returns the LAFS-compliant exit code for a command output.\n *\n * @param output - Typed result from the command.\n * @returns `0` on success, `1` on validation/check failure.\n * @internal\n */\nexport function resolveExitCode(output: CommandOutput<unknown>): number {\n\tif (output.success) return 0;\n\treturn 1;\n}\n","import { type ForgeError, type ForgeWarning, loadConfig } from \"@forge-ts/core\";\nimport { enforce } from \"@forge-ts/enforcer\";\nimport { defineCommand } from \"citty\";\nimport { type CommandOutput, emitResult, type OutputFlags, resolveExitCode } from \"../output.js\";\n\n/**\n * Arguments for the `check` command.\n * @internal\n */\nexport interface CheckArgs {\n\t/** Project root directory (default: cwd). */\n\tcwd?: string;\n\t/** Exit with non-zero code on warnings as well as errors. */\n\tstrict?: boolean;\n\t/** Include symbol signatures alongside diagnostics. */\n\tverbose?: boolean;\n\t/** MVI verbosity level for structured output. */\n\tmvi?: string;\n}\n\n/**\n * A single error entry within a file group, included at standard and full MVI levels.\n * @public\n */\nexport interface CheckFileError {\n\t/** Machine-readable error code. */\n\tcode: string;\n\t/** Symbol name that needs fixing. */\n\tsymbol: string;\n\t/** Symbol kind (function, class, interface, etc.). */\n\tkind: string;\n\t/** 1-based line number of the error. */\n\tline: number;\n\t/** Human-readable description. */\n\tmessage: string;\n\t/** Exact TSDoc block to add (full MVI level only). */\n\tsuggestedFix?: string;\n\t/** Recommended agent action (full MVI level only). */\n\tagentAction?: string;\n}\n\n/**\n * A single warning entry within a file group, included at standard and full MVI levels.\n * @public\n */\nexport interface CheckFileWarning {\n\t/** Machine-readable warning code. */\n\tcode: string;\n\t/** Symbol name that generated the warning. */\n\tsymbol: string;\n\t/** Symbol kind (function, class, interface, etc.). */\n\tkind: string;\n\t/** 1-based line number of the warning. */\n\tline: number;\n\t/** Human-readable description. */\n\tmessage: string;\n}\n\n/**\n * Errors and warnings grouped by file, included at standard and full MVI levels.\n * @public\n */\nexport interface CheckFileGroup {\n\t/** Absolute path to the source file. */\n\tfile: string;\n\t/** Errors in this file. */\n\terrors: CheckFileError[];\n\t/** Warnings in this file. */\n\twarnings: CheckFileWarning[];\n}\n\n/**\n * Typed result for the `check` command.\n * @public\n */\nexport interface CheckResult {\n\t/** Whether the check passed without errors. */\n\tsuccess: boolean;\n\t/** Aggregate counts — always present regardless of MVI level. */\n\tsummary: {\n\t\t/** Total number of errors. */\n\t\terrors: number;\n\t\t/** Total number of warnings. */\n\t\twarnings: number;\n\t\t/** Number of unique files with diagnostics. */\n\t\tfiles: number;\n\t\t/** Number of exported symbols checked. */\n\t\tsymbols: number;\n\t\t/** Wall-clock duration in milliseconds. */\n\t\tduration: number;\n\t};\n\t/** Per-file breakdown — present at standard and full MVI levels. */\n\tbyFile?: CheckFileGroup[];\n}\n\n// ---------------------------------------------------------------------------\n// Internal helpers\n// ---------------------------------------------------------------------------\n\n/**\n * Determines the recommended agent action given a ForgeError.\n * @internal\n */\nfunction resolveAgentAction(_error: ForgeError): string {\n\treturn \"retry_modified\";\n}\n\n/**\n * Groups errors and warnings by file path.\n * @internal\n */\nfunction groupByFile(\n\terrors: ForgeError[],\n\twarnings: ForgeWarning[],\n\tincludeFix: boolean,\n): CheckFileGroup[] {\n\tconst fileMap = new Map<string, CheckFileGroup>();\n\n\tfor (const e of errors) {\n\t\tconst fp = e.filePath ?? \"\";\n\t\tif (!fileMap.has(fp)) {\n\t\t\tfileMap.set(fp, { file: fp, errors: [], warnings: [] });\n\t\t}\n\t\tconst entry: CheckFileError = {\n\t\t\tcode: e.code,\n\t\t\tsymbol: e.symbolName ?? \"\",\n\t\t\tkind: e.symbolKind ?? \"\",\n\t\t\tline: e.line,\n\t\t\tmessage: e.message,\n\t\t};\n\t\tif (includeFix) {\n\t\t\tif (e.suggestedFix !== undefined) {\n\t\t\t\tentry.suggestedFix = e.suggestedFix;\n\t\t\t}\n\t\t\tentry.agentAction = resolveAgentAction(e);\n\t\t}\n\t\tfileMap.get(fp)?.errors.push(entry);\n\t}\n\n\tfor (const w of warnings) {\n\t\tconst fp = w.filePath ?? \"\";\n\t\tif (!fileMap.has(fp)) {\n\t\t\tfileMap.set(fp, { file: fp, errors: [], warnings: [] });\n\t\t}\n\t\tfileMap.get(fp)?.warnings.push({\n\t\t\tcode: w.code,\n\t\t\tsymbol: \"\",\n\t\t\tkind: \"\",\n\t\t\tline: w.line,\n\t\t\tmessage: w.message,\n\t\t});\n\t}\n\n\treturn Array.from(fileMap.values());\n}\n\n/**\n * Builds an MVI-projected CheckResult from raw enforcer output.\n * @internal\n */\nfunction buildCheckResult(\n\trawErrors: ForgeError[],\n\trawWarnings: ForgeWarning[],\n\t_symbolCount: number,\n\texportedSymbolCount: number,\n\tduration: number,\n\tsuccess: boolean,\n\tmviLevel: string,\n): CheckResult {\n\tconst uniqueFiles = new Set([\n\t\t...rawErrors.map((e) => e.filePath),\n\t\t...rawWarnings.map((w) => w.filePath),\n\t]);\n\n\tconst summary = {\n\t\terrors: rawErrors.length,\n\t\twarnings: rawWarnings.length,\n\t\tfiles: uniqueFiles.size,\n\t\tsymbols: exportedSymbolCount,\n\t\tduration,\n\t};\n\n\tif (mviLevel === \"minimal\") {\n\t\treturn { success, summary };\n\t}\n\n\tconst byFile = groupByFile(rawErrors, rawWarnings, mviLevel === \"full\");\n\treturn { success, summary, byFile };\n}\n\n// ---------------------------------------------------------------------------\n// Public API\n// ---------------------------------------------------------------------------\n\n/**\n * Runs the TSDoc enforcement pass and returns a typed command output.\n *\n * @param args - CLI arguments for the check command.\n * @returns A typed `CommandOutput<CheckResult>`.\n * @example\n * ```typescript\n * import { runCheck } from \"@forge-ts/cli/commands/check\";\n * const output = await runCheck({ cwd: process.cwd() });\n * console.log(output.data.summary.errors); // number of TSDoc errors found\n * ```\n * @public\n */\nexport async function runCheck(args: CheckArgs): Promise<CommandOutput<CheckResult>> {\n\tconst config = await loadConfig(args.cwd);\n\tif (args.strict !== undefined) {\n\t\tconfig.enforce.strict = args.strict;\n\t}\n\n\tconst result = await enforce(config);\n\tconst mviLevel = args.mvi ?? \"standard\";\n\n\tconst exportedSymbolCount = result.symbols.filter((s) => s.exported).length;\n\n\tconst data = buildCheckResult(\n\t\tresult.errors,\n\t\tresult.warnings,\n\t\tresult.symbols.length,\n\t\texportedSymbolCount,\n\t\tresult.duration,\n\t\tresult.success,\n\t\tmviLevel,\n\t);\n\n\treturn {\n\t\toperation: \"check\",\n\t\tsuccess: result.success,\n\t\tdata,\n\t\tduration: result.duration,\n\t};\n}\n\n// ---------------------------------------------------------------------------\n// Human formatter\n// ---------------------------------------------------------------------------\n\n/**\n * Formats a CheckResult as human-readable text.\n * @internal\n */\nfunction formatCheckHuman(result: CheckResult): string {\n\tconst lines: string[] = [];\n\n\tif (result.success) {\n\t\tlines.push(\n\t\t\t`forge-ts check: OK (${result.summary.symbols} symbol(s) checked, ${result.summary.duration}ms)`,\n\t\t);\n\t\treturn lines.join(\"\\n\");\n\t}\n\n\tlines.push(\"forge-ts check: FAILED\\n\");\n\tlines.push(\n\t\t` ${result.summary.errors} error(s), ${result.summary.warnings} warning(s) across ${result.summary.files} file(s) (${result.summary.symbols} symbols checked)\\n`,\n\t);\n\n\tif (result.byFile && result.byFile.length > 0) {\n\t\tfor (const group of result.byFile) {\n\t\t\tif (group.errors.length > 0) {\n\t\t\t\tlines.push(` ${group.file} (${group.errors.length} error(s)):`);\n\t\t\t\tfor (const err of group.errors) {\n\t\t\t\t\tconst symbolPart = err.symbol\n\t\t\t\t\t\t? `${err.symbol} (${err.kind}:${err.line})`\n\t\t\t\t\t\t: `line ${err.line}`;\n\t\t\t\t\tlines.push(` ${err.code} ${symbolPart} — ${err.message}`);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (group.warnings.length > 0) {\n\t\t\t\tlines.push(` ${group.file} (${group.warnings.length} warning(s)):`);\n\t\t\t\tfor (const w of group.warnings) {\n\t\t\t\t\tlines.push(` ${w.code} line ${w.line} — ${w.message}`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tlines.push(\"\");\n\t}\n\n\tlines.push(\" Run with --json --mvi full for exact fix suggestions.\");\n\n\treturn lines.join(\"\\n\");\n}\n\n/**\n * Citty command definition for `forge-ts check`.\n * @public\n */\nexport const checkCommand = defineCommand({\n\tmeta: {\n\t\tname: \"check\",\n\t\tdescription: \"Lint TSDoc coverage on exported symbols\",\n\t},\n\targs: {\n\t\tcwd: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"Project root directory\",\n\t\t},\n\t\tstrict: {\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Treat warnings as errors\",\n\t\t\tdefault: false,\n\t\t},\n\t\tverbose: {\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Show detailed output\",\n\t\t\tdefault: false,\n\t\t},\n\t\tjson: {\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Output as LAFS JSON envelope (agent-friendly)\",\n\t\t\tdefault: false,\n\t\t},\n\t\thuman: {\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Output as formatted text (default for TTY)\",\n\t\t\tdefault: false,\n\t\t},\n\t\tquiet: {\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Suppress non-essential output\",\n\t\t\tdefault: false,\n\t\t},\n\t\tmvi: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"MVI verbosity level: minimal, standard, full\",\n\t\t},\n\t},\n\tasync run({ args }) {\n\t\tconst output = await runCheck({\n\t\t\tcwd: args.cwd,\n\t\t\tstrict: args.strict,\n\t\t\tverbose: args.verbose,\n\t\t\tmvi: args.mvi,\n\t\t});\n\n\t\tconst flags: OutputFlags = {\n\t\t\tjson: args.json,\n\t\t\thuman: args.human,\n\t\t\tquiet: args.quiet,\n\t\t\tmvi: args.mvi,\n\t\t};\n\n\t\temitResult(output, flags, (data) => formatCheckHuman(data));\n\n\t\tprocess.exit(resolveExitCode(output));\n\t},\n});\n","/**\n * The `forge-ts docs dev` command — starts a local doc preview server.\n *\n * Reads the ssgTarget from forge-ts config, looks up the adapter,\n * and spawns the correct dev server automatically.\n *\n * @packageDocumentation\n * @public\n */\n\nimport { spawn } from \"node:child_process\";\nimport { resolve } from \"node:path\";\nimport { loadConfig } from \"@forge-ts/core\";\nimport { DEFAULT_TARGET, getAdapter, type SSGTarget } from \"@forge-ts/gen\";\nimport { defineCommand } from \"citty\";\nimport { createLogger } from \"../logger.js\";\n\n/**\n * Starts the local dev server for the configured SSG target.\n *\n * Reads `gen.ssgTarget` from the forge-ts config, resolves the adapter,\n * and spawns the platform's dev server in the output directory.\n *\n * @param args - Command arguments.\n * @returns A promise that resolves when the server exits.\n *\n * @example\n * ```typescript\n * import { runDocsDev } from \"@forge-ts/cli\";\n * await runDocsDev({ cwd: \"./my-project\" });\n * ```\n * @public\n */\nexport async function runDocsDev(args: {\n\t/** Project root directory. */\n\tcwd?: string;\n\t/** Override the SSG target from config. */\n\ttarget?: string;\n\t/** Port to run the dev server on. */\n\tport?: string;\n}): Promise<void> {\n\tconst logger = createLogger();\n\tconst config = await loadConfig(args.cwd);\n\tconst target = (args.target ?? config.gen.ssgTarget ?? DEFAULT_TARGET) as SSGTarget;\n\tconst adapter = getAdapter(target);\n\tconst outDir = resolve(config.outDir);\n\tconst devCmd = adapter.getDevCommand(outDir);\n\n\tlogger.info(`Starting ${devCmd.label}...`);\n\tlogger.info(` Target: ${target}`);\n\tlogger.info(` Directory: ${outDir}`);\n\tlogger.info(` URL: ${devCmd.url}`);\n\tlogger.info(\"\");\n\n\tconst spawnArgs = [...devCmd.args];\n\tif (args.port) {\n\t\tspawnArgs.push(\"--port\", args.port);\n\t}\n\n\tconst proc = spawn(devCmd.bin, spawnArgs, {\n\t\tcwd: devCmd.cwd,\n\t\tstdio: \"inherit\",\n\t\tshell: true,\n\t});\n\n\treturn new Promise<void>((_resolve, reject) => {\n\t\tproc.on(\"close\", (code) => {\n\t\t\tif (code === 0) {\n\t\t\t\t_resolve();\n\t\t\t} else {\n\t\t\t\treject(new Error(`${devCmd.label} exited with code ${code}`));\n\t\t\t}\n\t\t});\n\t\tproc.on(\"error\", reject);\n\t});\n}\n\n/**\n * Citty command definition for `forge-ts docs dev`.\n *\n * @example\n * ```typescript\n * import { docsDevCommand } from \"@forge-ts/cli\";\n * ```\n * @public\n */\nexport const docsDevCommand = defineCommand({\n\tmeta: {\n\t\tname: \"dev\",\n\t\tdescription: \"Start a local doc preview server\",\n\t},\n\targs: {\n\t\tcwd: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"Project root directory\",\n\t\t},\n\t\ttarget: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"SSG target override (reads from config by default)\",\n\t\t},\n\t\tport: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"Port for the dev server\",\n\t\t},\n\t},\n\tasync run({ args }) {\n\t\tawait runDocsDev(args);\n\t},\n});\n","import { mkdir, writeFile } from \"node:fs/promises\";\nimport { join, resolve } from \"node:path\";\nimport { loadConfig } from \"@forge-ts/core\";\nimport {\n\ttype AdapterContext,\n\tDEFAULT_TARGET,\n\tgetAdapter,\n\tgetAvailableTargets,\n\ttype SSGTarget,\n} from \"@forge-ts/gen\";\nimport { defineCommand } from \"citty\";\nimport { createLogger } from \"../logger.js\";\nimport {\n\ttype CommandOutput,\n\temitResult,\n\ttype ForgeCliError,\n\ttype OutputFlags,\n\tresolveExitCode,\n} from \"../output.js\";\n\n// ---------------------------------------------------------------------------\n// Public types\n// ---------------------------------------------------------------------------\n\n/**\n * Result of the `init docs` command.\n *\n * @example\n * ```typescript\n * import { runInitDocs } from \"@forge-ts/cli/commands/init-docs\";\n * const output = await runInitDocs({ target: \"mintlify\" });\n * console.log(output.data.summary.filesCreated); // number of files written\n * ```\n * @public\n */\nexport interface InitDocsResult {\n\t/** Whether the scaffold succeeded. */\n\tsuccess: boolean;\n\t/** The SSG target that was scaffolded. */\n\ttarget: SSGTarget;\n\t/** Summary of what was created. */\n\tsummary: {\n\t\t/** Number of files written to disk. */\n\t\tfilesCreated: number;\n\t\t/** Number of npm dependencies declared by the adapter. */\n\t\tdependencies: number;\n\t\t/** Number of package.json scripts declared by the adapter. */\n\t\tscripts: number;\n\t};\n\t/** Relative paths of all files created. */\n\tfiles: string[];\n\t/** Post-scaffold instructions for the user. */\n\tinstructions: string[];\n}\n\n/**\n * Arguments for the `init docs` command.\n * @internal\n */\nexport interface InitDocsArgs {\n\t/** SSG target to scaffold. Defaults to {@link DEFAULT_TARGET}. */\n\ttarget?: string;\n\t/** Project root directory (default: cwd). */\n\tcwd?: string;\n\t/** Output directory for the doc site (default: outDir from config or ./docs). */\n\toutDir?: string;\n\t/** Overwrite an existing scaffold without prompting. */\n\tforce?: boolean;\n\t/** MVI verbosity level for structured output. */\n\tmvi?: string;\n}\n\n// ---------------------------------------------------------------------------\n// Public API\n// ---------------------------------------------------------------------------\n\n/**\n * Scaffolds a documentation site for the target SSG platform.\n *\n * Resolves the target from args, validates it, checks for an existing\n * scaffold, calls the adapter's `scaffold()` method, and writes all files\n * produced by the manifest to `outDir`.\n *\n * @param args - CLI arguments for the init docs command.\n * @returns A typed `CommandOutput<InitDocsResult>`.\n * @example\n * ```typescript\n * import { runInitDocs } from \"@forge-ts/cli/commands/init-docs\";\n * const output = await runInitDocs({ target: \"mintlify\", cwd: process.cwd() });\n * console.log(output.data.files); // list of created file paths\n * ```\n * @public\n */\nexport async function runInitDocs(args: InitDocsArgs): Promise<CommandOutput<InitDocsResult>> {\n\tconst start = Date.now();\n\n\t// 1. Resolve target\n\tconst rawTarget = args.target ?? DEFAULT_TARGET;\n\tconst available = getAvailableTargets();\n\tif (!available.includes(rawTarget as SSGTarget)) {\n\t\tconst err: ForgeCliError = {\n\t\t\tcode: \"INIT_UNKNOWN_TARGET\",\n\t\t\tmessage: `Unknown SSG target \"${rawTarget}\". Available targets: ${available.join(\", \")}`,\n\t\t};\n\t\treturn {\n\t\t\toperation: \"init.docs\",\n\t\t\tsuccess: false,\n\t\t\tdata: {\n\t\t\t\tsuccess: false,\n\t\t\t\ttarget: DEFAULT_TARGET,\n\t\t\t\tsummary: { filesCreated: 0, dependencies: 0, scripts: 0 },\n\t\t\t\tfiles: [],\n\t\t\t\tinstructions: [],\n\t\t\t},\n\t\t\terrors: [err],\n\t\t\tduration: Date.now() - start,\n\t\t};\n\t}\n\n\tconst target = rawTarget as SSGTarget;\n\tconst adapter = getAdapter(target);\n\n\t// 2. Load config to resolve outDir\n\tconst config = await loadConfig(args.cwd);\n\tconst outDir = args.outDir ? resolve(args.outDir) : config.outDir;\n\n\t// 3. Safety check: detect existing scaffold\n\tconst alreadyExists = await adapter.detectExisting(outDir);\n\tif (alreadyExists && !args.force) {\n\t\tconst err: ForgeCliError = {\n\t\t\tcode: \"INIT_ALREADY_EXISTS\",\n\t\t\tmessage: `Docs already scaffolded for ${target}. Use --force to overwrite.`,\n\t\t};\n\t\treturn {\n\t\t\toperation: \"init.docs\",\n\t\t\tsuccess: false,\n\t\t\tdata: {\n\t\t\t\tsuccess: false,\n\t\t\t\ttarget,\n\t\t\t\tsummary: { filesCreated: 0, dependencies: 0, scripts: 0 },\n\t\t\t\tfiles: [],\n\t\t\t\tinstructions: [],\n\t\t\t},\n\t\t\terrors: [err],\n\t\t\tduration: Date.now() - start,\n\t\t};\n\t}\n\n\t// 4. Check for cross-target collision (any other adapter already scaffolded)\n\tconst warnings: Array<{ code: string; message: string }> = [];\n\tfor (const otherTarget of available) {\n\t\tif (otherTarget === target) continue;\n\t\tconst otherAdapter = getAdapter(otherTarget as SSGTarget);\n\t\tconst otherExists = await otherAdapter.detectExisting(outDir);\n\t\tif (otherExists) {\n\t\t\twarnings.push({\n\t\t\t\tcode: \"INIT_TARGET_MISMATCH\",\n\t\t\t\tmessage: `Existing scaffold detected for ${otherTarget} but scaffolding for ${target}. Remove conflicting files to avoid issues.`,\n\t\t\t});\n\t\t}\n\t}\n\n\t// 5. Build AdapterContext — use an empty pages/symbols array for init\n\tconst projectName = config.rootDir.split(\"/\").pop() ?? \"Project\";\n\tconst context: AdapterContext = {\n\t\tconfig,\n\t\tprojectName,\n\t\tpages: [],\n\t\tsymbols: [],\n\t\toutDir,\n\t};\n\n\t// 6. Call adapter.scaffold() to get the ScaffoldManifest\n\tconst manifest = adapter.scaffold(context);\n\n\t// 7. Write all files from the manifest\n\tconst writtenFiles: string[] = [];\n\tfor (const file of manifest.files) {\n\t\tconst filePath = join(outDir, file.path);\n\t\tconst fileDir = filePath.substring(0, filePath.lastIndexOf(\"/\"));\n\t\tawait mkdir(fileDir, { recursive: true });\n\t\tawait writeFile(filePath, file.content, \"utf8\");\n\t\twrittenFiles.push(file.path);\n\t}\n\n\tconst depCount =\n\t\tObject.keys(manifest.dependencies).length + Object.keys(manifest.devDependencies).length;\n\tconst scriptCount = Object.keys(manifest.scripts).length;\n\n\tconst data: InitDocsResult = {\n\t\tsuccess: true,\n\t\ttarget,\n\t\tsummary: {\n\t\t\tfilesCreated: writtenFiles.length,\n\t\t\tdependencies: depCount,\n\t\t\tscripts: scriptCount,\n\t\t},\n\t\tfiles: writtenFiles,\n\t\tinstructions: manifest.instructions,\n\t};\n\n\treturn {\n\t\toperation: \"init.docs\",\n\t\tsuccess: true,\n\t\tdata,\n\t\twarnings:\n\t\t\twarnings.length > 0\n\t\t\t\t? warnings.map((w) => ({\n\t\t\t\t\t\tcode: w.code,\n\t\t\t\t\t\tmessage: w.message,\n\t\t\t\t\t\tfilePath: \"\",\n\t\t\t\t\t\tline: 0,\n\t\t\t\t\t\tcolumn: 0,\n\t\t\t\t\t}))\n\t\t\t\t: undefined,\n\t\tduration: Date.now() - start,\n\t};\n}\n\n// ---------------------------------------------------------------------------\n// Human formatter\n// ---------------------------------------------------------------------------\n\n/**\n * Formats an InitDocsResult as human-readable text.\n * @internal\n */\nfunction formatInitDocsHuman(result: InitDocsResult): string {\n\tconst lines: string[] = [];\n\n\tif (!result.success) {\n\t\treturn \"\";\n\t}\n\n\tconst targetName = result.target.charAt(0).toUpperCase() + result.target.slice(1);\n\tlines.push(`\\n Scaffolding ${targetName} documentation site...\\n`);\n\n\tconst MAX_INLINE = 5;\n\tconst shown = result.files.slice(0, MAX_INLINE);\n\tconst remaining = result.files.length - shown.length;\n\n\tfor (const file of shown) {\n\t\tlines.push(` \\u2713 Created ${file}`);\n\t}\n\n\tif (remaining > 0) {\n\t\tlines.push(` ... (${remaining} more file${remaining !== 1 ? \"s\" : \"\"})`);\n\t}\n\n\tif (result.instructions.length > 0) {\n\t\tlines.push(\"\\n Next steps:\");\n\t\tresult.instructions.forEach((inst, idx) => {\n\t\t\tlines.push(` ${idx + 1}. ${inst}`);\n\t\t});\n\t}\n\n\tlines.push(\n\t\t`\\n ${result.summary.filesCreated} file${result.summary.filesCreated !== 1 ? \"s\" : \"\"} created for ${targetName} doc site.`,\n\t);\n\n\treturn lines.join(\"\\n\");\n}\n\n// ---------------------------------------------------------------------------\n// Citty command definition\n// ---------------------------------------------------------------------------\n\n/**\n * Citty command definition for `forge-ts init docs`.\n *\n * Scaffolds a complete documentation site for the target SSG platform.\n * Use `--json` for LAFS JSON envelope output (agent/CI-friendly).\n *\n * @example\n * ```typescript\n * import { initDocsCommand } from \"@forge-ts/cli/commands/init-docs\";\n * // Registered automatically as a subcommand of `forge-ts init`\n * ```\n * @public\n */\nexport const initDocsCommand = defineCommand({\n\tmeta: {\n\t\tname: \"docs\",\n\t\tdescription: \"Scaffold a documentation site\",\n\t},\n\targs: {\n\t\ttarget: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: `SSG target: ${getAvailableTargets().join(\", \")} (default: ${DEFAULT_TARGET})`,\n\t\t},\n\t\tcwd: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"Project root directory\",\n\t\t},\n\t\t\"out-dir\": {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"Output directory for doc site (default: ./docs)\",\n\t\t},\n\t\tforce: {\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Overwrite existing scaffold\",\n\t\t\tdefault: false,\n\t\t},\n\t\tjson: {\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Output as LAFS JSON envelope\",\n\t\t\tdefault: false,\n\t\t},\n\t\thuman: {\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Output as formatted text\",\n\t\t\tdefault: false,\n\t\t},\n\t\tquiet: {\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Suppress non-essential output\",\n\t\t\tdefault: false,\n\t\t},\n\t\tmvi: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"MVI verbosity level: minimal, standard, full\",\n\t\t},\n\t},\n\tasync run({ args }) {\n\t\tconst output = await runInitDocs({\n\t\t\ttarget: args.target,\n\t\t\tcwd: args.cwd,\n\t\t\toutDir: args[\"out-dir\"],\n\t\t\tforce: args.force,\n\t\t\tmvi: args.mvi,\n\t\t});\n\n\t\tconst flags: OutputFlags = {\n\t\t\tjson: args.json,\n\t\t\thuman: args.human,\n\t\t\tquiet: args.quiet,\n\t\t\tmvi: args.mvi,\n\t\t};\n\n\t\temitResult(output, flags, (data, cmd) => {\n\t\t\tif (!cmd.success) {\n\t\t\t\tconst logger = createLogger();\n\t\t\t\tconst msg = cmd.errors?.[0]?.message ?? \"Scaffold failed\";\n\t\t\t\tlogger.error(msg);\n\t\t\t\treturn \"\";\n\t\t\t}\n\t\t\treturn formatInitDocsHuman(data);\n\t\t});\n\n\t\tprocess.exit(resolveExitCode(output));\n\t},\n});\n\n// ---------------------------------------------------------------------------\n// Parent \"init\" command that exposes `forge-ts init docs`\n// ---------------------------------------------------------------------------\n\n/**\n * Citty command definition for `forge-ts init`.\n *\n * Exposes subcommands for scaffolding project artefacts.\n *\n * @example\n * ```typescript\n * import { initCommand } from \"@forge-ts/cli/commands/init-docs\";\n * // Registered automatically as a subcommand of `forge-ts`\n * ```\n * @public\n */\nexport const initCommand = defineCommand({\n\tmeta: {\n\t\tname: \"init\",\n\t\tdescription: \"Scaffold project artefacts\",\n\t},\n\tsubCommands: {\n\t\tdocs: initDocsCommand,\n\t},\n});\n","import { loadConfig } from \"@forge-ts/core\";\nimport { doctest } from \"@forge-ts/doctest\";\nimport { defineCommand } from \"citty\";\nimport { type CommandOutput, emitResult, type OutputFlags, resolveExitCode } from \"../output.js\";\n\n/**\n * Arguments for the `test` command.\n * @internal\n */\nexport interface TestArgs {\n\t/** Project root directory (default: cwd). */\n\tcwd?: string;\n\t/** MVI verbosity level for structured output. */\n\tmvi?: string;\n}\n\n/**\n * A single test failure entry, included at standard and full MVI levels.\n * @public\n */\nexport interface TestFailure {\n\t/** Symbol name where the doctest failed. */\n\tsymbol: string;\n\t/** Absolute path to the source file. */\n\tfile: string;\n\t/** 1-based line number of the failing example. */\n\tline: number;\n\t/** Human-readable failure message. */\n\tmessage: string;\n}\n\n/**\n * Typed result for the `test` command.\n * @public\n */\nexport interface TestResult {\n\t/** Whether all doctests passed. */\n\tsuccess: boolean;\n\t/** Aggregate counts — always present regardless of MVI level. */\n\tsummary: {\n\t\t/** Number of passing doctests. */\n\t\tpassed: number;\n\t\t/** Number of failing doctests. */\n\t\tfailed: number;\n\t\t/** Total doctests run. */\n\t\ttotal: number;\n\t\t/** Wall-clock duration in milliseconds. */\n\t\tduration: number;\n\t};\n\t/** Per-failure details — present at standard and full MVI levels. */\n\tfailures?: TestFailure[];\n}\n\n// ---------------------------------------------------------------------------\n// Public API\n// ---------------------------------------------------------------------------\n\n/**\n * Runs the doctest pipeline and returns a typed command output.\n *\n * @param args - CLI arguments for the test command.\n * @returns A typed `CommandOutput<TestResult>`.\n * @example\n * ```typescript\n * import { runTest } from \"@forge-ts/cli/commands/test\";\n * const output = await runTest({ cwd: process.cwd() });\n * console.log(output.data.summary.passed); // number of passing doctests\n * ```\n * @public\n */\nexport async function runTest(args: TestArgs): Promise<CommandOutput<TestResult>> {\n\tconst config = await loadConfig(args.cwd);\n\tconst result = await doctest(config);\n\tconst mviLevel = args.mvi ?? \"standard\";\n\n\tconst failCount = result.errors.length;\n\tconst totalSymbols = result.symbols.length;\n\tconst passCount = totalSymbols - failCount > 0 ? totalSymbols - failCount : 0;\n\n\tconst summary = {\n\t\tpassed: passCount,\n\t\tfailed: failCount,\n\t\ttotal: totalSymbols,\n\t\tduration: result.duration,\n\t};\n\n\tconst data: TestResult = { success: result.success, summary };\n\n\tif (mviLevel !== \"minimal\") {\n\t\tdata.failures = result.errors.map((e) => ({\n\t\t\tsymbol: e.symbolName ?? \"\",\n\t\t\tfile: e.filePath ?? \"\",\n\t\t\tline: e.line,\n\t\t\tmessage: e.message,\n\t\t}));\n\t}\n\n\treturn {\n\t\toperation: \"test\",\n\t\tsuccess: result.success,\n\t\tdata,\n\t\tduration: result.duration,\n\t};\n}\n\n/**\n * Citty command definition for `forge-ts test`.\n * @public\n */\nexport const testCommand = defineCommand({\n\tmeta: {\n\t\tname: \"test\",\n\t\tdescription: \"Run @example blocks as doctests\",\n\t},\n\targs: {\n\t\tcwd: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"Project root directory\",\n\t\t},\n\t\tjson: {\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Output as LAFS JSON envelope (agent-friendly)\",\n\t\t\tdefault: false,\n\t\t},\n\t\thuman: {\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Output as formatted text (default for TTY)\",\n\t\t\tdefault: false,\n\t\t},\n\t\tquiet: {\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Suppress non-essential output\",\n\t\t\tdefault: false,\n\t\t},\n\t\tmvi: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"MVI verbosity level: minimal, standard, full\",\n\t\t},\n\t},\n\tasync run({ args }) {\n\t\tconst output = await runTest({ cwd: args.cwd, mvi: args.mvi });\n\n\t\tconst flags: OutputFlags = {\n\t\t\tjson: args.json,\n\t\t\thuman: args.human,\n\t\t\tquiet: args.quiet,\n\t\t\tmvi: args.mvi,\n\t\t};\n\n\t\temitResult(output, flags, (data) => {\n\t\t\tif (output.success) {\n\t\t\t\treturn `forge-ts test: all doctests passed. (${data.summary.duration}ms)`;\n\t\t\t}\n\t\t\tconst lines: string[] = [];\n\t\t\tfor (const f of data.failures ?? []) {\n\t\t\t\tlines.push(f.message);\n\t\t\t}\n\t\t\tlines.push(`forge-ts test: ${data.summary.failed} failure(s). (${data.summary.duration}ms)`);\n\t\t\treturn lines.join(\"\\n\");\n\t\t});\n\n\t\tprocess.exit(resolveExitCode(output));\n\t},\n});\n"],"mappings":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M,KAAK,kBAAkB,KAAK,QAAQ,MAAM,iBAAiB,KAAK,QAAQ,QAAQ,KAAK;AAC3F,aAAO,MAAM,KAAK,IAAI;AAAA,IACvB,CAAC;AAED,YAAQ,KAAK,gBAAgB,MAAM,CAAC;AAAA,EACrC;AACD,CAAC;;;AP5GD,IAAM,cAAcC,eAAc;AAAA,EACjC,MAAM;AAAA,IACL,MAAM;AAAA,IACN,aAAa;AAAA,EACd;AAAA,EACA,aAAa;AAAA,IACZ,MAAM;AAAA,IACN,KAAK;AAAA,EACN;AACD,CAAC;AAED,IAAM,OAAOA,eAAc;AAAA,EAC1B,MAAM;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aAAa;AAAA,EACd;AAAA,EACA,aAAa;AAAA,IACZ,OAAO;AAAA,IACP,MAAM;AAAA,IACN,OAAO;AAAA,IACP,MAAM;AAAA,EACP;AACD,CAAC;AAED,QAAQ,IAAI;","names":["defineCommand","loadConfig","defineCommand","loadConfig","defineCommand","loadConfig","defineCommand","loadConfig","defineCommand","join","resolve","loadConfig","DEFAULT_TARGET","getAdapter","defineCommand","DEFAULT_TARGET","getAdapter","loadConfig","resolve","join","defineCommand","loadConfig","defineCommand","loadConfig","defineCommand","defineCommand"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/commands/build.ts","../src/logger.ts","../src/output.ts","../src/commands/check.ts","../src/commands/docs-dev.ts","../src/commands/init-docs.ts","../src/commands/test.ts"],"sourcesContent":["/**\n * @forge-ts/cli — Command-line interface for the forge-ts toolchain.\n *\n * Usage:\n * forge-ts check [--cwd <dir>] [--strict] [--verbose]\n * forge-ts test [--cwd <dir>]\n * forge-ts build [--cwd <dir>] [--skip-api] [--skip-gen]\n * forge-ts docs init [--target <ssg>] [--out-dir <dir>] [--force]\n * forge-ts docs dev [--target <ssg>] [--port <port>]\n *\n * @packageDocumentation\n * @public\n */\n\nimport { createRequire } from \"node:module\";\nimport { defineCommand, runMain } from \"citty\";\nimport { buildCommand } from \"./commands/build.js\";\nimport { checkCommand } from \"./commands/check.js\";\nimport { docsDevCommand } from \"./commands/docs-dev.js\";\nimport { initDocsCommand } from \"./commands/init-docs.js\";\nimport { testCommand } from \"./commands/test.js\";\n\nconst require = createRequire(import.meta.url);\nconst pkg = require(\"../package.json\") as { version: string };\n\nexport { type BuildResult, type BuildStep, buildCommand } from \"./commands/build.js\";\nexport {\n\ttype CheckFileError,\n\ttype CheckFileGroup,\n\ttype CheckFileWarning,\n\ttype CheckResult,\n\tcheckCommand,\n} from \"./commands/check.js\";\nexport { docsDevCommand, runDocsDev } from \"./commands/docs-dev.js\";\nexport {\n\ttype InitDocsResult,\n\tinitDocsCommand,\n} from \"./commands/init-docs.js\";\nexport { type TestFailure, type TestResult, testCommand } from \"./commands/test.js\";\nexport { createLogger, type Logger } from \"./logger.js\";\nexport {\n\ttype CommandOutput,\n\temitResult,\n\ttype ForgeCliError,\n\ttype ForgeCliWarning,\n\ttype OutputFlags,\n\tresolveExitCode,\n} from \"./output.js\";\n\n/**\n * The `docs` parent command with `init` and `dev` subcommands.\n *\n * @example\n * ```typescript\n * // forge-ts docs init --target mintlify\n * // forge-ts docs dev\n * ```\n * @public\n */\nconst docsCommand = defineCommand({\n\tmeta: {\n\t\tname: \"docs\",\n\t\tdescription: \"Documentation site management\",\n\t},\n\tsubCommands: {\n\t\tinit: initDocsCommand,\n\t\tdev: docsDevCommand,\n\t},\n});\n\nconst main = defineCommand({\n\tmeta: {\n\t\tname: \"forge-ts\",\n\t\tversion: pkg.version,\n\t\tdescription: \"Universal TypeScript Documentation Compiler\",\n\t},\n\tsubCommands: {\n\t\tcheck: checkCommand,\n\t\ttest: testCommand,\n\t\tbuild: buildCommand,\n\t\tdocs: docsCommand,\n\t},\n});\n\nrunMain(main);\n","import { generateApi } from \"@forge-ts/api\";\nimport { loadConfig } from \"@forge-ts/core\";\nimport { generate } from \"@forge-ts/gen\";\nimport { defineCommand } from \"citty\";\nimport { createLogger } from \"../logger.js\";\nimport {\n\ttype CommandOutput,\n\temitResult,\n\ttype ForgeCliError,\n\ttype OutputFlags,\n\tresolveExitCode,\n} from \"../output.js\";\n\n/**\n * Arguments for the `build` command.\n * @internal\n */\nexport interface BuildArgs {\n\t/** Project root directory (default: cwd). */\n\tcwd?: string;\n\t/** Skip API generation even if enabled in config. */\n\tskipApi?: boolean;\n\t/** Skip doc generation even if enabled in config. */\n\tskipGen?: boolean;\n\t/**\n\t * Overwrite stub pages even if they already exist on disk.\n\t * Normally stub pages (concepts, guides, faq, contributing, changelog)\n\t * are only created on the first build to preserve manual edits.\n\t * Use this to reset stubs to their scaffolding state.\n\t */\n\tforceStubs?: boolean;\n\t/** MVI verbosity level for structured output. */\n\tmvi?: string;\n}\n\n/**\n * A single step in the build pipeline.\n * @public\n */\nexport interface BuildStep {\n\t/** Internal step name, e.g. \"api\" or \"gen\". */\n\tname: string;\n\t/** Outcome of this step. */\n\tstatus: \"success\" | \"skipped\" | \"failed\";\n\t/** Path to the primary output file produced by this step, if applicable. */\n\toutputPath?: string;\n\t/** Wall-clock duration of this step in milliseconds. */\n\tduration?: number;\n\t/** Errors produced by this step when status is \"failed\". */\n\terrors?: ForgeCliError[];\n}\n\n/**\n * Typed result for the `build` command.\n * @public\n */\nexport interface BuildResult {\n\t/** Whether the build succeeded. */\n\tsuccess: boolean;\n\t/** Aggregate pipeline counts — always present. */\n\tsummary: {\n\t\t/** Total number of pipeline steps. */\n\t\tsteps: number;\n\t\t/** Steps that completed successfully. */\n\t\tsucceeded: number;\n\t\t/** Steps that failed. */\n\t\tfailed: number;\n\t\t/** Wall-clock duration in milliseconds. */\n\t\tduration: number;\n\t};\n\t/** Per-step details. */\n\tsteps: BuildStep[];\n\t/** Files written during the build — present at standard and full MVI levels. */\n\tgeneratedFiles?: string[];\n}\n\n// ---------------------------------------------------------------------------\n// Public API\n// ---------------------------------------------------------------------------\n\n/**\n * Runs the full build pipeline and returns a typed command output.\n *\n * @param args - CLI arguments for the build command.\n * @returns A typed `CommandOutput<BuildResult>`.\n * @example\n * ```typescript\n * import { runBuild } from \"@forge-ts/cli/commands/build\";\n * const output = await runBuild({ cwd: process.cwd() });\n * console.log(output.success); // true if all steps succeeded\n * ```\n * @public\n */\nexport async function runBuild(args: BuildArgs): Promise<CommandOutput<BuildResult>> {\n\tconst config = await loadConfig(args.cwd);\n\tconst buildStart = Date.now();\n\tconst mviLevel = args.mvi ?? \"standard\";\n\n\tconst steps: BuildStep[] = [];\n\tconst allErrors: ForgeCliError[] = [];\n\tconst generatedFiles: string[] = [];\n\tlet success = true;\n\n\tif (config.api.enabled && !args.skipApi) {\n\t\tconst result = await generateApi(config);\n\t\tif (!result.success) {\n\t\t\tconst errors: ForgeCliError[] = result.errors.map((e) => ({\n\t\t\t\tcode: e.code,\n\t\t\t\tmessage: e.message,\n\t\t\t\tfilePath: e.filePath,\n\t\t\t\tline: e.line,\n\t\t\t\tcolumn: e.column,\n\t\t\t}));\n\t\t\tallErrors.push(...errors);\n\t\t\tsuccess = false;\n\t\t\tsteps.push({\n\t\t\t\tname: \"api\",\n\t\t\t\tstatus: \"failed\",\n\t\t\t\toutputPath: config.api.openapiPath,\n\t\t\t\tduration: result.duration,\n\t\t\t\terrors,\n\t\t\t});\n\t\t} else {\n\t\t\tsteps.push({\n\t\t\t\tname: \"api\",\n\t\t\t\tstatus: \"success\",\n\t\t\t\toutputPath: config.api.openapiPath,\n\t\t\t\tduration: result.duration,\n\t\t\t});\n\t\t\tgeneratedFiles.push(config.api.openapiPath);\n\t\t}\n\t} else if (!config.api.enabled || args.skipApi) {\n\t\tsteps.push({ name: \"api\", status: \"skipped\" });\n\t}\n\n\tif (config.gen.enabled && !args.skipGen) {\n\t\tconst result = await generate(config, { forceStubs: args.forceStubs });\n\t\tif (!result.success) {\n\t\t\tconst errors: ForgeCliError[] = result.errors.map((e) => ({\n\t\t\t\tcode: e.code,\n\t\t\t\tmessage: e.message,\n\t\t\t\tfilePath: e.filePath,\n\t\t\t\tline: e.line,\n\t\t\t\tcolumn: e.column,\n\t\t\t}));\n\t\t\tallErrors.push(...errors);\n\t\t\tsuccess = false;\n\t\t\tsteps.push({\n\t\t\t\tname: \"gen\",\n\t\t\t\tstatus: \"failed\",\n\t\t\t\tduration: result.duration,\n\t\t\t\terrors,\n\t\t\t});\n\t\t} else {\n\t\t\tsteps.push({\n\t\t\t\tname: \"gen\",\n\t\t\t\tstatus: \"success\",\n\t\t\t\tduration: result.duration,\n\t\t\t});\n\t\t\tif (result.writtenFiles) {\n\t\t\t\tgeneratedFiles.push(...result.writtenFiles);\n\t\t\t}\n\t\t}\n\t} else if (!config.gen.enabled || args.skipGen) {\n\t\tsteps.push({ name: \"gen\", status: \"skipped\" });\n\t}\n\n\tconst totalMs = Date.now() - buildStart;\n\n\tconst succeededCount = steps.filter((s) => s.status === \"success\").length;\n\tconst failedCount = steps.filter((s) => s.status === \"failed\").length;\n\n\tconst data: BuildResult = {\n\t\tsuccess,\n\t\tsummary: {\n\t\t\tsteps: steps.length,\n\t\t\tsucceeded: succeededCount,\n\t\t\tfailed: failedCount,\n\t\t\tduration: totalMs,\n\t\t},\n\t\tsteps,\n\t};\n\n\tif (mviLevel !== \"minimal\") {\n\t\tdata.generatedFiles = generatedFiles;\n\t}\n\n\treturn {\n\t\toperation: \"build\",\n\t\tsuccess,\n\t\tdata,\n\t\terrors: allErrors,\n\t\tduration: totalMs,\n\t};\n}\n\n/**\n * Citty command definition for `forge-ts build`.\n * @public\n */\nexport const buildCommand = defineCommand({\n\tmeta: {\n\t\tname: \"build\",\n\t\tdescription: \"Generate API reference and documentation\",\n\t},\n\targs: {\n\t\tcwd: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"Project root directory\",\n\t\t},\n\t\t\"skip-api\": {\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Skip OpenAPI generation\",\n\t\t\tdefault: false,\n\t\t},\n\t\t\"skip-gen\": {\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Skip doc generation\",\n\t\t\tdefault: false,\n\t\t},\n\t\t\"force-stubs\": {\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Overwrite stub pages even if they exist (reset to scaffolding)\",\n\t\t\tdefault: false,\n\t\t},\n\t\tjson: {\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Output as LAFS JSON envelope (agent-friendly)\",\n\t\t\tdefault: false,\n\t\t},\n\t\thuman: {\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Output as formatted text (default for TTY)\",\n\t\t\tdefault: false,\n\t\t},\n\t\tquiet: {\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Suppress non-essential output\",\n\t\t\tdefault: false,\n\t\t},\n\t\tmvi: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"MVI verbosity level: minimal, standard, full\",\n\t\t},\n\t},\n\tasync run({ args }) {\n\t\tconst output = await runBuild({\n\t\t\tcwd: args.cwd,\n\t\t\tskipApi: args[\"skip-api\"],\n\t\t\tskipGen: args[\"skip-gen\"],\n\t\t\tforceStubs: args[\"force-stubs\"],\n\t\t\tmvi: args.mvi,\n\t\t});\n\n\t\tconst flags: OutputFlags = {\n\t\t\tjson: args.json,\n\t\t\thuman: args.human,\n\t\t\tquiet: args.quiet,\n\t\t\tmvi: args.mvi,\n\t\t};\n\n\t\temitResult(output, flags, (data) => {\n\t\t\tconst logger = createLogger();\n\t\t\tfor (const step of data.steps) {\n\t\t\t\tif (step.status === \"failed\") {\n\t\t\t\t\tfor (const err of step.errors ?? []) {\n\t\t\t\t\t\tlogger.error(`[${step.name}] ${err.message}`);\n\t\t\t\t\t}\n\t\t\t\t} else if (step.status === \"success\") {\n\t\t\t\t\tconst detail =\n\t\t\t\t\t\tstep.name === \"api\" && step.outputPath != null\n\t\t\t\t\t\t\t? `Generated OpenAPI spec \\u2192 ${step.outputPath}`\n\t\t\t\t\t\t\t: `Step complete`;\n\t\t\t\t\tlogger.step(step.name.toUpperCase(), detail, step.duration);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (output.success) {\n\t\t\t\treturn ` Done in ${data.summary.duration}ms`;\n\t\t\t}\n\t\t\treturn \"\";\n\t\t});\n\n\t\tprocess.exit(resolveExitCode(output));\n\t},\n});\n","/**\n * Simple TTY-aware logger for forge-ts CLI output.\n *\n * Uses ANSI escape codes directly — no external colour library.\n *\n * @packageDocumentation\n * @internal\n */\n\n// ---------------------------------------------------------------------------\n// ANSI constants\n// ---------------------------------------------------------------------------\n\nconst GREEN = \"\\x1b[32m\";\nconst YELLOW = \"\\x1b[33m\";\nconst RED = \"\\x1b[31m\";\nconst BOLD = \"\\x1b[1m\";\nconst RESET = \"\\x1b[0m\";\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\n/**\n * A minimal structured logger used throughout the CLI commands.\n * @internal\n */\nexport interface Logger {\n\t/** Print an informational message. */\n\tinfo(msg: string): void;\n\t/** Print a success message (green ✓ prefix when colours are on). */\n\tsuccess(msg: string): void;\n\t/** Print a warning message (yellow prefix when colours are on). */\n\twarn(msg: string): void;\n\t/** Print an error message (red ✗ prefix when colours are on). */\n\terror(msg: string): void;\n\t/**\n\t * Print a build-step line.\n\t *\n\t * @param label - Short category label (e.g. \"API\", \"Gen\").\n\t * @param detail - Description of what was produced.\n\t * @param duration - Optional wall-clock time in milliseconds.\n\t */\n\tstep(label: string, detail: string, duration?: number): void;\n}\n\n// ---------------------------------------------------------------------------\n// Implementation\n// ---------------------------------------------------------------------------\n\n/**\n * Creates a {@link Logger} instance.\n *\n * @param options - Optional configuration.\n * @param options.colors - Emit ANSI colour codes. Defaults to `process.stdout.isTTY`.\n * @returns A configured logger.\n * @internal\n */\nexport function createLogger(options?: { colors?: boolean }): Logger {\n\tconst useColors = options?.colors ?? process.stdout.isTTY ?? false;\n\n\tfunction colorize(text: string, code: string): string {\n\t\treturn useColors ? `${code}${text}${RESET}` : text;\n\t}\n\n\tfunction bold(text: string): string {\n\t\treturn useColors ? `${BOLD}${text}${RESET}` : text;\n\t}\n\n\treturn {\n\t\tinfo(msg: string): void {\n\t\t\tconsole.log(msg);\n\t\t},\n\n\t\tsuccess(msg: string): void {\n\t\t\tconst prefix = colorize(\"✓\", GREEN);\n\t\t\tconsole.log(`${prefix} ${msg}`);\n\t\t},\n\n\t\twarn(msg: string): void {\n\t\t\tconst prefix = colorize(\"warn\", YELLOW);\n\t\t\tconsole.warn(`${bold(prefix)} ${msg}`);\n\t\t},\n\n\t\terror(msg: string): void {\n\t\t\tconst prefix = colorize(\"error\", RED);\n\t\t\tconsole.error(`${bold(prefix)} ${msg}`);\n\t\t},\n\n\t\tstep(label: string, detail: string, duration?: number): void {\n\t\t\tconst check = colorize(\"✓\", GREEN);\n\t\t\tconst durationStr = duration !== undefined ? ` (${duration}ms)` : \"\";\n\t\t\tconsole.log(` ${check} ${bold(label)}: ${detail}${durationStr}`);\n\t\t},\n\t};\n}\n","/**\n * Central output layer for forge-ts CLI.\n *\n * Wraps all command results in LAFS envelopes for agent-first output, while\n * preserving human-readable formatting for TTY consumers.\n *\n * @packageDocumentation\n * @internal\n */\n\nimport { randomUUID } from \"node:crypto\";\nimport {\n\tcreateEnvelope,\n\ttype MVILevel,\n\tresolveFlags,\n\ttype UnifiedFlagInput,\n} from \"@cleocode/lafs-protocol\";\n\n// ---------------------------------------------------------------------------\n// Public types\n// ---------------------------------------------------------------------------\n\n/** Typed result from a forge-ts command. */\nexport interface CommandOutput<T> {\n\t/** Name of the command that produced this output (e.g., \"check\", \"build\"). */\n\toperation: string;\n\t/** Whether the command completed successfully. */\n\tsuccess: boolean;\n\t/** Strongly-typed command-specific result payload. */\n\tdata: T;\n\t/** Structured errors produced by the command, if any. */\n\terrors?: ForgeCliError[];\n\t/** Structured warnings produced by the command, if any. */\n\twarnings?: ForgeCliWarning[];\n\t/** Wall-clock duration of the command in milliseconds. */\n\tduration?: number;\n}\n\n/** Structured error for CLI commands. */\nexport interface ForgeCliError {\n\t/** Machine-readable error code (e.g., \"E004\"). */\n\tcode: string;\n\t/** Human-readable error description. */\n\tmessage: string;\n\t/** Absolute path to the source file containing the error, if applicable. */\n\tfilePath?: string;\n\t/** 1-based line number of the error, if applicable. */\n\tline?: number;\n\t/** 0-based column number of the error, if applicable. */\n\tcolumn?: number;\n}\n\n/** Structured warning for CLI commands. */\nexport interface ForgeCliWarning {\n\t/** Machine-readable warning code. */\n\tcode: string;\n\t/** Human-readable warning description. */\n\tmessage: string;\n\t/** Absolute path to the source file containing the warning, if applicable. */\n\tfilePath?: string;\n\t/** 1-based line number of the warning, if applicable. */\n\tline?: number;\n\t/** 0-based column number of the warning, if applicable. */\n\tcolumn?: number;\n}\n\n/** Output format flags passed through from citty args. */\nexport interface OutputFlags {\n\t/** Emit output as a LAFS JSON envelope instead of human-readable text. */\n\tjson?: boolean;\n\t/** Emit output as formatted human-readable text. */\n\thuman?: boolean;\n\t/** Suppress all output regardless of format. */\n\tquiet?: boolean;\n\t/** MVI verbosity level: \"minimal\", \"standard\", or \"full\". */\n\tmvi?: string;\n}\n\n// ---------------------------------------------------------------------------\n// emitResult\n// ---------------------------------------------------------------------------\n\n/**\n * Wraps a command result in a LAFS envelope and emits it.\n *\n * Output format is determined by LAFS flag resolution:\n * - TTY terminals default to human-readable output.\n * - Non-TTY (piped, CI, agents) defaults to JSON.\n * - Explicit `--json` or `--human` flags always take precedence.\n *\n * On failure, the full result is included alongside the error so agents\n * get actionable data (e.g., suggestedFix) in a single response.\n *\n * @param output - Typed result from the command.\n * @param flags - Output format flags from citty args.\n * @param humanFormatter - Produces a human-readable string for TTY consumers.\n * @example\n * ```typescript\n * import { emitResult } from \"@forge-ts/cli/output\";\n * emitResult(output, { human: true }, (data) => `Done: ${data.summary.duration}ms`);\n * ```\n * @internal\n */\nexport function emitResult<T>(\n\toutput: CommandOutput<T>,\n\tflags: OutputFlags,\n\thumanFormatter: (data: T, output: CommandOutput<T>) => string,\n): void {\n\tconst flagInput: UnifiedFlagInput = {\n\t\tjson: flags.json,\n\t\thuman: flags.human,\n\t\tquiet: flags.quiet,\n\t\tmvi: flags.mvi,\n\t\t// LAFS 1.8.0: TTY detection drives the default format.\n\t\t// Terminals get human output, pipes/agents get JSON.\n\t\ttty: process.stdout.isTTY ?? false,\n\t};\n\n\tconst resolved = resolveFlags(flagInput);\n\tconst format = resolved.format.format;\n\tconst quiet = resolved.format.quiet;\n\n\tif (quiet) {\n\t\treturn;\n\t}\n\n\tconst meta = {\n\t\toperation: `forge-ts.${output.operation}`,\n\t\trequestId: randomUUID(),\n\t\ttransport: \"cli\" as const,\n\t\tmvi: (flags.mvi as MVILevel) ?? \"full\",\n\t};\n\n\t// LAFS 1.8.0: result is included on error envelopes so agents get\n\t// actionable data (byFile, suggestedFix) alongside error metadata.\n\tconst envelope = output.success\n\t\t? createEnvelope({\n\t\t\t\tsuccess: true,\n\t\t\t\tresult: output.data as Record<string, unknown>,\n\t\t\t\tmeta,\n\t\t\t})\n\t\t: createEnvelope({\n\t\t\t\tsuccess: false,\n\t\t\t\tresult: output.data as Record<string, unknown>,\n\t\t\t\terror: {\n\t\t\t\t\tcode: output.errors?.[0]?.code ?? \"FORGE_CHECK_FAILED\",\n\t\t\t\t\tmessage: output.errors?.[0]?.message ?? \"Check failed — see result for actionable fixes\",\n\t\t\t\t\tcategory: \"VALIDATION\",\n\t\t\t\t\tretryable: true,\n\t\t\t\t\tretryAfterMs: null,\n\t\t\t\t},\n\t\t\t\tmeta,\n\t\t\t});\n\n\tif (format === \"json\") {\n\t\tprocess.stdout.write(`${JSON.stringify(envelope, null, 2)}\\n`);\n\t} else {\n\t\tconst formatted = humanFormatter(output.data, output);\n\t\tif (formatted) {\n\t\t\tconsole.log(formatted);\n\t\t}\n\t}\n}\n\n// ---------------------------------------------------------------------------\n// resolveExitCode\n// ---------------------------------------------------------------------------\n\n/**\n * Returns the LAFS-compliant exit code for a command output.\n *\n * @param output - Typed result from the command.\n * @returns `0` on success, `1` on validation/check failure.\n * @internal\n */\nexport function resolveExitCode(output: CommandOutput<unknown>): number {\n\tif (output.success) return 0;\n\treturn 1;\n}\n","import { type ForgeError, type ForgeWarning, loadConfig } from \"@forge-ts/core\";\nimport { enforce } from \"@forge-ts/enforcer\";\nimport { defineCommand } from \"citty\";\nimport { type CommandOutput, emitResult, type OutputFlags, resolveExitCode } from \"../output.js\";\n\n/**\n * Arguments for the `check` command.\n * @internal\n */\nexport interface CheckArgs {\n\t/** Project root directory (default: cwd). */\n\tcwd?: string;\n\t/** Exit with non-zero code on warnings as well as errors. */\n\tstrict?: boolean;\n\t/** Include symbol signatures alongside diagnostics. */\n\tverbose?: boolean;\n\t/** MVI verbosity level for structured output. */\n\tmvi?: string;\n}\n\n/**\n * A single error entry within a file group, included at standard and full MVI levels.\n * @public\n */\nexport interface CheckFileError {\n\t/** Machine-readable error code. */\n\tcode: string;\n\t/** Symbol name that needs fixing. */\n\tsymbol: string;\n\t/** Symbol kind (function, class, interface, etc.). */\n\tkind: string;\n\t/** 1-based line number of the error. */\n\tline: number;\n\t/** Human-readable description. */\n\tmessage: string;\n\t/** Exact TSDoc block to add (full MVI level only). */\n\tsuggestedFix?: string;\n\t/** Recommended agent action (full MVI level only). */\n\tagentAction?: string;\n}\n\n/**\n * A single warning entry within a file group, included at standard and full MVI levels.\n * @public\n */\nexport interface CheckFileWarning {\n\t/** Machine-readable warning code. */\n\tcode: string;\n\t/** Symbol name that generated the warning. */\n\tsymbol: string;\n\t/** Symbol kind (function, class, interface, etc.). */\n\tkind: string;\n\t/** 1-based line number of the warning. */\n\tline: number;\n\t/** Human-readable description. */\n\tmessage: string;\n}\n\n/**\n * Errors and warnings grouped by file, included at standard and full MVI levels.\n * @public\n */\nexport interface CheckFileGroup {\n\t/** Absolute path to the source file. */\n\tfile: string;\n\t/** Errors in this file. */\n\terrors: CheckFileError[];\n\t/** Warnings in this file. */\n\twarnings: CheckFileWarning[];\n}\n\n/**\n * Typed result for the `check` command.\n * @public\n */\nexport interface CheckResult {\n\t/** Whether the check passed without errors. */\n\tsuccess: boolean;\n\t/** Aggregate counts — always present regardless of MVI level. */\n\tsummary: {\n\t\t/** Total number of errors. */\n\t\terrors: number;\n\t\t/** Total number of warnings. */\n\t\twarnings: number;\n\t\t/** Number of unique files with diagnostics. */\n\t\tfiles: number;\n\t\t/** Number of exported symbols checked. */\n\t\tsymbols: number;\n\t\t/** Wall-clock duration in milliseconds. */\n\t\tduration: number;\n\t};\n\t/** Per-file breakdown — present at standard and full MVI levels. */\n\tbyFile?: CheckFileGroup[];\n}\n\n// ---------------------------------------------------------------------------\n// Internal helpers\n// ---------------------------------------------------------------------------\n\n/**\n * Determines the recommended agent action given a ForgeError.\n * @internal\n */\nfunction resolveAgentAction(_error: ForgeError): string {\n\treturn \"retry_modified\";\n}\n\n/**\n * Groups errors and warnings by file path.\n * @internal\n */\nfunction groupByFile(\n\terrors: ForgeError[],\n\twarnings: ForgeWarning[],\n\tincludeFix: boolean,\n): CheckFileGroup[] {\n\tconst fileMap = new Map<string, CheckFileGroup>();\n\n\tfor (const e of errors) {\n\t\tconst fp = e.filePath ?? \"\";\n\t\tif (!fileMap.has(fp)) {\n\t\t\tfileMap.set(fp, { file: fp, errors: [], warnings: [] });\n\t\t}\n\t\tconst entry: CheckFileError = {\n\t\t\tcode: e.code,\n\t\t\tsymbol: e.symbolName ?? \"\",\n\t\t\tkind: e.symbolKind ?? \"\",\n\t\t\tline: e.line,\n\t\t\tmessage: e.message,\n\t\t};\n\t\tif (includeFix) {\n\t\t\tif (e.suggestedFix !== undefined) {\n\t\t\t\tentry.suggestedFix = e.suggestedFix;\n\t\t\t}\n\t\t\tentry.agentAction = resolveAgentAction(e);\n\t\t}\n\t\tfileMap.get(fp)?.errors.push(entry);\n\t}\n\n\tfor (const w of warnings) {\n\t\tconst fp = w.filePath ?? \"\";\n\t\tif (!fileMap.has(fp)) {\n\t\t\tfileMap.set(fp, { file: fp, errors: [], warnings: [] });\n\t\t}\n\t\tfileMap.get(fp)?.warnings.push({\n\t\t\tcode: w.code,\n\t\t\tsymbol: \"\",\n\t\t\tkind: \"\",\n\t\t\tline: w.line,\n\t\t\tmessage: w.message,\n\t\t});\n\t}\n\n\treturn Array.from(fileMap.values());\n}\n\n/**\n * Builds an MVI-projected CheckResult from raw enforcer output.\n * @internal\n */\nfunction buildCheckResult(\n\trawErrors: ForgeError[],\n\trawWarnings: ForgeWarning[],\n\t_symbolCount: number,\n\texportedSymbolCount: number,\n\tduration: number,\n\tsuccess: boolean,\n\tmviLevel: string,\n): CheckResult {\n\tconst uniqueFiles = new Set([\n\t\t...rawErrors.map((e) => e.filePath),\n\t\t...rawWarnings.map((w) => w.filePath),\n\t]);\n\n\tconst summary = {\n\t\terrors: rawErrors.length,\n\t\twarnings: rawWarnings.length,\n\t\tfiles: uniqueFiles.size,\n\t\tsymbols: exportedSymbolCount,\n\t\tduration,\n\t};\n\n\tif (mviLevel === \"minimal\") {\n\t\treturn { success, summary };\n\t}\n\n\t// Always include suggestedFix — actionable output shouldn't require extra flags.\n\t// MVI \"minimal\" omits byFile entirely (summary only).\n\t// MVI \"standard\" and \"full\" both include suggestedFix for every error.\n\tconst byFile = groupByFile(rawErrors, rawWarnings, mviLevel !== \"minimal\");\n\treturn { success, summary, byFile };\n}\n\n// ---------------------------------------------------------------------------\n// Public API\n// ---------------------------------------------------------------------------\n\n/**\n * Runs the TSDoc enforcement pass and returns a typed command output.\n *\n * @param args - CLI arguments for the check command.\n * @returns A typed `CommandOutput<CheckResult>`.\n * @example\n * ```typescript\n * import { runCheck } from \"@forge-ts/cli/commands/check\";\n * const output = await runCheck({ cwd: process.cwd() });\n * console.log(output.data.summary.errors); // number of TSDoc errors found\n * ```\n * @public\n */\nexport async function runCheck(args: CheckArgs): Promise<CommandOutput<CheckResult>> {\n\tconst config = await loadConfig(args.cwd);\n\tif (args.strict !== undefined) {\n\t\tconfig.enforce.strict = args.strict;\n\t}\n\n\tconst result = await enforce(config);\n\t// Default to \"full\" MVI so suggestedFix is always included in JSON output.\n\t// Agents need actionable fixes, not just error descriptions.\n\tconst mviLevel = args.mvi ?? \"full\";\n\n\tconst exportedSymbolCount = result.symbols.filter((s) => s.exported).length;\n\n\tconst data = buildCheckResult(\n\t\tresult.errors,\n\t\tresult.warnings,\n\t\tresult.symbols.length,\n\t\texportedSymbolCount,\n\t\tresult.duration,\n\t\tresult.success,\n\t\tmviLevel,\n\t);\n\n\t// Populate top-level errors so the LAFS envelope error code is actionable.\n\tconst cliErrors = result.success\n\t\t? undefined\n\t\t: [\n\t\t\t\t{\n\t\t\t\t\tcode: \"FORGE_CHECK_FAILED\",\n\t\t\t\t\tmessage: `TSDoc coverage check failed: ${result.errors.length} error(s), ${result.warnings.length} warning(s) across ${data.summary.files} file(s)`,\n\t\t\t\t},\n\t\t\t];\n\n\treturn {\n\t\toperation: \"check\",\n\t\tsuccess: result.success,\n\t\tdata,\n\t\terrors: cliErrors,\n\t\tduration: result.duration,\n\t};\n}\n\n// ---------------------------------------------------------------------------\n// Human formatter\n// ---------------------------------------------------------------------------\n\n/**\n * Formats a CheckResult as human-readable, actionable text.\n *\n * Every error includes the exact TSDoc block to add (suggestedFix).\n * The agent or human can read the output and know exactly what to do\n * without needing additional flags or a second pass.\n *\n * @internal\n */\nfunction formatCheckHuman(result: CheckResult): string {\n\tconst lines: string[] = [];\n\n\tif (result.success) {\n\t\tlines.push(\n\t\t\t`forge-ts check: OK (${result.summary.symbols} symbol(s) checked, ${result.summary.duration}ms)`,\n\t\t);\n\t\treturn lines.join(\"\\n\");\n\t}\n\n\tlines.push(\"forge-ts check: FAILED\\n\");\n\tlines.push(\n\t\t` ${result.summary.errors} error(s), ${result.summary.warnings} warning(s) across ${result.summary.files} file(s) (${result.summary.symbols} symbols checked)\\n`,\n\t);\n\n\tif (result.byFile && result.byFile.length > 0) {\n\t\tfor (const group of result.byFile) {\n\t\t\tif (group.errors.length > 0) {\n\t\t\t\tlines.push(` ${group.file} (${group.errors.length} error(s)):`);\n\t\t\t\tfor (const err of group.errors) {\n\t\t\t\t\tconst symbolPart = err.symbol\n\t\t\t\t\t\t? `${err.symbol} (${err.kind}:${err.line})`\n\t\t\t\t\t\t: `line ${err.line}`;\n\t\t\t\t\tlines.push(` ${err.code} ${symbolPart} — ${err.message}`);\n\t\t\t\t\t// Show the exact fix — actionable, not just informational\n\t\t\t\t\tif (err.suggestedFix) {\n\t\t\t\t\t\tfor (const fixLine of err.suggestedFix.split(\"\\n\")) {\n\t\t\t\t\t\t\tlines.push(` ${fixLine}`);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (group.warnings.length > 0) {\n\t\t\t\tlines.push(` ${group.file} (${group.warnings.length} warning(s)):`);\n\t\t\t\tfor (const w of group.warnings) {\n\t\t\t\t\tlines.push(` ${w.code} line ${w.line} — ${w.message}`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn lines.join(\"\\n\");\n}\n\n/**\n * Citty command definition for `forge-ts check`.\n * @public\n */\nexport const checkCommand = defineCommand({\n\tmeta: {\n\t\tname: \"check\",\n\t\tdescription: \"Lint TSDoc coverage on exported symbols\",\n\t},\n\targs: {\n\t\tcwd: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"Project root directory\",\n\t\t},\n\t\tstrict: {\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Treat warnings as errors\",\n\t\t\tdefault: false,\n\t\t},\n\t\tverbose: {\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Show detailed output\",\n\t\t\tdefault: false,\n\t\t},\n\t\tjson: {\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Output as LAFS JSON envelope (agent-friendly)\",\n\t\t\tdefault: false,\n\t\t},\n\t\thuman: {\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Output as formatted text (default for TTY)\",\n\t\t\tdefault: false,\n\t\t},\n\t\tquiet: {\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Suppress non-essential output\",\n\t\t\tdefault: false,\n\t\t},\n\t\tmvi: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"MVI verbosity level: minimal, standard, full\",\n\t\t},\n\t},\n\tasync run({ args }) {\n\t\tconst output = await runCheck({\n\t\t\tcwd: args.cwd,\n\t\t\tstrict: args.strict,\n\t\t\tverbose: args.verbose,\n\t\t\tmvi: args.mvi,\n\t\t});\n\n\t\tconst flags: OutputFlags = {\n\t\t\tjson: args.json,\n\t\t\thuman: args.human,\n\t\t\tquiet: args.quiet,\n\t\t\tmvi: args.mvi,\n\t\t};\n\n\t\temitResult(output, flags, (data) => formatCheckHuman(data));\n\n\t\tprocess.exit(resolveExitCode(output));\n\t},\n});\n","/**\n * The `forge-ts docs dev` command — starts a local doc preview server.\n *\n * Reads the ssgTarget from forge-ts config, looks up the adapter,\n * and spawns the correct dev server automatically.\n *\n * @packageDocumentation\n * @public\n */\n\nimport { spawn } from \"node:child_process\";\nimport { resolve } from \"node:path\";\nimport { loadConfig } from \"@forge-ts/core\";\nimport { DEFAULT_TARGET, getAdapter, type SSGTarget } from \"@forge-ts/gen\";\nimport { defineCommand } from \"citty\";\nimport { createLogger } from \"../logger.js\";\n\n/**\n * Starts the local dev server for the configured SSG target.\n *\n * Reads `gen.ssgTarget` from the forge-ts config, resolves the adapter,\n * and spawns the platform's dev server in the output directory.\n *\n * @param args - Command arguments.\n * @returns A promise that resolves when the server exits.\n *\n * @example\n * ```typescript\n * import { runDocsDev } from \"@forge-ts/cli\";\n * await runDocsDev({ cwd: \"./my-project\" });\n * ```\n * @public\n */\nexport async function runDocsDev(args: {\n\t/** Project root directory. */\n\tcwd?: string;\n\t/** Override the SSG target from config. */\n\ttarget?: string;\n\t/** Port to run the dev server on. */\n\tport?: string;\n}): Promise<void> {\n\tconst logger = createLogger();\n\tconst config = await loadConfig(args.cwd);\n\tconst target = (args.target ?? config.gen.ssgTarget ?? DEFAULT_TARGET) as SSGTarget;\n\tconst adapter = getAdapter(target);\n\tconst outDir = resolve(config.outDir);\n\tconst devCmd = adapter.getDevCommand(outDir);\n\n\tlogger.info(`Starting ${devCmd.label}...`);\n\tlogger.info(` Target: ${target}`);\n\tlogger.info(` Directory: ${outDir}`);\n\tlogger.info(` URL: ${devCmd.url}`);\n\tlogger.info(\"\");\n\n\tconst spawnArgs = [...devCmd.args];\n\tif (args.port) {\n\t\tspawnArgs.push(\"--port\", args.port);\n\t}\n\n\tconst proc = spawn(devCmd.bin, spawnArgs, {\n\t\tcwd: devCmd.cwd,\n\t\tstdio: \"inherit\",\n\t\tshell: true,\n\t});\n\n\treturn new Promise<void>((_resolve, reject) => {\n\t\tproc.on(\"close\", (code) => {\n\t\t\tif (code === 0) {\n\t\t\t\t_resolve();\n\t\t\t} else {\n\t\t\t\treject(new Error(`${devCmd.label} exited with code ${code}`));\n\t\t\t}\n\t\t});\n\t\tproc.on(\"error\", reject);\n\t});\n}\n\n/**\n * Citty command definition for `forge-ts docs dev`.\n *\n * @example\n * ```typescript\n * import { docsDevCommand } from \"@forge-ts/cli\";\n * ```\n * @public\n */\nexport const docsDevCommand = defineCommand({\n\tmeta: {\n\t\tname: \"dev\",\n\t\tdescription: \"Start a local doc preview server\",\n\t},\n\targs: {\n\t\tcwd: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"Project root directory\",\n\t\t},\n\t\ttarget: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"SSG target override (reads from config by default)\",\n\t\t},\n\t\tport: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"Port for the dev server\",\n\t\t},\n\t},\n\tasync run({ args }) {\n\t\tawait runDocsDev(args);\n\t},\n});\n","import { mkdir, writeFile } from \"node:fs/promises\";\nimport { join, resolve } from \"node:path\";\nimport { loadConfig } from \"@forge-ts/core\";\nimport {\n\ttype AdapterContext,\n\tDEFAULT_TARGET,\n\tgetAdapter,\n\tgetAvailableTargets,\n\ttype SSGTarget,\n} from \"@forge-ts/gen\";\nimport { defineCommand } from \"citty\";\nimport { createLogger } from \"../logger.js\";\nimport {\n\ttype CommandOutput,\n\temitResult,\n\ttype ForgeCliError,\n\ttype OutputFlags,\n\tresolveExitCode,\n} from \"../output.js\";\n\n// ---------------------------------------------------------------------------\n// Public types\n// ---------------------------------------------------------------------------\n\n/**\n * Result of the `init docs` command.\n *\n * @example\n * ```typescript\n * import { runInitDocs } from \"@forge-ts/cli/commands/init-docs\";\n * const output = await runInitDocs({ target: \"mintlify\" });\n * console.log(output.data.summary.filesCreated); // number of files written\n * ```\n * @public\n */\nexport interface InitDocsResult {\n\t/** Whether the scaffold succeeded. */\n\tsuccess: boolean;\n\t/** The SSG target that was scaffolded. */\n\ttarget: SSGTarget;\n\t/** Summary of what was created. */\n\tsummary: {\n\t\t/** Number of files written to disk. */\n\t\tfilesCreated: number;\n\t\t/** Number of npm dependencies declared by the adapter. */\n\t\tdependencies: number;\n\t\t/** Number of package.json scripts declared by the adapter. */\n\t\tscripts: number;\n\t};\n\t/** Relative paths of all files created. */\n\tfiles: string[];\n\t/** Post-scaffold instructions for the user. */\n\tinstructions: string[];\n}\n\n/**\n * Arguments for the `init docs` command.\n * @internal\n */\nexport interface InitDocsArgs {\n\t/** SSG target to scaffold. Defaults to {@link DEFAULT_TARGET}. */\n\ttarget?: string;\n\t/** Project root directory (default: cwd). */\n\tcwd?: string;\n\t/** Output directory for the doc site (default: outDir from config or ./docs). */\n\toutDir?: string;\n\t/** Overwrite an existing scaffold without prompting. */\n\tforce?: boolean;\n\t/** MVI verbosity level for structured output. */\n\tmvi?: string;\n}\n\n// ---------------------------------------------------------------------------\n// Public API\n// ---------------------------------------------------------------------------\n\n/**\n * Scaffolds a documentation site for the target SSG platform.\n *\n * Resolves the target from args, validates it, checks for an existing\n * scaffold, calls the adapter's `scaffold()` method, and writes all files\n * produced by the manifest to `outDir`.\n *\n * @param args - CLI arguments for the init docs command.\n * @returns A typed `CommandOutput<InitDocsResult>`.\n * @example\n * ```typescript\n * import { runInitDocs } from \"@forge-ts/cli/commands/init-docs\";\n * const output = await runInitDocs({ target: \"mintlify\", cwd: process.cwd() });\n * console.log(output.data.files); // list of created file paths\n * ```\n * @public\n */\nexport async function runInitDocs(args: InitDocsArgs): Promise<CommandOutput<InitDocsResult>> {\n\tconst start = Date.now();\n\n\t// 1. Resolve target\n\tconst rawTarget = args.target ?? DEFAULT_TARGET;\n\tconst available = getAvailableTargets();\n\tif (!available.includes(rawTarget as SSGTarget)) {\n\t\tconst err: ForgeCliError = {\n\t\t\tcode: \"INIT_UNKNOWN_TARGET\",\n\t\t\tmessage: `Unknown SSG target \"${rawTarget}\". Available targets: ${available.join(\", \")}`,\n\t\t};\n\t\treturn {\n\t\t\toperation: \"init.docs\",\n\t\t\tsuccess: false,\n\t\t\tdata: {\n\t\t\t\tsuccess: false,\n\t\t\t\ttarget: DEFAULT_TARGET,\n\t\t\t\tsummary: { filesCreated: 0, dependencies: 0, scripts: 0 },\n\t\t\t\tfiles: [],\n\t\t\t\tinstructions: [],\n\t\t\t},\n\t\t\terrors: [err],\n\t\t\tduration: Date.now() - start,\n\t\t};\n\t}\n\n\tconst target = rawTarget as SSGTarget;\n\tconst adapter = getAdapter(target);\n\n\t// 2. Load config to resolve outDir\n\tconst config = await loadConfig(args.cwd);\n\tconst outDir = args.outDir ? resolve(args.outDir) : config.outDir;\n\n\t// 3. Safety check: detect existing scaffold\n\tconst alreadyExists = await adapter.detectExisting(outDir);\n\tif (alreadyExists && !args.force) {\n\t\tconst err: ForgeCliError = {\n\t\t\tcode: \"INIT_ALREADY_EXISTS\",\n\t\t\tmessage: `Docs already scaffolded for ${target}. Use --force to overwrite.`,\n\t\t};\n\t\treturn {\n\t\t\toperation: \"init.docs\",\n\t\t\tsuccess: false,\n\t\t\tdata: {\n\t\t\t\tsuccess: false,\n\t\t\t\ttarget,\n\t\t\t\tsummary: { filesCreated: 0, dependencies: 0, scripts: 0 },\n\t\t\t\tfiles: [],\n\t\t\t\tinstructions: [],\n\t\t\t},\n\t\t\terrors: [err],\n\t\t\tduration: Date.now() - start,\n\t\t};\n\t}\n\n\t// 4. Check for cross-target collision (any other adapter already scaffolded)\n\tconst warnings: Array<{ code: string; message: string }> = [];\n\tfor (const otherTarget of available) {\n\t\tif (otherTarget === target) continue;\n\t\tconst otherAdapter = getAdapter(otherTarget as SSGTarget);\n\t\tconst otherExists = await otherAdapter.detectExisting(outDir);\n\t\tif (otherExists) {\n\t\t\twarnings.push({\n\t\t\t\tcode: \"INIT_TARGET_MISMATCH\",\n\t\t\t\tmessage: `Existing scaffold detected for ${otherTarget} but scaffolding for ${target}. Remove conflicting files to avoid issues.`,\n\t\t\t});\n\t\t}\n\t}\n\n\t// 5. Build AdapterContext — use an empty pages/symbols array for init\n\tconst projectName = config.rootDir.split(\"/\").pop() ?? \"Project\";\n\tconst context: AdapterContext = {\n\t\tconfig,\n\t\tprojectName,\n\t\tpages: [],\n\t\tsymbols: [],\n\t\toutDir,\n\t};\n\n\t// 6. Call adapter.scaffold() to get the ScaffoldManifest\n\tconst manifest = adapter.scaffold(context);\n\n\t// 7. Write all files from the manifest\n\tconst writtenFiles: string[] = [];\n\tfor (const file of manifest.files) {\n\t\tconst filePath = join(outDir, file.path);\n\t\tconst fileDir = filePath.substring(0, filePath.lastIndexOf(\"/\"));\n\t\tawait mkdir(fileDir, { recursive: true });\n\t\tawait writeFile(filePath, file.content, \"utf8\");\n\t\twrittenFiles.push(file.path);\n\t}\n\n\tconst depCount =\n\t\tObject.keys(manifest.dependencies).length + Object.keys(manifest.devDependencies).length;\n\tconst scriptCount = Object.keys(manifest.scripts).length;\n\n\tconst data: InitDocsResult = {\n\t\tsuccess: true,\n\t\ttarget,\n\t\tsummary: {\n\t\t\tfilesCreated: writtenFiles.length,\n\t\t\tdependencies: depCount,\n\t\t\tscripts: scriptCount,\n\t\t},\n\t\tfiles: writtenFiles,\n\t\tinstructions: manifest.instructions,\n\t};\n\n\treturn {\n\t\toperation: \"init.docs\",\n\t\tsuccess: true,\n\t\tdata,\n\t\twarnings:\n\t\t\twarnings.length > 0\n\t\t\t\t? warnings.map((w) => ({\n\t\t\t\t\t\tcode: w.code,\n\t\t\t\t\t\tmessage: w.message,\n\t\t\t\t\t\tfilePath: \"\",\n\t\t\t\t\t\tline: 0,\n\t\t\t\t\t\tcolumn: 0,\n\t\t\t\t\t}))\n\t\t\t\t: undefined,\n\t\tduration: Date.now() - start,\n\t};\n}\n\n// ---------------------------------------------------------------------------\n// Human formatter\n// ---------------------------------------------------------------------------\n\n/**\n * Formats an InitDocsResult as human-readable text.\n * @internal\n */\nfunction formatInitDocsHuman(result: InitDocsResult): string {\n\tconst lines: string[] = [];\n\n\tif (!result.success) {\n\t\treturn \"\";\n\t}\n\n\tconst targetName = result.target.charAt(0).toUpperCase() + result.target.slice(1);\n\tlines.push(`\\n Scaffolding ${targetName} documentation site...\\n`);\n\n\tconst MAX_INLINE = 5;\n\tconst shown = result.files.slice(0, MAX_INLINE);\n\tconst remaining = result.files.length - shown.length;\n\n\tfor (const file of shown) {\n\t\tlines.push(` \\u2713 Created ${file}`);\n\t}\n\n\tif (remaining > 0) {\n\t\tlines.push(` ... (${remaining} more file${remaining !== 1 ? \"s\" : \"\"})`);\n\t}\n\n\tif (result.instructions.length > 0) {\n\t\tlines.push(\"\\n Next steps:\");\n\t\tresult.instructions.forEach((inst, idx) => {\n\t\t\tlines.push(` ${idx + 1}. ${inst}`);\n\t\t});\n\t}\n\n\tlines.push(\n\t\t`\\n ${result.summary.filesCreated} file${result.summary.filesCreated !== 1 ? \"s\" : \"\"} created for ${targetName} doc site.`,\n\t);\n\n\treturn lines.join(\"\\n\");\n}\n\n// ---------------------------------------------------------------------------\n// Citty command definition\n// ---------------------------------------------------------------------------\n\n/**\n * Citty command definition for `forge-ts init docs`.\n *\n * Scaffolds a complete documentation site for the target SSG platform.\n * Use `--json` for LAFS JSON envelope output (agent/CI-friendly).\n *\n * @example\n * ```typescript\n * import { initDocsCommand } from \"@forge-ts/cli/commands/init-docs\";\n * // Registered automatically as a subcommand of `forge-ts init`\n * ```\n * @public\n */\nexport const initDocsCommand = defineCommand({\n\tmeta: {\n\t\tname: \"init\",\n\t\tdescription: \"Scaffold a documentation site\",\n\t},\n\targs: {\n\t\ttarget: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: `SSG target: ${getAvailableTargets().join(\", \")} (default: ${DEFAULT_TARGET})`,\n\t\t},\n\t\tcwd: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"Project root directory\",\n\t\t},\n\t\t\"out-dir\": {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"Output directory for doc site (default: ./docs)\",\n\t\t},\n\t\tforce: {\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Overwrite existing scaffold\",\n\t\t\tdefault: false,\n\t\t},\n\t\tjson: {\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Output as LAFS JSON envelope\",\n\t\t\tdefault: false,\n\t\t},\n\t\thuman: {\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Output as formatted text\",\n\t\t\tdefault: false,\n\t\t},\n\t\tquiet: {\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Suppress non-essential output\",\n\t\t\tdefault: false,\n\t\t},\n\t\tmvi: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"MVI verbosity level: minimal, standard, full\",\n\t\t},\n\t},\n\tasync run({ args }) {\n\t\tconst output = await runInitDocs({\n\t\t\ttarget: args.target,\n\t\t\tcwd: args.cwd,\n\t\t\toutDir: args[\"out-dir\"],\n\t\t\tforce: args.force,\n\t\t\tmvi: args.mvi,\n\t\t});\n\n\t\tconst flags: OutputFlags = {\n\t\t\tjson: args.json,\n\t\t\thuman: args.human,\n\t\t\tquiet: args.quiet,\n\t\t\tmvi: args.mvi,\n\t\t};\n\n\t\temitResult(output, flags, (data, cmd) => {\n\t\t\tif (!cmd.success) {\n\t\t\t\tconst logger = createLogger();\n\t\t\t\tconst msg = cmd.errors?.[0]?.message ?? \"Scaffold failed\";\n\t\t\t\tlogger.error(msg);\n\t\t\t\treturn \"\";\n\t\t\t}\n\t\t\treturn formatInitDocsHuman(data);\n\t\t});\n\n\t\tprocess.exit(resolveExitCode(output));\n\t},\n});\n\n// ---------------------------------------------------------------------------\n// Parent \"init\" command that exposes `forge-ts init docs`\n// ---------------------------------------------------------------------------\n\n/**\n * Citty command definition for `forge-ts init`.\n *\n * Exposes subcommands for scaffolding project artefacts.\n *\n * @example\n * ```typescript\n * import { initCommand } from \"@forge-ts/cli/commands/init-docs\";\n * // Registered automatically as a subcommand of `forge-ts`\n * ```\n * @public\n */\nexport const initCommand = defineCommand({\n\tmeta: {\n\t\tname: \"init\",\n\t\tdescription: \"Scaffold project artefacts\",\n\t},\n\tsubCommands: {\n\t\tdocs: initDocsCommand,\n\t},\n});\n","import { loadConfig } from \"@forge-ts/core\";\nimport { doctest } from \"@forge-ts/doctest\";\nimport { defineCommand } from \"citty\";\nimport { type CommandOutput, emitResult, type OutputFlags, resolveExitCode } from \"../output.js\";\n\n/**\n * Arguments for the `test` command.\n * @internal\n */\nexport interface TestArgs {\n\t/** Project root directory (default: cwd). */\n\tcwd?: string;\n\t/** MVI verbosity level for structured output. */\n\tmvi?: string;\n}\n\n/**\n * A single test failure entry, included at standard and full MVI levels.\n * @public\n */\nexport interface TestFailure {\n\t/** Symbol name where the doctest failed. */\n\tsymbol: string;\n\t/** Absolute path to the source file. */\n\tfile: string;\n\t/** 1-based line number of the failing example. */\n\tline: number;\n\t/** Human-readable failure message. */\n\tmessage: string;\n}\n\n/**\n * Typed result for the `test` command.\n * @public\n */\nexport interface TestResult {\n\t/** Whether all doctests passed. */\n\tsuccess: boolean;\n\t/** Aggregate counts — always present regardless of MVI level. */\n\tsummary: {\n\t\t/** Number of passing doctests. */\n\t\tpassed: number;\n\t\t/** Number of failing doctests. */\n\t\tfailed: number;\n\t\t/** Total doctests run. */\n\t\ttotal: number;\n\t\t/** Wall-clock duration in milliseconds. */\n\t\tduration: number;\n\t};\n\t/** Per-failure details — present at standard and full MVI levels. */\n\tfailures?: TestFailure[];\n}\n\n// ---------------------------------------------------------------------------\n// Public API\n// ---------------------------------------------------------------------------\n\n/**\n * Runs the doctest pipeline and returns a typed command output.\n *\n * @param args - CLI arguments for the test command.\n * @returns A typed `CommandOutput<TestResult>`.\n * @example\n * ```typescript\n * import { runTest } from \"@forge-ts/cli/commands/test\";\n * const output = await runTest({ cwd: process.cwd() });\n * console.log(output.data.summary.passed); // number of passing doctests\n * ```\n * @public\n */\nexport async function runTest(args: TestArgs): Promise<CommandOutput<TestResult>> {\n\tconst config = await loadConfig(args.cwd);\n\tconst result = await doctest(config);\n\tconst mviLevel = args.mvi ?? \"standard\";\n\n\tconst failCount = result.errors.length;\n\tconst totalSymbols = result.symbols.length;\n\tconst passCount = totalSymbols - failCount > 0 ? totalSymbols - failCount : 0;\n\n\tconst summary = {\n\t\tpassed: passCount,\n\t\tfailed: failCount,\n\t\ttotal: totalSymbols,\n\t\tduration: result.duration,\n\t};\n\n\tconst data: TestResult = { success: result.success, summary };\n\n\tif (mviLevel !== \"minimal\") {\n\t\tdata.failures = result.errors.map((e) => ({\n\t\t\tsymbol: e.symbolName ?? \"\",\n\t\t\tfile: e.filePath ?? \"\",\n\t\t\tline: e.line,\n\t\t\tmessage: e.message,\n\t\t}));\n\t}\n\n\t// Populate top-level errors so the LAFS envelope error code is actionable.\n\tconst cliErrors = result.success\n\t\t? undefined\n\t\t: result.errors.map((e) => ({\n\t\t\t\tcode: e.code,\n\t\t\t\tmessage: e.message,\n\t\t\t}));\n\n\treturn {\n\t\toperation: \"test\",\n\t\tsuccess: result.success,\n\t\tdata,\n\t\terrors: cliErrors,\n\t\tduration: result.duration,\n\t};\n}\n\n/**\n * Citty command definition for `forge-ts test`.\n * @public\n */\nexport const testCommand = defineCommand({\n\tmeta: {\n\t\tname: \"test\",\n\t\tdescription: \"Run @example blocks as doctests\",\n\t},\n\targs: {\n\t\tcwd: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"Project root directory\",\n\t\t},\n\t\tjson: {\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Output as LAFS JSON envelope (agent-friendly)\",\n\t\t\tdefault: false,\n\t\t},\n\t\thuman: {\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Output as formatted text (default for TTY)\",\n\t\t\tdefault: false,\n\t\t},\n\t\tquiet: {\n\t\t\ttype: \"boolean\",\n\t\t\tdescription: \"Suppress non-essential output\",\n\t\t\tdefault: false,\n\t\t},\n\t\tmvi: {\n\t\t\ttype: \"string\",\n\t\t\tdescription: \"MVI verbosity level: minimal, standard, full\",\n\t\t},\n\t},\n\tasync run({ args }) {\n\t\tconst output = await runTest({ cwd: args.cwd, mvi: args.mvi });\n\n\t\tconst flags: OutputFlags = {\n\t\t\tjson: args.json,\n\t\t\thuman: args.human,\n\t\t\tquiet: args.quiet,\n\t\t\tmvi: args.mvi,\n\t\t};\n\n\t\temitResult(output, flags, (data) => {\n\t\t\tif (output.success) {\n\t\t\t\treturn `forge-ts test: all doctests passed. (${data.summary.duration}ms)`;\n\t\t\t}\n\t\t\tconst lines: string[] = [];\n\t\t\tfor (const f of data.failures ?? []) {\n\t\t\t\tlines.push(f.message);\n\t\t\t}\n\t\t\tlines.push(`forge-ts test: ${data.summary.failed} failure(s). (${data.summary.duration}ms)`);\n\t\t\treturn lines.join(\"\\n\");\n\t\t});\n\n\t\tprocess.exit(resolveExitCode(output));\n\t},\n});\n"],"mappings":";;;AAcA,SAAS,qBAAqB;AAC9B,SAAS,iBAAAA,gBAAe,eAAe;;;ACfvC,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB;AAC3B,SAAS,gBAAgB;AACzB,SAAS,qBAAqB;;;ACU9B,IAAM,QAAQ;AACd,IAAM,SAAS;AACf,IAAM,MAAM;AACZ,IAAM,OAAO;AACb,IAAM,QAAQ;AAyCP,SAAS,aAAa,SAAwC;AACpE,QAAM,YAAY,SAAS,UAAU,QAAQ,OAAO,SAAS;AAE7D,WAAS,SAAS,MAAc,MAAsB;AACrD,WAAO,YAAY,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,KAAK;AAAA,EAC/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AOA,eAAc;AAAA,EAC1B,MAAM;AAAA,IACL,MAAM;AAAA,IACN,SAAS,IAAI;AAAA,IACb,aAAa;AAAA,EACd;AAAA,EACA,aAAa;AAAA,IACZ,OAAO;AAAA,IACP,MAAM;AAAA,IACN,OAAO;AAAA,IACP,MAAM;AAAA,EACP;AACD,CAAC;AAED,QAAQ,IAAI;","names":["defineCommand","loadConfig","defineCommand","loadConfig","defineCommand","loadConfig","defineCommand","loadConfig","defineCommand","resolve","loadConfig","DEFAULT_TARGET","getAdapter","defineCommand","DEFAULT_TARGET","getAdapter","loadConfig","resolve","defineCommand","loadConfig","defineCommand","loadConfig","defineCommand","require","defineCommand"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge-ts/cli",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "type": "module",
5
5
  "description": "CLI entry point for forge-ts",
6
6
  "license": "MIT",
@@ -27,13 +27,13 @@
27
27
  }
28
28
  },
29
29
  "dependencies": {
30
- "@cleocode/lafs-protocol": "^1.7.0",
30
+ "@cleocode/lafs-protocol": "^1.8.0",
31
31
  "citty": "^0.2.1",
32
- "@forge-ts/api": "0.6.0",
33
- "@forge-ts/doctest": "0.6.0",
34
- "@forge-ts/core": "0.6.0",
35
- "@forge-ts/enforcer": "0.6.0",
36
- "@forge-ts/gen": "0.6.0"
32
+ "@forge-ts/api": "0.6.2",
33
+ "@forge-ts/core": "0.6.2",
34
+ "@forge-ts/doctest": "0.6.2",
35
+ "@forge-ts/enforcer": "0.6.2",
36
+ "@forge-ts/gen": "0.6.2"
37
37
  },
38
38
  "devDependencies": {
39
39
  "tsup": "^8.3.5",