@codelia/cli 0.1.86 → 0.1.89
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/auth-VNP4GLGX.js +66 -0
- package/dist/chunk-3YQPBHM7.js +45 -0
- package/dist/chunk-QYWLK4HY.js +156 -0
- package/dist/chunk-S7OVJIGV.js +1052 -0
- package/dist/chunk-YULPYRW7.js +202 -0
- package/dist/index.cjs +3243 -1564
- package/dist/index.js +48 -1575
- package/dist/launch-OTCP4VZR.js +9 -0
- package/dist/launcher-2HVS2HZE.js +19 -0
- package/dist/mcp-GB4CGP6K.js +699 -0
- package/dist/prompt-mode-CNJKMBMF.js +705 -0
- package/dist/session-2EB4JKFW.js +52 -0
- package/dist/update-IM6H3PZR.js +124 -0
- package/package.json +10 -10
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// src/commands/session.ts
|
|
2
|
+
import {
|
|
3
|
+
cleanupRunLogs,
|
|
4
|
+
resolveStoragePaths,
|
|
5
|
+
SessionStateStoreImpl
|
|
6
|
+
} from "@codelia/storage";
|
|
7
|
+
var HELP = "usage: codelia session list | pin|unpin|archive|unarchive <session_id> | cleanup\nArchive removes diagnostics and compresses unpinned run events, including legacy gzip. Original messages, active context and reference data remain; diagnostic dumps may expire.";
|
|
8
|
+
async function runSessionCommand(args) {
|
|
9
|
+
const [action, sessionId, extra] = args;
|
|
10
|
+
if (!action || action === "--help" || action === "help") {
|
|
11
|
+
console.log(HELP);
|
|
12
|
+
return 0;
|
|
13
|
+
}
|
|
14
|
+
if (action === "list" || action === "cleanup" ? sessionId !== void 0 : !["pin", "unpin", "archive", "unarchive"].includes(action) || !sessionId || extra !== void 0 || !/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/.test(sessionId)) {
|
|
15
|
+
console.error(HELP);
|
|
16
|
+
return 1;
|
|
17
|
+
}
|
|
18
|
+
const paths = resolveStoragePaths();
|
|
19
|
+
const sessions = new SessionStateStoreImpl({ paths });
|
|
20
|
+
try {
|
|
21
|
+
if (action === "list") {
|
|
22
|
+
for (const session2 of (await sessions.list()).sort(
|
|
23
|
+
(a, b) => b.updated_at.localeCompare(a.updated_at)
|
|
24
|
+
))
|
|
25
|
+
console.log(
|
|
26
|
+
`${session2.session_id} ${session2.updated_at} ${session2.pinned ? "pinned" : "unpinned"} ${session2.archived_at ? "archived" : "active"}`
|
|
27
|
+
);
|
|
28
|
+
return 0;
|
|
29
|
+
}
|
|
30
|
+
if (action === "cleanup") {
|
|
31
|
+
console.log(JSON.stringify(await cleanupRunLogs({ paths, sessions })));
|
|
32
|
+
return 0;
|
|
33
|
+
}
|
|
34
|
+
if (!sessionId) return 1;
|
|
35
|
+
const patch = action === "pin" || action === "unpin" ? { pinned: action === "pin" } : { archived: action === "archive" };
|
|
36
|
+
const session = await sessions.updateMetadata(sessionId, patch);
|
|
37
|
+
console.log(JSON.stringify(session));
|
|
38
|
+
if (!session.pinned && action !== "unarchive")
|
|
39
|
+
console.log(
|
|
40
|
+
JSON.stringify(await cleanupRunLogs({ paths, sessions, sessionId }))
|
|
41
|
+
);
|
|
42
|
+
return 0;
|
|
43
|
+
} catch (error) {
|
|
44
|
+
console.error(
|
|
45
|
+
`Session command failed: ${error instanceof Error ? error.message : String(error)}`
|
|
46
|
+
);
|
|
47
|
+
return 1;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
runSessionCommand
|
|
52
|
+
};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CLI_VERSION,
|
|
3
|
+
resolveLoadedCliPackageRoot
|
|
4
|
+
} from "./chunk-3YQPBHM7.js";
|
|
5
|
+
import {
|
|
6
|
+
applyUpdate,
|
|
7
|
+
buildUpdateCommand,
|
|
8
|
+
commandHint,
|
|
9
|
+
compareVersions,
|
|
10
|
+
detectInstallMethod,
|
|
11
|
+
resolveUpdatePaths,
|
|
12
|
+
resolveUpdateSettings,
|
|
13
|
+
runRegistryCheck
|
|
14
|
+
} from "./chunk-S7OVJIGV.js";
|
|
15
|
+
|
|
16
|
+
// src/commands/update.ts
|
|
17
|
+
import { promises as fs } from "fs";
|
|
18
|
+
import { resolveStoragePaths } from "@codelia/storage";
|
|
19
|
+
var USAGE = "usage: codelia update [--check]";
|
|
20
|
+
var runUpdateCommand = async (args, deps = {}) => {
|
|
21
|
+
const out = deps.out ?? ((line) => console.log(line));
|
|
22
|
+
const err = deps.err ?? ((line) => console.error(line));
|
|
23
|
+
if (args.length === 1 && ["-h", "--help", "help"].includes(args[0])) {
|
|
24
|
+
out(USAGE);
|
|
25
|
+
return 0;
|
|
26
|
+
}
|
|
27
|
+
if (args.length > 1 || args.length === 1 && args[0] !== "--check") {
|
|
28
|
+
err(USAGE);
|
|
29
|
+
return 1;
|
|
30
|
+
}
|
|
31
|
+
const checkOnly = args[0] === "--check";
|
|
32
|
+
const env = deps.env ?? process.env;
|
|
33
|
+
const currentVersion = deps.currentVersion ?? CLI_VERSION;
|
|
34
|
+
const packageRoot = deps.packageRoot === void 0 ? resolveLoadedCliPackageRoot() : deps.packageRoot;
|
|
35
|
+
const method = packageRoot ? detectInstallMethod({ packageRoot, env, resolveNpm: deps.resolveNpm }) : null;
|
|
36
|
+
const storagePaths = resolveStoragePaths();
|
|
37
|
+
const paths = resolveUpdatePaths(deps.cacheDir ?? storagePaths.cacheDir);
|
|
38
|
+
await fs.mkdir(paths.dir, { recursive: true });
|
|
39
|
+
const settings = await resolveUpdateSettings({
|
|
40
|
+
env,
|
|
41
|
+
interactive: true,
|
|
42
|
+
configFile: deps.configFile ?? storagePaths.configFile
|
|
43
|
+
});
|
|
44
|
+
for (const warning of settings.warnings) err(warning);
|
|
45
|
+
const outcome = await runRegistryCheck({
|
|
46
|
+
paths,
|
|
47
|
+
currentVersion,
|
|
48
|
+
configuredChannel: settings.channel,
|
|
49
|
+
env,
|
|
50
|
+
fetchImpl: deps.fetchImpl
|
|
51
|
+
});
|
|
52
|
+
if (outcome.status === "failed" || outcome.status === "aborted") {
|
|
53
|
+
err(
|
|
54
|
+
`Could not check for updates: ${outcome.status === "failed" ? outcome.message : "aborted"}.`
|
|
55
|
+
);
|
|
56
|
+
return 1;
|
|
57
|
+
}
|
|
58
|
+
out(
|
|
59
|
+
`Current: ${currentVersion}. Latest (${outcome.channel}): ${outcome.latest}.`
|
|
60
|
+
);
|
|
61
|
+
if (outcome.status === "up_to_date") {
|
|
62
|
+
out("Codelia is up to date.");
|
|
63
|
+
return 0;
|
|
64
|
+
}
|
|
65
|
+
if (!method || method.kind === "development") {
|
|
66
|
+
out("Running from a source checkout; update it with git.");
|
|
67
|
+
return checkOnly ? 0 : 1;
|
|
68
|
+
}
|
|
69
|
+
const command = buildUpdateCommand(method, {
|
|
70
|
+
version: outcome.latest,
|
|
71
|
+
channel: outcome.channel
|
|
72
|
+
});
|
|
73
|
+
const hint = method.autoApply.supported ? "Update with: codelia update" : commandHint(command);
|
|
74
|
+
if (checkOnly) {
|
|
75
|
+
out(hint);
|
|
76
|
+
return 0;
|
|
77
|
+
}
|
|
78
|
+
if (!method.autoApply.supported) {
|
|
79
|
+
err(
|
|
80
|
+
`Automatic update is unavailable (${method.autoApply.reason}). ${hint}`
|
|
81
|
+
);
|
|
82
|
+
return 1;
|
|
83
|
+
}
|
|
84
|
+
const result = await applyUpdate({
|
|
85
|
+
paths,
|
|
86
|
+
method,
|
|
87
|
+
from: currentVersion,
|
|
88
|
+
to: outcome.latest,
|
|
89
|
+
configuredChannel: settings.channel,
|
|
90
|
+
env,
|
|
91
|
+
runner: deps.runner
|
|
92
|
+
});
|
|
93
|
+
if (result.status === "installed") {
|
|
94
|
+
out(`Updated Codelia ${result.from} -> ${result.to}.`);
|
|
95
|
+
return 0;
|
|
96
|
+
}
|
|
97
|
+
if (result.status === "changed") {
|
|
98
|
+
if ((compareVersions(result.installed, outcome.latest) ?? -1) >= 0) {
|
|
99
|
+
out(`Codelia ${result.installed} is already up to date.`);
|
|
100
|
+
return 0;
|
|
101
|
+
}
|
|
102
|
+
err(
|
|
103
|
+
"Codelia changed version during the update check. Run codelia update again."
|
|
104
|
+
);
|
|
105
|
+
return 1;
|
|
106
|
+
}
|
|
107
|
+
if (result.status === "superseded") {
|
|
108
|
+
err("The cached update target changed. Run codelia update again.");
|
|
109
|
+
return 1;
|
|
110
|
+
}
|
|
111
|
+
if (result.status === "deferred") {
|
|
112
|
+
err(
|
|
113
|
+
"Another update is in progress for this installation. Run codelia update again after it finishes."
|
|
114
|
+
);
|
|
115
|
+
return 1;
|
|
116
|
+
}
|
|
117
|
+
err(
|
|
118
|
+
`Update failed: ${result.message}. ${result.unmanaged ? commandHint(null) : hint}`
|
|
119
|
+
);
|
|
120
|
+
return 1;
|
|
121
|
+
};
|
|
122
|
+
export {
|
|
123
|
+
runUpdateCommand
|
|
124
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codelia/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.89",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -20,19 +20,19 @@
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@codelia/config-loader": "0.1.
|
|
24
|
-
"@codelia/protocol": "0.1.
|
|
25
|
-
"@codelia/runtime": "0.1.
|
|
26
|
-
"@codelia/storage": "0.1.
|
|
23
|
+
"@codelia/config-loader": "0.1.89",
|
|
24
|
+
"@codelia/protocol": "0.1.89",
|
|
25
|
+
"@codelia/runtime": "0.1.89",
|
|
26
|
+
"@codelia/storage": "0.1.89",
|
|
27
27
|
"cac": "^6.7.14",
|
|
28
28
|
"zod": "^4.3.6"
|
|
29
29
|
},
|
|
30
30
|
"optionalDependencies": {
|
|
31
|
-
"@codelia/tui-darwin-arm64": "0.1.
|
|
32
|
-
"@codelia/tui-darwin-x64": "0.1.
|
|
33
|
-
"@codelia/tui-linux-arm64": "0.1.
|
|
34
|
-
"@codelia/tui-linux-x64": "0.1.
|
|
35
|
-
"@codelia/tui-win32-x64": "0.1.
|
|
31
|
+
"@codelia/tui-darwin-arm64": "0.1.89",
|
|
32
|
+
"@codelia/tui-darwin-x64": "0.1.89",
|
|
33
|
+
"@codelia/tui-linux-arm64": "0.1.89",
|
|
34
|
+
"@codelia/tui-linux-x64": "0.1.89",
|
|
35
|
+
"@codelia/tui-win32-x64": "0.1.89"
|
|
36
36
|
},
|
|
37
37
|
"overrides": {
|
|
38
38
|
"gaxios": "7.1.4"
|