pi-dev-flow 0.99.1 → 0.99.2
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 +1 -0
- package/package.json +1 -1
- package/src/runtime/jira.ts +51 -0
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.99.2] - 2026-12-03
|
|
8
|
+
|
|
9
|
+
**The approved plan reaches the linked Jira issue in every case.**
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
- **The approved plan now reaches the linked Jira issue in every case.** It used to go only with a mirrored Approve? question. That question is mirrored only when the agent closes its turn on it in a flow that is already linked. When an answer like "approve minor, yes to Jira" created the issue and approved in one go, the plan never got to the issue. Now every approval of a linked flow posts the plan, with `plan.md` and the mockups attached, unless the identical copy is already there. A flow linked after approval gets its plan posted when the link is made.
|
|
13
|
+
|
|
7
14
|
## [0.99.1] - 2026-12-03
|
|
8
15
|
|
|
9
16
|
**Jira attachments work with the token the Atlassian MCP server needs.**
|
package/docs/jira.md
CHANGED
|
@@ -40,6 +40,7 @@ status.Story.done = Done
|
|
|
40
40
|
- **No issue yet?** When you start a flow without naming an issue, the agent offers three choices: create a new issue in the synced project, link an existing one, or go without. The agent shows you the summary, type and description before anything is created (`flow jira create`), and links the new issue to the flow. Starting with `--no-jira` skips the offer.
|
|
41
41
|
- **Issues for roadmap items.** Ask the agent to create issues for roadmap items (`flow jira create --roadmap=2,5`). You see the list first. Each item's text becomes the summary and its brief the description, and the item is stamped with its key (`- [ ] Dark mode [DEV-14]`). When that item is picked and started, the flow links to its issue automatically.
|
|
42
42
|
- **Questions go to the issue.** When the agent stops to ask you something, its message is also posted as a comment. At **Approve?** it attaches `plan.md` and the mockups. Any screenshot the message names by path is attached as well. The same message is never posted twice, and the same file never uploaded twice.
|
|
43
|
+
- **The approved plan always reaches the issue.** When the plan is approved, dev-flow posts it to the issue with `plan.md` and the mockups attached. This covers approvals that never passed through a mirrored question: you approved in chat, or the issue was created or linked at the moment you approved. If the identical plan was already posted with the Approve? question, the approval comment just says so. A flow linked to an issue after approval gets its plan posted at link time.
|
|
43
44
|
- **Answering in Jira:**
|
|
44
45
|
- **Comment**, for example "Approved", "Verified", or a change request. Only comments from your own account (the token's owner) count as your answer. Other people's comments are shown in the session as information and never approve anything.
|
|
45
46
|
- **Move the issue** to the status mapped to the next stage. A move to `implement` answers Approve?, `pre-release` answers Verified?, `release` answers Release?, and `done` answers Finish?. Any other move is shown as information.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-dev-flow",
|
|
3
|
-
"version": "0.99.
|
|
3
|
+
"version": "0.99.2",
|
|
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/runtime/jira.ts
CHANGED
|
@@ -205,6 +205,11 @@ export async function linkFlow(root: string, cfg: Config, slug: string, key: str
|
|
|
205
205
|
writeState(root, { ...state, jira: link });
|
|
206
206
|
const moved = await moveToStage(root, cfg, slug, state.stage);
|
|
207
207
|
if (moved) lines.push(moved);
|
|
208
|
+
// linked after the plan was approved: the issue gets the plan it would have seen at Approve?
|
|
209
|
+
if (state.stage !== "plan") {
|
|
210
|
+
const posted = await postApprovedPlan(root, cfg, slug);
|
|
211
|
+
if (posted) lines.push(posted);
|
|
212
|
+
}
|
|
208
213
|
return { lines };
|
|
209
214
|
}
|
|
210
215
|
|
|
@@ -250,6 +255,10 @@ export async function syncStageMoves(root: string, cfg: Config, before: Map<stri
|
|
|
250
255
|
if (!stage) continue;
|
|
251
256
|
const line = await moveToStage(root, cfg, slug, stage, st?.jira ?? b.link);
|
|
252
257
|
if (line) out.push(line);
|
|
258
|
+
if (st && b.stage === "plan" && stage === "implement") {
|
|
259
|
+
const posted = await postApprovedPlan(root, cfg, slug);
|
|
260
|
+
if (posted) out.push(posted);
|
|
261
|
+
}
|
|
253
262
|
if (!st) {
|
|
254
263
|
const c = jiraClient(cfg.jira);
|
|
255
264
|
if (!("error" in c)) await c.client.comment(b.link.key, formatComment({ slug, text: `dev-flow feature \`${slug}\` finished.` }));
|
|
@@ -258,6 +267,48 @@ export async function syncStageMoves(root: string, cfg: Config, before: Map<stri
|
|
|
258
267
|
return out;
|
|
259
268
|
}
|
|
260
269
|
|
|
270
|
+
/** The approved plan on the issue, however the approval came: the Approve? question is mirrored only when the
|
|
271
|
+
* agent closes its turn on it in a linked flow, and an approval given in chat — or a link made at approval
|
|
272
|
+
* time — never reaches that point. Attaches plan.md and the mockups not already attached; the comment carries
|
|
273
|
+
* the plan itself unless an unchanged copy is already on the issue. Returns a gate-output line. */
|
|
274
|
+
export async function postApprovedPlan(root: string, cfg: Config, slug: string): Promise<string | null> {
|
|
275
|
+
const st = readState(root, slug);
|
|
276
|
+
if (!cfg.jira || !st?.jira) return null;
|
|
277
|
+
const planMd = path.join(featDir(root, slug), "plan", "plan.md");
|
|
278
|
+
if (!existsSync(planMd)) return null; // patch/docs: no plan document
|
|
279
|
+
const c = jiraClient(cfg.jira);
|
|
280
|
+
if ("error" in c) return `${AGENT_MARK}jira: the approved plan was not posted to ${st.jira.key} — ${c.error}`;
|
|
281
|
+
const link = st.jira;
|
|
282
|
+
const plan = readFileSync(planMd, "utf8");
|
|
283
|
+
const hashes = new Set(link.attached ?? []);
|
|
284
|
+
const already = hashes.has(sha1(plan)); // the Approve? mirror attached this very plan
|
|
285
|
+
const mock = path.join(featDir(root, slug), "plan", "mockups");
|
|
286
|
+
const files = [planMd, ...(existsSync(mock) ? readdirSync(mock).filter((f) => /\.(png|jpe?g|gif|webp)$/i.test(f)).map((f) => path.join(mock, f)) : [])];
|
|
287
|
+
const attached: string[] = [];
|
|
288
|
+
const failed: string[] = [];
|
|
289
|
+
for (const f of files) {
|
|
290
|
+
const h = sha1(readFileSync(f));
|
|
291
|
+
if (hashes.has(h)) continue;
|
|
292
|
+
const r = await c.client.upload(link.key, f);
|
|
293
|
+
if (r.ok) {
|
|
294
|
+
attached.push(path.basename(f));
|
|
295
|
+
hashes.add(h);
|
|
296
|
+
} else failed.push(`${path.basename(f)} (${r.error})`);
|
|
297
|
+
}
|
|
298
|
+
const call = st.versionChoice ? ` Release call: ${st.versionChoice}.` : "";
|
|
299
|
+
const mode = st.patch ? " (patch)" : st.docs ? " (docs)" : "";
|
|
300
|
+
const body = already
|
|
301
|
+
? `Plan approved${mode} — the copy posted with the question is the one approved.${call}`
|
|
302
|
+
: `**Plan approved${mode}** — implementation starts.${call}\n\n${plan.length > 24_000 ? `_(the plan is long — see the attached plan.md)_` : plan.trim()}`;
|
|
303
|
+
const r = await c.client.comment(link.key, formatComment({ slug, text: body, attachments: attached }));
|
|
304
|
+
const fresh = readState(root, slug) ?? st;
|
|
305
|
+
const next: JiraLink = { ...(fresh.jira ?? link), attached: [...hashes] };
|
|
306
|
+
if (r.ok && r.value) next.posted = [...next.posted, r.value];
|
|
307
|
+
writeState(root, { ...fresh, jira: next });
|
|
308
|
+
if (!r.ok) return `${AGENT_MARK}jira: the approved plan was not posted to ${link.key}: ${r.error}`;
|
|
309
|
+
return `Jira ${link.key}: approved plan posted${attached.length ? ` with ${attached.join(", ")}` : ""}${failed.length ? ` (not attached: ${failed.join("; ")})` : ""}`;
|
|
310
|
+
}
|
|
311
|
+
|
|
261
312
|
// ---------------------------------------------------------------- outbound: the closing-message mirror
|
|
262
313
|
|
|
263
314
|
const IMG = /(?:^|[\s(`'"[])((?:\.{0,2}\/|\/)?[\w@.\-/]+\.(?:png|jpe?g|gif|webp))(?=$|[\s)`'",\]:;])/gi;
|