universal-dev-standards 4.1.0 → 4.2.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.
Files changed (46) hide show
  1. package/bin/uds.js +75 -0
  2. package/bundled/core/ai-friendly-architecture.md +542 -0
  3. package/bundled/locales/zh-CN/README.md +210 -509
  4. package/bundled/locales/zh-CN/core/ai-friendly-architecture.md +306 -0
  5. package/bundled/locales/zh-CN/docs/AI-AGENT-ROADMAP.md +82 -22
  6. package/bundled/locales/zh-CN/integrations/gemini-cli/GEMINI.md +35 -3
  7. package/bundled/locales/zh-CN/integrations/github-copilot/COPILOT-CHAT-REFERENCE.md +89 -3
  8. package/bundled/locales/zh-CN/integrations/github-copilot/skills-mapping.md +8 -4
  9. package/bundled/locales/zh-TW/README.md +211 -490
  10. package/bundled/locales/zh-TW/core/ai-friendly-architecture.md +306 -0
  11. package/bundled/locales/zh-TW/docs/AI-AGENT-ROADMAP.md +82 -22
  12. package/bundled/locales/zh-TW/integrations/gemini-cli/GEMINI.md +35 -3
  13. package/bundled/locales/zh-TW/integrations/github-copilot/COPILOT-CHAT-REFERENCE.md +89 -3
  14. package/bundled/locales/zh-TW/integrations/github-copilot/skills-mapping.md +8 -4
  15. package/bundled/skills/claude-code/README.md +8 -0
  16. package/bundled/skills/claude-code/agents/README.md +305 -0
  17. package/bundled/skills/claude-code/agents/code-architect.md +259 -0
  18. package/bundled/skills/claude-code/agents/doc-writer.md +406 -0
  19. package/bundled/skills/claude-code/agents/reviewer.md +353 -0
  20. package/bundled/skills/claude-code/agents/spec-analyst.md +374 -0
  21. package/bundled/skills/claude-code/agents/test-specialist.md +364 -0
  22. package/bundled/skills/claude-code/workflows/README.md +303 -0
  23. package/bundled/skills/claude-code/workflows/code-review.workflow.yaml +186 -0
  24. package/bundled/skills/claude-code/workflows/feature-dev.workflow.yaml +174 -0
  25. package/bundled/skills/claude-code/workflows/integrated-flow.workflow.yaml +238 -0
  26. package/bundled/skills/claude-code/workflows/large-codebase-analysis.workflow.yaml +226 -0
  27. package/package.json +11 -1
  28. package/src/commands/agent.js +417 -0
  29. package/src/commands/ai-context.js +552 -0
  30. package/src/commands/check.js +3 -3
  31. package/src/commands/init.js +6 -3
  32. package/src/commands/workflow.js +425 -0
  33. package/src/config/ai-agent-paths.js +217 -13
  34. package/src/core/constants.js +514 -0
  35. package/src/core/errors.js +398 -0
  36. package/src/core/manifest.js +473 -0
  37. package/src/core/paths.js +398 -0
  38. package/src/prompts/init.js +7 -5
  39. package/src/utils/agent-adapter.js +320 -0
  40. package/src/utils/agents-installer.js +393 -0
  41. package/src/utils/context-chunker.js +467 -0
  42. package/src/utils/copier.js +59 -99
  43. package/src/utils/hasher.js +2 -16
  44. package/src/utils/integration-generator.js +28 -52
  45. package/src/utils/workflows-installer.js +545 -0
  46. package/standards-registry.json +166 -20
@@ -0,0 +1,514 @@
1
+ /**
2
+ * UDS Constants Registry
3
+ * Centralized management of all constants used across the UDS CLI
4
+ */
5
+
6
+ /**
7
+ * UDS markers for different file formats
8
+ * Used to identify UDS-managed sections in integration files
9
+ */
10
+ export const UDS_MARKERS = {
11
+ markdown: {
12
+ start: '<!-- UDS:STANDARDS:START -->',
13
+ end: '<!-- UDS:STANDARDS:END -->'
14
+ },
15
+ plaintext: {
16
+ start: '# === UDS:STANDARDS:START ===',
17
+ end: '# === UDS:STANDARDS:END ==='
18
+ },
19
+ // Additional marker variants for future use
20
+ yaml: {
21
+ start: '# === UDS:START ===',
22
+ end: '# === UDS:END ==='
23
+ },
24
+ json: {
25
+ start: '/* === UDS:START === */',
26
+ end: '/* === UDS:END === */'
27
+ }
28
+ };
29
+
30
+ /**
31
+ * UDS block markers for content integration
32
+ * Used to mark different types of content blocks
33
+ */
34
+ export const UDS_BLOCKS = {
35
+ INTRO: 'INTRO',
36
+ STANDARDS: 'STANDARDS',
37
+ COMMANDS: 'COMMANDS',
38
+ SKILLS: 'SKILLS',
39
+ AGENTS: 'AGENTS',
40
+ WORKFLOWS: 'WORKFLOWS',
41
+ REFERENCES: 'REFERENCES'
42
+ };
43
+
44
+ /**
45
+ * Supported AI tools and their configurations
46
+ */
47
+ export const SUPPORTED_AI_TOOLS = {
48
+ 'claude-code': {
49
+ name: 'Claude Code',
50
+ file: 'CLAUDE.md',
51
+ format: 'markdown',
52
+ category: 'primary',
53
+ supports: ['skills', 'commands', 'agents', 'workflows']
54
+ },
55
+ 'opencode': {
56
+ name: 'OpenCode',
57
+ file: 'AGENTS.md',
58
+ format: 'markdown',
59
+ category: 'primary',
60
+ supports: ['skills', 'commands']
61
+ },
62
+ 'cursor': {
63
+ name: 'Cursor',
64
+ file: '.cursorrules',
65
+ format: 'plaintext',
66
+ category: 'secondary',
67
+ supports: ['skills']
68
+ },
69
+ 'windsurf': {
70
+ name: 'Windsurf',
71
+ file: '.windsurfrules',
72
+ format: 'plaintext',
73
+ category: 'secondary',
74
+ supports: ['skills']
75
+ },
76
+ 'cline': {
77
+ name: 'Cline',
78
+ file: '.clinerules',
79
+ format: 'plaintext',
80
+ category: 'secondary',
81
+ supports: ['skills']
82
+ },
83
+ 'github-copilot': {
84
+ name: 'GitHub Copilot',
85
+ file: '.github/copilot-instructions.md',
86
+ format: 'markdown',
87
+ category: 'secondary',
88
+ supports: ['skills', 'commands']
89
+ },
90
+ 'aider': {
91
+ name: 'Aider',
92
+ file: '.aider.conf.yml',
93
+ format: 'yaml',
94
+ category: 'secondary',
95
+ supports: ['skills']
96
+ },
97
+ 'roo': {
98
+ name: 'Roo',
99
+ file: 'ROO.md',
100
+ format: 'markdown',
101
+ category: 'secondary',
102
+ supports: ['skills', 'workflows']
103
+ },
104
+ 'antigravity': {
105
+ name: 'Antigravity',
106
+ file: 'INSTRUCTIONS.md',
107
+ format: 'markdown',
108
+ category: 'secondary',
109
+ supports: ['skills', 'workflows']
110
+ }
111
+ };
112
+
113
+ /**
114
+ * Legacy tool name mappings (for backward compatibility)
115
+ */
116
+ export const LEGACY_TOOL_MAPPINGS = {
117
+ 'codex': 'opencode',
118
+ 'gemini-cli': 'opencode',
119
+ 'copilot': 'github-copilot'
120
+ };
121
+
122
+ /**
123
+ * File format extensions
124
+ */
125
+ export const FILE_EXTENSIONS = {
126
+ MARKDOWN: '.md',
127
+ AI_YAML: '.ai.yaml',
128
+ YAML: '.yaml',
129
+ YML: '.yml',
130
+ JSON: '.json',
131
+ WORKFLOW: '.workflow.yaml',
132
+ AGENT: '.md'
133
+ };
134
+
135
+ /**
136
+ * Content modes for integration files
137
+ */
138
+ export const CONTENT_MODES = {
139
+ MINIMAL: 'minimal', // Reference-only content
140
+ INDEX: 'index', // Standard index with descriptions
141
+ FULL: 'full' // Full standard content embedded
142
+ };
143
+
144
+ /**
145
+ * Standards scope options
146
+ */
147
+ export const STANDARDS_SCOPES = {
148
+ MINIMAL: 'minimal', // Core standards only
149
+ FULL: 'full' // All standards including extensions
150
+ };
151
+
152
+ /**
153
+ * Standard file formats
154
+ */
155
+ export const STANDARD_FORMATS = {
156
+ AI: 'ai', // AI-optimized format (.ai.yaml)
157
+ HUMAN: 'human', // Human-readable format (.md)
158
+ BOTH: 'both' // Both formats installed
159
+ };
160
+
161
+ /**
162
+ * Adoption levels
163
+ */
164
+ export const ADOPTION_LEVELS = {
165
+ LEVEL_1: 1, // Core standards only
166
+ LEVEL_2: 2, // Core + workflow standards
167
+ LEVEL_3: 3 // Full standards suite
168
+ };
169
+
170
+ /**
171
+ * Git workflow types
172
+ */
173
+ export const GIT_WORKFLOWS = {
174
+ GITHUB_FLOW: 'github-flow',
175
+ GITFLOW: 'gitflow',
176
+ TRUNK_BASED: 'trunk-based'
177
+ };
178
+
179
+ /**
180
+ * Merge strategies
181
+ */
182
+ export const MERGE_STRATEGIES = {
183
+ MERGE: 'merge',
184
+ SQUASH: 'squash',
185
+ REBASE: 'rebase'
186
+ };
187
+
188
+ /**
189
+ * Commit message languages
190
+ */
191
+ export const COMMIT_LANGUAGES = {
192
+ ENGLISH: 'english',
193
+ CHINESE: 'chinese',
194
+ BILINGUAL: 'bilingual'
195
+ };
196
+
197
+ /**
198
+ * Test levels
199
+ */
200
+ export const TEST_LEVELS = {
201
+ UNIT_TESTING: 'unit-testing',
202
+ INTEGRATION_TESTING: 'integration-testing',
203
+ E2E_TESTING: 'e2e-testing'
204
+ };
205
+
206
+ /**
207
+ * Installation locations
208
+ */
209
+ export const INSTALLATION_LOCATIONS = {
210
+ PROJECT: 'project',
211
+ USER: 'user',
212
+ MARKETPLACE: 'marketplace'
213
+ };
214
+
215
+ /**
216
+ * Skill categories
217
+ */
218
+ export const SKILL_CATEGORIES = {
219
+ AGENTS: 'agents',
220
+ WORKFLOWS: 'workflows',
221
+ COMMANDS: 'commands',
222
+ UTILITIES: 'utilities'
223
+ };
224
+
225
+ /**
226
+ * Directory structure constants
227
+ */
228
+ export const DIRECTORIES = {
229
+ STANDARDS: '.standards',
230
+ UDS: '.uds',
231
+ CORE: 'core',
232
+ AI: 'ai',
233
+ LOCALES: 'locales',
234
+ SKILLS: 'skills',
235
+ AGENTS: 'agents',
236
+ WORKFLOWS: 'workflows',
237
+ TEMPLATES: 'templates',
238
+ INTEGRATIONS: 'integrations',
239
+ CONFIG: 'config',
240
+ DOCS: 'docs'
241
+ };
242
+
243
+ /**
244
+ * Standard file patterns
245
+ */
246
+ export const FILE_PATTERNS = {
247
+ STANDARDS: `${DIRECTORIES.CORE}/*.md`,
248
+ AI_STANDARDS: `${DIRECTORIES.AI}/standards/*.ai.yaml`,
249
+ LOCALES: `${DIRECTORIES.LOCALES}/*/**.md`,
250
+ SKILLS: `${DIRECTORIES.SKILLS}/**`,
251
+ WORKFLOWS: `${DIRECTORIES.WORKFLOWS}/**`,
252
+ TEMPLATES: `${DIRECTORIES.TEMPLATES}/**`,
253
+ CONFIG: `${DIRECTORIES.CONFIG}/**`
254
+ };
255
+
256
+ /**
257
+ * HTTP configuration
258
+ */
259
+ export const HTTP_CONFIG = {
260
+ TIMEOUT: 30000, // 30 seconds
261
+ MAX_RETRIES: 3,
262
+ RETRY_DELAY: 1000, // 1 second
263
+ USER_AGENT: 'UDS-CLI/4.1.0'
264
+ };
265
+
266
+ /**
267
+ * GitHub configuration
268
+ */
269
+ export const GITHUB_CONFIG = {
270
+ REPO: 'AsiaOstrich/universal-dev-standards',
271
+ API_BASE: 'https://api.github.com',
272
+ RAW_BASE: 'https://raw.githubusercontent.com',
273
+ DEFAULT_BRANCH: 'main'
274
+ };
275
+
276
+ /**
277
+ * Hash algorithm and format
278
+ */
279
+ export const HASH_CONFIG = {
280
+ ALGORITHM: 'sha256',
281
+ PREFIX: 'sha256:',
282
+ ENCODING: 'hex'
283
+ };
284
+
285
+ /**
286
+ * Validation patterns
287
+ */
288
+ export const VALIDATION_PATTERNS = {
289
+ SEMVER: '^\\d+\\.\\d+\\.\\d+(-[a-zA-Z0-9.-]+)?(\\+[a-zA-Z0-9.-]+)?$',
290
+ EMAIL: '^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$',
291
+ URL: '^https?://[^\\s/$.?#].[^\\s]*$',
292
+ REPO: '^[\\w-]+/[\\w-]+$'
293
+ };
294
+
295
+ /**
296
+ * UI configuration
297
+ */
298
+ export const UI_CONFIG = {
299
+ MAX_WIDTH: 80,
300
+ INDENT_SIZE: 2,
301
+ TABLE_MIN_WIDTH: 60,
302
+ PROGRESS_BAR_WIDTH: 40,
303
+ SPINNER_FRAMES: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'],
304
+ COLORS: {
305
+ SUCCESS: 'green',
306
+ ERROR: 'red',
307
+ WARNING: 'yellow',
308
+ INFO: 'blue',
309
+ HIGHLIGHT: 'magenta'
310
+ }
311
+ };
312
+
313
+ /**
314
+ * Default configuration values
315
+ */
316
+ export const DEFAULTS = {
317
+ LEVEL: ADOPTION_LEVELS.LEVEL_2,
318
+ FORMAT: STANDARD_FORMATS.AI,
319
+ STANDARDS_SCOPE: STANDARDS_SCOPES.MINIMAL,
320
+ CONTENT_MODE: CONTENT_MODES.INDEX,
321
+ WORKFLOW: GIT_WORKFLOWS.GITHUB_FLOW,
322
+ MERGE_STRATEGY: MERGE_STRATEGIES.SQUASH,
323
+ COMMIT_LANGUAGE: COMMIT_LANGUAGES.ENGLISH,
324
+ TEST_LEVELS: [TEST_LEVELS.UNIT_TESTING, TEST_LEVELS.INTEGRATION_TESTING]
325
+ };
326
+
327
+ /**
328
+ * Feature flags (for experimental features)
329
+ */
330
+ export const FEATURE_FLAGS = {
331
+ BETA_FEATURES: false,
332
+ DEBUG_MODE: false,
333
+ VERBOSE_LOGGING: false,
334
+ FORCE_UPDATE: false
335
+ };
336
+
337
+ /**
338
+ * Environment variable names
339
+ */
340
+ export const ENV_VARS = {
341
+ UDS_DEBUG: 'UDS_DEBUG',
342
+ UDS_NO_COLOR: 'UDS_NO_COLOR',
343
+ UDS_CACHE_DIR: 'UDS_CACHE_DIR',
344
+ UDS_GITHUB_TOKEN: 'GITHUB_TOKEN',
345
+ UDS_OFFLINE: 'UDS_OFFLINE'
346
+ };
347
+
348
+ /**
349
+ * Cache configuration
350
+ */
351
+ export const CACHE_CONFIG = {
352
+ DEFAULT_TTL: 3600000, // 1 hour in milliseconds
353
+ MAX_SIZE: 100 * 1024 * 1024, // 100MB
354
+ CLEANUP_INTERVAL: 300000 // 5 minutes
355
+ };
356
+
357
+ /**
358
+ * File size limits
359
+ */
360
+ export const FILE_SIZE_LIMITS = {
361
+ MAX_STANDARD_SIZE: 1024 * 1024, // 1MB
362
+ MAX_INTEGRATION_SIZE: 512 * 1024, // 512KB
363
+ MAX_MANIFEST_SIZE: 64 * 1024, // 64KB
364
+ MAX_CACHE_FILE_SIZE: 10 * 1024 * 1024 // 10MB
365
+ };
366
+
367
+ /**
368
+ * Timeout values (in milliseconds)
369
+ */
370
+ export const TIMEOUTS = {
371
+ FILE_OPERATION: 5000, // 5 seconds
372
+ NETWORK_REQUEST: 30000, // 30 seconds
373
+ PROMPT_RESPONSE: 120000, // 2 minutes
374
+ CACHE_OPERATION: 1000, // 1 second
375
+ VALIDATION: 5000 // 5 seconds
376
+ };
377
+
378
+ /**
379
+ * Error severity levels
380
+ */
381
+ export const ERROR_SEVERITY = {
382
+ LOW: 'low',
383
+ MEDIUM: 'medium',
384
+ HIGH: 'high',
385
+ CRITICAL: 'critical'
386
+ };
387
+
388
+ /**
389
+ * Log levels
390
+ */
391
+ export const LOG_LEVELS = {
392
+ DEBUG: 0,
393
+ INFO: 1,
394
+ WARN: 2,
395
+ ERROR: 3,
396
+ FATAL: 4
397
+ };
398
+
399
+ /**
400
+ * Permission flags
401
+ */
402
+ export const PERMISSIONS = {
403
+ READABLE: 1 << 0, // 0b001 = 1
404
+ WRITABLE: 1 << 1, // 0b010 = 2
405
+ EXECUTABLE: 1 << 2, // 0b100 = 4
406
+ ALL: (1 << 0) | (1 << 1) | (1 << 2) // 0b111 = 7
407
+ };
408
+
409
+ /**
410
+ * Character encodings
411
+ */
412
+ export const ENCODINGS = {
413
+ UTF8: 'utf8',
414
+ ASCII: 'ascii',
415
+ BASE64: 'base64',
416
+ HEX: 'hex'
417
+ };
418
+
419
+ /**
420
+ * Status codes
421
+ */
422
+ export const STATUS_CODES = {
423
+ SUCCESS: 'success',
424
+ ERROR: 'error',
425
+ WARNING: 'warning',
426
+ SKIPPED: 'skipped',
427
+ CANCELLED: 'cancelled',
428
+ TIMEOUT: 'timeout',
429
+ IN_PROGRESS: 'in_progress'
430
+ };
431
+
432
+ /**
433
+ * Helper functions for constants
434
+ */
435
+
436
+ /**
437
+ * Check if a tool is supported
438
+ * @param {string} tool - Tool name
439
+ * @returns {boolean} True if supported
440
+ */
441
+ export function isToolSupported(tool) {
442
+ return Object.hasOwn(SUPPORTED_AI_TOOLS, tool) ||
443
+ Object.hasOwn(SUPPORTED_AI_TOOLS, LEGACY_TOOL_MAPPINGS[tool]);
444
+ }
445
+
446
+ /**
447
+ * Get normalized tool name
448
+ * @param {string} tool - Tool name
449
+ * @returns {string} Normalized tool name
450
+ */
451
+ export function getNormalizedToolName(tool) {
452
+ return LEGACY_TOOL_MAPPINGS[tool] || tool;
453
+ }
454
+
455
+ /**
456
+ * Get tool configuration
457
+ * @param {string} tool - Tool name
458
+ * @returns {Object|null} Tool configuration or null
459
+ */
460
+ export function getToolConfig(tool) {
461
+ const normalizedName = getNormalizedToolName(tool);
462
+ return SUPPORTED_AI_TOOLS[normalizedName] || null;
463
+ }
464
+
465
+ /**
466
+ * Check if tool supports a specific feature
467
+ * @param {string} tool - Tool name
468
+ * @param {string} feature - Feature name
469
+ * @returns {boolean} True if supported
470
+ */
471
+ export function doesToolSupport(tool, feature) {
472
+ const config = getToolConfig(tool);
473
+ return config && config.supports && config.supports.includes(feature);
474
+ }
475
+
476
+ /**
477
+ * Get file format for a tool
478
+ * @param {string} tool - Tool name
479
+ * @returns {string} File format ('markdown', 'plaintext', 'yaml', etc.)
480
+ */
481
+ export function getToolFormat(tool) {
482
+ const config = getToolConfig(tool);
483
+ return config ? config.format : 'markdown';
484
+ }
485
+
486
+ /**
487
+ * Get integration file name for a tool
488
+ * @param {string} tool - Tool name
489
+ * @returns {string} File name
490
+ */
491
+ export function getToolFileName(tool) {
492
+ const config = getToolConfig(tool);
493
+ return config ? config.file : `${tool}.md`;
494
+ }
495
+
496
+ export default {
497
+ UDS_MARKERS,
498
+ SUPPORTED_AI_TOOLS,
499
+ FILE_EXTENSIONS,
500
+ CONTENT_MODES,
501
+ STANDARDS_SCOPES,
502
+ STANDARD_FORMATS,
503
+ DEFAULTS,
504
+ DIRECTORIES,
505
+ VALIDATION_PATTERNS,
506
+ ENV_VARS,
507
+ // Helper functions
508
+ isToolSupported,
509
+ getNormalizedToolName,
510
+ getToolConfig,
511
+ doesToolSupport,
512
+ getToolFormat,
513
+ getToolFileName
514
+ };