@phantomcodes/cli 1.1.1 → 1.2.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 CHANGED
@@ -49,10 +49,12 @@ routing. Connect it using your saved key:
49
49
 
50
50
  ```bash
51
51
  npm i -g @phantomcodes/cli
52
- phantom login
53
52
  phantom setup
54
53
  ```
55
54
 
55
+ With no key saved yet, `phantom setup` signs you in first (the same device
56
+ approval as `phantom login`), then sets up your agents with the new key.
57
+
56
58
  Used pai, this CLI's old name? Run `phantom setup` once after you install. Until
57
59
  then, Claude Code and the shell block pai set up still call `pai`, and phantom
58
60
  prints a reminder.
@@ -133,8 +133,10 @@ export const COMMANDS = [
133
133
  name: 'setup', handler: setupCommand, keyless: true,
134
134
  help: ` setup set up every agent found: install the skill and
135
135
  point its model calls at Phantom AI; shows each
136
- file's changes and asks first
136
+ file's changes and asks first. With no key yet,
137
+ signs in first (in a terminal)
137
138
  [--yes] don't ask
139
+ [--no-browser] print the sign-in link instead of opening it
138
140
  [--dry-run] show the changes, write nothing
139
141
  [--model <id>] the model each agent starts on (default ${SETUP_MODEL})
140
142
  setup --agent <name> install the skill for one agent, without asking:
@@ -1,2 +1,2 @@
1
1
  /** This release of phantom. `npm version` keeps it equal to the version in package.json. */
2
- export const VERSION = '1.1.1';
2
+ export const VERSION = '1.2.0';
@@ -1,6 +1,8 @@
1
1
  import { createInterface } from 'node:readline/promises';
2
2
  import { die } from "../core/errors.mjs";
3
3
  import { out } from "../core/helpers.mjs";
4
+ import { resolveApiKey } from "../keys/saved.mjs";
5
+ import { workspaceLogin } from "../workspace/command.mjs";
4
6
  import { SETUP_AGENTS, SETUP_NAMES } from "./agents.mjs";
5
7
  import { planSetup } from "./plan.mjs";
6
8
  import { setupPreview, applySetup, previewSetup, restoreSetup } from "./apply.mjs";
@@ -52,8 +54,9 @@ export function tableRestore(d) {
52
54
  ];
53
55
  return lines.length ? lines.join('\n') : 'Nothing to restore.';
54
56
  }
55
- /** `phantom setup`: plans, previews, asks, applies or restores agent setup. Run by `run()`. */
56
- export async function setupCommand({ env, io, flags, table }) {
57
+ /** `phantom setup`: plans, previews, asks, applies or restores agent setup. Plain setup with no key yet signs in first when it runs in a terminal. Run by `run()`. */
58
+ export async function setupCommand(input) {
59
+ const { env, io, flags, table } = input;
57
60
  const agent = flags['agent'];
58
61
  if (agent === true)
59
62
  die(`--agent requires ${SETUP_NAMES.join(', ')} or all`);
@@ -74,6 +77,11 @@ export async function setupCommand({ env, io, flags, table }) {
74
77
  // Plain `phantom setup` sets up everything it finds and asks first. Any of
75
78
  // the older flags runs just what they name, without asking.
76
79
  const guided = agent === undefined && provider === undefined;
80
+ // With no key yet, sign in first, as phantom claude does, so the agents
81
+ // get one in this run. Its words go to stderr; stdout stays setup's result.
82
+ if (guided && !dryRun && io.isTTY && !resolveApiKey(env)) {
83
+ await workspaceLogin({ ...input, io: { ...io, stdout: io.stderr }, flags: flags['no-browser'] ? { 'no-browser': true } : {} });
84
+ }
77
85
  const plan = planSetup(env, {
78
86
  agent,
79
87
  provider: guided || provider === true ? true : provider === 'off' ? 'off' : false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phantomcodes/cli",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "description": "AI inference for your coding agents. Route models, control spending, and fund your workspace.",
5
5
  "keywords": [
6
6
  "phantom",