universal-dev-standards 6.14.0-beta.12 → 6.14.0-beta.13
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/bin/uds.js +8 -1
- package/bundled/hooks/validate-commit-msg.mjs +52 -9
- package/bundled/locales/zh-CN/CHANGELOG.md +3 -3
- package/bundled/locales/zh-CN/README.md +1 -1
- package/bundled/locales/zh-CN/SECURITY.md +1 -1
- package/bundled/locales/zh-CN/docs/CHEATSHEET.md +1 -1
- package/bundled/locales/zh-CN/docs/FEATURE-REFERENCE.md +3 -2
- package/bundled/locales/zh-TW/CHANGELOG.md +3 -3
- package/bundled/locales/zh-TW/README.md +1 -1
- package/bundled/locales/zh-TW/SECURITY.md +1 -1
- package/bundled/locales/zh-TW/docs/CHEATSHEET.md +1 -1
- package/bundled/locales/zh-TW/docs/FEATURE-REFERENCE.md +3 -2
- package/package.json +1 -1
- package/src/commands/audit.js +28 -1
- package/src/commands/check.js +72 -3
- package/src/commands/compile.js +37 -4
- package/src/commands/config.js +28 -19
- package/src/commands/init.js +59 -28
- package/src/commands/release-messages.js +228 -0
- package/src/commands/release.js +72 -72
- package/src/commands/update.js +112 -13
- package/src/compilers/claude-code-compiler.js +9 -1
- package/src/i18n/messages.js +84 -0
- package/src/installers/hooks-installer.js +1 -1
- package/src/mcp/server.js +9 -3
- package/src/prompts/init.js +17 -17
- package/src/reconciler/plan-executor.js +34 -4
- package/src/reconciler/recorded-versions.js +18 -0
- package/src/uninstallers/hook-uninstaller.js +9 -1
- package/src/uninstallers/skills-uninstaller.js +10 -3
- package/src/utils/build-manifest.js +1 -1
- package/src/utils/git-hooks.js +106 -4
- package/src/utils/integration-generator.js +75 -49
- package/src/utils/legacy-hook-migration.js +121 -2
- package/src/utils/spinner.js +14 -4
- package/standards-registry.json +7 -7
|
@@ -2472,11 +2472,17 @@ export function generateIndexDisclosure(format, language = 'en') {
|
|
|
2472
2472
|
'follow its contents. Working from this block alone means working without the',
|
|
2473
2473
|
'standards.'
|
|
2474
2474
|
]
|
|
2475
|
-
:
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2475
|
+
: language === 'zh-cn'
|
|
2476
|
+
? [
|
|
2477
|
+
'**这个区块是索引,不是标准本文。** 规则并未复制于此。',
|
|
2478
|
+
'在依照下方任何一项行动之前,请打开 `.standards/` 底下对应的文件并遵守其内容。',
|
|
2479
|
+
'只凭这个区块工作,等同于没有采用标准。'
|
|
2480
|
+
]
|
|
2481
|
+
: [
|
|
2482
|
+
'**這個區塊是索引,不是標準本文。** 規則並未複製於此。',
|
|
2483
|
+
'在依照下方任何一項行動之前,請打開 `.standards/` 底下對應的檔案並遵守其內容。',
|
|
2484
|
+
'只憑這個區塊工作,等同於沒有採用標準。'
|
|
2485
|
+
];
|
|
2480
2486
|
|
|
2481
2487
|
if (format === 'markdown') {
|
|
2482
2488
|
return lines.map((l) => `> ${l}`).join('\n');
|
|
@@ -2486,6 +2492,22 @@ export function generateIndexDisclosure(format, language = 'en') {
|
|
|
2486
2492
|
return lines.map((l) => l.replace(/\*\*/g, '').replace(/`/g, '')).join('\n');
|
|
2487
2493
|
}
|
|
2488
2494
|
|
|
2495
|
+
/**
|
|
2496
|
+
* Pick the text for a content language: English, Traditional Chinese (also used for 'bilingual', whose second language
|
|
2497
|
+
* is Traditional unless the display language is Simplified), or Simplified Chinese for 'zh-cn'.
|
|
2498
|
+
* XSPEC-482 R13: these functions chose between English and Traditional only, so a Simplified Chinese project got
|
|
2499
|
+
* Traditional sentences in the block `uds init` wrote.
|
|
2500
|
+
* @param {string} language
|
|
2501
|
+
* @param {string} en
|
|
2502
|
+
* @param {string} zhTw
|
|
2503
|
+
* @param {string} zhCn
|
|
2504
|
+
* @returns {string}
|
|
2505
|
+
*/
|
|
2506
|
+
function byLanguage(language, en, zhTw, zhCn) {
|
|
2507
|
+
if (language === 'en') return en;
|
|
2508
|
+
return language === 'zh-cn' ? zhCn : zhTw;
|
|
2509
|
+
}
|
|
2510
|
+
|
|
2489
2511
|
/**
|
|
2490
2512
|
* Generate minimal standards reference for minimal content mode
|
|
2491
2513
|
* @param {string[]} installedStandards - List of installed standard file paths
|
|
@@ -2537,17 +2559,16 @@ export function generateMinimalStandardsReference(
|
|
|
2537
2559
|
const sections = [];
|
|
2538
2560
|
|
|
2539
2561
|
if (format === 'markdown') {
|
|
2540
|
-
sections.push(language
|
|
2541
|
-
? '## Standards Reference'
|
|
2542
|
-
: '## 規範文件參考');
|
|
2562
|
+
sections.push(byLanguage(language, '## Standards Reference', '## 規範文件參考', '## 规范文档参考'));
|
|
2543
2563
|
sections.push('');
|
|
2544
|
-
sections.push(language
|
|
2545
|
-
|
|
2546
|
-
|
|
2564
|
+
sections.push(byLanguage(language,
|
|
2565
|
+
'**IMPORTANT**: When performing related tasks, you MUST read and follow the standards in `.standards/`:',
|
|
2566
|
+
'**重要**:執行相關任務時,務必讀取並遵循 `.standards/` 目錄下的對應規範:',
|
|
2567
|
+
'**重要**:执行相关任务时,务必读取并遵循 `.standards/` 目录下的对应规范:'));
|
|
2547
2568
|
sections.push('');
|
|
2548
2569
|
|
|
2549
2570
|
if (coreStandards.length > 0) {
|
|
2550
|
-
sections.push(language
|
|
2571
|
+
sections.push(byLanguage(language, '**Core Standards:**', '**核心規範:**', '**核心规范:**'));
|
|
2551
2572
|
for (const std of coreStandards) {
|
|
2552
2573
|
sections.push(`- \`.standards/${std.filename}\``);
|
|
2553
2574
|
}
|
|
@@ -2555,7 +2576,7 @@ export function generateMinimalStandardsReference(
|
|
|
2555
2576
|
}
|
|
2556
2577
|
|
|
2557
2578
|
if (optionStandards.length > 0) {
|
|
2558
|
-
sections.push(language
|
|
2579
|
+
sections.push(byLanguage(language, '**Options:**', '**選項:**', '**选项:**'));
|
|
2559
2580
|
for (const std of optionStandards) {
|
|
2560
2581
|
sections.push(`- \`.standards/options/${std.filename}\``);
|
|
2561
2582
|
}
|
|
@@ -2565,20 +2586,20 @@ export function generateMinimalStandardsReference(
|
|
|
2565
2586
|
// Said out loud rather than dropped quietly. A shorter list and a complete
|
|
2566
2587
|
// one read the same, and only the manifest knows which this is.
|
|
2567
2588
|
if (unresolved.length > 0) {
|
|
2568
|
-
sections.push(language
|
|
2569
|
-
|
|
2570
|
-
|
|
2589
|
+
sections.push(byLanguage(language,
|
|
2590
|
+
`> ${unresolved.length} manifest entr${unresolved.length === 1 ? 'y' : 'ies'} could not be matched to an installed file and ${unresolved.length === 1 ? 'is' : 'are'} not listed above: ${unresolved.join(', ')}. Run \`uds update\` — if that does not clear it, the manifest and the registry disagree.`,
|
|
2591
|
+
`> 有 ${unresolved.length} 筆 manifest 項目對不到已安裝的檔案,未列於上方:${unresolved.join('、')}。請執行 \`uds update\`;若仍未消失,代表 manifest 與 registry 不一致。`,
|
|
2592
|
+
`> 有 ${unresolved.length} 笔 manifest 项目对不到已安装的文件,未列于上方:${unresolved.join('、')}。请执行 \`uds update\`;若仍未消失,代表 manifest 与 registry 不一致。`));
|
|
2571
2593
|
sections.push('');
|
|
2572
2594
|
}
|
|
2573
2595
|
} else {
|
|
2574
2596
|
// Plaintext format
|
|
2575
|
-
sections.push(language
|
|
2576
|
-
? '## Standards Reference'
|
|
2577
|
-
: '## 規範文件參考');
|
|
2597
|
+
sections.push(byLanguage(language, '## Standards Reference', '## 規範文件參考', '## 规范文档参考'));
|
|
2578
2598
|
sections.push('');
|
|
2579
|
-
sections.push(language
|
|
2580
|
-
|
|
2581
|
-
|
|
2599
|
+
sections.push(byLanguage(language,
|
|
2600
|
+
'IMPORTANT: When performing related tasks, read and follow the standards in .standards/:',
|
|
2601
|
+
'重要:執行相關任務時,務必讀取並遵循 .standards/ 目錄下的對應規範:',
|
|
2602
|
+
'重要:执行相关任务时,务必读取并遵循 .standards/ 目录下的对应规范:'));
|
|
2582
2603
|
sections.push('');
|
|
2583
2604
|
|
|
2584
2605
|
for (const std of coreStandards) {
|
|
@@ -2587,7 +2608,7 @@ export function generateMinimalStandardsReference(
|
|
|
2587
2608
|
|
|
2588
2609
|
if (optionStandards.length > 0) {
|
|
2589
2610
|
sections.push('');
|
|
2590
|
-
sections.push(language
|
|
2611
|
+
sections.push(byLanguage(language, 'Options:', '選項:', '选项:'));
|
|
2591
2612
|
for (const std of optionStandards) {
|
|
2592
2613
|
sections.push(`- .standards/options/${std.filename}`);
|
|
2593
2614
|
}
|
|
@@ -2595,9 +2616,10 @@ export function generateMinimalStandardsReference(
|
|
|
2595
2616
|
|
|
2596
2617
|
if (unresolved.length > 0) {
|
|
2597
2618
|
sections.push('');
|
|
2598
|
-
sections.push(language
|
|
2599
|
-
|
|
2600
|
-
|
|
2619
|
+
sections.push(byLanguage(language,
|
|
2620
|
+
`NOTE: ${unresolved.length} manifest entries could not be matched to an installed file and are not listed: ${unresolved.join(', ')}`,
|
|
2621
|
+
`注意:有 ${unresolved.length} 筆 manifest 項目對不到已安裝的檔案,未列出:${unresolved.join('、')}`,
|
|
2622
|
+
`注意:有 ${unresolved.length} 笔 manifest 项目对不到已安装的文件,未列出:${unresolved.join('、')}`));
|
|
2601
2623
|
}
|
|
2602
2624
|
sections.push('');
|
|
2603
2625
|
}
|
|
@@ -3045,7 +3067,10 @@ export function generateIntegrationContent(config) {
|
|
|
3045
3067
|
|
|
3046
3068
|
// Include commit message language directive inside markers so it updates with marker-based updates
|
|
3047
3069
|
if (outputLanguage) {
|
|
3048
|
-
|
|
3070
|
+
// A Simplified Chinese project that chose bilingual commits gets the Simplified directive, as the commit-standards
|
|
3071
|
+
// section above already does; the Traditional one named "English + 繁體中文" for a project that asked for 简体中文 (XSPEC-482 R13).
|
|
3072
|
+
const directiveLanguage = (outputLanguage === 'bilingual' && language === 'zh-cn') ? 'bilingual-zhcn' : outputLanguage;
|
|
3073
|
+
const commitLangSection = generateOutputLanguageDirective(directiveLanguage, language);
|
|
3049
3074
|
if (commitLangSection) {
|
|
3050
3075
|
standardsContent += commitLangSection + '\n\n';
|
|
3051
3076
|
}
|
|
@@ -3332,9 +3357,7 @@ export function generateComplianceInstructions(
|
|
|
3332
3357
|
sections.push('');
|
|
3333
3358
|
|
|
3334
3359
|
if (mustFollow.length > 0) {
|
|
3335
|
-
sections.push(language
|
|
3336
|
-
? '**MUST follow** (always required):'
|
|
3337
|
-
: '**MUST follow** (每次都要遵守):');
|
|
3360
|
+
sections.push(byLanguage(language, '**MUST follow** (always required):', '**MUST follow** (每次都要遵守):', '**MUST follow** (每次都要遵守):'));
|
|
3338
3361
|
sections.push('| Task | Standard | When |');
|
|
3339
3362
|
sections.push('|------|----------|------|');
|
|
3340
3363
|
for (const entry of mustFollow) {
|
|
@@ -3344,9 +3367,7 @@ export function generateComplianceInstructions(
|
|
|
3344
3367
|
}
|
|
3345
3368
|
|
|
3346
3369
|
if (shouldFollow.length > 0) {
|
|
3347
|
-
sections.push(language
|
|
3348
|
-
? '**SHOULD follow** (when relevant):'
|
|
3349
|
-
: '**SHOULD follow** (相關任務時參考):');
|
|
3370
|
+
sections.push(byLanguage(language, '**SHOULD follow** (when relevant):', '**SHOULD follow** (相關任務時參考):', '**SHOULD follow** (相关任务时参考):'));
|
|
3350
3371
|
sections.push('| Task | Standard | When |');
|
|
3351
3372
|
sections.push('|------|----------|------|');
|
|
3352
3373
|
for (const entry of shouldFollow) {
|
|
@@ -3363,9 +3384,7 @@ export function generateComplianceInstructions(
|
|
|
3363
3384
|
sections.push('');
|
|
3364
3385
|
|
|
3365
3386
|
if (mustFollow.length > 0) {
|
|
3366
|
-
sections.push(language
|
|
3367
|
-
? 'MUST follow (always required):'
|
|
3368
|
-
: 'MUST follow (每次都要遵守):');
|
|
3387
|
+
sections.push(byLanguage(language, 'MUST follow (always required):', 'MUST follow (每次都要遵守):', 'MUST follow (每次都要遵守):'));
|
|
3369
3388
|
for (const entry of mustFollow) {
|
|
3370
3389
|
sections.push(`- ${entry.task}: Read ${entry.standard} ${entry.when.toLowerCase()}`);
|
|
3371
3390
|
}
|
|
@@ -3373,9 +3392,7 @@ export function generateComplianceInstructions(
|
|
|
3373
3392
|
}
|
|
3374
3393
|
|
|
3375
3394
|
if (shouldFollow.length > 0) {
|
|
3376
|
-
sections.push(language
|
|
3377
|
-
? 'SHOULD follow (when relevant):'
|
|
3378
|
-
: 'SHOULD follow (相關任務時參考):');
|
|
3395
|
+
sections.push(byLanguage(language, 'SHOULD follow (when relevant):', 'SHOULD follow (相關任務時參考):', 'SHOULD follow (相关任务时参考):'));
|
|
3379
3396
|
for (const entry of shouldFollow) {
|
|
3380
3397
|
sections.push(`- ${entry.task}: Reference ${entry.standard}`);
|
|
3381
3398
|
}
|
|
@@ -3429,14 +3446,23 @@ export function generateStandardsIndex(installedStandards, format, language = 'z
|
|
|
3429
3446
|
? ['', `${unresolved.length} further manifest entr${unresolved.length === 1 ? 'y has' : 'ies have'} no installed file and ${unresolved.length === 1 ? 'is' : 'are'} not counted above: ${unresolved.join(', ')}. Standards removed upstream stay in a manifest until someone drops them; \`uds update\` does not prune them.`]
|
|
3430
3447
|
: [])
|
|
3431
3448
|
]
|
|
3432
|
-
:
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3449
|
+
: language === 'zh-cn'
|
|
3450
|
+
? [
|
|
3451
|
+
`本项目采用 UDS 标准共 **${total}** 条(core ${coreCount}、options ${optionCount}),安装于 \`.standards/\`。`,
|
|
3452
|
+
'',
|
|
3453
|
+
'权威清单为 `.standards/manifest.json` 的 `standards` 字段。要知道某标准要求什么,读它自己的文件——并看第一行,已弃用的标准会在那里写明。',
|
|
3454
|
+
...(unresolved.length > 0
|
|
3455
|
+
? ['', `另有 ${unresolved.length} 笔 manifest 项目没有已安装的文件,未计入上方数字:${unresolved.join('、')}。上游移除的标准会留在 manifest 里直到有人拿掉它;\`uds update\` 不会修剪它们。`]
|
|
3456
|
+
: [])
|
|
3457
|
+
]
|
|
3458
|
+
: [
|
|
3459
|
+
`本專案採用 UDS 標準共 **${total}** 條(core ${coreCount}、options ${optionCount}),安裝於 \`.standards/\`。`,
|
|
3460
|
+
'',
|
|
3461
|
+
'權威清單為 `.standards/manifest.json` 的 `standards` 欄位。要知道某標準要求什麼,讀它自己的檔案——並看第一行,已棄用的標準會在那裡寫明。',
|
|
3462
|
+
...(unresolved.length > 0
|
|
3463
|
+
? ['', `另有 ${unresolved.length} 筆 manifest 項目沒有已安裝的檔案,未計入上方數字:${unresolved.join('、')}。上游移除的標準會留在 manifest 裡直到有人拿掉它;\`uds update\` 不會修剪它們。`]
|
|
3464
|
+
: [])
|
|
3465
|
+
];
|
|
3440
3466
|
|
|
3441
3467
|
const plainBody = body.map((l) => l.replace(/`/g, ''));
|
|
3442
3468
|
return [heading, '', ...(md ? body : plainBody), ''].join('\n');
|
|
@@ -3492,7 +3518,7 @@ function withSelectedOptions(manifest) {
|
|
|
3492
3518
|
* Both call sites now use this function instead of re-deriving the value.
|
|
3493
3519
|
*
|
|
3494
3520
|
* @param {Object} manifest - Project manifest
|
|
3495
|
-
* @returns {'en'|'zh-tw'|'bilingual'} Resolved content language
|
|
3521
|
+
* @returns {'en'|'zh-tw'|'zh-cn'|'bilingual'} Resolved content language
|
|
3496
3522
|
*/
|
|
3497
3523
|
export function resolveIntegrationLanguage(manifest) {
|
|
3498
3524
|
const selected = manifest.options?.output_language || manifest.options?.commit_language || 'english';
|
|
@@ -3500,7 +3526,7 @@ export function resolveIntegrationLanguage(manifest) {
|
|
|
3500
3526
|
const fromOutput = selected === 'bilingual'
|
|
3501
3527
|
? 'bilingual'
|
|
3502
3528
|
: selected === 'traditional-chinese' ? 'zh-tw' : 'en';
|
|
3503
|
-
return ['en', 'zh-tw', 'bilingual'].includes(display) ? display : fromOutput;
|
|
3529
|
+
return ['en', 'zh-tw', 'zh-cn', 'bilingual'].includes(display) ? display : fromOutput; // wire:integration-language-zh-cn
|
|
3504
3530
|
}
|
|
3505
3531
|
|
|
3506
3532
|
export function buildToolIntegrationConfig(manifest, tool) {
|
|
@@ -26,9 +26,12 @@
|
|
|
26
26
|
* @module utils/legacy-hook-migration
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
|
-
import { existsSync, readFileSync, writeFileSync } from 'fs';
|
|
29
|
+
import { existsSync, readFileSync, writeFileSync, chmodSync } from 'fs';
|
|
30
30
|
import { join } from 'path';
|
|
31
|
-
import {
|
|
31
|
+
import {
|
|
32
|
+
buildPreCommitBlock, buildNativePreCommitHook, classifyNativePreCommitHook,
|
|
33
|
+
UDS_HOOK_MARKER, UDS_HOOK_END_MARKER, BARE_UDS_RUNNER_RE, hasBareUdsRunner
|
|
34
|
+
} from './git-hooks.js';
|
|
32
35
|
import { getFileRecord, proveUnchanged, recordFile, newRecorder, RECORD_KINDS } from '../core/install-records.js';
|
|
33
36
|
|
|
34
37
|
/** The exact command lines UDS itself has written under the marker, and the extra arguments each carried. */
|
|
@@ -110,3 +113,119 @@ export function migrateLegacyHuskyHook(projectPath, { plan = false, manifest = n
|
|
|
110
113
|
}
|
|
111
114
|
return { state: 'migrated', replaced, kept, recorder };
|
|
112
115
|
}
|
|
116
|
+
|
|
117
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
118
|
+
// XSPEC-482 R3 + R5: pre-commit hooks that look like a check and cannot stop a commit.
|
|
119
|
+
//
|
|
120
|
+
// Two shapes are on disk in projects UDS set up earlier, and both let every commit through:
|
|
121
|
+
// - `.git/hooks/pre-commit` of 5.x .. 6.13.1: `uds check 2>/dev/null || true` (the CLI PATH happens to
|
|
122
|
+
// hold, errors thrown away, "Pre-commit checks passed" printed whatever happened);
|
|
123
|
+
// - the hook of 6.14.0-beta.2 .. beta.12 (native file, or the block inside `.husky/pre-commit`): it runs
|
|
124
|
+
// the installed CLI, but `check` without `--ci` exits 0 when a standard file was edited.
|
|
125
|
+
// `uds init` now writes `check --ci`. These functions bring the files already on disk to it.
|
|
126
|
+
//
|
|
127
|
+
// What counts as "UDS wrote this": the whole file equals one of the known texts (native hook), or the
|
|
128
|
+
// block between UDS's two marker lines equals the known block (husky). Exact equality, not a pattern: a
|
|
129
|
+
// hook someone edited is NOT replaced - it is reported with the line number and what to write instead.
|
|
130
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
/** A hook line that runs a UDS check and is built never to fail: `... check ... || true`. */
|
|
134
|
+
const ALWAYS_PASS_CHECK_RE = /\b(?:uds|universal-dev-standards)\s+check\b[^\n]*\|\|\s*true\b/;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Bring the native `.git/hooks/pre-commit` of an older UDS to the one this CLI writes.
|
|
138
|
+
*
|
|
139
|
+
* @param {string} projectPath
|
|
140
|
+
* @param {{plan?: boolean}} [opts] plan - report what would change, write nothing
|
|
141
|
+
* @returns {{
|
|
142
|
+
* file: '.git/hooks/pre-commit',
|
|
143
|
+
* state: 'none'|'migrated'|'would-migrate'|'kept'|'error',
|
|
144
|
+
* from?: 'legacy-6.11'|'without-ci',
|
|
145
|
+
* kept: Array<{line: number, text: string}>, // lines that make the check always pass, in a file UDS cannot prove it wrote
|
|
146
|
+
* recorder: object|null, // install record to fold into the manifest when non-null
|
|
147
|
+
* error?: string
|
|
148
|
+
* }}
|
|
149
|
+
*/
|
|
150
|
+
export function migrateOlderNativeHook(projectPath, { plan = false } = {}) {
|
|
151
|
+
const file = '.git/hooks/pre-commit';
|
|
152
|
+
const abs = join(projectPath, '.git', 'hooks', 'pre-commit');
|
|
153
|
+
const none = { file, state: 'none', kept: [], recorder: null };
|
|
154
|
+
if (!existsSync(abs)) return none;
|
|
155
|
+
|
|
156
|
+
let content;
|
|
157
|
+
try {
|
|
158
|
+
content = readFileSync(abs, 'utf-8');
|
|
159
|
+
} catch (e) {
|
|
160
|
+
return { ...none, state: 'error', error: e.message };
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const known = classifyNativePreCommitHook(content);
|
|
164
|
+
if (known === 'legacy-6.11' || known === 'without-ci') {
|
|
165
|
+
if (plan) return { ...none, state: 'would-migrate', from: known };
|
|
166
|
+
try {
|
|
167
|
+
// Keep the file's own line endings: a hook saved with CRLF stays CRLF (the husky path below does the same).
|
|
168
|
+
const fresh = buildNativePreCommitHook();
|
|
169
|
+
writeFileSync(abs, content.includes('\r\n') ? fresh.replace(/\n/g, '\r\n') : fresh, 'utf-8'); // wire:native-migration-keeps-eol
|
|
170
|
+
// writeFileSync keeps an existing file's mode; make sure git will still run it.
|
|
171
|
+
if (process.platform !== 'win32') chmodSync(abs, 0o755);
|
|
172
|
+
} catch (e) {
|
|
173
|
+
return { ...none, state: 'error', from: known, error: e.message };
|
|
174
|
+
}
|
|
175
|
+
// The whole file is UDS's again: record it, so `uds uninstall` can delete it as provably ours.
|
|
176
|
+
const recorder = newRecorder();
|
|
177
|
+
recordFile(recorder, projectPath, file, RECORD_KINDS.GIT_HOOK);
|
|
178
|
+
return { ...none, state: 'migrated', from: known, recorder };
|
|
179
|
+
}
|
|
180
|
+
if (known === 'current') return none;
|
|
181
|
+
|
|
182
|
+
// Not a text UDS wrote: if it still carries the always-pass check, say where. It is not replaced.
|
|
183
|
+
const kept = [];
|
|
184
|
+
content.split('\n').forEach((raw, i) => {
|
|
185
|
+
const text = raw.replace(/\r$/, '');
|
|
186
|
+
if (ALWAYS_PASS_CHECK_RE.test(text)) kept.push({ line: i + 1, text: text.trim() });
|
|
187
|
+
});
|
|
188
|
+
return kept.length > 0 ? { ...none, state: 'kept', kept } : none;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Bring the block `.husky/pre-commit` carries from beta.2 .. beta.12 (`check` without `--ci`) to the current one.
|
|
193
|
+
* Only the block between UDS's two marker lines, and only when it is exactly the old text; the lines around it
|
|
194
|
+
* are the adopter's and stay as they are.
|
|
195
|
+
*
|
|
196
|
+
* @param {string} projectPath
|
|
197
|
+
* @param {{plan?: boolean, manifest?: object|null}} [opts] manifest - read only to see whether the whole file was provably UDS's
|
|
198
|
+
* @returns {{file: '.husky/pre-commit', state: 'none'|'migrated'|'would-migrate'|'error', recorder: object|null, error?: string}}
|
|
199
|
+
*/
|
|
200
|
+
export function migrateHuskyBlockWithoutCi(projectPath, { plan = false, manifest = null } = {}) {
|
|
201
|
+
const file = '.husky/pre-commit';
|
|
202
|
+
const abs = join(projectPath, '.husky', 'pre-commit');
|
|
203
|
+
const none = { file, state: 'none', recorder: null };
|
|
204
|
+
if (!existsSync(abs)) return none;
|
|
205
|
+
|
|
206
|
+
let content;
|
|
207
|
+
try {
|
|
208
|
+
content = readFileSync(abs, 'utf-8');
|
|
209
|
+
} catch (e) {
|
|
210
|
+
return { ...none, state: 'error', error: e.message };
|
|
211
|
+
}
|
|
212
|
+
const eol = content.includes('\r\n') ? '\r\n' : '\n';
|
|
213
|
+
const text = content.replace(/\r\n/g, '\n');
|
|
214
|
+
const oldBlock = buildPreCommitBlock({ ci: false });
|
|
215
|
+
if (!text.includes(oldBlock) || !text.includes(UDS_HOOK_END_MARKER)) return none;
|
|
216
|
+
if (plan) return { ...none, state: 'would-migrate' };
|
|
217
|
+
|
|
218
|
+
const wasProven = !!manifest && !!getFileRecord(manifest, file) && proveUnchanged(manifest, projectPath, file).state === 'proven';
|
|
219
|
+
try {
|
|
220
|
+
const next = text.replace(oldBlock, buildPreCommitBlock());
|
|
221
|
+
writeFileSync(abs, eol === '\r\n' ? next.replace(/\n/g, '\r\n') : next, 'utf-8');
|
|
222
|
+
} catch (e) {
|
|
223
|
+
return { ...none, state: 'error', error: e.message };
|
|
224
|
+
}
|
|
225
|
+
let recorder = null;
|
|
226
|
+
if (wasProven) {
|
|
227
|
+
recorder = newRecorder();
|
|
228
|
+
recordFile(recorder, projectPath, file, RECORD_KINDS.GIT_HOOK);
|
|
229
|
+
}
|
|
230
|
+
return { ...none, state: 'migrated', recorder };
|
|
231
|
+
}
|
package/src/utils/spinner.js
CHANGED
|
@@ -22,10 +22,20 @@ import ora from 'ora';
|
|
|
22
22
|
* @returns {import('ora').Ora}
|
|
23
23
|
*/
|
|
24
24
|
export function createSpinner(options) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
const base = typeof options === 'string' ? { text: options } : options;
|
|
26
|
+
return ora({ stream: process.stdout, ...base, ...disabledWhenNoWidth(process.stdout) });
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* ora's clear step divides the length of the line by the stream's width to know how many lines to erase. A terminal that
|
|
31
|
+
* reports a width of 0 (a pty opened with no window size, which is what `expect` and some CI runners give a child) makes
|
|
32
|
+
* that Infinity, and the spinner sat in the erase loop at full CPU, so the command never finished (XSPEC-482 R14f).
|
|
33
|
+
* With no usable width there is nothing to animate: the spinner is switched off and prints its plain lines instead.
|
|
34
|
+
* @param {{isTTY?: boolean, columns?: number}} stream
|
|
35
|
+
* @returns {{isEnabled?: boolean}}
|
|
36
|
+
*/
|
|
37
|
+
export function disabledWhenNoWidth(stream) {
|
|
38
|
+
return stream && stream.isTTY && !(stream.columns > 0) ? { isEnabled: false } : {}; // wire:spinner-off-without-width
|
|
29
39
|
}
|
|
30
40
|
|
|
31
41
|
export default createSpinner;
|
package/standards-registry.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"version": "6.14.0-beta.
|
|
3
|
+
"version": "6.14.0-beta.13",
|
|
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.
|
|
61
|
+
"version": "6.14.0-beta.13"
|
|
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.
|
|
68
|
+
"version": "6.14.0-beta.13",
|
|
69
69
|
"note": "Skills are now included in the main repository under skills/"
|
|
70
70
|
}
|
|
71
71
|
},
|
|
@@ -2336,7 +2336,7 @@
|
|
|
2336
2336
|
"id": "license-compliance",
|
|
2337
2337
|
"name": "License Compliance Standards",
|
|
2338
2338
|
"nameZh": "授權合規標準",
|
|
2339
|
-
"version": "6.14.0-beta.
|
|
2339
|
+
"version": "6.14.0-beta.13",
|
|
2340
2340
|
"source": {
|
|
2341
2341
|
"human": "core/license-compliance.md",
|
|
2342
2342
|
"ai": "ai/standards/license-compliance.ai.yaml"
|
|
@@ -2348,7 +2348,7 @@
|
|
|
2348
2348
|
"id": "verification-oracle",
|
|
2349
2349
|
"name": "Verification Oracle Standards",
|
|
2350
2350
|
"nameZh": "驗證 Oracle 標準",
|
|
2351
|
-
"version": "6.14.0-beta.
|
|
2351
|
+
"version": "6.14.0-beta.13",
|
|
2352
2352
|
"source": {
|
|
2353
2353
|
"human": "core/verification-oracle.md",
|
|
2354
2354
|
"ai": "ai/standards/verification-oracle.ai.yaml"
|
|
@@ -2360,7 +2360,7 @@
|
|
|
2360
2360
|
"id": "model-provenance",
|
|
2361
2361
|
"name": "Model Provenance Policy Standards",
|
|
2362
2362
|
"nameZh": "模型來源政策標準",
|
|
2363
|
-
"version": "6.14.0-beta.
|
|
2363
|
+
"version": "6.14.0-beta.13",
|
|
2364
2364
|
"source": {
|
|
2365
2365
|
"human": "core/model-provenance.md",
|
|
2366
2366
|
"ai": "ai/standards/model-provenance.ai.yaml"
|
|
@@ -2372,7 +2372,7 @@
|
|
|
2372
2372
|
"id": "resource-cost-boundary",
|
|
2373
2373
|
"name": "Resource / Cost Boundary Declaration Standards",
|
|
2374
2374
|
"nameZh": "資源/成本邊界宣告標準",
|
|
2375
|
-
"version": "6.14.0-beta.
|
|
2375
|
+
"version": "6.14.0-beta.13",
|
|
2376
2376
|
"source": {
|
|
2377
2377
|
"human": "core/resource-cost-boundary.md",
|
|
2378
2378
|
"ai": "ai/standards/resource-cost-boundary.ai.yaml"
|