@pi-unipi/milestone 2.6.1 → 2.6.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/hooks.ts +1 -6
- package/milestone.ts +2 -41
- package/package.json +7 -3
package/hooks.ts
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
type ExtensionAPI,
|
|
13
13
|
type SessionEntry,
|
|
14
14
|
} from "@earendil-works/pi-coding-agent";
|
|
15
|
-
import { MILESTONE_DIRS, UNIPI_EVENTS, safeMtimeMs, tryRead } from "@pi-unipi/core";
|
|
15
|
+
import { MILESTONE_DIRS, UNIPI_EVENTS, safeMtimeMs, tryRead, isActiveSnapshot } from "@pi-unipi/core";
|
|
16
16
|
import { getProgressSummary, updateItemStatus } from "./milestone.js";
|
|
17
17
|
|
|
18
18
|
export const MILESTONE_SNAPSHOT_TYPE = "unipi-milestone-snapshot";
|
|
@@ -89,11 +89,6 @@ function latestHistoricalSnapshot(branch: SessionEntry[]): EffectiveSnapshot | u
|
|
|
89
89
|
return undefined;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
function isActiveSnapshot(snapshot: EffectiveSnapshot): boolean {
|
|
93
|
-
if (typeof snapshot.details?.active === "boolean") return snapshot.details.active;
|
|
94
|
-
return typeof snapshot.content === "string" && snapshot.content.includes("Status: active");
|
|
95
|
-
}
|
|
96
|
-
|
|
97
92
|
/**
|
|
98
93
|
* Register the agent-start hook. Snapshots are hidden from the transcript but
|
|
99
94
|
* persist in the append-only session and therefore keep the system prefix stable.
|
package/milestone.ts
CHANGED
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import * as fs from "node:fs";
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import type { MilestoneDoc, MilestonePhase, MilestoneItem, ProgressSummary } from "./types.js";
|
|
6
|
+
import { tryRead } from "@pi-unipi/core";
|
|
7
|
+
import type { MilestoneDoc, MilestonePhase, ProgressSummary } from "./types.js";
|
|
9
8
|
|
|
10
9
|
/** Default empty milestone doc */
|
|
11
10
|
function emptyDoc(filePath: string): MilestoneDoc {
|
|
@@ -96,44 +95,6 @@ export function parseMilestones(filePath: string): MilestoneDoc {
|
|
|
96
95
|
return doc;
|
|
97
96
|
}
|
|
98
97
|
|
|
99
|
-
/**
|
|
100
|
-
* Write a MilestoneDoc to a MILESTONES.md file.
|
|
101
|
-
* Generates frontmatter, phase headers, descriptions, and checkbox items.
|
|
102
|
-
*/
|
|
103
|
-
export function writeMilestones(filePath: string, doc: MilestoneDoc): void {
|
|
104
|
-
const lines: string[] = [];
|
|
105
|
-
|
|
106
|
-
// Frontmatter
|
|
107
|
-
lines.push("---");
|
|
108
|
-
lines.push(`title: "${doc.title}"`);
|
|
109
|
-
lines.push(`created: ${doc.created}`);
|
|
110
|
-
lines.push(`updated: ${doc.updated}`);
|
|
111
|
-
lines.push("---");
|
|
112
|
-
lines.push("");
|
|
113
|
-
lines.push(`# ${doc.title}`);
|
|
114
|
-
lines.push("");
|
|
115
|
-
|
|
116
|
-
// Phases
|
|
117
|
-
for (const phase of doc.phases) {
|
|
118
|
-
lines.push(`## ${phase.name}`);
|
|
119
|
-
if (phase.description) {
|
|
120
|
-
lines.push(`> ${phase.description}`);
|
|
121
|
-
}
|
|
122
|
-
lines.push("");
|
|
123
|
-
for (const item of phase.items) {
|
|
124
|
-
const check = item.checked ? "[x]" : "[ ]";
|
|
125
|
-
lines.push(`- ${check} ${item.text}`);
|
|
126
|
-
}
|
|
127
|
-
lines.push("");
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
ensureDir(filePath);
|
|
131
|
-
// Atomic write: write to temp, rename
|
|
132
|
-
const tmpPath = filePath + ".tmp";
|
|
133
|
-
fs.writeFileSync(tmpPath, lines.join("\n"), "utf-8");
|
|
134
|
-
fs.renameSync(tmpPath, filePath);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
98
|
/**
|
|
138
99
|
* Toggle a checkbox item's status in a MILESTONES.md file.
|
|
139
100
|
* Matches by normalized (lowercase, trimmed) phase name and item text.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-unipi/milestone",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.2",
|
|
4
4
|
"description": "Lifecycle layer for project-level goals — MILESTONES.md tracking, session hooks, auto-sync",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.ts",
|
|
@@ -44,8 +44,12 @@
|
|
|
44
44
|
"typescript": "^6.0.0"
|
|
45
45
|
},
|
|
46
46
|
"pi": {
|
|
47
|
-
"extensions": [
|
|
48
|
-
|
|
47
|
+
"extensions": [
|
|
48
|
+
"./index.ts"
|
|
49
|
+
],
|
|
50
|
+
"skills": [
|
|
51
|
+
"./skills"
|
|
52
|
+
],
|
|
49
53
|
"prompts": [],
|
|
50
54
|
"themes": []
|
|
51
55
|
}
|