@cogit/cli 0.28.1 → 0.28.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.
|
@@ -21206,7 +21206,7 @@ async function migrateProject(root) {
|
|
|
21206
21206
|
const next = renameGitignoreLines(text);
|
|
21207
21207
|
if (next !== text) await atomicWrite(gitignore, next).catch(() => void 0);
|
|
21208
21208
|
}
|
|
21209
|
-
const { installGitHooks: installGitHooks2 } = await import("./git-hooks-
|
|
21209
|
+
const { installGitHooks: installGitHooks2 } = await import("./git-hooks-XKHTMQKI.js");
|
|
21210
21210
|
await installGitHooks2(dir).catch(() => void 0);
|
|
21211
21211
|
return true;
|
|
21212
21212
|
}
|
|
@@ -25559,7 +25559,7 @@ async function onSessionEnd(ctx) {
|
|
|
25559
25559
|
// package.json
|
|
25560
25560
|
var package_default = {
|
|
25561
25561
|
name: "@cogit/cli",
|
|
25562
|
-
version: "0.28.
|
|
25562
|
+
version: "0.28.2",
|
|
25563
25563
|
description: "Git remembers what changed. cogit remembers why.",
|
|
25564
25564
|
license: "MIT",
|
|
25565
25565
|
keywords: [
|
|
@@ -26152,6 +26152,15 @@ export {
|
|
|
26152
26152
|
labelsToHashes,
|
|
26153
26153
|
hashesToLabels,
|
|
26154
26154
|
upgradeSessionIds,
|
|
26155
|
+
Slug,
|
|
26156
|
+
IsoDate,
|
|
26157
|
+
parseMessageRef,
|
|
26158
|
+
SESSION_SCHEMA,
|
|
26159
|
+
MESSAGE_ID,
|
|
26160
|
+
BranchSummary,
|
|
26161
|
+
Status,
|
|
26162
|
+
LineageNodeInput,
|
|
26163
|
+
SessionInput,
|
|
26155
26164
|
findGitRoot,
|
|
26156
26165
|
resolveCommit,
|
|
26157
26166
|
ensureGitignore,
|
|
@@ -26167,15 +26176,7 @@ export {
|
|
|
26167
26176
|
gitUserEmail,
|
|
26168
26177
|
commitBetween,
|
|
26169
26178
|
gitHooksDir,
|
|
26170
|
-
Slug,
|
|
26171
|
-
IsoDate,
|
|
26172
|
-
parseMessageRef,
|
|
26173
26179
|
Config,
|
|
26174
|
-
SESSION_SCHEMA,
|
|
26175
|
-
MESSAGE_ID,
|
|
26176
|
-
BranchSummary,
|
|
26177
|
-
Status,
|
|
26178
|
-
SessionInput,
|
|
26179
26180
|
LockBusyError,
|
|
26180
26181
|
withLock,
|
|
26181
26182
|
loadProject,
|
package/dist/cli.js
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
Config,
|
|
9
9
|
IsoDate,
|
|
10
10
|
LIVE_META_NAME,
|
|
11
|
+
LineageNodeInput,
|
|
11
12
|
LockBusyError,
|
|
12
13
|
MESSAGE_HASH,
|
|
13
14
|
MESSAGE_ID,
|
|
@@ -120,7 +121,7 @@ import {
|
|
|
120
121
|
versionNotice,
|
|
121
122
|
why,
|
|
122
123
|
withLock
|
|
123
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-X36QZV7V.js";
|
|
124
125
|
|
|
125
126
|
// node_modules/commander/lib/error.js
|
|
126
127
|
var CommanderError = class extends Error {
|
|
@@ -5957,6 +5958,48 @@ async function missingTurns(root, sessionId, env) {
|
|
|
5957
5958
|
}
|
|
5958
5959
|
return turns.filter((turn) => !isRecorded(recorded, turn));
|
|
5959
5960
|
}
|
|
5961
|
+
function writableAnswer(answer, recorder) {
|
|
5962
|
+
const out = { ...answer };
|
|
5963
|
+
const soleOwner = recorder !== "mixed";
|
|
5964
|
+
if (!soleOwner) delete out.status;
|
|
5965
|
+
let dropped = 0;
|
|
5966
|
+
if (out.status !== void 0) out.status = stripNulls(out.status);
|
|
5967
|
+
if (out.status !== void 0 && !Status.safeParse(out.status).success) {
|
|
5968
|
+
delete out.status;
|
|
5969
|
+
dropped += 1;
|
|
5970
|
+
}
|
|
5971
|
+
if (Array.isArray(out.nodes)) {
|
|
5972
|
+
const kept = [];
|
|
5973
|
+
for (const node of out.nodes) {
|
|
5974
|
+
const fixed = summaryAsText(node);
|
|
5975
|
+
if (ownsNode(fixed, soleOwner) && LineageNodeInput.safeParse(fixed).success) kept.push(fixed);
|
|
5976
|
+
else dropped += 1;
|
|
5977
|
+
}
|
|
5978
|
+
out.nodes = kept;
|
|
5979
|
+
}
|
|
5980
|
+
return { payload: out, dropped };
|
|
5981
|
+
}
|
|
5982
|
+
function stripNulls(value) {
|
|
5983
|
+
if (Array.isArray(value)) return value.map(stripNulls);
|
|
5984
|
+
if (typeof value === "object" && value !== null) {
|
|
5985
|
+
return Object.fromEntries(
|
|
5986
|
+
Object.entries(value).filter(([, v]) => v !== null).map(([key, v]) => [key, stripNulls(v)])
|
|
5987
|
+
);
|
|
5988
|
+
}
|
|
5989
|
+
return value;
|
|
5990
|
+
}
|
|
5991
|
+
function summaryAsText(node) {
|
|
5992
|
+
if (typeof node !== "object" || node === null) return node;
|
|
5993
|
+
const { summary, ...rest } = node;
|
|
5994
|
+
if (summary === void 0 || typeof summary === "string") return node;
|
|
5995
|
+
const text = typeof summary === "object" && summary !== null ? summary.text : void 0;
|
|
5996
|
+
return typeof text === "string" ? { ...rest, summary: text } : rest;
|
|
5997
|
+
}
|
|
5998
|
+
function ownsNode(node, soleOwner) {
|
|
5999
|
+
if (soleOwner || typeof node !== "object" || node === null) return true;
|
|
6000
|
+
const n = node;
|
|
6001
|
+
return n.branch === void 0 && n.agentDecisions === void 0;
|
|
6002
|
+
}
|
|
5960
6003
|
async function backfillTail(dir, sessionId, io, opts = {}) {
|
|
5961
6004
|
const { root } = await resolveProjectRoot(dir);
|
|
5962
6005
|
const project = await loadProject(root);
|
|
@@ -5992,8 +6035,16 @@ async function backfillTail(dir, sessionId, io, opts = {}) {
|
|
|
5992
6035
|
config.recorder
|
|
5993
6036
|
);
|
|
5994
6037
|
const stdout = await runClaude(prompt, config.sideModel, io.env);
|
|
5995
|
-
const
|
|
5996
|
-
|
|
6038
|
+
const { payload, dropped } = writableAnswer(
|
|
6039
|
+
withoutNulls(agentRecord(resultText(stdout))),
|
|
6040
|
+
config.recorder
|
|
6041
|
+
);
|
|
6042
|
+
if (dropped > 0) io.warn(`dropped ${dropped} malformed field(s) from the catch-up answer`);
|
|
6043
|
+
await sessionWrite(
|
|
6044
|
+
{ dir: root, by: "side" },
|
|
6045
|
+
io,
|
|
6046
|
+
async () => JSON.stringify({ ...payload, sessionId })
|
|
6047
|
+
);
|
|
5997
6048
|
if (opts.close === true) await closeSession(root, sessionId, io);
|
|
5998
6049
|
await maybeAutoCommit(root, sessionId, io.env);
|
|
5999
6050
|
}
|