@kosdev-code/kos-ddk-cli 0.1.0-dev.94 → 0.1.0-dev.97
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/agent-plugin/kos-ddk-tools/.claude-plugin/plugin.json +1 -1
- package/agent-plugin/kos-ddk-tools/plugin.json +1 -1
- package/agent-plugin/kos-ddk-tools/reference/reference.json +1 -1
- package/agent-plugin/kos-ddk-tools/servers/kos-ddk.mjs +1 -1
- package/package.json +2 -2
- package/reference/reference.json +1 -1
- package/src/codegen/descriptor.mjs +10 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kos-ddk-tools",
|
|
3
|
-
"version": "0.1.0-dev.
|
|
3
|
+
"version": "0.1.0-dev.97",
|
|
4
4
|
"description": "KOS DDK plugin authoring (kos-ddk) MCP server: plugin projects, extension-point contributions and overrides of the standard ones.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "kosdev-code"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
|
|
3
3
|
"name": "kos-ddk-tools",
|
|
4
|
-
"version": "0.1.0-dev.
|
|
4
|
+
"version": "0.1.0-dev.97",
|
|
5
5
|
"description": "KOS DDK plugin authoring (kos-ddk) MCP server: plugin projects, extension-point contributions and overrides of the standard ones.",
|
|
6
6
|
"license": "MIT"
|
|
7
7
|
}
|
|
@@ -20964,7 +20964,7 @@
|
|
|
20964
20964
|
"name": "ddk-guide-descriptor-project",
|
|
20965
20965
|
"title": "NCUI descriptor projects",
|
|
20966
20966
|
"description": "What ddk:descriptor-project writes for each layout and option, the dashboard layout, and where --descriptorProject lists a utility, setup step or navigation view.",
|
|
20967
|
-
"body": "# NCUI descriptor projects\n\nThe NCUI shows a utility, setup step or navigation view only if its NCUI descriptor lists it (`kondra.ncui` `utilities`, `setup.steps`, `navigations`). The DDK app uses an installed `ddk.ncui.descriptor` KAB in place of the system app's descriptor, so a descriptor project is where a plugin's new slots are listed; the backend `descriptor.json` is the fallback.\n\n```sh\nkosui ddk:descriptor-project --name my-ncui --layout standard --ice true\n```\n\nMCP: `scaffold_ddk_descriptor_project`. The project is a content project under `content/<name>`; its `.kos.json` is the KAB's `descriptor.json`. Run `npm install` if the command names added packages, then `nx run <name>:kab` and install the KAB beside the DDK app.\n\nThe lists below are what a new project gets with every option off. `standard` spreads utilities over two columns and marks `embed` navigation entries, whose children show as tabs; `compact` keeps utilities in one column.\n\n## standard\n\nSetup steps, in order: `selectCountry` (pre-step), `selectLanguage` (pre-step), `plainWater`, `ns`, `macroAssignment`, `ingredients`, `regions`, `timeSettings`, `dispenserProfile`, `waterSettings`.\n\nUtilities, by column:\n\n1. `touchScreenTest`, `pixelQualityTest`, `setup`, `usbUpdate` (manager, technician)\n2. `reboot` (manager), `downloadLogs` (manager, technician)\n\nNavigation:\n\n- `summary` (crew, technician)\n- `dashboard` (crew, technician)\n- `notifications` (crew, technician)\n- `about` (crew, technician) — embed: its children show as tabs\n - `dispenser-info` (technician, crew)\n - `hardware` (technician, crew)\n - `connectivity` (technician, crew)\n - `software` (technician, crew)\n- `utilities` (technician, manager)\n- `settings` (technician) — embed: its children show as tabs\n - `regions` (technician)\n - `dispenser-profile` (technician)\n - `cui-selection` (technician)\n - `water` (technician)\n - `remote-nns` (technician)\n\nDashboard regions:\n\n- `micros`: holder groups `*micros*`; one column per group\n- `macros`: holder groups `*`; compact cards; small size\n- `assembly`: summaries `*`; small size\n\nDashboard areas:\n\n- portrait: `micros macros` `micros macros` `micros assembly` (columns `73% 27%`)\n- landscape: `micros micros` `macros assembly` (columns `50% 50%`)\n\n## compact\n\nSetup steps, in order: `selectCountry` (pre-step), `selectLanguage` (pre-step), `plainWater`, `ns`, `macroAssignment`, `ingredients`, `regions`, `timeSettings`, `dispenserProfile`, `waterSettings`.\n\nUtilities, by column:\n\n1. `touchScreenTest`, `pixelQualityTest`, `setup`, `usbUpdate` (manager, technician), `reboot` (manager), `downloadLogs` (manager, technician)\n\nNavigation:\n\n- `dashboard` (crew, technician)\n- `notifications` (crew, technician)\n- `about` (crew, technician)\n - `software` (crew, technician)\n - `hardware` (crew, technician)\n- `network` (technician, crew)\n- `utilities` (technician, manager)\n- `settings` (technician)\n - `localization` (technician)\n - `time-settings` (technician)\n - `water-settings` (technician)\n - `dispenser-profile` (technician)\n - `cui-selection` (technician)\n\nDashboard regions:\n\n- `micros`: holder groups `*micros*`; one column per group\n- `macros`: holder groups `*`; compact cards; small size\n- `assembly`: summaries `*`; small size\n\nDashboard areas:\n\n- portrait: `micros` `macros` `assembly` (columns `100%`)\n- landscape: `micros micros` `macros assembly` (columns `50% 50%`)\n\n## Dashboard layout\n\n`kondra.ncui.dashboard` lays out the dashboard. With none, the DDK uses the built-in layout for its component mode (the same as a new project's).\n\n- `regions`: named slots. `holders` and `summaries` are holder-group and `dashboard.summary` `dashboardKey` patterns (`*` is the only wildcard). Each group and key goes to the first region, in list order, that the current layout places and that matches it; put `[\"*\"]` last to catch the rest. `holderCard` (default `true`) renders the holders as holder cards, `false` as compact cards; `perGroup` gives each group its own sub-column; `size` (`default` or `small`) applies to every card in the region; `justify` (`left`, `right`, `center`, `full`, default `full`) places the region and its cards in its cell.\n- `layouts.portrait` and/or `layouts.landscape` (give at least one; an orientation without a layout uses the other): `areas` (one string per row of region names, `.` for an empty cell), `columns` and `rows` (one size each: a share of the space such as `60%`, or `fit` to size to the cards; rows default to `fit`; a column can also be `fixed 20%` or `fixed 240px` for a set width, or `max 30%` or `max 300px` to fit its cards up to that width, where the percentage is of the dashboard's width and shares divide what is left), `justify` (`left`, `right` or `center`: where the grid sits when its columns don't fill the width, default `left`), and `flow` per region: `cards` and `groups` (`vertical` or `horizontal`), `wrap`.\n- A plugin renders a whole region with a `ddk.dashboard.region` contribution (`add_dashboard_region`) whose `regionKey` is the region's `component`, else its `name`; a region with none renders its built-in cards. A region that claims no holders or summaries (only a `component`, such as a dispenser map) takes no cards from the others and shows only while a plugin contributes its key.\n- A region with nothing to show is empty, and a column or row whose cells are all empty is dropped with its size, and its share goes to the columns that remain: a dispenser without micro groups loses the micro columns. Give a pinned column the size `fit` and set `justify: \"right\"` to keep it at the right edge when the others drop.\n- `validate_ddk_plugin` warns about an area that is no region, a plugin's dashboard summary that no placed region claims, a size that is not a share or `fit`, shares that do not add up to 100%, an unknown `justify`, a region `component` no workspace plugin contributes, and a plugin's region contribution that no descriptor region uses.\n\n## Options\n\nOff by default; each adds:\n\n- `--carb`: carbonation: the carbWater and carbTank setup steps.\n - standard: setup step `carbWater`, setup step `carbTank`\n - compact: setup step `carbWater`, setup step `carbTank`\n- `--ice`: ice: the iceSettings setup step and the ice settings tab.\n - standard: setup step `iceSettings`, navigation `settings.ice`\n - compact: setup step `iceSettings`, navigation `settings.ice-settings`\n- `--beveragePourTest`: the beveragePourTest utility.\n - standard: utility `beveragePourTest`\n - compact: utility `beveragePourTest`\n\n## Listing a plugin's slots\n\n- `--descriptorProject <name>` on `ddk:utility`, `ddk:setup` and `ddk:nav` (MCP `descriptorProject` on `add_utility`, `add_setup_step`, `add_nav_view`) lists the new contribution's slot:\n - a utility in the last column, or `--column <n>` (1-based), with `--roles` (comma-separated; none: every role);\n - a setup step last; the setup flow runs steps in descriptor order;\n - a navigation view under its parent path, with `--roles` or the parent's roles; the parent must exist.\n- A slot already listed is left as it is; an override (`--override`) fills a listed slot and needs no entry.\n- For contributions written before the descriptor project: `kosui ddk:descriptor-entries --project <plugin> --descriptorProject <name>` (MCP `add_descriptor_entries`).\n- `validate_ddk_plugin` warns about a slot no descriptor project lists."
|
|
20967
|
+
"body": "# NCUI descriptor projects\n\nThe NCUI shows a utility, setup step or navigation view only if its NCUI descriptor lists it (`kondra.ncui` `utilities`, `setup.steps`, `navigations`). The DDK app uses an installed `ddk.ncui.descriptor` KAB in place of the system app's descriptor, so a descriptor project is where a plugin's new slots are listed; the backend `descriptor.json` is the fallback.\n\n```sh\nkosui ddk:descriptor-project --name my-ncui --layout standard --ice true\n```\n\nMCP: `scaffold_ddk_descriptor_project`. The project is a content project under `content/<name>`; its `.kos.json` is the KAB's `descriptor.json`. Run `npm install` if the command names added packages, then `nx run <name>:kab` and install the KAB beside the DDK app.\n\nThe lists below are what a new project gets with every option off. `standard` spreads utilities over two columns and marks `embed` navigation entries, whose children show as tabs; `compact` keeps utilities in one column.\n\n## standard\n\nSetup steps, in order: `selectCountry` (pre-step), `selectLanguage` (pre-step), `plainWater`, `ns`, `macroAssignment`, `ingredients`, `regions`, `timeSettings`, `dispenserProfile`, `waterSettings`.\n\nUtilities, by column:\n\n1. `touchScreenTest`, `pixelQualityTest`, `setup`, `usbUpdate` (manager, technician)\n2. `reboot` (manager), `downloadLogs` (manager, technician)\n\nNavigation:\n\n- `summary` (crew, technician)\n- `dashboard` (crew, technician)\n- `notifications` (crew, technician)\n- `about` (crew, technician) — embed: its children show as tabs\n - `dispenser-info` (technician, crew)\n - `hardware` (technician, crew)\n - `connectivity` (technician, crew)\n - `software` (technician, crew)\n- `utilities` (technician, manager)\n- `settings` (technician) — embed: its children show as tabs\n - `regions` (technician)\n - `dispenser-profile` (technician)\n - `cui-selection` (technician)\n - `water` (technician)\n - `remote-nns` (technician)\n\nDashboard regions:\n\n- `micros`: holder groups `*micros*`; one column per group\n- `macros`: holder groups `*`; compact cards; small size\n- `assembly`: summaries `*`; small size\n\nDashboard areas:\n\n- portrait: `micros macros` `micros macros` `micros assembly` (columns `73% 27%`)\n- landscape: `micros micros` `macros assembly` (columns `50% 50%`)\n\n## compact\n\nSetup steps, in order: `selectCountry` (pre-step), `selectLanguage` (pre-step), `plainWater`, `ns`, `macroAssignment`, `ingredients`, `regions`, `timeSettings`, `dispenserProfile`, `waterSettings`.\n\nUtilities, by column:\n\n1. `touchScreenTest`, `pixelQualityTest`, `setup`, `usbUpdate` (manager, technician), `reboot` (manager), `downloadLogs` (manager, technician)\n\nNavigation:\n\n- `dashboard` (crew, technician)\n- `notifications` (crew, technician)\n- `about` (crew, technician)\n - `software` (crew, technician)\n - `hardware` (crew, technician)\n- `network` (technician, crew)\n- `utilities` (technician, manager)\n- `settings` (technician)\n - `localization` (technician)\n - `time-settings` (technician)\n - `water-settings` (technician)\n - `dispenser-profile` (technician)\n - `cui-selection` (technician)\n\nDashboard regions:\n\n- `micros`: holder groups `*micros*`; one column per group\n- `macros`: holder groups `*`; compact cards; small size\n- `assembly`: summaries `*`; small size\n\nDashboard areas:\n\n- portrait: `micros` `macros` `assembly` (columns `100%`)\n- landscape: `micros micros` `macros assembly` (columns `50% 50%`)\n\n## Dashboard layout\n\n`kondra.ncui.dashboard` lays out the dashboard. With none, the DDK uses the built-in layout for its component mode (the same as a new project's).\n\n- `regions`: named slots. `holders` and `summaries` are holder-group and `dashboard.summary` `dashboardKey` patterns (`*` is the only wildcard). Each group and key goes to the first region, in list order, that the current layout places and that matches it; put `[\"*\"]` last to catch the rest. `holderCard` (default `true`) renders the holders as holder cards, `false` as compact cards; `perGroup` gives each group its own sub-column; `size` (`default` or `small`) applies to every card in the region; `justify` (`left`, `right`, `center`, `full`, default `full`) places the region and its cards in its cell.\n- `layouts.portrait` and/or `layouts.landscape` (give at least one; an orientation without a layout uses the other): `areas` (one string per row of region names, `.` for an empty cell), `columns` and `rows` (one size each: a share of the space such as `60%`, `fill` for the share the others leave (all of it when there are no shares, split evenly between several), or `fit` to size to the cards; rows default to `fit`; a column can also be `fixed 20%` or `fixed 240px` for a set width, or `max 30%` or `max 300px` to fit its cards up to that width, where the percentage is of the dashboard's width and shares divide what is left), `justify` (`left`, `right` or `center`: where the grid sits when its columns don't fill the width, default `left`), and `flow` per region: `cards` and `groups` (`vertical` or `horizontal`), `wrap`.\n- A plugin renders a whole region with a `ddk.dashboard.region` contribution (`add_dashboard_region`) whose `regionKey` is the region's `component`, else its `name`; a region with none renders its built-in cards. A region that claims no holders or summaries (only a `component`, such as a dispenser map) takes no cards from the others and shows only while a plugin contributes its key.\n- A region with nothing to show is empty, and a column or row whose cells are all empty is dropped with its size, and its share goes to the columns that remain: a dispenser without micro groups loses the micro columns. Give a pinned column the size `fit` and set `justify: \"right\"` to keep it at the right edge when the others drop.\n- `validate_ddk_plugin` warns about an area that is no region, a plugin's dashboard summary that no placed region claims, a size that is not a share or `fit`, shares that do not add up to 100%, an unknown `justify`, a region `component` no workspace plugin contributes, and a plugin's region contribution that no descriptor region uses.\n\n## Options\n\nOff by default; each adds:\n\n- `--carb`: carbonation: the carbWater and carbTank setup steps.\n - standard: setup step `carbWater`, setup step `carbTank`\n - compact: setup step `carbWater`, setup step `carbTank`\n- `--ice`: ice: the iceSettings setup step and the ice settings tab.\n - standard: setup step `iceSettings`, navigation `settings.ice`\n - compact: setup step `iceSettings`, navigation `settings.ice-settings`\n- `--beveragePourTest`: the beveragePourTest utility.\n - standard: utility `beveragePourTest`\n - compact: utility `beveragePourTest`\n\n## Listing a plugin's slots\n\n- `--descriptorProject <name>` on `ddk:utility`, `ddk:setup` and `ddk:nav` (MCP `descriptorProject` on `add_utility`, `add_setup_step`, `add_nav_view`) lists the new contribution's slot:\n - a utility in the last column, or `--column <n>` (1-based), with `--roles` (comma-separated; none: every role);\n - a setup step last; the setup flow runs steps in descriptor order;\n - a navigation view under its parent path, with `--roles` or the parent's roles; the parent must exist.\n- A slot already listed is left as it is; an override (`--override`) fills a listed slot and needs no entry.\n- For contributions written before the descriptor project: `kosui ddk:descriptor-entries --project <plugin> --descriptorProject <name>` (MCP `add_descriptor_entries`).\n- `validate_ddk_plugin` warns about a slot no descriptor project lists."
|
|
20968
20968
|
},
|
|
20969
20969
|
{
|
|
20970
20970
|
"uri": "ddk://design/base",
|
|
@@ -48554,7 +48554,7 @@ export default (kosMock) => {
|
|
|
48554
48554
|
}
|
|
48555
48555
|
return kosMock.ddk.useDescriptor(descriptor);
|
|
48556
48556
|
};
|
|
48557
|
-
`}}var vPr=s=>(Array.isArray(s)?s:String(s??"").split(",")).map(a=>a.trim()).filter(Boolean);function drn(s,a,{project:p,slot:g,roles:E,column:A}){let{name:I,kosJsonPath:L}=g3n(s,p),W=s.read(L),$=JSON.parse(W),X=($.kondra??={}).ncui??={},ee=vPr(E),H=ee.length?{roles:ee}:{},ue;if(a==="utility"){let ae=X.utilities??=[[]];if(ae.flat().some(Fe=>Fe.name===g))return`${I} already lists utility "${g}".`;let Me=A===void 0||A===""?ae.length-1:Number(A)-1;if(!Number.isInteger(Me)||Me<0||Me>ae.length)throw new Error(`column must be 1 to ${ae.length+1}; got "${A}"`);(ae[Me]??=[]).push({name:g,options:{},...H}),ue=`Listed utility "${g}" in ${I} (column ${Me+1}).`}else if(a==="setup"){let ae=(X.setup??={}).steps??=[];if(ae.some(Me=>Me.name===g))return`${I} already lists setup step "${g}".`;ae.push({name:g}),ue=`Listed setup step "${g}" last in ${I}; the setup flow runs steps in that order.`}else{let ae=g.split("."),Me=X.navigations??=[],Fe;for(let Ee of ae.slice(0,-1)){if(Fe=Me.find(Ge=>Ge.name===Ee),!Fe)throw new Error(`${I} has no navigation "${ae.slice(0,ae.indexOf(Ee)+1).join(".")}" to add "${g}" under`);Me=Fe.children??=[]}let ke=ae[ae.length-1];if(Me.some(Ee=>Ee.name===ke))return`${I} already lists navigation "${g}".`;let Ie=ee.length?ee:Fe?.roles;Me.push({name:ke,...Ie?{roles:Ie}:{}}),ue=`Listed navigation "${g}" in ${I}.`}s.write(L,Mtt(W,$));let Q=tNt($);return s.write(Q.path,Q.content),ue}function f3n(s,a,p){if(a==="utility")return(s.utilities??[]).flat().some(E=>E.name===p);if(a==="setup")return(s.setup?.steps??[]).some(E=>E.name===p);let g=s.navigations??[];for(let E of p.split(".")){let A=g.find(I=>I.name===E);if(!A)return!1;g=A.children??[]}return!0}function Hjt(s,a,p){let g=o8e(s);return g.length?g.some(({kosJsonPath:E})=>f3n(JSON.parse(s.read(E)).kondra?.ncui??{},a,p)):Rtt.some(E=>[!1,!0].some(A=>f3n(Ott({layout:E,...Object.fromEntries(Object.keys(eNt).map(I=>[I,A]))}).ncui,a,p)))}var bPr=(s,a)=>new RegExp(`^${s.split("*").map(p=>p.replace(/[.+?^${}()|[\]\\]/g,"\\$&")).join(".*")}$`).test(a),_3n=/^\d+(\.\d+)?%$/,lrn=["left","right","center"],m3n=[...lrn,"full"],xPr=/^(fixed|max) \d+(\.\d+)?(%|px)$/;function h3n(s,a,p){if(!p)return[];let g=W=>W==="fit"||_3n.test(W)||a==="column"&&xPr.test(W),E=a==="column"?'a share like "50%", fit, fixed like "fixed 20%" or max like "max 300px"':'a share like "50%" or fit',A=p.filter(W=>!g(W)).map(W=>`${s} ${a} size "${W}" is not ${E}`),I=p.filter(W=>_3n.test(W)),L=I.reduce((W,$)=>W+parseFloat($),0);return I.length>0&&Math.abs(L-100)>.5&&A.push(`${s} ${a} shares add up to ${L}%, not 100%`),A}function SPr(s,a,p){if(!s)return[];let g=s.regions??[],E=new Set(g.map(I=>I.name)),A=[];!s.layouts?.portrait&&!s.layouts?.landscape&&A.push("dashboard has no portrait or landscape layout, so the built-in one shows");for(let I of g)p&&I.component&&!p.includes(I.component)&&A.push(`region "${I.name}" component "${I.component}" is contributed by no plugin in the workspace, so the region shows its built-in cards`),I.justify!==void 0&&!m3n.includes(I.justify)&&A.push(`region "${I.name}" justify "${I.justify}" is not ${m3n.join(", ")}`);for(let[I,L]of Object.entries(s.layouts??{})){L?.justify!==void 0&&!lrn.includes(L.justify)&&A.push(`${I} justify "${L.justify}" is not ${lrn.join(", ")}`),A.push(...h3n(I,"column",L?.columns),...h3n(I,"row",L?.rows));let W=new Set((L?.areas??[]).flatMap(X=>X.trim().split(/\s+/)).filter(X=>!/^\.+$/.test(X)));for(let X of W)E.has(X)||A.push(`${I} area "${X}" is not a dashboard region`);let $=g.filter(X=>W.has(X.name));for(let X of a)$.some(H=>(H.summaries??[]).some(ue=>bPr(ue,X)))||A.push(`dashboard summary "${X}" is in no ${I} region, so it does not show`)}return A}function y3n(s,a,p){return o8e(s).flatMap(({name:g,kosJsonPath:E})=>SPr(JSON.parse(s.read(E)).kondra?.ncui?.dashboard,a,p).map(A=>({project:g,problem:A})))}var v3n=s=>s.component??s.name;function qjt(s,a){let p=o8e(s);return(p.length?p.map(({kosJsonPath:E})=>JSON.parse(s.read(E)).kondra?.ncui?.dashboard):Rtt.map(E=>Ott({layout:E}).ncui.dashboard)).some(E=>(E?.regions??[]).some(A=>v3n(A)===a))}function b3n(s,{project:a,key:p}){let{name:g,kosJsonPath:E}=g3n(s,a),A=s.read(E),I=JSON.parse(A),L=(I.kondra??={}).ncui??={},W=[];L.dashboard||(L.dashboard=Ott({layout:"standard"}).ncui.dashboard,W.push(`${g} had no dashboard; it now has the built-in standard one.`));let $=L.dashboard.regions??=[];if($.some(ee=>v3n(ee)===p))return`${g} already has a dashboard region rendered by "${p}".`;if($.some(ee=>ee.name===p))throw new Error(`${g} has a dashboard region named "${p}" with another component; choose another regionKey`);$.push({name:p});for(let ee of Object.values(L.dashboard.layouts??{})){let H=Math.max(1,...(ee.areas??[]).map(ue=>ue.trim().split(/\s+/).length));(ee.areas??=[]).push(Array(H).fill(p).join(" ")),ee.rows&&ee.rows.push("fit")}s.write(E,Mtt(A,I));let X=tNt(I);return s.write(X.path,X.content),[...W,`Added dashboard region "${p}" to ${g} as the full-width last row of each layout; it claims no holders or summaries, so the component reads the assembly. Move it in kondra.ncui.dashboard.layouts, or give it holders and summaries patterns.`].join(" ")}var TPr=[["utilities","utility","utilDescriptor"],["setupStep","setup","setupDescriptor"],["navViews","nav","navDescriptor"]];function x3n(s,{project:a,descriptorProject:p}){let g=Nge(s.root,a)?.root,E=g&&s.read(urn.join(g,".kos.json"));if(!E)throw new Error(`No plugin project "${a}" with a .kos.json`);let A=JSON.parse(E).kos?.ui?.plugin?.contributes??{},I=[];for(let[L,W,$]of TPr)for(let X of A[L]??[])if(X[$])try{I.push(drn(s,W,{project:p,slot:X[$]}))}catch(ee){I.push(`${X.id}: ${ee.message}`)}return{label:"DDK descriptor entries",notes:I.length?I:[`${a} contributes no utility, setup step or navigation slot.`]}}var S3n={cui:{pluginType:"ddk.cui",label:"DDK CUI Configuration",required:"cuiDescriptor",description:"Create a CUI configuration; --descriptor is the CUI's appId from /api/app/kosdev.ddk/cui"},setup:{pluginType:"ddk.setup",label:"DDK Setup Step",overridable:"setupDescriptor",listedIn:"kondra.ncui.setup.steps",descriptorType:"setup",description:"Create a setup step; --descriptor is its kondra.ncui.setup.steps entry (default: from the name)"},utility:{pluginType:"ddk.utility",label:"DDK Utility",overridable:"utilDescriptor",listedIn:"kondra.ncui.utilities",descriptorType:"utility",layouts:["maximized","fullscreen"],description:"Create a utility in a modal; --layout maximized (default) or fullscreen; --descriptor is its kondra.ncui.utilities entry (default: from the name)"},nav:{pluginType:"ddk.nav",label:"DDK Navigation View",overridable:"navDescriptor",listedIn:"kondra.ncui.navigations",descriptorType:"nav",slotRequired:!0,description:"Create a navigation view; --descriptor is its kondra.ncui.navigations entry, e.g. settings.water for a Settings tab"}},EPr={"ddk.cui":{proceed:"Proceed"},"ddk.setup":{proceed:"Proceed"},"ddk.utility":{back:"Back",close:"Close",done:"Done"},"ddk.dashboardDetail":{close:"Close"},"ddk.troubleAction":{resolve:"Resolve"}};function DPr(s,a,p){let g=EPr[a],E=Nge(s.root,p)?.sourceRoot;if(!g||!E)return;let A=$jt.join(E,"assets","locales","en",`${p}.json`);s.exists(A)&&Gjt(s,A,I=>({...g,...I}))}function Ftt(s,a,p){let g=Nge(s.root,a)?.root,E=g&&s.read($jt.join(g,".kos.json"));if(!E)return;let A=JSON.parse(E).kos?.ui?.plugin?.contributes?.experiences??{},I=k9e({name:p}).namePascalCase,L=Object.values(A).find(W=>[I,`${I}Summary`,`${I}Detail`].includes(W.component));if(L)throw new Error(`${a} already has a component ${L.component} (${L.location}); components are exposed by name, so choose another --name (kosui ddk:descriptor-entries lists an existing contribution's slot in a descriptor project)`)}function Btt(s,a){let p=k9e({name:a}).namePascalCase,g=[];for(let E of QIt(s.root).values()){let A=s.read($jt.join(E.root,".kos.json"));if(!A)continue;let I;try{I=JSON.parse(A).models}catch{continue}for(let[L,W]of Object.entries(I??{})){let $=W?.factory??k9e({name:L}).namePascalCase;$===p&&g.push(`WARNING: component ${p} has the same name as model ${L}'s registration bean ${$} (${E.name}). Choose another name, e.g. ${a}-config (${p}Config), before writing.`)}}return g}function s8e(s,a,{name:p,project:g,...E}){d3n();let A=Nge(s.root,g)?.root,I=A&&$jt.join(A,".kos.json"),L=I&&s.read(I);l3n(s,ZIt,{name:p,appProject:g,type:"components",pluginType:a,useEmotionCss:!1,appDirectory:"",modelDirectory:"",...E});let W=L&&s.read(I);W&&W!==L&&s.write(I,Mtt(L,JSON.parse(W))),DPr(s,a,g)}function Ltt(s,a){if(!s)throw new Error(`${a} is required`)}var jtt=s=>s===void 0?{}:{rank:s};function T3n(s,{type:a,name:p,project:g,descriptor:E,override:A,rank:I,descriptorProject:L,roles:W,column:$,layout:X}){let ee=S3n[a];if(!ee)throw new Error(`Unknown contribution type "${a}". Choose from ${Object.keys(S3n).join(", ")}.`);let H=A||I!==void 0&&I!=="";if(!ee.overridable&&H)throw new Error(`${a} contributions are not ranked; --override and --rank do not apply`);if(ee.required&&Ltt(E,`descriptor (${ee.required})`),X&&!ee.layouts)throw new Error(`${a} contributions have no layout; --layout does not apply`);if(X&&!ee.layouts.includes(X))throw new Error(`Unknown layout "${X}". Choose from ${ee.layouts.join(", ")}.`);let ue=ee.overridable?Ptt(a,{override:A,rank:I,explicit:{[ee.overridable]:E}}):{fields:{},notes:[]},Q=ue.fields[ee.overridable]??E;if(ee.slotRequired&&!Q&&Ltt(Q,`descriptor (${ee.overridable}, a kondra.ncui.navigations path such as settings.water)`),Ftt(s,g,p),L&&A)throw new Error("--override fills a slot the descriptor already lists; --descriptorProject does not apply");let ae=ee.listedIn&&!Q?[`${ee.overridable} "${k9e({name:p}).nameCamelCase}" comes from the name (--descriptor sets it).`]:[];s8e(s,ee.pluginType,{name:p,project:g,...Q?{descriptor:Q}:{},...jtt(ue.rank),...ee.layouts?{layout:X||ee.layouts[0]}:{}});let Me=ee.descriptorType?CPr(s,ee,{slot:Q||k9e({name:p}).nameCamelCase,override:A,descriptorProject:L,roles:W,column:$}):[];return{label:ee.label,notes:[...Btt(s,p),...ue.notes,...ae,...Me]}}function CPr(s,a,{slot:p,override:g,descriptorProject:E,roles:A,column:I}){if(g)return[];if(E)return[drn(s,a.descriptorType,{project:E,slot:p,roles:A,column:I})];if(Hjt(s,a.descriptorType,p))return[];let W=o8e(s).map($=>$.name);return[W.length?`No descriptor project lists ${a.overridable} "${p}"; add it with --descriptorProject ${W[0]}.`:`The NCUI shows "${p}" only if its descriptor (${a.listedIn}) lists it: create a descriptor project with kosui ddk:descriptor-project and pass --descriptorProject, or the system app's descriptor must list it.`]}function E3n(s,{name:a,project:p,dashboardKey:g,detail:E=!0,override:A,rank:I}){Ftt(s,p,a);let L=Ptt("dashboard-card",{override:A,rank:I,explicit:{dashboardKey:g}}),W=L.fields.dashboardKey??g;Ltt(W,"dashboardKey");let $={name:a,project:p,dashboardKey:W,...jtt(L.rank)};return s8e(s,"ddk.dashboardSummary",$),E&&s8e(s,"ddk.dashboardDetail",$),{label:E?"DDK Dashboard Card":"DDK Dashboard Summary",notes:[...Btt(s,a),`The dashboard draws one card per active model at assembly.${W} (or the FreestyleAssembly companion's ${W}); no such model, no card.`,...E?["The detail opens when a technician selects the card."]:[],...L.notes,...Vnn("dashboard-card",{override:A,rank:L.rank,slot:{dashboardKey:W},written:E?["dashboardSummary","dashboardDetail"]:["dashboardSummary"]})]}}function D3n(s,{name:a,project:p,dashboardKey:g,override:E,rank:A}){Ftt(s,p,a);let I=Ptt("pump-detail",{override:E,rank:A,explicit:{dashboardKey:g}}),L=I.fields.dashboardKey??g;return Ltt(L,"dashboardKey"),s8e(s,"ddk.pumpDetail",{name:a,project:p,dashboardKey:L,...jtt(I.rank)}),{label:"DDK Pump Detail",notes:[...Btt(s,a),`Shown in the holder modal for holders with dashboard key "${L}" (default: its first pump's type; a holder with several keys uses the first one that has a pump detail), unless the holder has its own content.`,...I.notes]}}function C3n(s,{name:a,project:p,dashboardKey:g,detail:E=!0,override:A,rank:I}){Ftt(s,p,a);let L=Ptt("pump-card",{override:A,rank:I,explicit:{dashboardKey:g}}),W=L.fields.dashboardKey??g;Ltt(W,"dashboardKey");let $={name:a,project:p,dashboardKey:W,...jtt(L.rank)};return s8e(s,"ddk.pumpSummary",$),E&&s8e(s,"ddk.pumpDetail",$),{label:E?"DDK Pump Card":"DDK Pump Summary",notes:[...Btt(s,a),`Used for holders with dashboard key "${W}" (default: the holder's first pump type, which the backend assembly assigns; a holder with several keys uses the first one that has a contribution); other holders keep the default card body.`,...E?["The detail shows in the holder modal a technician opens from the card."]:[],...L.notes,...Vnn("pump-card",{override:A,rank:L.rank,slot:{dashboardKey:W},written:E?["dashboardPumpSummary","dashboardPumpDetail"]:["dashboardPumpSummary"]})]}}function A3n(s,{name:a,project:p,dashboardKey:g,override:E,rank:A}){Ftt(s,p,a);let I=Ptt("macro-summary",{override:E,rank:A,explicit:{dashboardKey:g}}),L=I.fields.dashboardKey??g;return Ltt(L,"dashboardKey"),s8e(s,"ddk.macroSummary",{name:a,project:p,dashboardKey:L,...jtt(I.rank)}),{label:"DDK Macro Summary",notes:[...Btt(s,a),`Matched to a macro holder by holder.name "${L}" first, then by the dashboard key factory.`,...I.notes]}}function P3n(s,{name:a,project:p,regionKey:g,rank:E,descriptorProject:A}){Ftt(s,p,a);let I=g||k9e({name:a}).nameCamelCase;s8e(s,"ddk.dashboardRegion",{name:a,project:p,regionKey:I,claimsNothing:!!A,...jtt(Gnn(E))});let L=g?[]:[`regionKey "${I}" comes from the name (--regionKey sets it).`],W;if(A)W=b3n(s,{project:A,key:I});else if(qjt(s,I))W=`Renders the dashboard region "${I}" in place of its built-in cards.`;else{let $=o8e(s).map(X=>X.name);W=$.length?`No dashboard region in a descriptor project is rendered by "${I}"; add one with --descriptorProject ${$[0]}, or set a region's component to "${I}".`:`The dashboard shows "${I}" only if its descriptor (kondra.ncui.dashboard) has a region named "${I}" or with component "${I}": create a descriptor project with kosui ddk:descriptor-project and pass --descriptorProject.`}return{label:"DDK Dashboard Region",notes:[...Btt(s,a),...L,W]}}function k3n(s,{name:a,project:p,troubleType:g,stateKey:E,stateValue:A,override:I,rank:L}){Ftt(s,p,a);let W=Ptt("trouble-action",{override:I,rank:L,explicit:{troubleType:g,stateKey:E,stateValue:A}}),$=W.fields.troubleType??g;return Ltt($,"troubleType"),s8e(s,"ddk.troubleAction",{name:a,project:p,troubleType:$,stateKey:W.fields.stateKey??(E||$),stateValue:W.fields.stateValue??(A||$),...jtt(W.rank)}),{label:"DDK Trouble Action",notes:[...Btt(s,a),`troubleType "${$}" must be the exact type the device raises; the experience shows while one is active and goes away once it is resolved.`,...W.notes]}}import{spawnSync as APr}from"node:child_process";import kme from"node:fs";import AX from"node:path";var PPr="~3.1.0",I3n="kosdev.ddk",kPr=["@kosdev-code/kos-ddk","@kosdev-code/kos-ddk-components","@kosdev-code/kos-ddk-model-components","@kosdev-code/kos-ddk-models","@kosdev-code/kos-ddk-styles","@kosdev-code/kos-ddk-story-containers"],wPr={cui:[],utilities:[]},nNt=s=>JSON.parse(kme.readFileSync(s,"utf-8")),prn=(s,a)=>kme.writeFileSync(s,JSON.stringify(a,null,2)+`
|
|
48557
|
+
`}}var vPr=s=>(Array.isArray(s)?s:String(s??"").split(",")).map(a=>a.trim()).filter(Boolean);function drn(s,a,{project:p,slot:g,roles:E,column:A}){let{name:I,kosJsonPath:L}=g3n(s,p),W=s.read(L),$=JSON.parse(W),X=($.kondra??={}).ncui??={},ee=vPr(E),H=ee.length?{roles:ee}:{},ue;if(a==="utility"){let ae=X.utilities??=[[]];if(ae.flat().some(Fe=>Fe.name===g))return`${I} already lists utility "${g}".`;let Me=A===void 0||A===""?ae.length-1:Number(A)-1;if(!Number.isInteger(Me)||Me<0||Me>ae.length)throw new Error(`column must be 1 to ${ae.length+1}; got "${A}"`);(ae[Me]??=[]).push({name:g,options:{},...H}),ue=`Listed utility "${g}" in ${I} (column ${Me+1}).`}else if(a==="setup"){let ae=(X.setup??={}).steps??=[];if(ae.some(Me=>Me.name===g))return`${I} already lists setup step "${g}".`;ae.push({name:g}),ue=`Listed setup step "${g}" last in ${I}; the setup flow runs steps in that order.`}else{let ae=g.split("."),Me=X.navigations??=[],Fe;for(let Ee of ae.slice(0,-1)){if(Fe=Me.find(Ge=>Ge.name===Ee),!Fe)throw new Error(`${I} has no navigation "${ae.slice(0,ae.indexOf(Ee)+1).join(".")}" to add "${g}" under`);Me=Fe.children??=[]}let ke=ae[ae.length-1];if(Me.some(Ee=>Ee.name===ke))return`${I} already lists navigation "${g}".`;let Ie=ee.length?ee:Fe?.roles;Me.push({name:ke,...Ie?{roles:Ie}:{}}),ue=`Listed navigation "${g}" in ${I}.`}s.write(L,Mtt(W,$));let Q=tNt($);return s.write(Q.path,Q.content),ue}function f3n(s,a,p){if(a==="utility")return(s.utilities??[]).flat().some(E=>E.name===p);if(a==="setup")return(s.setup?.steps??[]).some(E=>E.name===p);let g=s.navigations??[];for(let E of p.split(".")){let A=g.find(I=>I.name===E);if(!A)return!1;g=A.children??[]}return!0}function Hjt(s,a,p){let g=o8e(s);return g.length?g.some(({kosJsonPath:E})=>f3n(JSON.parse(s.read(E)).kondra?.ncui??{},a,p)):Rtt.some(E=>[!1,!0].some(A=>f3n(Ott({layout:E,...Object.fromEntries(Object.keys(eNt).map(I=>[I,A]))}).ncui,a,p)))}var bPr=(s,a)=>new RegExp(`^${s.split("*").map(p=>p.replace(/[.+?^${}()|[\]\\]/g,"\\$&")).join(".*")}$`).test(a),_3n=/^\d+(\.\d+)?%$/,lrn=["left","right","center"],m3n=[...lrn,"full"],xPr=/^(fixed|max) \d+(\.\d+)?(%|px)$/;function h3n(s,a,p){if(!p)return[];let g=W=>W==="fit"||W==="fill"||_3n.test(W)||a==="column"&&xPr.test(W),E=a==="column"?'a share like "50%", fill, fit, fixed like "fixed 20%" or max like "max 300px"':'a share like "50%", fill or fit',A=p.filter(W=>!g(W)).map(W=>`${s} ${a} size "${W}" is not ${E}`),I=p.filter(W=>_3n.test(W)),L=I.reduce((W,$)=>W+parseFloat($),0);return p.includes("fill")?L>99.5&&A.push(`${s} ${a} shares add up to ${L}%, leaving nothing for fill`):I.length>0&&Math.abs(L-100)>.5&&A.push(`${s} ${a} shares add up to ${L}%, not 100%`),A}function SPr(s,a,p){if(!s)return[];let g=s.regions??[],E=new Set(g.map(I=>I.name)),A=[];!s.layouts?.portrait&&!s.layouts?.landscape&&A.push("dashboard has no portrait or landscape layout, so the built-in one shows");for(let I of g)p&&I.component&&!p.includes(I.component)&&A.push(`region "${I.name}" component "${I.component}" is contributed by no plugin in the workspace, so the region shows its built-in cards`),I.justify!==void 0&&!m3n.includes(I.justify)&&A.push(`region "${I.name}" justify "${I.justify}" is not ${m3n.join(", ")}`);for(let[I,L]of Object.entries(s.layouts??{})){L?.justify!==void 0&&!lrn.includes(L.justify)&&A.push(`${I} justify "${L.justify}" is not ${lrn.join(", ")}`),A.push(...h3n(I,"column",L?.columns),...h3n(I,"row",L?.rows));let W=new Set((L?.areas??[]).flatMap(X=>X.trim().split(/\s+/)).filter(X=>!/^\.+$/.test(X)));for(let X of W)E.has(X)||A.push(`${I} area "${X}" is not a dashboard region`);let $=g.filter(X=>W.has(X.name));for(let X of a)$.some(H=>(H.summaries??[]).some(ue=>bPr(ue,X)))||A.push(`dashboard summary "${X}" is in no ${I} region, so it does not show`)}return A}function y3n(s,a,p){return o8e(s).flatMap(({name:g,kosJsonPath:E})=>SPr(JSON.parse(s.read(E)).kondra?.ncui?.dashboard,a,p).map(A=>({project:g,problem:A})))}var v3n=s=>s.component??s.name;function qjt(s,a){let p=o8e(s);return(p.length?p.map(({kosJsonPath:E})=>JSON.parse(s.read(E)).kondra?.ncui?.dashboard):Rtt.map(E=>Ott({layout:E}).ncui.dashboard)).some(E=>(E?.regions??[]).some(A=>v3n(A)===a))}function b3n(s,{project:a,key:p}){let{name:g,kosJsonPath:E}=g3n(s,a),A=s.read(E),I=JSON.parse(A),L=(I.kondra??={}).ncui??={},W=[];L.dashboard||(L.dashboard=Ott({layout:"standard"}).ncui.dashboard,W.push(`${g} had no dashboard; it now has the built-in standard one.`));let $=L.dashboard.regions??=[];if($.some(ee=>v3n(ee)===p))return`${g} already has a dashboard region rendered by "${p}".`;if($.some(ee=>ee.name===p))throw new Error(`${g} has a dashboard region named "${p}" with another component; choose another regionKey`);$.push({name:p});for(let ee of Object.values(L.dashboard.layouts??{})){let H=Math.max(1,...(ee.areas??[]).map(ue=>ue.trim().split(/\s+/).length));(ee.areas??=[]).push(Array(H).fill(p).join(" ")),ee.rows&&ee.rows.push("fit")}s.write(E,Mtt(A,I));let X=tNt(I);return s.write(X.path,X.content),[...W,`Added dashboard region "${p}" to ${g} as the full-width last row of each layout; it claims no holders or summaries, so the component reads the assembly. Move it in kondra.ncui.dashboard.layouts, or give it holders and summaries patterns.`].join(" ")}var TPr=[["utilities","utility","utilDescriptor"],["setupStep","setup","setupDescriptor"],["navViews","nav","navDescriptor"]];function x3n(s,{project:a,descriptorProject:p}){let g=Nge(s.root,a)?.root,E=g&&s.read(urn.join(g,".kos.json"));if(!E)throw new Error(`No plugin project "${a}" with a .kos.json`);let A=JSON.parse(E).kos?.ui?.plugin?.contributes??{},I=[];for(let[L,W,$]of TPr)for(let X of A[L]??[])if(X[$])try{I.push(drn(s,W,{project:p,slot:X[$]}))}catch(ee){I.push(`${X.id}: ${ee.message}`)}return{label:"DDK descriptor entries",notes:I.length?I:[`${a} contributes no utility, setup step or navigation slot.`]}}var S3n={cui:{pluginType:"ddk.cui",label:"DDK CUI Configuration",required:"cuiDescriptor",description:"Create a CUI configuration; --descriptor is the CUI's appId from /api/app/kosdev.ddk/cui"},setup:{pluginType:"ddk.setup",label:"DDK Setup Step",overridable:"setupDescriptor",listedIn:"kondra.ncui.setup.steps",descriptorType:"setup",description:"Create a setup step; --descriptor is its kondra.ncui.setup.steps entry (default: from the name)"},utility:{pluginType:"ddk.utility",label:"DDK Utility",overridable:"utilDescriptor",listedIn:"kondra.ncui.utilities",descriptorType:"utility",layouts:["maximized","fullscreen"],description:"Create a utility in a modal; --layout maximized (default) or fullscreen; --descriptor is its kondra.ncui.utilities entry (default: from the name)"},nav:{pluginType:"ddk.nav",label:"DDK Navigation View",overridable:"navDescriptor",listedIn:"kondra.ncui.navigations",descriptorType:"nav",slotRequired:!0,description:"Create a navigation view; --descriptor is its kondra.ncui.navigations entry, e.g. settings.water for a Settings tab"}},EPr={"ddk.cui":{proceed:"Proceed"},"ddk.setup":{proceed:"Proceed"},"ddk.utility":{back:"Back",close:"Close",done:"Done"},"ddk.dashboardDetail":{close:"Close"},"ddk.troubleAction":{resolve:"Resolve"}};function DPr(s,a,p){let g=EPr[a],E=Nge(s.root,p)?.sourceRoot;if(!g||!E)return;let A=$jt.join(E,"assets","locales","en",`${p}.json`);s.exists(A)&&Gjt(s,A,I=>({...g,...I}))}function Ftt(s,a,p){let g=Nge(s.root,a)?.root,E=g&&s.read($jt.join(g,".kos.json"));if(!E)return;let A=JSON.parse(E).kos?.ui?.plugin?.contributes?.experiences??{},I=k9e({name:p}).namePascalCase,L=Object.values(A).find(W=>[I,`${I}Summary`,`${I}Detail`].includes(W.component));if(L)throw new Error(`${a} already has a component ${L.component} (${L.location}); components are exposed by name, so choose another --name (kosui ddk:descriptor-entries lists an existing contribution's slot in a descriptor project)`)}function Btt(s,a){let p=k9e({name:a}).namePascalCase,g=[];for(let E of QIt(s.root).values()){let A=s.read($jt.join(E.root,".kos.json"));if(!A)continue;let I;try{I=JSON.parse(A).models}catch{continue}for(let[L,W]of Object.entries(I??{})){let $=W?.factory??k9e({name:L}).namePascalCase;$===p&&g.push(`WARNING: component ${p} has the same name as model ${L}'s registration bean ${$} (${E.name}). Choose another name, e.g. ${a}-config (${p}Config), before writing.`)}}return g}function s8e(s,a,{name:p,project:g,...E}){d3n();let A=Nge(s.root,g)?.root,I=A&&$jt.join(A,".kos.json"),L=I&&s.read(I);l3n(s,ZIt,{name:p,appProject:g,type:"components",pluginType:a,useEmotionCss:!1,appDirectory:"",modelDirectory:"",...E});let W=L&&s.read(I);W&&W!==L&&s.write(I,Mtt(L,JSON.parse(W))),DPr(s,a,g)}function Ltt(s,a){if(!s)throw new Error(`${a} is required`)}var jtt=s=>s===void 0?{}:{rank:s};function T3n(s,{type:a,name:p,project:g,descriptor:E,override:A,rank:I,descriptorProject:L,roles:W,column:$,layout:X}){let ee=S3n[a];if(!ee)throw new Error(`Unknown contribution type "${a}". Choose from ${Object.keys(S3n).join(", ")}.`);let H=A||I!==void 0&&I!=="";if(!ee.overridable&&H)throw new Error(`${a} contributions are not ranked; --override and --rank do not apply`);if(ee.required&&Ltt(E,`descriptor (${ee.required})`),X&&!ee.layouts)throw new Error(`${a} contributions have no layout; --layout does not apply`);if(X&&!ee.layouts.includes(X))throw new Error(`Unknown layout "${X}". Choose from ${ee.layouts.join(", ")}.`);let ue=ee.overridable?Ptt(a,{override:A,rank:I,explicit:{[ee.overridable]:E}}):{fields:{},notes:[]},Q=ue.fields[ee.overridable]??E;if(ee.slotRequired&&!Q&&Ltt(Q,`descriptor (${ee.overridable}, a kondra.ncui.navigations path such as settings.water)`),Ftt(s,g,p),L&&A)throw new Error("--override fills a slot the descriptor already lists; --descriptorProject does not apply");let ae=ee.listedIn&&!Q?[`${ee.overridable} "${k9e({name:p}).nameCamelCase}" comes from the name (--descriptor sets it).`]:[];s8e(s,ee.pluginType,{name:p,project:g,...Q?{descriptor:Q}:{},...jtt(ue.rank),...ee.layouts?{layout:X||ee.layouts[0]}:{}});let Me=ee.descriptorType?CPr(s,ee,{slot:Q||k9e({name:p}).nameCamelCase,override:A,descriptorProject:L,roles:W,column:$}):[];return{label:ee.label,notes:[...Btt(s,p),...ue.notes,...ae,...Me]}}function CPr(s,a,{slot:p,override:g,descriptorProject:E,roles:A,column:I}){if(g)return[];if(E)return[drn(s,a.descriptorType,{project:E,slot:p,roles:A,column:I})];if(Hjt(s,a.descriptorType,p))return[];let W=o8e(s).map($=>$.name);return[W.length?`No descriptor project lists ${a.overridable} "${p}"; add it with --descriptorProject ${W[0]}.`:`The NCUI shows "${p}" only if its descriptor (${a.listedIn}) lists it: create a descriptor project with kosui ddk:descriptor-project and pass --descriptorProject, or the system app's descriptor must list it.`]}function E3n(s,{name:a,project:p,dashboardKey:g,detail:E=!0,override:A,rank:I}){Ftt(s,p,a);let L=Ptt("dashboard-card",{override:A,rank:I,explicit:{dashboardKey:g}}),W=L.fields.dashboardKey??g;Ltt(W,"dashboardKey");let $={name:a,project:p,dashboardKey:W,...jtt(L.rank)};return s8e(s,"ddk.dashboardSummary",$),E&&s8e(s,"ddk.dashboardDetail",$),{label:E?"DDK Dashboard Card":"DDK Dashboard Summary",notes:[...Btt(s,a),`The dashboard draws one card per active model at assembly.${W} (or the FreestyleAssembly companion's ${W}); no such model, no card.`,...E?["The detail opens when a technician selects the card."]:[],...L.notes,...Vnn("dashboard-card",{override:A,rank:L.rank,slot:{dashboardKey:W},written:E?["dashboardSummary","dashboardDetail"]:["dashboardSummary"]})]}}function D3n(s,{name:a,project:p,dashboardKey:g,override:E,rank:A}){Ftt(s,p,a);let I=Ptt("pump-detail",{override:E,rank:A,explicit:{dashboardKey:g}}),L=I.fields.dashboardKey??g;return Ltt(L,"dashboardKey"),s8e(s,"ddk.pumpDetail",{name:a,project:p,dashboardKey:L,...jtt(I.rank)}),{label:"DDK Pump Detail",notes:[...Btt(s,a),`Shown in the holder modal for holders with dashboard key "${L}" (default: its first pump's type; a holder with several keys uses the first one that has a pump detail), unless the holder has its own content.`,...I.notes]}}function C3n(s,{name:a,project:p,dashboardKey:g,detail:E=!0,override:A,rank:I}){Ftt(s,p,a);let L=Ptt("pump-card",{override:A,rank:I,explicit:{dashboardKey:g}}),W=L.fields.dashboardKey??g;Ltt(W,"dashboardKey");let $={name:a,project:p,dashboardKey:W,...jtt(L.rank)};return s8e(s,"ddk.pumpSummary",$),E&&s8e(s,"ddk.pumpDetail",$),{label:E?"DDK Pump Card":"DDK Pump Summary",notes:[...Btt(s,a),`Used for holders with dashboard key "${W}" (default: the holder's first pump type, which the backend assembly assigns; a holder with several keys uses the first one that has a contribution); other holders keep the default card body.`,...E?["The detail shows in the holder modal a technician opens from the card."]:[],...L.notes,...Vnn("pump-card",{override:A,rank:L.rank,slot:{dashboardKey:W},written:E?["dashboardPumpSummary","dashboardPumpDetail"]:["dashboardPumpSummary"]})]}}function A3n(s,{name:a,project:p,dashboardKey:g,override:E,rank:A}){Ftt(s,p,a);let I=Ptt("macro-summary",{override:E,rank:A,explicit:{dashboardKey:g}}),L=I.fields.dashboardKey??g;return Ltt(L,"dashboardKey"),s8e(s,"ddk.macroSummary",{name:a,project:p,dashboardKey:L,...jtt(I.rank)}),{label:"DDK Macro Summary",notes:[...Btt(s,a),`Matched to a macro holder by holder.name "${L}" first, then by the dashboard key factory.`,...I.notes]}}function P3n(s,{name:a,project:p,regionKey:g,rank:E,descriptorProject:A}){Ftt(s,p,a);let I=g||k9e({name:a}).nameCamelCase;s8e(s,"ddk.dashboardRegion",{name:a,project:p,regionKey:I,claimsNothing:!!A,...jtt(Gnn(E))});let L=g?[]:[`regionKey "${I}" comes from the name (--regionKey sets it).`],W;if(A)W=b3n(s,{project:A,key:I});else if(qjt(s,I))W=`Renders the dashboard region "${I}" in place of its built-in cards.`;else{let $=o8e(s).map(X=>X.name);W=$.length?`No dashboard region in a descriptor project is rendered by "${I}"; add one with --descriptorProject ${$[0]}, or set a region's component to "${I}".`:`The dashboard shows "${I}" only if its descriptor (kondra.ncui.dashboard) has a region named "${I}" or with component "${I}": create a descriptor project with kosui ddk:descriptor-project and pass --descriptorProject.`}return{label:"DDK Dashboard Region",notes:[...Btt(s,a),...L,W]}}function k3n(s,{name:a,project:p,troubleType:g,stateKey:E,stateValue:A,override:I,rank:L}){Ftt(s,p,a);let W=Ptt("trouble-action",{override:I,rank:L,explicit:{troubleType:g,stateKey:E,stateValue:A}}),$=W.fields.troubleType??g;return Ltt($,"troubleType"),s8e(s,"ddk.troubleAction",{name:a,project:p,troubleType:$,stateKey:W.fields.stateKey??(E||$),stateValue:W.fields.stateValue??(A||$),...jtt(W.rank)}),{label:"DDK Trouble Action",notes:[...Btt(s,a),`troubleType "${$}" must be the exact type the device raises; the experience shows while one is active and goes away once it is resolved.`,...W.notes]}}import{spawnSync as APr}from"node:child_process";import kme from"node:fs";import AX from"node:path";var PPr="~3.1.0",I3n="kosdev.ddk",kPr=["@kosdev-code/kos-ddk","@kosdev-code/kos-ddk-components","@kosdev-code/kos-ddk-model-components","@kosdev-code/kos-ddk-models","@kosdev-code/kos-ddk-styles","@kosdev-code/kos-ddk-story-containers"],wPr={cui:[],utilities:[]},nNt=s=>JSON.parse(kme.readFileSync(s,"utf-8")),prn=(s,a)=>kme.writeFileSync(s,JSON.stringify(a,null,2)+`
|
|
48558
48558
|
`);function N3n(s){let a=AX.join(ZIt,`${s}-project`);return kme.readdirSync(a,{recursive:!0,withFileTypes:!0}).filter(p=>p.isFile()).map(p=>AX.relative(a,AX.join(p.parentPath,p.name)).replace(/\.template$/,"")).sort()}function R3n(s,a){let p=AX.join(ZIt,`${s}-project`);for(let g of N3n(s)){let E=AX.join(a,g);kme.mkdirSync(AX.dirname(E),{recursive:!0}),kme.copyFileSync(AX.join(p,`${g}.template`),E)}}function IPr(s,a){R3n("plugin",a);let p=AX.join(a,".kos.json"),g=nNt(p),E=g.kos.ui.plugin;E.contributes={...wPr,...E.contributes},g.test={...g.test,plugin:{...g.test?.plugin,context:I3n}},prn(p,g);let A=AX.join(s,"package.json"),I=nNt(A),L={...I.dependencies,...I.devDependencies},W=kPr.filter($=>!L[$]);if(W.length){I.dependencies={...I.dependencies};for(let $ of W)I.dependencies[$]=PPr;prn(A,I)}}function NPr(s,a){R3n("theme",a),kme.rmSync(AX.join(a,"theme","assets",".gitkeep"),{force:!0})}function RPr(s,a,{ncui:p}={}){let g=AX.join(a,".kos.json"),E=nNt(g);E.type=Vjt,E.kondra=Ott(p),prn(g,E);let A=tNt(E),I=AX.join(s,A.path);kme.mkdirSync(AX.dirname(I),{recursive:!0}),kme.writeFileSync(I,A.content)}var O3n={plugin:{generator:"@kosdev-code/kos-nx-plugin:kos-plugin-project",uiType:"ddk.ncui.plugin",overlay:IPr},theme:{generator:"@kosdev-code/kos-nx-plugin:kos-theme-project",uiType:"ddk.ncui.theme",overlay:NPr},descriptor:{generator:"@kosdev-code/kos-nx-plugin:kos-content-project",overlay:RPr}};function OPr(s,a,p,g={}){O3n[s].overlay(a,p,g)}function w3n(s){let a=nNt(AX.join(s,"package.json"));return{...a.dependencies,...a.devDependencies}}var M3n=s=>AX.join(s,".kos.json");function MPr(s){let a=M3n(s);return kme.existsSync(a)?nNt(a).development?.hosts??[]:[]}function LPr(s,a){return a||MPr(s).find(p=>p.pluginContext===I3n)?.name}function FPr(s,a){let p=M3n(s);if(!kme.existsSync(p))return;let g=kme.readFileSync(p,"utf-8"),E=JSON.parse(g),A=!1;for(let I of E.development?.hosts??[]){let L=(I.plugins??[]).filter(W=>W.project!==a);L.length!==(I.plugins??[]).length&&(I.plugins=L,A=!0)}A&&kme.writeFileSync(p,Mtt(g,E))}function L3n(s,{workspaceRoot:a,name:p,directory:g,host:E,ncui:A={},dryRun:I=!1,stdio:L="pipe"}){let W=O3n[s];s==="descriptor"&&Ott(A);let $=w3n(a),X=s==="plugin"?LPr(a,E):void 0,ee=APr("npx",["nx","generate",W.generator,`--name=${p}`,...W.uiType?[`--uiType=${W.uiType}`]:[],...g?[`--directory=${g}`]:[],...X?[`--host=${X}`]:[],"--no-interactive",...I?["--dry-run"]:[]],{cwd:a,encoding:"utf-8",stdio:L,shell:process.platform==="win32"}),H=ee.stdout?.trim()??"",ue=I&&/does not support --dry-run/.test(H+(ee.stderr??""));if(ee.status!==0&&!ue)throw new Error(`nx generate exited with ${ee.status}
|
|
48559
48559
|
${[ee.stderr,H].filter(Boolean).join(`
|
|
48560
48560
|
`)}`);if(I)return{output:ue?`${W.generator} creates project ${p}; it installs a missing Nx plugin on write, so Nx cannot list its files in a dry run.`:H,ddkFiles:s==="descriptor"?[`.kos.json: type ${Vjt}, kondra.ncui for the ${A.layout??"standard"} layout`,tNt({name:p}).path+": KosMock setup serving the descriptor"]:N3n(s)};let Q=Nge(a,p);if(!Q)throw new Error(`nx generate did not create project ${p}`);s==="plugin"&&!X&&FPr(a,p),OPr(s,a,AX.join(a,Q.root),{ncui:A});let ae=AX.join(a,"node_modules"),Me=Object.keys(w3n(a)).filter(Fe=>!$[Fe]&&!kme.existsSync(AX.join(ae,Fe)));return{output:H,root:Q.root,toInstall:Me}}import{existsSync as mrn,readFileSync as Jjt,readdirSync as GPr}from"node:fs";import c8e from"node:path";import{existsSync as F3n,readFileSync as BPr,readdirSync as jPr}from"node:fs";import MSe from"node:path";var WPr="ddk.ncui.plugin",zPr=new Set(["node_modules","dist","tmp",".git",".nx"]),WUr=process.env.DEV_LOG_DIR||"/tmp/kos-dev-logs";var frn=s=>JSON.parse(BPr(s,"utf-8"));function B3n(s,a){for(let p of jPr(s,{withFileTypes:!0}))p.isDirectory()&&!zPr.has(p.name)?B3n(MSe.join(s,p.name),a):p.name===".kos.json"&&s!==a.root&&a.files.push(MSe.join(s,p.name));return a.files}function _rn(s){let a=F3n(MSe.join(s,".kos.json"))?frn(MSe.join(s,".kos.json")):{},p=new Map((a.development?.hosts??[]).flatMap(g=>g.plugins??[]).map(g=>[g.project,g.alias]));return B3n(s,{root:s,files:[]}).filter(g=>frn(g).type===WPr).map(g=>{let E=MSe.join(MSe.dirname(g),"project.json"),A=F3n(E)?frn(E):{},I=A.name??MSe.basename(MSe.dirname(g));return{project:I,dir:MSe.relative(s,MSe.dirname(g)).split(MSe.sep).join("/"),alias:p.get(I),port:A.targets?.serve?.options?.port}}).sort((g,E)=>g.project.localeCompare(E.project))}var j3n=s=>JSON.parse(Jjt(s,"utf-8")),UPr=Object.fromEntries(Object.values(C9e).flatMap(({contributionKeys:s,keys:a})=>s.map(p=>[p,a])));function W3n(s,a){let p=_rn(s),g=p.find(I=>I.project===a||I.alias===a);if(!g)throw new Error(`No DDK plugin project "${a}". DDK plugin projects: ${p.map(I=>I.project).join(", ")||"none"}.`);let E=c8e.join(s,g.dir),A=j3n(c8e.join(E,".kos.json"));return{...g,absDir:E,block:A.kos?.ui?.plugin??{}}}var VPr=(s,a)=>Object.fromEntries((UPr[s]??[]).filter(p=>a[p]!==void 0).map(p=>[p,a[p]])),HPr=(s,a)=>{let p=Object.keys(s);return p.length>0&&p.length===Object.keys(a).length&&p.every(g=>s[g]===a[g])},qPr=(s,a)=>typeof s=="number"&&(typeof a!="number"||s<a);function hrn(s,a){let p=W3n(s,a),{extensionPoints:g}=ktt(),E=Qdt(Zdt()),A=p.block.contributes??{},I=A.experiences??{},L=[];for(let[W,$]of Object.entries(A)){if(!Array.isArray($))continue;let X=g.find(ee=>ee.contributionKey===W);for(let ee of $){let H=VPr(W,ee),ue=E.filter(ae=>ae.plugin!==p.project&&ae.contributionKey===W&&HPr(H,ae.keys)),Q=I[ee.experienceId];L.push({contributionKey:W,...X?{extensionPoint:X.id}:{},id:ee.id,...Object.keys(H).length?{slot:H}:{},...typeof ee.rank=="number"?{rank:ee.rank}:{},...Q?{component:Q.component,location:Q.location}:{},...ue.length?{sharesSlotWith:ue.map(ae=>({id:ae.id,...typeof ae.rank=="number"?{rank:ae.rank}:{},wins:qPr(ee.rank,ae.rank)}))}:{}})}}return{project:p.project,dir:p.dir,pluginId:p.block.id,contributions:L}}function z3n(s){return mrn(s)?GPr(s,{withFileTypes:!0}).flatMap(a=>{let p=c8e.join(s,a.name);return a.isDirectory()?a.name==="node_modules"?[]:z3n(p):/\.(tsx?|css)$/.test(a.name)?[p]:[]}):[]}var $Pr=(s,a)=>/export\s+default\b/.test(s)||new RegExp(`export\\s+(const|let|function|class)\\s+${a}\\b`).test(s)||new RegExp(`export\\s*\\{[^}]*\\b${a}\\b[^}]*\\}`).test(s);function JPr(s,a){return a===void 0||a===""?s.required?`missing required ${s.name}`:null:s.type.startsWith('"')?s.type.split(" | ").map(g=>JSON.parse(g)).includes(a)?null:`${s.name} must be ${s.type}`:["string","number","boolean"].includes(s.type)&&typeof a!==s.type?`${s.name} must be a ${s.type}`:null}function G3n(s,a){let p=W3n(s,a),{extensionPoints:g}=ktt(),E=hrn(s,a),A=p.block.contributes??{},I=A.experiences??{},L=[],W=[],$=new Map;for(let[Me,Fe]of Object.entries(A)){if(!Array.isArray(Fe))continue;let ke=g.find(Ie=>Ie.contributionKey===Me);for(let Ie of Fe){let Ee=`contributes.${Me} ${Ie.id??"(no id)"}`;Ie.id?$.has(Ie.id)?L.push(`${Ee}: id also used in contributes.${$.get(Ie.id)}`):$.set(Ie.id,Me):L.push(`${Ee}: missing id`);for(let Ge of ke?.fields??[]){if(Ge.name==="rank")continue;let Le=JPr(Ge,Ie[Ge.name]);Le&&L.push(`${Ee}: ${Le} (${ke.id})`)}if(Ie.rank!==void 0&&(!Number.isInteger(Ie.rank)||Ie.rank<0||Ie.rank>KIt?L.push(`${Ee}: rank must be an integer from 0 to ${KIt}`):ke&&!ke.isRankable&&W.push(`${Ee}: ${ke.id} is not ranked, so rank has no effect`)),Ie.experienceId!==void 0||ke?.hasView){let Ge=I[Ie.experienceId];if(!Ge)L.push(`${Ee}: experience ${Ie.experienceId??"(none)"} is not in contributes.experiences`);else{let Le=c8e.join(p.absDir,Ge.location??"");!Ge.location||!mrn(Le)?L.push(`${Ee}: component file ${Ge.location} does not exist`):Ge.component&&!$Pr(Jjt(Le,"utf-8"),Ge.component)&&L.push(`${Ee}: ${Ge.location} has no default export and does not export ${Ge.component}`)}}}}let X={root:s,read:Me=>{let Fe=c8e.join(s,Me);return mrn(Fe)?Jjt(Fe,"utf-8"):null}},ee=o8e(X).map(Me=>Me.name);for(let[Me,Fe,ke]of[["utilities","utility","utilDescriptor"],["setupStep","setup","setupDescriptor"],["navViews","nav","navDescriptor"]])for(let Ie of A[Me]??[]){let Ee=Ie[ke];!Ee||Hjt(X,Fe,Ee)||W.push(`contributes.${Me} ${Ie.id}: ${ke} "${Ee}" is not in ${ee.length?`descriptor project ${ee.join(", ")}`:"the standard NCUI descriptor (no descriptor project in the workspace)"}, so the NCUI does not show it${ee.length?`; list it with kosui ddk:descriptor-entries --project ${a} --descriptorProject ${ee[0]}`:""}`)}for(let Me of A.dashboardRegion??[])!Me.regionKey||qjt(X,Me.regionKey)||W.push(`contributes.dashboardRegion ${Me.id}: regionKey "${Me.regionKey}" is no region's component or name in ${ee.length?`descriptor project ${ee.join(", ")}`:"the built-in dashboard layout (no descriptor project in the workspace)"}, so the dashboard does not show it${ee.length?`; add it with kosui ddk:dashboard-region --descriptorProject ${ee[0]}`:""}`);let H=(A.dashboardSummary??[]).map(Me=>Me.dashboardKey).filter(Boolean),ue=_rn(s).flatMap(({dir:Me})=>(j3n(c8e.join(s,Me,".kos.json")).kos?.ui?.plugin?.contributes?.dashboardRegion??[]).map(Fe=>Fe.regionKey));for(let{project:Me,problem:Fe}of y3n(X,H,ue))W.push(`descriptor project ${Me}: ${Fe}`);let Q=new Map;for(let Me of E.contributions.filter(Fe=>Fe.slot)){let Fe=`${Me.contributionKey} ${JSON.stringify(Me.slot)}`,ke=Q.get(Fe);if(ke&&ke.rank===Me.rank&&W.push(`contributes.${Me.contributionKey} ${Me.id}: same slot and rank as ${ke.id}; which renders is not defined`),Q.set(Fe,Me),!Att().sources.includes(p.project))for(let Ie of Me.sharesSlotWith??[])Ie.wins||W.push(`contributes.${Me.contributionKey} ${Me.id}: shares a slot with ${Ie.id} (${typeof Ie.rank=="number"?`rank ${Ie.rank}`:"unranked"}) without a winning rank, so it does not replace it`)}let ae=c8e.join(p.absDir,"src");for(let Me of z3n(ae)){let Fe=Jjt(Me,"utf-8"),ke=c8e.relative(p.absDir,Me).split(c8e.sep).join("/"),Ie=[...new Set([...Fe.matchAll(/(--ddk-[\w-]+)\s*:/g)].map(Ee=>Ee[1]))];Ie.length&&L.push(`${ke}: sets DDK tokens (${Ie.join(", ")}); plugins compose DDK components and do not set tokens`)}return{project:p.project,ok:L.length===0,errors:L,warnings:W}}var KPr={type:"string",description:"Component name in kebab-case, e.g. fuel-level."},Xjt={type:"string",description:"DDK plugin project to write into."},brn={type:"boolean",description:"Default true: return the would-write files. false writes."},ept={type:"string",description:"Id of a standard contribution to replace (from list_ddk_contributions). Takes its slot with a winning rank."},tpt={type:"integer",description:"0-1000; lower wins. Default with override: 100, or one better than a ranked target."},grn={type:"string",description:"Assembly property whose models get the contribution, e.g. carbTank. Taken from override when given."},Wtt={name:KPr,project:Xjt,dryRun:brn,...Ydt};async function I9e(s,a){try{let p=JIt(s),g=await J7n({dryRun:s.dryRun!==!1,cwd:p,generate:a});return n8e(g.dryRun?{...g,hint:"Re-run with dryRun:false to write."}:g)}catch(p){return IAe(p.message)}}function Kjt(s,a,p,g={},E=[]){return{name:s,description:p,inputSchema:{type:"object",properties:{...Wtt,...g},required:["name","project",...E]},handler:A=>I9e(A,I=>T3n(I,{type:a,name:A.name,project:A.project,descriptor:A.descriptor,override:A.override,rank:A.rank,descriptorProject:A.descriptorProject,roles:A.roles,column:A.column,layout:A.layout}))}}var yrn=(s,a,p={})=>({descriptor:{type:"string",description:`${s}; shown only if the NCUI descriptor lists it (${a}). Default: from the name.`},descriptorProject:{type:"string",description:"NCUI descriptor project to list a new slot in (scaffold_ddk_descriptor_project)."},roles:{type:"string",description:"With descriptorProject: comma-separated roles that see it."},...p,override:ept,rank:tpt});function vrn(s,a,p){return{name:s,description:p,inputSchema:{type:"object",properties:{name:{type:"string",description:`${{plugin:"Plugin",theme:"Theme",descriptor:"Descriptor"}[a]} project name in kebab-case.`},...a==="descriptor"?{layout:{type:"string",enum:Rtt,description:"NCUI layout. Default: standard."},...Object.fromEntries(Object.entries(eNt).map(([g,E])=>[g,{type:"boolean",description:`Include ${E}.`}]))}:{},...a==="plugin"?{directory:{type:"string",description:"Parent folder of the project. Default: plugins."},host:{type:"string",description:"Workspace host to register with. Default: the host with the kosdev.ddk plugin context, else none."}}:{},dryRun:brn,...Ydt},required:["name"]},handler:async g=>{try{let E=g.dryRun!==!1,A=L3n(a,{workspaceRoot:JIt(g),name:g.name,directory:g.directory,host:g.host,ncui:{layout:g.layout,...Object.fromEntries(Object.keys(eNt).map(I=>[I,!!g[I]]))},dryRun:E});return n8e({dryRun:E,...A})}catch(E){return IAe(E.message)}}}}var U3n=[vrn("scaffold_ddk_plugin_project","plugin","Create a DDK plugin project: module federation serve target, DDK Storybook, .kos.json. dryRun lists the files."),vrn("scaffold_ddk_theme_project","theme","Create a DDK theme project; its theme-overlay.css overrides the DDK tokens. dryRun lists the files."),vrn("scaffold_ddk_descriptor_project","descriptor","Create an NCUI descriptor project (ddk.ncui.descriptor KAB) for a layout and options; list new utility, setup or nav slots in it. dryRun lists the files."),Kjt("add_utility","utility","Add a utility (utilities contribution) with its component, story and i18n title. The component renders in a modal through useUtilityModal.",yrn("utilDescriptor","kondra.ncui.utilities",{column:{type:"integer",description:"With descriptorProject: utilities column, 1-based. Default: the last."},layout:{type:"string",enum:["maximized","fullscreen"],description:"The utility's modal: maximized (default, a modal over the shell) or fullscreen (covers the display)."}})),Kjt("add_setup_step","setup","Add a setup step (setupStep contribution) with its component, story and i18n title.",yrn("setupDescriptor","kondra.ncui.setup.steps")),Kjt("add_nav_view","nav","Add a navigation view (navViews contribution) with its component, story and i18n title.",yrn("navDescriptor","kondra.ncui.navigations",{descriptor:{type:"string",description:"navDescriptor, a kondra.ncui.navigations path such as settings.water. Required unless override."}})),Kjt("add_cui_config","cui","Add a CUI configuration (cui contribution) with its component and story.",{descriptor:{type:"string",description:"cuiDescriptor: the CUI's appId from /api/app/kosdev.ddk/cui."}},["descriptor"]),{name:"add_dashboard_card",description:"Add a dashboard summary card and, by default, the detail it opens; both share dashboardKey and rank.",inputSchema:{type:"object",properties:{...Wtt,dashboardKey:grn,detail:{type:"boolean",description:"Also add the detail the card opens. Default true."},override:ept,rank:tpt},required:["name","project"]},handler:s=>I9e(s,a=>E3n(a,{name:s.name,project:s.project,dashboardKey:s.dashboardKey,detail:s.detail!==!1,override:s.override,rank:s.rank}))},{name:"add_pump_detail",description:"Add the pump detail shown in the holder modal for holders with dashboardKey.",inputSchema:{type:"object",properties:{...Wtt,dashboardKey:grn,override:ept,rank:tpt},required:["name","project"]},handler:s=>I9e(s,a=>D3n(a,{name:s.name,project:s.project,dashboardKey:s.dashboardKey,override:s.override,rank:s.rank}))},{name:"add_pump_card",description:"Add a pump card for a pump type: the holder card body and, by default, the pump detail; both share dashboardKey and rank.",inputSchema:{type:"object",properties:{...Wtt,dashboardKey:{type:"string",description:"The pump type the backend assembly assigns (the holder's first pump), e.g. cgp. Taken from override when given."},detail:{type:"boolean",description:"Also add the pump detail. Default true."},override:ept,rank:tpt},required:["name","project"]},handler:s=>I9e(s,a=>C3n(a,{name:s.name,project:s.project,dashboardKey:s.dashboardKey,detail:s.detail!==!1,override:s.override,rank:s.rank}))},{name:"add_macro_summary",description:"Add the macro holder card body for dashboardKey.",inputSchema:{type:"object",properties:{...Wtt,dashboardKey:grn,override:ept,rank:tpt},required:["name","project"]},handler:s=>I9e(s,a=>A3n(a,{name:s.name,project:s.project,dashboardKey:s.dashboardKey,override:s.override,rank:s.rank}))},{name:"add_dashboard_region",description:"Add a component that renders a whole dashboard region in place of its built-in cards: the descriptor region whose component (else name) is regionKey. A built-in region name such as macros replaces that region's cards.",inputSchema:{type:"object",properties:{...Wtt,regionKey:{type:"string",description:"The descriptor region's component, else its name. Default: from the name."},descriptorProject:{type:"string",description:"NCUI descriptor project to add the region to, as a full-width last row claiming no holders or summaries (scaffold_ddk_descriptor_project)."},rank:{type:"integer",description:"0-1000; lower wins among plugins rendering the same region."}},required:["name","project"]},handler:s=>I9e(s,a=>P3n(a,{name:s.name,project:s.project,regionKey:s.regionKey,rank:s.rank,descriptorProject:s.descriptorProject}))},{name:"add_trouble_action",description:"Add the experience shown while the device has an active trouble of troubleType.",inputSchema:{type:"object",properties:{...Wtt,troubleType:{type:"string",description:"Exact trouble type the device raises. Taken from override when given."},stateKey:{type:"string",description:"Contributions sharing a stateKey share one experience. Default: troubleType."},stateValue:{type:"string",description:"Default: troubleType."},override:ept,rank:tpt},required:["name","project"]},handler:s=>I9e(s,a=>k3n(a,{name:s.name,project:s.project,troubleType:s.troubleType,stateKey:s.stateKey,stateValue:s.stateValue,override:s.override,rank:s.rank}))},{name:"describe_ddk_plugin",description:"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.",inputSchema:{type:"object",properties:{project:Xjt,...Ydt},required:["project"]},handler:async s=>{try{return n8e(hrn(JIt(s),s.project))}catch(a){return IAe(a.message)}}},{name:"add_descriptor_entries",description:"List a plugin's existing utility, setup step and navigation slots in an NCUI descriptor project.",inputSchema:{type:"object",properties:{project:Xjt,descriptorProject:{type:"string",description:"NCUI descriptor project to list them in."},dryRun:brn,...Ydt},required:["project","descriptorProject"]},handler:s=>I9e(s,a=>x3n(a,{project:s.project,descriptorProject:s.descriptorProject}))},{name:"validate_ddk_plugin",description:"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.",inputSchema:{type:"object",properties:{project:Xjt,...Ydt},required:["project"]},handler:async s=>{try{return n8e(G3n(JIt(s),s.project))}catch(a){return IAe(a.message)}}},{name:"find_ddk_capability",description:"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.",inputSchema:{type:"object",properties:{need:{type:"string",description:"What the plugin should do."}},required:["need"]},handler:async s=>{try{return n8e(n3n(s.need))}catch(a){return IAe(a.message)}}},{name:"list_ddk_components",description:"List the DDK components and styled parts plugins render, by name and source file.",inputSchema:{type:"object",properties:{library:{type:"string",enum:qnn,description:"Only this library."},query:{type:"string",description:"Words every match has in its name or path, e.g. dashboard card."}}},handler:async s=>{try{return n8e({components:e3n(s)})}catch(a){return IAe(a.message)}}},{name:"describe_ddk_component",description:"One DDK component or hook from its source. Component: props (inherited ones included), the components and hooks it uses, each token it reads per theme. Hook: signature, option fields, returned fields.",inputSchema:{type:"object",properties:{name:{type:"string",description:"Export name, e.g. HolderDashboardCard or useUtilityModal."},library:{type:"string",enum:qnn,description:"Library, when both export the name."}},required:["name"]},handler:async s=>{try{let a=t3n(s.name,s.library);return a?{content:[{type:"text",text:a}]}:IAe(`No DDK component or hook named ${s.name}; list_ddk_components lists the components.`)}catch(a){return IAe(a.message)}}},{name:"list_ddk_contributions",description:"List the standard DDK contributions an override can replace, with each one's slot and rank, and the contribution keys each point writes. A pump detail is listed under both pump-detail and pump-card.",inputSchema:{type:"object",properties:{point:{type:"string",enum:Object.keys(C9e),description:"Only this command's contributions."}}},handler:async s=>{try{return n8e({points:Y7n(s.point||void 0),contributions:Zdt(s.point||void 0)})}catch(a){return IAe(a.message)}}}];await q7n(process.argv.slice(2),{name:"kos-ddk",version:K7n.version,tools:U3n,resources:Z7n()});
|
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.97",
|
|
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": "bcdf9574a4f043477d9592272d033d3fe4c6c1d5"
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
"publishConfig": {
|
package/reference/reference.json
CHANGED
|
@@ -20964,7 +20964,7 @@
|
|
|
20964
20964
|
"name": "ddk-guide-descriptor-project",
|
|
20965
20965
|
"title": "NCUI descriptor projects",
|
|
20966
20966
|
"description": "What ddk:descriptor-project writes for each layout and option, the dashboard layout, and where --descriptorProject lists a utility, setup step or navigation view.",
|
|
20967
|
-
"body": "# NCUI descriptor projects\n\nThe NCUI shows a utility, setup step or navigation view only if its NCUI descriptor lists it (`kondra.ncui` `utilities`, `setup.steps`, `navigations`). The DDK app uses an installed `ddk.ncui.descriptor` KAB in place of the system app's descriptor, so a descriptor project is where a plugin's new slots are listed; the backend `descriptor.json` is the fallback.\n\n```sh\nkosui ddk:descriptor-project --name my-ncui --layout standard --ice true\n```\n\nMCP: `scaffold_ddk_descriptor_project`. The project is a content project under `content/<name>`; its `.kos.json` is the KAB's `descriptor.json`. Run `npm install` if the command names added packages, then `nx run <name>:kab` and install the KAB beside the DDK app.\n\nThe lists below are what a new project gets with every option off. `standard` spreads utilities over two columns and marks `embed` navigation entries, whose children show as tabs; `compact` keeps utilities in one column.\n\n## standard\n\nSetup steps, in order: `selectCountry` (pre-step), `selectLanguage` (pre-step), `plainWater`, `ns`, `macroAssignment`, `ingredients`, `regions`, `timeSettings`, `dispenserProfile`, `waterSettings`.\n\nUtilities, by column:\n\n1. `touchScreenTest`, `pixelQualityTest`, `setup`, `usbUpdate` (manager, technician)\n2. `reboot` (manager), `downloadLogs` (manager, technician)\n\nNavigation:\n\n- `summary` (crew, technician)\n- `dashboard` (crew, technician)\n- `notifications` (crew, technician)\n- `about` (crew, technician) — embed: its children show as tabs\n - `dispenser-info` (technician, crew)\n - `hardware` (technician, crew)\n - `connectivity` (technician, crew)\n - `software` (technician, crew)\n- `utilities` (technician, manager)\n- `settings` (technician) — embed: its children show as tabs\n - `regions` (technician)\n - `dispenser-profile` (technician)\n - `cui-selection` (technician)\n - `water` (technician)\n - `remote-nns` (technician)\n\nDashboard regions:\n\n- `micros`: holder groups `*micros*`; one column per group\n- `macros`: holder groups `*`; compact cards; small size\n- `assembly`: summaries `*`; small size\n\nDashboard areas:\n\n- portrait: `micros macros` `micros macros` `micros assembly` (columns `73% 27%`)\n- landscape: `micros micros` `macros assembly` (columns `50% 50%`)\n\n## compact\n\nSetup steps, in order: `selectCountry` (pre-step), `selectLanguage` (pre-step), `plainWater`, `ns`, `macroAssignment`, `ingredients`, `regions`, `timeSettings`, `dispenserProfile`, `waterSettings`.\n\nUtilities, by column:\n\n1. `touchScreenTest`, `pixelQualityTest`, `setup`, `usbUpdate` (manager, technician), `reboot` (manager), `downloadLogs` (manager, technician)\n\nNavigation:\n\n- `dashboard` (crew, technician)\n- `notifications` (crew, technician)\n- `about` (crew, technician)\n - `software` (crew, technician)\n - `hardware` (crew, technician)\n- `network` (technician, crew)\n- `utilities` (technician, manager)\n- `settings` (technician)\n - `localization` (technician)\n - `time-settings` (technician)\n - `water-settings` (technician)\n - `dispenser-profile` (technician)\n - `cui-selection` (technician)\n\nDashboard regions:\n\n- `micros`: holder groups `*micros*`; one column per group\n- `macros`: holder groups `*`; compact cards; small size\n- `assembly`: summaries `*`; small size\n\nDashboard areas:\n\n- portrait: `micros` `macros` `assembly` (columns `100%`)\n- landscape: `micros micros` `macros assembly` (columns `50% 50%`)\n\n## Dashboard layout\n\n`kondra.ncui.dashboard` lays out the dashboard. With none, the DDK uses the built-in layout for its component mode (the same as a new project's).\n\n- `regions`: named slots. `holders` and `summaries` are holder-group and `dashboard.summary` `dashboardKey` patterns (`*` is the only wildcard). Each group and key goes to the first region, in list order, that the current layout places and that matches it; put `[\"*\"]` last to catch the rest. `holderCard` (default `true`) renders the holders as holder cards, `false` as compact cards; `perGroup` gives each group its own sub-column; `size` (`default` or `small`) applies to every card in the region; `justify` (`left`, `right`, `center`, `full`, default `full`) places the region and its cards in its cell.\n- `layouts.portrait` and/or `layouts.landscape` (give at least one; an orientation without a layout uses the other): `areas` (one string per row of region names, `.` for an empty cell), `columns` and `rows` (one size each: a share of the space such as `60%`, or `fit` to size to the cards; rows default to `fit`; a column can also be `fixed 20%` or `fixed 240px` for a set width, or `max 30%` or `max 300px` to fit its cards up to that width, where the percentage is of the dashboard's width and shares divide what is left), `justify` (`left`, `right` or `center`: where the grid sits when its columns don't fill the width, default `left`), and `flow` per region: `cards` and `groups` (`vertical` or `horizontal`), `wrap`.\n- A plugin renders a whole region with a `ddk.dashboard.region` contribution (`add_dashboard_region`) whose `regionKey` is the region's `component`, else its `name`; a region with none renders its built-in cards. A region that claims no holders or summaries (only a `component`, such as a dispenser map) takes no cards from the others and shows only while a plugin contributes its key.\n- A region with nothing to show is empty, and a column or row whose cells are all empty is dropped with its size, and its share goes to the columns that remain: a dispenser without micro groups loses the micro columns. Give a pinned column the size `fit` and set `justify: \"right\"` to keep it at the right edge when the others drop.\n- `validate_ddk_plugin` warns about an area that is no region, a plugin's dashboard summary that no placed region claims, a size that is not a share or `fit`, shares that do not add up to 100%, an unknown `justify`, a region `component` no workspace plugin contributes, and a plugin's region contribution that no descriptor region uses.\n\n## Options\n\nOff by default; each adds:\n\n- `--carb`: carbonation: the carbWater and carbTank setup steps.\n - standard: setup step `carbWater`, setup step `carbTank`\n - compact: setup step `carbWater`, setup step `carbTank`\n- `--ice`: ice: the iceSettings setup step and the ice settings tab.\n - standard: setup step `iceSettings`, navigation `settings.ice`\n - compact: setup step `iceSettings`, navigation `settings.ice-settings`\n- `--beveragePourTest`: the beveragePourTest utility.\n - standard: utility `beveragePourTest`\n - compact: utility `beveragePourTest`\n\n## Listing a plugin's slots\n\n- `--descriptorProject <name>` on `ddk:utility`, `ddk:setup` and `ddk:nav` (MCP `descriptorProject` on `add_utility`, `add_setup_step`, `add_nav_view`) lists the new contribution's slot:\n - a utility in the last column, or `--column <n>` (1-based), with `--roles` (comma-separated; none: every role);\n - a setup step last; the setup flow runs steps in descriptor order;\n - a navigation view under its parent path, with `--roles` or the parent's roles; the parent must exist.\n- A slot already listed is left as it is; an override (`--override`) fills a listed slot and needs no entry.\n- For contributions written before the descriptor project: `kosui ddk:descriptor-entries --project <plugin> --descriptorProject <name>` (MCP `add_descriptor_entries`).\n- `validate_ddk_plugin` warns about a slot no descriptor project lists."
|
|
20967
|
+
"body": "# NCUI descriptor projects\n\nThe NCUI shows a utility, setup step or navigation view only if its NCUI descriptor lists it (`kondra.ncui` `utilities`, `setup.steps`, `navigations`). The DDK app uses an installed `ddk.ncui.descriptor` KAB in place of the system app's descriptor, so a descriptor project is where a plugin's new slots are listed; the backend `descriptor.json` is the fallback.\n\n```sh\nkosui ddk:descriptor-project --name my-ncui --layout standard --ice true\n```\n\nMCP: `scaffold_ddk_descriptor_project`. The project is a content project under `content/<name>`; its `.kos.json` is the KAB's `descriptor.json`. Run `npm install` if the command names added packages, then `nx run <name>:kab` and install the KAB beside the DDK app.\n\nThe lists below are what a new project gets with every option off. `standard` spreads utilities over two columns and marks `embed` navigation entries, whose children show as tabs; `compact` keeps utilities in one column.\n\n## standard\n\nSetup steps, in order: `selectCountry` (pre-step), `selectLanguage` (pre-step), `plainWater`, `ns`, `macroAssignment`, `ingredients`, `regions`, `timeSettings`, `dispenserProfile`, `waterSettings`.\n\nUtilities, by column:\n\n1. `touchScreenTest`, `pixelQualityTest`, `setup`, `usbUpdate` (manager, technician)\n2. `reboot` (manager), `downloadLogs` (manager, technician)\n\nNavigation:\n\n- `summary` (crew, technician)\n- `dashboard` (crew, technician)\n- `notifications` (crew, technician)\n- `about` (crew, technician) — embed: its children show as tabs\n - `dispenser-info` (technician, crew)\n - `hardware` (technician, crew)\n - `connectivity` (technician, crew)\n - `software` (technician, crew)\n- `utilities` (technician, manager)\n- `settings` (technician) — embed: its children show as tabs\n - `regions` (technician)\n - `dispenser-profile` (technician)\n - `cui-selection` (technician)\n - `water` (technician)\n - `remote-nns` (technician)\n\nDashboard regions:\n\n- `micros`: holder groups `*micros*`; one column per group\n- `macros`: holder groups `*`; compact cards; small size\n- `assembly`: summaries `*`; small size\n\nDashboard areas:\n\n- portrait: `micros macros` `micros macros` `micros assembly` (columns `73% 27%`)\n- landscape: `micros micros` `macros assembly` (columns `50% 50%`)\n\n## compact\n\nSetup steps, in order: `selectCountry` (pre-step), `selectLanguage` (pre-step), `plainWater`, `ns`, `macroAssignment`, `ingredients`, `regions`, `timeSettings`, `dispenserProfile`, `waterSettings`.\n\nUtilities, by column:\n\n1. `touchScreenTest`, `pixelQualityTest`, `setup`, `usbUpdate` (manager, technician), `reboot` (manager), `downloadLogs` (manager, technician)\n\nNavigation:\n\n- `dashboard` (crew, technician)\n- `notifications` (crew, technician)\n- `about` (crew, technician)\n - `software` (crew, technician)\n - `hardware` (crew, technician)\n- `network` (technician, crew)\n- `utilities` (technician, manager)\n- `settings` (technician)\n - `localization` (technician)\n - `time-settings` (technician)\n - `water-settings` (technician)\n - `dispenser-profile` (technician)\n - `cui-selection` (technician)\n\nDashboard regions:\n\n- `micros`: holder groups `*micros*`; one column per group\n- `macros`: holder groups `*`; compact cards; small size\n- `assembly`: summaries `*`; small size\n\nDashboard areas:\n\n- portrait: `micros` `macros` `assembly` (columns `100%`)\n- landscape: `micros micros` `macros assembly` (columns `50% 50%`)\n\n## Dashboard layout\n\n`kondra.ncui.dashboard` lays out the dashboard. With none, the DDK uses the built-in layout for its component mode (the same as a new project's).\n\n- `regions`: named slots. `holders` and `summaries` are holder-group and `dashboard.summary` `dashboardKey` patterns (`*` is the only wildcard). Each group and key goes to the first region, in list order, that the current layout places and that matches it; put `[\"*\"]` last to catch the rest. `holderCard` (default `true`) renders the holders as holder cards, `false` as compact cards; `perGroup` gives each group its own sub-column; `size` (`default` or `small`) applies to every card in the region; `justify` (`left`, `right`, `center`, `full`, default `full`) places the region and its cards in its cell.\n- `layouts.portrait` and/or `layouts.landscape` (give at least one; an orientation without a layout uses the other): `areas` (one string per row of region names, `.` for an empty cell), `columns` and `rows` (one size each: a share of the space such as `60%`, `fill` for the share the others leave (all of it when there are no shares, split evenly between several), or `fit` to size to the cards; rows default to `fit`; a column can also be `fixed 20%` or `fixed 240px` for a set width, or `max 30%` or `max 300px` to fit its cards up to that width, where the percentage is of the dashboard's width and shares divide what is left), `justify` (`left`, `right` or `center`: where the grid sits when its columns don't fill the width, default `left`), and `flow` per region: `cards` and `groups` (`vertical` or `horizontal`), `wrap`.\n- A plugin renders a whole region with a `ddk.dashboard.region` contribution (`add_dashboard_region`) whose `regionKey` is the region's `component`, else its `name`; a region with none renders its built-in cards. A region that claims no holders or summaries (only a `component`, such as a dispenser map) takes no cards from the others and shows only while a plugin contributes its key.\n- A region with nothing to show is empty, and a column or row whose cells are all empty is dropped with its size, and its share goes to the columns that remain: a dispenser without micro groups loses the micro columns. Give a pinned column the size `fit` and set `justify: \"right\"` to keep it at the right edge when the others drop.\n- `validate_ddk_plugin` warns about an area that is no region, a plugin's dashboard summary that no placed region claims, a size that is not a share or `fit`, shares that do not add up to 100%, an unknown `justify`, a region `component` no workspace plugin contributes, and a plugin's region contribution that no descriptor region uses.\n\n## Options\n\nOff by default; each adds:\n\n- `--carb`: carbonation: the carbWater and carbTank setup steps.\n - standard: setup step `carbWater`, setup step `carbTank`\n - compact: setup step `carbWater`, setup step `carbTank`\n- `--ice`: ice: the iceSettings setup step and the ice settings tab.\n - standard: setup step `iceSettings`, navigation `settings.ice`\n - compact: setup step `iceSettings`, navigation `settings.ice-settings`\n- `--beveragePourTest`: the beveragePourTest utility.\n - standard: utility `beveragePourTest`\n - compact: utility `beveragePourTest`\n\n## Listing a plugin's slots\n\n- `--descriptorProject <name>` on `ddk:utility`, `ddk:setup` and `ddk:nav` (MCP `descriptorProject` on `add_utility`, `add_setup_step`, `add_nav_view`) lists the new contribution's slot:\n - a utility in the last column, or `--column <n>` (1-based), with `--roles` (comma-separated; none: every role);\n - a setup step last; the setup flow runs steps in descriptor order;\n - a navigation view under its parent path, with `--roles` or the parent's roles; the parent must exist.\n- A slot already listed is left as it is; an override (`--override`) fills a listed slot and needs no entry.\n- For contributions written before the descriptor project: `kosui ddk:descriptor-entries --project <plugin> --descriptorProject <name>` (MCP `add_descriptor_entries`).\n- `validate_ddk_plugin` warns about a slot no descriptor project lists."
|
|
20968
20968
|
},
|
|
20969
20969
|
{
|
|
20970
20970
|
"uri": "ddk://design/base",
|
|
@@ -216,18 +216,25 @@ function trackProblems(orientation, kind, sizes) {
|
|
|
216
216
|
if (!sizes) return [];
|
|
217
217
|
const known = (size) =>
|
|
218
218
|
size === "fit" ||
|
|
219
|
+
size === "fill" ||
|
|
219
220
|
SHARE.test(size) ||
|
|
220
221
|
(kind === "column" && SIZED_COLUMN.test(size));
|
|
221
222
|
const forms =
|
|
222
223
|
kind === "column"
|
|
223
|
-
? 'a share like "50%", fit, fixed like "fixed 20%" or max like "max 300px"'
|
|
224
|
-
: 'a share like "50%" or fit';
|
|
224
|
+
? 'a share like "50%", fill, fit, fixed like "fixed 20%" or max like "max 300px"'
|
|
225
|
+
: 'a share like "50%", fill or fit';
|
|
225
226
|
const problems = sizes
|
|
226
227
|
.filter((size) => !known(size))
|
|
227
228
|
.map((size) => `${orientation} ${kind} size "${size}" is not ${forms}`);
|
|
228
229
|
const shares = sizes.filter((size) => SHARE.test(size));
|
|
229
230
|
const total = shares.reduce((sum, size) => sum + parseFloat(size), 0);
|
|
230
|
-
if (
|
|
231
|
+
if (sizes.includes("fill")) {
|
|
232
|
+
if (total > 99.5) {
|
|
233
|
+
problems.push(
|
|
234
|
+
`${orientation} ${kind} shares add up to ${total}%, leaving nothing for fill`
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
} else if (shares.length > 0 && Math.abs(total - 100) > 0.5) {
|
|
231
238
|
problems.push(`${orientation} ${kind} shares add up to ${total}%, not 100%`);
|
|
232
239
|
}
|
|
233
240
|
return problems;
|