Problem
Two CLI commands shorten the (64-char SHA-256 hex) project id for display by hardcoding the same 12 independently. If the chosen display length ever changes, both must be edited in lockstep, and nothing ties them together.
- File / line:
packages/agentctx/src/cli/status.ts:53
env.io.out(`agentctx status — project ${projectId.slice(0, 12)}… (${env.cwd})`);
- File / line:
packages/agentctx/src/cli/reset.ts:61
`${result.edges} edge(s), ${result.sessions} session(s) for project ${projectId.slice(0, 12)}…`,
Both render <first 12 hex chars>…. The 12 is a bare literal in each spot with no shared constant — a small DRY/consistency gap (the sibling of the "hardcoded constant that can silently drift" point raised in #39 for the MCP tool descriptions).
What done looks like
- A single named constant (e.g.
PROJECT_ID_DISPLAY_LEN = 12) and a tiny shared helper (e.g. shortProjectId(projectId) returning `${projectId.slice(0, PROJECT_ID_DISPLAY_LEN)}…`) is defined once — a natural home is alongside resolveProjectId in packages/agentctx/src/storage/namespace.ts, or a shared CLI helper — and both status.ts:53 and reset.ts:61 call it instead of repeating slice(0, 12).
- No change to the rendered output (still the first 12 chars +
…); this is a pure refactor.
- (Optional) a small test pinning the helper's output format.
Problem
Two CLI commands shorten the (64-char SHA-256 hex) project id for display by hardcoding the same
12independently. If the chosen display length ever changes, both must be edited in lockstep, and nothing ties them together.packages/agentctx/src/cli/status.ts:53packages/agentctx/src/cli/reset.ts:61Both render
<first 12 hex chars>…. The12is a bare literal in each spot with no shared constant — a small DRY/consistency gap (the sibling of the "hardcoded constant that can silently drift" point raised in #39 for the MCP tool descriptions).What done looks like
PROJECT_ID_DISPLAY_LEN = 12) and a tiny shared helper (e.g.shortProjectId(projectId)returning`${projectId.slice(0, PROJECT_ID_DISPLAY_LEN)}…`) is defined once — a natural home is alongsideresolveProjectIdinpackages/agentctx/src/storage/namespace.ts, or a shared CLI helper — and bothstatus.ts:53andreset.ts:61call it instead of repeatingslice(0, 12).…); this is a pure refactor.