@meshpoint/cli 1.4.0 → 1.4.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/dist/import/distill.js +7 -4
- package/dist/import/run.js +4 -0
- package/package.json +1 -1
package/dist/import/distill.js
CHANGED
|
@@ -71,7 +71,7 @@ export function consolidatePrompt(items, live) {
|
|
|
71
71
|
"- When a fact or decision changed across sessions, keep only the newest statement (later session ids are newer in the list).",
|
|
72
72
|
"- Give conventions a short stable \"key\" (letters, digits, . _ : / -) such as test-runner or deploy-target.",
|
|
73
73
|
"- Mark a gotcha \"recurring\": true when the same problem appears in two or more sessions.",
|
|
74
|
-
"- Drop status
|
|
74
|
+
"- Drop every status item (they describe a past moment) and todos that read as finished.",
|
|
75
75
|
"- Items already live on the branch are listed; do not repeat them, and when a proposed item supersedes a live one, add \"supersedes\": [\"<live id>\"].",
|
|
76
76
|
`- Output only a JSON array of at most ${BRANCH_ITEMS_MAX} items: {"kind","title","body","key"?,"recurring"?,"supersedes"?,"sessions"}.`,
|
|
77
77
|
"",
|
|
@@ -80,19 +80,22 @@ export function consolidatePrompt(items, live) {
|
|
|
80
80
|
`Proposed items:\n${JSON.stringify(items)}`,
|
|
81
81
|
].join("\n");
|
|
82
82
|
}
|
|
83
|
+
// A status describes a past moment; an import never writes one, since a new status supersedes the
|
|
84
|
+
// branch's current one on write.
|
|
85
|
+
const IMPORT_KINDS = KINDS.filter((k) => k !== "status");
|
|
83
86
|
export function parseMerged(raw, fallback) {
|
|
84
87
|
let parsed;
|
|
85
88
|
try {
|
|
86
89
|
parsed = jsonBlock(raw);
|
|
87
90
|
}
|
|
88
91
|
catch {
|
|
89
|
-
return
|
|
92
|
+
return fallback.filter((i) => i.kind !== "status");
|
|
90
93
|
}
|
|
91
94
|
if (!Array.isArray(parsed))
|
|
92
|
-
return
|
|
95
|
+
return fallback.filter((i) => i.kind !== "status");
|
|
93
96
|
const out = [];
|
|
94
97
|
for (const v of parsed) {
|
|
95
|
-
if (!isRecord(v) || typeof v.kind !== "string" || !
|
|
98
|
+
if (!isRecord(v) || typeof v.kind !== "string" || !IMPORT_KINDS.includes(v.kind))
|
|
96
99
|
continue;
|
|
97
100
|
if (typeof v.title !== "string" || !v.title.trim() || typeof v.body !== "string" || !v.body.trim())
|
|
98
101
|
continue;
|
package/dist/import/run.js
CHANGED
|
@@ -137,11 +137,15 @@ export async function importSessions(opts) {
|
|
|
137
137
|
for (const b of result.branches) {
|
|
138
138
|
if (b.items.length === 0)
|
|
139
139
|
continue;
|
|
140
|
+
// Items are dated by the newest session that produced them, so ranking and decay see the
|
|
141
|
+
// real age rather than the import time.
|
|
142
|
+
const endedAt = (ids) => Math.max(0, ...sessions.filter((s) => ids.includes(s.id)).map((s) => s.endedAt));
|
|
140
143
|
const inputs = b.items.map((i) => ({
|
|
141
144
|
id: randomUUID(),
|
|
142
145
|
kind: i.kind,
|
|
143
146
|
title: i.title,
|
|
144
147
|
body: i.body,
|
|
148
|
+
...(endedAt(i.sessions) > 0 ? { created_at: endedAt(i.sessions) } : {}),
|
|
145
149
|
refs: i.refs,
|
|
146
150
|
paths: [],
|
|
147
151
|
...(sha ? { commit_sha: sha } : {}),
|