superlab 0.1.10 → 0.1.12

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 CHANGED
@@ -149,6 +149,36 @@ superlab doctor
149
149
  - LaTeX-first paper output layout under `<deliverables_root>/paper/`
150
150
  - boundary violations such as durable run outputs stored under `.lab/changes/*/runs`
151
151
 
152
+ ## Auto Mode
153
+
154
+ First fill `.lab/context/auto-mode.md` with the bounded contract, the per-stage commands, the stage output contracts, and the policy check commands for the campaign, then arm it for the current project:
155
+
156
+ ```bash
157
+ superlab auto start
158
+ ```
159
+
160
+ Inspect the live auto-mode state:
161
+
162
+ ```bash
163
+ superlab auto status
164
+ ```
165
+
166
+ Stop the current auto-mode run:
167
+
168
+ ```bash
169
+ superlab auto stop
170
+ ```
171
+
172
+ `/lab:auto` is an orchestration mode layered on top of approved execution stages. It reuses `run`, `iterate`, `review`, `report`, and optional `write` inside the limits defined by `.lab/context/auto-mode.md` and `.lab/context/auto-status.md`. `superlab auto start` runs the configured stage commands in the foreground, polls for completion, enforces `success/stop/promotion` check commands, guards the configured frozen core, and validates stage-specific contracts:
173
+
174
+ - `run` and `iterate` must change persistent outputs under `results_root`
175
+ - `review` must update canonical review context
176
+ - `report` must write `<deliverables_root>/report.md`
177
+ - `write` must produce LaTeX output under `<deliverables_root>/paper/`
178
+ - a successful promotion must write back into `.lab/context/data-decisions.md`, `.lab/context/decisions.md`, `.lab/context/state.md`, and `.lab/context/session-brief.md`
179
+
180
+ It does not replace manual `idea`, `data`, `framing`, or `spec` decisions.
181
+
152
182
  ## Version
153
183
 
154
184
  Show the CLI version and the current project asset version:
@@ -207,6 +237,7 @@ Stages should follow that file rather than guess language locally.
207
237
  - `/lab:idea` researches an idea, critiques it, and writes the initial research framing.
208
238
  - `/lab:data` turns the approved idea into a dataset and benchmark package with years, paper usage, source audit, download plans, explicit benchmark-role rationale for classic-public, recent-strong-public, and claim-specific benchmarks, and explicit comparison rationale for canonical baselines, strong historical baselines, recent strong public methods, and closest prior work.
209
239
  - `/lab:framing` locks paper-facing method names, module names, titles, and contribution wording before drafting.
240
+ - `/lab:auto` orchestrates approved `run`, `iterate`, `review`, `report`, and optional `write` stages inside a bounded contract and can promote exploratory additions to the primary package when the promotion policy is satisfied.
210
241
  - `/lab:spec` converts the approved idea into one `.lab/changes/<change-id>/` directory.
211
242
  - `/lab:run` executes a small-scale validation run and establishes the evaluation pipeline.
212
243
  - Durable run outputs should go under the configured `results_root`, not `.lab/changes/`.
package/README.zh-CN.md CHANGED
@@ -147,6 +147,36 @@ superlab doctor
147
147
  - `<deliverables_root>/paper/` 下是否仍然满足 LaTeX-first 输出约束
148
148
  - 是否把长期 run 输出错误地堆在 `.lab/changes/*/runs`
149
149
 
150
+ ## 自动模式
151
+
152
+ 先填写 `.lab/context/auto-mode.md`,明确本次自治执行的边界契约、各阶段命令、阶段产物约束,以及 success/stop/promotion 的检查命令,再启动当前项目的自动模式:
153
+
154
+ ```bash
155
+ superlab auto start
156
+ ```
157
+
158
+ 查看自动模式当前状态:
159
+
160
+ ```bash
161
+ superlab auto status
162
+ ```
163
+
164
+ 停止当前自动模式:
165
+
166
+ ```bash
167
+ superlab auto stop
168
+ ```
169
+
170
+ `/lab:auto` 是叠加在现有执行阶段之上的编排模式。它会在 `.lab/context/auto-mode.md` 和 `.lab/context/auto-status.md` 的约束下,复用 `run`、`iterate`、`review`、`report`,以及可选的 `write`。`superlab auto start` 会在前台执行这些已配置阶段命令、轮询完成情况,并真正执行 success/stop/promotion 检查命令,同时保护已声明的 frozen core,并校验各阶段的产物约束:
171
+
172
+ - `run` 和 `iterate` 必须更新 `results_root` 下的持久输出
173
+ - `review` 必须更新规范的审查上下文
174
+ - `report` 必须写出 `<deliverables_root>/report.md`
175
+ - `write` 必须写出 `<deliverables_root>/paper/` 下的 LaTeX 论文产物
176
+ - promotion 成功后必须写回 `.lab/context/data-decisions.md`、`.lab/context/decisions.md`、`.lab/context/state.md` 和 `.lab/context/session-brief.md`
177
+
178
+ 它不会替代手动的 `idea`、`data`、`framing`、`spec` 决策。
179
+
150
180
  ## 版本查询
151
181
 
152
182
  查看当前 CLI 版本和当前目录项目的资产版本:
@@ -205,6 +235,7 @@ superlab init --lang en
205
235
  - `/lab:idea` 调研 idea、文献、数据集、指标和 baseline,并输出初始方案。
206
236
  - `/lab:data` 把已批准的 idea 收敛成数据集与 benchmark 方案,要求记录年份、使用论文、来源审计、下载计划,并明确 classic-public、recent-strong-public、claim-specific 三类 benchmark 的纳入理由,以及 canonical baselines、strong historical baselines、recent strong public methods、closest prior work 四类对比方法的纳入理由。
207
237
  - `/lab:framing` 在正式写作前收紧方法名、模块名、论文题目和 contribution wording。
238
+ - `/lab:auto` 在已批准边界内编排 `run`、`iterate`、`review`、`report` 和可选 `write`,并在升格策略满足时允许把 exploratory additions 自动升级为 primary package。
208
239
  - `/lab:spec` 把批准后的方案转换成一个统一的 `.lab/changes/<change-id>/` 目录。
209
240
  - `/lab:run` 执行最小可运行实验,并建立首版评估链路。
210
241
  - 持久 run 输出应写到 `results_root`,不要写进 `.lab/changes/`。
package/bin/superlab.cjs CHANGED
@@ -15,6 +15,11 @@ const {
15
15
  pruneContext,
16
16
  refreshContext,
17
17
  } = require("../lib/context.cjs");
18
+ const {
19
+ getAutoStatus,
20
+ startAutoMode,
21
+ stopAutoMode,
22
+ } = require("../lib/auto.cjs");
18
23
  const { promptSelect } = require("../lib/init_tui.cjs");
19
24
 
20
25
  function restartReminder(lang) {
@@ -31,6 +36,9 @@ Usage:
31
36
  superlab init [--target <dir>] [--platform codex|claude|both|all] [--lang en|zh] [--force]
32
37
  superlab install [--target <dir>] [--platform codex|claude|both|all] [--lang en|zh] [--force]
33
38
  superlab paper attach-template --path <dir> [--target <dir>]
39
+ superlab auto start [--target <dir>]
40
+ superlab auto status [--target <dir>]
41
+ superlab auto stop [--target <dir>]
34
42
  superlab update [--target <dir>]
35
43
  superlab update --all-projects
36
44
  superlab version [--target <dir>] [--global|--project]
@@ -44,6 +52,7 @@ Commands:
44
52
  init Initialize /lab commands, skills, templates, and scripts in a target
45
53
  install Backward-compatible alias for init
46
54
  paper Attach and validate a user-provided LaTeX template directory
55
+ auto Manage the bounded auto-mode contract and live state
47
56
  update Refresh an initialized project or all registered projects
48
57
  version Show installed CLI version and project asset version
49
58
  handoff Print the minimal context handoff bundle for a project
@@ -205,6 +214,17 @@ function parsePaperArgs(argv) {
205
214
  return options;
206
215
  }
207
216
 
217
+ function parseAutoArgs(argv) {
218
+ const [action, ...rest] = argv;
219
+ if (!["start", "status", "stop"].includes(action || "")) {
220
+ throw new Error(`Unknown auto action: ${action || "(missing)"}`);
221
+ }
222
+ return {
223
+ action,
224
+ ...parseTargetOnlyArgs(rest),
225
+ };
226
+ }
227
+
208
228
  function printVersion(options) {
209
229
  const lines = [];
210
230
  if (!options.projectOnly) {
@@ -539,6 +559,17 @@ function validateDataDecisions(targetDir) {
539
559
  return [`missing dataset rationale fields: ${missing.join(", ")}`];
540
560
  }
541
561
 
562
+ function printAutoStatus(options) {
563
+ const { mode, status, issues } = getAutoStatus({ targetDir: options.targetDir });
564
+ console.log(`target: ${options.targetDir}`);
565
+ console.log(`status: ${status.status || "idle"}`);
566
+ console.log(`objective: ${mode.objective || "TBD"}`);
567
+ console.log(`allowed stages: ${mode.allowedStages.join(", ") || "TBD"}`);
568
+ console.log(`current stage: ${status.currentStage || "TBD"}`);
569
+ console.log(`decision: ${status.decision || "TBD"}`);
570
+ console.log(`issues: ${issues.length > 0 ? issues.join(" | ") : "none"}`);
571
+ }
572
+
542
573
  function attachPaperTemplate({ targetDir, templatePath }) {
543
574
  const configPath = path.join(targetDir, ".lab", "config", "workflow.json");
544
575
  if (!fs.existsSync(configPath)) {
@@ -708,6 +739,8 @@ function printDoctor(options) {
708
739
  ".lab/context/evidence-index.md",
709
740
  ".lab/context/open-questions.md",
710
741
  ".lab/context/data-decisions.md",
742
+ ".lab/context/auto-mode.md",
743
+ ".lab/context/auto-status.md",
711
744
  ".lab/context/terminology-lock.md",
712
745
  ".lab/context/summary.md",
713
746
  ".lab/context/next-action.md",
@@ -721,6 +754,8 @@ function printDoctor(options) {
721
754
  const templateIssues = validatePaperTemplateRoot(options.targetDir, config);
722
755
  const dataDecisionIssues = validateDataDecisions(options.targetDir);
723
756
  const rootIssues = validateProjectRoots(options.targetDir, config);
757
+ const autoStatus = getAutoStatus({ targetDir: options.targetDir });
758
+ const autoIssues = autoStatus.issues;
724
759
 
725
760
  if (projectInfo.status === "missing") {
726
761
  console.log("status: missing");
@@ -735,7 +770,8 @@ function printDoctor(options) {
735
770
  deliverableIssues.length > 0 ||
736
771
  templateIssues.length > 0 ||
737
772
  dataDecisionIssues.length > 0 ||
738
- rootIssues.length > 0
773
+ rootIssues.length > 0 ||
774
+ autoIssues.length > 0
739
775
  ) {
740
776
  console.log("status: degraded");
741
777
  console.log(`target: ${options.targetDir}`);
@@ -744,7 +780,7 @@ function printDoctor(options) {
744
780
  console.log(`language: ${projectInfo.lang}`);
745
781
  console.log(`missing: ${missing.length > 0 ? missing.join(", ") : "none"}`);
746
782
  console.log(`config: ${configIssues.length > 0 ? configIssues.join(" | ") : "none"}`);
747
- const outputIssues = deliverableIssues.concat(templateIssues, dataDecisionIssues, rootIssues);
783
+ const outputIssues = deliverableIssues.concat(templateIssues, dataDecisionIssues, rootIssues, autoIssues);
748
784
  console.log(`outputs: ${outputIssues.length > 0 ? outputIssues.join(" | ") : "none"}`);
749
785
  return;
750
786
  }
@@ -811,7 +847,7 @@ async function main() {
811
847
  return;
812
848
  }
813
849
 
814
- if (!["init", "install", "paper", "update", "version", "handoff", "doctor", "context"].includes(command)) {
850
+ if (!["init", "install", "paper", "auto", "update", "version", "handoff", "doctor", "context"].includes(command)) {
815
851
  throw new Error(`Unknown command: ${command}`);
816
852
  }
817
853
 
@@ -859,6 +895,27 @@ async function main() {
859
895
  return;
860
896
  }
861
897
 
898
+ if (command === "auto") {
899
+ const options = parseAutoArgs(rest);
900
+ if (options.action === "status") {
901
+ printAutoStatus(options);
902
+ return;
903
+ }
904
+ if (options.action === "start") {
905
+ const result = await startAutoMode({ targetDir: options.targetDir });
906
+ const verb = result.status.status === "stopped" ? "stopped" : "completed";
907
+ console.log(`auto mode ${verb} in ${options.targetDir}`);
908
+ console.log(`objective: ${result.mode.objective}`);
909
+ console.log(`stages executed: ${result.executedStages.join(", ")}`);
910
+ console.log(`status: ${result.status.status}`);
911
+ return;
912
+ }
913
+ const status = stopAutoMode({ targetDir: options.targetDir });
914
+ console.log(`auto mode stopped in ${options.targetDir}`);
915
+ console.log(`status: ${status.status}`);
916
+ return;
917
+ }
918
+
862
919
  if (command === "update") {
863
920
  const options = parseUpdateArgs(rest);
864
921
  if (options.allProjects) {