@hongmaple0820/scale-engine 0.38.0 → 0.39.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/README.md +15 -0
- package/dist/api/cli.js +142 -40
- package/dist/api/cli.js.map +1 -1
- package/dist/api/doctor.js +1 -1
- package/dist/api/doctor.js.map +1 -1
- package/dist/bootstrap/DependencyBootstrap.d.ts +22 -1
- package/dist/bootstrap/DependencyBootstrap.js +420 -32
- package/dist/bootstrap/DependencyBootstrap.js.map +1 -1
- package/dist/bootstrap/DependencyBootstrapRenderer.d.ts +3 -0
- package/dist/bootstrap/DependencyBootstrapRenderer.js +140 -0
- package/dist/bootstrap/DependencyBootstrapRenderer.js.map +1 -0
- package/dist/cli/gateStatusCommands.d.ts +1 -0
- package/dist/cli/gateStatusCommands.js +52 -0
- package/dist/cli/gateStatusCommands.js.map +1 -0
- package/dist/cli/phaseCommands.js +15 -3
- package/dist/cli/phaseCommands.js.map +1 -1
- package/dist/cli/promptCommands.d.ts +1 -0
- package/dist/cli/promptCommands.js +57 -0
- package/dist/cli/promptCommands.js.map +1 -0
- package/dist/cli/scoreCommands.d.ts +1 -0
- package/dist/cli/scoreCommands.js +112 -0
- package/dist/cli/scoreCommands.js.map +1 -0
- package/dist/codegraph/CodeIntelligence.js +1 -1
- package/dist/codegraph/CodeIntelligence.js.map +1 -1
- package/dist/context/SessionStartSequence.js +13 -4
- package/dist/context/SessionStartSequence.js.map +1 -1
- package/dist/core/ExternalCommand.js +18 -4
- package/dist/core/ExternalCommand.js.map +1 -1
- package/dist/env/EnvironmentDoctor.d.ts +66 -0
- package/dist/env/EnvironmentDoctor.js +365 -0
- package/dist/env/EnvironmentDoctor.js.map +1 -0
- package/dist/i18n/Language.d.ts +9 -0
- package/dist/i18n/Language.js +38 -0
- package/dist/i18n/Language.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/memory/MemoryProviders.js +38 -5
- package/dist/memory/MemoryProviders.js.map +1 -1
- package/dist/prompts/PromptOptimizer.d.ts +42 -0
- package/dist/prompts/PromptOptimizer.js +309 -0
- package/dist/prompts/PromptOptimizer.js.map +1 -0
- package/dist/setup/SetupWizard.d.ts +42 -0
- package/dist/setup/SetupWizard.js +156 -0
- package/dist/setup/SetupWizard.js.map +1 -0
- package/dist/skills/SkillRepository.js +2 -2
- package/dist/skills/SkillRepository.js.map +1 -1
- package/dist/testing/DiffTestSelector.js +1 -1
- package/dist/testing/DiffTestSelector.js.map +1 -1
- package/dist/tools/ToolCapabilityRegistry.d.ts +4 -0
- package/dist/tools/ToolCapabilityRegistry.js +11 -6
- package/dist/tools/ToolCapabilityRegistry.js.map +1 -1
- package/dist/workflow/CommitDiscipline.js +8 -7
- package/dist/workflow/CommitDiscipline.js.map +1 -1
- package/dist/workflow/CrossRepoOrchestrator.js +15 -7
- package/dist/workflow/CrossRepoOrchestrator.js.map +1 -1
- package/dist/workflow/GateCatalog.d.ts +61 -0
- package/dist/workflow/GateCatalog.js +212 -0
- package/dist/workflow/GateCatalog.js.map +1 -0
- package/dist/workflow/GovernanceTemplatePacks.js +19 -4
- package/dist/workflow/GovernanceTemplatePacks.js.map +1 -1
- package/dist/workflow/SessionPreamble.js +7 -2
- package/dist/workflow/SessionPreamble.js.map +1 -1
- package/dist/workflow/TaskScoreEngine.d.ts +42 -0
- package/dist/workflow/TaskScoreEngine.js +181 -0
- package/dist/workflow/TaskScoreEngine.js.map +1 -0
- package/dist/workflow/WorkspaceTopology.d.ts +3 -0
- package/dist/workflow/WorkspaceTopology.js +40 -3
- package/dist/workflow/WorkspaceTopology.js.map +1 -1
- package/dist/workflow/gates/GateSystem.js +2 -2
- package/dist/workflow/gates/GateSystem.js.map +1 -1
- package/dist/workflow/index.d.ts +2 -0
- package/dist/workflow/index.js +2 -0
- package/dist/workflow/index.js.map +1 -1
- package/docs/CODE_INTELLIGENCE.md +27 -2
- package/docs/MEMORY_FABRIC.md +22 -1
- package/docs/THIRD_PARTY_SKILLS.md +50 -1
- package/docs/guides/GETTING_STARTED.md +24 -0
- package/docs/start/quickstart.md +103 -76
- package/docs/workflow/GATES_AND_SCORE.md +56 -0
- package/docs/workflow/PROMPT_OPTIMIZATION.md +44 -0
- package/docs/workflow/README.md +7 -0
- package/docs/workflow/node-library.md +3 -3
- package/package.json +11 -4
- package/scripts/workflow/provider-rehearsal.mjs +425 -0
- package/scripts/workflow/setup-smoke.mjs +299 -0
package/README.md
CHANGED
|
@@ -76,6 +76,21 @@ scale bootstrap deps --pack ui,knowledge --apply
|
|
|
76
76
|
|
|
77
77
|
`bootstrap deps` 默认先出计划;只有显式加 `--apply` 才会执行安装命令。
|
|
78
78
|
|
|
79
|
+
安装入口变更后,先跑安装烟测:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
npm run smoke:setup
|
|
83
|
+
make setup-smoke
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
它会验证中英文安装输出、运行时依赖诊断、记忆供应商切换,以及 Graphify/CodeGraph 状态路径;不会执行真实第三方安装。
|
|
87
|
+
|
|
88
|
+
如果用户机器出现 Windows/Unix 命令差异、PATH 不对、缺 Python/Bun/Cargo/RTK 等问题,先跑:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
scale doctor env --json
|
|
92
|
+
```
|
|
93
|
+
|
|
79
94
|
## 适合谁
|
|
80
95
|
|
|
81
96
|
- 正在用 Codex、Claude Code、Cursor、Gemini CLI、OpenCode、Aider 等 Agent 写真实项目的团队。
|
package/dist/api/cli.js
CHANGED
|
@@ -27,8 +27,12 @@ import { createSkillPlan, evaluateSkillGate, loadSkillRoutingPolicy, skillPlanMa
|
|
|
27
27
|
import { createAdapter, SUPPORTED_AGENTS } from '../adapters/index.js';
|
|
28
28
|
import { LessonExtractor, RuleProposer, HookGenerator, EvolutionEngine } from '../evolution/EvolutionEngine.js';
|
|
29
29
|
import { Doctor } from './doctor.js';
|
|
30
|
+
import { inspectEnvironment, renderEnvironmentDoctor } from '../env/EnvironmentDoctor.js';
|
|
30
31
|
import { quickStart, detectPlatform, governanceNextSteps } from './quickstart.js';
|
|
31
32
|
import { bootstrapDependencies } from '../bootstrap/DependencyBootstrap.js';
|
|
33
|
+
import { renderDependencyBootstrapReport } from '../bootstrap/DependencyBootstrapRenderer.js';
|
|
34
|
+
import { runSetupWizard } from '../setup/SetupWizard.js';
|
|
35
|
+
import { normalizeLanguage, resolveCliLanguage } from '../i18n/Language.js';
|
|
32
36
|
import { SkillDiscovery } from '../skills/SkillDiscovery.js';
|
|
33
37
|
import { inspectRequiredWorkflowSkills, inspectWorkflowSkills } from '../skills/SkillDoctor.js';
|
|
34
38
|
import { evaluateSkillInstallSafety, listSkillRepositoryEntries, recommendSkillWorkflow, renderSkillRepositoryMarkdown, } from '../skills/SkillRepository.js';
|
|
@@ -40,6 +44,10 @@ import { OutOfScopeStore } from '../workflow/OutOfScopeStore.js';
|
|
|
40
44
|
import { ReviewStore } from '../workflow/ReviewStore.js';
|
|
41
45
|
import { WorkflowEngine } from '../workflow/WorkflowEngine.js';
|
|
42
46
|
import { resolveVerificationTargets, } from '../workflow/VerificationProfile.js';
|
|
47
|
+
import { preflightGateStages } from '../workflow/GateCatalog.js';
|
|
48
|
+
import { gatesCommand } from '../cli/gateStatusCommands.js';
|
|
49
|
+
import { scoreCommand } from '../cli/scoreCommands.js';
|
|
50
|
+
import { promptCommand } from '../cli/promptCommands.js';
|
|
43
51
|
import { writeGovernanceTemplates } from '../workflow/GovernanceTemplates.js';
|
|
44
52
|
import { getBootstrapPlanForProfile, getProfile as getConfigProfile, generateConfigForProfile, listProfiles as listConfigProfiles, } from '../config/profiles.js';
|
|
45
53
|
import { computeGovernanceDrift } from '../workflow/GovernanceLock.js';
|
|
@@ -126,9 +134,7 @@ function normalizePreflightProfile(value) {
|
|
|
126
134
|
return 'quick';
|
|
127
135
|
}
|
|
128
136
|
function gatesForPreflightProfile(profile) {
|
|
129
|
-
|
|
130
|
-
return ['G3', 'G0', 'G4', 'G5'];
|
|
131
|
-
return ['G3', 'G0', 'G4', 'G5', 'G6', 'G7'];
|
|
137
|
+
return preflightGateStages(profile);
|
|
132
138
|
}
|
|
133
139
|
function shouldSkipPreflightCommandTargets(resolved, args) {
|
|
134
140
|
if (!resolved.matrix)
|
|
@@ -167,11 +173,13 @@ function evaluateEngineeringStandardsGate(options) {
|
|
|
167
173
|
scaleDir: options.scaleDir ?? SCALE_DIR,
|
|
168
174
|
taskId: options.taskId,
|
|
169
175
|
artifactsDir: options.artifactsDir,
|
|
176
|
+
changedFiles: options.changedFiles,
|
|
170
177
|
})
|
|
171
178
|
: undefined;
|
|
172
179
|
const doctor = settlement?.doctor ?? doctorEngineeringStandards({
|
|
173
180
|
projectDir: options.projectDir ?? PROJECT_DIR,
|
|
174
181
|
scaleDir: options.scaleDir ?? SCALE_DIR,
|
|
182
|
+
changedFiles: options.changedFiles,
|
|
175
183
|
});
|
|
176
184
|
return {
|
|
177
185
|
mode,
|
|
@@ -181,6 +189,7 @@ function evaluateEngineeringStandardsGate(options) {
|
|
|
181
189
|
findings: doctor.findings,
|
|
182
190
|
summary: doctor.scan.summary,
|
|
183
191
|
standardsImpactPath: settlement?.standardsImpactPath,
|
|
192
|
+
changedFiles: options.changedFiles,
|
|
184
193
|
};
|
|
185
194
|
}
|
|
186
195
|
function skippedEngineeringStandardsGate(reason, policy) {
|
|
@@ -2315,12 +2324,14 @@ const preflight = defineCommand({
|
|
|
2315
2324
|
resolved.warnings.push('No verification services or profile commands configured; command gates skipped for this governance-only project.');
|
|
2316
2325
|
}
|
|
2317
2326
|
const workspaceSafety = inspectWorkspaceSafety(projectDir);
|
|
2327
|
+
const engineeringStandardsChangedFiles = readGitChangedFilesForStandards(projectDir);
|
|
2318
2328
|
const engineeringStandards = workspaceSafety.blocked
|
|
2319
2329
|
? skippedEngineeringStandardsGate('Workspace has unresolved git conflicts; resolve them before standards scanning.', resolved.policy)
|
|
2320
2330
|
: evaluateEngineeringStandardsGate({
|
|
2321
2331
|
policy: resolved.policy,
|
|
2322
2332
|
projectDir,
|
|
2323
2333
|
scaleDir,
|
|
2334
|
+
changedFiles: engineeringStandardsChangedFiles,
|
|
2324
2335
|
});
|
|
2325
2336
|
const targetResults = [];
|
|
2326
2337
|
if (!args.json) {
|
|
@@ -2336,6 +2347,9 @@ const preflight = defineCommand({
|
|
|
2336
2347
|
if (engineeringStandards.checked) {
|
|
2337
2348
|
const status = engineeringStandards.blocked ? 'BLOCKED' : engineeringStandards.ok ? 'OK' : 'WARN';
|
|
2338
2349
|
console.log(` Engineering standards: ${status} (${engineeringStandards.mode})`);
|
|
2350
|
+
if (engineeringStandards.changedFiles) {
|
|
2351
|
+
console.log(` Engineering standards scope: changed files (${engineeringStandards.changedFiles.length})`);
|
|
2352
|
+
}
|
|
2339
2353
|
}
|
|
2340
2354
|
else {
|
|
2341
2355
|
console.log(' Engineering standards: skipped');
|
|
@@ -2770,10 +2784,12 @@ const bootstrapDepsCommand = defineCommand({
|
|
|
2770
2784
|
'governance-pack': { type: 'string', description: 'Optional governance pack hint, for example frontend-app -> ui' },
|
|
2771
2785
|
include: { type: 'string', description: 'Additional dependency ids to include explicitly' },
|
|
2772
2786
|
apply: { type: 'boolean', default: false, description: 'Run install commands for ready dependencies' },
|
|
2787
|
+
lang: { type: 'string', description: 'Output language zh/en. Defaults to zh, then SCALE_LANG, then .scale/config.yaml locale.' },
|
|
2773
2788
|
json: { type: 'boolean', default: false, description: 'Output bootstrap plan as JSON' },
|
|
2774
2789
|
},
|
|
2775
2790
|
async run({ args }) {
|
|
2776
2791
|
const projectDir = resolve(String(args.dir ?? PROJECT_DIR));
|
|
2792
|
+
const lang = resolveCliLanguage({ lang: args.lang, projectDir, scaleDir: SCALE_DIR });
|
|
2777
2793
|
const explicitPacks = parseCommaList(args.pack);
|
|
2778
2794
|
const recommendedPacks = args.profile
|
|
2779
2795
|
? getBootstrapPlanForProfile(String(args.profile), args['governance-pack'] ? String(args['governance-pack']) : undefined).packs
|
|
@@ -2791,40 +2807,7 @@ const bootstrapDepsCommand = defineCommand({
|
|
|
2791
2807
|
process.exitCode = 1;
|
|
2792
2808
|
return;
|
|
2793
2809
|
}
|
|
2794
|
-
console.log(
|
|
2795
|
-
console.log(` Project: ${report.projectDir}`);
|
|
2796
|
-
console.log(` Packs: ${report.packIds.join(', ')}`);
|
|
2797
|
-
console.log(` Apply: ${report.apply}`);
|
|
2798
|
-
console.log(` Complete: ${report.complete}`);
|
|
2799
|
-
for (const item of report.items) {
|
|
2800
|
-
console.log(` [${item.status.toUpperCase()}] ${item.id} (${item.kind})`);
|
|
2801
|
-
console.log(` source: ${item.source}`);
|
|
2802
|
-
console.log(` detected: ${item.detectedBy}`);
|
|
2803
|
-
if (!item.installed && item.installCommand)
|
|
2804
|
-
console.log(` install: ${item.installCommand}`);
|
|
2805
|
-
if (!item.installed && item.manualReason)
|
|
2806
|
-
console.log(` reason: ${item.manualReason}`);
|
|
2807
|
-
if (!item.installed && item.prerequisites.length > 0) {
|
|
2808
|
-
console.log(` prereqs: ${item.prerequisites.map(req => `${req.command}=${req.present ? 'ok' : 'missing'}`).join(', ')}`);
|
|
2809
|
-
}
|
|
2810
|
-
if (item.error)
|
|
2811
|
-
console.log(` error: ${item.error}`);
|
|
2812
|
-
}
|
|
2813
|
-
for (const action of report.postActions)
|
|
2814
|
-
console.log(` [POST] ${action}`);
|
|
2815
|
-
if (report.postChecks.length > 0) {
|
|
2816
|
-
console.log(` Post-checks: passed=${report.postCheckSummary.passed}, warned=${report.postCheckSummary.warned}, failed=${report.postCheckSummary.failed}`);
|
|
2817
|
-
for (const check of report.postChecks) {
|
|
2818
|
-
console.log(` [POSTCHECK ${check.status.toUpperCase()}] ${check.label}: ${check.summary}`);
|
|
2819
|
-
console.log(` command: ${check.command}`);
|
|
2820
|
-
}
|
|
2821
|
-
}
|
|
2822
|
-
for (const command of report.postCheckCommands)
|
|
2823
|
-
console.log(` [CHECK] ${command}`);
|
|
2824
|
-
for (const hint of report.rollbackHints)
|
|
2825
|
-
console.log(` [ROLLBACK] ${hint}`);
|
|
2826
|
-
for (const recommendation of report.recommendations)
|
|
2827
|
-
console.log(` [NEXT] ${recommendation}`);
|
|
2810
|
+
console.log(renderDependencyBootstrapReport(report, lang));
|
|
2828
2811
|
if (report.apply && !report.ok)
|
|
2829
2812
|
process.exitCode = 1;
|
|
2830
2813
|
},
|
|
@@ -2834,6 +2817,74 @@ const bootstrap = defineCommand({
|
|
|
2834
2817
|
subCommands: { deps: bootstrapDepsCommand },
|
|
2835
2818
|
});
|
|
2836
2819
|
// ============================================================================
|
|
2820
|
+
const setup = defineCommand({
|
|
2821
|
+
meta: { name: 'setup', description: 'Interactive SCALE setup for third-party skills, CLIs, memory, and knowledge providers' },
|
|
2822
|
+
args: {
|
|
2823
|
+
dir: { type: 'string', default: PROJECT_DIR, description: 'Project directory' },
|
|
2824
|
+
pack: { type: 'string', default: '', description: 'Comma-separated packs: ui,memory,knowledge,external-cli,full. Defaults to full unless --profile is supplied.' },
|
|
2825
|
+
profile: { type: 'string', description: 'Resolve recommended packs from profile: minimal, standard, advanced' },
|
|
2826
|
+
'governance-pack': { type: 'string', description: 'Optional governance pack hint, for example frontend-app -> ui' },
|
|
2827
|
+
include: { type: 'string', description: 'Additional dependency ids to include explicitly' },
|
|
2828
|
+
apply: { type: 'boolean', default: false, description: 'Run install commands for ready dependencies' },
|
|
2829
|
+
yes: { type: 'boolean', default: false, description: 'Confirm installation without prompting' },
|
|
2830
|
+
interactive: { type: 'boolean', default: true, description: 'Prompt before installation when dependencies are ready' },
|
|
2831
|
+
lang: { type: 'string', description: 'Output language zh/en. Defaults to zh, then SCALE_LANG, then .scale/config.yaml locale.' },
|
|
2832
|
+
'memory-provider': { type: 'string', description: 'Switch memory provider during setup: gbrain, agentmemory, or scale-local' },
|
|
2833
|
+
'memory-mode': { type: 'string', description: 'Memory routing mode: auto, local-only, external-first' },
|
|
2834
|
+
'memory-endpoint': { type: 'string', description: 'Optional endpoint to persist for the selected memory provider' },
|
|
2835
|
+
'memory-write-mode': { type: 'string', description: 'Memory write mode: disabled, candidate-only, enabled' },
|
|
2836
|
+
'allow-external-write': { type: 'boolean', default: false, description: 'Explicitly allow external memory writes in provider routing' },
|
|
2837
|
+
json: { type: 'boolean', default: false, description: 'Output setup report as JSON' },
|
|
2838
|
+
},
|
|
2839
|
+
async run({ args }) {
|
|
2840
|
+
const projectDir = resolve(String(args.dir ?? PROJECT_DIR));
|
|
2841
|
+
const lang = resolveCliLanguage({ lang: args.lang, projectDir, scaleDir: SCALE_DIR });
|
|
2842
|
+
const explicitPacks = parseCommaList(args.pack);
|
|
2843
|
+
const recommendedPacks = args.profile
|
|
2844
|
+
? getBootstrapPlanForProfile(String(args.profile), args['governance-pack'] ? String(args['governance-pack']) : undefined).packs
|
|
2845
|
+
: [];
|
|
2846
|
+
const report = await runSetupWizard({
|
|
2847
|
+
projectDir,
|
|
2848
|
+
scaleDir: SCALE_DIR,
|
|
2849
|
+
packIds: explicitPacks.length > 0 ? uniqueStrings([...recommendedPacks, ...explicitPacks]) : recommendedPacks,
|
|
2850
|
+
includeIds: parseCommaList(args.include),
|
|
2851
|
+
apply: isTruthyFlag(args.apply),
|
|
2852
|
+
yes: isTruthyFlag(args.yes),
|
|
2853
|
+
interactive: isTruthyFlag(args.interactive) && !isTruthyFlag(args.json),
|
|
2854
|
+
lang,
|
|
2855
|
+
memoryProvider: args['memory-provider'] ? String(args['memory-provider']) : undefined,
|
|
2856
|
+
memoryMode: normalizeMemoryModeArg(args['memory-mode']),
|
|
2857
|
+
memoryEndpoint: args['memory-endpoint'] ? String(args['memory-endpoint']) : undefined,
|
|
2858
|
+
memoryWriteMode: normalizeMemoryWriteModeArg(args['memory-write-mode']),
|
|
2859
|
+
allowExternalWrite: isTruthyFlag(args['allow-external-write']) ? true : undefined,
|
|
2860
|
+
promptLanguage: isTruthyFlag(args.interactive) && !args.lang,
|
|
2861
|
+
});
|
|
2862
|
+
if (args.json) {
|
|
2863
|
+
console.log(JSON.stringify(report, null, 2));
|
|
2864
|
+
if (!report.ok)
|
|
2865
|
+
process.exitCode = 1;
|
|
2866
|
+
return;
|
|
2867
|
+
}
|
|
2868
|
+
console.log(lang === 'zh' ? '\nSCALE 交互式安装' : '\nSCALE Interactive Setup');
|
|
2869
|
+
console.log(lang === 'zh'
|
|
2870
|
+
? ` 已执行安装: ${report.applied ? '是' : '否'}`
|
|
2871
|
+
: ` Applied: ${report.applied}`);
|
|
2872
|
+
if (report.memoryProviderSwitch) {
|
|
2873
|
+
const switched = report.memoryProviderSwitch;
|
|
2874
|
+
console.log(lang === 'zh' ? ' 记忆供应商:' : ' Memory provider:');
|
|
2875
|
+
console.log(` provider=${switched.provider}; mode=${switched.mode}; config=${switched.path}`);
|
|
2876
|
+
console.log(` order=${switched.previousOrder.join(' -> ')} => ${switched.nextOrder.join(' -> ')}`);
|
|
2877
|
+
if (switched.providerStatus) {
|
|
2878
|
+
console.log(` status=${switched.providerStatus.available ? 'available' : 'not-ready'}; reason=${switched.providerStatus.reason}`);
|
|
2879
|
+
}
|
|
2880
|
+
for (const warning of switched.warnings)
|
|
2881
|
+
console.log(lang === 'zh' ? ` [警告] ${warning}` : ` [WARN] ${warning}`);
|
|
2882
|
+
}
|
|
2883
|
+
console.log(renderDependencyBootstrapReport(report.final, lang));
|
|
2884
|
+
if (!report.ok)
|
|
2885
|
+
process.exitCode = 1;
|
|
2886
|
+
},
|
|
2887
|
+
});
|
|
2837
2888
|
// config command — Configuration profile management
|
|
2838
2889
|
// ============================================================================
|
|
2839
2890
|
const configProfile = defineCommand({
|
|
@@ -3779,9 +3830,24 @@ function readGitChangedFiles(projectDir) {
|
|
|
3779
3830
|
const untracked = readGitPathList(projectDir, ['ls-files', '--others', '--exclude-standard']);
|
|
3780
3831
|
return Array.from(new Set([...tracked, ...untracked]));
|
|
3781
3832
|
}
|
|
3833
|
+
function readGitChangedFilesForStandards(projectDir) {
|
|
3834
|
+
try {
|
|
3835
|
+
execFileSync('git', ['-C', projectDir, 'rev-parse', '--is-inside-work-tree'], {
|
|
3836
|
+
encoding: 'utf-8',
|
|
3837
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
3838
|
+
});
|
|
3839
|
+
}
|
|
3840
|
+
catch {
|
|
3841
|
+
return undefined;
|
|
3842
|
+
}
|
|
3843
|
+
return readGitChangedFiles(projectDir);
|
|
3844
|
+
}
|
|
3782
3845
|
function readGitPathList(projectDir, args) {
|
|
3783
3846
|
try {
|
|
3784
|
-
return execFileSync('git', ['-C', projectDir, ...args], {
|
|
3847
|
+
return execFileSync('git', ['-C', projectDir, ...args], {
|
|
3848
|
+
encoding: 'utf-8',
|
|
3849
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
3850
|
+
})
|
|
3785
3851
|
.split(/\r?\n/)
|
|
3786
3852
|
.map(item => item.trim())
|
|
3787
3853
|
.filter(Boolean);
|
|
@@ -4112,8 +4178,19 @@ function normalizeThemeArg(value) {
|
|
|
4112
4178
|
return 'auto';
|
|
4113
4179
|
}
|
|
4114
4180
|
function normalizeLangArg(value) {
|
|
4115
|
-
|
|
4116
|
-
|
|
4181
|
+
return normalizeLanguage(value ?? process.env.SCALE_LANG);
|
|
4182
|
+
}
|
|
4183
|
+
function normalizeMemoryModeArg(value) {
|
|
4184
|
+
const normalized = String(value ?? '').trim().toLowerCase();
|
|
4185
|
+
if (normalized === 'auto' || normalized === 'local-only' || normalized === 'external-first')
|
|
4186
|
+
return normalized;
|
|
4187
|
+
return undefined;
|
|
4188
|
+
}
|
|
4189
|
+
function normalizeMemoryWriteModeArg(value) {
|
|
4190
|
+
const normalized = String(value ?? '').trim().toLowerCase();
|
|
4191
|
+
if (normalized === 'disabled' || normalized === 'candidate-only' || normalized === 'enabled')
|
|
4192
|
+
return normalized;
|
|
4193
|
+
return undefined;
|
|
4117
4194
|
}
|
|
4118
4195
|
function launchLocalFile(path) {
|
|
4119
4196
|
try {
|
|
@@ -4150,13 +4227,34 @@ const evolve = defineCommand({
|
|
|
4150
4227
|
// ============================================================================
|
|
4151
4228
|
// doctor command
|
|
4152
4229
|
// ============================================================================
|
|
4230
|
+
function runEnvironmentDoctor(json) {
|
|
4231
|
+
const report = inspectEnvironment();
|
|
4232
|
+
if (json) {
|
|
4233
|
+
console.log(JSON.stringify(report, null, 2));
|
|
4234
|
+
}
|
|
4235
|
+
else {
|
|
4236
|
+
console.log(renderEnvironmentDoctor(report));
|
|
4237
|
+
}
|
|
4238
|
+
process.exitCode = report.ok ? 0 : 1;
|
|
4239
|
+
}
|
|
4153
4240
|
const doctor = defineCommand({
|
|
4154
4241
|
meta: { name: 'doctor', description: 'Diagnose SCALE Engine health' },
|
|
4155
4242
|
args: {
|
|
4243
|
+
scope: { type: 'positional', required: false, description: 'Optional diagnostic scope: env' },
|
|
4156
4244
|
dir: { type: 'string', default: '.', description: 'Project directory' },
|
|
4157
4245
|
json: { type: 'boolean', default: false, description: 'Output as JSON' },
|
|
4158
4246
|
},
|
|
4159
4247
|
async run({ args }) {
|
|
4248
|
+
const scope = String(args.scope ?? '').trim().toLowerCase();
|
|
4249
|
+
if (scope === 'env' || scope === 'environment') {
|
|
4250
|
+
runEnvironmentDoctor(args.json);
|
|
4251
|
+
return;
|
|
4252
|
+
}
|
|
4253
|
+
if (scope) {
|
|
4254
|
+
console.error(`Unknown doctor scope: ${scope}. Supported scope: env.`);
|
|
4255
|
+
process.exitCode = 1;
|
|
4256
|
+
return;
|
|
4257
|
+
}
|
|
4160
4258
|
const doc = new Doctor(args.dir);
|
|
4161
4259
|
const report = await doc.diagnose();
|
|
4162
4260
|
if (args.json) {
|
|
@@ -6020,10 +6118,12 @@ const main = defineCommand({
|
|
|
6020
6118
|
run: runCommand,
|
|
6021
6119
|
// Original commands (preserved)
|
|
6022
6120
|
init,
|
|
6121
|
+
setup,
|
|
6023
6122
|
bootstrap,
|
|
6024
6123
|
doctor,
|
|
6025
6124
|
session,
|
|
6026
6125
|
gate,
|
|
6126
|
+
gates: gatesCommand,
|
|
6027
6127
|
'meta-governance': metaGovernance,
|
|
6028
6128
|
create,
|
|
6029
6129
|
list,
|
|
@@ -6038,6 +6138,8 @@ const main = defineCommand({
|
|
|
6038
6138
|
preflight,
|
|
6039
6139
|
upgrade,
|
|
6040
6140
|
governance,
|
|
6141
|
+
prompt: promptCommand,
|
|
6142
|
+
score: scoreCommand,
|
|
6041
6143
|
'ai-os': aiOs,
|
|
6042
6144
|
codegraph,
|
|
6043
6145
|
eval: evalCommand,
|