Skip to content

feat(tbd-cli): Add git-based versioning and test install scripts#10

Merged
jlevy merged 3 commits into
mainfrom
claude/fix-ci-failures-2ghXh
Jan 17, 2026
Merged

feat(tbd-cli): Add git-based versioning and test install scripts#10
jlevy merged 3 commits into
mainfrom
claude/fix-ci-failures-2ghXh

Conversation

@jlevy
Copy link
Copy Markdown
Owner

@jlevy jlevy commented Jan 17, 2026

Summary

  • Add shared scripts/git-version.mjs for git-based version detection at build time
  • Implement env var approach (TBD_DEV_VERSION) for dev mode version passing
  • Add src/cli/lib/version.ts CLI module with clean fallback chain (no git dependency at runtime)
  • Add test:install and test:uninstall scripts for testing packaged CLI installation
  • Update research doc with improved versioning pattern as reference for future projects

Changes

New Files

  • packages/tbd-cli/scripts/git-version.mjs - Single source of truth for git version logic
  • packages/tbd-cli/scripts/git-version.d.mts - TypeScript declarations
  • packages/tbd-cli/src/cli/lib/version.ts - CLI version resolution module

Modified Files

  • package.json - Added tbd dev script with env var, test:install, test:uninstall
  • packages/tbd-cli/package.json - Added test:install, test:uninstall scripts
  • packages/tbd-cli/tsdown.config.ts - Simplified to import from shared script
  • docs/development.md - Added "Testing the packaged installation" section
  • docs/general/research/current/research-modern-typescript-monorepo-patterns.md - Updated versioning pattern documentation

CLI 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 module

Version Format

State Format Example
On tag X.Y.Z 1.2.3
After tag X.Y.Z-dev.N.hash 1.2.4-dev.12.a1b2c3d
Dirty X.Y.Z-dev.N.hash-dirty 1.2.4-dev.12.a1b2c3d-dirty
No tags X.Y.Z-dev.N.hash 0.1.0-dev.42.a1b2c3d

Manual Validation

# Test dev mode version
pnpm tbd --version
# Should show: 0.1.0-dev.N.hash format

# Test built version
pnpm build
pnpm tbd:bin --version
# Should show same git-based version

# Test packaged installation
pnpm test:install
tbd --version
pnpm test:uninstall

🤖 Generated with Claude Code

jlevy and others added 3 commits January 17, 2026 14:00
- 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>
@github-actions
Copy link
Copy Markdown

Coverage Report for packages/tbd-cli

Status Category Percentage Covered / Total
🔵 Lines 12.4% 659 / 5311
🔵 Statements 12.4% 659 / 5311
🔵 Functions 37.83% 42 / 111
🔵 Branches 79.27% 153 / 193
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/tbd-cli/src/cli/cli.ts 0% 0% 0% 0% 1-152
packages/tbd-cli/src/cli/commands/import.ts 0% 0% 0% 0% 1-717
packages/tbd-cli/src/cli/commands/init.ts 0% 0% 0% 0% 1-122
packages/tbd-cli/src/cli/commands/status.ts 0% 0% 0% 0% 1-384
packages/tbd-cli/src/cli/lib/version.ts 0% 0% 0% 0% 1-40
Generated in workflow #85 for commit 55afcc2 by the Vitest Coverage Report Action

@jlevy jlevy merged commit 1c0a482 into main Jan 17, 2026
5 checks passed
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant