wp-typia 0.20.5 → 0.21.0

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.
@@ -54,7 +54,7 @@ import {
54
54
  } from "./cli-sj5mtyzj.js";
55
55
  import {
56
56
  readWorkspaceInventory
57
- } from "./cli-3w3qxq9w.js";
57
+ } from "./cli-hx88xwr4.js";
58
58
  import {
59
59
  getInvalidWorkspaceProjectReason,
60
60
  tryResolveWorkspaceProject
@@ -15,6 +15,60 @@ var CLI_DIAGNOSTIC_CODES = {
15
15
  UNKNOWN_TEMPLATE: "unknown-template",
16
16
  UNSUPPORTED_COMMAND: "unsupported-command"
17
17
  };
18
+ var CLI_DIAGNOSTIC_CODE_METADATA = {
19
+ [CLI_DIAGNOSTIC_CODES.COMMAND_EXECUTION]: {
20
+ cause: "The command failed after argument parsing and preflight checks completed.",
21
+ recovery: "Read the detail lines for the underlying tool failure, rerun with the same command once corrected, and report the full JSON envelope if the recovery is unclear."
22
+ },
23
+ [CLI_DIAGNOSTIC_CODES.CONFIGURATION_MISSING]: {
24
+ cause: "A command needs configuration that is not present in the current project.",
25
+ recovery: "Add the missing wp-typia config section or rerun the scaffold/init flow that creates the expected configuration."
26
+ },
27
+ [CLI_DIAGNOSTIC_CODES.DEPENDENCIES_NOT_INSTALLED]: {
28
+ cause: "Generated project or workspace dependencies are missing from the local install.",
29
+ recovery: "Run the package-manager install command from the reported project root, then rerun the wp-typia command."
30
+ },
31
+ [CLI_DIAGNOSTIC_CODES.DOCTOR_CHECK_FAILED]: {
32
+ cause: "One or more doctor checks reported a failing environment or workspace row.",
33
+ recovery: "Inspect the failed check labels and details, fix the reported drift or missing prerequisite, then rerun `wp-typia doctor`."
34
+ },
35
+ [CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT]: {
36
+ cause: "An argument was present but did not match the supported value, shape, or project state.",
37
+ recovery: "Correct the argument value using command help or the detail lines, then rerun the command."
38
+ },
39
+ [CLI_DIAGNOSTIC_CODES.INVALID_COMMAND]: {
40
+ cause: "The command or subcommand is not part of the supported wp-typia command tree.",
41
+ recovery: "Run `wp-typia --help` or the relevant command help and switch to a supported command/subcommand."
42
+ },
43
+ [CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT]: {
44
+ cause: "A required positional argument or flag value was omitted.",
45
+ recovery: "Provide the missing argument or flag value shown in the detail lines, then rerun the command."
46
+ },
47
+ [CLI_DIAGNOSTIC_CODES.MISSING_BUILD_ARTIFACT]: {
48
+ cause: "The published or standalone CLI layout is missing bundled build artifacts.",
49
+ recovery: "Reinstall the package or standalone binary, or rebuild the workspace before invoking the command again."
50
+ },
51
+ [CLI_DIAGNOSTIC_CODES.OUTSIDE_PROJECT_ROOT]: {
52
+ cause: "The command was run outside a generated wp-typia project or official workspace root.",
53
+ recovery: "Change into the scaffolded project/workspace root, or rerun the scaffold/init workflow that creates the expected root files."
54
+ },
55
+ [CLI_DIAGNOSTIC_CODES.TEMPLATE_SOURCE_TIMEOUT]: {
56
+ cause: "External template resolution did not complete within the allowed time.",
57
+ recovery: "Retry with a reachable template source, use a local path, or cache the template package before rerunning."
58
+ },
59
+ [CLI_DIAGNOSTIC_CODES.TEMPLATE_SOURCE_TOO_LARGE]: {
60
+ cause: "External template content exceeded the safety size limit.",
61
+ recovery: "Reduce the template package size or point wp-typia at a smaller official template layer."
62
+ },
63
+ [CLI_DIAGNOSTIC_CODES.UNKNOWN_TEMPLATE]: {
64
+ cause: "The requested scaffold template or add-block template id is not registered.",
65
+ recovery: "Run `wp-typia templates list` and rerun with one of the listed template ids."
66
+ },
67
+ [CLI_DIAGNOSTIC_CODES.UNSUPPORTED_COMMAND]: {
68
+ cause: "The requested command exists conceptually but is not supported by the current runtime surface.",
69
+ recovery: "Install Bun 1.3.11+ or use the standalone wp-typia binary when the detail lines say the Bun-powered runtime is required."
70
+ }
71
+ };
18
72
  var DEFAULT_CLI_FAILURE_SUMMARIES = {
19
73
  add: "Unable to complete the requested add workflow.",
20
74
  create: "Unable to complete the requested create workflow.",
@@ -148,6 +202,14 @@ function readCliDiagnosticCode(error) {
148
202
  }
149
203
  return null;
150
204
  }
205
+ function getCliDiagnosticCodeMetadata(code) {
206
+ return CLI_DIAGNOSTIC_CODE_METADATA[code];
207
+ }
208
+ function createCliDiagnosticCodeError(code, message, options) {
209
+ const error = new Error(message, options);
210
+ error.code = code;
211
+ return error;
212
+ }
151
213
  function inferCliDiagnosticCode(options) {
152
214
  const inheritedCode = readCliDiagnosticCode(options.error);
153
215
  if (inheritedCode) {
@@ -253,7 +315,8 @@ function serializeCliDiagnosticError(error) {
253
315
  };
254
316
  }
255
317
  function formatDoctorCheckLine(check) {
256
- return formatWrappedPrefixedLine(`${check.status === "pass" ? "PASS" : "FAIL"} ${check.label}: `, check.detail, resolveCliWrapColumns(process.stdout.columns)).join(`
318
+ const statusLabel = check.status === "pass" ? "PASS" : check.status === "warn" ? "WARN" : "FAIL";
319
+ return formatWrappedPrefixedLine(`${statusLabel} ${check.label}: `, check.detail, resolveCliWrapColumns(process.stdout.columns)).join(`
257
320
  `);
258
321
  }
259
322
  function getFailingDoctorChecks(checks) {
@@ -261,13 +324,18 @@ function getFailingDoctorChecks(checks) {
261
324
  }
262
325
  function formatDoctorSummaryLine(checks) {
263
326
  const failedChecks = getFailingDoctorChecks(checks);
264
- return formatWrappedPrefixedLine(`${failedChecks.length === 0 ? "PASS" : "FAIL"} wp-typia doctor summary: `, `${checks.length - failedChecks.length}/${checks.length} checks passed`, resolveCliWrapColumns(process.stdout.columns)).join(`
327
+ const warningCount = checks.filter((check) => check.status === "warn").length;
328
+ const summaryStatus = failedChecks.length > 0 ? "FAIL" : warningCount > 0 ? "WARN" : "PASS";
329
+ return formatWrappedPrefixedLine(`${summaryStatus} wp-typia doctor summary: `, [
330
+ `${checks.length - failedChecks.length - warningCount}/${checks.length} checks passed`,
331
+ warningCount > 0 ? `${warningCount} warning(s)` : null
332
+ ].filter((detail) => detail !== null).join(", "), resolveCliWrapColumns(process.stdout.columns)).join(`
265
333
  `);
266
334
  }
267
335
  function getDoctorFailureDetailLines(checks) {
268
336
  return getFailingDoctorChecks(checks).map((check) => `${check.label}: ${check.detail}`);
269
337
  }
270
338
 
271
- export { CLI_DIAGNOSTIC_CODES, CliDiagnosticError, isCliDiagnosticError, createCliCommandError, formatCliDiagnosticError, serializeCliDiagnosticError, formatDoctorCheckLine, getFailingDoctorChecks, formatDoctorSummaryLine, getDoctorFailureDetailLines };
339
+ export { CLI_DIAGNOSTIC_CODES, CLI_DIAGNOSTIC_CODE_METADATA, CliDiagnosticError, isCliDiagnosticError, getCliDiagnosticCodeMetadata, createCliDiagnosticCodeError, createCliCommandError, formatCliDiagnosticError, serializeCliDiagnosticError, formatDoctorCheckLine, getFailingDoctorChecks, formatDoctorSummaryLine, getDoctorFailureDetailLines };
272
340
 
273
- //# debugId=FFD0F77BD58A8FEE64756E2164756E21
341
+ //# debugId=723BDE410F54191064756E2164756E21