@finedesign/cli 0.6.0 → 0.6.1
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 +12 -11
- package/data/1.25.0/catalog.json +1 -1
- package/data/1.25.0/manifest.json +5 -5
- package/package.json +1 -1
- package/skills/fine-design/SKILL.md +4 -1
- package/skills/fine-design/references/imports-and-setup.md +2 -2
- package/src/cli.mjs +106 -65
- package/src/core/catalog.mjs +1 -0
- package/src/mcp.mjs +1 -1
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"version": "1.25.0",
|
|
4
4
|
"sourceKind": "repository-snapshot",
|
|
5
|
-
"sourceRevision": "
|
|
5
|
+
"sourceRevision": "0b3a8ab99f46f33a91bf5f2dea1942d1fbb7fe14",
|
|
6
6
|
"sourceDirty": false,
|
|
7
|
-
"contentHash": "
|
|
8
|
-
"catalogSha256": "
|
|
7
|
+
"contentHash": "f029a01c0366f98240ca9e0367fef4805cf0d472ca0bb80f5f7d15e84d22497e",
|
|
8
|
+
"catalogSha256": "53c62b06f8479ac04100829a85f9fc4034fc894c92a66c0f7101470c43d89e8a",
|
|
9
9
|
"skillFiles": {
|
|
10
10
|
"references/component-guide.md": "612948840948e65f250998231eaa16fc41e8e27b9c03b19af32571422ca8185a",
|
|
11
11
|
"references/docs-slug-map.md": "440ce5cf137fd22eabfcc5b51c3f55b85174aa643773ef0cedd5df542e77bbc2",
|
|
12
|
-
"references/imports-and-setup.md": "
|
|
12
|
+
"references/imports-and-setup.md": "51936c71ddd17b13f89bc034745fe995c15a3f9a4da3d91e56cc628f998ec2cf",
|
|
13
13
|
"references/theme-and-dark-mode.md": "2eccae4930ea993e7088eee03a4b4a0f1c839033079db5f21f8c60e0fe8168d1",
|
|
14
|
-
"SKILL.md": "
|
|
14
|
+
"SKILL.md": "59598c10f0a3fc3c7ae77baa0754c84bc032501c715f59afe323f3819fc67529"
|
|
15
15
|
}
|
|
16
16
|
}
|
package/package.json
CHANGED
|
@@ -9,19 +9,22 @@ user-invocable: true
|
|
|
9
9
|
|
|
10
10
|
Use `/fine-design` for component pages, fixes, and reviews. This folder guides AI; generated code must run without resolving skill files.
|
|
11
11
|
|
|
12
|
+
Run `npx -y @finedesign/cli doctor --format json` in the target project and read its `bundledSkillPath` when available. Use `npx fine-design` if the project already has the CLI installed. The public CLI is separate from the private `@fx-ui/fine-design` component package; a missing local command or private package does not prove the CLI is unavailable. Report the actual command and error if it fails.
|
|
13
|
+
|
|
12
14
|
## Workflow
|
|
13
15
|
|
|
14
16
|
1. Identify the deliverable and runtime: existing package-based project, standalone browser page, fix, or read-only review. Standalone HTML and embedded pages may use the public CDN runtime without npm or private-registry credentials. Preserve compatible existing components and explicit user choices; follow [imports-and-setup.md](references/imports-and-setup.md) for runtime selection.
|
|
15
17
|
2. In a package-based project, resolve Fine Design and React versions from installed packages or the lockfile; in this repository use the checked-out package and sources. In browser mode, use the selected runtime manifest and its compatibility evidence rather than requiring an installed package. State unknown versions instead of inventing them or upgrading dependencies to fit examples.
|
|
16
18
|
3. Query only the components needed at the exact target version. Prefer connected Fine Design MCP tools when matching-version data is available, or use the local CLI with `--format json`. Start with `info <component>` or `doc <component> --toc`. Fetch `example <component> <id>` source only when needed. Use `search` for unknown component names and `token` for theming. Check the installed CLI's help for supported commands. If the version is unknown or unsupported, consult matching local declarations/docs or verify browser exports and behavior. Resolve website pages through [docs-slug-map.md](references/docs-slug-map.md).
|
|
17
19
|
4. Use the relevant sections of [component-guide.md](references/component-guide.md) for component selection and API traps. Consult other references only for the conditions below.
|
|
18
|
-
5. Run the existing build/type check (plus `fine-design lint <file>` when available) and verify the affected interaction with local test data. Report
|
|
20
|
+
5. Run the existing build/type check (plus `fine-design lint <file>` when available) and verify the affected interaction with local test data. Report official lint, independent browser checks, and target preview checks separately, including unverified steps. Reviews remain read-only.
|
|
19
21
|
|
|
20
22
|
## Core Contracts
|
|
21
23
|
|
|
22
24
|
- Use target-version public APIs and package-root imports from `@fx-ui/fine-design`; deep imports require an explicit request. Standalone HTML uses the public UMD exports.
|
|
23
25
|
- Match the chosen component's schema, exports, and events. Keep filters, rows, and forms in the same stored value domain, and connect confirmations to actual mutations.
|
|
24
26
|
- Runnable single-file output includes its styles/runtime setup and has no missing local helpers, assets, or CSS modules.
|
|
27
|
+
- If the requested Fine Design runtime is unavailable, report the failed command and cause without guessing. A native HTML substitute is not a Fine Design component implementation; label it as an alternative and do not claim official lint passed. If real components are mandatory, stop and report the blocker instead of substituting them.
|
|
25
28
|
|
|
26
29
|
## Read Only When Needed
|
|
27
30
|
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
## Component Installation And Registry
|
|
14
14
|
|
|
15
|
-
The public `@finedesign/cli` package does not require company-registry credentials.
|
|
15
|
+
The public `@finedesign/cli` package does not require company-registry credentials. Run `npx -y @finedesign/cli doctor --format json`; installing the component library `@fx-ui/fine-design` is separate. CLI documentation queries can use an explicit supported `--fd-version` without installing the component library. A missing local executable or a failed private-package lookup does not establish that the public CLI is unavailable. Report the actual command, exit code and error; distinguish registry, authentication and network failures without guessing.
|
|
16
16
|
|
|
17
17
|
If component installation fails, inspect the effective configuration from the consuming project:
|
|
18
18
|
|
|
@@ -49,7 +49,7 @@ Use browser/CDN mode for standalone pages, embedded pages and previews without a
|
|
|
49
49
|
|
|
50
50
|
### Select Resources
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
Run `npx -y @finedesign/cli runtime list --format json` first and check its exit code. Use a version from its `versions` result with `npx -y @finedesign/cli runtime --fd-version <exact-version> --format html > demo.html` for a standalone starting page, or `--format json` for resources (MCP: `list_browser_runtimes` / `get_browser_runtime`). Use `--runtime-url` only for an explicitly selected preview. Only the currently hosted version is available; offline documentation may include more versions. An unavailable version is an error, not a reason to change the requested version. If discovery fails, report the actual error instead of guessing asset URLs or repeatedly probing unrelated packages.
|
|
53
53
|
|
|
54
54
|
1. Read the public [runtime manifest](https://fine-design-runtime.pages.dev/manifest.json). In this repository it is generated under `tools/fine-design/public/assets/react/fine-design-runtime/`. The manifest directly contains `version` and `resources`; there is no discovery pointer or historical version index.
|
|
55
55
|
2. Resolve resource `path` relative to that manifest; `url` is used exactly. Hosted paths include the precise package version, such as `fine-design/1.25.0/fine-design.min.js`. There is no hash directory or releaseId. Resource SHA-256 and SRI still verify the exact bytes.
|
package/src/cli.mjs
CHANGED
|
@@ -33,7 +33,8 @@ Options:
|
|
|
33
33
|
--component <name> Compare only this component (diff command only)
|
|
34
34
|
--agent <cursor|claude|codex|all> Target agent configuration (init command only)
|
|
35
35
|
--output <directory> Destination directory for extracted component (add command only)
|
|
36
|
-
--force
|
|
36
|
+
--force Update managed files or overwrite examples (init and add)
|
|
37
|
+
--dry-run Preview changes without writing (init and add)
|
|
37
38
|
--runtime-url <url> Runtime hosting base URL (runtime command only)
|
|
38
39
|
--format <text|json|markdown|html> Output format (markdown: doc/info/token; html: runtime)
|
|
39
40
|
--section <heading> Doc section heading (exact or case-insensitive)
|
|
@@ -73,13 +74,21 @@ function runDoctor(values) {
|
|
|
73
74
|
throw error;
|
|
74
75
|
}
|
|
75
76
|
}
|
|
77
|
+
const catalog = versionStatus === 'supported' ? loadCatalog(detectedVersion) : null;
|
|
76
78
|
return {
|
|
77
79
|
toolVersion: pkg.version,
|
|
78
80
|
nodeVersion: process.version,
|
|
79
81
|
projectDir,
|
|
80
82
|
detectedVersion,
|
|
83
|
+
versionSource: detectedVersion === null ? null : values['fd-version'] !== undefined ? 'explicit' : 'project',
|
|
81
84
|
versionStatus,
|
|
82
85
|
availableVersions,
|
|
86
|
+
catalogSource: catalog ? {
|
|
87
|
+
sourceKind: catalog.sourceKind,
|
|
88
|
+
sourceRevision: catalog.sourceRevision,
|
|
89
|
+
sourceDirty: catalog.sourceDirty,
|
|
90
|
+
contentHash: catalog.contentHash
|
|
91
|
+
} : null,
|
|
83
92
|
bundledSkillVersion: index.skillVersion,
|
|
84
93
|
bundledSkillPath,
|
|
85
94
|
bundledSkillAvailable,
|
|
@@ -101,6 +110,8 @@ function runInit(values) {
|
|
|
101
110
|
const bundledSkillDir = fileURLToPath(new URL('../skills/fine-design', import.meta.url));
|
|
102
111
|
const created = [];
|
|
103
112
|
const updated = [];
|
|
113
|
+
const skipped = [];
|
|
114
|
+
const warnings = [];
|
|
104
115
|
|
|
105
116
|
const agentInstructions = `# Fine Design Rules
|
|
106
117
|
|
|
@@ -110,6 +121,7 @@ function runInit(values) {
|
|
|
110
121
|
2. 交付独立 HTML 或无构建预览时,先单独运行 \`runtime list --format json\`,根据退出码判断清单是否可用。用 \`versions\` 返回的版本解析 UMD 资源,再查组件 API。
|
|
111
122
|
3. 按目标版本用 \`info\` 查组件 API。\`list --format json\` 从 \`components\` 数组读取组件,\`example <组件>\` 先列示例 ID,按需再读源码。
|
|
112
123
|
4. 对改动文件运行 \`lint\` 并执行项目已有检查。分别记录工程检查、UMD 清单解析和目标预览中的关键交互结果,标明未验证项。
|
|
124
|
+
5. CLI 与私有组件包是独立的;本地命令缺失或私有包查询失败不能证明公开 CLI 不存在。失败时记录实际命令、退出码和错误。真实组件不可用时,原生页面只能标为替代实现,不能声称通过官方 lint;若必须使用真实组件则报告阻碍。
|
|
113
125
|
`;
|
|
114
126
|
|
|
115
127
|
const cursorMdcContent = `---
|
|
@@ -120,72 +132,82 @@ alwaysApply: false
|
|
|
120
132
|
|
|
121
133
|
${agentInstructions}`;
|
|
122
134
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
updated.push('.cursorrules');
|
|
133
|
-
}
|
|
135
|
+
const startMarker = '<!-- fine-design:start -->';
|
|
136
|
+
const endMarker = '<!-- fine-design:end -->';
|
|
137
|
+
const managedInstructions = `${startMarker}\n${agentInstructions.trimEnd()}\n${endMarker}`;
|
|
138
|
+
function write(relative, content, overwrite = false) {
|
|
139
|
+
const filename = path.join(projectDir, relative);
|
|
140
|
+
const exists = fs.existsSync(filename);
|
|
141
|
+
if (exists && !overwrite) {
|
|
142
|
+
skipped.push(relative);
|
|
143
|
+
return;
|
|
134
144
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
fs.writeFileSync(mdcFile, cursorMdcContent, 'utf8');
|
|
140
|
-
created.push('.cursor/rules/fine-design.mdc');
|
|
145
|
+
(exists ? updated : created).push(relative);
|
|
146
|
+
if (!values['dry-run']) {
|
|
147
|
+
fs.mkdirSync(path.dirname(filename), { recursive: true });
|
|
148
|
+
fs.writeFileSync(filename, content);
|
|
141
149
|
}
|
|
142
150
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
151
|
+
function writeInstructions(relative) {
|
|
152
|
+
const filename = path.join(projectDir, relative);
|
|
153
|
+
if (!fs.existsSync(filename)) return write(relative, `${managedInstructions}\n`);
|
|
154
|
+
const existing = fs.readFileSync(filename, 'utf8');
|
|
155
|
+
const start = existing.indexOf(startMarker);
|
|
156
|
+
const end = existing.indexOf(endMarker);
|
|
157
|
+
if (start !== -1 || end !== -1) {
|
|
158
|
+
if (start === -1 || end < start || existing.indexOf(startMarker, start + startMarker.length) !== -1 || existing.indexOf(endMarker, end + endMarker.length) !== -1) {
|
|
159
|
+
skipped.push(relative);
|
|
160
|
+
warnings.push(`${relative}: invalid Fine Design markers; update manually.`);
|
|
161
|
+
} else if (values.force) {
|
|
162
|
+
write(relative, existing.slice(0, start) + managedInstructions + existing.slice(end + endMarker.length), true);
|
|
163
|
+
} else skipped.push(relative);
|
|
164
|
+
} else if (existing.includes('fine-design') || existing.includes('@finedesign/cli')) {
|
|
165
|
+
skipped.push(relative);
|
|
166
|
+
warnings.push(`${relative}: existing Fine Design instructions have no markers; update manually.`);
|
|
155
167
|
} else {
|
|
156
|
-
|
|
157
|
-
if (!existing.includes('fine-design') && !existing.includes('@finedesign/cli')) {
|
|
158
|
-
fs.appendFileSync(claudeMdFile, `\n\n${agentInstructions}`, 'utf8');
|
|
159
|
-
updated.push('CLAUDE.md');
|
|
160
|
-
}
|
|
168
|
+
write(relative, `${existing}\n\n${managedInstructions}\n`, true);
|
|
161
169
|
}
|
|
162
170
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
fs.cpSync(bundledSkillDir, codexSkillsDir, { recursive: true });
|
|
169
|
-
created.push('.agents/skills/fine-design/');
|
|
171
|
+
function writeSkill(relative) {
|
|
172
|
+
const target = path.join(projectDir, relative);
|
|
173
|
+
if (fs.existsSync(target) && !values.force) {
|
|
174
|
+
skipped.push(`${relative}/`);
|
|
175
|
+
return;
|
|
170
176
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
if (!existing.includes('fine-design') && !existing.includes('@finedesign/cli')) {
|
|
178
|
-
fs.appendFileSync(agentsMdFile, `\n\n${agentInstructions}`, 'utf8');
|
|
179
|
-
updated.push('AGENTS.md');
|
|
177
|
+
function copyFiles(source, destination) {
|
|
178
|
+
for (const entry of fs.readdirSync(source, { withFileTypes: true })) {
|
|
179
|
+
const src = path.join(source, entry.name);
|
|
180
|
+
const dest = path.join(destination, entry.name);
|
|
181
|
+
if (entry.isDirectory()) copyFiles(src, dest);
|
|
182
|
+
else if (entry.isFile()) write(dest, fs.readFileSync(src), values.force);
|
|
180
183
|
}
|
|
181
184
|
}
|
|
185
|
+
if (fs.existsSync(bundledSkillDir)) copyFiles(bundledSkillDir, relative);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (agent === 'cursor' || agent === 'all') {
|
|
189
|
+
writeInstructions('.cursorrules');
|
|
190
|
+
write('.cursor/rules/fine-design.mdc', cursorMdcContent, values.force);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (agent === 'claude' || agent === 'all') {
|
|
194
|
+
writeSkill('.claude/skills/fine-design');
|
|
195
|
+
writeInstructions('CLAUDE.md');
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
if (agent === 'codex' || agent === 'all') {
|
|
199
|
+
writeSkill('.agents/skills/fine-design');
|
|
200
|
+
writeInstructions('AGENTS.md');
|
|
182
201
|
}
|
|
183
202
|
|
|
184
203
|
return {
|
|
185
204
|
projectDir,
|
|
186
205
|
agent,
|
|
187
206
|
created: [...new Set(created)],
|
|
188
|
-
updated: [...new Set(updated)]
|
|
207
|
+
updated: [...new Set(updated)],
|
|
208
|
+
skipped,
|
|
209
|
+
warnings,
|
|
210
|
+
dryRun: Boolean(values['dry-run'])
|
|
189
211
|
};
|
|
190
212
|
}
|
|
191
213
|
|
|
@@ -235,13 +257,20 @@ function runAdd(componentArg, exampleArg, values) {
|
|
|
235
257
|
const prefix = sourceDir === '.' ? '' : `${sourceDir}/`;
|
|
236
258
|
const files = example.files.map((file) => ({ file, destPath: path.join(targetDir, file.path.slice(prefix.length)) }));
|
|
237
259
|
const writtenFiles = [];
|
|
260
|
+
const created = [];
|
|
261
|
+
const updated = [];
|
|
262
|
+
const conflicts = [];
|
|
238
263
|
|
|
239
264
|
for (const { destPath } of files) {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
265
|
+
const relative = path.relative(projectDir, destPath);
|
|
266
|
+
if (!fs.existsSync(destPath)) created.push(relative);
|
|
267
|
+
else if (values.force) updated.push(relative);
|
|
268
|
+
else conflicts.push(relative);
|
|
269
|
+
}
|
|
270
|
+
if (conflicts.length && !values['dry-run']) {
|
|
271
|
+
throw new ToolError('FILE_EXISTS', `File already exists: ${conflicts[0]}. Use --force to overwrite.`, 1);
|
|
243
272
|
}
|
|
244
|
-
for (const { file, destPath } of files) {
|
|
273
|
+
for (const { file, destPath } of values['dry-run'] ? [] : files) {
|
|
245
274
|
fs.mkdirSync(path.dirname(destPath), { recursive: true });
|
|
246
275
|
if (file.encoding === 'base64') {
|
|
247
276
|
fs.writeFileSync(destPath, Buffer.from(file.content, 'base64'));
|
|
@@ -261,6 +290,10 @@ function runAdd(componentArg, exampleArg, values) {
|
|
|
261
290
|
version,
|
|
262
291
|
targetDir: path.relative(projectDir, targetDir) || '.',
|
|
263
292
|
writtenFiles,
|
|
293
|
+
created,
|
|
294
|
+
updated,
|
|
295
|
+
conflicts,
|
|
296
|
+
dryRun: Boolean(values['dry-run']),
|
|
264
297
|
dependencies: example.dependencies || [],
|
|
265
298
|
requiredDependencies
|
|
266
299
|
};
|
|
@@ -274,7 +307,7 @@ export async function main(argv) {
|
|
|
274
307
|
format: { type: 'string' }, section: { type: 'string' }, toc: { type: 'boolean' }, summary: { type: 'boolean' },
|
|
275
308
|
offset: { type: 'string' }, limit: { type: 'string' }, 'include-assets': { type: 'boolean' },
|
|
276
309
|
'runtime-url': { type: 'string' }, component: { type: 'string' },
|
|
277
|
-
agent: { type: 'string' }, output: { type: 'string' }, force: { type: 'boolean' }
|
|
310
|
+
agent: { type: 'string' }, output: { type: 'string' }, force: { type: 'boolean' }, 'dry-run': { type: 'boolean' }
|
|
278
311
|
}});
|
|
279
312
|
format = values.format || 'text';
|
|
280
313
|
if (!['text', 'json', 'markdown', 'html'].includes(format)) throw new ToolError('INVALID_ARGUMENT', 'Unknown output format.', 2);
|
|
@@ -288,6 +321,7 @@ export async function main(argv) {
|
|
|
288
321
|
if (command !== 'init' && values.agent !== undefined) throw new ToolError('INVALID_ARGUMENT', '--agent is only supported for init.', 2);
|
|
289
322
|
if (command !== 'add' && values.output !== undefined) throw new ToolError('INVALID_ARGUMENT', '--output is only supported for add.', 2);
|
|
290
323
|
if (!['init', 'add'].includes(command) && values.force !== undefined) throw new ToolError('INVALID_ARGUMENT', '--force is only supported for init and add.', 2);
|
|
324
|
+
if (!['init', 'add'].includes(command) && values['dry-run'] !== undefined) throw new ToolError('INVALID_ARGUMENT', '--dry-run is only supported for init and add.', 2);
|
|
291
325
|
if (format === 'markdown' && !['doc', 'info', 'token'].includes(command)) {
|
|
292
326
|
throw new ToolError('INVALID_ARGUMENT', 'Markdown output format is only supported for the doc, info and token commands.', 2);
|
|
293
327
|
}
|
|
@@ -310,8 +344,9 @@ export async function main(argv) {
|
|
|
310
344
|
const lines = [
|
|
311
345
|
`CLI version: ${report.toolVersion} (Node ${report.nodeVersion})`,
|
|
312
346
|
`Project directory: ${report.projectDir}`,
|
|
313
|
-
`
|
|
347
|
+
`Fine Design version: ${report.detectedVersion ?? 'none'} (${report.versionStatus}${report.versionSource ? `, ${report.versionSource}` : ''})`,
|
|
314
348
|
`Bundled catalogs: ${report.availableVersions.join(', ')}`,
|
|
349
|
+
...(report.catalogSource ? [`Catalog source: ${report.catalogSource.sourceKind} ${report.catalogSource.sourceRevision}${report.catalogSource.sourceDirty ? ' (dirty)' : ''}`] : []),
|
|
315
350
|
`Bundled Skill (${report.bundledSkillVersion}): ${report.bundledSkillPath}`
|
|
316
351
|
];
|
|
317
352
|
if (report.suggestions?.length) lines.push(`Suggestions:\n${report.suggestions.map((item) => ` - ${item}`).join('\n')}`);
|
|
@@ -321,18 +356,21 @@ export async function main(argv) {
|
|
|
321
356
|
}
|
|
322
357
|
if (command === 'init') {
|
|
323
358
|
if (values.version || args.length > 0 || values.section !== undefined || summaryFlag || values.offset !== undefined || values.limit !== undefined || values['include-assets'] !== undefined || values['fd-version'] !== undefined || !['text', 'json'].includes(format)) {
|
|
324
|
-
throw new ToolError('INVALID_ARGUMENT', 'Usage: fine-design init [--agent <cursor|claude|codex|all>] [--project <dir>] [--force] [--format text|json]', 2);
|
|
359
|
+
throw new ToolError('INVALID_ARGUMENT', 'Usage: fine-design init [--agent <cursor|claude|codex|all>] [--project <dir>] [--force] [--dry-run] [--format text|json]', 2);
|
|
325
360
|
}
|
|
326
361
|
const report = runInit(values);
|
|
327
362
|
if (format === 'json') {
|
|
328
363
|
console.log(JSON.stringify(report));
|
|
329
364
|
} else {
|
|
330
365
|
const lines = [
|
|
331
|
-
|
|
366
|
+
`${report.dryRun ? 'Preview' : 'Initialized'} Fine Design agent configuration (${report.agent}) in ${report.projectDir}:`,
|
|
332
367
|
' Created files:',
|
|
333
368
|
...(report.created.length ? report.created.map((f) => ` - ${f}`) : [' - none']),
|
|
334
369
|
' Updated files:',
|
|
335
|
-
...(report.updated.length ? report.updated.map((f) => ` - ${f}`) : [' - none'])
|
|
370
|
+
...(report.updated.length ? report.updated.map((f) => ` - ${f}`) : [' - none']),
|
|
371
|
+
' Skipped files:',
|
|
372
|
+
...(report.skipped.length ? report.skipped.map((f) => ` - ${f}`) : [' - none']),
|
|
373
|
+
...report.warnings.map((warning) => ` Warning: ${warning}`)
|
|
336
374
|
];
|
|
337
375
|
console.log(lines.join('\n'));
|
|
338
376
|
}
|
|
@@ -340,15 +378,18 @@ export async function main(argv) {
|
|
|
340
378
|
}
|
|
341
379
|
if (command === 'add') {
|
|
342
380
|
if (values.version || args.length < 1 || args.length > 2 || values.section !== undefined || summaryFlag || values.offset !== undefined || values.limit !== undefined || values['include-assets'] !== undefined || !['text', 'json'].includes(format)) {
|
|
343
|
-
throw new ToolError('INVALID_ARGUMENT', 'Usage: fine-design add <component> [id] [--output <dir>] [--force] [--fd-version <version>] [--format text|json]', 2);
|
|
381
|
+
throw new ToolError('INVALID_ARGUMENT', 'Usage: fine-design add <component> [id] [--output <dir>] [--force] [--dry-run] [--fd-version <version>] [--format text|json]', 2);
|
|
344
382
|
}
|
|
345
383
|
const report = runAdd(args[0], args[1], values);
|
|
346
384
|
if (format === 'json') {
|
|
347
385
|
console.log(JSON.stringify(report));
|
|
348
386
|
} else {
|
|
349
387
|
const lines = [
|
|
350
|
-
|
|
351
|
-
...report.
|
|
388
|
+
`${report.dryRun ? 'Preview' : 'Added'} ${report.component} (${report.exampleId}) to ${report.targetDir}:`,
|
|
389
|
+
...report.created.map((f) => ` Create: ${f}`),
|
|
390
|
+
...report.updated.map((f) => ` Overwrite: ${f}`),
|
|
391
|
+
...report.conflicts.map((f) => ` Conflict: ${f}`),
|
|
392
|
+
...(report.conflicts.length ? [' No files will be written unless conflicts are resolved or --force is used.'] : [])
|
|
352
393
|
];
|
|
353
394
|
if (report.requiredDependencies.length) {
|
|
354
395
|
lines.push('', 'Required dependencies:', ` npm install ${report.requiredDependencies.join(' ')}`);
|
|
@@ -489,7 +530,7 @@ export async function main(argv) {
|
|
|
489
530
|
});
|
|
490
531
|
return [` - ${exports.join('/')} (${id})`, ...details].join('\n');
|
|
491
532
|
}),
|
|
492
|
-
...(result.migrations.length ? ['Recommended migrations:', ...result.migrations.map((m) => ` - ${m.legacy} -> ${m.recommended}: ${m.note}`)] : [])
|
|
533
|
+
...(result.migrations.length ? ['Recommended migrations (general guidance, not specific to these versions):', ...result.migrations.map((m) => ` - ${m.legacy} -> ${m.recommended}: ${m.note}`)] : [])
|
|
493
534
|
].join('\n'));
|
|
494
535
|
}
|
|
495
536
|
return;
|
package/src/core/catalog.mjs
CHANGED
|
@@ -484,6 +484,7 @@ export function diffCatalogs(fromCatalog, toCatalog, component) {
|
|
|
484
484
|
addedComponents,
|
|
485
485
|
removedComponents,
|
|
486
486
|
updatedComponents,
|
|
487
|
+
migrationScope: 'general',
|
|
487
488
|
migrations: [
|
|
488
489
|
{ components: ['table', 'data-table', 'next-table'], legacy: 'Table / DataTable', recommended: 'NextTable', note: 'Use <NextTable> with declarative <NextTable.Column>, <NextTable.HeaderCell>, and <NextTable.Cell dataKey="..."> children.' },
|
|
489
490
|
{ components: ['cascader', 'm-cascader'], legacy: 'Cascader', recommended: 'MCascader', note: 'Legacy Cascader has no online docs page; prefer MCascader for new pages.' },
|
package/src/mcp.mjs
CHANGED
|
@@ -25,7 +25,7 @@ export async function startMcp() {
|
|
|
25
25
|
get_component_doc: 'Read component documentation, or pass summary: true to list section headings and example IDs first. Version is optional.',
|
|
26
26
|
get_component_info: 'Show component overview, exports, aliases and API/props table sections. Version is optional.',
|
|
27
27
|
get_component_tokens: 'Inspect component or global Design Tokens and their default values. Version is optional.',
|
|
28
|
-
diff_catalogs: 'Compare documentation sections, examples
|
|
28
|
+
diff_catalogs: 'Compare documentation sections, examples and aliases between versions, optionally for one component. Migration guidance is general, not version-specific.',
|
|
29
29
|
lint_files: 'Scan code for Fine Design API traps. Pass an exact version if it cannot be detected from the targets.',
|
|
30
30
|
get_component_example: 'List example IDs and titles, or pass exampleId to read source, dependencies and asset metadata. Version is optional. Set includeAssets with exampleId to include large assets.',
|
|
31
31
|
list_browser_runtimes: 'Read the one currently hosted UMD version from its online manifest. Requires network access.',
|