@sushanglewis/lincoln 1.5.0 → 1.5.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 (305) hide show
  1. package/dist/main.d.ts +3 -0
  2. package/dist/main.js +1231 -906
  3. package/dist/main.js.map +1 -1
  4. package/dist/postinstall.d.ts +3 -0
  5. package/dist/postinstall.js +18 -0
  6. package/dist/postinstall.js.map +1 -0
  7. package/framework/.claude/agents/_contract.md +79 -0
  8. package/framework/.claude/agents/architect.md +31 -0
  9. package/framework/.claude/agents/default.md +151 -0
  10. package/framework/.claude/agents/designer.md +33 -0
  11. package/framework/.claude/agents/engineer.md +42 -0
  12. package/framework/.claude/agents/external/NOTICES.md +12 -0
  13. package/framework/.claude/agents/external/everything-claude-code.manifest.yaml +23 -0
  14. package/framework/.claude/agents/external/oh-my-claudecode.manifest.yaml +26 -0
  15. package/framework/.claude/agents/external/wshobson-agents.manifest.yaml +23 -0
  16. package/framework/.claude/agents/frontend-engineer.md +32 -0
  17. package/framework/.claude/agents/knowledge-curator.md +28 -0
  18. package/framework/.claude/agents/pm.md +38 -0
  19. package/framework/.claude/agents/qa.md +28 -0
  20. package/framework/.claude/agents/release-coordinator.md +25 -0
  21. package/framework/.claude/agents/researcher.md +41 -0
  22. package/framework/.claude/harnesses/claude-code.yaml +15 -0
  23. package/framework/.claude/harnesses/codex.yaml +40 -0
  24. package/framework/.claude/harnesses/command-map.yaml +255 -0
  25. package/framework/.claude/harnesses/opencode.yaml +32 -0
  26. package/framework/.claude/harnesses/scenarios.yaml +45 -0
  27. package/framework/.claude/hooks/on-pr-event.sh +69 -0
  28. package/framework/.claude/hooks/on-session-start.sh +427 -0
  29. package/framework/.claude/hooks/on-stop.sh +104 -0
  30. package/framework/.claude/hooks/post-tool-use.sh +161 -0
  31. package/framework/.claude/hooks/pre-tool-use.sh +246 -0
  32. package/framework/.claude/schemas/agent-definition.schema.json +35 -0
  33. package/framework/.claude/schemas/benchmark-report.schema.json +148 -0
  34. package/framework/.claude/schemas/pm-to-ux-handoff.schema.yaml +128 -0
  35. package/framework/.claude/schemas/stage-definition.schema.json +233 -0
  36. package/framework/.claude/schemas/workflow-stage.schema.json +86 -0
  37. package/framework/.claude/schemas/workflow-template.schema.json +88 -0
  38. package/framework/.claude/settings.json +14 -0
  39. package/framework/.claude/skills/build-product-prototype/SKILL.md +35 -0
  40. package/framework/.claude/skills/build-product-prototype/prompts/main.md +78 -0
  41. package/framework/.claude/skills/clarify-requirements/SKILL.md +32 -0
  42. package/framework/.claude/skills/clarify-requirements/prompts/main.md +81 -0
  43. package/framework/.claude/skills/dependencies.yaml +139 -0
  44. package/framework/.claude/skills/draft-product-design/SKILL.md +40 -0
  45. package/framework/.claude/skills/draft-product-design/prompts/main.md +47 -0
  46. package/framework/.claude/skills/lc-analyze-frameworks/SKILL.md +43 -0
  47. package/framework/.claude/skills/lc-analyze-frameworks/prompts/main.md +95 -0
  48. package/framework/.claude/skills/lc-benchmark/SKILL.md +61 -0
  49. package/framework/.claude/skills/lc-build-codebase-knowledge/SKILL.md +38 -0
  50. package/framework/.claude/skills/lc-build-codebase-knowledge/prompts/build-codebase-knowledge.md +61 -0
  51. package/framework/.claude/skills/lc-collect-intelligence/SKILL.md +43 -0
  52. package/framework/.claude/skills/lc-collect-intelligence/prompts/main.md +72 -0
  53. package/framework/.claude/skills/lc-competitive-analysis/SKILL.md +43 -0
  54. package/framework/.claude/skills/lc-competitive-analysis/prompts/main.md +70 -0
  55. package/framework/.claude/skills/lc-explore-opensource/SKILL.md +36 -0
  56. package/framework/.claude/skills/lc-explore-opensource/prompts/explore-opensource.md +77 -0
  57. package/framework/.claude/skills/lc-first-principles/SKILL.md +43 -0
  58. package/framework/.claude/skills/lc-first-principles/prompts/main.md +73 -0
  59. package/framework/.claude/skills/lc-handoff/SKILL.md +34 -0
  60. package/framework/.claude/skills/lc-init-branch/SKILL.md +52 -0
  61. package/framework/.claude/skills/lc-market-research/SKILL.md +43 -0
  62. package/framework/.claude/skills/lc-market-research/prompts/main.md +79 -0
  63. package/framework/.claude/skills/lc-product-research/SKILL.md +43 -0
  64. package/framework/.claude/skills/lc-product-research/prompts/main.md +80 -0
  65. package/framework/.claude/skills/lc-research-report/SKILL.md +43 -0
  66. package/framework/.claude/skills/lc-research-report/prompts/main.md +90 -0
  67. package/framework/.claude/skills/lc-research-scope/SKILL.md +43 -0
  68. package/framework/.claude/skills/lc-research-scope/prompts/main.md +82 -0
  69. package/framework/.claude/skills/lc-setup/SKILL.md +68 -0
  70. package/framework/.claude/skills/lc-setup/prompts/main.md +88 -0
  71. package/framework/.claude/skills/lc-stage/SKILL.md +45 -0
  72. package/framework/.claude/skills/lc-stakeholder-research/SKILL.md +43 -0
  73. package/framework/.claude/skills/lc-stakeholder-research/prompts/main.md +65 -0
  74. package/framework/.claude/skills/lc-status/SKILL.md +25 -0
  75. package/framework/.claude/skills/lc-storytelling/SKILL.md +43 -0
  76. package/framework/.claude/skills/lc-storytelling/prompts/main.md +77 -0
  77. package/framework/.claude/skills/lc-wf/SKILL.md +54 -0
  78. package/framework/.claude/skills/lc-workflow/SKILL.md +48 -0
  79. package/framework/.claude/skills/lc-workflow/validators/validate.py +755 -0
  80. package/framework/.claude/skills/lc-workflow-router/SKILL.md +41 -0
  81. package/framework/.claude/skills/lc-workflow-router/prompts/intake-prompt.md +91 -0
  82. package/framework/.claude/skills/lc-workflow-router/prompts/router-prompt.md +44 -0
  83. package/framework/.claude/skills/plan-tdd-development/SKILL.md +31 -0
  84. package/framework/.claude/skills/plan-tdd-development/prompts/main.md +44 -0
  85. package/framework/.claude/skills/process-interview/SKILL.md +32 -0
  86. package/framework/.claude/skills/process-interview/prompts/main.md +47 -0
  87. package/framework/.claude/skills/propose-with-openspec/SKILL.md +37 -0
  88. package/framework/.claude/skills/propose-with-openspec/prompts/main.md +53 -0
  89. package/framework/.claude/skills/split-to-github/SKILL.md +32 -0
  90. package/framework/.claude/skills/split-to-github/prompts/main.md +42 -0
  91. package/framework/.claude/skills/sync-to-knowledge/SKILL.md +35 -0
  92. package/framework/.claude/skills/sync-to-knowledge/prompts/main.md +54 -0
  93. package/framework/.claude/skills/workflow-continue/SKILL.md +24 -0
  94. package/framework/.claude/skills/workflow-continue/prompts/main.md +25 -0
  95. package/framework/.claude/stages/build-codebase-knowledge.yaml +42 -0
  96. package/framework/.claude/stages/clarify.yaml +59 -0
  97. package/framework/.claude/stages/explore-opensource.yaml +40 -0
  98. package/framework/.claude/stages/implement.yaml +60 -0
  99. package/framework/.claude/stages/ingest.yaml +40 -0
  100. package/framework/.claude/stages/lc-analyze-frameworks.yaml +37 -0
  101. package/framework/.claude/stages/lc-collect-intelligence.yaml +37 -0
  102. package/framework/.claude/stages/lc-competitive-analysis.yaml +37 -0
  103. package/framework/.claude/stages/lc-first-principles.yaml +37 -0
  104. package/framework/.claude/stages/lc-market-research.yaml +37 -0
  105. package/framework/.claude/stages/lc-product-research.yaml +37 -0
  106. package/framework/.claude/stages/lc-research-report.yaml +38 -0
  107. package/framework/.claude/stages/lc-research-scope.yaml +38 -0
  108. package/framework/.claude/stages/lc-stakeholder-research.yaml +37 -0
  109. package/framework/.claude/stages/lc-storytelling.yaml +37 -0
  110. package/framework/.claude/stages/product-design-docs.yaml +66 -0
  111. package/framework/.claude/stages/product-prototype.yaml +53 -0
  112. package/framework/.claude/stages/propose.yaml +45 -0
  113. package/framework/.claude/stages/split.yaml +41 -0
  114. package/framework/.claude/stages/sync-knowledge.yaml +49 -0
  115. package/framework/.claude/stages/tdd-development-plan.yaml +43 -0
  116. package/framework/.claude/stages/workflow-router.yaml +45 -0
  117. package/framework/.claude/templates/solo-workflow-context.yaml +23 -0
  118. package/framework/.claude/workflows/README.md +93 -0
  119. package/framework/.claude/workflows/bug-fix.yaml +81 -0
  120. package/framework/.claude/workflows/design-spike.yaml +55 -0
  121. package/framework/.claude/workflows/existing-project-iteration.yaml +106 -0
  122. package/framework/.claude/workflows/interview-to-knowledge.yaml +189 -0
  123. package/framework/.claude/workflows/oss-first-design.yaml +100 -0
  124. package/framework/.claude/workflows/pm-research.yaml +115 -0
  125. package/framework/.claude-plugin/hooks.json +6 -0
  126. package/framework/.claude-plugin/marketplace.json +32 -0
  127. package/framework/.claude-plugin/plugin.json +57 -0
  128. package/framework/.version-bump.json +43 -0
  129. package/framework/CLAUDE.md +140 -0
  130. package/framework/CONTRIBUTING.md +219 -0
  131. package/framework/LICENSE +21 -0
  132. package/framework/README.en.md +139 -0
  133. package/framework/README.md +139 -0
  134. package/framework/RELEASE.md +334 -0
  135. package/framework/SKILL.md +24 -0
  136. package/framework/USAGE.md +356 -0
  137. package/framework/manifest.json +1214 -0
  138. package/framework/requirements.txt +4 -0
  139. package/framework/scripts/__init__.py +0 -0
  140. package/framework/scripts/build_codebase_knowledge.py +76 -0
  141. package/framework/scripts/bump_version.py +181 -0
  142. package/framework/scripts/check-dependency-drift.py +69 -0
  143. package/framework/scripts/check-harness-drift.sh +57 -0
  144. package/framework/scripts/check-main-merge-hygiene.py +128 -0
  145. package/framework/scripts/check-skill-dependencies.sh +124 -0
  146. package/framework/scripts/init-lincoln-branch.sh +300 -0
  147. package/framework/scripts/init-project.sh +184 -0
  148. package/framework/scripts/lc-benchmark-cli.py +66 -0
  149. package/framework/scripts/lincoln-audit.py +288 -0
  150. package/framework/scripts/lincoln-setup.py +651 -0
  151. package/framework/scripts/lincoln-status.py +448 -0
  152. package/framework/scripts/lincoln_benchmark.py +224 -0
  153. package/framework/scripts/lincoln_benchmark_eval.py +104 -0
  154. package/framework/scripts/lincoln_benchmark_metrics.py +818 -0
  155. package/framework/scripts/lincoln_benchmark_report.py +141 -0
  156. package/framework/scripts/lincoln_command_map.py +289 -0
  157. package/framework/scripts/lincoln_dependency_manager.py +335 -0
  158. package/framework/scripts/lincoln_documents.py +175 -0
  159. package/framework/scripts/lincoln_harness_adapter.py +319 -0
  160. package/framework/scripts/lincoln_index.py +255 -0
  161. package/framework/scripts/lincoln_paths.py +198 -0
  162. package/framework/scripts/lincoln_prd.py +227 -0
  163. package/framework/scripts/lincoln_role.py +46 -0
  164. package/framework/scripts/lincoln_scenario.py +59 -0
  165. package/framework/scripts/lincoln_session_start_metrics.py +71 -0
  166. package/framework/scripts/lincoln_skill_prompt.py +48 -0
  167. package/framework/scripts/lincoln_trace.py +335 -0
  168. package/framework/scripts/lincoln_workflow.py +199 -0
  169. package/framework/scripts/list-active-lincoln-branches.sh +87 -0
  170. package/framework/scripts/package-lincoln-plugin.py +340 -0
  171. package/framework/scripts/run-infrastructure-tests.py +84 -0
  172. package/framework/scripts/stage_loader.py +1071 -0
  173. package/framework/scripts/static-check.sh +356 -0
  174. package/framework/scripts/sync-external-agents.sh +210 -0
  175. package/framework/scripts/sync-framework-package.mjs +218 -0
  176. package/framework/scripts/task_tool_guard.py +213 -0
  177. package/framework/scripts/track-artifacts.py +140 -0
  178. package/framework/scripts/validate_stage.py +350 -0
  179. package/{README.md → framework/tools/lincoln/README.md} +4 -4
  180. package/framework/tools/lincoln/package-lock.json +3349 -0
  181. package/framework/tools/lincoln/package.json +48 -0
  182. package/framework/tools/lincoln/src/cli.tsx +60 -0
  183. package/framework/tools/lincoln/src/components/AudioMeter.tsx +34 -0
  184. package/framework/tools/lincoln/src/components/CancelledScreen.tsx +11 -0
  185. package/framework/tools/lincoln/src/components/DevicesMenu.tsx +79 -0
  186. package/framework/tools/lincoln/src/components/HintBar.tsx +25 -0
  187. package/framework/tools/lincoln/src/components/LogView.tsx +36 -0
  188. package/framework/tools/lincoln/src/components/ModelMenu.tsx +122 -0
  189. package/framework/tools/lincoln/src/components/ReadyScreen.tsx +54 -0
  190. package/framework/tools/lincoln/src/components/RecordingApp.tsx +211 -0
  191. package/framework/tools/lincoln/src/components/RecordingScreen.tsx +41 -0
  192. package/framework/tools/lincoln/src/components/SelectMenu.tsx +53 -0
  193. package/framework/tools/lincoln/src/components/StatusPanel.tsx +52 -0
  194. package/framework/tools/lincoln/src/components/StopConfirmation.tsx +32 -0
  195. package/framework/tools/lincoln/src/config/args.ts +35 -0
  196. package/framework/tools/lincoln/src/config/loadConfig.ts +81 -0
  197. package/framework/tools/lincoln/src/config/resolveConfig.ts +85 -0
  198. package/framework/tools/lincoln/src/devices/listDevices.ts +11 -0
  199. package/framework/tools/lincoln/src/devices/parseDevices.ts +25 -0
  200. package/framework/tools/lincoln/src/hooks/useKeyHandler.ts +63 -0
  201. package/framework/tools/lincoln/src/main.tsx +4 -0
  202. package/framework/tools/lincoln/src/models/models.ts +34 -0
  203. package/framework/tools/lincoln/src/models/runWarmup.ts +46 -0
  204. package/framework/tools/lincoln/src/models/warmupProgress.ts +30 -0
  205. package/framework/tools/lincoln/src/recording/spawnRecorder.ts +127 -0
  206. package/framework/tools/lincoln/src/recording/useRecorder.ts +146 -0
  207. package/framework/tools/lincoln/src/utils/amplitudeToMeter.ts +4 -0
  208. package/framework/tools/lincoln/src/utils/formatDuration.ts +6 -0
  209. package/framework/tools/lincoln/src/utils/sessionId.ts +25 -0
  210. package/framework/tools/lincoln/tests/cli.test.tsx +52 -0
  211. package/framework/tools/lincoln/tests/components/AudioMeter.test.tsx +31 -0
  212. package/framework/tools/lincoln/tests/components/CancelledScreen.test.tsx +12 -0
  213. package/framework/tools/lincoln/tests/components/ReadyScreen.test.tsx +68 -0
  214. package/framework/tools/lincoln/tests/components/RecordingApp.menus.test.tsx +158 -0
  215. package/framework/tools/lincoln/tests/components/RecordingApp.test.tsx +248 -0
  216. package/framework/tools/lincoln/tests/components/RecordingScreen.test.tsx +37 -0
  217. package/framework/tools/lincoln/tests/components/SelectMenu.test.tsx +59 -0
  218. package/framework/tools/lincoln/tests/components/StopConfirmation.test.tsx +38 -0
  219. package/framework/tools/lincoln/tests/config/args.test.ts +49 -0
  220. package/framework/tools/lincoln/tests/config/loadConfig.test.ts +59 -0
  221. package/framework/tools/lincoln/tests/config/resolveConfig.test.ts +72 -0
  222. package/framework/tools/lincoln/tests/devices/parseDevices.test.ts +21 -0
  223. package/framework/tools/lincoln/tests/hooks/useKeyHandler.enabled.test.tsx +44 -0
  224. package/framework/tools/lincoln/tests/hooks/useKeyHandler.test.tsx +130 -0
  225. package/framework/tools/lincoln/tests/models/models.test.ts +27 -0
  226. package/framework/tools/lincoln/tests/models/warmupProgress.test.ts +25 -0
  227. package/framework/tools/lincoln/tests/recording/spawnRecorder.test.ts +85 -0
  228. package/framework/tools/lincoln/tests/recording/useRecorder.test.tsx +172 -0
  229. package/framework/tools/lincoln/tests/utils/amplitudeToMeter.test.ts +22 -0
  230. package/framework/tools/lincoln/tests/utils/formatDuration.test.ts +11 -0
  231. package/framework/tools/lincoln/tests/utils/sessionId.test.ts +30 -0
  232. package/framework/tools/lincoln/tsconfig.json +22 -0
  233. package/framework/tools/lincoln/tsconfig.tests.json +10 -0
  234. package/framework/tools/lincoln/tsup.config.ts +17 -0
  235. package/framework/tools/lincoln/vitest.config.ts +20 -0
  236. package/framework/tools/lincoln-installer/package-lock.json +3611 -0
  237. package/framework/tools/lincoln-installer/package.json +53 -0
  238. package/framework/tools/lincoln-installer/src/cli.tsx +63 -0
  239. package/framework/tools/lincoln-installer/src/components/HarnessSelectScreen.tsx +43 -0
  240. package/framework/tools/lincoln-installer/src/components/InstallerApp.tsx +98 -0
  241. package/framework/tools/lincoln-installer/src/components/OptionsScreen.tsx +56 -0
  242. package/framework/tools/lincoln-installer/src/components/ProgressScreen.tsx +25 -0
  243. package/framework/tools/lincoln-installer/src/components/ResultScreen.tsx +40 -0
  244. package/framework/tools/lincoln-installer/src/components/SelectMenu.tsx +73 -0
  245. package/framework/tools/lincoln-installer/src/components/SummaryScreen.tsx +49 -0
  246. package/framework/tools/lincoln-installer/src/components/UpdateApp.tsx +135 -0
  247. package/framework/tools/lincoln-installer/src/components/WelcomeScreen.tsx +22 -0
  248. package/framework/tools/lincoln-installer/src/config/args.ts +76 -0
  249. package/framework/tools/lincoln-installer/src/config/resolveConfig.ts +33 -0
  250. package/framework/tools/lincoln-installer/src/config/updateArgs.ts +67 -0
  251. package/framework/tools/lincoln-installer/src/hooks/useSetup.ts +149 -0
  252. package/framework/tools/lincoln-installer/src/main.tsx +11 -0
  253. package/framework/tools/lincoln-installer/src/types.ts +19 -0
  254. package/framework/tools/lincoln-installer/src/update-main.tsx +11 -0
  255. package/framework/tools/lincoln-installer/src/update.tsx +90 -0
  256. package/framework/tools/lincoln-installer/src/utils/detectHarness.ts +51 -0
  257. package/framework/tools/lincoln-installer/src/utils/runSetup.ts +62 -0
  258. package/framework/tools/lincoln-installer/src/utils/updateRelease.ts +454 -0
  259. package/framework/tools/lincoln-installer/tests/components/InstallerApp.test.tsx +88 -0
  260. package/framework/tools/lincoln-installer/tests/components/SelectMenu.test.tsx +26 -0
  261. package/framework/tools/lincoln-installer/tests/components/UpdateApp.test.tsx +170 -0
  262. package/framework/tools/lincoln-installer/tests/components/screens.test.tsx +310 -0
  263. package/framework/tools/lincoln-installer/tests/config/args.test.ts +66 -0
  264. package/framework/tools/lincoln-installer/tests/config/resolveConfig.test.ts +75 -0
  265. package/framework/tools/lincoln-installer/tests/config/updateArgs.test.ts +52 -0
  266. package/framework/tools/lincoln-installer/tests/hooks/useSetup.test.tsx +213 -0
  267. package/framework/tools/lincoln-installer/tests/update.test.tsx +108 -0
  268. package/framework/tools/lincoln-installer/tests/utils/detectHarness.test.ts +40 -0
  269. package/framework/tools/lincoln-installer/tests/utils/runSetup.test.ts +45 -0
  270. package/framework/tools/lincoln-installer/tests/utils/updateRelease.test.ts +559 -0
  271. package/framework/tools/lincoln-installer/tsconfig.json +22 -0
  272. package/framework/tools/lincoln-installer/tsconfig.tests.json +8 -0
  273. package/framework/tools/lincoln-installer/tsup.config.ts +17 -0
  274. package/framework/tools/lincoln-installer/vitest.config.ts +20 -0
  275. package/framework/tools/lincoln-record/Cargo.lock +1896 -0
  276. package/framework/tools/lincoln-record/Cargo.toml +24 -0
  277. package/framework/tools/lincoln-record/diarize/diarize.py +117 -0
  278. package/framework/tools/lincoln-record/diarize/merge.py +55 -0
  279. package/framework/tools/lincoln-record/src/audio/capture/microphone.rs +194 -0
  280. package/framework/tools/lincoln-record/src/audio/capture/mod.rs +1 -0
  281. package/framework/tools/lincoln-record/src/audio/devices.rs +20 -0
  282. package/framework/tools/lincoln-record/src/audio/mod.rs +5 -0
  283. package/framework/tools/lincoln-record/src/audio/resampler.rs +44 -0
  284. package/framework/tools/lincoln-record/src/audio/saver.rs +87 -0
  285. package/framework/tools/lincoln-record/src/audio/source.rs +104 -0
  286. package/framework/tools/lincoln-record/src/cli.rs +96 -0
  287. package/framework/tools/lincoln-record/src/config.rs +135 -0
  288. package/framework/tools/lincoln-record/src/lib.rs +6 -0
  289. package/framework/tools/lincoln-record/src/main.rs +242 -0
  290. package/framework/tools/lincoln-record/src/model/mod.rs +248 -0
  291. package/framework/tools/lincoln-record/src/output/metadata.rs +30 -0
  292. package/framework/tools/lincoln-record/src/output/mod.rs +2 -0
  293. package/framework/tools/lincoln-record/src/output/transcript.rs +42 -0
  294. package/framework/tools/lincoln-record/src/transcription/diarization.rs +64 -0
  295. package/framework/tools/lincoln-record/src/transcription/mod.rs +3 -0
  296. package/framework/tools/lincoln-record/src/transcription/provider.rs +43 -0
  297. package/framework/tools/lincoln-record/src/transcription/whisper.rs +176 -0
  298. package/framework/tools/lincoln-record/tests/cli_args.rs +103 -0
  299. package/framework/tools/lincoln-record/tests/config_test.rs +70 -0
  300. package/framework/tools/lincoln-record/tests/devices_test.rs +23 -0
  301. package/framework/tools/lincoln-record/tests/diarization_tests.rs +101 -0
  302. package/framework/tools/lincoln-record/tests/integration_tests.rs +44 -0
  303. package/framework/tools/lincoln-record/tests/model_test.rs +68 -0
  304. package/framework/tools/lincoln-record/tests/transcription_tests.rs +73 -0
  305. package/package.json +19 -13
@@ -0,0 +1,300 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # Initialize a Lincoln issue work package on the current feature branch.
5
+ # The work package is scoped to the issue and lives on the feature branch only.
6
+ #
7
+ # Usage:
8
+ # scripts/init-lincoln-branch.sh --issue-number <number> [--session-id <id>] [--design-id <id>] [--process-slug <slug>] [--workflow <name>] [--push] [--no-commit] [--auto]
9
+ #
10
+ # Legacy usage (non-issue-driven):
11
+ # scripts/init-lincoln-branch.sh <session-id> <design-id> [--process-slug <slug>] [--push]
12
+ #
13
+ # Example:
14
+ # scripts/init-lincoln-branch.sh --issue-number 21 --session-id 2026-07-08-stakeholder --design-id checkout-redesign --push
15
+ #
16
+ # Flags:
17
+ # --no-commit Create the issue package and workflow-stage.yaml but do not git-add/commit.
18
+ # --auto Non-interactive mode used by hooks; skips prompts and tolerates a dirty working tree.
19
+
20
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
21
+ ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
22
+ cd "$ROOT"
23
+
24
+ ISSUE_NUMBER=""
25
+ SESSION_ID=""
26
+ DESIGN_ID=""
27
+ PUSH=""
28
+ PROCESS_SLUG=""
29
+ NO_COMMIT=""
30
+ AUTO=""
31
+ WORKFLOW_NAME=""
32
+
33
+ # Detect legacy positional invocation
34
+ if [[ "${1:-}" != --* && $# -ge 2 ]]; then
35
+ SESSION_ID="${1:-}"
36
+ DESIGN_ID="${2:-}"
37
+ shift 2
38
+ fi
39
+
40
+ while [[ $# -gt 0 ]]; do
41
+ case "$1" in
42
+ --issue-number)
43
+ ISSUE_NUMBER="${2:-}"
44
+ if [[ -z "$ISSUE_NUMBER" ]]; then
45
+ echo "ERROR: --issue-number requires a value"
46
+ exit 1
47
+ fi
48
+ shift 2
49
+ ;;
50
+ --session-id)
51
+ SESSION_ID="${2:-}"
52
+ if [[ -z "$SESSION_ID" ]]; then
53
+ echo "ERROR: --session-id requires a value"
54
+ exit 1
55
+ fi
56
+ shift 2
57
+ ;;
58
+ --design-id)
59
+ DESIGN_ID="${2:-}"
60
+ if [[ -z "$DESIGN_ID" ]]; then
61
+ echo "ERROR: --design-id requires a value"
62
+ exit 1
63
+ fi
64
+ shift 2
65
+ ;;
66
+ --push)
67
+ PUSH="--push"
68
+ shift
69
+ ;;
70
+ --no-commit)
71
+ NO_COMMIT="1"
72
+ shift
73
+ ;;
74
+ --auto)
75
+ AUTO="1"
76
+ shift
77
+ ;;
78
+ --workflow)
79
+ WORKFLOW_NAME="${2:-}"
80
+ if [[ -z "$WORKFLOW_NAME" ]]; then
81
+ echo "ERROR: --workflow requires a value"
82
+ exit 1
83
+ fi
84
+ shift 2
85
+ ;;
86
+ --process-slug)
87
+ PROCESS_SLUG="${2:-}"
88
+ if [[ -z "$PROCESS_SLUG" ]]; then
89
+ echo "ERROR: --process-slug requires a value"
90
+ exit 1
91
+ fi
92
+ shift 2
93
+ ;;
94
+ *)
95
+ echo "ERROR: unknown argument: $1"
96
+ echo "Usage: $(basename "$0") --issue-number <number> [--session-id <id>] [--design-id <id>] [--process-slug <slug>] [--workflow <name>] [--push] [--no-commit] [--auto]"
97
+ exit 1
98
+ ;;
99
+ esac
100
+ done
101
+
102
+ # Validate issue number is numeric
103
+ if [[ -n "$ISSUE_NUMBER" && ! "$ISSUE_NUMBER" =~ ^[0-9]+$ ]]; then
104
+ echo "ERROR: --issue-number must be a positive integer: $ISSUE_NUMBER"
105
+ exit 1
106
+ fi
107
+
108
+ # Require issue number for issue-driven initialization
109
+ if [[ -z "$ISSUE_NUMBER" && ( -z "$SESSION_ID" || -z "$DESIGN_ID" ) ]]; then
110
+ echo "Usage: $(basename "$0") --issue-number <number> [--session-id <id>] [--design-id <id>] [--process-slug <slug>] [--workflow <name>] [--push] [--no-commit] [--auto]"
111
+ exit 1
112
+ fi
113
+
114
+ # Derive defaults for session/design from issue number
115
+ if [[ -n "$ISSUE_NUMBER" ]]; then
116
+ TODAY="$(date -u +%Y-%m-%d)"
117
+ SESSION_ID="${SESSION_ID:-$TODAY-issue-$ISSUE_NUMBER}"
118
+ DESIGN_ID="${DESIGN_ID:-issue-$ISSUE_NUMBER}"
119
+ fi
120
+
121
+ # Validate design_id (kebab-case)
122
+ if ! [[ "$DESIGN_ID" =~ ^[a-z0-9]+(-[a-z0-9]+)*$ ]]; then
123
+ echo "ERROR: design_id must be kebab-case lowercase: $DESIGN_ID"
124
+ exit 1
125
+ fi
126
+
127
+ # Validate session_id pattern (YYYY-MM-DD-descriptive-name)
128
+ if ! [[ "$SESSION_ID" =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}-[a-z0-9-]+$ ]]; then
129
+ echo "ERROR: session_id should match YYYY-MM-DD-descriptive-name: $SESSION_ID"
130
+ exit 1
131
+ fi
132
+
133
+ RUN_ID="$(date -u +%Y%m%d%H%M%S)-$(openssl rand -hex 4 2>/dev/null || echo $$)"
134
+
135
+ if [[ -z "$PROCESS_SLUG" ]]; then
136
+ if [[ -n "$ISSUE_NUMBER" ]]; then
137
+ PROCESS_SLUG="issue-$ISSUE_NUMBER"
138
+ elif [[ -n "${LINCOLN_PROCESS_SLUG:-}" ]]; then
139
+ PROCESS_SLUG="$LINCOLN_PROCESS_SLUG"
140
+ elif [[ -n "${CONDUCTOR_WORKSPACE_NAME:-}" ]]; then
141
+ PROCESS_SLUG="$CONDUCTOR_WORKSPACE_NAME"
142
+ else
143
+ PROCESS_SLUG="${SESSION_ID}-${DESIGN_ID}"
144
+ fi
145
+ fi
146
+
147
+ if ! [[ "$PROCESS_SLUG" =~ ^[a-z0-9]+(-[a-z0-9]+)*$ ]]; then
148
+ echo "ERROR: process_slug must be kebab-case lowercase: $PROCESS_SLUG"
149
+ exit 1
150
+ fi
151
+
152
+ # Determine current branch / create feature branch if on main
153
+ CURRENT_BRANCH="$(git branch --show-current 2>/dev/null || true)"
154
+ if [[ -z "$CURRENT_BRANCH" ]]; then
155
+ echo "ERROR: not on a git branch"
156
+ exit 1
157
+ fi
158
+
159
+ if [[ "$CURRENT_BRANCH" == "main" ]]; then
160
+ if [[ -z "$ISSUE_NUMBER" ]]; then
161
+ echo "ERROR: must provide --issue-number to create a feature branch from main"
162
+ exit 1
163
+ fi
164
+ BRANCH_NAME="issue-$ISSUE_NUMBER"
165
+ echo "==> Creating issue branch: $BRANCH_NAME"
166
+ git checkout -b "$BRANCH_NAME"
167
+ CURRENT_BRANCH="$BRANCH_NAME"
168
+ elif [[ -n "$ISSUE_NUMBER" && "$CURRENT_BRANCH" != "issue-$ISSUE_NUMBER" && "$CURRENT_BRANCH" != issue-$ISSUE_NUMBER-* ]]; then
169
+ echo "WARNING: current branch '$CURRENT_BRANCH' does not match the 'issue-$ISSUE_NUMBER' naming convention"
170
+ echo " (see README.md 分支级工作流与阶段状态: issue ↔ branch ↔ PR must correspond end-to-end)."
171
+ echo " Continuing anyway; ensure this is the intended feature branch."
172
+ fi
173
+
174
+ # Ensure working tree is clean before initializing package (skip in --auto mode)
175
+ if [[ -z "$AUTO" ]] && { ! git diff --quiet || ! git diff --cached --quiet; }; then
176
+ echo "ERROR: working tree or index is not clean. Commit or stash changes first."
177
+ exit 1
178
+ fi
179
+
180
+ BRANCH_NAME="$CURRENT_BRANCH"
181
+ PROCESS_ROOT="$PROCESS_SLUG"
182
+
183
+ # Create branch-scoped process package directories.
184
+ # Document templates stay read-only in .claude/templates/issue-package/; agents
185
+ # reference them on demand instead of copying .tpl files into the package.
186
+ echo "==> Creating Lincoln issue work package: $PROCESS_ROOT/"
187
+ mkdir -p "$PROCESS_ROOT"
188
+
189
+ # Initialize workflow-stage.yaml for this issue
190
+ python3 - "$ISSUE_NUMBER" "$SESSION_ID" "$DESIGN_ID" "$BRANCH_NAME" "$RUN_ID" "$ROOT" "$PROCESS_SLUG" "$WORKFLOW_NAME" <<'PY'
191
+ import sys
192
+ from pathlib import Path
193
+ import yaml
194
+
195
+ issue_number, session_id, design_id, branch_name, run_id, root_path, process_slug, workflow_name = sys.argv[1:9]
196
+ root = Path(root_path)
197
+ state_path = root / process_slug / "workflow-stage.yaml"
198
+
199
+ workflow_name = workflow_name or "interview-to-knowledge"
200
+ workflow_path = root / ".claude" / "workflows" / f"{workflow_name}.yaml"
201
+ if not workflow_path.is_file():
202
+ sys.exit(f"ERROR: workflow not found: {workflow_path}")
203
+ workflow_data = yaml.safe_load(workflow_path.read_text(encoding="utf-8")).get("workflow", {})
204
+ steps = workflow_data.get("steps", [])
205
+ first_stage = steps[0].get("id", "ingest") if steps else "ingest"
206
+
207
+ template_path = root / ".claude" / "templates" / "issue-package" / "workflow-stage.yaml"
208
+ state = yaml.safe_load(template_path.read_text(encoding="utf-8"))
209
+ state["workflow"]["name"] = workflow_data.get("name", workflow_name)
210
+ state["workflow"]["version"] = workflow_data.get("version", "1.0.0")
211
+ state["workflow"]["template"] = workflow_name
212
+ state["current_run"]["run_id"] = run_id
213
+ state["current_run"]["branch"] = branch_name
214
+ state["current_run"]["started_at"] = __import__("datetime").datetime.now(__import__("datetime").timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")
215
+ state["current_run"]["last_updated_at"] = state["current_run"]["started_at"]
216
+ state["current_run"]["current_stage"] = first_stage
217
+ state["current_run"]["status"] = "in_progress"
218
+ state["current_run"]["issue_number"] = issue_number
219
+ state["current_run"]["execution_mode"] = "team"
220
+ state["current_run"]["variables"]["session_id"] = session_id
221
+ state["current_run"]["variables"]["design_id"] = design_id
222
+ state["current_run"]["variables"]["issue_number"] = issue_number
223
+ state["current_run"]["variables"]["process_slug"] = process_slug
224
+ state["recovery"]["can_resume_from"] = first_stage
225
+
226
+ state_path.write_text(yaml.dump(state, allow_unicode=True, sort_keys=False), encoding="utf-8")
227
+ print(f"Initialized workflow-stage.yaml for issue #{issue_number} on branch {branch_name} (workflow: {workflow_name}, first stage: {first_stage})")
228
+ PY
229
+
230
+ # Add gitkeep files for empty directories to ensure they are tracked.
231
+ # The HTML portal lives at {process_slug}/index.html; deliverable docs/prototypes
232
+ # go under {process_slug}/pages/. Raw inputs stay in interviews/, openspec/,
233
+ # recordings/, and handoffs/pm-to-ux/.
234
+ for dir in \
235
+ "$PROCESS_ROOT/pages/docs/snapshots" \
236
+ "$PROCESS_ROOT/pages/prototype/app/main" \
237
+ "$PROCESS_ROOT/pages/prototype/app/onboarding" \
238
+ "$PROCESS_ROOT/pages/prototype/app/settings" \
239
+ "$PROCESS_ROOT/pages/prototype/app/org" \
240
+ "$PROCESS_ROOT/pages/prototype/app/tray" \
241
+ "$PROCESS_ROOT/pages/prototype/app/overlays" \
242
+ "$PROCESS_ROOT/pages/prototype/web/dashboard" \
243
+ "$PROCESS_ROOT/pages/prototype/web/list" \
244
+ "$PROCESS_ROOT/pages/prototype/web/form" \
245
+ "$PROCESS_ROOT/pages/prototype/web/detail" \
246
+ "$PROCESS_ROOT/pages/prototype/mobile/home" \
247
+ "$PROCESS_ROOT/pages/prototype/mobile/chat" \
248
+ "$PROCESS_ROOT/pages/prototype/mobile/settings" \
249
+ "$PROCESS_ROOT/pages/prototype/mobile/profile" \
250
+ "$PROCESS_ROOT/handoffs" \
251
+ "$PROCESS_ROOT/handoffs/pm-to-ux" \
252
+ "$PROCESS_ROOT/interviews/$SESSION_ID" \
253
+ "$PROCESS_ROOT/openspec/changes" \
254
+ "$PROCESS_ROOT/openspec/specs" \
255
+ "$PROCESS_ROOT/recordings" \
256
+ ".github/lincoln-sync-queue"; do
257
+ mkdir -p "$dir"
258
+ touch "$dir/.gitkeep"
259
+ done
260
+
261
+ # Copy the HTML portal scaffold from read-only templates.
262
+ # Templates stay in .claude/templates/issue-package/; only the rendered shell and
263
+ # shared assets are copied into the package.
264
+ echo "==> Copying HTML portal scaffold"
265
+ cp "$ROOT/.claude/templates/issue-package/index.html.tpl" "$PROCESS_ROOT/index.html"
266
+ mkdir -p "$PROCESS_ROOT/assets/js"
267
+ cp -R "$ROOT/.claude/templates/issue-package/assets/"* "$PROCESS_ROOT/assets/"
268
+
269
+ # Generate the portal index (assets/js/package-data.js) from workflow-stage.yaml.
270
+ python3 "$ROOT/scripts/lincoln_index.py" --state-file "$PROCESS_ROOT/workflow-stage.yaml"
271
+
272
+ if [[ -n "$NO_COMMIT" ]]; then
273
+ echo "==> Skipping git commit (--no-commit requested)"
274
+ else
275
+ # Stage and commit initial state
276
+ echo "==> Committing initial issue work package"
277
+ git add .
278
+ git commit -m "chore: initialize Lincoln issue work package for #$ISSUE_NUMBER
279
+
280
+ - branch: $BRANCH_NAME
281
+ - process_slug: $PROCESS_SLUG
282
+ - session_id: $SESSION_ID
283
+ - design_id: $DESIGN_ID
284
+ - run_id: $RUN_ID
285
+
286
+ Issue work package is branch-scoped and will not be merged to main."
287
+ fi
288
+
289
+ if [[ "$PUSH" == "--push" ]]; then
290
+ echo "==> Pushing branch to remote"
291
+ git push -u origin "$BRANCH_NAME"
292
+ fi
293
+
294
+ echo ""
295
+ echo "Lincoln issue work package created for issue #$ISSUE_NUMBER"
296
+ echo "Branch: $BRANCH_NAME"
297
+ echo "Process package: $PROCESS_ROOT/"
298
+ echo "Portal: $PROCESS_ROOT/index.html"
299
+ echo "Next step: place the recording in $PROCESS_ROOT/recordings/ and say:"
300
+ echo " '处理一下这个访谈录音 $PROCESS_ROOT/recordings/<recording-file>'"
@@ -0,0 +1,184 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # Lincoln Project Initialization Script
5
+ # Run this after creating a new project from the Lincoln GitHub template.
6
+
7
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8
+ PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
9
+
10
+ if [ -x "$PROJECT_ROOT/.venv/bin/python3" ]; then
11
+ PYTHON="$PROJECT_ROOT/.venv/bin/python3"
12
+ elif [ -x "$PROJECT_ROOT/venv/bin/python3" ]; then
13
+ PYTHON="$PROJECT_ROOT/venv/bin/python3"
14
+ else
15
+ PYTHON="python3"
16
+ fi
17
+
18
+ cd "$PROJECT_ROOT"
19
+
20
+ echo "🚀 Initializing Lincoln project at $PROJECT_ROOT"
21
+
22
+ # ---------------------------------------------------------------------------
23
+ # 1. Verify git repository
24
+ # ---------------------------------------------------------------------------
25
+ if ! git rev-parse --git-dir > /dev/null 2>&1; then
26
+ echo "❌ Error: not a git repository. Please run 'git init' first."
27
+ exit 1
28
+ fi
29
+
30
+ INITIAL_STATUS="$(git status --porcelain)"
31
+
32
+ # ---------------------------------------------------------------------------
33
+ # 2. Ensure placeholder files exist for durable tracked directories
34
+ # ---------------------------------------------------------------------------
35
+ mkdir -p products oss/clones knowledge/assets knowledge/01-interviews knowledge/02-requirements knowledge/03-features knowledge/04-decisions knowledge/06-references .context
36
+
37
+ [ -f products/.gitkeep ] || touch products/.gitkeep
38
+ [ -f oss/clones/.gitkeep ] || touch oss/clones/.gitkeep
39
+ [ -f knowledge/assets/.gitkeep ] || touch knowledge/assets/.gitkeep
40
+ [ -f knowledge/01-interviews/.gitkeep ] || touch knowledge/01-interviews/.gitkeep
41
+ [ -f knowledge/02-requirements/.gitkeep ] || touch knowledge/02-requirements/.gitkeep
42
+ [ -f knowledge/03-features/.gitkeep ] || touch knowledge/03-features/.gitkeep
43
+ [ -f knowledge/04-decisions/.gitkeep ] || touch knowledge/04-decisions/.gitkeep
44
+ [ -f knowledge/06-references/.gitkeep ] || touch knowledge/06-references/.gitkeep
45
+
46
+ if [ ! -f products/README.md ]; then
47
+ cat > products/README.md <<'EOF'
48
+ # Products
49
+
50
+ Put first-party product code under `products/<product-slug>/`.
51
+
52
+ Lincoln process artifacts live in feature-branch process packages, not here.
53
+ EOF
54
+ fi
55
+
56
+ if [ ! -f oss/README.md ]; then
57
+ cat > oss/README.md <<'EOF'
58
+ # OSS
59
+
60
+ Track third-party open-source candidates in `oss/projects.yaml`.
61
+
62
+ Local clones belong under `oss/clones/` and are gitignored.
63
+ EOF
64
+ fi
65
+
66
+ if [ ! -f oss/projects.yaml ]; then
67
+ cat > oss/projects.yaml <<'EOF'
68
+ projects: []
69
+ EOF
70
+ fi
71
+
72
+ # ---------------------------------------------------------------------------
73
+ # 3. Check dependencies (warn only; bootstrap should have installed them)
74
+ # ---------------------------------------------------------------------------
75
+ if [ -f "$PROJECT_ROOT/.claude/skills/dependencies.yaml" ]; then
76
+ if ! "$PYTHON" "$PROJECT_ROOT/scripts/lincoln-setup.py" check --root "$PROJECT_ROOT" > /dev/null 2>&1; then
77
+ echo "⚠️ Lincoln dependency check found missing items."
78
+ echo " Ask Claude to finish the bootstrap before creating issue work packages."
79
+ else
80
+ echo "✅ Lincoln dependency check passed"
81
+ fi
82
+ fi
83
+
84
+ # ---------------------------------------------------------------------------
85
+ # 4. Ensure OpenSpec config is configured
86
+ # ---------------------------------------------------------------------------
87
+ CONFIG_FILE=".github/openspec-config.yml"
88
+ NEEDS_INIT=false
89
+
90
+ if [ ! -f "$CONFIG_FILE" ]; then
91
+ NEEDS_INIT=true
92
+ else
93
+ if grep -qE "owner:\s*your-org" "$CONFIG_FILE" || grep -qE "name:\s*your-product-repo" "$CONFIG_FILE"; then
94
+ NEEDS_INIT=true
95
+ fi
96
+ fi
97
+
98
+ if [ "$NEEDS_INIT" = true ]; then
99
+ echo ""
100
+ echo "📝 $CONFIG_FILE needs the real GitHub owner and repo name."
101
+ OWNER="${LINCOLN_REPO_OWNER:-}"
102
+ NAME="${LINCOLN_REPO_NAME:-}"
103
+
104
+ if [ -z "$OWNER" ] || [ -z "$NAME" ]; then
105
+ REMOTE_URL="$(git remote get-url origin 2>/dev/null || true)"
106
+ if [[ "$REMOTE_URL" =~ github\.com[:/]([^/]+)/([^/]+?)(\.git)?$ ]]; then
107
+ OWNER="${BASH_REMATCH[1]}"
108
+ NAME="${BASH_REMATCH[2]}"
109
+ fi
110
+ fi
111
+
112
+ if [ -n "$OWNER" ] && [ -n "$NAME" ]; then
113
+ "$PYTHON" "$PROJECT_ROOT/scripts/lincoln-setup.py" init-repo-config \
114
+ --root "$PROJECT_ROOT" --owner "$OWNER" --name "$NAME"
115
+ else
116
+ echo " Please ask Claude to run:"
117
+ echo " python scripts/lincoln-setup.py init-repo-config --owner <owner> --name <repo>"
118
+ echo " Or set LINCOLN_REPO_OWNER and LINCOLN_REPO_NAME and re-run."
119
+ fi
120
+ else
121
+ echo "✅ OpenSpec config already contains real values"
122
+ fi
123
+
124
+ # ---------------------------------------------------------------------------
125
+ # 5. Make validator executable
126
+ # ---------------------------------------------------------------------------
127
+ VALIDATOR="scripts/validate_stage.py"
128
+ if [ -f "$VALIDATOR" ]; then
129
+ chmod +x "$VALIDATOR"
130
+ echo "✅ Validator made executable"
131
+ fi
132
+
133
+ # ---------------------------------------------------------------------------
134
+ # 6. GitHub CLI auth check
135
+ # ---------------------------------------------------------------------------
136
+ if command -v gh > /dev/null 2>&1; then
137
+ if ! gh auth status > /dev/null 2>&1; then
138
+ echo "⚠️ GitHub CLI is installed but not authenticated. Ask Claude to run 'gh auth login' before using split-to-github."
139
+ else
140
+ echo "✅ GitHub CLI authenticated"
141
+ fi
142
+ else
143
+ echo "⚠️ GitHub CLI not found. Ask Claude to install it during bootstrap."
144
+ fi
145
+
146
+ # ---------------------------------------------------------------------------
147
+ # 7. Initial commit for files created by this script
148
+ # ---------------------------------------------------------------------------
149
+ if [ -z "$(git status --porcelain)" ]; then
150
+ echo "ℹ️ No changes to commit"
151
+ elif [ -n "$INITIAL_STATUS" ]; then
152
+ echo "⚠️ Existing local changes detected before initialization; skipping automatic commit."
153
+ echo " Review and commit the changes manually when ready."
154
+ else
155
+ git add \
156
+ products/.gitkeep \
157
+ products/README.md \
158
+ oss/README.md \
159
+ oss/projects.yaml \
160
+ knowledge/assets/.gitkeep \
161
+ knowledge/01-interviews/.gitkeep \
162
+ knowledge/02-requirements/.gitkeep \
163
+ knowledge/03-features/.gitkeep \
164
+ knowledge/04-decisions/.gitkeep \
165
+ knowledge/06-references/.gitkeep
166
+ if git diff --cached --quiet; then
167
+ echo "ℹ️ No tracked initialization changes to commit"
168
+ else
169
+ git commit -m "chore: init project with Lincoln workflow"
170
+ echo "✅ Initial commit created"
171
+ fi
172
+ fi
173
+
174
+ # Record that project initialization is complete.
175
+ "$PYTHON" "$PROJECT_ROOT/scripts/lincoln-setup.py" mark-step \
176
+ --root "$PROJECT_ROOT" --step init_project --status completed
177
+
178
+ echo ""
179
+ echo "🎉 Lincoln project initialized successfully!"
180
+ echo ""
181
+ echo "Next steps:"
182
+ echo " 1. Create a feature process branch: scripts/init-lincoln-branch.sh --issue-number <number> --session-id <session-id> --design-id <design-id> --process-slug <feature-slug> --push"
183
+ echo " 2. Place interview recordings in <feature-slug>/recordings/"
184
+ echo " 3. Say to Claude Code: '处理一下这个访谈录音 <feature-slug>/recordings/<file>'"
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env python3
2
+ """Explicit CLI entry point for Lincoln benchmark reports (#72).
3
+
4
+ This wrapper resolves the current workflow state (using the same logic as the
5
+ hooks) and forwards to scripts/lincoln_benchmark.py. It makes `/lc-benchmark`
6
+ a deterministic, opt-in command instead of an implicit side effect of session
7
+ stop or PR events.
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ import argparse
13
+ import os
14
+ import sys
15
+ from pathlib import Path
16
+
17
+ _PROJECT_ROOT = Path(__file__).resolve().parents[1]
18
+ if str(_PROJECT_ROOT) not in sys.path:
19
+ sys.path.insert(0, str(_PROJECT_ROOT))
20
+
21
+ from scripts import lincoln_benchmark # noqa: E402
22
+ from scripts.lincoln_paths import resolve_state_path # noqa: E402
23
+
24
+
25
+ def parse_args(argv: list[str] | None = None) -> argparse.Namespace:
26
+ parser = argparse.ArgumentParser(
27
+ description="Generate a Lincoln benchmark report (opt-in)."
28
+ )
29
+ parser.add_argument(
30
+ "--state-file",
31
+ type=Path,
32
+ help="Path to workflow-stage.yaml. Auto-resolved if omitted.",
33
+ )
34
+ parser.add_argument(
35
+ "--trigger",
36
+ choices=["manual", "handoff", "pr_created", "pr_merged", "session_stop"],
37
+ default="manual",
38
+ help="Benchmark trigger context (default: manual).",
39
+ )
40
+ return parser.parse_args(argv)
41
+
42
+
43
+ def main(argv: list[str] | None = None) -> int:
44
+ args = parse_args(argv)
45
+
46
+ state_file = args.state_file
47
+ if state_file is None:
48
+ state_file = resolve_state_path(None, _PROJECT_ROOT)
49
+
50
+ if not state_file.exists():
51
+ print(
52
+ "No Lincoln workflow state found. "
53
+ "Run this from a repo with an active issue work package.",
54
+ file=sys.stderr,
55
+ )
56
+ return 1
57
+
58
+ # Avoid recursive trace logging when benchmark is invoked from a hook.
59
+ os.environ["LINCOLN_SKIP_TRACE"] = "1"
60
+ return lincoln_benchmark.main(
61
+ ["--state-file", str(state_file), "--trigger", args.trigger]
62
+ )
63
+
64
+
65
+ if __name__ == "__main__":
66
+ sys.exit(main())