@kosdev-code/kos-ddk-cli 0.0.0-stage → 0.1.0-dev.50
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 +129 -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 +888 -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 +19288 -0
- package/agent-plugin/kos-ddk-tools/servers/kos-ddk.mjs +48632 -0
- package/agent-plugin/kos-ddk-tools/skills/build-ddk-plugin/SKILL.md +71 -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__ +30 -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__ +32 -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__ +32 -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__ +32 -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__ +30 -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 +80 -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__ +32 -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__ +32 -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/setting/__nameDashCase__.stories.tsx__template__ +30 -0
- package/agent-plugin/kos-ddk-tools/templates/setting/__nameDashCase__.tsx__template__ +27 -0
- package/agent-plugin/kos-ddk-tools/templates/setting/index.ts__template__ +1 -0
- package/agent-plugin/kos-ddk-tools/templates/setup/__nameDashCase__.stories.tsx__template__ +30 -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__ +29 -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__ +30 -0
- package/agent-plugin/kos-ddk-tools/templates/utility/__nameDashCase__.tsx__template__ +47 -0
- package/agent-plugin/kos-ddk-tools/templates/utility/index.ts__template__ +1 -0
- package/catalog/contributions.json +888 -0
- package/guides/ddk-dev.md +46 -0
- package/guides/storybook.md +69 -0
- package/package.json +33 -3
- package/reference/reference.json +19288 -0
- package/src/build-paths.mjs +20 -0
- package/src/codegen/contribution.mjs +255 -0
- package/src/codegen/overrides.mjs +179 -0
- package/src/codegen/project.mjs +144 -0
- package/src/extension.mjs +22 -0
- package/src/generators/agent-install.mjs +79 -0
- package/src/generators/catalog.mjs +70 -0
- package/src/generators/contributions.mjs +116 -0
- package/src/generators/dashboard.mjs +238 -0
- package/src/generators/dev.mjs +221 -0
- package/src/generators/override-prompts.mjs +27 -0
- package/src/generators/plugin-project.mjs +34 -0
- package/src/generators/theme-project.mjs +34 -0
- package/src/handlers.mjs +325 -0
- package/src/mcp/pkg-info.mjs +7 -0
- package/src/mcp/plugin-inspect.mjs +257 -0
- package/src/mcp/reference.mjs +248 -0
- package/src/mcp/server.mjs +12 -0
- package/src/mcp/tools.mjs +478 -0
- package/templates/cui/__nameDashCase__.stories.tsx__template__ +30 -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__ +32 -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__ +32 -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__ +32 -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__ +30 -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 +80 -0
- package/templates/plugin-project/.storybook/registration.ts.template +6 -0
- package/templates/pump-detail/__nameDashCase__.stories.tsx__template__ +32 -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__ +32 -0
- package/templates/pump-summary/__nameDashCase__.tsx__template__ +25 -0
- package/templates/pump-summary/index.ts__template__ +1 -0
- package/templates/setting/__nameDashCase__.stories.tsx__template__ +30 -0
- package/templates/setting/__nameDashCase__.tsx__template__ +27 -0
- package/templates/setting/index.ts__template__ +1 -0
- package/templates/setup/__nameDashCase__.stories.tsx__template__ +30 -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__ +29 -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__ +30 -0
- package/templates/utility/__nameDashCase__.tsx__template__ +47 -0
- package/templates/utility/index.ts__template__ +1 -0
|
@@ -0,0 +1,478 @@
|
|
|
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
|
+
listOverridableContributions,
|
|
21
|
+
} from "../codegen/overrides.mjs";
|
|
22
|
+
import { createDdkProject } from "../codegen/project.mjs";
|
|
23
|
+
import { describePlugin, validatePlugin } from "./plugin-inspect.mjs";
|
|
24
|
+
import {
|
|
25
|
+
COMPONENT_LIBRARIES,
|
|
26
|
+
describeComponent,
|
|
27
|
+
findCapability,
|
|
28
|
+
listComponents,
|
|
29
|
+
} from "./reference.mjs";
|
|
30
|
+
|
|
31
|
+
const name = {
|
|
32
|
+
type: "string",
|
|
33
|
+
description: "Component name in kebab-case, e.g. fuel-level.",
|
|
34
|
+
};
|
|
35
|
+
const project = {
|
|
36
|
+
type: "string",
|
|
37
|
+
description: "DDK plugin project to write into.",
|
|
38
|
+
};
|
|
39
|
+
const dryRun = {
|
|
40
|
+
type: "boolean",
|
|
41
|
+
description: "Default true: return the would-write files. false writes.",
|
|
42
|
+
};
|
|
43
|
+
const override = {
|
|
44
|
+
type: "string",
|
|
45
|
+
description:
|
|
46
|
+
"Id of a standard contribution to replace (from list_ddk_contributions). Takes its slot with a winning rank.",
|
|
47
|
+
};
|
|
48
|
+
const rank = {
|
|
49
|
+
type: "integer",
|
|
50
|
+
description:
|
|
51
|
+
"0-1000; lower wins. Default with override: 100, or one better than a ranked target.",
|
|
52
|
+
};
|
|
53
|
+
const dashboardKey = {
|
|
54
|
+
type: "string",
|
|
55
|
+
description:
|
|
56
|
+
"Assembly property whose models get the contribution, e.g. carbTank. Taken from override when given.",
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const common = { name, project, dryRun, ...workspaceRootProperty };
|
|
60
|
+
|
|
61
|
+
async function run(args, generate) {
|
|
62
|
+
try {
|
|
63
|
+
const cwd = resolveWorkspaceRoot(args);
|
|
64
|
+
const result = await runGenerator({
|
|
65
|
+
dryRun: args.dryRun !== false,
|
|
66
|
+
cwd,
|
|
67
|
+
generate,
|
|
68
|
+
});
|
|
69
|
+
return textResult(
|
|
70
|
+
result.dryRun
|
|
71
|
+
? { ...result, hint: "Re-run with dryRun:false to write." }
|
|
72
|
+
: result
|
|
73
|
+
);
|
|
74
|
+
} catch (e) {
|
|
75
|
+
return errorResult(e.message);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** A tool for a ddk:<type> contribution command handled by generateDdkContribution. */
|
|
80
|
+
function contributionTool(toolName, type, description, extra = {}) {
|
|
81
|
+
return {
|
|
82
|
+
name: toolName,
|
|
83
|
+
description,
|
|
84
|
+
inputSchema: {
|
|
85
|
+
type: "object",
|
|
86
|
+
properties: { ...common, ...extra },
|
|
87
|
+
required: ["name", "project", ...(extra.group ? ["group"] : [])],
|
|
88
|
+
},
|
|
89
|
+
handler: (args) =>
|
|
90
|
+
run(args, (codegenFs) =>
|
|
91
|
+
generateDdkContribution(codegenFs, {
|
|
92
|
+
type,
|
|
93
|
+
name: args.name,
|
|
94
|
+
project: args.project,
|
|
95
|
+
group: args.group,
|
|
96
|
+
descriptor: args.descriptor,
|
|
97
|
+
override: args.override,
|
|
98
|
+
rank: args.rank,
|
|
99
|
+
})
|
|
100
|
+
),
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const slot = (field, listedIn) => ({
|
|
105
|
+
descriptor: {
|
|
106
|
+
type: "string",
|
|
107
|
+
description: `${field}; shown only if the device NCUI descriptor lists it (${listedIn}). Default: from the name.`,
|
|
108
|
+
},
|
|
109
|
+
override,
|
|
110
|
+
rank,
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
function projectTool(name, kind, description) {
|
|
114
|
+
return {
|
|
115
|
+
name,
|
|
116
|
+
description,
|
|
117
|
+
inputSchema: {
|
|
118
|
+
type: "object",
|
|
119
|
+
properties: {
|
|
120
|
+
name: {
|
|
121
|
+
type: "string",
|
|
122
|
+
description: `${
|
|
123
|
+
kind === "plugin" ? "Plugin" : "Theme"
|
|
124
|
+
} project name in kebab-case.`,
|
|
125
|
+
},
|
|
126
|
+
dryRun,
|
|
127
|
+
...workspaceRootProperty,
|
|
128
|
+
},
|
|
129
|
+
required: ["name"],
|
|
130
|
+
},
|
|
131
|
+
handler: async (args) => {
|
|
132
|
+
try {
|
|
133
|
+
const dryRunMode = args.dryRun !== false;
|
|
134
|
+
const result = createDdkProject(kind, {
|
|
135
|
+
workspaceRoot: resolveWorkspaceRoot(args),
|
|
136
|
+
name: args.name,
|
|
137
|
+
dryRun: dryRunMode,
|
|
138
|
+
});
|
|
139
|
+
return textResult({ dryRun: dryRunMode, ...result });
|
|
140
|
+
} catch (e) {
|
|
141
|
+
return errorResult(e.message);
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export const ddkTools = [
|
|
148
|
+
projectTool(
|
|
149
|
+
"scaffold_ddk_plugin_project",
|
|
150
|
+
"plugin",
|
|
151
|
+
"Create a DDK plugin project: module federation serve target, DDK Storybook, .kos.json. dryRun lists the files."
|
|
152
|
+
),
|
|
153
|
+
projectTool(
|
|
154
|
+
"scaffold_ddk_theme_project",
|
|
155
|
+
"theme",
|
|
156
|
+
"Create a DDK theme project; its theme-overlay.css overrides the DDK tokens. dryRun lists the files."
|
|
157
|
+
),
|
|
158
|
+
contributionTool(
|
|
159
|
+
"add_utility",
|
|
160
|
+
"utility",
|
|
161
|
+
"Add a utility (utilities contribution) with its component, story and i18n title.",
|
|
162
|
+
slot("utilDescriptor", "kondra.ncui.utilities")
|
|
163
|
+
),
|
|
164
|
+
contributionTool(
|
|
165
|
+
"add_setup_step",
|
|
166
|
+
"setup",
|
|
167
|
+
"Add a setup step (setupStep contribution) with its component, story and i18n title.",
|
|
168
|
+
slot("setupDescriptor", "kondra.ncui.setup.steps")
|
|
169
|
+
),
|
|
170
|
+
contributionTool(
|
|
171
|
+
"add_nav_view",
|
|
172
|
+
"nav",
|
|
173
|
+
"Add a navigation view (navViews contribution) with its component, story and i18n title.",
|
|
174
|
+
slot(
|
|
175
|
+
"navDescriptor (dotted, e.g. settings.water)",
|
|
176
|
+
"kondra.ncui.navigations"
|
|
177
|
+
)
|
|
178
|
+
),
|
|
179
|
+
contributionTool(
|
|
180
|
+
"add_cui_config",
|
|
181
|
+
"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.",
|
|
188
|
+
{
|
|
189
|
+
group: {
|
|
190
|
+
type: "string",
|
|
191
|
+
description: "Settings group the setting belongs to, e.g. network.",
|
|
192
|
+
},
|
|
193
|
+
}
|
|
194
|
+
),
|
|
195
|
+
{
|
|
196
|
+
name: "add_dashboard_card",
|
|
197
|
+
description:
|
|
198
|
+
"Add a dashboard summary card and, by default, the detail it opens; both share dashboardKey and rank.",
|
|
199
|
+
inputSchema: {
|
|
200
|
+
type: "object",
|
|
201
|
+
properties: {
|
|
202
|
+
...common,
|
|
203
|
+
dashboardKey,
|
|
204
|
+
detail: {
|
|
205
|
+
type: "boolean",
|
|
206
|
+
description: "Also add the detail the card opens. Default true.",
|
|
207
|
+
},
|
|
208
|
+
override,
|
|
209
|
+
rank,
|
|
210
|
+
},
|
|
211
|
+
required: ["name", "project"],
|
|
212
|
+
},
|
|
213
|
+
handler: (args) =>
|
|
214
|
+
run(args, (codegenFs) =>
|
|
215
|
+
generateDashboardCard(codegenFs, {
|
|
216
|
+
name: args.name,
|
|
217
|
+
project: args.project,
|
|
218
|
+
dashboardKey: args.dashboardKey,
|
|
219
|
+
detail: args.detail !== false,
|
|
220
|
+
override: args.override,
|
|
221
|
+
rank: args.rank,
|
|
222
|
+
})
|
|
223
|
+
),
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
name: "add_pump_detail",
|
|
227
|
+
description:
|
|
228
|
+
"Add the pump detail shown in the holder modal for holders with dashboardKey.",
|
|
229
|
+
inputSchema: {
|
|
230
|
+
type: "object",
|
|
231
|
+
properties: { ...common, dashboardKey, override, rank },
|
|
232
|
+
required: ["name", "project"],
|
|
233
|
+
},
|
|
234
|
+
handler: (args) =>
|
|
235
|
+
run(args, (codegenFs) =>
|
|
236
|
+
generatePumpDetail(codegenFs, {
|
|
237
|
+
name: args.name,
|
|
238
|
+
project: args.project,
|
|
239
|
+
dashboardKey: args.dashboardKey,
|
|
240
|
+
override: args.override,
|
|
241
|
+
rank: args.rank,
|
|
242
|
+
})
|
|
243
|
+
),
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
name: "add_pump_card",
|
|
247
|
+
description:
|
|
248
|
+
"Add a pump card for a pump type: the holder card body and, by default, the pump detail; both share dashboardKey and rank.",
|
|
249
|
+
inputSchema: {
|
|
250
|
+
type: "object",
|
|
251
|
+
properties: {
|
|
252
|
+
...common,
|
|
253
|
+
dashboardKey: {
|
|
254
|
+
type: "string",
|
|
255
|
+
description:
|
|
256
|
+
"The pump type the backend assembly assigns (the holder's first pump), e.g. cgp. Taken from override when given.",
|
|
257
|
+
},
|
|
258
|
+
detail: {
|
|
259
|
+
type: "boolean",
|
|
260
|
+
description: "Also add the pump detail. Default true.",
|
|
261
|
+
},
|
|
262
|
+
override,
|
|
263
|
+
rank,
|
|
264
|
+
},
|
|
265
|
+
required: ["name", "project"],
|
|
266
|
+
},
|
|
267
|
+
handler: (args) =>
|
|
268
|
+
run(args, (codegenFs) =>
|
|
269
|
+
generatePumpCard(codegenFs, {
|
|
270
|
+
name: args.name,
|
|
271
|
+
project: args.project,
|
|
272
|
+
dashboardKey: args.dashboardKey,
|
|
273
|
+
detail: args.detail !== false,
|
|
274
|
+
override: args.override,
|
|
275
|
+
rank: args.rank,
|
|
276
|
+
})
|
|
277
|
+
),
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
name: "add_macro_summary",
|
|
281
|
+
description: "Add the macro holder card body for dashboardKey.",
|
|
282
|
+
inputSchema: {
|
|
283
|
+
type: "object",
|
|
284
|
+
properties: { ...common, dashboardKey, override, rank },
|
|
285
|
+
required: ["name", "project"],
|
|
286
|
+
},
|
|
287
|
+
handler: (args) =>
|
|
288
|
+
run(args, (codegenFs) =>
|
|
289
|
+
generateMacroSummary(codegenFs, {
|
|
290
|
+
name: args.name,
|
|
291
|
+
project: args.project,
|
|
292
|
+
dashboardKey: args.dashboardKey,
|
|
293
|
+
override: args.override,
|
|
294
|
+
rank: args.rank,
|
|
295
|
+
})
|
|
296
|
+
),
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
name: "add_trouble_action",
|
|
300
|
+
description:
|
|
301
|
+
"Add the experience shown while the device has an active trouble of troubleType.",
|
|
302
|
+
inputSchema: {
|
|
303
|
+
type: "object",
|
|
304
|
+
properties: {
|
|
305
|
+
...common,
|
|
306
|
+
troubleType: {
|
|
307
|
+
type: "string",
|
|
308
|
+
description:
|
|
309
|
+
"Exact trouble type the device raises. Taken from override when given.",
|
|
310
|
+
},
|
|
311
|
+
stateKey: {
|
|
312
|
+
type: "string",
|
|
313
|
+
description:
|
|
314
|
+
"Contributions sharing a stateKey share one experience. Default: troubleType.",
|
|
315
|
+
},
|
|
316
|
+
stateValue: {
|
|
317
|
+
type: "string",
|
|
318
|
+
description: "Default: troubleType.",
|
|
319
|
+
},
|
|
320
|
+
override,
|
|
321
|
+
rank,
|
|
322
|
+
},
|
|
323
|
+
required: ["name", "project"],
|
|
324
|
+
},
|
|
325
|
+
handler: (args) =>
|
|
326
|
+
run(args, (codegenFs) =>
|
|
327
|
+
generateTroubleAction(codegenFs, {
|
|
328
|
+
name: args.name,
|
|
329
|
+
project: args.project,
|
|
330
|
+
troubleType: args.troubleType,
|
|
331
|
+
stateKey: args.stateKey,
|
|
332
|
+
stateValue: args.stateValue,
|
|
333
|
+
override: args.override,
|
|
334
|
+
rank: args.rank,
|
|
335
|
+
})
|
|
336
|
+
),
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
name: "describe_ddk_plugin",
|
|
340
|
+
description:
|
|
341
|
+
"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.",
|
|
342
|
+
inputSchema: {
|
|
343
|
+
type: "object",
|
|
344
|
+
properties: { project, ...workspaceRootProperty },
|
|
345
|
+
required: ["project"],
|
|
346
|
+
},
|
|
347
|
+
handler: async (args) => {
|
|
348
|
+
try {
|
|
349
|
+
return textResult(
|
|
350
|
+
describePlugin(resolveWorkspaceRoot(args), args.project)
|
|
351
|
+
);
|
|
352
|
+
} catch (e) {
|
|
353
|
+
return errorResult(e.message);
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
name: "validate_ddk_plugin",
|
|
359
|
+
description:
|
|
360
|
+
"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.",
|
|
361
|
+
inputSchema: {
|
|
362
|
+
type: "object",
|
|
363
|
+
properties: { project, ...workspaceRootProperty },
|
|
364
|
+
required: ["project"],
|
|
365
|
+
},
|
|
366
|
+
handler: async (args) => {
|
|
367
|
+
try {
|
|
368
|
+
return textResult(
|
|
369
|
+
validatePlugin(resolveWorkspaceRoot(args), args.project)
|
|
370
|
+
);
|
|
371
|
+
} catch (e) {
|
|
372
|
+
return errorResult(e.message);
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
name: "find_ddk_capability",
|
|
378
|
+
description:
|
|
379
|
+
"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.",
|
|
380
|
+
inputSchema: {
|
|
381
|
+
type: "object",
|
|
382
|
+
properties: {
|
|
383
|
+
need: { type: "string", description: "What the plugin should do." },
|
|
384
|
+
},
|
|
385
|
+
required: ["need"],
|
|
386
|
+
},
|
|
387
|
+
handler: async (args) => {
|
|
388
|
+
try {
|
|
389
|
+
return textResult(findCapability(args.need));
|
|
390
|
+
} catch (e) {
|
|
391
|
+
return errorResult(e.message);
|
|
392
|
+
}
|
|
393
|
+
},
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
name: "list_ddk_components",
|
|
397
|
+
description:
|
|
398
|
+
"List the DDK components and styled parts plugins render, by name and source file.",
|
|
399
|
+
inputSchema: {
|
|
400
|
+
type: "object",
|
|
401
|
+
properties: {
|
|
402
|
+
library: {
|
|
403
|
+
type: "string",
|
|
404
|
+
enum: COMPONENT_LIBRARIES,
|
|
405
|
+
description: "Only this library.",
|
|
406
|
+
},
|
|
407
|
+
query: {
|
|
408
|
+
type: "string",
|
|
409
|
+
description:
|
|
410
|
+
"Words every match has in its name or path, e.g. dashboard card.",
|
|
411
|
+
},
|
|
412
|
+
},
|
|
413
|
+
},
|
|
414
|
+
handler: async (args) => {
|
|
415
|
+
try {
|
|
416
|
+
return textResult({ components: listComponents(args) });
|
|
417
|
+
} catch (e) {
|
|
418
|
+
return errorResult(e.message);
|
|
419
|
+
}
|
|
420
|
+
},
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
name: "describe_ddk_component",
|
|
424
|
+
description:
|
|
425
|
+
"One DDK component from its source: props, the components and hooks it uses, and each token it reads with its value per theme.",
|
|
426
|
+
inputSchema: {
|
|
427
|
+
type: "object",
|
|
428
|
+
properties: {
|
|
429
|
+
name: {
|
|
430
|
+
type: "string",
|
|
431
|
+
description: "Export name, e.g. HolderDashboardCard.",
|
|
432
|
+
},
|
|
433
|
+
library: {
|
|
434
|
+
type: "string",
|
|
435
|
+
enum: COMPONENT_LIBRARIES,
|
|
436
|
+
description: "Library, when both export the name.",
|
|
437
|
+
},
|
|
438
|
+
},
|
|
439
|
+
required: ["name"],
|
|
440
|
+
},
|
|
441
|
+
handler: async (args) => {
|
|
442
|
+
try {
|
|
443
|
+
const text = describeComponent(args.name, args.library);
|
|
444
|
+
return text
|
|
445
|
+
? { content: [{ type: "text", text }] }
|
|
446
|
+
: errorResult(
|
|
447
|
+
`No DDK component named ${args.name}; list_ddk_components lists them.`
|
|
448
|
+
);
|
|
449
|
+
} catch (e) {
|
|
450
|
+
return errorResult(e.message);
|
|
451
|
+
}
|
|
452
|
+
},
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
name: "list_ddk_contributions",
|
|
456
|
+
description:
|
|
457
|
+
"List the standard DDK contributions an override can replace, with each one's slot and rank.",
|
|
458
|
+
inputSchema: {
|
|
459
|
+
type: "object",
|
|
460
|
+
properties: {
|
|
461
|
+
point: {
|
|
462
|
+
type: "string",
|
|
463
|
+
enum: Object.keys(OVERRIDABLE_POINTS),
|
|
464
|
+
description: "Only this command's contributions.",
|
|
465
|
+
},
|
|
466
|
+
},
|
|
467
|
+
},
|
|
468
|
+
handler: async (args) => {
|
|
469
|
+
try {
|
|
470
|
+
return textResult({
|
|
471
|
+
contributions: listOverridableContributions(args.point || undefined),
|
|
472
|
+
});
|
|
473
|
+
} catch (e) {
|
|
474
|
+
return errorResult(e.message);
|
|
475
|
+
}
|
|
476
|
+
},
|
|
477
|
+
},
|
|
478
|
+
];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Note: The plugin project Storybook configuration requires that the Studio
|
|
3
|
+
* Simulator is running in order to retrieve model data...
|
|
4
|
+
*/
|
|
5
|
+
import { CUIStoryContainer } from "@kosdev-code/kos-ddk-story-containers";
|
|
6
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
7
|
+
import { <%= namePascalCase %> } from "./<%= nameDashCase %>";
|
|
8
|
+
|
|
9
|
+
const meta: Meta<typeof <%= namePascalCase %>> = {
|
|
10
|
+
args: {},
|
|
11
|
+
component: <%= namePascalCase %>,
|
|
12
|
+
decorators: [
|
|
13
|
+
(Story, context) => (
|
|
14
|
+
<CUIStoryContainer>
|
|
15
|
+
<Story args={{ ...context.args }} />
|
|
16
|
+
</CUIStoryContainer>
|
|
17
|
+
),
|
|
18
|
+
],
|
|
19
|
+
tags: ["!autodocs"],
|
|
20
|
+
title: "CUI/<%= namePascalCase %>",
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default meta;
|
|
24
|
+
|
|
25
|
+
type Story = StoryObj<typeof <%= namePascalCase %>>;
|
|
26
|
+
|
|
27
|
+
export const Default: Story = {
|
|
28
|
+
render: (props) => <<%= namePascalCase %> {...props} />,
|
|
29
|
+
};
|
|
30
|
+
|
|
@@ -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 onClick={onComplete}>
|
|
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,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Note: The plugin project Storybook configuration requires that the Studio
|
|
3
|
+
* Simulator is running in order to retrieve model data...
|
|
4
|
+
*/
|
|
5
|
+
import { DashboardDetailStoryContainer } from "@kosdev-code/kos-ddk-story-containers";
|
|
6
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
7
|
+
import { <%= namePascalCase %>Detail } from "./<%= nameDashCase %>";
|
|
8
|
+
|
|
9
|
+
const meta: Meta<typeof <%= namePascalCase %>Detail> = {
|
|
10
|
+
args: {},
|
|
11
|
+
component: <%= namePascalCase %>Detail,
|
|
12
|
+
decorators: [
|
|
13
|
+
(Story, context) => (
|
|
14
|
+
<DashboardDetailStoryContainer
|
|
15
|
+
dashboardKey="<%= dashboardKey %>"
|
|
16
|
+
title="<%= namePascalCase %>"
|
|
17
|
+
>
|
|
18
|
+
{(props) => <Story args={{ ...context.args, ...props }} />}
|
|
19
|
+
</DashboardDetailStoryContainer>
|
|
20
|
+
),
|
|
21
|
+
],
|
|
22
|
+
tags: ["!autodocs"],
|
|
23
|
+
title: "dashboard/<%= namePascalCase %>/Detail",
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default meta;
|
|
27
|
+
|
|
28
|
+
type Story = StoryObj<typeof <%= namePascalCase %>Detail>;
|
|
29
|
+
|
|
30
|
+
export const Default: Story = {
|
|
31
|
+
render: (props) => <<%= namePascalCase %>Detail {...props} />,
|
|
32
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
Content,
|
|
5
|
+
Footer,
|
|
6
|
+
LabelSmall,
|
|
7
|
+
} from '@kosdev-code/kos-ddk-components';
|
|
8
|
+
import type { AssemblyModel } from '@kosdev-code/kos-dispense-sdk';
|
|
9
|
+
import {
|
|
10
|
+
KosLog,
|
|
11
|
+
kosComponent,
|
|
12
|
+
useKosTranslation,
|
|
13
|
+
type IKosDataModel,
|
|
14
|
+
} from '@kosdev-code/kos-ui-sdk';
|
|
15
|
+
|
|
16
|
+
const log = KosLog.createLogger({ name: "<%= nameDashCase %>-detail" });
|
|
17
|
+
log.debug("<%= nameDashCase %> detail component loaded");
|
|
18
|
+
|
|
19
|
+
const <%= namePascalCase %>DetailContainer = styled.div`
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
height: 100%;
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
interface <%= namePascalCase %>DetailProps {
|
|
26
|
+
dashboardKey?: string;
|
|
27
|
+
assembly?: AssemblyModel;
|
|
28
|
+
/** The assembly's "<%= dashboardKey %>" model whose card was selected. */
|
|
29
|
+
cardModel?: IKosDataModel;
|
|
30
|
+
/** Closes the modal the host shows this detail in. */
|
|
31
|
+
onComplete?: () => void;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Detail for the "<%= dashboardKey %>" dashboard card, shown in the host's modal. */
|
|
35
|
+
export const <%= namePascalCase %>Detail: React.FunctionComponent<<%= namePascalCase %>DetailProps> =
|
|
36
|
+
kosComponent(({ cardModel, onComplete }) => {
|
|
37
|
+
const { t } = useKosTranslation('<%= appProject %>');
|
|
38
|
+
return (
|
|
39
|
+
<<%= namePascalCase %>DetailContainer>
|
|
40
|
+
<Content>
|
|
41
|
+
<LabelSmall>{cardModel?.id}</LabelSmall>
|
|
42
|
+
</Content>
|
|
43
|
+
<Footer>
|
|
44
|
+
<Button onClick={onComplete}>{t('close')}</Button>
|
|
45
|
+
</Footer>
|
|
46
|
+
</<%= namePascalCase %>DetailContainer>
|
|
47
|
+
);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
<%= namePascalCase %>Detail.displayName = "<%= namePascalCase %>Detail";
|
|
51
|
+
|
|
52
|
+
export default <%= namePascalCase %>Detail;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./<%= nameDashCase %>";
|
|
@@ -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...
|
|
4
|
+
*/
|
|
5
|
+
import { DashboardSummaryStoryContainer } from "@kosdev-code/kos-ddk-story-containers";
|
|
6
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
7
|
+
import { <%= namePascalCase %>Summary } from "./<%= nameDashCase %>";
|
|
8
|
+
|
|
9
|
+
const meta: Meta<typeof <%= namePascalCase %>Summary> = {
|
|
10
|
+
args: {},
|
|
11
|
+
component: <%= namePascalCase %>Summary,
|
|
12
|
+
decorators: [
|
|
13
|
+
(Story, context) => (
|
|
14
|
+
<DashboardSummaryStoryContainer
|
|
15
|
+
dashboardKey="<%= dashboardKey %>"
|
|
16
|
+
title="<%= namePascalCase %>"
|
|
17
|
+
>
|
|
18
|
+
{(props) => <Story args={{ ...context.args, ...props }} />}
|
|
19
|
+
</DashboardSummaryStoryContainer>
|
|
20
|
+
),
|
|
21
|
+
],
|
|
22
|
+
tags: ["!autodocs"],
|
|
23
|
+
title: "dashboard/<%= namePascalCase %>/Summary",
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default meta;
|
|
27
|
+
|
|
28
|
+
type Story = StoryObj<typeof <%= namePascalCase %>Summary>;
|
|
29
|
+
|
|
30
|
+
export const Default: Story = {
|
|
31
|
+
render: (props) => <<%= namePascalCase %>Summary {...props} />,
|
|
32
|
+
};
|