@hongmaple0820/scale-engine 0.27.0 → 0.27.1
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.en.md +55 -3
- package/README.md +55 -3
- package/dist/api/cli.js +214 -5
- package/dist/api/cli.js.map +1 -1
- package/dist/runtime/AiOsRuntime.d.ts +216 -0
- package/dist/runtime/AiOsRuntime.js +699 -1
- package/dist/runtime/AiOsRuntime.js.map +1 -1
- package/dist/workflow/UpgradeManager.d.ts +4 -1
- package/dist/workflow/UpgradeManager.js +26 -0
- package/dist/workflow/UpgradeManager.js.map +1 -1
- package/docs/AI_ENGINEERING_OS_POSITIONING.md +109 -11
- package/docs/README.md +1 -1
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="https://img.shields.io/badge/version-0.27.
|
|
2
|
+
<img src="https://img.shields.io/badge/version-0.27.1-orange?style=flat-square" alt="version" />
|
|
3
3
|
<img src="https://img.shields.io/badge/platforms-22-blue?style=flat-square" alt="platforms" />
|
|
4
4
|
<img src="https://img.shields.io/badge/agents-12-blue?style=flat-square" alt="agents" />
|
|
5
5
|
<img src="https://img.shields.io/badge/workflows-10-green?style=flat-square" alt="workflows" />
|
|
6
6
|
<img src="https://img.shields.io/badge/detectors-19-red?style=flat-square" alt="detectors" />
|
|
7
7
|
<img src="https://img.shields.io/badge/tests-verified-brightgreen?style=flat-square" alt="tests" />
|
|
8
|
-
<img src="https://img.shields.io/badge/npm-0.27.
|
|
8
|
+
<img src="https://img.shields.io/badge/npm-0.27.1-cb3837?style=flat-square&logo=npm" alt="npm" />
|
|
9
9
|
</p>
|
|
10
10
|
|
|
11
|
-
# SCALE Engine v0.27.
|
|
11
|
+
# SCALE Engine v0.27.1
|
|
12
12
|
|
|
13
13
|
SCALE Engine makes AI coding agents follow engineering rules through executable workflow gates, evidence files, and review constraints instead of relying on prompt discipline alone. It helps humans see what the agent explored, planned, verified, skipped, and why a task is or is not ready to ship.
|
|
14
14
|
|
|
@@ -33,6 +33,58 @@ scale ai-os plan \
|
|
|
33
33
|
|
|
34
34
|
This is not a claim that SCALE replaces human judgment. It is the first testable, explainable, and measurable runtime planning layer for the AI Engineering OS direction.
|
|
35
35
|
|
|
36
|
+
The near-term target is a one-week push from `ai-os plan` to a runnable beta loop: `ai-os run`, memory providers, Context Compiler v2, Skill Router v2, Adaptive Workflow, Failure Learning, Dashboard, migration, and benchmark evidence. The long-range target is an AI Engineering OS beta in 8-12 weeks, a stable governance runtime in 3-6 months, and a cross-agent engineering operating layer in 6-12 months. See the full roadmap in [AI Engineering OS Strategic Positioning](docs/AI_ENGINEERING_OS_POSITIONING.md).
|
|
37
|
+
|
|
38
|
+
The current 0.27.0 beta runtime now includes the controlled run entry point: `scale ai-os run --dry-run` reuses the unified plan, produces execution steps, evidence requirements, next actions, and writes the run report to `.scale/ai-os/runs/`. When real verification is required, use guarded mode with explicit `--verify` commands. Commands run through the safe runner by default and are recorded as runtime evidence; failed verification returns a `blocked` JSON report and a non-zero CLI exit code.
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
scale ai-os run \
|
|
42
|
+
--task-id TASK-123 \
|
|
43
|
+
--task "Fix OAuth callback auth token handling and verify browser callback flow" \
|
|
44
|
+
--level L \
|
|
45
|
+
--files src/auth/oauth.ts,src/ui/callback.tsx \
|
|
46
|
+
--dry-run \
|
|
47
|
+
--json
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
scale ai-os run \
|
|
52
|
+
--task-id TASK-123 \
|
|
53
|
+
--task "Fix OAuth callback auth token handling and verify browser callback flow" \
|
|
54
|
+
--level L \
|
|
55
|
+
--files src/auth/oauth.ts,src/ui/callback.tsx \
|
|
56
|
+
--mode guarded \
|
|
57
|
+
--verify "npm test -- tests/auth/oauth.test.ts" \
|
|
58
|
+
--json
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
After multiple runs, use the dashboard to summarize ready/blocked runs, verification commands, pending evidence, and failure learning:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
scale ai-os dashboard --json
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Before a release or milestone review, run the fixed benchmark scenarios to compare context, memory, skill, governance, and dashboard metrics:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
scale ai-os benchmark --json
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Before adopting the 0.27.0 beta runtime in an existing project, create or verify the AI OS runtime state directories:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
scale ai-os migrate --json
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
For project-level readiness, run the AI OS doctor. It checks runtime directories, run history, dashboard health, benchmark freshness, and prints the next required action in English or Chinese:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
scale ai-os doctor --lang en --json
|
|
83
|
+
scale ai-os doctor --lang zh
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
The standard upgrade path also surfaces this readiness. `scale upgrade check --json` now includes the AI OS doctor result, and `scale upgrade plan --json` adds explicit `ai-os migrate` / `ai-os doctor` steps when a project has not yet adopted the runtime state.
|
|
87
|
+
|
|
36
88
|
## Community
|
|
37
89
|
|
|
38
90
|
SCALE Engine is an engineering workflow governance project for real AI-agent delivery. Contributions, issues, PRs, governance-pack ideas, and field reports are welcome through the source repositories. Chinese users can also follow the WeChat public account for updates, examples, and community entry points.
|
package/README.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="https://img.shields.io/badge/version-0.27.
|
|
2
|
+
<img src="https://img.shields.io/badge/version-0.27.1-orange?style=flat-square" alt="version" />
|
|
3
3
|
<img src="https://img.shields.io/badge/platforms-22-blue?style=flat-square" alt="platforms" />
|
|
4
4
|
<img src="https://img.shields.io/badge/agents-12-blue?style=flat-square" alt="agents" />
|
|
5
5
|
<img src="https://img.shields.io/badge/workflows-10-green?style=flat-square" alt="workflows" />
|
|
6
6
|
<img src="https://img.shields.io/badge/detectors-19-red?style=flat-square" alt="detectors" />
|
|
7
7
|
<img src="https://img.shields.io/badge/tests-verified-brightgreen?style=flat-square" alt="tests" />
|
|
8
|
-
<img src="https://img.shields.io/badge/npm-0.27.
|
|
8
|
+
<img src="https://img.shields.io/badge/npm-0.27.1-cb3837?style=flat-square&logo=npm" alt="npm" />
|
|
9
9
|
</p>
|
|
10
10
|
|
|
11
|
-
# SCALE Engine v0.27.
|
|
11
|
+
# SCALE Engine v0.27.1
|
|
12
12
|
|
|
13
13
|
SCALE Engine 让 AI Agent 不再只靠“自觉”遵守工程规范。它把探索、规划、实现、验证、评审、发版这些要求变成可执行的命令、门禁和证据文件,让人类可以看见 Agent 做了什么、跳过了什么、为什么能交付或不能交付。
|
|
14
14
|
|
|
@@ -33,6 +33,58 @@ scale ai-os plan \
|
|
|
33
33
|
|
|
34
34
|
这不是“完全替代人类判断”的声明;它是把 AI Engineering OS 的核心闭环先做成可测试、可解释、可度量的运行时规划层。
|
|
35
35
|
|
|
36
|
+
短期目标是用一周冲刺把 `ai-os plan` 推进到可运行的 beta 闭环:`ai-os run`、记忆供应商、Context Compiler v2、Skill Router v2、Adaptive Workflow、Failure Learning、Dashboard、迁移和 benchmark。远景目标是 8-12 周形成 AI Engineering OS beta,3-6 个月进入稳定治理运行时,6-12 个月沉淀为跨 Agent 的工程操作层。完整路线图见 [AI Engineering OS 战略定位](docs/AI_ENGINEERING_OS_POSITIONING.md)。
|
|
37
|
+
|
|
38
|
+
当前 0.27.0 beta runtime 已包含受控运行入口:`scale ai-os run --dry-run` 会复用统一 plan,生成执行步骤、证据要求、下一步动作,并把运行报告写入 `.scale/ai-os/runs/`。需要真实验证时可切到 guarded 模式并显式传入 `--verify`,命令默认通过 safe runner 执行并写入 runtime evidence;验证失败时 JSON 报告会返回 `blocked`,CLI 退出码为非零。
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
scale ai-os run \
|
|
42
|
+
--task-id TASK-123 \
|
|
43
|
+
--task "修复 OAuth callback auth token 并验证浏览器回调流程" \
|
|
44
|
+
--level L \
|
|
45
|
+
--files src/auth/oauth.ts,src/ui/callback.tsx \
|
|
46
|
+
--dry-run \
|
|
47
|
+
--json
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
scale ai-os run \
|
|
52
|
+
--task-id TASK-123 \
|
|
53
|
+
--task "修复 OAuth callback auth token 并验证浏览器回调流程" \
|
|
54
|
+
--level L \
|
|
55
|
+
--files src/auth/oauth.ts,src/ui/callback.tsx \
|
|
56
|
+
--mode guarded \
|
|
57
|
+
--verify "npm test -- tests/auth/oauth.test.ts" \
|
|
58
|
+
--json
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
运行多次后可以用 dashboard 汇总 ready/blocked、验证命令、pending evidence 和 failure learning:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
scale ai-os dashboard --json
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
发版或阶段验收前,用 benchmark 固定样例对比 context、memory、skill、governance 和 dashboard 指标:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
scale ai-os benchmark --json
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
旧项目接入 0.27.0 beta runtime 前,可先创建或核验 AI OS 运行态目录:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
scale ai-os migrate --json
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
项目级就绪检查可使用 AI OS doctor。它会检查运行态目录、运行历史、dashboard 健康度、benchmark 新鲜度,并按中英文输出下一步动作:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
scale ai-os doctor --lang zh --json
|
|
83
|
+
scale ai-os doctor --lang en
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
标准升级入口也会带出这项检查。`scale upgrade check --json` 会包含 AI OS doctor 结果;当项目尚未接入运行态目录时,`scale upgrade plan --json` 会补充明确的 `ai-os migrate` / `ai-os doctor` 步骤。
|
|
87
|
+
|
|
36
88
|
## 先怎么学
|
|
37
89
|
|
|
38
90
|
如果你第一次接触 SCALE,不要从完整命令列表开始读。按这个顺序更容易掌握:
|
package/dist/api/cli.js
CHANGED
|
@@ -65,7 +65,7 @@ import { doctorHtmlArtifacts, renderHtmlArtifact, resolveHtmlArtifactForOpen, se
|
|
|
65
65
|
import { renderGovernanceDashboard } from '../output/GovernanceDashboard.js';
|
|
66
66
|
import { cleanupWorkspaceLifecycle, inspectWorkspaceLifecycle, } from '../workflow/WorkspaceLifecycle.js';
|
|
67
67
|
import { inspectWorkspaceSafety } from '../workflow/WorkspaceSafety.js';
|
|
68
|
-
import { RuntimeEvidenceLedger, SessionLedger, createAiOsPlan, doctorRuntimeEvidence, evaluateFinalReportReadiness, } from '../runtime/index.js';
|
|
68
|
+
import { RuntimeEvidenceLedger, SessionLedger, createAiOsBenchmark, createAiOsDashboard, createAiOsDoctor, createAiOsMigration, createAiOsPlan, createAiOsRun, doctorRuntimeEvidence, evaluateFinalReportReadiness, } from '../runtime/index.js';
|
|
69
69
|
import { MemoryFabric, MemoryBrain, doctorMemoryFabric, renderContextPackMarkdown, renderMemoryLearningCandidateMarkdown, inspectMemoryProviders, recallMemoryProviders, settleMemoryLearning, writeMemoryProvidersConfig, } from '../memory/index.js';
|
|
70
70
|
import { resolveWorkspaceTopology, workspaceTopologyPath, workspaceTopologyTemplate, } from '../workflow/WorkspaceTopology.js';
|
|
71
71
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
@@ -2950,9 +2950,202 @@ const aiOsPlanCommand = defineCommand({
|
|
|
2950
2950
|
console.log(` recommendation: ${recommendation}`);
|
|
2951
2951
|
},
|
|
2952
2952
|
});
|
|
2953
|
+
const aiOsRunCommand = defineCommand({
|
|
2954
|
+
meta: { name: 'run', description: 'Run the AI OS beta loop in dry-run or guarded mode and write an execution report' },
|
|
2955
|
+
args: {
|
|
2956
|
+
dir: { type: 'string', default: PROJECT_DIR, description: 'Project directory' },
|
|
2957
|
+
'task-id': { type: 'string', description: 'Task id' },
|
|
2958
|
+
task: { type: 'string', required: true, description: 'Task or requirement description' },
|
|
2959
|
+
level: { type: 'string', default: 'M', description: 'Task level: S, M, L, or CRITICAL' },
|
|
2960
|
+
files: { type: 'string', description: 'Comma-separated changed or target files' },
|
|
2961
|
+
services: { type: 'string', description: 'Comma-separated affected services' },
|
|
2962
|
+
budget: { type: 'string', description: 'Maximum estimated tokens for the context compiler' },
|
|
2963
|
+
'requested-mode': { type: 'string', description: 'Requested governance mode: minimal, standard, expanded, or critical' },
|
|
2964
|
+
verify: { type: 'string', description: 'Comma-separated guarded verification commands to run without shell by default' },
|
|
2965
|
+
timeout: { type: 'string', description: 'Verification command timeout in milliseconds' },
|
|
2966
|
+
mode: { type: 'string', description: 'Run mode: dry-run or guarded' },
|
|
2967
|
+
'dry-run': { type: 'boolean', default: false, description: 'Force dry-run mode without executing external commands' },
|
|
2968
|
+
'allow-shell': { type: 'boolean', default: false, description: 'Allow shell execution for trusted local guarded runs' },
|
|
2969
|
+
json: { type: 'boolean', default: false },
|
|
2970
|
+
},
|
|
2971
|
+
async run({ args }) {
|
|
2972
|
+
const projectDir = resolve(String(args.dir ?? PROJECT_DIR));
|
|
2973
|
+
const scaleDir = resolveScaleDirForProject(projectDir);
|
|
2974
|
+
const report = await createAiOsRun({
|
|
2975
|
+
projectDir,
|
|
2976
|
+
scaleDir,
|
|
2977
|
+
taskId: args['task-id'] ? String(args['task-id']) : undefined,
|
|
2978
|
+
task: String(args.task),
|
|
2979
|
+
level: normalizeTaskArtifactLevel(args.level),
|
|
2980
|
+
files: parseCommaList(args.files),
|
|
2981
|
+
services: parseCommaList(args.services),
|
|
2982
|
+
budget: parsePositiveIntArg(args.budget, '--budget'),
|
|
2983
|
+
requestedMode: normalizeGovernanceMode(args['requested-mode']),
|
|
2984
|
+
mode: normalizeAiOsRunMode(args.mode, Boolean(args['dry-run'])),
|
|
2985
|
+
verificationCommands: parseCommaList(args.verify),
|
|
2986
|
+
commandTimeoutMs: parsePositiveIntArg(args.timeout, '--timeout'),
|
|
2987
|
+
allowShell: Boolean(args['allow-shell']),
|
|
2988
|
+
});
|
|
2989
|
+
if (args.json) {
|
|
2990
|
+
console.log(JSON.stringify(report, null, 2));
|
|
2991
|
+
if (report.status === 'blocked')
|
|
2992
|
+
process.exitCode = 1;
|
|
2993
|
+
return;
|
|
2994
|
+
}
|
|
2995
|
+
console.log('SCALE AI OS Runtime Run');
|
|
2996
|
+
console.log(` Version: ${report.version}`);
|
|
2997
|
+
console.log(` Mode: ${report.mode}`);
|
|
2998
|
+
console.log(` Status: ${report.status}`);
|
|
2999
|
+
console.log(` Task: ${report.plan.task.taskId ?? 'n/a'} ${report.plan.task.task}`);
|
|
3000
|
+
console.log(` Steps: ${report.steps.filter(step => step.status === 'passed').length} passed, ${report.steps.filter(step => step.status === 'planned').length} planned, ${report.steps.filter(step => step.status === 'blocked').length} blocked`);
|
|
3001
|
+
console.log(` Verification: ${report.verification.commands.filter(command => command.status === 'passed').length}/${report.verification.commands.length} passed`);
|
|
3002
|
+
console.log(` Evidence: ${report.evidence.produced.length} produced, ${report.evidence.pending.length} pending`);
|
|
3003
|
+
console.log(` Report: ${report.artifacts.runReport}`);
|
|
3004
|
+
for (const action of report.nextActions.slice(0, 6))
|
|
3005
|
+
console.log(` next: ${action}`);
|
|
3006
|
+
if (report.status === 'blocked')
|
|
3007
|
+
process.exitCode = 1;
|
|
3008
|
+
},
|
|
3009
|
+
});
|
|
3010
|
+
const aiOsDashboardCommand = defineCommand({
|
|
3011
|
+
meta: { name: 'dashboard', description: 'Summarize AI OS runtime run reports and verification health' },
|
|
3012
|
+
args: {
|
|
3013
|
+
dir: { type: 'string', default: PROJECT_DIR, description: 'Project directory' },
|
|
3014
|
+
limit: { type: 'string', description: 'Maximum latest run rows to include' },
|
|
3015
|
+
json: { type: 'boolean', default: false },
|
|
3016
|
+
},
|
|
3017
|
+
run({ args }) {
|
|
3018
|
+
const projectDir = resolve(String(args.dir ?? PROJECT_DIR));
|
|
3019
|
+
const scaleDir = resolveScaleDirForProject(projectDir);
|
|
3020
|
+
const dashboard = createAiOsDashboard({
|
|
3021
|
+
projectDir,
|
|
3022
|
+
scaleDir,
|
|
3023
|
+
limit: parsePositiveIntArg(args.limit, '--limit'),
|
|
3024
|
+
});
|
|
3025
|
+
if (args.json) {
|
|
3026
|
+
console.log(JSON.stringify(dashboard, null, 2));
|
|
3027
|
+
return;
|
|
3028
|
+
}
|
|
3029
|
+
console.log('SCALE AI OS Dashboard');
|
|
3030
|
+
console.log(` Health: ${dashboard.health.status} (${dashboard.health.score})`);
|
|
3031
|
+
console.log(` Runs: ${dashboard.summary.totalRuns} total, ${dashboard.summary.readyRuns} ready, ${dashboard.summary.blockedRuns} blocked`);
|
|
3032
|
+
console.log(` Verification: ${dashboard.summary.verificationCommands} command(s), ${dashboard.summary.failedVerificationCommands} failed`);
|
|
3033
|
+
console.log(` Failure learning: ${dashboard.summary.failureLearningCandidates} candidate(s)`);
|
|
3034
|
+
for (const run of dashboard.latestRuns) {
|
|
3035
|
+
console.log(` [${run.status}] ${run.taskId ?? 'n/a'} ${run.task}`);
|
|
3036
|
+
}
|
|
3037
|
+
for (const recommendation of dashboard.recommendations)
|
|
3038
|
+
console.log(` recommendation: ${recommendation}`);
|
|
3039
|
+
for (const warning of dashboard.warnings)
|
|
3040
|
+
console.log(` warning: ${warning}`);
|
|
3041
|
+
},
|
|
3042
|
+
});
|
|
3043
|
+
const aiOsBenchmarkCommand = defineCommand({
|
|
3044
|
+
meta: { name: 'benchmark', description: 'Run fixed AI OS beta benchmark scenarios for context, memory, skill, governance, and dashboard metrics' },
|
|
3045
|
+
args: {
|
|
3046
|
+
dir: { type: 'string', default: PROJECT_DIR, description: 'Project directory' },
|
|
3047
|
+
budget: { type: 'string', description: 'Scenario context budget' },
|
|
3048
|
+
json: { type: 'boolean', default: false },
|
|
3049
|
+
},
|
|
3050
|
+
async run({ args }) {
|
|
3051
|
+
const projectDir = resolve(String(args.dir ?? PROJECT_DIR));
|
|
3052
|
+
const scaleDir = resolveScaleDirForProject(projectDir);
|
|
3053
|
+
const benchmark = await createAiOsBenchmark({
|
|
3054
|
+
projectDir,
|
|
3055
|
+
scaleDir,
|
|
3056
|
+
budget: parsePositiveIntArg(args.budget, '--budget'),
|
|
3057
|
+
});
|
|
3058
|
+
if (args.json) {
|
|
3059
|
+
console.log(JSON.stringify(benchmark, null, 2));
|
|
3060
|
+
return;
|
|
3061
|
+
}
|
|
3062
|
+
console.log('SCALE AI OS Benchmark');
|
|
3063
|
+
console.log(` Scenarios: ${benchmark.summary.scenarios}`);
|
|
3064
|
+
console.log(` Tokens: ${benchmark.summary.totalEstimatedTokens}/${benchmark.summary.totalBudget}; saved ${benchmark.summary.totalEstimatedTokenSavings}`);
|
|
3065
|
+
console.log(` Memory items: ${benchmark.summary.totalMemoryItems}`);
|
|
3066
|
+
console.log(` Skill steps: ${benchmark.summary.totalSkillSteps} (${benchmark.summary.requiredSkillSteps} required)`);
|
|
3067
|
+
console.log(` Governance modes: ${benchmark.summary.governanceModes.join(', ') || 'none'}`);
|
|
3068
|
+
console.log(` Dashboard health: ${benchmark.dashboard.health.status}`);
|
|
3069
|
+
for (const scenario of benchmark.scenarios) {
|
|
3070
|
+
console.log(` [${scenario.governanceMode}] ${scenario.id}: tokens=${scenario.metrics.estimatedTokens}, skills=${scenario.metrics.skillSteps}, memory=${scenario.metrics.memoryItems}`);
|
|
3071
|
+
}
|
|
3072
|
+
for (const recommendation of benchmark.recommendations)
|
|
3073
|
+
console.log(` recommendation: ${recommendation}`);
|
|
3074
|
+
},
|
|
3075
|
+
});
|
|
3076
|
+
const aiOsMigrateCommand = defineCommand({
|
|
3077
|
+
meta: { name: 'migrate', description: 'Create or verify AI OS runtime state directories for this project' },
|
|
3078
|
+
args: {
|
|
3079
|
+
dir: { type: 'string', default: PROJECT_DIR, description: 'Project directory' },
|
|
3080
|
+
json: { type: 'boolean', default: false },
|
|
3081
|
+
},
|
|
3082
|
+
run({ args }) {
|
|
3083
|
+
const projectDir = resolve(String(args.dir ?? PROJECT_DIR));
|
|
3084
|
+
const scaleDir = resolveScaleDirForProject(projectDir);
|
|
3085
|
+
const report = createAiOsMigration({ projectDir, scaleDir });
|
|
3086
|
+
if (args.json) {
|
|
3087
|
+
console.log(JSON.stringify(report, null, 2));
|
|
3088
|
+
return;
|
|
3089
|
+
}
|
|
3090
|
+
console.log('SCALE AI OS Migration');
|
|
3091
|
+
console.log(` Status: ${report.status}`);
|
|
3092
|
+
console.log(` Created: ${report.created.length}`);
|
|
3093
|
+
console.log(` Existing: ${report.existing.length}`);
|
|
3094
|
+
console.log(` Report: ${report.files.migrationReport}`);
|
|
3095
|
+
for (const action of report.nextActions)
|
|
3096
|
+
console.log(` next: ${action}`);
|
|
3097
|
+
for (const warning of report.warnings)
|
|
3098
|
+
console.log(` warning: ${warning}`);
|
|
3099
|
+
},
|
|
3100
|
+
});
|
|
3101
|
+
const aiOsDoctorCommand = defineCommand({
|
|
3102
|
+
meta: { name: 'doctor', description: 'Check AI OS beta runtime readiness, dashboard health, and benchmark freshness' },
|
|
3103
|
+
args: {
|
|
3104
|
+
dir: { type: 'string', default: PROJECT_DIR, description: 'Project directory' },
|
|
3105
|
+
lang: { type: 'string', default: 'en', description: 'Output language zh/en' },
|
|
3106
|
+
'benchmark-max-age-hours': { type: 'string', description: 'Maximum accepted benchmark report age in hours' },
|
|
3107
|
+
json: { type: 'boolean', default: false },
|
|
3108
|
+
},
|
|
3109
|
+
run({ args }) {
|
|
3110
|
+
const projectDir = resolve(String(args.dir ?? PROJECT_DIR));
|
|
3111
|
+
const scaleDir = resolveScaleDirForProject(projectDir);
|
|
3112
|
+
const report = createAiOsDoctor({
|
|
3113
|
+
projectDir,
|
|
3114
|
+
scaleDir,
|
|
3115
|
+
lang: normalizeLangArg(args.lang),
|
|
3116
|
+
benchmarkMaxAgeHours: parsePositiveIntArg(args['benchmark-max-age-hours'], '--benchmark-max-age-hours'),
|
|
3117
|
+
});
|
|
3118
|
+
if (args.json) {
|
|
3119
|
+
console.log(JSON.stringify(report, null, 2));
|
|
3120
|
+
if (report.status === 'blocked')
|
|
3121
|
+
process.exitCode = 1;
|
|
3122
|
+
return;
|
|
3123
|
+
}
|
|
3124
|
+
console.log('SCALE AI OS Doctor');
|
|
3125
|
+
console.log(` Status: ${report.status}`);
|
|
3126
|
+
console.log(` Checks: ${report.summary.passedChecks} passed, ${report.summary.warningChecks} warning, ${report.summary.blockedChecks} blocked`);
|
|
3127
|
+
console.log(` Dashboard: ${report.dashboard.health.status} (${report.dashboard.health.score})`);
|
|
3128
|
+
console.log(` Benchmark: ${report.benchmark.status}`);
|
|
3129
|
+
for (const check of report.checks)
|
|
3130
|
+
console.log(` [${check.status}] ${check.id}: ${check.summary}`);
|
|
3131
|
+
for (const action of report.nextActions)
|
|
3132
|
+
console.log(` next: ${action}`);
|
|
3133
|
+
for (const warning of report.warnings)
|
|
3134
|
+
console.log(` warning: ${warning}`);
|
|
3135
|
+
if (report.status === 'blocked')
|
|
3136
|
+
process.exitCode = 1;
|
|
3137
|
+
},
|
|
3138
|
+
});
|
|
2953
3139
|
const aiOs = defineCommand({
|
|
2954
3140
|
meta: { name: 'ai-os', description: 'AI Engineering OS runtime planning and governance orchestration' },
|
|
2955
|
-
subCommands: {
|
|
3141
|
+
subCommands: {
|
|
3142
|
+
plan: aiOsPlanCommand,
|
|
3143
|
+
run: aiOsRunCommand,
|
|
3144
|
+
dashboard: aiOsDashboardCommand,
|
|
3145
|
+
benchmark: aiOsBenchmarkCommand,
|
|
3146
|
+
migrate: aiOsMigrateCommand,
|
|
3147
|
+
doctor: aiOsDoctorCommand,
|
|
3148
|
+
},
|
|
2956
3149
|
});
|
|
2957
3150
|
// ============================================================================
|
|
2958
3151
|
// upgrade command - Safe workflow/template/capability update planning
|
|
@@ -2967,8 +3160,10 @@ const upgradeCheck = defineCommand({
|
|
|
2967
3160
|
},
|
|
2968
3161
|
run({ args }) {
|
|
2969
3162
|
const lang = normalizeLangArg(args.lang);
|
|
3163
|
+
const projectDir = resolve(String(args.dir ?? PROJECT_DIR));
|
|
2970
3164
|
const report = createUpgradeCheckReport({
|
|
2971
|
-
projectDir
|
|
3165
|
+
projectDir,
|
|
3166
|
+
scaleDir: resolveScaleDirForProject(projectDir),
|
|
2972
3167
|
targetScaleVersion: args['target-version'] ? String(args['target-version']) : undefined,
|
|
2973
3168
|
});
|
|
2974
3169
|
if (args.json) {
|
|
@@ -2983,6 +3178,7 @@ const upgradeCheck = defineCommand({
|
|
|
2983
3178
|
console.log(` 治理包: ${report.governancePack.id ?? '无'} v${report.governancePack.currentVersion ?? '无'} -> v${report.governancePack.latestVersion ?? '无'}`);
|
|
2984
3179
|
console.log(` 受管生成文件: ${report.generatedFiles.clean} 个干净, ${report.generatedFiles.changed} 个本地改动, ${report.generatedFiles.missing} 个缺失`);
|
|
2985
3180
|
console.log(` 第三方能力策略: ${report.thirdParty.policy}; 需要人工审查: ${report.thirdParty.reviewRequired}`);
|
|
3181
|
+
console.log(` AI OS Runtime: ${report.aiOsRuntime.status}`);
|
|
2986
3182
|
console.log(' 下一步:');
|
|
2987
3183
|
}
|
|
2988
3184
|
else {
|
|
@@ -2993,6 +3189,7 @@ const upgradeCheck = defineCommand({
|
|
|
2993
3189
|
console.log(` Governance pack: ${report.governancePack.id ?? 'none'} v${report.governancePack.currentVersion ?? 'none'} -> v${report.governancePack.latestVersion ?? 'none'}`);
|
|
2994
3190
|
console.log(` Generated files: ${report.generatedFiles.clean} clean, ${report.generatedFiles.changed} changed, ${report.generatedFiles.missing} missing`);
|
|
2995
3191
|
console.log(` Third-party policy: ${report.thirdParty.policy}; review required: ${report.thirdParty.reviewRequired}`);
|
|
3192
|
+
console.log(` AI OS Runtime: ${report.aiOsRuntime.status}`);
|
|
2996
3193
|
console.log(' Next:');
|
|
2997
3194
|
}
|
|
2998
3195
|
for (const command of report.recommendedCommands)
|
|
@@ -3010,8 +3207,10 @@ const upgradePlan = defineCommand({
|
|
|
3010
3207
|
},
|
|
3011
3208
|
run({ args }) {
|
|
3012
3209
|
const lang = normalizeLangArg(args.lang);
|
|
3210
|
+
const projectDir = resolve(String(args.dir ?? PROJECT_DIR));
|
|
3013
3211
|
const report = createUpgradePlanReport({
|
|
3014
|
-
projectDir
|
|
3212
|
+
projectDir,
|
|
3213
|
+
scaleDir: resolveScaleDirForProject(projectDir),
|
|
3015
3214
|
targetScaleVersion: args['target-version'] ? String(args['target-version']) : undefined,
|
|
3016
3215
|
});
|
|
3017
3216
|
const htmlPath = args.html ? writeUpgradePlanHtml(report, undefined, lang) : undefined;
|
|
@@ -3056,8 +3255,10 @@ const upgradeApply = defineCommand({
|
|
|
3056
3255
|
},
|
|
3057
3256
|
run({ args }) {
|
|
3058
3257
|
const lang = normalizeLangArg(args.lang);
|
|
3258
|
+
const projectDir = resolve(String(args.dir ?? PROJECT_DIR));
|
|
3059
3259
|
const result = applyUpgradePlan({
|
|
3060
|
-
projectDir
|
|
3260
|
+
projectDir,
|
|
3261
|
+
scaleDir: resolveScaleDirForProject(projectDir),
|
|
3061
3262
|
confirm: isTruthyFlag(args.confirm),
|
|
3062
3263
|
});
|
|
3063
3264
|
if (args.json) {
|
|
@@ -5048,6 +5249,14 @@ function parseToolIds(value) {
|
|
|
5048
5249
|
function parseCommaList(value) {
|
|
5049
5250
|
return parseToolIds(value) ?? [];
|
|
5050
5251
|
}
|
|
5252
|
+
function normalizeAiOsRunMode(value, forceDryRun = false) {
|
|
5253
|
+
if (forceDryRun)
|
|
5254
|
+
return 'dry-run';
|
|
5255
|
+
const normalized = String(value ?? 'dry-run').trim().toLowerCase();
|
|
5256
|
+
if (normalized === 'dry-run' || normalized === 'guarded')
|
|
5257
|
+
return normalized;
|
|
5258
|
+
throw new Error(`Invalid AI OS run mode "${String(value)}"; expected dry-run or guarded.`);
|
|
5259
|
+
}
|
|
5051
5260
|
function createToolExecutionPlanFromArgs(args) {
|
|
5052
5261
|
const projectDir = resolve(String(args.dir ?? PROJECT_DIR));
|
|
5053
5262
|
const level = normalizeTaskArtifactLevel(args.level ?? 'M');
|