@doingdev/opencode-claude-manager-plugin 0.1.0 → 0.1.4
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 +34 -2
- package/dist/index.d.ts +0 -9
- package/dist/index.js +0 -9
- package/dist/plugin/claude-manager.plugin.js +82 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -56,6 +56,16 @@ If you are testing locally, point OpenCode at the local package or plugin file u
|
|
|
56
56
|
- `claude_manager_runs` - inspect persisted manager run records
|
|
57
57
|
- `claude_manager_cleanup_run` - explicitly remove worktrees created for a prior manager run
|
|
58
58
|
|
|
59
|
+
## Plugin-provided agents and commands
|
|
60
|
+
|
|
61
|
+
When the plugin loads successfully, it also injects config entries through the OpenCode plugin `config` hook.
|
|
62
|
+
|
|
63
|
+
- Primary agent: `claude-manager`
|
|
64
|
+
- Subagent: `claude-manager-research`
|
|
65
|
+
- Commands: `/claude-metadata`, `/claude-run`, `/claude-sessions`
|
|
66
|
+
|
|
67
|
+
These are added to OpenCode config at runtime by the plugin, so they do not require separate manual `opencode.json` entries.
|
|
68
|
+
|
|
59
69
|
## Quick Start
|
|
60
70
|
|
|
61
71
|
Typical flow inside OpenCode:
|
|
@@ -88,6 +98,24 @@ The compiled plugin output is written to `dist/`.
|
|
|
88
98
|
|
|
89
99
|
This package is configured for the npm scope `@doingdev`.
|
|
90
100
|
|
|
101
|
+
This repository uses npm trusted publishing with GitHub Actions OIDC, so you do not need an `NPM_TOKEN` secret once npm is configured correctly.
|
|
102
|
+
|
|
103
|
+
Before the first automated publish, configure npm trusted publishing for `@doingdev/opencode-claude-manager-plugin` on npmjs.com:
|
|
104
|
+
|
|
105
|
+
1. Open the package settings on npmjs.com.
|
|
106
|
+
2. Go to the `Trusted Publisher` section.
|
|
107
|
+
3. Choose `GitHub Actions`.
|
|
108
|
+
4. Set the GitHub owner/user to your account or org.
|
|
109
|
+
5. Set the repository name.
|
|
110
|
+
6. Set the workflow filename to `publish.yml`.
|
|
111
|
+
7. Leave the environment name empty unless you later add a GitHub Actions environment back to the workflow.
|
|
112
|
+
|
|
113
|
+
Notes for trusted publishing:
|
|
114
|
+
|
|
115
|
+
- npm trusted publishing requires GitHub-hosted runners.
|
|
116
|
+
- npm recommends Node `22.14.0+` with npm CLI `11.5.1+`; the workflows use Node `24`.
|
|
117
|
+
- Provenance is generated automatically by npm for trusted publishes from public GitHub repositories.
|
|
118
|
+
|
|
91
119
|
Release flow:
|
|
92
120
|
|
|
93
121
|
```bash
|
|
@@ -98,10 +126,14 @@ npm run lint
|
|
|
98
126
|
npm run typecheck
|
|
99
127
|
npm run test
|
|
100
128
|
npm run build
|
|
101
|
-
npm publish --access public
|
|
102
129
|
```
|
|
103
130
|
|
|
104
|
-
|
|
131
|
+
Then publish from GitHub by either:
|
|
132
|
+
|
|
133
|
+
- creating a GitHub Release, or
|
|
134
|
+
- running the `Publish` workflow manually from the Actions tab
|
|
135
|
+
|
|
136
|
+
After trusted publishing is working, you can tighten npm package security by disabling token-based publishing for the package in npm settings.
|
|
105
137
|
|
|
106
138
|
## Limitations
|
|
107
139
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
import type { Plugin } from '@opencode-ai/plugin';
|
|
2
|
-
export { ClaudeAgentSdkAdapter } from './claude/claude-agent-sdk-adapter.js';
|
|
3
|
-
export { ClaudeSessionService } from './claude/claude-session.service.js';
|
|
4
|
-
export { ManagerOrchestrator } from './manager/manager-orchestrator.js';
|
|
5
|
-
export { TaskPlanner } from './manager/task-planner.js';
|
|
6
|
-
export { ClaudeMetadataService } from './metadata/claude-metadata.service.js';
|
|
7
|
-
export { RepoClaudeConfigReader } from './metadata/repo-claude-config-reader.js';
|
|
8
|
-
export { getOrCreatePluginServices } from './plugin/service-factory.js';
|
|
9
|
-
export { FileRunStateStore } from './state/file-run-state-store.js';
|
|
10
|
-
export { WorktreeCoordinator } from './worktree/worktree-coordinator.js';
|
|
11
2
|
import { ClaudeManagerPlugin } from './plugin/claude-manager.plugin.js';
|
|
12
3
|
export type { ClaudeCapabilitySnapshot, ClaudeMetadataSnapshot, ClaudeSessionRunResult, ClaudeSessionSummary, ClaudeSessionTranscriptMessage, ManagerRunRecord, ManagerRunResult, ManagerTaskRequest, ManagerPromptRegistry, RunClaudeSessionInput, } from './types/contracts.js';
|
|
13
4
|
export { ClaudeManagerPlugin };
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
export { ClaudeAgentSdkAdapter } from './claude/claude-agent-sdk-adapter.js';
|
|
2
|
-
export { ClaudeSessionService } from './claude/claude-session.service.js';
|
|
3
|
-
export { ManagerOrchestrator } from './manager/manager-orchestrator.js';
|
|
4
|
-
export { TaskPlanner } from './manager/task-planner.js';
|
|
5
|
-
export { ClaudeMetadataService } from './metadata/claude-metadata.service.js';
|
|
6
|
-
export { RepoClaudeConfigReader } from './metadata/repo-claude-config-reader.js';
|
|
7
|
-
export { getOrCreatePluginServices } from './plugin/service-factory.js';
|
|
8
|
-
export { FileRunStateStore } from './state/file-run-state-store.js';
|
|
9
|
-
export { WorktreeCoordinator } from './worktree/worktree-coordinator.js';
|
|
10
1
|
import { ClaudeManagerPlugin } from './plugin/claude-manager.plugin.js';
|
|
11
2
|
export { ClaudeManagerPlugin };
|
|
12
3
|
export const plugin = ClaudeManagerPlugin;
|
|
@@ -1,8 +1,90 @@
|
|
|
1
1
|
import { tool } from '@opencode-ai/plugin';
|
|
2
|
+
import { managerPromptRegistry } from '../prompts/registry.js';
|
|
2
3
|
import { getOrCreatePluginServices } from './service-factory.js';
|
|
4
|
+
const MANAGER_TOOL_IDS = [
|
|
5
|
+
'claude_manager_run',
|
|
6
|
+
'claude_manager_metadata',
|
|
7
|
+
'claude_manager_sessions',
|
|
8
|
+
'claude_manager_runs',
|
|
9
|
+
'claude_manager_cleanup_run',
|
|
10
|
+
];
|
|
3
11
|
export const ClaudeManagerPlugin = async ({ worktree }) => {
|
|
4
12
|
const services = getOrCreatePluginServices(worktree);
|
|
5
13
|
return {
|
|
14
|
+
config: async (config) => {
|
|
15
|
+
config.agent ??= {};
|
|
16
|
+
config.command ??= {};
|
|
17
|
+
config.permission ??= {};
|
|
18
|
+
const globalPermissions = config.permission;
|
|
19
|
+
const managerPermissions = {
|
|
20
|
+
claude_manager_run: 'allow',
|
|
21
|
+
claude_manager_metadata: 'allow',
|
|
22
|
+
claude_manager_sessions: 'allow',
|
|
23
|
+
claude_manager_runs: 'allow',
|
|
24
|
+
claude_manager_cleanup_run: 'allow',
|
|
25
|
+
};
|
|
26
|
+
const researchPermissions = {
|
|
27
|
+
claude_manager_run: 'deny',
|
|
28
|
+
claude_manager_metadata: 'allow',
|
|
29
|
+
claude_manager_sessions: 'allow',
|
|
30
|
+
claude_manager_runs: 'allow',
|
|
31
|
+
claude_manager_cleanup_run: 'deny',
|
|
32
|
+
};
|
|
33
|
+
for (const toolId of MANAGER_TOOL_IDS) {
|
|
34
|
+
globalPermissions[toolId] ??= 'deny';
|
|
35
|
+
}
|
|
36
|
+
config.agent['claude-manager'] ??= {
|
|
37
|
+
description: 'Primary agent that manages Claude Code sessions through the bundled plugin tools.',
|
|
38
|
+
mode: 'primary',
|
|
39
|
+
color: 'accent',
|
|
40
|
+
permission: managerPermissions,
|
|
41
|
+
prompt: [
|
|
42
|
+
managerPromptRegistry.managerSystemPrompt,
|
|
43
|
+
'When Claude Code delegation is useful, prefer the claude_manager_run tool instead of simulating the work yourself.',
|
|
44
|
+
'Use claude_manager_metadata to inspect available Claude commands, skills, and hooks before making assumptions.',
|
|
45
|
+
'Use claude_manager_sessions and claude_manager_runs to inspect prior work before starting a new Claude session.',
|
|
46
|
+
].join(' '),
|
|
47
|
+
};
|
|
48
|
+
config.agent['claude-manager-research'] ??= {
|
|
49
|
+
description: 'Subagent that inspects Claude metadata, prior sessions, and manager runs without changing repository state.',
|
|
50
|
+
mode: 'subagent',
|
|
51
|
+
color: 'info',
|
|
52
|
+
permission: researchPermissions,
|
|
53
|
+
prompt: [
|
|
54
|
+
managerPromptRegistry.subagentSystemPrompt,
|
|
55
|
+
'Focus on inspection and summarization.',
|
|
56
|
+
'Prefer claude_manager_metadata, claude_manager_sessions, and claude_manager_runs over guesswork.',
|
|
57
|
+
].join(' '),
|
|
58
|
+
};
|
|
59
|
+
config.command['claude-metadata'] ??= {
|
|
60
|
+
description: 'Inspect bundled Claude commands, skills, hooks, and agents.',
|
|
61
|
+
agent: 'claude-manager-research',
|
|
62
|
+
subtask: true,
|
|
63
|
+
template: [
|
|
64
|
+
'Use claude_manager_metadata to inspect the current repository.',
|
|
65
|
+
'Summarize Claude commands, skills, hooks, discovered agents, and important config files.',
|
|
66
|
+
].join(' '),
|
|
67
|
+
};
|
|
68
|
+
config.command['claude-run'] ??= {
|
|
69
|
+
description: 'Delegate a task to Claude Code through the manager plugin.',
|
|
70
|
+
agent: 'claude-manager',
|
|
71
|
+
template: [
|
|
72
|
+
'Use claude_manager_run to delegate the following task to Claude Code:',
|
|
73
|
+
'$ARGUMENTS',
|
|
74
|
+
'Default to worktrees for multi-part work and return a concise result summary.',
|
|
75
|
+
].join('\n\n'),
|
|
76
|
+
};
|
|
77
|
+
config.command['claude-sessions'] ??= {
|
|
78
|
+
description: 'Inspect Claude session history and manager run records.',
|
|
79
|
+
agent: 'claude-manager-research',
|
|
80
|
+
subtask: true,
|
|
81
|
+
template: [
|
|
82
|
+
'Use claude_manager_sessions and claude_manager_runs to inspect recent Claude activity for this repository.',
|
|
83
|
+
'If the user provided extra arguments, use them to focus the inspection:',
|
|
84
|
+
'$ARGUMENTS',
|
|
85
|
+
].join('\n\n'),
|
|
86
|
+
};
|
|
87
|
+
},
|
|
6
88
|
tool: {
|
|
7
89
|
claude_manager_run: tool({
|
|
8
90
|
description: 'Delegate a task to Claude Code with optional subagents and worktrees.',
|