@kosdev-code/kos-ddk-cli 0.1.0-dev.50 → 0.1.0-dev.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -18
- package/agent-plugin/kos-ddk-tools/.claude-plugin/plugin.json +1 -1
- package/agent-plugin/kos-ddk-tools/catalog/contributions.json +0 -11
- package/agent-plugin/kos-ddk-tools/plugin.json +1 -1
- package/agent-plugin/kos-ddk-tools/reference/reference.json +108 -57
- package/agent-plugin/kos-ddk-tools/servers/kos-ddk.mjs +428 -427
- package/agent-plugin/kos-ddk-tools/skills/build-ddk-plugin/SKILL.md +9 -6
- package/agent-plugin/kos-ddk-tools/templates/cui/__nameDashCase__.stories.tsx__template__ +3 -1
- package/agent-plugin/kos-ddk-tools/templates/cui/__nameDashCase__.tsx__template__ +1 -1
- package/agent-plugin/kos-ddk-tools/templates/dashboard-detail/detail/__nameDashCase__.stories.tsx__template__ +3 -1
- package/agent-plugin/kos-ddk-tools/templates/dashboard-summary/summary/__nameDashCase__.stories.tsx__template__ +3 -1
- package/agent-plugin/kos-ddk-tools/templates/macro-summary/__nameDashCase__.stories.tsx__template__ +3 -1
- package/agent-plugin/kos-ddk-tools/templates/nav/__nameDashCase__.stories.tsx__template__ +3 -1
- package/agent-plugin/kos-ddk-tools/templates/plugin-project/.storybook/preview.tsx.template +37 -4
- package/agent-plugin/kos-ddk-tools/templates/pump-detail/__nameDashCase__.stories.tsx__template__ +3 -1
- package/agent-plugin/kos-ddk-tools/templates/pump-summary/__nameDashCase__.stories.tsx__template__ +3 -1
- package/agent-plugin/kos-ddk-tools/templates/setup/__nameDashCase__.stories.tsx__template__ +3 -1
- package/agent-plugin/kos-ddk-tools/templates/setup/__nameDashCase__.tsx__template__ +1 -1
- package/agent-plugin/kos-ddk-tools/templates/trouble-action/__nameDashCase__.stories.tsx__template__ +3 -1
- package/agent-plugin/kos-ddk-tools/templates/utility/__nameDashCase__.stories.tsx__template__ +3 -1
- package/agent-plugin/kos-ddk-tools/templates/utility/__nameDashCase__.tsx__template__ +2 -12
- package/catalog/contributions.json +0 -11
- package/guides/ddk-dev.md +2 -1
- package/guides/getting-started.md +126 -0
- package/guides/storybook.md +37 -2
- package/package.json +2 -2
- package/reference/reference.json +108 -57
- package/src/codegen/contribution.mjs +184 -14
- package/src/codegen/descriptor.mjs +210 -0
- package/src/codegen/ncui-descriptor.mjs +134 -0
- package/src/codegen/overrides.mjs +85 -1
- package/src/codegen/project.mjs +111 -13
- package/src/extension.mjs +10 -0
- package/src/generators/agent-install.mjs +3 -2
- package/src/generators/catalog.mjs +15 -4
- package/src/generators/contributions.mjs +41 -6
- package/src/generators/dashboard.mjs +12 -9
- package/src/generators/descriptor-entries.mjs +53 -0
- package/src/generators/descriptor-project.mjs +79 -0
- package/src/generators/dev.mjs +15 -5
- package/src/generators/plugin-project.mjs +36 -4
- package/src/generators/theme-project.mjs +14 -3
- package/src/handlers.mjs +9 -19
- package/src/mcp/plugin-inspect.mjs +35 -0
- package/src/mcp/reference.mjs +19 -3
- package/src/mcp/tools.mjs +118 -21
- package/templates/cui/__nameDashCase__.stories.tsx__template__ +3 -1
- package/templates/cui/__nameDashCase__.tsx__template__ +1 -1
- package/templates/dashboard-detail/detail/__nameDashCase__.stories.tsx__template__ +3 -1
- package/templates/dashboard-summary/summary/__nameDashCase__.stories.tsx__template__ +3 -1
- package/templates/macro-summary/__nameDashCase__.stories.tsx__template__ +3 -1
- package/templates/nav/__nameDashCase__.stories.tsx__template__ +3 -1
- package/templates/plugin-project/.storybook/preview.tsx.template +37 -4
- package/templates/pump-detail/__nameDashCase__.stories.tsx__template__ +3 -1
- package/templates/pump-summary/__nameDashCase__.stories.tsx__template__ +3 -1
- package/templates/setup/__nameDashCase__.stories.tsx__template__ +3 -1
- package/templates/setup/__nameDashCase__.tsx__template__ +1 -1
- package/templates/trouble-action/__nameDashCase__.stories.tsx__template__ +3 -1
- package/templates/utility/__nameDashCase__.stories.tsx__template__ +3 -1
- package/templates/utility/__nameDashCase__.tsx__template__ +2 -12
- package/agent-plugin/kos-ddk-tools/templates/setting/__nameDashCase__.stories.tsx__template__ +0 -30
- package/agent-plugin/kos-ddk-tools/templates/setting/__nameDashCase__.tsx__template__ +0 -27
- package/agent-plugin/kos-ddk-tools/templates/setting/index.ts__template__ +0 -1
- package/templates/setting/__nameDashCase__.stories.tsx__template__ +0 -30
- package/templates/setting/__nameDashCase__.tsx__template__ +0 -27
- package/templates/setting/index.ts__template__ +0 -1
|
@@ -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
|
};
|
|
@@ -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
|
};
|
|
@@ -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>
|
|
@@ -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
|
};
|
|
@@ -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>
|
package/agent-plugin/kos-ddk-tools/templates/setting/__nameDashCase__.stories.tsx__template__
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
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 { SettingStoryContainer } 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
|
-
<SettingStoryContainer>
|
|
15
|
-
<Story args={{ ...context.args }} />
|
|
16
|
-
</SettingStoryContainer>
|
|
17
|
-
),
|
|
18
|
-
],
|
|
19
|
-
tags: ["!autodocs"],
|
|
20
|
-
title: "setting/<%= 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
|
-
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import styled from '@emotion/styled';
|
|
2
|
-
import { type Experience } from '@kosdev-code/kos-ddk-components';
|
|
3
|
-
import {
|
|
4
|
-
KosLog,
|
|
5
|
-
kosComponent,
|
|
6
|
-
useKosTranslation,
|
|
7
|
-
} from '@kosdev-code/kos-ui-sdk';
|
|
8
|
-
|
|
9
|
-
const log = KosLog.createLogger({name: "<%= nameDashCase %>"})
|
|
10
|
-
log.debug("<%= nameDashCase %> component loaded");
|
|
11
|
-
|
|
12
|
-
const <%= namePascalCase %>Container = styled.div`
|
|
13
|
-
display: flex;
|
|
14
|
-
flex-direction: column;
|
|
15
|
-
width: 100%;
|
|
16
|
-
`;
|
|
17
|
-
|
|
18
|
-
export const <%= namePascalCase %>: Experience = kosComponent(({}) => {
|
|
19
|
-
const { t } = useKosTranslation('<%= appProject %>');
|
|
20
|
-
return (
|
|
21
|
-
<<%= namePascalCase %>Container>Hello from <%= namePascalCase %> Setting</<%= namePascalCase %>Container>
|
|
22
|
-
);
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
<%= namePascalCase %>.displayName = "<%= namePascalCase %>"
|
|
26
|
-
|
|
27
|
-
export default <%= namePascalCase %>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./<%= nameDashCase %>";
|
|
@@ -1,30 +0,0 @@
|
|
|
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 { SettingStoryContainer } 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
|
-
<SettingStoryContainer>
|
|
15
|
-
<Story args={{ ...context.args }} />
|
|
16
|
-
</SettingStoryContainer>
|
|
17
|
-
),
|
|
18
|
-
],
|
|
19
|
-
tags: ["!autodocs"],
|
|
20
|
-
title: "setting/<%= 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
|
-
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import styled from '@emotion/styled';
|
|
2
|
-
import { type Experience } from '@kosdev-code/kos-ddk-components';
|
|
3
|
-
import {
|
|
4
|
-
KosLog,
|
|
5
|
-
kosComponent,
|
|
6
|
-
useKosTranslation,
|
|
7
|
-
} from '@kosdev-code/kos-ui-sdk';
|
|
8
|
-
|
|
9
|
-
const log = KosLog.createLogger({name: "<%= nameDashCase %>"})
|
|
10
|
-
log.debug("<%= nameDashCase %> component loaded");
|
|
11
|
-
|
|
12
|
-
const <%= namePascalCase %>Container = styled.div`
|
|
13
|
-
display: flex;
|
|
14
|
-
flex-direction: column;
|
|
15
|
-
width: 100%;
|
|
16
|
-
`;
|
|
17
|
-
|
|
18
|
-
export const <%= namePascalCase %>: Experience = kosComponent(({}) => {
|
|
19
|
-
const { t } = useKosTranslation('<%= appProject %>');
|
|
20
|
-
return (
|
|
21
|
-
<<%= namePascalCase %>Container>Hello from <%= namePascalCase %> Setting</<%= namePascalCase %>Container>
|
|
22
|
-
);
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
<%= namePascalCase %>.displayName = "<%= namePascalCase %>"
|
|
26
|
-
|
|
27
|
-
export default <%= namePascalCase %>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./<%= nameDashCase %>";
|