@darwin.finance/cli 1.0.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 +113 -0
- package/dist/darwin.js +5410 -0
- package/npm-shrinkwrap.json +319 -0
- package/package.json +47 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Darwin Finance
|
|
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,113 @@
|
|
|
1
|
+
# Darwin CLI
|
|
2
|
+
|
|
3
|
+
Trade and check your [Darwin](https://darwin.finance) agent from a terminal or a script. The Darwin CLI
|
|
4
|
+
uses an API key for one of your agents (or, if you made one, for all your active agents), keeps it in
|
|
5
|
+
your computer's secret store, and turns every agent action into a command — for coding agents
|
|
6
|
+
(Claude Code, Codex, OpenClaw, Cursor, Gemini CLI) and for your own scripts.
|
|
7
|
+
|
|
8
|
+
Chat apps like Claude or ChatGPT don't use the CLI — they connect to Darwin directly instead.
|
|
9
|
+
|
|
10
|
+
> **Not on npm yet.** `@darwin.finance/cli` has not been published. Until it is, install from source
|
|
11
|
+
> (below) for testing only.
|
|
12
|
+
|
|
13
|
+
## Install (from source, for testing)
|
|
14
|
+
|
|
15
|
+
Requires Node.js 20+ and [Bun](https://bun.sh) to build.
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
git clone https://github.com/DarwinFinance/darwin-cli.git
|
|
19
|
+
cd darwin-cli
|
|
20
|
+
bun install
|
|
21
|
+
bun run build
|
|
22
|
+
npm i -g .
|
|
23
|
+
darwin --version
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Once published, the install line is `npm i -g @darwin.finance/cli`. Always install it — never run it
|
|
27
|
+
through `npx`: the CLI refuses to read a saved key when it runs from npx or from a project's
|
|
28
|
+
`node_modules`, because a project you are merely working in could substitute its own copy.
|
|
29
|
+
|
|
30
|
+
## Use
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
darwin login # pairs a new agent: open the link, approve with your passkey
|
|
34
|
+
darwin login --beta # the same against beta.darwin.finance
|
|
35
|
+
darwin help # every command, from Darwin's own catalogue
|
|
36
|
+
darwin whoami
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
What each command does is documented by Darwin itself: the command list is fetched from the site you
|
|
40
|
+
logged in to (`darwin help`, `darwin <command> --help`, `darwin help --json`), so new commands appear
|
|
41
|
+
without a new release of this program. The API reference: <https://darwin.finance/agents/docs>.
|
|
42
|
+
|
|
43
|
+
`darwin mcp` runs the same commands as a local MCP server for desktop AI clients;
|
|
44
|
+
`darwin mcp --print-config claude|cursor|gemini` prints the registration.
|
|
45
|
+
|
|
46
|
+
## Security model
|
|
47
|
+
|
|
48
|
+
- **The key stays put.** It lives in the OS secret store (macOS Keychain, Windows Credential Manager,
|
|
49
|
+
Linux Secret Service) — never in the config file. Headless machines can supply one with
|
|
50
|
+
`DARWIN_API_KEY` / `DARWIN_API_KEY_FILE` (read, never written), or opt in to a plain file with
|
|
51
|
+
`darwin login --store file` (owner-only permissions, with a warning). No flag ever takes a key on
|
|
52
|
+
the command line (it would show in `ps` and shell history): `darwin login --with-key` reads stdin.
|
|
53
|
+
- **One realm per key.** A key is only ever sent to the Darwin site it belongs to (`darwin.finance`
|
|
54
|
+
or `beta.darwin.finance`), over https. There is no host override; redirects are never followed.
|
|
55
|
+
- **Never printed.** Output is scrubbed of anything shaped like a Darwin credential.
|
|
56
|
+
- **No more than the key.** Every command is an ordinary agent API call under the key's own limits;
|
|
57
|
+
Darwin signs server-side under the agent's policy. Nothing here can withdraw or move funds between
|
|
58
|
+
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 exits 6
|
|
60
|
+
and says to check `darwin orders` rather than run it again. There is no `[y/N]` prompt; use
|
|
61
|
+
`--dry-run` to see what a command would send. Writes and reads are distinct commands, so your
|
|
62
|
+
agent harness can allow reads and ask before writes.
|
|
63
|
+
- **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 shown as `untrusted: …`.
|
|
65
|
+
- What a secret store does *not* do: it can't stop malware running as your own user. On macOS the
|
|
66
|
+
keychain item trusts the `node` binary for an npm install.
|
|
67
|
+
|
|
68
|
+
## Exit codes
|
|
69
|
+
|
|
70
|
+
| Code | Meaning |
|
|
71
|
+
|---|---|
|
|
72
|
+
| 0 | success |
|
|
73
|
+
| 1 | unexpected error |
|
|
74
|
+
| 2 | usage error — nothing was sent |
|
|
75
|
+
| 3 | no key / key refused |
|
|
76
|
+
| 4 | refused by Darwin |
|
|
77
|
+
| 5 | rate limited |
|
|
78
|
+
| 6 | a write's outcome is uncertain — don't re-run; check `darwin orders` |
|
|
79
|
+
| 7 | this CLI is too old |
|
|
80
|
+
| 8 | network unreachable before sending |
|
|
81
|
+
| 10 | the agent is paused |
|
|
82
|
+
|
|
83
|
+
## Releasing (maintainers)
|
|
84
|
+
|
|
85
|
+
The package is `@darwin.finance/cli` in the npm organization `darwin.finance`. Nothing in this repo
|
|
86
|
+
holds an npm token. Releases after the first are published by `.github/workflows/release.yml` through
|
|
87
|
+
npm **trusted publishing** (GitHub OIDC) with **provenance**.
|
|
88
|
+
|
|
89
|
+
**First release — by hand, once** (npm can only attach a trusted publisher to a package that exists):
|
|
90
|
+
|
|
91
|
+
1. Use an npm account with 2FA that is a member (with publish rights) of the `darwin.finance` org.
|
|
92
|
+
2. From a clean clone of `main` at the release commit: `bun install --frozen-lockfile && bun run check`.
|
|
93
|
+
3. Check `package.json` `"version"` (1.0.0 for the first release), then
|
|
94
|
+
`npm publish --access public --provenance=false` (npm asks for the 2FA code).
|
|
95
|
+
4. Tag that commit `v1.0.0` for the record. Pushing that tag starts the release workflow, which will
|
|
96
|
+
stop at the `npm` environment approval — **reject** that run (the version is already published).
|
|
97
|
+
|
|
98
|
+
**Then enable trusted publishing** on npmjs.com → `@darwin.finance/cli` → Settings → Trusted publisher →
|
|
99
|
+
GitHub Actions: organization/user `DarwinFinance`, repository `darwin-cli`, workflow `release.yml`,
|
|
100
|
+
environment `npm`. Optionally set "Require two-factor authentication and disallow tokens".
|
|
101
|
+
In GitHub → Settings → Environments, create `npm` with yourself as a required reviewer.
|
|
102
|
+
|
|
103
|
+
**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`.
|
|
105
|
+
|
|
106
|
+
## Develop
|
|
107
|
+
|
|
108
|
+
```sh
|
|
109
|
+
bun install
|
|
110
|
+
bun run check # typecheck, lint, tests, build
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
MIT licensed.
|