@hongmaple0820/scale-engine 0.46.0 → 0.47.0
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/dist/api/cli.js +133 -5
- package/dist/api/cli.js.map +1 -1
- package/dist/api/onboard.d.ts +34 -0
- package/dist/api/onboard.js +192 -0
- package/dist/api/onboard.js.map +1 -0
- package/dist/api/quickstart.js +1 -0
- package/dist/api/quickstart.js.map +1 -1
- package/dist/cli/onboardCommands.d.ts +22 -0
- package/dist/cli/onboardCommands.js +42 -0
- package/dist/cli/onboardCommands.js.map +1 -0
- package/dist/skills/ExternalSkills.js +4 -0
- package/dist/skills/ExternalSkills.js.map +1 -1
- package/dist/skills/SkillInstaller.js +4 -0
- package/dist/skills/SkillInstaller.js.map +1 -1
- package/dist/workflow/GateCatalog.d.ts +2 -1
- package/dist/workflow/GateCatalog.js +6 -2
- package/dist/workflow/GateCatalog.js.map +1 -1
- package/dist/workflow/UpgradeManager.d.ts +25 -0
- package/dist/workflow/UpgradeManager.js +81 -0
- package/dist/workflow/UpgradeManager.js.map +1 -1
- package/dist/workflow/gates/EnhancedGates.js +49 -4
- package/dist/workflow/gates/EnhancedGates.js.map +1 -1
- package/dist/workflow/gates/MetaGovernanceGates.js +42 -5
- package/dist/workflow/gates/MetaGovernanceGates.js.map +1 -1
- package/docs/guides/FAST_COMMIT_GUIDE.md +136 -0
- package/docs/guides/LEARNING_PATH.md +237 -0
- package/docs/guides/UPGRADE_AUTOMATION.md +199 -0
- package/package.json +1 -1
package/dist/api/cli.js
CHANGED
|
@@ -51,6 +51,7 @@ import { gatesCommand } from '../cli/gateStatusCommands.js';
|
|
|
51
51
|
import { scoreCommand } from '../cli/scoreCommands.js';
|
|
52
52
|
import { promptCommand } from '../cli/promptCommands.js';
|
|
53
53
|
import { quickstartCommand } from '../cli/quickstartCommands.js';
|
|
54
|
+
import { onboardCommand } from '../cli/onboardCommands.js';
|
|
54
55
|
import { tuiCommand } from '../cli/tuiCommands.js';
|
|
55
56
|
import { qaCommand } from '../cli/qaCommands.js';
|
|
56
57
|
import { autofixCommand } from '../cli/autofixCommands.js';
|
|
@@ -62,7 +63,7 @@ import { cortexCommand } from '../cli/cortexCommands.js';
|
|
|
62
63
|
import { writeGovernanceTemplates } from '../workflow/GovernanceTemplates.js';
|
|
63
64
|
import { getBootstrapPlanForProfile, getProfile as getConfigProfile, generateConfigForProfile, listProfiles as listConfigProfiles, } from '../config/profiles.js';
|
|
64
65
|
import { computeGovernanceDrift } from '../workflow/GovernanceLock.js';
|
|
65
|
-
import { applyUpgradePlan, createThirdPartyUpdateReport, createUpgradeCheckReport, createUpgradePlanReport, rollbackLatestUpgrade, writeUpgradePlanHtml, } from '../workflow/UpgradeManager.js';
|
|
66
|
+
import { applyUpgradePlan, createThirdPartyUpdateReport, createUpgradeCheckReport, createUpgradePlanReport, createUpgradeRecommendReport, rollbackLatestUpgrade, writeUpgradePlanHtml, } from '../workflow/UpgradeManager.js';
|
|
66
67
|
import { createGovernanceRoiReport } from '../governance/GovernanceRoi.js';
|
|
67
68
|
import { evaluateProgressiveGovernance, normalizeGovernanceMode } from '../governance/ProgressiveGovernance.js';
|
|
68
69
|
import { baselineEngineeringStandards, doctorEngineeringStandards, scanEngineeringStandards, settleEngineeringStandards, } from '../workflow/EngineeringStandards.js';
|
|
@@ -2331,7 +2332,7 @@ const preflight = defineCommand({
|
|
|
2331
2332
|
'test-cmd': { type: 'string', description: 'Override test command' },
|
|
2332
2333
|
'coverage-cmd': { type: 'string', description: 'Override coverage command' },
|
|
2333
2334
|
profile: { type: 'string', description: 'Verification profile from .scale/verification.json' },
|
|
2334
|
-
'preflight-profile': { type: 'string', default: 'quick', description: 'Gate intensity profile (quick/full/ci);
|
|
2335
|
+
'preflight-profile': { type: 'string', default: 'quick', description: 'Gate intensity profile (quick/fast-lane/full/ci); fast-lane for S-level tasks (build+TDD+lint+tests only)' },
|
|
2335
2336
|
service: { type: 'string', description: 'Service name from .scale/verification.json; use all for required services' },
|
|
2336
2337
|
'tdd-evidence': { type: 'string', description: 'Path to JSON TDD evidence with red/green/refactor/testFirst=true' },
|
|
2337
2338
|
'tdd-strict': { type: 'boolean', default: false, description: 'Require TDD evidence before other gates' },
|
|
@@ -2586,7 +2587,7 @@ const status = defineCommand({
|
|
|
2586
2587
|
// init command
|
|
2587
2588
|
// ============================================================================
|
|
2588
2589
|
const init = defineCommand({
|
|
2589
|
-
meta: { name: 'init', description: 'Initialize SCALE Engine governance in current project (
|
|
2590
|
+
meta: { name: 'init', description: 'Initialize SCALE Engine governance in current project (use --with-deps to also install third-party skills, CLIs, memory, and knowledge providers)' },
|
|
2590
2591
|
args: {
|
|
2591
2592
|
agent: { type: 'string', default: '', description: `Agent type (${SUPPORTED_AGENTS.join('/')}) - auto-detected if not specified` },
|
|
2592
2593
|
dir: { type: 'string', default: '.', description: 'Project directory' },
|
|
@@ -2603,6 +2604,7 @@ const init = defineCommand({
|
|
|
2603
2604
|
'coverage-threshold': { type: 'string', default: '80', description: 'Coverage threshold (default 80%)' },
|
|
2604
2605
|
'retry-threshold': { type: 'string', default: '3', description: 'Brute retry threshold (default 3)' },
|
|
2605
2606
|
'block-severity': { type: 'string', default: 'CRITICAL', description: 'Block severity level (CRITICAL/HIGH/MEDIUM)' },
|
|
2607
|
+
'with-deps': { type: 'boolean', default: false, description: 'Also install third-party skills, CLIs, memory, and knowledge providers after governance init' },
|
|
2606
2608
|
},
|
|
2607
2609
|
async run({ args }) {
|
|
2608
2610
|
// Interactive configuration mode
|
|
@@ -2689,6 +2691,22 @@ const init = defineCommand({
|
|
|
2689
2691
|
governancePack: String(args['governance-pack']),
|
|
2690
2692
|
}))
|
|
2691
2693
|
console.log(` → ${step}`);
|
|
2694
|
+
// Auto-install third-party deps if --with-deps
|
|
2695
|
+
if (args['with-deps']) {
|
|
2696
|
+
console.log(`\n🧰 Installing third-party dependencies (full pack)...`);
|
|
2697
|
+
const depReport = await bootstrapDependencies({
|
|
2698
|
+
projectDir: resolve(args.dir),
|
|
2699
|
+
scaleDir: join(resolve(args.dir), '.scale'),
|
|
2700
|
+
packIds: ['full'],
|
|
2701
|
+
includeIds: [],
|
|
2702
|
+
apply: true,
|
|
2703
|
+
});
|
|
2704
|
+
console.log(` ✓ ${depReport.summary.installed}/${depReport.summary.total} dependencies installed`);
|
|
2705
|
+
if (depReport.summary.needsInit > 0)
|
|
2706
|
+
console.log(` ⚠ ${depReport.summary.needsInit} need manual init`);
|
|
2707
|
+
if (depReport.summary.failed > 0)
|
|
2708
|
+
console.log(` ✗ ${depReport.summary.failed} failed`);
|
|
2709
|
+
}
|
|
2692
2710
|
return;
|
|
2693
2711
|
}
|
|
2694
2712
|
// One-click quick start mode
|
|
@@ -2742,6 +2760,22 @@ const init = defineCommand({
|
|
|
2742
2760
|
console.log(`\n📋 Next steps:`);
|
|
2743
2761
|
for (const step of qsResult.nextSteps)
|
|
2744
2762
|
console.log(` → ${step}`);
|
|
2763
|
+
// Auto-install third-party deps if --with-deps
|
|
2764
|
+
if (args['with-deps']) {
|
|
2765
|
+
console.log(`\n🧰 Installing third-party dependencies (full pack)...`);
|
|
2766
|
+
const depReport = await bootstrapDependencies({
|
|
2767
|
+
projectDir: resolve(args.dir),
|
|
2768
|
+
scaleDir: join(resolve(args.dir), '.scale'),
|
|
2769
|
+
packIds: ['full'],
|
|
2770
|
+
includeIds: [],
|
|
2771
|
+
apply: true,
|
|
2772
|
+
});
|
|
2773
|
+
console.log(` ✓ ${depReport.summary.installed}/${depReport.summary.total} dependencies installed`);
|
|
2774
|
+
if (depReport.summary.needsInit > 0)
|
|
2775
|
+
console.log(` ⚠ ${depReport.summary.needsInit} need manual init`);
|
|
2776
|
+
if (depReport.summary.failed > 0)
|
|
2777
|
+
console.log(` ✗ ${depReport.summary.failed} failed`);
|
|
2778
|
+
}
|
|
2745
2779
|
}
|
|
2746
2780
|
else {
|
|
2747
2781
|
console.log(`\n⚠️ No agent platform detected`);
|
|
@@ -2806,6 +2840,22 @@ const init = defineCommand({
|
|
|
2806
2840
|
governancePack: String(args['governance-pack']),
|
|
2807
2841
|
}))
|
|
2808
2842
|
console.log(` → ${step}`);
|
|
2843
|
+
// Auto-install third-party deps if --with-deps
|
|
2844
|
+
if (args['with-deps']) {
|
|
2845
|
+
console.log(`\n🧰 Installing third-party dependencies (full pack)...`);
|
|
2846
|
+
const depReport = await bootstrapDependencies({
|
|
2847
|
+
projectDir: resolve(args.dir),
|
|
2848
|
+
scaleDir: join(resolve(args.dir), '.scale'),
|
|
2849
|
+
packIds: ['full'],
|
|
2850
|
+
includeIds: [],
|
|
2851
|
+
apply: true,
|
|
2852
|
+
});
|
|
2853
|
+
console.log(` ✓ ${depReport.summary.installed}/${depReport.summary.total} dependencies installed`);
|
|
2854
|
+
if (depReport.summary.needsInit > 0)
|
|
2855
|
+
console.log(` ⚠ ${depReport.summary.needsInit} need manual init`);
|
|
2856
|
+
if (depReport.summary.failed > 0)
|
|
2857
|
+
console.log(` ✗ ${depReport.summary.failed} failed`);
|
|
2858
|
+
}
|
|
2809
2859
|
},
|
|
2810
2860
|
});
|
|
2811
2861
|
const bootstrapDepsCommand = defineCommand({
|
|
@@ -3682,11 +3732,79 @@ const upgradePlan = defineCommand({
|
|
|
3682
3732
|
console.log(` HTML: ${htmlPath}`);
|
|
3683
3733
|
},
|
|
3684
3734
|
});
|
|
3735
|
+
const upgradeRecommend = defineCommand({
|
|
3736
|
+
meta: { name: 'recommend', description: '自动分析升级风险并推荐操作 / Auto-analyze upgrade risk and recommend actions' },
|
|
3737
|
+
args: {
|
|
3738
|
+
dir: { type: 'string', default: PROJECT_DIR, description: '项目目录 / Project directory' },
|
|
3739
|
+
'target-version': { type: 'string', description: '目标 SCALE Engine 版本 / Target SCALE Engine version' },
|
|
3740
|
+
'auto-apply': { type: 'boolean', default: false, description: '如果安全则自动应用 / Auto-apply if safe' },
|
|
3741
|
+
lang: { type: 'string', default: 'zh', description: '输出语言 zh/en / Output language' },
|
|
3742
|
+
json: { type: 'boolean', default: false, description: '输出 JSON / Print JSON output' },
|
|
3743
|
+
},
|
|
3744
|
+
run({ args }) {
|
|
3745
|
+
const lang = normalizeLangArg(args.lang);
|
|
3746
|
+
const projectDir = resolve(String(args.dir ?? PROJECT_DIR));
|
|
3747
|
+
const report = createUpgradeRecommendReport({
|
|
3748
|
+
projectDir,
|
|
3749
|
+
scaleDir: resolveScaleDirForProject(projectDir),
|
|
3750
|
+
targetScaleVersion: args['target-version'] ? String(args['target-version']) : undefined,
|
|
3751
|
+
});
|
|
3752
|
+
if (args.json) {
|
|
3753
|
+
console.log(JSON.stringify(report, null, 2));
|
|
3754
|
+
return;
|
|
3755
|
+
}
|
|
3756
|
+
const riskEmoji = report.riskLevel === 'high' ? '🔴' : report.riskLevel === 'medium' ? '🟡' : '🟢';
|
|
3757
|
+
const recEmoji = report.recommendation === 'safe-to-apply' ? '✅' : report.recommendation === 'blocked' ? '🚫' : '⚠️';
|
|
3758
|
+
if (lang === 'zh') {
|
|
3759
|
+
console.log('SCALE 升级推荐');
|
|
3760
|
+
console.log(` 项目: ${report.projectDir}`);
|
|
3761
|
+
console.log(` ${riskEmoji} 风险分数: ${report.riskScore} (${report.riskLevel})`);
|
|
3762
|
+
console.log(` ${recEmoji} 推荐: ${report.recommendation}`);
|
|
3763
|
+
console.log(` 摘要: ${report.summary}`);
|
|
3764
|
+
console.log(` 应用模式: ${report.applyMode}`);
|
|
3765
|
+
}
|
|
3766
|
+
else {
|
|
3767
|
+
console.log('SCALE Upgrade Recommend');
|
|
3768
|
+
console.log(` Project: ${report.projectDir}`);
|
|
3769
|
+
console.log(` ${riskEmoji} Risk score: ${report.riskScore} (${report.riskLevel})`);
|
|
3770
|
+
console.log(` ${recEmoji} Recommendation: ${report.recommendation}`);
|
|
3771
|
+
console.log(` Summary: ${report.summary}`);
|
|
3772
|
+
console.log(` Apply mode: ${report.applyMode}`);
|
|
3773
|
+
}
|
|
3774
|
+
if (report.blockers.length > 0) {
|
|
3775
|
+
console.log(lang === 'zh' ? ' 阻塞项:' : ' Blockers:');
|
|
3776
|
+
for (const blocker of report.blockers)
|
|
3777
|
+
console.log(` [${blocker.code}] ${blocker.message}`);
|
|
3778
|
+
}
|
|
3779
|
+
if (report.steps.length > 0) {
|
|
3780
|
+
console.log(lang === 'zh' ? ' 步骤:' : ' Steps:');
|
|
3781
|
+
for (const step of report.steps)
|
|
3782
|
+
console.log(` [${step.risk}] ${step.action}: ${step.reason}`);
|
|
3783
|
+
}
|
|
3784
|
+
console.log(lang === 'zh' ? ' 建议命令:' : ' Suggested commands:');
|
|
3785
|
+
for (const cmd of report.autoCommands)
|
|
3786
|
+
console.log(` ${cmd}`);
|
|
3787
|
+
// Auto-apply if requested and safe
|
|
3788
|
+
if (args['auto-apply'] && report.recommendation === 'safe-to-apply') {
|
|
3789
|
+
console.log(lang === 'zh' ? '\n 自动应用中...' : '\n Auto-applying...');
|
|
3790
|
+
const result = applyUpgradePlan({
|
|
3791
|
+
projectDir,
|
|
3792
|
+
scaleDir: resolveScaleDirForProject(projectDir),
|
|
3793
|
+
confirm: true,
|
|
3794
|
+
autoBackup: true,
|
|
3795
|
+
});
|
|
3796
|
+
console.log(lang === 'zh' ? ` 结果: ${result.reason}` : ` Result: ${result.reason}`);
|
|
3797
|
+
if (result.gitBackup?.ok)
|
|
3798
|
+
console.log(lang === 'zh' ? ` Git 备份: ${result.gitBackup.branch}` : ` Git backup: ${result.gitBackup.branch}`);
|
|
3799
|
+
}
|
|
3800
|
+
},
|
|
3801
|
+
});
|
|
3685
3802
|
const upgradeApply = defineCommand({
|
|
3686
3803
|
meta: { name: 'apply', description: '按已审阅计划安全应用升级 / Guarded entrypoint for applying an upgrade plan' },
|
|
3687
3804
|
args: {
|
|
3688
3805
|
dir: { type: 'string', default: PROJECT_DIR, description: '项目目录 / Project directory' },
|
|
3689
3806
|
confirm: { type: 'boolean', default: false, description: '确认当前升级计划已经审阅 / Confirm the current plan was reviewed' },
|
|
3807
|
+
'auto-backup': { type: 'boolean', default: false, description: '应用前自动创建 git 分支备份 / Create git branch backup before applying' },
|
|
3690
3808
|
lang: { type: 'string', default: 'zh', description: '输出语言 zh/en / Output language' },
|
|
3691
3809
|
json: { type: 'boolean', default: false, description: '输出 JSON / Print JSON output' },
|
|
3692
3810
|
},
|
|
@@ -3697,6 +3815,7 @@ const upgradeApply = defineCommand({
|
|
|
3697
3815
|
projectDir,
|
|
3698
3816
|
scaleDir: resolveScaleDirForProject(projectDir),
|
|
3699
3817
|
confirm: isTruthyFlag(args.confirm),
|
|
3818
|
+
autoBackup: isTruthyFlag(args['auto-backup']),
|
|
3700
3819
|
});
|
|
3701
3820
|
if (args.json) {
|
|
3702
3821
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -3708,8 +3827,16 @@ const upgradeApply = defineCommand({
|
|
|
3708
3827
|
console.log(lang === 'zh' ? ` 已应用: ${result.applied}` : ` Applied: ${result.applied}`);
|
|
3709
3828
|
console.log(lang === 'zh' ? ` 原因: ${formatUpgradeApplyReason(result.reason, lang)}` : ` Reason: ${result.reason}`);
|
|
3710
3829
|
console.log(lang === 'zh' ? ` 应用模式: ${result.plan.applyMode}` : ` Apply mode: ${result.plan.applyMode}`);
|
|
3830
|
+
if (result.gitBackup) {
|
|
3831
|
+
if (result.gitBackup.ok) {
|
|
3832
|
+
console.log(lang === 'zh' ? ` Git 备份分支: ${result.gitBackup.branch}` : ` Git backup branch: ${result.gitBackup.branch}`);
|
|
3833
|
+
}
|
|
3834
|
+
else {
|
|
3835
|
+
console.log(lang === 'zh' ? ` Git 备份失败: ${result.gitBackup.error}` : ` Git backup failed: ${result.gitBackup.error}`);
|
|
3836
|
+
}
|
|
3837
|
+
}
|
|
3711
3838
|
if (result.backup)
|
|
3712
|
-
console.log(lang === 'zh' ? `
|
|
3839
|
+
console.log(lang === 'zh' ? ` 文件备份: ${result.backup.manifestPath}` : ` File backup: ${result.backup.manifestPath}`);
|
|
3713
3840
|
for (const path of result.changedFiles)
|
|
3714
3841
|
console.log(lang === 'zh' ? ` 已变更: ${path}` : ` changed: ${path}`);
|
|
3715
3842
|
if (!result.ok)
|
|
@@ -3755,7 +3882,7 @@ const upgrade = defineCommand({
|
|
|
3755
3882
|
lang: { type: 'string', default: 'zh', description: '输出语言 zh/en / Output language' },
|
|
3756
3883
|
json: { type: 'boolean', default: false, description: '输出 JSON / Print JSON output' },
|
|
3757
3884
|
},
|
|
3758
|
-
subCommands: { check: upgradeCheck, plan: upgradePlan, apply: upgradeApply, rollback: upgradeRollback },
|
|
3885
|
+
subCommands: { check: upgradeCheck, plan: upgradePlan, recommend: upgradeRecommend, apply: upgradeApply, rollback: upgradeRollback },
|
|
3759
3886
|
async run({ args }) {
|
|
3760
3887
|
if (isUpgradeSubcommandInvocation(process.argv))
|
|
3761
3888
|
return;
|
|
@@ -6580,6 +6707,7 @@ const main = defineCommand({
|
|
|
6580
6707
|
'out-of-scope': outOfScope,
|
|
6581
6708
|
config,
|
|
6582
6709
|
quickstart: quickstartCommand,
|
|
6710
|
+
onboard: onboardCommand,
|
|
6583
6711
|
tui: tuiCommand,
|
|
6584
6712
|
qa: qaCommand,
|
|
6585
6713
|
'auto-fix': autofixCommand,
|