pi-dev-flow 0.100.0 → 0.100.1
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 +7 -0
- package/docs/jira.md +2 -2
- package/extensions/dev-flow.ts +20 -8
- package/package.json +1 -1
- package/src/jira/client.ts +65 -8
- package/src/jira/creds.ts +29 -7
- package/src/runtime/jira.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,13 @@ Format: newest first. `Unreleased` collects what's merged but not yet tagged.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.100.1] - 2026-12-04
|
|
8
|
+
|
|
9
|
+
**Jira sync works with a scoped API token.**
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
- **Jira sync works with a scoped API token.** dev-flow sent the token to Atlassian's MCP server as Basic `email:token`. With a scoped token, which is the kind the setup asks for, the server accepted the connection but saw no site, so every call failed with *Cloud id … isn't explicitly granted by the user*. That broke `flow jira init`, linking and creating issues, status moves, mirrored questions and the reply watch. It also broke the `atlassian` tools given to the agent. dev-flow now sends the token as `Bearer`. It keeps Basic as a fallback for a plain token, using whichever one can see the site. The scheme that worked is saved with the login. Jira REST calls still use Basic.
|
|
13
|
+
|
|
7
14
|
## [0.100.0] - 2026-12-03
|
|
8
15
|
|
|
9
16
|
**Flows on one machine no longer deploy over each other at verify.**
|
package/docs/jira.md
CHANGED
|
@@ -6,8 +6,8 @@ It talks to Atlassian's official **Rovo MCP server** (`https://mcp.atlassian.com
|
|
|
6
6
|
|
|
7
7
|
## Setup
|
|
8
8
|
|
|
9
|
-
1. **Create a scoped API token for the Atlassian MCP app** at id.atlassian.com → Security → API tokens → *Create API token with scopes*. Give it `read:jira:agent-interface` and `write:jira:agent-interface`; `search:jira:agent-interface` is optional. An org admin must have turned on API-token authentication for the Rovo MCP server (Atlassian Administration → Rovo MCP server). A plain token (*Create API token*) does not work: with one, the MCP server offers only its search tool.
|
|
10
|
-
2. **Run `/flow jira login [site]`** and type the site, your email and the token into its dialogs. dev-flow checks them against the MCP server, then saves them to `~/.pi/agent/dev-flow/jira.json` (mode 0600). The token never passes through the chat or the agent, and is never written to `project.md`. You can use environment variables instead: `JIRA_SITE`, `JIRA_EMAIL` and `JIRA_API_TOKEN` override the file.
|
|
9
|
+
1. **Create a scoped API token for the Atlassian MCP app** at id.atlassian.com → Security → API tokens → *Create API token with scopes*. Give it `read:jira:agent-interface` and `write:jira:agent-interface`; `search:jira:agent-interface` is optional. An org admin must have turned on API-token authentication for the Rovo MCP server (Atlassian Administration → Rovo MCP server). A plain token (*Create API token*) does not work: with one, the MCP server offers only its search tool. dev-flow sends a scoped token as `Authorization: Bearer <token>`. A scoped token sent as Basic `email:token` gets through the handshake, but every call fails with *Cloud id … isn't explicitly granted*.
|
|
10
|
+
2. **Run `/flow jira login [site]`** and type the site, your email and the token into its dialogs. dev-flow checks them against the MCP server, then saves them to `~/.pi/agent/dev-flow/jira.json` (mode 0600). The token never passes through the chat or the agent, and is never written to `project.md`. Login also records which auth scheme worked (`auth = bearer` or `basic`), so later sessions skip the check. You can use environment variables instead: `JIRA_SITE`, `JIRA_EMAIL` and `JIRA_API_TOKEN` override the file, and `JIRA_AUTH=bearer|basic` pins the scheme.
|
|
11
11
|
3. **Ask the agent to set up Jira sync.** It runs `flow jira init`, which asks you one question at a time:
|
|
12
12
|
- **Jira project?** Which project this repo syncs with.
|
|
13
13
|
- **Issue types?** The types a flow may start from, such as Story or Bug.
|
package/extensions/dev-flow.ts
CHANGED
|
@@ -36,7 +36,7 @@ import { foldView, pluginUpstream } from "../src/runtime/reflect.ts";
|
|
|
36
36
|
import { type FlowHooks, runFlow } from "../src/runtime/gates.ts";
|
|
37
37
|
import { JiraWatch } from "../src/runtime/jira-watch.ts";
|
|
38
38
|
import { mirrorClosingMessage, disarmWatch, jiraSeams, resetJiraClients } from "../src/runtime/jira.ts";
|
|
39
|
-
import {
|
|
39
|
+
import { loadCreds, mcpAuth, normSite, saveAuth, saveCreds } from "../src/jira/creds.ts";
|
|
40
40
|
import { JiraClient, MCP_URL } from "../src/jira/client.ts";
|
|
41
41
|
import type { Relay } from "../src/jira/sync.ts";
|
|
42
42
|
import { grantCheck, grantRecord, isFriction, lastOperatorText, newGrantLedger, operatorMessageCount, type RefusalStreak } from "../src/runtime/grants.ts";
|
|
@@ -288,13 +288,24 @@ export default function devFlow(pi: ExtensionAPI) {
|
|
|
288
288
|
return "";
|
|
289
289
|
};
|
|
290
290
|
/** Give the agent the Atlassian MCP server's tools (deferred: found through tool search) for a Jira-synced
|
|
291
|
-
* project — the issue, its links, its history. A server of the same name in mcp.json wins.
|
|
292
|
-
|
|
293
|
-
|
|
291
|
+
* project — the issue, its links, its history. A server of the same name in mcp.json wins. With no stored
|
|
292
|
+
* auth scheme the token is probed first (Bearer, then Basic) and the one that works is remembered. */
|
|
293
|
+
const registerAtlassianMcp = async (cfg: ReturnType<typeof loadProject>["cfg"]) => {
|
|
294
|
+
if (!cfg.jira || !pi.registerMcpServer) return;
|
|
294
295
|
const creds = loadCreds(cfg.jira.site, jiraSeams.env ?? process.env, jiraSeams.credsFile);
|
|
295
296
|
if (!creds) return;
|
|
297
|
+
let scheme = creds.auth;
|
|
298
|
+
if (!scheme) {
|
|
299
|
+
try {
|
|
300
|
+
const picked = await new JiraClient(creds, { fetch: jiraSeams.fetch }).authScheme();
|
|
301
|
+
scheme = picked.scheme;
|
|
302
|
+
if (picked.verified && creds.source === "file") saveAuth(creds, scheme, jiraSeams.credsFile);
|
|
303
|
+
} catch {
|
|
304
|
+
scheme = "bearer"; // unreachable now: the scoped token's scheme
|
|
305
|
+
}
|
|
306
|
+
}
|
|
296
307
|
try {
|
|
297
|
-
pi.registerMcpServer
|
|
308
|
+
pi.registerMcpServer("atlassian", { url: MCP_URL, headers: { Authorization: mcpAuth(creds, scheme) }, exposure: "deferred", description: `Atlassian Jira/Confluence on ${creds.site} (dev-flow Jira sync: project ${cfg.jira.project})` });
|
|
298
309
|
} catch {
|
|
299
310
|
/* another extension owns the name, or no MCP support: the sync itself does not need it */
|
|
300
311
|
}
|
|
@@ -313,9 +324,10 @@ export default function devFlow(pi: ExtensionAPI) {
|
|
|
313
324
|
const probe = new JiraClient({ site: normSite(site), email: email.trim(), token: token.trim(), source: "file" }, { fetch: jiraSeams.fetch });
|
|
314
325
|
const me = await probe.me();
|
|
315
326
|
if (!me.ok) return `not saved — the Atlassian MCP server refused the token: ${me.error}`;
|
|
316
|
-
|
|
327
|
+
const auth = await probe.authScheme();
|
|
328
|
+
saveCreds(site, email, token, jiraSeams.credsFile, auth.verified ? auth.scheme : undefined);
|
|
317
329
|
resetJiraClients();
|
|
318
|
-
if (cfg) registerAtlassianMcp(cfg);
|
|
330
|
+
if (cfg) await registerAtlassianMcp(cfg);
|
|
319
331
|
return `Jira login saved for ${normSite(site)} — authenticated as ${me.value.displayName}. ${cfg?.jira ? "Jira sync is ready." : "Next: flow jira init picks the project, issue types and status mapping."}`;
|
|
320
332
|
};
|
|
321
333
|
|
|
@@ -707,7 +719,7 @@ export default function devFlow(pi: ExtensionAPI) {
|
|
|
707
719
|
if (!initiated(root)) return;
|
|
708
720
|
const cfg = loadProject(dfDir(root)).cfg;
|
|
709
721
|
if (!cfg.jira) return;
|
|
710
|
-
registerAtlassianMcp(cfg);
|
|
722
|
+
void registerAtlassianMcp(cfg);
|
|
711
723
|
// a question asked before this session (or before a restart) is caught up now, then watched again
|
|
712
724
|
const st = boundFeature(root, sessionKey(ctx));
|
|
713
725
|
if (st?.jira?.watch && !isWorkerSession(ctx)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-dev-flow",
|
|
3
|
-
"version": "0.100.
|
|
3
|
+
"version": "0.100.1",
|
|
4
4
|
"description": "Enforced feature workflow for Pi: plan → implement → pre-release → release, gated checkpoints, self-improvement reflections, one git worktree per feature, changelog + publish as part of the release",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
package/src/jira/client.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { readFileSync } from "node:fs";
|
|
13
13
|
import path from "node:path";
|
|
14
|
-
import { basicAuth, type JiraCreds } from "./creds.ts";
|
|
14
|
+
import { basicAuth, type JiraAuth, type JiraCreds, mcpAuth } from "./creds.ts";
|
|
15
15
|
import { type FetchLike, McpClient, type McpTool, resultText, resultValue } from "./mcp.ts";
|
|
16
16
|
import type { StatusInfo } from "./config.ts";
|
|
17
17
|
|
|
@@ -158,7 +158,10 @@ export const mimeOf = (file: string) => MIME[path.extname(file).toLowerCase()] ?
|
|
|
158
158
|
|
|
159
159
|
export class JiraClient {
|
|
160
160
|
readonly creds: JiraCreds;
|
|
161
|
-
readonly
|
|
161
|
+
private readonly mcpUrl: string;
|
|
162
|
+
private mcpP: Promise<McpClient> | undefined;
|
|
163
|
+
/** the MCP auth scheme in use, once picked; `verified` when the site was seen through it */
|
|
164
|
+
private picked: { scheme: JiraAuth; verified: boolean } | undefined;
|
|
162
165
|
private readonly fetchFn: FetchLike;
|
|
163
166
|
private cloudIdP: Promise<string> | undefined;
|
|
164
167
|
private cloudIdFixed: string | undefined;
|
|
@@ -169,7 +172,60 @@ export class JiraClient {
|
|
|
169
172
|
this.creds = creds;
|
|
170
173
|
this.fetchFn = opts.fetch ?? (globalThis.fetch as unknown as FetchLike);
|
|
171
174
|
this.cloudIdFixed = opts.cloudId;
|
|
172
|
-
this.
|
|
175
|
+
this.mcpUrl = opts.mcpUrl ?? MCP_URL;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** The MCP session, with the auth scheme picked on first use. */
|
|
179
|
+
private mcp(): Promise<McpClient> {
|
|
180
|
+
this.mcpP ??= this.pickAuth().catch((e) => {
|
|
181
|
+
this.mcpP = undefined;
|
|
182
|
+
throw e;
|
|
183
|
+
});
|
|
184
|
+
return this.mcpP;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/** Which Authorization the MCP server honours for this token. A scoped token works only as Bearer; sent as
|
|
188
|
+
* Basic the server still lists its tools but sees no site ("Cloud id … isn't explicitly granted"). So each
|
|
189
|
+
* scheme is tried until getAccessibleAtlassianResources returns a site; a stored scheme is used as is. */
|
|
190
|
+
private async pickAuth(): Promise<McpClient> {
|
|
191
|
+
const make = (s: JiraAuth) => new McpClient(this.mcpUrl, { authorization: mcpAuth(this.creds, s) }, this.fetchFn);
|
|
192
|
+
if (this.creds.auth) {
|
|
193
|
+
this.picked = { scheme: this.creds.auth, verified: false };
|
|
194
|
+
return make(this.creds.auth);
|
|
195
|
+
}
|
|
196
|
+
let fallback: { c: McpClient; scheme: JiraAuth } | undefined;
|
|
197
|
+
let err: unknown;
|
|
198
|
+
for (const scheme of ["bearer", "basic"] as const) {
|
|
199
|
+
const c = make(scheme);
|
|
200
|
+
try {
|
|
201
|
+
const tools = await c.listTools();
|
|
202
|
+
const t = tools.find((x) => (TOOLS.resources as readonly string[]).includes(x.name));
|
|
203
|
+
if (!t) {
|
|
204
|
+
// nothing to check with: the first scheme the server accepts
|
|
205
|
+
this.picked = { scheme, verified: false };
|
|
206
|
+
return c;
|
|
207
|
+
}
|
|
208
|
+
const r = await c.callTool(t.name, {});
|
|
209
|
+
if (!r.isError && arr(resultValue(r), "resources").length) {
|
|
210
|
+
this.picked = { scheme, verified: true };
|
|
211
|
+
return c;
|
|
212
|
+
}
|
|
213
|
+
fallback ??= { c, scheme };
|
|
214
|
+
} catch (e) {
|
|
215
|
+
err ??= e;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
if (fallback) {
|
|
219
|
+
this.picked = { scheme: fallback.scheme, verified: false };
|
|
220
|
+
return fallback.c;
|
|
221
|
+
}
|
|
222
|
+
throw err;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/** The MCP auth scheme this client uses, after connecting; `verified` when it proved to reach a site. */
|
|
226
|
+
async authScheme(): Promise<{ scheme: JiraAuth; verified: boolean }> {
|
|
227
|
+
await this.mcp();
|
|
228
|
+
return this.picked!;
|
|
173
229
|
}
|
|
174
230
|
|
|
175
231
|
get site() {
|
|
@@ -180,7 +236,7 @@ export class JiraClient {
|
|
|
180
236
|
}
|
|
181
237
|
|
|
182
238
|
private async tool(op: Op): Promise<McpTool | undefined> {
|
|
183
|
-
const tools = await this.mcp.listTools();
|
|
239
|
+
const tools = await (await this.mcp()).listTools();
|
|
184
240
|
for (const n of TOOLS[op]) {
|
|
185
241
|
const t = tools.find((x) => x.name === n);
|
|
186
242
|
if (t) return t;
|
|
@@ -207,7 +263,7 @@ export class JiraClient {
|
|
|
207
263
|
if (!t) return { ok: false, error: `the Atlassian MCP server offers no ${TOOLS[op].join("/")} tool` };
|
|
208
264
|
const needsCloud = t.inputSchema?.properties && "cloudId" in t.inputSchema.properties;
|
|
209
265
|
const args = this.args(t, { ...(needsCloud ? { cloudId: await this.cloudId() } : {}), ...logical });
|
|
210
|
-
const r = await this.mcp.callTool(t.name, args);
|
|
266
|
+
const r = await (await this.mcp()).callTool(t.name, args);
|
|
211
267
|
if (r.isError) return { ok: false, error: `${t.name}: ${resultText(r).slice(0, 400)}` };
|
|
212
268
|
return { ok: true, value: resultValue(r), via: "mcp" };
|
|
213
269
|
} catch (e) {
|
|
@@ -223,8 +279,8 @@ export class JiraClient {
|
|
|
223
279
|
try {
|
|
224
280
|
const t = await this.tool("resources");
|
|
225
281
|
if (t) {
|
|
226
|
-
const r = await this.mcp.callTool(t.name, {});
|
|
227
|
-
const hit = arr(resultValue(r)).map(rec).find((x) => str(x.url).replace(/^https?:\/\//, "").replace(/\/$/, "") === this.creds.site);
|
|
282
|
+
const r = await (await this.mcp()).callTool(t.name, {});
|
|
283
|
+
const hit = arr(resultValue(r), "resources").map(rec).find((x) => str(x.url).replace(/^https?:\/\//, "").replace(/\/$/, "") === this.creds.site);
|
|
228
284
|
if (hit?.cloudId ?? hit?.id) return str(hit.cloudId ?? hit.id);
|
|
229
285
|
}
|
|
230
286
|
} catch {
|
|
@@ -248,7 +304,8 @@ export class JiraClient {
|
|
|
248
304
|
return this.gateway ?? `https://${this.creds.site}/rest/api/3`;
|
|
249
305
|
}
|
|
250
306
|
|
|
251
|
-
/** Jira REST with the same token — only for what the MCP
|
|
307
|
+
/** Jira REST with the same token (always Basic `email:token`, scoped or not) — only for what the MCP
|
|
308
|
+
* server cannot do. */
|
|
252
309
|
private async rest(method: string, p: string, body?: unknown, extra: Record<string, string> = {}): Promise<JiraResult<unknown>> {
|
|
253
310
|
try {
|
|
254
311
|
const headers: Record<string, string> = { authorization: basicAuth(this.creds), accept: "application/json", ...extra };
|
package/src/jira/creds.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Jira credentials — a Cloud API token
|
|
3
|
-
*
|
|
2
|
+
* Jira credentials — a Cloud API token for the Atlassian Rovo MCP server. A scoped token (the kind the MCP
|
|
3
|
+
* server needs) is sent as `Authorization: Bearer <token>`; Basic `email:token` is the fallback for a plain
|
|
4
|
+
* token. The scheme that worked is stored as `auth` next to the token, so later sessions skip the probe.
|
|
5
|
+
* Jira's REST API always takes Basic `email:token`. They live outside the repo: `~/.pi/agent/dev-flow/jira.json` (mode 0600), written by
|
|
4
6
|
* `/flow jira login`; `JIRA_EMAIL` / `JIRA_API_TOKEN` (and optionally `JIRA_SITE`) override the file.
|
|
5
7
|
* Never printed, never written to project.md or to a comment.
|
|
6
8
|
*/
|
|
@@ -8,11 +10,17 @@ import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "n
|
|
|
8
10
|
import os from "node:os";
|
|
9
11
|
import path from "node:path";
|
|
10
12
|
|
|
13
|
+
/** How the token goes to the MCP server: `Bearer <token>` or Basic `email:token`. */
|
|
14
|
+
export type JiraAuth = "bearer" | "basic";
|
|
15
|
+
export const isJiraAuth = (v: unknown): v is JiraAuth => v === "bearer" || v === "basic";
|
|
16
|
+
|
|
11
17
|
export interface JiraCreds {
|
|
12
18
|
site: string; // acme.atlassian.net
|
|
13
19
|
email: string;
|
|
14
20
|
token: string;
|
|
15
21
|
source: "env" | "file";
|
|
22
|
+
/** the MCP auth scheme known to work; unset → probed (Bearer first) */
|
|
23
|
+
auth?: JiraAuth;
|
|
16
24
|
}
|
|
17
25
|
|
|
18
26
|
export const credsPath = (home = os.homedir()) => path.join(process.env.PI_CODING_AGENT_DIR ?? path.join(home, ".pi", "agent"), "dev-flow", "jira.json");
|
|
@@ -25,7 +33,7 @@ export const normSite = (s: string) =>
|
|
|
25
33
|
.replace(/\/.*$/, "")
|
|
26
34
|
.toLowerCase();
|
|
27
35
|
|
|
28
|
-
type Store = { sites?: Record<string, { email: string; token: string }> };
|
|
36
|
+
type Store = { sites?: Record<string, { email: string; token: string; auth?: JiraAuth }> };
|
|
29
37
|
|
|
30
38
|
function readStore(file: string): Store {
|
|
31
39
|
try {
|
|
@@ -39,19 +47,33 @@ function readStore(file: string): Store {
|
|
|
39
47
|
export function loadCreds(site?: string, env: NodeJS.ProcessEnv = process.env, file = credsPath()): JiraCreds | null {
|
|
40
48
|
const want = site ? normSite(site) : env.JIRA_SITE ? normSite(env.JIRA_SITE) : undefined;
|
|
41
49
|
if (env.JIRA_EMAIL && env.JIRA_API_TOKEN && (want || env.JIRA_SITE))
|
|
42
|
-
return { site: want ?? normSite(env.JIRA_SITE!), email: env.JIRA_EMAIL, token: env.JIRA_API_TOKEN, source: "env" };
|
|
50
|
+
return { site: want ?? normSite(env.JIRA_SITE!), email: env.JIRA_EMAIL, token: env.JIRA_API_TOKEN, source: "env", ...(isJiraAuth(env.JIRA_AUTH) ? { auth: env.JIRA_AUTH } : {}) };
|
|
43
51
|
const sites = readStore(file).sites ?? {};
|
|
44
52
|
const key = want ?? Object.keys(sites)[0];
|
|
45
53
|
const hit = key ? sites[key] : undefined;
|
|
46
|
-
return hit && key ? { site: key, email: hit.email, token: hit.token, source: "file" } : null;
|
|
54
|
+
return hit && key ? { site: key, email: hit.email, token: hit.token, source: "file", ...(isJiraAuth(hit.auth) ? { auth: hit.auth } : {}) } : null;
|
|
47
55
|
}
|
|
48
56
|
|
|
49
|
-
export function saveCreds(site: string, email: string, token: string, file = credsPath()): void {
|
|
57
|
+
export function saveCreds(site: string, email: string, token: string, file = credsPath(), auth?: JiraAuth): void {
|
|
50
58
|
mkdirSync(path.dirname(file), { recursive: true, mode: 0o700 });
|
|
51
59
|
const store = existsSync(file) ? readStore(file) : {};
|
|
52
|
-
store.sites = { ...(store.sites ?? {}), [normSite(site)]: { email: email.trim(), token: token.trim() } };
|
|
60
|
+
store.sites = { ...(store.sites ?? {}), [normSite(site)]: { email: email.trim(), token: token.trim(), ...(auth ? { auth } : {}) } };
|
|
61
|
+
writeFileSync(file, `${JSON.stringify(store, null, "\t")}\n`, { mode: 0o600 });
|
|
62
|
+
chmodSync(file, 0o600);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** Remember the MCP auth scheme that worked for a stored login (no-op when the site or token changed). */
|
|
66
|
+
export function saveAuth(creds: Pick<JiraCreds, "site" | "token">, auth: JiraAuth, file = credsPath()): void {
|
|
67
|
+
if (!existsSync(file)) return;
|
|
68
|
+
const store = readStore(file);
|
|
69
|
+
const hit = store.sites?.[creds.site];
|
|
70
|
+
if (!hit || hit.token !== creds.token || hit.auth === auth) return;
|
|
71
|
+
hit.auth = auth;
|
|
53
72
|
writeFileSync(file, `${JSON.stringify(store, null, "\t")}\n`, { mode: 0o600 });
|
|
54
73
|
chmodSync(file, 0o600);
|
|
55
74
|
}
|
|
56
75
|
|
|
57
76
|
export const basicAuth = (c: Pick<JiraCreds, "email" | "token">) => `Basic ${Buffer.from(`${c.email}:${c.token}`).toString("base64")}`;
|
|
77
|
+
|
|
78
|
+
/** The MCP server's Authorization header for `scheme` (default: the stored one, else Bearer). */
|
|
79
|
+
export const mcpAuth = (c: Pick<JiraCreds, "email" | "token" | "auth">, scheme: JiraAuth = c.auth ?? "bearer") => (scheme === "bearer" ? `Bearer ${c.token}` : basicAuth(c));
|
package/src/runtime/jira.ts
CHANGED
|
@@ -59,7 +59,7 @@ export async function gateJiraInit(root: string, cfg: Config, rest: string[], fl
|
|
|
59
59
|
if (!creds) return { text: needsOperator(noCreds(siteArg ?? cfg.jira?.site), "Jira login?", "ask the operator to run /flow jira login (never ask them to paste the token into the chat); once they say it is done, re-run flow jira init"), isError: true };
|
|
60
60
|
const client = clientFor(creds, cfg.jira?.site === creds.site ? cfg.jira.cloudId : undefined);
|
|
61
61
|
const me = await client.me();
|
|
62
|
-
if (!me.ok) return { text: `Jira authentication failed on ${creds.site} (${creds.source === "env" ? "JIRA_EMAIL/JIRA_API_TOKEN" : "stored login"}): ${me.error}\nThe Atlassian MCP server
|
|
62
|
+
if (!me.ok) return { text: `Jira authentication failed on ${creds.site} (${creds.source === "env" ? "JIRA_EMAIL/JIRA_API_TOKEN" : "stored login"}): ${me.error}\nThe Atlassian MCP server needs a scoped API token (read:jira:agent-interface, write:jira:agent-interface; sent as Bearer), and an org admin must have enabled API-token authentication for it (Atlassian Administration → Rovo MCP server). Check the token (/flow jira login re-enters it).`, isError: true };
|
|
63
63
|
const head = `Jira: authenticated as ${me.value.displayName} on ${creds.site} (Atlassian MCP server)`;
|
|
64
64
|
|
|
65
65
|
const project = flagValue(rest, "project") ?? cfg.jira?.project;
|