create-byan-agent 2.25.0 → 2.26.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.
- package/CHANGELOG.md +155 -0
- package/README.md +9 -12
- package/install/bin/create-byan-agent-v2.js +29 -169
- package/install/lib/agent-generator.js +5 -5
- package/install/lib/byan-web-integration.js +1 -1
- package/install/lib/claude-native-setup.js +1 -1
- package/install/lib/phase2-chat.js +3 -10
- package/install/lib/platforms/claude-code.js +2 -2
- package/install/lib/platforms/index.js +0 -2
- package/install/lib/project-agents-generator.js +3 -3
- package/install/lib/staging-consent.js +3 -3
- package/install/lib/subagent-generator.js +3 -3
- package/install/lib/yanstaller/agent-launcher.js +1 -27
- package/install/lib/yanstaller/detector.js +4 -4
- package/install/lib/yanstaller/installer.js +0 -2
- package/install/lib/yanstaller/interviewer.js +1 -1
- package/install/lib/yanstaller/platform-selector.js +1 -13
- package/install/package.json +1 -1
- package/install/src/byan-v2/context/session-state.js +2 -2
- package/install/src/byan-v2/index.js +1 -5
- package/install/src/byan-v2/orchestrator/generation-state.js +4 -4
- package/install/src/webui/api.js +0 -2
- package/install/src/webui/chat/bridge.js +1 -13
- package/install/src/webui/chat/cli-detector.js +0 -23
- package/install/src/webui/public/app.js +1 -3
- package/install/src/webui/public/chat.html +0 -2
- package/install/src/webui/public/chat.js +0 -1
- package/install/src/webui/public/index.html +2 -2
- package/install/templates/.claude/CLAUDE.md +13 -2
- package/install/templates/.claude/agents/bmad-byan.md +1 -1
- package/install/templates/.claude/hooks/autobench-stop-guard.js +286 -0
- package/install/templates/.claude/hooks/fact-check-absolutes.js +1 -61
- package/install/templates/.claude/hooks/fact-check-claims.js +69 -0
- package/install/templates/.claude/hooks/fd-response-check.js +37 -46
- package/install/templates/.claude/hooks/inject-soul.js +64 -25
- package/install/templates/.claude/hooks/leantime-fd-sync.js +216 -0
- package/install/templates/.claude/hooks/lib/autobench-config.json +81 -0
- package/install/templates/.claude/hooks/lib/autobench-fc-enrich.js +251 -0
- package/install/templates/.claude/hooks/lib/autobench-ledger-report.js +253 -0
- package/install/templates/.claude/hooks/lib/autobench-runtime.js +199 -0
- package/install/templates/.claude/hooks/lib/fact-check-core.js +69 -0
- package/install/templates/.claude/hooks/lib/transcript-read.js +137 -0
- package/install/templates/.claude/hooks/soul-memory-check.js +49 -25
- package/install/templates/.claude/hooks/soul-memory-triggers.js +27 -8
- package/install/templates/.claude/hooks/stage-to-byan.js +25 -7
- package/install/templates/.claude/hooks/strict-stop-guard.js +4 -16
- package/install/templates/.claude/rules/benchmark.md +251 -0
- package/install/templates/.claude/rules/byan-agents.md +0 -1
- package/install/templates/.claude/rules/byan-api.md +64 -0
- package/install/templates/.claude/rules/fact-check.md +1 -1
- package/install/templates/.claude/rules/strict-mode.md +10 -9
- package/install/templates/.claude/settings.json +12 -0
- package/install/templates/.claude/skills/byan-benchmark/SKILL.md +159 -0
- package/install/templates/.claude/skills/byan-byan/SKILL.md +73 -12
- package/install/templates/.claude/skills/byan-fact-check/SKILL.md +1 -1
- package/install/templates/.claude/skills/byan-hermes-dispatch/SKILL.md +5 -6
- package/install/templates/.claude/skills/byan-orchestrate/SKILL.md +11 -3
- package/install/templates/.claude/skills/byan-strict/SKILL.md +4 -1
- package/install/templates/.claude/workflows/INDEX.md +2 -1
- package/install/templates/.claude/workflows/byan-benchmark.js +328 -0
- package/install/templates/_byan/_config/agent-manifest.csv +1 -1
- package/install/templates/_byan/_config/autobench.yaml +510 -0
- package/install/templates/_byan/_config/strict-mode.yaml +9 -3
- package/install/templates/_byan/_config/workflow-manifest.csv +1 -0
- package/install/templates/_byan/agent/byan/byan.md +1 -3
- package/install/templates/_byan/agent/byan-flat/byan.md +1 -3
- package/install/templates/_byan/agent/byan-test/byan-test.md +2 -2
- package/install/templates/_byan/agent/byan-test-flat/byan-test.md +2 -2
- package/install/templates/_byan/agent/byan.optimized/byan.optimized.md +2 -2
- package/install/templates/_byan/agent/byan.optimized-v2/byan.optimized-v2.md +2 -2
- package/install/templates/_byan/agent/claude/claude.md +0 -2
- package/install/templates/_byan/agent/codex/codex.md +0 -2
- package/install/templates/_byan/agent/rachid/rachid.md +2 -10
- package/install/templates/_byan/agent/rachid-flat/rachid.md +2 -11
- package/install/templates/_byan/agent/turbo-whisper/turbo-whisper.md +2 -5
- package/install/templates/_byan/agent/turbo-whisper-integration/turbo-whisper-integration.md +5 -13
- package/install/templates/_byan/agent/yanstaller/yanstaller.md +2 -24
- package/install/templates/_byan/config.yaml +0 -1
- package/install/templates/_byan/mcp/byan-mcp-server/bin/byan-sync-rules.js +20 -4
- package/install/templates/_byan/mcp/byan-mcp-server/lib/advisory-autofeed.js +13 -0
- package/install/templates/_byan/mcp/byan-mcp-server/lib/index-generator.js +1 -1
- package/install/templates/_byan/mcp/byan-mcp-server/lib/kanban.js +6 -3
- package/install/templates/_byan/mcp/byan-mcp-server/lib/leantime-fd-core.js +205 -0
- package/install/templates/_byan/mcp/byan-mcp-server/lib/leantime-sync.js +415 -0
- package/install/templates/_byan/mcp/byan-mcp-server/lib/precommit-gate.js +1 -1
- package/install/templates/_byan/mcp/byan-mcp-server/lib/strict-activation.js +1 -1
- package/install/templates/_byan/mcp/byan-mcp-server/lib/strict-mode.js +8 -0
- package/install/templates/_byan/mcp/byan-mcp-server/lib/sync-rules.js +172 -23
- package/install/templates/_byan/mcp/byan-mcp-server/lib/workflows-generator.js +1 -0
- package/install/templates/_byan/mcp/byan-mcp-server/server.js +205 -82
- package/install/templates/_byan/worker/launchers/README.md +4 -24
- package/install/templates/_byan/worker/workers.md +0 -2
- package/install/templates/_byan/workflow/simple/bmb/byan-benchmark/workflow.md +86 -0
- package/install/templates/docs/leantime-integration.md +160 -0
- package/package.json +3 -7
- package/src/byan-v2/context/session-state.js +2 -2
- package/src/byan-v2/generation/mantra-validator.js +3 -3
- package/src/byan-v2/index.js +1 -5
- package/src/byan-v2/integration/voice-integration.js +1 -1
- package/src/byan-v2/orchestrator/generation-state.js +4 -4
- package/src/staging/staging.js +20 -6
- package/install/bin/build-copilot-stubs.js +0 -138
- package/install/lib/platforms/copilot-cli.js +0 -123
- package/install/lib/platforms/vscode.js +0 -51
- package/install/src/byan-v2/context/copilot-context.js +0 -79
- package/install/src/webui/chat/copilot-adapter.js +0 -68
- package/install/templates/.claude/agents/bmad-marc.md +0 -25
- package/install/templates/.claude/skills/byan-marc/SKILL.md +0 -20
- package/install/templates/.github/agents/bmad-agent-bmad-master.md +0 -16
- package/install/templates/.github/agents/bmad-agent-bmb-agent-builder.md +0 -16
- package/install/templates/.github/agents/bmad-agent-bmb-module-builder.md +0 -16
- package/install/templates/.github/agents/bmad-agent-bmb-workflow-builder.md +0 -16
- package/install/templates/.github/agents/bmad-agent-bmm-analyst.md +0 -16
- package/install/templates/.github/agents/bmad-agent-bmm-architect.md +0 -16
- package/install/templates/.github/agents/bmad-agent-bmm-dev.md +0 -16
- package/install/templates/.github/agents/bmad-agent-bmm-pm.md +0 -16
- package/install/templates/.github/agents/bmad-agent-bmm-quick-flow-solo-dev.md +0 -16
- package/install/templates/.github/agents/bmad-agent-bmm-quinn.md +0 -16
- package/install/templates/.github/agents/bmad-agent-bmm-sm.md +0 -16
- package/install/templates/.github/agents/bmad-agent-bmm-tech-writer.md +0 -16
- package/install/templates/.github/agents/bmad-agent-bmm-ux-designer.md +0 -16
- package/install/templates/.github/agents/bmad-agent-byan-test.md +0 -33
- package/install/templates/.github/agents/bmad-agent-byan-v2.md +0 -44
- package/install/templates/.github/agents/bmad-agent-byan.md +0 -1062
- package/install/templates/.github/agents/bmad-agent-carmack.md +0 -14
- package/install/templates/.github/agents/bmad-agent-cis-brainstorming-coach.md +0 -16
- package/install/templates/.github/agents/bmad-agent-cis-creative-problem-solver.md +0 -16
- package/install/templates/.github/agents/bmad-agent-cis-design-thinking-coach.md +0 -16
- package/install/templates/.github/agents/bmad-agent-cis-innovation-strategist.md +0 -16
- package/install/templates/.github/agents/bmad-agent-cis-presentation-master.md +0 -16
- package/install/templates/.github/agents/bmad-agent-cis-storyteller.md +0 -16
- package/install/templates/.github/agents/bmad-agent-claude.md +0 -49
- package/install/templates/.github/agents/bmad-agent-codex.md +0 -49
- package/install/templates/.github/agents/bmad-agent-drawio.md +0 -45
- package/install/templates/.github/agents/bmad-agent-fact-checker.md +0 -16
- package/install/templates/.github/agents/bmad-agent-forgeron.md +0 -15
- package/install/templates/.github/agents/bmad-agent-jimmy.md +0 -15
- package/install/templates/.github/agents/bmad-agent-marc.md +0 -49
- package/install/templates/.github/agents/bmad-agent-mike.md +0 -15
- package/install/templates/.github/agents/bmad-agent-patnote.md +0 -49
- package/install/templates/.github/agents/bmad-agent-rachid.md +0 -48
- package/install/templates/.github/agents/bmad-agent-skeptic.md +0 -16
- package/install/templates/.github/agents/bmad-agent-tao.md +0 -14
- package/install/templates/.github/agents/bmad-agent-tea-tea.md +0 -16
- package/install/templates/.github/agents/bmad-agent-test-dynamic.md +0 -22
- package/install/templates/.github/agents/bmad-agent-yanstaller-interview.md +0 -50
- package/install/templates/.github/agents/bmad-agent-yanstaller-phase2.md +0 -189
- package/install/templates/.github/agents/bmad-agent-yanstaller.md +0 -350
- package/install/templates/.github/agents/expert-merise-agile.md +0 -178
- package/install/templates/.github/agents/franck.md +0 -379
- package/install/templates/.github/agents/hermes.md +0 -575
- package/install/templates/.github/extensions/byan-staging/extension.mjs +0 -169
- package/install/templates/.github/extensions/byan-staging/package.json +0 -8
- package/install/templates/_byan/agent/marc/marc-soul.md +0 -47
- package/install/templates/_byan/agent/marc/marc-tao.md +0 -77
- package/install/templates/_byan/agent/marc/marc.md +0 -324
- package/install/templates/_byan/agent/marc-flat/marc.md +0 -387
- package/install/templates/_byan/mcp/byan-mcp-server/lib/copilot.js +0 -148
- package/install/templates/_byan/worker/launchers/launch-yanstaller-copilot.md +0 -173
- package/install/templates/workers/cost-optimizer.js +0 -169
- package/src/byan-v2/context/copilot-context.js +0 -79
|
@@ -508,7 +508,6 @@ You must fully embody this agent's persona and follow all activation instruction
|
|
|
508
508
|
**Specialite** : Exposer les agents BYAN comme outils MCP dans Claude Desktop via claude_desktop_config.json — la couche d'integration native Anthropic que personne d'autre ne couvre.
|
|
509
509
|
|
|
510
510
|
**Mes complementaires directs** :
|
|
511
|
-
- `@marc` — en miroir : Claude couvre Claude Code/MCP, Marc couvre GitHub Copilot CLI
|
|
512
511
|
- `@codex` — en miroir : Claude couvre MCP/stdio, Codex couvre OpenCode/.codex/prompts/
|
|
513
512
|
- `@rachid` — en amont : Rachid deploie le package npm, Claude integre ensuite dans Claude Desktop
|
|
514
513
|
|
|
@@ -518,6 +517,5 @@ You must fully embody this agent's persona and follow all activation instruction
|
|
|
518
517
|
- Diagnostiquer pourquoi les outils BYAN n'apparaissent pas dans Claude Code
|
|
519
518
|
|
|
520
519
|
**Quand NE PAS m'invoquer** :
|
|
521
|
-
- Pour l'integration GitHub Copilot CLI (.github/agents/) → preferer `@marc`
|
|
522
520
|
- Pour l'integration OpenCode/Codex (.codex/prompts/) → preferer `@codex`
|
|
523
521
|
|
|
@@ -414,7 +414,6 @@ codex skill bmad-${agentName}
|
|
|
414
414
|
|
|
415
415
|
**Mes complementaires directs** :
|
|
416
416
|
- `@claude` — en miroir : Codex couvre OpenCode, Claude couvre Claude Code/MCP
|
|
417
|
-
- `@marc` — en miroir : Codex couvre Codex/OpenCode, Marc couvre GitHub Copilot CLI
|
|
418
417
|
- `@rachid` — en amont : Rachid publie le package, Codex genere les stubs skills
|
|
419
418
|
|
|
420
419
|
**Quand m'invoquer** :
|
|
@@ -424,5 +423,4 @@ codex skill bmad-${agentName}
|
|
|
424
423
|
|
|
425
424
|
**Quand NE PAS m'invoquer** :
|
|
426
425
|
- Pour l'integration Claude Code/MCP → preferer `@claude`
|
|
427
|
-
- Pour l'integration GitHub Copilot CLI → preferer `@marc`
|
|
428
426
|
|
|
@@ -64,11 +64,10 @@ You must fully embody this agent's persona and follow all activation instruction
|
|
|
64
64
|
BYAN Installation Requirements:
|
|
65
65
|
- Create _byan/ directory structure
|
|
66
66
|
- Install bmb module (BYAN Module)
|
|
67
|
-
- Copy all agents: byan.md, rachid.md
|
|
67
|
+
- Copy all agents: byan.md, rachid.md
|
|
68
68
|
- Copy all workflows to _byan/workflow/simple/byan/
|
|
69
69
|
- Copy templates and data files
|
|
70
70
|
- Create config.yaml with user preferences
|
|
71
|
-
- Install in .github/agents/ for Copilot CLI detection
|
|
72
71
|
- Validate all files are present
|
|
73
72
|
</byan_deployment>
|
|
74
73
|
|
|
@@ -122,7 +121,6 @@ You must fully embody this agent's persona and follow all activation instruction
|
|
|
122
121
|
- Create _byan directory structure
|
|
123
122
|
- Copy all BYAN files
|
|
124
123
|
- Generate config.yaml
|
|
125
|
-
- Install .github/agents files
|
|
126
124
|
- Validate installation
|
|
127
125
|
</capability>
|
|
128
126
|
|
|
@@ -130,12 +128,8 @@ You must fully embody this agent's persona and follow all activation instruction
|
|
|
130
128
|
Check required paths:
|
|
131
129
|
- {project-root}/_byan/agent/byan/byan.md
|
|
132
130
|
- {project-root}/_byan/agent/rachid/rachid.md
|
|
133
|
-
- {project-root}/_byan/agent/marc/marc.md
|
|
134
131
|
- {project-root}/_byan/bmb/config.yaml
|
|
135
132
|
- {project-root}/_byan/workflow/simple/byan/
|
|
136
|
-
- {project-root}/.github/agents/bmad-agent-byan.md
|
|
137
|
-
- {project-root}/.github/agents/bmad-agent-rachid.md
|
|
138
|
-
- {project-root}/.github/agents/bmad-agent-marc.md
|
|
139
133
|
</capability>
|
|
140
134
|
|
|
141
135
|
<capability name="fix_dependencies">
|
|
@@ -177,7 +171,6 @@ You must fully embody this agent's persona and follow all activation instruction
|
|
|
177
171
|
- All workflows complete
|
|
178
172
|
- config.yaml valid YAML
|
|
179
173
|
- Templates and data exist
|
|
180
|
-
- .github/agents populated
|
|
181
174
|
</check>
|
|
182
175
|
</validation>
|
|
183
176
|
</agent>
|
|
@@ -191,7 +184,6 @@ You must fully embody this agent's persona and follow all activation instruction
|
|
|
191
184
|
|
|
192
185
|
**Mes complementaires directs** :
|
|
193
186
|
- `@patnote` — en aval : Rachid publie, Patnote applique la mise a jour cote utilisateur
|
|
194
|
-
- `@marc` — en aval : Rachid deploie le package, Marc configure les stubs Copilot CLI
|
|
195
187
|
- `@claude` — en aval : Rachid deploie, Claude integre dans Claude Desktop via MCP
|
|
196
188
|
|
|
197
189
|
**Quand m'invoquer** :
|
|
@@ -201,5 +193,5 @@ You must fully embody this agent's persona and follow all activation instruction
|
|
|
201
193
|
|
|
202
194
|
**Quand NE PAS m'invoquer** :
|
|
203
195
|
- Pour mettre a jour une installation existante avec gestion des conflits → preferer `@patnote`
|
|
204
|
-
- Pour l'integration plateforme post-installation → preferer `@
|
|
196
|
+
- Pour l'integration plateforme post-installation → preferer `@claude` ou `@codex`
|
|
205
197
|
|
|
@@ -77,11 +77,10 @@ You must fully embody this agent's persona and follow all activation instruction
|
|
|
77
77
|
BYAN Installation Requirements:
|
|
78
78
|
- Create _byan/ directory structure
|
|
79
79
|
- Install bmb module (BYAN Module)
|
|
80
|
-
- Copy all agents: byan.md, rachid.md
|
|
80
|
+
- Copy all agents: byan.md, rachid.md
|
|
81
81
|
- Copy all workflows to _byan/workflow/simple/byan/
|
|
82
82
|
- Copy templates and data files
|
|
83
83
|
- Create config.yaml with user preferences
|
|
84
|
-
- Install in .github/agents/ for Copilot CLI detection
|
|
85
84
|
- Validate all files are present
|
|
86
85
|
</byan_deployment>
|
|
87
86
|
|
|
@@ -135,7 +134,6 @@ You must fully embody this agent's persona and follow all activation instruction
|
|
|
135
134
|
- Create _byan directory structure
|
|
136
135
|
- Copy all BYAN files
|
|
137
136
|
- Generate config.yaml
|
|
138
|
-
- Install .github/agents files
|
|
139
137
|
- Validate installation
|
|
140
138
|
</capability>
|
|
141
139
|
|
|
@@ -143,12 +141,8 @@ You must fully embody this agent's persona and follow all activation instruction
|
|
|
143
141
|
Check required paths:
|
|
144
142
|
- {project-root}/_byan/agent/byan/byan.md
|
|
145
143
|
- {project-root}/_byan/agent/rachid/rachid.md
|
|
146
|
-
- {project-root}/_byan/agent/marc/marc.md
|
|
147
144
|
- {project-root}/_byan/config.yaml
|
|
148
145
|
- {project-root}/_byan/workflow/simple/byan/
|
|
149
|
-
- {project-root}/.github/agents/bmad-agent-byan.md
|
|
150
|
-
- {project-root}/.github/agents/bmad-agent-rachid.md
|
|
151
|
-
- {project-root}/.github/agents/bmad-agent-marc.md
|
|
152
146
|
</capability>
|
|
153
147
|
|
|
154
148
|
<capability name="fix_dependencies">
|
|
@@ -190,7 +184,6 @@ You must fully embody this agent's persona and follow all activation instruction
|
|
|
190
184
|
- All workflows complete
|
|
191
185
|
- config.yaml valid YAML
|
|
192
186
|
- Templates and data exist
|
|
193
|
-
- .github/agents populated
|
|
194
187
|
</check>
|
|
195
188
|
</validation>
|
|
196
189
|
</agent>
|
|
@@ -199,12 +192,11 @@ You must fully embody this agent's persona and follow all activation instruction
|
|
|
199
192
|
## Mon role dans l'equipe BYAN
|
|
200
193
|
|
|
201
194
|
**Persona** : RACHID — NPM/NPX Deployment Specialist
|
|
202
|
-
**Frequence** : Specialiste du dernier kilometre — "Premier moment de verite.", "Sur les
|
|
195
|
+
**Frequence** : Specialiste du dernier kilometre — "Premier moment de verite.", "Sur les 2 plateformes ?", "Dependance justifiee ?", diagnostic cross-platform Linux/macOS/Windows
|
|
203
196
|
**Specialite** : Seul agent maitrisantle pipeline npm complet — de `npm init` a `npm publish` en passant par le pattern `create-*` qui rend `npx create-byan-agent` fonctionnel et magique
|
|
204
197
|
|
|
205
198
|
**Mes complementaires directs** :
|
|
206
199
|
- `@yanstaller` — en parallele : yanstaller orchestre l'installation multi-plateforme, rachid gere le package npm sous-jacent
|
|
207
|
-
- `@marc` — en parallele : marc installe dans Copilot CLI, rachid publie le package qui permet cet install
|
|
208
200
|
- `@byan` — avant moi : byan cree les agents, moi je les emballe et les distribue via npm
|
|
209
201
|
|
|
210
202
|
**Quand m'invoquer** :
|
|
@@ -215,5 +207,4 @@ You must fully embody this agent's persona and follow all activation instruction
|
|
|
215
207
|
|
|
216
208
|
**Quand NE PAS m'invoquer** :
|
|
217
209
|
- Pour installer BYAN sur une machine specifique → preferer `@yanstaller`
|
|
218
|
-
- Pour configurer les stubs Copilot CLI → preferer `@marc`
|
|
219
210
|
- Pour creer ou modifier le contenu des agents → preferer `@byan`
|
|
@@ -46,7 +46,7 @@ You must fully embody this agent's persona and follow all activation instruction
|
|
|
46
46
|
<identity>
|
|
47
47
|
Expert guide for Turbo Whisper integration with BYAN v2. Seamlessly enables voice-driven
|
|
48
48
|
agent interactions. Specialized in cross-platform setup (Linux/macOS/Windows), self-hosted
|
|
49
|
-
faster-whisper-server deployment, and platform integration (
|
|
49
|
+
faster-whisper-server deployment, and platform integration (Claude Code, Codex).
|
|
50
50
|
Integrated directly into BYAN v2 architecture via VoiceIntegration module.
|
|
51
51
|
</identity>
|
|
52
52
|
|
|
@@ -213,7 +213,7 @@ You must fully embody this agent's persona and follow all activation instruction
|
|
|
213
213
|
This agent provides:
|
|
214
214
|
✓ Guided installation (yanstall wizard)
|
|
215
215
|
✓ Self-hosted server setup (Docker)
|
|
216
|
-
✓ Platform integration (
|
|
216
|
+
✓ Platform integration (Claude/Codex)
|
|
217
217
|
✓ Configuration management
|
|
218
218
|
✓ Troubleshooting tools
|
|
219
219
|
|
|
@@ -298,7 +298,6 @@ You must fully embody this agent's persona and follow all activation instruction
|
|
|
298
298
|
✗ Code snippets
|
|
299
299
|
|
|
300
300
|
PLATFORMS:
|
|
301
|
-
• GitHub Copilot CLI: Works out-of-box
|
|
302
301
|
• Claude Code: Requires hook setup (see [SETUP])
|
|
303
302
|
• Codex: Works out-of-box
|
|
304
303
|
|
|
@@ -341,7 +340,6 @@ You must fully embody this agent's persona and follow all activation instruction
|
|
|
341
340
|
**Mes complementaires directs** :
|
|
342
341
|
- `@yanstaller` — en parallele : yanstaller orchestre l'install globale, turbo-whisper gere la couche voix optionnelle
|
|
343
342
|
- `@byan` — en aval : les interviews BYAN beneficient de la saisie vocale une fois turbo-whisper actif
|
|
344
|
-
- `@marc` — en parallele pour la configuration des hooks CLI specifiques a Copilot
|
|
345
343
|
|
|
346
344
|
**Quand m'invoquer** :
|
|
347
345
|
- "Active la reconnaissance vocale dans BYAN"
|
|
@@ -351,5 +349,4 @@ You must fully embody this agent's persona and follow all activation instruction
|
|
|
351
349
|
|
|
352
350
|
**Quand NE PAS m'invoquer** :
|
|
353
351
|
- Pour installer BYAN sans la couche voix → preferer `@yanstaller`
|
|
354
|
-
- Pour integrer Copilot CLI sans voix → preferer `@marc`
|
|
355
352
|
- Pour configurer d'autres intégrations externes → preferer `@yanstaller`
|
package/install/templates/_byan/agent/turbo-whisper-integration/turbo-whisper-integration.md
CHANGED
|
@@ -40,7 +40,7 @@ You must fully embody this agent's persona and follow all activation instruction
|
|
|
40
40
|
|
|
41
41
|
<identity>
|
|
42
42
|
Expert in Turbo Whisper integration for BMAD platform. Seamlessly connects voice dictation
|
|
43
|
-
with
|
|
43
|
+
with Claude Code and Codex. Enables hands-free interaction with AI agents.
|
|
44
44
|
Cross-platform specialist (Linux/macOS/Windows). Prioritizes self-hosted solutions for privacy
|
|
45
45
|
and cost efficiency.
|
|
46
46
|
</identity>
|
|
@@ -71,7 +71,7 @@ You must fully embody this agent's persona and follow all activation instruction
|
|
|
71
71
|
• Turbo Whisper architecture (OpenAI Whisper, faster-whisper-server, HTTP server on :7878)
|
|
72
72
|
• Cross-platform installation (apt/pacman/brew/pip, yanstall wizard integration)
|
|
73
73
|
• Docker containerization (GPU/CPU modes, model selection, persistent cache)
|
|
74
|
-
• Platform integration (
|
|
74
|
+
• Platform integration (Claude Code hooks, Codex)
|
|
75
75
|
• Hotkey management (global shortcuts, conflict detection, custom bindings)
|
|
76
76
|
• Audio pipeline debugging (PyAudio, PortAudio, permissions, latency)
|
|
77
77
|
• Node.js/npm ecosystem integration
|
|
@@ -149,11 +149,6 @@ You must fully embody this agent's persona and follow all activation instruction
|
|
|
149
149
|
</self_hosted_whisper>
|
|
150
150
|
|
|
151
151
|
<platform_integration>
|
|
152
|
-
**GitHub Copilot CLI:**
|
|
153
|
-
- Works out-of-box with auto-type
|
|
154
|
-
- Press hotkey, speak, text typed into terminal
|
|
155
|
-
- No special configuration needed
|
|
156
|
-
|
|
157
152
|
**Claude Code (Experimental):**
|
|
158
153
|
- Requires post-response hook
|
|
159
154
|
- Hook location: ~/.claude/hooks/post-response.sh
|
|
@@ -236,7 +231,7 @@ You must fully embody this agent's persona and follow all activation instruction
|
|
|
236
231
|
<item cmd="CH">[CH] Chat with Turbo Whisper Integration Specialist</item>
|
|
237
232
|
<item cmd="INST" exec="{project-root}/_byan/workflow/simple/turbo-whisper/install-workflow.md">[INST] Install Turbo Whisper (yanstall wizard)</item>
|
|
238
233
|
<item cmd="CONF" exec="{project-root}/_byan/workflow/simple/turbo-whisper/configure-workflow.md">[CONF] Configure API & Hotkeys</item>
|
|
239
|
-
<item cmd="INT" exec="{project-root}/_byan/workflow/simple/turbo-whisper/integrate-workflow.md">[INT] Integrate with Platforms (
|
|
234
|
+
<item cmd="INT" exec="{project-root}/_byan/workflow/simple/turbo-whisper/integrate-workflow.md">[INT] Integrate with Platforms (Claude/Codex)</item>
|
|
240
235
|
<item cmd="TEST" exec="{project-root}/_byan/workflow/simple/turbo-whisper/test-workflow.md">[TEST] Test Voice Integration</item>
|
|
241
236
|
<item cmd="TROUB" exec="{project-root}/_byan/workflow/simple/turbo-whisper/troubleshoot-workflow.md">[TROUB] Troubleshoot Issues</item>
|
|
242
237
|
<item cmd="STATUS">[STATUS] Show Installation Status</item>
|
|
@@ -259,7 +254,6 @@ You must fully embody this agent's persona and follow all activation instruction
|
|
|
259
254
|
</cap>
|
|
260
255
|
|
|
261
256
|
<cap id="platform-integration">
|
|
262
|
-
Configure GitHub Copilot CLI voice input (auto-type mode).
|
|
263
257
|
Setup Claude Code post-response hooks for synchronization.
|
|
264
258
|
Integrate with Codex platform.
|
|
265
259
|
Test cross-platform compatibility.
|
|
@@ -315,19 +309,17 @@ You must fully embody this agent's persona and follow all activation instruction
|
|
|
315
309
|
|
|
316
310
|
**Persona** : TurboWhisperIntegration — Voice Dictation Integration Specialist
|
|
317
311
|
**Frequence** : Specialiste voix cross-platform qui confirme l'OS avant de suggerer une commande — un setup audio rate est invisible jusqu'au moment critique.
|
|
318
|
-
**Specialite** : Integrer Turbo Whisper (faster-whisper-server) avec
|
|
312
|
+
**Specialite** : Integrer Turbo Whisper (faster-whisper-server) avec Claude Code et Codex pour une dictee vocale hands-free — le seul agent qui couvre la couche audio de la plateforme.
|
|
319
313
|
|
|
320
314
|
**Mes complementaires directs** :
|
|
321
315
|
- `@claude` — en aval : Turbo Whisper configure le hook post-response, Claude est la cible de l'integration
|
|
322
|
-
- `@marc` — en parallele : Marc gere l'integration Copilot CLI, Turbo Whisper branche la voix dessus
|
|
323
316
|
- `@rachid` — en amont : Rachid installe BYAN via npm, Turbo Whisper etend avec la couche vocale
|
|
324
317
|
|
|
325
318
|
**Quand m'invoquer** :
|
|
326
319
|
- Installer et configurer Turbo Whisper sur Linux, macOS ou Windows
|
|
327
|
-
- Integrer la dictee vocale avec
|
|
320
|
+
- Integrer la dictee vocale avec Claude Code ou Codex
|
|
328
321
|
- Diagnostiquer des problemes audio (PyAudio, hotkeys, Docker GPU)
|
|
329
322
|
|
|
330
323
|
**Quand NE PAS m'invoquer** :
|
|
331
324
|
- Pour l'integration Claude Code sans voix (MCP, config) → preferer `@claude`
|
|
332
|
-
- Pour l'integration Copilot CLI sans voix → preferer `@marc`
|
|
333
325
|
|
|
@@ -61,20 +61,6 @@ You must fully embody this agent's persona and follow all activation instruction
|
|
|
61
61
|
|
|
62
62
|
<knowledge_base>
|
|
63
63
|
<platform_detection>
|
|
64
|
-
<platform id="copilot-cli">
|
|
65
|
-
<name>GitHub Copilot CLI</name>
|
|
66
|
-
<detect_command>which copilot</detect_command>
|
|
67
|
-
<detect_fallback>test -d ~/.config/copilot</detect_fallback>
|
|
68
|
-
<install_path>.github/agents/</install_path>
|
|
69
|
-
<agent_format>bmad-agent-{name}.md</agent_format>
|
|
70
|
-
<sdk_url>https://github.com/github/copilot-sdk</sdk_url>
|
|
71
|
-
<features>
|
|
72
|
-
• @workspace, @terminal commands
|
|
73
|
-
• Extensions support
|
|
74
|
-
• Native CLI integration
|
|
75
|
-
</features>
|
|
76
|
-
</platform>
|
|
77
|
-
|
|
78
64
|
<platform id="codex">
|
|
79
65
|
<name>OpenAI Codex</name>
|
|
80
66
|
<detect_command>test -d .codex</detect_command>
|
|
@@ -161,7 +147,6 @@ You must fully embody this agent's persona and follow all activation instruction
|
|
|
161
147
|
<capabilities>
|
|
162
148
|
<capability name="detect_platforms">
|
|
163
149
|
Scan system for installed AI platforms:
|
|
164
|
-
• Copilot CLI: which copilot || test -d ~/.config/copilot
|
|
165
150
|
• Codex: test -d .codex || test -f .codex/config.json
|
|
166
151
|
• Claude Code: which claude || test -d ~/.config/claude
|
|
167
152
|
|
|
@@ -188,7 +173,6 @@ You must fully embody this agent's persona and follow all activation instruction
|
|
|
188
173
|
|
|
189
174
|
<capability name="install_platform_agents">
|
|
190
175
|
Install agents for detected platforms:
|
|
191
|
-
• Copilot CLI → .github/agents/bmad-agent-*.md
|
|
192
176
|
• Codex → .codex/prompts/*.md
|
|
193
177
|
• Claude Code → .claude/agents/*.yaml
|
|
194
178
|
|
|
@@ -215,7 +199,7 @@ You must fully embody this agent's persona and follow all activation instruction
|
|
|
215
199
|
• Skip prompts
|
|
216
200
|
• Log progress clearly
|
|
217
201
|
|
|
218
|
-
Example:
|
|
202
|
+
Example: claude agent yanstaller "install"
|
|
219
203
|
</capability>
|
|
220
204
|
|
|
221
205
|
<capability name="validate_installation">
|
|
@@ -338,10 +322,6 @@ You must fully embody this agent's persona and follow all activation instruction
|
|
|
338
322
|
<after_installation>
|
|
339
323
|
Display platform-specific commands:
|
|
340
324
|
|
|
341
|
-
GitHub Copilot CLI:
|
|
342
|
-
• copilot --agent=bmad-agent-byan --prompt "help"
|
|
343
|
-
• copilot --agent=bmad-agent-yanstaller --prompt "validate"
|
|
344
|
-
|
|
345
325
|
Codex:
|
|
346
326
|
• codex prompt byan "help"
|
|
347
327
|
|
|
@@ -365,11 +345,10 @@ You must fully embody this agent's persona and follow all activation instruction
|
|
|
365
345
|
|
|
366
346
|
**Persona** : YANSTALLER — Multi-Platform BYAN Installer
|
|
367
347
|
**Frequence** : Guide accueillant et resilient — "Bienvenue.", "Etape confirmee. Suivante.", "On a un chemin de secours.", jamais "C'est complique", jamais "Debrouille-toi"
|
|
368
|
-
**Specialite** : Seul agent capable de detecter et cibler simultanement
|
|
348
|
+
**Specialite** : Seul agent capable de detecter et cibler simultanement Codex et Claude Code en une passe — detection automatique, installation zero-config, validation post-install sur les plateformes cibles
|
|
369
349
|
|
|
370
350
|
**Mes complementaires directs** :
|
|
371
351
|
- `@rachid` — en parallele : rachid publie le package npm, yanstaller execute l'install locale
|
|
372
|
-
- `@marc` — en aval pour les ajustements Copilot CLI apres l'install initiale
|
|
373
352
|
- `@turbo-whisper` — en aval pour la couche voix optionnelle apres l'install BYAN
|
|
374
353
|
- `@byan` — apres moi : une fois installe, l'utilisateur cree son premier agent avec byan
|
|
375
354
|
|
|
@@ -381,5 +360,4 @@ You must fully embody this agent's persona and follow all activation instruction
|
|
|
381
360
|
|
|
382
361
|
**Quand NE PAS m'invoquer** :
|
|
383
362
|
- Pour publier ou mettre a jour le package npm → preferer `@rachid`
|
|
384
|
-
- Pour reparer un stub Copilot CLI specifique → preferer `@marc`
|
|
385
363
|
- Pour creer un nouvel agent apres installation → preferer `@byan`
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { syncRules } from '../lib/sync-rules.js';
|
|
2
|
+
import { syncRules, syncAutobench } from '../lib/sync-rules.js';
|
|
3
3
|
|
|
4
4
|
// CLI wrapper for the byan-sync-rules generator.
|
|
5
5
|
// Usage: node bin/byan-sync-rules.js [--root <dir>] [--config <file>]
|
|
6
|
+
//
|
|
7
|
+
// One command regenerates BOTH generated rulesets: strict mode (syncRules) and
|
|
8
|
+
// auto-benchmark (syncAutobench). The --config override applies only to the
|
|
9
|
+
// strict source; the autobench source resolves from its own default path so the
|
|
10
|
+
// two generators stay independent.
|
|
6
11
|
|
|
7
12
|
function parseArgs(argv) {
|
|
8
13
|
const args = {};
|
|
@@ -13,10 +18,21 @@ function parseArgs(argv) {
|
|
|
13
18
|
return args;
|
|
14
19
|
}
|
|
15
20
|
|
|
21
|
+
function printReport(title, report) {
|
|
22
|
+
const lines = Object.entries(report).map(
|
|
23
|
+
([file, action]) => ` ${action.padEnd(9)} ${file}`
|
|
24
|
+
);
|
|
25
|
+
process.stdout.write(`${title}\n${lines.join('\n')}\n`);
|
|
26
|
+
}
|
|
27
|
+
|
|
16
28
|
try {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
29
|
+
const args = parseArgs(process.argv);
|
|
30
|
+
printReport('byan-sync-rules — strict mode artifacts', syncRules(args));
|
|
31
|
+
// Autobench resolves its own source; do not forward the strict --config.
|
|
32
|
+
printReport(
|
|
33
|
+
'byan-sync-rules — auto-benchmark artifacts',
|
|
34
|
+
syncAutobench({ projectRoot: args.projectRoot })
|
|
35
|
+
);
|
|
20
36
|
process.exit(0);
|
|
21
37
|
} catch (err) {
|
|
22
38
|
process.stderr.write(`byan-sync-rules failed: ${err.message}\n`);
|
|
@@ -81,3 +81,16 @@ export function validateForLog(input) {
|
|
|
81
81
|
? { kind: 'elo', domain: rec.domain, result: rec.result }
|
|
82
82
|
: { kind: 'suitability', model: rec.model, leafId: rec.leafId, success: rec.success };
|
|
83
83
|
}
|
|
84
|
+
|
|
85
|
+
// C3 — the ELO outcome line for a completed strict session. PURE (no I/O): a
|
|
86
|
+
// completed session that carried an EXPLICIT domain is a VALIDATED outcome.
|
|
87
|
+
// Returns the validated buffer line, or null when there is no domain (so abort
|
|
88
|
+
// and no-domain feed nothing). The caller (the byan_strict_complete handler)
|
|
89
|
+
// appends the returned line. The domain is the user's explicit lock_scope input,
|
|
90
|
+
// never inferred from text. Shared by the handler AND its test so the two cannot
|
|
91
|
+
// drift (no hand-copied replica).
|
|
92
|
+
export function eloOutcomeForStrictComplete(completeResult) {
|
|
93
|
+
const domain = completeResult && completeResult.domain;
|
|
94
|
+
if (!domain) return null;
|
|
95
|
+
return validateForLog({ kind: 'elo', domain, result: 'VALIDATED' });
|
|
96
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
//
|
|
3
3
|
// Produces _byan/INDEX.md — a human- and agent-readable map of the platform,
|
|
4
4
|
// derived from the machine-source manifests (_byan/_config/*-manifest.csv) plus
|
|
5
|
-
// a scan of the project zone (_byan/projet/*). Claude Code
|
|
5
|
+
// a scan of the project zone (_byan/projet/*). Claude Code and Codex
|
|
6
6
|
// read this instead of walking the whole file system.
|
|
7
7
|
//
|
|
8
8
|
// Manifest-driven by design: the index reflects whatever the manifests declare,
|
|
@@ -9,9 +9,12 @@
|
|
|
9
9
|
* Stand-up : _byan-output/party-mode-sessions/<session_id>/standup.jsonl
|
|
10
10
|
* entries : { agent, timestamp, did, blockers, next }
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* Wiring : the byan-orchestrate skill posts one stand-up per role at the
|
|
13
|
+
* aggregate step (byan_standup_post) and calls byan_standup_blocked to surface
|
|
14
|
+
* stuck roles. In the single-pass aggregate it uses minStreak:1 (one stand-up
|
|
15
|
+
* per role, so a 2-in-a-row streak is unreachable); a non-ok role's card is
|
|
16
|
+
* moved to the `blocked` column at the same step (byan_kanban_move). A
|
|
17
|
+
* longer-lived session that posts repeatedly uses the default minStreak:2.
|
|
15
18
|
*/
|
|
16
19
|
|
|
17
20
|
import fs from 'node:fs';
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
// Pure decision core for the FD -> Leantime auto-sync hook.
|
|
2
|
+
//
|
|
3
|
+
// WHY a separate pure module: a Claude Code hook is an I/O shell (stdin payload,
|
|
4
|
+
// network, disk) that is awkward to unit-test. The risky logic — which Leantime
|
|
5
|
+
// calls a phase transition implies, and the idempotence that stops duplicates —
|
|
6
|
+
// lives here with ZERO I/O, so every transition is testable as a data
|
|
7
|
+
// transform. The shell (.claude/hooks/leantime-fd-sync.js) feeds this the parsed
|
|
8
|
+
// fd-state + the sidecar map and executes the returned intents against
|
|
9
|
+
// lib/leantime-sync.js.
|
|
10
|
+
//
|
|
11
|
+
// State-coupling: this module reads fd-state echoed by the MCP tool; it does not
|
|
12
|
+
// read or write fd-state.json. The Leantime id mapping is the caller's sidecar.
|
|
13
|
+
|
|
14
|
+
// The two FD MCP tools whose result carries the post-transition fd-state.
|
|
15
|
+
export const FD_ADVANCE = 'byan_fd_advance';
|
|
16
|
+
export const FD_UPDATE = 'byan_fd_update';
|
|
17
|
+
|
|
18
|
+
// Recognize the FD tool regardless of the mcp__<server>__ prefix or snake/camel
|
|
19
|
+
// casing; the endsWith fallback keeps it working if the server key is renamed.
|
|
20
|
+
export function fdToolKind(toolName) {
|
|
21
|
+
if (typeof toolName !== 'string') return null;
|
|
22
|
+
if (toolName === FD_ADVANCE || toolName.endsWith(`__${FD_ADVANCE}`) || toolName.endsWith(FD_ADVANCE)) {
|
|
23
|
+
return 'advance';
|
|
24
|
+
}
|
|
25
|
+
if (toolName === FD_UPDATE || toolName.endsWith(`__${FD_UPDATE}`) || toolName.endsWith(FD_UPDATE)) {
|
|
26
|
+
return 'update';
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Parse the fd-state the MCP tool echoed. The byan_fd_* handlers return
|
|
32
|
+
// JSON.stringify(state); an MCP tool_response wraps it as
|
|
33
|
+
// { content: [{ type:'text', text:'<json>' }] }. Accept that envelope, a raw
|
|
34
|
+
// JSON string, or an already-parsed object. Returns the state object, or null
|
|
35
|
+
// when the shape is unrecognized (the shell then degrades to a file fallback).
|
|
36
|
+
export function parseFdState(toolResponse) {
|
|
37
|
+
if (!toolResponse) return null;
|
|
38
|
+
let candidate = toolResponse;
|
|
39
|
+
if (candidate && typeof candidate === 'object' && Array.isArray(candidate.content)) {
|
|
40
|
+
const textPart = candidate.content.find((p) => p && typeof p.text === 'string');
|
|
41
|
+
if (textPart) candidate = textPart.text;
|
|
42
|
+
}
|
|
43
|
+
if (typeof candidate === 'string') {
|
|
44
|
+
try {
|
|
45
|
+
candidate = JSON.parse(candidate);
|
|
46
|
+
} catch {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (candidate && typeof candidate === 'object' && typeof candidate.phase === 'string') {
|
|
51
|
+
return candidate;
|
|
52
|
+
}
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// FD phase order. Used to gate task creation to DISPATCH-onward (a feature's
|
|
57
|
+
// task carries its assigned specialist, set at DISPATCH) and to recognize
|
|
58
|
+
// terminal phases.
|
|
59
|
+
const PHASE_RANK = {
|
|
60
|
+
DISCOVERY: 0,
|
|
61
|
+
BRAINSTORM: 1,
|
|
62
|
+
PRUNE: 2,
|
|
63
|
+
DISPATCH: 3,
|
|
64
|
+
BUILD: 4,
|
|
65
|
+
REVIEW: 5,
|
|
66
|
+
VALIDATE: 6,
|
|
67
|
+
REFACTOR: 7,
|
|
68
|
+
DOC: 8,
|
|
69
|
+
COMPLETED: 9,
|
|
70
|
+
ABORTED: 9,
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
function lastReviewStatus(state) {
|
|
74
|
+
const arr = Array.isArray(state.review_findings) ? state.review_findings : [];
|
|
75
|
+
for (let i = arr.length - 1; i >= 0; i -= 1) {
|
|
76
|
+
if (arr[i] && typeof arr[i].status === 'string') return arr[i].status;
|
|
77
|
+
}
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// The board column the mapped tasks should reflect for the current fd-state.
|
|
82
|
+
// Board-wide (not per-feature): a BYAN FD builds its backlog together, and the
|
|
83
|
+
// per-item backlog status is agent-maintained and can lag a phase. Mirrors the
|
|
84
|
+
// SKILL section 2.5 fire points. Returns a column name or null (no move).
|
|
85
|
+
export function columnForState(state) {
|
|
86
|
+
switch (state.phase) {
|
|
87
|
+
case 'ABORTED':
|
|
88
|
+
return null; // leave the board verbatim: the diagnostic of where it died
|
|
89
|
+
case 'COMPLETED':
|
|
90
|
+
return 'done';
|
|
91
|
+
case 'DOC':
|
|
92
|
+
return 'review'; // validated, awaiting the COMPLETED sweep to done
|
|
93
|
+
case 'BUILD':
|
|
94
|
+
return 'doing';
|
|
95
|
+
case 'REFACTOR':
|
|
96
|
+
return 'blocked';
|
|
97
|
+
case 'VALIDATE': {
|
|
98
|
+
const v = state.validate_verdict;
|
|
99
|
+
if (v && v.status === 'KO') return 'blocked';
|
|
100
|
+
if (v && v.status === 'OK') return 'review';
|
|
101
|
+
return 'doing';
|
|
102
|
+
}
|
|
103
|
+
case 'REVIEW': {
|
|
104
|
+
const last = lastReviewStatus(state);
|
|
105
|
+
if (last === 'needs-rework') return 'blocked';
|
|
106
|
+
if (last === 'ready-for-validate') return 'review';
|
|
107
|
+
return 'doing';
|
|
108
|
+
}
|
|
109
|
+
default:
|
|
110
|
+
// DISCOVERY, BRAINSTORM, PRUNE, DISPATCH
|
|
111
|
+
return 'todo';
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Decide the ordered Leantime intents for one hook fire. Reconcile-from-state:
|
|
116
|
+
// each fire (re)ensures the project exists, ensures every backlog task exists
|
|
117
|
+
// (DISPATCH onward), and drives all mapped tasks to the column the current
|
|
118
|
+
// fd-state implies. Idempotence is the sidecar's job — project_ensure/task_create
|
|
119
|
+
// are emitted only when the id is absent, so a dropped call last fire is retried
|
|
120
|
+
// and a duplicate is not created.
|
|
121
|
+
//
|
|
122
|
+
// args: { toolName, state, sidecar, assignUserConfigured }
|
|
123
|
+
// sidecar: { projectId?, tasks?: { <backlogId>: taskId } } for THIS fd_id
|
|
124
|
+
// returns: { skip?: reason, intents: [...] }
|
|
125
|
+
//
|
|
126
|
+
// Intent ops (the shell maps each to a leantime-sync call):
|
|
127
|
+
// { op:'project_ensure', name, slug, details }
|
|
128
|
+
// { op:'assign_user' } // only if configured (shell sequences it after project_ensure)
|
|
129
|
+
// { op:'task_create', backlogId, headline }
|
|
130
|
+
// { op:'task_move', backlogId, column }
|
|
131
|
+
export function decideActions({ toolName, state, sidecar = {}, assignUserConfigured = false } = {}) {
|
|
132
|
+
const kind = fdToolKind(toolName);
|
|
133
|
+
if (!kind) return { skip: 'not-fd-tool', intents: [] };
|
|
134
|
+
if (!state || typeof state.phase !== 'string') return { skip: 'no-state', intents: [] };
|
|
135
|
+
|
|
136
|
+
const projectName =
|
|
137
|
+
(state.project_context && state.project_context.name) || state.feature_name || null;
|
|
138
|
+
if (!projectName) return { skip: 'no-project-name', intents: [] };
|
|
139
|
+
|
|
140
|
+
const intents = [];
|
|
141
|
+
const tasks = sidecar.tasks || {};
|
|
142
|
+
|
|
143
|
+
// 1. Ensure the project. Emitted only when the sidecar has no projectId yet.
|
|
144
|
+
if (!sidecar.projectId) {
|
|
145
|
+
intents.push({
|
|
146
|
+
op: 'project_ensure',
|
|
147
|
+
name: projectName,
|
|
148
|
+
slug: (state.project_context && state.project_context.slug) || undefined,
|
|
149
|
+
details: `BYAN FD ${state.fd_id || ''} — auto-synced board.`.trim(),
|
|
150
|
+
});
|
|
151
|
+
if (assignUserConfigured) intents.push({ op: 'assign_user' });
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const rank = PHASE_RANK[state.phase] ?? 0;
|
|
155
|
+
const backlog = Array.isArray(state.backlog) ? state.backlog : [];
|
|
156
|
+
|
|
157
|
+
// 2. Create a task per backlog item once the FD has reached DISPATCH (the task
|
|
158
|
+
// then carries the dispatched specialist). Skipped items are not created.
|
|
159
|
+
if (rank >= PHASE_RANK.DISPATCH && state.phase !== 'ABORTED') {
|
|
160
|
+
for (const item of backlog) {
|
|
161
|
+
if (!item || !item.id) continue;
|
|
162
|
+
if (item.status === 'skipped') continue;
|
|
163
|
+
if (!tasks[item.id]) {
|
|
164
|
+
intents.push({ op: 'task_create', backlogId: item.id, headline: item.title || item.id });
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// 3. Move every task (already-mapped + just-created) to the column the current
|
|
170
|
+
// state implies. ABORTED yields no column -> no move. To bound RPC volume
|
|
171
|
+
// (byan_fd_update fires several times per phase), moves are emitted only when
|
|
172
|
+
// the target column changed since the last applied fire (sidecar.lastColumn),
|
|
173
|
+
// OR a task was just created, OR the prior fire left a move unsynced
|
|
174
|
+
// (sidecar.moveFailed) so a dropped move self-heals on the next event.
|
|
175
|
+
const column = columnForState(state);
|
|
176
|
+
const createdThisFire = intents.some((i) => i.op === 'task_create');
|
|
177
|
+
const moveNeeded = column && (column !== sidecar.lastColumn || createdThisFire || sidecar.moveFailed === true);
|
|
178
|
+
if (moveNeeded) {
|
|
179
|
+
const seen = new Set();
|
|
180
|
+
for (const item of backlog) {
|
|
181
|
+
if (!item || !item.id || item.status === 'skipped') continue;
|
|
182
|
+
// a just-created task is moved in the same fire; an already-mapped one is
|
|
183
|
+
// reconciled to the current column (self-heals a dropped earlier move).
|
|
184
|
+
const willExist = tasks[item.id] || intents.some((i) => i.op === 'task_create' && i.backlogId === item.id);
|
|
185
|
+
if (willExist && !seen.has(item.id)) {
|
|
186
|
+
intents.push({ op: 'task_move', backlogId: item.id, column });
|
|
187
|
+
seen.add(item.id);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
// tasks in the sidecar that are no longer in the backlog still get swept to a
|
|
191
|
+
// terminal column on COMPLETED, so the board does not strand a renamed item.
|
|
192
|
+
if (state.phase === 'COMPLETED') {
|
|
193
|
+
for (const backlogId of Object.keys(tasks)) {
|
|
194
|
+
if (!seen.has(backlogId)) {
|
|
195
|
+
intents.push({ op: 'task_move', backlogId, column });
|
|
196
|
+
seen.add(backlogId);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// `column` is the current target; the shell persists it as sidecar.lastColumn so
|
|
203
|
+
// the next fire can skip a redundant move sweep.
|
|
204
|
+
return { intents, column };
|
|
205
|
+
}
|