@a5c-ai/babysitter-github 5.0.1-staging.92b6f9ae → 5.0.1-staging.ae07dd8d
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/bin/install-shared.js +67 -1
- package/bin/install.js +9 -0
- package/bin/uninstall.js +25 -4
- package/package.json +2 -2
- package/plugin.json +1 -1
- package/versions.json +1 -1
package/bin/install-shared.js
CHANGED
|
@@ -454,6 +454,70 @@ function installManagedHooks(packageRoot, copilotHome) {
|
|
|
454
454
|
mergeManagedHooksConfig(packageRoot, copilotHome);
|
|
455
455
|
}
|
|
456
456
|
|
|
457
|
+
function filterManagedHookEntries(eventHooks) {
|
|
458
|
+
if (!Array.isArray(eventHooks)) {
|
|
459
|
+
return [];
|
|
460
|
+
}
|
|
461
|
+
const allScriptNames = [...LEGACY_HOOK_SCRIPT_NAMES, ...HOOK_SCRIPT_NAMES];
|
|
462
|
+
|
|
463
|
+
return eventHooks
|
|
464
|
+
.map((entry) => {
|
|
465
|
+
if (!entry || typeof entry !== 'object') {
|
|
466
|
+
return null;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
if (Array.isArray(entry.hooks)) {
|
|
470
|
+
const keptHooks = entry.hooks.filter((hook) => {
|
|
471
|
+
const command = String(hook && hook.command || '');
|
|
472
|
+
return !allScriptNames.some((name) => command.includes(name));
|
|
473
|
+
});
|
|
474
|
+
return keptHooks.length > 0 ? { ...entry, hooks: keptHooks } : null;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
const bash = String(entry.bash || entry.command || '');
|
|
478
|
+
const ps = String(entry.powershell || '');
|
|
479
|
+
return allScriptNames.some((name) => bash.includes(name) || ps.includes(name))
|
|
480
|
+
? null
|
|
481
|
+
: entry;
|
|
482
|
+
})
|
|
483
|
+
.filter(Boolean);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
function removeManagedHooks(copilotHome) {
|
|
487
|
+
for (const hookName of [...LEGACY_HOOK_SCRIPT_NAMES, ...HOOK_SCRIPT_NAMES]) {
|
|
488
|
+
fs.rmSync(path.join(copilotHome, 'hooks', hookName), { force: true });
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
const hooksConfigPath = path.join(copilotHome, 'hooks.json');
|
|
492
|
+
if (!fs.existsSync(hooksConfigPath)) {
|
|
493
|
+
return;
|
|
494
|
+
}
|
|
495
|
+
let hooksConfig;
|
|
496
|
+
try {
|
|
497
|
+
hooksConfig = readJson(hooksConfigPath);
|
|
498
|
+
} catch {
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
501
|
+
if (!hooksConfig.hooks || typeof hooksConfig.hooks !== 'object') {
|
|
502
|
+
return;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
for (const eventName of ['SessionStart', 'UserPromptSubmit', 'Stop', 'sessionStart', 'sessionEnd', 'userPromptSubmitted']) {
|
|
506
|
+
const filteredEntries = filterManagedHookEntries(hooksConfig.hooks[eventName]);
|
|
507
|
+
if (filteredEntries.length > 0) {
|
|
508
|
+
hooksConfig.hooks[eventName] = filteredEntries;
|
|
509
|
+
} else {
|
|
510
|
+
delete hooksConfig.hooks[eventName];
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
if (Object.keys(hooksConfig.hooks).length === 0) {
|
|
515
|
+
fs.rmSync(hooksConfigPath, { force: true });
|
|
516
|
+
} else {
|
|
517
|
+
writeJson(hooksConfigPath, hooksConfig);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
|
|
457
521
|
function removeLegacyHooks(copilotHome) {
|
|
458
522
|
for (const hookName of LEGACY_HOOK_SCRIPT_NAMES) {
|
|
459
523
|
fs.rmSync(path.join(copilotHome, 'hooks', hookName), { force: true });
|
|
@@ -498,7 +562,7 @@ function removeLegacyHooks(copilotHome) {
|
|
|
498
562
|
}
|
|
499
563
|
|
|
500
564
|
function installCopilotSurface(packageRoot, copilotHome) {
|
|
501
|
-
|
|
565
|
+
removeManagedHooks(copilotHome);
|
|
502
566
|
installManagedSkills(packageRoot, copilotHome);
|
|
503
567
|
installManagedHooks(packageRoot, copilotHome);
|
|
504
568
|
}
|
|
@@ -852,6 +916,8 @@ module.exports = {
|
|
|
852
916
|
installManagedSkills,
|
|
853
917
|
mergeManagedHooksConfig,
|
|
854
918
|
installManagedHooks,
|
|
919
|
+
filterManagedHookEntries,
|
|
920
|
+
removeManagedHooks,
|
|
855
921
|
removeLegacyHooks,
|
|
856
922
|
installCopilotSurface,
|
|
857
923
|
renderCloudAgentAgentsBlock,
|
package/bin/install.js
CHANGED
|
@@ -65,6 +65,15 @@ function main() {
|
|
|
65
65
|
try {
|
|
66
66
|
shared.copyPluginBundle(PACKAGE_ROOT, pluginRoot);
|
|
67
67
|
shared.ensureMarketplaceEntry(marketplacePath, pluginRoot);
|
|
68
|
+
if (typeof shared.registerCopilotPlugin === 'function') {
|
|
69
|
+
shared.registerCopilotPlugin(pluginRoot);
|
|
70
|
+
}
|
|
71
|
+
if (typeof shared.installCopilotSurface === 'function' && typeof shared.getCopilotHome === 'function') {
|
|
72
|
+
shared.installCopilotSurface(PACKAGE_ROOT, shared.getCopilotHome());
|
|
73
|
+
}
|
|
74
|
+
if (typeof shared.warnWindowsHooks === 'function') {
|
|
75
|
+
shared.warnWindowsHooks();
|
|
76
|
+
}
|
|
68
77
|
if (typeof shared.harnessInstall === 'function') {
|
|
69
78
|
shared.harnessInstall(PACKAGE_ROOT, pluginRoot);
|
|
70
79
|
}
|
package/bin/uninstall.js
CHANGED
|
@@ -7,17 +7,38 @@ const shared = require('./install-shared');
|
|
|
7
7
|
|
|
8
8
|
function main() {
|
|
9
9
|
const pluginRoot = shared.getHomePluginRoot();
|
|
10
|
+
const marketplacePath = typeof shared.getHomeMarketplacePath === 'function'
|
|
11
|
+
? shared.getHomeMarketplacePath()
|
|
12
|
+
: null;
|
|
13
|
+
const copilotHome = typeof shared.getCopilotHome === 'function'
|
|
14
|
+
? shared.getCopilotHome()
|
|
15
|
+
: null;
|
|
10
16
|
|
|
11
17
|
if (!fs.existsSync(pluginRoot)) {
|
|
12
18
|
console.log(`[${shared.PLUGIN_NAME}] Plugin not installed at ${pluginRoot}`);
|
|
13
|
-
|
|
19
|
+
} else {
|
|
20
|
+
try {
|
|
21
|
+
fs.rmSync(pluginRoot, { recursive: true, force: true });
|
|
22
|
+
console.log(`[${shared.PLUGIN_NAME}] Uninstalled from ${pluginRoot}`);
|
|
23
|
+
} catch (err) {
|
|
24
|
+
console.error(`[${shared.PLUGIN_NAME}] Failed to uninstall: ${err.message}`);
|
|
25
|
+
process.exitCode = 1;
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
14
28
|
}
|
|
15
29
|
|
|
16
30
|
try {
|
|
17
|
-
|
|
18
|
-
|
|
31
|
+
if (typeof shared.deregisterCopilotPlugin === 'function') {
|
|
32
|
+
shared.deregisterCopilotPlugin(pluginRoot);
|
|
33
|
+
}
|
|
34
|
+
if (copilotHome && typeof shared.removeManagedHooks === 'function') {
|
|
35
|
+
shared.removeManagedHooks(copilotHome);
|
|
36
|
+
}
|
|
37
|
+
if (marketplacePath && typeof shared.removeMarketplaceEntry === 'function') {
|
|
38
|
+
shared.removeMarketplaceEntry(marketplacePath);
|
|
39
|
+
}
|
|
19
40
|
} catch (err) {
|
|
20
|
-
console.error(`[${shared.PLUGIN_NAME}] Failed to uninstall: ${err.message}`);
|
|
41
|
+
console.error(`[${shared.PLUGIN_NAME}] Failed to clean up uninstall state: ${err.message}`);
|
|
21
42
|
process.exitCode = 1;
|
|
22
43
|
}
|
|
23
44
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@a5c-ai/babysitter-github",
|
|
3
|
-
"version": "5.0.1-staging.
|
|
3
|
+
"version": "5.0.1-staging.ae07dd8d",
|
|
4
4
|
"description": "Orchestrate complex, multi-step workflows with event-sourced state management, hook-based extensibility, and human-in-the-loop approval",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"deploy": "npm publish --access public",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@a5c-ai/babysitter-sdk": "5.0.1-staging.
|
|
41
|
+
"@a5c-ai/babysitter-sdk": "5.0.1-staging.ae07dd8d"
|
|
42
42
|
},
|
|
43
43
|
"repository": {
|
|
44
44
|
"type": "git",
|
package/plugin.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "babysitter",
|
|
3
|
-
"version": "5.0.1-staging.
|
|
3
|
+
"version": "5.0.1-staging.ae07dd8d",
|
|
4
4
|
"description": "Orchestrate complex, multi-step workflows with event-sourced state management, hook-based extensibility, and human-in-the-loop approval",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "a5c.ai"
|
package/versions.json
CHANGED