@a5c-ai/babysitter-github 5.0.1-staging.ae07dd8d → 5.0.1-staging.aedcb38c
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 +25 -80
- package/package.json +13 -11
- package/plugin.json +1 -1
- package/scripts/sync-command-surfaces.js +12 -54
- package/versions.json +2 -1
package/bin/install-shared.js
CHANGED
|
@@ -13,7 +13,7 @@ function getUserHome() {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
function getHarnessHome() {
|
|
16
|
-
return path.join(os.homedir(),
|
|
16
|
+
return path.join(os.homedir(), ".copilot");
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
function getHomePluginRoot(scope) {
|
|
@@ -454,72 +454,9 @@ 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
457
|
function removeManagedHooks(copilotHome) {
|
|
487
|
-
|
|
488
|
-
|
|
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
|
-
|
|
521
|
-
function removeLegacyHooks(copilotHome) {
|
|
522
|
-
for (const hookName of LEGACY_HOOK_SCRIPT_NAMES) {
|
|
458
|
+
const managedHookNames = [...LEGACY_HOOK_SCRIPT_NAMES, ...HOOK_SCRIPT_NAMES];
|
|
459
|
+
for (const hookName of managedHookNames) {
|
|
523
460
|
fs.rmSync(path.join(copilotHome, 'hooks', hookName), { force: true });
|
|
524
461
|
}
|
|
525
462
|
|
|
@@ -540,10 +477,17 @@ function removeLegacyHooks(copilotHome) {
|
|
|
540
477
|
const eventHooks = Array.isArray(hooksConfig.hooks[eventName]) ? hooksConfig.hooks[eventName] : [];
|
|
541
478
|
const filteredMatchers = eventHooks
|
|
542
479
|
.map((matcher) => {
|
|
480
|
+
const directBash = String(matcher?.bash || matcher?.command || '');
|
|
481
|
+
const directPs = String(matcher?.powershell || '');
|
|
482
|
+
const hasDirectHook = directBash.length > 0 || directPs.length > 0;
|
|
483
|
+
const directIsManaged = managedHookNames.some((name) => directBash.includes(name) || directPs.includes(name));
|
|
484
|
+
if (hasDirectHook) {
|
|
485
|
+
return directIsManaged ? null : matcher;
|
|
486
|
+
}
|
|
543
487
|
const hooks = Array.isArray(matcher.hooks) ? matcher.hooks : [];
|
|
544
488
|
const keptHooks = hooks.filter((hook) => {
|
|
545
489
|
const command = String(hook.command || '');
|
|
546
|
-
return !
|
|
490
|
+
return !managedHookNames.some((name) => command.includes(name));
|
|
547
491
|
});
|
|
548
492
|
return keptHooks.length > 0 ? { ...matcher, hooks: keptHooks } : null;
|
|
549
493
|
})
|
|
@@ -567,6 +511,8 @@ function installCopilotSurface(packageRoot, copilotHome) {
|
|
|
567
511
|
installManagedHooks(packageRoot, copilotHome);
|
|
568
512
|
}
|
|
569
513
|
|
|
514
|
+
const removeLegacyHooks = removeManagedHooks;
|
|
515
|
+
|
|
570
516
|
function renderCloudAgentAgentsBlock() {
|
|
571
517
|
return [
|
|
572
518
|
'## Babysitter Cloud Agent',
|
|
@@ -895,10 +841,19 @@ module.exports = {
|
|
|
895
841
|
resolveCliCommand,
|
|
896
842
|
runCli,
|
|
897
843
|
ensureGlobalProcessLibrary,
|
|
844
|
+
PLUGIN_BUNDLE_ENTRIES,
|
|
845
|
+
copyRecursive,
|
|
846
|
+
copyPluginBundle,
|
|
847
|
+
DEFAULT_MARKETPLACE,
|
|
848
|
+
normalizeMarketplaceSourcePath,
|
|
849
|
+
ensureMarketplaceEntry,
|
|
850
|
+
removeMarketplaceEntry,
|
|
851
|
+
installManagedSkills,
|
|
852
|
+
mergeManagedHooksConfig,
|
|
853
|
+
installManagedHooks,
|
|
854
|
+
warnWindowsHooks,
|
|
898
855
|
LEGACY_HOOK_SCRIPT_NAMES,
|
|
899
856
|
HOOK_SCRIPT_NAMES,
|
|
900
|
-
DEFAULT_MARKETPLACE,
|
|
901
|
-
PLUGIN_BUNDLE_ENTRIES,
|
|
902
857
|
CLOUD_AGENT_BUNDLE_ENTRIES,
|
|
903
858
|
MANAGED_BLOCK_START,
|
|
904
859
|
MANAGED_BLOCK_END,
|
|
@@ -913,12 +868,8 @@ module.exports = {
|
|
|
913
868
|
rewriteCloudSkill,
|
|
914
869
|
registerCopilotPlugin,
|
|
915
870
|
deregisterCopilotPlugin,
|
|
916
|
-
installManagedSkills,
|
|
917
|
-
mergeManagedHooksConfig,
|
|
918
|
-
installManagedHooks,
|
|
919
|
-
filterManagedHookEntries,
|
|
920
|
-
removeManagedHooks,
|
|
921
871
|
removeLegacyHooks,
|
|
872
|
+
removeManagedHooks,
|
|
922
873
|
installCopilotSurface,
|
|
923
874
|
renderCloudAgentAgentsBlock,
|
|
924
875
|
renderCloudAgentCopilotInstructionsBlock,
|
|
@@ -928,12 +879,6 @@ module.exports = {
|
|
|
928
879
|
installCloudAgentInstructions,
|
|
929
880
|
installCloudAgentSetupSteps,
|
|
930
881
|
installCloudAgentSurface,
|
|
931
|
-
normalizeMarketplaceSourcePath,
|
|
932
|
-
ensureMarketplaceEntry,
|
|
933
|
-
removeMarketplaceEntry,
|
|
934
|
-
warnWindowsHooks,
|
|
935
|
-
copyPluginBundle,
|
|
936
|
-
copyRecursive,
|
|
937
882
|
harnessCliRoute,
|
|
938
883
|
harnessInstall,
|
|
939
884
|
};
|
package/package.json
CHANGED
|
@@ -1,28 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@a5c-ai/babysitter-github",
|
|
3
|
-
"version": "5.0.1-staging.
|
|
3
|
+
"version": "5.0.1-staging.aedcb38c",
|
|
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",
|
|
7
7
|
"deploy:staging": "npm publish --access public --tag staging",
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"team:install": "node scripts/team-install.js"
|
|
11
|
-
"test": "node scripts/sync-command-surfaces.js --check",
|
|
12
|
-
"sync:commands": "node scripts/sync-command-surfaces.js"
|
|
8
|
+
"plugin:install": "node bin/install.js --global",
|
|
9
|
+
"plugin:uninstall": "node bin/uninstall.js --global",
|
|
10
|
+
"team:install": "node scripts/team-install.js"
|
|
13
11
|
},
|
|
14
12
|
"bin": {
|
|
15
|
-
"babysitter-github
|
|
13
|
+
"babysitter-github": "bin/cli.js"
|
|
16
14
|
},
|
|
17
15
|
"files": [
|
|
18
16
|
"bin/",
|
|
19
17
|
"hooks.json",
|
|
18
|
+
"AGENTS.md",
|
|
20
19
|
"hooks/",
|
|
21
20
|
"skills/",
|
|
22
21
|
"commands/",
|
|
23
22
|
"scripts/",
|
|
24
23
|
"plugin.json",
|
|
25
|
-
"AGENTS.md",
|
|
26
24
|
"README.md",
|
|
27
25
|
"versions.json",
|
|
28
26
|
"package.json"
|
|
@@ -38,11 +36,15 @@
|
|
|
38
36
|
"access": "public"
|
|
39
37
|
},
|
|
40
38
|
"dependencies": {
|
|
41
|
-
"@a5c-ai/babysitter-sdk": "5.0.1-staging.
|
|
39
|
+
"@a5c-ai/babysitter-sdk": "5.0.1-staging.aedcb38c"
|
|
42
40
|
},
|
|
43
41
|
"repository": {
|
|
44
42
|
"type": "git",
|
|
45
|
-
"url": "https://github.com/a5c-ai/babysitter"
|
|
43
|
+
"url": "git+https://github.com/a5c-ai/babysitter.git",
|
|
44
|
+
"directory": "plugins/babysitter-github"
|
|
46
45
|
},
|
|
47
|
-
"homepage": "https://github.com/a5c-ai/babysitter/tree/main/plugins/babysitter-github#readme"
|
|
46
|
+
"homepage": "https://github.com/a5c-ai/babysitter/tree/main/plugins/babysitter-github#readme",
|
|
47
|
+
"bugs": {
|
|
48
|
+
"url": "https://github.com/a5c-ai/babysitter/issues"
|
|
49
|
+
}
|
|
48
50
|
}
|
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.aedcb38c",
|
|
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"
|
|
@@ -1,62 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
1
2
|
'use strict';
|
|
2
3
|
|
|
3
4
|
const path = require('path');
|
|
4
|
-
const {
|
|
5
|
-
listDirectories,
|
|
6
|
-
listMarkdownBasenames,
|
|
7
|
-
reportCheckResult,
|
|
8
|
-
syncCommandMirrors,
|
|
9
|
-
syncSkillsFromCommands,
|
|
10
|
-
} = require('../../../scripts/plugin-command-sync-lib.cjs');
|
|
5
|
+
const { spawnSync } = require('child_process');
|
|
11
6
|
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const PLUGIN_COMMANDS = path.join(PACKAGE_ROOT, 'commands');
|
|
16
|
-
const PLUGIN_SKILLS = path.join(PACKAGE_ROOT, 'skills');
|
|
17
|
-
const LABEL = 'babysitter-github sync';
|
|
7
|
+
const REPO_ROOT = path.resolve(__dirname, '..', '..');
|
|
8
|
+
const syncScript = path.join(REPO_ROOT, 'scripts', 'sync-plugin-commands.cjs');
|
|
9
|
+
const args = [syncScript, '--target', 'github-copilot'];
|
|
18
10
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return listMarkdownBasenames(ROOT_COMMANDS).filter((name) => local.has(name));
|
|
11
|
+
if (process.argv.includes('--check')) {
|
|
12
|
+
args.push('--check');
|
|
22
13
|
}
|
|
23
14
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function main() {
|
|
30
|
-
const check = process.argv.includes('--check');
|
|
31
|
-
const mirrorResult = syncCommandMirrors({
|
|
32
|
-
label: LABEL,
|
|
33
|
-
sourceRoot: ROOT_COMMANDS,
|
|
34
|
-
targetRoot: PLUGIN_COMMANDS,
|
|
35
|
-
names: getMirroredCommandNames(),
|
|
36
|
-
check,
|
|
37
|
-
cwd: PACKAGE_ROOT,
|
|
38
|
-
});
|
|
39
|
-
const skillsResult = syncSkillsFromCommands({
|
|
40
|
-
label: LABEL,
|
|
41
|
-
sourceRoot: PLUGIN_COMMANDS,
|
|
42
|
-
skillsRoot: PLUGIN_SKILLS,
|
|
43
|
-
names: getDerivedSkillNames(),
|
|
44
|
-
check,
|
|
45
|
-
cwd: PACKAGE_ROOT,
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
if (check) {
|
|
49
|
-
reportCheckResult(LABEL, [...mirrorResult.stale, ...skillsResult.stale]);
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const updated = mirrorResult.updated + skillsResult.updated;
|
|
54
|
-
if (updated === 0) {
|
|
55
|
-
console.log(`[${LABEL}] no GitHub plugin command changes were needed.`);
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
console.log(`[${LABEL}] updated ${updated} GitHub plugin file(s).`);
|
|
60
|
-
}
|
|
15
|
+
const result = spawnSync(process.execPath, args, {
|
|
16
|
+
cwd: REPO_ROOT,
|
|
17
|
+
stdio: 'inherit',
|
|
18
|
+
});
|
|
61
19
|
|
|
62
|
-
|
|
20
|
+
process.exit(result.status ?? 1);
|
package/versions.json
CHANGED