fix(context): use CLI package version when repo is a private workspace root#169
Conversation
…e root charter context read version from path.join(root, 'package.json'), where root is cwd. On the charter monorepo itself this resolves to the workspace root (private: true, version: 0.10.0) rather than packages/cli/package.json (version: 0.16.0), causing the brief to show an outdated version. Fix: import the CLI's own package.json statically and fall back to its version whenever the analysed repo's package.json has private: true. Private workspace roots have no meaningful published version; the installed CLI version is the correct signal for AI agent context. Adds two regression tests: private root uses CLI version, normal package uses its own version. Closes #161 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
I found one behavioral risk in this fix: the private true fallback to CLI version is broader than issue 161. Private true is common for single-package internal apps too, so this can replace legitimate app versions with the CLI version in normal repos. Please narrow this to private workspace roots (for example private true plus a workspace marker) or gate on explicit CLI package identity. That keeps the charter-monorepo fix without changing version semantics for other private repos. |
The previous fix fell back to the CLI version for any private: true package. That's too broad — private is common for single-package internal apps that have their own meaningful version. Narrow the guard to private: true AND workspaces != null, which precisely targets monorepo workspace roots (the only case where version is stale). Adds a test: private-but-no-workspaces internal-app preserves v2.4.1. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Fixed in 4f0b6ba — guard narrowed to |
Summary
charter contextwas readingversionfrompath.join(cwd, 'package.json'). On the charter monorepo, that resolves to the private workspace root (version: 0.10.0) instead ofpackages/cli/package.json(version: 0.16.0)package.jsonand fall back to its version whenpkg.private === true. Private workspace roots carry no meaningful published version — the installed CLI version is the right signalcontext.ts(~3 lines). No behavioural change for normal single-package reposTest plan
private: trueworkspace root → brief shows CLI version, notv0.1.0v3.7.2)pnpm test— 492/492 passCloses #161
🤖 Generated with Claude Code