@dp-pcs/ogp 0.3.3 → 0.4.3
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 +317 -61
- package/dist/cli/completion.d.ts +5 -0
- package/dist/cli/completion.d.ts.map +1 -0
- package/dist/cli/completion.js +148 -0
- package/dist/cli/completion.js.map +1 -0
- package/dist/cli/config.d.ts +3 -0
- package/dist/cli/config.d.ts.map +1 -0
- package/dist/cli/config.js +207 -0
- package/dist/cli/config.js.map +1 -0
- package/dist/cli/expose.d.ts.map +1 -1
- package/dist/cli/expose.js +20 -13
- package/dist/cli/expose.js.map +1 -1
- package/dist/cli/federation.d.ts +14 -0
- package/dist/cli/federation.d.ts.map +1 -1
- package/dist/cli/federation.js +347 -23
- package/dist/cli/federation.js.map +1 -1
- package/dist/cli/project.d.ts +4 -3
- package/dist/cli/project.d.ts.map +1 -1
- package/dist/cli/project.js +34 -24
- package/dist/cli/project.js.map +1 -1
- package/dist/cli/setup.d.ts +23 -0
- package/dist/cli/setup.d.ts.map +1 -1
- package/dist/cli/setup.js +560 -32
- package/dist/cli/setup.js.map +1 -1
- package/dist/cli.js +358 -35
- package/dist/cli.js.map +1 -1
- package/dist/daemon/agent-comms.d.ts.map +1 -1
- package/dist/daemon/agent-comms.js +15 -10
- package/dist/daemon/agent-comms.js.map +1 -1
- package/dist/daemon/heartbeat.d.ts +22 -0
- package/dist/daemon/heartbeat.d.ts.map +1 -0
- package/dist/daemon/heartbeat.js +119 -0
- package/dist/daemon/heartbeat.js.map +1 -0
- package/dist/daemon/intent-registry.d.ts.map +1 -1
- package/dist/daemon/intent-registry.js +19 -10
- package/dist/daemon/intent-registry.js.map +1 -1
- package/dist/daemon/keypair.d.ts +1 -0
- package/dist/daemon/keypair.d.ts.map +1 -1
- package/dist/daemon/keypair.js +151 -18
- package/dist/daemon/keypair.js.map +1 -1
- package/dist/daemon/message-handler.d.ts.map +1 -1
- package/dist/daemon/message-handler.js +30 -16
- package/dist/daemon/message-handler.js.map +1 -1
- package/dist/daemon/notify.d.ts +19 -0
- package/dist/daemon/notify.d.ts.map +1 -1
- package/dist/daemon/notify.js +376 -73
- package/dist/daemon/notify.js.map +1 -1
- package/dist/daemon/openclaw-bridge.d.ts +34 -0
- package/dist/daemon/openclaw-bridge.d.ts.map +1 -0
- package/dist/daemon/openclaw-bridge.js +261 -0
- package/dist/daemon/openclaw-bridge.js.map +1 -0
- package/dist/daemon/peers.d.ts +21 -0
- package/dist/daemon/peers.d.ts.map +1 -1
- package/dist/daemon/peers.js +125 -20
- package/dist/daemon/peers.js.map +1 -1
- package/dist/daemon/projects.d.ts +9 -6
- package/dist/daemon/projects.d.ts.map +1 -1
- package/dist/daemon/projects.js +30 -20
- package/dist/daemon/projects.js.map +1 -1
- package/dist/daemon/server.d.ts +17 -0
- package/dist/daemon/server.d.ts.map +1 -1
- package/dist/daemon/server.js +188 -77
- package/dist/daemon/server.js.map +1 -1
- package/dist/shared/config.d.ts +52 -1
- package/dist/shared/config.d.ts.map +1 -1
- package/dist/shared/config.js +18 -11
- package/dist/shared/config.js.map +1 -1
- package/dist/shared/framework-detection.d.ts +31 -0
- package/dist/shared/framework-detection.d.ts.map +1 -0
- package/dist/shared/framework-detection.js +91 -0
- package/dist/shared/framework-detection.js.map +1 -0
- package/dist/shared/help.d.ts +5 -0
- package/dist/shared/help.d.ts.map +1 -0
- package/dist/shared/help.js +281 -0
- package/dist/shared/help.js.map +1 -0
- package/dist/shared/meta-config.d.ts +44 -0
- package/dist/shared/meta-config.d.ts.map +1 -0
- package/dist/shared/meta-config.js +89 -0
- package/dist/shared/meta-config.js.map +1 -0
- package/dist/shared/migration.d.ts +57 -0
- package/dist/shared/migration.d.ts.map +1 -0
- package/dist/shared/migration.js +255 -0
- package/dist/shared/migration.js.map +1 -0
- package/docs/CLI-REFERENCE.md +1361 -0
- package/docs/GETTING-STARTED.md +953 -0
- package/docs/MIGRATION.md +202 -0
- package/docs/MULTI-FRAMEWORK-DEMO.md +352 -0
- package/docs/MULTI-FRAMEWORK-DESIGN.md +378 -0
- package/docs/MULTI-FRAMEWORK-IMPL.md +197 -0
- package/docs/case-studies/CRASH_RESOLUTION_20260407.md +190 -0
- package/docs/case-studies/OpenClaw_Hermes_Status_Report_20260407.md +142 -0
- package/docs/case-studies/OpenClaw_Stability_Fix_Summary.md +209 -0
- package/docs/case-studies/README.md +40 -0
- package/docs/case-studies/crash_observations.md +250 -0
- package/docs/cloudflare-named-tunnel-setup.md +126 -0
- package/docs/federation-flow.md +27 -37
- package/docs/hermes-implementation-checklist.md +4 -0
- package/docs/project-intent-testing.md +97 -0
- package/docs/quickstart.md +12 -4
- package/docs/rendezvous.md +13 -14
- package/docs/scopes.md +13 -13
- package/package.json +12 -6
- package/scripts/completion.bash +123 -0
- package/scripts/completion.zsh +372 -0
- package/scripts/install-skills.js +19 -1
- package/scripts/test-migration-execute.js +74 -0
- package/scripts/test-migration.js +42 -0
- package/scripts/test-project-intents.mjs +614 -0
- package/skills/ogp/SKILL.md +197 -64
- package/skills/ogp-agent-comms/SKILL.md +107 -41
- package/skills/ogp-expose/SKILL.md +183 -25
- package/skills/ogp-project/SKILL.md +110 -88
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
# Multi-Framework Support Design
|
|
2
|
+
|
|
3
|
+
**Status:** ✅ Implemented in OGP v0.4.0+
|
|
4
|
+
|
|
5
|
+
## Goal
|
|
6
|
+
Make OGP feel like a native integration for multiple AI frameworks (OpenClaw, Hermes, etc.) rather than requiring manual `OGP_HOME` environment variables.
|
|
7
|
+
|
|
8
|
+
## User Experience
|
|
9
|
+
|
|
10
|
+
### Setup (First-time)
|
|
11
|
+
```bash
|
|
12
|
+
$ ogp setup
|
|
13
|
+
|
|
14
|
+
🔍 Detecting installed AI frameworks...
|
|
15
|
+
✓ Found OpenClaw at ~/.openclaw/
|
|
16
|
+
✓ Found Hermes at ~/.hermes/
|
|
17
|
+
|
|
18
|
+
Which frameworks do you want to enable OGP for?
|
|
19
|
+
[x] OpenClaw (Junior @ OpenClaw)
|
|
20
|
+
[x] Hermes (Apollo @ Hermes)
|
|
21
|
+
[ ] Standalone (no framework)
|
|
22
|
+
|
|
23
|
+
Gateway configuration:
|
|
24
|
+
OpenClaw → https://ogp.sarcastek.com
|
|
25
|
+
Hermes → https://hermes.sarcastek.com
|
|
26
|
+
|
|
27
|
+
✓ OGP configured for 2 frameworks
|
|
28
|
+
OpenClaw: ~/.ogp-openclaw/
|
|
29
|
+
Hermes: ~/.ogp-hermes/
|
|
30
|
+
|
|
31
|
+
Tip: Use `ogp --for openclaw <command>` or `ogp --for hermes <command>`
|
|
32
|
+
Or set a default: `ogp config set-default openclaw`
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Command Execution
|
|
36
|
+
|
|
37
|
+
**When only one framework is configured:**
|
|
38
|
+
```bash
|
|
39
|
+
$ ogp federation list
|
|
40
|
+
# Automatically uses the only configured framework
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**When multiple frameworks are configured:**
|
|
44
|
+
```bash
|
|
45
|
+
$ ogp federation list
|
|
46
|
+
? Which framework? (use arrow keys or type to filter)
|
|
47
|
+
› openclaw
|
|
48
|
+
hermes
|
|
49
|
+
all (run on both)
|
|
50
|
+
|
|
51
|
+
# OR use flag directly:
|
|
52
|
+
$ ogp --for openclaw federation list
|
|
53
|
+
$ ogp --for hermes federation list
|
|
54
|
+
$ ogp --for all federation list # Run on both, show combined output
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Set a default:**
|
|
58
|
+
```bash
|
|
59
|
+
$ ogp config set-default openclaw
|
|
60
|
+
✓ Default framework: openclaw
|
|
61
|
+
|
|
62
|
+
$ ogp federation list
|
|
63
|
+
# Now automatically uses openclaw
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Framework Aliases
|
|
67
|
+
```bash
|
|
68
|
+
$ ogp alias add oc openclaw
|
|
69
|
+
$ ogp alias add ap hermes
|
|
70
|
+
|
|
71
|
+
$ ogp --for oc federation list # Uses openclaw
|
|
72
|
+
$ ogp --for ap federation list # Uses hermes
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Tab Completion
|
|
76
|
+
|
|
77
|
+
### Bash/Zsh Completion
|
|
78
|
+
```bash
|
|
79
|
+
$ ogp fed<TAB>
|
|
80
|
+
federation
|
|
81
|
+
|
|
82
|
+
$ ogp federation <TAB>
|
|
83
|
+
list request approve reject remove send
|
|
84
|
+
agent scopes alias
|
|
85
|
+
|
|
86
|
+
$ ogp --for <TAB>
|
|
87
|
+
openclaw hermes all
|
|
88
|
+
|
|
89
|
+
$ ogp federation send ?
|
|
90
|
+
Usage: ogp federation send <peer> <intent> <payload>
|
|
91
|
+
|
|
92
|
+
Available peers:
|
|
93
|
+
- apollo (Apollo @ Hermes)
|
|
94
|
+
- junior (Junior @ OpenClaw)
|
|
95
|
+
|
|
96
|
+
Example: ogp federation send apollo message '{"text":"hello"}'
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### `?` Style Help (Cisco IOS-inspired)
|
|
100
|
+
```bash
|
|
101
|
+
$ ogp ?
|
|
102
|
+
Available commands:
|
|
103
|
+
setup Initialize OGP configuration
|
|
104
|
+
start Start OGP daemon
|
|
105
|
+
stop Stop OGP daemon
|
|
106
|
+
status Show daemon status
|
|
107
|
+
federation Manage federation
|
|
108
|
+
agent-comms Configure agent-to-agent messaging
|
|
109
|
+
config Manage configuration
|
|
110
|
+
|
|
111
|
+
$ ogp federation ?
|
|
112
|
+
Available commands:
|
|
113
|
+
list List all peers
|
|
114
|
+
request Send federation request
|
|
115
|
+
approve Approve pending peer
|
|
116
|
+
reject Reject pending peer
|
|
117
|
+
remove Remove peer
|
|
118
|
+
send Send message to peer
|
|
119
|
+
agent Send agent-comms message
|
|
120
|
+
scopes View/update scopes
|
|
121
|
+
alias Manage peer aliases
|
|
122
|
+
|
|
123
|
+
$ ogp federation send ?
|
|
124
|
+
Usage: ogp federation send <peer> <intent> <payload>
|
|
125
|
+
|
|
126
|
+
Arguments:
|
|
127
|
+
peer Peer ID, alias, or display name
|
|
128
|
+
intent Intent type (message, task-request, status-update, agent-comms, project.*)
|
|
129
|
+
payload JSON payload
|
|
130
|
+
|
|
131
|
+
Example:
|
|
132
|
+
ogp federation send apollo message '{"text":"Hello from OGP!"}'
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Implementation Plan
|
|
136
|
+
|
|
137
|
+
### Phase 1: Framework Detection & Storage
|
|
138
|
+
**File:** `src/shared/frameworks.ts`
|
|
139
|
+
```typescript
|
|
140
|
+
export interface Framework {
|
|
141
|
+
id: string; // 'openclaw' | 'hermes' | 'standalone'
|
|
142
|
+
name: string; // Display name
|
|
143
|
+
detected: boolean; // Auto-detected during setup
|
|
144
|
+
enabled: boolean; // User selected during setup
|
|
145
|
+
configDir: string; // e.g., ~/.ogp-openclaw/
|
|
146
|
+
daemonPort: number; // e.g., 18790
|
|
147
|
+
gatewayUrl?: string; // User-provided during setup
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export function detectFrameworks(): Framework[] {
|
|
151
|
+
return [
|
|
152
|
+
{
|
|
153
|
+
id: 'openclaw',
|
|
154
|
+
name: 'OpenClaw',
|
|
155
|
+
detected: fs.existsSync(expandTilde('~/.openclaw')) || commandExists('openclaw'),
|
|
156
|
+
enabled: false,
|
|
157
|
+
configDir: '~/.ogp-openclaw',
|
|
158
|
+
daemonPort: 18790
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
id: 'hermes',
|
|
162
|
+
name: 'Hermes',
|
|
163
|
+
detected: fs.existsSync(expandTilde('~/.hermes')) || commandExists('hermes'),
|
|
164
|
+
enabled: false,
|
|
165
|
+
configDir: '~/.ogp-hermes',
|
|
166
|
+
daemonPort: 18793
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
id: 'standalone',
|
|
170
|
+
name: 'Standalone (no framework)',
|
|
171
|
+
detected: true,
|
|
172
|
+
enabled: false,
|
|
173
|
+
configDir: '~/.ogp',
|
|
174
|
+
daemonPort: 18790
|
|
175
|
+
}
|
|
176
|
+
];
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**File:** `~/.ogp-meta/config.json`
|
|
181
|
+
```json
|
|
182
|
+
{
|
|
183
|
+
"frameworks": [
|
|
184
|
+
{
|
|
185
|
+
"id": "openclaw",
|
|
186
|
+
"enabled": true,
|
|
187
|
+
"configDir": "~/.ogp-openclaw",
|
|
188
|
+
"daemonPort": 18790,
|
|
189
|
+
"gatewayUrl": "https://ogp.sarcastek.com",
|
|
190
|
+
"displayName": "Junior @ OpenClaw"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"id": "hermes",
|
|
194
|
+
"enabled": true,
|
|
195
|
+
"configDir": "~/.ogp-hermes",
|
|
196
|
+
"daemonPort": 18793,
|
|
197
|
+
"gatewayUrl": "https://hermes.sarcastek.com",
|
|
198
|
+
"displayName": "Apollo @ Hermes"
|
|
199
|
+
}
|
|
200
|
+
],
|
|
201
|
+
"default": "openclaw",
|
|
202
|
+
"aliases": {
|
|
203
|
+
"oc": "openclaw",
|
|
204
|
+
"ap": "hermes"
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### Phase 2: CLI Flag & Auto-selection
|
|
210
|
+
**File:** `src/cli.ts`
|
|
211
|
+
```typescript
|
|
212
|
+
program
|
|
213
|
+
.option('--for <framework>', 'Select framework (openclaw, hermes, all)')
|
|
214
|
+
.hook('preAction', (thisCommand, actionCommand) => {
|
|
215
|
+
const meta = loadMetaConfig();
|
|
216
|
+
let selectedFramework = thisCommand.opts().for;
|
|
217
|
+
|
|
218
|
+
if (!selectedFramework) {
|
|
219
|
+
const enabled = meta.frameworks.filter(f => f.enabled);
|
|
220
|
+
if (enabled.length === 0) {
|
|
221
|
+
console.error('No frameworks configured. Run `ogp setup` first.');
|
|
222
|
+
process.exit(1);
|
|
223
|
+
} else if (enabled.length === 1) {
|
|
224
|
+
selectedFramework = enabled[0].id;
|
|
225
|
+
} else if (meta.default) {
|
|
226
|
+
selectedFramework = meta.default;
|
|
227
|
+
} else {
|
|
228
|
+
// Interactive prompt
|
|
229
|
+
selectedFramework = await selectFramework(enabled);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// Resolve alias
|
|
234
|
+
selectedFramework = meta.aliases[selectedFramework] || selectedFramework;
|
|
235
|
+
|
|
236
|
+
// Set OGP_HOME for selected framework
|
|
237
|
+
const framework = meta.frameworks.find(f => f.id === selectedFramework);
|
|
238
|
+
if (!framework) {
|
|
239
|
+
console.error(`Framework not found: ${selectedFramework}`);
|
|
240
|
+
process.exit(1);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
process.env.OGP_HOME = expandTilde(framework.configDir);
|
|
244
|
+
});
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### Phase 3: Tab Completion
|
|
248
|
+
**File:** `scripts/install-completion.sh`
|
|
249
|
+
```bash
|
|
250
|
+
#!/bin/bash
|
|
251
|
+
# Generate completion script for bash/zsh
|
|
252
|
+
|
|
253
|
+
if [ -n "$BASH_VERSION" ]; then
|
|
254
|
+
# Bash completion
|
|
255
|
+
cat > ~/.ogp-completion.bash <<'EOF'
|
|
256
|
+
_ogp_completion() {
|
|
257
|
+
local cur prev opts
|
|
258
|
+
COMPREPLY=()
|
|
259
|
+
cur="${COMP_WORDS[COMP_CWORD]}"
|
|
260
|
+
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
|
261
|
+
|
|
262
|
+
# Top-level commands
|
|
263
|
+
if [ $COMP_CWORD -eq 1 ]; then
|
|
264
|
+
opts="setup start stop status federation agent-comms config"
|
|
265
|
+
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
266
|
+
return 0
|
|
267
|
+
fi
|
|
268
|
+
|
|
269
|
+
# --for flag completion
|
|
270
|
+
if [ "$prev" = "--for" ]; then
|
|
271
|
+
frameworks=$(ogp config list-frameworks --quiet)
|
|
272
|
+
COMPREPLY=( $(compgen -W "${frameworks}" -- ${cur}) )
|
|
273
|
+
return 0
|
|
274
|
+
fi
|
|
275
|
+
|
|
276
|
+
# federation subcommands
|
|
277
|
+
if [ "${COMP_WORDS[1]}" = "federation" ]; then
|
|
278
|
+
opts="list request approve reject remove send agent scopes alias"
|
|
279
|
+
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
|
|
280
|
+
return 0
|
|
281
|
+
fi
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
complete -F _ogp_completion ogp
|
|
285
|
+
EOF
|
|
286
|
+
echo "source ~/.ogp-completion.bash" >> ~/.bashrc
|
|
287
|
+
echo "✓ Bash completion installed. Restart your shell or run: source ~/.bashrc"
|
|
288
|
+
|
|
289
|
+
elif [ -n "$ZSH_VERSION" ]; then
|
|
290
|
+
# Zsh completion (similar structure)
|
|
291
|
+
echo "✓ Zsh completion not yet implemented"
|
|
292
|
+
fi
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### Phase 4: `?` Style Help
|
|
296
|
+
**File:** `src/cli.ts`
|
|
297
|
+
```typescript
|
|
298
|
+
// Intercept '?' as a special argument
|
|
299
|
+
program.hook('preAction', (thisCommand, actionCommand) => {
|
|
300
|
+
const args = process.argv;
|
|
301
|
+
const hasQuestionMark = args.includes('?');
|
|
302
|
+
|
|
303
|
+
if (hasQuestionMark) {
|
|
304
|
+
// Show context-sensitive help
|
|
305
|
+
const commandChain = args.slice(2).filter(a => a !== '?');
|
|
306
|
+
showContextHelp(commandChain);
|
|
307
|
+
process.exit(0);
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
function showContextHelp(commandChain: string[]) {
|
|
312
|
+
if (commandChain.length === 0) {
|
|
313
|
+
// ogp ?
|
|
314
|
+
console.log('Available commands:');
|
|
315
|
+
program.commands.forEach(cmd => {
|
|
316
|
+
console.log(` ${cmd.name().padEnd(15)} ${cmd.description()}`);
|
|
317
|
+
});
|
|
318
|
+
} else if (commandChain[0] === 'federation') {
|
|
319
|
+
// ogp federation ?
|
|
320
|
+
const fedCmd = program.commands.find(c => c.name() === 'federation');
|
|
321
|
+
console.log('Available federation commands:');
|
|
322
|
+
fedCmd?.commands.forEach(cmd => {
|
|
323
|
+
console.log(` ${cmd.name().padEnd(15)} ${cmd.description()}`);
|
|
324
|
+
});
|
|
325
|
+
} else if (commandChain[0] === 'federation' && commandChain[1] === 'send') {
|
|
326
|
+
// ogp federation send ?
|
|
327
|
+
console.log('Usage: ogp federation send <peer> <intent> <payload>');
|
|
328
|
+
console.log('');
|
|
329
|
+
console.log('Arguments:');
|
|
330
|
+
console.log(' peer Peer ID, alias, or display name');
|
|
331
|
+
console.log(' intent Intent type (message, task-request, status-update, agent-comms, project.*)');
|
|
332
|
+
console.log(' payload JSON payload');
|
|
333
|
+
console.log('');
|
|
334
|
+
console.log('Example:');
|
|
335
|
+
console.log(' ogp federation send apollo message \'{"text":"Hello from OGP!"}\'');
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
## Migration Path
|
|
341
|
+
|
|
342
|
+
### For Existing Users
|
|
343
|
+
1. Detect existing `~/.ogp/` and `~/.ogp-hermes/` directories
|
|
344
|
+
2. Auto-create `~/.ogp-meta/config.json` with both frameworks enabled
|
|
345
|
+
3. Rename directories:
|
|
346
|
+
- `~/.ogp/` → `~/.ogp-openclaw/` (if OpenClaw detected)
|
|
347
|
+
- Keep `~/.ogp-hermes/` as-is
|
|
348
|
+
4. Show migration notice on first run
|
|
349
|
+
|
|
350
|
+
### Backward Compatibility
|
|
351
|
+
- Still respect `OGP_HOME` environment variable if set (takes precedence over `--for`)
|
|
352
|
+
- Old commands work as-is if only one framework is configured
|
|
353
|
+
- `ogp start` without `--for` starts daemon for current framework context
|
|
354
|
+
|
|
355
|
+
## Benefits
|
|
356
|
+
|
|
357
|
+
1. **Native feel**: No more `OGP_HOME=~/.ogp-hermes ogp ...` commands
|
|
358
|
+
2. **Discoverability**: `?` help makes it easy for new users
|
|
359
|
+
3. **Power user friendly**: Tab completion, aliases, defaults
|
|
360
|
+
4. **Clean separation**: Each framework has isolated state/config
|
|
361
|
+
5. **Multi-framework operations**: `--for all` runs commands across all frameworks
|
|
362
|
+
|
|
363
|
+
## Implementation Notes
|
|
364
|
+
|
|
365
|
+
### Resolved Design Questions
|
|
366
|
+
|
|
367
|
+
1. **Custom framework definitions:** Not yet supported in v0.4.0. Future enhancement for users with multiple instances of the same framework.
|
|
368
|
+
|
|
369
|
+
2. **Daemon lifecycle:** Implemented as Option B - `ogp start` starts daemon for current/default context, `ogp --for all start` starts all configured framework daemons.
|
|
370
|
+
|
|
371
|
+
3. **Framework config location:** Framework-specific configs remain in their own directories (`~/.ogp-openclaw/`, `~/.ogp-hermes/`), with meta-config centralized at `~/.ogp-meta/config.json`.
|
|
372
|
+
|
|
373
|
+
### See Also
|
|
374
|
+
|
|
375
|
+
- [Getting Started Guide](./GETTING-STARTED.md) - Complete setup and usage guide
|
|
376
|
+
- [CLI Reference](./CLI-REFERENCE.md) - Full command documentation
|
|
377
|
+
- [Migration Guide](./MIGRATION.md) - Upgrading from single to multi-framework
|
|
378
|
+
- [Implementation Details](./MULTI-FRAMEWORK-IMPL.md) - Technical implementation notes
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# Multi-Framework Implementation Plan
|
|
2
|
+
|
|
3
|
+
**Status:** ✅ Implemented in OGP v0.4.0+
|
|
4
|
+
|
|
5
|
+
> Historical note, April 9, 2026: this file is primarily an implementation log.
|
|
6
|
+
> Some unchecked items below were not maintained after features landed.
|
|
7
|
+
> In particular, completion and `?` help are present in the codebase even though later checklist sections still show them as pending.
|
|
8
|
+
> Do not use this file as the canonical active backlog.
|
|
9
|
+
|
|
10
|
+
This document tracks the implementation status of multi-framework support.
|
|
11
|
+
|
|
12
|
+
## Phase 1: Core Infrastructure ✅ COMPLETED
|
|
13
|
+
|
|
14
|
+
### 1.1 Meta Configuration ✅
|
|
15
|
+
- [x] Create `~/.ogp-meta/` directory structure
|
|
16
|
+
- [x] Implement `loadMetaConfig()` and `saveMetaConfig()` functions
|
|
17
|
+
- [x] Define `Framework` interface and schema
|
|
18
|
+
- [x] Add framework detection logic (check for `~/.openclaw/`, `~/.hermes/`, command existence)
|
|
19
|
+
|
|
20
|
+
**Files created:**
|
|
21
|
+
- `src/shared/meta-config.ts` - Meta config management
|
|
22
|
+
- `src/shared/framework-detection.ts` - Auto-detect installed frameworks
|
|
23
|
+
|
|
24
|
+
### 1.2 Migration for Existing Users ✅
|
|
25
|
+
- [x] Detect existing `~/.ogp/` and `~/.ogp-hermes/` installations
|
|
26
|
+
- [x] Auto-create meta config from existing installations
|
|
27
|
+
- [x] Show migration notice with new command patterns
|
|
28
|
+
|
|
29
|
+
**Files modified:**
|
|
30
|
+
- `src/cli.ts` - Add migration check on startup
|
|
31
|
+
- `src/shared/migration.ts` - Migration logic
|
|
32
|
+
|
|
33
|
+
### 1.3 `--for` Flag ✅
|
|
34
|
+
- [x] Add global `--for <framework>` option to CLI
|
|
35
|
+
- [x] Implement framework selection logic (auto-select, prompt, or explicit)
|
|
36
|
+
- [x] Set `OGP_HOME` based on selected framework
|
|
37
|
+
- [x] Handle `all` value for multi-framework operations
|
|
38
|
+
|
|
39
|
+
**Files modified:**
|
|
40
|
+
- `src/cli.ts` - Add `preAction` hook for framework selection
|
|
41
|
+
|
|
42
|
+
## Phase 2: Setup Wizard ✅ COMPLETED
|
|
43
|
+
|
|
44
|
+
### 2.1 Interactive Setup ✅
|
|
45
|
+
- [x] Rewrite `ogp setup` to be framework-aware
|
|
46
|
+
- [x] Show detected frameworks with checkboxes
|
|
47
|
+
- [x] Prompt for gateway URL per framework
|
|
48
|
+
- [x] Prompt for display name per framework
|
|
49
|
+
- [x] Save to meta config
|
|
50
|
+
|
|
51
|
+
**Files modified:**
|
|
52
|
+
- `src/cli/setup.ts` - Interactive framework setup
|
|
53
|
+
|
|
54
|
+
### 2.2 Config Management Commands ✅
|
|
55
|
+
- [x] `ogp config list` - Show all configured frameworks
|
|
56
|
+
- [x] `ogp config set-default <framework>` - Set default framework
|
|
57
|
+
- [x] `ogp config enable <framework>` - Enable a framework
|
|
58
|
+
- [x] `ogp config disable <framework>` - Disable a framework
|
|
59
|
+
- [x] `ogp config show` - Show current configuration
|
|
60
|
+
|
|
61
|
+
**Files created:**
|
|
62
|
+
- `src/cli/config.ts` - Config management commands
|
|
63
|
+
|
|
64
|
+
## Phase 3: Tab Completion ⏳ IN PROGRESS
|
|
65
|
+
|
|
66
|
+
### 3.1 Completion Script Generation
|
|
67
|
+
- [ ] Create bash completion script template
|
|
68
|
+
- [ ] Create zsh completion script template
|
|
69
|
+
- [ ] Implement `ogp completion install` command
|
|
70
|
+
- [ ] Add completion for top-level commands
|
|
71
|
+
- [ ] Add completion for `--for` flag (framework names + aliases)
|
|
72
|
+
- [ ] Add completion for peer names/aliases
|
|
73
|
+
|
|
74
|
+
**Files to create:**
|
|
75
|
+
- `scripts/completion.bash` - Bash completion template
|
|
76
|
+
- `scripts/completion.zsh` - Zsh completion template
|
|
77
|
+
- `src/cli/completion.ts` - Completion installer
|
|
78
|
+
|
|
79
|
+
**Status:** Documented but not yet implemented in code.
|
|
80
|
+
|
|
81
|
+
### 3.2 Dynamic Completions
|
|
82
|
+
- [ ] `ogp config list --quiet` - Output framework IDs for completion
|
|
83
|
+
- [ ] `ogp federation list --quiet` - Output peer names/aliases for completion
|
|
84
|
+
|
|
85
|
+
## Phase 4: `?` Style Help ⏳ IN PROGRESS
|
|
86
|
+
|
|
87
|
+
### 4.1 Help Interceptor
|
|
88
|
+
- [ ] Add `preAction` hook to detect `?` in arguments
|
|
89
|
+
- [ ] Implement context-sensitive help based on command chain
|
|
90
|
+
- [ ] Show available subcommands
|
|
91
|
+
- [ ] Show usage examples
|
|
92
|
+
- [ ] Show available peers (for federation commands)
|
|
93
|
+
|
|
94
|
+
**Files to modify:**
|
|
95
|
+
- `src/cli.ts` - Add `?` interceptor
|
|
96
|
+
- `src/shared/help.ts` - Context-sensitive help formatter
|
|
97
|
+
|
|
98
|
+
**Status:** Documented but not yet implemented in code.
|
|
99
|
+
|
|
100
|
+
### 4.2 Enhanced Help for Key Commands
|
|
101
|
+
- [ ] `ogp ?` - Top-level commands
|
|
102
|
+
- [ ] `ogp federation ?` - Federation subcommands
|
|
103
|
+
- [ ] `ogp federation send ?` - Send command usage + peer list
|
|
104
|
+
- [ ] `ogp federation agent ?` - Agent-comms usage + peer list
|
|
105
|
+
- [ ] `ogp agent-comms ?` - Agent-comms subcommands
|
|
106
|
+
|
|
107
|
+
## Phase 5: Multi-Framework Operations ✅ COMPLETED
|
|
108
|
+
|
|
109
|
+
### 5.1 `--for all` Support ✅
|
|
110
|
+
- [x] Run command on all enabled frameworks sequentially
|
|
111
|
+
- [x] Aggregate results with framework labels
|
|
112
|
+
- [x] Handle errors gracefully (continue on failure)
|
|
113
|
+
|
|
114
|
+
**Implementation:** Commands support `--for all` with framework-labeled output.
|
|
115
|
+
|
|
116
|
+
### 5.2 Daemon Lifecycle ✅
|
|
117
|
+
- [x] `ogp start` - Start daemon for current framework
|
|
118
|
+
- [x] `ogp --for all start` - Start daemons for all enabled frameworks
|
|
119
|
+
- [x] `ogp stop` - Stop daemon for current framework
|
|
120
|
+
- [x] `ogp --for all stop` - Stop all framework daemons
|
|
121
|
+
- [x] `ogp status` - Show status for current framework
|
|
122
|
+
- [x] `ogp --for all status` - Show status for all frameworks
|
|
123
|
+
|
|
124
|
+
**Files modified:**
|
|
125
|
+
- `src/cli.ts` - Updated start/stop/status commands
|
|
126
|
+
|
|
127
|
+
## Testing Plan
|
|
128
|
+
|
|
129
|
+
### Unit Tests ✅
|
|
130
|
+
- [x] Framework detection logic
|
|
131
|
+
- [x] Meta config load/save
|
|
132
|
+
- [x] Framework selection (auto, prompt, explicit)
|
|
133
|
+
- [x] Migration logic
|
|
134
|
+
|
|
135
|
+
### Integration Tests ✅
|
|
136
|
+
- [x] Setup wizard with multiple frameworks
|
|
137
|
+
- [x] Command execution with `--for` flag
|
|
138
|
+
- [x] Default framework behavior
|
|
139
|
+
- [x] `--for all` aggregation
|
|
140
|
+
|
|
141
|
+
### Manual Testing ✅
|
|
142
|
+
- [x] Fresh install on clean machine
|
|
143
|
+
- [x] Migration from existing single-framework setup
|
|
144
|
+
- [x] Migration from existing multi-framework setup
|
|
145
|
+
- [ ] Tab completion (bash and zsh) - Pending implementation
|
|
146
|
+
- [ ] `?` help in various contexts - Pending implementation
|
|
147
|
+
|
|
148
|
+
## Documentation ✅ COMPLETED
|
|
149
|
+
|
|
150
|
+
### User-Facing Docs ✅
|
|
151
|
+
- [x] Update README with multi-framework examples
|
|
152
|
+
- [x] Create GETTING-STARTED guide with framework setup
|
|
153
|
+
- [x] Update all examples to show `--for` flag usage
|
|
154
|
+
- [x] Add tab completion installation instructions
|
|
155
|
+
- [x] Create CLI-REFERENCE with complete command documentation
|
|
156
|
+
|
|
157
|
+
**Files created/updated:**
|
|
158
|
+
- `README.md` - Updated with multi-framework examples
|
|
159
|
+
- `docs/GETTING-STARTED.md` - Comprehensive setup and usage guide
|
|
160
|
+
- `docs/CLI-REFERENCE.md` - Complete command reference
|
|
161
|
+
- `docs/MIGRATION.md` - Migration guide for existing users
|
|
162
|
+
|
|
163
|
+
### Developer Docs ✅
|
|
164
|
+
- [x] Document meta config schema
|
|
165
|
+
- [x] Document framework detection logic
|
|
166
|
+
- [x] Document migration path for existing users
|
|
167
|
+
|
|
168
|
+
## Success Metrics
|
|
169
|
+
|
|
170
|
+
1. ✅ New users can set up OGP for multiple frameworks in < 2 minutes
|
|
171
|
+
2. ✅ Existing users can migrate without manual config editing
|
|
172
|
+
3. ⏳ Tab completion works for all major commands (documented, pending implementation)
|
|
173
|
+
4. ⏳ `?` help provides useful context at every level (documented, pending implementation)
|
|
174
|
+
5. ✅ Zero breaking changes for single-framework users
|
|
175
|
+
|
|
176
|
+
## Breaking Changes (None!)
|
|
177
|
+
|
|
178
|
+
- ✅ Old `OGP_HOME` environment variable still works (takes precedence)
|
|
179
|
+
- ✅ Single-framework setups work exactly as before (auto-selected)
|
|
180
|
+
- ✅ All existing commands maintain backward compatibility
|
|
181
|
+
|
|
182
|
+
## Future Enhancements (Post-v1.0)
|
|
183
|
+
|
|
184
|
+
- [ ] Framework aliases (`ogp alias add oc openclaw`)
|
|
185
|
+
- [ ] Custom framework definitions (for multiple OpenClaw instances)
|
|
186
|
+
- [ ] Framework-specific config overrides
|
|
187
|
+
- [ ] Cross-framework federation status view
|
|
188
|
+
- [ ] Framework health monitoring dashboard
|
|
189
|
+
- [ ] Tab completion implementation (currently documented)
|
|
190
|
+
- [ ] `?` style help implementation (currently documented)
|
|
191
|
+
|
|
192
|
+
## See Also
|
|
193
|
+
|
|
194
|
+
- [Getting Started Guide](./GETTING-STARTED.md) - Complete setup and workflows
|
|
195
|
+
- [CLI Reference](./CLI-REFERENCE.md) - Full command documentation
|
|
196
|
+
- [Migration Guide](./MIGRATION.md) - Upgrading to multi-framework
|
|
197
|
+
- [Design Document](./MULTI-FRAMEWORK-DESIGN.md) - Design principles
|