@halfagiraf/clawx 0.1.15 → 0.1.17
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 +49 -3
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +19 -4
- package/dist/config/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -364,7 +364,8 @@ Clawx looks for config in this order (first match wins):
|
|
|
364
364
|
| 2 | `~/.clawx/config` | `clawx init` | Global config (recommended) |
|
|
365
365
|
| 3 | `.env` in package install dir | Dev only | Fallback for development |
|
|
366
366
|
| 4 | `clawx.json` in current directory | You | JSON format, supports systemPrompt |
|
|
367
|
-
| 5 |
|
|
367
|
+
| 5 | `~/.clawx/clawx.json` | You | Global JSON config (SSH targets, etc.) |
|
|
368
|
+
| 6 | Built-in defaults | — | Ollama on localhost |
|
|
368
369
|
|
|
369
370
|
**Config file paths by OS:**
|
|
370
371
|
|
|
@@ -376,6 +377,8 @@ Clawx looks for config in this order (first match wins):
|
|
|
376
377
|
|
|
377
378
|
The fastest way to set up is `clawx init` — it writes `~/.clawx/config` for you. To override per-project, drop a `.env` or `clawx.json` in the project directory.
|
|
378
379
|
|
|
380
|
+
**Global SSH targets:** Place a `clawx.json` in `~/.clawx/` to make SSH targets available from any directory. Local `clawx.json` targets override global ones with the same name.
|
|
381
|
+
|
|
379
382
|
### Environment variables
|
|
380
383
|
|
|
381
384
|
```bash
|
|
@@ -570,11 +573,54 @@ The agent will create files, install dependencies, build, and verify — iterati
|
|
|
570
573
|
|
|
571
574
|
### Remote scaffolding via SSH
|
|
572
575
|
|
|
576
|
+
Clawx can SSH into other machines on your network and run commands — from installing packages to deploying services. You describe what you want on your desktop; it happens on the remote machine.
|
|
577
|
+
|
|
578
|
+
**1. Configure an SSH target** in `clawx.json` (in your working directory):
|
|
579
|
+
|
|
580
|
+
```json
|
|
581
|
+
{
|
|
582
|
+
"sshTargets": {
|
|
583
|
+
"pi": {
|
|
584
|
+
"host": "192.168.1.198",
|
|
585
|
+
"username": "dev",
|
|
586
|
+
"privateKeyPath": "~/.ssh/id_ed25519"
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
```
|
|
591
|
+
|
|
592
|
+
**2. Run a prompt that references the target:**
|
|
593
|
+
|
|
573
594
|
```bash
|
|
574
|
-
|
|
575
|
-
clawx run "SSH into my Pi and set up a Node.js service that monitors CPU temperature and exposes it as a Prometheus metric on port 9100"
|
|
595
|
+
clawx run "SSH into the pi and run: hostname && uname -a"
|
|
576
596
|
```
|
|
577
597
|
|
|
598
|
+
**3. Clawx connects and executes:**
|
|
599
|
+
|
|
600
|
+
```
|
|
601
|
+
[tool] ssh_run target="pi" command="hostname && uname -a"
|
|
602
|
+
[pi] exit=0 (943ms)
|
|
603
|
+
ubuntu
|
|
604
|
+
Linux ubuntu 6.14.0-1019-raspi aarch64 GNU/Linux
|
|
605
|
+
```
|
|
606
|
+
|
|
607
|
+
Tested and verified with DeepSeek API → Raspberry Pi 4 (Ubuntu aarch64) over local network.
|
|
608
|
+
|
|
609
|
+
**More SSH examples:**
|
|
610
|
+
|
|
611
|
+
```bash
|
|
612
|
+
# Install and start a service on a remote Pi
|
|
613
|
+
clawx run "SSH into the pi, install Node.js, create an Express API with a /hello endpoint, start it on port 3000, and verify it's running with curl"
|
|
614
|
+
|
|
615
|
+
# Set up monitoring
|
|
616
|
+
clawx run "SSH into the pi and set up a Node.js service that monitors CPU temperature and exposes it as a Prometheus metric on port 9100"
|
|
617
|
+
|
|
618
|
+
# Deploy to a server
|
|
619
|
+
clawx run "SSH into server, pull the latest code from git, run npm install, and restart the PM2 process"
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
You can define multiple targets (pi, server, vm, etc.) and reference them by name in your prompts.
|
|
623
|
+
|
|
578
624
|
### Interactive basic REPL
|
|
579
625
|
|
|
580
626
|
```bash
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,WAAW,EAAa,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,WAAW,EAAa,MAAM,mBAAmB,CAAC;AAyDhE,yCAAyC;AACzC,wBAAgB,kBAAkB,IAAI,MAAM,CAK3C;AAED,kDAAkD;AAClD,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAED,wBAAgB,UAAU,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,WAAW,CAmFxE"}
|
package/dist/config/index.js
CHANGED
|
@@ -31,18 +31,33 @@ function parseSshTargets(raw) {
|
|
|
31
31
|
return {};
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
|
|
36
|
-
if (!fs.existsSync(configPath))
|
|
34
|
+
function loadJsonFile(filePath) {
|
|
35
|
+
if (!fs.existsSync(filePath))
|
|
37
36
|
return {};
|
|
38
37
|
try {
|
|
39
|
-
const raw = fs.readFileSync(
|
|
38
|
+
const raw = fs.readFileSync(filePath, "utf-8");
|
|
40
39
|
return JSON.parse(raw);
|
|
41
40
|
}
|
|
42
41
|
catch {
|
|
43
42
|
return {};
|
|
44
43
|
}
|
|
45
44
|
}
|
|
45
|
+
function loadJsonConfig(workDir) {
|
|
46
|
+
// 1. Check current working directory first
|
|
47
|
+
const local = loadJsonFile(path.join(workDir, "clawx.json"));
|
|
48
|
+
// 2. Check global config directory (~/.clawx/clawx.json)
|
|
49
|
+
const global = loadJsonFile(path.join(getGlobalConfigDir(), "clawx.json"));
|
|
50
|
+
// Local overrides global, but merge sshTargets from both
|
|
51
|
+
const mergedSshTargets = {
|
|
52
|
+
...(global.sshTargets || {}),
|
|
53
|
+
...(local.sshTargets || {}),
|
|
54
|
+
};
|
|
55
|
+
const merged = { ...global, ...local };
|
|
56
|
+
if (Object.keys(mergedSshTargets).length > 0) {
|
|
57
|
+
merged.sshTargets = mergedSshTargets;
|
|
58
|
+
}
|
|
59
|
+
return merged;
|
|
60
|
+
}
|
|
46
61
|
/** Global config directory: ~/.clawx/ */
|
|
47
62
|
export function getGlobalConfigDir() {
|
|
48
63
|
return path.join(process.env.HOME || process.env.USERPROFILE || ".", ".clawx");
|
package/dist/config/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,QAAQ,CAAC;AAG9C,MAAM,QAAQ,GAAgB;IAC5B,QAAQ,EAAE,oBAAoB;IAC9B,OAAO,EAAE,0BAA0B;IACnC,KAAK,EAAE,4BAA4B;IACnC,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,OAAO,CAAC,GAAG,EAAE;IACtB,KAAK,EAAE,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW;IAC7D,WAAW,EAAE,OAAO;IACpB,aAAa,EAAE,QAAQ;IACvB,SAAS,EAAE,KAAK;IAChB,UAAU,EAAE,IAAI,CAAC,IAAI,CACnB,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,GAAG,EAClD,QAAQ,EACR,UAAU,CACX;IACD,UAAU,EAAE,EAAE;CACf,CAAC;AAEF,SAAS,eAAe,CAAC,GAAW;IAClC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAI,OAAO,MAAM,KAAK,QA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