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.
- package/README.md +13 -3
- package/bin/uds.js +30 -6
- package/bundled/ai/options/code-review/pr-review.ai.yaml +20 -1
- package/bundled/ai/standards/code-review.ai.yaml +15 -2
- package/bundled/ai/standards/developer-memory.ai.yaml +12 -2
- package/bundled/ai/standards/full-coverage-testing.ai.yaml +44 -6
- package/bundled/ai/standards/open-work-tracking.ai.yaml +191 -11
- package/bundled/ai/standards/pipeline-security-gates.ai.yaml +48 -3
- package/bundled/ai/standards/project-context-memory.ai.yaml +12 -2
- package/bundled/core/code-review-checklist.md +20 -2
- package/bundled/core/developer-memory.md +12 -2
- package/bundled/core/full-coverage-testing.md +44 -4
- package/bundled/core/open-work-tracking.md +156 -16
- package/bundled/core/pipeline-security-gates.md +63 -0
- package/bundled/core/project-context-memory.md +10 -2
- package/bundled/locales/zh-CN/CHANGELOG.md +78 -3
- package/bundled/locales/zh-CN/README.md +1 -1
- package/bundled/locales/zh-CN/SECURITY.md +1 -1
- package/bundled/locales/zh-CN/adoption/ADOPTION-GUIDE.md +13 -4
- package/bundled/locales/zh-CN/adoption/STATIC-DYNAMIC-GUIDE.md +7 -1
- package/bundled/locales/zh-CN/adoption/checklists/enterprise.md +7 -1
- package/bundled/locales/zh-CN/adoption/checklists/minimal.md +13 -3
- package/bundled/locales/zh-CN/adoption/checklists/recommended.md +7 -1
- package/bundled/locales/zh-CN/core/code-review-checklist.md +17 -0
- package/bundled/locales/zh-CN/core/developer-memory.md +9 -0
- package/bundled/locales/zh-CN/core/full-coverage-testing.md +48 -8
- package/bundled/locales/zh-CN/core/pipeline-security-gates.md +64 -4
- package/bundled/locales/zh-CN/core/project-context-memory.md +5 -0
- package/bundled/locales/zh-CN/docs/AVAILABLE-STANDARDS.md +70 -0
- package/bundled/locales/zh-CN/docs/CHEATSHEET.md +4 -3
- package/bundled/locales/zh-CN/docs/CLI-INIT-OPTIONS.md +25 -23
- package/bundled/locales/zh-CN/docs/FEATURE-REFERENCE.md +13 -11
- package/bundled/locales/zh-CN/docs/USAGE-MODES-COMPARISON.md +6 -6
- package/bundled/locales/zh-CN/docs/WINDOWS-GUIDE.md +7 -1
- package/bundled/locales/zh-CN/docs/user/GETTING-STARTED.md +44 -0
- package/bundled/locales/zh-CN/options/code-review/pr-review.md +13 -2
- package/bundled/locales/zh-TW/CHANGELOG.md +78 -3
- package/bundled/locales/zh-TW/README.md +1 -1
- package/bundled/locales/zh-TW/SECURITY.md +1 -1
- package/bundled/locales/zh-TW/adoption/ADOPTION-GUIDE.md +13 -4
- package/bundled/locales/zh-TW/adoption/STATIC-DYNAMIC-GUIDE.md +7 -1
- package/bundled/locales/zh-TW/adoption/checklists/enterprise.md +7 -1
- package/bundled/locales/zh-TW/adoption/checklists/minimal.md +13 -3
- package/bundled/locales/zh-TW/adoption/checklists/recommended.md +7 -1
- package/bundled/locales/zh-TW/core/code-review-checklist.md +17 -0
- package/bundled/locales/zh-TW/core/developer-memory.md +9 -0
- package/bundled/locales/zh-TW/core/full-coverage-testing.md +48 -8
- package/bundled/locales/zh-TW/core/open-work-tracking.md +90 -14
- package/bundled/locales/zh-TW/core/pipeline-security-gates.md +64 -4
- package/bundled/locales/zh-TW/core/project-context-memory.md +5 -0
- package/bundled/locales/zh-TW/docs/AVAILABLE-STANDARDS.md +70 -0
- package/bundled/locales/zh-TW/docs/CHEATSHEET.md +4 -3
- package/bundled/locales/zh-TW/docs/CLI-INIT-OPTIONS.md +25 -23
- package/bundled/locales/zh-TW/docs/FEATURE-REFERENCE.md +13 -11
- package/bundled/locales/zh-TW/docs/USAGE-MODES-COMPARISON.md +6 -6
- package/bundled/locales/zh-TW/docs/WINDOWS-GUIDE.md +7 -1
- package/bundled/locales/zh-TW/docs/user/GETTING-STARTED.md +44 -0
- package/bundled/locales/zh-TW/options/code-review/pr-review.md +13 -2
- package/bundled/skills/SKILL_NAMING.md +9 -0
- package/bundled/templates/gates/check-anti-fake-tests.mjs +305 -5
- package/package.json +3 -1
- package/src/commands/audit.js +9 -2
- package/src/commands/check.js +17 -0
- package/src/commands/hitl.js +3 -0
- package/src/commands/init.js +41 -21
- package/src/commands/list.js +12 -3
- package/src/commands/mcp.js +2 -3
- package/src/commands/open-work.js +65 -6
- package/src/commands/quickstart.js +29 -13
- package/src/commands/release.js +41 -17
- package/src/commands/skills.js +19 -33
- package/src/commands/spec-split.js +28 -16
- package/src/commands/spec.js +34 -13
- package/src/commands/uninstall.js +2 -2
- package/src/commands/update.js +61 -61
- package/src/core/open-work-config.js +103 -0
- package/src/flows/init-flow.js +10 -0
- package/src/hitl/manager.js +4 -2
- package/src/i18n/messages.js +240 -63
- package/src/installers/skills-installer.js +3 -1
- package/src/mcp/__tests__/server.test.js +0 -1
- package/src/mcp/server.js +16 -4
- package/src/prompts/init.js +148 -13
- package/src/reconciler/index.js +42 -5
- package/src/uninstallers/skills-uninstaller.js +83 -16
- package/src/uninstallers/standards-uninstaller.js +56 -7
- package/src/utils/agents-installer.js +10 -17
- package/src/utils/available-standards-report.js +144 -0
- package/src/utils/available-standards.js +216 -0
- package/src/utils/copier.js +5 -4
- package/src/utils/friction-detector.js +27 -0
- package/src/utils/open-work-tracking.mjs +919 -48
- package/src/utils/prompt-closed.js +18 -0
- package/src/utils/skill-frontmatter.js +102 -0
- package/src/utils/skill-name-collision.js +169 -0
- package/src/utils/skills-install-paths.js +114 -0
- package/src/utils/skills-installer.js +63 -105
- package/src/utils/transient-fs.js +113 -0
- package/standards-registry.json +34 -9
package/src/commands/update.js
CHANGED
|
@@ -6,6 +6,12 @@ import { existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSync } from '
|
|
|
6
6
|
import { join, basename, dirname, relative } from 'path';
|
|
7
7
|
import { readManifest, writeManifest, copyStandard, copyExtension, isInitialized, getRepoRoot } from '../utils/copier.js';
|
|
8
8
|
import { getRepositoryInfo, getAllStandards, getShippableFilenames, getStandardSource } from '../utils/registry.js';
|
|
9
|
+
import { getAvailableStandards } from '../utils/available-standards.js';
|
|
10
|
+
import {
|
|
11
|
+
printAvailableStandardsSection,
|
|
12
|
+
resolveAddStandardRequest,
|
|
13
|
+
findAddStandardConflict
|
|
14
|
+
} from '../utils/available-standards-report.js';
|
|
9
15
|
import { computeFileHash, planStandardsRemovals, refreshIntegrationBlockHashes, pruneIntegrationFileHashes } from '../utils/hasher.js';
|
|
10
16
|
import { AmbiguousMarkerError } from '../utils/marker-locator.js';
|
|
11
17
|
import {
|
|
@@ -49,6 +55,7 @@ import {
|
|
|
49
55
|
getCommandsDirForAgent
|
|
50
56
|
} from '../config/ai-agent-paths.js';
|
|
51
57
|
import { getMarketplaceSkillsInfo } from '../utils/github.js';
|
|
58
|
+
import { printSkillNameCollisionWarning } from '../utils/skill-name-collision.js';
|
|
52
59
|
import { detectAITools } from '../utils/detector.js';
|
|
53
60
|
import { HOOK_CAPABLE_TOOLS, resolveHookTools, installMissingHooks } from '../installers/hooks-installer.js';
|
|
54
61
|
import { persistRecorder, mergeRecorderInto, newRecorder } from '../core/install-records.js';
|
|
@@ -323,43 +330,11 @@ async function updateCliAndExit(useBeta = false) {
|
|
|
323
330
|
* @returns {{newStandards: Array<{source: string, name: string}>, count: number}}
|
|
324
331
|
*/
|
|
325
332
|
function checkNewStandards(manifest) {
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
//
|
|
329
|
-
const
|
|
330
|
-
|
|
331
|
-
// Include all reference and skill standards
|
|
332
|
-
const eligibleStandards = registryStandards.filter(s => s.category === 'reference' || s.category === 'skill');
|
|
333
|
-
|
|
334
|
-
// Get installed standard basenames for comparison.
|
|
335
|
-
// Handles both legacy path format ("ai/standards/foo.ai.yaml" → basename "foo.ai.yaml")
|
|
336
|
-
// and v3.4.0 ID format ("foo" → resolve to source path, then get basename).
|
|
337
|
-
const installedBasenames = new Set();
|
|
338
|
-
for (const s of (manifest.standards || [])) {
|
|
339
|
-
if (s.includes('/options/') || s.startsWith('options/')) continue; // Skip option paths
|
|
340
|
-
if (!s.includes('/') && !s.includes('.')) {
|
|
341
|
-
// ID format: resolve to actual source filename via registry
|
|
342
|
-
const entry = registryStandards.find(r => r.id === s);
|
|
343
|
-
if (entry) {
|
|
344
|
-
const sourcePath = getStandardSource(entry, format);
|
|
345
|
-
if (sourcePath) installedBasenames.add(basename(sourcePath));
|
|
346
|
-
}
|
|
347
|
-
} else {
|
|
348
|
-
installedBasenames.add(basename(s));
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
// Find standards in registry that are not yet installed
|
|
353
|
-
const newStandards = [];
|
|
354
|
-
for (const std of eligibleStandards) {
|
|
355
|
-
const sourcePath = getStandardSource(std, format);
|
|
356
|
-
if (!sourcePath) continue; // Skip skill-only standards with no source file
|
|
357
|
-
const fileName = basename(sourcePath);
|
|
358
|
-
if (!installedBasenames.has(fileName)) {
|
|
359
|
-
newStandards.push({ source: sourcePath, name: fileName });
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
|
|
333
|
+
// One definition of "available but not installed", shared with `update --plan`, `check` and
|
|
334
|
+
// `audit --friction` (XSPEC-458 R1). This function used to hold its own copy of that logic, and the
|
|
335
|
+
// reconciler path (`--plan`/`--apply`) held none — so the two paths disagreed about what was missing.
|
|
336
|
+
const { offered } = getAvailableStandards(manifest);
|
|
337
|
+
const newStandards = offered.map(std => ({ source: std.source, name: std.name }));
|
|
363
338
|
return { newStandards, count: newStandards.length };
|
|
364
339
|
}
|
|
365
340
|
|
|
@@ -454,6 +429,28 @@ export async function updateCommand(options) {
|
|
|
454
429
|
console.log(chalk.bold(msg.title));
|
|
455
430
|
console.log(chalk.gray('─'.repeat(50)));
|
|
456
431
|
|
|
432
|
+
// XSPEC-458 R3: `--add-standard <id>` (repeatable) picks standards UDS ships and this project lacks.
|
|
433
|
+
// Judged here, before any mode runs, so an unknown id stops everything instead of being skipped.
|
|
434
|
+
const addStandardIds = [].concat(options.addStandard || []);
|
|
435
|
+
let addStandards = [];
|
|
436
|
+
if (addStandardIds.length > 0) {
|
|
437
|
+
const conflict = findAddStandardConflict(options);
|
|
438
|
+
if (conflict) {
|
|
439
|
+
console.log(chalk.red(conflict));
|
|
440
|
+
console.log();
|
|
441
|
+
process.exitCode = 1;
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
const request = resolveAddStandardRequest(manifest, addStandardIds);
|
|
445
|
+
if (!request.proceed) return;
|
|
446
|
+
if (request.ids.length === 0) {
|
|
447
|
+
console.log(chalk.gray(t().availableStandards.addNothingDone));
|
|
448
|
+
console.log();
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
addStandards = request.ids;
|
|
452
|
+
}
|
|
453
|
+
|
|
457
454
|
// Handle --claude-target option (XSPEC-418 R4): switch an EXISTING
|
|
458
455
|
// installation's claude-code integration target between CLAUDE.md and
|
|
459
456
|
// CLAUDE.local.md, without a full reinstall. Standalone, like --sync-refs
|
|
@@ -530,7 +527,7 @@ export async function updateCommand(options) {
|
|
|
530
527
|
// Handle --plan option (DSR dry-run). Nothing below this line writes.
|
|
531
528
|
if (options.plan) {
|
|
532
529
|
if (!scopedToSkills && !scopedToCommands) {
|
|
533
|
-
await handlePlan(projectPath, options, manifest);
|
|
530
|
+
await handlePlan(projectPath, options, manifest, addStandards);
|
|
534
531
|
}
|
|
535
532
|
if (scopedToSkills) await planSkills(projectPath, manifest, options);
|
|
536
533
|
if (scopedToCommands) await planCommands(projectPath, manifest, options);
|
|
@@ -543,10 +540,10 @@ export async function updateCommand(options) {
|
|
|
543
540
|
// files only when the manifest records them, so `--skills` is not redundant.
|
|
544
541
|
if (options.apply || options.force) {
|
|
545
542
|
if (!scopedToSkills && !scopedToCommands) {
|
|
546
|
-
await handleReconcile(projectPath, options, { force: !!options.force });
|
|
543
|
+
await handleReconcile(projectPath, options, { force: !!options.force, addStandards });
|
|
547
544
|
return;
|
|
548
545
|
}
|
|
549
|
-
await handleReconcile(projectPath, options, { force: !!options.force });
|
|
546
|
+
await handleReconcile(projectPath, options, { force: !!options.force, addStandards });
|
|
550
547
|
// These exit the process on completion, so run Skills last.
|
|
551
548
|
if (scopedToCommands) await updateCommandsOnly(projectPath, manifest, options);
|
|
552
549
|
if (scopedToSkills) await updateSkillsOnly(projectPath, manifest, options);
|
|
@@ -1670,23 +1667,11 @@ export async function updateCommand(options) {
|
|
|
1670
1667
|
console.log(chalk.gray(` ${msg.updateViaMarketplace}`));
|
|
1671
1668
|
console.log(chalk.gray(` • ${msg.autoUpdate}`));
|
|
1672
1669
|
console.log(chalk.gray(` • ${msg.manualUpdate}`));
|
|
1673
|
-
} else if (location === 'user') {
|
|
1674
|
-
console.log(chalk.yellow(` ${msg.manualInstallDeprecated}`));
|
|
1675
|
-
console.log(chalk.gray(` ${msg.recommendedMigrate}`));
|
|
1676
|
-
console.log(chalk.gray(' /plugin add https://github.com/anthropics/claude-code-plugins/blob/main/skills/universal-dev-standards.md'));
|
|
1677
|
-
console.log(chalk.gray(` ${msg.orUpdateManually}`));
|
|
1678
|
-
console.log(chalk.gray(' cd ~/.claude/skills/universal-dev-standards && git pull'));
|
|
1679
|
-
} else if (location === 'project') {
|
|
1680
|
-
console.log(chalk.yellow(` ${msg.manualInstallDeprecated}`));
|
|
1681
|
-
console.log(chalk.gray(` ${msg.recommendedMigrate}`));
|
|
1682
|
-
console.log(chalk.gray(' /plugin add https://github.com/anthropics/claude-code-plugins/blob/main/skills/universal-dev-standards.md'));
|
|
1683
|
-
console.log(chalk.gray(` ${msg.orUpdateManually}`));
|
|
1684
|
-
console.log(chalk.gray(' cd .claude/skills/universal-dev-standards && git pull'));
|
|
1685
1670
|
} else {
|
|
1686
|
-
//
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
console.log(chalk.gray(
|
|
1671
|
+
// XSPEC-462 R1: project level, user level or not known: one way to update them. This used to call
|
|
1672
|
+
// them "deprecated" and point at a generic plugin URL and a `git pull` in the skills folder; neither
|
|
1673
|
+
// is how UDS installs or updates skills (`uds update --apply --skills` is).
|
|
1674
|
+
console.log(chalk.gray(` ${msg.skillsUpdateCommand}`));
|
|
1690
1675
|
}
|
|
1691
1676
|
}
|
|
1692
1677
|
}
|
|
@@ -2974,6 +2959,9 @@ async function updateSkillsOnly(projectPath, manifest, options) {
|
|
|
2974
2959
|
finishStepBackup(projectPath, skillsBackup);
|
|
2975
2960
|
|
|
2976
2961
|
console.log();
|
|
2962
|
+
// XSPEC-465 R1: a personal skill with the same name as one of the UDS skills just written wins silently.
|
|
2963
|
+
// Information only: it does not change what was installed or the exit code.
|
|
2964
|
+
printSkillNameCollisionWarning(projectPath);
|
|
2977
2965
|
process.exit(0);
|
|
2978
2966
|
}
|
|
2979
2967
|
|
|
@@ -3618,10 +3606,10 @@ async function handleRollback(projectPath) {
|
|
|
3618
3606
|
/**
|
|
3619
3607
|
* Handle --plan: show what the reconciler would do without executing.
|
|
3620
3608
|
*/
|
|
3621
|
-
async function handlePlan(projectPath, options, manifest) {
|
|
3609
|
+
async function handlePlan(projectPath, options, manifest, addStandards = []) {
|
|
3622
3610
|
const spinner = createSpinner('Calculating reconciliation plan...').start();
|
|
3623
3611
|
|
|
3624
|
-
const result = await reconcilerPlan(projectPath, { force: false });
|
|
3612
|
+
const result = await reconcilerPlan(projectPath, { force: false, addStandards });
|
|
3625
3613
|
|
|
3626
3614
|
spinner.stop();
|
|
3627
3615
|
|
|
@@ -3649,10 +3637,17 @@ async function handlePlan(projectPath, options, manifest) {
|
|
|
3649
3637
|
// the plan above were silently skipped; the files were still on disk
|
|
3650
3638
|
// afterwards. Nor is `--force` the answer for "apply what I just read": it
|
|
3651
3639
|
// recomputes with force:true, a larger plan that rewrites every managed file.
|
|
3652
|
-
|
|
3640
|
+
// A plan made with --add-standard is only applied exactly by an --apply that names the same standards.
|
|
3641
|
+
const addFlags = addStandards.map(id => ` --add-standard ${id}`).join('');
|
|
3642
|
+
console.log(chalk.gray(`Run \`uds update --apply${addFlags}\` to apply exactly these changes.`));
|
|
3653
3643
|
console.log(chalk.gray('Run `uds update --force` to rewrite every managed file (a larger plan than the one above).'));
|
|
3654
3644
|
console.log();
|
|
3655
3645
|
}
|
|
3646
|
+
|
|
3647
|
+
// XSPEC-458 R2: what UDS ships that this project does not have. Information only — it is printed after
|
|
3648
|
+
// the plan is final and nothing above reads it.
|
|
3649
|
+
printAvailableStandardsSection(result.manifest || manifest, { phase: 'plan' });
|
|
3650
|
+
console.log();
|
|
3656
3651
|
}
|
|
3657
3652
|
|
|
3658
3653
|
/**
|
|
@@ -3666,7 +3661,7 @@ async function handlePlan(projectPath, options, manifest) {
|
|
|
3666
3661
|
* @param {Object} options - Command options (uses `yes`)
|
|
3667
3662
|
* @param {{ force: boolean }} mode
|
|
3668
3663
|
*/
|
|
3669
|
-
async function handleReconcile(projectPath, options, { force }) {
|
|
3664
|
+
async function handleReconcile(projectPath, options, { force, addStandards = [] }) {
|
|
3670
3665
|
console.log(chalk.cyan(
|
|
3671
3666
|
force
|
|
3672
3667
|
? 'Running declarative state reconciliation (force mode)...'
|
|
@@ -3675,7 +3670,7 @@ async function handleReconcile(projectPath, options, { force }) {
|
|
|
3675
3670
|
console.log();
|
|
3676
3671
|
|
|
3677
3672
|
// First show the plan
|
|
3678
|
-
const planResult = await reconcilerPlan(projectPath, { force });
|
|
3673
|
+
const planResult = await reconcilerPlan(projectPath, { force, addStandards });
|
|
3679
3674
|
|
|
3680
3675
|
if (planResult.plan.actions.length === 0) {
|
|
3681
3676
|
// XSPEC-454 R2: nothing to apply, but the manifest may still list skill files UDS never installed
|
|
@@ -3683,6 +3678,8 @@ async function handleReconcile(projectPath, options, { force }) {
|
|
|
3683
3678
|
const current = readManifest(projectPath);
|
|
3684
3679
|
if (current && (pruneForeignSkillHashes(current).length + pruneForeignCommandHashes(current).length) > 0) writeManifest(current, projectPath);
|
|
3685
3680
|
console.log(chalk.green('Everything is up to date. No changes needed.'));
|
|
3681
|
+
// XSPEC-458 R2: "up to date" is about the files UDS manages; say what UDS ships that is not managed here.
|
|
3682
|
+
printAvailableStandardsSection(planResult.manifest, { phase: 'apply' });
|
|
3686
3683
|
console.log();
|
|
3687
3684
|
return;
|
|
3688
3685
|
}
|
|
@@ -3709,6 +3706,7 @@ async function handleReconcile(projectPath, options, { force }) {
|
|
|
3709
3706
|
const result = await reconcile(projectPath, {
|
|
3710
3707
|
force,
|
|
3711
3708
|
backup: true,
|
|
3709
|
+
addStandards,
|
|
3712
3710
|
onAction: (action, index, total) => {
|
|
3713
3711
|
spinner.text = `[${index + 1}/${total}] ${action.type} ${action.path || action.category}`;
|
|
3714
3712
|
}
|
|
@@ -3732,5 +3730,7 @@ async function handleReconcile(projectPath, options, { force }) {
|
|
|
3732
3730
|
}
|
|
3733
3731
|
}
|
|
3734
3732
|
|
|
3733
|
+
// XSPEC-458 R2: the count of what UDS ships and this project lacks, with the command that installs one.
|
|
3734
|
+
printAvailableStandardsSection(result.manifest || planResult.manifest, { phase: 'apply' });
|
|
3735
3735
|
console.log();
|
|
3736
3736
|
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What an adopting project declares for `uds open-work`, read from the `open_work` section of
|
|
3
|
+
* uds.project.yaml (dev-platform XSPEC-460 R4 and XSPEC-461 R2: one namespace for both).
|
|
4
|
+
*
|
|
5
|
+
* version: "1"
|
|
6
|
+
* open_work:
|
|
7
|
+
* projects: # logical project name -> where it lives on THIS machine
|
|
8
|
+
* uds: ../universal-dev-standards
|
|
9
|
+
* vibeops: ../vibeops
|
|
10
|
+
* next_action_words: # extra words that mean "next action" in this project's carriers
|
|
11
|
+
* - 待辦
|
|
12
|
+
* command_words: # extra program names read as a command in a next action or a draft
|
|
13
|
+
* - kubectl
|
|
14
|
+
*
|
|
15
|
+
* This file holds no rule. It turns the section into the same `--root NAME=DIR` and
|
|
16
|
+
* `--next-action-word WORD` arguments a person could type, and hands them to the checker, which
|
|
17
|
+
* is self-contained (node builtins only) and therefore cannot read YAML itself. The repository
|
|
18
|
+
* shim `node scripts/check-open-work-tracking.mjs` does not read uds.project.yaml: it takes the
|
|
19
|
+
* flags only.
|
|
20
|
+
*
|
|
21
|
+
* Directories are resolved against the directory holding uds.project.yaml. A relative path keeps
|
|
22
|
+
* the committed file free of a user name and valid on every machine that lays the projects out
|
|
23
|
+
* the same way; an absolute path works but is the machine-specific thing OWT-027 keeps out of a
|
|
24
|
+
* carrier, so it belongs in a file that is not committed.
|
|
25
|
+
*
|
|
26
|
+
* @module core/open-work-config
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
import { resolve, isAbsolute } from 'path';
|
|
30
|
+
import { loadProjectConfig, CONFIG_FILENAME } from './project-config.js';
|
|
31
|
+
import { PROJECT_NAME } from '../utils/open-work-tracking.mjs';
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @returns {{projects: Object<string,string>, nextActionWords: string[], note: string|null, error: string|null}}
|
|
35
|
+
* `note`: the file exists but could not be read at all (nothing was applied; the command goes on).
|
|
36
|
+
* `error`: the file is readable and its open_work section is wrong (the command stops with exit 2).
|
|
37
|
+
*/
|
|
38
|
+
export function readOpenWorkDeclarations(cwd = process.cwd()) {
|
|
39
|
+
const out = { projects: {}, nextActionWords: [], commandWords: [], note: null, error: null };
|
|
40
|
+
let config;
|
|
41
|
+
try {
|
|
42
|
+
config = loadProjectConfig(cwd);
|
|
43
|
+
} catch (e) {
|
|
44
|
+
out.note = `${CONFIG_FILENAME} could not be read (${String(e.message).split('\n')[0]}); the open_work declarations in it were not applied`;
|
|
45
|
+
return out;
|
|
46
|
+
}
|
|
47
|
+
const section = config ? config.open_work : undefined;
|
|
48
|
+
if (section === undefined) return out;
|
|
49
|
+
const bad = (why) => { out.error = `${CONFIG_FILENAME}: open_work ${why}`; return out; };
|
|
50
|
+
if (typeof section !== 'object' || Array.isArray(section)) return bad('must be a mapping with projects and next_action_words');
|
|
51
|
+
|
|
52
|
+
if (section.projects !== undefined && section.projects !== null) {
|
|
53
|
+
if (typeof section.projects !== 'object' || Array.isArray(section.projects)) return bad('.projects must be a mapping of project name to directory');
|
|
54
|
+
for (const [name, dir] of Object.entries(section.projects)) {
|
|
55
|
+
if (!PROJECT_NAME.test(name)) return bad(`.projects: "${name}" is not a logical project name (lower-case letters, digits, "-" and "_", starting with a letter, 2 to 32 characters)`);
|
|
56
|
+
if (typeof dir !== 'string' || dir.trim() === '') return bad(`.projects.${name} must be a directory, written as text`);
|
|
57
|
+
out.projects[name] = isAbsolute(dir) ? dir : resolve(cwd, dir);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (section.next_action_words !== undefined && section.next_action_words !== null) {
|
|
61
|
+
if (!Array.isArray(section.next_action_words)) return bad('.next_action_words must be a list of words');
|
|
62
|
+
for (const w of section.next_action_words) {
|
|
63
|
+
if (typeof w !== 'string') return bad('.next_action_words must hold text only; write each word as plain text');
|
|
64
|
+
out.nextActionWords.push(w);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (section.command_words !== undefined && section.command_words !== null) {
|
|
68
|
+
if (!Array.isArray(section.command_words)) return bad('.command_words must be a list of program names');
|
|
69
|
+
for (const w of section.command_words) {
|
|
70
|
+
if (typeof w !== 'string') return bad('.command_words must hold text only; write each program name as plain text');
|
|
71
|
+
out.commandWords.push(w);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return out;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The `--root` arguments for `uds open-work waiting`: what was typed (a plain DIR, and NAME=DIR for other
|
|
79
|
+
* projects), then every project the file declares that was not already named on the command line (the command
|
|
80
|
+
* line wins for a name given in both).
|
|
81
|
+
*/
|
|
82
|
+
export function rootArguments(cliRoots, declaredProjects = {}) {
|
|
83
|
+
const given = [].concat(cliRoots ?? []);
|
|
84
|
+
const named = new Set(given.map((v) => /^([^\s/\\=]+)=/.exec(String(v))?.[1]).filter(Boolean));
|
|
85
|
+
const argv = [];
|
|
86
|
+
for (const [name, dir] of Object.entries(declaredProjects)) if (!named.has(name)) argv.push('--root', `${name}=${dir}`);
|
|
87
|
+
for (const v of given) argv.push('--root', v);
|
|
88
|
+
return argv;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** The `--command-word` arguments, merged the same way. */
|
|
92
|
+
export function commandArguments(cliWords, declaredWords = []) {
|
|
93
|
+
const argv = [];
|
|
94
|
+
for (const w of [].concat(cliWords ?? [], declaredWords)) argv.push('--command-word', w);
|
|
95
|
+
return argv;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** The `--next-action-word` arguments: the command line's words, then the file's. Merged, never either-or. */
|
|
99
|
+
export function wordArguments(cliWords, declaredWords = []) {
|
|
100
|
+
const argv = [];
|
|
101
|
+
for (const w of [].concat(cliWords ?? [], declaredWords)) argv.push('--next-action-word', w);
|
|
102
|
+
return argv;
|
|
103
|
+
}
|
package/src/flows/init-flow.js
CHANGED
|
@@ -139,6 +139,16 @@ export async function runInitFlow(options, detected, projectPath) {
|
|
|
139
139
|
|
|
140
140
|
const installations = await promptSkillsInstallLocation(aiTools);
|
|
141
141
|
|
|
142
|
+
// XSPEC-468 R1: the project way is pre-selected, so an empty answer was a deliberate "no". Say what that
|
|
143
|
+
// means (nothing is written to the project) and where the skills can come from instead.
|
|
144
|
+
if (installations.length === 0) {
|
|
145
|
+
console.log();
|
|
146
|
+
console.log(chalk.yellow(msgAfterLang.skillsSkippedTitle));
|
|
147
|
+
for (const line of msgAfterLang.skillsFromPluginLines) {
|
|
148
|
+
console.log(chalk.gray(` ${line}`));
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
142
152
|
if (installations.length > 0) {
|
|
143
153
|
const isMarketplace = installations.some(i => i.level === 'marketplace');
|
|
144
154
|
|
package/src/hitl/manager.js
CHANGED
|
@@ -40,8 +40,10 @@ export class HitlManager {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
async _promptUser(operation, riskLevel, context) {
|
|
43
|
-
// Check if we are in non-interactive mode
|
|
44
|
-
|
|
43
|
+
// Check if we are in non-interactive mode: CI, a declared non-interactive run, or no terminal to answer on.
|
|
44
|
+
// A prompt with no terminal never gets an answer; @inquirer/prompts then lets the process end with exit code 0 and a
|
|
45
|
+
// stack trace, which `uds hitl check` callers read as "approved". No one to ask means blocked, as in CI.
|
|
46
|
+
if (process.env.CI || process.env.UDS_NON_INTERACTIVE || !process.stdin.isTTY) {
|
|
45
47
|
console.log(chalk.yellow(''));
|
|
46
48
|
console.log(chalk.yellow('HITL Checkpoint triggered in non-interactive mode.'));
|
|
47
49
|
console.log(chalk.gray(` Operation: ${operation}`));
|