diff --git a/openspec/changes/i18n-support/apply-progress.md b/openspec/changes/i18n-support/apply-progress.md new file mode 100644 index 00000000..ae999fe6 --- /dev/null +++ b/openspec/changes/i18n-support/apply-progress.md @@ -0,0 +1,81 @@ +# Apply Progress: i18n Support + +## Status: Phase 1 & 2 COMPLETE + +--- + +## Phase 1: CLI & Agent Responses ✅ + +### Task 1: Add language field to Settings ✅ +- **File**: `strix/config/settings.py` +- **Status**: Complete +- **Commit**: feat/i18n-spanish branch + +### Task 2: Add --language CLI flag ✅ +- **File**: `strix/interface/cli_args.py` +- **Status**: Complete +- **Commit**: feat/i18n-spanish branch + +### Task 3: Inject language directive into agent prompts ✅ +- **Files**: `strix/agents/prompt.py`, `strix/agents/prompts/system_prompt.jinja` +- **Status**: Complete +- **Commit**: feat/i18n-spanish branch + +### Task 4: Integrate t() into main CLI messages ✅ +- **Files**: `strix/interface/main.py`, `strix/interface/cli.py` +- **Status**: Complete +- **Commit**: feat/i18n-spanish branch + +### Task 5: Add tests ✅ +- **File**: `tests/test_i18n.py` +- **Status**: Complete (34 tests passing) +- **Commit**: feat/i18n-spanish branch + +### Task 6: Verify with make check-all ✅ +- **Status**: Complete +- **Result**: PASS (ruff, mypy, bandit, pytest) + +--- + +## Phase 2: Report Translations ✅ + +### Task 7: Add report translation keys ✅ +- **Files**: `strix/locales/en.json`, `strix/locales/es.json` +- **Status**: Complete (18 keys added) +- **Commit**: fc554a8 + +### Task 8: Translate report writer ✅ +- **File**: `strix/report/writer.py` +- **Status**: Complete +- **Commit**: fc554a8 + +### Task 9: Add Phase 2 tests ✅ +- **File**: `tests/test_i18n.py` +- **Status**: Complete +- **Commit**: fc554a8 + +--- + +## Phase 3: Go TUI (PENDING) + +- **Status**: Not started +- **Scope**: ~300 strings across 45 Go files +- **Location**: `strix/interface/tui/internal/` + +--- + +## Phase 4: React Viewer (PENDING) + +- **Status**: Not started +- **Scope**: UI strings in `strix/interface/viewer/frontend/src/` + +--- + +## Summary + +| Phase | Status | Tasks | Tests | +|-------|--------|-------|-------| +| Phase 1 | ✅ Complete | 6/6 | 34/34 | +| Phase 2 | ✅ Complete | 3/3 | ✅ | +| Phase 3 | ⏳ Pending | 0 | - | +| Phase 4 | ⏳ Pending | 0 | - | diff --git a/openspec/changes/i18n-support/tasks.md b/openspec/changes/i18n-support/tasks.md index 00699802..1faeca52 100644 --- a/openspec/changes/i18n-support/tasks.md +++ b/openspec/changes/i18n-support/tasks.md @@ -1,4 +1,4 @@ -# Tasks: i18n Support — Phase 1 +# Tasks: i18n Support — Phase 1 & 2 ## Review Workload Forecast @@ -8,7 +8,9 @@ --- -## Task 1: Add language field to Settings +## Phase 1: CLI & Agent Responses ✅ COMPLETE + +## Task 1: Add language field to Settings ✅ **File**: `strix/config/settings.py` @@ -30,7 +32,7 @@ class Settings(BaseSettings): --- -## Task 2: Add --language CLI flag +## Task 2: Add --language CLI flag ✅ **File**: `strix/interface/cli_args.py` @@ -63,7 +65,7 @@ if args.language: --- -## Task 3: Inject language directive into agent prompts +## Task 3: Inject language directive into agent prompts ✅ **Files**: - `strix/agents/prompt.py` @@ -101,7 +103,7 @@ rendered = env.get_template("system_prompt.jinja").render( --- -## Task 4: Integrate t() into main CLI messages +## Task 4: Integrate t() into main CLI messages ✅ **File**: `strix/interface/main.py` @@ -131,7 +133,7 @@ Key strings to translate: --- -## Task 5: Add tests +## Task 5: Add tests ✅ **File**: `tests/test_i18n.py` @@ -159,7 +161,7 @@ def test_all_en_keys_exist_in_es() --- -## Task 6: Verify with make check-all +## Task 6: Verify with make check-all ✅ **Description**: Run full quality suite to ensure no regressions. @@ -189,3 +191,111 @@ Task 3 (Jinja) ─────┘ ├──> Task 4 (Main ``` Tasks 1 and 3 can be done in parallel. Task 2 depends on Task 1. Task 4 depends on Task 2. Task 5 depends on all. Task 6 is final verification. + +--- + +## Phase 2: Report Translations ✅ COMPLETE + +## Task 7: Add report translation keys ✅ + +**Files**: +- `strix/locales/en.json` +- `strix/locales/es.json` + +**Description**: Add 18 translation keys for report headings and metadata labels. + +**Keys added**: +- `report.title` — Executive report title +- `report.generated` — Generated timestamp label +- `report.description` — Description section heading +- `report.evidence` — Evidence section heading +- `report.impact` — Impact section heading +- `report.severity` — Severity metadata label +- `report.target` — Target metadata label +- `report.package` — Package metadata label +- `report.remediation` — Remediation section heading +- `report.references` — References section heading +- `report.cvss_score` — CVSS score label +- `report.cwe_id` — CWE ID label +- `report.affected_versions` — Affected versions label +- `report.fixed_versions` — Fixed versions label +- `report.proof_of_concept` — Proof of concept heading +- `report.steps_to_reproduce` — Steps to reproduce heading +- `report.expected_result` — Expected result label +- `report.actual_result` — Actual result label + +**Acceptance**: +- [x] All 18 keys exist in en.json +- [x] All 18 keys exist in es.json with Spanish translations +- [x] No missing keys between locales + +**Dependencies**: Task 1 (Settings.language) + +--- + +## Task 8: Translate report writer ✅ + +**File**: `strix/report/writer.py` + +**Description**: Replace hardcoded English report strings with `t()` calls. + +**Changes**: +```python +from strix.i18n import t + +# Replace strings like: +# "Description" +# With: +# t("report.description") +``` + +**Sections translated**: +- Executive report title and metadata +- Vulnerability detail headings (Description, Evidence, Impact, etc.) +- CVSS/CWE labels +- Remediation and references sections +- Proof of concept sections + +**Acceptance**: +- [x] `--language es` → Spanish report headings +- [x] `--language en` → English report headings (default) +- [x] SARIF and vulnerabilities.json stay English + +**Dependencies**: Task 7 + +--- + +## Task 9: Add Phase 2 tests ✅ + +**File**: `tests/test_i18n.py` + +**Description**: Add tests for report translation keys. + +**Test cases added**: +```python +def test_report_keys_exist_in_both_locales() +def test_report_t_returns_spanish_when_language_set() +def test_report_t_returns_english_by_default() +``` + +**Acceptance**: +- [x] `uv run pytest tests/test_i18n.py -v` passes +- [x] All report keys validated + +**Dependencies**: Task 7, Task 8 + +--- + +## Phase 3: Go TUI (PENDING) + +**Status**: Not started +**Scope**: ~300 strings across 45 Go files in `strix/interface/tui/internal/` +**Approach**: Backend socket serves locale JSON; Go code calls translation function + +--- + +## Phase 4: React Viewer (PENDING) + +**Status**: Not started +**Scope**: UI strings in `strix/interface/viewer/frontend/src/` +**Approach**: Fetch locale JSON; React hooks for translations diff --git a/openspec/changes/i18n-support/verify-report.md b/openspec/changes/i18n-support/verify-report.md new file mode 100644 index 00000000..f0d49632 --- /dev/null +++ b/openspec/changes/i18n-support/verify-report.md @@ -0,0 +1,70 @@ +# Verify Report: i18n Support + +## Status: PASS + +--- + +## Verification Summary + +| Phase | Status | Requirements | Tests | +|-------|--------|--------------|-------| +| Phase 1 | ✅ PASS | 6/6 | 34/34 | +| Phase 2 | ✅ PASS | 3/3 | ✅ | + +--- + +## Phase 1: CLI & Agent Responses + +### Requirements Verification + +| # | Requirement | Implementation | Status | +|---|-------------|----------------|--------| +| 1 | Settings.language field | `strix/config/settings.py` | ✅ PASS | +| 2 | STRIX_LANGUAGE env var | pydantic-settings alias | ✅ PASS | +| 3 | --language CLI flag | `strix/interface/cli_args.py` | ✅ PASS | +| 4 | Language directive injection | Jinja template | ✅ PASS | +| 5 | t() integration | main.py, cli.py | ✅ PASS | +| 6 | Tests | test_i18n.py | ✅ PASS | + +### Test Results +``` +uv run pytest tests/test_i18n.py -v +34 passed +``` + +### Code Quality +``` +make check-all +✓ ruff (linting) +✓ mypy (type checking) +✓ bandit (security) +✓ pytest (tests) +``` + +--- + +## Phase 2: Report Translations + +### Requirements Verification + +| # | Requirement | Implementation | Status | +|---|-------------|----------------|--------| +| 1 | Report translation keys | en.json, es.json (18 keys) | ✅ PASS | +| 2 | Report writer integration | strix/report/writer.py | ✅ PASS | +| 3 | SARIF/JSON stay English | Exports unaffected | ✅ PASS | + +### Test Results +- Report keys exist in both locales: ✅ +- Translation function works correctly: ✅ +- No regressions: ✅ + +--- + +## Verdict + +**PASS** — All Phase 1 & 2 requirements implemented and verified. + +## Remaining Work + +- Phase 3: Go TUI (~300 strings, 45 files) +- Phase 4: React viewer