Feature: dev-sync foundation — pre-commit hook + tools.json consolidation
IMPLEMENTATION RULES: Before implementing this plan, read and follow:
- WORKFLOW.md - The implementation process
- PLANS.md - Plan structure and best practices
Status: Active
Goal: Add version tracking infrastructure and consolidate the two separate JSON generators into one.
GitHub Issue: #54 (Phase 1 of 5)
Last Updated: 2026-02-16
Investigation: INVESTIGATE-dev-update-auto-pull.md — Phase 1 (foundation)
Overview
Issue #54 describes a multi-phase script-level sync system. This plan covers Phase 1 only — the version infrastructure that all future phases depend on.
Requirement: Development of devcontainer-toolbox is done inside the devcontainer itself (Linux). The pre-commit hook only needs to support GNU sed — no macOS portability concerns.
Problem: Two separate JSON generators
Currently there are two scripts that independently extract metadata from install scripts:
| Script | Output | Used by |
|---|---|---|
generate-tools-json.sh | .devcontainer/manage/tools.json | Runtime (dev-tools, future dev-sync) |
dev-docs.sh | website/src/data/tools.json | Website (React components) |
Both scan the same install-*.sh files but produce different JSON. The runtime version is actually more complete (includes packages, extensions, checkCommand, file) while the website version adds logo but misses those fields.
Solution
Make generate-tools-json.sh the single source of truth for tool JSON data:
- Enhance
generate-tools-json.shwithlogofield andSCRIPT_VER(version) - Refactor
dev-docs.shto callgenerate-tools-json.shand copy its output towebsite/src/data/tools.json, instead of re-extracting metadata dev-docs.shkeeps its MDX generation (needs to read scripts directly for package tables and--helpoutput), but uses the shared JSON fortools.jsonandcategories.json
Four deliverables
- Pre-commit hook (
.githooks/pre-commit) — validates scripts and auto-bumpsSCRIPT_VERpatch version - Script validation — syntax check, required metadata fields, shellcheck on staged addition scripts
- Consolidated JSON generator — one
generate-tools-json.shfor both runtime and website - Version fields in tools.json — per-tool
"version"fromSCRIPT_VER+ top-level"version"
Phase 1: Pre-commit hook — ✅ DONE
Tasks
- 1.1 Create
.githooks/pre-commitwith the auto-bump logic from issue #54 (uses GNUsed -i— runs inside devcontainer) - 1.2 Make the hook executable (
chmod +x) - 1.3 Add script validation (Job 1): syntax check (
bash -n), required metadata fields, shellcheck (--severity=error) - 1.4 Validation checks 8 required fields:
SCRIPT_ID,SCRIPT_VER,SCRIPT_NAME,SCRIPT_DESCRIPTION,SCRIPT_CATEGORY,SCRIPT_CHECK_COMMAND,SCRIPT_TAGS,SCRIPT_ABSTRACT - 1.5 Validation runs before version bump — blocks commit on failure
- 1.6 Tested in devcontainer: valid scripts pass, scripts with missing fields are rejected
Validation
chmod +x .githooks/pre-commit
git config core.hooksPath .githooks
# Stage a trivial change to a script with SCRIPT_VER, commit
# Verify SCRIPT_VER was auto-bumped in the committed file
User confirms phase is complete.
Phase 2: Enhance generate-tools-json.sh — ✅ DONE
Add the missing fields so it can serve both runtime and website needs.
Tasks
- 2.1 Add
SCRIPT_VERextraction — new"version"field per tool - 2.2 Add
SCRIPT_LOGOextraction — new"logo"field per tool (currently only in website generator) - 2.3 Add top-level
"version"field — start at"1.0.0", CI/CD will auto-bump in future phases - 2.4 Extract
SCRIPT_VERfrom config scripts and service scripts too - 2.5 Also generate
categories.jsonin the same script (currently only indev-docs.sh) - 2.6 Run the generator and verify the output has all fields needed by both runtime and website
Validation
bash .devcontainer/manage/generate-tools-json.sh
# Verify tools.json has:
# - top-level "version": "1.0.0"
# - each tool has "version": "X.Y.Z"
# - each tool has "logo" (when defined in script)
# - packages, extensions, checkCommand still present
# Verify categories.json is generated
User confirms phase is complete.
Phase 3: Refactor dev-docs.sh to use shared generator — ✅ DONE
Remove the duplicate generate_tools_json() and generate_categories_json() from dev-docs.sh and have it use the output from generate-tools-json.sh instead.
Tasks
- 3.1 In
dev-docs.sh, replacegenerate_tools_json()call with: rungenerate-tools-json.sh, then copy its output towebsite/src/data/tools.json - 3.2 Similarly for
categories.json— copy from the shared generator output - 3.3 Remove the duplicate
generate_tools_json()andgenerate_categories_json()functions fromdev-docs.sh - 3.4 Keep
dev-docs.sh's MDX generation unchanged (still reads scripts for package tables, help output) - 3.5 Run
dev-docsand verify website JSON matches what the generator produces - 3.6 Verify the website builds correctly with the new JSON (if possible)
Validation
dev-docs --verbose
# Verify website/src/data/tools.json and categories.json are generated
# Compare with .devcontainer/manage/tools.json — should have same tool data
# Verify MDX pages still generate correctly
User confirms phase is complete.
Phase 4: Documentation — ✅ DONE
Tasks
- 4.1 Add a note to contributor docs about the pre-commit hook setup:
git config core.hooksPath .githooks - 4.2 Document that
SCRIPT_VERis auto-bumped — contributors don't need to manually update it - 4.3 Document that
generate-tools-json.shis the single source of truth for tool JSON - 4.4 Document the pre-commit script validation (what's checked, what fields are required)
Validation
Documentation is clear and accurate.
User confirms phase is complete.
Acceptance Criteria
-
.githooks/pre-commitexists and auto-bumpsSCRIPT_VERon commit - Hook uses GNU
sed -i(runs inside devcontainer, Linux only) - Hook only bumps when there are real content changes (not just version line)
- Hook skips new files (not yet in HEAD)
- Hook validates staged addition scripts (syntax, metadata, shellcheck)
- Hook blocks commit if validation fails
-
tools.jsonhas a top-level"version"field - Each tool entry in
tools.jsonhas a"version"field fromSCRIPT_VER - Each tool entry in
tools.jsonhas a"logo"field (when defined) -
generate-tools-json.shis the single source of truth for tool JSON -
dev-docs.shno longer has its own JSON generation — uses the shared generator -
generate-tools-json.shalso producescategories.json - Website JSON output matches runtime JSON (same data)
- MDX page generation still works (reads scripts directly for package tables)
- Contributor docs explain hook setup and version auto-bumping
- Contributor docs explain script validation checks
Files to Create/Modify
.githooks/pre-commit— new — auto-bump hook.devcontainer/manage/generate-tools-json.sh— modify — add version, logo, categories.devcontainer/manage/dev-docs.sh— modify — remove duplicate JSON generation, use shared generator- Contributor docs — modify — add hook setup instructions