opencode-subagent-magazine 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/LICENSE +21 -0
- package/README.md +174 -0
- package/dist/_version.d.ts +1 -0
- package/dist/_version.js +2 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +1128 -0
- package/install.mjs +103 -0
- package/package.json +56 -0
- package/src/_version.ts +2 -0
- package/src/index.tsx +1380 -0
package/install.mjs
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Install script for opencode-subagent-magazine.
|
|
5
|
+
*
|
|
6
|
+
* Creates or updates `~/.config/opencode/tui.jsonc` so OpenCode loads
|
|
7
|
+
* the TUI sidebar plugin.
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* node install.mjs
|
|
11
|
+
* npm explore opencode-subagent-magazine -- node install.mjs
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { readFile, writeFile, mkdir, access } from "node:fs/promises"
|
|
15
|
+
import { constants } from "node:fs"
|
|
16
|
+
import { homedir, platform } from "node:os"
|
|
17
|
+
import { join, dirname } from "node:path"
|
|
18
|
+
|
|
19
|
+
const PLUGIN_SPEC = "opencode-subagent-magazine"
|
|
20
|
+
|
|
21
|
+
function configDir() {
|
|
22
|
+
if (platform() === "win32") {
|
|
23
|
+
return join(process.env.APPDATA ?? join(homedir(), "AppData", "Roaming"), "opencode")
|
|
24
|
+
}
|
|
25
|
+
return join(process.env.XDG_CONFIG_HOME ?? join(homedir(), ".config"), "opencode")
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async function exists(p) {
|
|
29
|
+
try { await access(p, constants.F_OK); return true }
|
|
30
|
+
catch { return false }
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async function readJSONC(p) {
|
|
34
|
+
const raw = await readFile(p, "utf-8")
|
|
35
|
+
const stripped = raw.replace(/^\s*\/\/.*$/gm, "")
|
|
36
|
+
return JSON.parse(stripped)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function formatJSONC(obj) {
|
|
40
|
+
return JSON.stringify(obj, null, 2) + "\n"
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function mergePlugin(existing, spec) {
|
|
44
|
+
const plugins = existing.plugin ?? []
|
|
45
|
+
if (plugins.some((p) => (typeof p === "string" ? p : p[0]) === spec)) {
|
|
46
|
+
return false
|
|
47
|
+
}
|
|
48
|
+
existing.plugin = [...plugins, spec]
|
|
49
|
+
return true
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async function main() {
|
|
53
|
+
const dir = configDir()
|
|
54
|
+
await mkdir(dir, { recursive: true })
|
|
55
|
+
|
|
56
|
+
// ---- tui.jsonc ----
|
|
57
|
+
const tuiPath = join(dir, "tui.jsonc")
|
|
58
|
+
let tuiChanged = false
|
|
59
|
+
|
|
60
|
+
if (await exists(tuiPath)) {
|
|
61
|
+
const cfg = await readJSONC(tuiPath)
|
|
62
|
+
tuiChanged = mergePlugin(cfg, PLUGIN_SPEC)
|
|
63
|
+
if (tuiChanged) {
|
|
64
|
+
await writeFile(tuiPath, formatJSONC(cfg))
|
|
65
|
+
console.log(`[opencode-subagent-magazine] Added to ${tuiPath}`)
|
|
66
|
+
} else {
|
|
67
|
+
console.log(`[opencode-subagent-magazine] Already in ${tuiPath}`)
|
|
68
|
+
}
|
|
69
|
+
} else {
|
|
70
|
+
const cfg = {
|
|
71
|
+
$schema: "https://opencode.ai/tui.json",
|
|
72
|
+
plugin: [PLUGIN_SPEC],
|
|
73
|
+
}
|
|
74
|
+
await writeFile(tuiPath, formatJSONC(cfg))
|
|
75
|
+
console.log(`[opencode-subagent-magazine] Created ${tuiPath}`)
|
|
76
|
+
tuiChanged = true
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// ---- opencode.jsonc (forward compat) ----
|
|
80
|
+
const ocPath = join(dir, "opencode.jsonc")
|
|
81
|
+
let ocChanged = false
|
|
82
|
+
|
|
83
|
+
if (await exists(ocPath)) {
|
|
84
|
+
const cfg = await readJSONC(ocPath)
|
|
85
|
+
ocChanged = mergePlugin(cfg, PLUGIN_SPEC)
|
|
86
|
+
if (ocChanged) {
|
|
87
|
+
await writeFile(ocPath, formatJSONC(cfg))
|
|
88
|
+
console.log(`[opencode-subagent-magazine] Also added to ${ocPath}`)
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// ---- done ----
|
|
93
|
+
if (tuiChanged || ocChanged) {
|
|
94
|
+
console.log("\nDone! Restart OpenCode to see the SubAgent Monitor sidebar panel.")
|
|
95
|
+
} else {
|
|
96
|
+
console.log("\nAlready installed. Restart OpenCode if you haven't yet.")
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
main().catch((err) => {
|
|
101
|
+
console.error("Install failed:", err.message)
|
|
102
|
+
process.exit(1)
|
|
103
|
+
})
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "opencode-subagent-magazine",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "OpenCode TUI plugin monitoring sub-agent invocation status in real time",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
},
|
|
13
|
+
"./tui": {
|
|
14
|
+
"import": "./src/index.tsx",
|
|
15
|
+
"config": {
|
|
16
|
+
"enabled": true
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"src",
|
|
23
|
+
"install.mjs",
|
|
24
|
+
"README.md"
|
|
25
|
+
],
|
|
26
|
+
"bin": {
|
|
27
|
+
"opencode-subagent-magazine": "install.mjs"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "tsc",
|
|
31
|
+
"typecheck": "tsc --noEmit",
|
|
32
|
+
"version": "node -e \"require('fs').writeFileSync('src/_version.ts','// auto-generated\\nexport const PLUGIN_VERSION='+JSON.stringify(require('./package.json').version)+';\\n')\"",
|
|
33
|
+
"prepublishOnly": "tsc"
|
|
34
|
+
},
|
|
35
|
+
"keywords": [
|
|
36
|
+
"opencode",
|
|
37
|
+
"opencode-plugin",
|
|
38
|
+
"tui",
|
|
39
|
+
"subagent",
|
|
40
|
+
"subtask"
|
|
41
|
+
],
|
|
42
|
+
"license": "MIT",
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"@opencode-ai/plugin": ">=1.14.0",
|
|
45
|
+
"@opencode-ai/sdk": ">=1.14.0",
|
|
46
|
+
"@opentui/core": ">=0.2.0",
|
|
47
|
+
"@opentui/solid": ">=0.2.0",
|
|
48
|
+
"solid-js": ">=1.9.0"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@opencode-ai/plugin": "^1.14.50",
|
|
52
|
+
"@opencode-ai/sdk": "^1.14.50",
|
|
53
|
+
"tsx": "^4.22.3",
|
|
54
|
+
"typescript": "^5.8.0"
|
|
55
|
+
}
|
|
56
|
+
}
|
package/src/_version.ts
ADDED