@kosdev-code/kos-ddk-cli 0.1.0-dev.50 → 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 +54 -18
- package/agent-plugin/kos-ddk-tools/.claude-plugin/plugin.json +1 -1
- package/agent-plugin/kos-ddk-tools/catalog/contributions.json +0 -11
- package/agent-plugin/kos-ddk-tools/plugin.json +1 -1
- package/agent-plugin/kos-ddk-tools/reference/reference.json +108 -57
- package/agent-plugin/kos-ddk-tools/servers/kos-ddk.mjs +428 -427
- package/agent-plugin/kos-ddk-tools/skills/build-ddk-plugin/SKILL.md +9 -6
- package/agent-plugin/kos-ddk-tools/templates/cui/__nameDashCase__.stories.tsx__template__ +3 -1
- package/agent-plugin/kos-ddk-tools/templates/cui/__nameDashCase__.tsx__template__ +1 -1
- package/agent-plugin/kos-ddk-tools/templates/dashboard-detail/detail/__nameDashCase__.stories.tsx__template__ +3 -1
- package/agent-plugin/kos-ddk-tools/templates/dashboard-summary/summary/__nameDashCase__.stories.tsx__template__ +3 -1
- package/agent-plugin/kos-ddk-tools/templates/macro-summary/__nameDashCase__.stories.tsx__template__ +3 -1
- package/agent-plugin/kos-ddk-tools/templates/nav/__nameDashCase__.stories.tsx__template__ +3 -1
- package/agent-plugin/kos-ddk-tools/templates/plugin-project/.storybook/preview.tsx.template +37 -4
- package/agent-plugin/kos-ddk-tools/templates/pump-detail/__nameDashCase__.stories.tsx__template__ +3 -1
- package/agent-plugin/kos-ddk-tools/templates/pump-summary/__nameDashCase__.stories.tsx__template__ +3 -1
- package/agent-plugin/kos-ddk-tools/templates/setup/__nameDashCase__.stories.tsx__template__ +3 -1
- package/agent-plugin/kos-ddk-tools/templates/setup/__nameDashCase__.tsx__template__ +1 -1
- package/agent-plugin/kos-ddk-tools/templates/trouble-action/__nameDashCase__.stories.tsx__template__ +3 -1
- package/agent-plugin/kos-ddk-tools/templates/utility/__nameDashCase__.stories.tsx__template__ +3 -1
- package/agent-plugin/kos-ddk-tools/templates/utility/__nameDashCase__.tsx__template__ +2 -12
- package/catalog/contributions.json +0 -11
- package/guides/ddk-dev.md +2 -1
- package/guides/getting-started.md +117 -0
- package/guides/storybook.md +37 -2
- package/package.json +2 -2
- package/reference/reference.json +108 -57
- package/src/codegen/contribution.mjs +184 -14
- package/src/codegen/descriptor.mjs +210 -0
- package/src/codegen/ncui-descriptor.mjs +134 -0
- package/src/codegen/overrides.mjs +85 -1
- package/src/codegen/project.mjs +111 -13
- package/src/extension.mjs +10 -0
- package/src/generators/agent-install.mjs +3 -2
- package/src/generators/catalog.mjs +15 -4
- package/src/generators/contributions.mjs +41 -6
- package/src/generators/dashboard.mjs +12 -9
- package/src/generators/descriptor-entries.mjs +53 -0
- package/src/generators/descriptor-project.mjs +79 -0
- package/src/generators/dev.mjs +15 -5
- package/src/generators/plugin-project.mjs +36 -4
- package/src/generators/theme-project.mjs +14 -3
- package/src/handlers.mjs +9 -19
- package/src/mcp/plugin-inspect.mjs +35 -0
- package/src/mcp/reference.mjs +19 -3
- package/src/mcp/tools.mjs +118 -21
- package/templates/cui/__nameDashCase__.stories.tsx__template__ +3 -1
- package/templates/cui/__nameDashCase__.tsx__template__ +1 -1
- package/templates/dashboard-detail/detail/__nameDashCase__.stories.tsx__template__ +3 -1
- package/templates/dashboard-summary/summary/__nameDashCase__.stories.tsx__template__ +3 -1
- package/templates/macro-summary/__nameDashCase__.stories.tsx__template__ +3 -1
- package/templates/nav/__nameDashCase__.stories.tsx__template__ +3 -1
- package/templates/plugin-project/.storybook/preview.tsx.template +37 -4
- package/templates/pump-detail/__nameDashCase__.stories.tsx__template__ +3 -1
- package/templates/pump-summary/__nameDashCase__.stories.tsx__template__ +3 -1
- package/templates/setup/__nameDashCase__.stories.tsx__template__ +3 -1
- package/templates/setup/__nameDashCase__.tsx__template__ +1 -1
- package/templates/trouble-action/__nameDashCase__.stories.tsx__template__ +3 -1
- package/templates/utility/__nameDashCase__.stories.tsx__template__ +3 -1
- package/templates/utility/__nameDashCase__.tsx__template__ +2 -12
- package/agent-plugin/kos-ddk-tools/templates/setting/__nameDashCase__.stories.tsx__template__ +0 -30
- package/agent-plugin/kos-ddk-tools/templates/setting/__nameDashCase__.tsx__template__ +0 -27
- package/agent-plugin/kos-ddk-tools/templates/setting/index.ts__template__ +0 -1
- package/templates/setting/__nameDashCase__.stories.tsx__template__ +0 -30
- package/templates/setting/__nameDashCase__.tsx__template__ +0 -27
- package/templates/setting/index.ts__template__ +0 -1
|
@@ -5,7 +5,7 @@ description: >-
|
|
|
5
5
|
for a need, write the contribution with its tool (including overrides of standard
|
|
6
6
|
contributions), build its component from DDK components, develop it in Storybook or
|
|
7
7
|
against a running DDK, and validate it. Use when adding a utility, setup step, nav
|
|
8
|
-
view
|
|
8
|
+
view (including a Settings tab), CUI configuration, dashboard card, pump detail, macro summary or
|
|
9
9
|
trouble action to a DDK plugin, or replacing a standard one.
|
|
10
10
|
---
|
|
11
11
|
|
|
@@ -26,9 +26,8 @@ component content. Never hand-edit the contributions or experiences the tools wr
|
|
|
26
26
|
`dryRun: false`). Project names are dash-case.
|
|
27
27
|
|
|
28
28
|
3. **The extension point.** Read `ddk://extension-point/{id}`: its contribution fields,
|
|
29
|
-
the props your component receives and the standard contributions.
|
|
30
|
-
|
|
31
|
-
`add_setting`.
|
|
29
|
+
the props your component receives and the standard contributions. A Settings tab
|
|
30
|
+
is a navigation view: `add_nav_view` with a `settings.<name>` descriptor.
|
|
32
31
|
|
|
33
32
|
4. **Replacing a standard contribution.** `list_ddk_contributions` lists the ones an
|
|
34
33
|
override can replace. Pass the id as `override`: the tool takes its slot and gives
|
|
@@ -49,8 +48,12 @@ component content. Never hand-edit the contributions or experiences the tools wr
|
|
|
49
48
|
6. **The NCUI descriptor.** A utility, setup step or nav view appears only if the
|
|
50
49
|
device's NCUI descriptor lists its descriptor (`kondra.ncui` `utilities`,
|
|
51
50
|
`setup.steps`, `navigations`). An override reuses a slot the descriptor already
|
|
52
|
-
lists; a new slot
|
|
53
|
-
|
|
51
|
+
lists; a new slot goes in an NCUI descriptor project (a `ddk.ncui.descriptor` KAB
|
|
52
|
+
installed beside the DDK app, which replaces the system app's descriptor): create one
|
|
53
|
+
with `scaffold_ddk_descriptor_project` (layout `standard` or `compact`, and `carb`, `ice`,
|
|
54
|
+
`beveragePourTest` for the dispenser) if the workspace
|
|
55
|
+
has none, and pass `descriptorProject` to `add_utility`, `add_setup_step` or
|
|
56
|
+
`add_nav_view`. `ddk://guide/descriptor-project` lists each layout's entries and what each option adds.
|
|
54
57
|
|
|
55
58
|
7. **Build the component** with the `ddk-content-component` skill.
|
|
56
59
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Note: The plugin project Storybook configuration requires that the Studio
|
|
3
|
-
* Simulator is running in order to retrieve model data
|
|
3
|
+
* Simulator is running in order to retrieve model data, unless the story mocks
|
|
4
|
+
* it with parameters.kosMock (ddk://guide/storybook).
|
|
4
5
|
*/
|
|
5
6
|
import { CUIStoryContainer } from "@kosdev-code/kos-ddk-story-containers";
|
|
6
7
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
@@ -25,6 +26,7 @@ export default meta;
|
|
|
25
26
|
type Story = StoryObj<typeof <%= namePascalCase %>>;
|
|
26
27
|
|
|
27
28
|
export const Default: Story = {
|
|
29
|
+
// parameters: { kosMock: { setups: ["<setup module>"] } },
|
|
28
30
|
render: (props) => <<%= namePascalCase %> {...props} />,
|
|
29
31
|
};
|
|
30
32
|
|
|
@@ -23,7 +23,7 @@ const <%= namePascalCase %>Container = styled.div`
|
|
|
23
23
|
export const <%= namePascalCase %>: Experience = kosComponent(({ onComplete }) => {
|
|
24
24
|
const { t } = useKosTranslation('<%= appProject %>');
|
|
25
25
|
return (
|
|
26
|
-
<<%= namePascalCase %>Container
|
|
26
|
+
<<%= namePascalCase %>Container>
|
|
27
27
|
Hello from <%= namePascalCase %> CUI Configuration
|
|
28
28
|
<Footer>
|
|
29
29
|
<Button onClick={onComplete}>{t('proceed')}</Button>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Note: The plugin project Storybook configuration requires that the Studio
|
|
3
|
-
* Simulator is running in order to retrieve model data
|
|
3
|
+
* Simulator is running in order to retrieve model data, unless the story mocks
|
|
4
|
+
* it with parameters.kosMock (ddk://guide/storybook).
|
|
4
5
|
*/
|
|
5
6
|
import { DashboardDetailStoryContainer } from "@kosdev-code/kos-ddk-story-containers";
|
|
6
7
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
@@ -28,5 +29,6 @@ export default meta;
|
|
|
28
29
|
type Story = StoryObj<typeof <%= namePascalCase %>Detail>;
|
|
29
30
|
|
|
30
31
|
export const Default: Story = {
|
|
32
|
+
// parameters: { kosMock: { setups: ["<setup module>"] } },
|
|
31
33
|
render: (props) => <<%= namePascalCase %>Detail {...props} />,
|
|
32
34
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Note: The plugin project Storybook configuration requires that the Studio
|
|
3
|
-
* Simulator is running in order to retrieve model data
|
|
3
|
+
* Simulator is running in order to retrieve model data, unless the story mocks
|
|
4
|
+
* it with parameters.kosMock (ddk://guide/storybook).
|
|
4
5
|
*/
|
|
5
6
|
import { DashboardSummaryStoryContainer } from "@kosdev-code/kos-ddk-story-containers";
|
|
6
7
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
@@ -28,5 +29,6 @@ export default meta;
|
|
|
28
29
|
type Story = StoryObj<typeof <%= namePascalCase %>Summary>;
|
|
29
30
|
|
|
30
31
|
export const Default: Story = {
|
|
32
|
+
// parameters: { kosMock: { setups: ["<setup module>"] } },
|
|
31
33
|
render: (props) => <<%= namePascalCase %>Summary {...props} />,
|
|
32
34
|
};
|
package/agent-plugin/kos-ddk-tools/templates/macro-summary/__nameDashCase__.stories.tsx__template__
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Note: The plugin project Storybook configuration requires that the Studio
|
|
3
|
-
* Simulator is running in order to retrieve model data
|
|
3
|
+
* Simulator is running in order to retrieve model data, unless the story mocks
|
|
4
|
+
* it with parameters.kosMock (ddk://guide/storybook).
|
|
4
5
|
*/
|
|
5
6
|
import { MacroSummaryStoryContainer } from "@kosdev-code/kos-ddk-story-containers";
|
|
6
7
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
@@ -28,5 +29,6 @@ export default meta;
|
|
|
28
29
|
type Story = StoryObj<typeof <%= namePascalCase %>>;
|
|
29
30
|
|
|
30
31
|
export const Default: Story = {
|
|
32
|
+
// parameters: { kosMock: { setups: ["<setup module>"] } },
|
|
31
33
|
render: (props) => <<%= namePascalCase %> {...props} />,
|
|
32
34
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Note: The plugin project Storybook configuration requires that the Studio
|
|
3
|
-
* Simulator is running in order to retrieve model data
|
|
3
|
+
* Simulator is running in order to retrieve model data, unless the story mocks
|
|
4
|
+
* it with parameters.kosMock (ddk://guide/storybook).
|
|
4
5
|
*/
|
|
5
6
|
import { NavStoryContainer } from "@kosdev-code/kos-ddk-story-containers";
|
|
6
7
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
@@ -25,6 +26,7 @@ export default meta;
|
|
|
25
26
|
type Story = StoryObj<typeof <%= namePascalCase %>>;
|
|
26
27
|
|
|
27
28
|
export const Default: Story = {
|
|
29
|
+
// parameters: { kosMock: { setups: ["<setup module>"] } },
|
|
28
30
|
render: (props) => <<%= namePascalCase %> {...props} />,
|
|
29
31
|
};
|
|
30
32
|
|
|
@@ -5,6 +5,7 @@ import { getStyles } from "@kosdev-code/kos-ddk-styles";
|
|
|
5
5
|
import {
|
|
6
6
|
ErrorBoundaryWithFallback,
|
|
7
7
|
KosTranslationProvider,
|
|
8
|
+
ensureKosMockBoot,
|
|
8
9
|
LoadingMessage,
|
|
9
10
|
} from "@kosdev-code/kos-ui-sdk";
|
|
10
11
|
import { ElementType, Suspense } from "react";
|
|
@@ -29,15 +30,44 @@ export const globalTypes = {
|
|
|
29
30
|
},
|
|
30
31
|
};
|
|
31
32
|
|
|
33
|
+
// Translation files load over HTTP from the device KosCore connects to (KOS_HOST and
|
|
34
|
+
// KOS_PORT in .env), not from Storybook's own origin; ?host= on the URL still wins.
|
|
35
|
+
const translationRoot =
|
|
36
|
+
!new URLSearchParams(window.location.search).get("host") &&
|
|
37
|
+
process.env.KOS_PORT
|
|
38
|
+
? `${window.location.protocol}//${
|
|
39
|
+
process.env.KOS_HOST || window.location.hostname
|
|
40
|
+
}:${process.env.KOS_PORT}`
|
|
41
|
+
: undefined;
|
|
42
|
+
|
|
43
|
+
// The plugin's own namespaces load from its locale files: the device lists them only
|
|
44
|
+
// once its KAB is installed.
|
|
45
|
+
const pluginLocales = (import.meta as any).webpackContext(
|
|
46
|
+
"../src/assets/locales",
|
|
47
|
+
{ recursive: true, regExp: /\.json$/ }
|
|
48
|
+
);
|
|
49
|
+
const bundleResolver = async (namespace: string, locale: string) => {
|
|
50
|
+
const file = `./${locale}/${namespace}.json`;
|
|
51
|
+
if (!pluginLocales.keys().includes(file)) return { fallback: true as const };
|
|
52
|
+
const bundle = pluginLocales(file);
|
|
53
|
+
return bundle.default ?? bundle;
|
|
54
|
+
};
|
|
55
|
+
|
|
32
56
|
export const decorators = [
|
|
33
57
|
(Story: ElementType, context: Meta) => (
|
|
34
58
|
<MemoryRouter initialEntries={["/"]}>
|
|
35
|
-
<Global
|
|
59
|
+
<Global
|
|
60
|
+
styles={getStyles(
|
|
61
|
+
context.globals.mode === "compact" ? "compact" : "flex-eu"
|
|
62
|
+
)}
|
|
63
|
+
/>
|
|
36
64
|
<ErrorBoundaryWithFallback>
|
|
37
65
|
<Suspense fallback={<LoadingMessage />}>
|
|
38
66
|
<KosCoreContextProvider>
|
|
39
67
|
<KosTranslationProvider
|
|
40
68
|
appContext={["app/system", "app/kosdev.ddk"]}
|
|
69
|
+
bundleResolver={bundleResolver}
|
|
70
|
+
rootUrl={translationRoot}
|
|
41
71
|
locale="en"
|
|
42
72
|
>
|
|
43
73
|
<AssemblyProvider>
|
|
@@ -62,17 +92,20 @@ export const decorators = [
|
|
|
62
92
|
</ErrorBoundaryWithFallback>
|
|
63
93
|
</MemoryRouter>
|
|
64
94
|
),
|
|
95
|
+
// Outermost: reloads into a story's parameters.kosMock boot switches.
|
|
96
|
+
(Story: ElementType, context: Meta) =>
|
|
97
|
+
ensureKosMockBoot(context.parameters?.kosMock) ? null : <Story />,
|
|
65
98
|
];
|
|
66
99
|
|
|
67
100
|
const preview: Preview = {
|
|
68
101
|
parameters: {
|
|
69
102
|
backgrounds: {
|
|
70
|
-
|
|
71
|
-
{
|
|
103
|
+
options: {
|
|
104
|
+
dark: {
|
|
72
105
|
name: "dark",
|
|
73
106
|
value: "var(--ncui-generic-color-grey-70)",
|
|
74
107
|
},
|
|
75
|
-
|
|
108
|
+
},
|
|
76
109
|
},
|
|
77
110
|
},
|
|
78
111
|
};
|
package/agent-plugin/kos-ddk-tools/templates/pump-detail/__nameDashCase__.stories.tsx__template__
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Note: The plugin project Storybook configuration requires that the Studio
|
|
3
|
-
* Simulator is running in order to retrieve model data
|
|
3
|
+
* Simulator is running in order to retrieve model data, unless the story mocks
|
|
4
|
+
* it with parameters.kosMock (ddk://guide/storybook).
|
|
4
5
|
*/
|
|
5
6
|
import { PumpDetailStoryContainer } from "@kosdev-code/kos-ddk-story-containers";
|
|
6
7
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
@@ -28,5 +29,6 @@ export default meta;
|
|
|
28
29
|
type Story = StoryObj<typeof <%= namePascalCase %>>;
|
|
29
30
|
|
|
30
31
|
export const Default: Story = {
|
|
32
|
+
// parameters: { kosMock: { setups: ["<setup module>"] } },
|
|
31
33
|
render: (props) => <<%= namePascalCase %> {...props} />,
|
|
32
34
|
};
|
package/agent-plugin/kos-ddk-tools/templates/pump-summary/__nameDashCase__.stories.tsx__template__
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Note: The plugin project Storybook configuration requires that the Studio
|
|
3
|
-
* Simulator is running in order to retrieve model data
|
|
3
|
+
* Simulator is running in order to retrieve model data, unless the story mocks
|
|
4
|
+
* it with parameters.kosMock (ddk://guide/storybook).
|
|
4
5
|
*/
|
|
5
6
|
import { PumpSummaryStoryContainer } from "@kosdev-code/kos-ddk-story-containers";
|
|
6
7
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
@@ -28,5 +29,6 @@ export default meta;
|
|
|
28
29
|
type Story = StoryObj<typeof <%= namePascalCase %>Summary>;
|
|
29
30
|
|
|
30
31
|
export const Default: Story = {
|
|
32
|
+
// parameters: { kosMock: { setups: ["<setup module>"] } },
|
|
31
33
|
render: (props) => <<%= namePascalCase %>Summary {...props} />,
|
|
32
34
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Note: The plugin project Storybook configuration requires that the Studio
|
|
3
|
-
* Simulator is running in order to retrieve model data
|
|
3
|
+
* Simulator is running in order to retrieve model data, unless the story mocks
|
|
4
|
+
* it with parameters.kosMock (ddk://guide/storybook).
|
|
4
5
|
*/
|
|
5
6
|
import { SetupStepStoryContainer } from "@kosdev-code/kos-ddk-story-containers";
|
|
6
7
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
@@ -25,6 +26,7 @@ export default meta;
|
|
|
25
26
|
type Story = StoryObj<typeof <%= namePascalCase %>>;
|
|
26
27
|
|
|
27
28
|
export const Default: Story = {
|
|
29
|
+
// parameters: { kosMock: { setups: ["<setup module>"] } },
|
|
28
30
|
render: (props) => <<%= namePascalCase %> {...props} />,
|
|
29
31
|
};
|
|
30
32
|
|
|
@@ -20,7 +20,7 @@ const <%= namePascalCase %>Container = styled.div`
|
|
|
20
20
|
export const <%= namePascalCase %>: Experience = kosComponent(({ onComplete }) => {
|
|
21
21
|
const { t } = useKosTranslation('<%= appProject %>');
|
|
22
22
|
return (
|
|
23
|
-
<<%= namePascalCase %>Container
|
|
23
|
+
<<%= namePascalCase %>Container>
|
|
24
24
|
Hello from <%= namePascalCase %> Setup Step
|
|
25
25
|
<Footer>
|
|
26
26
|
<Button onClick={onComplete}>{t('proceed')}</Button>
|
package/agent-plugin/kos-ddk-tools/templates/trouble-action/__nameDashCase__.stories.tsx__template__
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Note: The plugin project Storybook configuration requires that the Studio
|
|
3
|
-
* Simulator is running in order to retrieve model data
|
|
3
|
+
* Simulator is running in order to retrieve model data, unless the story mocks
|
|
4
|
+
* it with parameters.kosMock (ddk://guide/storybook).
|
|
4
5
|
*/
|
|
5
6
|
import { TroubleActionStoryContainer } from "@kosdev-code/kos-ddk-story-containers";
|
|
6
7
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
@@ -25,5 +26,6 @@ export default meta;
|
|
|
25
26
|
type Story = StoryObj<typeof <%= namePascalCase %>>;
|
|
26
27
|
|
|
27
28
|
export const Default: Story = {
|
|
29
|
+
// parameters: { kosMock: { setups: ["<setup module>"] } },
|
|
28
30
|
render: (props) => <<%= namePascalCase %> {...props} />,
|
|
29
31
|
};
|
package/agent-plugin/kos-ddk-tools/templates/utility/__nameDashCase__.stories.tsx__template__
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Note: The plugin project Storybook configuration requires that the Studio
|
|
3
|
-
* Simulator is running in order to retrieve model data
|
|
3
|
+
* Simulator is running in order to retrieve model data, unless the story mocks
|
|
4
|
+
* it with parameters.kosMock (ddk://guide/storybook).
|
|
4
5
|
*/
|
|
5
6
|
import { UtilityStoryContainer } from "@kosdev-code/kos-ddk-story-containers";
|
|
6
7
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
@@ -25,6 +26,7 @@ export default meta;
|
|
|
25
26
|
type Story = StoryObj<typeof <%= namePascalCase %>>;
|
|
26
27
|
|
|
27
28
|
export const Default: Story = {
|
|
29
|
+
// parameters: { kosMock: { setups: ["<setup module>"] } },
|
|
28
30
|
render: (props) => <<%= namePascalCase %> {...props} />,
|
|
29
31
|
};
|
|
30
32
|
|
|
@@ -15,25 +15,15 @@ log.debug("<%= nameDashCase %> component loaded");
|
|
|
15
15
|
|
|
16
16
|
const <%= namePascalCase %>Container = styled.div`
|
|
17
17
|
align-items: center;
|
|
18
|
-
background-color: white;
|
|
19
|
-
bottom: 0;
|
|
20
18
|
display: flex;
|
|
21
19
|
flex-direction: column;
|
|
22
|
-
|
|
23
|
-
height: 100vh;
|
|
24
|
-
justify-content: center;
|
|
25
|
-
left: 0;
|
|
26
|
-
position: fixed;
|
|
27
|
-
right: 0;
|
|
28
|
-
top: 0;
|
|
29
|
-
width: 100vw;
|
|
30
|
-
z-index: 999;
|
|
20
|
+
width: 100%;
|
|
31
21
|
`;
|
|
32
22
|
|
|
33
23
|
export const <%= namePascalCase %>: Experience = kosComponent(({ onComplete }) => {
|
|
34
24
|
const { t } = useKosTranslation('<%= appProject %>');
|
|
35
25
|
return (
|
|
36
|
-
<<%= namePascalCase %>Container
|
|
26
|
+
<<%= namePascalCase %>Container>
|
|
37
27
|
Hello from <%= namePascalCase %> Utility
|
|
38
28
|
<Footer>
|
|
39
29
|
<Button onClick={onComplete}>{t('proceed')}</Button>
|
|
@@ -37,17 +37,6 @@
|
|
|
37
37
|
"setupDescriptor": "carbTank"
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
|
-
{
|
|
41
|
-
"point": "setup",
|
|
42
|
-
"contributionKey": "setupStep",
|
|
43
|
-
"plugin": "kos-ddk-standard-plugin",
|
|
44
|
-
"id": "kos-ddk-standard-plugin.cgpNS.setup",
|
|
45
|
-
"title": "setup.title",
|
|
46
|
-
"namespace": "nutritive-sweetener",
|
|
47
|
-
"keys": {
|
|
48
|
-
"setupDescriptor": "cgpNS"
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
40
|
{
|
|
52
41
|
"point": "nav",
|
|
53
42
|
"contributionKey": "navViews",
|
package/guides/ddk-dev.md
CHANGED
|
@@ -36,7 +36,8 @@ standard contribution only when the device's DDK resolves its slots by rank.
|
|
|
36
36
|
## The URL it prints
|
|
37
37
|
|
|
38
38
|
`--device` is the URL of the DDK UI on the device or simulator, either its origin or the
|
|
39
|
-
page itself
|
|
39
|
+
page itself. Given the origin, the printed URL opens the NCUI page,
|
|
40
|
+
`/app/kosdev.ddk/ncui/index.html`, which is where devices and the simulator serve it. The
|
|
40
41
|
printed URL adds `?pluginDevServers=` with one `http://<address>:<port>` per plugin, from
|
|
41
42
|
the `port` of its `serve` target. The address is `localhost` when the device is local and
|
|
42
43
|
the machine's LAN IPv4 address otherwise, so a device on the network can reach the dev
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
---
|
|
2
|
+
uri: ddk://guide/getting-started
|
|
3
|
+
name: ddk-guide-getting-started
|
|
4
|
+
title: Getting started with the DDK CLI
|
|
5
|
+
description: Installing kos-ddk-cli in a workspace or globally, checking kosui loads it, working from a repo root, and installing the kos-ddk agent plugin and MCP server.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Getting started with the DDK CLI
|
|
9
|
+
|
|
10
|
+
`@kosdev-code/kos-ddk-cli` is a `kosui` extension: it adds the `ddk:*` commands to the
|
|
11
|
+
`kosui` CLI and ships the `kos-ddk-tools` agent plugin. It has no CLI of its own.
|
|
12
|
+
|
|
13
|
+
## 1. kosui
|
|
14
|
+
|
|
15
|
+
`kosui` (`@kosdev-code/kos-ui-cli`) is installed globally, at 3.0.31 or later.
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
npm install -g @kosdev-code/kos-ui-cli
|
|
19
|
+
kosui cli:update
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## 2. Install the extension
|
|
23
|
+
|
|
24
|
+
Either in the workspace, which pins the version with the project:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
cd <repo>/ui
|
|
28
|
+
npm install -D @kosdev-code/kos-ddk-cli
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
or globally, beside `kosui`, which adds the commands in every workspace:
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
npm install -g @kosdev-code/kos-ddk-cli
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
`kosui` looks in the workspace's `package.json` dependencies first, then beside its own
|
|
38
|
+
global install. When both have it, the workspace copy is used.
|
|
39
|
+
|
|
40
|
+
`latest` is the released version. `@dev` is the build of the DDK's `main` branch, published
|
|
41
|
+
on every push:
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
npm install -D @kosdev-code/kos-ddk-cli@dev
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## 3. Check kosui loads it
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
kosui extensions
|
|
51
|
+
kosui help
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`kosui extensions` names the package, its version, where it came from (`[workspace]` or
|
|
55
|
+
`[global]`), its status and the commands it adds. `kosui help` lists them under `ddk:`.
|
|
56
|
+
|
|
57
|
+
A workspace can turn it off in its `.kos.json`:
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{ "cli": { "disabledExtensions": ["@kosdev-code/kos-ddk-cli"] } }
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## 4. Repo root or ui workspace
|
|
64
|
+
|
|
65
|
+
Every command and the MCP server work from the ui workspace (the directory with
|
|
66
|
+
`nx.json`) and from a polyglot repo root: when the repo root's `.kos.json` (written by
|
|
67
|
+
`kosui repo`) names a ui workspace in `workspaces.ui`, `kosui` and the server use that
|
|
68
|
+
workspace. An agent started at the repo root, to work across the backend and the UI,
|
|
69
|
+
gets the same commands and tools.
|
|
70
|
+
|
|
71
|
+
## 5. Agent plugin and MCP server
|
|
72
|
+
|
|
73
|
+
```sh
|
|
74
|
+
kosui ddk:agent-install --client claude --scope user
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
This registers the package's `kos-ddk-tools` plugin with the agent client and installs
|
|
78
|
+
it; the plugin runs the `kos-ddk` MCP server. `--scope user` installs it for every repo,
|
|
79
|
+
`--scope repo` for the current checkout only. Without `--client` it detects the client.
|
|
80
|
+
|
|
81
|
+
The server is one self-contained file inside the package, so it does not depend on the
|
|
82
|
+
workspace's `node_modules`. It is registered from wherever the package is installed, in
|
|
83
|
+
the workspace or globally.
|
|
84
|
+
|
|
85
|
+
Run `ddk:agent-install` again after upgrading or reinstalling the package: the client
|
|
86
|
+
keeps its copy of the plugin until the registration is refreshed.
|
|
87
|
+
|
|
88
|
+
## 6. Next
|
|
89
|
+
|
|
90
|
+
- `kosui ddk:plugin-project --name my-plugin` creates a DDK plugin project under
|
|
91
|
+
`plugins/` (`--directory` changes the folder). It tests against the `kosdev.ddk`
|
|
92
|
+
plugin context and registers with the workspace host serving that context, or with
|
|
93
|
+
`--host`; a workspace without a DDK host registers it with none. The contribution
|
|
94
|
+
commands in the README add to it.
|
|
95
|
+
- `kosui ddk:descriptor-project --name my-ncui --layout standard --ice true` (or `compact`) creates the
|
|
96
|
+
NCUI descriptor project a new utility, setup step or navigation view is listed in;
|
|
97
|
+
pass `--descriptorProject my-ncui` to `ddk:utility`, `ddk:setup` and `ddk:nav`. `ddk://guide/descriptor-project` lists what each layout and option writes.
|
|
98
|
+
- `ddk://guide/storybook` for developing contributions in Storybook.
|
|
99
|
+
- `ddk://guide/ddk-dev` for loading plugins into a running DDK.
|
|
100
|
+
|
|
101
|
+
## Upgrading
|
|
102
|
+
|
|
103
|
+
```sh
|
|
104
|
+
kosui cli:update # kosui
|
|
105
|
+
npm install -D @kosdev-code/kos-ddk-cli@latest # workspace install
|
|
106
|
+
npm install -g @kosdev-code/kos-ddk-cli@latest # global install
|
|
107
|
+
kosui ddk:agent-install --client claude --scope user
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## When the ddk commands are missing
|
|
111
|
+
|
|
112
|
+
- `kosui extensions` does not list the package: it is in neither the workspace's
|
|
113
|
+
`package.json` nor the global install beside the `kosui` on your `PATH`
|
|
114
|
+
(`npm ls -g @kosdev-code/kos-ddk-cli`).
|
|
115
|
+
- It is listed as `incompatible`: `kosui` is older than the extension needs; update it.
|
|
116
|
+
- It is listed as `disabled`: the workspace `.kos.json` names it in
|
|
117
|
+
`cli.disabledExtensions`.
|
package/guides/storybook.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
uri: ddk://guide/storybook
|
|
3
3
|
name: ddk-guide-storybook
|
|
4
4
|
title: Developing DDK contributions in Storybook
|
|
5
|
-
description: Running a plugin's Storybook against a simulator, where model data comes from, the story container per contribution command, render modes and overrides.
|
|
5
|
+
description: Running a plugin's Storybook against a simulator or with KosMock story mocks, where model data comes from, the story container per contribution command, render modes and overrides.
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Developing DDK contributions in Storybook
|
|
@@ -32,10 +32,46 @@ first of:
|
|
|
32
32
|
`KOS_PORT=8081`, the simulator's default);
|
|
33
33
|
3. the page's own origin.
|
|
34
34
|
|
|
35
|
+
Translations come from the same device: the DDK's namespaces (`app/system`,
|
|
36
|
+
`app/kosdev.ddk`) from its files, and the plugin's own namespace from the plugin's
|
|
37
|
+
`src/assets/locales`, since the device lists it only once the KAB is installed. Each
|
|
38
|
+
contribution command adds its title key, and the keys its component calls, to
|
|
39
|
+
`src/assets/locales/en/<plugin>.json`.
|
|
40
|
+
|
|
35
41
|
Start the simulator before Storybook. A story shows what the simulator has: a dashboard card
|
|
36
42
|
needs an active model at its `dashboardKey`, a trouble action needs an active trouble of its
|
|
37
43
|
`troubleType`.
|
|
38
44
|
|
|
45
|
+
## Mocking what the simulator lacks
|
|
46
|
+
|
|
47
|
+
A story can bring its own data with KosMock, the SDK's transport-level mocks
|
|
48
|
+
(`kos://guide/mocking`), instead of waiting for the simulator to reach a state: an active
|
|
49
|
+
trouble, setup mode, a descriptor entry. It names the mocks as `parameters.kosMock`, and
|
|
50
|
+
the preview's outermost decorator reloads the page into those boot switches
|
|
51
|
+
(`ensureKosMockBoot`):
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
export const ActiveTrouble: Story = {
|
|
55
|
+
parameters: { kosMock: { setups: ["daily-cleaning-trouble"] } },
|
|
56
|
+
};
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
`kosMock` takes `setups` (setup modules in `fixtures/setups/`), `fixture` (a recorded
|
|
60
|
+
fixture), `mode` and `fixtureServer`:
|
|
61
|
+
|
|
62
|
+
- `mode: "on"` (the default) mocks only the named endpoints over the running simulator.
|
|
63
|
+
- `mode: "standalone"` boots with no device at all; every endpoint the story reads must
|
|
64
|
+
be mocked.
|
|
65
|
+
|
|
66
|
+
Serve the fixtures beside Storybook:
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
kosui fixtures serve
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
A story without `kosMock` reloads without switches, so mocks never carry over between
|
|
73
|
+
stories. Every generated story has a commented `kosMock` line to start from.
|
|
74
|
+
|
|
39
75
|
## Story containers
|
|
40
76
|
|
|
41
77
|
Each story renders the component inside the container for its extension point, from
|
|
@@ -46,7 +82,6 @@ Each story renders the component inside the container for its extension point, f
|
|
|
46
82
|
| `ddk:utility` | `UtilityStoryContainer` | the utility frame |
|
|
47
83
|
| `ddk:setup` | `SetupStepStoryContainer` | the setup step frame |
|
|
48
84
|
| `ddk:nav` | `NavStoryContainer` | the navigation view frame |
|
|
49
|
-
| `ddk:setting` | `SettingStoryContainer` | the setting frame |
|
|
50
85
|
| `ddk:cui` | `CUIStoryContainer` | the CUI frame |
|
|
51
86
|
| `ddk:dashboard-card` | `DashboardSummaryStoryContainer`, `DashboardDetailStoryContainer` | `dashboardKey`, `assembly`, `cardModel`, `onComplete` |
|
|
52
87
|
| `ddk:pump-detail` | `PumpDetailStoryContainer` | the first `holder` with the `dashboardKey` |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kosdev-code/kos-ddk-cli",
|
|
3
|
-
"version": "0.1.0-dev.
|
|
3
|
+
"version": "0.1.0-dev.55",
|
|
4
4
|
"description": "DDK commands for kosui: plugin projects and DDK extension-point contributions.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"kosui": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"kos": {
|
|
29
29
|
"build": {
|
|
30
|
-
"gitHash": "
|
|
30
|
+
"gitHash": "b6d50c39315256472036af8298ad14e9a58022d1"
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
"publishConfig": {
|