Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Command } from "commander";
import { assertNodeVersion } from "./utils/system.js";
import { VERSION } from "./version.js";
import "./frameworks/definitions.js";
import { loadCustomFrameworks } from "./frameworks/custom.js";
import { runOnboard } from "./commands/onboard.js";
Expand Down Expand Up @@ -57,7 +58,7 @@ program
.description(
"Secure CLI platform for running AI agents in isolated Docker sandboxes",
)
.version("0.2.0", "-V, --version", "Print version")
.version(VERSION, "-V, --version", "Print version")
.helpOption("-h, --help", "Show help");

// ── onboard ────────────────────────────────────────────────────────────────
Expand Down
3 changes: 2 additions & 1 deletion src/commands/integrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import Table from "cli-table3";
import { readConfig, patchConfig } from "../config/manager.js";
import type { IntegrationConfig, IntegrationAuthType } from "../config/schema.js";
import { getTemplate, listTemplates } from "../integrations/templates.js";
import { VERSION } from "../version.js";
import { log, section } from "../utils/logger.js";

// ---------------------------------------------------------------------------
Expand Down Expand Up @@ -320,7 +321,7 @@ export async function runIntegrationsTest(name: string): Promise<void> {
method: "GET",
timeout: 5000,
headers: {
"user-agent": "SILO/0.2.0",
"user-agent": `SILO/${VERSION}`,
},
},
(res) => {
Expand Down
5 changes: 3 additions & 2 deletions src/commands/onboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
getPreset,
} from "../policy/presets.js";
import type { Policy } from "../policy/engine.js";
import { VERSION } from "../version.js";

// Default models per provider
const DEFAULT_MODELS: Record<LLMProvider, string> = {
Expand Down Expand Up @@ -193,7 +194,7 @@ async function animateWelcome(): Promise<void> {
}

console.log();
console.log(` ${chalk.bold.white("SILO")} ${chalk.cyan("v0.2.0")} ${chalk.dim("•")} ${chalk.white("Secure AI Agent Sandbox")}`);
console.log(` ${chalk.bold.white("SILO")} ${chalk.cyan(`v${VERSION}`)} ${chalk.dim("•")} ${chalk.white("Secure AI Agent Sandbox")}`);
console.log();

// Play Star Wars style hyperspace jump animation under the logo
Expand All @@ -206,7 +207,7 @@ async function animateWelcome(): Promise<void> {
console.log(" " + grad(line));
}
console.log();
console.log(` ${chalk.bold.white("SILO")} ${chalk.cyan("v0.2.0")} ${chalk.dim("•")} ${chalk.white("Secure AI Agent Sandbox")}`);
console.log(` ${chalk.bold.white("SILO")} ${chalk.cyan(`v${VERSION}`)} ${chalk.dim("•")} ${chalk.white("Secure AI Agent Sandbox")}`);
console.log();

const os = `${platform()} ${arch()} (${release()})`;
Expand Down
3 changes: 2 additions & 1 deletion src/utils/logger.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import chalk from "chalk";
import boxen from "boxen";
import { VERSION } from "../version.js";

const PREFIX = {
info: chalk.cyan("ℹ"),
Expand Down Expand Up @@ -39,7 +40,7 @@ export function printBanner(): void {
const banner = boxen(
chalk.bold.cyan("SILO") +
" " +
chalk.dim("v0.2.0") +
chalk.dim(`v${VERSION}`) +
"\n" +
chalk.dim("Secure AI Agent Sandbox Orchestrator"),
{
Expand Down
14 changes: 14 additions & 0 deletions src/version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* The CLI version, read from package.json at runtime.
*
* `silo --version`, the banners, and the integration-test user-agent all use
* this, so a version bump in package.json is the only edit a release needs.
* `createRequire` resolves the path relative to this module, which works the
* same from src/ (tsx, vitest) and from the bundled files in dist/ —
* package.json sits one level up in both.
*/
import { createRequire } from "node:module";

const pkg = createRequire(import.meta.url)("../package.json") as { version: string };

export const VERSION: string = pkg.version;
16 changes: 16 additions & 0 deletions tests/version.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { describe, it, expect } from "vitest";
import { readFileSync } from "node:fs";
import { VERSION } from "../src/version.js";

describe("VERSION", () => {
it("matches the version in package.json", () => {
const pkg = JSON.parse(
readFileSync(new URL("../package.json", import.meta.url), "utf8"),
) as { version: string };
expect(VERSION).toBe(pkg.version);
});

it("is a semver string", () => {
expect(VERSION).toMatch(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/);
});
});
Loading