Skip to content

VERSION constant in src/version.ts can silently drift from package.json#version #101

Description

@Deepam02

File: packages/agentctx/src/version.ts:6

Problem (one line): VERSION is hardcoded as a string literal that is maintained independently of packages/agentctx/package.json's version, so the two can silently disagree and agentctx --version can report a version the package isn't.

Details

src/version.ts is:

export const VERSION = "0.1.0";

This value powers agentctx --version / agentctx -v and the --help banner (src/cli/main.ts:18, :52-55). Meanwhile packages/agentctx/package.json independently declares "version": "0.1.0". They happen to match today, but nothing enforces it — a release that bumps package.json (e.g. via npm version) without editing version.ts (or vice versa) makes the CLI lie about its own version, and no test catches it.

The module is intentionally dependency-free (see its own docstring) so --version/--help never load better-sqlite3; that constraint should be preserved — the fix belongs in a test, not a runtime package.json import.

What "done" looks like

Add a small unit test (e.g. test/version.test.ts) that reads package.json at test time and asserts VERSION === pkg.version, so any future drift fails CI. (Alternatively, generate version.ts from package.json at build time — but a guard test is the smaller, lower-risk change.)

Scope

Single new test file (or a few lines), no architectural change. Suitable for a first-time contributor; well under 4 hours.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions