@darwin.finance/cli 1.0.0 → 1.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/README.md +43 -12
- package/dist/darwin.js +1843 -484
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,10 +7,13 @@ your computer's secret store, and turns every agent action into a command — fo
|
|
|
7
7
|
|
|
8
8
|
Chat apps like Claude or ChatGPT don't use the CLI — they connect to Darwin directly instead.
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
> (below) for testing only.
|
|
10
|
+
## Install
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
```sh
|
|
13
|
+
npm i -g @darwin.finance/cli
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Install from source (for testing)
|
|
14
17
|
|
|
15
18
|
Requires Node.js 20+ and [Bun](https://bun.sh) to build.
|
|
16
19
|
|
|
@@ -23,7 +26,7 @@ npm i -g .
|
|
|
23
26
|
darwin --version
|
|
24
27
|
```
|
|
25
28
|
|
|
26
|
-
|
|
29
|
+
Always install it — never run it
|
|
27
30
|
through `npx`: the CLI refuses to read a saved key when it runs from npx or from a project's
|
|
28
31
|
`node_modules`, because a project you are merely working in could substitute its own copy.
|
|
29
32
|
|
|
@@ -36,11 +39,37 @@ darwin help # every command, from Darwin's own catalogue
|
|
|
36
39
|
darwin whoami
|
|
37
40
|
```
|
|
38
41
|
|
|
42
|
+
Output is readable text in a terminal and one JSON document when piped or redirected (or with
|
|
43
|
+
`--json`; `--format table` forces text). The JSON is Darwin's answer unchanged.
|
|
44
|
+
|
|
39
45
|
What each command does is documented by Darwin itself: the command list is fetched from the site you
|
|
40
46
|
logged in to (`darwin help`, `darwin <command> --help`, `darwin help --json`), so new commands appear
|
|
41
47
|
without a new release of this program. The API reference: <https://darwin.finance/agents/docs>.
|
|
42
48
|
|
|
43
|
-
|
|
49
|
+
### Trading (1.1)
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
darwin quote --sell USDC --amount 5 --for SOL # then: darwin order --quote <id> …
|
|
53
|
+
darwin instant --sell SOL --amount 0.1 --for USDC --max-slippage-bps 50
|
|
54
|
+
darwin perps collateral deposit --amount 5 # USDC: agent wallet → its own perps account
|
|
55
|
+
darwin perps order SOL --side long --size 0.01 --type market
|
|
56
|
+
darwin perps protect SOL --sl 120 --tp 160 [--percent 50] # or --cancel tp|sl|both
|
|
57
|
+
darwin perps close SOL [--size 0.01]
|
|
58
|
+
darwin perps collateral withdraw --amount 5 # back to the agent's own wallet
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
On a site that supports it, every order is two steps behind the scenes: Darwin first **checks** it
|
|
62
|
+
(the agent can trade, perps is set up, there is free collateral, the position or quote is there) and
|
|
63
|
+
stores exactly what it will send — pinning a close's size and side, and which TP/SL a change
|
|
64
|
+
replaces — then sends it **once**. After sending, the CLI waits a few seconds (reading only) and
|
|
65
|
+
says whether it went through. `--dry-run` runs Darwin's real checks and sends nothing.
|
|
66
|
+
|
|
67
|
+
If an order's answer is lost (exit 6), **don't run the command again**: run the `darwin retry <id>`
|
|
68
|
+
it printed. It only reads what happened — went through, still pending, failed or never sent — and
|
|
69
|
+
never sends anything. `darwin cancel <id>` makes sure an order that hasn't started never runs.
|
|
70
|
+
|
|
71
|
+
`darwin mcp` runs the same commands as a local MCP server for desktop AI clients (writes go through
|
|
72
|
+
the same check-then-send; `check_prepared` is the read-only recovery tool, `cancel_prepared` the cancel);
|
|
44
73
|
`darwin mcp --print-config claude|cursor|gemini` prints the registration.
|
|
45
74
|
|
|
46
75
|
## Security model
|
|
@@ -56,12 +85,14 @@ without a new release of this program. The API reference: <https://darwin.financ
|
|
|
56
85
|
- **No more than the key.** Every command is an ordinary agent API call under the key's own limits;
|
|
57
86
|
Darwin signs server-side under the agent's policy. Nothing here can withdraw or move funds between
|
|
58
87
|
your accounts — no such command exists.
|
|
59
|
-
- **No silent retries, no prompts.** A write is never re-sent. If its answer is lost, the CLI
|
|
60
|
-
|
|
61
|
-
|
|
88
|
+
- **No silent retries, no prompts.** A write is never re-sent. If its answer is lost, the CLI reads
|
|
89
|
+
what happened (never re-sends), and if that is still unknown exits 6 with the `darwin retry <id>`
|
|
90
|
+
to run later (on a site without checked orders: check `darwin orders`). There is no `[y/N]`
|
|
91
|
+
prompt; use `--dry-run` to have Darwin check a command without sending anything. Writes and reads are distinct commands, so your
|
|
62
92
|
agent harness can allow reads and ask before writes.
|
|
63
93
|
- **Server text is data.** Text a third party can influence (a token's name, a venue's message) is
|
|
64
|
-
stripped of terminal escapes and
|
|
94
|
+
stripped of terminal escapes, control and bidi characters before it reaches a terminal. In JSON
|
|
95
|
+
output it stays wrapped `{"untrusted": "…"}`, so an AI reading it knows not to act on it.
|
|
65
96
|
- What a secret store does *not* do: it can't stop malware running as your own user. On macOS the
|
|
66
97
|
keychain item trusts the `node` binary for an npm install.
|
|
67
98
|
|
|
@@ -75,7 +106,7 @@ without a new release of this program. The API reference: <https://darwin.financ
|
|
|
75
106
|
| 3 | no key / key refused |
|
|
76
107
|
| 4 | refused by Darwin |
|
|
77
108
|
| 5 | rate limited |
|
|
78
|
-
| 6 | a write's outcome is uncertain — don't re-run;
|
|
109
|
+
| 6 | a write's outcome is uncertain — don't re-run; `darwin retry <id>` (or `darwin orders`) |
|
|
79
110
|
| 7 | this CLI is too old |
|
|
80
111
|
| 8 | network unreachable before sending |
|
|
81
112
|
| 10 | the agent is paused |
|
|
@@ -97,11 +128,11 @@ npm **trusted publishing** (GitHub OIDC) with **provenance**.
|
|
|
97
128
|
|
|
98
129
|
**Then enable trusted publishing** on npmjs.com → `@darwin.finance/cli` → Settings → Trusted publisher →
|
|
99
130
|
GitHub Actions: organization/user `DarwinFinance`, repository `darwin-cli`, workflow `release.yml`,
|
|
100
|
-
environment `npm
|
|
131
|
+
environment `npm`, allowed action **`npm stage publish` only** (direct `npm publish` is NOT allowed). Publishing access is set to "Require two-factor authentication and disallow bypass 2FA tokens". (Both done 2026-10-05.)
|
|
101
132
|
In GitHub → Settings → Environments, create `npm` with yourself as a required reviewer.
|
|
102
133
|
|
|
103
134
|
**Every later release:** bump `"version"` in a PR, merge, tag the merge commit `vX.Y.Z`, push the tag,
|
|
104
|
-
approve the `npm` environment. The workflow tests, builds and runs `npm publish --provenance
|
|
135
|
+
approve the `npm` environment. The workflow tests, builds and runs `npm stage publish --provenance`, which uploads the version as STAGED. Then open npmjs.com → `@darwin.finance/cli` → the staged version and approve it with your passkey; only then does it go live.
|
|
105
136
|
|
|
106
137
|
## Develop
|
|
107
138
|
|