@harness-engineering/cli 1.7.0 → 1.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/dist/agents/personas/documentation-maintainer.yaml +3 -1
  2. package/dist/agents/personas/performance-guardian.yaml +23 -0
  3. package/dist/agents/skills/claude-code/align-documentation/SKILL.md +13 -0
  4. package/dist/agents/skills/claude-code/cleanup-dead-code/SKILL.md +25 -1
  5. package/dist/agents/skills/claude-code/cleanup-dead-code/skill.yaml +5 -2
  6. package/dist/agents/skills/claude-code/detect-doc-drift/SKILL.md +12 -0
  7. package/dist/agents/skills/claude-code/enforce-architecture/SKILL.md +48 -1
  8. package/dist/agents/skills/claude-code/enforce-architecture/skill.yaml +5 -2
  9. package/dist/agents/skills/claude-code/harness-accessibility/SKILL.md +7 -0
  10. package/dist/agents/skills/claude-code/harness-autopilot/SKILL.md +11 -3
  11. package/dist/agents/skills/claude-code/harness-brainstorming/SKILL.md +81 -11
  12. package/dist/agents/skills/claude-code/harness-brainstorming/skill.yaml +2 -0
  13. package/dist/agents/skills/claude-code/harness-code-review/SKILL.md +487 -234
  14. package/dist/agents/skills/claude-code/harness-code-review/skill.yaml +15 -2
  15. package/dist/agents/skills/claude-code/harness-codebase-cleanup/SKILL.md +226 -0
  16. package/dist/agents/skills/claude-code/harness-codebase-cleanup/skill.yaml +64 -0
  17. package/dist/agents/skills/claude-code/harness-dependency-health/SKILL.md +35 -6
  18. package/dist/agents/skills/claude-code/harness-docs-pipeline/SKILL.md +460 -0
  19. package/dist/agents/skills/claude-code/harness-docs-pipeline/skill.yaml +69 -0
  20. package/dist/agents/skills/claude-code/harness-execution/SKILL.md +73 -8
  21. package/dist/agents/skills/claude-code/harness-execution/skill.yaml +1 -0
  22. package/dist/agents/skills/claude-code/harness-hotspot-detector/SKILL.md +32 -6
  23. package/dist/agents/skills/claude-code/harness-i18n/SKILL.md +484 -0
  24. package/dist/agents/skills/claude-code/harness-i18n/skill.yaml +54 -0
  25. package/dist/agents/skills/claude-code/harness-i18n-process/SKILL.md +388 -0
  26. package/dist/agents/skills/claude-code/harness-i18n-process/skill.yaml +43 -0
  27. package/dist/agents/skills/claude-code/harness-i18n-workflow/SKILL.md +512 -0
  28. package/dist/agents/skills/claude-code/harness-i18n-workflow/skill.yaml +53 -0
  29. package/dist/agents/skills/claude-code/harness-impact-analysis/SKILL.md +35 -6
  30. package/dist/agents/skills/claude-code/harness-integrity/SKILL.md +17 -1
  31. package/dist/agents/skills/claude-code/harness-knowledge-mapper/SKILL.md +46 -5
  32. package/dist/agents/skills/claude-code/harness-perf/SKILL.md +37 -8
  33. package/dist/agents/skills/claude-code/harness-perf/skill.yaml +3 -0
  34. package/dist/agents/skills/claude-code/harness-perf-tdd/SKILL.md +17 -4
  35. package/dist/agents/skills/claude-code/harness-planning/SKILL.md +59 -5
  36. package/dist/agents/skills/claude-code/harness-planning/skill.yaml +2 -0
  37. package/dist/agents/skills/claude-code/harness-release-readiness/SKILL.md +16 -0
  38. package/dist/agents/skills/claude-code/harness-roadmap/SKILL.md +561 -0
  39. package/dist/agents/skills/claude-code/harness-roadmap/skill.yaml +43 -0
  40. package/dist/agents/skills/claude-code/harness-security-review/SKILL.md +36 -2
  41. package/dist/agents/skills/claude-code/harness-security-review/skill.yaml +8 -6
  42. package/dist/agents/skills/claude-code/harness-soundness-review/SKILL.md +1267 -0
  43. package/dist/agents/skills/claude-code/harness-soundness-review/skill.yaml +48 -0
  44. package/dist/agents/skills/claude-code/harness-test-advisor/SKILL.md +35 -6
  45. package/dist/agents/skills/claude-code/harness-verification/SKILL.md +66 -0
  46. package/dist/agents/skills/claude-code/harness-verification/skill.yaml +1 -0
  47. package/dist/agents/skills/claude-code/harness-verify/SKILL.md +11 -0
  48. package/dist/agents/skills/claude-code/initialize-harness-project/SKILL.md +15 -1
  49. package/dist/agents/skills/claude-code/validate-context-engineering/SKILL.md +12 -0
  50. package/dist/agents/skills/gemini-cli/add-harness-component/SKILL.md +192 -0
  51. package/dist/agents/skills/gemini-cli/add-harness-component/skill.yaml +32 -0
  52. package/dist/agents/skills/gemini-cli/align-documentation/SKILL.md +213 -0
  53. package/dist/agents/skills/gemini-cli/align-documentation/skill.yaml +31 -0
  54. package/dist/agents/skills/gemini-cli/check-mechanical-constraints/SKILL.md +191 -0
  55. package/dist/agents/skills/gemini-cli/check-mechanical-constraints/skill.yaml +32 -0
  56. package/dist/agents/skills/gemini-cli/cleanup-dead-code/SKILL.md +245 -0
  57. package/dist/agents/skills/gemini-cli/cleanup-dead-code/skill.yaml +33 -0
  58. package/dist/agents/skills/gemini-cli/detect-doc-drift/SKILL.md +179 -0
  59. package/dist/agents/skills/gemini-cli/detect-doc-drift/skill.yaml +30 -0
  60. package/dist/agents/skills/gemini-cli/enforce-architecture/SKILL.md +240 -0
  61. package/dist/agents/skills/gemini-cli/enforce-architecture/skill.yaml +34 -0
  62. package/dist/agents/skills/gemini-cli/harness-accessibility/SKILL.md +7 -0
  63. package/dist/agents/skills/gemini-cli/harness-architecture-advisor/SKILL.md +397 -0
  64. package/dist/agents/skills/gemini-cli/harness-architecture-advisor/skill.yaml +48 -0
  65. package/dist/agents/skills/gemini-cli/harness-autopilot/SKILL.md +11 -3
  66. package/dist/agents/skills/gemini-cli/harness-brainstorming/SKILL.md +317 -0
  67. package/dist/agents/skills/gemini-cli/harness-brainstorming/skill.yaml +49 -0
  68. package/dist/agents/skills/gemini-cli/harness-code-review/SKILL.md +681 -0
  69. package/dist/agents/skills/gemini-cli/harness-code-review/skill.yaml +45 -0
  70. package/dist/agents/skills/gemini-cli/harness-codebase-cleanup/SKILL.md +226 -0
  71. package/dist/agents/skills/gemini-cli/harness-codebase-cleanup/skill.yaml +64 -0
  72. package/dist/agents/skills/gemini-cli/harness-debugging/SKILL.md +366 -0
  73. package/dist/agents/skills/gemini-cli/harness-debugging/skill.yaml +47 -0
  74. package/dist/agents/skills/gemini-cli/harness-dependency-health/SKILL.md +35 -6
  75. package/dist/agents/skills/gemini-cli/harness-diagnostics/SKILL.md +318 -0
  76. package/dist/agents/skills/gemini-cli/harness-diagnostics/skill.yaml +50 -0
  77. package/dist/agents/skills/gemini-cli/harness-docs-pipeline/SKILL.md +460 -0
  78. package/dist/agents/skills/gemini-cli/harness-docs-pipeline/skill.yaml +69 -0
  79. package/dist/agents/skills/gemini-cli/harness-execution/SKILL.md +382 -0
  80. package/dist/agents/skills/gemini-cli/harness-execution/skill.yaml +51 -0
  81. package/dist/agents/skills/gemini-cli/harness-git-workflow/SKILL.md +268 -0
  82. package/dist/agents/skills/gemini-cli/harness-git-workflow/skill.yaml +31 -0
  83. package/dist/agents/skills/gemini-cli/harness-hotspot-detector/SKILL.md +32 -6
  84. package/dist/agents/skills/gemini-cli/harness-i18n/SKILL.md +484 -0
  85. package/dist/agents/skills/gemini-cli/harness-i18n/skill.yaml +54 -0
  86. package/dist/agents/skills/gemini-cli/harness-i18n-process/SKILL.md +388 -0
  87. package/dist/agents/skills/gemini-cli/harness-i18n-process/skill.yaml +43 -0
  88. package/dist/agents/skills/gemini-cli/harness-i18n-workflow/SKILL.md +512 -0
  89. package/dist/agents/skills/gemini-cli/harness-i18n-workflow/skill.yaml +53 -0
  90. package/dist/agents/skills/gemini-cli/harness-impact-analysis/SKILL.md +35 -6
  91. package/dist/agents/skills/gemini-cli/harness-integrity/SKILL.md +167 -0
  92. package/dist/agents/skills/gemini-cli/harness-integrity/skill.yaml +47 -0
  93. package/dist/agents/skills/gemini-cli/harness-knowledge-mapper/SKILL.md +46 -5
  94. package/dist/agents/skills/gemini-cli/harness-onboarding/SKILL.md +288 -0
  95. package/dist/agents/skills/gemini-cli/harness-onboarding/skill.yaml +30 -0
  96. package/dist/agents/skills/gemini-cli/harness-parallel-agents/SKILL.md +171 -0
  97. package/dist/agents/skills/gemini-cli/harness-parallel-agents/skill.yaml +33 -0
  98. package/dist/agents/skills/gemini-cli/harness-perf/SKILL.md +37 -8
  99. package/dist/agents/skills/gemini-cli/harness-perf/skill.yaml +3 -0
  100. package/dist/agents/skills/gemini-cli/harness-perf-tdd/SKILL.md +17 -4
  101. package/dist/agents/skills/gemini-cli/harness-planning/SKILL.md +389 -0
  102. package/dist/agents/skills/gemini-cli/harness-planning/skill.yaml +49 -0
  103. package/dist/agents/skills/gemini-cli/harness-pre-commit-review/SKILL.md +262 -0
  104. package/dist/agents/skills/gemini-cli/harness-pre-commit-review/skill.yaml +33 -0
  105. package/dist/agents/skills/gemini-cli/harness-refactoring/SKILL.md +169 -0
  106. package/dist/agents/skills/gemini-cli/harness-refactoring/skill.yaml +33 -0
  107. package/dist/agents/skills/gemini-cli/harness-release-readiness/SKILL.md +16 -0
  108. package/dist/agents/skills/gemini-cli/harness-roadmap/SKILL.md +561 -0
  109. package/dist/agents/skills/gemini-cli/harness-roadmap/skill.yaml +43 -0
  110. package/dist/agents/skills/gemini-cli/harness-security-review/skill.yaml +8 -6
  111. package/dist/agents/skills/gemini-cli/harness-skill-authoring/SKILL.md +292 -0
  112. package/dist/agents/skills/gemini-cli/harness-skill-authoring/skill.yaml +32 -0
  113. package/dist/agents/skills/gemini-cli/harness-soundness-review/SKILL.md +1267 -0
  114. package/dist/agents/skills/gemini-cli/harness-soundness-review/skill.yaml +48 -0
  115. package/dist/agents/skills/gemini-cli/harness-state-management/SKILL.md +309 -0
  116. package/dist/agents/skills/gemini-cli/harness-state-management/skill.yaml +32 -0
  117. package/dist/agents/skills/gemini-cli/harness-tdd/SKILL.md +177 -0
  118. package/dist/agents/skills/gemini-cli/harness-tdd/skill.yaml +48 -0
  119. package/dist/agents/skills/gemini-cli/harness-test-advisor/SKILL.md +35 -6
  120. package/dist/agents/skills/gemini-cli/harness-verification/SKILL.md +328 -0
  121. package/dist/agents/skills/gemini-cli/harness-verification/skill.yaml +42 -0
  122. package/dist/agents/skills/gemini-cli/harness-verify/SKILL.md +159 -0
  123. package/dist/agents/skills/gemini-cli/harness-verify/skill.yaml +40 -0
  124. package/dist/agents/skills/gemini-cli/initialize-harness-project/SKILL.md +224 -0
  125. package/dist/agents/skills/gemini-cli/initialize-harness-project/skill.yaml +31 -0
  126. package/dist/agents/skills/gemini-cli/validate-context-engineering/SKILL.md +150 -0
  127. package/dist/agents/skills/gemini-cli/validate-context-engineering/skill.yaml +31 -0
  128. package/dist/agents/skills/shared/i18n-knowledge/accessibility/intersection.yaml +142 -0
  129. package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/encoding.yaml +67 -0
  130. package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/formatting.yaml +106 -0
  131. package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/layout.yaml +80 -0
  132. package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/pluralization.yaml +80 -0
  133. package/dist/agents/skills/shared/i18n-knowledge/anti-patterns/string-handling.yaml +106 -0
  134. package/dist/agents/skills/shared/i18n-knowledge/frameworks/android-resources.yaml +47 -0
  135. package/dist/agents/skills/shared/i18n-knowledge/frameworks/apple-strings.yaml +47 -0
  136. package/dist/agents/skills/shared/i18n-knowledge/frameworks/backend-patterns.yaml +50 -0
  137. package/dist/agents/skills/shared/i18n-knowledge/frameworks/flutter-intl.yaml +47 -0
  138. package/dist/agents/skills/shared/i18n-knowledge/frameworks/i18next.yaml +47 -0
  139. package/dist/agents/skills/shared/i18n-knowledge/frameworks/react-intl.yaml +47 -0
  140. package/dist/agents/skills/shared/i18n-knowledge/frameworks/vue-i18n.yaml +47 -0
  141. package/dist/agents/skills/shared/i18n-knowledge/industries/ecommerce.yaml +66 -0
  142. package/dist/agents/skills/shared/i18n-knowledge/industries/fintech.yaml +66 -0
  143. package/dist/agents/skills/shared/i18n-knowledge/industries/gaming.yaml +69 -0
  144. package/dist/agents/skills/shared/i18n-knowledge/industries/healthcare.yaml +66 -0
  145. package/dist/agents/skills/shared/i18n-knowledge/industries/legal.yaml +66 -0
  146. package/dist/agents/skills/shared/i18n-knowledge/locales/ar.yaml +41 -0
  147. package/dist/agents/skills/shared/i18n-knowledge/locales/de.yaml +35 -0
  148. package/dist/agents/skills/shared/i18n-knowledge/locales/en.yaml +32 -0
  149. package/dist/agents/skills/shared/i18n-knowledge/locales/es.yaml +35 -0
  150. package/dist/agents/skills/shared/i18n-knowledge/locales/fi.yaml +35 -0
  151. package/dist/agents/skills/shared/i18n-knowledge/locales/fr.yaml +35 -0
  152. package/dist/agents/skills/shared/i18n-knowledge/locales/he.yaml +41 -0
  153. package/dist/agents/skills/shared/i18n-knowledge/locales/hi.yaml +35 -0
  154. package/dist/agents/skills/shared/i18n-knowledge/locales/it.yaml +32 -0
  155. package/dist/agents/skills/shared/i18n-knowledge/locales/ja.yaml +38 -0
  156. package/dist/agents/skills/shared/i18n-knowledge/locales/ko.yaml +38 -0
  157. package/dist/agents/skills/shared/i18n-knowledge/locales/nl.yaml +32 -0
  158. package/dist/agents/skills/shared/i18n-knowledge/locales/pl.yaml +35 -0
  159. package/dist/agents/skills/shared/i18n-knowledge/locales/pt.yaml +32 -0
  160. package/dist/agents/skills/shared/i18n-knowledge/locales/ru.yaml +35 -0
  161. package/dist/agents/skills/shared/i18n-knowledge/locales/sv.yaml +32 -0
  162. package/dist/agents/skills/shared/i18n-knowledge/locales/th.yaml +35 -0
  163. package/dist/agents/skills/shared/i18n-knowledge/locales/tr.yaml +35 -0
  164. package/dist/agents/skills/shared/i18n-knowledge/locales/zh-Hans.yaml +38 -0
  165. package/dist/agents/skills/shared/i18n-knowledge/locales/zh-Hant.yaml +35 -0
  166. package/dist/agents/skills/shared/i18n-knowledge/mcp-interop/i18next-mcp.yaml +56 -0
  167. package/dist/agents/skills/shared/i18n-knowledge/mcp-interop/lingo-dev.yaml +56 -0
  168. package/dist/agents/skills/shared/i18n-knowledge/mcp-interop/lokalise.yaml +60 -0
  169. package/dist/agents/skills/shared/i18n-knowledge/mcp-interop/tolgee.yaml +60 -0
  170. package/dist/agents/skills/shared/i18n-knowledge/testing/locale-testing.yaml +107 -0
  171. package/dist/agents/skills/shared/i18n-knowledge/testing/pseudo-localization.yaml +86 -0
  172. package/dist/bin/harness.js +64 -4
  173. package/dist/{chunk-GA6GN5J2.js → chunk-E2RTDBMG.js} +2263 -41
  174. package/dist/{chunk-FFIX3QVG.js → chunk-KJANDVVC.js} +141 -49
  175. package/dist/{chunk-4WUGOJQ7.js → chunk-RT2LYQHF.js} +1 -1
  176. package/dist/{dist-C4J67MPP.js → dist-CCM3L3UE.js} +95 -1
  177. package/dist/{dist-N4D4QWFV.js → dist-K6KTTN3I.js} +4 -4
  178. package/dist/index.d.ts +187 -7
  179. package/dist/index.js +7 -3
  180. package/dist/validate-cross-check-ZGKFQY57.js +7 -0
  181. package/package.json +9 -9
  182. package/dist/agents/skills/node_modules/.bin/glob +0 -17
  183. package/dist/agents/skills/node_modules/.bin/vitest +0 -17
  184. package/dist/agents/skills/node_modules/.bin/yaml +0 -17
  185. package/dist/templates/advanced/docs/specs/.gitkeep +0 -0
  186. package/dist/templates/intermediate/docs/specs/.gitkeep +0 -0
  187. package/dist/validate-cross-check-WGXQ7K62.js +0 -7
@@ -0,0 +1,224 @@
1
+ # Initialize Harness Project
2
+
3
+ > Scaffold a new harness-compliant project or migrate an existing project to the next adoption level. Assess current state, configure personas, generate AGENTS.md, and validate the result.
4
+
5
+ ## When to Use
6
+
7
+ - Starting a brand new project that should be harness-managed from day one
8
+ - Migrating an existing project to harness for the first time
9
+ - Upgrading an existing harness project from one adoption level to the next (basic to intermediate, intermediate to advanced)
10
+ - When `on_project_init` triggers fire
11
+ - NOT when the project is already at the desired adoption level (use harness-onboarding to orient instead)
12
+ - NOT when adding a single component to an existing harness project (use add-harness-component)
13
+ - NOT when the project has no clear owner or maintainer — harness setup requires someone to own the constraints
14
+
15
+ ## Process
16
+
17
+ ### Phase 1: ASSESS — Determine Current State
18
+
19
+ 1. **Check for existing harness configuration.** Look for `.harness/` directory, `AGENTS.md`, `harness.yaml`, and any skill definitions. Their presence determines whether this is a new project or a migration.
20
+
21
+ 2. **For new projects:** Gather project context — language, framework, test runner, build tool. Ask the human if any of these are undecided. Do not assume defaults.
22
+
23
+ 3. **For existing projects:** Run `harness validate` to see what is already configured and what is missing. Read `AGENTS.md` if it exists. Identify the current adoption level:
24
+ - **Basic:** Has `AGENTS.md` and `harness.yaml` with project metadata. No layers, no skills, no dependency constraints.
25
+ - **Intermediate:** Has layers defined, dependency constraints between layers, at least one custom skill. `harness check-deps` runs and passes.
26
+ - **Advanced:** Has full persona configuration, custom skills for the team's workflows, state management, learnings capture, and CI integration for `harness validate`.
27
+
28
+ 4. **Recommend the target adoption level.** For new projects, start with basic unless the team has harness experience. For existing projects, recommend one level up from current. Present the recommendation and wait for confirmation.
29
+
30
+ ### Phase 2: SCAFFOLD — Generate Project Structure
31
+
32
+ 1. **Run `harness init` with the appropriate flags:**
33
+ - New basic project: `harness init --level basic --framework <framework>`
34
+ - New intermediate project: `harness init --level intermediate --framework <framework>`
35
+ - Migration to intermediate: `harness init --level intermediate --migrate`
36
+ - Migration to advanced: `harness init --level advanced --migrate`
37
+
38
+ 2. **Review generated files.** `harness init` creates:
39
+ - `harness.yaml` — Project configuration (name, stack, adoption level)
40
+ - `.harness/` directory — State and learnings storage
41
+ - `AGENTS.md` — Agent instructions (template, needs customization)
42
+ - Layer definitions (intermediate and above)
43
+ - Dependency constraints (intermediate and above)
44
+
45
+ 3. **Do not blindly accept generated content.** Read the generated `AGENTS.md` and `harness.yaml`. Flag anything that looks wrong or incomplete. The scaffolded output is a starting point, not a finished product.
46
+
47
+ ### Phase 3: CONFIGURE — Customize for the Project
48
+
49
+ 1. **Configure personas.** Run `harness persona generate` to create persona definitions based on the project's stack and team structure. Personas define how agents should behave in this project — coding style, communication preferences, constraint strictness.
50
+
51
+ 2. **Customize AGENTS.md.** The generated template needs project-specific content:
52
+ - Project description and purpose
53
+ - Architecture overview (components, layers, data flow)
54
+ - Key conventions the team follows
55
+ - Known constraints and forbidden patterns
56
+ - Links to relevant documentation
57
+
58
+ 3. **For intermediate and above:** Define layer boundaries. Which modules belong to which layers? What are the allowed import directions? Document these in `harness.yaml` and ensure they match the actual codebase structure.
59
+
60
+ 4. **For advanced:** Configure state management (`.harness/state.json` schema), learnings capture (`.harness/learnings.md` conventions), and CI integration hooks.
61
+
62
+ 5. **Configure i18n (all levels).** Ask: "Will this project support multiple languages?" Based on the answer:
63
+ - **Yes:** Invoke `harness-i18n-workflow` configure phase to set up i18n config in `harness.config.json` (source locale, target locales, framework, strictness). Then invoke `harness-i18n-workflow` scaffold phase to create translation file structure and extraction config. Set `i18n.enabled: true`.
64
+ - **No:** Set `i18n.enabled: false` in `harness.config.json`. The `harness-i18n-process` skill will still fire gentle prompts for unconfigured projects when features touch user-facing strings.
65
+ - **Not sure yet:** Skip i18n configuration entirely. Do not set `i18n.enabled`. The project can enable i18n later by running `harness-i18n-workflow` directly.
66
+
67
+ ### Phase 4: VALIDATE — Confirm Everything Works
68
+
69
+ 1. **Run `harness validate`** to verify the full configuration. This checks:
70
+ - `harness.yaml` schema validity
71
+ - `AGENTS.md` presence and required sections
72
+ - Layer definitions (if intermediate+)
73
+ - Dependency constraints (if intermediate+)
74
+ - Persona configuration (if configured)
75
+
76
+ 2. **Fix any validation errors before finishing.** Do not leave the project in a half-configured state.
77
+
78
+ 3. **Run `harness check-deps`** (intermediate and above) to verify dependency constraints match the actual codebase. If there are violations, decide with the human: update the constraints or fix the code.
79
+
80
+ ### Build the Initial Knowledge Graph
81
+
82
+ If the project will use graph-based queries, build the initial knowledge graph now:
83
+
84
+ ```
85
+ harness scan [path]
86
+ ```
87
+
88
+ This creates the `.harness/graph/` directory and populates it with the project's dependency and relationship data. Subsequent graph queries (impact analysis, dependency health, test advisor) depend on this initial scan.
89
+
90
+ 4. **Mention roadmap.** After validation passes, inform the user: "When you are ready to set up a project roadmap, run `/harness:roadmap --create`. This creates a unified `docs/roadmap.md` that tracks features, milestones, and status across your specs and plans." This is informational only — do not create the roadmap automatically.
91
+
92
+ 5. **Commit the initialization.** All generated and configured files in a single commit.
93
+
94
+ ## Harness Integration
95
+
96
+ - **`harness init --level <level> --framework <framework>`** — Scaffold a new project at the specified adoption level.
97
+ - **`harness init --level <level> --migrate`** — Migrate an existing project to the next adoption level, preserving existing configuration.
98
+ - **`harness persona generate`** — Generate persona definitions based on project stack and team structure.
99
+ - **`harness validate`** — Verify the full project configuration is valid and complete.
100
+ - **`harness check-deps`** — Verify dependency constraints match the actual codebase (intermediate and above).
101
+ - **`harness-i18n-workflow configure` + `harness-i18n-workflow scaffold`** — Invoked during Phase 3 if the project will support multiple languages. Sets up i18n configuration and translation file structure.
102
+ - **Roadmap nudge** — After successful initialization, inform the user about `/harness:roadmap --create` for setting up project-level feature tracking. Informational only; does not create the roadmap.
103
+
104
+ ## Success Criteria
105
+
106
+ - `harness.yaml` exists and passes schema validation
107
+ - `AGENTS.md` exists with project-specific content (not just the template)
108
+ - `.harness/` directory exists with appropriate state files
109
+ - `harness validate` passes with zero errors
110
+ - `harness check-deps` passes (intermediate and above)
111
+ - Personas are configured if the project uses them
112
+ - The adoption level matches what was agreed upon with the human
113
+ - All generated files are committed in a single atomic commit
114
+ - i18n configuration is set if the human chose to enable it during init
115
+
116
+ ## Examples
117
+
118
+ ### Example: New TypeScript Project (Basic Level)
119
+
120
+ **ASSESS:**
121
+
122
+ ```
123
+ Human: "I'm starting a new TypeScript API project using Express and Vitest."
124
+ Check for .harness/ — not found. This is a new project.
125
+ Recommend: basic level (new project, start simple).
126
+ Human confirms: "Basic is fine for now."
127
+ ```
128
+
129
+ **SCAFFOLD:**
130
+
131
+ ```bash
132
+ harness init --level basic --framework express
133
+ # Creates: harness.yaml, .harness/, AGENTS.md (template)
134
+ ```
135
+
136
+ **CONFIGURE:**
137
+
138
+ ```
139
+ Edit AGENTS.md:
140
+ - Add project description: "REST API for widget management"
141
+ - Add stack: TypeScript, Express, Vitest, PostgreSQL
142
+ - Add conventions: "Use zod for validation, repository pattern for data access"
143
+ - Add constraints: "No direct SQL queries outside repository layer"
144
+ - Ask: "Will this project support multiple languages?"
145
+ - Human: "Yes, Spanish and French."
146
+ - Run harness-i18n-workflow configure (source: en, targets: es, fr)
147
+ - Run harness-i18n-workflow scaffold (creates locales/ directory structure)
148
+ ```
149
+
150
+ **VALIDATE:**
151
+
152
+ ```bash
153
+ harness validate # Pass — basic level checks satisfied
154
+ git add harness.yaml .harness/ AGENTS.md
155
+ git commit -m "feat: initialize harness project at basic level"
156
+ ```
157
+
158
+ ### Example: Migrating Existing Project from Basic to Intermediate
159
+
160
+ **ASSESS:**
161
+
162
+ ```
163
+ Read harness.yaml — level: basic
164
+ Read AGENTS.md — exists, has project-specific content
165
+ Run: harness validate — passes at basic level
166
+ Recommend: intermediate (add layers and dependency constraints)
167
+ Human confirms: "Yes, we're ready for layers."
168
+ ```
169
+
170
+ **SCAFFOLD:**
171
+
172
+ ```bash
173
+ harness init --level intermediate --migrate
174
+ # Preserves existing harness.yaml and AGENTS.md
175
+ # Adds: layer definitions template, dependency constraints template
176
+ ```
177
+
178
+ **CONFIGURE:**
179
+
180
+ ```
181
+ Define layers in harness.yaml:
182
+ - presentation: src/routes/, src/middleware/
183
+ - business: src/services/, src/models/
184
+ - data: src/repositories/, src/db/
185
+
186
+ Define constraints:
187
+ - presentation → business (allowed)
188
+ - business → data (allowed)
189
+ - data → presentation (forbidden)
190
+ - presentation → data (forbidden — must go through business)
191
+
192
+ Update AGENTS.md with layer documentation.
193
+ ```
194
+
195
+ **VALIDATE:**
196
+
197
+ ```bash
198
+ harness validate # Pass — intermediate level checks satisfied
199
+ harness check-deps # Pass — no constraint violations in existing code
200
+ git add -A
201
+ git commit -m "feat: migrate harness project to intermediate level with layers"
202
+ ```
203
+
204
+ ### Example: Adoption Level Progression
205
+
206
+ **Basic (start here):**
207
+
208
+ - `AGENTS.md` with project context
209
+ - `harness.yaml` with metadata
210
+ - `harness validate` runs in development
211
+
212
+ **Intermediate (add structure):**
213
+
214
+ - Layer definitions and boundaries
215
+ - Dependency constraints enforced by `harness check-deps`
216
+ - At least one custom skill for team workflows
217
+
218
+ **Advanced (full integration):**
219
+
220
+ - Persona configuration for consistent agent behavior
221
+ - State management across sessions
222
+ - `.harness/learnings.md` capturing institutional knowledge
223
+ - `harness validate` runs in CI pipeline
224
+ - Custom skills for all common team workflows
@@ -0,0 +1,31 @@
1
+ name: initialize-harness-project
2
+ version: "1.0.0"
3
+ description: Scaffold a new harness-compliant project
4
+ cognitive_mode: constructive-architect
5
+ triggers:
6
+ - manual
7
+ - on_project_init
8
+ platforms:
9
+ - claude-code
10
+ - gemini-cli
11
+ tools:
12
+ - Bash
13
+ - Read
14
+ - Write
15
+ - Glob
16
+ cli:
17
+ command: harness skill run initialize-harness-project
18
+ args:
19
+ - name: path
20
+ description: Project root path
21
+ required: false
22
+ mcp:
23
+ tool: run_skill
24
+ input:
25
+ skill: initialize-harness-project
26
+ path: string
27
+ type: flexible
28
+ state:
29
+ persistent: false
30
+ files: []
31
+ depends_on: []
@@ -0,0 +1,150 @@
1
+ # Validate Context Engineering
2
+
3
+ > Validate AGENTS.md quality and evolve it as the codebase changes. Good context engineering means AI agents always have accurate, current knowledge about the project.
4
+
5
+ ## When to Use
6
+
7
+ - After adding new files, modules, or packages to the project
8
+ - After renaming, moving, or deleting significant files
9
+ - After changing public APIs, architectural patterns, or conventions
10
+ - When onboarding a new contributor (human or AI) and want to verify context is current
11
+ - When `on_context_check` or `on_pre_commit` triggers fire
12
+ - Periodically (weekly or per-sprint) as a hygiene check
13
+ - NOT when making trivial changes (typo fixes, comment updates, formatting)
14
+ - NOT during active feature development — run this between features or at cycle boundaries
15
+
16
+ ## Process
17
+
18
+ ### Phase 1: Audit — Run Automated Checks
19
+
20
+ 1. **Run `harness validate`** to check overall project health. Review any context-related warnings or errors in the output.
21
+
22
+ 2. **Run `harness check-docs`** to detect documentation gaps, broken links, and stale references. Capture the full output for analysis.
23
+
24
+ 3. **Review AGENTS.md manually.** Automated tools catch structural issues but miss semantic drift. Read each section and ask: "Is this still true?"
25
+
26
+ ### Graph-Enhanced Context (when available)
27
+
28
+ When a knowledge graph exists at `.harness/graph/`, use graph queries for faster, more accurate auditing:
29
+
30
+ - `query_graph` — find all undocumented code nodes (file nodes without `documents` edges), replacing manual cross-referencing
31
+ - `search_similar` — detect stale references in AGENTS.md by matching section text against current code entities
32
+
33
+ When a graph is available, it IS the source of truth for documentation coverage. Drift = stale or missing edges between code and doc nodes. Fall back to file-based commands if no graph is available.
34
+
35
+ ### Pipeline Context (when orchestrated)
36
+
37
+ When invoked by `harness-docs-pipeline`, check for a `pipeline` field in `.harness/handoff.json`:
38
+
39
+ - If `pipeline` field exists: read `DocPipelineContext` from it
40
+ - Use `pipeline.exclusions` to skip findings that were already addressed in the FIX phase
41
+ - Write `GapFinding[]` results back to `pipeline.gapFindings` in handoff.json
42
+ - This enables dedup across FIX and AUDIT phases
43
+ - If `pipeline` field does not exist: behave exactly as today (standalone mode)
44
+
45
+ No changes to the skill's interface or output format — the pipeline field is purely additive.
46
+
47
+ ### Phase 2: Detect Gaps
48
+
49
+ Categorize findings into four types:
50
+
51
+ 1. **Undocumented files.** New source files, modules, or packages that are not mentioned in AGENTS.md or any knowledge map section. These are the highest priority — an AI agent encountering these files has no context.
52
+
53
+ 2. **Broken links.** References to files, functions, or URLs that no longer exist. These actively mislead agents.
54
+
55
+ 3. **Stale sections.** Content that was accurate when written but no longer reflects reality. Examples: renamed functions still referenced by old name, removed features still described, changed conventions not updated.
56
+
57
+ 4. **Missing context.** Sections that exist but lack critical information. A module is listed but its purpose, constraints, or relationships are not explained. An AI agent can find the file but does not understand why it exists or how to use it correctly.
58
+
59
+ ### Phase 3: Suggest Updates
60
+
61
+ For each gap, generate a specific suggestion:
62
+
63
+ - **Undocumented files:** Draft a new section or entry with the file path, purpose, key exports, and relationship to existing modules. Use the existing AGENTS.md style and structure.
64
+ - **Broken links:** Identify the correct target (renamed file, moved function) or recommend removal if the target was deleted.
65
+ - **Stale sections:** Draft replacement text that reflects current reality. Show the diff between old and new.
66
+ - **Missing context:** Draft additional content that fills the gap. Focus on what an AI agent needs to know: purpose, constraints, relationships, and gotchas.
67
+
68
+ ### Phase 4: Apply with Approval
69
+
70
+ 1. **Present all suggestions as a grouped list.** Organize by section of AGENTS.md for easy review.
71
+
72
+ 2. **Apply approved changes.** Update AGENTS.md with the approved suggestions. Preserve existing formatting and style.
73
+
74
+ 3. **Re-run `harness check-docs`** to verify all fixes are clean. No new issues should be introduced.
75
+
76
+ 4. **Commit the update.** Use a descriptive commit message that summarizes what was updated and why.
77
+
78
+ ## What Makes Good AGENTS.md Content
79
+
80
+ Good context engineering treats AGENTS.md as a **dynamic knowledge base**, not a static document.
81
+
82
+ - **Accuracy over completeness.** A small, accurate AGENTS.md is better than a comprehensive but stale one. Every statement must be verifiable against the current codebase.
83
+ - **Purpose-first descriptions.** Do not just list files. Explain WHY each module exists, what problem it solves, and what constraints apply to it.
84
+ - **Relationship mapping.** Show how modules connect. Which modules depend on which? What are the boundaries? An agent reading one section should understand how it fits into the whole.
85
+ - **Gotchas and constraints.** Document the non-obvious. What will break if someone does X? What patterns must be followed? What is forbidden and why?
86
+ - **Change-friendly structure.** Organize so that adding a new module means adding one section, not updating ten places. Use consistent formatting so automated tools can parse it.
87
+ - **Actionable guidance.** Every section should help an agent make correct decisions. "This module handles authentication" is less useful than "This module handles authentication. All auth changes must go through the AuthService class. Direct database access for auth data is forbidden — use the repository layer."
88
+
89
+ ## Harness Integration
90
+
91
+ - **`harness validate`** — Full project health check. Reports context gaps as part of overall validation.
92
+ - **`harness check-docs`** — Focused documentation audit. Detects broken links, missing references, stale sections, and undocumented files.
93
+ - **`harness fix-drift`** — Auto-fix simple drift issues (broken links, renamed references). Use after manual review confirms the fixes are correct.
94
+
95
+ ## Success Criteria
96
+
97
+ - `harness check-docs` passes with zero errors and zero warnings
98
+ - Every source file that contains public API or architectural significance is referenced in AGENTS.md
99
+ - All file paths and function names in AGENTS.md match the current codebase
100
+ - All links (internal and external) resolve correctly
101
+ - AGENTS.md sections accurately describe current module purposes, constraints, and relationships
102
+ - A new AI agent reading AGENTS.md can navigate the codebase and make correct decisions without additional guidance
103
+
104
+ ## Examples
105
+
106
+ ### Example: New module added but not documented
107
+
108
+ **Audit output from `harness check-docs`:**
109
+
110
+ ```
111
+ WARNING: Undocumented file detected: src/services/notification-service.ts
112
+ - File contains 3 public exports: NotificationService, NotificationType, sendNotification
113
+ - File is imported by 4 other modules
114
+ - No AGENTS.md section references this file
115
+ ```
116
+
117
+ **Suggested update:**
118
+
119
+ ```markdown
120
+ ### Notification Service (`src/services/notification-service.ts`)
121
+
122
+ Handles all outbound notifications (email, Slack, webhook). All notification delivery
123
+ must go through `NotificationService` — direct use of transport libraries (nodemailer,
124
+ Slack SDK) outside this module is forbidden.
125
+
126
+ - `NotificationType` — enum of supported notification channels
127
+ - `sendNotification()` — primary entry point; routes to the correct transport
128
+ - Requires `NOTIFICATION_CONFIG` environment variables to be set
129
+ - Respects rate limits defined in `harness.config.json` under `notifications`
130
+ ```
131
+
132
+ **Apply:** Add the section under the Services heading in AGENTS.md. Re-run `harness check-docs` to confirm the warning is resolved.
133
+
134
+ ### Example: Renamed function still referenced by old name
135
+
136
+ **Audit output:**
137
+
138
+ ```
139
+ ERROR: Broken reference in AGENTS.md line 47: `calculateShipping()`
140
+ - Function was renamed to `computeShippingCost()` in commit abc123
141
+ - Located in src/services/shipping.ts
142
+ ```
143
+
144
+ **Fix:** Replace `calculateShipping()` with `computeShippingCost()` in AGENTS.md. Verify no other references to the old name exist.
145
+
146
+ ## Escalation
147
+
148
+ - **When AGENTS.md is severely outdated (>20 issues):** Do not attempt to fix everything at once. Prioritize: broken links first, then undocumented public APIs, then stale descriptions. Batch the work across multiple commits.
149
+ - **When you are unsure whether a section is stale:** Check git blame for the section and compare against recent changes to the referenced files. If the section has not been updated since the referenced files changed, it is likely stale.
150
+ - **When the project has no AGENTS.md:** Escalate to the human. Creating an AGENTS.md from scratch is a significant decision about project structure and should be done intentionally, not automatically.
@@ -0,0 +1,31 @@
1
+ name: validate-context-engineering
2
+ version: "1.0.0"
3
+ description: Validate repository context engineering practices (AGENTS.md, doc coverage, knowledge map)
4
+ cognitive_mode: meticulous-verifier
5
+ triggers:
6
+ - manual
7
+ - on_pr
8
+ - on_commit
9
+ platforms:
10
+ - claude-code
11
+ - gemini-cli
12
+ tools:
13
+ - Bash
14
+ - Read
15
+ - Glob
16
+ cli:
17
+ command: harness skill run validate-context-engineering
18
+ args:
19
+ - name: path
20
+ description: Project root path
21
+ required: false
22
+ mcp:
23
+ tool: run_skill
24
+ input:
25
+ skill: validate-context-engineering
26
+ path: string
27
+ type: flexible
28
+ state:
29
+ persistent: false
30
+ files: []
31
+ depends_on: []
@@ -0,0 +1,142 @@
1
+ description: "Rules at the intersection of i18n and accessibility — ensuring localized content remains accessible across languages, scripts, and text directions"
2
+
3
+ rules:
4
+ - name: "lang attribute on html element"
5
+ category: "lang-tags"
6
+ wcag_criteria: ["3.1.1"]
7
+ description: "The <html> element must have a valid lang attribute matching the page's primary language"
8
+ detect:
9
+ method: "Check for lang attribute on <html> element; verify it matches a valid BCP 47 tag and corresponds to the page content language"
10
+ reason: "Screen readers use the lang attribute to select the correct pronunciation engine. Without it, an English screen reader will mispronounce French content."
11
+ fix: "Set <html lang='fr'> for French content, <html lang='ar' dir='rtl'> for Arabic, etc. Update dynamically when locale changes."
12
+ severity: error
13
+ strictness:
14
+ permissive: warn
15
+ standard: error
16
+ strict: error
17
+
18
+ - name: "lang attribute on inline language switches"
19
+ category: "lang-tags"
20
+ wcag_criteria: ["3.1.2"]
21
+ description: "Inline content in a different language must be wrapped with a lang attribute"
22
+ detect:
23
+ method: "Check for foreign-language words or phrases without a lang attribute on their container"
24
+ reason: "Screen readers will pronounce foreign words using the page's primary language rules, making them unintelligible."
25
+ fix: "Wrap language switches: <span lang='fr'>bonjour</span> within English content, <span lang='en'>API</span> within Japanese content."
26
+ severity: warning
27
+ strictness:
28
+ permissive: info
29
+ standard: warn
30
+ strict: error
31
+
32
+ - name: "dir attribute for RTL content"
33
+ category: "bidi-a11y"
34
+ wcag_criteria: ["1.3.2"]
35
+ description: "RTL content must have dir='rtl' set on the appropriate container element"
36
+ detect:
37
+ method: "Check for Arabic, Hebrew, or other RTL script content without a dir attribute on its container"
38
+ reason: "Without dir='rtl', screen readers may read RTL text in the wrong order, and visual rendering will be incorrect."
39
+ fix: "Set dir='rtl' on containers with RTL content. For the full page: <html lang='ar' dir='rtl'>. For inline: <span dir='rtl'>."
40
+ severity: error
41
+ strictness:
42
+ permissive: warn
43
+ standard: error
44
+ strict: error
45
+
46
+ - name: "dir=auto on user-generated content"
47
+ category: "bidi-a11y"
48
+ wcag_criteria: ["1.3.2"]
49
+ description: "User-generated content containers should use dir='auto' to detect text direction automatically"
50
+ detect:
51
+ method: "Check for user-generated content areas (comments, messages, reviews) without dir='auto'"
52
+ reason: "User content may be in any language. Without dir='auto', an Arabic comment in an English page will render incorrectly."
53
+ fix: "Set dir='auto' on elements that display user-generated content: <p dir='auto'>{userComment}</p>"
54
+ severity: warning
55
+ strictness:
56
+ permissive: info
57
+ standard: warn
58
+ strict: warn
59
+
60
+ - name: "Font size scaling for complex scripts"
61
+ category: "script-sizing"
62
+ wcag_criteria: ["1.4.4"]
63
+ description: "Complex scripts (Devanagari, Thai, Arabic, CJK) require larger minimum font sizes for legibility"
64
+ detect:
65
+ method: "Check minimum font sizes when content language uses complex scripts; flag sizes below recommended minimums"
66
+ reason: "Complex scripts have more visual detail per character. Arabic letters reshape by position. Thai stacks diacritics vertically. Below 12-14px, these become illegible."
67
+ fix: "Set minimum font sizes: 12px for CJK, 13px for Arabic, 14px for Devanagari and Thai. Increase line-height to 1.6-1.8 for scripts with stacking marks."
68
+ severity: warning
69
+ strictness:
70
+ permissive: info
71
+ standard: warn
72
+ strict: error
73
+
74
+ - name: "Screen reader pronunciation of numbers and dates"
75
+ category: "screen-readers"
76
+ wcag_criteria: ["1.3.1"]
77
+ description: "Numbers and dates must use semantic markup so screen readers pronounce them correctly per locale"
78
+ detect:
79
+ method: "Check for visually formatted numbers/dates that lack semantic markup (time element, appropriate ARIA)"
80
+ reason: "A screen reader seeing '03/04/2025' cannot determine if it is March 4 or April 3 without semantic context. '1.234' could be one-point-two-three-four or one-thousand-two-hundred-thirty-four."
81
+ fix: "Use <time datetime='2025-03-04'>March 4, 2025</time> for dates. Use aria-label for ambiguous number formats."
82
+ severity: warning
83
+ strictness:
84
+ permissive: info
85
+ standard: warn
86
+ strict: warn
87
+
88
+ - name: "ARIA labels must be translated"
89
+ category: "screen-readers"
90
+ wcag_criteria: ["4.1.2"]
91
+ description: "All ARIA labels, descriptions, and live region content must go through the translation pipeline"
92
+ detect:
93
+ method: "Check for hardcoded English strings in aria-label, aria-description, aria-roledescription attributes"
94
+ reason: "Untranslated ARIA labels make the interface inaccessible to screen reader users in non-English locales."
95
+ fix: "Wrap ARIA attributes in translation functions: aria-label={t('nav.menu')} instead of aria-label='Menu'"
96
+ severity: error
97
+ strictness:
98
+ permissive: warn
99
+ standard: error
100
+ strict: error
101
+
102
+ - name: "hreflang attribute on alternate-language links"
103
+ category: "lang-tags"
104
+ wcag_criteria: ["3.1.1"]
105
+ description: "Links to alternate-language versions of a page must have hreflang attributes"
106
+ detect:
107
+ method: "Check for <link rel='alternate'> elements without hreflang, or language switcher links without hreflang"
108
+ reason: "hreflang helps search engines serve the correct language version and assists screen readers in announcing the target language."
109
+ fix: "Add hreflang to all alternate links: <link rel='alternate' hreflang='es' href='/es/page'>. Include x-default for the default version."
110
+ severity: warning
111
+ strictness:
112
+ permissive: info
113
+ standard: warn
114
+ strict: warn
115
+
116
+ - name: "Translated alt text for images"
117
+ category: "screen-readers"
118
+ wcag_criteria: ["1.1.1"]
119
+ description: "Image alt text must be translated along with all other user-facing content"
120
+ detect:
121
+ method: "Check for img alt attributes containing English text when the page language is non-English"
122
+ reason: "Untranslated alt text is meaningless to screen reader users who do not speak the source language."
123
+ fix: "Include all alt attributes in the translation pipeline: <img alt={t('hero.alt')} /> instead of hardcoded text"
124
+ severity: error
125
+ strictness:
126
+ permissive: warn
127
+ standard: error
128
+ strict: error
129
+
130
+ - name: "Keyboard navigation in RTL layouts"
131
+ category: "bidi-a11y"
132
+ wcag_criteria: ["2.4.3"]
133
+ description: "Tab order must follow visual order in RTL layouts — right-to-left, top-to-bottom"
134
+ detect:
135
+ method: "Check tab order in RTL layouts; verify it matches the visual reading order (right to left)"
136
+ reason: "If tab order remains LTR in an RTL layout, keyboard users navigate against the visual flow, causing confusion."
137
+ fix: "Use CSS logical properties for layout; avoid manual tabindex that assumes LTR order; test tab navigation with RTL locale"
138
+ severity: error
139
+ strictness:
140
+ permissive: info
141
+ standard: warn
142
+ strict: error
@@ -0,0 +1,67 @@
1
+ description: "Encoding anti-patterns — common mistakes in character encoding, Unicode handling, and text measurement that break with non-ASCII content"
2
+
3
+ patterns:
4
+ - name: "Assuming 1 character equals 1 byte"
5
+ severity: error
6
+ scope: all
7
+ detect:
8
+ method: "Check for buffer allocation or data storage sized by string.length for strings that may contain non-ASCII"
9
+ context: "Buffer.alloc(str.length) or database VARCHAR columns sized by character count for UTF-8 data"
10
+ reason: "UTF-8 encodes characters in 1-4 bytes. 'hello' is 5 bytes but 'こんにちは' is 15 bytes. Buffer overflow or truncation results."
11
+ instead: "Use Buffer.byteLength(str, 'utf8') for byte calculations; size database columns for byte length not character count"
12
+ strictness:
13
+ permissive: info
14
+ standard: warn
15
+ strict: error
16
+
17
+ - name: "String length not equal to visual width"
18
+ severity: warning
19
+ scope: all
20
+ detect:
21
+ method: "Check for string.length used to estimate visual display width"
22
+ context: "Layout calculations or column alignment using .length instead of visual width measurement"
23
+ reason: "CJK characters are double-width visually but .length counts them as 1. Emoji may be multiple code points but one visual glyph."
24
+ instead: "Use Intl.Segmenter for grapheme counting; use canvas.measureText() or terminal wcwidth for visual width"
25
+ strictness:
26
+ permissive: info
27
+ standard: warn
28
+ strict: warn
29
+
30
+ - name: "Missing UTF-8 BOM handling"
31
+ severity: warning
32
+ scope: all
33
+ detect:
34
+ method: "Check for file reading that does not strip BOM (U+FEFF) from the beginning of text files"
35
+ context: "Reading CSV, JSON, or translation files that may have been edited in Windows tools that add BOM"
36
+ reason: "BOM at the start of a file can break JSON parsing, CSV parsing, and string comparison. Windows Notepad adds BOM by default."
37
+ instead: "Strip BOM when reading files: content.replace(/^\\uFEFF/, '') or use a BOM-aware file reader"
38
+ strictness:
39
+ permissive: info
40
+ standard: warn
41
+ strict: warn
42
+
43
+ - name: "Emoji and ZWJ sequence handling"
44
+ severity: warning
45
+ scope: all
46
+ detect:
47
+ method: "Check for string operations that split or truncate without grapheme cluster awareness"
48
+ context: "Array.from(str) or str.split('') used to process strings containing emoji"
49
+ reason: "Family emoji (👨‍👩‍👦) is 5 code points joined by ZWJ. Splitting by code point produces broken fragments."
50
+ instead: "Use Intl.Segmenter(locale, { granularity: 'grapheme' }) to iterate over visual characters safely"
51
+ strictness:
52
+ permissive: info
53
+ standard: warn
54
+ strict: warn
55
+
56
+ - name: "Filename and URL encoding not handling non-ASCII"
57
+ severity: error
58
+ scope: all
59
+ detect:
60
+ method: "Check for file path or URL construction that does not encode non-ASCII characters"
61
+ context: "Path concatenation with user input or locale-specific filenames without encodeURIComponent"
62
+ reason: "Non-ASCII filenames and URL segments must be percent-encoded. Unencoded characters cause 404 errors and security issues."
63
+ instead: "Use encodeURIComponent() for URL segments; use encodeURI() for full URLs; normalize filenames to ASCII-safe slugs"
64
+ strictness:
65
+ permissive: warn
66
+ standard: error
67
+ strict: error