Skip to content

Feat/windows installer json i18n#12

Closed
glauberlima wants to merge 11 commits intomainfrom
feat/windows-installer-json-i18n
Closed

Feat/windows installer json i18n#12
glauberlima wants to merge 11 commits intomainfrom
feat/windows-installer-json-i18n

Conversation

@glauberlima
Copy link
Copy Markdown
Owner

No description provided.

glauberlima and others added 9 commits February 3, 2026 20:04
- Create PowerShell installer (install.ps1) for Windows 10+
  * Compatible with PowerShell 5.1+
  * Full feature parity with install.sh
  * Downloads statusline.sh and JSON message files
  * Interactive language and component selection
  * Safe settings.json merging with backups

- Migrate i18n system from bash to JSON format
  * Convert messages/*.sh to messages/*.json
  * Unified format for Unix and Windows

- Update statusline.sh for JSON support
  * Add load_json_messages() function
  * Auto-migration from .sh to .json format
  * Backward compatible with bash format
  * Maintains pipe-delimited internal format for compatibility

- Update install.sh for JSON
  * Install JSON message files instead of bash
  * Save configuration as JSON format
  * Download JSON files from GitHub

Key improvements:
- Single message format to maintain (no dual bash/JSON)
- Native PowerShell JSON parsing (no jq on Windows)
- Auto-migration for existing Unix installations
- Forward slash paths in settings.json for cross-platform compatibility

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove all migration functions (migrate_config_to_json, migrate_messages_to_json)
- Simplify load_config() to only read JSON format
- Simplify load_language_messages() to only read JSON format
- Delete old bash message files (messages/*.sh)
- Reduce code complexity by ~100 lines

Breaking change: Users must use JSON format for messages and config.
The installer (install.sh and install.ps1) already installs JSON files.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Update CLAUDE.md: remove all bash format references, document JSON structure
- Update messages/README.md: complete rewrite for JSON format with examples
- Update tests/shellcheck.sh: remove references to deleted .sh message files
- Update tests/unit.sh: load JSON messages, validate JSON structure
- Fix shellcheck warnings: add default case, add disable comment

Changes ensure consistency across all documentation and code:
- No more references to .sh message files
- All examples use JSON format
- Tests validate JSON structure instead of bash syntax
- Configuration documented as JSON format

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The MESSAGES_DIR variable is defined as readonly during source,
so it must be exported before sourcing the script. This ensures
tests work in CI environments where ~/.claude/messages doesn't exist.

Changes:
- Export MESSAGES_DIR before source in unit tests
- Remove warning message (no longer needed)
- Tests now work in clean CI environments

Fixes CI pipeline failure.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fix two critical issues preventing statusline from working on Windows:

1. Strip carriage returns (CRLF) from jq output when parsing JSON
   - Windows jq outputs CRLF line endings which break bash arithmetic
   - Added explicit stripping of \r from all parsed variables

2. Force C locale for printf decimal formatting
   - Git Bash on Windows may use locales with comma decimal separators
   - LC_NUMERIC=C ensures consistent decimal point formatting for cost

Tested on Windows with Git Bash 5.2.37 (MSYS).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Simplify JSON message files (remove metadata, flatten structure)
- Add @CONFIG_START/@CONFIG_END block with SHOW_MESSAGES/SHOW_COST flags
- Add @MESSAGES_START/@MESSAGES_END block with hardcoded English arrays
- Refactor get_context_message() to use bash arrays instead of pipe-delimited strings
- Remove obsolete i18n functions (load_config, load_language_messages, load_json_messages)
- Update main() to remove config loading code
- Update build_context_component() and build_cost_component() to read global constants
- Create patch-statusline.sh script for build-time patching
- Add comprehensive design document

Performance impact: Eliminates 3-5ms runtime i18n overhead

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove load_language_messages() call from unit tests (messages now hardcoded)
- Update component toggle tests to use global SHOW_MESSAGES/SHOW_COST constants
- Fix language file tests to match simplified JSON format (no .tiers nesting)
- All tests pass (76 unit tests, 24 integration tests)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
README.md:
- Add patch-statusline.sh usage examples
- Document two configuration options (installer vs patch script)
- Explain zero runtime overhead benefit

CLAUDE.md:
- Update i18n architecture to describe static patching
- Remove references to dynamic loading functions
- Update performance targets (0ms i18n overhead)
- Update fallback mechanisms section
- Update file locations (add patch script, remove config files)

messages/README.md:
- Document simplified JSON format (no metadata, no nesting)
- Update "Adding a New Language" workflow
- Replace dynamic testing with patch-based testing
- Add "How Patching Works" section explaining transformation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use chmod --reference to copy original file permissions to temp file
before moving it. Falls back to chmod +x if --reference not available
(some systems don't support it).

This ensures patched statusline.sh remains executable after patching.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@glauberlima glauberlima force-pushed the feat/windows-installer-json-i18n branch from 57500c3 to eb2b091 Compare February 4, 2026 18:00
@glauberlima glauberlima force-pushed the feat/windows-installer-json-i18n branch from e4041f5 to 0b46876 Compare February 4, 2026 18:31
Removed circular tests, consolidated redundant coverage, and fixed broken
references while strengthening assertions and adding output validation.

Changes:
- Fix shellcheck: Replace deleted install.sh with patch-statusline.sh
- Remove circular tests: Delete detect_terminal_chars() tests (only in test file)
- Consolidate format_number(): Reduce from 13 to 8 boundary tests
- Strengthen tier tests: Verify get_context_tier() correctness vs "non-empty"
- Add fixture test: Utilize tests/fixtures/test-input.json with validation
- Enhance integration: Add optional output validation to catch silent failures
- Fix shellcheck style: Array bracing, grouped redirects, variable bracing

Results:
- Unit tests: 76 → 65 (-11 redundant)
- Integration tests: 24 → 25 (+1 fixture)
- Shellcheck: FAILING → PASSING
- Pass rate: 99% → 100%

All 90 tests pass. Preserved all security, i18n, and UTF-8 tests.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@glauberlima glauberlima closed this Feb 4, 2026
@glauberlima glauberlima deleted the feat/windows-installer-json-i18n branch February 4, 2026 19:03
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