wp-typia 0.15.0 → 0.15.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.
@@ -27,7 +27,7 @@ const modules: Record<GeneratedNames, Command<any>> = {
27
27
  const metadata: Record<GeneratedNames, GeneratedCommandMeta> = {
28
28
  'add': {
29
29
  name: 'add',
30
- description: 'Extend an official wp-typia workspace with blocks, variations, or patterns.',
30
+ description: 'Extend an official wp-typia workspace with blocks, variations, patterns, binding sources, or hooked blocks.',
31
31
  path: './src/commands/add'
32
32
  },
33
33
  'create': {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wp-typia",
3
- "version": "0.15.0",
3
+ "version": "0.15.2",
4
4
  "description": "Canonical CLI package for wp-typia scaffolding and project workflows",
5
5
  "packageManager": "bun@1.3.11",
6
6
  "type": "module",
@@ -64,7 +64,8 @@
64
64
  "@bunli/runtime": "0.3.1",
65
65
  "@bunli/tui": "0.6.0",
66
66
  "@bunli/utils": "0.6.0",
67
- "@wp-typia/project-tools": "0.15.0",
67
+ "@wp-typia/api-client": "^0.4.2",
68
+ "@wp-typia/project-tools": "0.15.2",
68
69
  "better-result": "^2.7.0",
69
70
  "react": "19.2.0",
70
71
  "react-dom": "19.2.0",
@@ -6,6 +6,7 @@ import { z } from "zod";
6
6
  import { getAddBlockDefaults } from "../config";
7
7
  import { resolveBundledModuleHref } from "../render-loader";
8
8
  import { executeAddCommand, getAddWorkspaceBlockOptions } from "../runtime-bridge";
9
+ import type { WpTypiaRenderArgs } from "./render-types";
9
10
  import { LazyFlow } from "../ui/lazy-flow";
10
11
 
11
12
  const supportsInteractiveTui = typeof Bun !== "undefined";
@@ -61,7 +62,7 @@ export const addCommand = defineCommand({
61
62
  options: addOptions,
62
63
  ...(supportsInteractiveTui
63
64
  ? {
64
- render: (args: any) => {
65
+ render: (args: WpTypiaRenderArgs) => {
65
66
  const config =
66
67
  args.context?.store?.wpTypiaUserConfig &&
67
68
  typeof args.context.store.wpTypiaUserConfig === "object"
@@ -6,6 +6,7 @@ import { z } from "zod";
6
6
  import { getCreateDefaults } from "../config";
7
7
  import { resolveBundledModuleHref } from "../render-loader";
8
8
  import { executeCreateCommand } from "../runtime-bridge";
9
+ import type { WpTypiaRenderArgs } from "./render-types";
9
10
  import { LazyFlow } from "../ui/lazy-flow";
10
11
 
11
12
  const supportsInteractiveTui = typeof Bun !== "undefined";
@@ -100,7 +101,7 @@ export const createCommand = defineCommand({
100
101
  options: createOptions,
101
102
  ...(supportsInteractiveTui
102
103
  ? {
103
- render: (args: any) => {
104
+ render: (args: WpTypiaRenderArgs) => {
104
105
  const config =
105
106
  args.context?.store?.wpTypiaUserConfig &&
106
107
  typeof args.context.store.wpTypiaUserConfig === "object"
@@ -5,6 +5,7 @@ import { z } from "zod";
5
5
 
6
6
  import { resolveBundledModuleHref } from "../render-loader";
7
7
  import { executeMigrateCommand } from "../runtime-bridge";
8
+ import type { WpTypiaRenderArgs } from "./render-types";
8
9
  import { LazyFlow } from "../ui/lazy-flow";
9
10
 
10
11
  const supportsInteractiveTui = typeof Bun !== "undefined";
@@ -69,7 +70,7 @@ export const migrateCommand = defineCommand({
69
70
  options: migrateOptions,
70
71
  ...(supportsInteractiveTui
71
72
  ? {
72
- render: (args: any) =>
73
+ render: (args: WpTypiaRenderArgs) =>
73
74
  createElement(LazyFlow, {
74
75
  loader: loadMigrateFlow,
75
76
  props: {
@@ -0,0 +1,9 @@
1
+ import type { RenderArgs } from "@bunli/core";
2
+
3
+ import type { WpTypiaUserConfig } from "../config";
4
+
5
+ type WpTypiaRenderStore = {
6
+ wpTypiaUserConfig?: WpTypiaUserConfig;
7
+ };
8
+
9
+ export type WpTypiaRenderArgs = RenderArgs<Record<string, unknown>, WpTypiaRenderStore>;
@@ -9,19 +9,23 @@ export const templatesCommand = defineCommand({
9
9
  handler: async (args) => {
10
10
  const subcommand = (args.positional[0] ?? "list") as string;
11
11
  const id = args.positional[1] ?? (args.flags.id as string | undefined);
12
+ const effectiveSubcommand =
13
+ subcommand === "list" && typeof id === "string" && id.length > 0
14
+ ? "inspect"
15
+ : subcommand;
12
16
  const prefersStructuredOutput =
13
17
  (args.formatExplicit && args.format !== "toon") ||
14
18
  args.agent ||
15
19
  Boolean(args.context?.store?.isAIAgent);
16
20
 
17
21
  if (prefersStructuredOutput) {
18
- if (subcommand === "list") {
22
+ if (effectiveSubcommand === "list") {
19
23
  args.output({ templates: listTemplates() });
20
24
  return;
21
25
  }
22
- if (subcommand === "inspect" && id) {
26
+ if (effectiveSubcommand === "inspect" && id) {
23
27
  await executeTemplatesCommand({
24
- flags: { id, subcommand },
28
+ flags: { id, subcommand: effectiveSubcommand },
25
29
  }, () => {});
26
30
  const template = listTemplates().find((entry) => entry.id === id);
27
31
  args.output({ template });
@@ -30,7 +34,7 @@ export const templatesCommand = defineCommand({
30
34
  }
31
35
 
32
36
  await executeTemplatesCommand({
33
- flags: { id, subcommand },
37
+ flags: { id, subcommand: effectiveSubcommand },
34
38
  });
35
39
  },
36
40
  name: "templates",
package/src/config.ts CHANGED
@@ -2,6 +2,8 @@ import fs from "node:fs/promises";
2
2
  import os from "node:os";
3
3
  import path from "node:path";
4
4
 
5
+ import { isPlainObject as isRecord } from "@wp-typia/api-client/runtime-primitives";
6
+
5
7
  export type WpTypiaSchemaSource = {
6
8
  namespace: string;
7
9
  path: string;
@@ -40,13 +42,8 @@ export const WP_TYPIA_CONFIG_SOURCES = [
40
42
  ".wp-typiarc",
41
43
  ".wp-typiarc.json",
42
44
  ] as const;
43
-
44
45
  type JsonRecord = Record<string, unknown>;
45
46
 
46
- function isRecord(value: unknown): value is JsonRecord {
47
- return typeof value === "object" && value !== null && !Array.isArray(value);
48
- }
49
-
50
47
  function deepMerge<T extends JsonRecord>(base: T, incoming: JsonRecord): T {
51
48
  const merged: JsonRecord = { ...base };
52
49