@a5c-ai/babysitter-opencode 5.0.1-staging.e4f17eff → 5.0.1-staging.ef4e872c
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 +2 -2
- package/bin/cli.cjs +1 -191
- package/bin/cli.js +90 -49
- package/bin/install-shared.cjs +1 -478
- package/bin/install-shared.js +615 -0
- package/bin/install.cjs +1 -143
- package/bin/install.js +18 -98
- package/bin/uninstall.cjs +1 -87
- package/bin/uninstall.js +12 -34
- package/commands/doctor.md +5 -5
- package/commands/help.md +245 -244
- package/commands/observe.md +12 -12
- package/hooks/babysitter-proxied-session-created.js +18 -212
- package/hooks/babysitter-proxied-session-created.sh +11 -0
- package/hooks/babysitter-proxied-session-idle.js +18 -167
- package/hooks/babysitter-proxied-session-idle.sh +3 -0
- package/hooks/babysitter-proxied-shell-env.js +21 -145
- package/hooks/babysitter-proxied-shell-env.sh +3 -0
- package/hooks/babysitter-proxied-tool-execute-after.js +20 -160
- package/hooks/babysitter-proxied-tool-execute-after.sh +3 -0
- package/hooks/babysitter-proxied-tool-execute-before.js +20 -162
- package/hooks/babysitter-proxied-tool-execute-before.sh +3 -0
- package/hooks/hooks.json +18 -18
- package/package.json +22 -18
- package/plugin.json +6 -4
- package/scripts/team-install.js +23 -0
- package/skills/contrib/SKILL.md +25 -25
- package/skills/doctor/SKILL.md +5 -5
- package/skills/help/SKILL.md +3 -2
- package/skills/observe/SKILL.md +1 -1
- package/skills/plugins/SKILL.md +243 -243
- package/skills/project-install/SKILL.md +3 -3
- package/skills/resume/SKILL.md +1 -1
- package/skills/retrospect/SKILL.md +48 -48
- package/skills/user-install/SKILL.md +3 -3
- package/versions.json +2 -2
- package/hooks/hooks.json.legacy +0 -46
- package/hooks/proxied-hooks.json +0 -47
- package/hooks/session-created.js +0 -182
- package/hooks/session-idle.js +0 -124
- package/hooks/shell-env.js +0 -88
- package/hooks/tool-execute-after.js +0 -107
- package/hooks/tool-execute-before.js +0 -109
package/bin/install.cjs
CHANGED
|
@@ -1,146 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
* Babysitter OpenCode Plugin Installer
|
|
6
|
-
*
|
|
7
|
-
* Copies the babysitter plugin bundle into the OpenCode plugins directory:
|
|
8
|
-
* <workspace>/.opencode/plugins/babysitter/
|
|
9
|
-
*
|
|
10
|
-
* Registers hooks in OpenCode config, creates the index.js entry point
|
|
11
|
-
* for plugin discovery, and bootstraps the global process library.
|
|
12
|
-
*
|
|
13
|
-
* Usage:
|
|
14
|
-
* node install.cjs # Install into cwd workspace
|
|
15
|
-
* node install.cjs --workspace /path # Install into specified workspace
|
|
16
|
-
* node install.cjs --global # Global install (user home)
|
|
17
|
-
* node install.cjs --accomplish # Install only to Accomplish AI data dir
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
const path = require('path');
|
|
21
|
-
const {
|
|
22
|
-
copyPluginBundle,
|
|
23
|
-
ensureGlobalProcessLibrary,
|
|
24
|
-
ensureMarketplaceEntry,
|
|
25
|
-
getAccomplishOpenCodeHome,
|
|
26
|
-
getHomeMarketplacePath,
|
|
27
|
-
getHomePluginRoot,
|
|
28
|
-
getOpenCodeHome,
|
|
29
|
-
installAccomplishSurface,
|
|
30
|
-
installOpenCodeSurface,
|
|
31
|
-
isAccomplishInstalled,
|
|
32
|
-
writeIndexJs,
|
|
33
|
-
} = require('./install-shared.cjs');
|
|
34
|
-
|
|
35
|
-
const PACKAGE_ROOT = path.resolve(__dirname, '..');
|
|
36
|
-
|
|
37
|
-
function parseArgs(argv) {
|
|
38
|
-
let workspace = process.env.OPENCODE_WORKSPACE || process.cwd();
|
|
39
|
-
let accomplish = false;
|
|
40
|
-
for (let i = 2; i < argv.length; i += 1) {
|
|
41
|
-
const arg = argv[i];
|
|
42
|
-
if (arg === '--workspace') {
|
|
43
|
-
const next = argv[i + 1];
|
|
44
|
-
workspace = next && !next.startsWith('-') ? path.resolve(argv[++i]) : process.cwd();
|
|
45
|
-
continue;
|
|
46
|
-
}
|
|
47
|
-
if (arg === '--global') {
|
|
48
|
-
workspace = null;
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
if (arg === '--accomplish') {
|
|
52
|
-
accomplish = true;
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
throw new Error(`unknown argument: ${arg}`);
|
|
56
|
-
}
|
|
57
|
-
return { workspace, accomplish };
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function installStandardOpenCode(workspace) {
|
|
61
|
-
const openCodeHome = getOpenCodeHome(workspace);
|
|
62
|
-
const pluginRoot = getHomePluginRoot(workspace);
|
|
63
|
-
const marketplacePath = getHomeMarketplacePath(workspace);
|
|
64
|
-
|
|
65
|
-
console.log(`[babysitter] Installing OpenCode plugin to ${pluginRoot}`);
|
|
66
|
-
|
|
67
|
-
// 1. Copy plugin bundle
|
|
68
|
-
copyPluginBundle(PACKAGE_ROOT, pluginRoot);
|
|
69
|
-
console.log('[babysitter] Copied plugin bundle');
|
|
70
|
-
|
|
71
|
-
// 2. Write index.js entry point for OpenCode plugin discovery
|
|
72
|
-
writeIndexJs(pluginRoot);
|
|
73
|
-
console.log('[babysitter] Created index.js entry point');
|
|
74
|
-
|
|
75
|
-
// 3. Register in marketplace
|
|
76
|
-
ensureMarketplaceEntry(marketplacePath, pluginRoot);
|
|
77
|
-
console.log(`[babysitter] Marketplace: ${marketplacePath}`);
|
|
78
|
-
|
|
79
|
-
// 4. Install OpenCode surfaces (skills, hooks config)
|
|
80
|
-
installOpenCodeSurface(PACKAGE_ROOT, openCodeHome);
|
|
81
|
-
console.log('[babysitter] Installed hooks and skills');
|
|
82
|
-
|
|
83
|
-
// 5. Bootstrap global process library
|
|
84
|
-
try {
|
|
85
|
-
const active = ensureGlobalProcessLibrary(PACKAGE_ROOT);
|
|
86
|
-
console.log(`[babysitter] Process library: ${active.binding?.dir || '(default)'}`);
|
|
87
|
-
if (active.defaultSpec?.cloneDir) {
|
|
88
|
-
console.log(`[babysitter] Process library clone: ${active.defaultSpec.cloneDir}`);
|
|
89
|
-
}
|
|
90
|
-
console.log(`[babysitter] Process library state: ${active.stateFile}`);
|
|
91
|
-
} catch (err) {
|
|
92
|
-
console.warn(`[babysitter] Warning: Could not bootstrap process library: ${err.message}`);
|
|
93
|
-
console.warn('[babysitter] Run "babysitter process-library:clone" manually if needed.');
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function installToAccomplish() {
|
|
98
|
-
const accomplishHome = getAccomplishOpenCodeHome();
|
|
99
|
-
console.log(`[babysitter] Installing plugin to Accomplish AI: ${accomplishHome}`);
|
|
100
|
-
|
|
101
|
-
installAccomplishSurface(PACKAGE_ROOT, accomplishHome);
|
|
102
|
-
|
|
103
|
-
console.log('[babysitter] Copied plugin bundle to Accomplish');
|
|
104
|
-
console.log('[babysitter] Created index.js entry point for Accomplish');
|
|
105
|
-
console.log('[babysitter] Installed hooks and skills for Accomplish');
|
|
106
|
-
console.log('[babysitter] Accomplish AI installation complete.');
|
|
107
|
-
console.log('[babysitter] Restart Accomplish to pick up the installed plugin.');
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
function main() {
|
|
111
|
-
const { workspace, accomplish } = parseArgs(process.argv);
|
|
112
|
-
|
|
113
|
-
try {
|
|
114
|
-
// If --accomplish is used without --global/--workspace, install only to Accomplish
|
|
115
|
-
if (accomplish && workspace !== null) {
|
|
116
|
-
installToAccomplish();
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// Standard OpenCode install
|
|
121
|
-
installStandardOpenCode(workspace);
|
|
122
|
-
|
|
123
|
-
// Auto-detect Accomplish and install there too (unless --accomplish was explicit)
|
|
124
|
-
if (!accomplish) {
|
|
125
|
-
try {
|
|
126
|
-
if (isAccomplishInstalled()) {
|
|
127
|
-
console.log('[babysitter] Detected Accomplish AI installation.');
|
|
128
|
-
installToAccomplish();
|
|
129
|
-
}
|
|
130
|
-
} catch (err) {
|
|
131
|
-
console.warn(`[babysitter] Warning: Accomplish AI detection failed: ${err.message}`);
|
|
132
|
-
}
|
|
133
|
-
} else {
|
|
134
|
-
// --accomplish combined with --global: install to both
|
|
135
|
-
installToAccomplish();
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
console.log('[babysitter] Installation complete!');
|
|
139
|
-
console.log('[babysitter] Restart OpenCode to pick up the installed plugin.');
|
|
140
|
-
} catch (err) {
|
|
141
|
-
console.error(`[babysitter] Failed to install plugin: ${err.message}`);
|
|
142
|
-
process.exitCode = 1;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
main();
|
|
4
|
+
require('./install.js');
|
package/bin/install.js
CHANGED
|
@@ -1,110 +1,30 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
* Babysitter OpenCode Plugin Installer
|
|
4
|
-
*
|
|
5
|
-
* Copies plugin files into the OpenCode plugins directory:
|
|
6
|
-
* .opencode/plugins/babysitter/
|
|
7
|
-
*
|
|
8
|
-
* OpenCode discovers plugins as JS/TS modules in .opencode/plugins/.
|
|
9
|
-
* This installer creates the necessary directory structure and copies
|
|
10
|
-
* hook scripts, skills, and an index.js entry point.
|
|
11
|
-
*/
|
|
2
|
+
'use strict';
|
|
12
3
|
|
|
13
|
-
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const shared = require('./install-shared');
|
|
14
6
|
|
|
15
|
-
const
|
|
16
|
-
const path = require("path");
|
|
17
|
-
|
|
18
|
-
const PLUGIN_ROOT = path.resolve(__dirname, "..");
|
|
19
|
-
const WORKSPACE = process.env.OPENCODE_WORKSPACE || process.cwd();
|
|
20
|
-
const TARGET_DIR = path.join(WORKSPACE, ".opencode", "plugins", "babysitter");
|
|
21
|
-
|
|
22
|
-
function copyRecursive(src, dest) {
|
|
23
|
-
const stat = fs.statSync(src);
|
|
24
|
-
if (stat.isDirectory()) {
|
|
25
|
-
fs.mkdirSync(dest, { recursive: true });
|
|
26
|
-
for (const entry of fs.readdirSync(src)) {
|
|
27
|
-
copyRecursive(path.join(src, entry), path.join(dest, entry));
|
|
28
|
-
}
|
|
29
|
-
} else {
|
|
30
|
-
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
|
31
|
-
fs.copyFileSync(src, dest);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
7
|
+
const PACKAGE_ROOT = path.resolve(__dirname, '..');
|
|
34
8
|
|
|
35
9
|
function main() {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
console.log(` Target: ${TARGET_DIR}`);
|
|
10
|
+
const pluginRoot = shared.getHomePluginRoot();
|
|
11
|
+
const marketplacePath = shared.getHomeMarketplacePath();
|
|
39
12
|
|
|
40
|
-
|
|
41
|
-
fs.mkdirSync(TARGET_DIR, { recursive: true });
|
|
13
|
+
console.log(`[${shared.PLUGIN_NAME}] Installing plugin to ${pluginRoot}`);
|
|
42
14
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// Copy skills
|
|
51
|
-
const skillsDir = path.join(PLUGIN_ROOT, "skills");
|
|
52
|
-
if (fs.existsSync(skillsDir)) {
|
|
53
|
-
copyRecursive(skillsDir, path.join(TARGET_DIR, "skills"));
|
|
54
|
-
console.log(" Copied skills/");
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// Copy commands
|
|
58
|
-
const commandsDir = path.join(PLUGIN_ROOT, "commands");
|
|
59
|
-
if (fs.existsSync(commandsDir)) {
|
|
60
|
-
copyRecursive(commandsDir, path.join(TARGET_DIR, "commands"));
|
|
61
|
-
console.log(" Copied commands/");
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Copy plugin.json and versions.json
|
|
65
|
-
for (const file of ["plugin.json", "versions.json"]) {
|
|
66
|
-
const src = path.join(PLUGIN_ROOT, file);
|
|
67
|
-
if (fs.existsSync(src)) {
|
|
68
|
-
fs.copyFileSync(src, path.join(TARGET_DIR, file));
|
|
69
|
-
console.log(` Copied ${file}`);
|
|
15
|
+
try {
|
|
16
|
+
shared.copyPluginBundle(PACKAGE_ROOT, pluginRoot);
|
|
17
|
+
shared.ensureMarketplaceEntry(marketplacePath, pluginRoot);
|
|
18
|
+
if (typeof shared.harnessInstall === 'function') {
|
|
19
|
+
shared.harnessInstall(PACKAGE_ROOT, pluginRoot);
|
|
70
20
|
}
|
|
21
|
+
shared.runPostInstall && shared.runPostInstall(pluginRoot);
|
|
22
|
+
console.log(`[${shared.PLUGIN_NAME}] Installation complete!`);
|
|
23
|
+
console.log(`[${shared.PLUGIN_NAME}] Restart your IDE/CLI to pick up the plugin.`);
|
|
24
|
+
} catch (err) {
|
|
25
|
+
console.error(`[${shared.PLUGIN_NAME}] Failed to install: ${err.message}`);
|
|
26
|
+
process.exitCode = 1;
|
|
71
27
|
}
|
|
72
|
-
|
|
73
|
-
// Create index.js entry point for OpenCode plugin discovery
|
|
74
|
-
const indexContent = `#!/usr/bin/env node
|
|
75
|
-
/**
|
|
76
|
-
* Babysitter plugin entry point for OpenCode.
|
|
77
|
-
*
|
|
78
|
-
* OpenCode discovers plugins by looking for JS/TS modules in
|
|
79
|
-
* .opencode/plugins/. This file registers the babysitter hooks
|
|
80
|
-
* with the OpenCode plugin system.
|
|
81
|
-
*/
|
|
82
|
-
|
|
83
|
-
"use strict";
|
|
84
|
-
|
|
85
|
-
const path = require("path");
|
|
86
|
-
|
|
87
|
-
const PLUGIN_DIR = __dirname;
|
|
88
|
-
|
|
89
|
-
module.exports = {
|
|
90
|
-
name: "babysitter",
|
|
91
|
-
version: require(path.join(PLUGIN_DIR, "plugin.json")).version,
|
|
92
|
-
|
|
93
|
-
hooks: {
|
|
94
|
-
"session.created": require(path.join(PLUGIN_DIR, "hooks", "session-created.js")),
|
|
95
|
-
"session.idle": require(path.join(PLUGIN_DIR, "hooks", "session-idle.js")),
|
|
96
|
-
"shell.env": require(path.join(PLUGIN_DIR, "hooks", "shell-env.js")),
|
|
97
|
-
"tool.execute.before": require(path.join(PLUGIN_DIR, "hooks", "tool-execute-before.js")),
|
|
98
|
-
"tool.execute.after": require(path.join(PLUGIN_DIR, "hooks", "tool-execute-after.js")),
|
|
99
|
-
},
|
|
100
|
-
};
|
|
101
|
-
`;
|
|
102
|
-
|
|
103
|
-
fs.writeFileSync(path.join(TARGET_DIR, "index.js"), indexContent);
|
|
104
|
-
console.log(" Created index.js");
|
|
105
|
-
|
|
106
|
-
console.log(`\nBabysitter plugin installed to ${TARGET_DIR}`);
|
|
107
|
-
console.log("Restart OpenCode to activate the plugin.");
|
|
108
28
|
}
|
|
109
29
|
|
|
110
30
|
main();
|
package/bin/uninstall.cjs
CHANGED
|
@@ -1,90 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
* Babysitter OpenCode Plugin Uninstaller
|
|
6
|
-
*
|
|
7
|
-
* Removes the babysitter plugin from the OpenCode plugins directory
|
|
8
|
-
* and cleans up hooks config and marketplace entries.
|
|
9
|
-
*
|
|
10
|
-
* Usage:
|
|
11
|
-
* node uninstall.cjs # Uninstall from cwd workspace
|
|
12
|
-
* node uninstall.cjs --workspace /path # Uninstall from specified workspace
|
|
13
|
-
* node uninstall.cjs --global # Global uninstall
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
const fs = require('fs');
|
|
17
|
-
const path = require('path');
|
|
18
|
-
const {
|
|
19
|
-
getHomeMarketplacePath,
|
|
20
|
-
getHomePluginRoot,
|
|
21
|
-
getOpenCodeHome,
|
|
22
|
-
removeManagedHooks,
|
|
23
|
-
removeMarketplaceEntry,
|
|
24
|
-
} = require('./install-shared.cjs');
|
|
25
|
-
|
|
26
|
-
function parseArgs(argv) {
|
|
27
|
-
let workspace = process.env.OPENCODE_WORKSPACE || process.cwd();
|
|
28
|
-
for (let i = 2; i < argv.length; i += 1) {
|
|
29
|
-
const arg = argv[i];
|
|
30
|
-
if (arg === '--workspace') {
|
|
31
|
-
const next = argv[i + 1];
|
|
32
|
-
workspace = next && !next.startsWith('-') ? path.resolve(argv[++i]) : process.cwd();
|
|
33
|
-
continue;
|
|
34
|
-
}
|
|
35
|
-
if (arg === '--global') {
|
|
36
|
-
workspace = null;
|
|
37
|
-
continue;
|
|
38
|
-
}
|
|
39
|
-
throw new Error(`unknown argument: ${arg}`);
|
|
40
|
-
}
|
|
41
|
-
return { workspace };
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function main() {
|
|
45
|
-
const { workspace } = parseArgs(process.argv);
|
|
46
|
-
const openCodeHome = getOpenCodeHome(workspace);
|
|
47
|
-
const pluginRoot = getHomePluginRoot(workspace);
|
|
48
|
-
const marketplacePath = getHomeMarketplacePath(workspace);
|
|
49
|
-
let removedPlugin = false;
|
|
50
|
-
|
|
51
|
-
console.log(`[babysitter] Uninstalling OpenCode plugin from ${pluginRoot}`);
|
|
52
|
-
|
|
53
|
-
// 1. Remove plugin directory
|
|
54
|
-
if (fs.existsSync(pluginRoot)) {
|
|
55
|
-
try {
|
|
56
|
-
fs.rmSync(pluginRoot, { recursive: true, force: true });
|
|
57
|
-
console.log(`[babysitter] Removed ${pluginRoot}`);
|
|
58
|
-
removedPlugin = true;
|
|
59
|
-
} catch (err) {
|
|
60
|
-
console.warn(`[babysitter] Warning: Could not remove plugin directory: ${err.message}`);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// 2. Remove marketplace entry
|
|
65
|
-
removeMarketplaceEntry(marketplacePath);
|
|
66
|
-
console.log('[babysitter] Cleaned marketplace entry');
|
|
67
|
-
|
|
68
|
-
// 3. Remove managed hooks from OpenCode config
|
|
69
|
-
removeManagedHooks(openCodeHome);
|
|
70
|
-
console.log('[babysitter] Cleaned hooks config');
|
|
71
|
-
|
|
72
|
-
// 4. Clean up empty parent directories
|
|
73
|
-
const pluginsDir = path.dirname(pluginRoot);
|
|
74
|
-
try {
|
|
75
|
-
const remaining = fs.readdirSync(pluginsDir);
|
|
76
|
-
if (remaining.length === 0) {
|
|
77
|
-
fs.rmdirSync(pluginsDir);
|
|
78
|
-
console.log('[babysitter] Removed empty plugins/ directory');
|
|
79
|
-
}
|
|
80
|
-
} catch { /* best-effort */ }
|
|
81
|
-
|
|
82
|
-
if (!removedPlugin) {
|
|
83
|
-
console.log('[babysitter] Plugin directory not found; config and hooks cleaned if present.');
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
console.log('[babysitter] Uninstallation complete. Restart OpenCode to finish removal.');
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
main();
|
|
4
|
+
require('./uninstall.js');
|
package/bin/uninstall.js
CHANGED
|
@@ -1,46 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
* Babysitter OpenCode Plugin Uninstaller
|
|
4
|
-
*
|
|
5
|
-
* Removes the babysitter plugin from the OpenCode plugins directory.
|
|
6
|
-
*/
|
|
2
|
+
'use strict';
|
|
7
3
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const fs = require("fs");
|
|
11
|
-
const path = require("path");
|
|
12
|
-
|
|
13
|
-
const WORKSPACE = process.env.OPENCODE_WORKSPACE || process.cwd();
|
|
14
|
-
const TARGET_DIR = path.join(WORKSPACE, ".opencode", "plugins", "babysitter");
|
|
15
|
-
|
|
16
|
-
function removeRecursive(dir) {
|
|
17
|
-
if (!fs.existsSync(dir)) return;
|
|
18
|
-
fs.rmSync(dir, { recursive: true, force: true });
|
|
19
|
-
}
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const shared = require('./install-shared');
|
|
20
6
|
|
|
21
7
|
function main() {
|
|
22
|
-
|
|
23
|
-
console.log(` Target: ${TARGET_DIR}`);
|
|
8
|
+
const pluginRoot = shared.getHomePluginRoot();
|
|
24
9
|
|
|
25
|
-
if (!fs.existsSync(
|
|
26
|
-
console.log(
|
|
10
|
+
if (!fs.existsSync(pluginRoot)) {
|
|
11
|
+
console.log(`[${shared.PLUGIN_NAME}] Plugin not installed at ${pluginRoot}`);
|
|
27
12
|
return;
|
|
28
13
|
}
|
|
29
14
|
|
|
30
|
-
removeRecursive(TARGET_DIR);
|
|
31
|
-
console.log(" Removed babysitter plugin directory.");
|
|
32
|
-
|
|
33
|
-
// Clean up empty parent directories
|
|
34
|
-
const pluginsDir = path.join(WORKSPACE, ".opencode", "plugins");
|
|
35
15
|
try {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
console.log("\nBabysitter plugin uninstalled. Restart OpenCode to complete removal.");
|
|
16
|
+
fs.rmSync(pluginRoot, { recursive: true, force: true });
|
|
17
|
+
console.log(`[${shared.PLUGIN_NAME}] Uninstalled from ${pluginRoot}`);
|
|
18
|
+
} catch (err) {
|
|
19
|
+
console.error(`[${shared.PLUGIN_NAME}] Failed to uninstall: ${err.message}`);
|
|
20
|
+
process.exitCode = 1;
|
|
21
|
+
}
|
|
44
22
|
}
|
|
45
23
|
|
|
46
24
|
main();
|
package/commands/doctor.md
CHANGED
|
@@ -362,13 +362,13 @@ Mark as FAIL if:
|
|
|
362
362
|
- Parse the output and inspect the `resolvedFrom` field. Classify as follows:
|
|
363
363
|
- `resolvedFrom: "pid-marker"` → mark as PASS ("Session ID derives from the live Claude Code ancestor process -- authoritative").
|
|
364
364
|
- `resolvedFrom: "env-file"` → mark as PASS with a note ("CLAUDE_ENV_FILE was used; typically healthy").
|
|
365
|
-
- `resolvedFrom: "env-var"` → mark as WARN ("`
|
|
366
|
-
- Remediation: run `babysitter session:cleanup` and start a fresh Claude Code session, or `unset
|
|
365
|
+
- `resolvedFrom: "env-var"` → mark as WARN ("`AGENT_SESSION_ID` is set without a corroborating PID marker. Likely stale from a prior Claude Code session -- see GitHub issue #130").
|
|
366
|
+
- Remediation: run `babysitter session:cleanup` and start a fresh Claude Code session, or `unset AGENT_SESSION_ID` before invoking babysitter.
|
|
367
367
|
- `resolvedFrom: "none"` → mark as ERROR ("No session ID resolvable. Either no session-start hook fired, or the ancestor walk failed").
|
|
368
368
|
|
|
369
369
|
**Env-var shadow check:**
|
|
370
370
|
- Independently inspect `envVarPresent` and `envVarMatches` in the output.
|
|
371
|
-
- If `envVarPresent && !envVarMatches`, mark as WARN ("`
|
|
371
|
+
- If `envVarPresent && !envVarMatches`, mark as WARN ("`AGENT_SESSION_ID` in env does not match the resolved session ID; a stale value is shadowing the authoritative one. Unset the env var").
|
|
372
372
|
|
|
373
373
|
---
|
|
374
374
|
|
|
@@ -390,7 +390,7 @@ Mark as FAIL if:
|
|
|
390
390
|
|
|
391
391
|
- Enumerate files in `~/.a5c/` matching the pattern `current-session-*-pid-*`.
|
|
392
392
|
- Count markers per harness (derived from the filename).
|
|
393
|
-
- If more than one live marker exists for the same harness, mark as INFO ("Multiple live Claude Code / harness sessions detected; ensure each shell scopes `
|
|
393
|
+
- If more than one live marker exists for the same harness, mark as INFO ("Multiple live Claude Code / harness sessions detected; ensure each shell scopes `AGENT_SESSION_ID` appropriately -- the PID marker handles this automatically").
|
|
394
394
|
- Otherwise mark as PASS.
|
|
395
395
|
|
|
396
396
|
---
|
|
@@ -501,7 +501,7 @@ babysitter session:cleanup --dry-run # preview
|
|
|
501
501
|
babysitter session:cleanup # apply
|
|
502
502
|
|
|
503
503
|
# 2. Unset a stale env var
|
|
504
|
-
unset
|
|
504
|
+
unset AGENT_SESSION_ID
|
|
505
505
|
|
|
506
506
|
# 3. Re-bind a run explicitly if needed
|
|
507
507
|
babysitter session:resume --session-id <fresh-id> --state-dir ~/.a5c --run-id <runId> --runs-dir .a5c/runs
|