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

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.
@@ -0,0 +1,137 @@
1
+ /**
2
+ * Judge a commit message against the commit-message standard, in this process.
3
+ * // implements XSPEC-456 R2
4
+ *
5
+ * `uds simulate -s commit-message` used to pipe the message into `npx commitlint`. That needs the
6
+ * network the first time (npx downloads the tool), needs a commitlint config in the project, and
7
+ * interpolates the message into a shell string. In a project with no commitlint config the tool refuses
8
+ * to run at all, and the old code printed that refusal as "Simulation Failed" - the same answer for a
9
+ * compliant message and a non-compliant one, which is the one thing a simulator must not do.
10
+ *
11
+ * Here the verdict comes from the standard's own rules, read from the installed standard file
12
+ * (`.standards/commit-message.ai.yaml`):
13
+ *
14
+ * - the header shape `<type>(<scope>): <subject>` from `format.template` (scope optional, as the
15
+ * standard's component list says);
16
+ * - the allowed types, from the commit-message option files installed next to the standard
17
+ * (`.standards/options/`, files whose `meta.parent` is `commit-message`); the Conventional Commits
18
+ * set when none are installed;
19
+ * - rule `scope-lowercase` and rule `subject-max-length`, using the `validator` pattern the standard gives.
20
+ *
21
+ * What it does NOT judge is returned in `notChecked`, so a pass never reads as more than it is: rules
22
+ * with no machine-checkable pattern (imperative mood, one logical change per commit) and the language
23
+ * option.
24
+ *
25
+ * @module utils/commit-message-judge
26
+ */
27
+
28
+ import fs from 'fs';
29
+ import path from 'path';
30
+ import * as yaml from 'js-yaml';
31
+
32
+ /** Used only when no commit-message option file is installed. The Conventional Commits type set. */
33
+ export const FALLBACK_TYPES = ['feat', 'fix', 'docs', 'style', 'refactor', 'perf', 'test', 'build', 'ci', 'chore', 'revert'];
34
+
35
+ /** `type(scope)!: subject` - scope and the breaking-change mark are optional. */
36
+ const HEADER = /^(?<type>[A-Za-z][A-Za-z0-9-]*)(?:\((?<scope>[^()]*)\))?(?<bang>!)?: (?<subject>\S.*)$/;
37
+
38
+ /**
39
+ * The commit types the project's installed option files allow. An option file belongs to this standard when
40
+ * its `meta.parent` is `commit-message`. Installed projects keep option files flat in `.standards/options/`
41
+ * (`english.ai.yaml`); a checkout of UDS itself nests them (`.standards/options/commit-message/`). Both are read.
42
+ * @param {string} standardsDir - `<project>/.standards`
43
+ * @returns {{ types: string[], source: string }}
44
+ */
45
+ export function allowedCommitTypes(standardsDir) {
46
+ const found = new Set();
47
+ const optionsDir = path.join(standardsDir, 'options');
48
+ for (const dir of [optionsDir, path.join(optionsDir, 'commit-message')]) {
49
+ let names = [];
50
+ try {
51
+ names = fs.readdirSync(dir).filter((n) => n.endsWith('.ai.yaml'));
52
+ } catch {
53
+ continue; // this layout is not present
54
+ }
55
+ for (const name of names) {
56
+ try {
57
+ const doc = yaml.load(fs.readFileSync(path.join(dir, name), 'utf-8'));
58
+ if (doc?.meta?.parent !== 'commit-message') continue;
59
+ for (const entry of doc.types || []) {
60
+ if (entry && typeof entry.type === 'string') found.add(entry.type);
61
+ }
62
+ } catch {
63
+ // an unreadable option file contributes nothing
64
+ }
65
+ }
66
+ }
67
+ if (found.size === 0) return { types: FALLBACK_TYPES, source: 'the Conventional Commits set, because no commit-message option file is installed' };
68
+ return { types: [...found], source: '.standards/options' };
69
+ }
70
+
71
+ /** The `validator` pattern of a rule in the standard, as a RegExp, or null when there is none. */
72
+ function ruleValidator(standardConfig, ruleId) {
73
+ const rule = (standardConfig?.standard?.rules || []).find((r) => r && r.id === ruleId);
74
+ if (!rule || typeof rule.validator !== 'string') return null;
75
+ try {
76
+ return new RegExp(rule.validator);
77
+ } catch {
78
+ return null;
79
+ }
80
+ }
81
+
82
+ /**
83
+ * @param {Object} standardConfig - the parsed commit-message standard
84
+ * @param {string} input - the commit message (only the first line is the header)
85
+ * @param {{ standardsDir: string }} context
86
+ * @returns {{ verdict: 'pass' | 'fail', findings: string[], checked: string[], notChecked: string[] }}
87
+ */
88
+ export function judgeCommitMessage(standardConfig, input, { standardsDir }) {
89
+ const findings = [];
90
+ const checked = [];
91
+ const notChecked = [];
92
+
93
+ const header = String(input).replace(/\r\n/g, '\n').split('\n')[0];
94
+ const match = HEADER.exec(header);
95
+
96
+ checked.push('header format <type>(<scope>): <subject>');
97
+ if (!match) {
98
+ findings.push('The first line is not in the form <type>(<scope>): <subject> (scope is optional).');
99
+ } else {
100
+ const { type, scope, subject } = match.groups;
101
+ const { types, source } = allowedCommitTypes(standardsDir);
102
+
103
+ checked.push(`type is one of: ${types.join(', ')} (from ${source})`);
104
+ if (!types.includes(type)) {
105
+ findings.push(`Type "${type}" is not one of: ${types.join(', ')}.`);
106
+ }
107
+
108
+ if (scope !== undefined) {
109
+ const scopeRule = ruleValidator(standardConfig, 'scope-lowercase');
110
+ if (scopeRule) {
111
+ checked.push('rule scope-lowercase');
112
+ if (scope === '' || !scopeRule.test(scope)) {
113
+ findings.push(`Scope "${scope}" breaks rule scope-lowercase (use lowercase letters, digits and dashes, starting with a letter).`);
114
+ }
115
+ } else {
116
+ notChecked.push('rule scope-lowercase (this copy of the standard gives no pattern for it)');
117
+ }
118
+ }
119
+
120
+ if (subject.trim() === '') findings.push('The subject is empty.');
121
+ }
122
+
123
+ const lengthRule = ruleValidator(standardConfig, 'subject-max-length');
124
+ if (lengthRule) {
125
+ checked.push('rule subject-max-length');
126
+ if (!lengthRule.test(header)) {
127
+ findings.push(`The subject line is ${header.length} characters, which breaks rule subject-max-length.`);
128
+ }
129
+ } else {
130
+ notChecked.push('rule subject-max-length (this copy of the standard gives no pattern for it)');
131
+ }
132
+
133
+ notChecked.push('rule imperative-mood (the standard gives no machine-checkable pattern)');
134
+ notChecked.push('rule no-mixed-changes and the commit language option');
135
+
136
+ return { verdict: findings.length === 0 ? 'pass' : 'fail', findings, checked, notChecked };
137
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * When `uds deps --if-present` is allowed to say "not applicable" instead of failing.
3
+ * // implements XSPEC-456 R6
4
+ *
5
+ * `uds deps` exits 1 when there is no package.json, on purpose: a check that examined nothing must not
6
+ * be able to show a pass (the same rule as `clean` in utils/dependency-resolution.js). That makes it
7
+ * awkward in a shared script that also runs in .NET, Python or Go projects, where callers ended up
8
+ * writing `if [ -f package.json ]` around it. `--if-present` is that guard made part of the command
9
+ * AND visible: the run says nothing was checked, in words, and exits 0.
10
+ *
11
+ * @module utils/deps-applicability
12
+ */
13
+
14
+ import { existsSync } from 'fs';
15
+ import { join } from 'path';
16
+
17
+ /**
18
+ * @param {string} root - Directory `uds deps` would examine
19
+ * @param {boolean} ifPresent - Whether `--if-present` was given
20
+ * @returns {'no-package-json' | null} Why the run is not applicable, or null when it must be run
21
+ */
22
+ export function notApplicableReason(root, ifPresent) {
23
+ if (ifPresent && !existsSync(join(root, 'package.json'))) return 'no-package-json';
24
+ return null;
25
+ }
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Which names in `manifest.skills.names` / `manifest.commands.names` UDS can still vouch for.
3
+ * // implements XSPEC-456 R4
4
+ *
5
+ * XSPEC-454 R2 cleaned `skillHashes` and `commandHashes` and left these two lists alone, on the
6
+ * reasoning that an over-long list is harmless. It is not: after `uds update --apply --skills` removed
7
+ * the `_shared`, `agents`, `ai`, `tools` and `workflows` folders an old CLI had copied into the skills
8
+ * folder, the manifest still listed all five as installed skills (61 names for 56 skills), which
9
+ * contradicted both the disk and the release notes' claim that the records were cleaned.
10
+ *
11
+ * The rule is the one XSPEC-454 R2 uses for the hash records: **what UDS can vouch for stays**.
12
+ * - a skill (command) name stays only if UDS ships a skill (command) of that name;
13
+ * - when asked to (`checkDisk`), only if it is also present in one of the places the manifest says
14
+ * it was installed. That second test is skipped when it cannot be made (no install location
15
+ * recorded, or none of the recorded folders exists): a name list is never emptied because the
16
+ * tool could not find where to look.
17
+ *
18
+ * Every manifest field that records skill or command NAMES, and what handles it:
19
+ * skills.names -> this module (skills)
20
+ * commands.names -> this module (commands)
21
+ * skillHashes -> utils/skill-hash-ownership.js (XSPEC-454 R2; the name is the 3rd path segment)
22
+ * commandHashes -> utils/command-hash-ownership.js (XSPEC-454 R2; the name is the file stem)
23
+ * `skills.installations` / `commands.installations` record tools and levels, not names, and
24
+ * `installedArtifacts` records only integration files and created directories.
25
+ *
26
+ * @module utils/installed-names-ownership
27
+ */
28
+
29
+ import { existsSync } from 'fs';
30
+ import { join } from 'path';
31
+ import { getAvailableSkillNames, getAvailableCommandNames } from './skills-installer.js';
32
+ import { MARKETPLACE_NAMES_SENTINEL } from '../core/marketplace-sentinel.js';
33
+ import { getSkillsDirForAgent, getCommandsDirForAgent, getCommandFileExtension } from '../config/ai-agent-paths.js';
34
+
35
+ /** Below these sizes the source tree did not load; never read that as "UDS ships nothing". */
36
+ const MIN_SHIPPED = 10;
37
+
38
+ /** `{ agent, level }` for every recorded installation (strings are legacy project-level entries). */
39
+ function installationsOf(section) {
40
+ return (section?.installations || [])
41
+ .map((entry) => (typeof entry === 'string'
42
+ ? { agent: entry, level: 'project' }
43
+ : { agent: entry?.agent, level: entry?.level || 'project' }))
44
+ .filter((entry) => entry.agent);
45
+ }
46
+
47
+ /** Folders a skill of the recorded installations would live in. Empty when the manifest does not say. */
48
+ function skillFolders(manifest, projectPath) {
49
+ const dirs = installationsOf(manifest.skills)
50
+ .map(({ agent, level }) => getSkillsDirForAgent(agent, level, projectPath))
51
+ .filter(Boolean);
52
+ if (dirs.length > 0) return dirs;
53
+ // A legacy manifest records no installations, only where the skills went.
54
+ const location = manifest.skills?.location;
55
+ if (location === 'project' || location === 'user') {
56
+ const dir = getSkillsDirForAgent('claude-code', location, projectPath);
57
+ return dir ? [dir] : [];
58
+ }
59
+ return [];
60
+ }
61
+
62
+ /** `[folder, extension]` pairs where a command of the recorded installations would live. */
63
+ function commandFolders(manifest, projectPath) {
64
+ return installationsOf(manifest.commands)
65
+ .map(({ agent, level }) => [getCommandsDirForAgent(agent, level, projectPath), getCommandFileExtension(agent)])
66
+ .filter(([dir]) => Boolean(dir));
67
+ }
68
+
69
+ function prune(names, keep) {
70
+ const kept = [];
71
+ const dropped = [];
72
+ for (const name of names) (keep(name) ? kept : dropped).push(name);
73
+ return { kept, dropped: dropped.sort() };
74
+ }
75
+
76
+ /**
77
+ * Drop the names in `manifest.skills.names` that UDS cannot vouch for. Mutates `manifest`.
78
+ *
79
+ * @param {Object} manifest
80
+ * @param {string} projectPath
81
+ * @param {Object} [options]
82
+ * @param {boolean} [options.checkDisk=false] - also require the skill to be present where it was installed
83
+ * @param {Set<string>} [options.shipped] - Injection point for tests; defaults to the skills this CLI ships
84
+ * @returns {string[]} The names dropped, sorted
85
+ */
86
+ export function pruneForeignSkillNames(manifest, projectPath, { checkDisk = false, shipped = new Set(getAvailableSkillNames()) } = {}) {
87
+ const names = manifest?.skills?.names;
88
+ if (!Array.isArray(names) || shipped.size < MIN_SHIPPED) return [];
89
+ // Marketplace installs record a sentinel instead of names; there is nothing to prune.
90
+ if (names.includes(MARKETPLACE_NAMES_SENTINEL)) return [];
91
+
92
+ const dirs = checkDisk ? skillFolders(manifest, projectPath) : [];
93
+ const diskTestPossible = dirs.some((dir) => existsSync(dir));
94
+ const { kept, dropped } = prune(names, (name) =>
95
+ shipped.has(name) && (!diskTestPossible || dirs.some((dir) => existsSync(join(dir, name)))));
96
+ if (dropped.length > 0) manifest.skills.names = kept;
97
+ return dropped;
98
+ }
99
+
100
+ /**
101
+ * Drop the names in `manifest.commands.names` that UDS cannot vouch for. Mutates `manifest`.
102
+ * Same contract as {@link pruneForeignSkillNames}.
103
+ */
104
+ export function pruneForeignCommandNames(manifest, projectPath, { checkDisk = false, shipped = new Set(getAvailableCommandNames()) } = {}) {
105
+ const names = manifest?.commands?.names;
106
+ if (!Array.isArray(names) || shipped.size < MIN_SHIPPED) return [];
107
+
108
+ const places = checkDisk ? commandFolders(manifest, projectPath) : [];
109
+ const diskTestPossible = places.some(([dir]) => existsSync(dir));
110
+ const { kept, dropped } = prune(names, (name) =>
111
+ shipped.has(name) && (!diskTestPossible || places.some(([dir, ext]) => existsSync(join(dir, `${name}${ext}`)))));
112
+ if (dropped.length > 0) manifest.commands.names = kept;
113
+ return dropped;
114
+ }
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Read the header of a full SDD spec: title, status and type.
3
+ * // implements XSPEC-456 R5
4
+ *
5
+ * `uds spec list` was built for micro-specs (`## Micro-Spec: ...` with `**Status**: draft`). A full SDD
6
+ * spec states the same facts in its own header - a table (`| Status | Approved (2026-09-30) |`), field
7
+ * lines (`- **Status**: Archived`, `> **Status**: Stable`) or a YAML front matter - and the reader that
8
+ * found none of them filled in `draft` and an empty title. This module reads those layouts and reports
9
+ * what it could not read as `null`, so a caller can say "not parsed" instead of printing a default.
10
+ *
11
+ * @module utils/sdd-header
12
+ */
13
+
14
+ /** Where a status or type can be read in a header table: `| Status | Approved (2026-01-01) |`. */
15
+ const TABLE_FIELD = (name) => new RegExp(`^\\|\\s*\\**\\s*${name}\\s*\\**\\s*\\|\\s*(.+?)\\s*\\|?\\s*$`, 'i');
16
+ /** ...in a field line: `- **Status**: Archived`, `> **Status**: Stable`, `Status: Draft`. */
17
+ const LINE_FIELD = (name) => new RegExp(`^[\\s>*-]*\\**\\s*${name}\\s*\\**\\s*[:\uFF1A]\\s*\\**\\s*(.+?)\\s*$`, 'i');
18
+ const TABLE_SEPARATOR = /^\|[\s:|-]+\|?\s*$/;
19
+
20
+ /** First word of a header value, lower-cased (`Approved (2026-01-01)` -> `approved`); text it cannot split stays as written. */
21
+ function headerWord(value) {
22
+ const cleaned = String(value).replace(/[*`_]/g, '').trim();
23
+ const word = cleaned.match(/^[A-Za-z][A-Za-z-]*/);
24
+ return (word ? word[0].toLowerCase() : cleaned) || null;
25
+ }
26
+
27
+ /**
28
+ * Read title, status and type from the header of an SDD spec: its first 80 lines. Understands the header table, field lines, and a YAML front matter `status:`.
29
+ * Whatever it cannot find is `null` / empty - never a default that looks like a result.
30
+ *
31
+ * @param {string} content - File content
32
+ * @returns {{ title: string, status: string|null, type: string|null }}
33
+ */
34
+ export function readSddHeader(content) {
35
+ const all = content.replace(/\r\n/g, '\n').split('\n');
36
+ let start = 0;
37
+ let frontMatter = [];
38
+ if (all[0]?.trim() === '---') {
39
+ const close = all.findIndex((l, i) => i > 0 && l.trim() === '---');
40
+ if (close > 0) {
41
+ frontMatter = all.slice(1, close);
42
+ start = close + 1;
43
+ }
44
+ }
45
+ const lines = all.slice(start, start + 80);
46
+
47
+ const title = (lines.find((l) => /^#\s+\S/.test(l)) || '').replace(/^#\s+/, '').replace(/\s+#+\s*$/, '').trim();
48
+
49
+ const read = (name) => {
50
+ for (let i = 0; i < lines.length; i++) {
51
+ const row = TABLE_FIELD(name).exec(lines[i]);
52
+ // A header row of a table (`| Status | Description |`) is followed by a separator row; a field row is not.
53
+ if (row && !TABLE_SEPARATOR.test(lines[i + 1] || '')) return headerWord(row[1]);
54
+ const field = LINE_FIELD(name).exec(lines[i]);
55
+ if (field) return headerWord(field[1]);
56
+ }
57
+ for (const line of frontMatter) {
58
+ const fm = new RegExp(`^${name}\\s*:\\s*(.+?)\\s*$`, 'i').exec(line);
59
+ if (fm) return headerWord(fm[1]);
60
+ }
61
+ return null;
62
+ };
63
+
64
+ return { title, status: read('Status'), type: read('Type') };
65
+ }
@@ -5,6 +5,7 @@ import { exec } from 'child_process';
5
5
  import util from 'util';
6
6
  import { pathToFileURL } from 'node:url';
7
7
  import { readManifest } from './copier.js';
8
+ import { judgeCommitMessage } from './commit-message-judge.js';
8
9
 
9
10
  const execAsync = util.promisify(exec);
10
11
 
@@ -395,51 +396,121 @@ export class StandardValidator {
395
396
  }
396
397
 
397
398
  /**
398
- * Run a simulation to predict compliance with a standard
399
+ * Standards in this project that define a `physical_spec.simulator` (the only ones `uds simulate` can run).
400
+ * @returns {string[]} Standard ids, sorted
401
+ */
402
+ listSimulatableStandards() {
403
+ const ids = [];
404
+ let files;
405
+ try {
406
+ files = fs.readdirSync(this.standardsDir).filter(f => f.endsWith('.ai.yaml'));
407
+ } catch {
408
+ return ids;
409
+ }
410
+ for (const file of files) {
411
+ try {
412
+ const doc = yaml.load(fs.readFileSync(path.join(this.standardsDir, file), 'utf-8'));
413
+ if (doc?.physical_spec?.simulator) ids.push(doc?.standard?.id || file.replace(/\.ai\.yaml$/, ''));
414
+ } catch {
415
+ // an unreadable standard is not simulatable
416
+ }
417
+ }
418
+ return ids.sort();
419
+ }
420
+
421
+ /**
422
+ * Run a simulation to predict compliance with a standard.
423
+ *
424
+ * XSPEC-456 R2. Three outcomes, never two:
425
+ * - `pass` - the input complies;
426
+ * - `fail` - the input does not comply (the standard's rules say so);
427
+ * - `cannot-simulate` - no verdict was reached: the standard has no simulator, the standard is not
428
+ * installed, or the tool a simulator delegates to is not usable. Reporting that
429
+ * as `fail` told people their input was non-compliant when nothing had judged it.
430
+ * `success` stays for existing readers and is true only for `pass`.
431
+ *
399
432
  * @param {string} standardId - Standard ID
400
- * @param {string} input - Input to test (e.g. commit message)
401
- * @returns {Promise<Object>} Simulation result
433
+ * @param {string} input - Input to test (e.g. a commit message)
434
+ * @returns {Promise<{ status: 'pass'|'fail'|'cannot-simulate', success: boolean, message: string, details?: string }>}
402
435
  */
403
436
  async simulate(standardId, input) {
437
+ const cannot = (message, details) => ({ status: 'cannot-simulate', success: false, message, ...(details ? { details } : {}) });
438
+
404
439
  const standardFile = this.findStandardFile(standardId);
405
440
  if (!standardFile) {
406
- return { success: false, message: `Standard '${standardId}' not found.` };
441
+ return cannot(`Standard '${standardId}' not found.`, this._simulatableHint());
407
442
  }
408
443
 
409
444
  let standardConfig;
410
445
  try {
411
446
  standardConfig = yaml.load(fs.readFileSync(standardFile, 'utf-8'));
412
447
  } catch (e) {
413
- return { success: false, message: `Failed to parse standard: ${e.message}` };
448
+ return cannot(`Failed to parse standard: ${e.message}`);
414
449
  }
415
450
 
416
- if (!standardConfig.physical_spec || !standardConfig.physical_spec.simulator) {
417
- return {
418
- success: false,
419
- message: `Standard '${standardId}' does not support simulation (no 'simulator' spec defined).`
420
- };
451
+ const simulator = standardConfig?.physical_spec?.simulator;
452
+ if (!simulator) {
453
+ return cannot(
454
+ `Standard '${standardId}' does not support simulation (no 'simulator' spec defined).`,
455
+ this._simulatableHint()
456
+ );
421
457
  }
422
458
 
423
- const { command } = standardConfig.physical_spec.simulator;
424
-
425
- // Sanitization: Escape double quotes to prevent breaking the echo command
426
- // This is a basic implementation. For production, consider using spawn with stdin stream.
427
- const sanitizedInput = input.replace(/"/g, '\\"');
428
- const finalCommand = command.replace('{input}', sanitizedInput);
459
+ // In-process judges. A standard names one with `simulator.judge`; copies installed before that field
460
+ // existed carry `command: echo "{input}" | npx commitlint`, and are routed the same way.
461
+ const judgeName = simulator.judge
462
+ || (standardConfig?.standard?.id === 'commit-message' && /commitlint/.test(simulator.command || '') ? 'commit-message' : null);
463
+ if (judgeName === 'commit-message') {
464
+ const outcome = judgeCommitMessage(standardConfig, input, { standardsDir: this.standardsDir });
465
+ const details = [
466
+ ...outcome.findings.map(f => `- ${f}`),
467
+ `Checked: ${outcome.checked.join('; ')}`,
468
+ `Not checked: ${outcome.notChecked.join('; ')}`
469
+ ].join('\n');
470
+ return outcome.verdict === 'pass'
471
+ ? { status: 'pass', success: true, message: 'Simulation passed', details }
472
+ : { status: 'fail', success: false, message: 'Simulation failed: the input does not comply', details };
473
+ }
474
+ if (simulator.judge) {
475
+ return cannot(`Standard '${standardId}' names an unknown simulator judge '${simulator.judge}'.`);
476
+ }
477
+
478
+ if (typeof simulator.command !== 'string' || simulator.command.trim() === '') {
479
+ return cannot(`Standard '${standardId}' defines a simulator without a command or a judge.`);
480
+ }
481
+ return this._simulateWithCommand(simulator.command, input);
482
+ }
483
+
484
+ /** @private Names the standards that can be simulated, for messages. */
485
+ _simulatableHint() {
486
+ const ids = this.listSimulatableStandards();
487
+ return ids.length > 0
488
+ ? `Standards that can be simulated in this project: ${ids.join(', ')}.`
489
+ : 'No installed standard defines a simulator.';
490
+ }
491
+
492
+ /**
493
+ * @private Delegate to the command a standard gives. The input never becomes part of the shell string:
494
+ * `{input}` is replaced by a reference to an environment variable, which the shell expands without
495
+ * re-reading its value (so quotes, `$` and backticks in the input stay data). A tool that is not usable
496
+ * (not found, not executable) is `cannot-simulate`; a tool that ran and said no is `fail`.
497
+ */
498
+ async _simulateWithCommand(command, input) {
499
+ const ref = process.platform === 'win32' ? '%UDS_SIMULATE_INPUT%' : '$UDS_SIMULATE_INPUT';
500
+ const finalCommand = command.split('{input}').join(ref);
501
+ const env = { ...process.env, UDS_SIMULATE_INPUT: String(input) };
429
502
 
430
503
  try {
431
- const { stdout } = await execAsync(finalCommand, { cwd: this.projectPath });
432
- return {
433
- success: true,
434
- message: 'Simulation passed',
435
- details: stdout.trim()
436
- };
504
+ const { stdout } = await execAsync(finalCommand, { cwd: this.projectPath, env });
505
+ return { status: 'pass', success: true, message: 'Simulation passed', details: stdout.trim() };
437
506
  } catch (e) {
438
- return {
439
- success: false,
440
- message: 'Simulation failed',
441
- details: e.message + (e.stdout ? `\nOutput: ${e.stdout}` : '')
442
- };
507
+ const text = `${e.stderr || ''}`;
508
+ const notUsable = e.code === 126 || e.code === 127 || e.code === 9009
509
+ || /command not found|not recognized as an internal or external command|ENOENT/i.test(text);
510
+ const details = e.message + (e.stdout ? `\nOutput: ${e.stdout}` : '');
511
+ return notUsable
512
+ ? { status: 'cannot-simulate', success: false, message: 'Simulation could not run: the tool the standard delegates to is not usable here', details }
513
+ : { status: 'fail', success: false, message: 'Simulation failed: the input does not comply', details };
443
514
  }
444
515
  }
445
516
  }
@@ -12,6 +12,7 @@
12
12
  import { readFileSync, writeFileSync, existsSync, mkdirSync, readdirSync, unlinkSync, renameSync } from 'node:fs';
13
13
  import { join, basename } from 'node:path';
14
14
  import { config } from '../utils/config-manager.js';
15
+ import { readSddHeader } from '../utils/sdd-header.js';
15
16
 
16
17
  /**
17
18
  * Micro-spec status values
@@ -365,6 +366,20 @@ export class MicroSpec {
365
366
  const confirmedMatch = content.match(/\*\*Confirmed\*\*: (Yes|No)/);
366
367
  if (confirmedMatch) spec.confirmed = confirmedMatch[1] === 'Yes';
367
368
 
369
+ // XSPEC-456 R5: a file that is not in the micro-spec layout is a full SDD spec (or something else
370
+ // that lives in specs/). Everything above was built for the micro-spec layout, and what it does not
371
+ // find it fills with defaults - `draft`, an empty title, type `feature` - which `uds spec list`
372
+ // printed as if they had been read from the file. For these files the header is read as the SDD
373
+ // layouts write it, and what cannot be read stays unknown (`null`) instead of becoming a default.
374
+ const isMicro = /^## (?:Micro-)?Spec: /m.test(content) || /\*\*Spec Mode\*\*: /.test(content);
375
+ spec.format = isMicro ? 'micro' : 'sdd';
376
+ if (!isMicro) {
377
+ const header = readSddHeader(content);
378
+ spec.title = header.title;
379
+ spec.status = header.status;
380
+ spec.type = header.type;
381
+ }
382
+
368
383
  return spec;
369
384
  }
370
385
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "version": "6.14.0-beta.5",
3
+ "version": "6.14.0-beta.6",
4
4
  "lastUpdated": "2026-05-13",
5
5
  "description": "Standards registry for universal-dev-standards with integrated skills and AI-optimized formats",
6
6
  "formats": {
@@ -58,14 +58,14 @@
58
58
  "standards": {
59
59
  "name": "universal-dev-standards",
60
60
  "url": "https://github.com/AsiaOstrich/universal-dev-standards",
61
- "version": "6.14.0-beta.5"
61
+ "version": "6.14.0-beta.6"
62
62
  },
63
63
  "skills": {
64
64
  "name": "universal-dev-standards",
65
65
  "url": "https://github.com/AsiaOstrich/universal-dev-standards",
66
66
  "localPath": "skills",
67
67
  "rawUrl": "https://raw.githubusercontent.com/AsiaOstrich/universal-dev-standards/main/skills",
68
- "version": "6.14.0-beta.5",
68
+ "version": "6.14.0-beta.6",
69
69
  "note": "Skills are now included in the main repository under skills/"
70
70
  }
71
71
  },
@@ -2309,7 +2309,7 @@
2309
2309
  "id": "license-compliance",
2310
2310
  "name": "License Compliance Standards",
2311
2311
  "nameZh": "授權合規標準",
2312
- "version": "6.14.0-beta.5",
2312
+ "version": "6.14.0-beta.6",
2313
2313
  "source": {
2314
2314
  "human": "core/license-compliance.md",
2315
2315
  "ai": "ai/standards/license-compliance.ai.yaml"
@@ -2321,7 +2321,7 @@
2321
2321
  "id": "verification-oracle",
2322
2322
  "name": "Verification Oracle Standards",
2323
2323
  "nameZh": "驗證 Oracle 標準",
2324
- "version": "6.14.0-beta.5",
2324
+ "version": "6.14.0-beta.6",
2325
2325
  "source": {
2326
2326
  "human": "core/verification-oracle.md",
2327
2327
  "ai": "ai/standards/verification-oracle.ai.yaml"
@@ -2333,7 +2333,7 @@
2333
2333
  "id": "model-provenance",
2334
2334
  "name": "Model Provenance Policy Standards",
2335
2335
  "nameZh": "模型來源政策標準",
2336
- "version": "6.14.0-beta.5",
2336
+ "version": "6.14.0-beta.6",
2337
2337
  "source": {
2338
2338
  "human": "core/model-provenance.md",
2339
2339
  "ai": "ai/standards/model-provenance.ai.yaml"
@@ -2345,7 +2345,7 @@
2345
2345
  "id": "resource-cost-boundary",
2346
2346
  "name": "Resource / Cost Boundary Declaration Standards",
2347
2347
  "nameZh": "資源/成本邊界宣告標準",
2348
- "version": "6.14.0-beta.5",
2348
+ "version": "6.14.0-beta.6",
2349
2349
  "source": {
2350
2350
  "human": "core/resource-cost-boundary.md",
2351
2351
  "ai": "ai/standards/resource-cost-boundary.ai.yaml"