@kosdev-code/kos-ddk-cli 0.0.0-stage → 0.1.0-dev.55
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 +165 -2
- package/agent-plugin/.claude-plugin/marketplace.json +13 -0
- package/agent-plugin/kos-ddk-tools/.claude-plugin/plugin.json +8 -0
- package/agent-plugin/kos-ddk-tools/.mcp.json +11 -0
- package/agent-plugin/kos-ddk-tools/agents/kos-ddk-plugin-planner.md +40 -0
- package/agent-plugin/kos-ddk-tools/agents/kos-ddk-plugin-reviewer.md +33 -0
- package/agent-plugin/kos-ddk-tools/catalog/contributions.json +877 -0
- package/agent-plugin/kos-ddk-tools/mcp.json +12 -0
- package/agent-plugin/kos-ddk-tools/plugin.json +7 -0
- package/agent-plugin/kos-ddk-tools/reference/reference.json +19339 -0
- package/agent-plugin/kos-ddk-tools/servers/kos-ddk.mjs +48633 -0
- package/agent-plugin/kos-ddk-tools/skills/build-ddk-plugin/SKILL.md +74 -0
- package/agent-plugin/kos-ddk-tools/skills/ddk-content-component/SKILL.md +49 -0
- package/agent-plugin/kos-ddk-tools/skills/ddk-storybook/SKILL.md +39 -0
- package/agent-plugin/kos-ddk-tools/templates/cui/__nameDashCase__.stories.tsx__template__ +32 -0
- package/agent-plugin/kos-ddk-tools/templates/cui/__nameDashCase__.tsx__template__ +35 -0
- package/agent-plugin/kos-ddk-tools/templates/cui/index.ts__template__ +1 -0
- package/agent-plugin/kos-ddk-tools/templates/dashboard-detail/detail/__nameDashCase__.stories.tsx__template__ +34 -0
- package/agent-plugin/kos-ddk-tools/templates/dashboard-detail/detail/__nameDashCase__.tsx__template__ +52 -0
- package/agent-plugin/kos-ddk-tools/templates/dashboard-detail/detail/index.ts__template__ +1 -0
- package/agent-plugin/kos-ddk-tools/templates/dashboard-summary/summary/__nameDashCase__.stories.tsx__template__ +34 -0
- package/agent-plugin/kos-ddk-tools/templates/dashboard-summary/summary/__nameDashCase__.tsx__template__ +41 -0
- package/agent-plugin/kos-ddk-tools/templates/dashboard-summary/summary/index.ts__template__ +1 -0
- package/agent-plugin/kos-ddk-tools/templates/macro-summary/__nameDashCase__.stories.tsx__template__ +34 -0
- package/agent-plugin/kos-ddk-tools/templates/macro-summary/__nameDashCase__.tsx__template__ +24 -0
- package/agent-plugin/kos-ddk-tools/templates/macro-summary/index.ts__template__ +1 -0
- package/agent-plugin/kos-ddk-tools/templates/nav/__nameDashCase__.stories.tsx__template__ +32 -0
- package/agent-plugin/kos-ddk-tools/templates/nav/__nameDashCase__.tsx__template__ +27 -0
- package/agent-plugin/kos-ddk-tools/templates/nav/index.ts__template__ +1 -0
- package/agent-plugin/kos-ddk-tools/templates/plugin-project/.storybook/preview.tsx.template +113 -0
- package/agent-plugin/kos-ddk-tools/templates/plugin-project/.storybook/registration.ts.template +6 -0
- package/agent-plugin/kos-ddk-tools/templates/pump-detail/__nameDashCase__.stories.tsx__template__ +34 -0
- package/agent-plugin/kos-ddk-tools/templates/pump-detail/__nameDashCase__.tsx__template__ +38 -0
- package/agent-plugin/kos-ddk-tools/templates/pump-detail/index.ts__template__ +1 -0
- package/agent-plugin/kos-ddk-tools/templates/pump-summary/__nameDashCase__.stories.tsx__template__ +34 -0
- package/agent-plugin/kos-ddk-tools/templates/pump-summary/__nameDashCase__.tsx__template__ +25 -0
- package/agent-plugin/kos-ddk-tools/templates/pump-summary/index.ts__template__ +1 -0
- package/agent-plugin/kos-ddk-tools/templates/setup/__nameDashCase__.stories.tsx__template__ +32 -0
- package/agent-plugin/kos-ddk-tools/templates/setup/__nameDashCase__.tsx__template__ +33 -0
- package/agent-plugin/kos-ddk-tools/templates/setup/index.ts__template__ +1 -0
- package/agent-plugin/kos-ddk-tools/templates/theme-project/theme/assets/component.css.template +2 -0
- package/agent-plugin/kos-ddk-tools/templates/theme-project/theme/assets/generic.css.template +2 -0
- package/agent-plugin/kos-ddk-tools/templates/theme-project/theme/assets/semantic.css.template +2 -0
- package/agent-plugin/kos-ddk-tools/templates/theme-project/theme/assets/theme-overlay.css.template +7 -0
- package/agent-plugin/kos-ddk-tools/templates/trouble-action/__nameDashCase__.stories.tsx__template__ +31 -0
- package/agent-plugin/kos-ddk-tools/templates/trouble-action/__nameDashCase__.tsx__template__ +57 -0
- package/agent-plugin/kos-ddk-tools/templates/trouble-action/index.ts__template__ +1 -0
- package/agent-plugin/kos-ddk-tools/templates/utility/__nameDashCase__.stories.tsx__template__ +32 -0
- package/agent-plugin/kos-ddk-tools/templates/utility/__nameDashCase__.tsx__template__ +37 -0
- package/agent-plugin/kos-ddk-tools/templates/utility/index.ts__template__ +1 -0
- package/catalog/contributions.json +877 -0
- package/guides/ddk-dev.md +47 -0
- package/guides/getting-started.md +117 -0
- package/guides/storybook.md +104 -0
- package/package.json +33 -3
- package/reference/reference.json +19339 -0
- package/src/build-paths.mjs +20 -0
- package/src/codegen/contribution.mjs +425 -0
- package/src/codegen/descriptor.mjs +210 -0
- package/src/codegen/ncui-descriptor.mjs +134 -0
- package/src/codegen/overrides.mjs +263 -0
- package/src/codegen/project.mjs +242 -0
- package/src/extension.mjs +32 -0
- package/src/generators/agent-install.mjs +80 -0
- package/src/generators/catalog.mjs +81 -0
- package/src/generators/contributions.mjs +151 -0
- package/src/generators/dashboard.mjs +241 -0
- package/src/generators/descriptor-entries.mjs +53 -0
- package/src/generators/descriptor-project.mjs +79 -0
- package/src/generators/dev.mjs +231 -0
- package/src/generators/override-prompts.mjs +27 -0
- package/src/generators/plugin-project.mjs +66 -0
- package/src/generators/theme-project.mjs +45 -0
- package/src/handlers.mjs +315 -0
- package/src/mcp/pkg-info.mjs +7 -0
- package/src/mcp/plugin-inspect.mjs +292 -0
- package/src/mcp/reference.mjs +264 -0
- package/src/mcp/server.mjs +12 -0
- package/src/mcp/tools.mjs +575 -0
- package/templates/cui/__nameDashCase__.stories.tsx__template__ +32 -0
- package/templates/cui/__nameDashCase__.tsx__template__ +35 -0
- package/templates/cui/index.ts__template__ +1 -0
- package/templates/dashboard-detail/detail/__nameDashCase__.stories.tsx__template__ +34 -0
- package/templates/dashboard-detail/detail/__nameDashCase__.tsx__template__ +52 -0
- package/templates/dashboard-detail/detail/index.ts__template__ +1 -0
- package/templates/dashboard-summary/summary/__nameDashCase__.stories.tsx__template__ +34 -0
- package/templates/dashboard-summary/summary/__nameDashCase__.tsx__template__ +41 -0
- package/templates/dashboard-summary/summary/index.ts__template__ +1 -0
- package/templates/macro-summary/__nameDashCase__.stories.tsx__template__ +34 -0
- package/templates/macro-summary/__nameDashCase__.tsx__template__ +24 -0
- package/templates/macro-summary/index.ts__template__ +1 -0
- package/templates/nav/__nameDashCase__.stories.tsx__template__ +32 -0
- package/templates/nav/__nameDashCase__.tsx__template__ +27 -0
- package/templates/nav/index.ts__template__ +1 -0
- package/templates/plugin-project/.storybook/preview.tsx.template +113 -0
- package/templates/plugin-project/.storybook/registration.ts.template +6 -0
- package/templates/pump-detail/__nameDashCase__.stories.tsx__template__ +34 -0
- package/templates/pump-detail/__nameDashCase__.tsx__template__ +38 -0
- package/templates/pump-detail/index.ts__template__ +1 -0
- package/templates/pump-summary/__nameDashCase__.stories.tsx__template__ +34 -0
- package/templates/pump-summary/__nameDashCase__.tsx__template__ +25 -0
- package/templates/pump-summary/index.ts__template__ +1 -0
- package/templates/setup/__nameDashCase__.stories.tsx__template__ +32 -0
- package/templates/setup/__nameDashCase__.tsx__template__ +33 -0
- package/templates/setup/index.ts__template__ +1 -0
- package/templates/theme-project/theme/assets/component.css.template +2 -0
- package/templates/theme-project/theme/assets/generic.css.template +2 -0
- package/templates/theme-project/theme/assets/semantic.css.template +2 -0
- package/templates/theme-project/theme/assets/theme-overlay.css.template +7 -0
- package/templates/trouble-action/__nameDashCase__.stories.tsx__template__ +31 -0
- package/templates/trouble-action/__nameDashCase__.tsx__template__ +57 -0
- package/templates/trouble-action/index.ts__template__ +1 -0
- package/templates/utility/__nameDashCase__.stories.tsx__template__ +32 -0
- package/templates/utility/__nameDashCase__.tsx__template__ +37 -0
- package/templates/utility/index.ts__template__ +1 -0
|
@@ -0,0 +1,575 @@
|
|
|
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
|
+
generateDdkContribution,
|
|
13
|
+
generateMacroSummary,
|
|
14
|
+
generatePumpCard,
|
|
15
|
+
generatePumpDetail,
|
|
16
|
+
generateTroubleAction,
|
|
17
|
+
} from "../codegen/contribution.mjs";
|
|
18
|
+
import {
|
|
19
|
+
OVERRIDABLE_POINTS,
|
|
20
|
+
describeOverridablePoints,
|
|
21
|
+
listOverridableContributions,
|
|
22
|
+
} from "../codegen/overrides.mjs";
|
|
23
|
+
import { addPluginDescriptorEntries } from "../codegen/descriptor.mjs";
|
|
24
|
+
import { NCUI_LAYOUTS, NCUI_OPTIONS } from "../codegen/ncui-descriptor.mjs";
|
|
25
|
+
import { createDdkProject } from "../codegen/project.mjs";
|
|
26
|
+
import { describePlugin, validatePlugin } from "./plugin-inspect.mjs";
|
|
27
|
+
import {
|
|
28
|
+
COMPONENT_LIBRARIES,
|
|
29
|
+
describeComponent,
|
|
30
|
+
findCapability,
|
|
31
|
+
listComponents,
|
|
32
|
+
} from "./reference.mjs";
|
|
33
|
+
|
|
34
|
+
const name = {
|
|
35
|
+
type: "string",
|
|
36
|
+
description: "Component name in kebab-case, e.g. fuel-level.",
|
|
37
|
+
};
|
|
38
|
+
const project = {
|
|
39
|
+
type: "string",
|
|
40
|
+
description: "DDK plugin project to write into.",
|
|
41
|
+
};
|
|
42
|
+
const dryRun = {
|
|
43
|
+
type: "boolean",
|
|
44
|
+
description: "Default true: return the would-write files. false writes.",
|
|
45
|
+
};
|
|
46
|
+
const override = {
|
|
47
|
+
type: "string",
|
|
48
|
+
description:
|
|
49
|
+
"Id of a standard contribution to replace (from list_ddk_contributions). Takes its slot with a winning rank.",
|
|
50
|
+
};
|
|
51
|
+
const rank = {
|
|
52
|
+
type: "integer",
|
|
53
|
+
description:
|
|
54
|
+
"0-1000; lower wins. Default with override: 100, or one better than a ranked target.",
|
|
55
|
+
};
|
|
56
|
+
const dashboardKey = {
|
|
57
|
+
type: "string",
|
|
58
|
+
description:
|
|
59
|
+
"Assembly property whose models get the contribution, e.g. carbTank. Taken from override when given.",
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const common = { name, project, dryRun, ...workspaceRootProperty };
|
|
63
|
+
|
|
64
|
+
async function run(args, generate) {
|
|
65
|
+
try {
|
|
66
|
+
const cwd = resolveWorkspaceRoot(args);
|
|
67
|
+
const result = await runGenerator({
|
|
68
|
+
dryRun: args.dryRun !== false,
|
|
69
|
+
cwd,
|
|
70
|
+
generate,
|
|
71
|
+
});
|
|
72
|
+
return textResult(
|
|
73
|
+
result.dryRun
|
|
74
|
+
? { ...result, hint: "Re-run with dryRun:false to write." }
|
|
75
|
+
: result
|
|
76
|
+
);
|
|
77
|
+
} catch (e) {
|
|
78
|
+
return errorResult(e.message);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** A tool for a ddk:<type> contribution command handled by generateDdkContribution. */
|
|
83
|
+
function contributionTool(
|
|
84
|
+
toolName,
|
|
85
|
+
type,
|
|
86
|
+
description,
|
|
87
|
+
extra = {},
|
|
88
|
+
required = []
|
|
89
|
+
) {
|
|
90
|
+
return {
|
|
91
|
+
name: toolName,
|
|
92
|
+
description,
|
|
93
|
+
inputSchema: {
|
|
94
|
+
type: "object",
|
|
95
|
+
properties: { ...common, ...extra },
|
|
96
|
+
required: ["name", "project", ...required],
|
|
97
|
+
},
|
|
98
|
+
handler: (args) =>
|
|
99
|
+
run(args, (codegenFs) =>
|
|
100
|
+
generateDdkContribution(codegenFs, {
|
|
101
|
+
type,
|
|
102
|
+
name: args.name,
|
|
103
|
+
project: args.project,
|
|
104
|
+
descriptor: args.descriptor,
|
|
105
|
+
override: args.override,
|
|
106
|
+
rank: args.rank,
|
|
107
|
+
descriptorProject: args.descriptorProject,
|
|
108
|
+
roles: args.roles,
|
|
109
|
+
column: args.column,
|
|
110
|
+
})
|
|
111
|
+
),
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const slot = (field, listedIn, extra = {}) => ({
|
|
116
|
+
descriptor: {
|
|
117
|
+
type: "string",
|
|
118
|
+
description: `${field}; shown only if the NCUI descriptor lists it (${listedIn}). Default: from the name.`,
|
|
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,
|
|
130
|
+
override,
|
|
131
|
+
rank,
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
function projectTool(name, kind, description) {
|
|
135
|
+
return {
|
|
136
|
+
name,
|
|
137
|
+
description,
|
|
138
|
+
inputSchema: {
|
|
139
|
+
type: "object",
|
|
140
|
+
properties: {
|
|
141
|
+
name: {
|
|
142
|
+
type: "string",
|
|
143
|
+
description: `${
|
|
144
|
+
{ plugin: "Plugin", theme: "Theme", descriptor: "Descriptor" }[kind]
|
|
145
|
+
} project name in kebab-case.`,
|
|
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
|
+
: {}),
|
|
175
|
+
dryRun,
|
|
176
|
+
...workspaceRootProperty,
|
|
177
|
+
},
|
|
178
|
+
required: ["name"],
|
|
179
|
+
},
|
|
180
|
+
handler: async (args) => {
|
|
181
|
+
try {
|
|
182
|
+
const dryRunMode = args.dryRun !== false;
|
|
183
|
+
const result = createDdkProject(kind, {
|
|
184
|
+
workspaceRoot: resolveWorkspaceRoot(args),
|
|
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
|
+
},
|
|
197
|
+
dryRun: dryRunMode,
|
|
198
|
+
});
|
|
199
|
+
return textResult({ dryRun: dryRunMode, ...result });
|
|
200
|
+
} catch (e) {
|
|
201
|
+
return errorResult(e.message);
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export const ddkTools = [
|
|
208
|
+
projectTool(
|
|
209
|
+
"scaffold_ddk_plugin_project",
|
|
210
|
+
"plugin",
|
|
211
|
+
"Create a DDK plugin project: module federation serve target, DDK Storybook, .kos.json. dryRun lists the files."
|
|
212
|
+
),
|
|
213
|
+
projectTool(
|
|
214
|
+
"scaffold_ddk_theme_project",
|
|
215
|
+
"theme",
|
|
216
|
+
"Create a DDK theme project; its theme-overlay.css overrides the DDK tokens. dryRun lists the files."
|
|
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
|
+
),
|
|
223
|
+
contributionTool(
|
|
224
|
+
"add_utility",
|
|
225
|
+
"utility",
|
|
226
|
+
"Add a utility (utilities contribution) with its component, story and i18n title.",
|
|
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
|
+
})
|
|
234
|
+
),
|
|
235
|
+
contributionTool(
|
|
236
|
+
"add_setup_step",
|
|
237
|
+
"setup",
|
|
238
|
+
"Add a setup step (setupStep contribution) with its component, story and i18n title.",
|
|
239
|
+
slot("setupDescriptor", "kondra.ncui.setup.steps")
|
|
240
|
+
),
|
|
241
|
+
contributionTool(
|
|
242
|
+
"add_nav_view",
|
|
243
|
+
"nav",
|
|
244
|
+
"Add a navigation view (navViews contribution) with its component, story and i18n title.",
|
|
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
|
+
})
|
|
252
|
+
),
|
|
253
|
+
contributionTool(
|
|
254
|
+
"add_cui_config",
|
|
255
|
+
"cui",
|
|
256
|
+
"Add a CUI configuration (cui contribution) with its component and story.",
|
|
257
|
+
{
|
|
258
|
+
descriptor: {
|
|
259
|
+
type: "string",
|
|
260
|
+
description:
|
|
261
|
+
"cuiDescriptor: the CUI's appId from /api/app/kosdev.ddk/cui.",
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
["descriptor"]
|
|
265
|
+
),
|
|
266
|
+
{
|
|
267
|
+
name: "add_dashboard_card",
|
|
268
|
+
description:
|
|
269
|
+
"Add a dashboard summary card and, by default, the detail it opens; both share dashboardKey and rank.",
|
|
270
|
+
inputSchema: {
|
|
271
|
+
type: "object",
|
|
272
|
+
properties: {
|
|
273
|
+
...common,
|
|
274
|
+
dashboardKey,
|
|
275
|
+
detail: {
|
|
276
|
+
type: "boolean",
|
|
277
|
+
description: "Also add the detail the card opens. Default true.",
|
|
278
|
+
},
|
|
279
|
+
override,
|
|
280
|
+
rank,
|
|
281
|
+
},
|
|
282
|
+
required: ["name", "project"],
|
|
283
|
+
},
|
|
284
|
+
handler: (args) =>
|
|
285
|
+
run(args, (codegenFs) =>
|
|
286
|
+
generateDashboardCard(codegenFs, {
|
|
287
|
+
name: args.name,
|
|
288
|
+
project: args.project,
|
|
289
|
+
dashboardKey: args.dashboardKey,
|
|
290
|
+
detail: args.detail !== false,
|
|
291
|
+
override: args.override,
|
|
292
|
+
rank: args.rank,
|
|
293
|
+
})
|
|
294
|
+
),
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
name: "add_pump_detail",
|
|
298
|
+
description:
|
|
299
|
+
"Add the pump detail shown in the holder modal for holders with dashboardKey.",
|
|
300
|
+
inputSchema: {
|
|
301
|
+
type: "object",
|
|
302
|
+
properties: { ...common, dashboardKey, override, rank },
|
|
303
|
+
required: ["name", "project"],
|
|
304
|
+
},
|
|
305
|
+
handler: (args) =>
|
|
306
|
+
run(args, (codegenFs) =>
|
|
307
|
+
generatePumpDetail(codegenFs, {
|
|
308
|
+
name: args.name,
|
|
309
|
+
project: args.project,
|
|
310
|
+
dashboardKey: args.dashboardKey,
|
|
311
|
+
override: args.override,
|
|
312
|
+
rank: args.rank,
|
|
313
|
+
})
|
|
314
|
+
),
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
name: "add_pump_card",
|
|
318
|
+
description:
|
|
319
|
+
"Add a pump card for a pump type: the holder card body and, by default, the pump detail; both share dashboardKey and rank.",
|
|
320
|
+
inputSchema: {
|
|
321
|
+
type: "object",
|
|
322
|
+
properties: {
|
|
323
|
+
...common,
|
|
324
|
+
dashboardKey: {
|
|
325
|
+
type: "string",
|
|
326
|
+
description:
|
|
327
|
+
"The pump type the backend assembly assigns (the holder's first pump), e.g. cgp. Taken from override when given.",
|
|
328
|
+
},
|
|
329
|
+
detail: {
|
|
330
|
+
type: "boolean",
|
|
331
|
+
description: "Also add the pump detail. Default true.",
|
|
332
|
+
},
|
|
333
|
+
override,
|
|
334
|
+
rank,
|
|
335
|
+
},
|
|
336
|
+
required: ["name", "project"],
|
|
337
|
+
},
|
|
338
|
+
handler: (args) =>
|
|
339
|
+
run(args, (codegenFs) =>
|
|
340
|
+
generatePumpCard(codegenFs, {
|
|
341
|
+
name: args.name,
|
|
342
|
+
project: args.project,
|
|
343
|
+
dashboardKey: args.dashboardKey,
|
|
344
|
+
detail: args.detail !== false,
|
|
345
|
+
override: args.override,
|
|
346
|
+
rank: args.rank,
|
|
347
|
+
})
|
|
348
|
+
),
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
name: "add_macro_summary",
|
|
352
|
+
description: "Add the macro holder card body for dashboardKey.",
|
|
353
|
+
inputSchema: {
|
|
354
|
+
type: "object",
|
|
355
|
+
properties: { ...common, dashboardKey, override, rank },
|
|
356
|
+
required: ["name", "project"],
|
|
357
|
+
},
|
|
358
|
+
handler: (args) =>
|
|
359
|
+
run(args, (codegenFs) =>
|
|
360
|
+
generateMacroSummary(codegenFs, {
|
|
361
|
+
name: args.name,
|
|
362
|
+
project: args.project,
|
|
363
|
+
dashboardKey: args.dashboardKey,
|
|
364
|
+
override: args.override,
|
|
365
|
+
rank: args.rank,
|
|
366
|
+
})
|
|
367
|
+
),
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
name: "add_trouble_action",
|
|
371
|
+
description:
|
|
372
|
+
"Add the experience shown while the device has an active trouble of troubleType.",
|
|
373
|
+
inputSchema: {
|
|
374
|
+
type: "object",
|
|
375
|
+
properties: {
|
|
376
|
+
...common,
|
|
377
|
+
troubleType: {
|
|
378
|
+
type: "string",
|
|
379
|
+
description:
|
|
380
|
+
"Exact trouble type the device raises. Taken from override when given.",
|
|
381
|
+
},
|
|
382
|
+
stateKey: {
|
|
383
|
+
type: "string",
|
|
384
|
+
description:
|
|
385
|
+
"Contributions sharing a stateKey share one experience. Default: troubleType.",
|
|
386
|
+
},
|
|
387
|
+
stateValue: {
|
|
388
|
+
type: "string",
|
|
389
|
+
description: "Default: troubleType.",
|
|
390
|
+
},
|
|
391
|
+
override,
|
|
392
|
+
rank,
|
|
393
|
+
},
|
|
394
|
+
required: ["name", "project"],
|
|
395
|
+
},
|
|
396
|
+
handler: (args) =>
|
|
397
|
+
run(args, (codegenFs) =>
|
|
398
|
+
generateTroubleAction(codegenFs, {
|
|
399
|
+
name: args.name,
|
|
400
|
+
project: args.project,
|
|
401
|
+
troubleType: args.troubleType,
|
|
402
|
+
stateKey: args.stateKey,
|
|
403
|
+
stateValue: args.stateValue,
|
|
404
|
+
override: args.override,
|
|
405
|
+
rank: args.rank,
|
|
406
|
+
})
|
|
407
|
+
),
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
name: "describe_ddk_plugin",
|
|
411
|
+
description:
|
|
412
|
+
"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.",
|
|
413
|
+
inputSchema: {
|
|
414
|
+
type: "object",
|
|
415
|
+
properties: { project, ...workspaceRootProperty },
|
|
416
|
+
required: ["project"],
|
|
417
|
+
},
|
|
418
|
+
handler: async (args) => {
|
|
419
|
+
try {
|
|
420
|
+
return textResult(
|
|
421
|
+
describePlugin(resolveWorkspaceRoot(args), args.project)
|
|
422
|
+
);
|
|
423
|
+
} catch (e) {
|
|
424
|
+
return errorResult(e.message);
|
|
425
|
+
}
|
|
426
|
+
},
|
|
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
|
+
},
|
|
453
|
+
{
|
|
454
|
+
name: "validate_ddk_plugin",
|
|
455
|
+
description:
|
|
456
|
+
"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.",
|
|
457
|
+
inputSchema: {
|
|
458
|
+
type: "object",
|
|
459
|
+
properties: { project, ...workspaceRootProperty },
|
|
460
|
+
required: ["project"],
|
|
461
|
+
},
|
|
462
|
+
handler: async (args) => {
|
|
463
|
+
try {
|
|
464
|
+
return textResult(
|
|
465
|
+
validatePlugin(resolveWorkspaceRoot(args), args.project)
|
|
466
|
+
);
|
|
467
|
+
} catch (e) {
|
|
468
|
+
return errorResult(e.message);
|
|
469
|
+
}
|
|
470
|
+
},
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
name: "find_ddk_capability",
|
|
474
|
+
description:
|
|
475
|
+
"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.",
|
|
476
|
+
inputSchema: {
|
|
477
|
+
type: "object",
|
|
478
|
+
properties: {
|
|
479
|
+
need: { type: "string", description: "What the plugin should do." },
|
|
480
|
+
},
|
|
481
|
+
required: ["need"],
|
|
482
|
+
},
|
|
483
|
+
handler: async (args) => {
|
|
484
|
+
try {
|
|
485
|
+
return textResult(findCapability(args.need));
|
|
486
|
+
} catch (e) {
|
|
487
|
+
return errorResult(e.message);
|
|
488
|
+
}
|
|
489
|
+
},
|
|
490
|
+
},
|
|
491
|
+
{
|
|
492
|
+
name: "list_ddk_components",
|
|
493
|
+
description:
|
|
494
|
+
"List the DDK components and styled parts plugins render, by name and source file.",
|
|
495
|
+
inputSchema: {
|
|
496
|
+
type: "object",
|
|
497
|
+
properties: {
|
|
498
|
+
library: {
|
|
499
|
+
type: "string",
|
|
500
|
+
enum: COMPONENT_LIBRARIES,
|
|
501
|
+
description: "Only this library.",
|
|
502
|
+
},
|
|
503
|
+
query: {
|
|
504
|
+
type: "string",
|
|
505
|
+
description:
|
|
506
|
+
"Words every match has in its name or path, e.g. dashboard card.",
|
|
507
|
+
},
|
|
508
|
+
},
|
|
509
|
+
},
|
|
510
|
+
handler: async (args) => {
|
|
511
|
+
try {
|
|
512
|
+
return textResult({ components: listComponents(args) });
|
|
513
|
+
} catch (e) {
|
|
514
|
+
return errorResult(e.message);
|
|
515
|
+
}
|
|
516
|
+
},
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
name: "describe_ddk_component",
|
|
520
|
+
description:
|
|
521
|
+
"One DDK component from its source: props, the components and hooks it uses, and each token it reads with its value per theme.",
|
|
522
|
+
inputSchema: {
|
|
523
|
+
type: "object",
|
|
524
|
+
properties: {
|
|
525
|
+
name: {
|
|
526
|
+
type: "string",
|
|
527
|
+
description: "Export name, e.g. HolderDashboardCard.",
|
|
528
|
+
},
|
|
529
|
+
library: {
|
|
530
|
+
type: "string",
|
|
531
|
+
enum: COMPONENT_LIBRARIES,
|
|
532
|
+
description: "Library, when both export the name.",
|
|
533
|
+
},
|
|
534
|
+
},
|
|
535
|
+
required: ["name"],
|
|
536
|
+
},
|
|
537
|
+
handler: async (args) => {
|
|
538
|
+
try {
|
|
539
|
+
const text = describeComponent(args.name, args.library);
|
|
540
|
+
return text
|
|
541
|
+
? { content: [{ type: "text", text }] }
|
|
542
|
+
: errorResult(
|
|
543
|
+
`No DDK component named ${args.name}; list_ddk_components lists them.`
|
|
544
|
+
);
|
|
545
|
+
} catch (e) {
|
|
546
|
+
return errorResult(e.message);
|
|
547
|
+
}
|
|
548
|
+
},
|
|
549
|
+
},
|
|
550
|
+
{
|
|
551
|
+
name: "list_ddk_contributions",
|
|
552
|
+
description:
|
|
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.",
|
|
554
|
+
inputSchema: {
|
|
555
|
+
type: "object",
|
|
556
|
+
properties: {
|
|
557
|
+
point: {
|
|
558
|
+
type: "string",
|
|
559
|
+
enum: Object.keys(OVERRIDABLE_POINTS),
|
|
560
|
+
description: "Only this command's contributions.",
|
|
561
|
+
},
|
|
562
|
+
},
|
|
563
|
+
},
|
|
564
|
+
handler: async (args) => {
|
|
565
|
+
try {
|
|
566
|
+
return textResult({
|
|
567
|
+
points: describeOverridablePoints(args.point || undefined),
|
|
568
|
+
contributions: listOverridableContributions(args.point || undefined),
|
|
569
|
+
});
|
|
570
|
+
} catch (e) {
|
|
571
|
+
return errorResult(e.message);
|
|
572
|
+
}
|
|
573
|
+
},
|
|
574
|
+
},
|
|
575
|
+
];
|
|
@@ -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 %>";
|
|
@@ -0,0 +1,34 @@
|
|
|
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 { DashboardDetailStoryContainer } from "@kosdev-code/kos-ddk-story-containers";
|
|
7
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
8
|
+
import { <%= namePascalCase %>Detail } from "./<%= nameDashCase %>";
|
|
9
|
+
|
|
10
|
+
const meta: Meta<typeof <%= namePascalCase %>Detail> = {
|
|
11
|
+
args: {},
|
|
12
|
+
component: <%= namePascalCase %>Detail,
|
|
13
|
+
decorators: [
|
|
14
|
+
(Story, context) => (
|
|
15
|
+
<DashboardDetailStoryContainer
|
|
16
|
+
dashboardKey="<%= dashboardKey %>"
|
|
17
|
+
title="<%= namePascalCase %>"
|
|
18
|
+
>
|
|
19
|
+
{(props) => <Story args={{ ...context.args, ...props }} />}
|
|
20
|
+
</DashboardDetailStoryContainer>
|
|
21
|
+
),
|
|
22
|
+
],
|
|
23
|
+
tags: ["!autodocs"],
|
|
24
|
+
title: "dashboard/<%= namePascalCase %>/Detail",
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default meta;
|
|
28
|
+
|
|
29
|
+
type Story = StoryObj<typeof <%= namePascalCase %>Detail>;
|
|
30
|
+
|
|
31
|
+
export const Default: Story = {
|
|
32
|
+
// parameters: { kosMock: { setups: ["<setup module>"] } },
|
|
33
|
+
render: (props) => <<%= namePascalCase %>Detail {...props} />,
|
|
34
|
+
};
|