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 +21 -0
- package/README.md +248 -0
- package/bin/uds.js +56 -0
- package/package.json +63 -0
- package/src/commands/check.js +149 -0
- package/src/commands/configure.js +221 -0
- package/src/commands/init.js +665 -0
- package/src/commands/list.js +100 -0
- package/src/commands/update.js +186 -0
- package/src/index.js +7 -0
- package/src/prompts/init.js +702 -0
- package/src/prompts/integrations.js +453 -0
- package/src/utils/copier.js +143 -0
- package/src/utils/detector.js +159 -0
- package/src/utils/github.js +508 -0
- package/src/utils/integration-generator.js +1694 -0
- package/src/utils/registry.js +207 -0
- package/standards-registry.json +658 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import {
|
|
3
|
+
getAllStandards,
|
|
4
|
+
getStandardsByLevel,
|
|
5
|
+
getStandardsByCategory,
|
|
6
|
+
getLevelInfo,
|
|
7
|
+
getCategoryInfo,
|
|
8
|
+
getRepositoryInfo
|
|
9
|
+
} from '../utils/registry.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* List command - displays available standards
|
|
13
|
+
* @param {Object} options - Command options
|
|
14
|
+
*/
|
|
15
|
+
export function listCommand(options) {
|
|
16
|
+
const { level, category } = options;
|
|
17
|
+
|
|
18
|
+
console.log();
|
|
19
|
+
console.log(chalk.bold('Universal Development Standards'));
|
|
20
|
+
console.log(chalk.gray('─'.repeat(50)));
|
|
21
|
+
|
|
22
|
+
const repoInfo = getRepositoryInfo();
|
|
23
|
+
console.log(chalk.gray(`Version: ${repoInfo.standards.version}`));
|
|
24
|
+
console.log();
|
|
25
|
+
|
|
26
|
+
let standards;
|
|
27
|
+
|
|
28
|
+
if (level) {
|
|
29
|
+
const levelNum = parseInt(level, 10);
|
|
30
|
+
if (![1, 2, 3].includes(levelNum)) {
|
|
31
|
+
console.log(chalk.red('Error: Level must be 1, 2, or 3'));
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
standards = getStandardsByLevel(levelNum);
|
|
35
|
+
const levelInfo = getLevelInfo(levelNum);
|
|
36
|
+
console.log(chalk.cyan(`Showing Level ${levelNum}: ${levelInfo.name} (${levelInfo.nameZh})`));
|
|
37
|
+
console.log(chalk.gray(levelInfo.description));
|
|
38
|
+
console.log();
|
|
39
|
+
} else if (category) {
|
|
40
|
+
const categoryInfo = getCategoryInfo(category);
|
|
41
|
+
if (!categoryInfo) {
|
|
42
|
+
console.log(chalk.red(`Error: Unknown category '${category}'`));
|
|
43
|
+
console.log(chalk.gray('Valid categories: skill, reference, extension, integration, template'));
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
standards = getStandardsByCategory(category);
|
|
47
|
+
console.log(chalk.cyan(`Category: ${categoryInfo.name}`));
|
|
48
|
+
console.log(chalk.gray(categoryInfo.description));
|
|
49
|
+
console.log();
|
|
50
|
+
} else {
|
|
51
|
+
standards = getAllStandards();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Group by category
|
|
55
|
+
const grouped = {};
|
|
56
|
+
for (const std of standards) {
|
|
57
|
+
if (!grouped[std.category]) {
|
|
58
|
+
grouped[std.category] = [];
|
|
59
|
+
}
|
|
60
|
+
grouped[std.category].push(std);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Display each category
|
|
64
|
+
const categoryOrder = ['skill', 'reference', 'extension', 'integration', 'template'];
|
|
65
|
+
|
|
66
|
+
for (const cat of categoryOrder) {
|
|
67
|
+
if (!grouped[cat] || grouped[cat].length === 0) continue;
|
|
68
|
+
|
|
69
|
+
const catInfo = getCategoryInfo(cat);
|
|
70
|
+
console.log(chalk.yellow.bold(`${catInfo.name} (${grouped[cat].length})`));
|
|
71
|
+
|
|
72
|
+
for (const std of grouped[cat]) {
|
|
73
|
+
const levelBadge = chalk.gray(`[L${std.level}]`);
|
|
74
|
+
const name = std.skillName
|
|
75
|
+
? chalk.green(`${std.name}`) + chalk.gray(` → ${std.skillName}`)
|
|
76
|
+
: chalk.white(std.name);
|
|
77
|
+
|
|
78
|
+
console.log(` ${levelBadge} ${name}`);
|
|
79
|
+
// Handle source being an object with human/ai paths
|
|
80
|
+
const sourceDisplay = typeof std.source === 'object'
|
|
81
|
+
? std.source.human || std.source.ai
|
|
82
|
+
: std.source;
|
|
83
|
+
console.log(chalk.gray(` ${sourceDisplay}`));
|
|
84
|
+
|
|
85
|
+
if (std.applicability) {
|
|
86
|
+
console.log(chalk.gray(` Applies to: ${std.applicability}`));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
console.log();
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Summary
|
|
93
|
+
console.log(chalk.gray('─'.repeat(50)));
|
|
94
|
+
const skillCount = standards.filter(s => s.skillName).length;
|
|
95
|
+
const refCount = standards.filter(s => !s.skillName).length;
|
|
96
|
+
console.log(chalk.gray(`Total: ${standards.length} standards (${skillCount} with Skills, ${refCount} reference-only)`));
|
|
97
|
+
console.log();
|
|
98
|
+
console.log(chalk.gray('Run `uds init` to adopt standards in your project.'));
|
|
99
|
+
console.log(chalk.gray('See: https://github.com/AsiaOstrich/universal-dev-standards/blob/main/adoption/ADOPTION-GUIDE.md'));
|
|
100
|
+
}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import ora from 'ora';
|
|
3
|
+
import inquirer from 'inquirer';
|
|
4
|
+
import { readManifest, writeManifest, copyStandard, copyIntegration, isInitialized } from '../utils/copier.js';
|
|
5
|
+
import { getRepositoryInfo } from '../utils/registry.js';
|
|
6
|
+
|
|
7
|
+
// Integration file mappings (same as init.js)
|
|
8
|
+
const INTEGRATION_MAPPINGS = {
|
|
9
|
+
cursor: {
|
|
10
|
+
source: 'integrations/cursor/.cursorrules',
|
|
11
|
+
target: '.cursorrules'
|
|
12
|
+
},
|
|
13
|
+
windsurf: {
|
|
14
|
+
source: 'integrations/windsurf/.windsurfrules',
|
|
15
|
+
target: '.windsurfrules'
|
|
16
|
+
},
|
|
17
|
+
cline: {
|
|
18
|
+
source: 'integrations/cline/.clinerules',
|
|
19
|
+
target: '.clinerules'
|
|
20
|
+
},
|
|
21
|
+
copilot: {
|
|
22
|
+
source: 'integrations/github-copilot/copilot-instructions.md',
|
|
23
|
+
target: '.github/copilot-instructions.md'
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Update command - update standards to latest version
|
|
29
|
+
* @param {Object} options - Command options
|
|
30
|
+
*/
|
|
31
|
+
export async function updateCommand(options) {
|
|
32
|
+
const projectPath = process.cwd();
|
|
33
|
+
|
|
34
|
+
console.log();
|
|
35
|
+
console.log(chalk.bold('Universal Documentation Standards - Update'));
|
|
36
|
+
console.log(chalk.gray('─'.repeat(50)));
|
|
37
|
+
|
|
38
|
+
// Check if initialized
|
|
39
|
+
if (!isInitialized(projectPath)) {
|
|
40
|
+
console.log(chalk.red('✗ Standards not initialized in this project.'));
|
|
41
|
+
console.log(chalk.gray(' Run `uds init` to initialize first.'));
|
|
42
|
+
console.log();
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Read manifest
|
|
47
|
+
const manifest = readManifest(projectPath);
|
|
48
|
+
if (!manifest) {
|
|
49
|
+
console.log(chalk.red('✗ Could not read manifest file.'));
|
|
50
|
+
console.log();
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Check versions
|
|
55
|
+
const repoInfo = getRepositoryInfo();
|
|
56
|
+
const currentVersion = manifest.upstream.version;
|
|
57
|
+
const latestVersion = repoInfo.standards.version;
|
|
58
|
+
|
|
59
|
+
console.log(chalk.gray(`Current version: ${currentVersion}`));
|
|
60
|
+
console.log(chalk.gray(`Latest version: ${latestVersion}`));
|
|
61
|
+
console.log();
|
|
62
|
+
|
|
63
|
+
if (currentVersion === latestVersion) {
|
|
64
|
+
console.log(chalk.green('✓ Standards are up to date.'));
|
|
65
|
+
console.log();
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
console.log(chalk.cyan(`Update available: ${currentVersion} → ${latestVersion}`));
|
|
70
|
+
console.log();
|
|
71
|
+
|
|
72
|
+
// List files to update
|
|
73
|
+
console.log(chalk.gray('Files to update:'));
|
|
74
|
+
for (const std of manifest.standards) {
|
|
75
|
+
console.log(chalk.gray(` .standards/${std.split('/').pop()}`));
|
|
76
|
+
}
|
|
77
|
+
for (const ext of manifest.extensions) {
|
|
78
|
+
console.log(chalk.gray(` .standards/${ext.split('/').pop()}`));
|
|
79
|
+
}
|
|
80
|
+
for (const int of manifest.integrations) {
|
|
81
|
+
console.log(chalk.gray(` ${int}`));
|
|
82
|
+
}
|
|
83
|
+
console.log();
|
|
84
|
+
|
|
85
|
+
// Confirm
|
|
86
|
+
if (!options.yes) {
|
|
87
|
+
const { confirmed } = await inquirer.prompt([
|
|
88
|
+
{
|
|
89
|
+
type: 'confirm',
|
|
90
|
+
name: 'confirmed',
|
|
91
|
+
message: 'Proceed with update? This will overwrite existing files.',
|
|
92
|
+
default: true
|
|
93
|
+
}
|
|
94
|
+
]);
|
|
95
|
+
|
|
96
|
+
if (!confirmed) {
|
|
97
|
+
console.log(chalk.yellow('Update cancelled.'));
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Perform update
|
|
103
|
+
console.log();
|
|
104
|
+
const spinner = ora('Updating standards...').start();
|
|
105
|
+
|
|
106
|
+
const results = {
|
|
107
|
+
updated: [],
|
|
108
|
+
errors: []
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
// Update standards
|
|
112
|
+
for (const std of manifest.standards) {
|
|
113
|
+
const result = copyStandard(std, '.standards', projectPath);
|
|
114
|
+
if (result.success) {
|
|
115
|
+
results.updated.push(std);
|
|
116
|
+
} else {
|
|
117
|
+
results.errors.push(`${std}: ${result.error}`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Update extensions
|
|
122
|
+
for (const ext of manifest.extensions) {
|
|
123
|
+
const result = copyStandard(ext, '.standards', projectPath);
|
|
124
|
+
if (result.success) {
|
|
125
|
+
results.updated.push(ext);
|
|
126
|
+
} else {
|
|
127
|
+
results.errors.push(`${ext}: ${result.error}`);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Update integrations
|
|
132
|
+
for (const int of manifest.integrations) {
|
|
133
|
+
// Find the mapping for this integration
|
|
134
|
+
let mapping = null;
|
|
135
|
+
for (const [, m] of Object.entries(INTEGRATION_MAPPINGS)) {
|
|
136
|
+
if (m.target === int) {
|
|
137
|
+
mapping = m;
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (mapping) {
|
|
143
|
+
const result = copyIntegration(mapping.source, mapping.target, projectPath);
|
|
144
|
+
if (result.success) {
|
|
145
|
+
results.updated.push(int);
|
|
146
|
+
} else {
|
|
147
|
+
results.errors.push(`${int}: ${result.error}`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
spinner.succeed(`Updated ${results.updated.length} files`);
|
|
153
|
+
|
|
154
|
+
// Update manifest
|
|
155
|
+
manifest.upstream.version = latestVersion;
|
|
156
|
+
manifest.upstream.installed = new Date().toISOString().split('T')[0];
|
|
157
|
+
writeManifest(manifest, projectPath);
|
|
158
|
+
|
|
159
|
+
// Summary
|
|
160
|
+
console.log();
|
|
161
|
+
console.log(chalk.green('✓ Standards updated successfully!'));
|
|
162
|
+
console.log(chalk.gray(` Version: ${currentVersion} → ${latestVersion}`));
|
|
163
|
+
|
|
164
|
+
if (results.errors.length > 0) {
|
|
165
|
+
console.log();
|
|
166
|
+
console.log(chalk.yellow(`⚠ ${results.errors.length} file(s) could not be updated:`));
|
|
167
|
+
for (const err of results.errors) {
|
|
168
|
+
console.log(chalk.gray(` ${err}`));
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Skills update reminder
|
|
173
|
+
if (manifest.skills.installed) {
|
|
174
|
+
const skillsVersion = repoInfo.skills.version;
|
|
175
|
+
if (manifest.skills.version !== skillsVersion) {
|
|
176
|
+
console.log();
|
|
177
|
+
console.log(chalk.cyan('Skills update available:'));
|
|
178
|
+
console.log(chalk.gray(` Current: ${manifest.skills.version || 'unknown'}`));
|
|
179
|
+
console.log(chalk.gray(` Latest: ${skillsVersion}`));
|
|
180
|
+
console.log(chalk.gray(' Run the following to update:'));
|
|
181
|
+
console.log(chalk.gray(' cd path/to/universal-dev-skills && git pull && ./install.sh'));
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
console.log();
|
|
186
|
+
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Universal Documentation Standards CLI
|
|
2
|
+
// Main entry point
|
|
3
|
+
|
|
4
|
+
export { listCommand } from './commands/list.js';
|
|
5
|
+
export { initCommand } from './commands/init.js';
|
|
6
|
+
export { checkCommand } from './commands/check.js';
|
|
7
|
+
export { updateCommand } from './commands/update.js';
|