feat(tbd-cli): Add git-based versioning and test install scripts#10
Merged
Conversation
- Add shared git-version.mjs script for version detection at build time - Implement env var approach for dev mode (TBD_DEV_VERSION) - Add version.ts CLI module with clean fallback chain (no git dependency at runtime) - Add test:install and test:uninstall scripts for testing packaged CLI - Update research doc with improved versioning pattern as reference Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
No actively maintained npm package provides build-time git version injection with env var support for dev mode. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Coverage Report for packages/tbd-cli
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
jlevy
pushed a commit
that referenced
this pull request
May 7, 2026
The user pointed out the new Design Principles in the docs-config plan should be cross-referenced and consolidated with the existing tbd-design principles. Three changes: 1. tbd-design.md §1.5 (Design Principles) extended from 6 to 10: - #1 (Simplicity first) extended to spell out "simple things simple, complex things possible". - #3 (Git for sync) extended with the reproducible-from-config contract. - #7 added: Auth is always out-of-band — tbd never holds credentials. - #8 added: Hard cuts on format versions with reliable migration — already practiced for f02→f03; making it an explicit principle. - #9 added: Spec ↔ implementation synchrony via tests. - #10 added: Layered architecture, separable artifacts. These four new principles emerged from the docs-config redesign work but apply tbd-wide. 2. tbd-design.md §1.4 Design Goals: added goal #8 (extensible knowledge subsystem), which links forward to the plan-spec and the docref/ docmap design docs as the authoritative location for that subsystem's design. 3. plan-spec Design Principles intro: now explicitly notes that P1, P5, P6, P7, P8, P9 are restatements/elaborations of tbd-design §1.5 principles, while P2, P3, P4 are docs/config-specific and have no direct system-wide analog. Each restated principle gets an inline "(extends tbd-design §1.5 #N)" cross-reference. tbd-design.md is declared authoritative for system-wide values. This consolidates principles in one foundational location (tbd-design.md) while keeping the docs-config plan readable on its own. https://claude.ai/code/session_01PhbYdWX7DUBpUBVuUesVuP
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.
Summary
scripts/git-version.mjsfor git-based version detection at build timeTBD_DEV_VERSION) for dev mode version passingsrc/cli/lib/version.tsCLI module with clean fallback chain (no git dependency at runtime)test:installandtest:uninstallscripts for testing packaged CLI installationChanges
New Files
packages/tbd-cli/scripts/git-version.mjs- Single source of truth for git version logicpackages/tbd-cli/scripts/git-version.d.mts- TypeScript declarationspackages/tbd-cli/src/cli/lib/version.ts- CLI version resolution moduleModified Files
package.json- Addedtbddev script with env var,test:install,test:uninstallpackages/tbd-cli/package.json- Addedtest:install,test:uninstallscriptspackages/tbd-cli/tsdown.config.ts- Simplified to import from shared scriptdocs/development.md- Added "Testing the packaged installation" sectiondocs/general/research/current/research-modern-typescript-monorepo-patterns.md- Updated versioning pattern documentationCLI Files Updated
src/cli/cli.ts,src/cli/commands/init.ts,src/cli/commands/import.ts,src/cli/commands/status.ts- Import VERSION from new moduleVersion Format
X.Y.Z1.2.3X.Y.Z-dev.N.hash1.2.4-dev.12.a1b2c3dX.Y.Z-dev.N.hash-dirty1.2.4-dev.12.a1b2c3d-dirtyX.Y.Z-dev.N.hash0.1.0-dev.42.a1b2c3dManual Validation
🤖 Generated with Claude Code