@qin-ui/vant-pro 1.0.3 → 1.0.4
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/AI-CONTEXT.md +1 -1
- package/api.json +1 -1
- package/bin/init-ai.mjs +142 -0
- package/package.json +13 -9
- package/LICENSE +0 -9
package/AI-CONTEXT.md
CHANGED
|
@@ -25,7 +25,7 @@ npm install @qin-ui/vant-pro vant vue
|
|
|
25
25
|
|
|
26
26
|
每个字段支持:`path`, `label`, `component`, `hidden`, `disabled`, `rules`, `valueFormatter`, `fields`, `grid`, `slots`, `componentStyle`, `componentClass`, `componentContainer`, `formItemStyle`, `formItemClass`, `formItemContainer`, `modelProp`
|
|
27
27
|
|
|
28
|
-
内置组件:
|
|
28
|
+
内置组件:field, switch, stepper, rate, slider, uploader, checkbox-group, radio-group, picker, date-picker, time-picker, cascader, area, signature, button, custom
|
|
29
29
|
|
|
30
30
|
## 类型扩展
|
|
31
31
|
|
package/api.json
CHANGED
package/bin/init-ai.mjs
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @qin-ui/* AI 上下文初始化 CLI 工具
|
|
5
|
+
*
|
|
6
|
+
* 遵循 Agentic Collaboration Standard (ACS),
|
|
7
|
+
* 在消费方项目中自动生成统一的 .agents 规范配置文件。
|
|
8
|
+
*
|
|
9
|
+
* 用法:
|
|
10
|
+
* npx @qin-ui/vant-pro init-ai
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import fs from 'node:fs';
|
|
14
|
+
import path from 'node:path';
|
|
15
|
+
import { fileURLToPath } from 'node:url';
|
|
16
|
+
|
|
17
|
+
// ==================== 常量 ====================
|
|
18
|
+
|
|
19
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
20
|
+
const __dirname = path.dirname(__filename);
|
|
21
|
+
const PKG_ROOT = path.resolve(__dirname, '..');
|
|
22
|
+
|
|
23
|
+
const PKG_JSON = JSON.parse(
|
|
24
|
+
fs.readFileSync(path.join(PKG_ROOT, 'package.json'), 'utf-8')
|
|
25
|
+
);
|
|
26
|
+
const PKG_NAME = PKG_JSON.name;
|
|
27
|
+
const PKG_SHORT = PKG_NAME.replace(/^@qin-ui\//, '');
|
|
28
|
+
|
|
29
|
+
// ==================== 终端颜色 ====================
|
|
30
|
+
|
|
31
|
+
const green = (s) => `\x1b[32m${s}\x1b[0m`;
|
|
32
|
+
const cyan = (s) => `\x1b[36m${s}\x1b[0m`;
|
|
33
|
+
const bold = (s) => `\x1b[1m${s}\x1b[0m`;
|
|
34
|
+
const red = (s) => `\x1b[31m${s}\x1b[0m`;
|
|
35
|
+
|
|
36
|
+
// ==================== 内容生成 ====================
|
|
37
|
+
|
|
38
|
+
function getAiContextContent() {
|
|
39
|
+
const filePath = path.join(PKG_ROOT, 'AI-CONTEXT.md');
|
|
40
|
+
if (fs.existsSync(filePath)) {
|
|
41
|
+
return fs.readFileSync(filePath, 'utf-8').trim();
|
|
42
|
+
}
|
|
43
|
+
return `# ${PKG_NAME}\n\n> 基于 Vue 3 的配置驱动组件库。`;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function getUnifiedAgentContent() {
|
|
47
|
+
const aiContext = getAiContextContent();
|
|
48
|
+
const core = [
|
|
49
|
+
aiContext,
|
|
50
|
+
'',
|
|
51
|
+
'## 完整 API 参考',
|
|
52
|
+
'',
|
|
53
|
+
`使用 \`${PKG_NAME}\` 时,请阅读以下文件获取完整的 API 定义、类型签名和使用示例:`,
|
|
54
|
+
`- \`node_modules/${PKG_NAME}/README.md\` — 详细使用文档和代码示例`,
|
|
55
|
+
`- \`node_modules/${PKG_NAME}/api.json\` — 结构化 API 元数据(组件、Hook、类型的签名和 JSDoc 示例)`,
|
|
56
|
+
'',
|
|
57
|
+
].join('\n');
|
|
58
|
+
|
|
59
|
+
// 包含兼容性的 Frontmatter(如 Cursor 支持的 globs 等)
|
|
60
|
+
return [
|
|
61
|
+
'---',
|
|
62
|
+
`description: "${PKG_NAME} 组件库使用规范"`,
|
|
63
|
+
'globs: ["**/*.vue", "**/*.ts", "**/*.tsx"]',
|
|
64
|
+
'alwaysApply: false',
|
|
65
|
+
'---',
|
|
66
|
+
'',
|
|
67
|
+
core,
|
|
68
|
+
].join('\n');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// ==================== 文件写入 ====================
|
|
72
|
+
|
|
73
|
+
function ensureDir(dirPath) {
|
|
74
|
+
if (!fs.existsSync(dirPath)) {
|
|
75
|
+
fs.mkdirSync(dirPath, { recursive: true });
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// ==================== CLI 入口 ====================
|
|
80
|
+
|
|
81
|
+
function printHelp() {
|
|
82
|
+
console.log(`
|
|
83
|
+
${bold(`${PKG_NAME} CLI`)}
|
|
84
|
+
|
|
85
|
+
${bold('用法:')}
|
|
86
|
+
npx ${PKG_NAME} init-ai
|
|
87
|
+
|
|
88
|
+
${bold('命令:')}
|
|
89
|
+
init-ai 在当前项目中生成统一的 .agents 规范配置文件
|
|
90
|
+
|
|
91
|
+
${bold('选项:')}
|
|
92
|
+
--help 显示帮助信息
|
|
93
|
+
|
|
94
|
+
${bold('说明:')}
|
|
95
|
+
该命令将采用统一的 Agentic 标准,在项目的 .agents/rules/ 目录下
|
|
96
|
+
生成上下文文件。兼容支持读取 .agents 的主流 AI IDE 和 CLI 工具。
|
|
97
|
+
`);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function main() {
|
|
101
|
+
const args = process.argv.slice(2);
|
|
102
|
+
const subcommand = args.find((a) => !a.startsWith('-'));
|
|
103
|
+
const flags = args.filter((a) => a.startsWith('-'));
|
|
104
|
+
|
|
105
|
+
if (!subcommand || flags.includes('--help') || flags.includes('-h')) {
|
|
106
|
+
printHelp();
|
|
107
|
+
process.exit(0);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (subcommand !== 'init-ai') {
|
|
111
|
+
console.error(red(`\n 未知命令: ${subcommand}\n`));
|
|
112
|
+
printHelp();
|
|
113
|
+
process.exit(1);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
console.log('');
|
|
117
|
+
console.log(bold(`📦 ${PKG_NAME} — AI 上下文初始化 (ACS 标准)`));
|
|
118
|
+
console.log('');
|
|
119
|
+
|
|
120
|
+
const content = getUnifiedAgentContent();
|
|
121
|
+
const dirPath = '.agents/rules';
|
|
122
|
+
const fileName = `${PKG_SHORT}.md`;
|
|
123
|
+
|
|
124
|
+
const fullDir = path.join(process.cwd(), dirPath);
|
|
125
|
+
const fullPath = path.join(fullDir, fileName);
|
|
126
|
+
|
|
127
|
+
ensureDir(fullDir);
|
|
128
|
+
fs.writeFileSync(fullPath, content, 'utf-8');
|
|
129
|
+
|
|
130
|
+
const relPath = path.join(dirPath, fileName);
|
|
131
|
+
console.log(` ${green('✔')} ${cyan(relPath)} ${green('[created/updated]')}`);
|
|
132
|
+
|
|
133
|
+
console.log('');
|
|
134
|
+
console.log(green('✅ 完成!已生成统一标准规则文件。'));
|
|
135
|
+
console.log('');
|
|
136
|
+
console.log(`${bold('下一步:')}`);
|
|
137
|
+
console.log(
|
|
138
|
+
` 将 ${cyan(dirPath)} 目录提交到 Git,团队即可自动享受 AI 增强\n`
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
main();
|
package/package.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qin-ui/vant-pro",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "基于 vant 和 @qin-ui/core 封装的高级表单和列表组件库",
|
|
5
|
+
"bin": {
|
|
6
|
+
"vant-pro": "./bin/init-ai.mjs"
|
|
7
|
+
},
|
|
5
8
|
"type": "module",
|
|
6
9
|
"module": "es/index.js",
|
|
7
10
|
"types": "es/index.d.ts",
|
|
@@ -14,6 +17,7 @@
|
|
|
14
17
|
},
|
|
15
18
|
"files": [
|
|
16
19
|
"es",
|
|
20
|
+
"bin",
|
|
17
21
|
"README.md",
|
|
18
22
|
"LICENSE",
|
|
19
23
|
"api.json",
|
|
@@ -24,6 +28,10 @@
|
|
|
24
28
|
"type": "git",
|
|
25
29
|
"url": "git+https://github.com/dufan3715/pro-components.git"
|
|
26
30
|
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"prebuild": "tsx ../../scripts/generate-api-json.ts vant-pro",
|
|
33
|
+
"build": "vue-tsc && vite build"
|
|
34
|
+
},
|
|
27
35
|
"author": "dufan3715",
|
|
28
36
|
"bugs": {
|
|
29
37
|
"url": "https://github.com/dufan3715/pro-components/issues"
|
|
@@ -38,10 +46,10 @@
|
|
|
38
46
|
"vue-component-type-helpers": "^3.2.5"
|
|
39
47
|
},
|
|
40
48
|
"devDependencies": {
|
|
49
|
+
"@qin-ui/core": "workspace:^",
|
|
41
50
|
"@types/lodash-es": "^4.17.12",
|
|
42
51
|
"lodash-es": "^4.17.21",
|
|
43
|
-
"vant": "^4.9.15"
|
|
44
|
-
"@qin-ui/core": "^1.0.0"
|
|
52
|
+
"vant": "^4.9.15"
|
|
45
53
|
},
|
|
46
54
|
"sideEffects": false,
|
|
47
55
|
"publishConfig": {
|
|
@@ -59,9 +67,5 @@
|
|
|
59
67
|
"ui",
|
|
60
68
|
"form",
|
|
61
69
|
"pro-form"
|
|
62
|
-
]
|
|
63
|
-
|
|
64
|
-
"prebuild": "tsx ../../scripts/generate-api-json.ts vant-pro",
|
|
65
|
-
"build": "vue-tsc && vite build"
|
|
66
|
-
}
|
|
67
|
-
}
|
|
70
|
+
]
|
|
71
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2023-present pro-components
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
-
|
|
7
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
-
|
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|