universal-dev-standards 6.15.0 → 6.16.0-beta.2

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 (41) hide show
  1. package/bin/uds.js +2 -0
  2. package/bundled/locales/zh-CN/CHANGELOG.md +34 -4
  3. package/bundled/locales/zh-CN/CLAUDE.md +2 -2
  4. package/bundled/locales/zh-CN/README.md +17 -14
  5. package/bundled/locales/zh-CN/SECURITY.md +1 -0
  6. package/bundled/locales/zh-CN/docs/CHEATSHEET.md +1 -1
  7. package/bundled/locales/zh-CN/docs/CLI-INIT-OPTIONS.md +24 -2
  8. package/bundled/locales/zh-CN/docs/FEATURE-REFERENCE.md +3 -1
  9. package/bundled/locales/zh-TW/CHANGELOG.md +34 -4
  10. package/bundled/locales/zh-TW/CLAUDE.md +2 -2
  11. package/bundled/locales/zh-TW/README.md +17 -14
  12. package/bundled/locales/zh-TW/SECURITY.md +1 -0
  13. package/bundled/locales/zh-TW/docs/CHEATSHEET.md +1 -1
  14. package/bundled/locales/zh-TW/docs/CLI-INIT-OPTIONS.md +24 -2
  15. package/bundled/locales/zh-TW/docs/FEATURE-REFERENCE.md +3 -1
  16. package/package.json +3 -3
  17. package/src/commands/skills.js +9 -0
  18. package/src/commands/update.js +223 -2
  19. package/src/reconciler/desired-state-calculator.js +11 -2
  20. package/src/utils/optional-skills-report.js +86 -0
  21. package/src/utils/optional-skills.js +20 -0
  22. package/src/utils/skill-selection.js +137 -0
  23. package/src/utils/skills-installer.js +11 -4
  24. package/standards-registry.json +7 -7
  25. package/src/core/agent-communication-protocol.js +0 -257
  26. package/src/flow/condition-evaluator.js +0 -86
  27. package/src/flow/flow-bundler.js +0 -80
  28. package/src/flow/flow-commands.js +0 -107
  29. package/src/flow/flow-engine.js +0 -154
  30. package/src/flow/flow-inheritance.js +0 -100
  31. package/src/flow/flow-parser.js +0 -104
  32. package/src/flow/flow-validator.js +0 -37
  33. package/src/flow/gate-checker.js +0 -82
  34. package/src/flow/gate-loader.js +0 -52
  35. package/src/missions/MissionManager.js +0 -533
  36. package/src/utils/e2e-analyzer.js +0 -471
  37. package/src/utils/e2e-detector.js +0 -132
  38. package/src/utils/hook-stats.js +0 -151
  39. package/src/utils/workflow-executor.js +0 -870
  40. package/src/utils/workflows-installer.js +0 -545
  41. package/src/vibe/auto-sweep.js +0 -349
@@ -1,151 +0,0 @@
1
- /**
2
- * Hook Statistics - Context-aware loading learning loop
3
- *
4
- * Records and analyzes trigger statistics from inject-standards.mjs hook.
5
- * Privacy: never records full prompt content or file paths.
6
- *
7
- * @module utils/hook-stats
8
- * @see docs/specs/SPEC-SELFDIAG-001-standards-self-diagnosis.md (REQ-7)
9
- */
10
-
11
- import { existsSync, readFileSync, appendFileSync, mkdirSync, statSync, writeFileSync } from 'fs';
12
- import { join } from 'path';
13
-
14
- const STATS_FILE = '.uds/hook-stats.jsonl';
15
- const CONFIG_FILE = '.uds/config.json';
16
- const MAX_STATS_SIZE = 1024 * 1024; // 1MB
17
-
18
- /**
19
- * Check if hook stats recording is enabled.
20
- * Default: OFF (opt-in). Set hookStats: true in .uds/config.json to enable.
21
- * @param {string} projectPath
22
- * @returns {boolean}
23
- */
24
- export function shouldRecordStats(projectPath) {
25
- const configPath = join(projectPath, CONFIG_FILE);
26
- try {
27
- if (!existsSync(configPath)) return false; // Default OFF
28
- const config = JSON.parse(readFileSync(configPath, 'utf-8'));
29
- return config.hookStats === true; // Explicit opt-in required
30
- } catch {
31
- return false; // Default OFF on config read errors
32
- }
33
- }
34
-
35
- /**
36
- * Append a hook trigger stat entry. Silently fails on any error.
37
- * @param {string} projectPath
38
- * @param {{ matched_standards: string[], matched_count: number, total_available: number, prompt_length?: number, hook_type?: string }} entry
39
- */
40
- export function appendHookStat(projectPath, entry) {
41
- try {
42
- const statsPath = join(projectPath, STATS_FILE);
43
- const dir = join(projectPath, '.uds');
44
- if (!existsSync(dir)) {
45
- mkdirSync(dir, { recursive: true });
46
- }
47
-
48
- const record = {
49
- timestamp: new Date().toISOString(),
50
- matched_standards: entry.matched_standards,
51
- matched_count: entry.matched_count,
52
- total_available: entry.total_available
53
- };
54
-
55
- // Include prompt_length if provided (but never prompt content)
56
- if (entry.prompt_length !== undefined) {
57
- record.prompt_length = entry.prompt_length;
58
- }
59
-
60
- // Include hook_type if provided (commit-msg | security | logging)
61
- if (entry.hook_type !== undefined) {
62
- record.hook_type = entry.hook_type;
63
- }
64
-
65
- // Truncate if file exceeds 1MB (keep last half)
66
- if (existsSync(statsPath)) {
67
- try {
68
- const size = statSync(statsPath).size;
69
- if (size > MAX_STATS_SIZE) {
70
- const content = readFileSync(statsPath, 'utf-8');
71
- const lines = content.trim().split('\n');
72
- const keepLines = lines.slice(Math.floor(lines.length / 2));
73
- writeFileSync(statsPath, keepLines.join('\n') + '\n');
74
- }
75
- } catch { /* ignore truncation errors */ }
76
- }
77
-
78
- appendFileSync(statsPath, JSON.stringify(record) + '\n');
79
- } catch {
80
- // Silently ignore write failures (AC-10)
81
- }
82
- }
83
-
84
- /**
85
- * Analyze hook statistics for trigger blind spots
86
- * @param {string} projectPath
87
- * @param {{ allStandards?: string[] }} options
88
- * @returns {{ total_triggers: number, top_standards: Array, zero_match_count: number, zero_match_rate: number, never_matched: string[] }}
89
- */
90
- export function analyzeHookStats(projectPath, options = {}) {
91
- const statsPath = join(projectPath, STATS_FILE);
92
-
93
- if (!existsSync(statsPath)) {
94
- return {
95
- total_triggers: 0,
96
- top_standards: [],
97
- zero_match_count: 0,
98
- zero_match_rate: 0,
99
- never_matched: []
100
- };
101
- }
102
-
103
- const content = readFileSync(statsPath, 'utf-8').trim();
104
- if (!content) {
105
- return {
106
- total_triggers: 0,
107
- top_standards: [],
108
- zero_match_count: 0,
109
- zero_match_rate: 0,
110
- never_matched: []
111
- };
112
- }
113
-
114
- const entries = content.split('\n').map(line => {
115
- try { return JSON.parse(line); } catch { return null; }
116
- }).filter(Boolean);
117
-
118
- const totalTriggers = entries.length;
119
-
120
- // Count standard matches
121
- const matchCounts = {};
122
- let zeroMatchCount = 0;
123
-
124
- for (const entry of entries) {
125
- if (!entry.matched_standards || entry.matched_standards.length === 0) {
126
- zeroMatchCount++;
127
- continue;
128
- }
129
- for (const std of entry.matched_standards) {
130
- matchCounts[std] = (matchCounts[std] || 0) + 1;
131
- }
132
- }
133
-
134
- // Top standards sorted by count
135
- const topStandards = Object.entries(matchCounts)
136
- .map(([id, count]) => ({ id, count }))
137
- .sort((a, b) => b.count - a.count);
138
-
139
- // Never matched (from provided allStandards list)
140
- const matchedSet = new Set(Object.keys(matchCounts));
141
- const neverMatched = (options.allStandards || [])
142
- .filter(s => !matchedSet.has(s));
143
-
144
- return {
145
- total_triggers: totalTriggers,
146
- top_standards: topStandards,
147
- zero_match_count: zeroMatchCount,
148
- zero_match_rate: totalTriggers > 0 ? zeroMatchCount / totalTriggers : 0,
149
- never_matched: neverMatched
150
- };
151
- }