@every-env/compound-plugin 0.5.2 → 0.7.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.
Files changed (35) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +34 -0
  3. package/README.md +20 -3
  4. package/docs/plans/2026-02-14-feat-add-gemini-cli-target-provider-plan.md +370 -0
  5. package/docs/specs/gemini.md +122 -0
  6. package/package.json +1 -1
  7. package/plugins/compound-engineering/.claude-plugin/plugin.json +1 -1
  8. package/plugins/compound-engineering/CHANGELOG.md +17 -0
  9. package/plugins/compound-engineering/commands/workflows/plan.md +3 -0
  10. package/plugins/compound-engineering/commands/workflows/work.md +8 -1
  11. package/src/commands/convert.ts +14 -25
  12. package/src/commands/install.ts +23 -25
  13. package/src/commands/sync.ts +44 -21
  14. package/src/converters/claude-to-gemini.ts +193 -0
  15. package/src/converters/claude-to-opencode.ts +16 -0
  16. package/src/converters/claude-to-pi.ts +205 -0
  17. package/src/sync/cursor.ts +78 -0
  18. package/src/sync/droid.ts +21 -0
  19. package/src/sync/pi.ts +88 -0
  20. package/src/targets/gemini.ts +68 -0
  21. package/src/targets/index.ts +18 -0
  22. package/src/targets/pi.ts +131 -0
  23. package/src/templates/pi/compat-extension.ts +452 -0
  24. package/src/types/gemini.ts +29 -0
  25. package/src/types/pi.ts +40 -0
  26. package/src/utils/resolve-home.ts +17 -0
  27. package/tests/cli.test.ts +76 -0
  28. package/tests/converter.test.ts +29 -0
  29. package/tests/gemini-converter.test.ts +373 -0
  30. package/tests/gemini-writer.test.ts +181 -0
  31. package/tests/pi-converter.test.ts +116 -0
  32. package/tests/pi-writer.test.ts +99 -0
  33. package/tests/sync-cursor.test.ts +92 -0
  34. package/tests/sync-droid.test.ts +57 -0
  35. package/tests/sync-pi.test.ts +68 -0
@@ -0,0 +1,99 @@
1
+ import { describe, expect, test } from "bun:test"
2
+ import { promises as fs } from "fs"
3
+ import path from "path"
4
+ import os from "os"
5
+ import { writePiBundle } from "../src/targets/pi"
6
+ import type { PiBundle } from "../src/types/pi"
7
+
8
+ async function exists(filePath: string): Promise<boolean> {
9
+ try {
10
+ await fs.access(filePath)
11
+ return true
12
+ } catch {
13
+ return false
14
+ }
15
+ }
16
+
17
+ describe("writePiBundle", () => {
18
+ test("writes prompts, skills, extensions, mcporter config, and AGENTS.md block", async () => {
19
+ const tempRoot = await fs.mkdtemp(path.join(os.tmpdir(), "pi-writer-"))
20
+ const outputRoot = path.join(tempRoot, ".pi")
21
+
22
+ const bundle: PiBundle = {
23
+ prompts: [{ name: "workflows-plan", content: "Prompt content" }],
24
+ skillDirs: [
25
+ {
26
+ name: "skill-one",
27
+ sourceDir: path.join(import.meta.dir, "fixtures", "sample-plugin", "skills", "skill-one"),
28
+ },
29
+ ],
30
+ generatedSkills: [{ name: "repo-research-analyst", content: "---\nname: repo-research-analyst\n---\n\nBody" }],
31
+ extensions: [{ name: "compound-engineering-compat.ts", content: "export default function () {}" }],
32
+ mcporterConfig: {
33
+ mcpServers: {
34
+ context7: { baseUrl: "https://mcp.context7.com/mcp" },
35
+ },
36
+ },
37
+ }
38
+
39
+ await writePiBundle(outputRoot, bundle)
40
+
41
+ expect(await exists(path.join(outputRoot, "prompts", "workflows-plan.md"))).toBe(true)
42
+ expect(await exists(path.join(outputRoot, "skills", "skill-one", "SKILL.md"))).toBe(true)
43
+ expect(await exists(path.join(outputRoot, "skills", "repo-research-analyst", "SKILL.md"))).toBe(true)
44
+ expect(await exists(path.join(outputRoot, "extensions", "compound-engineering-compat.ts"))).toBe(true)
45
+ expect(await exists(path.join(outputRoot, "compound-engineering", "mcporter.json"))).toBe(true)
46
+
47
+ const agentsPath = path.join(outputRoot, "AGENTS.md")
48
+ const agentsContent = await fs.readFile(agentsPath, "utf8")
49
+ expect(agentsContent).toContain("BEGIN COMPOUND PI TOOL MAP")
50
+ expect(agentsContent).toContain("MCPorter")
51
+ })
52
+
53
+ test("writes to ~/.pi/agent style roots without nesting under .pi", async () => {
54
+ const tempRoot = await fs.mkdtemp(path.join(os.tmpdir(), "pi-agent-root-"))
55
+ const outputRoot = path.join(tempRoot, "agent")
56
+
57
+ const bundle: PiBundle = {
58
+ prompts: [{ name: "workflows-work", content: "Prompt content" }],
59
+ skillDirs: [],
60
+ generatedSkills: [],
61
+ extensions: [],
62
+ }
63
+
64
+ await writePiBundle(outputRoot, bundle)
65
+
66
+ expect(await exists(path.join(outputRoot, "prompts", "workflows-work.md"))).toBe(true)
67
+ expect(await exists(path.join(outputRoot, ".pi"))).toBe(false)
68
+ })
69
+
70
+ test("backs up existing mcporter config before overwriting", async () => {
71
+ const tempRoot = await fs.mkdtemp(path.join(os.tmpdir(), "pi-backup-"))
72
+ const outputRoot = path.join(tempRoot, ".pi")
73
+ const configPath = path.join(outputRoot, "compound-engineering", "mcporter.json")
74
+
75
+ await fs.mkdir(path.dirname(configPath), { recursive: true })
76
+ await fs.writeFile(configPath, JSON.stringify({ previous: true }, null, 2))
77
+
78
+ const bundle: PiBundle = {
79
+ prompts: [],
80
+ skillDirs: [],
81
+ generatedSkills: [],
82
+ extensions: [],
83
+ mcporterConfig: {
84
+ mcpServers: {
85
+ linear: { baseUrl: "https://mcp.linear.app/mcp" },
86
+ },
87
+ },
88
+ }
89
+
90
+ await writePiBundle(outputRoot, bundle)
91
+
92
+ const files = await fs.readdir(path.dirname(configPath))
93
+ const backupFileName = files.find((file) => file.startsWith("mcporter.json.bak."))
94
+ expect(backupFileName).toBeDefined()
95
+
96
+ const currentConfig = JSON.parse(await fs.readFile(configPath, "utf8")) as { mcpServers: Record<string, unknown> }
97
+ expect(currentConfig.mcpServers.linear).toBeDefined()
98
+ })
99
+ })
@@ -0,0 +1,92 @@
1
+ import { describe, expect, test } from "bun:test"
2
+ import { promises as fs } from "fs"
3
+ import path from "path"
4
+ import os from "os"
5
+ import { syncToCursor } from "../src/sync/cursor"
6
+ import type { ClaudeHomeConfig } from "../src/parsers/claude-home"
7
+
8
+ describe("syncToCursor", () => {
9
+ test("symlinks skills and writes mcp.json", async () => {
10
+ const tempRoot = await fs.mkdtemp(path.join(os.tmpdir(), "sync-cursor-"))
11
+ const fixtureSkillDir = path.join(import.meta.dir, "fixtures", "sample-plugin", "skills", "skill-one")
12
+
13
+ const config: ClaudeHomeConfig = {
14
+ skills: [
15
+ {
16
+ name: "skill-one",
17
+ sourceDir: fixtureSkillDir,
18
+ skillPath: path.join(fixtureSkillDir, "SKILL.md"),
19
+ },
20
+ ],
21
+ mcpServers: {
22
+ context7: { url: "https://mcp.context7.com/mcp" },
23
+ local: { command: "echo", args: ["hello"], env: { FOO: "bar" } },
24
+ },
25
+ }
26
+
27
+ await syncToCursor(config, tempRoot)
28
+
29
+ // Check skill symlink
30
+ const linkedSkillPath = path.join(tempRoot, "skills", "skill-one")
31
+ const linkedStat = await fs.lstat(linkedSkillPath)
32
+ expect(linkedStat.isSymbolicLink()).toBe(true)
33
+
34
+ // Check mcp.json
35
+ const mcpPath = path.join(tempRoot, "mcp.json")
36
+ const mcpConfig = JSON.parse(await fs.readFile(mcpPath, "utf8")) as {
37
+ mcpServers: Record<string, { url?: string; command?: string; args?: string[]; env?: Record<string, string> }>
38
+ }
39
+
40
+ expect(mcpConfig.mcpServers.context7?.url).toBe("https://mcp.context7.com/mcp")
41
+ expect(mcpConfig.mcpServers.local?.command).toBe("echo")
42
+ expect(mcpConfig.mcpServers.local?.args).toEqual(["hello"])
43
+ expect(mcpConfig.mcpServers.local?.env).toEqual({ FOO: "bar" })
44
+ })
45
+
46
+ test("merges existing mcp.json", async () => {
47
+ const tempRoot = await fs.mkdtemp(path.join(os.tmpdir(), "sync-cursor-merge-"))
48
+ const mcpPath = path.join(tempRoot, "mcp.json")
49
+
50
+ await fs.writeFile(
51
+ mcpPath,
52
+ JSON.stringify({ mcpServers: { existing: { command: "node", args: ["server.js"] } } }, null, 2),
53
+ )
54
+
55
+ const config: ClaudeHomeConfig = {
56
+ skills: [],
57
+ mcpServers: {
58
+ context7: { url: "https://mcp.context7.com/mcp" },
59
+ },
60
+ }
61
+
62
+ await syncToCursor(config, tempRoot)
63
+
64
+ const merged = JSON.parse(await fs.readFile(mcpPath, "utf8")) as {
65
+ mcpServers: Record<string, { command?: string; url?: string }>
66
+ }
67
+
68
+ expect(merged.mcpServers.existing?.command).toBe("node")
69
+ expect(merged.mcpServers.context7?.url).toBe("https://mcp.context7.com/mcp")
70
+ })
71
+
72
+ test("does not write mcp.json when no MCP servers", async () => {
73
+ const tempRoot = await fs.mkdtemp(path.join(os.tmpdir(), "sync-cursor-nomcp-"))
74
+ const fixtureSkillDir = path.join(import.meta.dir, "fixtures", "sample-plugin", "skills", "skill-one")
75
+
76
+ const config: ClaudeHomeConfig = {
77
+ skills: [
78
+ {
79
+ name: "skill-one",
80
+ sourceDir: fixtureSkillDir,
81
+ skillPath: path.join(fixtureSkillDir, "SKILL.md"),
82
+ },
83
+ ],
84
+ mcpServers: {},
85
+ }
86
+
87
+ await syncToCursor(config, tempRoot)
88
+
89
+ const mcpExists = await fs.access(path.join(tempRoot, "mcp.json")).then(() => true).catch(() => false)
90
+ expect(mcpExists).toBe(false)
91
+ })
92
+ })
@@ -0,0 +1,57 @@
1
+ import { describe, expect, test } from "bun:test"
2
+ import { promises as fs } from "fs"
3
+ import path from "path"
4
+ import os from "os"
5
+ import { syncToDroid } from "../src/sync/droid"
6
+ import type { ClaudeHomeConfig } from "../src/parsers/claude-home"
7
+
8
+ describe("syncToDroid", () => {
9
+ test("symlinks skills to factory skills dir", async () => {
10
+ const tempRoot = await fs.mkdtemp(path.join(os.tmpdir(), "sync-droid-"))
11
+ const fixtureSkillDir = path.join(import.meta.dir, "fixtures", "sample-plugin", "skills", "skill-one")
12
+
13
+ const config: ClaudeHomeConfig = {
14
+ skills: [
15
+ {
16
+ name: "skill-one",
17
+ sourceDir: fixtureSkillDir,
18
+ skillPath: path.join(fixtureSkillDir, "SKILL.md"),
19
+ },
20
+ ],
21
+ mcpServers: {
22
+ context7: { url: "https://mcp.context7.com/mcp" },
23
+ },
24
+ }
25
+
26
+ await syncToDroid(config, tempRoot)
27
+
28
+ const linkedSkillPath = path.join(tempRoot, "skills", "skill-one")
29
+ const linkedStat = await fs.lstat(linkedSkillPath)
30
+ expect(linkedStat.isSymbolicLink()).toBe(true)
31
+
32
+ // Droid does not write MCP config
33
+ const mcpExists = await fs.access(path.join(tempRoot, "mcp.json")).then(() => true).catch(() => false)
34
+ expect(mcpExists).toBe(false)
35
+ })
36
+
37
+ test("skips skills with invalid names", async () => {
38
+ const tempRoot = await fs.mkdtemp(path.join(os.tmpdir(), "sync-droid-invalid-"))
39
+ const fixtureSkillDir = path.join(import.meta.dir, "fixtures", "sample-plugin", "skills", "skill-one")
40
+
41
+ const config: ClaudeHomeConfig = {
42
+ skills: [
43
+ {
44
+ name: "../escape",
45
+ sourceDir: fixtureSkillDir,
46
+ skillPath: path.join(fixtureSkillDir, "SKILL.md"),
47
+ },
48
+ ],
49
+ mcpServers: {},
50
+ }
51
+
52
+ await syncToDroid(config, tempRoot)
53
+
54
+ const entries = await fs.readdir(path.join(tempRoot, "skills"))
55
+ expect(entries).toHaveLength(0)
56
+ })
57
+ })
@@ -0,0 +1,68 @@
1
+ import { describe, expect, test } from "bun:test"
2
+ import { promises as fs } from "fs"
3
+ import path from "path"
4
+ import os from "os"
5
+ import { syncToPi } from "../src/sync/pi"
6
+ import type { ClaudeHomeConfig } from "../src/parsers/claude-home"
7
+
8
+ describe("syncToPi", () => {
9
+ test("symlinks skills and writes MCPorter config", async () => {
10
+ const tempRoot = await fs.mkdtemp(path.join(os.tmpdir(), "sync-pi-"))
11
+ const fixtureSkillDir = path.join(import.meta.dir, "fixtures", "sample-plugin", "skills", "skill-one")
12
+
13
+ const config: ClaudeHomeConfig = {
14
+ skills: [
15
+ {
16
+ name: "skill-one",
17
+ sourceDir: fixtureSkillDir,
18
+ skillPath: path.join(fixtureSkillDir, "SKILL.md"),
19
+ },
20
+ ],
21
+ mcpServers: {
22
+ context7: { url: "https://mcp.context7.com/mcp" },
23
+ local: { command: "echo", args: ["hello"] },
24
+ },
25
+ }
26
+
27
+ await syncToPi(config, tempRoot)
28
+
29
+ const linkedSkillPath = path.join(tempRoot, "skills", "skill-one")
30
+ const linkedStat = await fs.lstat(linkedSkillPath)
31
+ expect(linkedStat.isSymbolicLink()).toBe(true)
32
+
33
+ const mcporterPath = path.join(tempRoot, "compound-engineering", "mcporter.json")
34
+ const mcporterConfig = JSON.parse(await fs.readFile(mcporterPath, "utf8")) as {
35
+ mcpServers: Record<string, { baseUrl?: string; command?: string }>
36
+ }
37
+
38
+ expect(mcporterConfig.mcpServers.context7?.baseUrl).toBe("https://mcp.context7.com/mcp")
39
+ expect(mcporterConfig.mcpServers.local?.command).toBe("echo")
40
+ })
41
+
42
+ test("merges existing MCPorter config", async () => {
43
+ const tempRoot = await fs.mkdtemp(path.join(os.tmpdir(), "sync-pi-merge-"))
44
+ const mcporterPath = path.join(tempRoot, "compound-engineering", "mcporter.json")
45
+ await fs.mkdir(path.dirname(mcporterPath), { recursive: true })
46
+
47
+ await fs.writeFile(
48
+ mcporterPath,
49
+ JSON.stringify({ mcpServers: { existing: { baseUrl: "https://example.com/mcp" } } }, null, 2),
50
+ )
51
+
52
+ const config: ClaudeHomeConfig = {
53
+ skills: [],
54
+ mcpServers: {
55
+ context7: { url: "https://mcp.context7.com/mcp" },
56
+ },
57
+ }
58
+
59
+ await syncToPi(config, tempRoot)
60
+
61
+ const merged = JSON.parse(await fs.readFile(mcporterPath, "utf8")) as {
62
+ mcpServers: Record<string, { baseUrl?: string }>
63
+ }
64
+
65
+ expect(merged.mcpServers.existing?.baseUrl).toBe("https://example.com/mcp")
66
+ expect(merged.mcpServers.context7?.baseUrl).toBe("https://mcp.context7.com/mcp")
67
+ })
68
+ })