@kendoo.agentdesk/agentdesk 0.4.3 → 0.4.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/cli/login.mjs +49 -3
- package/package.json +1 -1
- package/prompts/team.md +80 -1
package/cli/login.mjs
CHANGED
|
@@ -9,6 +9,13 @@ const AGENTDESK_SERVER = process.env.AGENTDESK_SERVER || "https://agentdesk.live
|
|
|
9
9
|
const CONFIG_DIR = join(process.env.HOME || process.env.USERPROFILE, ".agentdesk");
|
|
10
10
|
const CREDENTIALS_PATH = join(CONFIG_DIR, "credentials.json");
|
|
11
11
|
|
|
12
|
+
function getEnvApiKey() {
|
|
13
|
+
const envPath = join(process.cwd(), ".env");
|
|
14
|
+
if (!existsSync(envPath)) return null;
|
|
15
|
+
const match = readFileSync(envPath, "utf-8").match(/AGENTDESK_API_KEY=(.+)/);
|
|
16
|
+
return match?.[1]?.trim() || null;
|
|
17
|
+
}
|
|
18
|
+
|
|
12
19
|
export function getStoredApiKey() {
|
|
13
20
|
if (!existsSync(CREDENTIALS_PATH)) return null;
|
|
14
21
|
try {
|
|
@@ -23,12 +30,51 @@ export async function runLogin() {
|
|
|
23
30
|
console.log(" ━━━━━━━━━━━━━━━━");
|
|
24
31
|
console.log("");
|
|
25
32
|
|
|
26
|
-
// Check if already logged in
|
|
33
|
+
// Check if already logged in — validate key against server
|
|
27
34
|
const existing = getStoredApiKey();
|
|
28
35
|
if (existing) {
|
|
29
|
-
console.log(`
|
|
36
|
+
console.log(` Stored key: ${existing.slice(0, 8)}...`);
|
|
37
|
+
|
|
38
|
+
// Validate against server
|
|
39
|
+
try {
|
|
40
|
+
const res = await fetch(`${AGENTDESK_SERVER}/api/sessions`, {
|
|
41
|
+
headers: { "x-api-key": existing },
|
|
42
|
+
signal: AbortSignal.timeout(5000),
|
|
43
|
+
});
|
|
44
|
+
if (res.ok) {
|
|
45
|
+
console.log(" Status: valid ✓");
|
|
46
|
+
} else {
|
|
47
|
+
console.log(" Status: INVALID — this key is not recognized by the server");
|
|
48
|
+
console.log("");
|
|
49
|
+
console.log(" Run: agentdesk logout && agentdesk login");
|
|
50
|
+
console.log("");
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
} catch {
|
|
54
|
+
console.log(" Status: could not reach server (key not validated)");
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Warn about .env override and validate it
|
|
58
|
+
const envKey = getEnvApiKey();
|
|
59
|
+
if (envKey && envKey !== existing) {
|
|
60
|
+
console.log("");
|
|
61
|
+
console.log(` ⚠ Warning: .env has a different AGENTDESK_API_KEY (${envKey.slice(0, 8)}...)`);
|
|
62
|
+
console.log(" The .env key takes priority at runtime.");
|
|
63
|
+
try {
|
|
64
|
+
const envRes = await fetch(`${AGENTDESK_SERVER}/api/sessions`, {
|
|
65
|
+
headers: { "x-api-key": envKey },
|
|
66
|
+
signal: AbortSignal.timeout(5000),
|
|
67
|
+
});
|
|
68
|
+
if (envRes.ok) {
|
|
69
|
+
console.log(" .env key status: valid ✓");
|
|
70
|
+
} else {
|
|
71
|
+
console.log(" .env key status: INVALID — update or remove it from .env");
|
|
72
|
+
}
|
|
73
|
+
} catch {}
|
|
74
|
+
}
|
|
75
|
+
|
|
30
76
|
console.log("");
|
|
31
|
-
console.log(" To re-authenticate, run: agentdesk logout");
|
|
77
|
+
console.log(" To re-authenticate, run: agentdesk logout && agentdesk login");
|
|
32
78
|
console.log("");
|
|
33
79
|
return;
|
|
34
80
|
}
|
package/package.json
CHANGED
package/prompts/team.md
CHANGED
|
@@ -152,13 +152,92 @@ When a task involves UI changes, the team MUST capture screenshots of the affect
|
|
|
152
152
|
kill $DEV_PID 2>/dev/null
|
|
153
153
|
```
|
|
154
154
|
|
|
155
|
-
4. Upload screenshots to the task tracker
|
|
155
|
+
4. Upload screenshots to the task tracker (see upload instructions below).
|
|
156
156
|
|
|
157
157
|
**When to capture:**
|
|
158
158
|
- After ALL code changes, reviews, and fixes are complete (during Bart's review step)
|
|
159
159
|
- Before creating the PR
|
|
160
160
|
- Only capture the pages/views that were actually affected by the changes
|
|
161
161
|
|
|
162
|
+
### Uploading screenshots to the task tracker
|
|
163
|
+
|
|
164
|
+
{{#LINEAR}}
|
|
165
|
+
**Linear — Upload & attach screenshots:**
|
|
166
|
+
|
|
167
|
+
Step 1: Get an upload URL from Linear:
|
|
168
|
+
```bash
|
|
169
|
+
UPLOAD_RESPONSE=$(curl -s -X POST https://api.linear.app/graphql \
|
|
170
|
+
-H "Authorization: $LINEAR_API_KEY" \
|
|
171
|
+
-H "Content-Type: application/json" \
|
|
172
|
+
-d '{"query":"mutation { fileUpload(contentType: \"image/png\", filename: \"screenshot.png\", size: '$(stat -f%z screenshot.png)') { uploadFile { uploadUrl assetUrl headers { key value } } } }"}')
|
|
173
|
+
|
|
174
|
+
UPLOAD_URL=$(echo "$UPLOAD_RESPONSE" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d['data']['fileUpload']['uploadFile']['uploadUrl'])")
|
|
175
|
+
ASSET_URL=$(echo "$UPLOAD_RESPONSE" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d['data']['fileUpload']['uploadFile']['assetUrl'])")
|
|
176
|
+
HEADERS=$(echo "$UPLOAD_RESPONSE" | python3 -c "import sys,json; d=json.load(sys.stdin); h=d['data']['fileUpload']['uploadFile']['headers']; print(' '.join([f'-H \"{x[\"key\"]}: {x[\"value\"]}\"' for x in h]))")
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Step 2: Upload the file to the signed URL:
|
|
180
|
+
```bash
|
|
181
|
+
eval curl -s -X PUT "$UPLOAD_URL" \
|
|
182
|
+
-H "Content-Type: image/png" \
|
|
183
|
+
$HEADERS \
|
|
184
|
+
--data-binary @screenshot.png
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Step 3: Post a comment with the uploaded image URLs (as a SEPARATE comment, not inside badge blocks):
|
|
188
|
+
```bash
|
|
189
|
+
curl -s -X POST https://api.linear.app/graphql \
|
|
190
|
+
-H "Authorization: $LINEAR_API_KEY" \
|
|
191
|
+
-H "Content-Type: application/json" \
|
|
192
|
+
-d '{"query":"mutation { commentCreate(input: { issueId: \"'$ISSUE_ID'\", body: \"\n\nDesktop view.\n\n\n\nMobile view.\" }) { success } }"}'
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Repeat steps 1-2 for each screenshot file (desktop, mobile). Use the ASSET_URL values in the comment body.
|
|
196
|
+
{{/LINEAR}}
|
|
197
|
+
|
|
198
|
+
{{#JIRA}}
|
|
199
|
+
**Jira — Upload & attach screenshots:**
|
|
200
|
+
|
|
201
|
+
Upload each screenshot as an attachment:
|
|
202
|
+
```bash
|
|
203
|
+
curl -s -X POST "$JIRA_BASE_URL/rest/api/3/issue/{{TASK_ID}}/attachments" \
|
|
204
|
+
-u "$JIRA_EMAIL:$JIRA_API_TOKEN" \
|
|
205
|
+
-H "X-Atlassian-Token: no-check" \
|
|
206
|
+
-F "file=@screenshots/desktop.png" \
|
|
207
|
+
-F "file=@screenshots/mobile.png"
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Then post a comment referencing the attachments:
|
|
211
|
+
```bash
|
|
212
|
+
curl -s -X POST "$JIRA_BASE_URL/rest/api/3/issue/{{TASK_ID}}/comment" \
|
|
213
|
+
-u "$JIRA_EMAIL:$JIRA_API_TOKEN" \
|
|
214
|
+
-H "Content-Type: application/json" \
|
|
215
|
+
-d '{"body":{"type":"doc","version":1,"content":[{"type":"paragraph","content":[{"type":"text","text":"Screenshots of affected views:"}]},{"type":"mediaGroup","content":[{"type":"media","attrs":{"type":"file","collection":"","id":"desktop.png"}},{"type":"media","attrs":{"type":"file","collection":"","id":"mobile.png"}}]}]}}'
|
|
216
|
+
```
|
|
217
|
+
{{/JIRA}}
|
|
218
|
+
|
|
219
|
+
{{#GITHUB}}
|
|
220
|
+
**GitHub — Upload & attach screenshots:**
|
|
221
|
+
|
|
222
|
+
GitHub supports drag-and-drop image uploads in comments. To upload via CLI, use the GitHub API:
|
|
223
|
+
```bash
|
|
224
|
+
# Upload image to GitHub's user content (via issue comment with image)
|
|
225
|
+
# The simplest approach: create a comment with base64-embedded images or use gh CLI
|
|
226
|
+
gh issue comment {{TASK_ID}} --body "$(cat <<SCREENSHOT_EOF
|
|
227
|
+
**Screenshots of affected views:**
|
|
228
|
+
|
|
229
|
+
Desktop (1280x800):
|
|
230
|
+
.read()).decode())"))
|
|
231
|
+
|
|
232
|
+
Mobile (375x812):
|
|
233
|
+
.read()).decode())"))
|
|
234
|
+
SCREENSHOT_EOF
|
|
235
|
+
)"
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Note: If base64 images are too large, upload them as release assets or to a gist and reference the raw URLs instead.
|
|
239
|
+
{{/GITHUB}}
|
|
240
|
+
|
|
162
241
|
{{#LINEAR}}
|
|
163
242
|
## LINEAR INTEGRATION
|
|
164
243
|
|