bmm-opencode 1.0.0 → 1.1.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 CHANGED
@@ -9,50 +9,32 @@ BMAD-METHOD agents and skills converted for [OpenCode](https://opencode.ai) - re
9
9
 
10
10
  ## Installation
11
11
 
12
- ### One-Line Install (Recommended)
12
+ ### For Humans
13
13
 
14
- Simply add `bmm-opencode` to your `opencode.json`:
14
+ Paste this into your LLM agent session:
15
15
 
16
- ```json
17
- {
18
- "$schema": "https://opencode.ai/config.json",
19
- "plugin": ["bmm-opencode"]
20
- }
21
16
  ```
22
-
23
- **Done!** Restart OpenCode and all 17 agents + 61 skills are ready to use.
24
-
25
- ---
26
-
27
- <details>
28
- <summary><b>Alternative: Manual Installation</b></summary>
29
-
30
- #### Via git clone
31
-
32
- ```bash
33
- git clone https://github.com/Jack-R-Hong/BMM-opencode.git
34
- cp -r BMM-opencode/.opencode /path/to/your-project/.opencode
17
+ Install and configure bmm-opencode by following the instructions here:
18
+ https://raw.githubusercontent.com/Jack-R-Hong/BMM-opencode/refs/heads/main/docs/installation.md
35
19
  ```
36
20
 
37
- #### Via npm pack
21
+ ### For LLM Agents
22
+
23
+ Fetch the installation guide and follow it:
38
24
 
39
25
  ```bash
40
- npm pack bmm-opencode
41
- tar -xzf bmm-opencode-*.tgz
42
- cp -r package/.opencode /path/to/your-project/.opencode
43
- rm -rf package bmm-opencode-*.tgz
26
+ curl -s https://raw.githubusercontent.com/Jack-R-Hong/BMM-opencode/refs/heads/main/docs/installation.md
44
27
  ```
45
28
 
46
- </details>
47
-
48
29
  ---
49
30
 
50
31
  ## Quick Start
51
32
 
52
- After installation, restart OpenCode and you'll have access to:
33
+ After installation, you have access to:
53
34
 
54
- 1. **17 Specialized Agents** - Switch agents using `Tab` key
55
- 2. **61 Workflow Skills** - Load skills via slash commands like `/bmad-bmm-create-prd`
35
+ 1. **Plugin Tools** - Use `bmm_list`, `bmm_agent`, `bmm_skill` directly
36
+ 2. **17 Specialized Agents** - After `bmm_install`, switch agents using `Tab` key
37
+ 3. **61 Workflow Skills** - After `bmm_install`, load skills via slash commands like `/bmad-bmm-create-prd`
56
38
 
57
39
  ---
58
40
 
@@ -125,7 +107,15 @@ After installation, restart OpenCode and you'll have access to:
125
107
 
126
108
  ## Usage
127
109
 
128
- ### Switch to an agent
110
+ ### Using Plugin Tools
111
+
112
+ ```
113
+ Use bmm_list to see all available agents and skills
114
+ Use bmm_skill with name bmad-bmm-create-prd to get the PRD creation workflow
115
+ Use bmm_install to copy everything to my project
116
+ ```
117
+
118
+ ### Switch to an agent (after bmm_install)
129
119
 
130
120
  Press `Tab` or use the agent switch keybind, then select an agent.
131
121
 
@@ -0,0 +1,4 @@
1
+ import type { Plugin } from "@opencode-ai/plugin";
2
+ export declare const BMMPlugin: Plugin;
3
+ export default BMMPlugin;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAgDlD,eAAO,MAAM,SAAS,EAAE,MAuHvB,CAAC;AAEF,eAAe,SAAS,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,154 @@
1
+ import { tool } from "@opencode-ai/plugin/tool";
2
+ import { readFileSync, readdirSync, existsSync, cpSync, mkdirSync } from "fs";
3
+ import { join, dirname } from "path";
4
+ import { fileURLToPath } from "url";
5
+ import { homedir } from "os";
6
+ const __dirname = dirname(fileURLToPath(import.meta.url));
7
+ const packageRoot = join(__dirname, "..");
8
+ const agentsDir = join(packageRoot, ".opencode", "agents");
9
+ const skillsDir = join(packageRoot, ".opencode", "skills");
10
+ function listAgents() {
11
+ try {
12
+ return readdirSync(agentsDir)
13
+ .filter((f) => f.endsWith(".md"))
14
+ .map((f) => f.replace(".md", ""));
15
+ }
16
+ catch {
17
+ return [];
18
+ }
19
+ }
20
+ function listSkills() {
21
+ try {
22
+ return readdirSync(skillsDir).filter((d) => existsSync(join(skillsDir, d, "SKILL.md")));
23
+ }
24
+ catch {
25
+ return [];
26
+ }
27
+ }
28
+ function loadAgent(name) {
29
+ try {
30
+ return readFileSync(join(agentsDir, `${name}.md`), "utf-8");
31
+ }
32
+ catch {
33
+ return `Agent "${name}" not found`;
34
+ }
35
+ }
36
+ function loadSkill(name) {
37
+ try {
38
+ return readFileSync(join(skillsDir, name, "SKILL.md"), "utf-8");
39
+ }
40
+ catch {
41
+ return `Skill "${name}" not found`;
42
+ }
43
+ }
44
+ export const BMMPlugin = async () => {
45
+ const agents = listAgents();
46
+ const skills = listSkills();
47
+ return {
48
+ tool: {
49
+ bmm_list: tool({
50
+ description: "List all available BMAD-METHOD agents and skills from bmm-opencode",
51
+ args: {},
52
+ async execute() {
53
+ return `# BMM-OpenCode Resources
54
+
55
+ ## Agents (${agents.length})
56
+ ${agents.map((a) => `- ${a}`).join("\n")}
57
+
58
+ ## Skills (${skills.length})
59
+ ${skills.map((s) => `- ${s}`).join("\n")}
60
+
61
+ ## Usage
62
+ - Use \`bmm_agent\` tool to get agent definition
63
+ - Use \`bmm_skill\` tool to get skill instructions
64
+ - Use \`bmm_install\` with \`global=true\` to install globally (~/.config/opencode/)
65
+ - Use \`bmm_install\` to install to current project (.opencode/)`;
66
+ },
67
+ }),
68
+ bmm_agent: tool({
69
+ description: "Get a BMAD-METHOD agent definition by name",
70
+ args: {
71
+ name: tool.schema.string().describe(`Agent name`),
72
+ },
73
+ async execute(args) {
74
+ return loadAgent(args.name);
75
+ },
76
+ }),
77
+ bmm_skill: tool({
78
+ description: "Get a BMAD-METHOD skill instructions by name",
79
+ args: {
80
+ name: tool.schema.string().describe(`Skill name`),
81
+ },
82
+ async execute(args) {
83
+ return loadSkill(args.name);
84
+ },
85
+ }),
86
+ bmm_install: tool({
87
+ description: "Install BMM agents and skills. Use global=true for ~/.config/opencode/ (all projects), or omit for current project's .opencode/",
88
+ args: {
89
+ target: tool.schema
90
+ .string()
91
+ .optional()
92
+ .describe("Target directory (defaults to current project's .opencode/)"),
93
+ global: tool.schema
94
+ .boolean()
95
+ .optional()
96
+ .describe("Install to global ~/.config/opencode/ instead of project"),
97
+ force: tool.schema
98
+ .boolean()
99
+ .optional()
100
+ .describe("Overwrite existing files without warning (default: false)"),
101
+ },
102
+ async execute(args, context) {
103
+ const globalConfigDir = join(homedir(), ".config", "opencode");
104
+ const targetBase = args.global
105
+ ? globalConfigDir
106
+ : args.target || join(context.directory, ".opencode");
107
+ try {
108
+ const targetAgents = join(targetBase, "agents");
109
+ const targetSkills = join(targetBase, "skills");
110
+ const agentsExist = existsSync(targetAgents) && readdirSync(targetAgents).length > 0;
111
+ const skillsExist = existsSync(targetSkills) && readdirSync(targetSkills).length > 0;
112
+ if ((agentsExist || skillsExist) && !args.force) {
113
+ const existing = [];
114
+ if (agentsExist)
115
+ existing.push(`agents (${readdirSync(targetAgents).length} files)`);
116
+ if (skillsExist)
117
+ existing.push(`skills (${readdirSync(targetSkills).length} dirs)`);
118
+ return `Existing installation detected at ${targetBase}:
119
+ - ${existing.join("\n- ")}
120
+
121
+ Use \`force=true\` to overwrite, or remove existing files first.`;
122
+ }
123
+ mkdirSync(targetAgents, { recursive: true });
124
+ mkdirSync(targetSkills, { recursive: true });
125
+ let agentsCopied = 0;
126
+ for (const agent of agents) {
127
+ const src = join(agentsDir, `${agent}.md`);
128
+ const dest = join(targetAgents, `${agent}.md`);
129
+ cpSync(src, dest);
130
+ agentsCopied++;
131
+ }
132
+ let skillsCopied = 0;
133
+ for (const skill of skills) {
134
+ const src = join(skillsDir, skill);
135
+ const dest = join(targetSkills, skill);
136
+ cpSync(src, dest, { recursive: true });
137
+ skillsCopied++;
138
+ }
139
+ const installType = args.global ? "globally" : "to project";
140
+ return `Successfully installed BMM-OpenCode ${installType} (${targetBase}):
141
+ - ${agentsCopied} agents copied to ${targetAgents}
142
+ - ${skillsCopied} skills copied to ${targetSkills}
143
+
144
+ Restart OpenCode to use the new agents and skills.`;
145
+ }
146
+ catch (error) {
147
+ return `Installation failed: ${error instanceof Error ? error.message : String(error)}`;
148
+ }
149
+ },
150
+ }),
151
+ },
152
+ };
153
+ };
154
+ export default BMMPlugin;
package/package.json CHANGED
@@ -1,9 +1,13 @@
1
1
  {
2
2
  "name": "bmm-opencode",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "BMAD-METHOD agents and skills for OpenCode - AI agent framework with 17 specialized agents and 61 workflow skills",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "type": "module",
5
8
  "keywords": [
6
9
  "opencode",
10
+ "plugin",
7
11
  "bmad",
8
12
  "bmad-method",
9
13
  "ai-agents",
@@ -25,9 +29,24 @@
25
29
  },
26
30
  "license": "MIT",
27
31
  "author": "Jack-R-Hong",
28
- "type": "module",
32
+ "scripts": {
33
+ "build": "tsc",
34
+ "dev": "tsc --watch",
35
+ "test": "node --experimental-vm-modules --test tests/*.test.js",
36
+ "prepublishOnly": "npm run build && npm test"
37
+ },
38
+ "dependencies": {
39
+ "@opencode-ai/plugin": "^1.1.51"
40
+ },
41
+ "devDependencies": {
42
+ "@types/node": "^22.0.0",
43
+ "typescript": "^5.0.0"
44
+ },
29
45
  "files": [
30
- ".opencode/**/*"
46
+ "dist",
47
+ ".opencode/**/*",
48
+ "README.md",
49
+ "LICENSE"
31
50
  ],
32
51
  "publishConfig": {
33
52
  "access": "public"