development-companion 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -0
- package/RELEASE.md +23 -8
- package/adapters/opencode/README.md +94 -28
- package/core/roles/README.md +2 -1
- package/core/roles/orchestrator.md +1 -1
- package/core/roles/team-lead.md +37 -12
- package/package.json +1 -1
- package/src/cli.mjs +43 -0
- package/src/install.mjs +113 -7
- package/templates/rules/AGENTS.block.md +5 -0
package/README.md
CHANGED
|
@@ -128,6 +128,21 @@ Read `core/process.md` for the full phase guide.
|
|
|
128
128
|
Role contracts live in `core/roles/`. The CLI installs them to `.companion/roles/` and
|
|
129
129
|
generates native bindings where the harness supports subagents.
|
|
130
130
|
|
|
131
|
+
### Orchestration in OpenCode
|
|
132
|
+
|
|
133
|
+
`devcomp init` installs `team-lead` with `mode: primary` and writes
|
|
134
|
+
`.opencode/opencode.json` with `default_agent: "team-lead"`. The 11 specialists are
|
|
135
|
+
subagents. New sessions start as the team lead, which delegates with the `subagent` tool;
|
|
136
|
+
Build and Plan remain available in the agent selector. If the project already has an
|
|
137
|
+
OpenCode config, the installer preserves it and `devcomp doctor` warns that
|
|
138
|
+
`default_agent` is not set.
|
|
139
|
+
|
|
140
|
+
The team lead is a router, not an implementer. Its generated binding denies `edit` outside
|
|
141
|
+
`.companion/local/**` and `docs/companion/**`, and denies `shell`; it must launch a
|
|
142
|
+
specialist for code, commands, tests, security, UX, or deployment. Specialists deny the
|
|
143
|
+
`subagent` permission, so only the team lead orchestrates. Existing sessions keep their
|
|
144
|
+
previous agent; start a new session to pick up `team-lead`.
|
|
145
|
+
|
|
131
146
|
## Skills and profiles
|
|
132
147
|
|
|
133
148
|
Process skills are installed always:
|
package/RELEASE.md
CHANGED
|
@@ -43,7 +43,7 @@ npm pack --pack-destination "$packdir"
|
|
|
43
43
|
app=$(mktemp -d)
|
|
44
44
|
cd "$app"
|
|
45
45
|
npm init -y
|
|
46
|
-
npm install "$packdir"/development-companion-1.
|
|
46
|
+
npm install "$packdir"/development-companion-1.2.0.tgz
|
|
47
47
|
./node_modules/.bin/devcomp --version
|
|
48
48
|
./node_modules/.bin/devcomp init . --yes --harness opencode --profile web
|
|
49
49
|
./node_modules/.bin/devcomp doctor .
|
|
@@ -57,16 +57,31 @@ All checks must pass before publishing.
|
|
|
57
57
|
npm publish --access public
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
If npm asks for a one-time password, enter it from the authenticator.
|
|
61
|
-
|
|
60
|
+
If npm asks for a one-time password, enter it from the authenticator. If 2FA uses a
|
|
61
|
+
passkey or security key, npm prints an authentication URL and opens the browser; approve
|
|
62
|
+
with the passkey. Do not paste secrets into a file, shell history, or chat.
|
|
63
|
+
|
|
64
|
+
### First publish and the `0.0.0-stage` placeholder
|
|
65
|
+
|
|
66
|
+
When a package does not exist yet, npm may create a temporary `0.0.0-stage` placeholder
|
|
67
|
+
while the real version is being processed. This is expected. Do not bump the version or
|
|
68
|
+
republish immediately. Wait a few minutes and verify:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npm view development-companion version dist-tags
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The `latest` tag must point to `1.2.0`, not `0.0.0-stage`. If it still points to the
|
|
75
|
+
placeholder after several minutes, check the npmjs.com package page and the Staged
|
|
76
|
+
Packages tab before retrying.
|
|
62
77
|
|
|
63
78
|
## 5. Verify the published package
|
|
64
79
|
|
|
65
80
|
```bash
|
|
66
81
|
cd "$(mktemp -d)"
|
|
67
|
-
npx development-companion@1.
|
|
68
|
-
npx development-companion@1.
|
|
69
|
-
npx development-companion@1.
|
|
82
|
+
npx development-companion@1.2.0 --version
|
|
83
|
+
npx development-companion@1.2.0 init . --yes --harness opencode --profile web
|
|
84
|
+
npx development-companion@1.2.0 doctor .
|
|
70
85
|
```
|
|
71
86
|
|
|
72
87
|
Also verify the package page:
|
|
@@ -78,14 +93,14 @@ https://www.npmjs.com/package/development-companion
|
|
|
78
93
|
## 6. Tag and publish the source release
|
|
79
94
|
|
|
80
95
|
```bash
|
|
81
|
-
git tag -a v1.
|
|
96
|
+
git tag -a v1.2.0 -m "v1.2.0"
|
|
82
97
|
git push origin main --tags
|
|
83
98
|
```
|
|
84
99
|
|
|
85
100
|
Create the release on Codeberg:
|
|
86
101
|
|
|
87
102
|
```text
|
|
88
|
-
https://codeberg.org/rockmadehome/development-companion/releases/new?tag=v1.
|
|
103
|
+
https://codeberg.org/rockmadehome/development-companion/releases/new?tag=v1.2.0
|
|
89
104
|
```
|
|
90
105
|
|
|
91
106
|
Include the install command, the supported harness tiers, and the breaking changes from
|
|
@@ -33,57 +33,123 @@ ln -s /path/to/development-companion/skills/code-review .agents/skills/code-revi
|
|
|
33
33
|
|
|
34
34
|
Verify with the `skill` tool or ask OpenCode to list available skills.
|
|
35
35
|
|
|
36
|
-
##
|
|
36
|
+
## Agents
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
agent name. Required frontmatter: `description`. Use `mode: subagent` for specialists.
|
|
38
|
+
`devcomp init` writes one Markdown agent per role in `.opencode/agents/`:
|
|
40
39
|
|
|
41
|
-
|
|
40
|
+
- `team-lead.md` — `mode: primary`, so it appears in the OpenCode agent selector.
|
|
41
|
+
- The 11 specialists — `mode: subagent`, launched by the team lead through the
|
|
42
|
+
`subagent` tool.
|
|
43
|
+
|
|
44
|
+
It also creates `.opencode/opencode.json` with:
|
|
45
|
+
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"$schema": "https://opencode.ai/config.json",
|
|
49
|
+
"default_agent": "team-lead"
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
New sessions start as `team-lead`; Build and Plan remain available in the selector. If the
|
|
54
|
+
project already has `.opencode/opencode.json` or `.opencode/opencode.jsonc`, the installer
|
|
55
|
+
preserves it and `devcomp doctor` warns that `default_agent` is not set.
|
|
56
|
+
|
|
57
|
+
OpenCode does not route by intent by itself. The generated team-lead prompt **mandates**
|
|
58
|
+
delegation with the `subagent` tool, and its permissions **deny `edit` and `shell`** outside
|
|
59
|
+
`.companion/local/**` and `docs/companion/**`. The team lead therefore cannot implement code
|
|
60
|
+
or run commands itself; it must launch the specialists. Specialists deny `subagent`, so only
|
|
61
|
+
the team lead orchestrates.
|
|
62
|
+
|
|
63
|
+
For deterministic routing beyond prompt and permissions, an OpenCode plugin would be needed,
|
|
64
|
+
but the generated binding is designed so the model has no direct path to do the work.
|
|
65
|
+
|
|
66
|
+
## Specialist example
|
|
42
67
|
|
|
43
68
|
```markdown
|
|
44
69
|
---
|
|
45
70
|
description: Reviews diffs for correctness, security, data risks, and missing tests. Use before merging or when the user asks for a code review.
|
|
46
71
|
mode: subagent
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"
|
|
53
|
-
|
|
72
|
+
permissions:
|
|
73
|
+
- action: edit
|
|
74
|
+
resource: "*"
|
|
75
|
+
effect: deny
|
|
76
|
+
- action: shell
|
|
77
|
+
resource: "*"
|
|
78
|
+
effect: ask
|
|
79
|
+
- action: shell
|
|
80
|
+
resource: "git diff *"
|
|
81
|
+
effect: allow
|
|
82
|
+
- action: shell
|
|
83
|
+
resource: "git log *"
|
|
84
|
+
effect: allow
|
|
85
|
+
- action: shell
|
|
86
|
+
resource: "git status *"
|
|
87
|
+
effect: allow
|
|
54
88
|
---
|
|
55
89
|
|
|
56
90
|
You are the Development Companion QA engineer.
|
|
57
91
|
|
|
58
|
-
Load and follow the `code-review` skill. Also follow
|
|
59
|
-
is available in the workspace. Report findings by severity with file and line
|
|
92
|
+
Load and follow the `code-review` skill. Also follow `.companion/roles/qa-engineer.md` when
|
|
93
|
+
it is available in the workspace. Report findings by severity with file and line
|
|
60
94
|
references. Do not edit files. Do not approve without evidence.
|
|
61
95
|
```
|
|
62
96
|
|
|
63
|
-
|
|
64
|
-
`
|
|
65
|
-
|
|
97
|
+
OpenCode V2 uses **`permissions`** (plural), an ordered list of
|
|
98
|
+
`action` / `resource` / `effect` rules. The legacy OpenCode V1 shape (`permission`,
|
|
99
|
+
`permission.task`, boolean maps) is not used in new bindings.
|
|
100
|
+
|
|
101
|
+
## Team lead example
|
|
102
|
+
|
|
103
|
+
The generated binding is a router, not an implementer:
|
|
66
104
|
|
|
67
105
|
```yaml
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
"
|
|
74
|
-
|
|
106
|
+
---
|
|
107
|
+
description: Leads discovery, planning, delegation, and closure.
|
|
108
|
+
mode: primary
|
|
109
|
+
permissions:
|
|
110
|
+
- action: edit
|
|
111
|
+
resource: "*"
|
|
112
|
+
effect: deny
|
|
113
|
+
- action: edit
|
|
114
|
+
resource: ".companion/local/**"
|
|
115
|
+
effect: allow
|
|
116
|
+
- action: edit
|
|
117
|
+
resource: "**/.companion/local/**"
|
|
118
|
+
effect: allow
|
|
119
|
+
- action: edit
|
|
120
|
+
resource: "docs/companion/**"
|
|
121
|
+
effect: allow
|
|
122
|
+
- action: edit
|
|
123
|
+
resource: "**/docs/companion/**"
|
|
124
|
+
effect: allow
|
|
125
|
+
- action: shell
|
|
126
|
+
resource: "*"
|
|
127
|
+
effect: deny
|
|
128
|
+
- action: subagent
|
|
129
|
+
resource: "*"
|
|
130
|
+
effect: allow
|
|
131
|
+
---
|
|
75
132
|
```
|
|
76
133
|
|
|
77
|
-
|
|
134
|
+
The last matching rule wins. The team lead can read, write its own plan/closure documents,
|
|
135
|
+
and launch any specialist, but it cannot edit code or run shell commands. Specialists get
|
|
136
|
+
`{ "action": "subagent", "resource": "*", "effect": "deny" }` so they cannot spawn more
|
|
137
|
+
agents.
|
|
138
|
+
|
|
139
|
+
To restrict which specialists the team lead may launch, replace `"*"` with explicit
|
|
140
|
+
`resource` entries such as `architect`, `qa-engineer`, or `mobile-engineer`.
|
|
78
141
|
|
|
79
142
|
## Limitations
|
|
80
143
|
|
|
81
144
|
- OpenCode subagents use Markdown frontmatter, not the canonical role format. Keep the
|
|
82
145
|
binding thin and put durable policy in `core/`.
|
|
83
|
-
-
|
|
84
|
-
|
|
146
|
+
- The team lead starts with fresh context in a new session. It reads
|
|
147
|
+
`.companion/local/` and the repository; it does not inherit the previous chat. Existing
|
|
148
|
+
sessions keep their previous agent; start a new session to pick up `team-lead`.
|
|
149
|
+
- Permissions are enforced by the harness; the generated binding blocks direct code edits
|
|
150
|
+
and shell commands from the team lead.
|
|
85
151
|
|
|
86
152
|
## References
|
|
87
153
|
|
|
88
|
-
- Skills: <https://opencode.ai/docs/skills
|
|
89
|
-
- Agents: <https://opencode.ai/docs/agents
|
|
154
|
+
- Skills: <https://opencode.ai/v2/docs/skills>
|
|
155
|
+
- Agents: <https://opencode.ai/v2/docs/agents>
|
package/core/roles/README.md
CHANGED
|
@@ -42,7 +42,8 @@ The files remain for v0.1 compatibility but are not installed by `devcomp init`.
|
|
|
42
42
|
|
|
43
43
|
- A role is not a personality. It is a bounded responsibility with explicit outputs.
|
|
44
44
|
- The Team Lead routes; specialists do the deep work; QA and Cybersecurity verify.
|
|
45
|
-
- Every role follows
|
|
45
|
+
- Every role follows the installed skills and the process. In this repository, the
|
|
46
|
+
canonical source docs are `core/principles.md`, `core/process.md`, and
|
|
46
47
|
`core/quality-gates.md`.
|
|
47
48
|
- If a role needs new policy, add it to the canonical layer first. Do not fork the
|
|
48
49
|
role in an adapter.
|
package/core/roles/team-lead.md
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
## Mission
|
|
6
6
|
|
|
7
|
-
Own the process from request to verified closure.
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
Own the process from request to verified closure. The user talks only to you. You frame
|
|
8
|
+
the work, route it to specialists, enforce the gates, and report with evidence. You are a
|
|
9
|
+
router and reviewer, not an implementer.
|
|
10
10
|
|
|
11
11
|
## Use when
|
|
12
12
|
|
|
@@ -29,25 +29,47 @@ Do not use for a one-file fix or a routine review; handle those directly.
|
|
|
29
29
|
- `.companion/local/01-operational-brief.md`
|
|
30
30
|
- `.companion/local/06-delivery-plan.md`
|
|
31
31
|
- `.companion/local/10-closure.md`
|
|
32
|
-
- A
|
|
32
|
+
- A verified completion report with evidence from the specialists.
|
|
33
33
|
|
|
34
34
|
## Operating checklist
|
|
35
35
|
|
|
36
36
|
1. **Discover** — ask the operational questions first; confirm scope, success, hosting,
|
|
37
37
|
third parties, data, auth, platforms, branch convention, and definition of done.
|
|
38
38
|
2. **Frame** — state goal, non-goals, acceptance criteria, and constraints.
|
|
39
|
-
3. **Route** —
|
|
40
|
-
|
|
39
|
+
3. **Route** — choose the specialist for each deliverable and launch it with `subagent`.
|
|
40
|
+
Launch independent specialists in parallel; serialize dependencies.
|
|
41
41
|
4. **Plan** — decompose into deliverables with owners, dependencies, and gates.
|
|
42
42
|
5. **Delegate** — give each specialist a bounded deliverable, context, and evidence
|
|
43
43
|
requirement.
|
|
44
|
-
6. **
|
|
45
|
-
|
|
44
|
+
6. **Verify** — read the evidence, not the summary. If a child returns without proof, send
|
|
45
|
+
it back with a bounded follow-up.
|
|
46
|
+
7. **Integrate** — resolve conflicts, prevent duplicate edits, keep the diff coherent.
|
|
46
47
|
8. **Close** — summarize delivered, verified, residual risks, and next steps.
|
|
47
48
|
|
|
49
|
+
## Routing
|
|
50
|
+
|
|
51
|
+
| Work | Subagent |
|
|
52
|
+
|---|---|
|
|
53
|
+
| Architecture, boundaries, ADRs | `architect` |
|
|
54
|
+
| Threat model, security review, pentest | `cybersecurity-engineer` |
|
|
55
|
+
| Test strategy, QA, load, accessibility verification | `qa-engineer` |
|
|
56
|
+
| UX, UI, web frontend | `frontend-engineer` |
|
|
57
|
+
| API, data, auth, backend | `backend-engineer` |
|
|
58
|
+
| iOS/Android | `mobile-engineer` |
|
|
59
|
+
| Native Windows | `desktop-windows-engineer` |
|
|
60
|
+
| Native macOS | `desktop-macos-engineer` |
|
|
61
|
+
| Native Linux | `desktop-linux-engineer` |
|
|
62
|
+
| Cross-platform core | `multiplatform-engineer` |
|
|
63
|
+
| Deploy, observability, secrets | `sre-engineer` |
|
|
64
|
+
| No specialist fits | `general` or `explore`, or ask the user |
|
|
65
|
+
|
|
48
66
|
## Boundaries
|
|
49
67
|
|
|
50
|
-
- Do not design the architecture, implement features, or run
|
|
68
|
+
- Do not design the architecture, implement features, run tests, or run shell commands.
|
|
69
|
+
- Do not edit code. Your only writable paths are `.companion/local/**` and
|
|
70
|
+
`docs/companion/**`.
|
|
71
|
+
- Do not claim a delegation you did not perform. A delegation is real only if the
|
|
72
|
+
`subagent` tool was called.
|
|
51
73
|
- Do not start implementation before discovery and architecture are accepted.
|
|
52
74
|
- Do not expand scope silently; surface the trade-off.
|
|
53
75
|
- Do not accept a high-risk change without independent security and QA verification.
|
|
@@ -55,13 +77,16 @@ Do not use for a one-file fix or a routine review; handle those directly.
|
|
|
55
77
|
|
|
56
78
|
## Handoff
|
|
57
79
|
|
|
80
|
+
Use the `subagent` tool with:
|
|
81
|
+
|
|
58
82
|
```markdown
|
|
59
83
|
**Role:** architect | cybersecurity | qa | frontend | backend | mobile | platform | sre
|
|
60
84
|
**Goal:** ...
|
|
61
85
|
**Context:** files, decisions, constraints
|
|
62
86
|
**Deliverable:** ...
|
|
63
|
-
**Verification:**
|
|
64
|
-
**Do not:**
|
|
87
|
+
**Verification:** what evidence to return
|
|
88
|
+
**Do not:** out-of-scope work, files to avoid
|
|
65
89
|
```
|
|
66
90
|
|
|
67
|
-
|
|
91
|
+
After the child returns, verify the evidence and either accept it or send a follow-up.
|
|
92
|
+
Close with the completion format in the `development-workflow` skill.
|
package/package.json
CHANGED
package/src/cli.mjs
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
readManifest,
|
|
15
15
|
readTemplate,
|
|
16
16
|
writeManifest,
|
|
17
|
+
writeOpenCodeConfig,
|
|
17
18
|
writeText
|
|
18
19
|
} from "./install.mjs";
|
|
19
20
|
import {
|
|
@@ -235,6 +236,7 @@ async function cmdInit(args) {
|
|
|
235
236
|
const skillResults = installSkills({ target: requested, adapter, skills, mode, force });
|
|
236
237
|
const roleResults = installRoles({ target: requested, roles, force });
|
|
237
238
|
const bindingResults = installBindings({ target: requested, adapter, roles, force });
|
|
239
|
+
const openCodeConfig = adapter.name === "opencode" ? writeOpenCodeConfig(requested) : null;
|
|
238
240
|
const ignore = ensureGitignore(requested, [".companion/local/"]);
|
|
239
241
|
|
|
240
242
|
const manifest = {
|
|
@@ -270,6 +272,9 @@ async function cmdInit(args) {
|
|
|
270
272
|
if (bindingResults.length) {
|
|
271
273
|
console.log(` Bindings: ${bindingResults.filter((r) => r.status === "installed").length} installed`);
|
|
272
274
|
}
|
|
275
|
+
if (openCodeConfig) {
|
|
276
|
+
console.log(` OpenCode config: ${openCodeConfig.status} (${openCodeConfig.path})`);
|
|
277
|
+
}
|
|
273
278
|
if (ignore.changed) console.log(` .gitignore: added ${ignore.added.join(", ")}`);
|
|
274
279
|
console.log("");
|
|
275
280
|
console.log("Next: run `devcomp doctor` and start with the `project-discovery` skill.");
|
|
@@ -352,6 +357,40 @@ async function cmdDoctor(args) {
|
|
|
352
357
|
);
|
|
353
358
|
add("roles", missingRoles.length ? "fail" : "pass", missingRoles.length ? `missing: ${missingRoles.join(", ")}` : `${manifest.roles.length} present`);
|
|
354
359
|
|
|
360
|
+
if (manifest.harness === "opencode") {
|
|
361
|
+
const teamLeadPath = join(target, ".opencode", "agents", "team-lead.md");
|
|
362
|
+
if (!existsSync(teamLeadPath)) {
|
|
363
|
+
add("orchestrator", "fail", "team-lead binding missing");
|
|
364
|
+
} else {
|
|
365
|
+
const content = readFileSync(teamLeadPath, "utf8");
|
|
366
|
+
const primary = /^mode:\s*primary\s*$/m.test(content);
|
|
367
|
+
add(
|
|
368
|
+
"orchestrator",
|
|
369
|
+
primary ? "pass" : "warn",
|
|
370
|
+
primary
|
|
371
|
+
? "team-lead is a primary agent"
|
|
372
|
+
: "team-lead is not primary; run `devcomp update --force` to enable orchestration"
|
|
373
|
+
);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
const configPath = join(target, ".opencode", "opencode.json");
|
|
377
|
+
let defaultAgent = null;
|
|
378
|
+
if (existsSync(configPath)) {
|
|
379
|
+
try {
|
|
380
|
+
defaultAgent = JSON.parse(readFileSync(configPath, "utf8")).default_agent;
|
|
381
|
+
} catch {
|
|
382
|
+
defaultAgent = null;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
add(
|
|
386
|
+
"default agent",
|
|
387
|
+
defaultAgent === "team-lead" ? "pass" : "warn",
|
|
388
|
+
defaultAgent
|
|
389
|
+
? `default_agent=${defaultAgent}`
|
|
390
|
+
: "not set; add default_agent=team-lead to start sessions as the orchestrator"
|
|
391
|
+
);
|
|
392
|
+
}
|
|
393
|
+
|
|
355
394
|
const agentsPath = join(target, "AGENTS.md");
|
|
356
395
|
if (!existsSync(agentsPath)) {
|
|
357
396
|
add("AGENTS.md", "fail", "missing");
|
|
@@ -420,12 +459,16 @@ async function cmdUpdate(args) {
|
|
|
420
459
|
const skillResults = installSkills({ target, adapter, skills, force });
|
|
421
460
|
const roleResults = installRoles({ target, roles, force });
|
|
422
461
|
installBindings({ target, adapter, roles, force });
|
|
462
|
+
const openCodeConfig = adapter.name === "opencode" ? writeOpenCodeConfig(target) : null;
|
|
423
463
|
manifest.packageVersion = VERSION;
|
|
424
464
|
manifest.contentVersion = VERSION;
|
|
425
465
|
writeManifest(target, manifest);
|
|
426
466
|
console.log(`Updated to ${VERSION}.`);
|
|
427
467
|
console.log(` Skills: ${skillResults.filter((r) => r.status === "kept").length} kept, ${skillResults.filter((r) => r.status === "installed").length} added`);
|
|
428
468
|
console.log(` Roles: ${roleResults.filter((r) => r.status === "kept").length} kept, ${roleResults.filter((r) => r.status === "installed").length} added`);
|
|
469
|
+
if (openCodeConfig) {
|
|
470
|
+
console.log(` OpenCode config: ${openCodeConfig.status} (${openCodeConfig.path})`);
|
|
471
|
+
}
|
|
429
472
|
console.log(" Existing files are preserved; use --force to overwrite.");
|
|
430
473
|
}
|
|
431
474
|
|
package/src/install.mjs
CHANGED
|
@@ -117,14 +117,91 @@ function bindingBody(role) {
|
|
|
117
117
|
return `Read \`.companion/roles/${role}.md\` and follow it. Load the skills it references from \`.agents/skills/\` or \`.claude/skills/\`. Report evidence, not claims.`;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
function
|
|
121
|
-
return
|
|
122
|
-
description: ${ROLE_DESCRIPTIONS[role] ?? role}
|
|
123
|
-
mode: subagent
|
|
124
|
-
---
|
|
120
|
+
function openCodeLeadBody() {
|
|
121
|
+
return `You are the primary orchestrator for this OpenCode session. The user talks only to you.
|
|
125
122
|
|
|
126
|
-
|
|
127
|
-
|
|
123
|
+
## Mandatory routing
|
|
124
|
+
|
|
125
|
+
- You do not implement, edit code, run shell commands, or produce specialist artifacts.
|
|
126
|
+
- Your only writable paths are \`.companion/local/**\` and \`docs/companion/**\`.
|
|
127
|
+
- Every non-trivial request MUST be delegated with the \`subagent\` tool.
|
|
128
|
+
- A delegation is real only if you call \`subagent\`. Never claim a delegation you did not perform.
|
|
129
|
+
- Launch independent specialists in parallel; serialize only when one depends on another.
|
|
130
|
+
- Only you speak to the user. Specialists report to you; verify their evidence before accepting it.
|
|
131
|
+
- If a child returns without evidence, send it back with a bounded follow-up.
|
|
132
|
+
|
|
133
|
+
## Routing
|
|
134
|
+
|
|
135
|
+
| Work | Subagent |
|
|
136
|
+
|---|---|
|
|
137
|
+
| Architecture, boundaries, ADRs | architect |
|
|
138
|
+
| Threat model, security review, pentest | cybersecurity-engineer |
|
|
139
|
+
| Test strategy, QA, load, accessibility verification | qa-engineer |
|
|
140
|
+
| UX, UI, web frontend | frontend-engineer |
|
|
141
|
+
| API, data, auth, backend | backend-engineer |
|
|
142
|
+
| iOS/Android | mobile-engineer |
|
|
143
|
+
| Native Windows | desktop-windows-engineer |
|
|
144
|
+
| Native macOS | desktop-macos-engineer |
|
|
145
|
+
| Native Linux | desktop-linux-engineer |
|
|
146
|
+
| Cross-platform core | multiplatform-engineer |
|
|
147
|
+
| Deploy, observability, secrets | sre-engineer |
|
|
148
|
+
| No specialist fits | general or explore, or ask the user |
|
|
149
|
+
|
|
150
|
+
## Flow
|
|
151
|
+
|
|
152
|
+
1. Read the request and \`.companion/roles/team-lead.md\`.
|
|
153
|
+
2. Decide the route and the bounded deliverable.
|
|
154
|
+
3. Call \`subagent\` with goal, context, deliverable, verification, and do-not.
|
|
155
|
+
4. Review the child's evidence; ask for fixes if needed.
|
|
156
|
+
5. Write only your own plan/closure documents under \`.companion/local/\`.
|
|
157
|
+
6. Report to the user with evidence.
|
|
158
|
+
|
|
159
|
+
A trivial one-line answer may be answered directly. Anything that changes the repository or produces an artifact must be delegated.`;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function openCodeBinding(role) {
|
|
163
|
+
const isLead = role === "team-lead";
|
|
164
|
+
const mode = isLead ? "primary" : "subagent";
|
|
165
|
+
const body = isLead ? openCodeLeadBody() : bindingBody(role);
|
|
166
|
+
const permissions = isLead
|
|
167
|
+
? [
|
|
168
|
+
"permissions:",
|
|
169
|
+
" - action: edit",
|
|
170
|
+
' resource: "*"',
|
|
171
|
+
" effect: deny",
|
|
172
|
+
" - action: edit",
|
|
173
|
+
' resource: ".companion/local/**"',
|
|
174
|
+
" effect: allow",
|
|
175
|
+
" - action: edit",
|
|
176
|
+
' resource: "**/.companion/local/**"',
|
|
177
|
+
" effect: allow",
|
|
178
|
+
" - action: edit",
|
|
179
|
+
' resource: "docs/companion/**"',
|
|
180
|
+
" effect: allow",
|
|
181
|
+
" - action: edit",
|
|
182
|
+
' resource: "**/docs/companion/**"',
|
|
183
|
+
" effect: allow",
|
|
184
|
+
" - action: shell",
|
|
185
|
+
' resource: "*"',
|
|
186
|
+
" effect: deny",
|
|
187
|
+
" - action: subagent",
|
|
188
|
+
' resource: "*"',
|
|
189
|
+
" effect: allow"
|
|
190
|
+
]
|
|
191
|
+
: [
|
|
192
|
+
"permissions:",
|
|
193
|
+
" - action: subagent",
|
|
194
|
+
' resource: "*"',
|
|
195
|
+
" effect: deny"
|
|
196
|
+
];
|
|
197
|
+
const frontmatter = [
|
|
198
|
+
"---",
|
|
199
|
+
`description: ${ROLE_DESCRIPTIONS[role] ?? role}`,
|
|
200
|
+
`mode: ${mode}`,
|
|
201
|
+
...permissions,
|
|
202
|
+
"---"
|
|
203
|
+
].join("\n");
|
|
204
|
+
return `${frontmatter}\n\n${body}\n`;
|
|
128
205
|
}
|
|
129
206
|
|
|
130
207
|
function claudeBinding(role) {
|
|
@@ -169,6 +246,35 @@ export function installBindings({ target, adapter, roles, force = false }) {
|
|
|
169
246
|
return results;
|
|
170
247
|
}
|
|
171
248
|
|
|
249
|
+
/**
|
|
250
|
+
* Crea `.opencode/opencode.json` con `default_agent: team-lead` si no existe ya una
|
|
251
|
+
* configuración local de OpenCode. No sobrescribe configuración existente.
|
|
252
|
+
*/
|
|
253
|
+
export function writeOpenCodeConfig(target) {
|
|
254
|
+
const dir = join(target, ".opencode");
|
|
255
|
+
const jsonPath = join(dir, "opencode.json");
|
|
256
|
+
const jsoncPath = join(dir, "opencode.jsonc");
|
|
257
|
+
if (existsSync(jsonPath) || existsSync(jsoncPath)) {
|
|
258
|
+
return {
|
|
259
|
+
status: "kept",
|
|
260
|
+
path: existsSync(jsonPath) ? jsonPath : jsoncPath,
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
ensureDir(dir);
|
|
264
|
+
writeText(
|
|
265
|
+
jsonPath,
|
|
266
|
+
`${JSON.stringify(
|
|
267
|
+
{
|
|
268
|
+
$schema: "https://opencode.ai/config.json",
|
|
269
|
+
default_agent: "team-lead",
|
|
270
|
+
},
|
|
271
|
+
null,
|
|
272
|
+
2,
|
|
273
|
+
)}\n`,
|
|
274
|
+
);
|
|
275
|
+
return { status: "created", path: jsonPath };
|
|
276
|
+
}
|
|
277
|
+
|
|
172
278
|
export function writeManifest(target, manifest) {
|
|
173
279
|
const path = join(target, ".companion", "config.json");
|
|
174
280
|
writeText(path, `${JSON.stringify(manifest, null, 2)}\n`);
|
|
@@ -15,6 +15,11 @@ Use the `development-workflow` skill for non-trivial work. For a new project or
|
|
|
15
15
|
change, follow the process: discovery → architecture + security → test strategy → UX →
|
|
16
16
|
delivery plan → implementation → security verification → QA → deployment → closure.
|
|
17
17
|
|
|
18
|
+
If the harness exposes a team lead (OpenCode: `team-lead`, the default primary agent), use
|
|
19
|
+
it as the single accountable owner. The team lead MUST delegate specialist work with the
|
|
20
|
+
`subagent` tool and verify the evidence; it must not implement code or run shell commands
|
|
21
|
+
itself. Its only writable paths are `.companion/local/**` and `docs/companion/**`.
|
|
22
|
+
|
|
18
23
|
Profile: `{{profile}}`. Branching: `{{branching}}`.
|
|
19
24
|
|
|
20
25
|
## Non-negotiables
|