@anthropologies/claudestory 0.1.36 → 0.1.37
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/dist/cli.d.ts +1 -0
- package/dist/cli.js +221 -18
- package/dist/index.d.ts +1857 -0
- package/dist/mcp.d.ts +1 -0
- package/dist/mcp.js +212 -17
- package/package.json +1 -1
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/dist/cli.js
CHANGED
|
@@ -5266,6 +5266,7 @@ var init_session_types = __esm({
|
|
|
5266
5266
|
"FINALIZE",
|
|
5267
5267
|
"COMPACT",
|
|
5268
5268
|
"LESSON_CAPTURE",
|
|
5269
|
+
"ISSUE_FIX",
|
|
5269
5270
|
"ISSUE_SWEEP"
|
|
5270
5271
|
]);
|
|
5271
5272
|
IDLE_STATES = /* @__PURE__ */ new Set([
|
|
@@ -5294,6 +5295,7 @@ var init_session_types = __esm({
|
|
|
5294
5295
|
"HANDOVER",
|
|
5295
5296
|
"COMPLETE",
|
|
5296
5297
|
"LESSON_CAPTURE",
|
|
5298
|
+
"ISSUE_FIX",
|
|
5297
5299
|
"ISSUE_SWEEP",
|
|
5298
5300
|
"SESSION_END"
|
|
5299
5301
|
];
|
|
@@ -5342,6 +5344,14 @@ var init_session_types = __esm({
|
|
|
5342
5344
|
timestamp: z9.string()
|
|
5343
5345
|
})).default([])
|
|
5344
5346
|
}).default({ plan: [], code: [] }),
|
|
5347
|
+
// T-153: Current issue being fixed (null when working on a ticket)
|
|
5348
|
+
currentIssue: z9.object({
|
|
5349
|
+
id: z9.string(),
|
|
5350
|
+
title: z9.string(),
|
|
5351
|
+
severity: z9.string()
|
|
5352
|
+
}).nullable().default(null),
|
|
5353
|
+
// T-153: Issues resolved this session
|
|
5354
|
+
resolvedIssues: z9.array(z9.string()).default([]),
|
|
5345
5355
|
// Completed tickets this session
|
|
5346
5356
|
completedTickets: z9.array(z9.object({
|
|
5347
5357
|
id: z9.string(),
|
|
@@ -5845,7 +5855,7 @@ var init_state_machine = __esm({
|
|
|
5845
5855
|
// start does INIT + LOAD_CONTEXT internally
|
|
5846
5856
|
LOAD_CONTEXT: ["PICK_TICKET"],
|
|
5847
5857
|
// internal (never seen by Claude)
|
|
5848
|
-
PICK_TICKET: ["PLAN", "SESSION_END"],
|
|
5858
|
+
PICK_TICKET: ["PLAN", "ISSUE_FIX", "SESSION_END"],
|
|
5849
5859
|
PLAN: ["PLAN_REVIEW"],
|
|
5850
5860
|
PLAN_REVIEW: ["IMPLEMENT", "WRITE_TESTS", "PLAN", "PLAN_REVIEW", "SESSION_END"],
|
|
5851
5861
|
// approve → IMPLEMENT/WRITE_TESTS, reject → PLAN, stay for next round; SESSION_END for tiered exit
|
|
@@ -5859,8 +5869,11 @@ var init_state_machine = __esm({
|
|
|
5859
5869
|
// approve → VERIFY/FINALIZE, reject → IMPLEMENT/PLAN, stay for next round; SESSION_END for tiered exit
|
|
5860
5870
|
VERIFY: ["FINALIZE", "IMPLEMENT", "VERIFY"],
|
|
5861
5871
|
// pass → FINALIZE, fail → IMPLEMENT, retry
|
|
5862
|
-
FINALIZE: ["COMPLETE"],
|
|
5872
|
+
FINALIZE: ["COMPLETE", "PICK_TICKET"],
|
|
5873
|
+
// PICK_TICKET for issue-fix flow (bypass COMPLETE)
|
|
5863
5874
|
COMPLETE: ["PICK_TICKET", "HANDOVER", "ISSUE_SWEEP", "SESSION_END"],
|
|
5875
|
+
ISSUE_FIX: ["FINALIZE", "PICK_TICKET", "ISSUE_FIX"],
|
|
5876
|
+
// T-153: fix done → FINALIZE, cancel → PICK_TICKET, retry self
|
|
5864
5877
|
LESSON_CAPTURE: ["ISSUE_SWEEP", "HANDOVER", "LESSON_CAPTURE"],
|
|
5865
5878
|
// advance → ISSUE_SWEEP, retry self, done → HANDOVER
|
|
5866
5879
|
ISSUE_SWEEP: ["ISSUE_SWEEP", "HANDOVER", "PICK_TICKET"],
|
|
@@ -6420,28 +6433,52 @@ var init_pick_ticket = __esm({
|
|
|
6420
6433
|
(c, i) => `${i + 1}. **${c.ticket.id}: ${c.ticket.title}** (${c.ticket.type})`
|
|
6421
6434
|
).join("\n");
|
|
6422
6435
|
}
|
|
6436
|
+
const highIssues = projectState.issues.filter(
|
|
6437
|
+
(i) => i.status === "open" && (i.severity === "critical" || i.severity === "high")
|
|
6438
|
+
);
|
|
6439
|
+
let issuesText = "";
|
|
6440
|
+
if (highIssues.length > 0) {
|
|
6441
|
+
issuesText = "\n\n## Open Issues (high+ severity)\n\n" + highIssues.map(
|
|
6442
|
+
(i, idx) => `${idx + 1}. **${i.id}: ${i.title}** (${i.severity})`
|
|
6443
|
+
).join("\n");
|
|
6444
|
+
}
|
|
6423
6445
|
const topCandidate = candidates.kind === "found" ? candidates.candidates[0] : null;
|
|
6446
|
+
const hasIssues = highIssues.length > 0;
|
|
6424
6447
|
return {
|
|
6425
6448
|
instruction: [
|
|
6426
|
-
"# Pick a Ticket",
|
|
6449
|
+
"# Pick a Ticket or Issue",
|
|
6450
|
+
"",
|
|
6451
|
+
"## Ticket Candidates",
|
|
6427
6452
|
"",
|
|
6428
6453
|
candidatesText || "No ticket candidates found.",
|
|
6454
|
+
issuesText,
|
|
6429
6455
|
"",
|
|
6430
|
-
topCandidate ? `Pick **${topCandidate.ticket.id}** (highest priority) by calling \`claudestory_autonomous_guide\` now:` : "Pick a ticket by calling `claudestory_autonomous_guide` now:",
|
|
6456
|
+
topCandidate ? `Pick **${topCandidate.ticket.id}** (highest priority) or an open issue by calling \`claudestory_autonomous_guide\` now:` : hasIssues ? `Pick an issue to fix by calling \`claudestory_autonomous_guide\` now:` : "Pick a ticket by calling `claudestory_autonomous_guide` now:",
|
|
6431
6457
|
"```json",
|
|
6432
6458
|
topCandidate ? `{ "sessionId": "${ctx.state.sessionId}", "action": "report", "report": { "completedAction": "ticket_picked", "ticketId": "${topCandidate.ticket.id}" } }` : `{ "sessionId": "${ctx.state.sessionId}", "action": "report", "report": { "completedAction": "ticket_picked", "ticketId": "T-XXX" } }`,
|
|
6433
|
-
"```"
|
|
6459
|
+
"```",
|
|
6460
|
+
...hasIssues ? [
|
|
6461
|
+
"",
|
|
6462
|
+
"Or to fix an issue:",
|
|
6463
|
+
"```json",
|
|
6464
|
+
`{ "sessionId": "${ctx.state.sessionId}", "action": "report", "report": { "completedAction": "issue_picked", "issueId": "${highIssues[0].id}" } }`,
|
|
6465
|
+
"```"
|
|
6466
|
+
] : []
|
|
6434
6467
|
].join("\n"),
|
|
6435
6468
|
reminders: [
|
|
6436
|
-
"Do NOT stop or summarize. Call autonomous_guide IMMEDIATELY to pick a ticket.",
|
|
6469
|
+
"Do NOT stop or summarize. Call autonomous_guide IMMEDIATELY to pick a ticket or issue.",
|
|
6437
6470
|
"Do NOT ask the user for confirmation."
|
|
6438
6471
|
]
|
|
6439
6472
|
};
|
|
6440
6473
|
}
|
|
6441
6474
|
async report(ctx, report) {
|
|
6475
|
+
const issueId = report.issueId;
|
|
6476
|
+
if (issueId) {
|
|
6477
|
+
return this.handleIssuePick(ctx, issueId);
|
|
6478
|
+
}
|
|
6442
6479
|
const ticketId = report.ticketId;
|
|
6443
6480
|
if (!ticketId) {
|
|
6444
|
-
return { action: "retry", instruction: "report.ticketId is required
|
|
6481
|
+
return { action: "retry", instruction: "report.ticketId or report.issueId is required." };
|
|
6445
6482
|
}
|
|
6446
6483
|
const { state: projectState } = await ctx.loadProject();
|
|
6447
6484
|
const ticket = projectState.ticketByID(ticketId);
|
|
@@ -6492,6 +6529,24 @@ ${ticket.description}` : "",
|
|
|
6492
6529
|
}
|
|
6493
6530
|
};
|
|
6494
6531
|
}
|
|
6532
|
+
// T-153: Handle issue pick -- validate and route to ISSUE_FIX
|
|
6533
|
+
async handleIssuePick(ctx, issueId) {
|
|
6534
|
+
const { state: projectState } = await ctx.loadProject();
|
|
6535
|
+
const issue = projectState.issues.find((i) => i.id === issueId);
|
|
6536
|
+
if (!issue) {
|
|
6537
|
+
return { action: "retry", instruction: `Issue ${issueId} not found. Pick a valid issue or ticket.` };
|
|
6538
|
+
}
|
|
6539
|
+
if (issue.status !== "open") {
|
|
6540
|
+
return { action: "retry", instruction: `Issue ${issueId} is ${issue.status}. Pick an open issue.` };
|
|
6541
|
+
}
|
|
6542
|
+
ctx.updateDraft({
|
|
6543
|
+
currentIssue: { id: issue.id, title: issue.title, severity: issue.severity },
|
|
6544
|
+
ticket: void 0,
|
|
6545
|
+
reviews: { plan: [], code: [] },
|
|
6546
|
+
finalizeCheckpoint: null
|
|
6547
|
+
});
|
|
6548
|
+
return { action: "goto", target: "ISSUE_FIX" };
|
|
6549
|
+
}
|
|
6495
6550
|
};
|
|
6496
6551
|
}
|
|
6497
6552
|
});
|
|
@@ -7486,10 +7541,13 @@ var init_finalize = __esm({
|
|
|
7486
7541
|
"Code review passed. Time to commit.",
|
|
7487
7542
|
"",
|
|
7488
7543
|
ctx.state.ticket ? `1. Update ticket ${ctx.state.ticket.id} status to "complete" in .story/` : "",
|
|
7489
|
-
|
|
7544
|
+
ctx.state.currentIssue ? `1. Ensure issue ${ctx.state.currentIssue.id} status is "resolved" in .story/issues/` : "",
|
|
7545
|
+
"2. Stage only the files you created or modified for this work (code + .story/ changes). Do NOT use `git add -A` or `git add .`",
|
|
7490
7546
|
'3. Call me with completedAction: "files_staged"'
|
|
7491
7547
|
].filter(Boolean).join("\n"),
|
|
7492
|
-
reminders: [
|
|
7548
|
+
reminders: [
|
|
7549
|
+
ctx.state.currentIssue ? "Stage both code changes and .story/ issue update in the same commit. Only stage files related to this fix." : "Stage both code changes and .story/ ticket update in the same commit. Only stage files related to this ticket."
|
|
7550
|
+
],
|
|
7493
7551
|
transitionedFrom: ctx.state.previousState ?? void 0
|
|
7494
7552
|
};
|
|
7495
7553
|
}
|
|
@@ -7532,9 +7590,9 @@ var init_finalize = __esm({
|
|
|
7532
7590
|
const headResult = await gitHead(ctx.root);
|
|
7533
7591
|
const previousHead = ctx.state.git.expectedHead ?? ctx.state.git.initHead;
|
|
7534
7592
|
if (headResult.ok && previousHead && headResult.data.hash !== previousHead) {
|
|
7593
|
+
const treeResult = await gitDiffTreeNames(ctx.root, headResult.data.hash);
|
|
7535
7594
|
const ticketId2 = ctx.state.ticket?.id;
|
|
7536
7595
|
if (ticketId2) {
|
|
7537
|
-
const treeResult = await gitDiffTreeNames(ctx.root, headResult.data.hash);
|
|
7538
7596
|
const ticketPath = `.story/tickets/${ticketId2}.json`;
|
|
7539
7597
|
if (treeResult.ok && !treeResult.data.includes(ticketPath)) {
|
|
7540
7598
|
return {
|
|
@@ -7543,6 +7601,16 @@ var init_finalize = __esm({
|
|
|
7543
7601
|
};
|
|
7544
7602
|
}
|
|
7545
7603
|
}
|
|
7604
|
+
const earlyIssueId = ctx.state.currentIssue?.id;
|
|
7605
|
+
if (earlyIssueId) {
|
|
7606
|
+
const issuePath = `.story/issues/${earlyIssueId}.json`;
|
|
7607
|
+
if (treeResult.ok && !treeResult.data.includes(issuePath)) {
|
|
7608
|
+
return {
|
|
7609
|
+
action: "retry",
|
|
7610
|
+
instruction: `Commit detected (${headResult.data.hash.slice(0, 7)}) but issue file ${issuePath} is not in the commit. Amend the commit to include it: \`git add ${issuePath} && git commit --amend --no-edit\`, then report completedAction: "commit_done" with the new hash.`
|
|
7611
|
+
};
|
|
7612
|
+
}
|
|
7613
|
+
}
|
|
7546
7614
|
ctx.writeState({ finalizeCheckpoint: "precommit_passed" });
|
|
7547
7615
|
return this.handleCommit(ctx, { ...report, commitHash: headResult.data.hash });
|
|
7548
7616
|
}
|
|
@@ -7576,6 +7644,16 @@ var init_finalize = __esm({
|
|
|
7576
7644
|
};
|
|
7577
7645
|
}
|
|
7578
7646
|
}
|
|
7647
|
+
const issueId = ctx.state.currentIssue?.id;
|
|
7648
|
+
if (issueId) {
|
|
7649
|
+
const issuePath = `.story/issues/${issueId}.json`;
|
|
7650
|
+
if (!stagedResult.data.includes(issuePath)) {
|
|
7651
|
+
return {
|
|
7652
|
+
action: "retry",
|
|
7653
|
+
instruction: `Issue file ${issuePath} is not staged. Run \`git add ${issuePath}\` and call me again with completedAction: "files_staged".`
|
|
7654
|
+
};
|
|
7655
|
+
}
|
|
7656
|
+
}
|
|
7579
7657
|
ctx.writeState({
|
|
7580
7658
|
finalizeCheckpoint: overlapOverridden ? "staged_override" : "staged"
|
|
7581
7659
|
});
|
|
@@ -7623,6 +7701,16 @@ var init_finalize = __esm({
|
|
|
7623
7701
|
};
|
|
7624
7702
|
}
|
|
7625
7703
|
}
|
|
7704
|
+
const precommitIssueId = ctx.state.currentIssue?.id;
|
|
7705
|
+
if (precommitIssueId) {
|
|
7706
|
+
const issuePath = `.story/issues/${precommitIssueId}.json`;
|
|
7707
|
+
if (!stagedResult.data.includes(issuePath)) {
|
|
7708
|
+
return {
|
|
7709
|
+
action: "retry",
|
|
7710
|
+
instruction: `Pre-commit hooks may have modified the staged set. Issue file ${issuePath} is no longer staged. Run \`git add ${issuePath}\` and call me again with completedAction: "files_staged".`
|
|
7711
|
+
};
|
|
7712
|
+
}
|
|
7713
|
+
}
|
|
7626
7714
|
ctx.writeState({ finalizeCheckpoint: "precommit_passed" });
|
|
7627
7715
|
return {
|
|
7628
7716
|
action: "retry",
|
|
@@ -7660,6 +7748,21 @@ var init_finalize = __esm({
|
|
|
7660
7748
|
if (previousHead && normalizedHash === previousHead) {
|
|
7661
7749
|
return { action: "retry", instruction: `No new commit detected: HEAD (${normalizedHash}) has not changed. Create a commit first, then report the new hash.` };
|
|
7662
7750
|
}
|
|
7751
|
+
const currentIssue = ctx.state.currentIssue;
|
|
7752
|
+
if (currentIssue) {
|
|
7753
|
+
ctx.writeState({
|
|
7754
|
+
finalizeCheckpoint: "committed",
|
|
7755
|
+
resolvedIssues: [...ctx.state.resolvedIssues ?? [], currentIssue.id],
|
|
7756
|
+
currentIssue: null,
|
|
7757
|
+
git: {
|
|
7758
|
+
...ctx.state.git,
|
|
7759
|
+
mergeBase: normalizedHash,
|
|
7760
|
+
expectedHead: normalizedHash
|
|
7761
|
+
}
|
|
7762
|
+
});
|
|
7763
|
+
ctx.appendEvent("commit", { commitHash: normalizedHash, issueId: currentIssue.id });
|
|
7764
|
+
return { action: "goto", target: "PICK_TICKET" };
|
|
7765
|
+
}
|
|
7663
7766
|
const completedTicket = ctx.state.ticket ? { id: ctx.state.ticket.id, title: ctx.state.ticket.title, commitHash: normalizedHash, risk: ctx.state.ticket.risk, realizedRisk: ctx.state.ticket.realizedRisk } : void 0;
|
|
7664
7767
|
ctx.writeState({
|
|
7665
7768
|
finalizeCheckpoint: "committed",
|
|
@@ -7884,6 +7987,85 @@ var init_lesson_capture = __esm({
|
|
|
7884
7987
|
}
|
|
7885
7988
|
});
|
|
7886
7989
|
|
|
7990
|
+
// src/autonomous/stages/issue-fix.ts
|
|
7991
|
+
var IssueFixStage;
|
|
7992
|
+
var init_issue_fix = __esm({
|
|
7993
|
+
"src/autonomous/stages/issue-fix.ts"() {
|
|
7994
|
+
"use strict";
|
|
7995
|
+
init_esm_shims();
|
|
7996
|
+
IssueFixStage = class {
|
|
7997
|
+
id = "ISSUE_FIX";
|
|
7998
|
+
async enter(ctx) {
|
|
7999
|
+
const issue = ctx.state.currentIssue;
|
|
8000
|
+
if (!issue) {
|
|
8001
|
+
return { action: "goto", target: "PICK_TICKET" };
|
|
8002
|
+
}
|
|
8003
|
+
const { state: projectState } = await ctx.loadProject();
|
|
8004
|
+
const fullIssue = projectState.issues.find((i) => i.id === issue.id);
|
|
8005
|
+
const details = fullIssue ? [
|
|
8006
|
+
`**${fullIssue.id}**: ${fullIssue.title}`,
|
|
8007
|
+
"",
|
|
8008
|
+
`Severity: ${fullIssue.severity}`,
|
|
8009
|
+
fullIssue.impact ? `Impact: ${fullIssue.impact}` : "",
|
|
8010
|
+
fullIssue.components.length > 0 ? `Components: ${fullIssue.components.join(", ")}` : "",
|
|
8011
|
+
fullIssue.location.length > 0 ? `Location: ${fullIssue.location.join(", ")}` : ""
|
|
8012
|
+
].filter(Boolean).join("\n") : `**${issue.id}**: ${issue.title} (severity: ${issue.severity})`;
|
|
8013
|
+
return {
|
|
8014
|
+
instruction: [
|
|
8015
|
+
"# Fix Issue",
|
|
8016
|
+
"",
|
|
8017
|
+
details,
|
|
8018
|
+
"",
|
|
8019
|
+
'Fix this issue, then update its status to "resolved" in `.story/issues/`.',
|
|
8020
|
+
"Add a resolution description explaining the fix.",
|
|
8021
|
+
"",
|
|
8022
|
+
"When done, call `claudestory_autonomous_guide` with:",
|
|
8023
|
+
"```json",
|
|
8024
|
+
`{ "sessionId": "${ctx.state.sessionId}", "action": "report", "report": { "completedAction": "issue_fixed" } }`,
|
|
8025
|
+
"```"
|
|
8026
|
+
].join("\n"),
|
|
8027
|
+
reminders: [
|
|
8028
|
+
'Update the issue JSON: set status to "resolved", add resolution text, set resolvedDate.',
|
|
8029
|
+
"Do NOT ask the user for confirmation."
|
|
8030
|
+
]
|
|
8031
|
+
};
|
|
8032
|
+
}
|
|
8033
|
+
async report(ctx, _report) {
|
|
8034
|
+
const issue = ctx.state.currentIssue;
|
|
8035
|
+
if (!issue) {
|
|
8036
|
+
return { action: "goto", target: "PICK_TICKET" };
|
|
8037
|
+
}
|
|
8038
|
+
const { state: projectState } = await ctx.loadProject();
|
|
8039
|
+
const current = projectState.issues.find((i) => i.id === issue.id);
|
|
8040
|
+
if (!current || current.status !== "resolved") {
|
|
8041
|
+
return {
|
|
8042
|
+
action: "retry",
|
|
8043
|
+
instruction: `Issue ${issue.id} is still ${current?.status ?? "missing"}. Update its status to "resolved" in .story/issues/${issue.id}.json with a resolution description and resolvedDate, then report again.`,
|
|
8044
|
+
reminders: ["Set status to 'resolved', add resolution text, set resolvedDate."]
|
|
8045
|
+
};
|
|
8046
|
+
}
|
|
8047
|
+
return {
|
|
8048
|
+
action: "goto",
|
|
8049
|
+
target: "FINALIZE",
|
|
8050
|
+
result: {
|
|
8051
|
+
instruction: [
|
|
8052
|
+
"# Finalize Issue Fix",
|
|
8053
|
+
"",
|
|
8054
|
+
`Issue ${issue.id} resolved. Time to commit.`,
|
|
8055
|
+
"",
|
|
8056
|
+
`1. Ensure .story/issues/${issue.id}.json is updated with status: "resolved"`,
|
|
8057
|
+
"2. Stage only the files you modified for this fix (code + .story/ changes). Do NOT use `git add -A` or `git add .`",
|
|
8058
|
+
'3. Call me with completedAction: "files_staged"'
|
|
8059
|
+
].join("\n"),
|
|
8060
|
+
reminders: ["Stage both code changes and .story/ issue update in the same commit. Only stage files related to this fix."],
|
|
8061
|
+
transitionedFrom: "ISSUE_FIX"
|
|
8062
|
+
}
|
|
8063
|
+
};
|
|
8064
|
+
}
|
|
8065
|
+
};
|
|
8066
|
+
}
|
|
8067
|
+
});
|
|
8068
|
+
|
|
7887
8069
|
// src/autonomous/stages/issue-sweep.ts
|
|
7888
8070
|
var IssueSweepStage;
|
|
7889
8071
|
var init_issue_sweep = __esm({
|
|
@@ -8094,6 +8276,7 @@ var init_stages = __esm({
|
|
|
8094
8276
|
init_finalize();
|
|
8095
8277
|
init_complete();
|
|
8096
8278
|
init_lesson_capture();
|
|
8279
|
+
init_issue_fix();
|
|
8097
8280
|
init_issue_sweep();
|
|
8098
8281
|
init_handover2();
|
|
8099
8282
|
registerStage(new PickTicketStage());
|
|
@@ -8108,6 +8291,7 @@ var init_stages = __esm({
|
|
|
8108
8291
|
registerStage(new FinalizeStage());
|
|
8109
8292
|
registerStage(new CompleteStage());
|
|
8110
8293
|
registerStage(new LessonCaptureStage());
|
|
8294
|
+
registerStage(new IssueFixStage());
|
|
8111
8295
|
registerStage(new IssueSweepStage());
|
|
8112
8296
|
registerStage(new HandoverStage());
|
|
8113
8297
|
}
|
|
@@ -8670,13 +8854,22 @@ ${ticket.description}` : "",
|
|
|
8670
8854
|
} else {
|
|
8671
8855
|
candidatesText = "No tickets found.";
|
|
8672
8856
|
}
|
|
8857
|
+
const highIssues = projectState.issues.filter(
|
|
8858
|
+
(i) => i.status === "open" && (i.severity === "critical" || i.severity === "high")
|
|
8859
|
+
);
|
|
8860
|
+
let issuesText = "";
|
|
8861
|
+
if (highIssues.length > 0) {
|
|
8862
|
+
issuesText = "\n\n## Open Issues (high+ severity)\n\n" + highIssues.map(
|
|
8863
|
+
(i, idx) => `${idx + 1}. **${i.id}: ${i.title}** (${i.severity})`
|
|
8864
|
+
).join("\n");
|
|
8865
|
+
}
|
|
8673
8866
|
const guideRecOptions = buildGuideRecommendOptions(root);
|
|
8674
8867
|
const recResult = recommend(projectState, 5, guideRecOptions);
|
|
8675
8868
|
let recsText = "";
|
|
8676
8869
|
if (recResult.recommendations.length > 0) {
|
|
8677
|
-
const
|
|
8678
|
-
if (
|
|
8679
|
-
recsText = "\n\n**Recommended:**\n" +
|
|
8870
|
+
const actionableRecs = recResult.recommendations.filter((r) => r.kind === "ticket" || r.kind === "issue");
|
|
8871
|
+
if (actionableRecs.length > 0) {
|
|
8872
|
+
recsText = "\n\n**Recommended:**\n" + actionableRecs.map(
|
|
8680
8873
|
(r) => `- ${r.id}: ${r.title} (${r.reason})`
|
|
8681
8874
|
).join("\n");
|
|
8682
8875
|
}
|
|
@@ -8696,21 +8889,30 @@ ${ticket.description}` : "",
|
|
|
8696
8889
|
const interval = updated.config.handoverInterval ?? 3;
|
|
8697
8890
|
const sessionDesc = maxTickets > 0 ? `Work continuously until all tickets are done or you reach ${maxTickets} tickets.` : "Work continuously until all tickets are done.";
|
|
8698
8891
|
const checkpointDesc = interval > 0 ? ` A checkpoint handover will be saved every ${interval} tickets.` : "";
|
|
8892
|
+
const hasHighIssues = highIssues.length > 0;
|
|
8699
8893
|
const instruction = [
|
|
8700
8894
|
"# Autonomous Session Started",
|
|
8701
8895
|
"",
|
|
8702
8896
|
`You are now in autonomous mode. ${sessionDesc}${checkpointDesc}`,
|
|
8703
|
-
"Do NOT stop to summarize. Do NOT ask the user. Pick a ticket and start working immediately.",
|
|
8897
|
+
"Do NOT stop to summarize. Do NOT ask the user. Pick a ticket or issue and start working immediately.",
|
|
8704
8898
|
"",
|
|
8705
8899
|
"## Ticket Candidates",
|
|
8706
8900
|
"",
|
|
8707
8901
|
candidatesText,
|
|
8902
|
+
issuesText,
|
|
8708
8903
|
recsText,
|
|
8709
8904
|
"",
|
|
8710
|
-
topCandidate ? `Pick **${topCandidate.ticket.id}** (highest priority) by calling \`claudestory_autonomous_guide\` now:` : "Pick a ticket by calling `claudestory_autonomous_guide` now:",
|
|
8905
|
+
topCandidate ? `Pick **${topCandidate.ticket.id}** (highest priority) or an open issue by calling \`claudestory_autonomous_guide\` now:` : hasHighIssues ? "Pick an issue to fix by calling `claudestory_autonomous_guide` now:" : "Pick a ticket by calling `claudestory_autonomous_guide` now:",
|
|
8711
8906
|
"```json",
|
|
8712
8907
|
topCandidate ? `{ "sessionId": "${updated.sessionId}", "action": "report", "report": { "completedAction": "ticket_picked", "ticketId": "${topCandidate.ticket.id}" } }` : `{ "sessionId": "${updated.sessionId}", "action": "report", "report": { "completedAction": "ticket_picked", "ticketId": "T-XXX" } }`,
|
|
8713
|
-
"```"
|
|
8908
|
+
"```",
|
|
8909
|
+
...hasHighIssues ? [
|
|
8910
|
+
"",
|
|
8911
|
+
"Or to fix an issue:",
|
|
8912
|
+
"```json",
|
|
8913
|
+
`{ "sessionId": "${updated.sessionId}", "action": "report", "report": { "completedAction": "issue_picked", "issueId": "${highIssues[0].id}" } }`,
|
|
8914
|
+
"```"
|
|
8915
|
+
] : []
|
|
8714
8916
|
].join("\n");
|
|
8715
8917
|
return guideResult(updated, "PICK_TICKET", {
|
|
8716
8918
|
instruction,
|
|
@@ -9285,6 +9487,7 @@ var init_guide = __esm({
|
|
|
9285
9487
|
CODE_REVIEW: { state: "PLAN", resetPlan: true, resetCode: true },
|
|
9286
9488
|
FINALIZE: { state: "IMPLEMENT", resetPlan: false, resetCode: true },
|
|
9287
9489
|
LESSON_CAPTURE: { state: "PICK_TICKET", resetPlan: false, resetCode: false },
|
|
9490
|
+
ISSUE_FIX: { state: "PICK_TICKET", resetPlan: false, resetCode: false },
|
|
9288
9491
|
ISSUE_SWEEP: { state: "PICK_TICKET", resetPlan: false, resetCode: false }
|
|
9289
9492
|
};
|
|
9290
9493
|
SEVERITY_MAP = {
|
|
@@ -10646,7 +10849,7 @@ var init_mcp = __esm({
|
|
|
10646
10849
|
init_init();
|
|
10647
10850
|
ENV_VAR2 = "CLAUDESTORY_PROJECT_ROOT";
|
|
10648
10851
|
CONFIG_PATH2 = ".story/config.json";
|
|
10649
|
-
version = "0.1.
|
|
10852
|
+
version = "0.1.37";
|
|
10650
10853
|
main().catch((err) => {
|
|
10651
10854
|
process.stderr.write(`Fatal: ${err instanceof Error ? err.message : String(err)}
|
|
10652
10855
|
`);
|
|
@@ -14070,7 +14273,7 @@ async function runCli() {
|
|
|
14070
14273
|
registerSessionCommand: registerSessionCommand2,
|
|
14071
14274
|
registerRepairCommand: registerRepairCommand2
|
|
14072
14275
|
} = await Promise.resolve().then(() => (init_register(), register_exports));
|
|
14073
|
-
const version2 = "0.1.
|
|
14276
|
+
const version2 = "0.1.37";
|
|
14074
14277
|
class HandledError extends Error {
|
|
14075
14278
|
constructor() {
|
|
14076
14279
|
super("HANDLED_ERROR");
|