wp-typia 0.19.0 → 0.20.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.
- package/README.md +4 -2
- package/dist-bunli/.bunli/commands.gen.js +1843 -1216
- package/dist-bunli/.bunli/commands.gen.js.map +36 -33
- package/dist-bunli/cli-03j0axbt.js +163 -0
- package/dist-bunli/cli-03j0axbt.js.map +11 -0
- package/dist-bunli/{cli-7svz19s1.js → cli-2ybmc22r.js} +370 -86
- package/dist-bunli/{cli-7svz19s1.js.map → cli-2ybmc22r.js.map} +15 -14
- package/dist-bunli/cli-7yg38ht2.js +427 -0
- package/dist-bunli/cli-7yg38ht2.js.map +12 -0
- package/dist-bunli/{cli-yw0mq0wq.js → cli-93wd227r.js} +108 -3
- package/dist-bunli/cli-93wd227r.js.map +10 -0
- package/dist-bunli/{cli-kan7a6db.js → cli-a6dwqnhq.js} +24 -2
- package/dist-bunli/cli-a6dwqnhq.js.map +11 -0
- package/dist-bunli/{cli-add-j2c81sh1.js → cli-add-pq6wm87p.js} +16 -9
- package/dist-bunli/{cli-add-j2c81sh1.js.map → cli-add-pq6wm87p.js.map} +3 -3
- package/dist-bunli/{cli-diagnostics-c65hhyhx.js → cli-diagnostics-e5gxeprp.js} +8 -4
- package/dist-bunli/{cli-diagnostics-c65hhyhx.js.map → cli-diagnostics-e5gxeprp.js.map} +1 -1
- package/dist-bunli/{cli-doctor-hft0wr0e.js → cli-doctor-qk6fwpds.js} +14 -13
- package/dist-bunli/{cli-doctor-hft0wr0e.js.map → cli-doctor-qk6fwpds.js.map} +3 -3
- package/dist-bunli/{cli-572d6g4m.js → cli-hv2yedw2.js} +2 -157
- package/dist-bunli/{cli-572d6g4m.js.map → cli-hv2yedw2.js.map} +4 -6
- package/dist-bunli/{cli-scaffold-vcg6wem5.js → cli-scaffold-s3nhwe7x.js} +9 -7
- package/dist-bunli/cli-scaffold-s3nhwe7x.js.map +10 -0
- package/dist-bunli/cli-t73q5aqz.js +103 -0
- package/dist-bunli/cli-t73q5aqz.js.map +10 -0
- package/dist-bunli/{cli-templates-4qxszbmc.js → cli-templates-j65r4k9v.js} +1 -1
- package/dist-bunli/{cli-wtrvnce5.js → cli-w4r0rr8a.js} +8 -8
- package/dist-bunli/cli-w4r0rr8a.js.map +10 -0
- package/dist-bunli/cli.js +127 -2863
- package/dist-bunli/cli.js.map +5 -56
- package/dist-bunli/command-list-37n1za5q.js +2485 -0
- package/dist-bunli/command-list-37n1za5q.js.map +58 -0
- package/dist-bunli/node-cli.js +432 -323
- package/dist-bunli/node-cli.js.map +11 -10
- package/dist-bunli/{sync-x91y9jtv.js → sync-k2k8svyc.js} +3 -2
- package/dist-bunli/{sync-x91y9jtv.js.map → sync-k2k8svyc.js.map} +1 -1
- package/package.json +6 -3
- package/dist-bunli/cli-kan7a6db.js.map +0 -11
- package/dist-bunli/cli-scaffold-vcg6wem5.js.map +0 -10
- package/dist-bunli/cli-wtrvnce5.js.map +0 -10
- package/dist-bunli/cli-yw0mq0wq.js.map +0 -10
- /package/dist-bunli/{cli-templates-4qxszbmc.js.map → cli-templates-j65r4k9v.js.map} +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../wp-typia-project-tools/src/runtime/cli-diagnostics.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"/**\n * Shared human-readable diagnostics for non-interactive `wp-typia` CLI flows.\n */\nexport interface CliDiagnosticMessage {\n\tcode: CliDiagnosticCode;\n\tcommand: string;\n\tdetailLines: string[];\n\tsummary: string;\n}\n\nexport const CLI_DIAGNOSTIC_CODES = {\n\tCOMMAND_EXECUTION: \"command-execution\",\n\tCONFIGURATION_MISSING: \"configuration-missing\",\n\tDEPENDENCIES_NOT_INSTALLED: \"dependencies-not-installed\",\n\tDOCTOR_CHECK_FAILED: \"doctor-check-failed\",\n\tINVALID_ARGUMENT: \"invalid-argument\",\n\tINVALID_COMMAND: \"invalid-command\",\n\tMISSING_ARGUMENT: \"missing-argument\",\n\tMISSING_BUILD_ARTIFACT: \"missing-build-artifact\",\n\tOUTSIDE_PROJECT_ROOT: \"outside-project-root\",\n\tUNSUPPORTED_COMMAND: \"unsupported-command\",\n} as const;\n\nexport type CliDiagnosticCode =\n\t(typeof CLI_DIAGNOSTIC_CODES)[keyof typeof CLI_DIAGNOSTIC_CODES];\n\ntype DoctorCheckLike = {\n\tdetail: string;\n\tlabel: string;\n\tstatus: \"pass\" | \"fail\";\n};\n\nconst DEFAULT_CLI_FAILURE_SUMMARIES: Record<string, string> = {\n\tadd: \"Unable to complete the requested add workflow.\",\n\tcreate: \"Unable to complete the requested create workflow.\",\n\tdoctor: \"One or more doctor checks failed.\",\n\tmcp: \"Unable to inspect or sync MCP metadata.\",\n\tmigrate: \"Unable to complete the requested migration command.\",\n\tsync: \"Unable to complete the requested sync workflow.\",\n\ttemplates: \"Unable to inspect scaffold templates.\",\n};\n\nconst MIN_CLI_WRAP_COLUMNS = 32;\n\nfunction parseCliColumns(value: string | undefined): number | null {\n\tif (typeof value !== \"string\" || value.trim().length === 0) {\n\t\treturn null;\n\t}\n\n\tconst parsed = Number.parseInt(value, 10);\n\treturn Number.isFinite(parsed) && parsed >= MIN_CLI_WRAP_COLUMNS ? parsed : null;\n}\n\nfunction resolveCliWrapColumns(streamColumns: number | undefined): number | null {\n\treturn parseCliColumns(process.env.COLUMNS) ??\n\t\t(typeof streamColumns === \"number\" && streamColumns >= MIN_CLI_WRAP_COLUMNS\n\t\t\t? streamColumns\n\t\t\t: null);\n}\n\nfunction wrapCliText(text: string, maxWidth: number): string[] {\n\tconst words = text.trim().split(/\\s+/u).filter((word) => word.length > 0);\n\n\tif (words.length === 0) {\n\t\treturn [\"\"];\n\t}\n\n\tconst lines: string[] = [];\n\tlet currentLine = words[0] ?? \"\";\n\n\tfor (const word of words.slice(1)) {\n\t\tconst nextLine = `${currentLine} ${word}`;\n\t\tif (nextLine.length <= maxWidth) {\n\t\t\tcurrentLine = nextLine;\n\t\t\tcontinue;\n\t\t}\n\n\t\tlines.push(currentLine);\n\t\tcurrentLine = word;\n\t}\n\n\tlines.push(currentLine);\n\treturn lines;\n}\n\nfunction formatWrappedPrefixedLine(\n\tprefix: string,\n\ttext: string,\n\tcolumns: number | null,\n\tcontinuationIndent = \" \",\n): string[] {\n\tconst singleLine = `${prefix}${text}`;\n\tif (columns === null || singleLine.length <= columns) {\n\t\treturn [singleLine];\n\t}\n\n\tconst words = text.trim().split(/\\s+/u).filter((word) => word.length > 0);\n\tif (words.length === 0) {\n\t\treturn [prefix.trimEnd()];\n\t}\n\n\tconst continuationWidth = Math.max(1, columns - continuationIndent.length);\n\tconst firstLineWidth = columns - prefix.length;\n\tif (firstLineWidth <= 0 || (words[0]?.length ?? 0) > firstLineWidth) {\n\t\treturn [\n\t\t\tprefix.trimEnd(),\n\t\t\t...wrapCliText(text, continuationWidth).map((line) => `${continuationIndent}${line}`),\n\t\t];\n\t}\n\n\tconst lines: string[] = [];\n\tlet currentPrefix = prefix;\n\tlet currentWidth = Math.max(1, columns - currentPrefix.length);\n\tlet currentLine = words[0] ?? \"\";\n\n\tfor (const word of words.slice(1)) {\n\t\tconst nextLine = `${currentLine} ${word}`;\n\t\tif (nextLine.length <= currentWidth) {\n\t\t\tcurrentLine = nextLine;\n\t\t\tcontinue;\n\t\t}\n\n\t\tlines.push(`${currentPrefix}${currentLine}`);\n\t\tcurrentPrefix = continuationIndent;\n\t\tcurrentWidth = continuationWidth;\n\t\tcurrentLine = word;\n\t}\n\n\tlines.push(`${currentPrefix}${currentLine}`);\n\treturn lines;\n}\n\nfunction formatCliDiagnosticBlock(message: CliDiagnosticMessage): string {\n\tconst columns = resolveCliWrapColumns(process.stderr.columns);\n\tconst lines = [\n\t\t`wp-typia ${message.command} failed`,\n\t\t...formatWrappedPrefixedLine(\"Summary: \", message.summary, columns),\n\t];\n\n\tif (message.detailLines.length > 0) {\n\t\tlines.push(\"Details:\");\n\t\tfor (const detailLine of message.detailLines) {\n\t\t\tlines.push(...formatWrappedPrefixedLine(\"- \", detailLine, columns));\n\t\t}\n\t}\n\n\treturn lines.join(\"\\n\");\n}\n\nfunction getErrorMessage(error: unknown): string {\n\tif (error instanceof Error) {\n\t\treturn error.message;\n\t}\n\n\treturn String(error);\n}\n\nfunction normalizeDetailLines(detailLines: Array<string | null | undefined>): string[] {\n\treturn detailLines\n\t\t.flatMap((detailLine) =>\n\t\t\ttypeof detailLine === \"string\" ? detailLine.split(\"\\n\") : [],\n\t\t)\n\t\t.map((detailLine) => detailLine.trim())\n\t\t.filter((detailLine) => detailLine.length > 0);\n}\n\n/**\n * Structured CLI failure carrying a stable summary/detail layout.\n */\nexport class CliDiagnosticError extends Error {\n\treadonly code: CliDiagnosticCode;\n\treadonly command: string;\n\treadonly detailLines: string[];\n\treadonly summary: string;\n\n\tconstructor(message: CliDiagnosticMessage, options?: ErrorOptions) {\n\t\tsuper(formatCliDiagnosticBlock(message), options);\n\t\tthis.code = message.code;\n\t\tthis.command = message.command;\n\t\tthis.detailLines = [...message.detailLines];\n\t\tthis.name = \"CliDiagnosticError\";\n\t\tthis.summary = message.summary;\n\t}\n}\n\n/**\n * Narrow an unknown error to the shared CLI diagnostic error shape.\n */\nexport function isCliDiagnosticError(error: unknown): error is CliDiagnosticError {\n\treturn error instanceof CliDiagnosticError;\n}\n\nfunction isCliDiagnosticCode(value: unknown): value is CliDiagnosticCode {\n\treturn Object.values(CLI_DIAGNOSTIC_CODES).includes(value as CliDiagnosticCode);\n}\n\nfunction readCliDiagnosticCode(error: unknown): CliDiagnosticCode | null {\n\tif (isCliDiagnosticError(error)) {\n\t\treturn error.code;\n\t}\n\n\tif (typeof error === \"object\" && error !== null && \"code\" in error) {\n\t\tconst { code } = error as { code?: unknown };\n\t\tif (isCliDiagnosticCode(code)) {\n\t\t\treturn code;\n\t\t}\n\t}\n\n\treturn null;\n}\n\nfunction inferCliDiagnosticCode(options: {\n\tcommand: string;\n\tdetailLines: string[];\n\terror?: unknown;\n}): CliDiagnosticCode {\n\tconst inheritedCode = readCliDiagnosticCode(options.error);\n\tif (inheritedCode) {\n\t\treturn inheritedCode;\n\t}\n\n\tconst haystack = normalizeDetailLines([\n\t\t...options.detailLines,\n\t\toptions.error === undefined ? undefined : getErrorMessage(options.error),\n\t]).join(\"\\n\");\n\n\tif (/No MCP schema sources are configured\\./u.test(haystack)) {\n\t\treturn CLI_DIAGNOSTIC_CODES.CONFIGURATION_MISSING;\n\t}\n\tif (/Missing bundled build artifacts/u.test(haystack)) {\n\t\treturn CLI_DIAGNOSTIC_CODES.MISSING_BUILD_ARTIFACT;\n\t}\n\tif (/No generated wp-typia project root was found/u.test(haystack)) {\n\t\treturn CLI_DIAGNOSTIC_CODES.OUTSIDE_PROJECT_ROOT;\n\t}\n\tif (/dependencies have not been installed yet/u.test(haystack)) {\n\t\treturn CLI_DIAGNOSTIC_CODES.DEPENDENCIES_NOT_INSTALLED;\n\t}\n\tif (options.command === \"doctor\") {\n\t\treturn CLI_DIAGNOSTIC_CODES.DOCTOR_CHECK_FAILED;\n\t}\n\tif (/requires <|requires --/u.test(haystack)) {\n\t\treturn CLI_DIAGNOSTIC_CODES.MISSING_ARGUMENT;\n\t}\n\tif (\n\t\t/Unknown .*subcommand|Unknown add kind|Unknown template|removed in favor|does not support|The Bun-free fallback runtime does not support|The positional alias only accepts/u.test(\n\t\t\thaystack,\n\t\t)\n\t) {\n\t\treturn haystack.includes(\"does not support\") ||\n\t\t\thaystack.includes(\"The Bun-free fallback runtime does not support\")\n\t\t\t? CLI_DIAGNOSTIC_CODES.UNSUPPORTED_COMMAND\n\t\t\t: CLI_DIAGNOSTIC_CODES.INVALID_COMMAND;\n\t}\n\tif (\n\t\t/Invalid |must start with|cannot hook|cannot nest|cannot use|cannot be|already defines|already exists|Expected one of/u.test(\n\t\t\thaystack,\n\t\t)\n\t) {\n\t\treturn CLI_DIAGNOSTIC_CODES.INVALID_ARGUMENT;\n\t}\n\n\treturn CLI_DIAGNOSTIC_CODES.COMMAND_EXECUTION;\n}\n\n/**\n * Build a shared diagnostic error for one CLI command failure.\n */\nexport function createCliCommandError(options: {\n\tcommand: string;\n\tcode?: CliDiagnosticCode;\n\tdetailLines?: string[];\n\terror?: unknown;\n\tsummary?: string;\n}): CliDiagnosticError {\n\tif (isCliDiagnosticError(options.error)) {\n\t\treturn options.error;\n\t}\n\n\tconst summary =\n\t\toptions.summary ?? DEFAULT_CLI_FAILURE_SUMMARIES[options.command] ?? \"Command failed.\";\n\tconst detailLines = normalizeDetailLines(\n\t\toptions.detailLines ?? [options.error === undefined ? undefined : getErrorMessage(options.error)],\n\t);\n\tconst code =\n\t\toptions.code ??\n\t\tinferCliDiagnosticCode({\n\t\t\tcommand: options.command,\n\t\t\tdetailLines,\n\t\t\terror: options.error,\n\t\t});\n\n\treturn new CliDiagnosticError(\n\t\t{\n\t\t\tcode,\n\t\t\tcommand: options.command,\n\t\t\tdetailLines,\n\t\t\tsummary,\n\t\t},\n\t\toptions.error instanceof Error ? { cause: options.error } : undefined,\n\t);\n}\n\n/**\n * Render a CLI diagnostic block. Non-diagnostic errors fall back to their\n * plain message so existing non-command failures keep working.\n */\nexport function formatCliDiagnosticError(error: unknown): string {\n\tif (!isCliDiagnosticError(error)) {\n\t\treturn getErrorMessage(error);\n\t}\n\n\treturn formatCliDiagnosticBlock({\n\t\tcode: error.code,\n\t\tcommand: error.command,\n\t\tdetailLines: error.detailLines,\n\t\tsummary: error.summary,\n\t});\n}\n\nexport function serializeCliDiagnosticError(error: unknown): {\n\tcode: CliDiagnosticCode;\n\tcommand?: string;\n\tdetailLines?: string[];\n\tkind: \"command-execution\";\n\tmessage: string;\n\tname: string;\n\tsummary?: string;\n\ttag: \"CommandExecutionError\";\n} {\n\tif (isCliDiagnosticError(error)) {\n\t\treturn {\n\t\t\tcode: error.code,\n\t\t\tcommand: error.command,\n\t\t\tdetailLines: [...error.detailLines],\n\t\t\tkind: \"command-execution\",\n\t\t\tmessage: formatCliDiagnosticBlock({\n\t\t\t\tcode: error.code,\n\t\t\t\tcommand: error.command,\n\t\t\t\tdetailLines: error.detailLines,\n\t\t\t\tsummary: error.summary,\n\t\t\t}),\n\t\t\tname: error.name,\n\t\t\tsummary: error.summary,\n\t\t\ttag: \"CommandExecutionError\",\n\t\t};\n\t}\n\n\treturn {\n\t\tcode: inferCliDiagnosticCode({\n\t\t\tcommand: \"unknown\",\n\t\t\tdetailLines: [],\n\t\t\terror,\n\t\t}),\n\t\tkind: \"command-execution\",\n\t\tmessage: getErrorMessage(error),\n\t\tname: error instanceof Error ? error.name : \"Error\",\n\t\ttag: \"CommandExecutionError\",\n\t};\n}\n\n/**\n * Format one human-readable doctor check row.\n */\nexport function formatDoctorCheckLine(check: DoctorCheckLike): string {\n\treturn formatWrappedPrefixedLine(\n\t\t`${check.status === \"pass\" ? \"PASS\" : \"FAIL\"} ${check.label}: `,\n\t\tcheck.detail,\n\t\tresolveCliWrapColumns(process.stdout.columns),\n\t).join(\"\\n\");\n}\n\n/**\n * Return the failing doctor checks from one doctor run.\n */\nexport function getFailingDoctorChecks<TCheck extends DoctorCheckLike>(\n\tchecks: readonly TCheck[],\n): TCheck[] {\n\treturn checks.filter((check) => check.status === \"fail\");\n}\n\n/**\n * Format the final doctor summary row.\n */\nexport function formatDoctorSummaryLine(checks: readonly DoctorCheckLike[]): string {\n\tconst failedChecks = getFailingDoctorChecks(checks);\n\treturn formatWrappedPrefixedLine(\n\t\t`${failedChecks.length === 0 ? \"PASS\" : \"FAIL\"} wp-typia doctor summary: `,\n\t\t`${checks.length - failedChecks.length}/${checks.length} checks passed`,\n\t\tresolveCliWrapColumns(process.stdout.columns),\n\t).join(\"\\n\");\n}\n\n/**\n * Build detail lines for doctor failures so the non-interactive formatter can\n * restate the failed checks after the streaming rows.\n */\nexport function getDoctorFailureDetailLines(checks: readonly DoctorCheckLike[]): string[] {\n\treturn getFailingDoctorChecks(checks).map((check) => `${check.label}: ${check.detail}`);\n}\n"
|
|
6
|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Id": "FAC56547BE07902964756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -45,14 +45,36 @@ function getRemovedBuiltInTemplateMessage(templateId) {
|
|
|
45
45
|
|
|
46
46
|
// ../wp-typia-project-tools/src/runtime/template-registry.ts
|
|
47
47
|
var __dirname2 = path.dirname(fileURLToPath(import.meta.url));
|
|
48
|
+
var PROJECT_TOOLS_PACKAGE_ROOT_ENV = "WP_TYPIA_PROJECT_TOOLS_PACKAGE_ROOT";
|
|
49
|
+
var PROJECT_TOOLS_PACKAGE_NAME = "@wp-typia/project-tools";
|
|
50
|
+
function resolveValidProjectToolsPackageRoot(candidateRoot) {
|
|
51
|
+
const packageJsonPath = path.join(candidateRoot, "package.json");
|
|
52
|
+
if (!fs.existsSync(packageJsonPath)) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
|
|
57
|
+
return packageJson.name === PROJECT_TOOLS_PACKAGE_NAME ? candidateRoot : undefined;
|
|
58
|
+
} catch {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
48
62
|
function resolvePackageRoot(startDir) {
|
|
63
|
+
const overriddenPackageRoot = process.env[PROJECT_TOOLS_PACKAGE_ROOT_ENV]?.trim();
|
|
64
|
+
if (overriddenPackageRoot) {
|
|
65
|
+
const resolvedOverride = path.resolve(overriddenPackageRoot);
|
|
66
|
+
const validOverride = resolveValidProjectToolsPackageRoot(resolvedOverride);
|
|
67
|
+
if (validOverride) {
|
|
68
|
+
return validOverride;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
49
71
|
let currentDir = startDir;
|
|
50
72
|
while (true) {
|
|
51
73
|
const packageJsonPath = path.join(currentDir, "package.json");
|
|
52
74
|
if (fs.existsSync(packageJsonPath)) {
|
|
53
75
|
try {
|
|
54
76
|
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
|
|
55
|
-
if (packageJson.name ===
|
|
77
|
+
if (packageJson.name === PROJECT_TOOLS_PACKAGE_NAME) {
|
|
56
78
|
return currentDir;
|
|
57
79
|
}
|
|
58
80
|
} catch {}
|
|
@@ -155,4 +177,4 @@ function getTemplateSelectOptions() {
|
|
|
155
177
|
|
|
156
178
|
export { BUILTIN_BLOCK_METADATA_VERSION, COMPOUND_CHILD_BLOCK_METADATA_DEFAULTS, getBuiltInTemplateMetadataDefaults, isRemovedBuiltInTemplateId, getRemovedBuiltInTemplateMessage, PROJECT_TOOLS_PACKAGE_ROOT, SHARED_BASE_TEMPLATE_ROOT, SHARED_COMPOUND_TEMPLATE_ROOT, SHARED_PERSISTENCE_TEMPLATE_ROOT, SHARED_PRESET_TEMPLATE_ROOT, SHARED_REST_HELPER_TEMPLATE_ROOT, SHARED_MIGRATION_UI_TEMPLATE_ROOT, SHARED_WORKSPACE_TEMPLATE_ROOT, SHARED_TEST_PRESET_TEMPLATE_ROOT, SHARED_WP_ENV_PRESET_TEMPLATE_ROOT, BUILTIN_TEMPLATE_IDS, OFFICIAL_WORKSPACE_TEMPLATE_PACKAGE, TEMPLATE_IDS, isBuiltInTemplateId, listTemplates, getTemplateById, getTemplateSelectOptions };
|
|
157
179
|
|
|
158
|
-
//# debugId=
|
|
180
|
+
//# debugId=4B25E5AE2392289964756E2164756E21
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../wp-typia-project-tools/src/runtime/template-registry.ts", "../../wp-typia-project-tools/src/runtime/template-defaults.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport { getBuiltInTemplateMetadataDefaults } from \"./template-defaults.js\";\n\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\nconst PROJECT_TOOLS_PACKAGE_ROOT_ENV = \"WP_TYPIA_PROJECT_TOOLS_PACKAGE_ROOT\";\nconst PROJECT_TOOLS_PACKAGE_NAME = \"@wp-typia/project-tools\";\n\nfunction resolveValidProjectToolsPackageRoot(\n\tcandidateRoot: string,\n): string | undefined {\n\tconst packageJsonPath = path.join(candidateRoot, \"package.json\");\n\tif (!fs.existsSync(packageJsonPath)) {\n\t\treturn undefined;\n\t}\n\n\ttry {\n\t\tconst packageJson = JSON.parse(fs.readFileSync(packageJsonPath, \"utf8\")) as {\n\t\t\tname?: string;\n\t\t};\n\t\treturn packageJson.name === PROJECT_TOOLS_PACKAGE_NAME\n\t\t\t? candidateRoot\n\t\t\t: undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\n/**\n * Resolve the canonical `@wp-typia/project-tools` package root.\n *\n * When `WP_TYPIA_PROJECT_TOOLS_PACKAGE_ROOT` is set, the override is only\n * accepted if it points at a readable package manifest whose `name` matches\n * `@wp-typia/project-tools`. Invalid or stale overrides are ignored and normal\n * upward package-root discovery continues.\n */\nexport function resolvePackageRoot(startDir: string): string {\n\tconst overriddenPackageRoot = process.env[PROJECT_TOOLS_PACKAGE_ROOT_ENV]?.trim();\n\tif (overriddenPackageRoot) {\n\t\tconst resolvedOverride = path.resolve(overriddenPackageRoot);\n\t\tconst validOverride = resolveValidProjectToolsPackageRoot(resolvedOverride);\n\t\tif (validOverride) {\n\t\t\treturn validOverride;\n\t\t}\n\t}\n\n\tlet currentDir = startDir;\n\n\twhile (true) {\n\t\tconst packageJsonPath = path.join(currentDir, \"package.json\");\n\t\tif (fs.existsSync(packageJsonPath)) {\n\t\t\ttry {\n\t\t\t\tconst packageJson = JSON.parse(fs.readFileSync(packageJsonPath, \"utf8\")) as { name?: string };\n\t\t\t\tif (packageJson.name === PROJECT_TOOLS_PACKAGE_NAME) {\n\t\t\t\t\treturn currentDir;\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// Ignore malformed package.json while walking upward.\n\t\t\t}\n\t\t}\n\n\t\tconst parentDir = path.dirname(currentDir);\n\t\tif (parentDir === currentDir) {\n\t\t\tthrow new Error(\"Unable to resolve the @wp-typia/project-tools package root.\");\n\t\t}\n\t\tcurrentDir = parentDir;\n\t}\n}\n\nexport const PROJECT_TOOLS_PACKAGE_ROOT = resolvePackageRoot(__dirname);\nexport const TEMPLATE_ROOT = path.join(PROJECT_TOOLS_PACKAGE_ROOT, \"templates\");\nexport const SHARED_TEMPLATE_ROOT = path.join(TEMPLATE_ROOT, \"_shared\");\nexport const SHARED_BASE_TEMPLATE_ROOT = path.join(SHARED_TEMPLATE_ROOT, \"base\");\nexport const SHARED_COMPOUND_TEMPLATE_ROOT = path.join(SHARED_TEMPLATE_ROOT, \"compound\");\nexport const SHARED_PERSISTENCE_TEMPLATE_ROOT = path.join(SHARED_TEMPLATE_ROOT, \"persistence\");\nexport const SHARED_PRESET_TEMPLATE_ROOT = path.join(SHARED_TEMPLATE_ROOT, \"presets\");\nexport const SHARED_REST_HELPER_TEMPLATE_ROOT = path.join(SHARED_TEMPLATE_ROOT, \"rest-helpers\");\nexport const SHARED_MIGRATION_UI_TEMPLATE_ROOT = path.join(SHARED_TEMPLATE_ROOT, \"migration-ui\");\n/**\n * Shared workspace template overlay root used by workspace scaffolding flows.\n */\nexport const SHARED_WORKSPACE_TEMPLATE_ROOT = path.join(SHARED_TEMPLATE_ROOT, \"workspace\");\nexport const SHARED_TEST_PRESET_TEMPLATE_ROOT = path.join(SHARED_PRESET_TEMPLATE_ROOT, \"test-preset\");\nexport const SHARED_WP_ENV_PRESET_TEMPLATE_ROOT = path.join(SHARED_PRESET_TEMPLATE_ROOT, \"wp-env\");\nexport const BUILTIN_TEMPLATE_IDS = [\n\t\"basic\",\n\t\"interactivity\",\n\t\"persistence\",\n\t\"compound\",\n\t\"query-loop\",\n] as const;\nexport const OFFICIAL_WORKSPACE_TEMPLATE_PACKAGE = \"@wp-typia/create-workspace-template\";\nexport type BuiltInTemplateId = (typeof BUILTIN_TEMPLATE_IDS)[number];\nexport type PersistencePolicy = \"authenticated\" | \"public\";\n\nexport interface TemplateDefinition {\n\tid: string;\n\tdescription: string;\n\tdefaultCategory: string;\n\tfeatures: string[];\n\ttemplateDir: string;\n}\n\nexport const TEMPLATE_REGISTRY = Object.freeze<TemplateDefinition[]>([\n\t{\n\t\tid: \"basic\",\n\t\tdescription: \"A lightweight WordPress block with Typia validation\",\n\t\tdefaultCategory: getBuiltInTemplateMetadataDefaults(\"basic\").category,\n\t\tfeatures: [\"Type-safe attributes\", \"Runtime validation\", \"Minimal setup\"],\n\t\ttemplateDir: path.join(TEMPLATE_ROOT, \"basic\"),\n\t},\n\t{\n\t\tid: \"interactivity\",\n\t\tdescription: \"An interactive WordPress block with Typia validation and Interactivity API\",\n\t\tdefaultCategory: getBuiltInTemplateMetadataDefaults(\"interactivity\").category,\n\t\tfeatures: [\"Interactivity API\", \"Client-side state\", \"Event handling\"],\n\t\ttemplateDir: path.join(TEMPLATE_ROOT, \"interactivity\"),\n\t},\n\t{\n\t\tid: \"persistence\",\n\t\tdescription: \"A persistence-aware WordPress block with Typia validation, typed REST contracts, and selectable public or authenticated write policies\",\n\t\tdefaultCategory: getBuiltInTemplateMetadataDefaults(\"persistence\").category,\n\t\tfeatures: [\"Interactivity API\", \"Typed REST client\", \"Schema sync\", \"Persistence policies\"],\n\t\ttemplateDir: path.join(TEMPLATE_ROOT, \"persistence\"),\n\t},\n\t{\n\t\tid: \"compound\",\n\t\tdescription: \"A parent-and-child WordPress block scaffold with InnerBlocks, optional persistence wiring, and hidden implementation child blocks\",\n\t\tdefaultCategory: getBuiltInTemplateMetadataDefaults(\"compound\").category,\n\t\tfeatures: [\"InnerBlocks\", \"Hidden child blocks\", \"Optional persistence layer\"],\n\t\ttemplateDir: path.join(TEMPLATE_ROOT, \"compound\"),\n\t},\n\t{\n\t\tid: \"query-loop\",\n\t\tdescription: \"A Query Loop block variation scaffold with stable namespace-based identity, inline starter layout, connected pattern presets, custom query seams, and runtime parity hooks\",\n\t\tdefaultCategory: getBuiltInTemplateMetadataDefaults(\"query-loop\").category,\n\t\tfeatures: [\"core/query variation\", \"Default innerBlocks\", \"Connected patterns\", \"Custom query hooks\", \"Runtime parity hooks\", \"Allowed controls\"],\n\t\ttemplateDir: path.join(TEMPLATE_ROOT, \"query-loop\"),\n\t},\n\t{\n\t\tid: OFFICIAL_WORKSPACE_TEMPLATE_PACKAGE,\n\t\tdescription: \"The official empty workspace template that powers `wp-typia add ...` workflows\",\n\t\tdefaultCategory: \"workspace\",\n\t\tfeatures: [\"Workspace inventory\", \"Add block workflows\", \"Workspace doctor and migrate\"],\n\t\ttemplateDir: path.resolve(PROJECT_TOOLS_PACKAGE_ROOT, \"..\", \"create-workspace-template\"),\n\t},\n]);\n\nexport const TEMPLATE_IDS = [...BUILTIN_TEMPLATE_IDS] as BuiltInTemplateId[];\n\nexport function isBuiltInTemplateId(templateId: string): templateId is BuiltInTemplateId {\n\treturn (BUILTIN_TEMPLATE_IDS as readonly string[]).includes(templateId);\n}\n\nexport function listTemplates(): readonly TemplateDefinition[] {\n\treturn TEMPLATE_REGISTRY;\n}\n\nexport function getTemplateById(templateId: string): TemplateDefinition {\n\tconst template = TEMPLATE_REGISTRY.find((entry) => entry.id === templateId);\n\tif (!template) {\n\t\tthrow new Error(\n\t\t\t`Unknown template \"${templateId}\". Expected one of: ${[\n\t\t\t\t...TEMPLATE_IDS,\n\t\t\t\tOFFICIAL_WORKSPACE_TEMPLATE_PACKAGE,\n\t\t\t].join(\", \")}`,\n\t\t);\n\t}\n\treturn template;\n}\n\nexport function getTemplateSelectOptions(): Array<{\n\tlabel: string;\n\tvalue: TemplateDefinition[\"id\"];\n\thint: string;\n}> {\n\treturn TEMPLATE_REGISTRY.map((template) => ({\n\t\tlabel: template.id,\n\t\tvalue: template.id,\n\t\thint: template.features.join(\", \"),\n\t}));\n}\n",
|
|
6
|
+
"/**\n * Internal built-in template metadata defaults used by scaffold rendering.\n */\nexport const BUILTIN_BLOCK_METADATA_VERSION = \"0.1.0\";\n\n/**\n * Built-in parent block metadata defaults keyed by template id.\n */\nexport const BUILTIN_TEMPLATE_METADATA_DEFAULTS = Object.freeze({\n\tbasic: Object.freeze({\n\t\tcategory: \"text\",\n\t\ticon: \"smiley\",\n\t}),\n\tinteractivity: Object.freeze({\n\t\tcategory: \"widgets\",\n\t\ticon: \"smiley\",\n\t}),\n\tpersistence: Object.freeze({\n\t\tcategory: \"widgets\",\n\t\ticon: \"database\",\n\t}),\n\tcompound: Object.freeze({\n\t\tcategory: \"widgets\",\n\t\ticon: \"screenoptions\",\n\t}),\n\t\"query-loop\": Object.freeze({\n\t\tcategory: \"widgets\",\n\t\ticon: \"query-pagination\",\n\t}),\n});\n\n/**\n * Shared hidden child block metadata defaults for compound scaffolds.\n */\nexport const COMPOUND_CHILD_BLOCK_METADATA_DEFAULTS = Object.freeze({\n\tcategory: \"widgets\",\n\ticon: \"excerpt-view\",\n});\n\n/**\n * Legacy built-in template ids that were removed in favor of persistence modes.\n */\nexport const REMOVED_BUILTIN_TEMPLATE_IDS = [\"data\", \"persisted\"] as const;\n/**\n * Union of removed built-in template ids accepted by compatibility checks.\n */\nexport type RemovedBuiltInTemplateId = (typeof REMOVED_BUILTIN_TEMPLATE_IDS)[number];\n\n/**\n * Returns the metadata defaults for a built-in scaffold template id.\n *\n * @param templateId Built-in template id whose metadata defaults should be read.\n * @returns The stable category/icon defaults used by scaffold rendering.\n */\nexport function getBuiltInTemplateMetadataDefaults(\n\ttemplateId: keyof typeof BUILTIN_TEMPLATE_METADATA_DEFAULTS,\n) {\n\treturn BUILTIN_TEMPLATE_METADATA_DEFAULTS[templateId];\n}\n\n/**\n * Checks whether a template id points at a removed built-in scaffold.\n *\n * @param templateId Template id supplied to scaffold resolution.\n * @returns True when the template id is one of the removed legacy built-ins.\n */\nexport function isRemovedBuiltInTemplateId(\n\ttemplateId: string,\n): templateId is RemovedBuiltInTemplateId {\n\treturn (REMOVED_BUILTIN_TEMPLATE_IDS as readonly string[]).includes(templateId);\n}\n\n/**\n * Builds the stable recovery guidance shown for removed built-in template ids.\n *\n * @param templateId Removed template id, where `data` maps to the public policy and\n * `persisted` maps to the authenticated policy.\n * @returns A user-facing error string in the form\n * `Built-in template \"<id>\" was removed. Use --template persistence --persistence-policy <policy> instead.`\n */\nexport function getRemovedBuiltInTemplateMessage(templateId: RemovedBuiltInTemplateId): string {\n\treturn `Built-in template \"${templateId}\" was removed. Use --template persistence --persistence-policy ${\n\t\ttemplateId === \"data\" ? \"public\" : \"authenticated\"\n\t} instead.`;\n}\n"
|
|
7
|
+
],
|
|
8
|
+
"mappings": ";;AAAA;AACA;AACA;;;ACCO,IAAM,iCAAiC;AAKvC,IAAM,qCAAqC,OAAO,OAAO;AAAA,EAC/D,OAAO,OAAO,OAAO;AAAA,IACpB,UAAU;AAAA,IACV,MAAM;AAAA,EACP,CAAC;AAAA,EACD,eAAe,OAAO,OAAO;AAAA,IAC5B,UAAU;AAAA,IACV,MAAM;AAAA,EACP,CAAC;AAAA,EACD,aAAa,OAAO,OAAO;AAAA,IAC1B,UAAU;AAAA,IACV,MAAM;AAAA,EACP,CAAC;AAAA,EACD,UAAU,OAAO,OAAO;AAAA,IACvB,UAAU;AAAA,IACV,MAAM;AAAA,EACP,CAAC;AAAA,EACD,cAAc,OAAO,OAAO;AAAA,IAC3B,UAAU;AAAA,IACV,MAAM;AAAA,EACP,CAAC;AACF,CAAC;AAKM,IAAM,yCAAyC,OAAO,OAAO;AAAA,EACnE,UAAU;AAAA,EACV,MAAM;AACP,CAAC;AAKM,IAAM,+BAA+B,CAAC,QAAQ,WAAW;AAYzD,SAAS,kCAAkC,CACjD,YACC;AAAA,EACD,OAAO,mCAAmC;AAAA;AASpC,SAAS,0BAA0B,CACzC,YACyC;AAAA,EACzC,OAAQ,6BAAmD,SAAS,UAAU;AAAA;AAWxE,SAAS,gCAAgC,CAAC,YAA8C;AAAA,EAC9F,OAAO,sBAAsB,4EAC5B,eAAe,SAAS,WAAW;AAAA;;;AD5ErC,IAAM,aAAY,KAAK,QAAQ,cAAc,YAAY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
|
|
11
|
+
}
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
resolveTemplateSeed,
|
|
15
15
|
scaffoldProject,
|
|
16
16
|
syncPersistenceRestArtifacts
|
|
17
|
-
} from "./cli-
|
|
17
|
+
} from "./cli-2ybmc22r.js";
|
|
18
18
|
import {
|
|
19
19
|
ensureMigrationDirectories,
|
|
20
20
|
parseMigrationConfig,
|
|
@@ -26,10 +26,10 @@ import"./cli-bq2v559b.js";
|
|
|
26
26
|
import {
|
|
27
27
|
formatInstallCommand
|
|
28
28
|
} from "./cli-1b5jx6j9.js";
|
|
29
|
-
import"./cli-
|
|
29
|
+
import"./cli-w4r0rr8a.js";
|
|
30
30
|
import {
|
|
31
31
|
SHARED_WORKSPACE_TEMPLATE_ROOT
|
|
32
|
-
} from "./cli-
|
|
32
|
+
} from "./cli-a6dwqnhq.js";
|
|
33
33
|
import {
|
|
34
34
|
ADD_BLOCK_TEMPLATE_IDS,
|
|
35
35
|
ADD_KIND_IDS,
|
|
@@ -65,6 +65,9 @@ import {
|
|
|
65
65
|
toKebabCase,
|
|
66
66
|
toTitleCase
|
|
67
67
|
} from "./cli-rg481yks.js";
|
|
68
|
+
import {
|
|
69
|
+
createManagedTempRoot
|
|
70
|
+
} from "./cli-t73q5aqz.js";
|
|
68
71
|
import {
|
|
69
72
|
resolveWorkspaceProject
|
|
70
73
|
} from "./cli-pd5pqgre.js";
|
|
@@ -72,7 +75,6 @@ import"./cli-xnn9xjcy.js";
|
|
|
72
75
|
// ../wp-typia-project-tools/src/runtime/cli-add-block.ts
|
|
73
76
|
import fs2 from "fs";
|
|
74
77
|
import { promises as fsp2 } from "fs";
|
|
75
|
-
import os from "os";
|
|
76
78
|
import path3 from "path";
|
|
77
79
|
import {
|
|
78
80
|
syncBlockMetadata
|
|
@@ -652,6 +654,7 @@ async function runAddBlockCommand({
|
|
|
652
654
|
selectExternalLayerId
|
|
653
655
|
});
|
|
654
656
|
let tempRoot = "";
|
|
657
|
+
let cleanupTempRoot;
|
|
655
658
|
try {
|
|
656
659
|
const normalizedSlug = resolveNonEmptyNormalizedBlockSlug({
|
|
657
660
|
input: blockName,
|
|
@@ -659,7 +662,10 @@ async function runAddBlockCommand({
|
|
|
659
662
|
usage: "wp-typia add block <name> --template <family>"
|
|
660
663
|
});
|
|
661
664
|
const defaults = getDefaultAnswers(normalizedSlug, resolvedTemplateId);
|
|
662
|
-
|
|
665
|
+
({
|
|
666
|
+
path: tempRoot,
|
|
667
|
+
cleanup: cleanupTempRoot
|
|
668
|
+
} = await createManagedTempRoot("wp-typia-add-block-"));
|
|
663
669
|
const tempProjectDir = path3.join(tempRoot, normalizedSlug);
|
|
664
670
|
const blockConfigPath = path3.join(workspace.projectDir, "scripts", "block-config.ts");
|
|
665
671
|
const migrationConfigPath = path3.join(workspace.projectDir, "src", "migrations", "config.ts");
|
|
@@ -729,9 +735,10 @@ async function runAddBlockCommand({
|
|
|
729
735
|
throw error;
|
|
730
736
|
}
|
|
731
737
|
} finally {
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
738
|
+
try {
|
|
739
|
+
await resolvedExternalLayerSelection.cleanup?.();
|
|
740
|
+
} finally {
|
|
741
|
+
await cleanupTempRoot?.();
|
|
735
742
|
}
|
|
736
743
|
}
|
|
737
744
|
}
|
|
@@ -3000,4 +3007,4 @@ export {
|
|
|
3000
3007
|
ADD_BLOCK_TEMPLATE_IDS
|
|
3001
3008
|
};
|
|
3002
3009
|
|
|
3003
|
-
//# debugId=
|
|
3010
|
+
//# debugId=463512A631ED386C64756E2164756E21
|