@yiyi_zhang/laoshi 0.0.0-stage → 0.2.0-beta.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.
Files changed (358) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/LICENSE +21 -0
  3. package/README.md +60 -2
  4. package/SCOPE.md +13 -0
  5. package/adapters/dsh/adapter.ts +75 -0
  6. package/adapters/dsh/dsh-runtime.ts +242 -0
  7. package/adapters/dsh/install.mjs +97 -0
  8. package/adapters/dsh/intranet/install.mjs +15 -0
  9. package/adapters/dsh/intranet/make-sample.mjs +52 -0
  10. package/adapters/dsh/plugin/channel.d.mts +2 -0
  11. package/adapters/dsh/plugin/channel.mjs +31 -0
  12. package/adapters/dsh/plugin/index.d.mts +3 -0
  13. package/adapters/dsh/plugin/index.mjs +292 -0
  14. package/adapters/dsh/plugin/package.json +18 -0
  15. package/adapters/mogao/adapter.ts +46 -0
  16. package/adapters/mogao/install.mjs +31 -0
  17. package/adapters/mogao/make-expert.mjs +63 -0
  18. package/adapters/mogao/mogao-runtime.ts +457 -0
  19. package/adapters/mogao/skill/setup.md +21 -0
  20. package/adapters/paseo/adapter.ts +96 -0
  21. package/adapters/paseo/daemon-check.ts +80 -0
  22. package/adapters/paseo/daemon-version.ts +64 -0
  23. package/adapters/paseo/doctor.ts +161 -0
  24. package/adapters/paseo/install.mjs +30 -0
  25. package/adapters/paseo/paseo-json.ts +73 -0
  26. package/adapters/paseo/paseo-profiles.ts +127 -0
  27. package/adapters/paseo/paseo-runtime.ts +507 -0
  28. package/adapters/paseo/settings.ts +22 -0
  29. package/adapters/paseo/skill/setup.md +26 -0
  30. package/adapters/paseo/skill/templates/copy-local-files.mjs +32 -0
  31. package/adapters/paseo/skill/templates/with-port.mjs +36 -0
  32. package/adapters/paseo/smoke-test.ts +203 -0
  33. package/bin/bootstrap.mjs +170 -0
  34. package/bin/install.mjs +251 -0
  35. package/bin/locate.mjs +22 -0
  36. package/bin/req-docs.d.mts +5 -0
  37. package/bin/req-docs.mjs +167 -0
  38. package/bin/req-doctor.mjs +21 -0
  39. package/bin/req.mjs +244 -0
  40. package/bin/start-pipeline +21 -0
  41. package/bin/start-pipeline.mjs +22 -0
  42. package/config.example.json +134 -0
  43. package/contracts/README.md +21 -0
  44. package/contracts/agent-runtime.md +86 -0
  45. package/contracts/cli-json.md +76 -0
  46. package/contracts/feature-files.md +148 -0
  47. package/contracts/notifier-event.md +90 -0
  48. package/contracts/result-file.md +21 -0
  49. package/contracts/spec.md +37 -0
  50. package/contracts/state.md +69 -0
  51. package/contracts/usage-record.md +72 -0
  52. package/contracts/verify.md +41 -0
  53. package/docs/adr/0001-new-repo-core-and-adapters.md +20 -0
  54. package/docs/adr/0002-two-orchestration-modes.md +20 -0
  55. package/docs/adr/0003-generate-once-then-lock.md +20 -0
  56. package/docs/adr/0004-external-contracts-stay-stable.md +19 -0
  57. package/docs/adr/0005-skill-names.md +26 -0
  58. package/docs/adr/0006-deterministic-engine-platform-capabilities.md +42 -0
  59. package/docs/adr/0007-one-install-many-repos.md +63 -0
  60. package/docs/adr/0008-capability-sources-and-platform-plugin.md +81 -0
  61. package/docs/adr/README.md +14 -0
  62. package/docs/design/adapter-guide.md +90 -0
  63. package/docs/design/architecture.md +104 -0
  64. package/docs/design/builtin-capabilities.md +72 -0
  65. package/docs/design/compat-migration.md +65 -0
  66. package/docs/design/dsh-adapter.md +145 -0
  67. package/docs/design/in-chat-orchestration.md +67 -0
  68. package/docs/design/init-bootstrap.md +83 -0
  69. package/docs/design/internal-platform-adapter.md +76 -0
  70. package/docs/design/mogao-expert.md +101 -0
  71. package/docs/design/platform-discovery.md +117 -0
  72. package/docs/design/platform-vocabulary.md +44 -0
  73. package/docs/design/state-v2.md +71 -0
  74. package/docs/guide//344/275/277/347/224/250/350/200/205/346/214/207/345/215/227.md +130 -0
  75. package/docs/guide//345/256/211/350/243/205/344/270/216/345/215/207/347/272/247.md +211 -0
  76. package/docs/guide//347/273/264/346/212/244/350/200/205/346/214/207/345/215/227.md +86 -0
  77. package/docs/guide//351/241/271/347/233/256/345/256/232/345/210/266/344/270/216/350/277/220/350/241/214/350/247/204/345/210/231.md +595 -0
  78. package/docs/intranet/install-verify.md +278 -0
  79. package/engine/prompts/00-shared-context.md +107 -0
  80. package/engine/prompts/02-spec-review.md +46 -0
  81. package/engine/prompts/03-design.md +77 -0
  82. package/engine/prompts/03a-design-proposal.md +30 -0
  83. package/engine/prompts/04-design-review.md +73 -0
  84. package/engine/prompts/04b-design-revise.md +56 -0
  85. package/engine/prompts/05-implement.md +72 -0
  86. package/engine/prompts/06-code-review.md +81 -0
  87. package/engine/prompts/07-review-fix.md +41 -0
  88. package/engine/prompts/07b-handoff.md +45 -0
  89. package/engine/prompts/08-service-start.md +59 -0
  90. package/engine/prompts/09-verify.md +90 -0
  91. package/engine/prompts/10-defect-fix.md +41 -0
  92. package/engine/prompts/10b-reverify.md +43 -0
  93. package/engine/prompts/11-report.md +112 -0
  94. package/engine/prompts/browser-verify.md +14 -0
  95. package/engine/prompts/incremental.md +24 -0
  96. package/engine/prompts/joint.md +55 -0
  97. package/engine/prompts/managed-services.md +9 -0
  98. package/engine/prompts/panel-member.md +38 -0
  99. package/engine/prompts/related-repos.md +7 -0
  100. package/engine/prompts/review-axis-spec.md +10 -0
  101. package/engine/prompts/review-axis-standards.md +11 -0
  102. package/engine/prompts/types/assessment.md +41 -0
  103. package/engine/prompts/types/defect.md +55 -0
  104. package/engine/prompts/types/refactor.md +39 -0
  105. package/engine/prompts/ui-check.md +15 -0
  106. package/engine/prompts/verify-deployed.md +14 -0
  107. package/engine/skill-fragments/setup-builtin.md +24 -0
  108. package/engine/src/activity.ts +131 -0
  109. package/engine/src/api.ts +655 -0
  110. package/engine/src/builtin/index.ts +30 -0
  111. package/engine/src/builtin/project-services.ts +66 -0
  112. package/engine/src/builtin/service-runner.mjs +35 -0
  113. package/engine/src/builtin/services.ts +264 -0
  114. package/engine/src/builtin/setup-runner.mjs +26 -0
  115. package/engine/src/builtin/workspace.ts +139 -0
  116. package/engine/src/card-cmd.ts +505 -0
  117. package/engine/src/card.ts +541 -0
  118. package/engine/src/checklist-cmd.ts +37 -0
  119. package/engine/src/checklist.ts +254 -0
  120. package/engine/src/cli-args.ts +228 -0
  121. package/engine/src/code-review.ts +421 -0
  122. package/engine/src/codeowners.ts +87 -0
  123. package/engine/src/config-view.ts +310 -0
  124. package/engine/src/config.ts +862 -0
  125. package/engine/src/configure.ts +343 -0
  126. package/engine/src/control.ts +257 -0
  127. package/engine/src/danger-guard.ts +187 -0
  128. package/engine/src/digest.ts +141 -0
  129. package/engine/src/doctor.ts +410 -0
  130. package/engine/src/estimate.ts +95 -0
  131. package/engine/src/eval.ts +325 -0
  132. package/engine/src/factory.ts +545 -0
  133. package/engine/src/features.ts +311 -0
  134. package/engine/src/gate.ts +157 -0
  135. package/engine/src/git.ts +30 -0
  136. package/engine/src/identity.ts +72 -0
  137. package/engine/src/index-cmd.ts +34 -0
  138. package/engine/src/integration-cmd.ts +161 -0
  139. package/engine/src/integrations.ts +485 -0
  140. package/engine/src/joint.ts +173 -0
  141. package/engine/src/launch.ts +481 -0
  142. package/engine/src/lessons.ts +74 -0
  143. package/engine/src/locations.ts +97 -0
  144. package/engine/src/main.ts +393 -0
  145. package/engine/src/messages.ts +472 -0
  146. package/engine/src/notifiers.ts +114 -0
  147. package/engine/src/notify-test.ts +108 -0
  148. package/engine/src/outcomes.ts +145 -0
  149. package/engine/src/paths.ts +10 -0
  150. package/engine/src/permission-cmd.ts +56 -0
  151. package/engine/src/pipeline.ts +2517 -0
  152. package/engine/src/platform.ts +126 -0
  153. package/engine/src/playbooks.ts +46 -0
  154. package/engine/src/preflight.ts +352 -0
  155. package/engine/src/prompts.ts +76 -0
  156. package/engine/src/queue.ts +61 -0
  157. package/engine/src/records.ts +403 -0
  158. package/engine/src/reply.ts +81 -0
  159. package/engine/src/review-assets/app.css +339 -0
  160. package/engine/src/review-assets/app.html +107 -0
  161. package/engine/src/review-assets/app.js +958 -0
  162. package/engine/src/review-assets/check.css +12 -0
  163. package/engine/src/review-assets/check.html +61 -0
  164. package/engine/src/review-assets/check.js +341 -0
  165. package/engine/src/review-assets/code.css +16 -0
  166. package/engine/src/review-assets/code.html +58 -0
  167. package/engine/src/review-assets/code.js +497 -0
  168. package/engine/src/review-assets/rk-icons.js +98 -0
  169. package/engine/src/review-assets/rk-tokens.css +252 -0
  170. package/engine/src/review-assets/rk.css +254 -0
  171. package/engine/src/review.ts +771 -0
  172. package/engine/src/runtime-loader.ts +112 -0
  173. package/engine/src/runtime.ts +191 -0
  174. package/engine/src/scan-guard.ts +132 -0
  175. package/engine/src/schedule-time.ts +51 -0
  176. package/engine/src/secret-scan.ts +177 -0
  177. package/engine/src/semver.ts +31 -0
  178. package/engine/src/skills-render.ts +108 -0
  179. package/engine/src/spec-review.ts +99 -0
  180. package/engine/src/state.ts +528 -0
  181. package/engine/src/stats.ts +810 -0
  182. package/engine/src/steps.ts +269 -0
  183. package/engine/src/try.ts +135 -0
  184. package/engine/src/ui-check-page.js +208 -0
  185. package/engine/src/ui-check.ts +366 -0
  186. package/engine/src/usage.ts +67 -0
  187. package/engine/src/watchdog.ts +139 -0
  188. package/engine/src/words.ts +95 -0
  189. package/engine/src/worktree.ts +227 -0
  190. package/notifiers/im-template.mjs +86 -0
  191. package/package.json +78 -4
  192. package/principles/INDEX.md +11 -0
  193. package/site-dist/404.html +27 -0
  194. package/site-dist/assets/app.DMAHANCl.js +1 -0
  195. package/site-dist/assets/changelog.md.Q8QGpuBY.js +1 -0
  196. package/site-dist/assets/changelog.md.Q8QGpuBY.lean.js +1 -0
  197. package/site-dist/assets/chunks/@localSearchIndexroot.CQdjFK3w.js +1 -0
  198. package/site-dist/assets/chunks/VPLocalSearchBox.COsLwqWS.js +9 -0
  199. package/site-dist/assets/chunks/framework.BetZR81g.js +20 -0
  200. package/site-dist/assets/chunks/theme.CeR3HD86.js +2 -0
  201. package/site-dist/assets/guide_dsh.md.0X-eYB87.js +5 -0
  202. package/site-dist/assets/guide_dsh.md.0X-eYB87.lean.js +5 -0
  203. package/site-dist/assets/guide_getting-started.md.Bytaz3L8.js +1 -0
  204. package/site-dist/assets/guide_getting-started.md.Bytaz3L8.lean.js +1 -0
  205. package/site-dist/assets/guide_how-it-works.md.CkvlSgxO.js +25 -0
  206. package/site-dist/assets/guide_how-it-works.md.CkvlSgxO.lean.js +1 -0
  207. package/site-dist/assets/guide_index.md.D67QX_Vi.js +1 -0
  208. package/site-dist/assets/guide_index.md.D67QX_Vi.lean.js +1 -0
  209. package/site-dist/assets/guide_install.md.D7NiiOPu.js +19 -0
  210. package/site-dist/assets/guide_install.md.D7NiiOPu.lean.js +19 -0
  211. package/site-dist/assets/guide_intranet.md.Bz0sAHK0.js +9 -0
  212. package/site-dist/assets/guide_intranet.md.Bz0sAHK0.lean.js +9 -0
  213. package/site-dist/assets/guide_maintainer.md.C-Vt-DdK.js +1 -0
  214. package/site-dist/assets/guide_maintainer.md.C-Vt-DdK.lean.js +1 -0
  215. package/site-dist/assets/guide_phases.md.Cw0A9Vb1.js +1 -0
  216. package/site-dist/assets/guide_phases.md.Cw0A9Vb1.lean.js +1 -0
  217. package/site-dist/assets/guide_project.md.BIcaDhdS.js +77 -0
  218. package/site-dist/assets/guide_project.md.BIcaDhdS.lean.js +77 -0
  219. package/site-dist/assets/guide_user.md.B66TQvIA.js +1 -0
  220. package/site-dist/assets/guide_user.md.B66TQvIA.lean.js +1 -0
  221. package/site-dist/assets/index.md.CrBM3tiI.js +1 -0
  222. package/site-dist/assets/index.md.CrBM3tiI.lean.js +1 -0
  223. package/site-dist/assets/inter-italic-cyrillic-ext.r48I6akx.woff2 +0 -0
  224. package/site-dist/assets/inter-italic-cyrillic.By2_1cv3.woff2 +0 -0
  225. package/site-dist/assets/inter-italic-greek-ext.1u6EdAuj.woff2 +0 -0
  226. package/site-dist/assets/inter-italic-greek.DJ8dCoTZ.woff2 +0 -0
  227. package/site-dist/assets/inter-italic-latin-ext.CN1xVJS-.woff2 +0 -0
  228. package/site-dist/assets/inter-italic-latin.C2AdPX0b.woff2 +0 -0
  229. package/site-dist/assets/inter-italic-vietnamese.BSbpV94h.woff2 +0 -0
  230. package/site-dist/assets/inter-roman-cyrillic-ext.BBPuwvHQ.woff2 +0 -0
  231. package/site-dist/assets/inter-roman-cyrillic.C5lxZ8CY.woff2 +0 -0
  232. package/site-dist/assets/inter-roman-greek-ext.CqjqNYQ-.woff2 +0 -0
  233. package/site-dist/assets/inter-roman-greek.BBVDIX6e.woff2 +0 -0
  234. package/site-dist/assets/inter-roman-latin-ext.4ZJIpNVo.woff2 +0 -0
  235. package/site-dist/assets/inter-roman-latin.Di8DUHzh.woff2 +0 -0
  236. package/site-dist/assets/inter-roman-vietnamese.BjW4sHH5.woff2 +0 -0
  237. package/site-dist/assets/reference_adr_0001-new-repo-core-and-adapters.md.CjNHHmrf.js +1 -0
  238. package/site-dist/assets/reference_adr_0001-new-repo-core-and-adapters.md.CjNHHmrf.lean.js +1 -0
  239. package/site-dist/assets/reference_adr_0002-two-orchestration-modes.md.CHD05agO.js +1 -0
  240. package/site-dist/assets/reference_adr_0002-two-orchestration-modes.md.CHD05agO.lean.js +1 -0
  241. package/site-dist/assets/reference_adr_0003-generate-once-then-lock.md.BaRiZfXT.js +1 -0
  242. package/site-dist/assets/reference_adr_0003-generate-once-then-lock.md.BaRiZfXT.lean.js +1 -0
  243. package/site-dist/assets/reference_adr_0004-external-contracts-stay-stable.md.DUJ7CTV1.js +1 -0
  244. package/site-dist/assets/reference_adr_0004-external-contracts-stay-stable.md.DUJ7CTV1.lean.js +1 -0
  245. package/site-dist/assets/reference_adr_0005-skill-names.md.DuBVd1tl.js +1 -0
  246. package/site-dist/assets/reference_adr_0005-skill-names.md.DuBVd1tl.lean.js +1 -0
  247. package/site-dist/assets/reference_adr_0006-deterministic-engine-platform-capabilities.md.Dcrnx1-L.js +1 -0
  248. package/site-dist/assets/reference_adr_0006-deterministic-engine-platform-capabilities.md.Dcrnx1-L.lean.js +1 -0
  249. package/site-dist/assets/reference_adr_0007-one-install-many-repos.md.C78cd4_P.js +1 -0
  250. package/site-dist/assets/reference_adr_0007-one-install-many-repos.md.C78cd4_P.lean.js +1 -0
  251. package/site-dist/assets/reference_adr_0008-capability-sources-and-platform-plugin.md.B4vBkIDS.js +1 -0
  252. package/site-dist/assets/reference_adr_0008-capability-sources-and-platform-plugin.md.B4vBkIDS.lean.js +1 -0
  253. package/site-dist/assets/reference_adr_index.md.Dx8sPsjs.js +1 -0
  254. package/site-dist/assets/reference_adr_index.md.Dx8sPsjs.lean.js +1 -0
  255. package/site-dist/assets/reference_commands.md.BFJRjNju.js +1 -0
  256. package/site-dist/assets/reference_commands.md.BFJRjNju.lean.js +1 -0
  257. package/site-dist/assets/reference_config.md.Dt_TJ2y9.js +6 -0
  258. package/site-dist/assets/reference_config.md.Dt_TJ2y9.lean.js +1 -0
  259. package/site-dist/assets/reference_contracts_agent-runtime.md.TK7Lhwdf.js +1 -0
  260. package/site-dist/assets/reference_contracts_agent-runtime.md.TK7Lhwdf.lean.js +1 -0
  261. package/site-dist/assets/reference_contracts_cli-json.md.Bonk0m6-.js +1 -0
  262. package/site-dist/assets/reference_contracts_cli-json.md.Bonk0m6-.lean.js +1 -0
  263. package/site-dist/assets/reference_contracts_feature-files.md.9n332kF_.js +26 -0
  264. package/site-dist/assets/reference_contracts_feature-files.md.9n332kF_.lean.js +26 -0
  265. package/site-dist/assets/reference_contracts_index.md.dqNwNs6U.js +1 -0
  266. package/site-dist/assets/reference_contracts_index.md.dqNwNs6U.lean.js +1 -0
  267. package/site-dist/assets/reference_contracts_notifier-event.md.D6we9wWS.js +24 -0
  268. package/site-dist/assets/reference_contracts_notifier-event.md.D6we9wWS.lean.js +24 -0
  269. package/site-dist/assets/reference_contracts_result-file.md.BmCaSlEu.js +1 -0
  270. package/site-dist/assets/reference_contracts_result-file.md.BmCaSlEu.lean.js +1 -0
  271. package/site-dist/assets/reference_contracts_spec.md.CDQYgJz7.js +8 -0
  272. package/site-dist/assets/reference_contracts_spec.md.CDQYgJz7.lean.js +8 -0
  273. package/site-dist/assets/reference_contracts_state.md.DVHC4opX.js +1 -0
  274. package/site-dist/assets/reference_contracts_state.md.DVHC4opX.lean.js +1 -0
  275. package/site-dist/assets/reference_contracts_usage-record.md.CQI2chqh.js +10 -0
  276. package/site-dist/assets/reference_contracts_usage-record.md.CQI2chqh.lean.js +10 -0
  277. package/site-dist/assets/reference_contracts_verify.md.CkJy8LXk.js +29 -0
  278. package/site-dist/assets/reference_contracts_verify.md.CkJy8LXk.lean.js +29 -0
  279. package/site-dist/assets/reference_design_adapter-guide.md.BSziZJSM.js +16 -0
  280. package/site-dist/assets/reference_design_adapter-guide.md.BSziZJSM.lean.js +16 -0
  281. package/site-dist/assets/reference_design_architecture.md.Bfoc-F2B.js +23 -0
  282. package/site-dist/assets/reference_design_architecture.md.Bfoc-F2B.lean.js +23 -0
  283. package/site-dist/assets/reference_design_builtin-capabilities.md.CZYtjo_v.js +7 -0
  284. package/site-dist/assets/reference_design_builtin-capabilities.md.CZYtjo_v.lean.js +7 -0
  285. package/site-dist/assets/reference_design_platform-vocabulary.md.xWGv5QO8.js +3 -0
  286. package/site-dist/assets/reference_design_platform-vocabulary.md.xWGv5QO8.lean.js +3 -0
  287. package/site-dist/assets/reference_scope.md.aUo6vISB.js +1 -0
  288. package/site-dist/assets/reference_scope.md.aUo6vISB.lean.js +1 -0
  289. package/site-dist/assets/style.BX2ZxxqY.css +1 -0
  290. package/site-dist/changelog.html +30 -0
  291. package/site-dist/favicon.svg +10 -0
  292. package/site-dist/guide/dsh.html +34 -0
  293. package/site-dist/guide/getting-started.html +30 -0
  294. package/site-dist/guide/how-it-works.html +54 -0
  295. package/site-dist/guide/index.html +30 -0
  296. package/site-dist/guide/install.html +48 -0
  297. package/site-dist/guide/intranet.html +38 -0
  298. package/site-dist/guide/maintainer.html +30 -0
  299. package/site-dist/guide/phases.html +30 -0
  300. package/site-dist/guide/project.html +106 -0
  301. package/site-dist/guide/user.html +30 -0
  302. package/site-dist/hashmap.json +1 -0
  303. package/site-dist/index.html +30 -0
  304. package/site-dist/logo-light.svg +6 -0
  305. package/site-dist/logo.svg +6 -0
  306. package/site-dist/reference/adr/0001-new-repo-core-and-adapters.html +30 -0
  307. package/site-dist/reference/adr/0002-two-orchestration-modes.html +30 -0
  308. package/site-dist/reference/adr/0003-generate-once-then-lock.html +30 -0
  309. package/site-dist/reference/adr/0004-external-contracts-stay-stable.html +30 -0
  310. package/site-dist/reference/adr/0005-skill-names.html +30 -0
  311. package/site-dist/reference/adr/0006-deterministic-engine-platform-capabilities.html +30 -0
  312. package/site-dist/reference/adr/0007-one-install-many-repos.html +30 -0
  313. package/site-dist/reference/adr/0008-capability-sources-and-platform-plugin.html +30 -0
  314. package/site-dist/reference/adr/index.html +30 -0
  315. package/site-dist/reference/commands.html +30 -0
  316. package/site-dist/reference/config.html +35 -0
  317. package/site-dist/reference/contracts/agent-runtime.html +30 -0
  318. package/site-dist/reference/contracts/cli-json.html +30 -0
  319. package/site-dist/reference/contracts/feature-files.html +55 -0
  320. package/site-dist/reference/contracts/index.html +30 -0
  321. package/site-dist/reference/contracts/notifier-event.html +53 -0
  322. package/site-dist/reference/contracts/result-file.html +30 -0
  323. package/site-dist/reference/contracts/spec.html +37 -0
  324. package/site-dist/reference/contracts/state.html +30 -0
  325. package/site-dist/reference/contracts/usage-record.html +39 -0
  326. package/site-dist/reference/contracts/verify.html +58 -0
  327. package/site-dist/reference/design/adapter-guide.html +45 -0
  328. package/site-dist/reference/design/architecture.html +52 -0
  329. package/site-dist/reference/design/builtin-capabilities.html +36 -0
  330. package/site-dist/reference/design/platform-vocabulary.html +32 -0
  331. package/site-dist/reference/scope.html +30 -0
  332. package/site-dist/vp-icons.css +1 -0
  333. package/skills/acceptance-criteria/SKILL.md +61 -0
  334. package/skills/laoshi/SKILL.md +111 -0
  335. package/skills/laoshi/playbooks/accept.md +65 -0
  336. package/skills/laoshi/playbooks/change.md +51 -0
  337. package/skills/laoshi/playbooks/incident.md +55 -0
  338. package/skills/laoshi/playbooks/new.md +96 -0
  339. package/skills/laoshi/playbooks/small.md +48 -0
  340. package/skills/laoshi/playbooks/status.md +41 -0
  341. package/skills/laoshi/playbooks/takeover.md +51 -0
  342. package/skills/laoshi/playbooks/unattended.md +101 -0
  343. package/skills/laoshi/playbooks/verify.md +57 -0
  344. package/skills/laoshi-doctor/SKILL.md +38 -0
  345. package/skills/laoshi-retro/SKILL.md +83 -0
  346. package/skills/laoshi-setup/SKILL.md +110 -0
  347. package/skills/laoshi-setup/templates/copy-local-files.mjs +32 -0
  348. package/skills/principle-delete-before-add/SKILL.md +33 -0
  349. package/skills/principle-dont-block-on-humans/SKILL.md +35 -0
  350. package/skills/principle-fix-root-cause/SKILL.md +33 -0
  351. package/skills/principle-prove-it-works/SKILL.md +33 -0
  352. package/skills/principle-report-honestly/SKILL.md +33 -0
  353. package/skills/principle-speak-to-reader/SKILL.md +33 -0
  354. package/skills/principle-this-requirement-only/SKILL.md +33 -0
  355. package/skills/requirement-interview/SKILL.md +97 -0
  356. package/skills/result-report/SKILL.md +34 -0
  357. package/skills/spec-writing/SKILL.md +58 -0
  358. package/skills/spec-writing/spec-template.md +109 -0
@@ -0,0 +1,31 @@
1
+ // Where the laoshi dsh plugin listens and how the engine finds it. Shared by the plugin (runs in
2
+ // the dsh host) and the engine's dsh runtime, so both compute the same places from DSH_HOME.
3
+ //
4
+ // The plugin opens a local socket (a named pipe on Windows) and writes a random token next to it;
5
+ // only processes that can read the token, i.e. the same user, can call it (ADR 0008: the engine
6
+ // talks to the plugin only, never to dsh's /api).
7
+ import crypto from "node:crypto";
8
+ import os from "node:os";
9
+ import path from "node:path";
10
+
11
+ /** dsh's home: $DSH_HOME, else ~/.dsh (dsh's own default). */
12
+ export function dshHome(env = process.env) {
13
+ const configured = env.DSH_HOME?.trim();
14
+ return configured ? path.resolve(configured) : path.join(os.homedir(), ".dsh");
15
+ }
16
+
17
+ /** The plugin's files under dsh's home, and the socket or pipe it listens on. */
18
+ export function channelPaths(home = dshHome()) {
19
+ const dir = path.join(home, "laoshi");
20
+ const tag = crypto.createHash("sha256").update(path.resolve(home)).digest("hex").slice(0, 12);
21
+ let socket;
22
+ if (process.platform === "win32") {
23
+ socket = `\\\\.\\pipe\\laoshi-dsh-${tag}`;
24
+ } else {
25
+ socket = path.join(dir, "plugin.sock");
26
+ // Unix socket paths are limited to about 104 bytes; a long home falls back to the temp directory
27
+ // (the token, not the path, is what keeps other users out).
28
+ if (Buffer.byteLength(socket) > 100) socket = path.join(os.tmpdir(), `laoshi-dsh-${tag}.sock`);
29
+ }
30
+ return { dir, socket, token: path.join(dir, "token"), log: path.join(dir, "plugin.log") };
31
+ }
@@ -0,0 +1,3 @@
1
+ export declare const name: string;
2
+ export declare const inject: string[];
3
+ export declare function apply(ctx: unknown, config?: { home?: string; approvals?: "ask" | "allow"; subagentProvider?: string }): void;
@@ -0,0 +1,292 @@
1
+ // laoshi's plugin for the DeepSeek Harness (dsh) host (ADR 0008, docs/design/dsh-adapter.md).
2
+ //
3
+ // The laoshi engine runs outside dsh and calls only this plugin, over a local socket guarded by a
4
+ // token (channel.mjs). The plugin does inside the host what dsh's /api cannot: start a step agent
5
+ // as a child of the chat, schedule a message into the chat, answer a step's approval request by
6
+ // policy; and it relays the rest (prompt, cancel, status, history) to dsh's session controller.
7
+ // It holds no pipeline logic: order, rounds and gates stay in the engine.
8
+ import crypto from "node:crypto";
9
+ import fs from "node:fs";
10
+ import net from "node:net";
11
+ import path from "node:path";
12
+ import { channelPaths, dshHome } from "./channel.mjs";
13
+
14
+ export const name = "laoshi-dsh";
15
+ export const inject = ["agents", "subagents", "schedule", "approval", "sessionController", "llm"];
16
+
17
+ const VERSION = "0.2.0-beta.1";
18
+ const SHELL_TOOLS = new Set(["bash", "pwsh"]);
19
+ const SEARCH_TOOLS = new Set(["grep", "glob"]);
20
+
21
+ /**
22
+ * @param {any} ctx dsh's Cordis context.
23
+ * @param {{ home?: string, approvals?: "ask" | "allow", subagentProvider?: string }} config
24
+ * approvals: "ask" (default) leaves a step's approval request to the person in dsh's UI and
25
+ * reports it to the engine; "allow" grants it once. Only laoshi's own step agents are affected.
26
+ */
27
+ export function apply(ctx, config = {}) {
28
+ const paths = channelPaths(config.home ? path.resolve(config.home) : dshHome());
29
+ fs.mkdirSync(paths.dir, { recursive: true, mode: 0o700 });
30
+ const log = (o) => {
31
+ try {
32
+ fs.appendFileSync(paths.log, JSON.stringify({ at: new Date().toISOString(), ...o }) + "\n");
33
+ } catch {}
34
+ };
35
+ const sessions = ctx.sessionController;
36
+ const approvals = config.approvals === "allow" ? "allow" : "ask";
37
+ const timeout = () => AbortSignal.timeout(60_000);
38
+
39
+ // Step agents laoshi started, child -> parent. Kept on disk so they are known after a restart.
40
+ const childrenFile = path.join(paths.dir, "children.json");
41
+ /** @type {Record<string, string>} */
42
+ const children = fs.existsSync(childrenFile) ? JSON.parse(fs.readFileSync(childrenFile, "utf8")) : {};
43
+ const saveChildren = () => fs.writeFileSync(childrenFile, JSON.stringify(children));
44
+ /** Activations started in this process: the first turn of a child, and how it ended. */
45
+ const activations = new Map();
46
+ /** Approval requests of laoshi's step agents that wait for a person, by session. */
47
+ const pending = new Map();
48
+ let approvalCount = 0;
49
+
50
+ ctx.on(
51
+ "approval/request",
52
+ async (req, next) => {
53
+ const sessionId = req.agent?.id;
54
+ if (!sessionId || !(sessionId in children)) return next(); // not a laoshi step: leave it alone
55
+ const title = [req.toolName, req.reason].filter(Boolean).join(":");
56
+ if (approvals === "allow") {
57
+ log({ approval: "allowed-once", sessionId, title });
58
+ return "allowed-once";
59
+ }
60
+ const id = `approval-${++approvalCount}`;
61
+ const list = pending.get(sessionId) ?? [];
62
+ list.push({ id, title });
63
+ pending.set(sessionId, list);
64
+ log({ approval: "asked", sessionId, title });
65
+ try {
66
+ return await next();
67
+ } finally {
68
+ const rest = (pending.get(sessionId) ?? []).filter((p) => p.id !== id);
69
+ if (rest.length) pending.set(sessionId, rest);
70
+ else pending.delete(sessionId);
71
+ }
72
+ },
73
+ { prepend: true }, // the Web gateway's answerer forwards to the browser and does not call next()
74
+ );
75
+
76
+ const address = (sessionId) =>
77
+ sessionId in children
78
+ ? { kind: "subagent", parentSessionId: children[sessionId], childSessionId: sessionId, mode: "continuable" }
79
+ : { kind: "session", sessionId };
80
+
81
+ async function summary(sessionId) {
82
+ const { items } = await sessions.list({}, timeout());
83
+ return items.find((i) => i.sessionId === sessionId) ?? null;
84
+ }
85
+
86
+ async function events(sessionId) {
87
+ const page = await sessions.page({ address: address(sessionId), maxMessages: 1000 }, timeout());
88
+ return page.records.filter((r) => r.type === "event").map((r) => r.event);
89
+ }
90
+
91
+ async function prompt(sessionId, text, mode = "queue") {
92
+ const content = [{ type: "text", text }];
93
+ const requestId = `laoshi-${crypto.randomUUID()}`;
94
+ if (sessionId in children) {
95
+ await ctx.subagents.prompt(
96
+ { requestId, parentSessionId: children[sessionId], childSessionId: sessionId, mode: "continuable", delivery: mode, content },
97
+ timeout(),
98
+ );
99
+ } else {
100
+ await sessions.prompt({ requestId, sessionId, mode, content }, timeout());
101
+ }
102
+ }
103
+
104
+ async function liveAgent(sessionId) {
105
+ const live = ctx.agents.get(sessionId);
106
+ if (live) return live;
107
+ const handle = await ctx.agents.resume({ resumeSessionId: sessionId });
108
+ return handle.agent;
109
+ }
110
+
111
+ const methods = {
112
+ hello: async () => ({ plugin: VERSION, approvals }),
113
+
114
+ /** The chat (or any session): does it exist, where does it work. */
115
+ session: async ({ sessionId }) => {
116
+ const s = await summary(sessionId);
117
+ return s ? { exists: true, cwd: s.cwd ?? null, running: s.running, parentSessionId: s.parentSessionId ?? null } : { exists: false };
118
+ },
119
+
120
+ /** A step agent as a child of the chat, labelled, working in cwd; its result goes to the engine only. */
121
+ spawn: async ({ parent, label, prompt: text, cwd, model }) => {
122
+ const parentAgent = await liveAgent(parent);
123
+ const provider = config.subagentProvider ?? "spawn";
124
+ // The step's own model (the role's provider/model in laoshi's config); without it, the chat's.
125
+ const agentOptions = model?.provider && model?.model ? { provider: model.provider, model: model.model, ...(model.reasoningEffort ? { reasoningEffort: model.reasoningEffort } : {}) } : null;
126
+ const activation = await ctx.subagents.startActivation({
127
+ provider,
128
+ label,
129
+ request: { prompt: [{ type: "text", text }], parent: parentAgent, cwd, ...(agentOptions ? { agentOptions } : {}) },
130
+ signal: new AbortController().signal,
131
+ delivery: "caller",
132
+ });
133
+ const childId = activation.childId;
134
+ children[childId] = parent;
135
+ saveChildren();
136
+ const entry = { settled: null };
137
+ activations.set(childId, entry);
138
+ activation.result.then(
139
+ (result) => (entry.settled = { ok: true, stopReason: result?.stopReason ?? null }),
140
+ (error) => (entry.settled = { ok: false, error: String(error?.message ?? error) }),
141
+ );
142
+ log({ spawn: childId, parent, label, provider, cwd, model: agentOptions });
143
+ return { childId };
144
+ },
145
+
146
+ /** The models step agents can use: every provider route with an adapter, and its models. */
147
+ models: async () => {
148
+ const providers = [];
149
+ for (const p of ctx.llm.listProviders()) {
150
+ const models = await ctx.llm.listModels(p.id).catch(() => []);
151
+ providers.push({ provider: p.id, name: p.name, models: models.map((m) => ({ id: m.id, name: m.name })) });
152
+ }
153
+ return { providers };
154
+ },
155
+
156
+ /** Is the session working, waiting for an approval, how much has it used. */
157
+ status: async ({ sessionId }) => {
158
+ const s = await summary(sessionId);
159
+ if (!s) return { exists: false };
160
+ const values = s.projections?.values ?? {};
161
+ const inbox = values.inbox ?? {};
162
+ const queued = (inbox["next-turn"]?.length ?? 0) + (inbox["next-step"]?.length ?? 0);
163
+ const activation = activations.get(sessionId);
164
+ const firstTurn = activation && activation.settled === null;
165
+ return {
166
+ exists: true,
167
+ running: Boolean(s.running) || queued > 0 || Boolean(firstTurn),
168
+ pendingPermissions: pending.get(sessionId) ?? [],
169
+ usage: values.tokenUsage ?? null,
170
+ error: activation?.settled && !activation.settled.ok ? activation.settled.error : null,
171
+ };
172
+ },
173
+
174
+ /** The last thing the agent said. */
175
+ lastMessage: async ({ sessionId }) => {
176
+ const texts = (await events(sessionId))
177
+ .filter((e) => e.type === "assistant/message")
178
+ .map((e) => (e.data.message?.content ?? []).filter((p) => p.type === "text").map((p) => p.text).join(""));
179
+ return { text: texts.at(-1) ?? null };
180
+ },
181
+
182
+ /** The session's tool calls, in the engine's terms (shell / search / …). */
183
+ toolCalls: async ({ sessionId }) => {
184
+ const evs = await events(sessionId);
185
+ const done = new Set(evs.filter((e) => e.type === "tool/result").map((e) => e.data.message?.toolCallId));
186
+ return {
187
+ calls: evs
188
+ .filter((e) => e.type === "tool/call")
189
+ .map((e) => {
190
+ let args = {};
191
+ try {
192
+ args = JSON.parse(e.data.arguments ?? "{}");
193
+ } catch {}
194
+ const tool = String(e.data.name ?? "");
195
+ const kind = SHELL_TOOLS.has(tool) ? "shell" : SEARCH_TOOLS.has(tool) ? "search" : tool;
196
+ const text = kind === "shell" ? args.command : kind === "search" ? (args.pattern ?? args.query) : (args.command ?? "");
197
+ return {
198
+ callId: String(e.data.callId),
199
+ kind,
200
+ text: String(text ?? ""),
201
+ status: done.has(e.data.callId) ? "completed" : "running",
202
+ startedAt: new Date(e.time).toISOString(),
203
+ };
204
+ }),
205
+ };
206
+ },
207
+
208
+ /** A message into the session, after its current turn (never interrupting it). */
209
+ prompt: async ({ sessionId, text }) => {
210
+ await prompt(sessionId, text, "queue");
211
+ return {};
212
+ },
213
+
214
+ /** Stop the session's current turn, then give it text. */
215
+ interrupt: async ({ sessionId, text }) => {
216
+ if (sessionId in children) ctx.subagents.interruptByParent(sessionId, children[sessionId], "continuable");
217
+ else sessions.cancel({ sessionId });
218
+ if (text) await prompt(sessionId, text, "queue");
219
+ return {};
220
+ },
221
+
222
+ /** A new top-level session in cwd, given a first message (a requirement's own chat). */
223
+ startSession: async ({ cwd, prompt: text }) => {
224
+ const { sessionId } = await sessions.create({ cwd });
225
+ await prompt(sessionId, text, "queue");
226
+ return { sessionId };
227
+ },
228
+
229
+ /** A message into the session at a time (`at`, ISO) or on a five-field cron in a time zone. */
230
+ schedule: async ({ sessionId, title, prompt: text, at, cron, timeZone }) => {
231
+ const timing = cron ? { cron: { expression: cron, time_zone: timeZone } } : { at };
232
+ const record = await ctx.schedule.create(sessionId, { title, prompt: text, ...timing });
233
+ log({ schedule: record.id, sessionId, title });
234
+ return { id: record.id };
235
+ },
236
+
237
+ cancelSchedule: async ({ sessionId, id }) => {
238
+ await ctx.schedule.delete({ sessionId, id });
239
+ return {};
240
+ },
241
+ };
242
+
243
+ // ---- the local socket
244
+ const token = crypto.randomBytes(32).toString("hex");
245
+ const tokenOk = (given) => typeof given === "string" && given.length === token.length && crypto.timingSafeEqual(Buffer.from(given), Buffer.from(token));
246
+ const server = net.createServer((socket) => {
247
+ let buffer = "";
248
+ socket.setEncoding("utf8");
249
+ socket.on("data", (chunk) => {
250
+ buffer += chunk;
251
+ let nl;
252
+ while ((nl = buffer.indexOf("\n")) >= 0) {
253
+ const line = buffer.slice(0, nl);
254
+ buffer = buffer.slice(nl + 1);
255
+ handle(line).then((reply) => socket.write(JSON.stringify(reply) + "\n"));
256
+ }
257
+ });
258
+ socket.on("error", () => {});
259
+ });
260
+
261
+ async function handle(line) {
262
+ let req;
263
+ try {
264
+ req = JSON.parse(line);
265
+ } catch {
266
+ return { id: null, ok: false, error: "bad request" };
267
+ }
268
+ if (!tokenOk(req.token)) return { id: req.id ?? null, ok: false, error: "unauthorized" };
269
+ const method = methods[req.method];
270
+ if (!method) return { id: req.id, ok: false, error: `unknown method ${req.method}` };
271
+ try {
272
+ return { id: req.id, ok: true, result: await method(req.params ?? {}) };
273
+ } catch (e) {
274
+ log({ method: req.method, error: String(e?.stack ?? e).slice(0, 800) });
275
+ return { id: req.id, ok: false, error: String(e?.message ?? e) };
276
+ }
277
+ }
278
+
279
+ if (process.platform !== "win32") fs.rmSync(paths.socket, { force: true });
280
+ server.listen(paths.socket, () => {
281
+ if (process.platform !== "win32") fs.chmodSync(paths.socket, 0o600);
282
+ fs.writeFileSync(paths.token, token, { mode: 0o600 });
283
+ log({ listening: paths.socket, version: VERSION, approvals });
284
+ });
285
+ server.on("error", (e) => log({ serverError: String(e?.message ?? e) }));
286
+
287
+ ctx.on("dispose", () => {
288
+ server.close();
289
+ fs.rmSync(paths.token, { force: true });
290
+ if (process.platform !== "win32") fs.rmSync(paths.socket, { force: true });
291
+ });
292
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "laoshi-dsh-plugin",
3
+ "version": "0.2.0-beta.1",
4
+ "private": true,
5
+ "description": "laoshi's plugin for the DeepSeek Harness host: creates step agents under the chat, schedules messages, answers approvals by policy, and serves the laoshi engine over a local socket (ADR 0008).",
6
+ "type": "module",
7
+ "main": "index.mjs",
8
+ "exports": {
9
+ ".": "./index.mjs"
10
+ },
11
+ "files": [
12
+ "index.mjs",
13
+ "index.d.mts",
14
+ "channel.mjs",
15
+ "channel.d.mts"
16
+ ],
17
+ "license": "MIT"
18
+ }
@@ -0,0 +1,46 @@
1
+ // The 摸高 adapter (docs/design/mogao-expert.md, form B1): step agents are runs of the platform's
2
+ // command line (`aimax run`), approvals are the platform's HITL answered through laoshi, tool calls
3
+ // and usage come from the platform's progress callback. Worktrees and services are laoshi's builtin
4
+ // ones. The platform keeps a chat's machine for one turn, so the engine runs in the chat's command.
5
+
6
+ import { spawnSync } from "node:child_process";
7
+ import path from "node:path";
8
+ import { fileURLToPath } from "node:url";
9
+ import type { PlatformAdapter } from "../../engine/src/platform.js";
10
+ import { mogaoSettings } from "./mogao-runtime.js";
11
+
12
+ export const mogaoAdapter: PlatformAdapter = {
13
+ id: "mogao",
14
+ displayName: "摸高",
15
+ createRuntime: async (input) => (await import("./mogao-runtime.js")).createRuntime(input),
16
+ capabilities: {
17
+ services: "builtin",
18
+ worktree: "builtin",
19
+ activity: "platform",
20
+ runningTool: "platform",
21
+ toolCalls: "platform",
22
+ },
23
+ originEnv: { id: "AIMAX_SESSION_ID" },
24
+ runsInChat: true,
25
+ skillSetup: path.join(path.dirname(fileURLToPath(import.meta.url)), "skill", "setup.md"),
26
+ words: {
27
+ name: "摸高",
28
+ chat: "摸高的对话",
29
+ schedule: "定时任务(摸高上没有,到时请在对话里说\"继续\")",
30
+ approvePermission: "在对话里回答\"批准\"或\"拒绝\",对话会运行 `laoshi permission <需求> approve`(或 `deny`)并接着做",
31
+ signIn: "检查摸高的模型配置",
32
+ origin: "摸高提供的 `AIMAX_SESSION_ID`",
33
+ connectFix: "确认在摸高的对话里运行,并且 `aimax` 命令可用(`aimax --version`)。",
34
+ },
35
+ doctorTitle: "摸高(aimax 命令行)",
36
+ async doctorPlatform({ config, tools }) {
37
+ const settings = mogaoSettings(config);
38
+ const r = spawnSync(settings.command, ["--version"], { encoding: "utf8", timeout: 20_000 });
39
+ if (r.error || r.status !== 0) {
40
+ tools.report("fail", `运行 ${settings.command} --version 失败:${r.error?.message ?? (r.stderr || r.stdout).trim()}`, "在摸高的对话或沙箱里运行;不在 PATH 中时在安装级配置的 platform.mogao.command 写上它的完整路径");
41
+ return;
42
+ }
43
+ tools.report("ok", `aimax ${(r.stdout || "").trim()}(数据目录 ${settings.dataDir},单次运行上限 ${settings.runTimeoutMinutes} 分钟)`);
44
+ if (!process.env.AIMAX_SESSION_ID) tools.info("没有 AIMAX_SESSION_ID:不在摸高的对话里运行,进展只写入日志");
45
+ },
46
+ };
@@ -0,0 +1,31 @@
1
+ // laoshi installer, 摸高 part (bin/install.mjs). The platform loads skills from the expert that is
2
+ // submitted to it, so the skills rendered for 摸高 go into the install root's skills directory: that
3
+ // directory is the expert's skill package. Nothing else to install: step agents use `aimax`.
4
+ import path from "node:path";
5
+
6
+ export const id = "mogao";
7
+
8
+ /** Installer options this platform reads (bin/install.mjs passes them through). */
9
+ export const options = {};
10
+
11
+ /** The install-level config's platform section for a new installation. */
12
+ export function platformConfig() {
13
+ return { adapter: "mogao", mogao: { dataDir: "/data" } };
14
+ }
15
+
16
+ /** Every step on the platform's model (`aimax run` takes the chat's). */
17
+ export const defaultAgents = { builder: { provider: "mogao/chat-model" }, reviewer: { provider: "mogao/chat-model" } };
18
+
19
+ /** The expert's skill package: <install root>/skills. */
20
+ export function skillTargets(args, config, env = process.env, home) {
21
+ const root = home ?? path.resolve(env.LAOSHI_HOME ?? path.join(env.HOME ?? "", ".laoshi"));
22
+ const dir = path.join(root, "skills");
23
+ return [{ dir, label: `专家的 skill 目录 ${dir}(提交到摸高的专家用这个目录)` }];
24
+ }
25
+
26
+ export function setup({ report }) {
27
+ report("info", "步骤 agent 用摸高的 aimax 命令运行;在摸高上请把安装根放在工作区(LAOSHI_HOME=/data/workspace/.laoshi)");
28
+ return ["把上面专家的 skill 目录提交为摸高的专家(或在对话里加载它)", "体检:laoshi doctor --no-project"];
29
+ }
30
+
31
+ export function uninstall() {}
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env node
2
+ // Builds the 摸高 expert: laoshi's skills rendered for 摸高, as they will run there (the program in
3
+ // the workspace, /data/workspace/.laoshi/npm/node_modules/<package>, installed on first use by the
4
+ // skills themselves), and a short description of the expert. The result is what is submitted to the
5
+ // platform as the expert (a directory and a zip of it).
6
+ //
7
+ // node adapters/mogao/make-expert.mjs [--out <dir>]
8
+ import { execFileSync, spawnSync } from "node:child_process";
9
+ import fs from "node:fs";
10
+ import path from "node:path";
11
+ import { fileURLToPath } from "node:url";
12
+ import { parseArgs } from "node:util";
13
+
14
+ const kit = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..");
15
+ const pkg = JSON.parse(fs.readFileSync(path.join(kit, "package.json"), "utf8"));
16
+ const { values } = parseArgs({ options: { out: { type: "string", default: path.join(kit, "dist-expert") } } });
17
+ const WORKSPACE_HOME = "/data/workspace/.laoshi";
18
+ const programRoot = `${WORKSPACE_HOME}/npm/node_modules/${pkg.name}`;
19
+ const name = `laoshi-expert-${pkg.version}`;
20
+ const out = path.resolve(values.out, name);
21
+ fs.rmSync(out, { recursive: true, force: true });
22
+ fs.mkdirSync(out, { recursive: true });
23
+
24
+ const config = path.join(out, ".render-config.json");
25
+ fs.writeFileSync(config, JSON.stringify({ platform: { adapter: "mogao" } }));
26
+ const tsx = path.join(kit, "node_modules", "tsx", "dist", "cli.mjs");
27
+ const r = spawnSync(process.execPath, [tsx, path.join(kit, "engine", "src", "skills-render.ts"), "--out", path.join(out, "skills"), "--config", config, "--root", programRoot], { encoding: "utf8" });
28
+ fs.rmSync(config);
29
+ if (r.status !== 0) {
30
+ console.error(r.stderr || r.stdout);
31
+ process.exit(1);
32
+ }
33
+
34
+ const skills = fs.readdirSync(path.join(out, "skills")).filter((d) => fs.existsSync(path.join(out, "skills", d, "SKILL.md")));
35
+ const describe = (d) => /^description:\s*(.+)$/m.exec(fs.readFileSync(path.join(out, "skills", d, "SKILL.md"), "utf8"))?.[1] ?? "";
36
+ fs.writeFileSync(
37
+ path.join(out, "EXPERT.md"),
38
+ [
39
+ `# laoshi 需求开发专家(${pkg.version})`,
40
+ "",
41
+ "给测试、产品、项目经理用:在对话里把需求谈清楚、写成需求说明并确认,之后由一组 agent 完成方案、实现、评审、验证和报告,每个要拍板的地方都停下来等人。",
42
+ "",
43
+ "- 入口:`/laoshi`(需求开发)、`/laoshi-setup`(项目接入,每个项目一次)、`/laoshi-doctor`(体检)、`/laoshi-retro`(复盘)",
44
+ `- 第一次使用时,入口 skill 会从内网 npm 镜像把 \`${pkg.name}@${pkg.version}\` 装到 \`${WORKSPACE_HOME}\`(约一分钟),之后每个对话直接使用`,
45
+ "- 每一步是摸高的一个独立 agent(`aimax run`);需要批准的操作走摸高的人工审批;进度和用量来自摸高的回调",
46
+ "",
47
+ "## 包含的 skill",
48
+ "",
49
+ "| skill | 作用 |",
50
+ "| --- | --- |",
51
+ ...skills.sort().map((d) => `| \`${d}\` | ${describe(d).replace(/\|/g, "\\|")} |`),
52
+ "",
53
+ ].join("\n"),
54
+ );
55
+
56
+ const zip = path.resolve(values.out, `${name}.zip`);
57
+ fs.rmSync(zip, { force: true });
58
+ try {
59
+ execFileSync("zip", ["-qr", zip, name], { cwd: path.resolve(values.out) });
60
+ console.log(`已生成专家:${out}\n压缩包:${zip}`);
61
+ } catch {
62
+ console.log(`已生成专家:${out}(没有 zip 命令,未打包)`);
63
+ }