@kosdev-code/kos-ddk-cli 0.0.0-stage → 0.1.0-dev.105

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 (124) hide show
  1. package/README.md +181 -2
  2. package/agent-plugin/.claude-plugin/marketplace.json +13 -0
  3. package/agent-plugin/kos-ddk-tools/.claude-plugin/plugin.json +8 -0
  4. package/agent-plugin/kos-ddk-tools/.mcp.json +11 -0
  5. package/agent-plugin/kos-ddk-tools/agents/kos-ddk-plugin-planner.md +45 -0
  6. package/agent-plugin/kos-ddk-tools/agents/kos-ddk-plugin-reviewer.md +43 -0
  7. package/agent-plugin/kos-ddk-tools/catalog/contributions.json +921 -0
  8. package/agent-plugin/kos-ddk-tools/mcp.json +12 -0
  9. package/agent-plugin/kos-ddk-tools/plugin.json +7 -0
  10. package/agent-plugin/kos-ddk-tools/reference/reference.json +21141 -0
  11. package/agent-plugin/kos-ddk-tools/servers/kos-ddk.mjs +48656 -0
  12. package/agent-plugin/kos-ddk-tools/skills/build-ddk-plugin/SKILL.md +110 -0
  13. package/agent-plugin/kos-ddk-tools/skills/ddk-config-page/SKILL.md +130 -0
  14. package/agent-plugin/kos-ddk-tools/skills/ddk-content-component/SKILL.md +59 -0
  15. package/agent-plugin/kos-ddk-tools/skills/ddk-storybook/SKILL.md +45 -0
  16. package/agent-plugin/kos-ddk-tools/templates/cui/__nameDashCase__.stories.tsx__template__ +32 -0
  17. package/agent-plugin/kos-ddk-tools/templates/cui/__nameDashCase__.tsx__template__ +35 -0
  18. package/agent-plugin/kos-ddk-tools/templates/cui/index.ts__template__ +1 -0
  19. package/agent-plugin/kos-ddk-tools/templates/dashboard-detail/detail/__nameDashCase__.stories.tsx__template__ +34 -0
  20. package/agent-plugin/kos-ddk-tools/templates/dashboard-detail/detail/__nameDashCase__.tsx__template__ +52 -0
  21. package/agent-plugin/kos-ddk-tools/templates/dashboard-detail/detail/index.ts__template__ +1 -0
  22. package/agent-plugin/kos-ddk-tools/templates/dashboard-region/__nameDashCase__.stories.tsx__template__ +38 -0
  23. package/agent-plugin/kos-ddk-tools/templates/dashboard-region/__nameDashCase__.tsx__template__ +28 -0
  24. package/agent-plugin/kos-ddk-tools/templates/dashboard-region/index.ts__template__ +1 -0
  25. package/agent-plugin/kos-ddk-tools/templates/dashboard-summary/summary/__nameDashCase__.stories.tsx__template__ +34 -0
  26. package/agent-plugin/kos-ddk-tools/templates/dashboard-summary/summary/__nameDashCase__.tsx__template__ +41 -0
  27. package/agent-plugin/kos-ddk-tools/templates/dashboard-summary/summary/index.ts__template__ +1 -0
  28. package/agent-plugin/kos-ddk-tools/templates/macro-summary/__nameDashCase__.stories.tsx__template__ +34 -0
  29. package/agent-plugin/kos-ddk-tools/templates/macro-summary/__nameDashCase__.tsx__template__ +24 -0
  30. package/agent-plugin/kos-ddk-tools/templates/macro-summary/index.ts__template__ +1 -0
  31. package/agent-plugin/kos-ddk-tools/templates/nav/__nameDashCase__.stories.tsx__template__ +32 -0
  32. package/agent-plugin/kos-ddk-tools/templates/nav/__nameDashCase__.tsx__template__ +27 -0
  33. package/agent-plugin/kos-ddk-tools/templates/nav/index.ts__template__ +1 -0
  34. package/agent-plugin/kos-ddk-tools/templates/plugin-project/.storybook/preview.tsx.template +113 -0
  35. package/agent-plugin/kos-ddk-tools/templates/plugin-project/.storybook/registration.ts.template +6 -0
  36. package/agent-plugin/kos-ddk-tools/templates/pump-detail/__nameDashCase__.stories.tsx__template__ +34 -0
  37. package/agent-plugin/kos-ddk-tools/templates/pump-detail/__nameDashCase__.tsx__template__ +38 -0
  38. package/agent-plugin/kos-ddk-tools/templates/pump-detail/index.ts__template__ +1 -0
  39. package/agent-plugin/kos-ddk-tools/templates/pump-summary/__nameDashCase__.stories.tsx__template__ +34 -0
  40. package/agent-plugin/kos-ddk-tools/templates/pump-summary/__nameDashCase__.tsx__template__ +25 -0
  41. package/agent-plugin/kos-ddk-tools/templates/pump-summary/index.ts__template__ +1 -0
  42. package/agent-plugin/kos-ddk-tools/templates/setup/__nameDashCase__.stories.tsx__template__ +32 -0
  43. package/agent-plugin/kos-ddk-tools/templates/setup/__nameDashCase__.tsx__template__ +33 -0
  44. package/agent-plugin/kos-ddk-tools/templates/setup/index.ts__template__ +1 -0
  45. package/agent-plugin/kos-ddk-tools/templates/theme-project/theme/assets/component.css.template +2 -0
  46. package/agent-plugin/kos-ddk-tools/templates/theme-project/theme/assets/generic.css.template +2 -0
  47. package/agent-plugin/kos-ddk-tools/templates/theme-project/theme/assets/semantic.css.template +2 -0
  48. package/agent-plugin/kos-ddk-tools/templates/theme-project/theme/assets/theme-overlay.css.template +7 -0
  49. package/agent-plugin/kos-ddk-tools/templates/trouble-action/__nameDashCase__.stories.tsx__template__ +31 -0
  50. package/agent-plugin/kos-ddk-tools/templates/trouble-action/__nameDashCase__.tsx__template__ +57 -0
  51. package/agent-plugin/kos-ddk-tools/templates/trouble-action/index.ts__template__ +1 -0
  52. package/agent-plugin/kos-ddk-tools/templates/utility/__nameDashCase__.stories.tsx__template__ +60 -0
  53. package/agent-plugin/kos-ddk-tools/templates/utility/__nameDashCase__.tsx__template__ +88 -0
  54. package/agent-plugin/kos-ddk-tools/templates/utility/index.ts__template__ +1 -0
  55. package/catalog/contributions.json +921 -0
  56. package/guides/config-property-cards.md +77 -0
  57. package/guides/ddk-dev.md +59 -0
  58. package/guides/getting-started.md +126 -0
  59. package/guides/storybook.md +127 -0
  60. package/package.json +33 -3
  61. package/reference/reference.json +21141 -0
  62. package/src/build-paths.mjs +20 -0
  63. package/src/codegen/contribution.mjs +530 -0
  64. package/src/codegen/descriptor.mjs +422 -0
  65. package/src/codegen/json-preserve.mjs +137 -0
  66. package/src/codegen/ncui-descriptor.mjs +167 -0
  67. package/src/codegen/overrides.mjs +263 -0
  68. package/src/codegen/project.mjs +271 -0
  69. package/src/extension.mjs +32 -0
  70. package/src/generators/agent-install.mjs +80 -0
  71. package/src/generators/catalog.mjs +81 -0
  72. package/src/generators/contributions.mjs +164 -0
  73. package/src/generators/dashboard.mjs +282 -0
  74. package/src/generators/descriptor-entries.mjs +53 -0
  75. package/src/generators/descriptor-project.mjs +84 -0
  76. package/src/generators/dev.mjs +231 -0
  77. package/src/generators/override-prompts.mjs +27 -0
  78. package/src/generators/plugin-project.mjs +71 -0
  79. package/src/generators/theme-project.mjs +53 -0
  80. package/src/handlers.mjs +335 -0
  81. package/src/mcp/pkg-info.mjs +7 -0
  82. package/src/mcp/plugin-inspect.mjs +328 -0
  83. package/src/mcp/reference.mjs +315 -0
  84. package/src/mcp/server.mjs +12 -0
  85. package/src/mcp/tools.mjs +619 -0
  86. package/templates/cui/__nameDashCase__.stories.tsx__template__ +32 -0
  87. package/templates/cui/__nameDashCase__.tsx__template__ +35 -0
  88. package/templates/cui/index.ts__template__ +1 -0
  89. package/templates/dashboard-detail/detail/__nameDashCase__.stories.tsx__template__ +34 -0
  90. package/templates/dashboard-detail/detail/__nameDashCase__.tsx__template__ +52 -0
  91. package/templates/dashboard-detail/detail/index.ts__template__ +1 -0
  92. package/templates/dashboard-region/__nameDashCase__.stories.tsx__template__ +38 -0
  93. package/templates/dashboard-region/__nameDashCase__.tsx__template__ +28 -0
  94. package/templates/dashboard-region/index.ts__template__ +1 -0
  95. package/templates/dashboard-summary/summary/__nameDashCase__.stories.tsx__template__ +34 -0
  96. package/templates/dashboard-summary/summary/__nameDashCase__.tsx__template__ +41 -0
  97. package/templates/dashboard-summary/summary/index.ts__template__ +1 -0
  98. package/templates/macro-summary/__nameDashCase__.stories.tsx__template__ +34 -0
  99. package/templates/macro-summary/__nameDashCase__.tsx__template__ +24 -0
  100. package/templates/macro-summary/index.ts__template__ +1 -0
  101. package/templates/nav/__nameDashCase__.stories.tsx__template__ +32 -0
  102. package/templates/nav/__nameDashCase__.tsx__template__ +27 -0
  103. package/templates/nav/index.ts__template__ +1 -0
  104. package/templates/plugin-project/.storybook/preview.tsx.template +113 -0
  105. package/templates/plugin-project/.storybook/registration.ts.template +6 -0
  106. package/templates/pump-detail/__nameDashCase__.stories.tsx__template__ +34 -0
  107. package/templates/pump-detail/__nameDashCase__.tsx__template__ +38 -0
  108. package/templates/pump-detail/index.ts__template__ +1 -0
  109. package/templates/pump-summary/__nameDashCase__.stories.tsx__template__ +34 -0
  110. package/templates/pump-summary/__nameDashCase__.tsx__template__ +25 -0
  111. package/templates/pump-summary/index.ts__template__ +1 -0
  112. package/templates/setup/__nameDashCase__.stories.tsx__template__ +32 -0
  113. package/templates/setup/__nameDashCase__.tsx__template__ +33 -0
  114. package/templates/setup/index.ts__template__ +1 -0
  115. package/templates/theme-project/theme/assets/component.css.template +2 -0
  116. package/templates/theme-project/theme/assets/generic.css.template +2 -0
  117. package/templates/theme-project/theme/assets/semantic.css.template +2 -0
  118. package/templates/theme-project/theme/assets/theme-overlay.css.template +7 -0
  119. package/templates/trouble-action/__nameDashCase__.stories.tsx__template__ +31 -0
  120. package/templates/trouble-action/__nameDashCase__.tsx__template__ +57 -0
  121. package/templates/trouble-action/index.ts__template__ +1 -0
  122. package/templates/utility/__nameDashCase__.stories.tsx__template__ +60 -0
  123. package/templates/utility/__nameDashCase__.tsx__template__ +88 -0
  124. package/templates/utility/index.ts__template__ +1 -0
@@ -0,0 +1,619 @@
1
+ // kos-ddk MCP tools: one per ddk:* command, on the same codegen functions, plus the
2
+ // override catalog. Dry-run by default, like the kos-codegen tools.
3
+ import {
4
+ errorResult,
5
+ resolveWorkspaceRoot,
6
+ runGenerator,
7
+ textResult,
8
+ workspaceRootProperty,
9
+ } from "@kosdev-code/kos-ui-cli/extension/mcp";
10
+ import {
11
+ generateDashboardCard,
12
+ generateDashboardRegion,
13
+ generateDdkContribution,
14
+ generateMacroSummary,
15
+ generatePumpCard,
16
+ generatePumpDetail,
17
+ generateTroubleAction,
18
+ } from "../codegen/contribution.mjs";
19
+ import {
20
+ OVERRIDABLE_POINTS,
21
+ describeOverridablePoints,
22
+ listOverridableContributions,
23
+ } from "../codegen/overrides.mjs";
24
+ import { addPluginDescriptorEntries } from "../codegen/descriptor.mjs";
25
+ import { NCUI_LAYOUTS, NCUI_OPTIONS } from "../codegen/ncui-descriptor.mjs";
26
+ import { createDdkProject } from "../codegen/project.mjs";
27
+ import { describePlugin, validatePlugin } from "./plugin-inspect.mjs";
28
+ import {
29
+ COMPONENT_LIBRARIES,
30
+ describeComponent,
31
+ findCapability,
32
+ listComponents,
33
+ } from "./reference.mjs";
34
+
35
+ const name = {
36
+ type: "string",
37
+ description: "Component name in kebab-case, e.g. fuel-level.",
38
+ };
39
+ const project = {
40
+ type: "string",
41
+ description: "DDK plugin project to write into.",
42
+ };
43
+ const dryRun = {
44
+ type: "boolean",
45
+ description: "Default true: return the would-write files. false writes.",
46
+ };
47
+ const override = {
48
+ type: "string",
49
+ description:
50
+ "Id of a standard contribution to replace (from list_ddk_contributions). Takes its slot with a winning rank.",
51
+ };
52
+ const rank = {
53
+ type: "integer",
54
+ description:
55
+ "0-1000; lower wins. Default with override: 100, or one better than a ranked target.",
56
+ };
57
+ const dashboardKey = {
58
+ type: "string",
59
+ description:
60
+ "Assembly property whose models get the contribution, e.g. carbTank. Taken from override when given.",
61
+ };
62
+
63
+ const common = { name, project, dryRun, ...workspaceRootProperty };
64
+
65
+ async function run(args, generate) {
66
+ try {
67
+ const cwd = resolveWorkspaceRoot(args);
68
+ const result = await runGenerator({
69
+ dryRun: args.dryRun !== false,
70
+ cwd,
71
+ generate,
72
+ });
73
+ return textResult(
74
+ result.dryRun
75
+ ? { ...result, hint: "Re-run with dryRun:false to write." }
76
+ : result
77
+ );
78
+ } catch (e) {
79
+ return errorResult(e.message);
80
+ }
81
+ }
82
+
83
+ /** A tool for a ddk:<type> contribution command handled by generateDdkContribution. */
84
+ function contributionTool(
85
+ toolName,
86
+ type,
87
+ description,
88
+ extra = {},
89
+ required = []
90
+ ) {
91
+ return {
92
+ name: toolName,
93
+ description,
94
+ inputSchema: {
95
+ type: "object",
96
+ properties: { ...common, ...extra },
97
+ required: ["name", "project", ...required],
98
+ },
99
+ handler: (args) =>
100
+ run(args, (codegenFs) =>
101
+ generateDdkContribution(codegenFs, {
102
+ type,
103
+ name: args.name,
104
+ project: args.project,
105
+ descriptor: args.descriptor,
106
+ override: args.override,
107
+ rank: args.rank,
108
+ descriptorProject: args.descriptorProject,
109
+ roles: args.roles,
110
+ column: args.column,
111
+ layout: args.layout,
112
+ })
113
+ ),
114
+ };
115
+ }
116
+
117
+ const slot = (field, listedIn, extra = {}) => ({
118
+ descriptor: {
119
+ type: "string",
120
+ description: `${field}; shown only if the NCUI descriptor lists it (${listedIn}). Default: from the name.`,
121
+ },
122
+ descriptorProject: {
123
+ type: "string",
124
+ description:
125
+ "NCUI descriptor project to list a new slot in (scaffold_ddk_descriptor_project).",
126
+ },
127
+ roles: {
128
+ type: "string",
129
+ description: "With descriptorProject: comma-separated roles that see it.",
130
+ },
131
+ ...extra,
132
+ override,
133
+ rank,
134
+ });
135
+
136
+ function projectTool(name, kind, description) {
137
+ return {
138
+ name,
139
+ description,
140
+ inputSchema: {
141
+ type: "object",
142
+ properties: {
143
+ name: {
144
+ type: "string",
145
+ description: `${
146
+ { plugin: "Plugin", theme: "Theme", descriptor: "Descriptor" }[kind]
147
+ } project name in kebab-case.`,
148
+ },
149
+ ...(kind === "descriptor"
150
+ ? {
151
+ layout: {
152
+ type: "string",
153
+ enum: NCUI_LAYOUTS,
154
+ description: "NCUI layout. Default: standard.",
155
+ },
156
+ ...Object.fromEntries(
157
+ Object.entries(NCUI_OPTIONS).map(([option, what]) => [
158
+ option,
159
+ { type: "boolean", description: `Include ${what}.` },
160
+ ])
161
+ ),
162
+ }
163
+ : {}),
164
+ ...(kind === "plugin"
165
+ ? {
166
+ directory: {
167
+ type: "string",
168
+ description: "Parent folder of the project. Default: plugins.",
169
+ },
170
+ host: {
171
+ type: "string",
172
+ description:
173
+ "Workspace host to register with. Default: the host with the kosdev.ddk plugin context, else none.",
174
+ },
175
+ }
176
+ : {}),
177
+ dryRun,
178
+ ...workspaceRootProperty,
179
+ },
180
+ required: ["name"],
181
+ },
182
+ handler: async (args) => {
183
+ try {
184
+ const dryRunMode = args.dryRun !== false;
185
+ const result = createDdkProject(kind, {
186
+ workspaceRoot: resolveWorkspaceRoot(args),
187
+ name: args.name,
188
+ directory: args.directory,
189
+ host: args.host,
190
+ ncui: {
191
+ layout: args.layout,
192
+ ...Object.fromEntries(
193
+ Object.keys(NCUI_OPTIONS).map((option) => [
194
+ option,
195
+ !!args[option],
196
+ ])
197
+ ),
198
+ },
199
+ dryRun: dryRunMode,
200
+ });
201
+ return textResult({ dryRun: dryRunMode, ...result });
202
+ } catch (e) {
203
+ return errorResult(e.message);
204
+ }
205
+ },
206
+ };
207
+ }
208
+
209
+ export const ddkTools = [
210
+ projectTool(
211
+ "scaffold_ddk_plugin_project",
212
+ "plugin",
213
+ "Create a DDK plugin project: module federation serve target, DDK Storybook, .kos.json. dryRun lists the files."
214
+ ),
215
+ projectTool(
216
+ "scaffold_ddk_theme_project",
217
+ "theme",
218
+ "Create a DDK theme project; its theme-overlay.css overrides the DDK tokens. dryRun lists the files."
219
+ ),
220
+ projectTool(
221
+ "scaffold_ddk_descriptor_project",
222
+ "descriptor",
223
+ "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."
224
+ ),
225
+ contributionTool(
226
+ "add_utility",
227
+ "utility",
228
+ "Add a utility (utilities contribution) with its component, story and i18n title. The component renders in a modal through useUtilityModal.",
229
+ slot("utilDescriptor", "kondra.ncui.utilities", {
230
+ column: {
231
+ type: "integer",
232
+ description:
233
+ "With descriptorProject: utilities column, 1-based. Default: the last.",
234
+ },
235
+ layout: {
236
+ type: "string",
237
+ enum: ["maximized", "fullscreen"],
238
+ description:
239
+ "The utility's modal: maximized (default, a modal over the shell) or fullscreen (covers the display).",
240
+ },
241
+ })
242
+ ),
243
+ contributionTool(
244
+ "add_setup_step",
245
+ "setup",
246
+ "Add a setup step (setupStep contribution) with its component, story and i18n title.",
247
+ slot("setupDescriptor", "kondra.ncui.setup.steps")
248
+ ),
249
+ contributionTool(
250
+ "add_nav_view",
251
+ "nav",
252
+ "Add a navigation view (navViews contribution) with its component, story and i18n title.",
253
+ slot("navDescriptor", "kondra.ncui.navigations", {
254
+ descriptor: {
255
+ type: "string",
256
+ description:
257
+ "navDescriptor, a kondra.ncui.navigations path such as settings.water. Required unless override.",
258
+ },
259
+ })
260
+ ),
261
+ contributionTool(
262
+ "add_cui_config",
263
+ "cui",
264
+ "Add a CUI configuration (cui contribution) with its component and story.",
265
+ {
266
+ descriptor: {
267
+ type: "string",
268
+ description:
269
+ "cuiDescriptor: the CUI's appId from /api/app/kosdev.ddk/cui.",
270
+ },
271
+ },
272
+ ["descriptor"]
273
+ ),
274
+ {
275
+ name: "add_dashboard_card",
276
+ description:
277
+ "Add a dashboard summary card and, by default, the detail it opens; both share dashboardKey and rank.",
278
+ inputSchema: {
279
+ type: "object",
280
+ properties: {
281
+ ...common,
282
+ dashboardKey,
283
+ detail: {
284
+ type: "boolean",
285
+ description: "Also add the detail the card opens. Default true.",
286
+ },
287
+ override,
288
+ rank,
289
+ },
290
+ required: ["name", "project"],
291
+ },
292
+ handler: (args) =>
293
+ run(args, (codegenFs) =>
294
+ generateDashboardCard(codegenFs, {
295
+ name: args.name,
296
+ project: args.project,
297
+ dashboardKey: args.dashboardKey,
298
+ detail: args.detail !== false,
299
+ override: args.override,
300
+ rank: args.rank,
301
+ })
302
+ ),
303
+ },
304
+ {
305
+ name: "add_pump_detail",
306
+ description:
307
+ "Add the pump detail shown in the holder modal for holders with dashboardKey.",
308
+ inputSchema: {
309
+ type: "object",
310
+ properties: { ...common, dashboardKey, override, rank },
311
+ required: ["name", "project"],
312
+ },
313
+ handler: (args) =>
314
+ run(args, (codegenFs) =>
315
+ generatePumpDetail(codegenFs, {
316
+ name: args.name,
317
+ project: args.project,
318
+ dashboardKey: args.dashboardKey,
319
+ override: args.override,
320
+ rank: args.rank,
321
+ })
322
+ ),
323
+ },
324
+ {
325
+ name: "add_pump_card",
326
+ description:
327
+ "Add a pump card for a pump type: the holder card body and, by default, the pump detail; both share dashboardKey and rank.",
328
+ inputSchema: {
329
+ type: "object",
330
+ properties: {
331
+ ...common,
332
+ dashboardKey: {
333
+ type: "string",
334
+ description:
335
+ "The pump type the backend assembly assigns (the holder's first pump), e.g. cgp. Taken from override when given.",
336
+ },
337
+ detail: {
338
+ type: "boolean",
339
+ description: "Also add the pump detail. Default true.",
340
+ },
341
+ override,
342
+ rank,
343
+ },
344
+ required: ["name", "project"],
345
+ },
346
+ handler: (args) =>
347
+ run(args, (codegenFs) =>
348
+ generatePumpCard(codegenFs, {
349
+ name: args.name,
350
+ project: args.project,
351
+ dashboardKey: args.dashboardKey,
352
+ detail: args.detail !== false,
353
+ override: args.override,
354
+ rank: args.rank,
355
+ })
356
+ ),
357
+ },
358
+ {
359
+ name: "add_macro_summary",
360
+ description: "Add the macro holder card body for dashboardKey.",
361
+ inputSchema: {
362
+ type: "object",
363
+ properties: { ...common, dashboardKey, override, rank },
364
+ required: ["name", "project"],
365
+ },
366
+ handler: (args) =>
367
+ run(args, (codegenFs) =>
368
+ generateMacroSummary(codegenFs, {
369
+ name: args.name,
370
+ project: args.project,
371
+ dashboardKey: args.dashboardKey,
372
+ override: args.override,
373
+ rank: args.rank,
374
+ })
375
+ ),
376
+ },
377
+ {
378
+ name: "add_dashboard_region",
379
+ description:
380
+ "Add a component that renders a whole dashboard region in place of its built-in cards: the descriptor region whose component (else name) is regionKey. A built-in region name such as macros replaces that region's cards.",
381
+ inputSchema: {
382
+ type: "object",
383
+ properties: {
384
+ ...common,
385
+ regionKey: {
386
+ type: "string",
387
+ description:
388
+ "The descriptor region's component, else its name. Default: from the name.",
389
+ },
390
+ descriptorProject: {
391
+ type: "string",
392
+ description:
393
+ "NCUI descriptor project to add the region to, as a full-width last row claiming no holders or summaries (scaffold_ddk_descriptor_project).",
394
+ },
395
+ rank: {
396
+ type: "integer",
397
+ description: "0-1000; lower wins among plugins rendering the same region.",
398
+ },
399
+ },
400
+ required: ["name", "project"],
401
+ },
402
+ handler: (args) =>
403
+ run(args, (codegenFs) =>
404
+ generateDashboardRegion(codegenFs, {
405
+ name: args.name,
406
+ project: args.project,
407
+ regionKey: args.regionKey,
408
+ rank: args.rank,
409
+ descriptorProject: args.descriptorProject,
410
+ })
411
+ ),
412
+ },
413
+ {
414
+ name: "add_trouble_action",
415
+ description:
416
+ "Add the experience shown while the device has an active trouble of troubleType.",
417
+ inputSchema: {
418
+ type: "object",
419
+ properties: {
420
+ ...common,
421
+ troubleType: {
422
+ type: "string",
423
+ description:
424
+ "Exact trouble type the device raises. Taken from override when given.",
425
+ },
426
+ stateKey: {
427
+ type: "string",
428
+ description:
429
+ "Contributions sharing a stateKey share one experience. Default: troubleType.",
430
+ },
431
+ stateValue: {
432
+ type: "string",
433
+ description: "Default: troubleType.",
434
+ },
435
+ override,
436
+ rank,
437
+ },
438
+ required: ["name", "project"],
439
+ },
440
+ handler: (args) =>
441
+ run(args, (codegenFs) =>
442
+ generateTroubleAction(codegenFs, {
443
+ name: args.name,
444
+ project: args.project,
445
+ troubleType: args.troubleType,
446
+ stateKey: args.stateKey,
447
+ stateValue: args.stateValue,
448
+ override: args.override,
449
+ rank: args.rank,
450
+ })
451
+ ),
452
+ },
453
+ {
454
+ name: "describe_ddk_plugin",
455
+ description:
456
+ "A DDK plugin project's contributions from its .kos.json: extension point, slot, rank, component, and which standard contributions it shares a slot with and beats.",
457
+ inputSchema: {
458
+ type: "object",
459
+ properties: { project, ...workspaceRootProperty },
460
+ required: ["project"],
461
+ },
462
+ handler: async (args) => {
463
+ try {
464
+ return textResult(
465
+ describePlugin(resolveWorkspaceRoot(args), args.project)
466
+ );
467
+ } catch (e) {
468
+ return errorResult(e.message);
469
+ }
470
+ },
471
+ },
472
+ {
473
+ name: "add_descriptor_entries",
474
+ description:
475
+ "List a plugin's existing utility, setup step and navigation slots in an NCUI descriptor project.",
476
+ inputSchema: {
477
+ type: "object",
478
+ properties: {
479
+ project,
480
+ descriptorProject: {
481
+ type: "string",
482
+ description: "NCUI descriptor project to list them in.",
483
+ },
484
+ dryRun,
485
+ ...workspaceRootProperty,
486
+ },
487
+ required: ["project", "descriptorProject"],
488
+ },
489
+ handler: (args) =>
490
+ run(args, (codegenFs) =>
491
+ addPluginDescriptorEntries(codegenFs, {
492
+ project: args.project,
493
+ descriptorProject: args.descriptorProject,
494
+ })
495
+ ),
496
+ },
497
+ {
498
+ name: "validate_ddk_plugin",
499
+ description:
500
+ "Check a DDK plugin project: contribution fields against each extension point's schema, ranks, experiences and their component files, overrides that do not win, and tokens set in plugin code.",
501
+ inputSchema: {
502
+ type: "object",
503
+ properties: { project, ...workspaceRootProperty },
504
+ required: ["project"],
505
+ },
506
+ handler: async (args) => {
507
+ try {
508
+ return textResult(
509
+ validatePlugin(resolveWorkspaceRoot(args), args.project)
510
+ );
511
+ } catch (e) {
512
+ return errorResult(e.message);
513
+ }
514
+ },
515
+ },
516
+ {
517
+ name: "find_ddk_capability",
518
+ description:
519
+ "Map a plain-language need (e.g. replace the carb tank card) to the DDK extension points and components that cover it, with the resource and tool for each.",
520
+ inputSchema: {
521
+ type: "object",
522
+ properties: {
523
+ need: { type: "string", description: "What the plugin should do." },
524
+ },
525
+ required: ["need"],
526
+ },
527
+ handler: async (args) => {
528
+ try {
529
+ return textResult(findCapability(args.need));
530
+ } catch (e) {
531
+ return errorResult(e.message);
532
+ }
533
+ },
534
+ },
535
+ {
536
+ name: "list_ddk_components",
537
+ description:
538
+ "List the DDK components and styled parts plugins render, by name and source file.",
539
+ inputSchema: {
540
+ type: "object",
541
+ properties: {
542
+ library: {
543
+ type: "string",
544
+ enum: COMPONENT_LIBRARIES,
545
+ description: "Only this library.",
546
+ },
547
+ query: {
548
+ type: "string",
549
+ description:
550
+ "Words every match has in its name or path, e.g. dashboard card.",
551
+ },
552
+ },
553
+ },
554
+ handler: async (args) => {
555
+ try {
556
+ return textResult({ components: listComponents(args) });
557
+ } catch (e) {
558
+ return errorResult(e.message);
559
+ }
560
+ },
561
+ },
562
+ {
563
+ name: "describe_ddk_component",
564
+ description:
565
+ "One DDK component or hook from its source. Component: props (inherited ones included), the components and hooks it uses, each token it reads per theme. Hook: signature, option fields, returned fields.",
566
+ inputSchema: {
567
+ type: "object",
568
+ properties: {
569
+ name: {
570
+ type: "string",
571
+ description: "Export name, e.g. HolderDashboardCard or useUtilityModal.",
572
+ },
573
+ library: {
574
+ type: "string",
575
+ enum: COMPONENT_LIBRARIES,
576
+ description: "Library, when both export the name.",
577
+ },
578
+ },
579
+ required: ["name"],
580
+ },
581
+ handler: async (args) => {
582
+ try {
583
+ const text = describeComponent(args.name, args.library);
584
+ return text
585
+ ? { content: [{ type: "text", text }] }
586
+ : errorResult(
587
+ `No DDK component or hook named ${args.name}; list_ddk_components lists the components.`
588
+ );
589
+ } catch (e) {
590
+ return errorResult(e.message);
591
+ }
592
+ },
593
+ },
594
+ {
595
+ name: "list_ddk_contributions",
596
+ description:
597
+ "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.",
598
+ inputSchema: {
599
+ type: "object",
600
+ properties: {
601
+ point: {
602
+ type: "string",
603
+ enum: Object.keys(OVERRIDABLE_POINTS),
604
+ description: "Only this command's contributions.",
605
+ },
606
+ },
607
+ },
608
+ handler: async (args) => {
609
+ try {
610
+ return textResult({
611
+ points: describeOverridablePoints(args.point || undefined),
612
+ contributions: listOverridableContributions(args.point || undefined),
613
+ });
614
+ } catch (e) {
615
+ return errorResult(e.message);
616
+ }
617
+ },
618
+ },
619
+ ];
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Note: The plugin project Storybook configuration requires that the Studio
3
+ * Simulator is running in order to retrieve model data, unless the story mocks
4
+ * it with parameters.kosMock (ddk://guide/storybook).
5
+ */
6
+ import { CUIStoryContainer } from "@kosdev-code/kos-ddk-story-containers";
7
+ import type { Meta, StoryObj } from "@storybook/react";
8
+ import { <%= namePascalCase %> } from "./<%= nameDashCase %>";
9
+
10
+ const meta: Meta<typeof <%= namePascalCase %>> = {
11
+ args: {},
12
+ component: <%= namePascalCase %>,
13
+ decorators: [
14
+ (Story, context) => (
15
+ <CUIStoryContainer>
16
+ <Story args={{ ...context.args }} />
17
+ </CUIStoryContainer>
18
+ ),
19
+ ],
20
+ tags: ["!autodocs"],
21
+ title: "CUI/<%= namePascalCase %>",
22
+ };
23
+
24
+ export default meta;
25
+
26
+ type Story = StoryObj<typeof <%= namePascalCase %>>;
27
+
28
+ export const Default: Story = {
29
+ // parameters: { kosMock: { setups: ["<setup module>"] } },
30
+ render: (props) => <<%= namePascalCase %> {...props} />,
31
+ };
32
+
@@ -0,0 +1,35 @@
1
+ import styled from '@emotion/styled';
2
+ import {
3
+ Button,
4
+ Footer,
5
+ type Experience,
6
+ } from '@kosdev-code/kos-ddk-components';
7
+ import {
8
+ KosLog,
9
+ kosComponent,
10
+ useKosTranslation,
11
+ } from '@kosdev-code/kos-ui-sdk';
12
+
13
+ const log = KosLog.createLogger({name: "<%= nameDashCase %>"})
14
+ log.debug("<%= nameDashCase %> component loaded");
15
+
16
+ const <%= namePascalCase %>Container = styled.div`
17
+ align-items: center;
18
+ display: flex;
19
+ flex-direction: column;
20
+ width: 100%;
21
+ `;
22
+
23
+ export const <%= namePascalCase %>: Experience = kosComponent(({ onComplete }) => {
24
+ const { t } = useKosTranslation('<%= appProject %>');
25
+ return (
26
+ <<%= namePascalCase %>Container>
27
+ Hello from <%= namePascalCase %> CUI Configuration
28
+ <Footer>
29
+ <Button onClick={onComplete}>{t('proceed')}</Button>
30
+ </Footer>
31
+ </<%= namePascalCase %>Container>
32
+ );
33
+ });
34
+
35
+ export default <%= namePascalCase %>
@@ -0,0 +1 @@
1
+ export * from "./<%= nameDashCase %>";