@jennie-shawn/starwork 0.1.0-alpha.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 (228) hide show
  1. package/README.md +18 -0
  2. package/adapters/README.md +5 -0
  3. package/cli/README.md +52 -0
  4. package/cli/adapt-spec.md +61 -0
  5. package/cli/bin/starwork.js +8 -0
  6. package/cli/doctor-spec.md +516 -0
  7. package/cli/init-spec.md +435 -0
  8. package/cli/pack-install-spec.md +63 -0
  9. package/cli/spawn-blueprint-spec.md +657 -0
  10. package/cli/spawn-spec.md +439 -0
  11. package/cli/src/cli.js +1955 -0
  12. package/cli/test/init.test.js +436 -0
  13. package/core/README.md +51 -0
  14. package/core/baseline/README.md +12 -0
  15. package/core/baseline/file-boundaries.md +25 -0
  16. package/core/baseline/health-check.md +27 -0
  17. package/core/baseline/roles.md +26 -0
  18. package/core/baseline/spec.md +47 -0
  19. package/core/capabilities/README.md +15 -0
  20. package/core/capabilities/decisions/capability.md +26 -0
  21. package/core/capabilities/local-identity/capability.md +15 -0
  22. package/core/capabilities/local-identity/templates/identity/README.md +5 -0
  23. package/core/capabilities/local-lessons/capability.md +15 -0
  24. package/core/capabilities/local-lessons/templates/lessons/README.md +5 -0
  25. package/core/capabilities/main-repo-sync/capability.md +133 -0
  26. package/core/capabilities/main-repo-sync/templates/.core-sync.example.json +31 -0
  27. package/core/capabilities/main-repo-sync/templates/.internal/README.md +5 -0
  28. package/core/capabilities/matter-mode/capability.md +46 -0
  29. package/core/capabilities/matter-mode/templates/matters/_matter-template/README.md +17 -0
  30. package/core/capabilities/matter-mode/templates/matters/_matter-template/drafts/.gitkeep +1 -0
  31. package/core/capabilities/matter-mode/templates/matters/_matter-template/handoff.md +3 -0
  32. package/core/capabilities/matter-mode/templates/matters/_matter-template/notes.md +5 -0
  33. package/core/capabilities/matter-mode/templates/matters/_matter-template/progress.md +5 -0
  34. package/core/capabilities/matter-mode/templates/matters/registry.md +16 -0
  35. package/core/capabilities/skill-mount/capability.md +24 -0
  36. package/core/capabilities/starter-outputs/capability.md +25 -0
  37. package/core/capabilities/starter-outputs/templates/outputs/drafts/README.md +5 -0
  38. package/core/capabilities/starter-outputs/templates/outputs/final/README.md +5 -0
  39. package/core/capabilities/starter-outputs/templates/references/README.md +5 -0
  40. package/core/core-v0.1-protocol.md +201 -0
  41. package/core/kits/README.md +15 -0
  42. package/core/kits/hub/.incoming/README.md +5 -0
  43. package/core/kits/hub/AGENTS.md +26 -0
  44. package/core/kits/hub/README.md +25 -0
  45. package/core/kits/hub/_/347/263/273/347/273/237//344/270/212/344/270/213/346/226/207//351/241/271/347/233/256/347/212/266/346/200/201.md +24 -0
  46. package/core/kits/hub/_/347/263/273/347/273/237//344/273/273/345/212/241//345/275/223/345/211/215/345/267/245/344/275/234.md +17 -0
  47. package/core/kits/hub/identity/README.md +5 -0
  48. package/core/kits/hub/lessons/README.md +5 -0
  49. package/core/kits/hub/skills/README.md +5 -0
  50. package/core/kits/hub//347/237/245/350/257/206/README.md +5 -0
  51. package/core/kits/hub//351/241/271/347/233/256/README.md +5 -0
  52. package/core/kits/hub//351/241/271/347/233/256/registry.json +4 -0
  53. package/core/kits/hub//351/241/271/347/233/256//350/201/224/347/273/234/README.md +5 -0
  54. package/core/kits/kit-structure-reference.md +253 -0
  55. package/core/kits/local-matter/AGENTS.md +23 -0
  56. package/core/kits/local-matter/README.md +22 -0
  57. package/core/kits/local-matter/_/347/263/273/347/273/237//344/270/212/344/270/213/346/226/207//345/206/263/347/255/226.md +7 -0
  58. package/core/kits/local-matter/_/347/263/273/347/273/237//344/270/212/344/270/213/346/226/207//351/241/271/347/233/256/347/212/266/346/200/201.md +25 -0
  59. package/core/kits/local-matter/_/347/263/273/347/273/237//344/273/273/345/212/241//345/275/223/345/211/215/345/267/245/344/275/234.md +17 -0
  60. package/core/kits/local-matter/_/347/263/273/347/273/237//346/225/231/350/256/255/README.md +5 -0
  61. package/core/kits/local-matter/_/347/263/273/347/273/237//350/272/253/344/273/275/README.md +5 -0
  62. package/core/kits/local-matter//344/272/213/351/241/271/_/344/272/213/351/241/271/346/250/241/346/235/277/README.md +17 -0
  63. package/core/kits/local-matter//344/272/213/351/241/271/_/344/272/213/351/241/271/346/250/241/346/235/277//344/272/244/346/216/245.md +3 -0
  64. package/core/kits/local-matter//344/272/213/351/241/271/_/344/272/213/351/241/271/346/250/241/346/235/277//347/254/224/350/256/260.md +5 -0
  65. package/core/kits/local-matter//344/272/213/351/241/271/_/344/272/213/351/241/271/346/250/241/346/235/277//350/215/211/347/250/277/.gitkeep +1 -0
  66. package/core/kits/local-matter//344/272/213/351/241/271/_/344/272/213/351/241/271/346/250/241/346/235/277//350/277/233/345/272/246.md +5 -0
  67. package/core/kits/local-matter//344/272/213/351/241/271//346/263/250/345/206/214/350/241/250.md +16 -0
  68. package/core/kits/local-matter//345/217/202/350/200/203/350/265/204/346/226/231/README.md +5 -0
  69. package/core/kits/local-matter//350/276/223/345/207/272//347/241/256/350/256/244/346/210/220/346/236/234/README.md +5 -0
  70. package/core/kits/local-matter//350/276/223/345/207/272//350/215/211/347/250/277/README.md +5 -0
  71. package/core/kits/local-starter/AGENTS.md +23 -0
  72. package/core/kits/local-starter/README.md +23 -0
  73. package/core/kits/local-starter/_/347/263/273/347/273/237//344/270/212/344/270/213/346/226/207//351/241/271/347/233/256/347/212/266/346/200/201.md +25 -0
  74. package/core/kits/local-starter/_/347/263/273/347/273/237//344/273/273/345/212/241//345/275/223/345/211/215/345/267/245/344/275/234.md +17 -0
  75. package/core/kits/local-starter/_/347/263/273/347/273/237//346/225/231/350/256/255/README.md +5 -0
  76. package/core/kits/local-starter/_/347/263/273/347/273/237//350/272/253/344/273/275/README.md +5 -0
  77. package/core/kits/local-starter//345/217/202/350/200/203/350/265/204/346/226/231/README.md +5 -0
  78. package/core/kits/local-starter//350/276/223/345/207/272//347/241/256/350/256/244/346/210/220/346/236/234/README.md +5 -0
  79. package/core/kits/local-starter//350/276/223/345/207/272//350/215/211/347/250/277/README.md +5 -0
  80. package/core/kits/satellite-matter/.agents/skills/README.md +5 -0
  81. package/core/kits/satellite-matter/.claude/skills/README.md +5 -0
  82. package/core/kits/satellite-matter/.core-sync.json +31 -0
  83. package/core/kits/satellite-matter/.internal/README.md +5 -0
  84. package/core/kits/satellite-matter/.obsidian/README.md +5 -0
  85. package/core/kits/satellite-matter/AGENTS.md +27 -0
  86. package/core/kits/satellite-matter/CLAUDE.md +5 -0
  87. package/core/kits/satellite-matter/README.md +40 -0
  88. package/core/kits/satellite-matter/_/347/263/273/347/273/237//344/270/212/344/270/213/346/226/207//345/206/263/347/255/226.md +7 -0
  89. package/core/kits/satellite-matter/_/347/263/273/347/273/237//344/270/212/344/270/213/346/226/207//345/275/223/345/211/215/351/241/271/347/233/256.md +29 -0
  90. package/core/kits/satellite-matter/_/347/263/273/347/273/237//344/270/273/345/272/223/345/220/214/346/255/245/README.md +42 -0
  91. package/core/kits/satellite-matter/_/347/263/273/347/273/237//344/273/273/345/212/241//345/275/223/345/211/215/345/267/245/344/275/234.md +17 -0
  92. package/core/kits/satellite-matter/_/347/263/273/347/273/237//346/225/231/350/256/255/README.md +8 -0
  93. package/core/kits/satellite-matter/_/347/263/273/347/273/237//350/267/250/351/241/271/347/233/256/README.md +9 -0
  94. package/core/kits/satellite-matter/_/347/263/273/347/273/237//350/267/250/351/241/271/347/233/256/inbox/README.md +5 -0
  95. package/core/kits/satellite-matter/_/347/263/273/347/273/237//350/267/250/351/241/271/347/233/256/outbox/README.md +5 -0
  96. package/core/kits/satellite-matter/_/347/263/273/347/273/237//350/272/253/344/273/275/README.md +5 -0
  97. package/core/kits/satellite-matter//344/272/213/351/241/271/_/344/272/213/351/241/271/346/250/241/346/235/277/README.md +17 -0
  98. package/core/kits/satellite-matter//344/272/213/351/241/271/_/344/272/213/351/241/271/346/250/241/346/235/277//344/272/244/346/216/245.md +3 -0
  99. package/core/kits/satellite-matter//344/272/213/351/241/271/_/344/272/213/351/241/271/346/250/241/346/235/277//347/254/224/350/256/260.md +5 -0
  100. package/core/kits/satellite-matter//344/272/213/351/241/271/_/344/272/213/351/241/271/346/250/241/346/235/277//350/215/211/347/250/277/.gitkeep +1 -0
  101. package/core/kits/satellite-matter//344/272/213/351/241/271/_/344/272/213/351/241/271/346/250/241/346/235/277//350/277/233/345/272/246.md +5 -0
  102. package/core/kits/satellite-matter//344/272/213/351/241/271//346/263/250/345/206/214/350/241/250.md +16 -0
  103. package/core/kits/satellite-matter//345/217/202/350/200/203/350/265/204/346/226/231/README.md +5 -0
  104. package/core/kits/satellite-matter//347/237/245/350/257/206/README.md +5 -0
  105. package/core/kits/satellite-matter//350/276/223/345/207/272//347/241/256/350/256/244/346/210/220/346/236/234/README.md +5 -0
  106. package/core/kits/satellite-matter//350/276/223/345/207/272//350/215/211/347/250/277/README.md +5 -0
  107. package/core/kits/satellite-starter/.agents/skills/README.md +5 -0
  108. package/core/kits/satellite-starter/.claude/skills/README.md +5 -0
  109. package/core/kits/satellite-starter/.core-sync.json +31 -0
  110. package/core/kits/satellite-starter/.internal/README.md +5 -0
  111. package/core/kits/satellite-starter/.obsidian/README.md +5 -0
  112. package/core/kits/satellite-starter/AGENTS.md +25 -0
  113. package/core/kits/satellite-starter/CLAUDE.md +5 -0
  114. package/core/kits/satellite-starter/README.md +42 -0
  115. package/core/kits/satellite-starter/_/347/263/273/347/273/237//344/270/212/344/270/213/346/226/207//345/275/223/345/211/215/351/241/271/347/233/256.md +29 -0
  116. package/core/kits/satellite-starter/_/347/263/273/347/273/237//344/270/273/345/272/223/345/220/214/346/255/245/README.md +40 -0
  117. package/core/kits/satellite-starter/_/347/263/273/347/273/237//344/273/273/345/212/241//345/275/223/345/211/215/345/267/245/344/275/234.md +17 -0
  118. package/core/kits/satellite-starter/_/347/263/273/347/273/237//346/225/231/350/256/255/README.md +8 -0
  119. package/core/kits/satellite-starter/_/347/263/273/347/273/237//350/267/250/351/241/271/347/233/256/README.md +9 -0
  120. package/core/kits/satellite-starter/_/347/263/273/347/273/237//350/267/250/351/241/271/347/233/256/inbox/README.md +5 -0
  121. package/core/kits/satellite-starter/_/347/263/273/347/273/237//350/267/250/351/241/271/347/233/256/outbox/README.md +5 -0
  122. package/core/kits/satellite-starter/_/347/263/273/347/273/237//350/272/253/344/273/275/README.md +5 -0
  123. package/core/kits/satellite-starter//345/217/202/350/200/203/350/265/204/346/226/231/README.md +5 -0
  124. package/core/kits/satellite-starter//347/237/245/350/257/206/README.md +5 -0
  125. package/core/kits/satellite-starter//350/276/223/345/207/272//347/241/256/350/256/244/346/210/220/346/236/234/README.md +5 -0
  126. package/core/kits/satellite-starter//350/276/223/345/207/272//350/215/211/347/250/277/README.md +5 -0
  127. package/core/presets/README.md +26 -0
  128. package/core/presets/hub.yaml +10 -0
  129. package/core/presets/local-matter.yaml +14 -0
  130. package/core/presets/local-starter.yaml +12 -0
  131. package/core/presets/satellite-matter.yaml +17 -0
  132. package/core/presets/satellite-starter.yaml +15 -0
  133. package/core/profiles/README.md +18 -0
  134. package/core/profiles/en/labels.json +26 -0
  135. package/core/profiles/en/paths.json +21 -0
  136. package/core/profiles/en/profile.md +22 -0
  137. package/core/profiles/en/reference-kits/local-starter/AGENTS.md +23 -0
  138. package/core/profiles/en/reference-kits/local-starter/README.md +23 -0
  139. package/core/profiles/en/reference-kits/local-starter/_system/context/project-status.md +25 -0
  140. package/core/profiles/en/reference-kits/local-starter/_system/identity/README.md +5 -0
  141. package/core/profiles/en/reference-kits/local-starter/_system/lessons/README.md +5 -0
  142. package/core/profiles/en/reference-kits/local-starter/_system/tasks/current-work.md +17 -0
  143. package/core/profiles/en/reference-kits/local-starter/outputs/drafts/README.md +5 -0
  144. package/core/profiles/en/reference-kits/local-starter/outputs/final/README.md +5 -0
  145. package/core/profiles/en/reference-kits/local-starter/references/README.md +5 -0
  146. package/core/profiles/en/reference-presets/local-starter.yaml +12 -0
  147. package/core/profiles/en/templates/AGENTS.md +23 -0
  148. package/core/profiles/en/templates/_system/context/project-status.md +25 -0
  149. package/core/profiles/en/templates/_system/tasks/current-work.md +17 -0
  150. package/core/profiles/zh/labels.json +26 -0
  151. package/core/profiles/zh/paths.json +21 -0
  152. package/core/profiles/zh/profile.md +22 -0
  153. package/core/profiles/zh/templates/AGENTS.md +23 -0
  154. package/core/profiles/zh/templates/_/347/263/273/347/273/237//344/270/212/344/270/213/346/226/207//351/241/271/347/233/256/347/212/266/346/200/201.md +25 -0
  155. package/core/profiles/zh/templates/_/347/263/273/347/273/237//344/273/273/345/212/241//345/275/223/345/211/215/345/267/245/344/275/234.md +17 -0
  156. package/docs/README.md +18 -0
  157. package/docs/alpha-test-guide.md +124 -0
  158. package/docs/cli-capabilities.html +1088 -0
  159. package/docs/hub-management.html +750 -0
  160. package/docs/index.html +228 -0
  161. package/docs/product-direction.md +64 -0
  162. package/docs/product-shape-business-model.html +1024 -0
  163. package/docs/roadmap.html +899 -0
  164. package/docs/roadmap.md +272 -0
  165. package/docs/v0.1-plan.md +109 -0
  166. package/examples/README.md +3 -0
  167. package/package.json +32 -0
  168. package/packs/README.md +24 -0
  169. package/packs/content-creator/README.md +38 -0
  170. package/packs/content-creator/languages/en.json +40 -0
  171. package/packs/content-creator/languages/zh.json +40 -0
  172. package/packs/content-creator/pack.json +41 -0
  173. package/packs/content-creator/rules/en/file-boundaries.md +10 -0
  174. package/packs/content-creator/rules/en/overview.md +9 -0
  175. package/packs/content-creator/rules/en/review.md +13 -0
  176. package/packs/content-creator/rules/en/workflow.md +8 -0
  177. package/packs/content-creator/rules/zh/file-boundaries.md +10 -0
  178. package/packs/content-creator/rules/zh/overview.md +9 -0
  179. package/packs/content-creator/rules/zh/review.md +13 -0
  180. package/packs/content-creator/rules/zh/workflow.md +8 -0
  181. package/packs/content-creator/seed/en/account-profile/README.md +3 -0
  182. package/packs/content-creator/seed/en/analytics-review/README.md +3 -0
  183. package/packs/content-creator/seed/en/drafts-and-scripts/README.md +3 -0
  184. package/packs/content-creator/seed/en/ideas/README.md +3 -0
  185. package/packs/content-creator/seed/en/materials/README.md +3 -0
  186. package/packs/content-creator/seed/en/published/README.md +3 -0
  187. package/packs/content-creator/seed/zh//345/217/221/345/270/203/350/256/260/345/275/225/README.md +5 -0
  188. package/packs/content-creator/seed/zh//346/225/260/346/215/256/345/244/215/347/233/230/README.md +3 -0
  189. package/packs/content-creator/seed/zh//347/264/240/346/235/220/345/272/223/README.md +5 -0
  190. package/packs/content-creator/seed/zh//350/215/211/347/250/277/344/270/216/350/204/232/346/234/254/README.md +5 -0
  191. package/packs/content-creator/seed/zh//350/264/246/345/217/267/345/256/232/344/275/215/README.md +3 -0
  192. package/packs/content-creator/seed/zh//351/200/211/351/242/230/346/261/240/README.md +3 -0
  193. package/packs/content-creator/templates/en/content-brief.md +21 -0
  194. package/packs/content-creator/templates/en/publish-record.md +23 -0
  195. package/packs/content-creator/templates/en/weekly-review.md +21 -0
  196. package/packs/content-creator/templates/zh/content-brief.md +30 -0
  197. package/packs/content-creator/templates/zh/publish-record.md +21 -0
  198. package/packs/content-creator/templates/zh/weekly-review.md +22 -0
  199. package/packs/general/README.md +5 -0
  200. package/packs/general/languages/en.json +19 -0
  201. package/packs/general/languages/zh.json +19 -0
  202. package/packs/general/pack.json +20 -0
  203. package/packs/general/rules/en/overview.md +7 -0
  204. package/packs/general/rules/en/workflow.md +6 -0
  205. package/packs/general/rules/zh/overview.md +7 -0
  206. package/packs/general/rules/zh/workflow.md +6 -0
  207. package/packs/hub-management/README.md +5 -0
  208. package/packs/hub-management/languages/en.json +27 -0
  209. package/packs/hub-management/languages/zh.json +27 -0
  210. package/packs/hub-management/pack.json +28 -0
  211. package/packs/hub-management/rules/en/overview.md +7 -0
  212. package/packs/hub-management/rules/en/workflow.md +6 -0
  213. package/packs/hub-management/rules/zh/overview.md +7 -0
  214. package/packs/hub-management/rules/zh/workflow.md +6 -0
  215. package/packs/hub-management/seed/en/.incoming/README.md +3 -0
  216. package/packs/hub-management/seed/en/projects/coordination/README.md +5 -0
  217. package/packs/hub-management/seed/en/projects/registry.json +4 -0
  218. package/packs/hub-management/seed/zh/.incoming/README.md +5 -0
  219. package/packs/hub-management/seed/zh//351/241/271/347/233/256/registry.json +4 -0
  220. package/packs/hub-management/seed/zh//351/241/271/347/233/256//350/201/224/347/273/234/README.md +5 -0
  221. package/packs/pack-structure-spec.md +315 -0
  222. package/schemas/README.md +3 -0
  223. package/skills/README.md +17 -0
  224. package/skills/starworkInit/SKILL.md +289 -0
  225. package/skills/starworkInit/agents/openai.yaml +7 -0
  226. package/skills/starworkInit-spec.md +585 -0
  227. package/skills/starworkSpawn/SKILL.md +136 -0
  228. package/skills/starworkSpawn/agents/openai.yaml +7 -0
@@ -0,0 +1,436 @@
1
+ const fs = require("fs");
2
+ const os = require("os");
3
+ const path = require("path");
4
+ const test = require("node:test");
5
+ const assert = require("node:assert/strict");
6
+ const { execFileSync, spawnSync } = require("node:child_process");
7
+
8
+ const root = path.resolve(__dirname, "..", "..");
9
+ const bin = path.join(root, "cli", "bin", "starwork.js");
10
+
11
+ function tempDir() {
12
+ return fs.mkdtempSync(path.join(os.tmpdir(), "starwork-init-test-"));
13
+ }
14
+
15
+ function runInit(args) {
16
+ return execFileSync(process.execPath, [bin, "init", ...args], {
17
+ cwd: root,
18
+ encoding: "utf8"
19
+ });
20
+ }
21
+
22
+ function runDoctor(args) {
23
+ return spawnSync(process.execPath, [bin, "doctor", ...args], {
24
+ cwd: root,
25
+ encoding: "utf8"
26
+ });
27
+ }
28
+
29
+ function runCommand(args) {
30
+ return spawnSync(process.execPath, [bin, ...args], {
31
+ cwd: root,
32
+ encoding: "utf8"
33
+ });
34
+ }
35
+
36
+ function readJson(file) {
37
+ return JSON.parse(fs.readFileSync(file, "utf8"));
38
+ }
39
+
40
+ test("dry-run does not write files", () => {
41
+ const dir = tempDir();
42
+ const output = runInit(["--type", "single-light", "--pack", "general", "--target", dir, "--dry-run"]);
43
+
44
+ assert.match(output, /初始化预览/);
45
+ assert.equal(fs.existsSync(path.join(dir, "AGENTS.md")), false);
46
+ assert.equal(fs.existsSync(path.join(dir, ".starwork", "workspace.json")), false);
47
+ });
48
+
49
+ test("creates a single-light workspace with general pack", () => {
50
+ const dir = tempDir();
51
+ runInit(["--type", "single-light", "--pack", "general", "--target", dir, "--yes"]);
52
+
53
+ const state = readJson(path.join(dir, ".starwork", "workspace.json"));
54
+ assert.equal(state.workspace_type, "single-light");
55
+ assert.equal(state.kit, "local-starter");
56
+ assert.equal(state.packs[0].id, "general");
57
+ assert.equal(fs.existsSync(path.join(dir, "AGENTS.md")), true);
58
+ assert.equal(fs.existsSync(path.join(dir, "输出", "确认成果", "README.md")), true);
59
+ assert.equal(fs.existsSync(path.join(dir, "_系统", "身份", "README.md")), true);
60
+ assert.equal(fs.existsSync(path.join(dir, "_系统", "教训", "README.md")), true);
61
+ });
62
+
63
+ test("creates a single-matter workspace with content creator pack", () => {
64
+ const dir = tempDir();
65
+ runInit(["--type", "single-matter", "--pack", "content-creator", "--target", dir, "--yes"]);
66
+
67
+ const state = readJson(path.join(dir, ".starwork", "workspace.json"));
68
+ const agents = fs.readFileSync(path.join(dir, "AGENTS.md"), "utf8");
69
+ assert.equal(state.workspace_type, "single-matter");
70
+ assert.equal(state.packs[0].id, "content-creator");
71
+ assert.equal(state.paths.formal_source, "发布记录/");
72
+ assert.match(agents, /自媒体内容生产流/);
73
+ assert.equal(fs.existsSync(path.join(dir, "事项", "注册表.md")), true);
74
+ assert.equal(fs.existsSync(path.join(dir, "发布记录", "README.md")), true);
75
+ assert.equal(fs.existsSync(path.join(dir, ".starwork", "packs", "content-creator", "templates", "content-brief.md")), true);
76
+ });
77
+
78
+ test("creates a hub workspace with hub management pack", () => {
79
+ const dir = tempDir();
80
+ runInit(["--type", "hub", "--target", dir, "--yes"]);
81
+
82
+ const state = readJson(path.join(dir, ".starwork", "workspace.json"));
83
+ assert.equal(state.workspace_type, "hub");
84
+ assert.equal(state.kit, "hub");
85
+ assert.equal(state.packs[0].id, "hub-management");
86
+ assert.equal(fs.existsSync(path.join(dir, "项目", "registry.json")), true);
87
+ assert.equal(fs.existsSync(path.join(dir, "知识", "README.md")), true);
88
+ assert.equal(fs.existsSync(path.join(dir, ".incoming", "README.md")), true);
89
+ });
90
+
91
+ test("does not overwrite existing user files", () => {
92
+ const dir = tempDir();
93
+ fs.writeFileSync(path.join(dir, "README.md"), "# Existing\n", "utf8");
94
+
95
+ runInit(["--type", "single-light", "--pack", "general", "--target", dir, "--yes"]);
96
+
97
+ assert.equal(fs.readFileSync(path.join(dir, "README.md"), "utf8"), "# Existing\n");
98
+ assert.equal(fs.existsSync(path.join(dir, "README.starwork-new.md")), true);
99
+ });
100
+
101
+ test("doctor passes on a single-light workspace with general pack", () => {
102
+ const dir = tempDir();
103
+ runInit(["--type", "single-light", "--pack", "general", "--target", dir, "--yes"]);
104
+
105
+ const result = runDoctor(["--target", dir]);
106
+
107
+ assert.equal(result.status, 0);
108
+ assert.match(result.stdout, /Workspace is healthy/);
109
+ });
110
+
111
+ test("doctor passes on a single-matter workspace with content creator pack", () => {
112
+ const dir = tempDir();
113
+ runInit(["--type", "single-matter", "--pack", "content-creator", "--target", dir, "--yes"]);
114
+
115
+ const result = runDoctor(["--target", dir, "--json"]);
116
+ const report = JSON.parse(result.stdout);
117
+
118
+ assert.equal(result.status, 0);
119
+ assert.equal(report.ok, true);
120
+ assert.equal(report.workspace.workspace_type, "single-matter");
121
+ assert.deepEqual(report.workspace.packs, ["content-creator"]);
122
+ });
123
+
124
+ test("doctor passes on a hub workspace", () => {
125
+ const dir = tempDir();
126
+ runInit(["--type", "hub", "--target", dir, "--yes"]);
127
+
128
+ const result = runDoctor(["--target", dir]);
129
+
130
+ assert.equal(result.status, 0);
131
+ assert.match(result.stdout, /Workspace is healthy/);
132
+ });
133
+
134
+ test("spawn creates a matter project from a hub", () => {
135
+ const hub = tempDir();
136
+ const target = tempDir();
137
+ runInit(["--type", "hub", "--target", hub, "--yes"]);
138
+
139
+ const spawn = runCommand(["spawn", "--hub", hub, "--name", "Content Site", "--id", "content-site", "--target", target, "--mode", "matter", "--yes"]);
140
+ const state = readJson(path.join(target, ".starwork", "workspace.json"));
141
+ const sync = readJson(path.join(target, ".core-sync.json"));
142
+ const registry = readJson(path.join(hub, "项目", "registry.json"));
143
+ const doctor = runDoctor(["--target", target, "--json"]);
144
+ const report = JSON.parse(doctor.stdout);
145
+
146
+ assert.equal(spawn.status, 0);
147
+ assert.equal(state.workspace_type, "satellite-matter");
148
+ assert.equal(state.kit, "satellite-matter");
149
+ assert.equal(state.hub.project_id, "content-site");
150
+ assert.equal(sync.project_id, "content-site");
151
+ assert.equal(registry.projects[0].id, "content-site");
152
+ assert.equal(registry.projects[0].path, path.resolve(target));
153
+ assert.equal(fs.lstatSync(path.join(target, "知识")).isSymbolicLink(), true);
154
+ assert.equal(fs.lstatSync(path.join(target, ".agents", "skills")).isSymbolicLink(), true);
155
+ assert.equal(doctor.status, 0);
156
+ });
157
+
158
+ test("spawn creates a starter project from a hub", () => {
159
+ const hub = tempDir();
160
+ const target = tempDir();
161
+ runInit(["--type", "hub", "--target", hub, "--yes"]);
162
+
163
+ const spawn = runCommand(["spawn", "--hub", hub, "--name", "Quick Project", "--id", "quick-project", "--target", target, "--mode", "starter", "--yes"]);
164
+ const state = readJson(path.join(target, ".starwork", "workspace.json"));
165
+ const doctor = runDoctor(["--target", target, "--json"]);
166
+ const report = JSON.parse(doctor.stdout);
167
+
168
+ assert.equal(spawn.status, 0);
169
+ assert.equal(state.workspace_type, "satellite-starter");
170
+ assert.equal(state.kit, "satellite-starter");
171
+ assert.equal(fs.existsSync(path.join(target, "事项")), false);
172
+ assert.equal(doctor.status, 0);
173
+ });
174
+
175
+ test("spawn creates a customized project from a blueprint", () => {
176
+ const hub = tempDir();
177
+ const target = tempDir();
178
+ const blueprintDir = tempDir();
179
+ fs.mkdirSync(path.join(blueprintDir, "rules"), { recursive: true });
180
+ fs.mkdirSync(path.join(blueprintDir, "seed", "会议纪要"), { recursive: true });
181
+ fs.writeFileSync(path.join(blueprintDir, "rules", "file-boundaries.md"), "正式成果放在 {{paths.formal_source}}。\n", "utf8");
182
+ fs.writeFileSync(path.join(blueprintDir, "rules", "workflow.md"), "当前推进放在 {{paths.business_work_area}}。\n", "utf8");
183
+ fs.writeFileSync(path.join(blueprintDir, "seed", "会议纪要", "README.md"), "# 会议纪要\n\n项目:{{project.name}}\n", "utf8");
184
+ fs.writeFileSync(path.join(blueprintDir, "blueprint.json"), `${JSON.stringify({
185
+ schema: "starwork.spawn_blueprint.v0.1",
186
+ name: "Blueprint Project",
187
+ project_id: "blueprint-project",
188
+ description: "用 blueprint 生成的定制项目。",
189
+ base: {
190
+ mode: "matter",
191
+ kit: "satellite-matter",
192
+ language: "zh"
193
+ },
194
+ paths: {
195
+ formal_source: "交付物/确认版本/",
196
+ business_work_area: "事项/"
197
+ },
198
+ folders: [
199
+ "资料库/",
200
+ "会议纪要/",
201
+ "版本记录/",
202
+ "交付物/确认版本/"
203
+ ],
204
+ agent_rules: [
205
+ { slot: "project.file_boundaries", from: "rules/file-boundaries.md" },
206
+ { slot: "project.workflow", from: "rules/workflow.md" }
207
+ ],
208
+ seed: [
209
+ { from: "seed/会议纪要/README.md", to: "会议纪要/README.md", on_conflict: "error" }
210
+ ]
211
+ }, null, 2)}\n`, "utf8");
212
+ runInit(["--type", "hub", "--target", hub, "--yes"]);
213
+
214
+ const spawn = runCommand(["spawn", "--hub", hub, "--target", target, "--blueprint", path.join(blueprintDir, "blueprint.json"), "--yes"]);
215
+ const state = readJson(path.join(target, ".starwork", "workspace.json"));
216
+ const agents = fs.readFileSync(path.join(target, "AGENTS.md"), "utf8");
217
+ const projectStatus = fs.readFileSync(path.join(target, "_系统", "上下文", "当前项目.md"), "utf8");
218
+ const seed = fs.readFileSync(path.join(target, "会议纪要", "README.md"), "utf8");
219
+ const registry = readJson(path.join(hub, "项目", "registry.json"));
220
+ const doctor = runDoctor(["--target", target, "--json"]);
221
+ const report = JSON.parse(doctor.stdout);
222
+
223
+ assert.equal(spawn.status, 0);
224
+ assert.equal(state.workspace_type, "satellite-matter");
225
+ assert.equal(state.paths.formal_source, "交付物/确认版本/");
226
+ assert.equal(state.customization.type, "spawn_blueprint");
227
+ assert.equal(state.customization.agent_rules[0].slot, "project.file_boundaries");
228
+ assert.equal(fs.existsSync(path.join(target, "资料库")), true);
229
+ assert.equal(fs.existsSync(path.join(target, "交付物", "确认版本")), true);
230
+ assert.match(agents, /StarWork Blueprint: project\.file_boundaries/);
231
+ assert.match(agents, /正式成果放在 交付物\/确认版本\//);
232
+ assert.match(projectStatus, /工作区定制/);
233
+ assert.match(seed, /项目:Blueprint Project/);
234
+ assert.equal(registry.projects[0].customized, true);
235
+ assert.equal(doctor.status, 0);
236
+ assert(report.checks.some((check) => check.id === "blueprint.folder.exists" && check.level === "pass"));
237
+ assert(report.checks.some((check) => check.id === "blueprint.rule.injected" && check.level === "pass"));
238
+ });
239
+
240
+ test("spawn blueprint dry-run does not write target or registry", () => {
241
+ const hub = tempDir();
242
+ const target = tempDir();
243
+ const blueprintDir = tempDir();
244
+ fs.writeFileSync(path.join(blueprintDir, "blueprint.json"), `${JSON.stringify({
245
+ schema: "starwork.spawn_blueprint.v0.1",
246
+ name: "Dry Blueprint",
247
+ base: {
248
+ mode: "starter",
249
+ kit: "satellite-starter",
250
+ language: "zh"
251
+ },
252
+ paths: {
253
+ formal_source: "交付物/",
254
+ business_work_area: "参考资料/"
255
+ },
256
+ folders: ["交付物/"]
257
+ }, null, 2)}\n`, "utf8");
258
+ runInit(["--type", "hub", "--target", hub, "--yes"]);
259
+
260
+ const result = runCommand(["spawn", "--hub", hub, "--target", target, "--blueprint", path.join(blueprintDir, "blueprint.json"), "--dry-run"]);
261
+ const registry = readJson(path.join(hub, "项目", "registry.json"));
262
+
263
+ assert.equal(result.status, 0);
264
+ assert.match(result.stdout, /Blueprint/);
265
+ assert.equal(fs.existsSync(path.join(target, ".starwork", "workspace.json")), false);
266
+ assert.deepEqual(registry.projects, []);
267
+ });
268
+
269
+ test("spawn blueprint rejects unsafe paths", () => {
270
+ const hub = tempDir();
271
+ const target = tempDir();
272
+ const blueprintDir = tempDir();
273
+ fs.writeFileSync(path.join(blueprintDir, "blueprint.json"), `${JSON.stringify({
274
+ schema: "starwork.spawn_blueprint.v0.1",
275
+ name: "Unsafe Blueprint",
276
+ base: {
277
+ mode: "matter",
278
+ kit: "satellite-matter",
279
+ language: "zh"
280
+ },
281
+ paths: {
282
+ formal_source: "../escape/",
283
+ business_work_area: "事项/"
284
+ }
285
+ }, null, 2)}\n`, "utf8");
286
+ runInit(["--type", "hub", "--target", hub, "--yes"]);
287
+
288
+ const result = runCommand(["spawn", "--hub", hub, "--target", target, "--blueprint", path.join(blueprintDir, "blueprint.json"), "--yes"]);
289
+
290
+ assert.equal(result.status, 1);
291
+ assert.match(result.stderr, /不能跳出工作区/);
292
+ });
293
+
294
+ test("spawn refuses duplicate registry id", () => {
295
+ const hub = tempDir();
296
+ const first = tempDir();
297
+ const second = tempDir();
298
+ runInit(["--type", "hub", "--target", hub, "--yes"]);
299
+ runCommand(["spawn", "--hub", hub, "--name", "First", "--id", "same-id", "--target", first, "--yes"]);
300
+
301
+ const duplicate = runCommand(["spawn", "--hub", hub, "--name", "Second", "--id", "same-id", "--target", second, "--yes"]);
302
+
303
+ assert.equal(duplicate.status, 1);
304
+ assert.match(duplicate.stderr, /已存在项目 ID/);
305
+ });
306
+
307
+ test("spawn refuses non-hub workspaces", () => {
308
+ const workspace = tempDir();
309
+ const target = tempDir();
310
+ runInit(["--type", "single-light", "--pack", "general", "--target", workspace, "--yes"]);
311
+
312
+ const result = runCommand(["spawn", "--hub", workspace, "--name", "Nope", "--id", "nope", "--target", target, "--yes"]);
313
+
314
+ assert.equal(result.status, 1);
315
+ assert.match(result.stderr, /多项目管理中枢/);
316
+ });
317
+
318
+ test("spawn refuses non-empty target directories", () => {
319
+ const hub = tempDir();
320
+ const target = tempDir();
321
+ fs.writeFileSync(path.join(target, "existing.txt"), "user content\n", "utf8");
322
+ runInit(["--type", "hub", "--target", hub, "--yes"]);
323
+
324
+ const result = runCommand(["spawn", "--hub", hub, "--name", "Existing", "--id", "existing", "--target", target, "--yes"]);
325
+
326
+ assert.equal(result.status, 1);
327
+ assert.match(result.stderr, /目标目录已有内容/);
328
+ });
329
+
330
+ test("doctor fails when AGENTS.md is missing", () => {
331
+ const dir = tempDir();
332
+ runInit(["--type", "single-light", "--pack", "general", "--target", dir, "--yes"]);
333
+ fs.rmSync(path.join(dir, "AGENTS.md"));
334
+
335
+ const result = runDoctor(["--target", dir]);
336
+
337
+ assert.equal(result.status, 1);
338
+ assert.match(result.stdout, /core\.entry_rules\.exists/);
339
+ });
340
+
341
+ test("doctor fails when the formal source is missing", () => {
342
+ const dir = tempDir();
343
+ runInit(["--type", "single-light", "--pack", "general", "--target", dir, "--yes"]);
344
+ fs.rmSync(path.join(dir, "输出", "确认成果"), { recursive: true, force: true });
345
+
346
+ const result = runDoctor(["--target", dir, "--json"]);
347
+ const report = JSON.parse(result.stdout);
348
+
349
+ assert.equal(result.status, 1);
350
+ assert.equal(report.ok, false);
351
+ assert(report.checks.some((check) => check.id === "core.formal_source.exists" && check.level === "fail"));
352
+ });
353
+
354
+ test("doctor fails when pack seed is missing", () => {
355
+ const dir = tempDir();
356
+ runInit(["--type", "single-matter", "--pack", "content-creator", "--target", dir, "--yes"]);
357
+ fs.rmSync(path.join(dir, "选题池", "README.md"));
358
+
359
+ const result = runDoctor(["--target", dir, "--json"]);
360
+ const report = JSON.parse(result.stdout);
361
+
362
+ assert.equal(result.status, 1);
363
+ assert(report.checks.some((check) => check.id === "pack.seed.installed" && check.level === "fail"));
364
+ });
365
+
366
+ test("doctor fails outside a StarWork workspace", () => {
367
+ const dir = tempDir();
368
+
369
+ const result = runDoctor(["--target", dir]);
370
+
371
+ assert.equal(result.status, 1);
372
+ assert.match(result.stdout, /不是 StarWork 工作台/);
373
+ });
374
+
375
+ test("adapt creates a Claude adapter and records it in workspace state", () => {
376
+ const dir = tempDir();
377
+ runInit(["--type", "single-light", "--pack", "general", "--target", dir, "--yes"]);
378
+
379
+ const result = runCommand(["adapt", "claude", "--target", dir, "--yes"]);
380
+ const state = readJson(path.join(dir, ".starwork", "workspace.json"));
381
+ const claude = fs.readFileSync(path.join(dir, "CLAUDE.md"), "utf8");
382
+
383
+ assert.equal(result.status, 0);
384
+ assert.match(claude, /StarWork Adapter for Claude Code/);
385
+ assert.equal(state.adapters[0].id, "claude");
386
+ });
387
+
388
+ test("adapt creates Cursor rules", () => {
389
+ const dir = tempDir();
390
+ runInit(["--type", "single-light", "--pack", "general", "--target", dir, "--yes"]);
391
+
392
+ const result = runCommand(["adapt", "--agent", "cursor", "--target", dir, "--yes"]);
393
+ const cursorRule = fs.readFileSync(path.join(dir, ".cursor", "rules", "starwork.mdc"), "utf8");
394
+
395
+ assert.equal(result.status, 0);
396
+ assert.match(cursorRule, /alwaysApply: true/);
397
+ assert.match(cursorRule, /AGENTS\.md/);
398
+ });
399
+
400
+ test("pack install adds content creator pack to an existing workspace", () => {
401
+ const dir = tempDir();
402
+ runInit(["--type", "single-light", "--pack", "general", "--target", dir, "--yes"]);
403
+
404
+ const install = runCommand(["pack", "install", "content-creator", "--target", dir, "--yes"]);
405
+ const state = readJson(path.join(dir, ".starwork", "workspace.json"));
406
+ const agents = fs.readFileSync(path.join(dir, "AGENTS.md"), "utf8");
407
+ const doctor = runDoctor(["--target", dir]);
408
+
409
+ assert.equal(install.status, 0);
410
+ assert.deepEqual(state.packs.map((pack) => pack.id), ["general", "content-creator"]);
411
+ assert.equal(state.paths.formal_source, "发布记录/");
412
+ assert.equal(fs.existsSync(path.join(dir, "发布记录", "README.md")), true);
413
+ assert.equal(fs.existsSync(path.join(dir, ".starwork", "packs", "content-creator", "templates", "content-brief.md")), true);
414
+ assert.match(agents, /StarWork Pack: content-creator/);
415
+ assert.equal(doctor.status, 0);
416
+ });
417
+
418
+ test("pack install refuses unsupported workspace types", () => {
419
+ const dir = tempDir();
420
+ runInit(["--type", "hub", "--target", dir, "--yes"]);
421
+
422
+ const result = runCommand(["pack", "install", "content-creator", "--target", dir, "--yes"]);
423
+
424
+ assert.equal(result.status, 1);
425
+ assert.match(result.stderr, /不支持工作区类型 hub/);
426
+ });
427
+
428
+ test("pack install skips already installed packs", () => {
429
+ const dir = tempDir();
430
+ runInit(["--type", "single-light", "--pack", "general", "--target", dir, "--yes"]);
431
+
432
+ const result = runCommand(["pack", "install", "general", "--target", dir, "--yes"]);
433
+
434
+ assert.equal(result.status, 0);
435
+ assert.match(result.stdout, /已安装/);
436
+ });
package/core/README.md ADDED
@@ -0,0 +1,51 @@
1
+ # StarWork Core
2
+
3
+ StarWork Core 是面向 AI 协作项目的工作区协议。
4
+
5
+ 先读:[StarWork Core v0.1 协议总览](./core-v0.1-protocol.md)。
6
+
7
+ Core v0.1 定义:
8
+
9
+ - Agent 开始工作前先读什么
10
+ - 项目状态和当前工作分别放在哪里
11
+ - 过程材料如何与正式事实源分离
12
+ - 轻量的 `references/outputs` 工作区如何与 Matter 工作区并存
13
+ - CLI、Adapters、Packs 和模板如何基于同一套协议工作
14
+
15
+ ## 仓库维护模型
16
+
17
+ Core 用“一套基线 + 可组合的 profile 和 capability”来维护:
18
+
19
+ ```text
20
+ product/core/
21
+ ├── baseline/ # 每个 Core 工作区都必须遵守的共同语义
22
+ ├── profiles/ # 语言、路径和模板映射,例如 zh 与 en
23
+ ├── capabilities/ # 可选能力,例如 Starter Mode 和 Matter Mode
24
+ ├── presets/ # 面向用户状态的组合配方
25
+ └── kits/ # 由 preset 组装出来的可复制模板包
26
+ ```
27
+
28
+ ## 维护规则
29
+
30
+ - 共同规则改 `baseline/`。
31
+ - 路径、模板语言、CLI 提问和用户可见名称改 `profiles/`。
32
+ - 可选行为改 `capabilities/`。
33
+ - 面向用户的组合状态改 `presets/`。
34
+ - `kits/` 是生成或组装结果,不是协议事实源。
35
+
36
+ ## Hub + Satellite 模型
37
+
38
+ 多项目模式由 `main-repo-sync` 表达,不拆成 `shared-identity` 和 `shared-lessons` 这类局部开关。
39
+
40
+ 在这个模型里:
41
+
42
+ - Hub 维护可复用规则、身份、教训、知识、共享 skills、项目注册元数据、跨项目联络和回写审核。
43
+ - Satellite 工作区维护自己的项目状态、当前工作、过程材料、项目决策和正式事实源。
44
+ - 快照、只读链接、`.core-sync.json` 和审核队列共同定义同步边界。
45
+ - Hub 可以读取 Satellite 状态,但不会把状态正文复制进 registry。
46
+
47
+ ## v0.1 范围
48
+
49
+ Core v0.1 故意保持小。它先冻结最小工作区语义,再让 CLI、Packs 和 Adapters 在其上增加自动化。
50
+
51
+ Core 不包含自媒体内容创作者的专属工作流逻辑。那部分属于 `product/packs/content-creator/`。
@@ -0,0 +1,12 @@
1
+ # Baseline
2
+
3
+ `baseline/` 是 Core 共同语义的事实源。
4
+
5
+ 无论用户使用哪种语言、哪种路径、启用哪些能力,每个 StarWork Core 工作区都必须遵守这里定义的含义。
6
+
7
+ ## 文件
8
+
9
+ - `spec.md`:基线定义和必需行为
10
+ - `roles.md`:标准角色
11
+ - `file-boundaries.md`:不同内容应该写到哪里
12
+ - `health-check.md`:未来 CLI `doctor` 的检查规则
@@ -0,0 +1,25 @@
1
+ # File Boundaries v0.1
2
+
3
+ ## 必需基线文件
4
+
5
+ | 文件角色 | 应该写这里 | 不应该写这里 |
6
+ |---|---|---|
7
+ | `agent.entry_rules` | Agent 在这个工作区应该如何工作。 | 项目状态、任务历史、草稿正文。 |
8
+ | `system.context.project_status` | 目标、阶段、重点、风险、正式事实源位置。 | 单次会话笔记、草稿正文、详细事项进度。 |
9
+ | `system.tasks.current_work` | 当前任务、活跃事项、阻塞点、等待确认的问题。 | 长期背景、完整设计稿、项目历史。 |
10
+
11
+ ## 可选能力文件
12
+
13
+ | 能力 | 边界 |
14
+ |---|---|
15
+ | `decisions` | 只记录会影响后续工作的高影响、已确认决策。 |
16
+ | `starter-outputs` | `references/` 是只读原始资料;`outputs/drafts/` 是未确认 AI 草稿;`outputs/final/` 是用户确认成果。 |
17
+ | `matter-mode` | 事项目录是过程工作区;成熟内容必须晋升到项目正式事实源。 |
18
+ | `local-identity` | 项目本地身份参考,只能在用户确认后修改。 |
19
+ | `local-lessons` | 项目本地可复用教训,不是普通复盘流水。 |
20
+ | `main-repo-sync` | Hub 资源通过快照、只读链接、元数据和审核队列进入卫星项目;Hub registry 不存项目进度正文。 |
21
+ | `skill-mount` | 共享 skills 从主库软链接挂载,不复制成独立分叉。 |
22
+
23
+ ## 正式事实源规则
24
+
25
+ 每个工作区都必须声明正式事实源放在哪里。Core 不要求该目录一定叫 `product/`。
@@ -0,0 +1,27 @@
1
+ # Core Health Check v0.1
2
+
3
+ 一个工作区满足以下条件时,可视为 Core v0.1 健康:
4
+
5
+ - `agent.entry_rules` 存在。
6
+ - `system.context.project_status` 存在。
7
+ - `system.tasks.current_work` 存在。
8
+ - 入口规则或项目状态中声明了正式事实源。
9
+ - 已启用的可选能力文件遵守自身边界。
10
+ - 使用 `main-repo-sync` 的卫星项目包含 `.core-sync.json`。
11
+
12
+ ## 警告项
13
+
14
+ 检查器遇到以下情况应给出警告:
15
+
16
+ - 当前工作文件包含大段项目历史。
17
+ - 项目状态文件包含任务级流水,不论实际路径映射成 `_系统/上下文/项目状态.md`、`_系统/上下文/当前项目.md` 还是英文路径。
18
+ - 决策记录写入会议纪要或局部草稿选择。
19
+ - `references/` 被当成生成成果来改写。
20
+ - Matter 草稿被当成正式事实源。
21
+ - 卫星项目在未确认情况下修改主库快照或软链接 skill。
22
+
23
+ ## 兼容性
24
+
25
+ `system.context.project_status` 是角色,不是强制文件名。
26
+
27
+ 对当前由 Hub 管理的中文卫星项目,`_系统/上下文/当前项目.md` 是兼容事实源。中文本地单项目 Kit 使用 `_系统/上下文/项目状态.md`。检查器和 adapter 必须读取 profile / preset 声明,不能假设所有工作区都使用同一个文件名。
@@ -0,0 +1,26 @@
1
+ # Core Roles v0.1
2
+
3
+ ## 标准角色
4
+
5
+ | 标准角色 | 是否必需 | 说明 |
6
+ |---|---:|---|
7
+ | `agent.entry_rules` | 是 | 所有 Agent 进入项目时必须读取的工作规则。 |
8
+ | `system.context.project_status` | 是 | 变化较慢的项目状态。 |
9
+ | `system.tasks.current_work` | 是 | 当前工作、阻塞点和下一次交接入口。 |
10
+ | `system.context.decisions` | 否 | 高影响决策记录。 |
11
+ | `work.starter.references` | 否 | Starter Mode 中默认只读的原始资料。 |
12
+ | `work.starter.outputs_drafts` | 否 | 等待用户审阅的 AI 草稿。 |
13
+ | `work.starter.outputs_final` | 否 | 用户确认后的成果。 |
14
+ | `work.matters.registry` | 否 | Matter Mode 的事项索引。 |
15
+ | `identity.local` | 否 | 项目本地身份参考。 |
16
+ | `lessons.local` | 否 | 项目本地可复用教训。 |
17
+ | `main_repo.sync_metadata` | 否 | 卫星项目与主库同步的元数据。 |
18
+ | `main_repo.knowledge_link` | 否 | 只读共享知识链接。 |
19
+ | `main_repo.internal_protocols` | 否 | 从主库复制的内部协议快照。 |
20
+ | `main_repo.skill_mounts` | 否 | 通过软链接挂载的共享 skills。 |
21
+
22
+ ## 规则
23
+
24
+ Profiles 负责把标准角色映射到具体路径。Capabilities 可以要求或推荐额外角色,但不能改变 baseline 角色的含义。
25
+
26
+ `system.context.project_status` 刻意使用角色名,而不是绑定单一文件名。Preset 可以把它映射到 `project-status.md`、`current-projects.md` 或其他声明文件,但一个工作区只能有一个项目状态事实源。
@@ -0,0 +1,47 @@
1
+ # Core Baseline v0.1
2
+
3
+ ## 定义
4
+
5
+ StarWork Core Baseline 是人和 AI Agent 共同使用一个工作区时的最小语义契约。
6
+
7
+ 它定义角色、边界和健康检查。它不定义具体业务领域、不绑定某个 Agent Runtime,也不强制唯一的语言路径结构。
8
+
9
+ ## 必需角色
10
+
11
+ 一个 Core v0.1 工作区必须提供这些角色:
12
+
13
+ | 角色 | 用途 |
14
+ |---|---|
15
+ | `agent.entry_rules` | 跨 Agent 的工作规则入口。 |
16
+ | `system.context.project_status` | 稳定的项目状态和正式事实源指针。 |
17
+ | `system.tasks.current_work` | 下一次 Agent 会话进入当前工作的入口。 |
18
+
19
+ ## 必需行为
20
+
21
+ - Agent 修改工作区前必须先读入口规则。
22
+ - 当前工作必须有稳定入口文件。
23
+ - 项目必须声明正式事实源在哪里。
24
+ - 过程材料不能被悄悄当成正式事实源。
25
+ - 只读参考层不能在没有用户明确确认的情况下被改写。
26
+
27
+ ## 可选能力
28
+
29
+ Capabilities 可以增加文件和行为,但不能重新定义 baseline 的含义:
30
+
31
+ - `starter-outputs`
32
+ - `matter-mode`
33
+ - `decisions`
34
+ - `local-identity`
35
+ - `local-lessons`
36
+ - `main-repo-sync`
37
+ - `skill-mount`
38
+
39
+ ## 不做什么
40
+
41
+ Core v0.1 不定义:
42
+
43
+ - Pack 专属工作流
44
+ - CLI 命令实现
45
+ - 特定 Agent Runtime 行为
46
+ - 强制性的机器可读 manifest
47
+ - 所有用户都必须拥有事项目录
@@ -0,0 +1,15 @@
1
+ # Capabilities
2
+
3
+ Capabilities 是 Core 的可选能力,可以通过 presets 组合。
4
+
5
+ 它们不能重新定义 baseline 角色的含义。
6
+
7
+ ## v0.1 包含
8
+
9
+ - `starter-outputs`:`references/` + `outputs/`
10
+ - `matter-mode`:事项工作区与事项维护要求
11
+ - `decisions`:高影响决策记录
12
+ - `local-identity`:项目本地身份
13
+ - `local-lessons`:项目本地教训
14
+ - `main-repo-sync`:主库与卫星项目的同步模型
15
+ - `skill-mount`:通过软链接挂载共享 skills
@@ -0,0 +1,26 @@
1
+ # Capability: decisions v0.1
2
+
3
+ `decisions` 能力为工作区增加高影响决策记录。
4
+
5
+ ## 规则
6
+
7
+ 决策记录文件是可选文件。中文 profile 默认映射为 `_系统/上下文/决策.md`,英文 profile 可映射为 `decisions.md`。它不是会议纪要、任务日志,也不是草稿历史。
8
+
9
+ 只有同时满足以下条件时,才写入一条决策:
10
+
11
+ 1. 这个判断已经被确认。
12
+ 2. 它会影响未来工作,而不只是影响某个局部草稿。
13
+ 3. 未来 Agent 需要读到它,才能避免重复争论或重走旧路。
14
+
15
+ ## 示例
16
+
17
+ 适合写入:
18
+
19
+ - Core v0.1 支持 Starter Mode 和 Matter Mode。
20
+ - Matter Mode 是可选能力,不是 baseline 必需项。
21
+
22
+ 不适合写入:
23
+
24
+ - 某次讨论了三个方案。
25
+ - 这个草稿使用 B 版本。
26
+ - 明天需要问用户。