Skip to content

Conversation

@AdaInTheLab
Copy link
Owner

Summary

Fix critical ES module import errors that prevented the CLI from running, and establish comprehensive style guides to prevent future issues.

Changes

Bug Fixes

  1. capabilities.ts: Add missing .js extension

    // Before
    import { CLI_SCHEMA_VERSION } from "./schema";
    
    // After
    import { CLI_SCHEMA_VERSION } from "./schema.js";
  2. version.ts: Fix package.json path for compiled code

    // Before (works in dev, breaks in production)
    const pkg = require("../../package.json");
    
    // After (works from compiled location)
    const pkg = require("../../../package.json");

Style Guide

Added two comprehensive documentation files:

  1. STYLE_GUIDE.md (Full guide)

    • ES modules import rules (CRITICAL)
    • File structure & naming conventions
    • Code patterns & templates
    • Commit message format (lore-coded)
    • Testing & building process
    • Common gotchas with solutions
    • Contract guarantees
    • Development workflow
  2. QUICK_REFERENCE.md (One-page cheat sheet)

    • Quick commands
    • Pattern templates
    • Debugging table
    • Emergency fixes
    • Print-and-keep format

Why This Matters

Node.js ES Modules require explicit .js extensions for relative imports. TypeScript doesn't add them automatically, so they must be written in source files even though the actual files are .ts.

The style guide prevents this and other common issues by documenting:

Testing

  • CLI builds successfully: npm run build
  • Global install works: npm install -g .
  • Commands functional:
    • hpl version - Shows version
    • hpl capabilities - Lists capabilities
    • hpl health - Checks API health
    • hpl version --json - JSON output works
  • No import errors
  • No module not found errors

Breaking Changes

None - all changes are bug fixes and documentation.

Impact

Before: CLI unusable due to ES module errors
After: CLI fully functional + guides to prevent future issues

Time saved: ~2-4 hours per new contributor who would have hit these issues

Related

  • Fixes issues discovered during Liminal Bridge implementation
  • Part of broader effort to improve developer experience

Checklist

  • Code follows style guide (now documented!)
  • All tests passing
  • Documentation comprehensive
  • Commit messages follow lore-coded format
  • No breaking changes

These guides will help future contributors (and AI assistants) avoid the same pitfalls!

Co-authored-by: Sage sage@thehumanpatternlab.com

@github-actions
Copy link

😼🔥 Carmel Chaos Stamp™

I sense weakness in these tests.

Fix critical ES module import errors and establish comprehensive
style guide to prevent future issues.

Import Fixes:
- Add .js extension to schema import in capabilities.ts
- Fix package.json path from ../../ to ../../../ (for compiled code)
- TypeScript doesn't auto-add extensions for ES Modules

Style Guide:
- Add STYLE_GUIDE.md with complete development conventions
- Add QUICK_REFERENCE.md as one-page cheat sheet
- Cover import rules, commit format, common gotchas
- Include VS Code settings for auto-adding .js extensions

Testing:
- CLI builds successfully (npm run build)
- Global install works (npm install -g .)
- All commands functional (hpl version, capabilities, health)

These guides will help future contributors (biological and digital)
avoid common ES module pitfalls and maintain consistency.

Co-authored-by: Sage <sage@thehumanpatternlab.com>
@AdaInTheLab AdaInTheLab force-pushed the refactor/liminal-bridge branch from 3b3d6bd to d0b622e Compare January 28, 2026 00:41
@github-actions
Copy link

😼✨ Carmel Approval Stamp™

Adequate work, human.

@AdaInTheLab AdaInTheLab merged commit 2f81257 into main Jan 28, 2026
2 checks passed
@AdaInTheLab AdaInTheLab deleted the refactor/liminal-bridge branch January 28, 2026 00:42
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.

2 participants