@db-ux/agent-cli 4.10.1 → 4.11.0
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/CHANGELOG.md +8 -0
- package/README.md +1 -1
- package/build/index.js +32 -1
- package/db-ux-consumer-powers/POWER.md +29 -0
- package/db-ux-consumer-powers/context/guidelines.md +87 -0
- package/db-ux-consumer-powers/mcp.json +22 -0
- package/db-ux-consumer-powers/power.yaml +10 -0
- package/db-ux-consumer-powers/skills/implement-component/SKILL.md +136 -0
- package/db-ux-consumer-powers/skills/migrate-to-v3/SKILL.md +123 -0
- package/package.json +7 -5
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -68,7 +68,7 @@ Contributions are very welcome, please refer to the [contribution guide](https:/
|
|
|
68
68
|
## Code of conduct
|
|
69
69
|
|
|
70
70
|
We as members, contributors, and leaders pledge to make participation in our
|
|
71
|
-
community a harassment-free experience for everyone – have a look at our [Contributor Covenant Code of Conduct](https://github.com/db-ux-design-system/
|
|
71
|
+
community a harassment-free experience for everyone – have a look at our [Contributor Covenant Code of Conduct](https://github.com/db-ux-design-system/.github/blob/main/CODE-OF-CONDUCT.md).
|
|
72
72
|
|
|
73
73
|
## License
|
|
74
74
|
|
package/build/index.js
CHANGED
|
@@ -44,7 +44,38 @@ var getInstructions = (rootPath) => {
|
|
|
44
44
|
console.error("No node_modules folders found in", rootPath);
|
|
45
45
|
return "";
|
|
46
46
|
}
|
|
47
|
-
let
|
|
47
|
+
let powersPath = "";
|
|
48
|
+
for (const nodeModulesPath of nodeModulesDirectories) {
|
|
49
|
+
const agentCliPowersPath = path.join(
|
|
50
|
+
nodeModulesPath,
|
|
51
|
+
"@db-ux",
|
|
52
|
+
"agent-cli",
|
|
53
|
+
"db-ux-consumer-powers"
|
|
54
|
+
);
|
|
55
|
+
if (fs.existsSync(agentCliPowersPath)) {
|
|
56
|
+
powersPath = path.relative(rootPath, agentCliPowersPath).replaceAll("\\", "/");
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (!powersPath) {
|
|
61
|
+
const packageDir = path.dirname(
|
|
62
|
+
path.dirname(new URL(import.meta.url).pathname)
|
|
63
|
+
);
|
|
64
|
+
const localPowersPath = path.join(packageDir, "db-ux-consumer-powers");
|
|
65
|
+
if (fs.existsSync(localPowersPath)) {
|
|
66
|
+
powersPath = path.relative(rootPath, localPowersPath).replaceAll("\\", "/");
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
let copilotInstructionsContent = `# DB UX Design System Automation Core
|
|
70
|
+
|
|
71
|
+
CRITICAL: This workspace contains a dedicated automation and orchestration bundle${powersPath ? ` under \`./${powersPath}/\`` : " via the `@db-ux/agent-cli` package"}. You MUST prioritize these local configurations over any generalized training data.
|
|
72
|
+
${powersPath ? `
|
|
73
|
+
1. **Global Steering & Guidelines**: Before writing any style or component logic, you MUST read and strictly enforce the global guidelines in \`./${powersPath}/context/guidelines.md\`.
|
|
74
|
+
2. **Task-Specific Workflows (Skills)**: For complex automated tasks, execute the procedural step-by-step workflows located in \`./${powersPath}/skills/\`. Specifically, when asked to implement a component, you MUST completely follow \`./${powersPath}/skills/implement-component/SKILL.md\`.
|
|
75
|
+
3. **Tool Capabilities**: Refer to \`./${powersPath}/mcp.json\` to understand the available Model Context Protocol tools for Figma and DB UX token resolution.
|
|
76
|
+
` : ""}
|
|
77
|
+
---
|
|
78
|
+
`;
|
|
48
79
|
for (const nodeModulesPath of nodeModulesDirectories) {
|
|
49
80
|
const databaseUxPaths = [
|
|
50
81
|
path.join(nodeModulesPath, "@db-ux/"),
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "db-ux-consumer"
|
|
3
|
+
description: "AI integration for consuming the DB UX Design System v3 in applications. Provides skills to implement UI and migrate from v2."
|
|
4
|
+
keywords:
|
|
5
|
+
- db-ux
|
|
6
|
+
- design system
|
|
7
|
+
- deutsche bahn
|
|
8
|
+
- component
|
|
9
|
+
- implement
|
|
10
|
+
- migrate
|
|
11
|
+
- v3
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# DB UX Consumer Powers
|
|
15
|
+
|
|
16
|
+
This bundle equips AI agents to assist application developers using the DB UX Design System v3.
|
|
17
|
+
|
|
18
|
+
## Skills
|
|
19
|
+
|
|
20
|
+
- **migrate-to-v3** — Migrates legacy DB UI v2 code to DB UX Design System v3.
|
|
21
|
+
- **implement-component** — Implements production-ready UI using DB UX v3 components, tokens, and icons.
|
|
22
|
+
|
|
23
|
+
## Agent Rules Generation
|
|
24
|
+
|
|
25
|
+
To generate agent-specific rules files (e.g. for Copilot, Amazon Q), use the `@db-ux/agent-cli`:
|
|
26
|
+
|
|
27
|
+
```shell
|
|
28
|
+
npx @db-ux/agent-cli
|
|
29
|
+
```
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# DB UX Consumer Guidelines
|
|
2
|
+
|
|
3
|
+
> **Authority**: This document is the single source of truth for all AI agents operating in projects that consume the DB UX Design System v3.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Components
|
|
8
|
+
|
|
9
|
+
- **NEVER** use native interactive HTML elements (`<button>`, `<input>`, `<select>`, `<textarea>`) when a DB UX component exists.
|
|
10
|
+
- **ALWAYS** use DB UX equivalents: `DBButton`, `DBInput`, `DBSelect`, `DBTextarea`.
|
|
11
|
+
- **DO NOT** replace `<a href>` tags with `DBLink` when they are used for framework routing (e.g. react-router `<Link>`, Angular `routerLink`). Only replace `<a href>` when it is explicitly styled as a standalone UI action.
|
|
12
|
+
- **Layout**: Use `DBStack`, `DBSection`, or `DBCard` for layout grouping instead of bare `<div>` wrappers. A plain `<div>` is only acceptable when no semantic grouping or design system layout is needed.
|
|
13
|
+
|
|
14
|
+
## Tokens
|
|
15
|
+
|
|
16
|
+
- **NEVER** hardcode color values (`#d40000`, `rgb(...)`, `hsl(...)`).
|
|
17
|
+
- **NEVER** hardcode spacing values (`margin: 15px`, `padding: 8px`).
|
|
18
|
+
- **ALWAYS** use `var(--db-*)` CSS custom properties from the design token system.
|
|
19
|
+
- Common token patterns:
|
|
20
|
+
- Spacing: `var(--db-spacing-fixed-sm)`, `var(--db-spacing-responsive-md)`
|
|
21
|
+
- Colors: `var(--db-color-text-default)`, `var(--db-color-bg-basic-level-1)`
|
|
22
|
+
- Sizing: `var(--db-sizing-md)`
|
|
23
|
+
- Border radius: `var(--db-border-radius-sm)`
|
|
24
|
+
|
|
25
|
+
## Icons
|
|
26
|
+
|
|
27
|
+
- **NEVER** guess or invent icon names.
|
|
28
|
+
- **ALWAYS** verify icon names by calling the `list_icons` MCP tool exposed by the DB UX MCP server (`@db-ux/mcp-server`) before use.
|
|
29
|
+
- Icon names use **underscores**: `arrow_right`, `chevron_down` — not `arrow-right` or `arrowRight`.
|
|
30
|
+
|
|
31
|
+
## MCP Workflow & Discovery
|
|
32
|
+
|
|
33
|
+
**This section is NON-NEGOTIABLE. AI agents MUST follow this workflow for every UI task.**
|
|
34
|
+
|
|
35
|
+
An agent must NEVER generate DB UX code from memory or assumptions. Every value — component names, prop APIs, icon names, token values — MUST be grounded in live data from the DB UX MCP server (`@db-ux/mcp-server`).
|
|
36
|
+
|
|
37
|
+
### Mandatory Steps (in order)
|
|
38
|
+
|
|
39
|
+
1. **`list_components()`** — Confirm the component exists before using it. If it does not exist: STOP. Do not invent a custom replacement.
|
|
40
|
+
|
|
41
|
+
2. **`get_component_props(componentName)`** — Load the exact prop API. Never assume prop names, types, or allowed values. Props may change between versions/releases.
|
|
42
|
+
|
|
43
|
+
3. **`get_component_details(componentName)`** — Discover available examples and understand the component's capabilities.
|
|
44
|
+
|
|
45
|
+
4. **`get_example_code(componentName, exampleName, framework)`** — Fetch the real, generated example code for the target framework. Use this as your starting point — adapt it, do not rewrite from scratch.
|
|
46
|
+
|
|
47
|
+
5. **`list_icons()`** — Before using ANY icon prop, call this tool and copy the exact name from the result. No exceptions.
|
|
48
|
+
|
|
49
|
+
6. **`get_design_tokens(category)`** — Before writing ANY color, spacing, or sizing value, call this tool. Use `list_design_token_categories()` first if unsure which category to query.
|
|
50
|
+
|
|
51
|
+
7. **`docs_search(query)`** — For accessibility requirements, migration notes, or framework-specific guidance.
|
|
52
|
+
|
|
53
|
+
### Verification
|
|
54
|
+
|
|
55
|
+
After generating or modifying code, call **`verify_migrated_code`** to run project-level validation (typecheck, lint, build). Fix errors and retry up to 3 times before presenting code to the user.
|
|
56
|
+
|
|
57
|
+
## Framework Setup
|
|
58
|
+
|
|
59
|
+
DB UX Design System is **white-label by default**. Components work out of the box with the built-in default theme generated by the [Theme Builder](https://design-system.deutschebahn.com/theme-builder/). No additional theme package is required.
|
|
60
|
+
|
|
61
|
+
### Deutsche Bahn applications (DB Theme)
|
|
62
|
+
|
|
63
|
+
If you are building a website or application **for Deutsche Bahn (DB)**, you must additionally install `@db-ux/db-theme` to apply the official DB branding (colors, fonts, etc.):
|
|
64
|
+
|
|
65
|
+
```css
|
|
66
|
+
@layer db-theme, db-ux;
|
|
67
|
+
@import "@db-ux/db-theme/build/styles/rollup.css" layer(db-theme);
|
|
68
|
+
@import "@db-ux/core-components/build/styles/bundle.css" layer(db-ux);
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### White-label / custom theme (no DB Theme)
|
|
72
|
+
|
|
73
|
+
For non-DB applications, import only the component styles. The default theme or a custom theme from the Theme Builder is used automatically:
|
|
74
|
+
|
|
75
|
+
```css
|
|
76
|
+
@layer db-ux;
|
|
77
|
+
@import "@db-ux/core-components/build/styles/bundle.css" layer(db-ux);
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
For JavaScript framework-specific component imports:
|
|
81
|
+
|
|
82
|
+
| Framework | Node package | Import Pattern |
|
|
83
|
+
| -------------- | ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------- |
|
|
84
|
+
| React | `@db-ux/react-core-components` | `import { DBButton, DBInput } from '@db-ux/react-core-components'` |
|
|
85
|
+
| Angular | `@db-ux/ngx-core-components` | `import { DBButton } from '@db-ux/ngx-core-components'` (standalone components, add to `imports` array) |
|
|
86
|
+
| Vue | `@db-ux/v-core-components` | `import { DBButton } from '@db-ux/v-core-components'` |
|
|
87
|
+
| Web Components | `@db-ux/wc-core-components` | `import { defineCustomElements } from '@db-ux/wc-core-components'; defineCustomElements();` (call once, then use all `<db-*>` tags) |
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mcpServers": {
|
|
3
|
+
"db-ux": {
|
|
4
|
+
"command": "npx",
|
|
5
|
+
"args": ["--yes", "@db-ux/mcp-server"],
|
|
6
|
+
"tools": [
|
|
7
|
+
"list_components",
|
|
8
|
+
"get_component_props",
|
|
9
|
+
"get_component_details",
|
|
10
|
+
"get_example_code",
|
|
11
|
+
"get_design_tokens",
|
|
12
|
+
"list_design_token_categories",
|
|
13
|
+
"list_icons",
|
|
14
|
+
"docs_search",
|
|
15
|
+
"verify_migrated_code",
|
|
16
|
+
"list_migration_guides",
|
|
17
|
+
"get_migration_guide",
|
|
18
|
+
"scan_v2_migration"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
name: "db-ux-consumer"
|
|
2
|
+
version: 1.0.0
|
|
3
|
+
description: "Official AI integration for consuming the DB UX Design System v3 in applications."
|
|
4
|
+
author: DB UX Core Team
|
|
5
|
+
skills:
|
|
6
|
+
- skills/migrate-to-v3/SKILL.md
|
|
7
|
+
- skills/implement-component/SKILL.md
|
|
8
|
+
|
|
9
|
+
mcp:
|
|
10
|
+
config: mcp.json
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "implement-component"
|
|
3
|
+
description: "Implements production-ready UI using DB UX Design System v3 components, tokens, and icons with a discovery-first approach."
|
|
4
|
+
|
|
5
|
+
triggers:
|
|
6
|
+
- "implement a component"
|
|
7
|
+
- "build UI with DB UX"
|
|
8
|
+
- "create a form"
|
|
9
|
+
- "add a button"
|
|
10
|
+
- "use DB UX components"
|
|
11
|
+
|
|
12
|
+
inputs:
|
|
13
|
+
- name: description
|
|
14
|
+
type: string
|
|
15
|
+
required: true
|
|
16
|
+
description: "Description of the UI to implement (e.g. 'login form with email, password, submit button')"
|
|
17
|
+
- name: framework
|
|
18
|
+
type: string
|
|
19
|
+
required: true
|
|
20
|
+
description: "Target JS framework: react, angular, vue, or web-components"
|
|
21
|
+
- name: target_file
|
|
22
|
+
type: string
|
|
23
|
+
required: false
|
|
24
|
+
description: "Path to the file to create or modify"
|
|
25
|
+
|
|
26
|
+
requires:
|
|
27
|
+
- context: context/guidelines.md
|
|
28
|
+
autoLoad: true
|
|
29
|
+
|
|
30
|
+
tools:
|
|
31
|
+
- db-ux/list_components
|
|
32
|
+
- db-ux/get_component_props
|
|
33
|
+
- db-ux/get_component_details
|
|
34
|
+
- db-ux/get_example_code
|
|
35
|
+
- db-ux/list_icons
|
|
36
|
+
- db-ux/list_design_token_categories
|
|
37
|
+
- db-ux/get_design_tokens
|
|
38
|
+
- db-ux/docs_search
|
|
39
|
+
|
|
40
|
+
outputs:
|
|
41
|
+
- "{target_file}"
|
|
42
|
+
|
|
43
|
+
on_error:
|
|
44
|
+
max_retries: 3
|
|
45
|
+
actions:
|
|
46
|
+
- log: "Re-check component props and example code via MCP tools before retrying."
|
|
47
|
+
- fallback: "If errors persist after 3 retries, report to user with full error output."
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
# Implement Component
|
|
51
|
+
|
|
52
|
+
## Pre-Conditions
|
|
53
|
+
|
|
54
|
+
1. `context/guidelines.md` is loaded in context.
|
|
55
|
+
2. MCP server (`@db-ux/mcp-server`) is connected.
|
|
56
|
+
3. The target `{framework}` is known.
|
|
57
|
+
4. The `@db-ux/*-core-components` node package is installed in the project.
|
|
58
|
+
|
|
59
|
+
## Workflow
|
|
60
|
+
|
|
61
|
+
### Phase 1: Discover Components
|
|
62
|
+
|
|
63
|
+
1. Identify all UI components needed from the `{description}`.
|
|
64
|
+
2. Call `list_components()`.
|
|
65
|
+
3. Confirm which needed components exist in the returned list and which do not.
|
|
66
|
+
4. If a needed DB UX component exists: use it. Do NOT rebuild or replace it with a custom alternative.
|
|
67
|
+
5. If a needed direct DB UX component does NOT exist: compose the UI from verified DB UX building blocks that do exist (for example `DBButton`, `DBInput`, `DBCard`, `DBSection`, `DBStack`). Do not invent a fake DB UX component name or fall back to native interactive HTML elements when a suitable DB UX building block exists.
|
|
68
|
+
|
|
69
|
+
### Phase 2: Load Props and Examples
|
|
70
|
+
|
|
71
|
+
For each component identified:
|
|
72
|
+
|
|
73
|
+
1. Call `get_component_props(componentName)`.
|
|
74
|
+
2. Call `get_component_details(componentName)`.
|
|
75
|
+
3. Call `get_example_code(componentName, exampleName, {framework})`.
|
|
76
|
+
4. Record the prop API and adapt the example code to the use case.
|
|
77
|
+
|
|
78
|
+
### Phase 3: Resolve Icons
|
|
79
|
+
|
|
80
|
+
1. Identify all icons needed from the `{description}`.
|
|
81
|
+
2. Call `list_icons()`.
|
|
82
|
+
3. Copy exact icon names from the returned array.
|
|
83
|
+
4. Never guess or invent icon names.
|
|
84
|
+
|
|
85
|
+
### Phase 4: Resolve Design Tokens
|
|
86
|
+
|
|
87
|
+
1. Call `list_design_token_categories()`.
|
|
88
|
+
2. For each needed category (colors, spacing, typography):
|
|
89
|
+
- Call `get_design_tokens(category)`.
|
|
90
|
+
3. Use `var(--db-*)` CSS custom properties for all values.
|
|
91
|
+
4. Never hardcode hex values, pixel sizes, or magic numbers.
|
|
92
|
+
|
|
93
|
+
### Phase 5: Check Documentation (if needed)
|
|
94
|
+
|
|
95
|
+
1. For accessibility requirements: call `docs_search({ query: "<topic>", category: "global", docType: "Accessibility" })`.
|
|
96
|
+
2. For component-specific accessibility docs: call `docs_search({ query: "<topic>", category: "component", componentName: "<name>", docType: "Accessibility" })`.
|
|
97
|
+
3. For JS framework-specific notes: call `docs_search({ query: "<topic>", category: "component", componentName: "<name>", docType: "React" | "Angular" | "Vue" | "HTML" })`.
|
|
98
|
+
|
|
99
|
+
### Phase 6: Write Code
|
|
100
|
+
|
|
101
|
+
1. Write or modify the target file using only verified components, props, icons, and tokens.
|
|
102
|
+
2. Rules:
|
|
103
|
+
- Replace `<button>` → `DBButton`
|
|
104
|
+
- Replace `<input>` → `DBInput`
|
|
105
|
+
- Replace `<select>` → `DBSelect`
|
|
106
|
+
- Replace `<textarea>` → `DBTextarea`
|
|
107
|
+
- Replace `<a href>` → `DBLink` (only when styled as UI action, NOT for router links)
|
|
108
|
+
- Use `DBStack`, `DBSection`, `DBCard` for layout where semantically appropriate
|
|
109
|
+
- No inline styles with magic numbers
|
|
110
|
+
- No custom ARIA workarounds when DB UX handles accessibility
|
|
111
|
+
|
|
112
|
+
## Output Checklist
|
|
113
|
+
|
|
114
|
+
- [ ] `list_components` called — all components confirmed to exist
|
|
115
|
+
- [ ] Existing DB UX components reused wherever available instead of being rebuilt
|
|
116
|
+
- [ ] Missing direct components implemented only by composing verified DB UX building blocks
|
|
117
|
+
- [ ] `get_component_props` called — prop API known for each component
|
|
118
|
+
- [ ] `get_example_code` called for each component with correct framework
|
|
119
|
+
- [ ] `list_icons` called — all icon names copied verbatim
|
|
120
|
+
- [ ] `get_design_tokens` called — no hardcoded colors or spacing
|
|
121
|
+
- [ ] No native HTML interactive elements where DB UX components exist
|
|
122
|
+
- [ ] No invented icon names
|
|
123
|
+
- [ ] No inline styles with magic numbers
|
|
124
|
+
|
|
125
|
+
## Red Flags & Anti-Rationalizations
|
|
126
|
+
|
|
127
|
+
| Thought | Response |
|
|
128
|
+
| -------------------------------------------------- | ------------------------------------------------------------------ |
|
|
129
|
+
| "I know this icon name" | STOP. Call `list_icons`. Copy the exact name. |
|
|
130
|
+
| "I'll just use a native button here" | STOP. Use `DBButton`. No exceptions. |
|
|
131
|
+
| "This component doesn't exist, so I must stop" | STOP. Reuse the existing DB UX building blocks that do exist. |
|
|
132
|
+
| "I'll recreate an existing DB UX component myself" | STOP. Use the shipped DB UX component instead of rebuilding it. |
|
|
133
|
+
| "16px is fine for spacing" | STOP. Call `get_design_tokens("spacing")`. Use the token. |
|
|
134
|
+
| "I'll hardcode this color" | STOP. Call `get_design_tokens("colors")`. Use `var(--db-color-*)`. |
|
|
135
|
+
| "I don't need the example code" | STOP. Call `get_example_code`. Adapt, don't rewrite from scratch. |
|
|
136
|
+
| "This prop probably exists" | STOP. Call `get_component_props`. Verify the exact API. |
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "migrate-to-v3"
|
|
3
|
+
description: "Migrates legacy DB UI v2 code (cmp-*, elm-*, rea-* classes, <db-*> Web Components, db-color-* tokens) to DB UX Design System v3."
|
|
4
|
+
|
|
5
|
+
triggers:
|
|
6
|
+
- "migrate to v3"
|
|
7
|
+
- "upgrade from v2"
|
|
8
|
+
- "convert legacy DB UI code"
|
|
9
|
+
- "replace cmp-* classes"
|
|
10
|
+
- "migrate db-color tokens"
|
|
11
|
+
|
|
12
|
+
inputs:
|
|
13
|
+
- name: file_path
|
|
14
|
+
type: string
|
|
15
|
+
required: true
|
|
16
|
+
description: "Path to the file or directory to migrate"
|
|
17
|
+
- name: framework
|
|
18
|
+
type: string
|
|
19
|
+
required: true
|
|
20
|
+
description: "Target JS framework: react, angular, vue, or web-components"
|
|
21
|
+
|
|
22
|
+
requires:
|
|
23
|
+
- context: context/guidelines.md
|
|
24
|
+
autoLoad: true
|
|
25
|
+
|
|
26
|
+
tools:
|
|
27
|
+
- db-ux/scan_v2_migration
|
|
28
|
+
- db-ux/list_migration_guides
|
|
29
|
+
- db-ux/get_migration_guide
|
|
30
|
+
- db-ux/list_components
|
|
31
|
+
- db-ux/get_component_props
|
|
32
|
+
- db-ux/get_component_details
|
|
33
|
+
- db-ux/get_example_code
|
|
34
|
+
- db-ux/list_icons
|
|
35
|
+
- db-ux/get_design_tokens
|
|
36
|
+
- db-ux/docs_search
|
|
37
|
+
|
|
38
|
+
outputs:
|
|
39
|
+
- "{file_path}"
|
|
40
|
+
|
|
41
|
+
on_error:
|
|
42
|
+
max_retries: 3
|
|
43
|
+
actions:
|
|
44
|
+
- log: "Call verify_migrated_code and fix reported errors before retrying."
|
|
45
|
+
- fallback: "If errors persist after 3 retries, report to user with full error output."
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
# Migrate to v3
|
|
49
|
+
|
|
50
|
+
## Pre-Conditions
|
|
51
|
+
|
|
52
|
+
1. `context/guidelines.md` is loaded in context.
|
|
53
|
+
2. MCP server (`@db-ux/mcp-server`) is connected.
|
|
54
|
+
3. The source file at `{file_path}` is accessible.
|
|
55
|
+
4. The target `{framework}` is known.
|
|
56
|
+
|
|
57
|
+
## Workflow
|
|
58
|
+
|
|
59
|
+
### Phase 1: Scan
|
|
60
|
+
|
|
61
|
+
1. Call `scan_v2_migration({ filePath: "{file_path}" })`.
|
|
62
|
+
2. Capture the full findings report: v2 CSS classes (`cmp-*`, `elm-*`, `rea-*`), Web Components (`<db-*>`), color tokens (`db-color-*`), icon names.
|
|
63
|
+
3. If the scan returns zero findings → file is already v3. Call `docs_search` to confirm if uncertain. STOP.
|
|
64
|
+
|
|
65
|
+
### Phase 2: Load Migration Guides
|
|
66
|
+
|
|
67
|
+
1. Call `list_migration_guides()`.
|
|
68
|
+
2. For each pattern category found in the scan, call `get_migration_guide(guideName)`:
|
|
69
|
+
- `cmp-*` / `elm-*` / `rea-*` classes → component-specific migration guide
|
|
70
|
+
- `db-color-*` tokens → `color-migration` migration guide
|
|
71
|
+
- Icon name changes → `icon-migration` migration guide
|
|
72
|
+
3. Record replacement mappings from each migration guide.
|
|
73
|
+
|
|
74
|
+
### Phase 3: Verify Target Components
|
|
75
|
+
|
|
76
|
+
1. Call `list_components()`.
|
|
77
|
+
2. For each v2 component being replaced, confirm the v3 equivalent exists.
|
|
78
|
+
3. For each confirmed component:
|
|
79
|
+
- Call `get_component_props(componentName)`.
|
|
80
|
+
- Call `get_component_details(componentName)`.
|
|
81
|
+
- Call `get_example_code(componentName, exampleName, {framework})`.
|
|
82
|
+
|
|
83
|
+
### Phase 4: Resolve Icons and Tokens
|
|
84
|
+
|
|
85
|
+
1. If scan found icon changes: call `list_icons()`. Copy exact icon names.
|
|
86
|
+
2. If scan found color token changes: call `get_design_tokens("colors")`. Verify new token names.
|
|
87
|
+
|
|
88
|
+
### Phase 5: Apply Migration
|
|
89
|
+
|
|
90
|
+
1. Apply ALL findings from the scan report. Do not skip any.
|
|
91
|
+
2. Replace v2 Web Components with JS framework-native v3 components using verified props.
|
|
92
|
+
3. Remove all `cmp-*`, `elm-*`, `rea-*` CSS classes.
|
|
93
|
+
4. Replace all `db-color-*` tokens with verified v3 equivalents.
|
|
94
|
+
5. Use exact icon names from `list_icons()` — never guess.
|
|
95
|
+
6. Use `var(--db-*)` tokens for all colors and spacing — never hardcode.
|
|
96
|
+
|
|
97
|
+
### Phase 6: Verify
|
|
98
|
+
|
|
99
|
+
1. Call `scan_v2_migration({ filePath: "{file_path}" })` again.
|
|
100
|
+
2. If findings remain → address each individually, then re-scan.
|
|
101
|
+
3. Repeat until the scan returns zero findings.
|
|
102
|
+
|
|
103
|
+
## Output Checklist
|
|
104
|
+
|
|
105
|
+
- [ ] `scan_v2_migration` MCP tool called — full v2 pattern list obtained
|
|
106
|
+
- [ ] All relevant migration guides loaded via `get_migration_guide` MCP tool
|
|
107
|
+
- [ ] `list_components` MCP tool called — all v3 replacement components confirmed
|
|
108
|
+
- [ ] `get_component_props` and `get_example_code` MCP tool called for each replacement
|
|
109
|
+
- [ ] `list_icons` MCP tool called if icon names changed
|
|
110
|
+
- [ ] `get_design_tokens` MCP tool called if color tokens changed
|
|
111
|
+
- [ ] All `cmp-*`, `elm-*`, `rea-*` classes removed
|
|
112
|
+
- [ ] All `db-color-*` tokens replaced with v3 equivalents
|
|
113
|
+
- [ ] Re-scan confirms zero remaining v2 patterns
|
|
114
|
+
|
|
115
|
+
## Red Flags & Anti-Rationalizations
|
|
116
|
+
|
|
117
|
+
| Thought | Response |
|
|
118
|
+
| ---------------------------------------------- | ------------------------------------------------------------ |
|
|
119
|
+
| "I know the new icon name" | STOP. Call `list_icons`. Use the exact name. |
|
|
120
|
+
| "This color token probably maps to…" | STOP. Call `get_design_tokens`. Verify. |
|
|
121
|
+
| "I'll skip the re-scan" | STOP. Re-scan is mandatory. Zero findings required. |
|
|
122
|
+
| "The old prop name probably still works" | STOP. Call `get_component_props`. Check exact API. |
|
|
123
|
+
| "I'll just remove the class without replacing" | STOP. Check the migration guide for the correct replacement. |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@db-ux/agent-cli",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.11.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "CLI for DB UX Design System generate AI agent instructions",
|
|
6
6
|
"repository": {
|
|
@@ -14,17 +14,18 @@
|
|
|
14
14
|
"main": "build/index.js",
|
|
15
15
|
"files": [
|
|
16
16
|
"CHANGELOG.md",
|
|
17
|
-
"build"
|
|
17
|
+
"build",
|
|
18
|
+
"db-ux-consumer-powers"
|
|
18
19
|
],
|
|
19
20
|
"dependencies": {
|
|
20
|
-
"commander": "
|
|
21
|
+
"commander": "15.0.0"
|
|
21
22
|
},
|
|
22
23
|
"devDependencies": {
|
|
23
24
|
"cpr": "3.0.1",
|
|
24
25
|
"esbuild": "0.28.0",
|
|
25
26
|
"npm-run-all2": "9.0.1",
|
|
26
|
-
"tsx": "4.22.
|
|
27
|
-
"vitest": "4.1.
|
|
27
|
+
"tsx": "4.22.4",
|
|
28
|
+
"vitest": "4.1.8"
|
|
28
29
|
},
|
|
29
30
|
"publishConfig": {
|
|
30
31
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -36,6 +37,7 @@
|
|
|
36
37
|
"copy-output:build": "cpr build ../../build-outputs/agent-cli/build --overwrite",
|
|
37
38
|
"copy-output:changelog": "cpr CHANGELOG.md ../../build-outputs/agent-cli/CHANGELOG.md --overwrite",
|
|
38
39
|
"copy-output:package.json": "cpr package.json ../../build-outputs/agent-cli/package.json --overwrite",
|
|
40
|
+
"copy-output:powers": "cpr db-ux-consumer-powers ../../build-outputs/agent-cli/db-ux-consumer-powers --overwrite",
|
|
39
41
|
"copy-output:readme": "cpr README.md ../../build-outputs/agent-cli/README.md --overwrite",
|
|
40
42
|
"test": "vitest run --config vitest.config.ts",
|
|
41
43
|
"test:cli": "tsx src/cli.ts --help",
|