vibeostheog 0.25.13 → 0.25.14
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/CHANGELOG.md +4 -0
- package/package.json +1 -1
- package/scripts/deploy.mjs +71 -40
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vibeostheog",
|
|
3
|
-
"version": "0.25.
|
|
3
|
+
"version": "0.25.14",
|
|
4
4
|
"description": "Cost-aware delegation enforcer for OpenCode. Tracks model usage, routes Task subagents to cheaper tiers, surfaces cumulative savings in chat. Includes research audit, reporting framework, project memory, progressive scratchpad decadence, and trinity CLI for brain/medium/cheap slot switching.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"release": "node scripts/release.mjs",
|
package/scripts/deploy.mjs
CHANGED
|
@@ -10,9 +10,29 @@ const ROOT = join(__dirname, "..")
|
|
|
10
10
|
|
|
11
11
|
const bundlePath = join(ROOT, "dist", "vibeOS.js")
|
|
12
12
|
const assetsPath = join(ROOT, "dist", "assets")
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
13
|
+
|
|
14
|
+
function resolveOpenCodeHomes() {
|
|
15
|
+
const override = process.env.VIBEOS_OPENCODE_HOME
|
|
16
|
+
if (override) return [override]
|
|
17
|
+
const base = homedir()
|
|
18
|
+
const configHome = join(base, ".config", "opencode")
|
|
19
|
+
const dotHome = join(base, ".opencode")
|
|
20
|
+
const roots = [configHome, dotHome]
|
|
21
|
+
const existing = roots.filter((dir) => {
|
|
22
|
+
try {
|
|
23
|
+
const oc = readFileSync(join(dir, "opencode.json"), "utf8")
|
|
24
|
+
return Boolean(String(oc || "").trim())
|
|
25
|
+
} catch {
|
|
26
|
+
try {
|
|
27
|
+
const oc = readFileSync(join(dir, "opencode.jsonc"), "utf8")
|
|
28
|
+
return Boolean(String(oc || "").trim())
|
|
29
|
+
} catch {
|
|
30
|
+
return false
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
return Array.from(new Set(existing.length > 0 ? existing : roots))
|
|
35
|
+
}
|
|
16
36
|
|
|
17
37
|
if (!existsSync(bundlePath)) {
|
|
18
38
|
process.stderr.write("[vibeOS deploy] ERROR: dist/vibeOS.js not found\n")
|
|
@@ -20,38 +40,47 @@ if (!existsSync(bundlePath)) {
|
|
|
20
40
|
}
|
|
21
41
|
|
|
22
42
|
try {
|
|
23
|
-
if (!existsSync(pluginDir)) {
|
|
24
|
-
mkdirSync(pluginDir, { recursive: true })
|
|
25
|
-
}
|
|
26
43
|
const bundle = readFileSync(bundlePath)
|
|
27
|
-
|
|
28
|
-
|
|
44
|
+
for (const home of resolveOpenCodeHomes()) {
|
|
45
|
+
const pluginDir = join(home, "plugins")
|
|
46
|
+
const destPath = join(pluginDir, "vibeOS.js")
|
|
47
|
+
const destAssets = join(pluginDir, "assets")
|
|
29
48
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
49
|
+
if (!existsSync(pluginDir)) {
|
|
50
|
+
mkdirSync(pluginDir, { recursive: true })
|
|
51
|
+
}
|
|
52
|
+
writeFileSync(destPath, bundle)
|
|
53
|
+
process.stderr.write(`[vibeOS deploy] dist/vibeOS.js -> ${home}/plugins/vibeOS.js (${bundle.length} bytes)\n`)
|
|
34
54
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
55
|
+
if (existsSync(assetsPath)) {
|
|
56
|
+
cpSync(assetsPath, destAssets, { recursive: true, force: true })
|
|
57
|
+
process.stderr.write(`[vibeOS deploy] dist/assets/ -> ${home}/plugins/assets/\n`)
|
|
38
58
|
}
|
|
59
|
+
|
|
60
|
+
for (const staleDir of [join(pluginDir, "lib"), join(pluginDir, "utils"), join(pluginDir, "vibeOS-lib"), join(pluginDir, "vibeOS-api-server"), join(pluginDir, "dashboard", "dist")]) {
|
|
61
|
+
if (existsSync(staleDir)) {
|
|
62
|
+
rmSync(staleDir, { recursive: true, force: true })
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const rmTsRecursive = (d) => { for (const e of readdirSync(d)) { const f = join(d, e); if (statSync(f).isDirectory()) rmTsRecursive(f); else if (e.endsWith('.ts')) { rmSync(f); } } }
|
|
66
|
+
rmTsRecursive(pluginDir)
|
|
67
|
+
process.stderr.write(`[vibeOS deploy] Stripped .ts files from ${home}/plugins\n`)
|
|
39
68
|
}
|
|
40
|
-
const rmTsRecursive = (d) => { for (const e of readdirSync(d)) { const f = join(d, e); if (statSync(f).isDirectory()) rmTsRecursive(f); else if (e.endsWith('.ts')) { rmSync(f); } } }
|
|
41
|
-
rmTsRecursive(pluginDir)
|
|
42
|
-
process.stderr.write(`[vibeOS deploy] Stripped .ts files from plugin dir\n`)
|
|
43
69
|
|
|
44
70
|
const envSrc = join(ROOT, ".env.production")
|
|
45
71
|
if (existsSync(envSrc)) {
|
|
46
72
|
const envContent = readFileSync(envSrc)
|
|
47
|
-
const pluginEnvDest = join(pluginDir, ".env.production")
|
|
48
73
|
const homeEnvDir = join(homedir(), ".claude")
|
|
49
74
|
const homeEnvDest = join(homeEnvDir, ".env.production")
|
|
50
75
|
|
|
51
76
|
mkdirSync(homeEnvDir, { recursive: true })
|
|
52
|
-
writeFileSync(pluginEnvDest, envContent)
|
|
53
77
|
writeFileSync(homeEnvDest, envContent)
|
|
54
|
-
|
|
78
|
+
for (const home of resolveOpenCodeHomes()) {
|
|
79
|
+
const pluginEnvDest = join(home, "plugins", ".env.production")
|
|
80
|
+
mkdirSync(join(home, "plugins"), { recursive: true })
|
|
81
|
+
writeFileSync(pluginEnvDest, envContent)
|
|
82
|
+
}
|
|
83
|
+
process.stderr.write(`[vibeOS deploy] Synced .env.production to plugin dirs and ~/.claude\n`)
|
|
55
84
|
}
|
|
56
85
|
|
|
57
86
|
// ── Install nightly pricing sync cron if not already present ──
|
|
@@ -85,26 +114,28 @@ try {
|
|
|
85
114
|
|
|
86
115
|
// Auto-register in opencode.json so OpenCode loads the plugin
|
|
87
116
|
try {
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
117
|
+
for (const home of resolveOpenCodeHomes()) {
|
|
118
|
+
const ocConfigPath = join(home, "opencode.json")
|
|
119
|
+
mkdirSync(dirname(ocConfigPath), { recursive: true })
|
|
120
|
+
let config = {}
|
|
121
|
+
if (existsSync(ocConfigPath)) {
|
|
122
|
+
const raw = readFileSync(ocConfigPath, "utf-8")
|
|
123
|
+
try {
|
|
124
|
+
const cleaned = raw.replace(/\/\/.*$/gm, "").replace(/\/\*[\s\S]*?\*\//g, "")
|
|
125
|
+
config = JSON.parse(cleaned)
|
|
126
|
+
} catch {
|
|
127
|
+
config = {}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (!config || typeof config !== "object" || Array.isArray(config)) config = {}
|
|
131
|
+
if (!Array.isArray(config.plugin)) config.plugin = []
|
|
132
|
+
const hasVibeOs = config.plugin.some(p => typeof p === "string" && p.includes("vibeOS"))
|
|
133
|
+
if (!hasVibeOs) {
|
|
134
|
+
config.$schema ||= "https://opencode.ai/config.json"
|
|
135
|
+
config.plugin.push("./plugins/vibeOS.js")
|
|
136
|
+
writeFileSync(ocConfigPath, JSON.stringify(config, null, 2) + "\n")
|
|
137
|
+
process.stderr.write(`[vibeOS deploy] Registered vibeOS in ${home}/opencode.json\n`)
|
|
98
138
|
}
|
|
99
|
-
}
|
|
100
|
-
if (!config || typeof config !== "object" || Array.isArray(config)) config = {}
|
|
101
|
-
if (!Array.isArray(config.plugin)) config.plugin = []
|
|
102
|
-
const hasVibeOs = config.plugin.some(p => typeof p === "string" && p.includes("vibeOS"))
|
|
103
|
-
if (!hasVibeOs) {
|
|
104
|
-
config.$schema ||= "https://opencode.ai/config.json"
|
|
105
|
-
config.plugin.push("./plugins/vibeOS.js")
|
|
106
|
-
writeFileSync(ocConfigPath, JSON.stringify(config, null, 2) + "\n")
|
|
107
|
-
process.stderr.write("[vibeOS deploy] Registered vibeOS in opencode.json\n")
|
|
108
139
|
}
|
|
109
140
|
} catch {
|
|
110
141
|
process.stderr.write("[vibeOS deploy] Could not auto-register in opencode.json (plugin may need manual config)\n")
|