Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Use the `skill` tool for common workflows:
| `release` | To cut a new version release |
| `create-pr` | To create a pull request with concise description |

If validation fails due to missing tools, install dependencies first with `bun install`.

## Code Review Agents

Before submitting changes, run review agents in parallel with validation:
Expand Down
7 changes: 7 additions & 0 deletions src/client/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,13 @@ export class ApiClient {
}

const orpcError = err as { code?: string; status?: number };
if (orpcError.status === 401) {
return new ApiClientError(
'Unauthorized. Get the token by running `perry agent show-token` on the agent, then set it here with `perry config token <token>`.',
401,
'UNAUTHORIZED'
);
}
if (orpcError.code) {
return new ApiClientError(err.message, orpcError.status || 500, orpcError.code);
}
Expand Down
17 changes: 17 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,23 @@ agentCmd
}
});

agentCmd
.command('show-token')
.description('Show the auth token for connecting clients')
.action(async () => {
const configDir = getConfigDir();
await ensureConfigDir(configDir);
const config = await loadAgentConfig(configDir);

if (!config.auth?.token) {
console.log('No auth token configured.');
console.log('Run `perry auth init` to generate one.');
process.exit(1);
}

console.log(config.auth.token);
});

const authCmd = program.command('auth').description('Manage authentication');

authCmd
Expand Down
12 changes: 4 additions & 8 deletions web/src/pages/Auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,10 @@ export function Auth({ onAuthenticated }: AuthProps) {

<div className="mt-6 p-4 rounded-lg bg-muted/50 text-sm text-muted-foreground">
<p className="font-medium mb-2">Where do I find the token?</p>
<ul className="space-y-1 list-disc list-inside">
<li>
Run <code className="bg-muted px-1 rounded">perry agent config</code> on the agent
</li>
<li>
Or check <code className="bg-muted px-1 rounded">~/.config/perry/config.json</code>
</li>
</ul>
<p>
On the machine running the agent, run:{' '}
<code className="bg-muted px-1 rounded">perry agent show-token</code>
</p>
</div>
</div>
</div>
Expand Down
Loading