@yiyi_zhang/laoshi 0.2.0-beta.2 → 0.2.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.
Files changed (90) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/adapters/dsh/plugin/index.mjs +1 -1
  3. package/adapters/dsh/plugin/package.json +1 -1
  4. package/adapters/mogao/adapter.ts +1 -0
  5. package/adapters/mogao/mogao-runtime.ts +73 -28
  6. package/adapters/mogao/skill/setup.md +6 -0
  7. package/adapters/paseo/plugin/package.json +1 -1
  8. package/bin/ensure-version.mjs +60 -0
  9. package/bin/req-doctor.mjs +5 -0
  10. package/bin/req.mjs +8 -0
  11. package/bin/start-pipeline.mjs +5 -0
  12. package/docs/design/builtin-capabilities.md +2 -2
  13. package/docs/design/cli-adapter.md +1 -1
  14. package/docs/design/dsh-adapter.md +2 -2
  15. package/docs/guide//345/234/250/346/221/270/351/253/230/344/270/212/344/275/277/347/224/250.md +2 -1
  16. package/docs/guide//347/273/264/346/212/244/350/200/205/346/214/207/345/215/227.md +36 -6
  17. package/engine/prompts/00-shared-context.md +7 -0
  18. package/engine/prompts/03-design.md +2 -0
  19. package/engine/prompts/04-design-review.md +5 -1
  20. package/engine/skill-fragments/defaults.md +5 -0
  21. package/engine/src/diagnose.ts +238 -0
  22. package/engine/src/launch.ts +18 -4
  23. package/engine/src/pipeline.ts +12 -1
  24. package/engine/src/platform.ts +6 -0
  25. package/engine/src/skills-render.ts +10 -1
  26. package/package.json +1 -1
  27. package/site-dist/404.html +2 -2
  28. package/site-dist/assets/{app.D2ywvSfZ.js → app.BxNgGFu-.js} +1 -1
  29. package/site-dist/assets/changelog.md.D0PzSXw9.js +1 -0
  30. package/site-dist/assets/{changelog.md.EDul9PkX.lean.js → changelog.md.D0PzSXw9.lean.js} +1 -1
  31. package/site-dist/assets/chunks/@localSearchIndexroot.vA-yiw-8.js +1 -0
  32. package/site-dist/assets/chunks/{VPLocalSearchBox.ClWffKqN.js → VPLocalSearchBox.Dw_fzw9V.js} +1 -1
  33. package/site-dist/assets/chunks/{theme.tbt16E5a.js → theme.CwrnT4KI.js} +2 -2
  34. package/site-dist/assets/{guide_getting-started.md.qAp5hWCl.js → guide_getting-started.md.CjzysdDe.js} +1 -1
  35. package/site-dist/assets/guide_maintainer.md.CvqvRle1.js +1 -0
  36. package/site-dist/assets/guide_maintainer.md.CvqvRle1.lean.js +1 -0
  37. package/site-dist/assets/{guide_mogao.md.S0eln1Pr.js → guide_mogao.md.TCu3lgE9.js} +2 -2
  38. package/site-dist/assets/{guide_mogao.md.S0eln1Pr.lean.js → guide_mogao.md.TCu3lgE9.lean.js} +2 -2
  39. package/site-dist/assets/{reference_design_builtin-capabilities.md.CZYtjo_v.lean.js → reference_design_builtin-capabilities.md.k5NXkESv.js} +2 -2
  40. package/site-dist/assets/{reference_design_builtin-capabilities.md.CZYtjo_v.js → reference_design_builtin-capabilities.md.k5NXkESv.lean.js} +2 -2
  41. package/site-dist/assets/{reference_design_cli-adapter.md.pJy3x6Un.js → reference_design_cli-adapter.md.C1lcDATP.js} +1 -1
  42. package/site-dist/assets/{reference_design_cli-adapter.md.pJy3x6Un.lean.js → reference_design_cli-adapter.md.C1lcDATP.lean.js} +1 -1
  43. package/site-dist/changelog.html +5 -5
  44. package/site-dist/guide/cli.html +4 -4
  45. package/site-dist/guide/dsh.html +4 -4
  46. package/site-dist/guide/getting-started.html +5 -5
  47. package/site-dist/guide/how-it-works.html +4 -4
  48. package/site-dist/guide/index.html +4 -4
  49. package/site-dist/guide/install.html +4 -4
  50. package/site-dist/guide/intranet.html +4 -4
  51. package/site-dist/guide/maintainer.html +5 -5
  52. package/site-dist/guide/mogao.html +7 -7
  53. package/site-dist/guide/phases.html +4 -4
  54. package/site-dist/guide/project.html +4 -4
  55. package/site-dist/guide/user.html +4 -4
  56. package/site-dist/hashmap.json +1 -1
  57. package/site-dist/index.html +4 -4
  58. package/site-dist/reference/adr/0001-new-repo-core-and-adapters.html +4 -4
  59. package/site-dist/reference/adr/0002-two-orchestration-modes.html +4 -4
  60. package/site-dist/reference/adr/0003-generate-once-then-lock.html +4 -4
  61. package/site-dist/reference/adr/0004-external-contracts-stay-stable.html +4 -4
  62. package/site-dist/reference/adr/0005-skill-names.html +4 -4
  63. package/site-dist/reference/adr/0006-deterministic-engine-platform-capabilities.html +4 -4
  64. package/site-dist/reference/adr/0007-one-install-many-repos.html +4 -4
  65. package/site-dist/reference/adr/0008-capability-sources-and-platform-plugin.html +4 -4
  66. package/site-dist/reference/adr/index.html +4 -4
  67. package/site-dist/reference/commands.html +4 -4
  68. package/site-dist/reference/config.html +4 -4
  69. package/site-dist/reference/contracts/agent-runtime.html +4 -4
  70. package/site-dist/reference/contracts/cli-json.html +4 -4
  71. package/site-dist/reference/contracts/feature-files.html +4 -4
  72. package/site-dist/reference/contracts/index.html +4 -4
  73. package/site-dist/reference/contracts/notifier-event.html +4 -4
  74. package/site-dist/reference/contracts/result-file.html +4 -4
  75. package/site-dist/reference/contracts/spec.html +4 -4
  76. package/site-dist/reference/contracts/state.html +4 -4
  77. package/site-dist/reference/contracts/usage-record.html +4 -4
  78. package/site-dist/reference/contracts/verify.html +4 -4
  79. package/site-dist/reference/design/adapter-guide.html +4 -4
  80. package/site-dist/reference/design/architecture.html +4 -4
  81. package/site-dist/reference/design/builtin-capabilities.html +6 -6
  82. package/site-dist/reference/design/cli-adapter.html +5 -5
  83. package/site-dist/reference/design/platform-vocabulary.html +4 -4
  84. package/site-dist/reference/scope.html +4 -4
  85. package/skills/laoshi/SKILL.md +1 -3
  86. package/site-dist/assets/changelog.md.EDul9PkX.js +0 -1
  87. package/site-dist/assets/chunks/@localSearchIndexroot.Dr_jsw66.js +0 -1
  88. package/site-dist/assets/guide_maintainer.md.Da1ffqxm.js +0 -1
  89. package/site-dist/assets/guide_maintainer.md.Da1ffqxm.lean.js +0 -1
  90. /package/site-dist/assets/{guide_getting-started.md.qAp5hWCl.lean.js → guide_getting-started.md.CjzysdDe.lean.js} +0 -0
@@ -0,0 +1,238 @@
1
+ // `laoshi diagnose <需求> [--out <目录>]`: collects a redacted diagnostic bundle for a requirement
2
+ // (state, pipeline log tail, step results, step agent outputs/events, sanitized config, environment)
3
+ // so users can hand one clean folder to maintainers for troubleshooting.
4
+
5
+ import fs from "node:fs";
6
+ import os from "node:os";
7
+ import path from "node:path";
8
+ import { fileURLToPath } from "node:url";
9
+ import { locate } from "./api.js";
10
+ import { DEFAULT_CONFIG, loadConfig, type PipelineConfig } from "./config.js";
11
+ import { defaultConfigPath, kitHome, kitVersion } from "./locations.js";
12
+ import { type PipelineState, readState, statePath } from "./state.js";
13
+
14
+ const MAX_LOG_BYTES = 200 * 1024;
15
+ const MAX_AGENT_FILE_BYTES = 64 * 1024;
16
+
17
+ /** Redacts credentials, tokens, private keys, and secret environment variables from diagnostic text. */
18
+ export function redactText(text: string): string {
19
+ return text
20
+ .replace(/-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z0-9 ]*PRIVATE KEY-----/g, "-----BEGIN PRIVATE KEY-----\n***REDACTED***\n-----END PRIVATE KEY-----")
21
+ .replace(/(authorization["']?\s*[:=]\s*["']?(?:bearer\s+|basic\s+)?)[^\s"',}]+/gi, "$1***")
22
+ .replace(/\b(bearer\s+)[A-Za-z0-9._~+/=-]{8,}/gi, "$1***")
23
+ .replace(/((?:token|secret|password|passwd|pwd|api[_-]?key|access[_-]?key|private[_-]?key|client[_-]?secret|credential|cookie)[A-Za-z0-9_.-]*["']?\s*[:=]\s*["']?)[^\s"',;)}]{4,}/gi, "$1***")
24
+ .replace(/\b([A-Z][A-Z0-9_]*(?:TOKEN|KEY|SECRET|PASSWORD|PASSWD|CREDENTIAL)[A-Z0-9_]*=)\S+/g, "$1***")
25
+ .replace(/\b(sk-[A-Za-z0-9_-]{16,}|gh[pous]_[A-Za-z0-9]{16,}|github_pat_[A-Za-z0-9_]{16,}|AKIA[0-9A-Z]{16}|xox[baprs]-[A-Za-z0-9-]{12,})\b/g, "***");
26
+ }
27
+
28
+ function readTail(file: string, maxBytes: number): string | null {
29
+ if (!fs.existsSync(file)) return null;
30
+ const stat = fs.statSync(file);
31
+ if (!stat.isFile()) return null;
32
+ if (stat.size <= maxBytes) return fs.readFileSync(file, "utf8");
33
+ const fd = fs.openSync(file, "r");
34
+ try {
35
+ const buf = Buffer.alloc(maxBytes);
36
+ fs.readSync(fd, buf, 0, maxBytes, stat.size - maxBytes);
37
+ return `...[已截断前 ${stat.size - maxBytes} 字节]...\n${buf.toString("utf8")}`;
38
+ } finally {
39
+ fs.closeSync(fd);
40
+ }
41
+ }
42
+
43
+ function writeRedacted(dest: string, content: string): void {
44
+ fs.mkdirSync(path.dirname(dest), { recursive: true });
45
+ fs.writeFileSync(dest, redactText(content), "utf8");
46
+ }
47
+
48
+ function sanitizeJson(value: unknown): unknown {
49
+ if (typeof value === "string") return redactText(value);
50
+ if (Array.isArray(value)) return value.map(sanitizeJson);
51
+ if (value && typeof value === "object") {
52
+ const out: Record<string, unknown> = {};
53
+ for (const [k, v] of Object.entries(value)) {
54
+ if (/(token|secret|password|passwd|api[_-]?key|access[_-]?key|private[_-]?key|credential|cookie)/i.test(k) && typeof v === "string" && v.length > 0) {
55
+ out[k] = "***";
56
+ } else {
57
+ out[k] = sanitizeJson(v);
58
+ }
59
+ }
60
+ return out;
61
+ }
62
+ return value;
63
+ }
64
+
65
+ function collectAgentIds(state: PipelineState | null): string[] {
66
+ if (!state) return [];
67
+ const ids = new Set<string>();
68
+ for (const step of state.history ?? []) {
69
+ if (step.agentId) ids.add(step.agentId);
70
+ }
71
+ if (state.waitingPermission?.agentId) ids.add(state.waitingPermission.agentId);
72
+ return [...ids];
73
+ }
74
+
75
+ export interface DiagnoseOptions {
76
+ repo: string;
77
+ featureDir: string;
78
+ home?: string;
79
+ config?: PipelineConfig;
80
+ configSources?: string[];
81
+ outDir?: string;
82
+ now?: Date;
83
+ }
84
+
85
+ export interface DiagnoseResult {
86
+ outDir: string;
87
+ files: string[];
88
+ agentCount: number;
89
+ }
90
+
91
+ /** Collects a redacted diagnostic bundle directory for one requirement. */
92
+ export function collectDiagnoseBundle(options: DiagnoseOptions): DiagnoseResult {
93
+ const home = options.home ?? kitHome();
94
+ const featureName = path.basename(options.featureDir);
95
+ const stamp = (options.now ?? new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19);
96
+ const outDir = path.resolve(options.outDir ?? path.join(home, "diagnose", `${featureName}-${stamp}`));
97
+ fs.mkdirSync(outDir, { recursive: true });
98
+
99
+ const files: string[] = [];
100
+ const record = (rel: string, content: string) => {
101
+ writeRedacted(path.join(outDir, rel), content);
102
+ files.push(rel);
103
+ };
104
+
105
+ const pipelineDir = path.join(options.repo, options.featureDir, ".pipeline");
106
+ const stateFile = statePath(options.repo, options.featureDir);
107
+ const state = readState(stateFile);
108
+ if (fs.existsSync(stateFile)) {
109
+ record("state.json", fs.readFileSync(stateFile, "utf8"));
110
+ }
111
+
112
+ const logTail = readTail(path.join(pipelineDir, "pipeline.log"), MAX_LOG_BYTES);
113
+ if (logTail !== null) {
114
+ record("pipeline.log", logTail);
115
+ }
116
+
117
+ const resultsDir = path.join(pipelineDir, "results");
118
+ if (fs.existsSync(resultsDir) && fs.statSync(resultsDir).isDirectory()) {
119
+ for (const entry of fs.readdirSync(resultsDir).sort()) {
120
+ const full = path.join(resultsDir, entry);
121
+ if (fs.statSync(full).isFile() && entry.endsWith(".json")) {
122
+ record(path.posix.join("results", entry), fs.readFileSync(full, "utf8"));
123
+ }
124
+ }
125
+ }
126
+
127
+ const adapter = state?.adapter?.id ?? options.config?.platform?.adapter ?? "default";
128
+ const agentIds = collectAgentIds(state);
129
+ let agentCount = 0;
130
+ const agentsRoot = path.join(home, adapter, "agents");
131
+ if (fs.existsSync(agentsRoot) && fs.statSync(agentsRoot).isDirectory()) {
132
+ for (const id of agentIds) {
133
+ const dir = path.join(agentsRoot, id);
134
+ if (!fs.existsSync(dir) || !fs.statSync(dir).isDirectory()) continue;
135
+ agentCount++;
136
+ for (const entry of fs.readdirSync(dir).sort()) {
137
+ const full = path.join(dir, entry);
138
+ if (!fs.statSync(full).isFile()) continue;
139
+ if (entry === "agent.json" || entry === "decision.json" || entry.endsWith(".txt") || entry.endsWith(".md") || entry === "events.jsonl" || /^run-\d+\.(out|err)$/.test(entry)) {
140
+ const limit = entry === "events.jsonl" ? MAX_LOG_BYTES : MAX_AGENT_FILE_BYTES;
141
+ const text = readTail(full, limit);
142
+ if (text !== null) record(path.posix.join("agents", id, entry), text);
143
+ }
144
+ }
145
+ }
146
+ }
147
+
148
+ if (options.config) {
149
+ record("config.json", `${JSON.stringify({ sources: options.configSources ?? [], config: sanitizeJson(options.config) }, null, 2)}\n`);
150
+ }
151
+
152
+ const summary = {
153
+ generatedAt: (options.now ?? new Date()).toISOString(),
154
+ laoshiVersion: kitVersion(),
155
+ nodeVersion: process.version,
156
+ platform: `${process.platform}-${process.arch}`,
157
+ hostname: os.hostname(),
158
+ adapter,
159
+ repo: options.repo,
160
+ featureDir: options.featureDir,
161
+ state: state
162
+ ? {
163
+ status: state.status,
164
+ stopKind: state.stopKind ?? null,
165
+ stopReason: state.stopReason ? redactText(state.stopReason) : null,
166
+ outcome: state.outcome ? redactText(state.outcome) : null,
167
+ branch: state.branch,
168
+ profile: state.profile,
169
+ startedAt: state.startedAt,
170
+ updatedAt: state.updatedAt,
171
+ history: (state.history ?? []).map((s) => ({
172
+ key: s.key,
173
+ attempt: s.attempt,
174
+ outcome: s.outcome,
175
+ agentId: s.agentId,
176
+ startedAt: s.startedAt,
177
+ endedAt: s.endedAt,
178
+ error: s.error ? redactText(s.error) : null,
179
+ })),
180
+ waitingPermission: state.waitingPermission ?? null,
181
+ }
182
+ : null,
183
+ agentCount,
184
+ files: [...files, "summary.json"],
185
+ };
186
+ writeRedacted(path.join(outDir, "summary.json"), `${JSON.stringify(summary, null, 2)}\n`);
187
+ files.push("summary.json");
188
+
189
+ return { outDir, files, agentCount };
190
+ }
191
+
192
+ function parseArgs(argv: string[]): { feature: string | null; outDir?: string; help: boolean } {
193
+ let feature: string | null = null;
194
+ let outDir: string | undefined;
195
+ let help = false;
196
+ for (let i = 0; i < argv.length; i++) {
197
+ const a = argv[i];
198
+ if (a === "-h" || a === "--help") help = true;
199
+ else if (a === "--out" && argv[i + 1]) outDir = argv[++i];
200
+ else if (a.startsWith("--out=")) outDir = a.slice(6);
201
+ else if (!a.startsWith("-") && !feature) feature = a;
202
+ }
203
+ return { feature, outDir, help };
204
+ }
205
+
206
+ async function main(argv: string[]): Promise<number> {
207
+ const args = parseArgs(argv);
208
+ if (args.help || !args.feature) {
209
+ console.log("用法:laoshi diagnose <需求> [--out <目录>]");
210
+ console.log("导出已脱敏的诊断包(状态、日志尾部、步骤结果、步骤输出与事件),便于发给维护者排查问题。");
211
+ return args.help ? 0 : 2;
212
+ }
213
+ const { repo, featureDir } = locate(process.cwd(), args.feature);
214
+ let config: PipelineConfig = DEFAULT_CONFIG;
215
+ let configSources: string[] = [];
216
+ try {
217
+ const loaded = loadConfig(defaultConfigPath(), repo);
218
+ config = loaded.config;
219
+ configSources = loaded.sources;
220
+ } catch {
221
+ // Use default config when install/project config is unreadable.
222
+ }
223
+ const res = collectDiagnoseBundle({ repo, featureDir, config, configSources, outDir: args.outDir });
224
+ console.log(`已生成脱敏诊断包(${res.files.length} 个文件,含 ${res.agentCount} 个步骤记录):`);
225
+ console.log(` ${res.outDir}`);
226
+ console.log("请压缩这个目录发给维护者。");
227
+ return 0;
228
+ }
229
+
230
+ if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
231
+ main(process.argv.slice(2)).then(
232
+ (code) => process.exit(code),
233
+ (error: Error) => {
234
+ console.error(`生成诊断包失败:${error.message}`);
235
+ process.exit(1);
236
+ },
237
+ );
238
+ }
@@ -439,9 +439,11 @@ console.log(
439
439
  checked.branch ? `工作分支:${checked.branch}` : "不是 git 仓库:步骤不会提交代码。",
440
440
  loaded.sources.length > 1 ? `使用了项目配置:${loaded.sources[1]}` : null,
441
441
  `运行日志:${logPath}`,
442
- args.originAgentId
443
- ? `进展和结果会发回 agent ${args.originAgentId} 的对话。`
444
- : "没有提供 --origin-agent,进展只写入日志。",
442
+ inChat
443
+ ? null
444
+ : args.originAgentId
445
+ ? `进展和结果会发回 agent ${args.originAgentId} 的对话。`
446
+ : "没有提供 --origin-agent,进展只写入日志。",
445
447
  ]
446
448
  .filter(Boolean)
447
449
  .join("\n"),
@@ -455,18 +457,30 @@ if (inChat) process.exit(await followInChat(child, chatOut));
455
457
  * with the chat's turn, so the chat keeps waiting for this command rather than ending its turn.
456
458
  */
457
459
  async function followInChat(engine: import("node:child_process").ChildProcess, file: string): Promise<number> {
458
- console.log("流水线在这条命令里运行,进展会显示在下面;命令结束前请不要结束这一轮对话(对话结束时运行会中断,之后用继续命令接着做)。");
460
+ // How long the command may stay quiet before it says again that the pipeline is still running.
461
+ const HEARTBEAT_MS = Number(process.env.LAOSHI_HEARTBEAT_SECONDS ?? 180) * 1000;
462
+ const started = Date.now();
463
+ const stillRunning = () =>
464
+ `【流水线仍在运行,已运行 ${Math.round((Date.now() - started) / 60_000)} 分钟】流水线在这条命令里运行,不在后台:请继续等待这条命令的输出,不要结束这一轮对话(对话结束时机器被收回,流水线会停止,不会自己继续)。`;
465
+ console.log(stillRunning().replace(/已运行 \d+ 分钟/, "刚开始"));
459
466
  let shown = 0;
467
+ let lastOutput = Date.now();
460
468
  const show = () => {
461
469
  try {
462
470
  const text = fs.readFileSync(file, "utf8");
463
471
  if (text.length > shown) {
464
472
  process.stdout.write(text.slice(shown));
465
473
  shown = text.length;
474
+ lastOutput = Date.now();
466
475
  }
467
476
  } catch {
468
477
  // Not written yet.
469
478
  }
479
+ // The chat reads this output to decide whether to keep waiting: say it again when quiet.
480
+ if (Date.now() - lastOutput >= HEARTBEAT_MS) {
481
+ console.log(stillRunning());
482
+ lastOutput = Date.now();
483
+ }
470
484
  };
471
485
  const code = await new Promise<number>((resolve) => {
472
486
  const timer = setInterval(show, 1000);
@@ -879,13 +879,24 @@ async function runStep(
879
879
  }
880
880
  }
881
881
 
882
+ /** The agent's context (its model's window) filled up: a new agent repeating the same reads fails the same way. */
883
+ const CONTEXT_FULL =
884
+ /context.{0,30}(length|window|limit|exceed|overflow|too (long|large))|maximum context|prompt is too long|too many tokens|token.{0,20}(limit|exceed)|上下文.{0,10}(超|满|过长|溢出)|超出.{0,10}上下文/i;
885
+
886
+ export function isContextFull(message: string): boolean {
887
+ return CONTEXT_FULL.test(message);
888
+ }
889
+
882
890
  /** Tells the next agent of a step that an earlier one stopped part way. */
883
891
  function withRetryNote(extras: StepExtras, message: string): StepExtras {
884
892
  return {
885
893
  ...extras,
886
894
  contextLines: [
887
895
  ...(extras.contextLines ?? []).filter((l) => !l.startsWith("自动重试:")),
888
- `自动重试:本步骤上一次中断了(${message.slice(0, 200)})。工作区里可能留有上一次没做完的改动,先用 git status 和 git diff 查看,在此基础上继续,不要重复提交`,
896
+ `自动重试:本步骤上一次中断了(${message.slice(0, 200)})。工作区里可能留有上一次没做完的改动,先用 git status 和 git diff 查看,在此基础上继续,不要重复提交` +
897
+ (isContextFull(message)
898
+ ? "。上一次是因为上下文占满而失败:这次严格按\"控制读入的内容量\"做,命令输出一律过滤后再看,不要解压或列出依赖包,先看已经写下的产物和 progress.md,接着它做,不要从头重新调查"
899
+ : ""),
889
900
  ],
890
901
  };
891
902
  }
@@ -68,6 +68,12 @@ export interface PlatformAdapter {
68
68
  * in the background: it runs in the chat's command, which shows what it tells the chat.
69
69
  */
70
70
  runsInChat?: boolean;
71
+ /**
72
+ * The skills are handed over with a fixed laoshi version (a platform's expert, installed on first
73
+ * use): every command in them carries it (LAOSHI_WANT_VERSION), and an installed laoshi of another
74
+ * version installs that one first (bin/ensure-version.mjs).
75
+ */
76
+ pinVersion?: boolean;
71
77
  /** Heading of the platform section in `doctor`. */
72
78
  doctorTitle: string;
73
79
  /** The platform section of `doctor` (connection, versions, profiles), when not --offline. */
@@ -18,6 +18,8 @@ import { type PlatformWords, renderWords } from "./words.js";
18
18
  export const SKILLS_DIR = path.join(KIT_ROOT, "skills");
19
19
  /** laoshi's own /laoshi-setup sections, for platforms whose services are laoshi's builtin ones. */
20
20
  export const BUILTIN_SETUP = path.join(ENGINE_DIR, "skill-fragments", "setup-builtin.md");
21
+ /** Sections every platform gets unless its own skill file has a block of the same name. */
22
+ export const DEFAULT_FRAGMENTS = path.join(ENGINE_DIR, "skill-fragments", "defaults.md");
21
23
 
22
24
  export interface SkillValues {
23
25
  root: string;
@@ -25,6 +27,8 @@ export interface SkillValues {
25
27
  version: string;
26
28
  words: PlatformWords;
27
29
  fragments: Record<string, string>;
30
+ /** How the skills start laoshi's scripts: "node", or with the version they need ("LAOSHI_WANT_VERSION=… node"). */
31
+ node?: string;
28
32
  }
29
33
 
30
34
  /** "<!-- fragment: name -->" blocks of a fragments file, by name. */
@@ -59,7 +63,8 @@ export function skillValues(config?: unknown, root: string = KIT_ROOT): SkillVal
59
63
  launcher: path.join(root, path.relative(KIT_ROOT, LAUNCHER)),
60
64
  version: kitVersion(),
61
65
  words: wordsFor(config),
62
- fragments: { ...builtin, ...own },
66
+ fragments: { ...parseFragments(fs.readFileSync(DEFAULT_FRAGMENTS, "utf8")), ...builtin, ...own },
67
+ node: adapter.pinVersion ? `LAOSHI_WANT_VERSION=${kitVersion()} node` : "node",
63
68
  };
64
69
  }
65
70
 
@@ -71,8 +76,12 @@ export function renderSkillText(text: string, v: SkillValues): string {
71
76
  if (!m) lines.push(line);
72
77
  else if (v.fragments[m[1]]) lines.push(v.fragments[m[1]]);
73
78
  }
79
+ const node = v.node ?? "node";
74
80
  const filled = lines
75
81
  .join("\n")
82
+ // Commands that start laoshi's own scripts (not `node -p …` and the like).
83
+ .replaceAll('node "{{REQ_KIT_ROOT}}', `${node} "{{REQ_KIT_ROOT}}`)
84
+ .replaceAll('node "{{PIPELINE_LAUNCHER}}', `${node} "{{PIPELINE_LAUNCHER}}`)
76
85
  .replaceAll("{{REQ_KIT_ROOT}}", v.root.split(path.sep).join("/"))
77
86
  .replaceAll("{{PIPELINE_LAUNCHER}}", v.launcher.split(path.sep).join("/"))
78
87
  .replaceAll("{{REQ_KIT_VERSION}}", v.version);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yiyi_zhang/laoshi",
3
- "version": "0.2.0-beta.2",
3
+ "version": "0.2.0",
4
4
  "description": "laoshi:给测试、产品、项目经理用的需求开发体系。在 agent 平台(Paseo、DeepSeek Harness)的对话中对齐需求,由一组 AI agent 在后台完成设计、实现、评审和验证。",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -9,7 +9,7 @@
9
9
  <link rel="preload stylesheet" href="/assets/style.BX2ZxxqY.css" as="style">
10
10
  <link rel="preload stylesheet" href="/vp-icons.css" as="style">
11
11
 
12
- <script type="module" src="/assets/app.D2ywvSfZ.js"></script>
12
+ <script type="module" src="/assets/app.BxNgGFu-.js"></script>
13
13
  <link rel="preload" href="/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
14
14
  <link rel="icon" type="image/svg+xml" href="/favicon.svg">
15
15
  <meta name="theme-color" content="#a8e01f">
@@ -21,7 +21,7 @@
21
21
  </head>
22
22
  <body>
23
23
  <div id="app"></div>
24
- <script>window.__VP_HASH_MAP__=JSON.parse("{\"changelog.md\":\"EDul9PkX\",\"guide_cli.md\":\"BrXllHw9\",\"guide_dsh.md\":\"0X-eYB87\",\"guide_getting-started.md\":\"qAp5hWCl\",\"guide_how-it-works.md\":\"CkvlSgxO\",\"guide_index.md\":\"D67QX_Vi\",\"guide_install.md\":\"By4WxsJG\",\"guide_intranet.md\":\"Bz0sAHK0\",\"guide_maintainer.md\":\"Da1ffqxm\",\"guide_mogao.md\":\"S0eln1Pr\",\"guide_phases.md\":\"Cw0A9Vb1\",\"guide_project.md\":\"B2cmf8YF\",\"guide_user.md\":\"B66TQvIA\",\"index.md\":\"CrBM3tiI\",\"reference_adr_0001-new-repo-core-and-adapters.md\":\"CjNHHmrf\",\"reference_adr_0002-two-orchestration-modes.md\":\"CHD05agO\",\"reference_adr_0003-generate-once-then-lock.md\":\"BaRiZfXT\",\"reference_adr_0004-external-contracts-stay-stable.md\":\"DUJ7CTV1\",\"reference_adr_0005-skill-names.md\":\"DuBVd1tl\",\"reference_adr_0006-deterministic-engine-platform-capabilities.md\":\"Dcrnx1-L\",\"reference_adr_0007-one-install-many-repos.md\":\"C78cd4_P\",\"reference_adr_0008-capability-sources-and-platform-plugin.md\":\"B4vBkIDS\",\"reference_adr_index.md\":\"Dx8sPsjs\",\"reference_commands.md\":\"BFJRjNju\",\"reference_config.md\":\"Dt_TJ2y9\",\"reference_contracts_agent-runtime.md\":\"DPE2FJFc\",\"reference_contracts_cli-json.md\":\"D6vfWOD9\",\"reference_contracts_feature-files.md\":\"9n332kF_\",\"reference_contracts_index.md\":\"B5P4FjRk\",\"reference_contracts_notifier-event.md\":\"BeR8iODP\",\"reference_contracts_result-file.md\":\"BmCaSlEu\",\"reference_contracts_spec.md\":\"CDQYgJz7\",\"reference_contracts_state.md\":\"DLygjkfs\",\"reference_contracts_usage-record.md\":\"CgfMoYp0\",\"reference_contracts_verify.md\":\"CkJy8LXk\",\"reference_design_adapter-guide.md\":\"B_P-spS5\",\"reference_design_architecture.md\":\"Bfoc-F2B\",\"reference_design_builtin-capabilities.md\":\"CZYtjo_v\",\"reference_design_cli-adapter.md\":\"pJy3x6Un\",\"reference_design_platform-vocabulary.md\":\"xWGv5QO8\",\"reference_scope.md\":\"aUo6vISB\"}");window.__VP_SITE_DATA__=JSON.parse("{\"lang\":\"zh-CN\",\"dir\":\"ltr\",\"title\":\"laoshi\",\"titleTemplate\":\":title · laoshi\",\"description\":\"在 agent 平台(Paseo、DeepSeek Harness)中用对话对齐需求,由一组 AI agent 在后台完成设计、实现、评审和验证。给测试、产品、项目经理用的需求开发体系。\",\"base\":\"/\",\"head\":[],\"router\":{\"prefetchLinks\":true},\"appearance\":true,\"themeConfig\":{\"rk\":{\"version\":\"0.2.0-beta.2\",\"beta\":true,\"releases\":4,\"stable\":2,\"adrs\":8},\"logo\":{\"light\":\"/logo-light.svg\",\"dark\":\"/logo.svg\",\"alt\":\"laoshi\"},\"siteTitle\":\"laoshi\",\"nav\":[{\"text\":\"指南\",\"link\":\"/guide/\",\"activeMatch\":\"^/guide/\"},{\"text\":\"参考\",\"link\":\"/reference/commands\",\"activeMatch\":\"^/reference/\"},{\"text\":\"更新记录\",\"link\":\"/changelog\"},{\"text\":\"v0.2.0-beta.2\",\"items\":[{\"text\":\"更新记录\",\"link\":\"/changelog\"},{\"text\":\"GitHub Releases\",\"link\":\"https://github.com/yiyisf/laoshi/releases\"},{\"text\":\"范围与取舍\",\"link\":\"/reference/scope\"}]}],\"sidebar\":{\"/guide/\":[{\"text\":\"开始\",\"items\":[{\"text\":\"laoshi 是什么\",\"link\":\"/guide/\"},{\"text\":\"快速开始\",\"link\":\"/guide/getting-started\"},{\"text\":\"工作原理\",\"link\":\"/guide/how-it-works\"}]},{\"text\":\"使用\",\"items\":[{\"text\":\"使用者指南\",\"link\":\"/guide/user\"},{\"text\":\"分阶段执行与提测\",\"link\":\"/guide/phases\"}]},{\"text\":\"安装与维护\",\"items\":[{\"text\":\"安装与升级\",\"link\":\"/guide/install\"},{\"text\":\"在 DeepSeek Harness 上使用\",\"link\":\"/guide/dsh\"},{\"text\":\"在摸高上使用\",\"link\":\"/guide/mogao\"},{\"text\":\"只用命令行 agent\",\"link\":\"/guide/cli\"},{\"text\":\"内网安装与验证\",\"link\":\"/guide/intranet\"},{\"text\":\"项目定制与运行规则\",\"link\":\"/guide/project\"},{\"text\":\"维护者指南\",\"link\":\"/guide/maintainer\"}]}],\"/reference/\":[{\"text\":\"参考\",\"items\":[{\"text\":\"命令\",\"link\":\"/reference/commands\"},{\"text\":\"配置项\",\"link\":\"/reference/config\"},{\"text\":\"范围与取舍\",\"link\":\"/reference/scope\"}]},{\"text\":\"文件格式约定\",\"collapsed\":false,\"items\":[{\"text\":\"总览\",\"link\":\"/reference/contracts/\"},{\"text\":\"需求说明 spec.md\",\"link\":\"/reference/contracts/spec\"},{\"text\":\"状态文件 state.json\",\"link\":\"/reference/contracts/state\"},{\"text\":\"结果文件\",\"link\":\"/reference/contracts/result-file\"},{\"text\":\"功能目录中的文件\",\"link\":\"/reference/contracts/feature-files\"},{\"text\":\"验证方法 verify.md\",\"link\":\"/reference/contracts/verify\"},{\"text\":\"外部通知事件\",\"link\":\"/reference/contracts/notifier-event\"},{\"text\":\"laoshi api 的 JSON 输出\",\"link\":\"/reference/contracts/cli-json\"},{\"text\":\"agent 平台运行时\",\"link\":\"/reference/contracts/agent-runtime\"},{\"text\":\"需求索引与使用记录\",\"link\":\"/reference/contracts/usage-record\"}]},{\"text\":\"设计\",\"collapsed\":true,\"items\":[{\"text\":\"架构\",\"link\":\"/reference/design/architecture\"},{\"text\":\"平台用词\",\"link\":\"/reference/design/platform-vocabulary\"},{\"text\":\"内置能力\",\"link\":\"/reference/design/builtin-capabilities\"},{\"text\":\"编写平台适配器\",\"link\":\"/reference/design/adapter-guide\"},{\"text\":\"命令行 agent 适配器\",\"link\":\"/reference/design/cli-adapter\"}]},{\"text\":\"设计决定(ADR)\",\"collapsed\":true,\"items\":[{\"text\":\"总览\",\"link\":\"/reference/adr/\"},{\"text\":\"0001 新建 laoshi 库:核心与平台适配器分开\",\"link\":\"/reference/adr/0001-new-repo-core-and-adapters\"},{\"text\":\"0002 两种编排模式:外部引擎与会话内编排\",\"link\":\"/reference/adr/0002-two-orchestration-modes\"},{\"text\":\"0003 适配器只在安装时生成一次并锁定\",\"link\":\"/reference/adr/0003-generate-once-then-lock\"},{\"text\":\"0004 对外契约在迁移中保持稳定\",\"link\":\"/reference/adr/0004-external-contracts-stay-stable\"},{\"text\":\"0005 入口 skill 命名\",\"link\":\"/reference/adr/0005-skill-names\"},{\"text\":\"0006 确定性引擎 + 平台能力层:先手写,后生成\",\"link\":\"/reference/adr/0006-deterministic-engine-platform-capabilities\"},{\"text\":\"0007 一次安装,多库共用;库内只放专属配置\",\"link\":\"/reference/adr/0007-one-install-many-repos\"},{\"text\":\"0008 能力按来源分层,平台插件作为适配器的一部分\",\"link\":\"/reference/adr/0008-capability-sources-and-platform-plugin\"}]}]},\"socialLinks\":[{\"icon\":\"github\",\"link\":\"https://github.com/yiyisf/laoshi\"}],\"editLink\":{\"pattern\":\"https://github.com/yiyisf/laoshi/edit/main/site/:path\",\"text\":\"在 GitHub 上编辑此页\"},\"footer\":{\"message\":\"以 MIT 许可发布。laoshi 可运行在 Paseo、DeepSeek Harness 等 agent 平台上。\",\"copyright\":\"Copyright © 2026 yiyisf\"},\"search\":{\"provider\":\"local\",\"options\":{\"translations\":{\"button\":{\"buttonText\":\"搜索文档\",\"buttonAriaLabel\":\"搜索文档\"},\"modal\":{\"noResultsText\":\"没有找到相关结果\",\"resetButtonTitle\":\"清除\",\"footer\":{\"selectText\":\"选择\",\"navigateText\":\"切换\",\"closeText\":\"关闭\"}}}}},\"outline\":{\"level\":[2,3],\"label\":\"本页内容\"},\"docFooter\":{\"prev\":\"上一页\",\"next\":\"下一页\"},\"lastUpdated\":{\"text\":\"最后更新\"},\"returnToTopLabel\":\"回到顶部\",\"sidebarMenuLabel\":\"目录\",\"darkModeSwitchLabel\":\"外观\",\"lightModeSwitchTitle\":\"切换到浅色\",\"darkModeSwitchTitle\":\"切换到深色\",\"externalLinkIcon\":true,\"notFound\":{\"title\":\"页面不存在\",\"quote\":\"这个页面可能已经移动或删除。\",\"linkText\":\"回到首页\"}},\"locales\":{},\"scrollOffset\":134,\"cleanUrls\":true}");</script>
24
+ <script>window.__VP_HASH_MAP__=JSON.parse("{\"changelog.md\":\"D0PzSXw9\",\"guide_cli.md\":\"BrXllHw9\",\"guide_dsh.md\":\"0X-eYB87\",\"guide_getting-started.md\":\"CjzysdDe\",\"guide_how-it-works.md\":\"CkvlSgxO\",\"guide_index.md\":\"D67QX_Vi\",\"guide_install.md\":\"By4WxsJG\",\"guide_intranet.md\":\"Bz0sAHK0\",\"guide_maintainer.md\":\"CvqvRle1\",\"guide_mogao.md\":\"TCu3lgE9\",\"guide_phases.md\":\"Cw0A9Vb1\",\"guide_project.md\":\"B2cmf8YF\",\"guide_user.md\":\"B66TQvIA\",\"index.md\":\"CrBM3tiI\",\"reference_adr_0001-new-repo-core-and-adapters.md\":\"CjNHHmrf\",\"reference_adr_0002-two-orchestration-modes.md\":\"CHD05agO\",\"reference_adr_0003-generate-once-then-lock.md\":\"BaRiZfXT\",\"reference_adr_0004-external-contracts-stay-stable.md\":\"DUJ7CTV1\",\"reference_adr_0005-skill-names.md\":\"DuBVd1tl\",\"reference_adr_0006-deterministic-engine-platform-capabilities.md\":\"Dcrnx1-L\",\"reference_adr_0007-one-install-many-repos.md\":\"C78cd4_P\",\"reference_adr_0008-capability-sources-and-platform-plugin.md\":\"B4vBkIDS\",\"reference_adr_index.md\":\"Dx8sPsjs\",\"reference_commands.md\":\"BFJRjNju\",\"reference_config.md\":\"Dt_TJ2y9\",\"reference_contracts_agent-runtime.md\":\"DPE2FJFc\",\"reference_contracts_cli-json.md\":\"D6vfWOD9\",\"reference_contracts_feature-files.md\":\"9n332kF_\",\"reference_contracts_index.md\":\"B5P4FjRk\",\"reference_contracts_notifier-event.md\":\"BeR8iODP\",\"reference_contracts_result-file.md\":\"BmCaSlEu\",\"reference_contracts_spec.md\":\"CDQYgJz7\",\"reference_contracts_state.md\":\"DLygjkfs\",\"reference_contracts_usage-record.md\":\"CgfMoYp0\",\"reference_contracts_verify.md\":\"CkJy8LXk\",\"reference_design_adapter-guide.md\":\"B_P-spS5\",\"reference_design_architecture.md\":\"Bfoc-F2B\",\"reference_design_builtin-capabilities.md\":\"k5NXkESv\",\"reference_design_cli-adapter.md\":\"C1lcDATP\",\"reference_design_platform-vocabulary.md\":\"xWGv5QO8\",\"reference_scope.md\":\"aUo6vISB\"}");window.__VP_SITE_DATA__=JSON.parse("{\"lang\":\"zh-CN\",\"dir\":\"ltr\",\"title\":\"laoshi\",\"titleTemplate\":\":title · laoshi\",\"description\":\"在 agent 平台(Paseo、DeepSeek Harness)中用对话对齐需求,由一组 AI agent 在后台完成设计、实现、评审和验证。给测试、产品、项目经理用的需求开发体系。\",\"base\":\"/\",\"head\":[],\"router\":{\"prefetchLinks\":true},\"appearance\":true,\"themeConfig\":{\"rk\":{\"version\":\"0.2.0\",\"beta\":false,\"releases\":6,\"stable\":3,\"adrs\":8},\"logo\":{\"light\":\"/logo-light.svg\",\"dark\":\"/logo.svg\",\"alt\":\"laoshi\"},\"siteTitle\":\"laoshi\",\"nav\":[{\"text\":\"指南\",\"link\":\"/guide/\",\"activeMatch\":\"^/guide/\"},{\"text\":\"参考\",\"link\":\"/reference/commands\",\"activeMatch\":\"^/reference/\"},{\"text\":\"更新记录\",\"link\":\"/changelog\"},{\"text\":\"v0.2.0\",\"items\":[{\"text\":\"更新记录\",\"link\":\"/changelog\"},{\"text\":\"GitHub Releases\",\"link\":\"https://github.com/yiyisf/laoshi/releases\"},{\"text\":\"范围与取舍\",\"link\":\"/reference/scope\"}]}],\"sidebar\":{\"/guide/\":[{\"text\":\"开始\",\"items\":[{\"text\":\"laoshi 是什么\",\"link\":\"/guide/\"},{\"text\":\"快速开始\",\"link\":\"/guide/getting-started\"},{\"text\":\"工作原理\",\"link\":\"/guide/how-it-works\"}]},{\"text\":\"使用\",\"items\":[{\"text\":\"使用者指南\",\"link\":\"/guide/user\"},{\"text\":\"分阶段执行与提测\",\"link\":\"/guide/phases\"}]},{\"text\":\"安装与维护\",\"items\":[{\"text\":\"安装与升级\",\"link\":\"/guide/install\"},{\"text\":\"在 DeepSeek Harness 上使用\",\"link\":\"/guide/dsh\"},{\"text\":\"在摸高上使用\",\"link\":\"/guide/mogao\"},{\"text\":\"只用命令行 agent\",\"link\":\"/guide/cli\"},{\"text\":\"内网安装与验证\",\"link\":\"/guide/intranet\"},{\"text\":\"项目定制与运行规则\",\"link\":\"/guide/project\"},{\"text\":\"维护者指南\",\"link\":\"/guide/maintainer\"}]}],\"/reference/\":[{\"text\":\"参考\",\"items\":[{\"text\":\"命令\",\"link\":\"/reference/commands\"},{\"text\":\"配置项\",\"link\":\"/reference/config\"},{\"text\":\"范围与取舍\",\"link\":\"/reference/scope\"}]},{\"text\":\"文件格式约定\",\"collapsed\":false,\"items\":[{\"text\":\"总览\",\"link\":\"/reference/contracts/\"},{\"text\":\"需求说明 spec.md\",\"link\":\"/reference/contracts/spec\"},{\"text\":\"状态文件 state.json\",\"link\":\"/reference/contracts/state\"},{\"text\":\"结果文件\",\"link\":\"/reference/contracts/result-file\"},{\"text\":\"功能目录中的文件\",\"link\":\"/reference/contracts/feature-files\"},{\"text\":\"验证方法 verify.md\",\"link\":\"/reference/contracts/verify\"},{\"text\":\"外部通知事件\",\"link\":\"/reference/contracts/notifier-event\"},{\"text\":\"laoshi api 的 JSON 输出\",\"link\":\"/reference/contracts/cli-json\"},{\"text\":\"agent 平台运行时\",\"link\":\"/reference/contracts/agent-runtime\"},{\"text\":\"需求索引与使用记录\",\"link\":\"/reference/contracts/usage-record\"}]},{\"text\":\"设计\",\"collapsed\":true,\"items\":[{\"text\":\"架构\",\"link\":\"/reference/design/architecture\"},{\"text\":\"平台用词\",\"link\":\"/reference/design/platform-vocabulary\"},{\"text\":\"内置能力\",\"link\":\"/reference/design/builtin-capabilities\"},{\"text\":\"编写平台适配器\",\"link\":\"/reference/design/adapter-guide\"},{\"text\":\"命令行 agent 适配器\",\"link\":\"/reference/design/cli-adapter\"}]},{\"text\":\"设计决定(ADR)\",\"collapsed\":true,\"items\":[{\"text\":\"总览\",\"link\":\"/reference/adr/\"},{\"text\":\"0001 新建 laoshi 库:核心与平台适配器分开\",\"link\":\"/reference/adr/0001-new-repo-core-and-adapters\"},{\"text\":\"0002 两种编排模式:外部引擎与会话内编排\",\"link\":\"/reference/adr/0002-two-orchestration-modes\"},{\"text\":\"0003 适配器只在安装时生成一次并锁定\",\"link\":\"/reference/adr/0003-generate-once-then-lock\"},{\"text\":\"0004 对外契约在迁移中保持稳定\",\"link\":\"/reference/adr/0004-external-contracts-stay-stable\"},{\"text\":\"0005 入口 skill 命名\",\"link\":\"/reference/adr/0005-skill-names\"},{\"text\":\"0006 确定性引擎 + 平台能力层:先手写,后生成\",\"link\":\"/reference/adr/0006-deterministic-engine-platform-capabilities\"},{\"text\":\"0007 一次安装,多库共用;库内只放专属配置\",\"link\":\"/reference/adr/0007-one-install-many-repos\"},{\"text\":\"0008 能力按来源分层,平台插件作为适配器的一部分\",\"link\":\"/reference/adr/0008-capability-sources-and-platform-plugin\"}]}]},\"socialLinks\":[{\"icon\":\"github\",\"link\":\"https://github.com/yiyisf/laoshi\"}],\"editLink\":{\"pattern\":\"https://github.com/yiyisf/laoshi/edit/main/site/:path\",\"text\":\"在 GitHub 上编辑此页\"},\"footer\":{\"message\":\"以 MIT 许可发布。laoshi 可运行在 Paseo、DeepSeek Harness 等 agent 平台上。\",\"copyright\":\"Copyright © 2026 yiyisf\"},\"search\":{\"provider\":\"local\",\"options\":{\"translations\":{\"button\":{\"buttonText\":\"搜索文档\",\"buttonAriaLabel\":\"搜索文档\"},\"modal\":{\"noResultsText\":\"没有找到相关结果\",\"resetButtonTitle\":\"清除\",\"footer\":{\"selectText\":\"选择\",\"navigateText\":\"切换\",\"closeText\":\"关闭\"}}}}},\"outline\":{\"level\":[2,3],\"label\":\"本页内容\"},\"docFooter\":{\"prev\":\"上一页\",\"next\":\"下一页\"},\"lastUpdated\":{\"text\":\"最后更新\"},\"returnToTopLabel\":\"回到顶部\",\"sidebarMenuLabel\":\"目录\",\"darkModeSwitchLabel\":\"外观\",\"lightModeSwitchTitle\":\"切换到浅色\",\"darkModeSwitchTitle\":\"切换到深色\",\"externalLinkIcon\":true,\"notFound\":{\"title\":\"页面不存在\",\"quote\":\"这个页面可能已经移动或删除。\",\"linkText\":\"回到首页\"}},\"locales\":{},\"scrollOffset\":134,\"cleanUrls\":true}");</script>
25
25
 
26
26
  </body>
27
27
  </html>
@@ -1 +1 @@
1
- import{R as p}from"./chunks/theme.tbt16E5a.js";import{R as s,a4 as i,a5 as u,a6 as c,a7 as l,a8 as f,a9 as d,aa as m,ab as h,ac as g,ad as A,d as v,u as R,v as w,s as y,ae as C,af as P,ag as b,a3 as E}from"./chunks/framework.BetZR81g.js";function r(e){if(e.extends){const a=r(e.extends);return{...a,...e,async enhanceApp(t){a.enhanceApp&&await a.enhanceApp(t),e.enhanceApp&&await e.enhanceApp(t)}}}return e}const n=r(p),S=v({name:"VitePressApp",setup(){const{site:e,lang:a,dir:t}=R();return w(()=>{y(()=>{document.documentElement.lang=a.value,document.documentElement.dir=t.value})}),e.value.router.prefetchLinks&&C(),P(),b(),n.setup&&n.setup(),()=>E(n.Layout)}});async function T(){globalThis.__VITEPRESS__=!0;const e=_(),a=D();a.provide(u,e);const t=c(e.route);return a.provide(l,t),a.component("Content",f),a.component("ClientOnly",d),Object.defineProperties(a.config.globalProperties,{$frontmatter:{get(){return t.frontmatter.value}},$params:{get(){return t.page.value.params}}}),n.enhanceApp&&await n.enhanceApp({app:a,router:e,siteData:m}),{app:a,router:e,data:t}}function D(){return A(S)}function _(){let e=s;return h(a=>{let t=g(a),o=null;return t&&(e&&(t=t.replace(/\.js$/,".lean.js")),o=import(t)),s&&(e=!1),o},n.NotFound)}s&&T().then(({app:e,router:a,data:t})=>{a.go().then(()=>{i(a.route,t.site),e.mount("#app")})});export{T as createApp};
1
+ import{R as p}from"./chunks/theme.CwrnT4KI.js";import{R as s,a4 as i,a5 as u,a6 as c,a7 as l,a8 as f,a9 as d,aa as m,ab as h,ac as g,ad as A,d as v,u as R,v as w,s as y,ae as C,af as P,ag as b,a3 as E}from"./chunks/framework.BetZR81g.js";function r(e){if(e.extends){const a=r(e.extends);return{...a,...e,async enhanceApp(t){a.enhanceApp&&await a.enhanceApp(t),e.enhanceApp&&await e.enhanceApp(t)}}}return e}const n=r(p),S=v({name:"VitePressApp",setup(){const{site:e,lang:a,dir:t}=R();return w(()=>{y(()=>{document.documentElement.lang=a.value,document.documentElement.dir=t.value})}),e.value.router.prefetchLinks&&C(),P(),b(),n.setup&&n.setup(),()=>E(n.Layout)}});async function T(){globalThis.__VITEPRESS__=!0;const e=_(),a=D();a.provide(u,e);const t=c(e.route);return a.provide(l,t),a.component("Content",f),a.component("ClientOnly",d),Object.defineProperties(a.config.globalProperties,{$frontmatter:{get(){return t.frontmatter.value}},$params:{get(){return t.page.value.params}}}),n.enhanceApp&&await n.enhanceApp({app:a,router:e,siteData:m}),{app:a,router:e,data:t}}function D(){return A(S)}function _(){let e=s;return h(a=>{let t=g(a),o=null;return t&&(e&&(t=t.replace(/\.js$/,".lean.js")),o=import(t)),s&&(e=!1),o},n.NotFound)}s&&T().then(({app:e,router:a,data:t})=>{a.go().then(()=>{i(a.route,t.site),e.mount("#app")})});export{T as createApp};
@@ -0,0 +1 @@
1
+ import{_ as o,o as a,c as t,a2 as l}from"./chunks/framework.BetZR81g.js";const p=JSON.parse('{"title":"更新记录","description":"","frontmatter":{"editLink":false},"headers":[],"relativePath":"changelog.md","filePath":"changelog.md","lastUpdated":null}'),i={name:"changelog.md"};function d(s,e,c,r,n,h){return a(),t("div",null,[...e[0]||(e[0]=[l('<div><h1 id="更新记录" tabindex="-1">更新记录 <a class="header-anchor" href="#更新记录" aria-label="Permalink to &quot;更新记录&quot;">​</a></h1><p>laoshi 的版本号遵循语义化版本,从 0.1.0 开始;每一版的标题写成 <code>## &lt;版本&gt; - &lt;日期&gt;</code>。每一版先写使用者会看到的变化,再写升级须知。laoshi 之前的历史见 paseo-req-kit 的更新记录(laoshi 从它的 1.15.0 抽出)。</p><h2 id="_0-2-0-2026-11-21" tabindex="-1">0.2.0 - 2026-11-21 <a class="header-anchor" href="#_0-2-0-2026-11-21" aria-label="Permalink to &quot;0.2.0 - 2026-11-21&quot;">​</a></h2><p>正式版(npm <code>latest</code> 标签):汇总 0.2.0-beta.1~beta.3 的全部功能(摸高适配器与专家包、Paseo 需求插件迁入、<code>laoshi migrate</code>、<code>laoshi permission</code>),并补充摸高版本自检、进程组清理、上下文控制、<code>laoshi diagnose</code> 脱敏诊断包与 Release 自动附带摸高专家包。安装:<code>npx -y @yiyi_zhang/laoshi@latest install --platform &lt;平台&gt;</code>。</p><h3 id="使用者会看到的变化" tabindex="-1">使用者会看到的变化 <a class="header-anchor" href="#使用者会看到的变化" aria-label="Permalink to &quot;使用者会看到的变化&quot;">​</a></h3><ul><li><strong>诊断包(<code>laoshi diagnose &lt;需求&gt; [--out &lt;目录&gt;]</code>)</strong>:一键导出已脱敏的排查目录(状态、流水线日志尾部、步骤结果、步骤输出与回调事件、脱敏配置与环境摘要),方便压缩后发给维护者定位问题。</li><li><strong>摸高:启动后不再&quot;去后台、有进展通知你&quot;</strong>:摸高上流水线在对话的命令里运行,对话一结束就停止。入口 skill 里启动后的说明改为摸高自己的一节(命令不会马上返回、不要结束这一轮对话、持续查看输出并转述);命令输出也不再写&quot;已在后台启动&quot;&quot;进展会发回对话&quot;,安静超过 3 分钟时再提醒一次&quot;流水线仍在运行&quot;。</li><li><strong>摸高:结束一次运行时连它启动的进程一起结束</strong>:每次 <code>aimax run</code> 单独成一个进程组,结束时整组结束,步骤里留下的服务、构建守护进程不再残留;收到 <code>done</code> 回调后留 2 秒等待完整输出,避免抢跑拿到不完整回复与用量。</li><li><strong>步骤控制读入的内容量</strong>:步骤提示词要求命令输出先过滤再看、不整包解压或列出依赖包、读源码先搜索定位(有的模型实际上下文只有十万 token 左右);因上下文占满失败重做时,告诉新的 agent 换做法,从已写下的产物接着做。方案写明依赖相关结论的依据(命令和关键输出),方案审核照着重跑核实、每个结论只核实一次、<code>javap</code> 不看常量池和字节码。</li><li><strong>摸高:专家要求的版本由命令自己保证</strong>:专家里每条 laoshi 命令都带上它要求的版本(<code>LAOSHI_WANT_VERSION</code>),工作区装的不是这个版本时,命令先从 npm 镜像装上再执行;安装失败时不会在子脚本里重复尝试,更新平台设置失败时给出明确警告。</li><li><strong>发布产物附带摸高专家包</strong>:GitHub Release 除 <code>.tgz</code> 与 Windows 离线包外,同时附带该版本生成的 <code>laoshi-expert-0.2.0.zip</code>。</li></ul><h3 id="升级须知" tabindex="-1">升级须知 <a class="header-anchor" href="#升级须知" aria-label="Permalink to &quot;升级须知&quot;">​</a></h3><ul><li><strong>摸高</strong>:直接替换为本版本 Release 附带的 <code>laoshi-expert-0.2.0.zip</code>(或运行 <code>node adapters/mogao/make-expert.mjs</code> 生成),不要手工修改旧专家包里的版本号。</li><li><strong>Paseo / dsh</strong>:运行 <code>laoshi upgrade</code> 即可升级到 <code>0.2.0</code>(Paseo 需求插件会顺带更新)。</li></ul><h2 id="_0-2-0-beta-3-2026-11-11" tabindex="-1">0.2.0-beta.3 - 2026-11-11 <a class="header-anchor" href="#_0-2-0-beta-3-2026-11-11" aria-label="Permalink to &quot;0.2.0-beta.3 - 2026-11-11&quot;">​</a></h2><p>预发布版(npm 的 <code>beta</code> 标签,<code>latest</code> 仍是 0.1.1):摸高的回调按平台文档的格式解析,步骤做完后靠 <code>done</code> 及时进入下一步,工具调用和用量能收到。安装:<code>npx -y @yiyi_zhang/laoshi@beta install --platform &lt;平台&gt;</code>。</p><h3 id="使用者会看到的变化-1" tabindex="-1">使用者会看到的变化 <a class="header-anchor" href="#使用者会看到的变化-1" aria-label="Permalink to &quot;使用者会看到的变化&quot;">​</a></h3><ul><li><strong>摸高:回调按平台文档的格式解析</strong>:工具调用(包在 <code>progress</code> 事件里)现在收得到,危险命令拦截和&quot;最近活动&quot;在摸高上开始生效;用量从 <code>usage</code> 字段读并计入缓存命中;<code>error</code> 回调也表示运行结束;上一版启动、这一版接着等的步骤也能靠 <code>done</code> 及时结束。</li></ul><h3 id="升级须知-1" tabindex="-1">升级须知 <a class="header-anchor" href="#升级须知-1" aria-label="Permalink to &quot;升级须知&quot;">​</a></h3><ul><li>摸高:专家包要换成这个版本生成的(入口 skill 里写着要装的版本),第一次使用时会装上 0.2.0-beta.3;用 <code>node -p &quot;require(&#39;/data/workspace/.laoshi/npm/node_modules/@yiyi_zhang/laoshi/package.json&#39;).version&quot;</code> 确认。</li></ul><h2 id="_0-2-0-beta-2-2026-11-10" tabindex="-1">0.2.0-beta.2 - 2026-11-10 <a class="header-anchor" href="#_0-2-0-beta-2-2026-11-10" aria-label="Permalink to &quot;0.2.0-beta.2 - 2026-11-10&quot;">​</a></h2><p>预发布版(npm 的 <code>beta</code> 标签,<code>latest</code> 仍是 0.1.1):修复摸高上步骤做完要等很久才进入下一步的问题;新增不需要平台的命令行 agent 适配器、<code>laoshi migrate</code> 和随 laoshi 发布的 Paseo 需求插件。安装:<code>npx -y @yiyi_zhang/laoshi@beta install --platform &lt;平台&gt;</code>。</p><h3 id="使用者会看到的变化-2" tabindex="-1">使用者会看到的变化 <a class="header-anchor" href="#使用者会看到的变化-2" aria-label="Permalink to &quot;使用者会看到的变化&quot;">​</a></h3><ul><li><strong>发起人</strong>:状态文件和 <code>laoshi api list</code> 记下每个需求的发起人(<code>startedBy</code>,第一次运行时为谁运行,之后不改)。</li><li><strong>使用者取平台给的身份</strong>:平台提供使用者时(摸高的 <code>AIMAX_USER_NAME</code>)优先用它,<code>LAOSHI_USER</code> 仍然最优先;<code>laoshi doctor</code> 显示使用者从哪里来。</li><li><strong>安装</strong>:程序装在安装根的 <code>npm</code> 目录里时(摸高专家就这样安装),不再提示&quot;需要设置环境变量 LAOSHI_HOME&quot;。</li><li><strong>命令行 agent(不需要平台)</strong>(<code>laoshi install --platform cli</code>):步骤 agent 是 Claude Code(<code>claude -p</code>)或 Codex(<code>codex exec</code>)的一次运行,追问和打断用会话续接,工具调用来自命令行的事件流(危险命令拦截照常工作);进展用 <code>laoshi status</code> 查看。第一版,真实命令行上的验证待做。</li><li><strong>摸高:步骤做完后马上进入下一步</strong>:agent 做完但 <code>aimax run</code> 进程不退出时,以完整的输出或平台回调的 <code>done</code> 为准结束这一步,并结束残留的进程(之前要等到平台结束后台命令、再继续时才进入下一步)。</li><li><strong>Paseo 的需求插件随 laoshi 发布</strong>:<code>laoshi plugin install|status|remove</code>(从 paseo-req-kit 迁入,插件 id 改为 <code>laoshi</code>);安装、升级时顺带更新插件。</li><li><strong><code>laoshi migrate</code></strong>:从 paseo-req-kit 1.x 迁移本机的配置、使用记录、需求索引和需求状态;默认只预览,<code>--apply</code> 执行,<code>--rollback</code> 回滚;旧目录不动。</li><li><strong>文档</strong>:新增《在摸高上使用》《只用命令行 agent》。</li></ul><h3 id="升级须知-2" tabindex="-1">升级须知 <a class="header-anchor" href="#升级须知-2" aria-label="Permalink to &quot;升级须知&quot;">​</a></h3><ul><li>摸高:专家包要按这个版本重新生成(<code>node adapters/mogao/make-expert.mjs</code>),入口 skill 第一次使用时会换上这个版本。</li><li>Paseo:装过 paseo-req-kit 插件的,可以改装 laoshi 插件(<code>laoshi plugin install</code>),确认可用后用 <code>req plugin remove</code> 移除旧的。</li></ul><h2 id="_0-2-0-beta-1-2026-11-07" tabindex="-1">0.2.0-beta.1 - 2026-11-07 <a class="header-anchor" href="#_0-2-0-beta-1-2026-11-07" aria-label="Permalink to &quot;0.2.0-beta.1 - 2026-11-07&quot;">​</a></h2><p>预发布版(npm 的 <code>beta</code> 标签,<code>latest</code> 仍是 0.1.1):支持摸高,用来在摸高沙箱里验证专家。安装:<code>npx -y @yiyi_zhang/laoshi@beta install --platform &lt;平台&gt;</code>。</p><h3 id="使用者会看到的变化-3" tabindex="-1">使用者会看到的变化 <a class="header-anchor" href="#使用者会看到的变化-3" aria-label="Permalink to &quot;使用者会看到的变化&quot;">​</a></h3><ul><li><strong>支持摸高</strong>(<code>laoshi install --platform mogao</code>):每一步是摸高的一个独立 agent(<code>aimax run</code>),审批用摸高的人工审批,工具调用和用量来自摸高的进度回调。引擎在对话的命令里运行,进展显示在命令输出里;对话轮次结束打断的运行,下一轮用继续命令接着做。</li><li><strong>摸高专家</strong>:<code>node adapters/mogao/make-expert.mjs</code> 生成提交给摸高的专家(按摸高渲染的 skill 和介绍);入口 skill 第一次使用时把 laoshi 装到工作区,并说明在摸高上命令会一直运行到停下、等待批准怎么回答、工具装在工作区。</li><li><strong>安装根</strong>:没有 <code>LAOSHI_HOME</code> 时,程序装在 <code>&lt;安装根&gt;/npm</code> 下就用这个安装根(每个对话轮次换机器的平台上不能依赖 <code>~</code>)。</li><li><strong><code>laoshi permission &lt;需求&gt; approve|deny [理由]</code></strong>:在对话里批准或拒绝步骤等待批准的操作,并接着运行(摸高上用)。</li><li><strong>危险命令拦截</strong>:读出凭据环境变量(如 <code>echo $XXX_TOKEN</code>、<code>printenv</code>)算作危险操作。</li></ul><h2 id="_0-1-1-2026-11-05" tabindex="-1">0.1.1 - 2026-11-05 <a class="header-anchor" href="#_0-1-1-2026-11-05" aria-label="Permalink to &quot;0.1.1 - 2026-11-05&quot;">​</a></h2><p>在 npm 上的包名改为 <strong><code>@yiyi_zhang/laoshi</code></strong>:<code>laoshi</code> 这个名字在 npm 上不能使用,0.1.0 只发布到了 GitHub Release,没有发布到 npm。其余内容与 0.1.0 相同。</p><h3 id="升级须知-3" tabindex="-1">升级须知 <a class="header-anchor" href="#升级须知-3" aria-label="Permalink to &quot;升级须知&quot;">​</a></h3><ul><li>安装命令:<code>npx -y @yiyi_zhang/laoshi@latest install --platform dsh|paseo</code>(内网加 <code>--registry=&lt;镜像地址&gt;</code>)。装好后的命令仍是 <code>laoshi</code>(别名 <code>req</code>),skill 仍是 <code>/laoshi</code> 等。</li><li>公司的 npm 镜像需要能同步 <code>@yiyi_zhang</code> 作用域下的包。</li><li>用 GitHub Release 上 0.1.0 的 <code>.tgz</code> 或离线包装过的机器,运行一次上面的安装命令即可换成 npm 上的版本。</li></ul><h2 id="_0-1-0-2026-11-05" tabindex="-1">0.1.0 - 2026-11-05 <a class="header-anchor" href="#_0-1-0-2026-11-05" aria-label="Permalink to &quot;0.1.0 - 2026-11-05&quot;">​</a></h2><p>第一个正式版:paseo-req-kit 的需求开发体系,抽成不绑定平台的工具包,支持 Paseo 和 DeepSeek Harness。</p><h3 id="使用者会看到的变化-4" tabindex="-1">使用者会看到的变化 <a class="header-anchor" href="#使用者会看到的变化-4" aria-label="Permalink to &quot;使用者会看到的变化&quot;">​</a></h3><ul><li><strong>新的名字和命令</strong>:对话中的入口是 <code>/laoshi</code>、<code>/laoshi-setup</code>、<code>/laoshi-doctor</code>、<code>/laoshi-retro</code>;终端命令是 <code>laoshi</code>(<code>req</code> 是它的别名)。</li><li><strong>支持 DeepSeek Harness(dsh)</strong>:步骤 agent 作为子会话挂在发起的对话下,进展和结果发回对话;各角色可以各用一个 dsh 中的模型(<code>&lt;提供方&gt;/&lt;模型&gt;</code>,<code>dsh/chat-model</code> 用对话的模型);<code>laoshi doctor</code> 列出可用的模型并逐个角色检查。</li><li><strong>内置工作区和服务</strong>:平台不提供时,laoshi 用 <code>git worktree</code> 为需求新建工作区,并按 <code>.laoshi/services.json</code> 启动、检查、停止项目的服务(每个工作区独立端口)。</li><li><strong>一步安装</strong>:<code>npx -y @yiyi_zhang/laoshi@latest install --platform dsh|paseo</code>;公司内网加 <code>--registry=&lt;镜像地址&gt;</code>;<code>laoshi upgrade</code> 升级或回退;<code>laoshi install --check</code>、<code>--uninstall</code>。Windows 上只用 cmd 和 Git Bash。</li><li><strong>离线安装包</strong>:完全没有 npm 源的机器,用 GitHub Release 上带 Windows 依赖的离线安装包,步骤见&quot;内网安装与验证&quot;。</li><li><strong>文档站点</strong>:<a href="https://yiyisf.github.io/laoshi/" target="_blank" rel="noreferrer">https://yiyisf.github.io/laoshi/</a> ;<code>laoshi docs</code> 在本机打开和装的版本一致的文档(不需要外网)。</li><li><strong>体检</strong>:<code>laoshi doctor</code> 的&quot;安装&quot;一节检查 skill 是否已是这个版本的,并从 npm 源查询有没有新版本。</li><li><strong>使用记录带上代码库和使用者</strong>:使用记录、通知事件和 <code>laoshi api list</code> 中增加了代码库(目录、远程地址)和使用者(<code>LAOSHI_USER</code> 或安装级配置的 <code>user</code>)。</li></ul><h3 id="升级须知-从-paseo-req-kit" tabindex="-1">升级须知(从 paseo-req-kit) <a class="header-anchor" href="#升级须知-从-paseo-req-kit" aria-label="Permalink to &quot;升级须知(从 paseo-req-kit)&quot;">​</a></h3><ul><li>laoshi 和 paseo-req-kit 可以装在同一台机器上,互不覆盖:安装根是 <code>~/.laoshi</code>(只有 <code>~/.req-kit</code> 时读取它),项目配置是 <code>.laoshi.json</code>(<code>.requirement-pipeline.json</code> 继续被读取)。</li><li>状态文件升到第 2 版:第一次读到旧的状态文件时自动迁移,原文件留作 <code>.bak-v1</code>;正在运行的流水线只在内存中迁移。</li><li>配置中的 <code>paseoProfile</code>、<code>paseoServices</code> 改名为 <code>platformProfile</code>、<code>platformServices</code>,旧名继续有效。</li><li>Paseo 的需求插件暂时仍由 paseo-req-kit 提供,计划在 0.1.0 之后迁入。</li></ul></div><p class="source-note">本页由仓库中的 <a href="https://github.com/yiyisf/laoshi/blob/main/CHANGELOG.md">CHANGELOG.md</a> 生成。<a href="https://github.com/yiyisf/laoshi/edit/main/CHANGELOG.md">在 GitHub 上编辑</a></p>',2)])])}const u=o(i,[["render",d]]);export{p as __pageData,u as default};
@@ -1 +1 @@
1
- import{_ as o,o as a,c as i,a2 as l}from"./chunks/framework.BetZR81g.js";const p=JSON.parse('{"title":"更新记录","description":"","frontmatter":{"editLink":false},"headers":[],"relativePath":"changelog.md","filePath":"changelog.md","lastUpdated":null}'),t={name:"changelog.md"};function d(s,e,c,r,n,h){return a(),i("div",null,[...e[0]||(e[0]=[l("",2)])])}const u=o(t,[["render",d]]);export{p as __pageData,u as default};
1
+ import{_ as o,o as a,c as t,a2 as l}from"./chunks/framework.BetZR81g.js";const p=JSON.parse('{"title":"更新记录","description":"","frontmatter":{"editLink":false},"headers":[],"relativePath":"changelog.md","filePath":"changelog.md","lastUpdated":null}'),i={name:"changelog.md"};function d(s,e,c,r,n,h){return a(),t("div",null,[...e[0]||(e[0]=[l("",2)])])}const u=o(i,[["render",d]]);export{p as __pageData,u as default};