@synap-core/cli 0.9.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/README.md +250 -0
- package/dist/commands/connect.d.ts +11 -0
- package/dist/commands/connect.js +96 -0
- package/dist/commands/connect.js.map +1 -0
- package/dist/commands/finish.d.ts +16 -0
- package/dist/commands/finish.js +82 -0
- package/dist/commands/finish.js.map +1 -0
- package/dist/commands/init.d.ts +21 -0
- package/dist/commands/init.js +865 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/security-audit.d.ts +12 -0
- package/dist/commands/security-audit.js +100 -0
- package/dist/commands/security-audit.js.map +1 -0
- package/dist/commands/status.d.ts +6 -0
- package/dist/commands/status.js +216 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/update.d.ts +6 -0
- package/dist/commands/update.js +34 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +138 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/auth.d.ts +57 -0
- package/dist/lib/auth.js +322 -0
- package/dist/lib/auth.js.map +1 -0
- package/dist/lib/hardening.d.ts +18 -0
- package/dist/lib/hardening.js +203 -0
- package/dist/lib/hardening.js.map +1 -0
- package/dist/lib/openclaw.d.ts +28 -0
- package/dist/lib/openclaw.js +106 -0
- package/dist/lib/openclaw.js.map +1 -0
- package/dist/lib/pod.d.ts +91 -0
- package/dist/lib/pod.js +305 -0
- package/dist/lib/pod.js.map +1 -0
- package/dist/lib/seed.d.ts +13 -0
- package/dist/lib/seed.js +135 -0
- package/dist/lib/seed.js.map +1 -0
- package/dist/lib/templates.d.ts +11 -0
- package/dist/lib/templates.js +13 -0
- package/dist/lib/templates.js.map +1 -0
- package/dist/templates/agent-os.json +3090 -0
- package/dist/utils/logger.d.ts +11 -0
- package/dist/utils/logger.js +31 -0
- package/dist/utils/logger.js.map +1 -0
- package/package.json +45 -0
package/README.md
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
# @synap-core/cli
|
|
2
|
+
|
|
3
|
+
Connect [OpenClaw](https://github.com/openclaw/openclaw) to your Synap pod — sovereign knowledge infrastructure for AI agents.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npx @synap-core/cli init
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## What it does
|
|
12
|
+
|
|
13
|
+
`synap init` walks you through three paths depending on your setup:
|
|
14
|
+
|
|
15
|
+
| Path | When to use |
|
|
16
|
+
|------|-------------|
|
|
17
|
+
| **A** — Existing OpenClaw | OpenClaw is already running, just connect it to Synap |
|
|
18
|
+
| **B** — Fresh install | No OpenClaw yet — generates config, you run `openclaw --config synap.json` |
|
|
19
|
+
| **C** — Managed pod | Point to your Synap cloud pod, CLI handles everything |
|
|
20
|
+
|
|
21
|
+
After init, your AI agent gets structured memory (entities, relationships, full-text search, knowledge graph) via the `synap` OpenClaw skill.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Install
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Run once (no install needed)
|
|
29
|
+
npx @synap-core/cli init
|
|
30
|
+
|
|
31
|
+
# Or install globally
|
|
32
|
+
npm install -g @synap-core/cli
|
|
33
|
+
synap init
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Requirements**: Node.js 20+
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Commands
|
|
41
|
+
|
|
42
|
+
### `synap init`
|
|
43
|
+
|
|
44
|
+
Full setup wizard. Detects OpenClaw, connects to a pod, installs the skill, seeds the Agent OS workspace.
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
synap init
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
If OpenClaw is being provisioned on a managed server, setup may take a few minutes. Run `synap finish` once it's ready.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
### `synap finish`
|
|
55
|
+
|
|
56
|
+
Complete the setup after OpenClaw has started (managed pod path). Installs the skill, seeds entities, configures the intelligence service.
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
synap finish
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Run this after `synap init` if prompted — it's the second half of the managed pod flow.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
### `synap status`
|
|
67
|
+
|
|
68
|
+
Show the health of your entire stack at a glance.
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
synap status
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Output covers:
|
|
75
|
+
- **Account** — login state, token expiry
|
|
76
|
+
- **OpenClaw** — local running state, or remote provisioning state on your pod
|
|
77
|
+
- **Synap Pod** — URL, health, version
|
|
78
|
+
- **Workspace Config** — workspace ID, agent user, when config was saved
|
|
79
|
+
- **Intelligence Service** — whether AI is provisioned
|
|
80
|
+
- **Synap Skill** — whether the skill is installed in OpenClaw
|
|
81
|
+
- **Next Steps** — what to do next
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
### `synap login`
|
|
86
|
+
|
|
87
|
+
Sign in to your Synap account. Required for managed pod flows.
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
synap login # Opens browser
|
|
91
|
+
synap login --token <token> # Headless / server environments
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
For servers without a browser, generate a token at [synap.live/account/tokens](https://synap.live/account/tokens) and use `--token`.
|
|
95
|
+
|
|
96
|
+
Your session is kept alive automatically — as long as `synap status` or `synap init` succeeds at least once every 7 days, you won't need to re-login.
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
### `synap logout`
|
|
101
|
+
|
|
102
|
+
Remove stored credentials.
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
synap logout
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
### `synap connect`
|
|
111
|
+
|
|
112
|
+
Connect to a pod that was already provisioned (skip the full init wizard).
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
synap connect
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
### `synap security-audit`
|
|
121
|
+
|
|
122
|
+
Check your OpenClaw + Synap config for common security issues (API key exposure, outdated versions, HTTPS enforcement, etc.).
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
synap security-audit
|
|
126
|
+
synap security-audit --fix # Auto-fix what's fixable
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Example output:
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
✓ Gateway bound to loopback
|
|
133
|
+
✓ Token authentication enabled
|
|
134
|
+
✗ OpenClaw version 2026.2.x — CRITICAL (9.9 CVSS)
|
|
135
|
+
✓ No plaintext credentials
|
|
136
|
+
✗ ~/.openclaw world-readable
|
|
137
|
+
✓ WebSocket origin validation
|
|
138
|
+
✓ Dangerous skill scanner
|
|
139
|
+
✓ Workspace filesystem access
|
|
140
|
+
✓ Exec approval gates
|
|
141
|
+
|
|
142
|
+
Score: B (2 issues, 1 critical)
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
### `synap update`
|
|
148
|
+
|
|
149
|
+
Update the Synap skill in your OpenClaw installation to the latest version.
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
synap update
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Configuration
|
|
158
|
+
|
|
159
|
+
The CLI stores config in `~/.synap/` (user-only, `chmod 600`):
|
|
160
|
+
|
|
161
|
+
| File | Contents |
|
|
162
|
+
|------|----------|
|
|
163
|
+
| `credentials.json` | CP auth token |
|
|
164
|
+
| `pod-config.json` | Pod URL, workspace ID, agent user ID, Hub API key |
|
|
165
|
+
|
|
166
|
+
Never commit these files.
|
|
167
|
+
|
|
168
|
+
### Environment variables
|
|
169
|
+
|
|
170
|
+
| Variable | Default | Description |
|
|
171
|
+
|----------|---------|-------------|
|
|
172
|
+
| `SYNAP_CP_URL` | `https://api.synap.live` | Control plane API URL |
|
|
173
|
+
| `SYNAP_LANDING_URL` | `https://synap.live` | Landing page URL (for OAuth callback) |
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## How the skill works
|
|
178
|
+
|
|
179
|
+
The `synap` OpenClaw skill gives your AI agents access to Synap's Hub Protocol:
|
|
180
|
+
|
|
181
|
+
| What | How the agent uses it |
|
|
182
|
+
|------|----------------------|
|
|
183
|
+
| Store a memory | Save a fact — keyword or semantic search |
|
|
184
|
+
| Search memories | Find relevant facts across everything stored |
|
|
185
|
+
| Create an entity | Structured object (person, task, note, project, …) |
|
|
186
|
+
| Search entities | Find by name, type, or content |
|
|
187
|
+
| Send a message | Post to any channel |
|
|
188
|
+
| Create a proposal | Propose a change for human review |
|
|
189
|
+
|
|
190
|
+
Agents self-discover available entity types and views at runtime — no hardcoding.
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## Deployment paths
|
|
195
|
+
|
|
196
|
+
### Self-hosted (free)
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
git clone https://github.com/synap-core/synap-backend
|
|
200
|
+
cd synap-backend
|
|
201
|
+
docker compose --profile openclaw up -d
|
|
202
|
+
# then:
|
|
203
|
+
synap init # → "Connect to existing pod" → http://localhost:4000
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Managed pod ($15–20/mo)
|
|
207
|
+
|
|
208
|
+
1. Create a pod at [synap.live](https://synap.live)
|
|
209
|
+
2. Run `synap init` → "Connect to my Synap cloud pod"
|
|
210
|
+
3. Select your pod — CLI handles provisioning
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## Troubleshooting
|
|
215
|
+
|
|
216
|
+
**"Could not reach pod"**
|
|
217
|
+
Check that your pod URL is reachable. For self-hosted, make sure Docker Compose is up and port 4000 is accessible.
|
|
218
|
+
|
|
219
|
+
**"No workspace found on this pod"**
|
|
220
|
+
The CLI auto-creates an Agent OS workspace on first connect. Re-run `synap init` — it's idempotent.
|
|
221
|
+
|
|
222
|
+
**"OpenClaw provisioning error"** (managed pod, `serverIp null`)
|
|
223
|
+
Your managed pod doesn't have a registered server IP (trial pods). Install OpenClaw locally instead:
|
|
224
|
+
```bash
|
|
225
|
+
npm i -g openclaw
|
|
226
|
+
synap init # → Path A
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
**Login on a remote server (no browser)**
|
|
230
|
+
```bash
|
|
231
|
+
synap login --token <your-token>
|
|
232
|
+
# Generate token at: https://synap.live/account/tokens
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
**"Session expired" in synap status**
|
|
236
|
+
Run `synap login` again. In normal use the session auto-refreshes and you should only need to login once.
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
## Why Synap
|
|
241
|
+
|
|
242
|
+
- **Structured memory**: OpenClaw's `MEMORY.md` is flat files. Synap gives you PostgreSQL + pgvector + Typesense — entities, relationships, full-text + semantic search.
|
|
243
|
+
- **Governance**: AI agent mutations go through proposals — reviewable, reversible, auditable.
|
|
244
|
+
- **Sovereign**: Self-host for free. Your data stays on your infrastructure.
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## License
|
|
249
|
+
|
|
250
|
+
MIT
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* synap connect
|
|
3
|
+
*
|
|
4
|
+
* Quick connection: link existing OpenClaw to existing Synap pod.
|
|
5
|
+
*/
|
|
6
|
+
import prompts from "prompts";
|
|
7
|
+
import ora from "ora";
|
|
8
|
+
import { log, banner } from "../utils/logger.js";
|
|
9
|
+
import { detectOpenClaw, readOpenClawConfig, writeOpenClawConfig, setConfigValue } from "../lib/openclaw.js";
|
|
10
|
+
import { checkPodHealth, setupAgent } from "../lib/pod.js";
|
|
11
|
+
export async function connect(opts) {
|
|
12
|
+
banner();
|
|
13
|
+
log.heading("Connect to Synap Pod");
|
|
14
|
+
// Get pod URL
|
|
15
|
+
let podUrl = opts.podUrl;
|
|
16
|
+
if (!podUrl) {
|
|
17
|
+
const { url } = await prompts({
|
|
18
|
+
type: "text",
|
|
19
|
+
name: "url",
|
|
20
|
+
message: "Synap pod URL:",
|
|
21
|
+
initial: "http://localhost:4000",
|
|
22
|
+
});
|
|
23
|
+
podUrl = url;
|
|
24
|
+
}
|
|
25
|
+
if (!podUrl)
|
|
26
|
+
return;
|
|
27
|
+
// Health check
|
|
28
|
+
const spinner = ora("Checking pod health...").start();
|
|
29
|
+
const status = await checkPodHealth(podUrl);
|
|
30
|
+
if (!status.healthy) {
|
|
31
|
+
spinner.fail(`Pod not reachable at ${podUrl}`);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
spinner.succeed(`Pod healthy at ${podUrl}`);
|
|
35
|
+
// Get or generate API key
|
|
36
|
+
let apiKey = opts.apiKey;
|
|
37
|
+
if (!apiKey) {
|
|
38
|
+
const { method } = await prompts({
|
|
39
|
+
type: "select",
|
|
40
|
+
name: "method",
|
|
41
|
+
message: "Authentication:",
|
|
42
|
+
choices: [
|
|
43
|
+
{ title: "Paste existing API key", value: "paste" },
|
|
44
|
+
{ title: "Generate new key (needs PROVISIONING_TOKEN)", value: "generate" },
|
|
45
|
+
],
|
|
46
|
+
});
|
|
47
|
+
if (method === "paste") {
|
|
48
|
+
const { key } = await prompts({
|
|
49
|
+
type: "password",
|
|
50
|
+
name: "key",
|
|
51
|
+
message: "Hub Protocol API key:",
|
|
52
|
+
});
|
|
53
|
+
apiKey = key;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
const { token } = await prompts({
|
|
57
|
+
type: "password",
|
|
58
|
+
name: "token",
|
|
59
|
+
message: "PROVISIONING_TOKEN:",
|
|
60
|
+
});
|
|
61
|
+
if (token) {
|
|
62
|
+
const genSpinner = ora("Creating agent credentials...").start();
|
|
63
|
+
try {
|
|
64
|
+
const result = await setupAgent(podUrl, token);
|
|
65
|
+
apiKey = result.hubApiKey;
|
|
66
|
+
genSpinner.succeed("Credentials created");
|
|
67
|
+
// Save to OpenClaw config
|
|
68
|
+
const oc = detectOpenClaw();
|
|
69
|
+
if (oc.found) {
|
|
70
|
+
const config = readOpenClawConfig() ?? {};
|
|
71
|
+
setConfigValue(config, "synap.podUrl", podUrl);
|
|
72
|
+
setConfigValue(config, "synap.workspaceId", result.workspaceId);
|
|
73
|
+
setConfigValue(config, "synap.agentUserId", result.agentUserId);
|
|
74
|
+
writeOpenClawConfig(config);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
genSpinner.fail(err instanceof Error ? err.message : "Failed");
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (!apiKey)
|
|
85
|
+
return;
|
|
86
|
+
log.blank();
|
|
87
|
+
log.success("Connected to Synap pod");
|
|
88
|
+
log.blank();
|
|
89
|
+
log.info("Set these environment variables:");
|
|
90
|
+
log.dim(` export SYNAP_HUB_API_KEY="${apiKey}"`);
|
|
91
|
+
log.dim(` export SYNAP_POD_URL="${podUrl}"`);
|
|
92
|
+
log.blank();
|
|
93
|
+
log.info("Install the skill:");
|
|
94
|
+
log.dim(" openclaw skills install synap");
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=connect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../src/commands/connect.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EA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,CAAC;gBACH,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,UAAU,CAAC,IAAI,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;oBAC/D,OAAO;gBACT,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,IAAI,CAAC,MAAM;QAAE,OAAO;IAEpB,GAAG,CAAC,KAAK,EAAE,CAAC;IACZ,GAAG,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC;IACtC,GAAG,CAAC,KAAK,EAAE,CAAC;IACZ,GAAG,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;IAC7C,GAAG,CAAC,GAAG,CAAC,+BAA+B,MAAM,GAAG,CAAC,CAAC;IAClD,GAAG,CAAC,GAAG,CAAC,2BAA2B,MAAM,GAAG,CAAC,CAAC;IAC9C,GAAG,CAAC,KAAK,EAAE,CAAC;IACZ,GAAG,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IAC/B,GAAG,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* synap finish
|
|
3
|
+
*
|
|
4
|
+
* Complete setup after OpenClaw has been provisioned.
|
|
5
|
+
* Run this once OpenClaw is running (a few minutes after synap init).
|
|
6
|
+
*
|
|
7
|
+
* Steps:
|
|
8
|
+
* 1. Verify pod connection (reads ~/.synap/pod-config.json)
|
|
9
|
+
* 2. Check pod health
|
|
10
|
+
* 3. Check OpenClaw is running
|
|
11
|
+
* 4. Security audit
|
|
12
|
+
* 5. Install synap skill
|
|
13
|
+
* 6. Seed workspace entities
|
|
14
|
+
* 7. Optionally configure IS as AI provider
|
|
15
|
+
*/
|
|
16
|
+
export declare function finish(): Promise<void>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* synap finish
|
|
3
|
+
*
|
|
4
|
+
* Complete setup after OpenClaw has been provisioned.
|
|
5
|
+
* Run this once OpenClaw is running (a few minutes after synap init).
|
|
6
|
+
*
|
|
7
|
+
* Steps:
|
|
8
|
+
* 1. Verify pod connection (reads ~/.synap/pod-config.json)
|
|
9
|
+
* 2. Check pod health
|
|
10
|
+
* 3. Check OpenClaw is running
|
|
11
|
+
* 4. Security audit
|
|
12
|
+
* 5. Install synap skill
|
|
13
|
+
* 6. Seed workspace entities
|
|
14
|
+
* 7. Optionally configure IS as AI provider
|
|
15
|
+
*/
|
|
16
|
+
import chalk from "chalk";
|
|
17
|
+
import { log, banner } from "../utils/logger.js";
|
|
18
|
+
import { detectOpenClaw } from "../lib/openclaw.js";
|
|
19
|
+
import { checkPodHealth, getLocalPodConfig } from "../lib/pod.js";
|
|
20
|
+
import { securityStep, skillStep, seedStep, isStep } from "./init.js";
|
|
21
|
+
export async function finish() {
|
|
22
|
+
banner();
|
|
23
|
+
// ── Step 1: Verify pod config ──────────────────────────────────────────────
|
|
24
|
+
const localConfig = getLocalPodConfig();
|
|
25
|
+
if (!localConfig) {
|
|
26
|
+
log.error("Not connected to a pod.");
|
|
27
|
+
log.dim("Run: synap init");
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
const { podUrl, hubApiKey } = localConfig;
|
|
31
|
+
// ── Step 2: Check pod health ───────────────────────────────────────────────
|
|
32
|
+
log.heading("Synap Pod");
|
|
33
|
+
const pod = await checkPodHealth(podUrl);
|
|
34
|
+
log.info(`URL: ${podUrl}`);
|
|
35
|
+
if (!pod.healthy) {
|
|
36
|
+
log.error("Pod is unreachable.");
|
|
37
|
+
log.dim("Check your network connection and pod status.");
|
|
38
|
+
log.dim(" synap status");
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
log.success(`Health: ${chalk.green("healthy")}${pod.version ? ` (v${pod.version})` : ""}`);
|
|
42
|
+
// ── Step 3: Check OpenClaw ─────────────────────────────────────────────────
|
|
43
|
+
log.heading("OpenClaw");
|
|
44
|
+
const oc = detectOpenClaw();
|
|
45
|
+
if (!oc.found) {
|
|
46
|
+
log.warn("OpenClaw is not running yet.");
|
|
47
|
+
log.blank();
|
|
48
|
+
log.dim("If you just ran `synap init`, it may still be starting (2-5 min).");
|
|
49
|
+
log.dim("Check with: `synap status`");
|
|
50
|
+
log.blank();
|
|
51
|
+
log.info("Run `synap finish` again once it's up.");
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
log.success(`Version: ${oc.version ?? "unknown"}`);
|
|
55
|
+
log.info(`Gateway: ${oc.gatewayRunning ? chalk.green("running") : chalk.dim("stopped")} (port ${oc.gatewayPort ?? 18789})`);
|
|
56
|
+
// ── Step 4: Security audit ─────────────────────────────────────────────────
|
|
57
|
+
await securityStep(oc.version);
|
|
58
|
+
// ── Step 5: Install skill ──────────────────────────────────────────────────
|
|
59
|
+
await skillStep(true);
|
|
60
|
+
// ── Step 6: Seed workspace ─────────────────────────────────────────────────
|
|
61
|
+
await seedStep(podUrl, hubApiKey, oc);
|
|
62
|
+
// ── Step 7: Configure IS ──────────────────────────────────────────────────
|
|
63
|
+
await isStep(podUrl, hubApiKey, true);
|
|
64
|
+
// ── Summary ────────────────────────────────────────────────────────────────
|
|
65
|
+
log.blank();
|
|
66
|
+
console.log(chalk.green("═══════════════════════════════════════════"));
|
|
67
|
+
console.log(chalk.green.bold(" Synap + OpenClaw Ready"));
|
|
68
|
+
console.log(chalk.green("═══════════════════════════════════════════"));
|
|
69
|
+
log.blank();
|
|
70
|
+
log.info(`Pod: ${podUrl}`);
|
|
71
|
+
log.info("Skill: synap (knowledge graph + relay)");
|
|
72
|
+
log.blank();
|
|
73
|
+
log.info("Try it now:");
|
|
74
|
+
log.dim(' Ask your agent: "remember that Marc prefers email"');
|
|
75
|
+
log.dim(' Then later: "what do I know about Marc?"');
|
|
76
|
+
log.blank();
|
|
77
|
+
log.dim(" synap status — health check");
|
|
78
|
+
log.dim(" synap update — update skill");
|
|
79
|
+
log.dim(" synap security-audit — verify security");
|
|
80
|
+
log.blank();
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=finish.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finish.js","sourceRoot":"","sources":["../../src/commands/finish.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEtE,MAAM,CAAC,KAAK,UAAU,MAAM;IAC1B,MAAM,EAAE,CAAC;IAET,8EAA8E;IAC9E,MAAM,WAAW,GAAG,iBAAiB,EAAE,CAAC;IACxC,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,GAAG,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;QACrC,GAAG,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QAC3B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,WAAW,CAAC;IAE1C,8EAA8E;IAC9E,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IACzB,MAAM,GAAG,GAAG,MAAM,cAAc,CAAC,MAAM,CAAC,CAAC;IACzC,GAAG,CAAC,IAAI,CAAC,QAAQ,MAAM,EAAE,CAAC,CAAC;IAC3B,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;QACjB,GAAG,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;QACjC,GAAG,CAAC,GAAG,CAAC,+CAA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AC,MAAM,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;IAEtC,6EAA6E;IAC7E,MAAM,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IAEtC,8EAA8E;IAC9E,GAAG,CAAC,KAAK,EAAE,CAAC;IACZ,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,6CAA6C,CAAC,CAAC,CAAC;IACxE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC,CAAC;IAC1D,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,6CAA6C,CAAC,CAAC,CAAC;IACxE,GAAG,CAAC,KAAK,EAAE,CAAC;IACZ,GAAG,CAAC,IAAI,CAAC,QAAQ,MAAM,EAAE,CAAC,CAAC;IAC3B,GAAG,CAAC,IAAI,CAAC,wCAAwC,CAAC,CAAC;IACnD,GAAG,CAAC,KAAK,EAAE,CAAC;IACZ,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACxB,GAAG,CAAC,GAAG,CAAC,sDAAsD,CAAC,CAAC;IAChE,GAAG,CAAC,GAAG,CAAC,4CAA4C,CAAC,CAAC;IACtD,GAAG,CAAC,KAAK,EAAE,CAAC;IACZ,GAAG,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;IACjD,GAAG,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;IACjD,GAAG,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;IACpD,GAAG,CAAC,KAAK,EAAE,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* synap init
|
|
3
|
+
*
|
|
4
|
+
* Three paths based on environment detection:
|
|
5
|
+
* A: OpenClaw found → connect mode (primary funnel, 250K users)
|
|
6
|
+
* B: Server, no OpenClaw → bundle mode (fresh setup)
|
|
7
|
+
* C: Laptop/desktop → need hosting
|
|
8
|
+
*/
|
|
9
|
+
import { detectOpenClaw } from "../lib/openclaw.js";
|
|
10
|
+
interface InitOptions {
|
|
11
|
+
podUrl?: string;
|
|
12
|
+
apiKey?: string;
|
|
13
|
+
skipSecurity?: boolean;
|
|
14
|
+
skipIs?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare function init(opts: InitOptions): Promise<void>;
|
|
17
|
+
export declare function securityStep(version?: string): Promise<void>;
|
|
18
|
+
export declare function skillStep(openclawFound: boolean): Promise<void>;
|
|
19
|
+
export declare function seedStep(podUrl: string, apiKey: string, oc: ReturnType<typeof detectOpenClaw>): Promise<void>;
|
|
20
|
+
export declare function isStep(podUrl: string, apiKey: string, openclawFound: boolean): Promise<void>;
|
|
21
|
+
export {};
|