@agentuity/claude-code 1.0.5
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/.claude-plugin/plugin.json +19 -0
- package/AGENTS.md +78 -0
- package/LICENSE +13 -0
- package/README.md +165 -0
- package/agents/architect.md +311 -0
- package/agents/builder.md +398 -0
- package/agents/lead.md +692 -0
- package/agents/memory.md +983 -0
- package/agents/product.md +473 -0
- package/agents/reviewer.md +340 -0
- package/agents/scout.md +294 -0
- package/commands/agentuity-cadence-cancel.md +15 -0
- package/commands/agentuity-cadence.md +74 -0
- package/commands/agentuity-coder.md +14 -0
- package/commands/agentuity-memory-save.md +14 -0
- package/commands/agentuity-memory-share.md +31 -0
- package/commands/agentuity-sandbox.md +33 -0
- package/dist/install.d.ts +22 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +113 -0
- package/dist/install.js.map +1 -0
- package/hooks/hooks.json +67 -0
- package/hooks/scripts/block-sensitive-commands.sh +43 -0
- package/hooks/scripts/cadence-stop.sh +180 -0
- package/hooks/scripts/pre-compact.sh +24 -0
- package/hooks/scripts/session-end.sh +203 -0
- package/hooks/scripts/session-start.sh +68 -0
- package/hooks/scripts/setup-cadence.sh +133 -0
- package/hooks/scripts/stop-memory-save.sh +69 -0
- package/package.json +49 -0
- package/skills/agentuity-backend/SKILL.md +471 -0
- package/skills/agentuity-cloud/SKILL.md +108 -0
- package/skills/agentuity-command-runner/SKILL.md +127 -0
- package/skills/agentuity-frontend/SKILL.md +321 -0
- package/skills/agentuity-ops/SKILL.md +207 -0
- package/src/install.ts +150 -0
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agentuity-frontend
|
|
3
|
+
description: When working with Agentuity SDK frontend packages including @agentuity/react, @agentuity/frontend, @agentuity/auth, or @agentuity/workbench. Activates when building React components that call agents, setting up authentication, using useAPI or useWebsocket hooks, or integrating the workbench dev UI.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Agentuity Frontend Reference
|
|
8
|
+
|
|
9
|
+
Deep reference material for the Agentuity SDK frontend packages used to build web applications, React integrations, and authentication.
|
|
10
|
+
|
|
11
|
+
## Package Overview
|
|
12
|
+
|
|
13
|
+
| Package | Purpose |
|
|
14
|
+
|---------|---------|
|
|
15
|
+
| `@agentuity/react` | React hooks for calling agents (useAPI, useWebsocket) |
|
|
16
|
+
| `@agentuity/frontend` | Framework-agnostic web utilities |
|
|
17
|
+
| `@agentuity/auth` | Authentication (server + client) |
|
|
18
|
+
| `@agentuity/workbench` | Dev UI for testing agents |
|
|
19
|
+
|
|
20
|
+
## Reference URLs
|
|
21
|
+
|
|
22
|
+
When uncertain, look up:
|
|
23
|
+
- **SDK Source**: https://github.com/agentuity/sdk/tree/main/packages
|
|
24
|
+
- **Docs**: https://agentuity.dev
|
|
25
|
+
- **React Package**: https://github.com/agentuity/sdk/tree/main/packages/react/src
|
|
26
|
+
- **Auth Package**: https://github.com/agentuity/sdk/tree/main/packages/auth/src
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## @agentuity/react
|
|
31
|
+
|
|
32
|
+
React hooks and components for Agentuity web applications.
|
|
33
|
+
|
|
34
|
+
### Setup with AgentuityProvider
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
import { AgentuityProvider } from '@agentuity/react';
|
|
38
|
+
|
|
39
|
+
function App() {
|
|
40
|
+
return (
|
|
41
|
+
<AgentuityProvider>
|
|
42
|
+
<MyApp />
|
|
43
|
+
</AgentuityProvider>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
NOTE: The `baseUrl="http://localhost:3000"` property is only needed if using outside an Agentuity full stack project.
|
|
49
|
+
|
|
50
|
+
### useAPI Hook
|
|
51
|
+
|
|
52
|
+
Call agents/routes from React components with automatic type inference.
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
import { useAPI } from '@agentuity/react';
|
|
56
|
+
|
|
57
|
+
function ChatComponent() {
|
|
58
|
+
// For POST/mutation routes
|
|
59
|
+
const { data, invoke, isLoading, isSuccess, isError, error, reset } = useAPI('POST /agent/chat');
|
|
60
|
+
|
|
61
|
+
const handleSubmit = async (message: string) => {
|
|
62
|
+
await invoke({ message });
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<div>
|
|
67
|
+
{isLoading && <p>Loading...</p>}
|
|
68
|
+
{data && <p>Response: {data.reply}</p>}
|
|
69
|
+
{error && <p>Error: {error.message}</p>}
|
|
70
|
+
<button onClick={() => handleSubmit('Hello!')}>Send</button>
|
|
71
|
+
</div>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// For GET routes (auto-fetches on mount)
|
|
76
|
+
function UserProfile() {
|
|
77
|
+
const { data, isLoading, isFetching, refetch } = useAPI('GET /api/user');
|
|
78
|
+
// data is fetched automatically on mount
|
|
79
|
+
// isFetching is true during refetches
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Options:**
|
|
84
|
+
```typescript
|
|
85
|
+
const { data, invoke } = useAPI({
|
|
86
|
+
route: 'POST /agent/my-agent',
|
|
87
|
+
headers: { 'X-Custom': 'value' },
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
// Streaming support
|
|
91
|
+
const { data, invoke } = useAPI('POST /agent/stream', {
|
|
92
|
+
delimiter: '\n',
|
|
93
|
+
onChunk: (chunk) => console.log('Received chunk:', chunk),
|
|
94
|
+
});
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### useWebsocket Hook
|
|
98
|
+
|
|
99
|
+
Real-time bidirectional communication.
|
|
100
|
+
|
|
101
|
+
```tsx
|
|
102
|
+
import { useWebsocket } from '@agentuity/react';
|
|
103
|
+
|
|
104
|
+
function LiveChat() {
|
|
105
|
+
const {
|
|
106
|
+
isConnected,
|
|
107
|
+
send,
|
|
108
|
+
close,
|
|
109
|
+
data, // Latest message
|
|
110
|
+
messages, // All messages array
|
|
111
|
+
clearMessages, // Clear message history
|
|
112
|
+
error,
|
|
113
|
+
readyState
|
|
114
|
+
} = useWebsocket('/ws/chat');
|
|
115
|
+
|
|
116
|
+
// Messages are accessed via data (latest) or messages (all)
|
|
117
|
+
useEffect(() => {
|
|
118
|
+
if (data) {
|
|
119
|
+
console.log('Received:', data);
|
|
120
|
+
}
|
|
121
|
+
}, [data]);
|
|
122
|
+
|
|
123
|
+
return (
|
|
124
|
+
<div>
|
|
125
|
+
<p>Status: {isConnected ? 'Connected' : 'Disconnected'}</p>
|
|
126
|
+
<button onClick={() => send({ type: 'ping' })}>Ping</button>
|
|
127
|
+
<ul>
|
|
128
|
+
{messages.map((msg, i) => <li key={i}>{JSON.stringify(msg)}</li>)}
|
|
129
|
+
</ul>
|
|
130
|
+
</div>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**Features:**
|
|
136
|
+
- Auto-reconnection on connection loss
|
|
137
|
+
- Message queuing when disconnected
|
|
138
|
+
- Auth tokens auto-injected when AuthProvider is in tree
|
|
139
|
+
- Access latest message via `data` or all via `messages` array
|
|
140
|
+
|
|
141
|
+
### useAuth Hook
|
|
142
|
+
|
|
143
|
+
Access authentication state.
|
|
144
|
+
|
|
145
|
+
```tsx
|
|
146
|
+
import { useAuth } from '@agentuity/react';
|
|
147
|
+
|
|
148
|
+
function UserProfile() {
|
|
149
|
+
const { isAuthenticated, authLoading, authHeader } = useAuth();
|
|
150
|
+
|
|
151
|
+
if (authLoading) return <p>Loading...</p>;
|
|
152
|
+
if (!isAuthenticated) return <p>Please sign in</p>;
|
|
153
|
+
|
|
154
|
+
return <p>Welcome back!</p>;
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**Note:** Auth tokens are automatically injected into useAPI and useWebsocket calls when AuthProvider is in the component tree.
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## @agentuity/auth
|
|
163
|
+
|
|
164
|
+
First-class authentication for Agentuity projects, powered by BetterAuth.
|
|
165
|
+
|
|
166
|
+
### Server Setup
|
|
167
|
+
|
|
168
|
+
```typescript
|
|
169
|
+
import { createAuth, createSessionMiddleware, mountAuthRoutes } from '@agentuity/auth';
|
|
170
|
+
import { createRouter } from '@agentuity/runtime';
|
|
171
|
+
|
|
172
|
+
// Create auth instance
|
|
173
|
+
const auth = createAuth({
|
|
174
|
+
connectionString: process.env.DATABASE_URL,
|
|
175
|
+
// Optional: custom base path (default: /api/auth)
|
|
176
|
+
basePath: '/api/auth',
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
const router = createRouter();
|
|
180
|
+
|
|
181
|
+
// Mount auth routes (handles sign-in, sign-up, etc.)
|
|
182
|
+
router.on(['GET', 'POST'], '/api/auth/*', mountAuthRoutes(auth));
|
|
183
|
+
|
|
184
|
+
// Protect routes with session middleware
|
|
185
|
+
router.use('/api/*', createSessionMiddleware(auth));
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Agent Handler (ctx.auth)
|
|
189
|
+
|
|
190
|
+
When using auth middleware, `ctx.auth` is available in agent handlers:
|
|
191
|
+
|
|
192
|
+
```typescript
|
|
193
|
+
import { createAgent } from '@agentuity/runtime';
|
|
194
|
+
|
|
195
|
+
export default createAgent('protected-agent', {
|
|
196
|
+
handler: async (ctx, input) => {
|
|
197
|
+
// ctx.auth is null for unauthenticated requests
|
|
198
|
+
if (!ctx.auth) {
|
|
199
|
+
return { error: 'Please sign in' };
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// Get authenticated user
|
|
203
|
+
const user = await ctx.auth.getUser();
|
|
204
|
+
return { message: `Hello ${user.name}` };
|
|
205
|
+
},
|
|
206
|
+
});
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### Client Setup (React)
|
|
210
|
+
|
|
211
|
+
```tsx
|
|
212
|
+
import { AuthProvider } from '@agentuity/react';
|
|
213
|
+
|
|
214
|
+
function App() {
|
|
215
|
+
return (
|
|
216
|
+
<AuthProvider>
|
|
217
|
+
<AgentuityProvider>
|
|
218
|
+
<MyApp />
|
|
219
|
+
</AgentuityProvider>
|
|
220
|
+
</AuthProvider>
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Integration with @agentuity/drizzle
|
|
226
|
+
|
|
227
|
+
```typescript
|
|
228
|
+
import { createPostgresDrizzle, drizzleAdapter } from '@agentuity/drizzle';
|
|
229
|
+
import { createAuth } from '@agentuity/auth';
|
|
230
|
+
import * as schema from './schema';
|
|
231
|
+
|
|
232
|
+
const { db, close } = createPostgresDrizzle({ schema });
|
|
233
|
+
|
|
234
|
+
const auth = createAuth({
|
|
235
|
+
database: drizzleAdapter(db, { provider: 'pg' }),
|
|
236
|
+
});
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## @agentuity/frontend
|
|
242
|
+
|
|
243
|
+
Framework-agnostic utilities for web applications.
|
|
244
|
+
|
|
245
|
+
- URL building for API endpoints
|
|
246
|
+
- Reconnection manager for WebSocket connections
|
|
247
|
+
- Shared utilities used by @agentuity/react
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## @agentuity/workbench
|
|
252
|
+
|
|
253
|
+
Dev UI for testing agents during development.
|
|
254
|
+
|
|
255
|
+
```typescript
|
|
256
|
+
// In your main entry point
|
|
257
|
+
import { welcome } from '@agentuity/workbench';
|
|
258
|
+
|
|
259
|
+
// Export welcome to enable the workbench
|
|
260
|
+
export { welcome };
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
The workbench provides a testing interface for your agents during local development (`bun run dev`).
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## Common Patterns
|
|
268
|
+
|
|
269
|
+
### Full-Stack Setup
|
|
270
|
+
|
|
271
|
+
```
|
|
272
|
+
src/
|
|
273
|
+
├── agent/<name>/ # Agent handlers (backend)
|
|
274
|
+
│ ├── agent.ts
|
|
275
|
+
│ └── index.ts
|
|
276
|
+
├── api/ # API routes (Hono)
|
|
277
|
+
│ └── index.ts
|
|
278
|
+
└── web/ # React frontend
|
|
279
|
+
├── App.tsx
|
|
280
|
+
├── index.tsx
|
|
281
|
+
└── components/
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
### Auth + Agent Call Pattern
|
|
285
|
+
|
|
286
|
+
```tsx
|
|
287
|
+
import { AuthProvider, AgentuityProvider, useAPI, useAuth } from '@agentuity/react';
|
|
288
|
+
|
|
289
|
+
function App() {
|
|
290
|
+
return (
|
|
291
|
+
<AuthProvider>
|
|
292
|
+
<AgentuityProvider>
|
|
293
|
+
<ProtectedChat />
|
|
294
|
+
</AgentuityProvider>
|
|
295
|
+
</AuthProvider>
|
|
296
|
+
);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function ProtectedChat() {
|
|
300
|
+
const { isAuthenticated } = useAuth();
|
|
301
|
+
const { data, invoke } = useAPI('POST /agent/chat');
|
|
302
|
+
|
|
303
|
+
if (!isAuthenticated) return <SignIn />;
|
|
304
|
+
|
|
305
|
+
return (
|
|
306
|
+
<div>
|
|
307
|
+
<button onClick={() => invoke({ message: 'Hello' })}>Chat</button>
|
|
308
|
+
{data && <p>{data.reply}</p>}
|
|
309
|
+
</div>
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
## Common Mistakes
|
|
315
|
+
|
|
316
|
+
| Mistake | Better Approach | Why |
|
|
317
|
+
|---------|-----------------|-----|
|
|
318
|
+
| Adding `baseUrl` inside Agentuity project | Omit `baseUrl` | Auto-detected in full-stack projects |
|
|
319
|
+
| Using `fetch` directly for agents | Use `useAPI` hook | Type inference, auth injection, loading states |
|
|
320
|
+
| Manual WebSocket management | Use `useWebsocket` hook | Auto-reconnect, auth injection, message queuing |
|
|
321
|
+
| Missing AuthProvider | Wrap app with AuthProvider | Required for auth token injection |
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agentuity-ops
|
|
3
|
+
description: When working with the Agentuity CLI, cloud services (KV, Vector, Storage, Sandbox, Database, SSH), deployments, or infrastructure. Activates when running agentuity commands, managing cloud resources, deploying projects, or configuring infrastructure.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Agentuity Ops Reference
|
|
8
|
+
|
|
9
|
+
Deep reference material for the Agentuity CLI, cloud services, deployments, and infrastructure.
|
|
10
|
+
|
|
11
|
+
## CLI Accuracy Contract (NON-NEGOTIABLE)
|
|
12
|
+
|
|
13
|
+
**Never hallucinate CLI flags, subcommands, URLs, or outputs.**
|
|
14
|
+
|
|
15
|
+
1. **Never guess** flags, subcommands, or argument order
|
|
16
|
+
2. If not 100% certain, FIRST run: `agentuity <cmd> --help`
|
|
17
|
+
3. **Trust CLI output over memory**
|
|
18
|
+
4. **Never fabricate URLs** — read actual command output
|
|
19
|
+
5. Provide **copy/paste-ready commands**
|
|
20
|
+
|
|
21
|
+
## CRITICAL: Region Configuration
|
|
22
|
+
|
|
23
|
+
Before suggesting `--region` flags, CHECK EXISTING CONFIG:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
cat ~/.config/agentuity/config.json 2>/dev/null | grep region
|
|
27
|
+
cat agentuity.json 2>/dev/null | grep region
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
- If region is configured → NO `--region` flag needed
|
|
31
|
+
- If NOT configured → help user set it in config OR use `--region`
|
|
32
|
+
|
|
33
|
+
## CRITICAL: Agentuity Projects Use Bun (Always)
|
|
34
|
+
|
|
35
|
+
- If `agentuity.json` or `.agentuity/` exists → ALWAYS use `bun`
|
|
36
|
+
- Never suggest `npm` or `pnpm` for Agentuity projects
|
|
37
|
+
|
|
38
|
+
## Golden Commands
|
|
39
|
+
|
|
40
|
+
| Purpose | Command |
|
|
41
|
+
|---------|---------|
|
|
42
|
+
| Create project | `agentuity new` (interactive) or `agentuity new --name <name>` |
|
|
43
|
+
| Start dev server | `bun run dev` → read output for actual URL |
|
|
44
|
+
| Deploy | `agentuity deploy` → read output for deployment URL |
|
|
45
|
+
| Check auth | `agentuity auth whoami` |
|
|
46
|
+
| List regions | `agentuity region list` |
|
|
47
|
+
| Get CLI help | `agentuity <command> --help` |
|
|
48
|
+
| Show all commands | `agentuity ai schema show` |
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Cloud Service Commands
|
|
53
|
+
|
|
54
|
+
### KV (Key-Value Storage)
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# Namespace management
|
|
58
|
+
agentuity cloud kv list-namespaces --json
|
|
59
|
+
agentuity cloud kv create-namespace <name>
|
|
60
|
+
agentuity cloud kv delete-namespace <name> --json
|
|
61
|
+
|
|
62
|
+
# Key operations
|
|
63
|
+
agentuity cloud kv set <namespace> <key> <value> [ttl]
|
|
64
|
+
agentuity cloud kv get <namespace> <key> --json
|
|
65
|
+
agentuity cloud kv keys <namespace> --json
|
|
66
|
+
agentuity cloud kv search <namespace> <keyword> --json
|
|
67
|
+
agentuity cloud kv delete <namespace> <key> --json
|
|
68
|
+
agentuity cloud kv stats --json
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Storage (S3-compatible)
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
agentuity cloud storage list --json
|
|
75
|
+
agentuity cloud storage create --json
|
|
76
|
+
agentuity cloud storage upload <bucket> <file> --key <path> --json
|
|
77
|
+
agentuity cloud storage download <bucket> <filename> [output]
|
|
78
|
+
agentuity cloud storage list <bucket> [prefix] --json
|
|
79
|
+
agentuity cloud storage delete <bucket> <filename> --json
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Vector (Semantic Search)
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
agentuity cloud vector upsert <namespace> <key> --document "text" --json
|
|
86
|
+
agentuity cloud vector search <namespace> "query" --limit N --json
|
|
87
|
+
agentuity cloud vector get <namespace> <key> --json
|
|
88
|
+
agentuity cloud vector delete <namespace> <key> --no-confirm --json
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Sandbox (Isolated Execution)
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# Runtimes
|
|
95
|
+
agentuity cloud sandbox runtime list --json
|
|
96
|
+
|
|
97
|
+
# Lifecycle
|
|
98
|
+
agentuity cloud sandbox run [--memory 1Gi] [--cpu 1000m] \
|
|
99
|
+
[--runtime <name>] [--name <name>] [--description <text>] \
|
|
100
|
+
-- <command> # One-shot
|
|
101
|
+
agentuity cloud sandbox create --json [--memory 1Gi] \
|
|
102
|
+
[--network] [--port <1024-65535>] \
|
|
103
|
+
[--runtime <name>] [--name <name>] # Persistent
|
|
104
|
+
agentuity cloud sandbox exec <sandboxId> -- <command>
|
|
105
|
+
agentuity cloud sandbox list --json
|
|
106
|
+
agentuity cloud sandbox get <sandboxId> --json
|
|
107
|
+
agentuity cloud sandbox delete <sandboxId> --json
|
|
108
|
+
|
|
109
|
+
# File operations (default working dir: /home/agentuity)
|
|
110
|
+
agentuity cloud sandbox files <sandboxId> [path] --json
|
|
111
|
+
agentuity cloud sandbox cp ./local sbx_abc123:/home/agentuity
|
|
112
|
+
agentuity cloud sandbox cp sbx_abc123:/home/agentuity ./local
|
|
113
|
+
agentuity cloud sandbox mkdir <sandboxId> /path/to/dir
|
|
114
|
+
agentuity cloud sandbox rm <sandboxId> /path/to/file
|
|
115
|
+
|
|
116
|
+
# Environment variables
|
|
117
|
+
agentuity cloud sandbox env <sandboxId> VAR1=value1 VAR2=value2
|
|
118
|
+
agentuity cloud sandbox env <sandboxId> --delete VAR1
|
|
119
|
+
|
|
120
|
+
# Snapshots
|
|
121
|
+
agentuity cloud sandbox snapshot create <sandboxId> \
|
|
122
|
+
[--name <name>] [--description <text>] [--tag <tag>]
|
|
123
|
+
agentuity cloud sandbox snapshot list --json
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**Snapshot tags:** Default to `latest`. Max 128 chars, must match `^[a-zA-Z0-9][a-zA-Z0-9._-]*$`.
|
|
127
|
+
|
|
128
|
+
### Network & Public URLs
|
|
129
|
+
|
|
130
|
+
| Scenario | Use `--network`? | Use `--port`? |
|
|
131
|
+
|----------|------------------|---------------|
|
|
132
|
+
| Running tests locally | No | No |
|
|
133
|
+
| Installing npm packages | Yes | No |
|
|
134
|
+
| Running web server for internal testing | Yes | No |
|
|
135
|
+
| Exposing dev preview to share | Yes | Yes |
|
|
136
|
+
| API that external services call | Yes | Yes |
|
|
137
|
+
|
|
138
|
+
**Public URL format:** `https://s{identifier}.agentuity.run`
|
|
139
|
+
|
|
140
|
+
### SSH (Remote Access)
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
# SSH into deployed projects
|
|
144
|
+
agentuity cloud ssh # Current project
|
|
145
|
+
agentuity cloud ssh proj_abc123 # Specific project
|
|
146
|
+
agentuity cloud ssh proj_abc123 'tail -f /var/log/app.log' # Run command
|
|
147
|
+
|
|
148
|
+
# SSH into sandboxes
|
|
149
|
+
agentuity cloud ssh sbx_abc123 # Interactive shell
|
|
150
|
+
|
|
151
|
+
# File transfer
|
|
152
|
+
agentuity cloud scp upload ./config.json --identifier=proj_abc123
|
|
153
|
+
agentuity cloud scp download /var/log/app.log --identifier=deploy_abc123
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Database (Postgres)
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
agentuity cloud db create <name> [--description "<text>"] --json
|
|
160
|
+
agentuity cloud db list --json
|
|
161
|
+
agentuity cloud db sql <name> "<query>" --json
|
|
162
|
+
agentuity cloud db delete <name> --json
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Deployment Commands
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
# Deploy current project
|
|
171
|
+
agentuity deploy
|
|
172
|
+
|
|
173
|
+
# Deploy with specific environment
|
|
174
|
+
agentuity deploy --env production
|
|
175
|
+
|
|
176
|
+
# List deployments
|
|
177
|
+
agentuity cloud deployment list --json
|
|
178
|
+
|
|
179
|
+
# Get deployment details
|
|
180
|
+
agentuity cloud deployment get <deploymentId> --json
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Project Configuration
|
|
184
|
+
|
|
185
|
+
### agentuity.json
|
|
186
|
+
|
|
187
|
+
```json
|
|
188
|
+
{
|
|
189
|
+
"projectId": "proj_abc123",
|
|
190
|
+
"orgId": "org_xyz",
|
|
191
|
+
"region": "use"
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### CLI Profile (~/.config/agentuity/production.yaml)
|
|
196
|
+
|
|
197
|
+
Contains `orgId` from `preferences.orgId` — used as fallback when `agentuity.json` doesn't have orgId.
|
|
198
|
+
|
|
199
|
+
## Common Mistakes
|
|
200
|
+
|
|
201
|
+
| Mistake | Better Approach | Why |
|
|
202
|
+
|---------|-----------------|-----|
|
|
203
|
+
| Blindly adding `--region` flag | Check config first | Region may already be configured |
|
|
204
|
+
| Using npm for Agentuity projects | Always use `bun` | Agentuity is Bun-native |
|
|
205
|
+
| Hardcoding sandbox paths as `/app` | Use `/home/agentuity` | That's the default working directory |
|
|
206
|
+
| Making up CLI flags | Run `--help` first | Flags change between versions |
|
|
207
|
+
| Fabricating deployment URLs | Read actual output | URLs are generated dynamically |
|
package/src/install.ts
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agentuity/claude-code - Agentuity Coder plugin for Claude Code
|
|
3
|
+
*
|
|
4
|
+
* Install script that configures the plugin for the current project.
|
|
5
|
+
* Sets up permissions for Agentuity Cloud CLI commands.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { join } from "node:path";
|
|
9
|
+
import { homedir } from "node:os";
|
|
10
|
+
|
|
11
|
+
export interface InstallConfig {
|
|
12
|
+
projectId?: string;
|
|
13
|
+
orgId?: string;
|
|
14
|
+
region?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface ClaudeSettings {
|
|
18
|
+
permissions?: {
|
|
19
|
+
allow?: string[];
|
|
20
|
+
deny?: string[];
|
|
21
|
+
ask?: string[];
|
|
22
|
+
};
|
|
23
|
+
[key: string]: unknown;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const AGENTUITY_PERMISSIONS = [
|
|
27
|
+
"Bash(agentuity cloud *)",
|
|
28
|
+
"Bash(agentuity auth whoami *)",
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
const AGENTUITY_DENY_PERMISSIONS = [
|
|
32
|
+
"Bash(agentuity cloud secrets *)",
|
|
33
|
+
"Bash(agentuity cloud secret *)",
|
|
34
|
+
"Bash(agentuity cloud apikey *)",
|
|
35
|
+
"Bash(agentuity auth token *)",
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Read agentuity.json from the current project if it exists.
|
|
40
|
+
*/
|
|
41
|
+
export async function readProjectConfig(): Promise<InstallConfig> {
|
|
42
|
+
try {
|
|
43
|
+
const file = Bun.file("agentuity.json");
|
|
44
|
+
if (await file.exists()) {
|
|
45
|
+
const config = await file.json();
|
|
46
|
+
return {
|
|
47
|
+
projectId: config.projectId,
|
|
48
|
+
orgId: config.orgId,
|
|
49
|
+
region: config.region,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
} catch {
|
|
53
|
+
// No agentuity.json found or invalid
|
|
54
|
+
}
|
|
55
|
+
return {};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Read a Claude Code settings JSON file.
|
|
60
|
+
*/
|
|
61
|
+
async function readSettings(path: string): Promise<ClaudeSettings> {
|
|
62
|
+
try {
|
|
63
|
+
const file = Bun.file(path);
|
|
64
|
+
if (await file.exists()) {
|
|
65
|
+
return await file.json();
|
|
66
|
+
}
|
|
67
|
+
} catch {
|
|
68
|
+
// File doesn't exist or is invalid
|
|
69
|
+
}
|
|
70
|
+
return {};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Write a Claude Code settings JSON file.
|
|
75
|
+
*/
|
|
76
|
+
async function writeSettings(
|
|
77
|
+
path: string,
|
|
78
|
+
settings: ClaudeSettings,
|
|
79
|
+
): Promise<void> {
|
|
80
|
+
await Bun.write(path, JSON.stringify(settings, null, 2) + "\n");
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Ensure Agentuity Cloud permissions are configured in Claude Code settings.
|
|
85
|
+
* Adds allow rules for agentuity cloud commands and deny rules for sensitive ones.
|
|
86
|
+
*/
|
|
87
|
+
async function configurePermissions(): Promise<{ added: number }> {
|
|
88
|
+
const settingsPath = join(homedir(), ".claude", "settings.local.json");
|
|
89
|
+
const settings = await readSettings(settingsPath);
|
|
90
|
+
|
|
91
|
+
if (!settings.permissions) {
|
|
92
|
+
settings.permissions = {};
|
|
93
|
+
}
|
|
94
|
+
if (!settings.permissions.allow) {
|
|
95
|
+
settings.permissions.allow = [];
|
|
96
|
+
}
|
|
97
|
+
if (!settings.permissions.deny) {
|
|
98
|
+
settings.permissions.deny = [];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
let added = 0;
|
|
102
|
+
|
|
103
|
+
for (const perm of AGENTUITY_PERMISSIONS) {
|
|
104
|
+
if (!settings.permissions.allow.includes(perm)) {
|
|
105
|
+
settings.permissions.allow.push(perm);
|
|
106
|
+
added++;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
for (const perm of AGENTUITY_DENY_PERMISSIONS) {
|
|
111
|
+
if (!settings.permissions.deny.includes(perm)) {
|
|
112
|
+
settings.permissions.deny.push(perm);
|
|
113
|
+
added++;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (added > 0) {
|
|
118
|
+
await writeSettings(settingsPath, settings);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return { added };
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Install the Agentuity Coder plugin.
|
|
126
|
+
* This is called when the plugin is first installed.
|
|
127
|
+
*/
|
|
128
|
+
export async function install(): Promise<void> {
|
|
129
|
+
const config = await readProjectConfig();
|
|
130
|
+
|
|
131
|
+
// Configure Claude Code permissions for Agentuity Cloud commands
|
|
132
|
+
const { added } = await configurePermissions();
|
|
133
|
+
if (added > 0) {
|
|
134
|
+
console.log(
|
|
135
|
+
`Configured ${added} permission rules for Agentuity Cloud commands`,
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (config.projectId) {
|
|
140
|
+
console.log(
|
|
141
|
+
`Agentuity Coder configured for project: ${config.projectId}`,
|
|
142
|
+
);
|
|
143
|
+
} else {
|
|
144
|
+
console.log(
|
|
145
|
+
"Agentuity Coder installed (no agentuity.json found - will use session-start hook for context)",
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export default install;
|