@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.
Files changed (116) hide show
  1. package/README.md +129 -2
  2. package/agent-plugin/.claude-plugin/marketplace.json +13 -0
  3. package/agent-plugin/kos-ddk-tools/.claude-plugin/plugin.json +8 -0
  4. package/agent-plugin/kos-ddk-tools/.mcp.json +11 -0
  5. package/agent-plugin/kos-ddk-tools/agents/kos-ddk-plugin-planner.md +40 -0
  6. package/agent-plugin/kos-ddk-tools/agents/kos-ddk-plugin-reviewer.md +33 -0
  7. package/agent-plugin/kos-ddk-tools/catalog/contributions.json +888 -0
  8. package/agent-plugin/kos-ddk-tools/mcp.json +12 -0
  9. package/agent-plugin/kos-ddk-tools/plugin.json +7 -0
  10. package/agent-plugin/kos-ddk-tools/reference/reference.json +19288 -0
  11. package/agent-plugin/kos-ddk-tools/servers/kos-ddk.mjs +48632 -0
  12. package/agent-plugin/kos-ddk-tools/skills/build-ddk-plugin/SKILL.md +71 -0
  13. package/agent-plugin/kos-ddk-tools/skills/ddk-content-component/SKILL.md +49 -0
  14. package/agent-plugin/kos-ddk-tools/skills/ddk-storybook/SKILL.md +39 -0
  15. package/agent-plugin/kos-ddk-tools/templates/cui/__nameDashCase__.stories.tsx__template__ +30 -0
  16. package/agent-plugin/kos-ddk-tools/templates/cui/__nameDashCase__.tsx__template__ +35 -0
  17. package/agent-plugin/kos-ddk-tools/templates/cui/index.ts__template__ +1 -0
  18. package/agent-plugin/kos-ddk-tools/templates/dashboard-detail/detail/__nameDashCase__.stories.tsx__template__ +32 -0
  19. package/agent-plugin/kos-ddk-tools/templates/dashboard-detail/detail/__nameDashCase__.tsx__template__ +52 -0
  20. package/agent-plugin/kos-ddk-tools/templates/dashboard-detail/detail/index.ts__template__ +1 -0
  21. package/agent-plugin/kos-ddk-tools/templates/dashboard-summary/summary/__nameDashCase__.stories.tsx__template__ +32 -0
  22. package/agent-plugin/kos-ddk-tools/templates/dashboard-summary/summary/__nameDashCase__.tsx__template__ +41 -0
  23. package/agent-plugin/kos-ddk-tools/templates/dashboard-summary/summary/index.ts__template__ +1 -0
  24. package/agent-plugin/kos-ddk-tools/templates/macro-summary/__nameDashCase__.stories.tsx__template__ +32 -0
  25. package/agent-plugin/kos-ddk-tools/templates/macro-summary/__nameDashCase__.tsx__template__ +24 -0
  26. package/agent-plugin/kos-ddk-tools/templates/macro-summary/index.ts__template__ +1 -0
  27. package/agent-plugin/kos-ddk-tools/templates/nav/__nameDashCase__.stories.tsx__template__ +30 -0
  28. package/agent-plugin/kos-ddk-tools/templates/nav/__nameDashCase__.tsx__template__ +27 -0
  29. package/agent-plugin/kos-ddk-tools/templates/nav/index.ts__template__ +1 -0
  30. package/agent-plugin/kos-ddk-tools/templates/plugin-project/.storybook/preview.tsx.template +80 -0
  31. package/agent-plugin/kos-ddk-tools/templates/plugin-project/.storybook/registration.ts.template +6 -0
  32. package/agent-plugin/kos-ddk-tools/templates/pump-detail/__nameDashCase__.stories.tsx__template__ +32 -0
  33. package/agent-plugin/kos-ddk-tools/templates/pump-detail/__nameDashCase__.tsx__template__ +38 -0
  34. package/agent-plugin/kos-ddk-tools/templates/pump-detail/index.ts__template__ +1 -0
  35. package/agent-plugin/kos-ddk-tools/templates/pump-summary/__nameDashCase__.stories.tsx__template__ +32 -0
  36. package/agent-plugin/kos-ddk-tools/templates/pump-summary/__nameDashCase__.tsx__template__ +25 -0
  37. package/agent-plugin/kos-ddk-tools/templates/pump-summary/index.ts__template__ +1 -0
  38. package/agent-plugin/kos-ddk-tools/templates/setting/__nameDashCase__.stories.tsx__template__ +30 -0
  39. package/agent-plugin/kos-ddk-tools/templates/setting/__nameDashCase__.tsx__template__ +27 -0
  40. package/agent-plugin/kos-ddk-tools/templates/setting/index.ts__template__ +1 -0
  41. package/agent-plugin/kos-ddk-tools/templates/setup/__nameDashCase__.stories.tsx__template__ +30 -0
  42. package/agent-plugin/kos-ddk-tools/templates/setup/__nameDashCase__.tsx__template__ +33 -0
  43. package/agent-plugin/kos-ddk-tools/templates/setup/index.ts__template__ +1 -0
  44. package/agent-plugin/kos-ddk-tools/templates/theme-project/theme/assets/component.css.template +2 -0
  45. package/agent-plugin/kos-ddk-tools/templates/theme-project/theme/assets/generic.css.template +2 -0
  46. package/agent-plugin/kos-ddk-tools/templates/theme-project/theme/assets/semantic.css.template +2 -0
  47. package/agent-plugin/kos-ddk-tools/templates/theme-project/theme/assets/theme-overlay.css.template +7 -0
  48. package/agent-plugin/kos-ddk-tools/templates/trouble-action/__nameDashCase__.stories.tsx__template__ +29 -0
  49. package/agent-plugin/kos-ddk-tools/templates/trouble-action/__nameDashCase__.tsx__template__ +57 -0
  50. package/agent-plugin/kos-ddk-tools/templates/trouble-action/index.ts__template__ +1 -0
  51. package/agent-plugin/kos-ddk-tools/templates/utility/__nameDashCase__.stories.tsx__template__ +30 -0
  52. package/agent-plugin/kos-ddk-tools/templates/utility/__nameDashCase__.tsx__template__ +47 -0
  53. package/agent-plugin/kos-ddk-tools/templates/utility/index.ts__template__ +1 -0
  54. package/catalog/contributions.json +888 -0
  55. package/guides/ddk-dev.md +46 -0
  56. package/guides/storybook.md +69 -0
  57. package/package.json +33 -3
  58. package/reference/reference.json +19288 -0
  59. package/src/build-paths.mjs +20 -0
  60. package/src/codegen/contribution.mjs +255 -0
  61. package/src/codegen/overrides.mjs +179 -0
  62. package/src/codegen/project.mjs +144 -0
  63. package/src/extension.mjs +22 -0
  64. package/src/generators/agent-install.mjs +79 -0
  65. package/src/generators/catalog.mjs +70 -0
  66. package/src/generators/contributions.mjs +116 -0
  67. package/src/generators/dashboard.mjs +238 -0
  68. package/src/generators/dev.mjs +221 -0
  69. package/src/generators/override-prompts.mjs +27 -0
  70. package/src/generators/plugin-project.mjs +34 -0
  71. package/src/generators/theme-project.mjs +34 -0
  72. package/src/handlers.mjs +325 -0
  73. package/src/mcp/pkg-info.mjs +7 -0
  74. package/src/mcp/plugin-inspect.mjs +257 -0
  75. package/src/mcp/reference.mjs +248 -0
  76. package/src/mcp/server.mjs +12 -0
  77. package/src/mcp/tools.mjs +478 -0
  78. package/templates/cui/__nameDashCase__.stories.tsx__template__ +30 -0
  79. package/templates/cui/__nameDashCase__.tsx__template__ +35 -0
  80. package/templates/cui/index.ts__template__ +1 -0
  81. package/templates/dashboard-detail/detail/__nameDashCase__.stories.tsx__template__ +32 -0
  82. package/templates/dashboard-detail/detail/__nameDashCase__.tsx__template__ +52 -0
  83. package/templates/dashboard-detail/detail/index.ts__template__ +1 -0
  84. package/templates/dashboard-summary/summary/__nameDashCase__.stories.tsx__template__ +32 -0
  85. package/templates/dashboard-summary/summary/__nameDashCase__.tsx__template__ +41 -0
  86. package/templates/dashboard-summary/summary/index.ts__template__ +1 -0
  87. package/templates/macro-summary/__nameDashCase__.stories.tsx__template__ +32 -0
  88. package/templates/macro-summary/__nameDashCase__.tsx__template__ +24 -0
  89. package/templates/macro-summary/index.ts__template__ +1 -0
  90. package/templates/nav/__nameDashCase__.stories.tsx__template__ +30 -0
  91. package/templates/nav/__nameDashCase__.tsx__template__ +27 -0
  92. package/templates/nav/index.ts__template__ +1 -0
  93. package/templates/plugin-project/.storybook/preview.tsx.template +80 -0
  94. package/templates/plugin-project/.storybook/registration.ts.template +6 -0
  95. package/templates/pump-detail/__nameDashCase__.stories.tsx__template__ +32 -0
  96. package/templates/pump-detail/__nameDashCase__.tsx__template__ +38 -0
  97. package/templates/pump-detail/index.ts__template__ +1 -0
  98. package/templates/pump-summary/__nameDashCase__.stories.tsx__template__ +32 -0
  99. package/templates/pump-summary/__nameDashCase__.tsx__template__ +25 -0
  100. package/templates/pump-summary/index.ts__template__ +1 -0
  101. package/templates/setting/__nameDashCase__.stories.tsx__template__ +30 -0
  102. package/templates/setting/__nameDashCase__.tsx__template__ +27 -0
  103. package/templates/setting/index.ts__template__ +1 -0
  104. package/templates/setup/__nameDashCase__.stories.tsx__template__ +30 -0
  105. package/templates/setup/__nameDashCase__.tsx__template__ +33 -0
  106. package/templates/setup/index.ts__template__ +1 -0
  107. package/templates/theme-project/theme/assets/component.css.template +2 -0
  108. package/templates/theme-project/theme/assets/generic.css.template +2 -0
  109. package/templates/theme-project/theme/assets/semantic.css.template +2 -0
  110. package/templates/theme-project/theme/assets/theme-overlay.css.template +7 -0
  111. package/templates/trouble-action/__nameDashCase__.stories.tsx__template__ +29 -0
  112. package/templates/trouble-action/__nameDashCase__.tsx__template__ +57 -0
  113. package/templates/trouble-action/index.ts__template__ +1 -0
  114. package/templates/utility/__nameDashCase__.stories.tsx__template__ +30 -0
  115. package/templates/utility/__nameDashCase__.tsx__template__ +47 -0
  116. package/templates/utility/index.ts__template__ +1 -0
package/README.md CHANGED
@@ -1,3 +1,130 @@
1
- # Temporary Holding Version
1
+ # @kosdev-code/kos-ddk-cli
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ DDK commands for `kosui`. Installing this package in a KOS workspace adds the
4
+ `ddk:*` commands to the CLI; it is not a standalone CLI.
5
+
6
+ ```sh
7
+ npm install -D @kosdev-code/kos-ddk-cli
8
+ kosui extensions
9
+ ```
10
+
11
+ `kosui extensions` lists the extension and the commands it adds.
12
+
13
+ ## Commands
14
+
15
+ | Command | Writes |
16
+ | -------------------- | ----------------------------------------------------------------- |
17
+ | `ddk:utility` | a utility (`utilities` contribution, `utilDescriptor`) |
18
+ | `ddk:setup` | a setup step (`setupStep` contribution, `setupDescriptor`) |
19
+ | `ddk:dashboard-card` | a dashboard summary card and its detail, sharing `--dashboardKey` |
20
+ | `ddk:pump-detail` | a pump detail for holders with `--dashboardKey` |
21
+ | `ddk:pump-card` | a pump card body and its pump detail, sharing `--dashboardKey` |
22
+ | `ddk:macro-summary` | a macro holder card body for `--dashboardKey` |
23
+ | `ddk:trouble-action` | the experience shown while a `--troubleType` trouble is active |
24
+ | `ddk:cui` | a CUI configuration (`cui` contribution) |
25
+ | `ddk:nav` | a navigation view (`navViews` contribution, `navDescriptor`) |
26
+ | `ddk:setting` | a setting (`settings` contribution); needs `--group` |
27
+ | `ddk:contributions` | lists the standard contributions an `--override` can replace |
28
+ | `ddk:plugin-project` | a DDK plugin project |
29
+ | `ddk:theme-project` | a DDK theme project, whose `theme-overlay.css` overrides tokens |
30
+ | `ddk:dev` | serves DDK plugin projects for a device to load (see below) |
31
+ | `ddk:agent-install` | installs the kos-ddk-tools agent plugin (see below) |
32
+
33
+ Each contribution command writes the component, its story and `index.ts`, the
34
+ `.kos.json` contribution and experience, and the i18n title key. Add `--dryRun` to
35
+ list the files without writing them.
36
+
37
+ ```sh
38
+ kosui ddk:utility --name fuel-level --project demo-plugin
39
+ kosui ddk:setting --name fuel-level --project demo-plugin --group network --dryRun
40
+ ```
41
+
42
+ ## Overriding a standard contribution
43
+
44
+ Utilities, setup steps, navigation views, dashboard cards, pump details, macro
45
+ summaries and trouble actions are ranked: when two contributions fill the same slot
46
+ (the same `utilDescriptor`, `setupDescriptor`, `navDescriptor`, `dashboardKey` or
47
+ `troubleType`), the DDK hosts use the one with the lower `rank`, and an unranked
48
+ contribution loses to any ranked one. An override is a new contribution in your
49
+ plugin, with its own id, that fills the slot of an existing one with a better rank.
50
+
51
+ ```sh
52
+ kosui ddk:contributions --point utility
53
+ kosui ddk:utility --name my-logs --project demo-plugin --override kos-ddk-standard-plugin.copyLogs.util
54
+ ```
55
+
56
+ `--override <id>` copies the slot from the named contribution and, without
57
+ `--rank`, ranks the override `100` against an unranked contribution, or one better
58
+ than a ranked one. `--rank <n>` (0 to 1000) sets the rank, and is refused if it does
59
+ not beat the overridden contribution. Without `--override`, `--rank` ranks a new
60
+ contribution, and `--descriptor` sets a utility's, setup step's or navigation
61
+ view's slot when it is not derived from the component name.
62
+
63
+ The generated story renders the override on its own, so it can be developed in
64
+ Storybook before the plugin is loaded beside the standard one.
65
+
66
+ [`guides/storybook.md`](guides/storybook.md) covers running Storybook, where model data
67
+ comes from and the story containers.
68
+
69
+ ## Testing plugins against a running DDK
70
+
71
+ `ddk:dev` serves the workspace's DDK plugin projects for a running DDK to load, without
72
+ access to the DDK host source. [`guides/ddk-dev.md`](guides/ddk-dev.md) covers choosing
73
+ plugins and scenarios and the URL it prints.
74
+
75
+ ```sh
76
+ kosui ddk:dev --device http://192.168.1.50:8081
77
+ ```
78
+
79
+ ## Agent plugin
80
+
81
+ The package ships `kos-ddk-tools`, an agent plugin running the `kos-ddk` MCP server: one
82
+ tool per contribution command, `scaffold_ddk_plugin_project` and `list_ddk_contributions`. Its
83
+ writing tools preview by default and write with `dryRun: false`.
84
+
85
+ Its reference is extracted from DDK source at build time:
86
+
87
+ - `ddk://index`, and `ddk://extension-point/{id}` for each `defineExtensionPoint` in
88
+ kos-ddk-model-components: contribution fields, component props, standard
89
+ contributions and the tool that writes it.
90
+ - `ddk://design/{base,flex-eu,compact}`: a DESIGN.md per theme `getStyles()` builds, from
91
+ the kos-ddk-styles tokens and the typography components.
92
+ - `list_ddk_components` and `describe_ddk_component` for the kos-ddk-components and
93
+ kos-ddk-model-components exports: props as typed, the components and hooks each uses,
94
+ and every token it reads with its value per theme.
95
+ - `find_ddk_capability` maps a plain-language need to extension points, standard
96
+ contributions and components.
97
+ - `ddk://guide/storybook` and `ddk://guide/ddk-dev`, from [`guides/`](guides).
98
+
99
+ `describe_ddk_plugin` and `validate_ddk_plugin` read a plugin project's `.kos.json`: its
100
+ contributions, the standard ones they share a slot with, and checks of fields, ranks,
101
+ experiences and tokens set in plugin code. The skills `build-ddk-plugin`,
102
+ `ddk-content-component` and `ddk-storybook` give the workflow, and the
103
+ `kos-ddk-plugin-planner` and `kos-ddk-plugin-reviewer` subagents plan and review
104
+ read-only.
105
+
106
+ ```sh
107
+ kosui ddk:agent-install --client claude --scope user
108
+ ```
109
+
110
+ `--scope repo` installs it for the current checkout only.
111
+
112
+ ## Tests
113
+
114
+ ```sh
115
+ npx nx run kos-ddk-cli:test
116
+ ```
117
+
118
+ The suite builds and packs this package and installs it with
119
+ `@kosdev-code/kos-ui-cli` from the registry, so during local development the local
120
+ registry must be running with the SDK published to it. It checks the handlers'
121
+ output against the SDK built-ins and drives every command through the installed
122
+ `kosui`.
123
+
124
+ ```sh
125
+ npx nx run kos-ddk-cli:test:slow
126
+ ```
127
+
128
+ The slow suite also installs the published DDK libraries, the SDKs, React, Emotion
129
+ and Storybook, runs every contribution command into one plugin, and type-checks the
130
+ result with a KOS plugin workspace's compiler options.
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "kos-ddk",
3
+ "owner": {
4
+ "name": "kosdev-code"
5
+ },
6
+ "plugins": [
7
+ {
8
+ "name": "kos-ddk-tools",
9
+ "source": "./kos-ddk-tools",
10
+ "description": "KOS DDK plugin authoring (kos-ddk) MCP server: plugin projects, extension-point contributions and overrides of the standard ones."
11
+ }
12
+ ]
13
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "kos-ddk-tools",
3
+ "version": "0.1.0-dev.50",
4
+ "description": "KOS DDK plugin authoring (kos-ddk) MCP server: plugin projects, extension-point contributions and overrides of the standard ones.",
5
+ "author": {
6
+ "name": "kosdev-code"
7
+ }
8
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "mcpServers": {
3
+ "kos-ddk": {
4
+ "type": "stdio",
5
+ "command": "node",
6
+ "args": [
7
+ "${CLAUDE_PLUGIN_ROOT}/servers/kos-ddk.mjs"
8
+ ]
9
+ }
10
+ }
11
+ }
@@ -0,0 +1,40 @@
1
+ ---
2
+ name: kos-ddk-plugin-planner
3
+ description: Turn a DDK plugin feature into a plan before anything is written. Finds the extension points and standard contributions that cover the need, what the plugin already contributes, and the DDK components each contribution should render. Use when starting a DDK plugin feature or an override and the shape is not yet decided. Read-only; returns the tool calls for the main thread to run with the build-ddk-plugin skill.
4
+ tools: Read, Grep, Glob, ReadMcpResourceTool, ListMcpResourcesTool, mcp__plugin_kos-ddk-tools_kos-ddk__find_ddk_capability, mcp__plugin_kos-ddk-tools_kos-ddk__list_ddk_contributions, mcp__plugin_kos-ddk-tools_kos-ddk__list_ddk_components, mcp__plugin_kos-ddk-tools_kos-ddk__describe_ddk_component, mcp__plugin_kos-ddk-tools_kos-ddk__describe_ddk_plugin
5
+ model: inherit
6
+ ---
7
+
8
+ You plan DDK plugin work; you do not build it. You cannot write. The main thread
9
+ runs the `build-ddk-plugin` skill from your plan.
10
+
11
+ ## Input
12
+
13
+ What the plugin should do or replace, and the plugin project if one exists. Pass
14
+ `workspaceRoot` on every call that takes it when the session cwd is not the workspace.
15
+
16
+ ## Procedure
17
+
18
+ 1. `find_ddk_capability` with the need in plain words. Read `ddk://index` and the
19
+ `ddk://extension-point/{id}` resource of each candidate point.
20
+ 2. Replacing something standard: `list_ddk_contributions` for the point, and name the
21
+ id to pass as `override`. Say whether the slot is one the NCUI descriptor must list
22
+ (utilities, setup steps, nav views).
23
+ 3. Existing project: `describe_ddk_plugin`, so the plan extends what it contributes and
24
+ does not take a slot it already fills.
25
+ 4. Components: `list_ddk_components` and `describe_ddk_component` for what each
26
+ contribution renders. Prefer a kos-ddk-model-components component bound to the
27
+ model over composing one from kos-ddk-components.
28
+
29
+ ## Output
30
+
31
+ Under 30 lines:
32
+
33
+ - **Project**: the existing plugin, or the `scaffold_ddk_plugin_project` arguments.
34
+ - **Contributions**: ordered tool calls (`add_*`) with their key arguments (`name`,
35
+ `project`, `override`, `rank`, `dashboardKey`, `troubleType`, `group`), each with the
36
+ extension point resource it rests on.
37
+ - **Components**: per contribution, the DDK components to render and the props they take
38
+ from the extension point's props.
39
+ - **Descriptor**: NCUI descriptor entries a new utility, setup step or nav view slot needs.
40
+ - **Open questions**: anything the developer must rule on.
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: kos-ddk-plugin-reviewer
3
+ description: Read-only review of a DDK plugin project: its contributions against the extension points, its overrides, and its components against the rule that plugins compose DDK components and leave tokens to the DDK app. Use after writing or changing contributions, before a commit, or when asked to check a DDK plugin. Returns findings with the tool or resource that fixes each; never edits.
4
+ tools: Read, Grep, Glob, ReadMcpResourceTool, ListMcpResourcesTool, mcp__plugin_kos-ddk-tools_kos-ddk__validate_ddk_plugin, mcp__plugin_kos-ddk-tools_kos-ddk__describe_ddk_plugin, mcp__plugin_kos-ddk-tools_kos-ddk__list_ddk_contributions, mcp__plugin_kos-ddk-tools_kos-ddk__list_ddk_components, mcp__plugin_kos-ddk-tools_kos-ddk__describe_ddk_component
5
+ model: inherit
6
+ ---
7
+
8
+ You review DDK plugins. You cannot edit anything: report and stop. If a tool you
9
+ need is unavailable, say which one and stop; never fall back to judging by eye.
10
+
11
+ ## Input
12
+
13
+ The plugin project, or a description of what changed. Pass `workspaceRoot` on every
14
+ call that takes it when the session cwd is not the workspace being reviewed.
15
+
16
+ ## Procedure
17
+
18
+ 1. `validate_ddk_plugin` for the static findings; every error is a finding.
19
+ 2. `describe_ddk_plugin` for each contribution's point, slot, rank and component. For
20
+ each override, confirm it beats every standard contribution it shares a slot with.
21
+ 3. Read each contribution's component file. For the props it uses, check them against
22
+ the extension point resource (`ddk://extension-point/{id}`) and, for each DDK
23
+ component it renders, `describe_ddk_component`.
24
+ 4. Composition: flag markup or styled elements that re-create a component
25
+ `list_ddk_components` already has, text styled by hand instead of the typography
26
+ components, and any `--ddk-*` token set or overridden in plugin code.
27
+ 5. Utilities, setup steps and nav views: name the NCUI descriptor entry each slot
28
+ needs; you cannot see the device's descriptor, so say it must be confirmed there.
29
+
30
+ ## Output
31
+
32
+ Findings, most severe first, each with the file, what is wrong and the tool or
33
+ resource that fixes it. "No findings" when there are none.