wp-typia 0.22.3 → 0.22.4
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-bunli/.bunli/commands.gen.js +1827 -1687
- package/dist-bunli/{cli-prc42zqd.js → cli-2mt6bvcj.js} +7 -7
- package/dist-bunli/{cli-sj5mtyzj.js → cli-6bhfzq5e.js} +41 -2
- package/dist-bunli/{cli-tbd9x8b6.js → cli-6ymn63t4.js} +138 -12
- package/dist-bunli/{cli-add-p3re8act.js → cli-add-6s6kzf7x.js} +201 -273
- package/dist-bunli/{cli-pd5pqgre.js → cli-btbpt84c.js} +6 -11
- package/dist-bunli/{cli-doctor-cjm4rzbk.js → cli-doctor-70zd5m3b.js} +9 -64
- package/dist-bunli/{cli-mpgt29xc.js → cli-gsj6vyn5.js} +59 -9
- package/dist-bunli/{cli-gcbre1zs.js → cli-hb9vpsev.js} +6 -13
- package/dist-bunli/{cli-init-7gcthyn1.js → cli-init-kjjyky1y.js} +11 -11
- package/dist-bunli/{cli-x0h03qqe.js → cli-qr2ek735.js} +1157 -1086
- package/dist-bunli/cli-rwjkqjhs.js +88 -0
- package/dist-bunli/{cli-scaffold-x1dp8sz1.js → cli-scaffold-f57ccf5v.js} +10 -10
- package/dist-bunli/cli.js +5 -3
- package/dist-bunli/{command-list-wzej5c7v.js → command-list-wsaa4t2p.js} +69 -132
- package/dist-bunli/{migrations-xfb2h7nf.js → migrations-vw502qf9.js} +5 -5
- package/dist-bunli/node-cli.js +147 -142
- package/dist-bunli/{workspace-project-gxb499cp.js → workspace-project-7826tewa.js} +3 -2
- package/package.json +2 -2
package/dist-bunli/node-cli.js
CHANGED
|
@@ -3,7 +3,7 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
|
3
3
|
// package.json
|
|
4
4
|
var package_default = {
|
|
5
5
|
name: "wp-typia",
|
|
6
|
-
version: "0.22.
|
|
6
|
+
version: "0.22.4",
|
|
7
7
|
description: "Canonical CLI package for wp-typia scaffolding and project workflows",
|
|
8
8
|
packageManager: "bun@1.3.11",
|
|
9
9
|
type: "module",
|
|
@@ -73,7 +73,7 @@ var package_default = {
|
|
|
73
73
|
"@bunli/tui": "0.6.0",
|
|
74
74
|
"@bunli/utils": "0.6.0",
|
|
75
75
|
"@wp-typia/api-client": "^0.4.5",
|
|
76
|
-
"@wp-typia/project-tools": "0.22.
|
|
76
|
+
"@wp-typia/project-tools": "0.22.4",
|
|
77
77
|
"better-result": "^2.7.0",
|
|
78
78
|
react: "^19.2.5",
|
|
79
79
|
"react-dom": "^19.2.5",
|
|
@@ -97,8 +97,8 @@ var package_default = {
|
|
|
97
97
|
|
|
98
98
|
// src/node-cli.ts
|
|
99
99
|
import {
|
|
100
|
-
CLI_DIAGNOSTIC_CODES as
|
|
101
|
-
createCliCommandError as
|
|
100
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES7,
|
|
101
|
+
createCliCommandError as createCliCommandError3,
|
|
102
102
|
createCliDiagnosticCodeError as createCliDiagnosticCodeError6,
|
|
103
103
|
formatCliDiagnosticError,
|
|
104
104
|
serializeCliDiagnosticError as serializeCliDiagnosticError2
|
|
@@ -336,7 +336,7 @@ var SYNC_OPTION_METADATA = {
|
|
|
336
336
|
};
|
|
337
337
|
var DOCTOR_OPTION_METADATA = {
|
|
338
338
|
format: {
|
|
339
|
-
description: "Use `json` for machine-readable doctor check output.",
|
|
339
|
+
description: "Use `json` for machine-readable doctor check output or `toon` for human-readable output.",
|
|
340
340
|
type: "string"
|
|
341
341
|
}
|
|
342
342
|
};
|
|
@@ -353,7 +353,7 @@ var GLOBAL_OPTION_METADATA = {
|
|
|
353
353
|
type: "string"
|
|
354
354
|
},
|
|
355
355
|
format: {
|
|
356
|
-
description: "Output format for supported commands.",
|
|
356
|
+
description: "Output format for supported commands (`json` or `toon`).",
|
|
357
357
|
type: "string"
|
|
358
358
|
},
|
|
359
359
|
id: {
|
|
@@ -580,10 +580,16 @@ function resolveCommandOptionValues(metadata, options) {
|
|
|
580
580
|
|
|
581
581
|
// src/cli-diagnostic-output.ts
|
|
582
582
|
import {
|
|
583
|
-
createCliCommandError,
|
|
583
|
+
createCliCommandError as createCliCommandError2,
|
|
584
584
|
serializeCliDiagnosticError
|
|
585
585
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
586
586
|
|
|
587
|
+
// src/cli-output-format.ts
|
|
588
|
+
import {
|
|
589
|
+
CLI_DIAGNOSTIC_CODES,
|
|
590
|
+
createCliCommandError
|
|
591
|
+
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
592
|
+
|
|
587
593
|
// bin/argv-walker.js
|
|
588
594
|
function normalizeOptionSet(values) {
|
|
589
595
|
return values instanceof Set ? values : new Set(values);
|
|
@@ -624,6 +630,60 @@ function findFirstPositionalIndex(argv, metadata) {
|
|
|
624
630
|
const positionalIndexes = collectPositionalIndexes(argv, metadata);
|
|
625
631
|
return positionalIndexes[0] ?? -1;
|
|
626
632
|
}
|
|
633
|
+
function findFirstPositional(argv, metadata) {
|
|
634
|
+
const firstPositionalIndex = findFirstPositionalIndex(argv, metadata);
|
|
635
|
+
return firstPositionalIndex === -1 ? undefined : argv[firstPositionalIndex];
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
// src/cli-output-format.ts
|
|
639
|
+
var SUPPORTED_CLI_OUTPUT_FORMATS = ["json", "toon"];
|
|
640
|
+
function formatSupportedCliOutputFormats() {
|
|
641
|
+
return SUPPORTED_CLI_OUTPUT_FORMATS.join(", ");
|
|
642
|
+
}
|
|
643
|
+
function isSupportedCliOutputFormat(value) {
|
|
644
|
+
return SUPPORTED_CLI_OUTPUT_FORMATS.includes(value);
|
|
645
|
+
}
|
|
646
|
+
function formatInvalidCliOutputFormatMessage(value) {
|
|
647
|
+
return `Invalid --format value "${value}". Supported values: ${formatSupportedCliOutputFormats()}.`;
|
|
648
|
+
}
|
|
649
|
+
function resolveEntrypointCliCommand(argv) {
|
|
650
|
+
return findFirstPositional(argv, COMMAND_ROUTING_METADATA) ?? "wp-typia";
|
|
651
|
+
}
|
|
652
|
+
function assertSupportedCliOutputFormat(value, argv) {
|
|
653
|
+
if (isSupportedCliOutputFormat(value)) {
|
|
654
|
+
return;
|
|
655
|
+
}
|
|
656
|
+
throw createCliCommandError({
|
|
657
|
+
code: CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT,
|
|
658
|
+
command: resolveEntrypointCliCommand(argv),
|
|
659
|
+
detailLines: [formatInvalidCliOutputFormatMessage(value)]
|
|
660
|
+
});
|
|
661
|
+
}
|
|
662
|
+
function validateCliOutputFormatArgv(argv) {
|
|
663
|
+
for (let index = 0;index < argv.length; index += 1) {
|
|
664
|
+
const arg = argv[index];
|
|
665
|
+
if (!arg) {
|
|
666
|
+
continue;
|
|
667
|
+
}
|
|
668
|
+
if (arg === "--") {
|
|
669
|
+
return;
|
|
670
|
+
}
|
|
671
|
+
if (arg === "--format") {
|
|
672
|
+
const next = argv[index + 1];
|
|
673
|
+
if (next && !next.startsWith("-")) {
|
|
674
|
+
assertSupportedCliOutputFormat(next, argv);
|
|
675
|
+
index += 1;
|
|
676
|
+
}
|
|
677
|
+
continue;
|
|
678
|
+
}
|
|
679
|
+
if (arg.startsWith("--format=")) {
|
|
680
|
+
const value = arg.slice("--format=".length);
|
|
681
|
+
if (value) {
|
|
682
|
+
assertSupportedCliOutputFormat(value, argv);
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
}
|
|
627
687
|
|
|
628
688
|
// src/cli-diagnostic-output.ts
|
|
629
689
|
function prefersStructuredCliArgv(argv) {
|
|
@@ -653,7 +713,7 @@ import {
|
|
|
653
713
|
|
|
654
714
|
// src/add-kind-registry.ts
|
|
655
715
|
import {
|
|
656
|
-
CLI_DIAGNOSTIC_CODES as
|
|
716
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES3,
|
|
657
717
|
createCliDiagnosticCodeError as createCliDiagnosticCodeError2
|
|
658
718
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
659
719
|
|
|
@@ -675,7 +735,7 @@ var ADD_KIND_IDS = [
|
|
|
675
735
|
|
|
676
736
|
// src/cli-string-flags.ts
|
|
677
737
|
import {
|
|
678
|
-
CLI_DIAGNOSTIC_CODES,
|
|
738
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES2,
|
|
679
739
|
createCliDiagnosticCodeError
|
|
680
740
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
681
741
|
function readOptionalCliStringFlagValue(flags, name, mode) {
|
|
@@ -684,12 +744,12 @@ function readOptionalCliStringFlagValue(flags, name, mode) {
|
|
|
684
744
|
return;
|
|
685
745
|
}
|
|
686
746
|
if (typeof value !== "string") {
|
|
687
|
-
throw createCliDiagnosticCodeError(
|
|
747
|
+
throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES2.MISSING_ARGUMENT, `\`--${name}\` requires a value.`);
|
|
688
748
|
}
|
|
689
749
|
const trimmed = value.trim();
|
|
690
750
|
if (trimmed.length === 0) {
|
|
691
751
|
if (mode === "strict") {
|
|
692
|
-
throw createCliDiagnosticCodeError(
|
|
752
|
+
throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES2.MISSING_ARGUMENT, `\`--${name}\` requires a value.`);
|
|
693
753
|
}
|
|
694
754
|
return;
|
|
695
755
|
}
|
|
@@ -704,7 +764,7 @@ function readOptionalStrictStringFlag(flags, name) {
|
|
|
704
764
|
function requireStrictStringFlag(flags, name, message) {
|
|
705
765
|
const value = readOptionalStrictStringFlag(flags, name);
|
|
706
766
|
if (!value) {
|
|
707
|
-
throw createCliDiagnosticCodeError(
|
|
767
|
+
throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES2.MISSING_ARGUMENT, message);
|
|
708
768
|
}
|
|
709
769
|
return value;
|
|
710
770
|
}
|
|
@@ -712,7 +772,7 @@ function readOptionalPairedStrictStringFlags(flags, leftName, rightName, message
|
|
|
712
772
|
const leftValue = readOptionalStrictStringFlag(flags, leftName);
|
|
713
773
|
const rightValue = readOptionalStrictStringFlag(flags, rightName);
|
|
714
774
|
if (Boolean(leftValue) !== Boolean(rightValue)) {
|
|
715
|
-
throw createCliDiagnosticCodeError(
|
|
775
|
+
throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES2.MISSING_ARGUMENT, message);
|
|
716
776
|
}
|
|
717
777
|
return [leftValue, rightValue];
|
|
718
778
|
}
|
|
@@ -793,7 +853,7 @@ var NAME_NAMESPACE_VISIBLE_FIELDS = [
|
|
|
793
853
|
];
|
|
794
854
|
function requireAddKindName(context, message) {
|
|
795
855
|
if (!context.name) {
|
|
796
|
-
throw createCliDiagnosticCodeError2(
|
|
856
|
+
throw createCliDiagnosticCodeError2(CLI_DIAGNOSTIC_CODES3.MISSING_ARGUMENT, message);
|
|
797
857
|
}
|
|
798
858
|
return context.name;
|
|
799
859
|
}
|
|
@@ -812,6 +872,18 @@ function createNamedExecutionPlan(context, options) {
|
|
|
812
872
|
function isAddPersistenceTemplate(template) {
|
|
813
873
|
return template === "persistence" || template === "compound";
|
|
814
874
|
}
|
|
875
|
+
function formatAddBlockTemplateIds(addRuntime) {
|
|
876
|
+
return addRuntime.ADD_BLOCK_TEMPLATE_IDS.join(", ");
|
|
877
|
+
}
|
|
878
|
+
function assertAddBlockTemplateId(context, templateId) {
|
|
879
|
+
if (context.addRuntime.isAddBlockTemplateId(templateId)) {
|
|
880
|
+
return templateId;
|
|
881
|
+
}
|
|
882
|
+
if (templateId === "query-loop") {
|
|
883
|
+
throw createCliDiagnosticCodeError2(CLI_DIAGNOSTIC_CODES3.INVALID_ARGUMENT, "`wp-typia add block --template query-loop` is not supported. Query Loop is a create-time `core/query` variation scaffold, so use `wp-typia create <project-dir> --template query-loop` instead.");
|
|
884
|
+
}
|
|
885
|
+
throw createCliDiagnosticCodeError2(CLI_DIAGNOSTIC_CODES3.UNKNOWN_TEMPLATE, `Unknown add-block template "${templateId}". Expected one of: ${formatAddBlockTemplateIds(context.addRuntime)}. Run \`wp-typia templates list\` to inspect available templates.`);
|
|
886
|
+
}
|
|
815
887
|
var ADD_KIND_REGISTRY = {
|
|
816
888
|
"admin-view": defineAddKindRegistryEntry({
|
|
817
889
|
completion: {
|
|
@@ -918,7 +990,8 @@ var ADD_KIND_REGISTRY = {
|
|
|
918
990
|
const dataStorageMode = readOptionalStrictStringFlag(context.flags, "data-storage");
|
|
919
991
|
const innerBlocksPreset = readOptionalStrictStringFlag(context.flags, "inner-blocks-preset");
|
|
920
992
|
const persistencePolicy = readOptionalStrictStringFlag(context.flags, "persistence-policy");
|
|
921
|
-
|
|
993
|
+
const requestedTemplateId = readOptionalStrictStringFlag(context.flags, "template");
|
|
994
|
+
let resolvedTemplateId = requestedTemplateId ? assertAddBlockTemplateId(context, requestedTemplateId) : undefined;
|
|
922
995
|
if (!resolvedTemplateId && context.isInteractiveSession) {
|
|
923
996
|
const templatePrompt = await context.getOrCreatePrompt();
|
|
924
997
|
resolvedTemplateId = await templatePrompt.select("Select a block template", context.addRuntime.ADD_BLOCK_TEMPLATE_IDS.map((templateId) => ({
|
|
@@ -1334,7 +1407,7 @@ import os from "node:os";
|
|
|
1334
1407
|
import path from "node:path";
|
|
1335
1408
|
import { isPlainObject as isRecord } from "@wp-typia/api-client/runtime-primitives";
|
|
1336
1409
|
import {
|
|
1337
|
-
CLI_DIAGNOSTIC_CODES as
|
|
1410
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES4,
|
|
1338
1411
|
createCliDiagnosticCodeError as createCliDiagnosticCodeError3
|
|
1339
1412
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
1340
1413
|
var WP_TYPIA_CONFIG_SOURCES = [
|
|
@@ -1372,7 +1445,7 @@ async function readJsonFile(filePath) {
|
|
|
1372
1445
|
return isRecord(parsed) ? parsed : null;
|
|
1373
1446
|
} catch (error) {
|
|
1374
1447
|
const message = error instanceof Error ? error.message : String(error);
|
|
1375
|
-
throw createCliDiagnosticCodeError3(
|
|
1448
|
+
throw createCliDiagnosticCodeError3(CLI_DIAGNOSTIC_CODES4.INVALID_ARGUMENT, `Unable to parse ${filePath}: ${message}`, error instanceof Error ? { cause: error } : undefined);
|
|
1376
1449
|
}
|
|
1377
1450
|
}
|
|
1378
1451
|
function resolveConfigPath(cwd, source) {
|
|
@@ -1425,7 +1498,7 @@ function extractWpTypiaConfigOverride(argv) {
|
|
|
1425
1498
|
|
|
1426
1499
|
// src/runtime-bridge.ts
|
|
1427
1500
|
import {
|
|
1428
|
-
CLI_DIAGNOSTIC_CODES as
|
|
1501
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES6,
|
|
1429
1502
|
createCliDiagnosticCodeError as createCliDiagnosticCodeError5
|
|
1430
1503
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
1431
1504
|
|
|
@@ -1557,9 +1630,10 @@ async function simulateWorkspaceAddDryRun({
|
|
|
1557
1630
|
}
|
|
1558
1631
|
|
|
1559
1632
|
// src/runtime-bridge-output.ts
|
|
1560
|
-
import
|
|
1561
|
-
|
|
1562
|
-
|
|
1633
|
+
import {
|
|
1634
|
+
formatPackageExecCommand,
|
|
1635
|
+
inferPackageManagerId
|
|
1636
|
+
} from "@wp-typia/project-tools/package-managers";
|
|
1563
1637
|
|
|
1564
1638
|
// src/output-markers.ts
|
|
1565
1639
|
var UNICODE_OUTPUT_MARKERS = {
|
|
@@ -1806,32 +1880,6 @@ function buildInitCompletionPayload(plan, markerOptions) {
|
|
|
1806
1880
|
warningLines: plan.notes
|
|
1807
1881
|
};
|
|
1808
1882
|
}
|
|
1809
|
-
function inferProjectPackageManager(projectDir) {
|
|
1810
|
-
try {
|
|
1811
|
-
const packageJsonPath = path3.join(projectDir, "package.json");
|
|
1812
|
-
if (fs3.existsSync(packageJsonPath)) {
|
|
1813
|
-
const manifest = JSON.parse(fs3.readFileSync(packageJsonPath, "utf8"));
|
|
1814
|
-
if (manifest.packageManager?.startsWith("bun@"))
|
|
1815
|
-
return "bun";
|
|
1816
|
-
if (manifest.packageManager?.startsWith("pnpm@"))
|
|
1817
|
-
return "pnpm";
|
|
1818
|
-
if (manifest.packageManager?.startsWith("yarn@"))
|
|
1819
|
-
return "yarn";
|
|
1820
|
-
if (manifest.packageManager?.startsWith("npm@"))
|
|
1821
|
-
return "npm";
|
|
1822
|
-
}
|
|
1823
|
-
} catch {}
|
|
1824
|
-
if (fs3.existsSync(path3.join(projectDir, "bun.lock")) || fs3.existsSync(path3.join(projectDir, "bun.lockb"))) {
|
|
1825
|
-
return "bun";
|
|
1826
|
-
}
|
|
1827
|
-
if (fs3.existsSync(path3.join(projectDir, "pnpm-lock.yaml"))) {
|
|
1828
|
-
return "pnpm";
|
|
1829
|
-
}
|
|
1830
|
-
if (fs3.existsSync(path3.join(projectDir, "yarn.lock")) || fs3.existsSync(path3.join(projectDir, ".yarnrc.yml"))) {
|
|
1831
|
-
return "yarn";
|
|
1832
|
-
}
|
|
1833
|
-
return "npm";
|
|
1834
|
-
}
|
|
1835
1883
|
function buildMigrationCompletionPayload(options, markerOptions) {
|
|
1836
1884
|
const summaryLines = options.lines.filter((line) => line.trim().length > 0);
|
|
1837
1885
|
return {
|
|
@@ -1841,7 +1889,7 @@ function buildMigrationCompletionPayload(options, markerOptions) {
|
|
|
1841
1889
|
}
|
|
1842
1890
|
function buildAddCompletionPayload(options, markerOptions) {
|
|
1843
1891
|
const verificationLines = [
|
|
1844
|
-
formatPackageExecCommand(options.packageManager ??
|
|
1892
|
+
formatPackageExecCommand(options.packageManager ?? inferPackageManagerId(options.projectDir), `wp-typia@${package_default.version}`, "doctor")
|
|
1845
1893
|
];
|
|
1846
1894
|
const verificationNote = "Run doctor via your package manager for a quick inventory and generated-artifact check after the add workflow.";
|
|
1847
1895
|
const completion = buildAddKindCompletionDetails(options.kind, {
|
|
@@ -1902,12 +1950,17 @@ function isInteractiveTerminal({
|
|
|
1902
1950
|
}
|
|
1903
1951
|
// src/runtime-bridge-sync.ts
|
|
1904
1952
|
import { spawnSync } from "node:child_process";
|
|
1905
|
-
import
|
|
1906
|
-
import
|
|
1953
|
+
import fs3 from "node:fs";
|
|
1954
|
+
import path3 from "node:path";
|
|
1907
1955
|
import {
|
|
1908
|
-
CLI_DIAGNOSTIC_CODES as
|
|
1956
|
+
CLI_DIAGNOSTIC_CODES as CLI_DIAGNOSTIC_CODES5,
|
|
1909
1957
|
createCliDiagnosticCodeError as createCliDiagnosticCodeError4
|
|
1910
1958
|
} from "@wp-typia/project-tools/cli-diagnostics";
|
|
1959
|
+
import {
|
|
1960
|
+
formatInstallCommand,
|
|
1961
|
+
formatRunScript,
|
|
1962
|
+
inferPackageManagerId as inferPackageManagerId2
|
|
1963
|
+
} from "@wp-typia/project-tools/package-managers";
|
|
1911
1964
|
var SYNC_INSTALL_MARKERS = [
|
|
1912
1965
|
"node_modules",
|
|
1913
1966
|
".pnp.cjs",
|
|
@@ -1922,66 +1975,17 @@ function resolveSyncExecutionTarget(subcommand) {
|
|
|
1922
1975
|
if (subcommand === "ai") {
|
|
1923
1976
|
return "ai";
|
|
1924
1977
|
}
|
|
1925
|
-
throw createCliDiagnosticCodeError4(
|
|
1926
|
-
}
|
|
1927
|
-
function formatRunScript(packageManagerId, scriptName, extraArgs = "") {
|
|
1928
|
-
const args = extraArgs.trim();
|
|
1929
|
-
if (packageManagerId === "bun") {
|
|
1930
|
-
return args ? `bun run ${scriptName} ${args}` : `bun run ${scriptName}`;
|
|
1931
|
-
}
|
|
1932
|
-
if (packageManagerId === "npm") {
|
|
1933
|
-
return args ? `npm run ${scriptName} -- ${args}` : `npm run ${scriptName}`;
|
|
1934
|
-
}
|
|
1935
|
-
if (packageManagerId === "pnpm") {
|
|
1936
|
-
return args ? `pnpm run ${scriptName} ${args}` : `pnpm run ${scriptName}`;
|
|
1937
|
-
}
|
|
1938
|
-
return args ? `yarn run ${scriptName} ${args}` : `yarn run ${scriptName}`;
|
|
1939
|
-
}
|
|
1940
|
-
function formatInstallCommand(packageManagerId) {
|
|
1941
|
-
switch (packageManagerId) {
|
|
1942
|
-
case "bun":
|
|
1943
|
-
return "bun install";
|
|
1944
|
-
case "pnpm":
|
|
1945
|
-
return "pnpm install";
|
|
1946
|
-
case "yarn":
|
|
1947
|
-
return "yarn install";
|
|
1948
|
-
default:
|
|
1949
|
-
return "npm install";
|
|
1950
|
-
}
|
|
1978
|
+
throw createCliDiagnosticCodeError4(CLI_DIAGNOSTIC_CODES5.INVALID_COMMAND, `Unknown sync subcommand "${subcommand}". Expected one of: "ai".`);
|
|
1951
1979
|
}
|
|
1952
1980
|
function getSyncRootError(cwd) {
|
|
1953
|
-
return createCliDiagnosticCodeError4(
|
|
1954
|
-
}
|
|
1955
|
-
function inferSyncPackageManager(cwd, packageManagerField) {
|
|
1956
|
-
const field = String(packageManagerField ?? "");
|
|
1957
|
-
if (field.startsWith("bun@"))
|
|
1958
|
-
return "bun";
|
|
1959
|
-
if (field.startsWith("npm@"))
|
|
1960
|
-
return "npm";
|
|
1961
|
-
if (field.startsWith("pnpm@"))
|
|
1962
|
-
return "pnpm";
|
|
1963
|
-
if (field.startsWith("yarn@"))
|
|
1964
|
-
return "yarn";
|
|
1965
|
-
if (fs4.existsSync(path4.join(cwd, "bun.lock")) || fs4.existsSync(path4.join(cwd, "bun.lockb"))) {
|
|
1966
|
-
return "bun";
|
|
1967
|
-
}
|
|
1968
|
-
if (fs4.existsSync(path4.join(cwd, "pnpm-lock.yaml"))) {
|
|
1969
|
-
return "pnpm";
|
|
1970
|
-
}
|
|
1971
|
-
if (fs4.existsSync(path4.join(cwd, "yarn.lock")) || fs4.existsSync(path4.join(cwd, ".pnp.cjs")) || fs4.existsSync(path4.join(cwd, ".pnp.loader.mjs")) || fs4.existsSync(path4.join(cwd, ".yarnrc.yml"))) {
|
|
1972
|
-
return "yarn";
|
|
1973
|
-
}
|
|
1974
|
-
if (fs4.existsSync(path4.join(cwd, "package-lock.json")) || fs4.existsSync(path4.join(cwd, "npm-shrinkwrap.json"))) {
|
|
1975
|
-
return "npm";
|
|
1976
|
-
}
|
|
1977
|
-
return "npm";
|
|
1981
|
+
return createCliDiagnosticCodeError4(CLI_DIAGNOSTIC_CODES5.OUTSIDE_PROJECT_ROOT, `No generated wp-typia project root was found at ${cwd}. Run \`wp-typia sync\` from a scaffolded project or official workspace root that already contains generated sync scripts. If you expected this directory to work, cd into the scaffold root first or rerun the scaffold before syncing.`);
|
|
1978
1982
|
}
|
|
1979
1983
|
function resolveSyncProjectContext(cwd) {
|
|
1980
|
-
const packageJsonPath =
|
|
1981
|
-
if (!
|
|
1984
|
+
const packageJsonPath = path3.join(cwd, "package.json");
|
|
1985
|
+
if (!fs3.existsSync(packageJsonPath)) {
|
|
1982
1986
|
throw getSyncRootError(cwd);
|
|
1983
1987
|
}
|
|
1984
|
-
const packageJson = JSON.parse(
|
|
1988
|
+
const packageJson = JSON.parse(fs3.readFileSync(packageJsonPath, "utf8"));
|
|
1985
1989
|
const scripts = packageJson.scripts ?? {};
|
|
1986
1990
|
const syncScripts = {
|
|
1987
1991
|
sync: typeof scripts.sync === "string" ? {
|
|
@@ -2007,17 +2011,17 @@ function resolveSyncProjectContext(cwd) {
|
|
|
2007
2011
|
return {
|
|
2008
2012
|
cwd,
|
|
2009
2013
|
packageJsonPath,
|
|
2010
|
-
packageManager:
|
|
2014
|
+
packageManager: inferPackageManagerId2(cwd, packageJson.packageManager),
|
|
2011
2015
|
scripts: syncScripts
|
|
2012
2016
|
};
|
|
2013
2017
|
}
|
|
2014
2018
|
function findInstalledDependencyMarkerDir(projectDir) {
|
|
2015
|
-
let currentDir =
|
|
2019
|
+
let currentDir = path3.resolve(projectDir);
|
|
2016
2020
|
while (true) {
|
|
2017
|
-
if (SYNC_INSTALL_MARKERS.some((marker) =>
|
|
2021
|
+
if (SYNC_INSTALL_MARKERS.some((marker) => fs3.existsSync(path3.join(currentDir, marker)))) {
|
|
2018
2022
|
return currentDir;
|
|
2019
2023
|
}
|
|
2020
|
-
const parentDir =
|
|
2024
|
+
const parentDir = path3.dirname(currentDir);
|
|
2021
2025
|
if (parentDir === currentDir) {
|
|
2022
2026
|
return null;
|
|
2023
2027
|
}
|
|
@@ -2040,7 +2044,7 @@ function assertSyncDependenciesInstalled(project, target) {
|
|
|
2040
2044
|
if (markerDir) {
|
|
2041
2045
|
return;
|
|
2042
2046
|
}
|
|
2043
|
-
throw createCliDiagnosticCodeError4(
|
|
2047
|
+
throw createCliDiagnosticCodeError4(CLI_DIAGNOSTIC_CODES5.DEPENDENCIES_NOT_INSTALLED, `Project dependencies have not been installed yet. Run \`${formatInstallCommand(project.packageManager)}\` from the project root before \`wp-typia sync\`. The generated sync scripts rely on local tools such as \`tsx\`.`);
|
|
2044
2048
|
}
|
|
2045
2049
|
function getPackageManagerRunInvocation(packageManager, scriptName, extraArgs) {
|
|
2046
2050
|
switch (packageManager) {
|
|
@@ -2078,7 +2082,7 @@ function buildSyncPlannedCommands(project, extraArgs, target) {
|
|
|
2078
2082
|
if (target === "ai") {
|
|
2079
2083
|
const syncAiCommand2 = createSyncPlannedCommand(project, "sync-ai", extraArgs);
|
|
2080
2084
|
if (!syncAiCommand2) {
|
|
2081
|
-
throw createCliDiagnosticCodeError4(
|
|
2085
|
+
throw createCliDiagnosticCodeError4(CLI_DIAGNOSTIC_CODES5.CONFIGURATION_MISSING, `Expected ${project.packageJsonPath} to define a \`sync-ai\` script for \`wp-typia sync ai\`.`);
|
|
2082
2086
|
}
|
|
2083
2087
|
return [syncAiCommand2];
|
|
2084
2088
|
}
|
|
@@ -2087,7 +2091,7 @@ function buildSyncPlannedCommands(project, extraArgs, target) {
|
|
|
2087
2091
|
}
|
|
2088
2092
|
const syncTypesCommand = createSyncPlannedCommand(project, "sync-types", extraArgs);
|
|
2089
2093
|
if (!syncTypesCommand) {
|
|
2090
|
-
throw createCliDiagnosticCodeError4(
|
|
2094
|
+
throw createCliDiagnosticCodeError4(CLI_DIAGNOSTIC_CODES5.CONFIGURATION_MISSING, `Expected ${project.packageJsonPath} to define either a \`sync\` or \`sync-types\` script.`);
|
|
2091
2095
|
}
|
|
2092
2096
|
const plannedCommands = [syncTypesCommand];
|
|
2093
2097
|
const syncRestCommand = createSyncPlannedCommand(project, "sync-rest", extraArgs);
|
|
@@ -2161,8 +2165,8 @@ var loadCliScaffoldRuntime = () => import("@wp-typia/project-tools/cli-scaffold"
|
|
|
2161
2165
|
var loadCliTemplatesRuntime = () => import("@wp-typia/project-tools/cli-templates");
|
|
2162
2166
|
var loadMigrationsRuntime = () => import("@wp-typia/project-tools/migrations");
|
|
2163
2167
|
async function wrapCliCommandError(command, error) {
|
|
2164
|
-
const { createCliCommandError:
|
|
2165
|
-
return
|
|
2168
|
+
const { createCliCommandError: createCliCommandError3 } = await loadCliDiagnosticsRuntime();
|
|
2169
|
+
return createCliCommandError3({ command, error });
|
|
2166
2170
|
}
|
|
2167
2171
|
function shouldWrapCliCommandError(options) {
|
|
2168
2172
|
if (options.emitOutput === false) {
|
|
@@ -2367,13 +2371,13 @@ async function executeAddCommand({
|
|
|
2367
2371
|
if (emitOutput) {
|
|
2368
2372
|
printLine(addRuntime.formatAddHelpText());
|
|
2369
2373
|
}
|
|
2370
|
-
throw createCliDiagnosticCodeError5(
|
|
2374
|
+
throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES6.MISSING_ARGUMENT, `\`wp-typia add\` requires <kind>. Usage: wp-typia add ${formatAddKindUsagePlaceholder()} ...`);
|
|
2371
2375
|
}
|
|
2372
2376
|
if (!isAddKindId(kind)) {
|
|
2373
|
-
throw createCliDiagnosticCodeError5(
|
|
2377
|
+
throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES6.INVALID_COMMAND, `Unknown add kind "${kind}". Expected one of: ${formatAddKindList()}.`);
|
|
2374
2378
|
}
|
|
2375
2379
|
if (dryRun && !supportsAddKindDryRun(kind)) {
|
|
2376
|
-
throw createCliDiagnosticCodeError5(
|
|
2380
|
+
throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES6.INVALID_ARGUMENT, `\`wp-typia add ${kind}\` does not support \`--dry-run\` yet.`);
|
|
2377
2381
|
}
|
|
2378
2382
|
const executionContext = {
|
|
2379
2383
|
addRuntime,
|
|
@@ -2425,16 +2429,16 @@ async function executeTemplatesCommand({ flags }, printLine = console.log) {
|
|
|
2425
2429
|
}
|
|
2426
2430
|
if (subcommand === "inspect") {
|
|
2427
2431
|
if (!flags.id) {
|
|
2428
|
-
throw createCliDiagnosticCodeError5(
|
|
2432
|
+
throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES6.MISSING_ARGUMENT, "`wp-typia templates inspect` requires <template-id>.");
|
|
2429
2433
|
}
|
|
2430
2434
|
const template = getTemplateById(flags.id);
|
|
2431
2435
|
if (!template) {
|
|
2432
|
-
throw createCliDiagnosticCodeError5(
|
|
2436
|
+
throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES6.INVALID_ARGUMENT, `Unknown template "${flags.id}".`);
|
|
2433
2437
|
}
|
|
2434
2438
|
printBlock([formatTemplateDetails(template)], printLine);
|
|
2435
2439
|
return;
|
|
2436
2440
|
}
|
|
2437
|
-
throw createCliDiagnosticCodeError5(
|
|
2441
|
+
throw createCliDiagnosticCodeError5(CLI_DIAGNOSTIC_CODES6.INVALID_COMMAND, `Unknown templates subcommand "${subcommand}". Expected list or inspect.`);
|
|
2438
2442
|
}
|
|
2439
2443
|
async function executeInitCommand({ apply, cwd, packageManager, projectDir }, options = {}) {
|
|
2440
2444
|
try {
|
|
@@ -2522,7 +2526,7 @@ async function executeMigrateCommand({
|
|
|
2522
2526
|
}
|
|
2523
2527
|
|
|
2524
2528
|
// src/command-contract.ts
|
|
2525
|
-
import
|
|
2529
|
+
import path4 from "node:path";
|
|
2526
2530
|
|
|
2527
2531
|
// src/command-registry.ts
|
|
2528
2532
|
var WP_TYPIA_CANONICAL_CREATE_USAGE = "wp-typia create <project-dir>";
|
|
@@ -2736,7 +2740,7 @@ function looksLikeStructuredProjectInput(value) {
|
|
|
2736
2740
|
return value.startsWith("@") && value.includes("/");
|
|
2737
2741
|
}
|
|
2738
2742
|
function assertPositionalAliasProjectDir(projectDir) {
|
|
2739
|
-
const normalizedProjectDir =
|
|
2743
|
+
const normalizedProjectDir = path4.normalize(projectDir).replace(/[\\/]+$/u, "") || path4.normalize(projectDir);
|
|
2740
2744
|
if (normalizedProjectDir === "." || normalizedProjectDir === "..") {
|
|
2741
2745
|
throw new Error(`The positional alias does not scaffold into \`${projectDir}\`. Use \`${WP_TYPIA_CANONICAL_CREATE_USAGE}\` with an explicit child directory instead.`);
|
|
2742
2746
|
}
|
|
@@ -2819,7 +2823,7 @@ function parseGlobalFlags(argv) {
|
|
|
2819
2823
|
};
|
|
2820
2824
|
} catch (error) {
|
|
2821
2825
|
if (error instanceof Error && /\`--format\` requires a value\.|\`--id\` requires a value\./.test(error.message)) {
|
|
2822
|
-
throw createCliDiagnosticCodeError6(
|
|
2826
|
+
throw createCliDiagnosticCodeError6(CLI_DIAGNOSTIC_CODES7.MISSING_ARGUMENT, error.message);
|
|
2823
2827
|
}
|
|
2824
2828
|
throw error;
|
|
2825
2829
|
}
|
|
@@ -2982,16 +2986,16 @@ function renderTemplatesJson(flags, subcommand) {
|
|
|
2982
2986
|
}
|
|
2983
2987
|
const templateId = flags.id;
|
|
2984
2988
|
if (!templateId) {
|
|
2985
|
-
throw
|
|
2986
|
-
code:
|
|
2989
|
+
throw createCliCommandError3({
|
|
2990
|
+
code: CLI_DIAGNOSTIC_CODES7.MISSING_ARGUMENT,
|
|
2987
2991
|
command: "templates",
|
|
2988
2992
|
detailLines: ["`wp-typia templates inspect` requires <template-id>."]
|
|
2989
2993
|
});
|
|
2990
2994
|
}
|
|
2991
2995
|
const template = getTemplateById(templateId);
|
|
2992
2996
|
if (!template) {
|
|
2993
|
-
throw
|
|
2994
|
-
code:
|
|
2997
|
+
throw createCliCommandError3({
|
|
2998
|
+
code: CLI_DIAGNOSTIC_CODES7.INVALID_ARGUMENT,
|
|
2995
2999
|
command: "templates",
|
|
2996
3000
|
detailLines: [`Unknown template "${templateId}".`]
|
|
2997
3001
|
});
|
|
@@ -3001,8 +3005,8 @@ function renderTemplatesJson(flags, subcommand) {
|
|
|
3001
3005
|
}, null, 2));
|
|
3002
3006
|
}
|
|
3003
3007
|
function renderUnsupportedCommand(command) {
|
|
3004
|
-
throw
|
|
3005
|
-
code:
|
|
3008
|
+
throw createCliCommandError3({
|
|
3009
|
+
code: CLI_DIAGNOSTIC_CODES7.UNSUPPORTED_COMMAND,
|
|
3006
3010
|
command,
|
|
3007
3011
|
detailLines: [
|
|
3008
3012
|
[
|
|
@@ -3017,7 +3021,7 @@ function renderUnsupportedCommand(command) {
|
|
|
3017
3021
|
async function renderDoctorJson() {
|
|
3018
3022
|
const [
|
|
3019
3023
|
{ getDoctorChecks },
|
|
3020
|
-
{ createCliCommandError:
|
|
3024
|
+
{ createCliCommandError: createCliCommandError4, getDoctorFailureDetailLines }
|
|
3021
3025
|
] = await Promise.all([
|
|
3022
3026
|
import("@wp-typia/project-tools/cli-doctor"),
|
|
3023
3027
|
import("@wp-typia/project-tools/cli-diagnostics")
|
|
@@ -3027,8 +3031,8 @@ async function renderDoctorJson() {
|
|
|
3027
3031
|
checks
|
|
3028
3032
|
}, null, 2));
|
|
3029
3033
|
if (checks.some((check) => check.status === "fail")) {
|
|
3030
|
-
throw
|
|
3031
|
-
code:
|
|
3034
|
+
throw createCliCommandError4({
|
|
3035
|
+
code: CLI_DIAGNOSTIC_CODES7.DOCTOR_CHECK_FAILED,
|
|
3032
3036
|
command: "doctor",
|
|
3033
3037
|
detailLines: getDoctorFailureDetailLines(checks),
|
|
3034
3038
|
summary: "One or more doctor checks failed."
|
|
@@ -3044,8 +3048,8 @@ var NODE_FALLBACK_COMMAND_DISPATCHERS = {
|
|
|
3044
3048
|
if (!positionals[1]) {
|
|
3045
3049
|
const { formatAddHelpText } = await import("@wp-typia/project-tools/cli-add");
|
|
3046
3050
|
printLine(formatAddHelpText());
|
|
3047
|
-
throw
|
|
3048
|
-
code:
|
|
3051
|
+
throw createCliCommandError3({
|
|
3052
|
+
code: CLI_DIAGNOSTIC_CODES7.MISSING_ARGUMENT,
|
|
3049
3053
|
command: "add",
|
|
3050
3054
|
detailLines: [
|
|
3051
3055
|
`\`wp-typia add\` requires <kind>. Usage: wp-typia add ${formatAddKindUsagePlaceholder()} ...`
|
|
@@ -3064,7 +3068,7 @@ var NODE_FALLBACK_COMMAND_DISPATCHERS = {
|
|
|
3064
3068
|
name: positionals[2]
|
|
3065
3069
|
});
|
|
3066
3070
|
} catch (error) {
|
|
3067
|
-
throw
|
|
3071
|
+
throw createCliCommandError3({
|
|
3068
3072
|
command: "add",
|
|
3069
3073
|
error
|
|
3070
3074
|
});
|
|
@@ -3092,8 +3096,8 @@ var NODE_FALLBACK_COMMAND_DISPATCHERS = {
|
|
|
3092
3096
|
}) => {
|
|
3093
3097
|
const projectDir = positionals[1];
|
|
3094
3098
|
if (!projectDir) {
|
|
3095
|
-
throw
|
|
3096
|
-
code:
|
|
3099
|
+
throw createCliCommandError3({
|
|
3100
|
+
code: CLI_DIAGNOSTIC_CODES7.MISSING_ARGUMENT,
|
|
3097
3101
|
command: "create",
|
|
3098
3102
|
detailLines: [
|
|
3099
3103
|
"`wp-typia create` requires <project-dir>.",
|
|
@@ -3111,7 +3115,7 @@ var NODE_FALLBACK_COMMAND_DISPATCHERS = {
|
|
|
3111
3115
|
projectDir
|
|
3112
3116
|
});
|
|
3113
3117
|
} catch (error) {
|
|
3114
|
-
throw
|
|
3118
|
+
throw createCliCommandError3({
|
|
3115
3119
|
command: "create",
|
|
3116
3120
|
error
|
|
3117
3121
|
});
|
|
@@ -3189,7 +3193,7 @@ var NODE_FALLBACK_COMMAND_DISPATCHERS = {
|
|
|
3189
3193
|
}));
|
|
3190
3194
|
}
|
|
3191
3195
|
} catch (error) {
|
|
3192
|
-
throw
|
|
3196
|
+
throw createCliCommandError3({
|
|
3193
3197
|
command: "sync",
|
|
3194
3198
|
error
|
|
3195
3199
|
});
|
|
@@ -3203,8 +3207,8 @@ var NODE_FALLBACK_COMMAND_DISPATCHERS = {
|
|
|
3203
3207
|
const templateId = typeof mergedFlags.id === "string" ? mergedFlags.id : positionals[2];
|
|
3204
3208
|
const resolvedSubcommand = templateId ? "inspect" : subcommand ?? "list";
|
|
3205
3209
|
if (resolvedSubcommand !== "list" && resolvedSubcommand !== "inspect") {
|
|
3206
|
-
throw
|
|
3207
|
-
code:
|
|
3210
|
+
throw createCliCommandError3({
|
|
3211
|
+
code: CLI_DIAGNOSTIC_CODES7.INVALID_COMMAND,
|
|
3208
3212
|
command: "templates",
|
|
3209
3213
|
detailLines: [
|
|
3210
3214
|
`Unknown templates subcommand "${resolvedSubcommand}". Expected list or inspect.`
|
|
@@ -3229,6 +3233,7 @@ var NODE_FALLBACK_COMMAND_DISPATCHERS = {
|
|
|
3229
3233
|
async function runNodeCli(argv = process.argv.slice(2)) {
|
|
3230
3234
|
const normalizedArgv = normalizeWpTypiaArgv(argv);
|
|
3231
3235
|
const { argv: argvWithoutConfigOverride, configOverridePath } = extractWpTypiaConfigOverride(normalizedArgv);
|
|
3236
|
+
validateCliOutputFormatArgv(argvWithoutConfigOverride);
|
|
3232
3237
|
const { argv: cliArgv, flags } = parseGlobalFlags(argvWithoutConfigOverride);
|
|
3233
3238
|
const { flags: commandFlags, positionals } = parseArgv(cliArgv);
|
|
3234
3239
|
const rawMergedFlags = {
|
|
@@ -3305,4 +3310,4 @@ export {
|
|
|
3305
3310
|
hasFlagBeforeTerminator
|
|
3306
3311
|
};
|
|
3307
3312
|
|
|
3308
|
-
//# debugId=
|
|
3313
|
+
//# debugId=8CAE70B24462975F64756E2164756E21
|
|
@@ -6,7 +6,8 @@ import {
|
|
|
6
6
|
parseWorkspacePackageManagerId,
|
|
7
7
|
resolveWorkspaceProject,
|
|
8
8
|
tryResolveWorkspaceProject
|
|
9
|
-
} from "./cli-
|
|
9
|
+
} from "./cli-btbpt84c.js";
|
|
10
|
+
import"./cli-6bhfzq5e.js";
|
|
10
11
|
import"./cli-xnn9xjcy.js";
|
|
11
12
|
export {
|
|
12
13
|
tryResolveWorkspaceProject,
|
|
@@ -17,4 +18,4 @@ export {
|
|
|
17
18
|
WORKSPACE_TEMPLATE_PACKAGE
|
|
18
19
|
};
|
|
19
20
|
|
|
20
|
-
//# debugId=
|
|
21
|
+
//# debugId=C7B44E5AFEFF3A9264756E2164756E21
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wp-typia",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.4",
|
|
4
4
|
"description": "Canonical CLI package for wp-typia scaffolding and project workflows",
|
|
5
5
|
"packageManager": "bun@1.3.11",
|
|
6
6
|
"type": "module",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"@bunli/tui": "0.6.0",
|
|
71
71
|
"@bunli/utils": "0.6.0",
|
|
72
72
|
"@wp-typia/api-client": "^0.4.5",
|
|
73
|
-
"@wp-typia/project-tools": "0.22.
|
|
73
|
+
"@wp-typia/project-tools": "0.22.4",
|
|
74
74
|
"better-result": "^2.7.0",
|
|
75
75
|
"react": "^19.2.5",
|
|
76
76
|
"react-dom": "^19.2.5",
|