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,207 @@
|
|
|
1
|
+
import { readFileSync } from 'fs';
|
|
2
|
+
import { fileURLToPath } from 'url';
|
|
3
|
+
import { dirname, join } from 'path';
|
|
4
|
+
|
|
5
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = dirname(__filename);
|
|
7
|
+
|
|
8
|
+
// Path to the standards registry (bundled with CLI package)
|
|
9
|
+
const REGISTRY_PATH = join(__dirname, '../../standards-registry.json');
|
|
10
|
+
|
|
11
|
+
let registryCache = null;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Load the standards registry
|
|
15
|
+
* @returns {Object} The standards registry
|
|
16
|
+
*/
|
|
17
|
+
export function loadRegistry() {
|
|
18
|
+
if (registryCache) {
|
|
19
|
+
return registryCache;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
const content = readFileSync(REGISTRY_PATH, 'utf-8');
|
|
24
|
+
registryCache = JSON.parse(content);
|
|
25
|
+
return registryCache;
|
|
26
|
+
} catch (error) {
|
|
27
|
+
throw new Error(`Failed to load standards registry: ${error.message}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Get standards filtered by level
|
|
33
|
+
* @param {number} level - Adoption level (1, 2, or 3)
|
|
34
|
+
* @returns {Array} Standards at or below the specified level
|
|
35
|
+
*/
|
|
36
|
+
export function getStandardsByLevel(level) {
|
|
37
|
+
const registry = loadRegistry();
|
|
38
|
+
return registry.standards.filter(s => s.level <= level);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Get standards filtered by category
|
|
43
|
+
* @param {string} category - Category name
|
|
44
|
+
* @returns {Array} Standards matching the category
|
|
45
|
+
*/
|
|
46
|
+
export function getStandardsByCategory(category) {
|
|
47
|
+
const registry = loadRegistry();
|
|
48
|
+
return registry.standards.filter(s => s.category === category);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Get all standards
|
|
53
|
+
* @returns {Array} All standards
|
|
54
|
+
*/
|
|
55
|
+
export function getAllStandards() {
|
|
56
|
+
const registry = loadRegistry();
|
|
57
|
+
return registry.standards;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Get adoption level info
|
|
62
|
+
* @param {number} level - Adoption level
|
|
63
|
+
* @returns {Object} Level information
|
|
64
|
+
*/
|
|
65
|
+
export function getLevelInfo(level) {
|
|
66
|
+
const registry = loadRegistry();
|
|
67
|
+
return registry.adoptionLevels[String(level)];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Get category info
|
|
72
|
+
* @param {string} category - Category name
|
|
73
|
+
* @returns {Object} Category information
|
|
74
|
+
*/
|
|
75
|
+
export function getCategoryInfo(category) {
|
|
76
|
+
const registry = loadRegistry();
|
|
77
|
+
return registry.categories[category];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Get repository info
|
|
82
|
+
* @returns {Object} Repository information
|
|
83
|
+
*/
|
|
84
|
+
export function getRepositoryInfo() {
|
|
85
|
+
const registry = loadRegistry();
|
|
86
|
+
return registry.repositories;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Get standards that have skills
|
|
91
|
+
* @returns {Array} Standards with skillName defined
|
|
92
|
+
*/
|
|
93
|
+
export function getSkillStandards() {
|
|
94
|
+
const registry = loadRegistry();
|
|
95
|
+
return registry.standards.filter(s => s.skillName);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Get reference standards (no skills)
|
|
100
|
+
* @returns {Array} Standards without skills that need to be copied
|
|
101
|
+
*/
|
|
102
|
+
export function getReferenceStandards() {
|
|
103
|
+
const registry = loadRegistry();
|
|
104
|
+
return registry.standards.filter(s => !s.skillName && s.category === 'reference');
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Get skill files mapping
|
|
109
|
+
* @returns {Object} Mapping of skill names to their file paths
|
|
110
|
+
*/
|
|
111
|
+
export function getSkillFiles() {
|
|
112
|
+
const registry = loadRegistry();
|
|
113
|
+
return registry.skillFiles || {};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Get all skill names
|
|
118
|
+
* @returns {string[]} Array of skill names
|
|
119
|
+
*/
|
|
120
|
+
export function getAllSkillNames() {
|
|
121
|
+
const registry = loadRegistry();
|
|
122
|
+
return Object.keys(registry.skillFiles || {});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Get standards that have options
|
|
127
|
+
* @returns {Array} Standards with options defined
|
|
128
|
+
*/
|
|
129
|
+
export function getStandardsWithOptions() {
|
|
130
|
+
const registry = loadRegistry();
|
|
131
|
+
return registry.standards.filter(s => s.options);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Get option categories
|
|
136
|
+
* @returns {Object} Option categories
|
|
137
|
+
*/
|
|
138
|
+
export function getOptionCategories() {
|
|
139
|
+
const registry = loadRegistry();
|
|
140
|
+
return registry.optionCategories || {};
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Get source path for a standard based on format
|
|
145
|
+
* @param {Object} standard - Standard object from registry
|
|
146
|
+
* @param {string} format - 'ai' or 'human'
|
|
147
|
+
* @returns {string} Source path
|
|
148
|
+
*/
|
|
149
|
+
export function getStandardSource(standard, format = 'human') {
|
|
150
|
+
if (typeof standard.source === 'string') {
|
|
151
|
+
return standard.source;
|
|
152
|
+
}
|
|
153
|
+
return standard.source[format] || standard.source.human;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Get source path for an option based on format
|
|
158
|
+
* @param {Object} option - Option object from registry
|
|
159
|
+
* @param {string} format - 'ai' or 'human'
|
|
160
|
+
* @returns {string} Source path
|
|
161
|
+
*/
|
|
162
|
+
export function getOptionSource(option, format = 'human') {
|
|
163
|
+
if (typeof option.source === 'string') {
|
|
164
|
+
return option.source;
|
|
165
|
+
}
|
|
166
|
+
return option.source[format] || option.source.human;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Find option by ID within a standard
|
|
171
|
+
* @param {Object} standard - Standard object
|
|
172
|
+
* @param {string} categoryKey - Option category key (e.g., 'workflow')
|
|
173
|
+
* @param {string} optionId - Option ID to find
|
|
174
|
+
* @returns {Object|null} Option object or null
|
|
175
|
+
*/
|
|
176
|
+
export function findOption(standard, categoryKey, optionId) {
|
|
177
|
+
if (!standard.options || !standard.options[categoryKey]) {
|
|
178
|
+
return null;
|
|
179
|
+
}
|
|
180
|
+
return standard.options[categoryKey].choices.find(c => c.id === optionId) || null;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Get default option for a category
|
|
185
|
+
* @param {Object} standard - Standard object
|
|
186
|
+
* @param {string} categoryKey - Option category key
|
|
187
|
+
* @returns {string|null} Default option ID or null
|
|
188
|
+
*/
|
|
189
|
+
export function getDefaultOption(standard, categoryKey) {
|
|
190
|
+
if (!standard.options || !standard.options[categoryKey]) {
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
return standard.options[categoryKey].default;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Check if option category supports multi-select
|
|
198
|
+
* @param {Object} standard - Standard object
|
|
199
|
+
* @param {string} categoryKey - Option category key
|
|
200
|
+
* @returns {boolean} True if multi-select
|
|
201
|
+
*/
|
|
202
|
+
export function isMultiSelectOption(standard, categoryKey) {
|
|
203
|
+
if (!standard.options || !standard.options[categoryKey]) {
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
return standard.options[categoryKey].multiSelect === true;
|
|
207
|
+
}
|