universal-dev-standards 6.14.0-beta.5 → 6.14.0-beta.7

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 (99) hide show
  1. package/README.md +13 -3
  2. package/bin/uds.js +32 -7
  3. package/bundled/ai/options/code-review/pr-review.ai.yaml +20 -1
  4. package/bundled/ai/standards/code-review.ai.yaml +15 -2
  5. package/bundled/ai/standards/commit-message.ai.yaml +6 -2
  6. package/bundled/ai/standards/developer-memory.ai.yaml +12 -2
  7. package/bundled/ai/standards/full-coverage-testing.ai.yaml +44 -6
  8. package/bundled/ai/standards/open-work-tracking.ai.yaml +191 -11
  9. package/bundled/ai/standards/pipeline-security-gates.ai.yaml +48 -3
  10. package/bundled/ai/standards/project-context-memory.ai.yaml +12 -2
  11. package/bundled/core/code-review-checklist.md +20 -2
  12. package/bundled/core/developer-memory.md +12 -2
  13. package/bundled/core/full-coverage-testing.md +44 -4
  14. package/bundled/core/open-work-tracking.md +156 -16
  15. package/bundled/core/pipeline-security-gates.md +63 -0
  16. package/bundled/core/project-context-memory.md +10 -2
  17. package/bundled/locales/zh-CN/CHANGELOG.md +75 -3
  18. package/bundled/locales/zh-CN/README.md +1 -1
  19. package/bundled/locales/zh-CN/SECURITY.md +1 -1
  20. package/bundled/locales/zh-CN/adoption/ADOPTION-GUIDE.md +13 -4
  21. package/bundled/locales/zh-CN/adoption/STATIC-DYNAMIC-GUIDE.md +7 -1
  22. package/bundled/locales/zh-CN/adoption/checklists/enterprise.md +7 -1
  23. package/bundled/locales/zh-CN/adoption/checklists/minimal.md +13 -3
  24. package/bundled/locales/zh-CN/adoption/checklists/recommended.md +7 -1
  25. package/bundled/locales/zh-CN/core/code-review-checklist.md +17 -0
  26. package/bundled/locales/zh-CN/core/developer-memory.md +9 -0
  27. package/bundled/locales/zh-CN/core/full-coverage-testing.md +48 -8
  28. package/bundled/locales/zh-CN/core/pipeline-security-gates.md +64 -4
  29. package/bundled/locales/zh-CN/core/project-context-memory.md +5 -0
  30. package/bundled/locales/zh-CN/docs/AVAILABLE-STANDARDS.md +70 -0
  31. package/bundled/locales/zh-CN/docs/CHEATSHEET.md +5 -4
  32. package/bundled/locales/zh-CN/docs/CLI-INIT-OPTIONS.md +25 -23
  33. package/bundled/locales/zh-CN/docs/FEATURE-REFERENCE.md +15 -12
  34. package/bundled/locales/zh-CN/docs/USAGE-MODES-COMPARISON.md +6 -6
  35. package/bundled/locales/zh-CN/docs/WINDOWS-GUIDE.md +7 -1
  36. package/bundled/locales/zh-CN/docs/user/GETTING-STARTED.md +44 -0
  37. package/bundled/locales/zh-CN/options/code-review/pr-review.md +13 -2
  38. package/bundled/locales/zh-TW/CHANGELOG.md +75 -3
  39. package/bundled/locales/zh-TW/README.md +1 -1
  40. package/bundled/locales/zh-TW/SECURITY.md +1 -1
  41. package/bundled/locales/zh-TW/adoption/ADOPTION-GUIDE.md +13 -4
  42. package/bundled/locales/zh-TW/adoption/STATIC-DYNAMIC-GUIDE.md +7 -1
  43. package/bundled/locales/zh-TW/adoption/checklists/enterprise.md +7 -1
  44. package/bundled/locales/zh-TW/adoption/checklists/minimal.md +13 -3
  45. package/bundled/locales/zh-TW/adoption/checklists/recommended.md +7 -1
  46. package/bundled/locales/zh-TW/core/code-review-checklist.md +17 -0
  47. package/bundled/locales/zh-TW/core/developer-memory.md +9 -0
  48. package/bundled/locales/zh-TW/core/full-coverage-testing.md +48 -8
  49. package/bundled/locales/zh-TW/core/open-work-tracking.md +90 -14
  50. package/bundled/locales/zh-TW/core/pipeline-security-gates.md +64 -4
  51. package/bundled/locales/zh-TW/core/project-context-memory.md +5 -0
  52. package/bundled/locales/zh-TW/docs/AVAILABLE-STANDARDS.md +70 -0
  53. package/bundled/locales/zh-TW/docs/CHEATSHEET.md +5 -4
  54. package/bundled/locales/zh-TW/docs/CLI-INIT-OPTIONS.md +25 -23
  55. package/bundled/locales/zh-TW/docs/FEATURE-REFERENCE.md +15 -12
  56. package/bundled/locales/zh-TW/docs/USAGE-MODES-COMPARISON.md +6 -6
  57. package/bundled/locales/zh-TW/docs/WINDOWS-GUIDE.md +7 -1
  58. package/bundled/locales/zh-TW/docs/user/GETTING-STARTED.md +44 -0
  59. package/bundled/locales/zh-TW/options/code-review/pr-review.md +13 -2
  60. package/bundled/skills/SKILL_NAMING.md +9 -0
  61. package/bundled/templates/gates/check-anti-fake-tests.mjs +305 -5
  62. package/package.json +3 -1
  63. package/src/commands/audit.js +9 -2
  64. package/src/commands/check.js +17 -0
  65. package/src/commands/deps.js +31 -1
  66. package/src/commands/init.js +41 -21
  67. package/src/commands/open-work.js +65 -6
  68. package/src/commands/simulate.js +20 -8
  69. package/src/commands/skills.js +59 -33
  70. package/src/commands/spec.js +14 -8
  71. package/src/commands/update.js +106 -66
  72. package/src/core/manifest.js +12 -10
  73. package/src/core/marketplace-sentinel.js +5 -0
  74. package/src/core/open-work-config.js +103 -0
  75. package/src/core/project-config.js +58 -38
  76. package/src/flows/init-flow.js +10 -0
  77. package/src/i18n/messages.js +264 -60
  78. package/src/installers/skills-installer.js +3 -1
  79. package/src/prompts/init.js +148 -13
  80. package/src/reconciler/backup-locations.js +75 -0
  81. package/src/reconciler/backup-manager.js +29 -45
  82. package/src/reconciler/index.js +62 -8
  83. package/src/utils/available-standards-report.js +144 -0
  84. package/src/utils/available-standards.js +216 -0
  85. package/src/utils/commit-message-judge.js +137 -0
  86. package/src/utils/copier.js +5 -4
  87. package/src/utils/deps-applicability.js +25 -0
  88. package/src/utils/friction-detector.js +27 -0
  89. package/src/utils/installed-names-ownership.js +114 -0
  90. package/src/utils/open-work-tracking.mjs +919 -48
  91. package/src/utils/sdd-header.js +65 -0
  92. package/src/utils/skill-frontmatter.js +102 -0
  93. package/src/utils/skill-name-collision.js +169 -0
  94. package/src/utils/skills-install-paths.js +114 -0
  95. package/src/utils/skills-installer.js +63 -105
  96. package/src/utils/standard-validator.js +98 -27
  97. package/src/utils/transient-fs.js +113 -0
  98. package/src/vibe/micro-spec.js +15 -0
  99. package/standards-registry.json +9 -9
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `uds open-work` — the open-work-tracking reference checks (OWT-017 / 018 / 019)
2
+ * `uds open-work` — the open-work-tracking reference checks (OWT-017 … OWT-028)
3
3
  * as a command, so an adopter can run them from the npm package.
4
4
  *
5
5
  * This file holds no rules. The one body of them is
@@ -20,6 +20,7 @@
20
20
  */
21
21
 
22
22
  import { main } from '../utils/open-work-tracking.mjs';
23
+ import { readOpenWorkDeclarations, rootArguments, wordArguments, commandArguments } from '../core/open-work-config.js';
23
24
 
24
25
  /** Append `--name value` when the option was given. */
25
26
  function withOption(argv, name, value) {
@@ -31,12 +32,39 @@ function run(argv) {
31
32
  process.exitCode = main(argv);
32
33
  }
33
34
 
34
- /** uds open-work next-action [files...] [--root DIR] [--id-pattern RE] — OWT-019 */
35
+ /**
36
+ * What uds.project.yaml declares for open-work, or null after saying why the command stops.
37
+ * A file that cannot be read at all is a note and the command goes on without it (a project's
38
+ * unrelated YAML problem must not stop a check that never needed the file); a readable file whose
39
+ * open_work section is wrong stops it, because the check would otherwise run without what the
40
+ * project meant to declare and look cleaner than it is.
41
+ */
42
+ function declarationsOrStop() {
43
+ const declared = readOpenWorkDeclarations(process.cwd()); // wire:declarations
44
+ if (declared.note) console.error(`[owt] NOTE: ${declared.note}`);
45
+ if (declared.error) {
46
+ console.error(`[owt] CANNOT DECIDE: ${declared.error}. Exit 2 is not a pass.`);
47
+ process.exitCode = 2;
48
+ return null;
49
+ }
50
+ return declared;
51
+ }
52
+
53
+ /**
54
+ * uds open-work next-action [files...] [--root DIR] [--id-pattern RE] [--next-action-word WORD ...] [--command-word WORD ...] [--now DATE] [--stale-after DAYS] — OWT-019
55
+ * `--now` and `--stale-after` are what the fourth outcome (an asked-awaiting row, XSPEC-464) needs to show an age and to mark it old.
56
+ */
35
57
  export function openWorkNextActionCommand(files = [], options = {}) {
58
+ const declared = declarationsOrStop();
59
+ if (!declared) return;
36
60
  const argv = ['next-action'];
37
61
  withOption(argv, '--root', options.root);
38
62
  withOption(argv, '--id-pattern', options.idPattern);
39
- run([...argv, ...files]);
63
+ withOption(argv, '--now', options.now);
64
+ withOption(argv, '--stale-after', options.staleAfter);
65
+ const wordArgv = wordArguments(options.nextActionWord, declared.nextActionWords); // wire:next-action-words
66
+ const commandArgv = commandArguments(options.commandWord, declared.commandWords); // wire:next-action-command-words
67
+ process.exitCode = main([...argv, ...wordArgv, ...commandArgv, ...files]); // wire:next-action
40
68
  }
41
69
 
42
70
  /** uds open-work revision (--file PATH --base REV | --before FILE --after FILE) — OWT-018 */
@@ -49,9 +77,40 @@ export function openWorkRevisionCommand(options = {}) {
49
77
  run(argv);
50
78
  }
51
79
 
52
- /** uds open-work separation [files...] — OWT-017 */
53
- export function openWorkSeparationCommand(files = []) {
54
- run(['separation', ...files]);
80
+ /** uds open-work separation [files...] [--next-action-word WORD ...] — OWT-017 */
81
+ export function openWorkSeparationCommand(files = [], options = {}) {
82
+ const declared = declarationsOrStop();
83
+ if (!declared) return;
84
+ const wordArgv = wordArguments(options.nextActionWord, declared.nextActionWords); // wire:separation-words
85
+ process.exitCode = main(['separation', ...wordArgv, ...files]); // wire:separation
86
+ }
87
+
88
+ /**
89
+ * uds open-work waiting [files...] [--root DIR] [--root NAME=DIR ...] [--id-pattern RE] [--now DATE] — OWT-020 to OWT-022, OWT-027/028.
90
+ * Calls the imported `main` itself rather than the shared `run()`: the line that carries this
91
+ * command into the checker is then its own, and cutting it silences exactly this command.
92
+ * `--root` repeats: a plain DIR is what relative paths resolve against (as before), NAME=DIR says where
93
+ * another project lives (and uds.project.yaml's open_work.projects says the same, without typing it).
94
+ */
95
+ export function openWorkWaitingCommand(files = [], options = {}) {
96
+ const declared = declarationsOrStop();
97
+ if (!declared) return;
98
+ const argv = ['waiting'];
99
+ const rootArgv = rootArguments(options.root, declared.projects); // wire:roots
100
+ argv.push(...rootArgv);
101
+ withOption(argv, '--id-pattern', options.idPattern);
102
+ withOption(argv, '--now', options.now);
103
+ const commandArgv = commandArguments(options.commandWord, declared.commandWords); // wire:waiting-command-words
104
+ argv.push(...commandArgv);
105
+ process.exitCode = main([...argv, ...files]); // wire:waiting
106
+ }
107
+
108
+ /** uds open-work observations [files...] [--now DATE] [--stale-after DAYS] — OWT-023/024/025/026 (same reason as above) */
109
+ export function openWorkObservationsCommand(files = [], options = {}) {
110
+ const argv = ['observations'];
111
+ withOption(argv, '--now', options.now);
112
+ withOption(argv, '--stale-after', options.staleAfter);
113
+ process.exitCode = main([...argv, ...files]); // wire:observations
55
114
  }
56
115
 
57
116
  /** uds open-work self-test — run the checker's own arms and nothing else */
@@ -1,6 +1,9 @@
1
1
  import chalk from 'chalk';
2
2
  import { StandardValidator } from '../utils/standard-validator.js';
3
3
 
4
+ /** Process exit code per outcome. 2 means no verdict - it is not a pass. */
5
+ export const EXIT_CODES = { pass: 0, fail: 1, 'cannot-simulate': 2 };
6
+
4
7
  export async function simulateCommand(options) {
5
8
  if (!options.standard) {
6
9
  if (options.json) {
@@ -25,10 +28,13 @@ export async function simulateCommand(options) {
25
28
 
26
29
  try {
27
30
  const result = await validator.simulate(options.standard, options.input);
31
+ // XSPEC-456 R2: exit 0 only for a pass. 1 = the input does not comply, 2 = no verdict could be reached
32
+ // (the same "cannot decide is not a pass" contract as `uds open-work`).
33
+ const exitCode = EXIT_CODES[result.status] ?? EXIT_CODES['cannot-simulate'];
28
34
 
29
35
  if (options.json) {
30
36
  console.log(JSON.stringify(result, null, 2));
31
- if (!result.success) process.exitCode = 1;
37
+ process.exitCode = exitCode;
32
38
  return;
33
39
  }
34
40
 
@@ -37,25 +43,31 @@ export async function simulateCommand(options) {
37
43
  console.log(chalk.gray('Input: ' + options.input));
38
44
  console.log(chalk.gray('─'.repeat(50)));
39
45
 
40
- if (result.success) {
46
+ if (result.status === 'pass') {
41
47
  console.log(chalk.green('✓ Simulation Passed'));
42
48
  if (result.details) console.log(chalk.gray(result.details));
49
+ } else if (result.status === 'fail') {
50
+ console.log(chalk.red('✗ Simulation Failed: the input does not comply'));
51
+ if (result.details) {
52
+ console.log(chalk.gray('\nDetails:'));
53
+ console.log(chalk.gray(result.details));
54
+ }
43
55
  } else {
44
- console.log(chalk.red('✗ Simulation Failed'));
45
- console.log(chalk.red(` ${result.message}`));
56
+ console.log(chalk.yellow('⚠ Cannot simulate: no verdict was reached, so this is neither a pass nor a fail'));
57
+ console.log(chalk.yellow(` ${result.message}`));
46
58
  if (result.details) {
47
59
  console.log(chalk.gray('\nDetails:'));
48
60
  console.log(chalk.gray(result.details));
49
61
  }
50
- process.exitCode = 1;
51
62
  }
63
+ process.exitCode = exitCode;
52
64
  } catch (error) {
53
65
  if (options.json) {
54
- console.log(JSON.stringify({ success: false, message: error.message }));
55
- process.exit(1);
66
+ console.log(JSON.stringify({ status: 'cannot-simulate', success: false, message: error.message }));
67
+ process.exit(EXIT_CODES['cannot-simulate']);
56
68
  }
57
69
  console.error(chalk.red(`Error: ${error.message}`));
58
- process.exit(1);
70
+ process.exit(EXIT_CODES['cannot-simulate']);
59
71
  }
60
72
  if (!options.json) console.log();
61
73
  }
@@ -3,8 +3,12 @@ import { existsSync, readdirSync, readFileSync } from 'fs';
3
3
  import { join } from 'path';
4
4
  import { homedir } from 'os';
5
5
  import { getAllSkillNames } from '../utils/registry.js';
6
+ import { getAvailableSkillNames } from '../utils/skills-installer.js';
7
+ import { pruneForeignSkillHashes } from '../utils/skill-hash-ownership.js';
8
+ import { getSkillsDirForAgent, getAgentDisplayName } from '../config/ai-agent-paths.js';
6
9
  import { readManifest, isInitialized } from '../utils/copier.js';
7
10
  import { t, setLanguage, isLanguageExplicitlySet } from '../i18n/messages.js';
11
+ import { printInstallPathComparison } from '../utils/skills-install-paths.js';
8
12
 
9
13
  // Known skill directories (non-skill items to exclude)
10
14
  const NON_SKILL_ITEMS = [
@@ -111,8 +115,18 @@ export function skillsCommand() {
111
115
  console.log(chalk.gray('─'.repeat(50)));
112
116
  console.log();
113
117
 
114
- // Get all known skills from registry
115
- const knownSkills = getAllSkillNames();
118
+ // XSPEC-456 R3: the skills UDS ships are the ones in its skills source tree (what `uds init` and
119
+ // `uds update` install, and what `uds check` verifies). This used to be the `skillFiles` list of
120
+ // standards-registry.json, a hand-kept list that stopped at 30 while UDS ships 56, so a project with
121
+ // all 56 installed read "27 / 30" (27 = the installed ones that happened to be on the stale list).
122
+ // The registry list is only a fallback for a source tree that did not load.
123
+ const shipped = getAvailableSkillNames();
124
+ const knownSkills = shipped.length > 0 ? shipped : getAllSkillNames();
125
+
126
+ // XSPEC-462 R1: one place that prints the two ways to install (an empty result and a full one both end with it).
127
+ const sayBothWays = () => {
128
+ printInstallPathComparison();
129
+ };
116
130
 
117
131
  // Check different installation locations
118
132
  const installations = [];
@@ -131,7 +145,7 @@ export function skillsCommand() {
131
145
  path: udsPlugin.installPath,
132
146
  version: udsPlugin.version || 'unknown',
133
147
  skills,
134
- recommended: !udsPlugin.isLegacyMarketplace,
148
+ isPlugin: true,
135
149
  legacyMarketplace: udsPlugin.isLegacyMarketplace
136
150
  });
137
151
  }
@@ -157,11 +171,10 @@ export function skillsCommand() {
157
171
  }
158
172
 
159
173
  installations.push({
160
- location: 'User Level (deprecated)',
174
+ location: 'User Level',
161
175
  path: userSkillsDir,
162
176
  version,
163
- skills: udsSkills,
164
- deprecated: true
177
+ skills: udsSkills
165
178
  });
166
179
  }
167
180
  }
@@ -186,35 +199,51 @@ export function skillsCommand() {
186
199
  }
187
200
 
188
201
  installations.push({
189
- location: 'Project Level (deprecated)',
202
+ location: 'Project Level',
190
203
  path: projectSkillsDir,
191
204
  version,
192
- skills: udsSkills,
193
- deprecated: true
205
+ skills: udsSkills
194
206
  });
195
207
  }
196
208
  }
197
209
 
210
+ // 4. Other AI tools the manifest says Skills were installed for (Codex, OpenCode, ...). Claude Code's
211
+ // own two locations were handled above.
212
+ const manifestForSkills = isInitialized(projectPath) ? readManifest(projectPath) : null;
213
+ const seenDirs = new Set(installations.map(i => i.path));
214
+ for (const entry of manifestForSkills?.skills?.installations || []) {
215
+ const agent = typeof entry === 'string' ? entry : entry?.agent;
216
+ const level = typeof entry === 'string' ? 'project' : (entry?.level || 'project');
217
+ if (!agent || agent === 'claude-code') continue;
218
+ const dir = getSkillsDirForAgent(agent, level, projectPath);
219
+ if (!dir || seenDirs.has(dir)) continue;
220
+ seenDirs.add(dir);
221
+ const udsSkills = listSkillsInDir(dir).filter(s => knownSkills.includes(s));
222
+ if (udsSkills.length === 0) continue;
223
+ installations.push({
224
+ location: `${getAgentDisplayName(agent)} (${level} level)`,
225
+ path: dir,
226
+ version: manifestForSkills.skills.version || 'unknown',
227
+ skills: udsSkills
228
+ });
229
+ }
230
+
198
231
  // Display results
199
232
  if (installations.length === 0) {
200
233
  console.log(chalk.yellow(msg.noSkillsInstalled));
201
234
  console.log();
202
- console.log(chalk.gray(msg.installViaMarketplace));
203
- console.log(chalk.cyan(' /plugin marketplace add AsiaOstrich/universal-dev-standards'));
204
- console.log(chalk.cyan(' /plugin install universal-dev-standards@asia-ostrich'));
205
- console.log();
235
+ // XSPEC-462 R1: say both ways and what each one can and cannot do, not only the plugin.
236
+ sayBothWays();
206
237
  return;
207
238
  }
208
239
 
209
240
  // Show each installation
210
241
  for (const install of installations) {
211
242
  // Header
212
- if (install.recommended) {
213
- console.log(chalk.green(`✓ ${install.location}`) + chalk.gray(` ${msg.recommended}`));
214
- } else if (install.legacyMarketplace) {
215
- console.log(chalk.yellow(`⚠ ${install.location}`));
216
- } else if (install.deprecated) {
243
+ if (install.legacyMarketplace) {
217
244
  console.log(chalk.yellow(`⚠ ${install.location}`));
245
+ } else if (install.isPlugin) {
246
+ console.log(chalk.green(`✓ ${install.location}`));
218
247
  } else {
219
248
  console.log(chalk.blue(`● ${install.location}`));
220
249
  }
@@ -226,7 +255,7 @@ export function skillsCommand() {
226
255
  // Skills list
227
256
  console.log(chalk.gray(` Skills (${install.skills.length}):`));
228
257
  for (const skill of install.skills) {
229
- const icon = (install.deprecated || install.legacyMarketplace)
258
+ const icon = install.legacyMarketplace
230
259
  ? chalk.yellow('○')
231
260
  : chalk.green('✓');
232
261
  console.log(` ${icon} ${skill}`);
@@ -241,31 +270,28 @@ export function skillsCommand() {
241
270
  console.log(chalk.cyan(' /plugin install universal-dev-standards@asia-ostrich'));
242
271
  console.log();
243
272
  }
244
-
245
- // Deprecation warning
246
- if (install.deprecated) {
247
- console.log(chalk.yellow(` ${msg.manualInstallDeprecated}`));
248
- console.log(chalk.gray(` ${msg.manualInstallHint}`));
249
- console.log(chalk.cyan(' /plugin marketplace add AsiaOstrich/universal-dev-standards'));
250
- console.log(chalk.cyan(' /plugin install universal-dev-standards@asia-ostrich'));
251
- console.log();
252
- }
253
273
  }
254
274
 
255
275
  // Summary
256
276
  const totalSkills = new Set(installations.flatMap(i => i.skills)).size;
257
- const hasMarketplace = installations.some(i => i.recommended);
258
277
 
259
278
  console.log(chalk.gray('─'.repeat(50)));
260
279
  console.log(chalk.gray(`${msg.totalUniqueSkills}: ${totalSkills} / ${knownSkills.length}`));
261
280
 
262
- if (!hasMarketplace && installations.length > 0) {
263
- console.log();
264
- console.log(chalk.yellow(msg.recommendation));
265
- console.log(chalk.gray(` ${msg.benefits}`));
281
+ // The number `uds check` prints is a count of FILES (a skill is one or more files), so say how the two
282
+ // relate instead of leaving two different numbers side by side. Counted the way `check` counts them.
283
+ if (manifestForSkills?.skillHashes) {
284
+ const tracked = structuredClone(manifestForSkills);
285
+ pruneForeignSkillHashes(tracked, new Set(knownSkills));
286
+ const files = Object.keys(tracked.skillHashes || {}).length;
287
+ if (files > 0 && msg.skillFilesTracked) {
288
+ console.log(chalk.gray(msg.skillFilesTracked.replace('{files}', files)));
289
+ }
266
290
  }
267
291
 
292
+ // XSPEC-462 R1: the two ways, side by side, with their limits.
268
293
  console.log();
294
+ sayBothWays();
269
295
  }
270
296
 
271
297
  // Export for testing
@@ -131,15 +131,21 @@ export async function specListCommand(options = {}) {
131
131
  return;
132
132
  }
133
133
 
134
- // Display specs as a table
135
- console.log(chalk.gray('─'.repeat(70)));
134
+ // Display specs as a table. A status or type the file does not state is shown as unknown, never as a
135
+ // default (XSPEC-456 R5): an SDD spec whose header could not be read used to be listed as `draft`.
136
+ const unparsed = t('spec.statusUnparsed', 'format: SDD (status not parsed)');
137
+ const statusLabel = (spec) => spec.status ?? unparsed;
138
+ const statusWidth = Math.max(12, ...specs.map((spec) => statusLabel(spec).length + 1));
139
+ const ruleWidth = 70 + (statusWidth - 12);
140
+
141
+ console.log(chalk.gray('─'.repeat(ruleWidth)));
136
142
  console.log(
137
143
  chalk.bold('ID'.padEnd(35)) +
138
- chalk.bold('Status'.padEnd(12)) +
144
+ chalk.bold('Status'.padEnd(statusWidth)) +
139
145
  chalk.bold('Type'.padEnd(10)) +
140
146
  chalk.bold('Title')
141
147
  );
142
- console.log(chalk.gray('─'.repeat(70)));
148
+ console.log(chalk.gray('─'.repeat(ruleWidth)));
143
149
 
144
150
  for (const spec of specs) {
145
151
  const statusColor = {
@@ -152,13 +158,13 @@ export async function specListCommand(options = {}) {
152
158
 
153
159
  console.log(
154
160
  spec.id.slice(0, 34).padEnd(35) +
155
- statusColor(spec.status.padEnd(12)) +
156
- spec.type.padEnd(10) +
161
+ statusColor(statusLabel(spec).padEnd(statusWidth)) +
162
+ (spec.type ?? '-').padEnd(10) +
157
163
  spec.title.slice(0, 25)
158
164
  );
159
165
  }
160
166
 
161
- console.log(chalk.gray('─'.repeat(70)));
167
+ console.log(chalk.gray('─'.repeat(ruleWidth)));
162
168
  console.log(chalk.gray(`${t('spec.total', 'Total')}: ${specs.length}`));
163
169
  }
164
170
 
@@ -333,7 +339,7 @@ export function specSearchCommand(query, options = {}) {
333
339
 
334
340
  console.log(chalk.bold(`\nFound ${results.length} spec(s) matching "${query}":\n`));
335
341
  for (const r of results) {
336
- const badge = r.source === 'archive' ? chalk.gray('[archived]') : chalk.green(`[${r.status}]`);
342
+ const badge = r.source === 'archive' ? chalk.gray('[archived]') : chalk.green(`[${r.status ?? t('spec.statusUnparsed', 'format: SDD (status not parsed)')}]`);
337
343
  console.log(` ${chalk.cyan(r.id)} ${badge} ${r.title}`);
338
344
  }
339
345
  console.log();