@phantomcodes/cli 0.0.0-stage → 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 +81 -0
- package/README.md +191 -2
- package/bin/phantom.mjs +14 -0
- package/dist/agents/command.mjs +155 -0
- package/dist/agents/proxy.mjs +140 -0
- package/dist/cli/commands.mjs +129 -0
- package/dist/cli/help.mjs +38 -0
- package/dist/cli/run.mjs +79 -0
- package/dist/core/errors.mjs +39 -0
- package/dist/core/helpers.mjs +85 -0
- package/dist/core/request.mjs +78 -0
- package/dist/core/secrets.mjs +94 -0
- package/dist/core/shapes.mjs +1 -0
- package/dist/core/state.mjs +7 -0
- package/dist/core/version.mjs +2 -0
- package/dist/keys/command.mjs +116 -0
- package/dist/keys/saved.mjs +172 -0
- package/dist/phantom.mjs +57 -0
- package/dist/receipts/command.mjs +41 -0
- package/dist/receipts/receipts.mjs +82 -0
- package/dist/setup/agents.mjs +437 -0
- package/dist/setup/apply.mjs +218 -0
- package/dist/setup/command.mjs +114 -0
- package/dist/setup/editors.mjs +486 -0
- package/dist/setup/legacy.mjs +36 -0
- package/dist/setup/plan.mjs +142 -0
- package/dist/setup/shared.mjs +89 -0
- package/dist/spend/command.mjs +105 -0
- package/dist/spend/routing.mjs +32 -0
- package/dist/workspace/command.mjs +204 -0
- package/package.json +83 -4
- package/skills/phantom-ai/SKILL.md +117 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: phantom-ai
|
|
3
|
+
description: Use the phantom CLI to connect and run coding agents through Phantom AI, manage workspace funding and spending controls, and route models. Applies when the user requests Phantom inference or payment workflows.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Phantom AI
|
|
7
|
+
|
|
8
|
+
Phantom AI serves model inference at `https://phantom.codes/v1`. The Phantom CLI connects
|
|
9
|
+
existing coding agents to that API, manages model routing to control costs, and
|
|
10
|
+
handles workspace funding and controls. Management commands
|
|
11
|
+
print JSON; add `--table` for supported human-readable output.
|
|
12
|
+
|
|
13
|
+
## Connect and run
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
phantom login
|
|
17
|
+
phantom workspace status
|
|
18
|
+
phantom codex
|
|
19
|
+
phantom claude --key coding
|
|
20
|
+
phantom pi
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Login uses browser device approval and saves a key privately; ask the user to
|
|
24
|
+
complete approval themselves. For an existing key, have them run
|
|
25
|
+
`phantom login --paste` locally, never paste it into chat.
|
|
26
|
+
Agent configuration is temporary. The Phantom CLI flags go before agent arguments, or `--`.
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
phantom codex --key coding -- exec "review this repository"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Named-key selection uses `PHANTOM_KEY_NAME`, then `PHANTOM_API_KEY`, then the
|
|
33
|
+
saved login key. An agent's explicit `--key` selects that local named key.
|
|
34
|
+
|
|
35
|
+
## Connect existing agents for future runs
|
|
36
|
+
|
|
37
|
+
Offer saved setup when the user wants their installed agent to use Phantom AI
|
|
38
|
+
without a phantom launcher. Ask whether they want saved setup or a temporary run;
|
|
39
|
+
when their request already specifies one, follow it.
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
phantom setup --dry-run --table
|
|
43
|
+
phantom setup
|
|
44
|
+
phantom setup --restore
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Preview and show the configuration changes before applying the setup the user
|
|
48
|
+
approves. Plain setup detects supported agents and asks before writing. Restart
|
|
49
|
+
the agent or open a new terminal afterward. It keeps backups for restore.
|
|
50
|
+
To connect only Codex, preview the targeted setup first:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
phantom setup --agent codex --provider --dry-run --table
|
|
54
|
+
phantom setup --agent codex --provider
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Targeted provider setup applies without its own confirmation; run it only after
|
|
58
|
+
the user approves the preview. Cursor needs manual settings steps; pi receives
|
|
59
|
+
the skill only. Setup wires up a saved key through helpers or environment
|
|
60
|
+
variables where supported; Cline stores it in a private config file.
|
|
61
|
+
If the user requested a budget, verify that the key the configured agent uses
|
|
62
|
+
has that cap. Creating a separate capped key does not change the default key.
|
|
63
|
+
|
|
64
|
+
## Fund a workspace
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
phantom fund --amount 10 --card
|
|
68
|
+
phantom fund --amount 10 --coin usdc
|
|
69
|
+
phantom workspace payment --id <payment-id>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Card checkout opens the payment URL in your browser. Crypto funding (`--coin usdc|usdt|sol`)
|
|
73
|
+
provides a Solana pay URL. Credit is available once confirmed. Check pending payments with
|
|
74
|
+
`phantom workspace payment --id <id>`. Check balance anytime with `phantom balance`.
|
|
75
|
+
|
|
76
|
+
## Control spending and keys
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
phantom keys create --save coding --limit 5
|
|
80
|
+
phantom keys list
|
|
81
|
+
phantom keys set --id <key-id> --budget 20 --period 30 --rate 1
|
|
82
|
+
phantom keys revoke --id <key-id>
|
|
83
|
+
phantom keys saved
|
|
84
|
+
phantom keys rm <name>
|
|
85
|
+
phantom balance
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Use the full ID from workspace key metadata. Key controls are enforced by the
|
|
89
|
+
server; the rate is dollars per minute. Revocation preserves shared funds.
|
|
90
|
+
`keys saved` lists local metadata; `keys rm` only forgets the local copy.
|
|
91
|
+
|
|
92
|
+
## Route models
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
phantom route
|
|
96
|
+
phantom route set --models <model-a>,<model-b>
|
|
97
|
+
phantom route rule add --if has_tools=true --use first
|
|
98
|
+
phantom route test --table
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Routing affects `auto` requests. Use `PHANTOM_KEY_NAME=coding` to manage the same
|
|
102
|
+
key used by an agent with `--key coding`. Route tests are free.
|
|
103
|
+
|
|
104
|
+
## Advanced tasks
|
|
105
|
+
|
|
106
|
+
Use `phantom --help --all` for receipts, MCP and direct-key purchases.
|
|
107
|
+
Export guest recovery with `phantom workspace export --file
|
|
108
|
+
<path>` only to a private destination. Recovery grants workspace management access.
|
|
109
|
+
|
|
110
|
+
## Rules
|
|
111
|
+
|
|
112
|
+
- Never print, log or repeat API keys, wallet secrets, management credentials or recovery files. `phantom keys show` is for shell integration, not model context.
|
|
113
|
+
- Use CLI commands to manage state; do not manually edit or delete its files.
|
|
114
|
+
- Ask before payments the user has not requested. Existing task approval covers only the requested payment and amount.
|
|
115
|
+
- Run permanent `phantom setup` changes only when requested; otherwise preview with `--dry-run`.
|
|
116
|
+
- Use a user's existing subscription agent when they request that workflow. Phantom inference requires their intent.
|
|
117
|
+
- Exit code 2 means a rejected key; report it rather than retrying unchanged credentials.
|