synthesis-cli 0.1.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.md +45 -0
- package/dist/cli.d.ts +13 -0
- package/dist/cli.js +71 -0
- package/package.json +47 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# synthesis-cli
|
|
2
|
+
|
|
3
|
+
`synthesis-cli` is a deliberately thin wrapper around child CLIs.
|
|
4
|
+
|
|
5
|
+
## Vision
|
|
6
|
+
|
|
7
|
+
One entrypoint (`synthesis`) that routes directly to domain CLIs (uniswap, lido, moonpay, 8004, filecoin), without adding abstraction layers that drift from upstream tools.
|
|
8
|
+
|
|
9
|
+
## Philosophy: thin and direct
|
|
10
|
+
|
|
11
|
+
- No business logic duplication.
|
|
12
|
+
- No protocol-specific wrappers inside this package.
|
|
13
|
+
- Forward args as-is to child CLIs.
|
|
14
|
+
- Keep maintenance surface tiny.
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
synthesis <moonpay|uniswap|lido|8004|filecoin> [...args]
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Examples:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
synthesis uniswap swap --help
|
|
26
|
+
synthesis lido stake 1
|
|
27
|
+
synthesis 8004 status
|
|
28
|
+
synthesis filecoin --version
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Install
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm i -g synthesis-cli
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
> Note: Child CLIs must also be installed and available on your PATH.
|
|
38
|
+
|
|
39
|
+
## Development
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm install
|
|
43
|
+
npm run build
|
|
44
|
+
npm test
|
|
45
|
+
```
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawnSync, SpawnSyncReturns } from 'node:child_process';
|
|
3
|
+
|
|
4
|
+
declare const ROUTES: Record<string, string>;
|
|
5
|
+
declare function helpText(): string;
|
|
6
|
+
declare function routeArgs(argv: string[]): {
|
|
7
|
+
command?: string;
|
|
8
|
+
forwardedArgs: string[];
|
|
9
|
+
};
|
|
10
|
+
type SpawnFn = (command: string, args: string[], options: Parameters<typeof spawnSync>[2]) => SpawnSyncReturns<Buffer>;
|
|
11
|
+
declare function run(argv: string[], spawnFn?: SpawnFn): number;
|
|
12
|
+
|
|
13
|
+
export { ROUTES, helpText, routeArgs, run };
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/cli.ts
|
|
4
|
+
import { spawnSync } from "child_process";
|
|
5
|
+
var ROUTES = {
|
|
6
|
+
moonpay: "moonpay",
|
|
7
|
+
uniswap: "uniswap",
|
|
8
|
+
lido: "lido",
|
|
9
|
+
"8004": "8004",
|
|
10
|
+
filecoin: "filecoin"
|
|
11
|
+
};
|
|
12
|
+
var HELP_TEXT = `synthesis-cli
|
|
13
|
+
|
|
14
|
+
A thin command router for child CLIs.
|
|
15
|
+
|
|
16
|
+
Usage:
|
|
17
|
+
synthesis <moonpay|uniswap|lido|8004|filecoin> [...args]
|
|
18
|
+
|
|
19
|
+
Examples:
|
|
20
|
+
synthesis uniswap swap --help
|
|
21
|
+
synthesis lido stake 1
|
|
22
|
+
synthesis 8004 status
|
|
23
|
+
|
|
24
|
+
Philosophy:
|
|
25
|
+
synthesis does not reimplement child CLI logic.
|
|
26
|
+
It forwards argv directly to installed child CLIs.
|
|
27
|
+
`;
|
|
28
|
+
function helpText() {
|
|
29
|
+
return HELP_TEXT;
|
|
30
|
+
}
|
|
31
|
+
function routeArgs(argv) {
|
|
32
|
+
const [command, ...forwardedArgs] = argv;
|
|
33
|
+
return { command, forwardedArgs };
|
|
34
|
+
}
|
|
35
|
+
function run(argv, spawnFn = spawnSync) {
|
|
36
|
+
const { command, forwardedArgs } = routeArgs(argv);
|
|
37
|
+
if (!command || command === "-h" || command === "--help" || command === "help") {
|
|
38
|
+
process.stdout.write(`${helpText()}
|
|
39
|
+
`);
|
|
40
|
+
return 0;
|
|
41
|
+
}
|
|
42
|
+
const target = ROUTES[command];
|
|
43
|
+
if (!target) {
|
|
44
|
+
process.stderr.write(`Unknown command: ${command}
|
|
45
|
+
|
|
46
|
+
${helpText()}
|
|
47
|
+
`);
|
|
48
|
+
return 1;
|
|
49
|
+
}
|
|
50
|
+
const result = spawnFn(target, forwardedArgs, {
|
|
51
|
+
stdio: "inherit",
|
|
52
|
+
shell: process.platform === "win32"
|
|
53
|
+
});
|
|
54
|
+
if (result.error) {
|
|
55
|
+
const msg = result.error.message || String(result.error);
|
|
56
|
+
process.stderr.write(`Failed to execute '${target}': ${msg}
|
|
57
|
+
`);
|
|
58
|
+
return 1;
|
|
59
|
+
}
|
|
60
|
+
return result.status ?? 0;
|
|
61
|
+
}
|
|
62
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
63
|
+
const code = run(process.argv.slice(2));
|
|
64
|
+
process.exit(code);
|
|
65
|
+
}
|
|
66
|
+
export {
|
|
67
|
+
ROUTES,
|
|
68
|
+
helpText,
|
|
69
|
+
routeArgs,
|
|
70
|
+
run
|
|
71
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "synthesis-cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Thin wrapper CLI that routes to DeFi and infra child CLIs",
|
|
5
|
+
"private": false,
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"synthesis": "dist/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"README.md",
|
|
13
|
+
"LICENSE"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsup src/cli.ts --format esm --dts --clean",
|
|
17
|
+
"dev": "tsx src/cli.ts",
|
|
18
|
+
"test": "vitest run",
|
|
19
|
+
"typecheck": "tsc --noEmit",
|
|
20
|
+
"lint": "eslint .",
|
|
21
|
+
"prepare": "npm run build"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"cli",
|
|
25
|
+
"wrapper",
|
|
26
|
+
"uniswap",
|
|
27
|
+
"lido",
|
|
28
|
+
"moonpay",
|
|
29
|
+
"filecoin"
|
|
30
|
+
],
|
|
31
|
+
"author": "",
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=20"
|
|
35
|
+
},
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"provenance": false,
|
|
38
|
+
"access": "public"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@types/node": "^24.0.0",
|
|
42
|
+
"tsup": "^8.2.0",
|
|
43
|
+
"tsx": "^4.20.0",
|
|
44
|
+
"typescript": "^5.8.0",
|
|
45
|
+
"vitest": "^2.1.8"
|
|
46
|
+
}
|
|
47
|
+
}
|