peer-bridge 0.0.0-stage → 0.7.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.ko.md +202 -0
- package/README.md +242 -2
- package/adapters/antigravity/bin/agy-hook.mjs +24 -0
- package/adapters/antigravity/hooks.json +23 -0
- package/adapters/antigravity/mcp_config.json +8 -0
- package/adapters/antigravity/plugin.json +4 -0
- package/adapters/antigravity/rules/AGENTS.md +6 -0
- package/adapters/antigravity/skills/peer-bridge/SKILL.md +19 -0
- package/adapters/claude/.claude-plugin/plugin.json +5 -0
- package/adapters/claude/.mcp.json +8 -0
- package/adapters/claude/bin/cc-hook.mjs +20 -0
- package/adapters/claude/hooks/hooks.json +46 -0
- package/adapters/claude/skills/peer-bridge/SKILL.md +19 -0
- package/adapters/codex/bin/codex-hook.mjs +10 -0
- package/adapters/codex/config.toml.example +5 -0
- package/adapters/codex/hooks.json +44 -0
- package/adapters/codex/skills/peer-bridge/SKILL.md +12 -0
- package/adapters/gemini/bin/gemini-hook.mjs +10 -0
- package/adapters/gemini/settings.json +51 -0
- package/adapters/gemini/skills/peer-bridge/SKILL.md +12 -0
- package/adapters/paseo/SKILL.md +24 -0
- package/bin/pbridge-mcp.mjs +37 -0
- package/bin/pbridge-tui.mjs +7 -0
- package/bin/pbridge.mjs +5 -0
- package/bin/pbridged.mjs +16 -0
- package/package.json +57 -4
- package/scripts/postinstall.mjs +25 -0
- package/scripts/preuninstall.mjs +20 -0
- package/skills/peer-bridge/SKILL.md +70 -0
- package/src/adapters/antigravity/hooks.mjs +207 -0
- package/src/adapters/claude/hooks.mjs +204 -0
- package/src/adapters/codex/hooks.mjs +142 -0
- package/src/adapters/gemini/hooks.mjs +159 -0
- package/src/adapters/installer.mjs +328 -0
- package/src/cli/main.mjs +785 -0
- package/src/client/rpc.mjs +243 -0
- package/src/config.mjs +154 -0
- package/src/daemon/broker.mjs +1799 -0
- package/src/daemon/resolver.mjs +200 -0
- package/src/daemon/server.mjs +221 -0
- package/src/index.mjs +60 -0
- package/src/mcp/server.mjs +668 -0
- package/src/orchestrator/workflows.mjs +496 -0
- package/src/project.mjs +81 -0
- package/src/protocol.mjs +203 -0
- package/src/runtime/conv-api.mjs +101 -0
- package/src/runtime/host-discovery.mjs +635 -0
- package/src/runtime/native-claude.mjs +88 -0
- package/src/runtime/paseo.mjs +289 -0
- package/src/runtime/workers.mjs +751 -0
- package/src/skills.mjs +115 -0
- package/src/storage/db.mjs +704 -0
- package/src/tui/render.mjs +472 -0
- package/src/tui/viewer.mjs +443 -0
package/src/skills.mjs
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
|
|
6
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
const REPO_ROOT = path.resolve(__dirname, '..');
|
|
8
|
+
|
|
9
|
+
export const MANAGED_SKILL_MARKER = '<!-- peer-bridge:managed-skill -->';
|
|
10
|
+
export const CANONICAL_SKILL_PATH = path.join(REPO_ROOT, 'skills', 'peer-bridge', 'SKILL.md');
|
|
11
|
+
|
|
12
|
+
export function getSkillCandidateDirs(homeDir = os.homedir()) {
|
|
13
|
+
return [
|
|
14
|
+
{ runtime: 'agents', parent: path.join(homeDir, '.agents'), dir: path.join(homeDir, '.agents', 'skills', 'peer-bridge'), always: true },
|
|
15
|
+
{ runtime: 'claude', parent: path.join(homeDir, '.claude'), dir: path.join(homeDir, '.claude', 'skills', 'peer-bridge'), always: true },
|
|
16
|
+
{ runtime: 'codex', parent: path.join(homeDir, '.codex'), dir: path.join(homeDir, '.codex', 'skills', 'peer-bridge'), always: false },
|
|
17
|
+
{ runtime: 'gemini', parent: path.join(homeDir, '.gemini'), dir: path.join(homeDir, '.gemini', 'skills', 'peer-bridge'), always: false },
|
|
18
|
+
];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function getSkillTargetDirs({ homeDir = os.homedir(), includeAll = false } = {}) {
|
|
22
|
+
return getSkillCandidateDirs(homeDir)
|
|
23
|
+
.filter((entry) => includeAll || entry.always || fs.existsSync(entry.parent))
|
|
24
|
+
.map((entry) => entry.dir);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function readCanonicalSkill() {
|
|
28
|
+
return fs.readFileSync(CANONICAL_SKILL_PATH, 'utf8');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function installGlobalSkills({ homeDir = os.homedir(), includeAll = false, dryRun = false } = {}) {
|
|
32
|
+
const content = readCanonicalSkill();
|
|
33
|
+
const targetDirs = getSkillTargetDirs({ homeDir, includeAll });
|
|
34
|
+
const installed = [];
|
|
35
|
+
const skipped = [];
|
|
36
|
+
|
|
37
|
+
for (const dir of targetDirs) {
|
|
38
|
+
const destFile = path.join(dir, 'SKILL.md');
|
|
39
|
+
if (fs.existsSync(destFile)) {
|
|
40
|
+
try {
|
|
41
|
+
const existing = fs.readFileSync(destFile, 'utf8');
|
|
42
|
+
if (!existing.includes(MANAGED_SKILL_MARKER)) {
|
|
43
|
+
skipped.push({ path: destFile, reason: 'custom_user_skill' });
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
} catch {
|
|
47
|
+
skipped.push({ path: destFile, reason: 'unreadable' });
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (!dryRun) {
|
|
53
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
54
|
+
fs.writeFileSync(destFile, content, 'utf8');
|
|
55
|
+
}
|
|
56
|
+
installed.push(destFile);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return { installed, skipped, dry_run: dryRun };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function uninstallGlobalSkills({ homeDir = os.homedir(), dryRun = false } = {}) {
|
|
63
|
+
const candidates = getSkillCandidateDirs(homeDir);
|
|
64
|
+
const removed = [];
|
|
65
|
+
const skipped = [];
|
|
66
|
+
|
|
67
|
+
for (const entry of candidates) {
|
|
68
|
+
const destFile = path.join(entry.dir, 'SKILL.md');
|
|
69
|
+
if (!fs.existsSync(destFile)) continue;
|
|
70
|
+
try {
|
|
71
|
+
const existing = fs.readFileSync(destFile, 'utf8');
|
|
72
|
+
if (!existing.includes(MANAGED_SKILL_MARKER)) {
|
|
73
|
+
skipped.push({ path: destFile, reason: 'custom_user_skill' });
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
if (!dryRun) {
|
|
77
|
+
fs.rmSync(destFile, { force: true });
|
|
78
|
+
try {
|
|
79
|
+
if (fs.readdirSync(entry.dir).length === 0) {
|
|
80
|
+
fs.rmdirSync(entry.dir);
|
|
81
|
+
}
|
|
82
|
+
} catch {
|
|
83
|
+
// ignore non-empty dir
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
removed.push(destFile);
|
|
87
|
+
} catch {
|
|
88
|
+
skipped.push({ path: destFile, reason: 'error' });
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return { removed, skipped, dry_run: dryRun };
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function getGlobalSkillsStatus({ homeDir = os.homedir() } = {}) {
|
|
96
|
+
const skills = getSkillCandidateDirs(homeDir).map((entry) => {
|
|
97
|
+
const destFile = path.join(entry.dir, 'SKILL.md');
|
|
98
|
+
const installed = fs.existsSync(destFile);
|
|
99
|
+
let managed = false;
|
|
100
|
+
if (installed) {
|
|
101
|
+
try {
|
|
102
|
+
managed = fs.readFileSync(destFile, 'utf8').includes(MANAGED_SKILL_MARKER);
|
|
103
|
+
} catch {
|
|
104
|
+
managed = false;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return {
|
|
108
|
+
runtime: entry.runtime,
|
|
109
|
+
path: destFile,
|
|
110
|
+
installed,
|
|
111
|
+
managed,
|
|
112
|
+
};
|
|
113
|
+
});
|
|
114
|
+
return { skills };
|
|
115
|
+
}
|