@artyfacts/claude 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/README.md +135 -0
- package/bin/cli.js +2 -0
- package/dist/cli.mjs +756 -0
- package/dist/index.d.mts +312 -0
- package/dist/index.d.ts +312 -0
- package/dist/index.js +626 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +586 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +47 -0
package/README.md
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# @artyfacts/claude
|
|
2
|
+
|
|
3
|
+
Run AI agents locally using Claude Code, orchestrated by Artyfacts.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx @artyfacts/claude
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
That's it. The CLI will:
|
|
12
|
+
1. Open your browser to log in (first time only)
|
|
13
|
+
2. Check Claude Code is installed
|
|
14
|
+
3. Start polling for tasks from artyfacts.dev
|
|
15
|
+
4. Execute tasks locally with Claude Code
|
|
16
|
+
|
|
17
|
+
## Prerequisites
|
|
18
|
+
|
|
19
|
+
**Claude Code** must be installed:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install -g @anthropic-ai/claude-code
|
|
23
|
+
claude login
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## How It Works
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
artyfacts.dev Your Machine
|
|
30
|
+
───────────── ────────────
|
|
31
|
+
Create goal
|
|
32
|
+
Create tasks ──────────> npx @artyfacts/claude
|
|
33
|
+
│
|
|
34
|
+
├─ Polls for tasks
|
|
35
|
+
├─ Claims task
|
|
36
|
+
├─ Runs: claude -p "task..."
|
|
37
|
+
├─ Reports completion
|
|
38
|
+
│
|
|
39
|
+
Task complete! <────────── Next task...
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Commands
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# Start the adapter (default)
|
|
46
|
+
npx @artyfacts/claude
|
|
47
|
+
|
|
48
|
+
# Check status
|
|
49
|
+
npx @artyfacts/claude status
|
|
50
|
+
|
|
51
|
+
# Log in manually
|
|
52
|
+
npx @artyfacts/claude login
|
|
53
|
+
|
|
54
|
+
# Log out
|
|
55
|
+
npx @artyfacts/claude logout
|
|
56
|
+
|
|
57
|
+
# Show current user
|
|
58
|
+
npx @artyfacts/claude whoami
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Options
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
npx @artyfacts/claude [options]
|
|
65
|
+
|
|
66
|
+
-i, --interval <sec> Poll interval in seconds (default: 30)
|
|
67
|
+
-c, --concurrent <n> Max concurrent tasks (default: 1)
|
|
68
|
+
-m, --model <model> Claude model: sonnet, opus (default: sonnet)
|
|
69
|
+
-d, --cwd <dir> Working directory
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Example Session
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
$ npx @artyfacts/claude
|
|
76
|
+
|
|
77
|
+
🚀 Artyfacts + Claude Code
|
|
78
|
+
|
|
79
|
+
🔗 Opening browser to log in...
|
|
80
|
+
|
|
81
|
+
https://artyfacts.dev/auth/device?code=ABCD-1234
|
|
82
|
+
|
|
83
|
+
Your code: ABCD-1234
|
|
84
|
+
|
|
85
|
+
Waiting for authorization...
|
|
86
|
+
|
|
87
|
+
✓ Logged in as gracie@example.com
|
|
88
|
+
|
|
89
|
+
Checking Claude Code...
|
|
90
|
+
✓ Claude Code 2.1.22
|
|
91
|
+
|
|
92
|
+
✓ Started
|
|
93
|
+
Polling every 30s
|
|
94
|
+
Model: sonnet
|
|
95
|
+
|
|
96
|
+
Waiting for tasks from artyfacts.dev...
|
|
97
|
+
Create goals and tasks at https://artyfacts.dev
|
|
98
|
+
|
|
99
|
+
▶ Research competitor pricing
|
|
100
|
+
From: Q2 Growth Strategy
|
|
101
|
+
Running with Claude...
|
|
102
|
+
✓ Completed
|
|
103
|
+
Duration: 45.2s
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Programmatic Usage
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
import { ClaudeAdapter, DeviceAuth } from '@artyfacts/claude';
|
|
110
|
+
|
|
111
|
+
const auth = new DeviceAuth();
|
|
112
|
+
|
|
113
|
+
// Ensure logged in
|
|
114
|
+
if (!auth.hasCredentials()) {
|
|
115
|
+
await auth.login();
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const adapter = new ClaudeAdapter({
|
|
119
|
+
apiKey: auth.getAccessToken()!,
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
adapter.on('task:completed', (task) => {
|
|
123
|
+
console.log(`Done: ${task.heading}`);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
await adapter.start();
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Credentials
|
|
130
|
+
|
|
131
|
+
Stored in `~/.artyfacts/credentials.json` with 600 permissions (user read/write only).
|
|
132
|
+
|
|
133
|
+
## License
|
|
134
|
+
|
|
135
|
+
MIT
|
package/bin/cli.js
ADDED