wp-typia 0.24.4 → 0.24.5

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.
Files changed (58) hide show
  1. package/README.md +7 -5
  2. package/bin/wp-typia.js +24 -103
  3. package/{dist-bunli/node-cli.js → dist/cli.js} +5013 -3687
  4. package/package.json +9 -36
  5. package/bin/routing-metadata.generated.d.ts +0 -8
  6. package/bin/routing-metadata.generated.js +0 -93
  7. package/bin/runtime-routing.d.ts +0 -34
  8. package/bin/runtime-routing.js +0 -124
  9. package/dist-bunli/.bunli/commands.gen.js +0 -304441
  10. package/dist-bunli/.bunli/highlights-eq9cgrbb.scm +0 -604
  11. package/dist-bunli/.bunli/highlights-ghv9g403.scm +0 -205
  12. package/dist-bunli/.bunli/highlights-hk7bwhj4.scm +0 -284
  13. package/dist-bunli/.bunli/highlights-r812a2qc.scm +0 -150
  14. package/dist-bunli/.bunli/highlights-x6tmsnaa.scm +0 -115
  15. package/dist-bunli/.bunli/injections-73j83es3.scm +0 -27
  16. package/dist-bunli/.bunli/tree-sitter-javascript-nd0q4pe9.wasm +0 -0
  17. package/dist-bunli/.bunli/tree-sitter-markdown-411r6y9b.wasm +0 -0
  18. package/dist-bunli/.bunli/tree-sitter-markdown_inline-j5349f42.wasm +0 -0
  19. package/dist-bunli/.bunli/tree-sitter-typescript-zxjzwt75.wasm +0 -0
  20. package/dist-bunli/.bunli/tree-sitter-zig-e78zbjpm.wasm +0 -0
  21. package/dist-bunli/agents-91fpdyyt.js +0 -12
  22. package/dist-bunli/chunk-bdqvmfwv-f5qmzmxg.js +0 -16825
  23. package/dist-bunli/cli-03j0axbt.js +0 -163
  24. package/dist-bunli/cli-1170yyve.js +0 -106
  25. package/dist-bunli/cli-368d4cgy.js +0 -1235
  26. package/dist-bunli/cli-377p86mf.js +0 -191
  27. package/dist-bunli/cli-6v0pcxw6.js +0 -314
  28. package/dist-bunli/cli-84c7wff4.js +0 -198
  29. package/dist-bunli/cli-8hxf9qw6.js +0 -198
  30. package/dist-bunli/cli-9fx0qgb7.js +0 -3680
  31. package/dist-bunli/cli-ac2ebaf8.js +0 -3
  32. package/dist-bunli/cli-add-qjd3ba8j.js +0 -10671
  33. package/dist-bunli/cli-am5x7tb4.js +0 -192
  34. package/dist-bunli/cli-bajwv85z.js +0 -24
  35. package/dist-bunli/cli-ccax7s0s.js +0 -34
  36. package/dist-bunli/cli-cvxvcw7c.js +0 -46
  37. package/dist-bunli/cli-diagnostics-10drxh34.js +0 -34
  38. package/dist-bunli/cli-doctor-6fyxq940.js +0 -1446
  39. package/dist-bunli/cli-e4bwd81c.js +0 -1260
  40. package/dist-bunli/cli-fv4h3ydt.js +0 -173823
  41. package/dist-bunli/cli-hv2yedw2.js +0 -74591
  42. package/dist-bunli/cli-init-7avk42dh.js +0 -880
  43. package/dist-bunli/cli-kfm9mm68.js +0 -14679
  44. package/dist-bunli/cli-prompt-ncyg68rn.js +0 -12
  45. package/dist-bunli/cli-rdcga1bd.js +0 -135
  46. package/dist-bunli/cli-scaffold-0bb6pr3w.js +0 -538
  47. package/dist-bunli/cli-t73q5aqz.js +0 -103
  48. package/dist-bunli/cli-templates-g8t4fm11.js +0 -167
  49. package/dist-bunli/cli-tj7ajdvf.js +0 -2612
  50. package/dist-bunli/cli-tq730sqt.js +0 -344
  51. package/dist-bunli/cli-xnn9xjcy.js +0 -68
  52. package/dist-bunli/cli-z48frc8t.js +0 -229
  53. package/dist-bunli/cli.js +0 -2523
  54. package/dist-bunli/command-list-y3g7e9rb.js +0 -4013
  55. package/dist-bunli/create-template-validation-4fr851vg.js +0 -16
  56. package/dist-bunli/migrations-3vngdy51.js +0 -47
  57. package/dist-bunli/sync-k2k8svyc.js +0 -13
  58. package/dist-bunli/workspace-project-gmv2a71z.js +0 -22
@@ -1,163 +0,0 @@
1
- // @bun
2
- import {
3
- renderFull
4
- } from "./cli-hv2yedw2.js";
5
- import {
6
- builtinAgents,
7
- detectAgents
8
- } from "./cli-6v0pcxw6.js";
9
-
10
- // ../../node_modules/.bun/@bunli+plugin-skills@0.1.0+44deef6f8e4a2f18/node_modules/@bunli/plugin-skills/src/sync.ts
11
- import * as fs from "fs";
12
- import * as fsp from "fs/promises";
13
- import * as os from "os";
14
- import * as path from "path";
15
- import { createHash } from "crypto";
16
-
17
- // ../../node_modules/.bun/@bunli+plugin-skills@0.1.0+44deef6f8e4a2f18/node_modules/@bunli/plugin-skills/src/generate.ts
18
- function generateSkillFile(cliName, commands, options = {}) {
19
- const { description } = options;
20
- const slug = cliName.replace(/\s+/g, "-");
21
- const frontmatter = renderFrontmatter({
22
- name: slug,
23
- ...description ? { description } : {}
24
- });
25
- const body = renderFull(cliName, commands, description);
26
- return `${frontmatter}
27
-
28
- ${body}
29
- `;
30
- }
31
- function renderFrontmatter(fields) {
32
- const lines = ["---"];
33
- for (const [key, value] of Object.entries(fields)) {
34
- lines.push(`${key}: ${formatFrontmatterValue(key, value)}`);
35
- }
36
- lines.push("---");
37
- return lines.join(`
38
- `);
39
- }
40
- function formatFrontmatterValue(key, value) {
41
- if (key === "name" && /^[a-z0-9][a-z0-9-]*$/.test(value)) {
42
- return value;
43
- }
44
- return JSON.stringify(value);
45
- }
46
-
47
- // ../../node_modules/.bun/@bunli+plugin-skills@0.1.0+44deef6f8e4a2f18/node_modules/@bunli/plugin-skills/src/sync.ts
48
- var defaultSyncRuntime = {
49
- homeDir: () => os.homedir(),
50
- dataHome: () => process.env.XDG_DATA_HOME || path.join(os.homedir(), ".local", "share")
51
- };
52
- async function syncSkills(cliName, commands, options = {}, runtime = defaultSyncRuntime) {
53
- const {
54
- global: isGlobal = true,
55
- force = false,
56
- description,
57
- cwd = process.cwd()
58
- } = options;
59
- const canonicalBase = path.join(isGlobal ? runtime.homeDir() : cwd, ".agents", "skills");
60
- const cacheKey = stalenessCacheKey(cliName, isGlobal, cwd, canonicalBase);
61
- const skillName = cliName.replace(/\s+/g, "-");
62
- const canonicalDir = path.join(canonicalBase, skillName);
63
- const detected = options.agents ?? detectAgents(builtinAgents);
64
- const agentKey = computeAgentKey(detected, canonicalDir, skillName, isGlobal, cwd);
65
- const content = generateSkillFile(cliName, commands, { description });
66
- const hash = createHash("sha256").update(content).digest("hex").slice(0, 16);
67
- const prevState = readState(cacheKey, runtime);
68
- if (!force && prevState?.hash === hash && prevState.agentKey === agentKey) {
69
- return { paths: [], agents: [], updated: false };
70
- }
71
- await fsp.mkdir(canonicalDir, { recursive: true });
72
- await fsp.writeFile(path.join(canonicalDir, "SKILL.md"), content);
73
- const paths = [canonicalDir];
74
- const agentInstalls = [];
75
- let hadInstallFailure = false;
76
- for (const agent of detected) {
77
- const agentSkillsDir = isGlobal ? agent.globalSkillsDir : path.join(cwd, agent.projectSkillsDir);
78
- const agentDir = path.join(agentSkillsDir, skillName);
79
- if (agentDir === canonicalDir)
80
- continue;
81
- try {
82
- rmForce(agentDir);
83
- fs.mkdirSync(path.dirname(agentDir), { recursive: true });
84
- const realLinkDir = resolveParent(path.dirname(agentDir));
85
- const realTarget = resolveParent(canonicalDir);
86
- const rel = path.relative(realLinkDir, realTarget);
87
- fs.symlinkSync(rel, agentDir);
88
- agentInstalls.push({ agent: agent.name, path: agentDir, mode: "symlink" });
89
- } catch {
90
- try {
91
- fs.cpSync(canonicalDir, agentDir, { recursive: true });
92
- agentInstalls.push({ agent: agent.name, path: agentDir, mode: "copy" });
93
- } catch {
94
- hadInstallFailure = true;
95
- }
96
- }
97
- }
98
- if (!hadInstallFailure) {
99
- writeState(cacheKey, { hash, agentKey }, runtime);
100
- }
101
- return { paths, agents: agentInstalls, updated: true };
102
- }
103
- function stalenessCacheKey(name, isGlobal, cwd, canonicalBase) {
104
- const scope = isGlobal ? `global:${path.resolve(canonicalBase)}` : `local:${path.resolve(cwd)}`;
105
- const scopeHash = createHash("sha256").update(scope).digest("hex").slice(0, 8);
106
- return `${name}-${scopeHash}`;
107
- }
108
- function hashPath(cacheKey, runtime) {
109
- const dir = runtime.dataHome();
110
- return path.join(dir, "bunli", `${cacheKey}-skills.json`);
111
- }
112
- function computeAgentKey(agents, canonicalDir, skillName, isGlobal, cwd) {
113
- const targets = agents.map((agent) => isGlobal ? path.join(agent.globalSkillsDir, skillName) : path.join(cwd, agent.projectSkillsDir, skillName)).filter((target) => target !== canonicalDir).sort();
114
- return createHash("sha256").update(JSON.stringify(targets)).digest("hex").slice(0, 16);
115
- }
116
- function writeState(cacheKey, state, runtime = defaultSyncRuntime) {
117
- const file = hashPath(cacheKey, runtime);
118
- const dir = path.dirname(file);
119
- if (!fs.existsSync(dir))
120
- fs.mkdirSync(dir, { recursive: true });
121
- fs.writeFileSync(file, JSON.stringify({ ...state, at: new Date().toISOString() }) + `
122
- `);
123
- }
124
- function readState(cacheKey, runtime = defaultSyncRuntime) {
125
- try {
126
- const data = JSON.parse(fs.readFileSync(hashPath(cacheKey, runtime), "utf-8"));
127
- if (typeof data?.hash !== "string")
128
- return;
129
- return {
130
- hash: data.hash,
131
- agentKey: typeof data.agentKey === "string" ? data.agentKey : undefined
132
- };
133
- } catch {
134
- return;
135
- }
136
- }
137
- function rmForce(target) {
138
- try {
139
- const stat = fs.lstatSync(target);
140
- if (stat.isSymbolicLink())
141
- fs.unlinkSync(target);
142
- else
143
- fs.rmSync(target, { recursive: true, force: true });
144
- } catch {}
145
- }
146
- function resolveParent(dir) {
147
- try {
148
- return fs.realpathSync(dir);
149
- } catch {
150
- const parent = path.dirname(dir);
151
- if (parent === dir)
152
- return dir;
153
- try {
154
- return path.join(fs.realpathSync(parent), path.relative(parent, dir));
155
- } catch {
156
- return dir;
157
- }
158
- }
159
- }
160
-
161
- export { syncSkills };
162
-
163
- //# debugId=04AAAF4D97379D9D64756E2164756E21
@@ -1,106 +0,0 @@
1
- // @bun
2
- import {
3
- parsePackageManagerField
4
- } from "./cli-am5x7tb4.js";
5
- import {
6
- readJsonFileSync
7
- } from "./cli-ccax7s0s.js";
8
-
9
- // ../wp-typia-project-tools/src/runtime/workspace-project.ts
10
- import fs from "fs";
11
- import path from "path";
12
- var WORKSPACE_TEMPLATE_PACKAGE = "@wp-typia/create-workspace-template";
13
- function hasNonEmptyString(value) {
14
- return typeof value === "string" && value.trim().length > 0;
15
- }
16
- function parseWorkspacePackageJson(projectDirOrManifestPath) {
17
- const packageJsonPath = path.basename(projectDirOrManifestPath) === "package.json" ? projectDirOrManifestPath : path.join(projectDirOrManifestPath, "package.json");
18
- return readJsonFileSync(packageJsonPath, {
19
- context: "workspace package manifest"
20
- });
21
- }
22
- function getWorkspaceMetadataIssues(packageJson) {
23
- if (!packageJson.wpTypia) {
24
- return [];
25
- }
26
- const issues = [];
27
- if (packageJson.wpTypia.projectType !== "workspace") {
28
- issues.push('wpTypia.projectType must be "workspace"');
29
- }
30
- if (packageJson.wpTypia.templatePackage !== WORKSPACE_TEMPLATE_PACKAGE) {
31
- issues.push(`wpTypia.templatePackage must be "${WORKSPACE_TEMPLATE_PACKAGE}"`);
32
- }
33
- if (!hasNonEmptyString(packageJson.wpTypia.namespace)) {
34
- issues.push("wpTypia.namespace must be a non-empty string");
35
- }
36
- if (!hasNonEmptyString(packageJson.wpTypia.textDomain)) {
37
- issues.push("wpTypia.textDomain must be a non-empty string");
38
- }
39
- if (!hasNonEmptyString(packageJson.wpTypia.phpPrefix)) {
40
- issues.push("wpTypia.phpPrefix must be a non-empty string");
41
- }
42
- return issues;
43
- }
44
- function getInvalidWorkspaceProjectReason(startDir) {
45
- let currentDir = path.resolve(startDir);
46
- while (true) {
47
- const packageJsonPath = path.join(currentDir, "package.json");
48
- if (fs.existsSync(packageJsonPath)) {
49
- const packageJson = parseWorkspacePackageJson(packageJsonPath);
50
- const issues = getWorkspaceMetadataIssues(packageJson);
51
- if (issues.length > 0) {
52
- return `Invalid wp-typia workspace metadata at ${packageJsonPath}: ${issues.join("; ")}`;
53
- }
54
- }
55
- const parentDir = path.dirname(currentDir);
56
- if (parentDir === currentDir) {
57
- break;
58
- }
59
- currentDir = parentDir;
60
- }
61
- return null;
62
- }
63
- function parseWorkspacePackageManagerId(packageManagerField) {
64
- return parsePackageManagerField(packageManagerField) ?? "npm";
65
- }
66
- function tryResolveWorkspaceProject(startDir) {
67
- let currentDir = path.resolve(startDir);
68
- while (true) {
69
- const packageJsonPath = path.join(currentDir, "package.json");
70
- if (fs.existsSync(packageJsonPath)) {
71
- const packageJson = parseWorkspacePackageJson(packageJsonPath);
72
- if (packageJson.wpTypia?.projectType === "workspace" && packageJson.wpTypia?.templatePackage === WORKSPACE_TEMPLATE_PACKAGE && hasNonEmptyString(packageJson.wpTypia.namespace) && hasNonEmptyString(packageJson.wpTypia.textDomain) && hasNonEmptyString(packageJson.wpTypia.phpPrefix)) {
73
- return {
74
- author: typeof packageJson.author === "string" ? packageJson.author : "Your Name",
75
- packageManager: parseWorkspacePackageManagerId(packageJson.packageManager),
76
- packageName: typeof packageJson.name === "string" ? packageJson.name : path.basename(currentDir),
77
- projectDir: currentDir,
78
- workspace: {
79
- namespace: packageJson.wpTypia.namespace,
80
- phpPrefix: packageJson.wpTypia.phpPrefix,
81
- projectType: "workspace",
82
- templatePackage: WORKSPACE_TEMPLATE_PACKAGE,
83
- textDomain: packageJson.wpTypia.textDomain
84
- }
85
- };
86
- }
87
- }
88
- const parentDir = path.dirname(currentDir);
89
- if (parentDir === currentDir) {
90
- break;
91
- }
92
- currentDir = parentDir;
93
- }
94
- return null;
95
- }
96
- function resolveWorkspaceProject(startDir) {
97
- const workspace = tryResolveWorkspaceProject(startDir);
98
- if (workspace) {
99
- return workspace;
100
- }
101
- throw new Error(`This command must run inside an official wp-typia workspace. Create one with \`wp-typia create my-plugin --template workspace\` first (the short alias for \`${WORKSPACE_TEMPLATE_PACKAGE}\`).`);
102
- }
103
-
104
- export { WORKSPACE_TEMPLATE_PACKAGE, parseWorkspacePackageJson, getInvalidWorkspaceProjectReason, parseWorkspacePackageManagerId, tryResolveWorkspaceProject, resolveWorkspaceProject };
105
-
106
- //# debugId=A038EAAB2DDFD6D964756E2164756E21