@kendoo.agentdesk/agentdesk 0.17.4 → 0.17.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/CHANGELOG.md CHANGED
@@ -8,6 +8,11 @@ All user-facing changes to AgentDesk. Each entry is tagged:
8
8
 
9
9
  Internal refactors, infrastructure changes, and architectural notes are not listed here.
10
10
 
11
+ ## [0.17.5] — 2026-04-18
12
+
13
+ ### Fixed
14
+ - `[CLI]` `agentdesk init` now explicitly asks how you want to authenticate with GitHub instead of silently reusing whichever account the gh CLI was last logged in as. Three choices: use the existing gh CLI auth (showing which account it's currently on), paste a personal access token for a different account, or skip and configure later. When a per-project token is saved, the verify step uses it so gh picks the right identity.
15
+
11
16
  ## [0.17.4] — 2026-04-18
12
17
 
13
18
  ### Fixed
package/cli/init.mjs CHANGED
@@ -9,6 +9,7 @@
9
9
  import { existsSync, readFileSync, writeFileSync } from "fs";
10
10
  import { join } from "path";
11
11
  import { createInterface } from "readline";
12
+ import { execSync } from "child_process";
12
13
  import { detectProject } from "./detect.mjs";
13
14
  import { loadConfig, pushConfig } from "./config.mjs";
14
15
  import { getStoredApiKey } from "./login.mjs";
@@ -262,6 +263,47 @@ export async function runInit(cwd, opts = {}) {
262
263
  const r = answer.trim() || current;
263
264
  if (r) config.github = { repo: r };
264
265
  console.log("");
266
+
267
+ // Ask which identity to use for this project, regardless of whether
268
+ // `gh auth` is already set up globally. Without this prompt the wizard
269
+ // silently reuses whichever account the user last ran `gh auth login`
270
+ // with, which is surprising on a machine with multiple GitHub identities.
271
+ let ghLogin = null;
272
+ try {
273
+ const out = execSync("gh api user --jq .login", { stdio: ["ignore", "pipe", "ignore"], encoding: "utf-8" }).trim();
274
+ if (out) ghLogin = out;
275
+ } catch {}
276
+ const ghOptionLabel = ghLogin
277
+ ? `Use gh CLI — currently authenticated as @${ghLogin}`
278
+ : `Use gh CLI — you'll run 'gh auth login' after this wizard`;
279
+ const authChoice = await selectOption(rl, "GitHub authentication for this project:", [
280
+ { label: ghOptionLabel, value: "gh" },
281
+ { label: "Paste a personal access token (use a different account)", value: "pat" },
282
+ { label: "Skip — configure later in the dashboard", value: "skip" },
283
+ ]);
284
+ console.log("");
285
+
286
+ if (authChoice.value === "pat") {
287
+ if (!quick) {
288
+ console.log(" Create a token:");
289
+ console.log(" 1. Open https://github.com/settings/tokens");
290
+ console.log(" 2. Click \"Generate new token (classic)\"");
291
+ console.log(" 3. Name: AgentDesk. Scope: repo. Click Generate.");
292
+ console.log(" 4. Copy the token and paste below.");
293
+ console.log("");
294
+ }
295
+ while (true) {
296
+ const tokenInput = (await ask(rl, " GitHub token: ")).trim();
297
+ if (!tokenInput) {
298
+ console.log(" Token is required. Press Ctrl+C to abort.");
299
+ continue;
300
+ }
301
+ saveEnvVar(cwd, "GITHUB_TOKEN", tokenInput);
302
+ console.log(" ✓ Saved to .env (as GITHUB_TOKEN). This overrides any global gh CLI auth for this project.");
303
+ console.log("");
304
+ break;
305
+ }
306
+ }
265
307
  }
266
308
 
267
309
  // --- Step 3: Verify tracker permissions (with re-prompt on failure) ---
@@ -158,6 +158,11 @@ async function checkGitHub({ repo }, creds) {
158
158
  const errors = [];
159
159
  let identity = null;
160
160
 
161
+ // If a per-project GITHUB_TOKEN is configured, let gh use it via env —
162
+ // takes precedence over whichever account `gh auth` is logged into.
163
+ const env = { ...process.env };
164
+ if (creds?.GITHUB_TOKEN) env.GH_TOKEN = creds.GITHUB_TOKEN;
165
+
161
166
  // Check if gh CLI is available
162
167
  try {
163
168
  execSync("gh --version", { stdio: "pipe" });
@@ -167,19 +172,19 @@ async function checkGitHub({ repo }, creds) {
167
172
 
168
173
  // Check auth status and grab the authenticated login
169
174
  try {
170
- execSync("gh auth status", { stdio: "pipe" });
175
+ execSync("gh auth status", { stdio: "pipe", env });
171
176
  try {
172
- const who = execSync(`gh api user --jq '{login: .login, name: .name}'`, { stdio: "pipe", encoding: "utf-8" }).trim();
177
+ const who = execSync(`gh api user --jq '{login: .login, name: .name}'`, { stdio: "pipe", encoding: "utf-8", env }).trim();
173
178
  const j = JSON.parse(who);
174
179
  identity = { name: j.name || j.login, login: j.login };
175
180
  } catch {}
176
181
  } catch {
177
- return { ok: false, errors: ["GitHub CLI is not authenticated — run 'gh auth login'"] };
182
+ return { ok: false, errors: ["GitHub CLI is not authenticated — run 'gh auth login', or paste a GITHUB_TOKEN"] };
178
183
  }
179
184
 
180
185
  // Check repo access and permissions
181
186
  try {
182
- const result = execSync(`gh api repos/${repo} --jq ".permissions"`, { stdio: "pipe", encoding: "utf-8" });
187
+ const result = execSync(`gh api repos/${repo} --jq ".permissions"`, { stdio: "pipe", encoding: "utf-8", env });
183
188
  const perms = JSON.parse(result.trim());
184
189
 
185
190
  if (!perms.pull) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kendoo.agentdesk/agentdesk",
3
- "version": "0.17.4",
3
+ "version": "0.17.5",
4
4
  "description": "AI team orchestrator for Claude Code — run collaborative agent sessions from your terminal",
5
5
  "type": "module",
6
6
  "bin": {