@kosdev-code/kos-ddk-cli 0.1.0-dev.50 → 0.1.0-dev.56
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 +54 -18
- package/agent-plugin/kos-ddk-tools/.claude-plugin/plugin.json +1 -1
- package/agent-plugin/kos-ddk-tools/catalog/contributions.json +0 -11
- package/agent-plugin/kos-ddk-tools/plugin.json +1 -1
- package/agent-plugin/kos-ddk-tools/reference/reference.json +108 -57
- package/agent-plugin/kos-ddk-tools/servers/kos-ddk.mjs +428 -427
- package/agent-plugin/kos-ddk-tools/skills/build-ddk-plugin/SKILL.md +9 -6
- package/agent-plugin/kos-ddk-tools/templates/cui/__nameDashCase__.stories.tsx__template__ +3 -1
- package/agent-plugin/kos-ddk-tools/templates/cui/__nameDashCase__.tsx__template__ +1 -1
- package/agent-plugin/kos-ddk-tools/templates/dashboard-detail/detail/__nameDashCase__.stories.tsx__template__ +3 -1
- package/agent-plugin/kos-ddk-tools/templates/dashboard-summary/summary/__nameDashCase__.stories.tsx__template__ +3 -1
- package/agent-plugin/kos-ddk-tools/templates/macro-summary/__nameDashCase__.stories.tsx__template__ +3 -1
- package/agent-plugin/kos-ddk-tools/templates/nav/__nameDashCase__.stories.tsx__template__ +3 -1
- package/agent-plugin/kos-ddk-tools/templates/plugin-project/.storybook/preview.tsx.template +37 -4
- package/agent-plugin/kos-ddk-tools/templates/pump-detail/__nameDashCase__.stories.tsx__template__ +3 -1
- package/agent-plugin/kos-ddk-tools/templates/pump-summary/__nameDashCase__.stories.tsx__template__ +3 -1
- package/agent-plugin/kos-ddk-tools/templates/setup/__nameDashCase__.stories.tsx__template__ +3 -1
- package/agent-plugin/kos-ddk-tools/templates/setup/__nameDashCase__.tsx__template__ +1 -1
- package/agent-plugin/kos-ddk-tools/templates/trouble-action/__nameDashCase__.stories.tsx__template__ +3 -1
- package/agent-plugin/kos-ddk-tools/templates/utility/__nameDashCase__.stories.tsx__template__ +3 -1
- package/agent-plugin/kos-ddk-tools/templates/utility/__nameDashCase__.tsx__template__ +2 -12
- package/catalog/contributions.json +0 -11
- package/guides/ddk-dev.md +2 -1
- package/guides/getting-started.md +126 -0
- package/guides/storybook.md +37 -2
- package/package.json +2 -2
- package/reference/reference.json +108 -57
- package/src/codegen/contribution.mjs +184 -14
- package/src/codegen/descriptor.mjs +210 -0
- package/src/codegen/ncui-descriptor.mjs +134 -0
- package/src/codegen/overrides.mjs +85 -1
- package/src/codegen/project.mjs +111 -13
- package/src/extension.mjs +10 -0
- package/src/generators/agent-install.mjs +3 -2
- package/src/generators/catalog.mjs +15 -4
- package/src/generators/contributions.mjs +41 -6
- package/src/generators/dashboard.mjs +12 -9
- package/src/generators/descriptor-entries.mjs +53 -0
- package/src/generators/descriptor-project.mjs +79 -0
- package/src/generators/dev.mjs +15 -5
- package/src/generators/plugin-project.mjs +36 -4
- package/src/generators/theme-project.mjs +14 -3
- package/src/handlers.mjs +9 -19
- package/src/mcp/plugin-inspect.mjs +35 -0
- package/src/mcp/reference.mjs +19 -3
- package/src/mcp/tools.mjs +118 -21
- package/templates/cui/__nameDashCase__.stories.tsx__template__ +3 -1
- package/templates/cui/__nameDashCase__.tsx__template__ +1 -1
- package/templates/dashboard-detail/detail/__nameDashCase__.stories.tsx__template__ +3 -1
- package/templates/dashboard-summary/summary/__nameDashCase__.stories.tsx__template__ +3 -1
- package/templates/macro-summary/__nameDashCase__.stories.tsx__template__ +3 -1
- package/templates/nav/__nameDashCase__.stories.tsx__template__ +3 -1
- package/templates/plugin-project/.storybook/preview.tsx.template +37 -4
- package/templates/pump-detail/__nameDashCase__.stories.tsx__template__ +3 -1
- package/templates/pump-summary/__nameDashCase__.stories.tsx__template__ +3 -1
- package/templates/setup/__nameDashCase__.stories.tsx__template__ +3 -1
- package/templates/setup/__nameDashCase__.tsx__template__ +1 -1
- package/templates/trouble-action/__nameDashCase__.stories.tsx__template__ +3 -1
- package/templates/utility/__nameDashCase__.stories.tsx__template__ +3 -1
- package/templates/utility/__nameDashCase__.tsx__template__ +2 -12
- package/agent-plugin/kos-ddk-tools/templates/setting/__nameDashCase__.stories.tsx__template__ +0 -30
- package/agent-plugin/kos-ddk-tools/templates/setting/__nameDashCase__.tsx__template__ +0 -27
- package/agent-plugin/kos-ddk-tools/templates/setting/index.ts__template__ +0 -1
- package/templates/setting/__nameDashCase__.stories.tsx__template__ +0 -30
- package/templates/setting/__nameDashCase__.tsx__template__ +0 -27
- package/templates/setting/index.ts__template__ +0 -1
package/src/generators/dev.mjs
CHANGED
|
@@ -11,6 +11,8 @@ const LOG_DIR = process.env.DEV_LOG_DIR || "/tmp/kos-dev-logs";
|
|
|
11
11
|
export const metadata = {
|
|
12
12
|
key: "ddk:dev",
|
|
13
13
|
name: "DDK Plugin Dev Servers",
|
|
14
|
+
description:
|
|
15
|
+
"Serve DDK plugin projects for a running DDK to load with ?pluginDevServers=",
|
|
14
16
|
invalidateCache: false,
|
|
15
17
|
namedArguments: {
|
|
16
18
|
plugins: "plugins",
|
|
@@ -123,6 +125,9 @@ function devMachineAddress(device) {
|
|
|
123
125
|
return external?.address ?? "localhost";
|
|
124
126
|
}
|
|
125
127
|
|
|
128
|
+
/** Where a device or simulator serves the DDK NCUI. */
|
|
129
|
+
export const NCUI_PATH = "/app/kosdev.ddk/ncui/index.html";
|
|
130
|
+
|
|
126
131
|
/** The URL that loads `plugins` into the DDK served by `device`. */
|
|
127
132
|
export function deviceUrl(device, plugins) {
|
|
128
133
|
const address = devMachineAddress(device);
|
|
@@ -130,11 +135,17 @@ export function deviceUrl(device, plugins) {
|
|
|
130
135
|
.map((plugin) => `http://${address}:${plugin.port}`)
|
|
131
136
|
.join(",");
|
|
132
137
|
const base = device ? device.replace(/\/+$/, "") : "<device-url>";
|
|
133
|
-
|
|
134
|
-
|
|
138
|
+
const pathname = new URL(base, "http://x").pathname;
|
|
139
|
+
// An origin gets the NCUI page; a page URL such as .../ncui/index.html takes the
|
|
140
|
+
// query directly.
|
|
141
|
+
const page = !device
|
|
142
|
+
? "/"
|
|
143
|
+
: pathname === "/"
|
|
144
|
+
? NCUI_PATH
|
|
145
|
+
: /\/[^/]+\.[a-z]+$/i.test(pathname)
|
|
135
146
|
? ""
|
|
136
147
|
: "/";
|
|
137
|
-
return `${base}${
|
|
148
|
+
return `${base}${page}?pluginDevServers=${servers}`;
|
|
138
149
|
}
|
|
139
150
|
|
|
140
151
|
export async function register(plop, { host }) {
|
|
@@ -190,8 +201,7 @@ export async function register(plop, { host }) {
|
|
|
190
201
|
});
|
|
191
202
|
|
|
192
203
|
plop.setGenerator("ddk:dev", {
|
|
193
|
-
description:
|
|
194
|
-
"Serve DDK plugin projects for a running DDK to load with ?pluginDevServers=",
|
|
204
|
+
description: metadata.description,
|
|
195
205
|
prompts: [
|
|
196
206
|
...host.DEFAULT_PROMPTS,
|
|
197
207
|
{
|
|
@@ -2,25 +2,44 @@
|
|
|
2
2
|
// the DDK KAB type, Storybook preview, registration, contribution keys and packages.
|
|
3
3
|
import { createDdkProject } from "../codegen/project.mjs";
|
|
4
4
|
|
|
5
|
+
const installNote = (toInstall) =>
|
|
6
|
+
toInstall?.length
|
|
7
|
+
? `Run npm install: the project added ${toInstall.join(", ")}.`
|
|
8
|
+
: "";
|
|
9
|
+
|
|
5
10
|
export const metadata = {
|
|
6
11
|
key: "ddk:plugin-project",
|
|
7
12
|
name: "DDK Plugin Project",
|
|
13
|
+
description:
|
|
14
|
+
"Create a new DDK plugin project; --directory sets the parent folder, --host the host it registers with",
|
|
8
15
|
invalidateCache: true,
|
|
9
|
-
namedArguments: {
|
|
16
|
+
namedArguments: {
|
|
17
|
+
name: "name",
|
|
18
|
+
directory: "directory",
|
|
19
|
+
host: "host",
|
|
20
|
+
interactive: "interactive",
|
|
21
|
+
},
|
|
10
22
|
};
|
|
11
23
|
|
|
12
24
|
export async function register(plop, { host }) {
|
|
13
25
|
plop.setActionType("ddk:createPluginProject", (answers) => {
|
|
14
|
-
createDdkProject("plugin", {
|
|
26
|
+
const { toInstall } = createDdkProject("plugin", {
|
|
15
27
|
workspaceRoot: process.cwd(),
|
|
16
28
|
name: answers.name,
|
|
29
|
+
directory: answers.directory || undefined,
|
|
30
|
+
host: answers.host || undefined,
|
|
17
31
|
stdio: "inherit",
|
|
18
32
|
});
|
|
19
|
-
return
|
|
33
|
+
return [
|
|
34
|
+
`DDK plugin project ${answers.name} created.`,
|
|
35
|
+
installNote(toInstall),
|
|
36
|
+
]
|
|
37
|
+
.filter(Boolean)
|
|
38
|
+
.join("\n");
|
|
20
39
|
});
|
|
21
40
|
|
|
22
41
|
plop.setGenerator("ddk:plugin-project", {
|
|
23
|
-
description:
|
|
42
|
+
description: metadata.description,
|
|
24
43
|
prompts: [
|
|
25
44
|
{
|
|
26
45
|
type: "input",
|
|
@@ -28,6 +47,19 @@ export async function register(plop, { host }) {
|
|
|
28
47
|
message: "What is the name of the plugin project?",
|
|
29
48
|
validate: host.required,
|
|
30
49
|
},
|
|
50
|
+
{
|
|
51
|
+
type: "input",
|
|
52
|
+
name: "directory",
|
|
53
|
+
message: "Folder to create it in (blank: plugins)?",
|
|
54
|
+
default: "",
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
type: "input",
|
|
58
|
+
name: "host",
|
|
59
|
+
message:
|
|
60
|
+
"Host to register with (blank: the kosdev.ddk host, else none)?",
|
|
61
|
+
default: "",
|
|
62
|
+
},
|
|
31
63
|
],
|
|
32
64
|
actions: host.actionFactory("ddk:createPluginProject", metadata),
|
|
33
65
|
});
|
|
@@ -2,25 +2,36 @@
|
|
|
2
2
|
// DDK KAB type and the theme-overlay.css the DDK apps load over their base tokens.
|
|
3
3
|
import { createDdkProject } from "../codegen/project.mjs";
|
|
4
4
|
|
|
5
|
+
const installNote = (toInstall) =>
|
|
6
|
+
toInstall?.length
|
|
7
|
+
? `Run npm install: the project added ${toInstall.join(", ")}.`
|
|
8
|
+
: "";
|
|
9
|
+
|
|
5
10
|
export const metadata = {
|
|
6
11
|
key: "ddk:theme-project",
|
|
7
12
|
name: "DDK Theme Project",
|
|
13
|
+
description: "Create a new DDK theme project",
|
|
8
14
|
invalidateCache: true,
|
|
9
15
|
namedArguments: { name: "name", interactive: "interactive" },
|
|
10
16
|
};
|
|
11
17
|
|
|
12
18
|
export async function register(plop, { host }) {
|
|
13
19
|
plop.setActionType("ddk:createThemeProject", (answers) => {
|
|
14
|
-
createDdkProject("theme", {
|
|
20
|
+
const { toInstall } = createDdkProject("theme", {
|
|
15
21
|
workspaceRoot: process.cwd(),
|
|
16
22
|
name: answers.name,
|
|
17
23
|
stdio: "inherit",
|
|
18
24
|
});
|
|
19
|
-
return
|
|
25
|
+
return [
|
|
26
|
+
`DDK theme project ${answers.name} created.`,
|
|
27
|
+
installNote(toInstall),
|
|
28
|
+
]
|
|
29
|
+
.filter(Boolean)
|
|
30
|
+
.join("\n");
|
|
20
31
|
});
|
|
21
32
|
|
|
22
33
|
plop.setGenerator("ddk:theme-project", {
|
|
23
|
-
description:
|
|
34
|
+
description: metadata.description,
|
|
24
35
|
prompts: [
|
|
25
36
|
{
|
|
26
37
|
type: "input",
|
package/src/handlers.mjs
CHANGED
|
@@ -51,11 +51,19 @@ export class DdkCuiHandler extends DdkHandler {
|
|
|
51
51
|
contributionKey = "cui";
|
|
52
52
|
|
|
53
53
|
createConfiguration(options) {
|
|
54
|
+
if (!options.descriptor) {
|
|
55
|
+
throw new Error(
|
|
56
|
+
"A CUI configuration needs its cuiDescriptor (descriptor)"
|
|
57
|
+
);
|
|
58
|
+
}
|
|
54
59
|
return this.contribute(options, {
|
|
55
60
|
suffix: "",
|
|
56
61
|
experienceSuffix: "cui",
|
|
57
62
|
key: "cui",
|
|
58
|
-
fields: {
|
|
63
|
+
fields: {
|
|
64
|
+
titleSuffix: "cui",
|
|
65
|
+
extra: { cuiDescriptor: options.descriptor },
|
|
66
|
+
},
|
|
59
67
|
});
|
|
60
68
|
}
|
|
61
69
|
}
|
|
@@ -100,23 +108,6 @@ export class DdkUtilityHandler extends DdkHandler {
|
|
|
100
108
|
}
|
|
101
109
|
}
|
|
102
110
|
|
|
103
|
-
export class DdkSettingHandler extends DdkHandler {
|
|
104
|
-
pluginType = "ddk.setting";
|
|
105
|
-
contributionKey = "setting";
|
|
106
|
-
|
|
107
|
-
createConfiguration(options) {
|
|
108
|
-
return this.contribute(options, {
|
|
109
|
-
suffix: "setting",
|
|
110
|
-
experienceSuffix: "settings",
|
|
111
|
-
key: "settings",
|
|
112
|
-
fields: {
|
|
113
|
-
titleSuffix: "setting",
|
|
114
|
-
extra: { settingsGroup: options.group || "general" },
|
|
115
|
-
},
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
111
|
export class DdkNavHandler extends DdkHandler {
|
|
121
112
|
pluginType = "ddk.nav";
|
|
122
113
|
contributionKey = "nav";
|
|
@@ -304,7 +295,6 @@ export const DDK_HANDLERS = [
|
|
|
304
295
|
DdkCuiHandler,
|
|
305
296
|
DdkSetupHandler,
|
|
306
297
|
DdkUtilityHandler,
|
|
307
|
-
DdkSettingHandler,
|
|
308
298
|
DdkNavHandler,
|
|
309
299
|
DdkDashboardSummaryHandler,
|
|
310
300
|
DdkDashboardDetailHandler,
|
|
@@ -10,6 +10,10 @@ import {
|
|
|
10
10
|
loadCatalog,
|
|
11
11
|
uniqueContributions,
|
|
12
12
|
} from "../codegen/overrides.mjs";
|
|
13
|
+
import {
|
|
14
|
+
descriptorListsSlot,
|
|
15
|
+
findDescriptorProjects,
|
|
16
|
+
} from "../codegen/descriptor.mjs";
|
|
13
17
|
import { findDdkPlugins } from "../generators/dev.mjs";
|
|
14
18
|
import { loadReference } from "./reference.mjs";
|
|
15
19
|
|
|
@@ -212,6 +216,37 @@ export function validatePlugin(root, project) {
|
|
|
212
216
|
}
|
|
213
217
|
}
|
|
214
218
|
|
|
219
|
+
// A utility, setup step or navigation view shows only if the NCUI descriptor lists it.
|
|
220
|
+
const readFs = {
|
|
221
|
+
root,
|
|
222
|
+
read: (file) => {
|
|
223
|
+
const abs = path.join(root, file);
|
|
224
|
+
return existsSync(abs) ? readFileSync(abs, "utf-8") : null;
|
|
225
|
+
},
|
|
226
|
+
};
|
|
227
|
+
const descriptorProjects = findDescriptorProjects(readFs).map((p) => p.name);
|
|
228
|
+
for (const [key, type, field] of [
|
|
229
|
+
["utilities", "utility", "utilDescriptor"],
|
|
230
|
+
["setupStep", "setup", "setupDescriptor"],
|
|
231
|
+
["navViews", "nav", "navDescriptor"],
|
|
232
|
+
]) {
|
|
233
|
+
for (const entry of contributes[key] ?? []) {
|
|
234
|
+
const slot = entry[field];
|
|
235
|
+
if (!slot || descriptorListsSlot(readFs, type, slot)) continue;
|
|
236
|
+
warnings.push(
|
|
237
|
+
`contributes.${key} ${entry.id}: ${field} "${slot}" is not in ${
|
|
238
|
+
descriptorProjects.length
|
|
239
|
+
? `descriptor project ${descriptorProjects.join(", ")}`
|
|
240
|
+
: "the standard NCUI descriptor (no descriptor project in the workspace)"
|
|
241
|
+
}, so the NCUI does not show it${
|
|
242
|
+
descriptorProjects.length
|
|
243
|
+
? `; list it with kosui ddk:descriptor-entries --project ${project} --descriptorProject ${descriptorProjects[0]}`
|
|
244
|
+
: ""
|
|
245
|
+
}`
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
215
250
|
const bySlot = new Map();
|
|
216
251
|
for (const c of described.contributions.filter((c) => c.slot)) {
|
|
217
252
|
const slotKey = `${c.contributionKey} ${JSON.stringify(c.slot)}`;
|
package/src/mcp/reference.mjs
CHANGED
|
@@ -78,24 +78,40 @@ export function describeComponent(name, library) {
|
|
|
78
78
|
`# ${c.name}${c.styled ? " (styled part)" : ""}`,
|
|
79
79
|
"",
|
|
80
80
|
`\`import { ${c.name} } from "${c.package}";\` — source \`${c.file}\`.`,
|
|
81
|
+
...(c.description ? ["", c.description] : []),
|
|
81
82
|
"",
|
|
82
83
|
"## Props",
|
|
83
84
|
"",
|
|
84
85
|
];
|
|
86
|
+
const described = c.props.some((p) => p.description);
|
|
85
87
|
lines.push(
|
|
86
88
|
...(c.props.length
|
|
87
89
|
? [
|
|
88
|
-
|
|
89
|
-
|
|
90
|
+
`| Prop | Type | Required |${described ? " Description |" : ""}`,
|
|
91
|
+
`| --- | --- | --- |${described ? " --- |" : ""}`,
|
|
90
92
|
...c.props.map(
|
|
91
93
|
(p) =>
|
|
92
94
|
`| ${cell(p.name)} | ${cell(p.type)} | ${
|
|
93
95
|
p.optional ? "no" : "yes"
|
|
94
|
-
}
|
|
96
|
+
} |${
|
|
97
|
+
described
|
|
98
|
+
? ` ${(p.description ?? "").replace(/\s*\n\s*/g, " ")} |`
|
|
99
|
+
: ""
|
|
100
|
+
}`
|
|
95
101
|
),
|
|
96
102
|
]
|
|
97
103
|
: ["No props of its own; it takes the element's standard props."])
|
|
98
104
|
);
|
|
105
|
+
if (c.inherits?.length) {
|
|
106
|
+
lines.push(
|
|
107
|
+
"",
|
|
108
|
+
`Also takes every prop of ${c.inherits
|
|
109
|
+
.map((t) => cell(t))
|
|
110
|
+
.join(
|
|
111
|
+
", "
|
|
112
|
+
)} (for an element, all its HTML attributes and event handlers such as \`onClick\`).`
|
|
113
|
+
);
|
|
114
|
+
}
|
|
99
115
|
if (c.renders.length) {
|
|
100
116
|
lines.push(
|
|
101
117
|
"",
|
package/src/mcp/tools.mjs
CHANGED
|
@@ -17,8 +17,11 @@ import {
|
|
|
17
17
|
} from "../codegen/contribution.mjs";
|
|
18
18
|
import {
|
|
19
19
|
OVERRIDABLE_POINTS,
|
|
20
|
+
describeOverridablePoints,
|
|
20
21
|
listOverridableContributions,
|
|
21
22
|
} from "../codegen/overrides.mjs";
|
|
23
|
+
import { addPluginDescriptorEntries } from "../codegen/descriptor.mjs";
|
|
24
|
+
import { NCUI_LAYOUTS, NCUI_OPTIONS } from "../codegen/ncui-descriptor.mjs";
|
|
22
25
|
import { createDdkProject } from "../codegen/project.mjs";
|
|
23
26
|
import { describePlugin, validatePlugin } from "./plugin-inspect.mjs";
|
|
24
27
|
import {
|
|
@@ -77,14 +80,20 @@ async function run(args, generate) {
|
|
|
77
80
|
}
|
|
78
81
|
|
|
79
82
|
/** A tool for a ddk:<type> contribution command handled by generateDdkContribution. */
|
|
80
|
-
function contributionTool(
|
|
83
|
+
function contributionTool(
|
|
84
|
+
toolName,
|
|
85
|
+
type,
|
|
86
|
+
description,
|
|
87
|
+
extra = {},
|
|
88
|
+
required = []
|
|
89
|
+
) {
|
|
81
90
|
return {
|
|
82
91
|
name: toolName,
|
|
83
92
|
description,
|
|
84
93
|
inputSchema: {
|
|
85
94
|
type: "object",
|
|
86
95
|
properties: { ...common, ...extra },
|
|
87
|
-
required: ["name", "project", ...
|
|
96
|
+
required: ["name", "project", ...required],
|
|
88
97
|
},
|
|
89
98
|
handler: (args) =>
|
|
90
99
|
run(args, (codegenFs) =>
|
|
@@ -92,20 +101,32 @@ function contributionTool(toolName, type, description, extra = {}) {
|
|
|
92
101
|
type,
|
|
93
102
|
name: args.name,
|
|
94
103
|
project: args.project,
|
|
95
|
-
group: args.group,
|
|
96
104
|
descriptor: args.descriptor,
|
|
97
105
|
override: args.override,
|
|
98
106
|
rank: args.rank,
|
|
107
|
+
descriptorProject: args.descriptorProject,
|
|
108
|
+
roles: args.roles,
|
|
109
|
+
column: args.column,
|
|
99
110
|
})
|
|
100
111
|
),
|
|
101
112
|
};
|
|
102
113
|
}
|
|
103
114
|
|
|
104
|
-
const slot = (field, listedIn) => ({
|
|
115
|
+
const slot = (field, listedIn, extra = {}) => ({
|
|
105
116
|
descriptor: {
|
|
106
117
|
type: "string",
|
|
107
|
-
description: `${field}; shown only if the
|
|
118
|
+
description: `${field}; shown only if the NCUI descriptor lists it (${listedIn}). Default: from the name.`,
|
|
108
119
|
},
|
|
120
|
+
descriptorProject: {
|
|
121
|
+
type: "string",
|
|
122
|
+
description:
|
|
123
|
+
"NCUI descriptor project to list a new slot in (scaffold_ddk_descriptor_project).",
|
|
124
|
+
},
|
|
125
|
+
roles: {
|
|
126
|
+
type: "string",
|
|
127
|
+
description: "With descriptorProject: comma-separated roles that see it.",
|
|
128
|
+
},
|
|
129
|
+
...extra,
|
|
109
130
|
override,
|
|
110
131
|
rank,
|
|
111
132
|
});
|
|
@@ -120,9 +141,37 @@ function projectTool(name, kind, description) {
|
|
|
120
141
|
name: {
|
|
121
142
|
type: "string",
|
|
122
143
|
description: `${
|
|
123
|
-
|
|
144
|
+
{ plugin: "Plugin", theme: "Theme", descriptor: "Descriptor" }[kind]
|
|
124
145
|
} project name in kebab-case.`,
|
|
125
146
|
},
|
|
147
|
+
...(kind === "descriptor"
|
|
148
|
+
? {
|
|
149
|
+
layout: {
|
|
150
|
+
type: "string",
|
|
151
|
+
enum: NCUI_LAYOUTS,
|
|
152
|
+
description: "NCUI layout. Default: standard.",
|
|
153
|
+
},
|
|
154
|
+
...Object.fromEntries(
|
|
155
|
+
Object.entries(NCUI_OPTIONS).map(([option, what]) => [
|
|
156
|
+
option,
|
|
157
|
+
{ type: "boolean", description: `Include ${what}.` },
|
|
158
|
+
])
|
|
159
|
+
),
|
|
160
|
+
}
|
|
161
|
+
: {}),
|
|
162
|
+
...(kind === "plugin"
|
|
163
|
+
? {
|
|
164
|
+
directory: {
|
|
165
|
+
type: "string",
|
|
166
|
+
description: "Parent folder of the project. Default: plugins.",
|
|
167
|
+
},
|
|
168
|
+
host: {
|
|
169
|
+
type: "string",
|
|
170
|
+
description:
|
|
171
|
+
"Workspace host to register with. Default: the host with the kosdev.ddk plugin context, else none.",
|
|
172
|
+
},
|
|
173
|
+
}
|
|
174
|
+
: {}),
|
|
126
175
|
dryRun,
|
|
127
176
|
...workspaceRootProperty,
|
|
128
177
|
},
|
|
@@ -134,6 +183,17 @@ function projectTool(name, kind, description) {
|
|
|
134
183
|
const result = createDdkProject(kind, {
|
|
135
184
|
workspaceRoot: resolveWorkspaceRoot(args),
|
|
136
185
|
name: args.name,
|
|
186
|
+
directory: args.directory,
|
|
187
|
+
host: args.host,
|
|
188
|
+
ncui: {
|
|
189
|
+
layout: args.layout,
|
|
190
|
+
...Object.fromEntries(
|
|
191
|
+
Object.keys(NCUI_OPTIONS).map((option) => [
|
|
192
|
+
option,
|
|
193
|
+
!!args[option],
|
|
194
|
+
])
|
|
195
|
+
),
|
|
196
|
+
},
|
|
137
197
|
dryRun: dryRunMode,
|
|
138
198
|
});
|
|
139
199
|
return textResult({ dryRun: dryRunMode, ...result });
|
|
@@ -155,11 +215,22 @@ export const ddkTools = [
|
|
|
155
215
|
"theme",
|
|
156
216
|
"Create a DDK theme project; its theme-overlay.css overrides the DDK tokens. dryRun lists the files."
|
|
157
217
|
),
|
|
218
|
+
projectTool(
|
|
219
|
+
"scaffold_ddk_descriptor_project",
|
|
220
|
+
"descriptor",
|
|
221
|
+
"Create an NCUI descriptor project (ddk.ncui.descriptor KAB) for a layout and options; list new utility, setup or nav slots in it. dryRun lists the files."
|
|
222
|
+
),
|
|
158
223
|
contributionTool(
|
|
159
224
|
"add_utility",
|
|
160
225
|
"utility",
|
|
161
226
|
"Add a utility (utilities contribution) with its component, story and i18n title.",
|
|
162
|
-
slot("utilDescriptor", "kondra.ncui.utilities"
|
|
227
|
+
slot("utilDescriptor", "kondra.ncui.utilities", {
|
|
228
|
+
column: {
|
|
229
|
+
type: "integer",
|
|
230
|
+
description:
|
|
231
|
+
"With descriptorProject: utilities column, 1-based. Default: the last.",
|
|
232
|
+
},
|
|
233
|
+
})
|
|
163
234
|
),
|
|
164
235
|
contributionTool(
|
|
165
236
|
"add_setup_step",
|
|
@@ -171,26 +242,26 @@ export const ddkTools = [
|
|
|
171
242
|
"add_nav_view",
|
|
172
243
|
"nav",
|
|
173
244
|
"Add a navigation view (navViews contribution) with its component, story and i18n title.",
|
|
174
|
-
slot(
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
245
|
+
slot("navDescriptor", "kondra.ncui.navigations", {
|
|
246
|
+
descriptor: {
|
|
247
|
+
type: "string",
|
|
248
|
+
description:
|
|
249
|
+
"navDescriptor, a kondra.ncui.navigations path such as settings.water. Required unless override.",
|
|
250
|
+
},
|
|
251
|
+
})
|
|
178
252
|
),
|
|
179
253
|
contributionTool(
|
|
180
254
|
"add_cui_config",
|
|
181
255
|
"cui",
|
|
182
|
-
"Add a CUI configuration (cui contribution) with its component and story."
|
|
183
|
-
),
|
|
184
|
-
contributionTool(
|
|
185
|
-
"add_setting",
|
|
186
|
-
"setting",
|
|
187
|
-
"Add a setting (settings contribution) to a settings group, with its component and story.",
|
|
256
|
+
"Add a CUI configuration (cui contribution) with its component and story.",
|
|
188
257
|
{
|
|
189
|
-
|
|
258
|
+
descriptor: {
|
|
190
259
|
type: "string",
|
|
191
|
-
description:
|
|
260
|
+
description:
|
|
261
|
+
"cuiDescriptor: the CUI's appId from /api/app/kosdev.ddk/cui.",
|
|
192
262
|
},
|
|
193
|
-
}
|
|
263
|
+
},
|
|
264
|
+
["descriptor"]
|
|
194
265
|
),
|
|
195
266
|
{
|
|
196
267
|
name: "add_dashboard_card",
|
|
@@ -354,6 +425,31 @@ export const ddkTools = [
|
|
|
354
425
|
}
|
|
355
426
|
},
|
|
356
427
|
},
|
|
428
|
+
{
|
|
429
|
+
name: "add_descriptor_entries",
|
|
430
|
+
description:
|
|
431
|
+
"List a plugin's existing utility, setup step and navigation slots in an NCUI descriptor project.",
|
|
432
|
+
inputSchema: {
|
|
433
|
+
type: "object",
|
|
434
|
+
properties: {
|
|
435
|
+
project,
|
|
436
|
+
descriptorProject: {
|
|
437
|
+
type: "string",
|
|
438
|
+
description: "NCUI descriptor project to list them in.",
|
|
439
|
+
},
|
|
440
|
+
dryRun,
|
|
441
|
+
...workspaceRootProperty,
|
|
442
|
+
},
|
|
443
|
+
required: ["project", "descriptorProject"],
|
|
444
|
+
},
|
|
445
|
+
handler: (args) =>
|
|
446
|
+
run(args, (codegenFs) =>
|
|
447
|
+
addPluginDescriptorEntries(codegenFs, {
|
|
448
|
+
project: args.project,
|
|
449
|
+
descriptorProject: args.descriptorProject,
|
|
450
|
+
})
|
|
451
|
+
),
|
|
452
|
+
},
|
|
357
453
|
{
|
|
358
454
|
name: "validate_ddk_plugin",
|
|
359
455
|
description:
|
|
@@ -454,7 +550,7 @@ export const ddkTools = [
|
|
|
454
550
|
{
|
|
455
551
|
name: "list_ddk_contributions",
|
|
456
552
|
description:
|
|
457
|
-
"List the standard DDK contributions an override can replace, with each one's slot and rank.",
|
|
553
|
+
"List the standard DDK contributions an override can replace, with each one's slot and rank, and the contribution keys each point writes. A pump detail is listed under both pump-detail and pump-card.",
|
|
458
554
|
inputSchema: {
|
|
459
555
|
type: "object",
|
|
460
556
|
properties: {
|
|
@@ -468,6 +564,7 @@ export const ddkTools = [
|
|
|
468
564
|
handler: async (args) => {
|
|
469
565
|
try {
|
|
470
566
|
return textResult({
|
|
567
|
+
points: describeOverridablePoints(args.point || undefined),
|
|
471
568
|
contributions: listOverridableContributions(args.point || undefined),
|
|
472
569
|
});
|
|
473
570
|
} catch (e) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Note: The plugin project Storybook configuration requires that the Studio
|
|
3
|
-
* Simulator is running in order to retrieve model data
|
|
3
|
+
* Simulator is running in order to retrieve model data, unless the story mocks
|
|
4
|
+
* it with parameters.kosMock (ddk://guide/storybook).
|
|
4
5
|
*/
|
|
5
6
|
import { CUIStoryContainer } from "@kosdev-code/kos-ddk-story-containers";
|
|
6
7
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
@@ -25,6 +26,7 @@ export default meta;
|
|
|
25
26
|
type Story = StoryObj<typeof <%= namePascalCase %>>;
|
|
26
27
|
|
|
27
28
|
export const Default: Story = {
|
|
29
|
+
// parameters: { kosMock: { setups: ["<setup module>"] } },
|
|
28
30
|
render: (props) => <<%= namePascalCase %> {...props} />,
|
|
29
31
|
};
|
|
30
32
|
|
|
@@ -23,7 +23,7 @@ const <%= namePascalCase %>Container = styled.div`
|
|
|
23
23
|
export const <%= namePascalCase %>: Experience = kosComponent(({ onComplete }) => {
|
|
24
24
|
const { t } = useKosTranslation('<%= appProject %>');
|
|
25
25
|
return (
|
|
26
|
-
<<%= namePascalCase %>Container
|
|
26
|
+
<<%= namePascalCase %>Container>
|
|
27
27
|
Hello from <%= namePascalCase %> CUI Configuration
|
|
28
28
|
<Footer>
|
|
29
29
|
<Button onClick={onComplete}>{t('proceed')}</Button>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Note: The plugin project Storybook configuration requires that the Studio
|
|
3
|
-
* Simulator is running in order to retrieve model data
|
|
3
|
+
* Simulator is running in order to retrieve model data, unless the story mocks
|
|
4
|
+
* it with parameters.kosMock (ddk://guide/storybook).
|
|
4
5
|
*/
|
|
5
6
|
import { DashboardDetailStoryContainer } from "@kosdev-code/kos-ddk-story-containers";
|
|
6
7
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
@@ -28,5 +29,6 @@ export default meta;
|
|
|
28
29
|
type Story = StoryObj<typeof <%= namePascalCase %>Detail>;
|
|
29
30
|
|
|
30
31
|
export const Default: Story = {
|
|
32
|
+
// parameters: { kosMock: { setups: ["<setup module>"] } },
|
|
31
33
|
render: (props) => <<%= namePascalCase %>Detail {...props} />,
|
|
32
34
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Note: The plugin project Storybook configuration requires that the Studio
|
|
3
|
-
* Simulator is running in order to retrieve model data
|
|
3
|
+
* Simulator is running in order to retrieve model data, unless the story mocks
|
|
4
|
+
* it with parameters.kosMock (ddk://guide/storybook).
|
|
4
5
|
*/
|
|
5
6
|
import { DashboardSummaryStoryContainer } from "@kosdev-code/kos-ddk-story-containers";
|
|
6
7
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
@@ -28,5 +29,6 @@ export default meta;
|
|
|
28
29
|
type Story = StoryObj<typeof <%= namePascalCase %>Summary>;
|
|
29
30
|
|
|
30
31
|
export const Default: Story = {
|
|
32
|
+
// parameters: { kosMock: { setups: ["<setup module>"] } },
|
|
31
33
|
render: (props) => <<%= namePascalCase %>Summary {...props} />,
|
|
32
34
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Note: The plugin project Storybook configuration requires that the Studio
|
|
3
|
-
* Simulator is running in order to retrieve model data
|
|
3
|
+
* Simulator is running in order to retrieve model data, unless the story mocks
|
|
4
|
+
* it with parameters.kosMock (ddk://guide/storybook).
|
|
4
5
|
*/
|
|
5
6
|
import { MacroSummaryStoryContainer } from "@kosdev-code/kos-ddk-story-containers";
|
|
6
7
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
@@ -28,5 +29,6 @@ export default meta;
|
|
|
28
29
|
type Story = StoryObj<typeof <%= namePascalCase %>>;
|
|
29
30
|
|
|
30
31
|
export const Default: Story = {
|
|
32
|
+
// parameters: { kosMock: { setups: ["<setup module>"] } },
|
|
31
33
|
render: (props) => <<%= namePascalCase %> {...props} />,
|
|
32
34
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Note: The plugin project Storybook configuration requires that the Studio
|
|
3
|
-
* Simulator is running in order to retrieve model data
|
|
3
|
+
* Simulator is running in order to retrieve model data, unless the story mocks
|
|
4
|
+
* it with parameters.kosMock (ddk://guide/storybook).
|
|
4
5
|
*/
|
|
5
6
|
import { NavStoryContainer } from "@kosdev-code/kos-ddk-story-containers";
|
|
6
7
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
@@ -25,6 +26,7 @@ export default meta;
|
|
|
25
26
|
type Story = StoryObj<typeof <%= namePascalCase %>>;
|
|
26
27
|
|
|
27
28
|
export const Default: Story = {
|
|
29
|
+
// parameters: { kosMock: { setups: ["<setup module>"] } },
|
|
28
30
|
render: (props) => <<%= namePascalCase %> {...props} />,
|
|
29
31
|
};
|
|
30
32
|
|