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

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 +30 -6
  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/developer-memory.ai.yaml +12 -2
  6. package/bundled/ai/standards/full-coverage-testing.ai.yaml +44 -6
  7. package/bundled/ai/standards/open-work-tracking.ai.yaml +191 -11
  8. package/bundled/ai/standards/pipeline-security-gates.ai.yaml +48 -3
  9. package/bundled/ai/standards/project-context-memory.ai.yaml +12 -2
  10. package/bundled/core/code-review-checklist.md +20 -2
  11. package/bundled/core/developer-memory.md +12 -2
  12. package/bundled/core/full-coverage-testing.md +44 -4
  13. package/bundled/core/open-work-tracking.md +156 -16
  14. package/bundled/core/pipeline-security-gates.md +63 -0
  15. package/bundled/core/project-context-memory.md +10 -2
  16. package/bundled/locales/zh-CN/CHANGELOG.md +78 -3
  17. package/bundled/locales/zh-CN/README.md +1 -1
  18. package/bundled/locales/zh-CN/SECURITY.md +1 -1
  19. package/bundled/locales/zh-CN/adoption/ADOPTION-GUIDE.md +13 -4
  20. package/bundled/locales/zh-CN/adoption/STATIC-DYNAMIC-GUIDE.md +7 -1
  21. package/bundled/locales/zh-CN/adoption/checklists/enterprise.md +7 -1
  22. package/bundled/locales/zh-CN/adoption/checklists/minimal.md +13 -3
  23. package/bundled/locales/zh-CN/adoption/checklists/recommended.md +7 -1
  24. package/bundled/locales/zh-CN/core/code-review-checklist.md +17 -0
  25. package/bundled/locales/zh-CN/core/developer-memory.md +9 -0
  26. package/bundled/locales/zh-CN/core/full-coverage-testing.md +48 -8
  27. package/bundled/locales/zh-CN/core/pipeline-security-gates.md +64 -4
  28. package/bundled/locales/zh-CN/core/project-context-memory.md +5 -0
  29. package/bundled/locales/zh-CN/docs/AVAILABLE-STANDARDS.md +70 -0
  30. package/bundled/locales/zh-CN/docs/CHEATSHEET.md +4 -3
  31. package/bundled/locales/zh-CN/docs/CLI-INIT-OPTIONS.md +25 -23
  32. package/bundled/locales/zh-CN/docs/FEATURE-REFERENCE.md +13 -11
  33. package/bundled/locales/zh-CN/docs/USAGE-MODES-COMPARISON.md +6 -6
  34. package/bundled/locales/zh-CN/docs/WINDOWS-GUIDE.md +7 -1
  35. package/bundled/locales/zh-CN/docs/user/GETTING-STARTED.md +44 -0
  36. package/bundled/locales/zh-CN/options/code-review/pr-review.md +13 -2
  37. package/bundled/locales/zh-TW/CHANGELOG.md +78 -3
  38. package/bundled/locales/zh-TW/README.md +1 -1
  39. package/bundled/locales/zh-TW/SECURITY.md +1 -1
  40. package/bundled/locales/zh-TW/adoption/ADOPTION-GUIDE.md +13 -4
  41. package/bundled/locales/zh-TW/adoption/STATIC-DYNAMIC-GUIDE.md +7 -1
  42. package/bundled/locales/zh-TW/adoption/checklists/enterprise.md +7 -1
  43. package/bundled/locales/zh-TW/adoption/checklists/minimal.md +13 -3
  44. package/bundled/locales/zh-TW/adoption/checklists/recommended.md +7 -1
  45. package/bundled/locales/zh-TW/core/code-review-checklist.md +17 -0
  46. package/bundled/locales/zh-TW/core/developer-memory.md +9 -0
  47. package/bundled/locales/zh-TW/core/full-coverage-testing.md +48 -8
  48. package/bundled/locales/zh-TW/core/open-work-tracking.md +90 -14
  49. package/bundled/locales/zh-TW/core/pipeline-security-gates.md +64 -4
  50. package/bundled/locales/zh-TW/core/project-context-memory.md +5 -0
  51. package/bundled/locales/zh-TW/docs/AVAILABLE-STANDARDS.md +70 -0
  52. package/bundled/locales/zh-TW/docs/CHEATSHEET.md +4 -3
  53. package/bundled/locales/zh-TW/docs/CLI-INIT-OPTIONS.md +25 -23
  54. package/bundled/locales/zh-TW/docs/FEATURE-REFERENCE.md +13 -11
  55. package/bundled/locales/zh-TW/docs/USAGE-MODES-COMPARISON.md +6 -6
  56. package/bundled/locales/zh-TW/docs/WINDOWS-GUIDE.md +7 -1
  57. package/bundled/locales/zh-TW/docs/user/GETTING-STARTED.md +44 -0
  58. package/bundled/locales/zh-TW/options/code-review/pr-review.md +13 -2
  59. package/bundled/skills/SKILL_NAMING.md +9 -0
  60. package/bundled/templates/gates/check-anti-fake-tests.mjs +305 -5
  61. package/package.json +3 -1
  62. package/src/commands/audit.js +9 -2
  63. package/src/commands/check.js +17 -0
  64. package/src/commands/hitl.js +3 -0
  65. package/src/commands/init.js +41 -21
  66. package/src/commands/list.js +12 -3
  67. package/src/commands/mcp.js +2 -3
  68. package/src/commands/open-work.js +65 -6
  69. package/src/commands/quickstart.js +29 -13
  70. package/src/commands/release.js +41 -17
  71. package/src/commands/skills.js +19 -33
  72. package/src/commands/spec-split.js +28 -16
  73. package/src/commands/spec.js +34 -13
  74. package/src/commands/uninstall.js +2 -2
  75. package/src/commands/update.js +61 -61
  76. package/src/core/open-work-config.js +103 -0
  77. package/src/flows/init-flow.js +10 -0
  78. package/src/hitl/manager.js +4 -2
  79. package/src/i18n/messages.js +240 -63
  80. package/src/installers/skills-installer.js +3 -1
  81. package/src/mcp/__tests__/server.test.js +0 -1
  82. package/src/mcp/server.js +16 -4
  83. package/src/prompts/init.js +148 -13
  84. package/src/reconciler/index.js +42 -5
  85. package/src/uninstallers/skills-uninstaller.js +83 -16
  86. package/src/uninstallers/standards-uninstaller.js +56 -7
  87. package/src/utils/agents-installer.js +10 -17
  88. package/src/utils/available-standards-report.js +144 -0
  89. package/src/utils/available-standards.js +216 -0
  90. package/src/utils/copier.js +5 -4
  91. package/src/utils/friction-detector.js +27 -0
  92. package/src/utils/open-work-tracking.mjs +919 -48
  93. package/src/utils/prompt-closed.js +18 -0
  94. package/src/utils/skill-frontmatter.js +102 -0
  95. package/src/utils/skill-name-collision.js +169 -0
  96. package/src/utils/skills-install-paths.js +114 -0
  97. package/src/utils/skills-installer.js +63 -105
  98. package/src/utils/transient-fs.js +113 -0
  99. package/standards-registry.json +34 -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 */
@@ -21,6 +21,7 @@
21
21
 
22
22
  import chalk from 'chalk';
23
23
  import { select } from '@inquirer/prompts';
24
+ import { isPromptClosed } from '../utils/prompt-closed.js';
24
25
 
25
26
  export const WORKFLOWS = [
26
27
  {
@@ -64,6 +65,18 @@ export const WORKFLOWS = [
64
65
  },
65
66
  ];
66
67
 
68
+ /** Print one workflow: its name, what it is for, and its numbered commands. */
69
+ function printWorkflow(workflow) {
70
+ console.log(chalk.bold(`\n${workflow.name}\n`));
71
+ console.log(chalk.gray(`${workflow.description}\n`));
72
+
73
+ for (let i = 0; i < workflow.steps.length; i++) {
74
+ const step = workflow.steps[i];
75
+ console.log(` ${chalk.cyan(`${i + 1}.`)} ${chalk.yellow(step.cmd)}`);
76
+ console.log(` ${chalk.gray(step.desc)}\n`);
77
+ }
78
+ }
79
+
67
80
  /**
68
81
  * Execute the quickstart command
69
82
  */
@@ -77,20 +90,23 @@ export async function quickstartCommand() {
77
90
  description: w.description,
78
91
  }));
79
92
 
80
- const selected = await select({
81
- message: 'Which workflow do you want to follow?',
82
- choices,
83
- });
84
-
85
- const workflow = WORKFLOWS[selected];
86
- console.log(chalk.bold(`\n${workflow.name}\n`));
87
- console.log(chalk.gray(`${workflow.description}\n`));
88
-
89
- for (let i = 0; i < workflow.steps.length; i++) {
90
- const step = workflow.steps[i];
91
- console.log(` ${chalk.cyan(`${i + 1}.`)} ${chalk.yellow(step.cmd)}`);
92
- console.log(` ${chalk.gray(step.desc)}\n`);
93
+ let selected;
94
+ try {
95
+ selected = await select({
96
+ message: 'Which workflow do you want to follow?',
97
+ choices,
98
+ });
99
+ } catch (promptError) {
100
+ if (!isPromptClosed(promptError)) throw promptError;
101
+ // Nothing can answer (not a terminal: an AI assistant, CI, a pipe). The guide's whole job is to show the commands, so show all of them
102
+ // rather than a stack trace and an exit code of 0.
103
+ console.log(chalk.gray('Nothing here can answer the question (not a terminal), so every workflow is shown.'));
104
+ for (const workflow of WORKFLOWS) printWorkflow(workflow);
105
+ console.log(chalk.gray('Tip: Run "uds quickstart" in a terminal to pick one workflow.\n'));
106
+ return;
93
107
  }
94
108
 
109
+ printWorkflow(WORKFLOWS[selected]);
110
+
95
111
  console.log(chalk.gray('Tip: Run each command in order. Use "uds quickstart" anytime to see this guide again.\n'));
96
112
  }
@@ -7,8 +7,17 @@
7
7
  * deploy — Record deployment to environment (manual/hybrid mode)
8
8
  * manifest — Generate build-manifest.json (manual/hybrid mode)
9
9
  * verify — Verify manifest against git state (manual/hybrid mode)
10
+ *
11
+ * Exit codes of `verify` (a script that gates a release on it must never read a failure as a pass):
12
+ * 0 the manifest verified
13
+ * 1 verification FAILED (commit or checksum does not match what the manifest records)
14
+ * 2 could not verify (no manifest, unreadable manifest, artifact not found, or the mode has no verify)
15
+ * 1 = "the answer is no", 2 = "no answer", the same split as `uds hitl check`.
10
16
  */
11
17
 
18
+ const EXIT_VERIFY_FAILED = 1;
19
+ const EXIT_CANNOT_VERIFY = 2;
20
+
12
21
  import chalk from 'chalk';
13
22
  import * as yaml from 'js-yaml';
14
23
  import { existsSync, readFileSync, writeFileSync } from 'fs';
@@ -16,7 +25,7 @@ import { join } from 'path';
16
25
  import { execSync } from 'child_process';
17
26
  import { createHash } from 'crypto';
18
27
  import { resolveReleaseWorkflow } from '../utils/release-config.js';
19
- import { formatGitTag, createPromotionRecord, parseRCVersion, isStableVersion } from '../utils/version-promote.js';
28
+ import { formatGitTag, parseRCVersion, isStableVersion } from '../utils/version-promote.js';
20
29
 
21
30
  // Default deployment environments (overridable via release-config.yaml release.environments)
22
31
  const DEFAULT_ENVIRONMENTS = ['development', 'staging', 'canary', 'preview', 'production'];
@@ -39,6 +48,20 @@ function loadReleaseConfig(projectPath) {
39
48
  }
40
49
  }
41
50
 
51
+ /**
52
+ * The deployment environment names a release-config.yaml declares, or null when it declares none.
53
+ * An entry is a name (`- staging`) or the object `uds config` writes (`- name: staging`, with `type` and so on).
54
+ * The object form used to be compared as if it were a name, so a project set up by UDS itself could not deploy anywhere.
55
+ */
56
+ function configuredEnvironmentNames(releaseConfig) {
57
+ const declared = releaseConfig?.release?.environments;
58
+ if (!Array.isArray(declared)) return null;
59
+ const names = declared
60
+ .map((entry) => (entry && typeof entry === 'object' ? entry.name : entry))
61
+ .filter((name) => typeof name === 'string' && name.trim() !== '');
62
+ return names.length > 0 ? names : null;
63
+ }
64
+
42
65
  /**
43
66
  * Load deployments.yaml
44
67
  */
@@ -151,9 +174,13 @@ export async function releaseCommand(subcommand, args, options) {
151
174
  case 'verify':
152
175
  if (!workflow.hasManifest) {
153
176
  console.log(chalk.red('verify 子命令僅在 manual 或 hybrid 模式下可用。'));
177
+ process.exitCode = EXIT_CANNOT_VERIFY; // nothing was verified; 0 would read as "verified"
154
178
  return;
155
179
  }
156
- await handleVerify(projectPath, options);
180
+ {
181
+ const verifyExit = await handleVerify(projectPath, options);
182
+ if (verifyExit !== 0) process.exitCode = verifyExit; // wire:release-verify-exit
183
+ }
157
184
  break;
158
185
 
159
186
  default:
@@ -203,16 +230,12 @@ async function handlePromote(targetVersion, projectPath) {
203
230
  console.log(chalk.gray(` 晉升目標: ${targetVersion}`));
204
231
  }
205
232
 
206
- // Create promotion record
207
- const record = createPromotionRecord(currentVersion || 'unknown', targetVersion);
208
- console.log();
209
- console.log(chalk.green(` ✓ 晉升紀錄建立: ${record.promoted_from} → ${record.version}`));
210
-
211
- // Create git tag
233
+ // This command only prints. It writes no promotion record and creates no git tag, so it must not say it did.
212
234
  const tag = formatGitTag(targetVersion);
213
- console.log(chalk.green(` ✓ Git tag: ${tag}`));
214
235
  console.log();
215
- console.log(chalk.cyan('後續步驟:'));
236
+ console.log(chalk.yellow('這個指令不會建立晉升紀錄,也不會建立 Git tag;它只列出下一步要執行的事。'));
237
+ console.log();
238
+ console.log(chalk.cyan('下一步(由你執行):'));
216
239
  console.log(chalk.gray(` 1. 更新版本檔案為 ${targetVersion}`));
217
240
  console.log(chalk.gray(` 2. git tag ${tag}`));
218
241
  console.log(chalk.gray(' 3. 從此 commit 重新打包'));
@@ -234,10 +257,7 @@ async function handleDeploy(environment, options, projectPath) {
234
257
 
235
258
  // Validate environment against allow-list (overridable via release-config.yaml)
236
259
  const deployConfig = loadReleaseConfig(projectPath);
237
- const allowedEnvironments =
238
- Array.isArray(deployConfig?.release?.environments) && deployConfig.release.environments.length > 0
239
- ? deployConfig.release.environments
240
- : DEFAULT_ENVIRONMENTS;
260
+ const allowedEnvironments = configuredEnvironmentNames(deployConfig) || DEFAULT_ENVIRONMENTS;
241
261
  if (!allowedEnvironments.includes(environment)) {
242
262
  console.log(chalk.red(`未知的部署環境: ${environment}`));
243
263
  console.log(chalk.gray(` 允許的環境: ${allowedEnvironments.join(', ')}`));
@@ -335,6 +355,8 @@ async function handleManifest(versionArg, options, projectPath) {
335
355
  *
336
356
  * T13 (XSPEC-292): when --artifact is given, compute its SHA256 so verify
337
357
  * actually CONSUMES the checksum recorded in the manifest, not just stores it.
358
+ *
359
+ * @returns {Promise<number>} the exit code: 0 verified, EXIT_VERIFY_FAILED, or EXIT_CANNOT_VERIFY
338
360
  */
339
361
  async function handleVerify(projectPath, options = {}) {
340
362
  const manifestPath = join(projectPath, 'build-manifest.json');
@@ -342,7 +364,7 @@ async function handleVerify(projectPath, options = {}) {
342
364
  if (!existsSync(manifestPath)) {
343
365
  console.log(chalk.red('找不到 build-manifest.json'));
344
366
  console.log(chalk.gray(' 請先執行 uds release manifest'));
345
- return;
367
+ return EXIT_CANNOT_VERIFY;
346
368
  }
347
369
 
348
370
  let manifest;
@@ -350,7 +372,7 @@ async function handleVerify(projectPath, options = {}) {
350
372
  manifest = JSON.parse(readFileSync(manifestPath, 'utf-8'));
351
373
  } catch {
352
374
  console.log(chalk.red('build-manifest.json 格式不正確'));
353
- return;
375
+ return EXIT_CANNOT_VERIFY;
354
376
  }
355
377
  const currentCommit = getGitCommit();
356
378
 
@@ -360,7 +382,7 @@ async function handleVerify(projectPath, options = {}) {
360
382
  if (artifactPath) {
361
383
  if (!existsSync(artifactPath)) {
362
384
  console.log(chalk.red(`找不到 artifact:${artifactPath}`));
363
- return;
385
+ return EXIT_CANNOT_VERIFY;
364
386
  }
365
387
  actualChecksum = createHash('sha256').update(readFileSync(artifactPath)).digest('hex');
366
388
  }
@@ -396,6 +418,8 @@ async function handleVerify(projectPath, options = {}) {
396
418
  } else {
397
419
  console.log(chalk.yellow(' Staging: 未通過或無紀錄'));
398
420
  }
421
+
422
+ return result.valid ? 0 : EXIT_VERIFY_FAILED;
399
423
  }
400
424
 
401
425
  /**
@@ -8,6 +8,7 @@ import { pruneForeignSkillHashes } from '../utils/skill-hash-ownership.js';
8
8
  import { getSkillsDirForAgent, getAgentDisplayName } from '../config/ai-agent-paths.js';
9
9
  import { readManifest, isInitialized } from '../utils/copier.js';
10
10
  import { t, setLanguage, isLanguageExplicitlySet } from '../i18n/messages.js';
11
+ import { printInstallPathComparison } from '../utils/skills-install-paths.js';
11
12
 
12
13
  // Known skill directories (non-skill items to exclude)
13
14
  const NON_SKILL_ITEMS = [
@@ -122,6 +123,11 @@ export function skillsCommand() {
122
123
  const shipped = getAvailableSkillNames();
123
124
  const knownSkills = shipped.length > 0 ? shipped : getAllSkillNames();
124
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
+ };
130
+
125
131
  // Check different installation locations
126
132
  const installations = [];
127
133
 
@@ -139,7 +145,7 @@ export function skillsCommand() {
139
145
  path: udsPlugin.installPath,
140
146
  version: udsPlugin.version || 'unknown',
141
147
  skills,
142
- recommended: !udsPlugin.isLegacyMarketplace,
148
+ isPlugin: true,
143
149
  legacyMarketplace: udsPlugin.isLegacyMarketplace
144
150
  });
145
151
  }
@@ -165,11 +171,10 @@ export function skillsCommand() {
165
171
  }
166
172
 
167
173
  installations.push({
168
- location: 'User Level (deprecated)',
174
+ location: 'User Level',
169
175
  path: userSkillsDir,
170
176
  version,
171
- skills: udsSkills,
172
- deprecated: true
177
+ skills: udsSkills
173
178
  });
174
179
  }
175
180
  }
@@ -194,11 +199,10 @@ export function skillsCommand() {
194
199
  }
195
200
 
196
201
  installations.push({
197
- location: 'Project Level (deprecated)',
202
+ location: 'Project Level',
198
203
  path: projectSkillsDir,
199
204
  version,
200
- skills: udsSkills,
201
- deprecated: true
205
+ skills: udsSkills
202
206
  });
203
207
  }
204
208
  }
@@ -228,22 +232,18 @@ export function skillsCommand() {
228
232
  if (installations.length === 0) {
229
233
  console.log(chalk.yellow(msg.noSkillsInstalled));
230
234
  console.log();
231
- console.log(chalk.gray(msg.installViaMarketplace));
232
- console.log(chalk.cyan(' /plugin marketplace add AsiaOstrich/universal-dev-standards'));
233
- console.log(chalk.cyan(' /plugin install universal-dev-standards@asia-ostrich'));
234
- console.log();
235
+ // XSPEC-462 R1: say both ways and what each one can and cannot do, not only the plugin.
236
+ sayBothWays();
235
237
  return;
236
238
  }
237
239
 
238
240
  // Show each installation
239
241
  for (const install of installations) {
240
242
  // Header
241
- if (install.recommended) {
242
- console.log(chalk.green(`✓ ${install.location}`) + chalk.gray(` ${msg.recommended}`));
243
- } else if (install.legacyMarketplace) {
244
- console.log(chalk.yellow(`⚠ ${install.location}`));
245
- } else if (install.deprecated) {
243
+ if (install.legacyMarketplace) {
246
244
  console.log(chalk.yellow(`⚠ ${install.location}`));
245
+ } else if (install.isPlugin) {
246
+ console.log(chalk.green(`✓ ${install.location}`));
247
247
  } else {
248
248
  console.log(chalk.blue(`● ${install.location}`));
249
249
  }
@@ -255,7 +255,7 @@ export function skillsCommand() {
255
255
  // Skills list
256
256
  console.log(chalk.gray(` Skills (${install.skills.length}):`));
257
257
  for (const skill of install.skills) {
258
- const icon = (install.deprecated || install.legacyMarketplace)
258
+ const icon = install.legacyMarketplace
259
259
  ? chalk.yellow('○')
260
260
  : chalk.green('✓');
261
261
  console.log(` ${icon} ${skill}`);
@@ -270,20 +270,10 @@ export function skillsCommand() {
270
270
  console.log(chalk.cyan(' /plugin install universal-dev-standards@asia-ostrich'));
271
271
  console.log();
272
272
  }
273
-
274
- // Deprecation warning
275
- if (install.deprecated) {
276
- console.log(chalk.yellow(` ${msg.manualInstallDeprecated}`));
277
- console.log(chalk.gray(` ${msg.manualInstallHint}`));
278
- console.log(chalk.cyan(' /plugin marketplace add AsiaOstrich/universal-dev-standards'));
279
- console.log(chalk.cyan(' /plugin install universal-dev-standards@asia-ostrich'));
280
- console.log();
281
- }
282
273
  }
283
274
 
284
275
  // Summary
285
276
  const totalSkills = new Set(installations.flatMap(i => i.skills)).size;
286
- const hasMarketplace = installations.some(i => i.recommended);
287
277
 
288
278
  console.log(chalk.gray('─'.repeat(50)));
289
279
  console.log(chalk.gray(`${msg.totalUniqueSkills}: ${totalSkills} / ${knownSkills.length}`));
@@ -299,13 +289,9 @@ export function skillsCommand() {
299
289
  }
300
290
  }
301
291
 
302
- if (!hasMarketplace && installations.length > 0) {
303
- console.log();
304
- console.log(chalk.yellow(msg.recommendation));
305
- console.log(chalk.gray(` ${msg.benefits}`));
306
- }
307
-
292
+ // XSPEC-462 R1: the two ways, side by side, with their limits.
308
293
  console.log();
294
+ sayBothWays();
309
295
  }
310
296
 
311
297
  // Export for testing
@@ -13,6 +13,7 @@ import { MicroSpec } from '../vibe/micro-spec.js';
13
13
  import { existsSync, readFileSync, writeFileSync, mkdirSync, copyFileSync } from 'node:fs';
14
14
  import { join } from 'node:path';
15
15
  import { withFileTransaction } from '../utils/transaction.js';
16
+ import { isPromptClosed } from '../utils/prompt-closed.js';
16
17
 
17
18
  /**
18
19
  * Extract acceptance criteria from spec markdown
@@ -86,25 +87,36 @@ export async function specSplitCommand(id, options = {}) {
86
87
  }
87
88
  console.log();
88
89
 
89
- // Interactive selection: which ACs to move to new spec
90
- const toMove = await checkbox({
91
- message: 'Select ACs to move to a NEW spec (remaining stay in original):',
92
- choices: acs.map(ac => ({
93
- name: `${ac.id}: ${ac.text.substring(ac.id.length + 1).trim().substring(0, 60)}`,
94
- value: ac.id,
95
- })),
96
- });
97
-
98
- if (toMove.length === 0 || toMove.length === acs.length) {
99
- console.log(chalk.yellow('Must select some (but not all) ACs to move. Aborting.'));
90
+ // Interactive selection: which ACs to move to new spec. Nothing can be written before both answers are in,
91
+ // so a prompt that cannot be answered (not a terminal) changes nothing and says so.
92
+ let toMove;
93
+ let proceed;
94
+ try {
95
+ toMove = await checkbox({
96
+ message: 'Select ACs to move to a NEW spec (remaining stay in original):',
97
+ choices: acs.map(ac => ({
98
+ name: `${ac.id}: ${ac.text.substring(ac.id.length + 1).trim().substring(0, 60)}`,
99
+ value: ac.id,
100
+ })),
101
+ });
102
+
103
+ if (toMove.length === 0 || toMove.length === acs.length) {
104
+ console.log(chalk.yellow('Must select some (but not all) ACs to move. Aborting.'));
105
+ return;
106
+ }
107
+
108
+ proceed = await inquirerConfirm({
109
+ message: `Split ${id}: keep ${acs.length - toMove.length} ACs, move ${toMove.length} ACs to new spec?`,
110
+ default: true,
111
+ });
112
+ } catch (promptError) {
113
+ if (!isPromptClosed(promptError)) throw promptError;
114
+ console.log(chalk.red('\nCannot ask which ACs to move: there is nothing attached to answer the prompt (non-interactive shell, CI, or a pipe).'));
115
+ console.log(chalk.gray(` Run \`uds spec split ${id}\` in a terminal. Nothing has been changed.`));
116
+ process.exitCode = 2;
100
117
  return;
101
118
  }
102
119
 
103
- const proceed = await inquirerConfirm({
104
- message: `Split ${id}: keep ${acs.length - toMove.length} ACs, move ${toMove.length} ACs to new spec?`,
105
- default: true,
106
- });
107
-
108
120
  if (!proceed) {
109
121
  console.log(chalk.gray('Split cancelled.'));
110
122
  return;
@@ -15,6 +15,7 @@ import { existsSync, readFileSync } from 'node:fs';
15
15
  import { join } from 'node:path';
16
16
  import { MicroSpec, SpecStatus } from '../vibe/micro-spec.js';
17
17
  import { msg } from '../i18n/messages.js';
18
+ import { isPromptClosed } from '../utils/prompt-closed.js';
18
19
 
19
20
  /**
20
21
  * Get localized message with fallback
@@ -69,15 +70,25 @@ export async function specCreateCommand(intent, options = {}) {
69
70
 
70
71
  // Ask for confirmation unless --yes flag
71
72
  if (!options.yes) {
72
- const action = await select({
73
- message: t('spec.confirmQuestion', 'How would you like to proceed?'),
74
- choices: [
75
- { name: t('spec.confirm', 'Confirm and proceed'), value: 'confirm' },
76
- { name: t('spec.edit', 'Edit the spec'), value: 'edit' },
77
- { name: t('spec.skip', 'Skip (keep as draft)'), value: 'skip' },
78
- { name: t('spec.discard', 'Discard'), value: 'discard' }
79
- ]
80
- });
73
+ let action;
74
+ try {
75
+ action = await select({
76
+ message: t('spec.confirmQuestion', 'How would you like to proceed?'),
77
+ choices: [
78
+ { name: t('spec.confirm', 'Confirm and proceed'), value: 'confirm' },
79
+ { name: t('spec.edit', 'Edit the spec'), value: 'edit' },
80
+ { name: t('spec.skip', 'Skip (keep as draft)'), value: 'skip' },
81
+ { name: t('spec.discard', 'Discard'), value: 'discard' }
82
+ ]
83
+ });
84
+ } catch (promptError) {
85
+ if (!isPromptClosed(promptError)) throw promptError;
86
+ // Nothing can answer (not a terminal): the spec is already written, so it stays a draft and the person is told how to confirm it.
87
+ console.log('');
88
+ console.log(chalk.yellow(t('spec.cannotAsk', 'Nothing here can answer the question, so the spec stays a draft.')));
89
+ console.log(chalk.gray(t('spec.cannotAskHint', 'Run `uds spec confirm <id>` to confirm it, or create it with --yes.')));
90
+ action = 'skip';
91
+ }
81
92
 
82
93
  if (action === 'confirm') {
83
94
  microSpec.confirm(spec.id);
@@ -265,10 +276,20 @@ export async function specDeleteCommand(id, options = {}) {
265
276
  });
266
277
 
267
278
  if (!options.yes) {
268
- const confirmed = await inquirerConfirm({
269
- message: t('spec.deleteConfirm', `Are you sure you want to delete spec '${id}'?`),
270
- default: false
271
- });
279
+ let confirmed;
280
+ try {
281
+ confirmed = await inquirerConfirm({
282
+ message: t('spec.deleteConfirm', `Are you sure you want to delete spec '${id}'?`),
283
+ default: false
284
+ });
285
+ } catch (promptError) {
286
+ if (!isPromptClosed(promptError)) throw promptError;
287
+ // Not auto-confirming: an unattended run must not be allowed to delete what a person was asked about.
288
+ console.log(chalk.red(t('spec.cannotConfirmDelete', 'Cannot ask for confirmation: there is nothing attached to answer the prompt (non-interactive shell, CI, or a pipe).')));
289
+ console.log(chalk.gray(t('spec.cannotConfirmDeleteHint', 'Re-run with --yes to delete. Nothing has been deleted.')));
290
+ process.exitCode = 2;
291
+ return;
292
+ }
272
293
 
273
294
  if (!confirmed) {
274
295
  console.log(chalk.gray(t('spec.deleteCancelled', 'Delete cancelled.')));
@@ -227,7 +227,7 @@ async function gatherPreview(projectPath, manifest, categories, includeUserLevel
227
227
  preview.integrations = await uninstallIntegrations(projectPath, manifest, { dryRun: true });
228
228
  }
229
229
  if (categories.includes('standards')) {
230
- preview.standards = uninstallStandards(projectPath, { dryRun: true });
230
+ preview.standards = uninstallStandards(projectPath, { dryRun: true, manifest });
231
231
  }
232
232
  if (categories.includes('hooks')) {
233
233
  // Nothing is deleted yet in a preview, so folders are judged against what the
@@ -267,7 +267,7 @@ async function executeUninstall(projectPath, manifest, categories, options) {
267
267
  });
268
268
  }
269
269
  if (categories.includes('standards')) {
270
- results.standards = uninstallStandards(projectPath);
270
+ results.standards = uninstallStandards(projectPath, { manifest });
271
271
  }
272
272
  if (categories.includes('hooks')) {
273
273
  // After everything else, so a folder that only held UDS files is empty by now.