sphica 0.6.13 → 0.6.14
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/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/dist/cli.js +25 -2
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://anthropic.com/claude-code/plugin.schema.json",
|
|
3
3
|
"name": "sphica",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.14",
|
|
5
5
|
"description": "Records Claude Code and Codex sessions on your machine and keeps past implementation and decisions, with their sources, for your agent to find.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "iroha924",
|
package/dist/cli.js
CHANGED
|
@@ -14880,6 +14880,16 @@ function prune(file, kept) {
|
|
|
14880
14880
|
} catch {}
|
|
14881
14881
|
}
|
|
14882
14882
|
var versionOf = (raw) => raw.prepare("pragma user_version").get().user_version;
|
|
14883
|
+
var SQLITE_BUSY = 5;
|
|
14884
|
+
function committed(raw) {
|
|
14885
|
+
if (raw.isTransaction)
|
|
14886
|
+
return null;
|
|
14887
|
+
try {
|
|
14888
|
+
return versionOf(raw);
|
|
14889
|
+
} catch {
|
|
14890
|
+
return null;
|
|
14891
|
+
}
|
|
14892
|
+
}
|
|
14883
14893
|
function immediate(raw, fn) {
|
|
14884
14894
|
raw.exec("begin immediate");
|
|
14885
14895
|
try {
|
|
@@ -14910,7 +14920,7 @@ function migrate(file = dbFile(), dir = MIGRATIONS()) {
|
|
|
14910
14920
|
for (let r2 = from + 1;r2 <= SCHEMA_REVISION; r2++) {
|
|
14911
14921
|
const script = MIGRATION(dir, r2);
|
|
14912
14922
|
if (!fs5.existsSync(script))
|
|
14913
|
-
throw new Error(`
|
|
14923
|
+
throw new Error(`This Sphica has no migration script for revision ${r2} (${script} is missing). Reinstall sphica (\`npm i -g sphica@${packageVersionAt(ROOT) ?? "latest"}\`), then run \`sphica init\` again.`);
|
|
14914
14924
|
raw.exec("pragma foreign_keys = off");
|
|
14915
14925
|
try {
|
|
14916
14926
|
immediate(raw, () => {
|
|
@@ -14928,8 +14938,21 @@ function migrate(file = dbFile(), dir = MIGRATIONS()) {
|
|
|
14928
14938
|
}
|
|
14929
14939
|
}
|
|
14930
14940
|
} catch (e) {
|
|
14941
|
+
const said = e.message.replace(/\.$/, "");
|
|
14942
|
+
const now = committed(raw);
|
|
14943
|
+
if (now === from) {
|
|
14944
|
+
let left = "the backup made for this run was removed";
|
|
14945
|
+
try {
|
|
14946
|
+
fs5.rmSync(backup, { force: true });
|
|
14947
|
+
} catch {
|
|
14948
|
+
left = `the backup made for this run is still at ${backup}; delete it yourself`;
|
|
14949
|
+
}
|
|
14950
|
+
const retry = sqliteCode(e) === SQLITE_BUSY ? " Another process is writing to the database. Run `sphica init` again when it has finished." : "";
|
|
14951
|
+
throw new Error(`${said}. No migration step was committed: the database is still at revision ${from}, and there is no need to replace it with a backup (${left}).${retry}`);
|
|
14952
|
+
}
|
|
14931
14953
|
const base = path5.basename(file);
|
|
14932
|
-
|
|
14954
|
+
const state = now === null ? "The committed revision could not be confirmed after the failure" : `The database is now at revision ${now} (this run, or another \`sphica init\` running at the same time, migrated it that far)`;
|
|
14955
|
+
throw new Error(`${said}. ${state}. The database before migrating is at ${backup} (anything recorded after it was made is not in it). To go back to it, close every session using Sphica, move ${base}, ${base}-wal, and ${base}-shm in ${path5.dirname(file)} aside, then copy the backup to ${file}.`);
|
|
14933
14956
|
}
|
|
14934
14957
|
prune(file, backup);
|
|
14935
14958
|
return from;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sphica",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.14",
|
|
4
4
|
"description": "Records Claude Code and Codex sessions on your machine and keeps past implementation and decisions, with their sources, for your agent to find.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|