@anthropologies/claudestory 0.1.25 → 0.1.27
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.js +47 -9
- package/dist/mcp.js +44 -6
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -7200,6 +7200,16 @@ var init_finalize = __esm({
|
|
|
7200
7200
|
}
|
|
7201
7201
|
}
|
|
7202
7202
|
}
|
|
7203
|
+
const ticketId = ctx.state.ticket?.id;
|
|
7204
|
+
if (ticketId) {
|
|
7205
|
+
const ticketPath = `.story/tickets/${ticketId}.json`;
|
|
7206
|
+
if (!stagedResult.data.includes(ticketPath)) {
|
|
7207
|
+
return {
|
|
7208
|
+
action: "retry",
|
|
7209
|
+
instruction: `Pre-commit hooks may have modified the staged set. Ticket file ${ticketPath} is no longer staged. Run \`git add ${ticketPath}\` and call me again with completedAction: "files_staged".`
|
|
7210
|
+
};
|
|
7211
|
+
}
|
|
7212
|
+
}
|
|
7203
7213
|
ctx.writeState({ finalizeCheckpoint: "precommit_passed" });
|
|
7204
7214
|
return {
|
|
7205
7215
|
action: "retry",
|
|
@@ -7769,7 +7779,7 @@ async function handleStart(root, args) {
|
|
|
7769
7779
|
return guideError(new Error(
|
|
7770
7780
|
`Stale compacted session ${existing.state.sessionId} found (prepared ${Math.round((Date.now() - preparedAt) / 6e4)} minutes ago, never resumed). SessionStart hook is no longer prompting for this session.
|
|
7771
7781
|
- To resume anyway: call action "resume" with sessionId "${existing.state.sessionId}"
|
|
7772
|
-
- To abandon and start fresh: run "claudestory session
|
|
7782
|
+
- To abandon and start fresh: run "claudestory session stop ${existing.state.sessionId}"`
|
|
7773
7783
|
));
|
|
7774
7784
|
}
|
|
7775
7785
|
return guideError(new Error(
|
|
@@ -7790,7 +7800,7 @@ async function handleStart(root, args) {
|
|
|
7790
7800
|
return guideError(new Error(
|
|
7791
7801
|
`${resumable.stale ? "Stale c" : "C"}ompacted session ${sid} found (prepared ${Math.round((Date.now() - preparedAt) / 6e4)} minutes ago, lease expired but not resumed).
|
|
7792
7802
|
- To resume: call action "resume" with sessionId "${sid}"
|
|
7793
|
-
- To abandon: run "claudestory session
|
|
7803
|
+
- To abandon: run "claudestory session stop ${sid}"`
|
|
7794
7804
|
));
|
|
7795
7805
|
}
|
|
7796
7806
|
}
|
|
@@ -8309,7 +8319,7 @@ async function handleReport(root, args) {
|
|
|
8309
8319
|
const report = args.report;
|
|
8310
8320
|
if (state.compactPending && currentState !== "COMPACT") {
|
|
8311
8321
|
return guideError(new Error(
|
|
8312
|
-
`Session has pending compaction in inconsistent state (${currentState}). Call action: "resume" or run "claudestory session
|
|
8322
|
+
`Session has pending compaction in inconsistent state (${currentState}). Call action: "resume" or run "claudestory session stop ${args.sessionId}".`
|
|
8313
8323
|
));
|
|
8314
8324
|
}
|
|
8315
8325
|
const recipe = resolveRecipeFromState(state);
|
|
@@ -8338,7 +8348,7 @@ async function handleResume(root, args) {
|
|
|
8338
8348
|
const resumeState = info.state.preCompactState;
|
|
8339
8349
|
if (!resumeState || !WORKFLOW_STATES.includes(resumeState)) {
|
|
8340
8350
|
return guideError(new Error(
|
|
8341
|
-
`Session ${args.sessionId} has invalid preCompactState: ${resumeState}. Run "claudestory session
|
|
8351
|
+
`Session ${args.sessionId} has invalid preCompactState: ${resumeState}. Run "claudestory session stop ${args.sessionId}" to terminate.`
|
|
8342
8352
|
));
|
|
8343
8353
|
}
|
|
8344
8354
|
const headResult = await gitHead(root);
|
|
@@ -8355,7 +8365,7 @@ async function handleResume(root, args) {
|
|
|
8355
8365
|
data: { reason: "cannot_validate_head", expectedHead: expectedHead ?? null, gitAvailable: headResult.ok }
|
|
8356
8366
|
});
|
|
8357
8367
|
return guideError(new Error(
|
|
8358
|
-
`Cannot validate git state for session ${args.sessionId}. Check git status and try "resume" again, or run "claudestory session
|
|
8368
|
+
`Cannot validate git state for session ${args.sessionId}. Check git status and try "resume" again, or run "claudestory session stop ${args.sessionId}" to end the session.`
|
|
8359
8369
|
));
|
|
8360
8370
|
}
|
|
8361
8371
|
if (expectedHead && headResult.data.hash !== expectedHead) {
|
|
@@ -8528,6 +8538,34 @@ ${driftPreamble}Recovered to state: **${mapping.state}**. Continue from here.`,
|
|
|
8528
8538
|
}
|
|
8529
8539
|
const resumeMode = written.mode ?? "auto";
|
|
8530
8540
|
const modeContext = resumeMode === "auto" ? "You are in autonomous mode \u2014 continue working." : resumeMode === "review" ? "You are in review mode \u2014 session ends after code review approval." : resumeMode === "plan" ? "You are in plan mode \u2014 session ends after plan review approval." : "You are in guided mode \u2014 single ticket, full pipeline.";
|
|
8541
|
+
const resumeStage = getStage(resumeState);
|
|
8542
|
+
if (resumeStage) {
|
|
8543
|
+
const recipe = resolveRecipeFromState(written);
|
|
8544
|
+
const ctx = new StageContext(root, info.dir, written, recipe);
|
|
8545
|
+
const enterResult = await resumeStage.enter(ctx);
|
|
8546
|
+
if (isStageAdvance(enterResult)) {
|
|
8547
|
+
return processAdvance(ctx, resumeStage, enterResult);
|
|
8548
|
+
}
|
|
8549
|
+
return guideResult(ctx.state, resumeState, {
|
|
8550
|
+
instruction: [
|
|
8551
|
+
"# Resumed After Compact",
|
|
8552
|
+
"",
|
|
8553
|
+
`Session restored at state: **${resumeState}**.`,
|
|
8554
|
+
written.ticket ? `Working on: **${written.ticket.id}: ${written.ticket.title}**` : "",
|
|
8555
|
+
"",
|
|
8556
|
+
modeContext,
|
|
8557
|
+
"",
|
|
8558
|
+
"---",
|
|
8559
|
+
"",
|
|
8560
|
+
enterResult.instruction
|
|
8561
|
+
].filter(Boolean).join("\n"),
|
|
8562
|
+
reminders: [
|
|
8563
|
+
...enterResult.reminders ?? [],
|
|
8564
|
+
...resumeMode === "auto" ? ["Do NOT use plan mode.", "Do NOT stop or summarize."] : [`This is ${resumeMode} mode.`],
|
|
8565
|
+
"Call autonomous_guide after completing each step."
|
|
8566
|
+
]
|
|
8567
|
+
});
|
|
8568
|
+
}
|
|
8531
8569
|
return guideResult(written, resumeState, {
|
|
8532
8570
|
instruction: [
|
|
8533
8571
|
"# Resumed After Compact",
|
|
@@ -10091,7 +10129,7 @@ var init_mcp = __esm({
|
|
|
10091
10129
|
init_init();
|
|
10092
10130
|
ENV_VAR2 = "CLAUDESTORY_PROJECT_ROOT";
|
|
10093
10131
|
CONFIG_PATH2 = ".story/config.json";
|
|
10094
|
-
version = "0.1.
|
|
10132
|
+
version = "0.1.27";
|
|
10095
10133
|
main().catch((err) => {
|
|
10096
10134
|
process.stderr.write(`Fatal: ${err instanceof Error ? err.message : String(err)}
|
|
10097
10135
|
`);
|
|
@@ -13255,7 +13293,7 @@ function registerSessionCommand(yargs) {
|
|
|
13255
13293
|
await handleSessionResumePrompt2();
|
|
13256
13294
|
}
|
|
13257
13295
|
).command(
|
|
13258
|
-
"clear-compact",
|
|
13296
|
+
"clear-compact [sessionId]",
|
|
13259
13297
|
"Clear stale compact marker (admin)",
|
|
13260
13298
|
(y2) => y2.positional("sessionId", {
|
|
13261
13299
|
type: "string",
|
|
@@ -13280,7 +13318,7 @@ function registerSessionCommand(yargs) {
|
|
|
13280
13318
|
}
|
|
13281
13319
|
}
|
|
13282
13320
|
).command(
|
|
13283
|
-
"stop",
|
|
13321
|
+
"stop [sessionId]",
|
|
13284
13322
|
"Stop an active session (admin)",
|
|
13285
13323
|
(y2) => y2.positional("sessionId", {
|
|
13286
13324
|
type: "string",
|
|
@@ -13369,7 +13407,7 @@ async function runCli() {
|
|
|
13369
13407
|
registerConfigCommand: registerConfigCommand2,
|
|
13370
13408
|
registerSessionCommand: registerSessionCommand2
|
|
13371
13409
|
} = await Promise.resolve().then(() => (init_register(), register_exports));
|
|
13372
|
-
const version2 = "0.1.
|
|
13410
|
+
const version2 = "0.1.27";
|
|
13373
13411
|
class HandledError extends Error {
|
|
13374
13412
|
constructor() {
|
|
13375
13413
|
super("HANDLED_ERROR");
|
package/dist/mcp.js
CHANGED
|
@@ -6722,6 +6722,16 @@ var FinalizeStage = class {
|
|
|
6722
6722
|
}
|
|
6723
6723
|
}
|
|
6724
6724
|
}
|
|
6725
|
+
const ticketId = ctx.state.ticket?.id;
|
|
6726
|
+
if (ticketId) {
|
|
6727
|
+
const ticketPath = `.story/tickets/${ticketId}.json`;
|
|
6728
|
+
if (!stagedResult.data.includes(ticketPath)) {
|
|
6729
|
+
return {
|
|
6730
|
+
action: "retry",
|
|
6731
|
+
instruction: `Pre-commit hooks may have modified the staged set. Ticket file ${ticketPath} is no longer staged. Run \`git add ${ticketPath}\` and call me again with completedAction: "files_staged".`
|
|
6732
|
+
};
|
|
6733
|
+
}
|
|
6734
|
+
}
|
|
6725
6735
|
ctx.writeState({ finalizeCheckpoint: "precommit_passed" });
|
|
6726
6736
|
return {
|
|
6727
6737
|
action: "retry",
|
|
@@ -7258,7 +7268,7 @@ async function handleStart(root, args) {
|
|
|
7258
7268
|
return guideError(new Error(
|
|
7259
7269
|
`Stale compacted session ${existing.state.sessionId} found (prepared ${Math.round((Date.now() - preparedAt) / 6e4)} minutes ago, never resumed). SessionStart hook is no longer prompting for this session.
|
|
7260
7270
|
- To resume anyway: call action "resume" with sessionId "${existing.state.sessionId}"
|
|
7261
|
-
- To abandon and start fresh: run "claudestory session
|
|
7271
|
+
- To abandon and start fresh: run "claudestory session stop ${existing.state.sessionId}"`
|
|
7262
7272
|
));
|
|
7263
7273
|
}
|
|
7264
7274
|
return guideError(new Error(
|
|
@@ -7279,7 +7289,7 @@ async function handleStart(root, args) {
|
|
|
7279
7289
|
return guideError(new Error(
|
|
7280
7290
|
`${resumable.stale ? "Stale c" : "C"}ompacted session ${sid} found (prepared ${Math.round((Date.now() - preparedAt) / 6e4)} minutes ago, lease expired but not resumed).
|
|
7281
7291
|
- To resume: call action "resume" with sessionId "${sid}"
|
|
7282
|
-
- To abandon: run "claudestory session
|
|
7292
|
+
- To abandon: run "claudestory session stop ${sid}"`
|
|
7283
7293
|
));
|
|
7284
7294
|
}
|
|
7285
7295
|
}
|
|
@@ -7799,7 +7809,7 @@ async function handleReport(root, args) {
|
|
|
7799
7809
|
const report = args.report;
|
|
7800
7810
|
if (state.compactPending && currentState !== "COMPACT") {
|
|
7801
7811
|
return guideError(new Error(
|
|
7802
|
-
`Session has pending compaction in inconsistent state (${currentState}). Call action: "resume" or run "claudestory session
|
|
7812
|
+
`Session has pending compaction in inconsistent state (${currentState}). Call action: "resume" or run "claudestory session stop ${args.sessionId}".`
|
|
7803
7813
|
));
|
|
7804
7814
|
}
|
|
7805
7815
|
const recipe = resolveRecipeFromState(state);
|
|
@@ -7828,7 +7838,7 @@ async function handleResume(root, args) {
|
|
|
7828
7838
|
const resumeState = info.state.preCompactState;
|
|
7829
7839
|
if (!resumeState || !WORKFLOW_STATES.includes(resumeState)) {
|
|
7830
7840
|
return guideError(new Error(
|
|
7831
|
-
`Session ${args.sessionId} has invalid preCompactState: ${resumeState}. Run "claudestory session
|
|
7841
|
+
`Session ${args.sessionId} has invalid preCompactState: ${resumeState}. Run "claudestory session stop ${args.sessionId}" to terminate.`
|
|
7832
7842
|
));
|
|
7833
7843
|
}
|
|
7834
7844
|
const headResult = await gitHead(root);
|
|
@@ -7845,7 +7855,7 @@ async function handleResume(root, args) {
|
|
|
7845
7855
|
data: { reason: "cannot_validate_head", expectedHead: expectedHead ?? null, gitAvailable: headResult.ok }
|
|
7846
7856
|
});
|
|
7847
7857
|
return guideError(new Error(
|
|
7848
|
-
`Cannot validate git state for session ${args.sessionId}. Check git status and try "resume" again, or run "claudestory session
|
|
7858
|
+
`Cannot validate git state for session ${args.sessionId}. Check git status and try "resume" again, or run "claudestory session stop ${args.sessionId}" to end the session.`
|
|
7849
7859
|
));
|
|
7850
7860
|
}
|
|
7851
7861
|
if (expectedHead && headResult.data.hash !== expectedHead) {
|
|
@@ -8018,6 +8028,34 @@ ${driftPreamble}Recovered to state: **${mapping.state}**. Continue from here.`,
|
|
|
8018
8028
|
}
|
|
8019
8029
|
const resumeMode = written.mode ?? "auto";
|
|
8020
8030
|
const modeContext = resumeMode === "auto" ? "You are in autonomous mode \u2014 continue working." : resumeMode === "review" ? "You are in review mode \u2014 session ends after code review approval." : resumeMode === "plan" ? "You are in plan mode \u2014 session ends after plan review approval." : "You are in guided mode \u2014 single ticket, full pipeline.";
|
|
8031
|
+
const resumeStage = getStage(resumeState);
|
|
8032
|
+
if (resumeStage) {
|
|
8033
|
+
const recipe = resolveRecipeFromState(written);
|
|
8034
|
+
const ctx = new StageContext(root, info.dir, written, recipe);
|
|
8035
|
+
const enterResult = await resumeStage.enter(ctx);
|
|
8036
|
+
if (isStageAdvance(enterResult)) {
|
|
8037
|
+
return processAdvance(ctx, resumeStage, enterResult);
|
|
8038
|
+
}
|
|
8039
|
+
return guideResult(ctx.state, resumeState, {
|
|
8040
|
+
instruction: [
|
|
8041
|
+
"# Resumed After Compact",
|
|
8042
|
+
"",
|
|
8043
|
+
`Session restored at state: **${resumeState}**.`,
|
|
8044
|
+
written.ticket ? `Working on: **${written.ticket.id}: ${written.ticket.title}**` : "",
|
|
8045
|
+
"",
|
|
8046
|
+
modeContext,
|
|
8047
|
+
"",
|
|
8048
|
+
"---",
|
|
8049
|
+
"",
|
|
8050
|
+
enterResult.instruction
|
|
8051
|
+
].filter(Boolean).join("\n"),
|
|
8052
|
+
reminders: [
|
|
8053
|
+
...enterResult.reminders ?? [],
|
|
8054
|
+
...resumeMode === "auto" ? ["Do NOT use plan mode.", "Do NOT stop or summarize."] : [`This is ${resumeMode} mode.`],
|
|
8055
|
+
"Call autonomous_guide after completing each step."
|
|
8056
|
+
]
|
|
8057
|
+
});
|
|
8058
|
+
}
|
|
8021
8059
|
return guideResult(written, resumeState, {
|
|
8022
8060
|
instruction: [
|
|
8023
8061
|
"# Resumed After Compact",
|
|
@@ -9256,7 +9294,7 @@ async function ensureGitignoreEntries(gitignorePath, entries) {
|
|
|
9256
9294
|
// src/mcp/index.ts
|
|
9257
9295
|
var ENV_VAR2 = "CLAUDESTORY_PROJECT_ROOT";
|
|
9258
9296
|
var CONFIG_PATH2 = ".story/config.json";
|
|
9259
|
-
var version = "0.1.
|
|
9297
|
+
var version = "0.1.27";
|
|
9260
9298
|
function tryDiscoverRoot() {
|
|
9261
9299
|
const envRoot = process.env[ENV_VAR2];
|
|
9262
9300
|
if (envRoot) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anthropologies/claudestory",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.27",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"description": "Cross-session context persistence for AI coding projects. Tracks tickets, issues, roadmap, and handovers so every session builds on the last.",
|
|
6
6
|
"keywords": [
|