Repository navigation
SPEC-0011: tangent-shell: add /version api endpoint - #200
Draft
maxy-shpfy wants to merge 1 commit into
Draft
maxy-shpfy wants to merge 1 commit into
maxy-shpfy wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements SPEC-0011 — tangent-shell: add /version api endpoint.
Story
The tangent-shell server (@tangent/server) exposes GET /api/health but there's no way to read which build is running. Add a sibling GET /api/version endpoint that returns the server package's name and version as JSON: { "name": "", "version": "" }, read from its own package.json.
Mount it the same way as the existing health route, add no new dependencies, and include a test in the server's existing test setup that asserts a 200 and the JSON shape. No auth, no params. Follow the repo's own conventions (its CLAUDE.md / AGENTS.md).
Plan
SPEC-0011 — Server package version endpoint
Scope
Add unauthenticated
GET /api/versionbesideGET /api/health, returning HTTP 200 and exactly{ name, version }fromapps/server/package.json. No dependencies, parameters, frontend changes, version bumps, or health refactoring.Implementation
resolveJsonModuleexplicitly inapps/server/tsconfig.jsonfor typed server-local JSON imports. Leave shared configuration unchanged.apps/server/src/routes/version.ts, statically importing../../package.jsonwithwith { type: "json" }. Export synchronoushandleGetVersionwith Express request/response types and avoidreturn. Useres.jsonwith only manifestnameandversion, not the complete manifest, hardcoded values, environment overrides, or Git metadata. Follow repo import conventions, including explicit.tsextensions for TypeScript imports; keep comments minimal.app.get("/api/version", handleGetVersion)inapps/server/src/index.tsdirectly beside health and before other API routers. Preserve middleware order, health behavior, and startup behavior. Do not introduce a router abstraction or extract health logic.apps/server/src/routes/version.test.tswithnode:test,node:assert/strict, Express, andfetch. Register the production handler at the full path in an isolated Express app, listen on an ephemeral loopback port, await readiness, and close reliably through test cleanup. Do not import the side-effectful server entrypoint. Request without authorization, cookies, or parameters; assert 200, JSON content type, and exact deep equality to{ name: manifest.name, version: manifest.version }. Reject additional fields. No mocks or test dependencies.Build and validation
dist/without the source manifest.pnpm install --frozen-lockfilein this worktree; do not change manifests or lockfile to bypass installation problems.pnpm --filter @tangent/server exec tsx --test src/routes/version.test.ts, thenpnpm --filter @tangent/server test(validation skips tests).pnpm validate.apps/server/dist/index.jsfor embedded metadata and absence of a runtime source-manifest dependency. Smoke-test an isolated bundled version-handler harness using existing esbuild and plain Node in a temporary.local/directory without the source manifest. Verify the HTTP response against build-time metadata; keep harness uncommitted and avoid the full server entrypoint.Inspection findings
The session mount is on branch
SPEC-0011, with tracked files clean. RepositoryCLAUDE.mdand relevant project-conventions, TypeScript, server-testing, and code-navigation skills were reviewed; no applicableAGENTS.mdfound. Health registration is inapps/server/src/index.ts:411; HTTP testing conventions are inroutes/attach.test.ts; production bundling is inbuild.mjsandDockerfile. Compiler configuration inspection was blocked by unresolved@tangent/build/tsconfig/node.json; verify resolved configuration after installing dependencies. No implementation or tests performed. A gitignored planning note was saved under.local/.Affected files
apps/server/tsconfig.json— modify: Enable typed static JSON imports locally for server package metadata.apps/server/src/routes/version.ts— add: Provide an independently testable handler returning only manifest-derived name and version, bundled with production code.apps/server/src/index.ts— modify: Register GET /api/version beside health without changing existing behavior or middleware.apps/server/src/routes/version.test.ts— add: Assert unauthenticated HTTP access, 200, JSON content type, and exact manifest-derived response using existing Node tests.Part of the SPEC-0011 slice spanning tangent-shell. This PR is one draft layer of that stack — review and undraft each layer per repo.