universal-dev-standards 3.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Universal Development Standards Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,248 @@
1
+ # Universal Development Standards CLI
2
+ # 通用開發規範 CLI 工具
3
+
4
+ CLI tool for adopting Universal Development Standards in your projects.
5
+
6
+ 採用通用開發規範的 CLI 工具,協助您在專案中快速導入標準。
7
+
8
+ ## Installation | 安裝
9
+
10
+ ### Option 1: npm (Recommended) | 選項一:npm(推薦)
11
+
12
+ ```bash
13
+ # Install globally
14
+ npm install -g universal-dev-standards
15
+
16
+ # Or use npx directly
17
+ npx universal-dev-standards init
18
+ ```
19
+
20
+ ### Option 2: Clone and Run Locally | 選項二:本地克隆執行
21
+
22
+ ```bash
23
+ # Clone the repository
24
+ git clone https://github.com/AsiaOstrich/universal-dev-standards.git
25
+
26
+ # Navigate to CLI directory
27
+ cd universal-dev-standards/cli
28
+
29
+ # Install dependencies
30
+ npm install
31
+
32
+ # Run directly
33
+ node bin/uds.js list
34
+ node bin/uds.js init
35
+
36
+ # Or link globally
37
+ npm link
38
+ uds list
39
+ ```
40
+
41
+ ## Commands | 命令
42
+
43
+ ### `uds list`
44
+
45
+ List all available standards. | 列出所有可用的規範。
46
+
47
+ ```bash
48
+ # List all standards
49
+ uds list
50
+
51
+ # Filter by level
52
+ uds list --level 2
53
+
54
+ # Filter by category
55
+ uds list --category skill
56
+ ```
57
+
58
+ **Options | 選項:**
59
+ - `-l, --level <1|2|3>` - Filter by adoption level | 按採用等級篩選
60
+ - `-c, --category <name>` - Filter by category | 按類別篩選 (skill, reference, extension, integration, template)
61
+
62
+ ### `uds init`
63
+
64
+ Initialize standards in your project. | 在您的專案中初始化規範。
65
+
66
+ ```bash
67
+ # Interactive mode (recommended)
68
+ uds init
69
+
70
+ # Non-interactive with defaults
71
+ uds init --yes
72
+
73
+ # Specify options
74
+ uds init --level 2 --lang php --locale zh-tw
75
+ ```
76
+
77
+ **Options | 選項:**
78
+ - `-l, --level <1|2|3>` - Adoption level | 採用等級 (1=基本, 2=推薦, 3=企業)
79
+ - `--lang <language>` - Language extension | 語言延伸 (csharp, php)
80
+ - `--framework <name>` - Framework extension | 框架延伸 (fat-free)
81
+ - `--locale <locale>` - Locale extension | 地區延伸 (zh-tw)
82
+ - `--no-skills` - Skip Claude Code Skills installation prompt | 跳過 Skills 安裝提示
83
+ - `-y, --yes` - Use defaults, skip interactive prompts | 使用預設值,跳過互動提示
84
+
85
+ **What it does | 功能說明:**
86
+ 1. Detects your project's language and framework
87
+ 2. Asks which standards to adopt
88
+ 3. Copies reference documents to `.standards/`
89
+ 4. Copies AI tool integrations (Cursor, Copilot, etc.)
90
+ 5. Creates `.standards/manifest.json` for tracking
91
+
92
+ ### `uds check`
93
+
94
+ Check adoption status of current project. | 檢查當前專案的採用狀態。
95
+
96
+ ```bash
97
+ uds check
98
+ ```
99
+
100
+ **Output includes | 輸出內容:**
101
+ - Installed version and level | 已安裝版本和等級
102
+ - File integrity check | 檔案完整性檢查
103
+ - Skills installation status | Skills 安裝狀態
104
+ - Coverage summary | 涵蓋範圍摘要
105
+ - Update availability | 更新可用性
106
+
107
+ ### `uds update`
108
+
109
+ Update standards to the latest version. | 更新規範到最新版本。
110
+
111
+ ```bash
112
+ # Interactive update
113
+ uds update
114
+
115
+ # Skip confirmation
116
+ uds update --yes
117
+ ```
118
+
119
+ **Options | 選項:**
120
+ - `-y, --yes` - Skip confirmation prompts | 跳過確認提示
121
+
122
+ ## Adoption Levels | 採用等級
123
+
124
+ | Level | Name | Description | 說明 |
125
+ |-------|------|-------------|------|
126
+ | 1 | Essential | Minimum viable standards | 最低可行標準 |
127
+ | 2 | Recommended | Professional quality for teams | 團隊專業品質 |
128
+ | 3 | Enterprise | Comprehensive standards | 全面企業標準 |
129
+
130
+ ## Categories | 類別
131
+
132
+ | Category | Description | 說明 |
133
+ |----------|-------------|------|
134
+ | `skill` | Standards with Claude Code Skills | 包含 Skills 的規範 |
135
+ | `reference` | Reference documents (no Skills) | 參考文件(無 Skills)|
136
+ | `extension` | Language/framework-specific | 語言/框架特定 |
137
+ | `integration` | AI tool configurations | AI 工具配置 |
138
+ | `template` | Document templates | 文件模板 |
139
+
140
+ ## Example Workflow | 範例工作流程
141
+
142
+ ```bash
143
+ # 1. Install CLI (one-time)
144
+ npm install -g universal-dev-standards
145
+
146
+ # 2. Navigate to your project
147
+ cd my-project
148
+
149
+ # 3. Initialize standards (interactive)
150
+ uds init
151
+ # ? Select adoption level: Level 2: Recommended
152
+ # ? Detected PHP project. Select style guides: PHP Style Guide
153
+ # ? Select AI tool integrations: Cursor, GitHub Copilot
154
+ # ? Install Claude Code Skills? Yes
155
+
156
+ # 4. Review what was created
157
+ ls .standards/
158
+ # checkin-standards.md
159
+ # spec-driven-development.md
160
+ # manifest.json
161
+
162
+ # 5. Check status anytime
163
+ uds check
164
+
165
+ # 6. Update when new version is available
166
+ uds update
167
+ ```
168
+
169
+ ## File Structure | 檔案結構
170
+
171
+ After initialization, your project will have: | 初始化後,您的專案將包含:
172
+
173
+ ```
174
+ your-project/
175
+ ├── .standards/
176
+ │ ├── manifest.json # Tracks what was installed
177
+ │ ├── checkin-standards.md # Reference documents
178
+ │ ├── spec-driven-development.md
179
+ │ └── (other standards...)
180
+ ├── .cursorrules # AI tool integrations
181
+ ├── .github/
182
+ │ └── copilot-instructions.md
183
+ └── ...
184
+ ```
185
+
186
+ ## Manifest File | 清單檔案
187
+
188
+ The `.standards/manifest.json` tracks your adoption: | `.standards/manifest.json` 追蹤您的採用狀態:
189
+
190
+ ```json
191
+ {
192
+ "version": "1.0.0",
193
+ "upstream": {
194
+ "repo": "AsiaOstrich/universal-dev-standards",
195
+ "version": "2.0.0",
196
+ "installed": "2025-12-23"
197
+ },
198
+ "level": 2,
199
+ "standards": ["core/checkin-standards.md", ...],
200
+ "extensions": ["extensions/languages/php-style.md"],
201
+ "integrations": [".cursorrules"],
202
+ "skills": {
203
+ "installed": true,
204
+ "version": "1.1.0"
205
+ }
206
+ }
207
+ ```
208
+
209
+ ## Integration with Claude Code Skills | 與 Claude Code Skills 整合
210
+
211
+ This CLI works alongside [universal-dev-skills](https://github.com/AsiaOstrich/universal-dev-skills):
212
+ 此 CLI 與 [universal-dev-skills](https://github.com/AsiaOstrich/universal-dev-skills) 配合使用:
213
+
214
+ - **Skills** provide interactive AI assistance (commit messages, code review, etc.)
215
+ - **Skills** 提供互動式 AI 協助(commit 訊息、程式碼審查等)
216
+ - **Reference documents** provide guidelines for manual reference
217
+ - **參考文件**提供手動參考的指南
218
+
219
+ **Important | 重要**: For standards with Skills available, use the Skill OR copy the source document — never both.
220
+ 對於有可用 Skills 的規範,請使用 Skill 或複製來源文件 — 切勿兩者同時使用。
221
+
222
+ ## Related | 相關資源
223
+
224
+ - [universal-dev-standards](https://github.com/AsiaOstrich/universal-dev-standards) - Source repository | 原始碼庫
225
+ - [universal-dev-skills](https://github.com/AsiaOstrich/universal-dev-skills) - Claude Code Skills
226
+ - [Adoption Guide](https://github.com/AsiaOstrich/universal-dev-standards/blob/main/adoption/ADOPTION-GUIDE.md) - Complete guidance | 完整指南
227
+
228
+ ---
229
+
230
+ ## Version History | 版本歷史
231
+
232
+ | Version | Date | Changes |
233
+ |---------|------|---------|
234
+ | 3.0.0 | 2025-12-30 | Published to npm, enhanced init with AI tools selection |
235
+ | 1.0.1 | 2025-12-24 | Added: Bilingual support (English + Chinese) |
236
+ | 1.0.0 | 2025-12-23 | Initial CLI documentation |
237
+
238
+ ---
239
+
240
+ ## License | 授權
241
+
242
+ This project uses a **dual-license** model:
243
+ 本專案使用**雙授權**模式:
244
+
245
+ | Content Type | License | 說明 |
246
+ |-------------|---------|------|
247
+ | Documentation (`*.md`) | [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) | 文件 |
248
+ | Code (`*.js`, etc.) | [MIT](https://opensource.org/licenses/MIT) | 程式碼 |
package/bin/uds.js ADDED
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { program } from 'commander';
4
+ import { listCommand } from '../src/commands/list.js';
5
+ import { initCommand } from '../src/commands/init.js';
6
+ import { checkCommand } from '../src/commands/check.js';
7
+ import { updateCommand } from '../src/commands/update.js';
8
+ import { configureCommand } from '../src/commands/configure.js';
9
+
10
+ program
11
+ .name('uds')
12
+ .description('CLI tool for adopting Universal Development Standards')
13
+ .version('3.0.0');
14
+
15
+ program
16
+ .command('list')
17
+ .description('List available standards')
18
+ .option('-l, --level <level>', 'Filter by adoption level (1, 2, or 3)')
19
+ .option('-c, --category <category>', 'Filter by category (skill, reference, extension, integration, template)')
20
+ .action(listCommand);
21
+
22
+ program
23
+ .command('init')
24
+ .description('Initialize standards in current project')
25
+ .option('-m, --mode <mode>', 'Installation mode (skills, full)')
26
+ .option('-l, --level <level>', 'Adoption level (1=Essential, 2=Recommended, 3=Enterprise)')
27
+ .option('-f, --format <format>', 'Standards format (ai, human, both)')
28
+ .option('--workflow <workflow>', 'Git workflow (github-flow, gitflow, trunk-based)')
29
+ .option('--merge-strategy <strategy>', 'Merge strategy (squash, merge-commit, rebase-ff)')
30
+ .option('--commit-lang <lang>', 'Commit message language (english, traditional-chinese, bilingual)')
31
+ .option('--test-levels <levels>', 'Test levels, comma-separated (unit-testing,integration-testing,...)')
32
+ .option('--lang <language>', 'Language extension (csharp, php)')
33
+ .option('--framework <framework>', 'Framework extension (fat-free)')
34
+ .option('--locale <locale>', 'Locale extension (zh-tw)')
35
+ .option('-y, --yes', 'Use defaults, skip interactive prompts')
36
+ .action(initCommand);
37
+
38
+ program
39
+ .command('configure')
40
+ .alias('config')
41
+ .description('Modify options for initialized project')
42
+ .option('-t, --type <type>', 'Option type to configure (format, workflow, merge_strategy, commit_language, test_levels, all)')
43
+ .action(configureCommand);
44
+
45
+ program
46
+ .command('check')
47
+ .description('Check adoption status of current project')
48
+ .action(checkCommand);
49
+
50
+ program
51
+ .command('update')
52
+ .description('Update standards to latest version')
53
+ .option('-y, --yes', 'Skip confirmation prompts')
54
+ .action(updateCommand);
55
+
56
+ program.parse();
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "universal-dev-standards",
3
+ "version": "3.0.0",
4
+ "description": "CLI tool for adopting Universal Development Standards",
5
+ "keywords": [
6
+ "documentation",
7
+ "standards",
8
+ "cli",
9
+ "developer-tools",
10
+ "best-practices"
11
+ ],
12
+ "author": "AsiaOstrich",
13
+ "license": "MIT",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/AsiaOstrich/universal-dev-standards.git",
17
+ "directory": "cli"
18
+ },
19
+ "homepage": "https://github.com/AsiaOstrich/universal-dev-standards#readme",
20
+ "bugs": {
21
+ "url": "https://github.com/AsiaOstrich/universal-dev-standards/issues"
22
+ },
23
+ "type": "module",
24
+ "main": "src/index.js",
25
+ "bin": {
26
+ "uds": "bin/uds.js",
27
+ "universal-dev-standards": "bin/uds.js"
28
+ },
29
+ "files": [
30
+ "bin",
31
+ "src",
32
+ "standards-registry.json",
33
+ "README.md"
34
+ ],
35
+ "engines": {
36
+ "node": ">=18.0.0"
37
+ },
38
+ "scripts": {
39
+ "test": "vitest run",
40
+ "test:watch": "vitest",
41
+ "test:coverage": "vitest run --coverage",
42
+ "lint": "eslint src/",
43
+ "prepare": "cd .. && husky cli/.husky"
44
+ },
45
+ "dependencies": {
46
+ "chalk": "^5.3.0",
47
+ "commander": "^12.1.0",
48
+ "inquirer": "^9.2.12",
49
+ "ora": "^8.0.1"
50
+ },
51
+ "devDependencies": {
52
+ "@vitest/coverage-v8": "^4.0.16",
53
+ "eslint": "^8.56.0",
54
+ "husky": "^9.1.7",
55
+ "lint-staged": "^15.2.10",
56
+ "vitest": "^4.0.16"
57
+ },
58
+ "lint-staged": {
59
+ "src/**/*.js": [
60
+ "eslint --fix"
61
+ ]
62
+ }
63
+ }
@@ -0,0 +1,149 @@
1
+ import chalk from 'chalk';
2
+ import { existsSync } from 'fs';
3
+ import { join } from 'path';
4
+ import { readManifest, isInitialized } from '../utils/copier.js';
5
+ import {
6
+ getStandardsByLevel,
7
+ getLevelInfo,
8
+ getRepositoryInfo
9
+ } from '../utils/registry.js';
10
+
11
+ /**
12
+ * Check command - verify adoption status
13
+ */
14
+ export function checkCommand() {
15
+ const projectPath = process.cwd();
16
+
17
+ console.log();
18
+ console.log(chalk.bold('Universal Documentation Standards - Check'));
19
+ console.log(chalk.gray('─'.repeat(50)));
20
+
21
+ // Check if initialized
22
+ if (!isInitialized(projectPath)) {
23
+ console.log(chalk.red('✗ Standards not initialized in this project.'));
24
+ console.log(chalk.gray(' Run `uds init` to initialize.'));
25
+ console.log();
26
+ return;
27
+ }
28
+
29
+ // Read manifest
30
+ const manifest = readManifest(projectPath);
31
+ if (!manifest) {
32
+ console.log(chalk.red('✗ Could not read manifest file.'));
33
+ console.log(chalk.gray(' The .standards/manifest.json may be corrupted.'));
34
+ console.log();
35
+ return;
36
+ }
37
+
38
+ // Display adoption info
39
+ const levelInfo = getLevelInfo(manifest.level);
40
+ const repoInfo = getRepositoryInfo();
41
+
42
+ console.log(chalk.green('✓ Standards initialized'));
43
+ console.log();
44
+ console.log(chalk.cyan('Adoption Status:'));
45
+ console.log(chalk.gray(` Level: ${manifest.level} - ${levelInfo.name} (${levelInfo.nameZh})`));
46
+ console.log(chalk.gray(` Installed: ${manifest.upstream.installed}`));
47
+ console.log(chalk.gray(` Version: ${manifest.upstream.version}`));
48
+ console.log();
49
+
50
+ // Check for updates
51
+ if (manifest.upstream.version !== repoInfo.standards.version) {
52
+ console.log(chalk.yellow(`⚠ Update available: ${manifest.upstream.version} → ${repoInfo.standards.version}`));
53
+ console.log(chalk.gray(' Run `uds update` to update.'));
54
+ console.log();
55
+ }
56
+
57
+ // Check file integrity
58
+ console.log(chalk.cyan('File Integrity:'));
59
+
60
+ let missingCount = 0;
61
+ let presentCount = 0;
62
+
63
+ // Check standards
64
+ for (const std of manifest.standards) {
65
+ const filePath = join(projectPath, '.standards', std.split('/').pop());
66
+ if (existsSync(filePath)) {
67
+ presentCount++;
68
+ } else {
69
+ missingCount++;
70
+ console.log(chalk.red(` ✗ Missing: .standards/${std.split('/').pop()}`));
71
+ }
72
+ }
73
+
74
+ // Check extensions
75
+ for (const ext of manifest.extensions) {
76
+ const filePath = join(projectPath, '.standards', ext.split('/').pop());
77
+ if (existsSync(filePath)) {
78
+ presentCount++;
79
+ } else {
80
+ missingCount++;
81
+ console.log(chalk.red(` ✗ Missing: .standards/${ext.split('/').pop()}`));
82
+ }
83
+ }
84
+
85
+ // Check integrations
86
+ for (const int of manifest.integrations) {
87
+ const filePath = join(projectPath, int);
88
+ if (existsSync(filePath)) {
89
+ presentCount++;
90
+ } else {
91
+ missingCount++;
92
+ console.log(chalk.red(` ✗ Missing: ${int}`));
93
+ }
94
+ }
95
+
96
+ if (missingCount === 0) {
97
+ console.log(chalk.green(` ✓ All ${presentCount} files present`));
98
+ } else {
99
+ console.log(chalk.yellow(` ${presentCount} present, ${missingCount} missing`));
100
+ }
101
+ console.log();
102
+
103
+ // Skills status
104
+ console.log(chalk.cyan('Skills Status:'));
105
+ if (manifest.skills.installed) {
106
+ const skillsDir = join(process.env.HOME || '', '.claude', 'skills');
107
+ const hasGlobalSkills = existsSync(skillsDir);
108
+ const hasProjectSkills = existsSync(join(projectPath, '.claude', 'skills'));
109
+
110
+ if (hasGlobalSkills || hasProjectSkills) {
111
+ console.log(chalk.green(' ✓ Claude Code Skills installed'));
112
+ if (hasGlobalSkills) console.log(chalk.gray(' Global: ~/.claude/skills/'));
113
+ if (hasProjectSkills) console.log(chalk.gray(' Project: .claude/skills/'));
114
+ } else {
115
+ console.log(chalk.yellow(' ⚠ Skills marked as installed but not found'));
116
+ console.log(chalk.gray(' Run: git clone https://github.com/AsiaOstrich/universal-dev-skills.git'));
117
+ console.log(chalk.gray(' cd universal-dev-skills && ./install.sh'));
118
+ }
119
+ } else {
120
+ console.log(chalk.gray(' Skills not installed (using reference documents only)'));
121
+ }
122
+ console.log();
123
+
124
+ // Coverage report
125
+ console.log(chalk.cyan('Coverage Summary:'));
126
+ const expectedStandards = getStandardsByLevel(manifest.level);
127
+ const skillStandards = expectedStandards.filter(s => s.skillName);
128
+ const refStandards = expectedStandards.filter(s => !s.skillName);
129
+
130
+ console.log(chalk.gray(` Level ${manifest.level} requires ${expectedStandards.length} standards:`));
131
+ console.log(chalk.gray(` ${skillStandards.length} with Skills (interactive AI assistance)`));
132
+ console.log(chalk.gray(` ${refStandards.length} reference documents`));
133
+
134
+ const coveredBySkills = manifest.skills.installed ? skillStandards.length : 0;
135
+ const coveredByDocs = manifest.standards.length;
136
+
137
+ console.log(chalk.gray(' Your coverage:'));
138
+ console.log(chalk.gray(` ${coveredBySkills} via Skills`));
139
+ console.log(chalk.gray(` ${coveredByDocs} via copied documents`));
140
+ console.log();
141
+
142
+ // Final status
143
+ if (missingCount === 0 && (manifest.skills.installed || !manifest.skills.installed)) {
144
+ console.log(chalk.green('✓ Project is compliant with standards'));
145
+ } else {
146
+ console.log(chalk.yellow('⚠ Some issues detected. Review above for details.'));
147
+ }
148
+ console.log();
149
+ }