@paleo/alcode 0.2.0 → 0.3.0

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/cli.d.ts CHANGED
@@ -19,6 +19,7 @@ export interface AlcodeArgs {
19
19
  guide: boolean;
20
20
  openclawGuide: boolean;
21
21
  help: boolean;
22
+ version: boolean;
22
23
  }
23
24
  export declare function parseAlcodeArgs(argv: string[]): AlcodeArgs;
24
25
  export declare function validateArgs(args: AlcodeArgs): string | undefined;
package/dist/cli.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { readFileSync } from "node:fs";
1
2
  import { relative } from "node:path";
2
3
  import { parseArgs } from "node:util";
3
4
  import { renderGuide } from "./guide.js";
@@ -18,6 +19,10 @@ export async function main(options) {
18
19
  stderr.write(`${err instanceof Error ? err.message : String(err)}\n`);
19
20
  return 1;
20
21
  }
22
+ if (parsed.version) {
23
+ stdout.write(`${readPackageVersion()}\n`);
24
+ return 0;
25
+ }
21
26
  if (parsed.help) {
22
27
  stdout.write(renderHelp());
23
28
  return 0;
@@ -33,6 +38,12 @@ export async function main(options) {
33
38
  }
34
39
  return runSession(parsed, { cwd, env, stdout, stderr });
35
40
  }
41
+ function readPackageVersion() {
42
+ const pkg = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
43
+ if (!pkg.version)
44
+ throw new Error("alcode: package.json is missing 'version'");
45
+ return pkg.version;
46
+ }
36
47
  // alcode always runs `claude` in the foreground and blocks until it exits. When OpenClaw drives
37
48
  // alcode, it wraps this call in its own `exec` tool (which backgrounds after `yieldMs` and wakes
38
49
  // the agent on exit) — alcode owns no backgrounding or callback of its own. The per-run session
@@ -115,6 +126,7 @@ export function parseAlcodeArgs(argv) {
115
126
  guide: { type: "boolean", default: false },
116
127
  "openclaw-guide": { type: "boolean", default: false },
117
128
  help: { type: "boolean", default: false },
129
+ version: { type: "boolean", short: "v", default: false },
118
130
  },
119
131
  strict: true,
120
132
  });
@@ -129,6 +141,7 @@ export function parseAlcodeArgs(argv) {
129
141
  guide: values.guide === true,
130
142
  openclawGuide: values["openclaw-guide"] === true,
131
143
  help: values.help === true,
144
+ version: values.version === true,
132
145
  };
133
146
  }
134
147
  export function validateArgs(args) {
@@ -174,6 +187,7 @@ Usage:
174
187
  alcode --guide
175
188
  alcode --openclaw-guide
176
189
  alcode --help
190
+ alcode -v, --version
177
191
 
178
192
  Modes:
179
193
  --new Start a new session.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paleo/alcode",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "license": "CC0-1.0",
5
5
  "author": "Thomas MUR",
6
6
  "description": "Run a coding agent through AlignFirst protocols, with a durable session file per run.",