@activatus/code-standards 0.0.0-stage → 3.0.0

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 (180) hide show
  1. package/README.md +199 -2
  2. package/docs/Guides/_category_.json +4 -0
  3. package/docs/Guides/component-library-workflow.md +182 -0
  4. package/docs/Guides/migrating.md +161 -0
  5. package/docs/Guides/setup.md +158 -0
  6. package/docs/Standards/_category_.json +4 -0
  7. package/docs/Standards/agent-skills.md +125 -0
  8. package/docs/Standards/agent-specs.md +74 -0
  9. package/docs/Standards/direnv.mdx +249 -0
  10. package/docs/Standards/documentation.md +314 -0
  11. package/docs/Standards/editorconfig.md +74 -0
  12. package/docs/Standards/eslint.md +900 -0
  13. package/docs/Standards/human-readable-names.md +274 -0
  14. package/docs/Standards/lint-errors.md +171 -0
  15. package/docs/Standards/prettier.md +106 -0
  16. package/docs/Standards/readable-code.md +570 -0
  17. package/docs/Standards/stylelint.md +193 -0
  18. package/docs/Standards/styling.md +290 -0
  19. package/docs/Standards/tech-stack.md +158 -0
  20. package/docs/Structure/_category_.json +4 -0
  21. package/docs/Structure/api-routes.md +118 -0
  22. package/docs/Structure/component-organization.md +526 -0
  23. package/docs/Structure/folder-structure.md +366 -0
  24. package/docs/Structure/import-organization.md +158 -0
  25. package/docs/Structure/naming-conventions.md +334 -0
  26. package/docs/design-system-components.md +117 -0
  27. package/docs/intro.md +44 -0
  28. package/docs/ontology.md +127 -0
  29. package/docs/templates.mdx +396 -0
  30. package/docs/version-history.md +338 -0
  31. package/package.json +60 -3
  32. package/scripts/renameSymbol.mjs +188 -0
  33. package/static/templates/.editorconfig +25 -0
  34. package/static/templates/.envrc +25 -0
  35. package/static/templates/.nvmrc +1 -0
  36. package/static/templates/AGENTS.md +163 -0
  37. package/static/templates/decision-doc.md +19 -0
  38. package/static/templates/docs/ai/agent-harness.md +17 -0
  39. package/static/templates/docs/ai/agents.md +17 -0
  40. package/static/templates/docs/ai/architecture.md +17 -0
  41. package/static/templates/docs/ai/context.md +17 -0
  42. package/static/templates/docs/ai/model-routing.md +17 -0
  43. package/static/templates/docs/ai/models.md +17 -0
  44. package/static/templates/docs/ai/retrieval.md +17 -0
  45. package/static/templates/docs/ai/tools.md +17 -0
  46. package/static/templates/docs/architecture/authentication.md +17 -0
  47. package/static/templates/docs/architecture/backend.md +17 -0
  48. package/static/templates/docs/architecture/background-jobs.md +17 -0
  49. package/static/templates/docs/architecture/backups.md +17 -0
  50. package/static/templates/docs/architecture/caching.md +17 -0
  51. package/static/templates/docs/architecture/ci-cd.md +17 -0
  52. package/static/templates/docs/architecture/disaster-recovery.md +17 -0
  53. package/static/templates/docs/architecture/environments.md +17 -0
  54. package/static/templates/docs/architecture/frontend.md +17 -0
  55. package/static/templates/docs/architecture/hosting.md +17 -0
  56. package/static/templates/docs/architecture/observability.md +17 -0
  57. package/static/templates/docs/architecture/realtime.md +17 -0
  58. package/static/templates/docs/architecture/search.md +17 -0
  59. package/static/templates/docs/architecture/services.md +17 -0
  60. package/static/templates/docs/architecture/state-management.md +17 -0
  61. package/static/templates/docs/architecture/storage.md +17 -0
  62. package/static/templates/docs/architecture/system.md +17 -0
  63. package/static/templates/docs/business/buying-trigger.md +17 -0
  64. package/static/templates/docs/business/customer-value.md +17 -0
  65. package/static/templates/docs/business/customer.md +17 -0
  66. package/static/templates/docs/business/defensibility.md +17 -0
  67. package/static/templates/docs/business/growth.md +17 -0
  68. package/static/templates/docs/business/pricing.md +17 -0
  69. package/static/templates/docs/business/revenue-model.md +17 -0
  70. package/static/templates/docs/business/unit-economics.md +17 -0
  71. package/static/templates/docs/data/analytics.md +17 -0
  72. package/static/templates/docs/data/audit.md +17 -0
  73. package/static/templates/docs/data/database.md +17 -0
  74. package/static/templates/docs/data/indexing.md +17 -0
  75. package/static/templates/docs/data/migrations.md +17 -0
  76. package/static/templates/docs/data/model.md +17 -0
  77. package/static/templates/docs/data/retention.md +17 -0
  78. package/static/templates/docs/data/schema.md +17 -0
  79. package/static/templates/docs/deployment/approval.md +17 -0
  80. package/static/templates/docs/deployment/live-verification.md +17 -0
  81. package/static/templates/docs/deployment/process.md +17 -0
  82. package/static/templates/docs/deployment/rollback.md +17 -0
  83. package/static/templates/docs/design/design-system.md +17 -0
  84. package/static/templates/docs/design/errors.md +17 -0
  85. package/static/templates/docs/design/feedback.md +17 -0
  86. package/static/templates/docs/design/interactions.md +17 -0
  87. package/static/templates/docs/design/layout.md +17 -0
  88. package/static/templates/docs/design/navigation.md +17 -0
  89. package/static/templates/docs/design/principles.md +17 -0
  90. package/static/templates/docs/design/responsive.md +17 -0
  91. package/static/templates/docs/development/branching.md +17 -0
  92. package/static/templates/docs/development/code-quality.md +17 -0
  93. package/static/templates/docs/development/coding-standards.md +21 -0
  94. package/static/templates/docs/development/commits.md +17 -0
  95. package/static/templates/docs/development/merge-strategy.md +17 -0
  96. package/static/templates/docs/development/process.md +17 -0
  97. package/static/templates/docs/development/pull-requests.md +17 -0
  98. package/static/templates/docs/experience/accessibility.md +17 -0
  99. package/static/templates/docs/experience/aha-moment.md +17 -0
  100. package/static/templates/docs/experience/anti-experience.md +17 -0
  101. package/static/templates/docs/experience/friction.md +17 -0
  102. package/static/templates/docs/experience/outcomes.md +17 -0
  103. package/static/templates/docs/experience/principles.md +17 -0
  104. package/static/templates/docs/experience/retention.md +17 -0
  105. package/static/templates/docs/experience/sharing.md +17 -0
  106. package/static/templates/docs/overview/how-it-works.md +17 -0
  107. package/static/templates/docs/overview/what-is-it.md +17 -0
  108. package/static/templates/docs/overview/writing-docs.md +16 -0
  109. package/static/templates/docs/pitch/alternatives.md +17 -0
  110. package/static/templates/docs/pitch/assumptions.md +17 -0
  111. package/static/templates/docs/pitch/audience.md +17 -0
  112. package/static/templates/docs/pitch/concept.md +17 -0
  113. package/static/templates/docs/pitch/differentiators.md +17 -0
  114. package/static/templates/docs/pitch/outcomes.md +17 -0
  115. package/static/templates/docs/pitch/problem.md +17 -0
  116. package/static/templates/docs/pitch/product-market-fit.md +17 -0
  117. package/static/templates/docs/pitch/success-criteria.md +17 -0
  118. package/static/templates/docs/pitch/validation.md +17 -0
  119. package/static/templates/docs/pitch/value-proposition.md +17 -0
  120. package/static/templates/docs/pitch/vision.md +17 -0
  121. package/static/templates/docs/scope/core.md +17 -0
  122. package/static/templates/docs/scope/exclusions.md +17 -0
  123. package/static/templates/docs/scope/future.md +17 -0
  124. package/static/templates/docs/scope/launch.md +17 -0
  125. package/static/templates/docs/scope/post-launch.md +17 -0
  126. package/static/templates/docs/scope/priorities.md +17 -0
  127. package/static/templates/docs/scope/quality-bar.md +17 -0
  128. package/static/templates/docs/security/audit.md +17 -0
  129. package/static/templates/docs/security/data-access.md +17 -0
  130. package/static/templates/docs/security/logging.md +17 -0
  131. package/static/templates/docs/security/privacy.md +17 -0
  132. package/static/templates/docs/security/secrets.md +17 -0
  133. package/static/templates/docs/security/threat-model.md +17 -0
  134. package/static/templates/docs/testing/end-to-end.md +17 -0
  135. package/static/templates/docs/testing/integration.md +17 -0
  136. package/static/templates/docs/testing/regression.md +17 -0
  137. package/static/templates/docs/testing/security.md +17 -0
  138. package/static/templates/docs/testing/strategy.md +17 -0
  139. package/static/templates/docs/testing/test-data.md +17 -0
  140. package/static/templates/docs/testing/unit.md +17 -0
  141. package/static/templates/docs/uat/checks.md +17 -0
  142. package/static/templates/docs/uat/strategy.md +17 -0
  143. package/static/templates/docs/users/permissions.md +17 -0
  144. package/static/templates/docs/users/roles.md +17 -0
  145. package/static/templates/docs/users/user-types.md +17 -0
  146. package/static/templates/docs/workflows/assignment.md +17 -0
  147. package/static/templates/docs/workflows/bugfix.md +17 -0
  148. package/static/templates/docs/workflows/dependencies.md +17 -0
  149. package/static/templates/docs/workflows/deployment.md +17 -0
  150. package/static/templates/docs/workflows/development.md +17 -0
  151. package/static/templates/docs/workflows/planning.md +17 -0
  152. package/static/templates/docs/workflows/review.md +17 -0
  153. package/static/templates/docs/workflows/uat.md +17 -0
  154. package/static/templates/docsSite/docusaurus.config.mjs +144 -0
  155. package/static/templates/docsSite/gitignore.txt +3 -0
  156. package/static/templates/docsSite/package.json.txt +42 -0
  157. package/static/templates/docsSite/pnpm-workspace.yaml +2 -0
  158. package/static/templates/docsSite/sidebars.mjs +7 -0
  159. package/static/templates/docsSite/src/css/custom.css +7 -0
  160. package/static/templates/docsSite/src/pages/index.tsx +9 -0
  161. package/static/templates/docsSite/static/images/logo.svg +4 -0
  162. package/static/templates/docsSite/tsconfig.json +7 -0
  163. package/static/templates/eslint/base/eslint.config.mjs +104 -0
  164. package/static/templates/eslint/nextjs/eslint.config.mjs +181 -0
  165. package/static/templates/eslint/react/eslint.config.mjs +173 -0
  166. package/static/templates/eslint/typescript/eslint.config.mjs +154 -0
  167. package/static/templates/globals.css +16 -0
  168. package/static/templates/husky/pre-commit +1 -0
  169. package/static/templates/next.config.mjs +21 -0
  170. package/static/templates/prettier.config.mjs +26 -0
  171. package/static/templates/skills/codeReview.md +31 -0
  172. package/static/templates/skills/format.md +18 -0
  173. package/static/templates/skills/lint.md +21 -0
  174. package/static/templates/skills/lintFix.md +24 -0
  175. package/static/templates/skills/securityAudit.md +28 -0
  176. package/static/templates/skills/test.md +24 -0
  177. package/static/templates/skills/typescript.md +28 -0
  178. package/static/templates/skills/updateLayout.md +20 -0
  179. package/static/templates/stylelint/css/stylelint.config.mjs +40 -0
  180. package/static/templates/stylelint/scss/stylelint.config.mjs +13 -0
@@ -0,0 +1,314 @@
1
+ ---
2
+ sidebar_position: 0.5
3
+ ---
4
+
5
+ # Documentation
6
+
7
+ Every project documents itself the same way, so a developer or an AI agent can open any Activatus project and find what they need in the same place.
8
+
9
+ This is the docs framework from Launchpad. It is used for Launchpad itself and for every other project.
10
+
11
+ ## How it works
12
+
13
+ | Part | What it is | Where it lives |
14
+ | -------------- | ------------------------------------------------- | -------------------------------------------------- |
15
+ | **The docs** | Plain Markdown files. Every one is a Decision Doc | `docs/` in the project root |
16
+ | **The viewer** | A Docusaurus site that displays those files | `docsSite/` in the project root |
17
+ | **The route** | The docs appear at `/docs` in the running project | Switched on by the `DOCS_URL` environment variable |
18
+
19
+ The docs are written once, as Markdown, and read two ways:
20
+
21
+ - **AI agents** read the files in `docs/` directly. No build, no server.
22
+ - **People** browse them at `/docs`, with a menu, search and page contents — the same layout as this site.
23
+
24
+ ---
25
+
26
+ ## 📜 Every file is a Decision Doc
27
+
28
+ **Every file in `docs/` is a Decision Doc.** There is no separate `decisions/` folder.
29
+
30
+ A design system is a decision. A scope is a decision. A database choice is a decision. Each doc states one decision and why it was made, so anyone — or any agent — can trace the work back to the reason for it, and never has to invent a product decision to unblock themselves.
31
+
32
+ - **Tickets own the _what_.** "Build GitHub authentication."
33
+ - **Decision Docs own the _why_.** "Developers are our audience and we must sync directly to their repositories."
34
+
35
+ See the [Ontology](/ontology#key-distinctions) for the terms.
36
+
37
+ ---
38
+
39
+ ## 📁 The folders
40
+
41
+ Every project has the same folders. The folder is the menu group.
42
+
43
+ ### Reusable folders
44
+
45
+ These are the same in every project:
46
+
47
+ | Folder | Holds decisions about | Files |
48
+ | --------------- | -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
49
+ | `overview/` | What the project is and how to read its docs | `what-is-it`, `how-it-works`, `writing-docs` |
50
+ | `ai/` | Agents, models and what they may do | `agent-harness`, `agents`, `architecture`, `context`, `model-routing`, `models`, `retrieval`, `tools` |
51
+ | `architecture/` | How the system is built | `authentication`, `backend`, `background-jobs`, `backups`, `caching`, `ci-cd`, `disaster-recovery`, `environments`, `frontend`, `hosting`, `observability`, `realtime`, `search`, `services`, `state-management`, `storage`, `system` |
52
+ | `business/` | The customer and the money | `buying-trigger`, `customer`, `customer-value`, `defensibility`, `growth`, `pricing`, `revenue-model`, `unit-economics` |
53
+ | `data/` | What is stored and how | `analytics`, `audit`, `database`, `indexing`, `migrations`, `model`, `retention`, `schema` |
54
+ | `deployment/` | Getting work to production | `approval`, `live-verification`, `process`, `rollback` |
55
+ | `design/` | How it looks and behaves | `design-system`, `errors`, `feedback`, `interactions`, `layout`, `navigation`, `principles`, `responsive` |
56
+ | `development/` | How code is written and merged | `branching`, `code-quality`, `coding-standards`, `commits`, `merge-strategy`, `process`, `pull-requests` |
57
+ | `experience/` | What using it should feel like | `accessibility`, `aha-moment`, `anti-experience`, `friction`, `outcomes`, `principles`, `retention`, `sharing` |
58
+ | `pitch/` | Why the product should exist | `alternatives`, `assumptions`, `audience`, `concept`, `differentiators`, `outcomes`, `problem`, `product-market-fit`, `success-criteria`, `validation`, `value-proposition`, `vision` |
59
+ | `scope/` | What is in, out and later | `core`, `exclusions`, `future`, `launch`, `post-launch`, `priorities`, `quality-bar` |
60
+ | `security/` | Keeping it safe | `audit`, `data-access`, `logging`, `privacy`, `secrets`, `threat-model` |
61
+ | `testing/` | How it is tested | `end-to-end`, `integration`, `regression`, `security`, `strategy`, `test-data`, `unit` |
62
+ | `uat/` | Checking we built the right thing | `checks`, `strategy` |
63
+ | `users/` | Who uses it and what they may do | `permissions`, `roles`, `user-types` |
64
+ | `workflows/` | How work moves | `assignment`, `bugfix`, `dependencies`, `deployment`, `development`, `planning`, `review`, `uat` |
65
+
66
+ ### Product-specific folders
67
+
68
+ Decisions that only make sense for this one product go in their own folders:
69
+
70
+ | Folder | Holds |
71
+ | ---------------------------------------- | ---------------------------------------------------- |
72
+ | `product/` | What this product is and how its main parts work |
73
+ | `integrations/` | One file per outside service the product connects to |
74
+ | `user-flows/` | One file per User Flow |
75
+ | _A folder for the product's own subject_ | For example, Launchpad has `tickets/` |
76
+
77
+ ### Which folder?
78
+
79
+ Before placing a doc in a reusable folder, ask: **would this topic make sense as a standard decision category for a completely different software product?**
80
+
81
+ - **Yes** → a reusable folder.
82
+ - **No** → a product-specific folder.
83
+
84
+ Keep these pairs distinct:
85
+
86
+ - **Authentication** (_who are you?_) belongs in `architecture/authentication.md`. **Permissions** (_what are you allowed to do?_) belong in `users/permissions.md`.
87
+ - `data/model.md` is the conceptual model, `data/database.md` is the technology and strategy, and `data/schema.md` is the concrete structure.
88
+
89
+ ### Every file exists from the start
90
+
91
+ **A new project starts with every reusable file already in place**, each marked `Status: Not started`. Copy the [doc templates](/templates#document-templates).
92
+
93
+ - When a decision is made, **write it into the matching file**.
94
+ - **Create a new file** only when a topic has no home.
95
+
96
+ A `Not started` file is a visible gap: it shows a decision that has not been made yet.
97
+
98
+ ---
99
+
100
+ ## 📄 The doc format
101
+
102
+ Every doc has the same shape:
103
+
104
+ ```md
105
+ # <Group> — <Menu item>
106
+
107
+ > One line: what this doc decides.
108
+
109
+ **Status:** Not started | Under evaluation | Current plan | Decided · **Updated:** YYYY-MM-DD
110
+
111
+ ## Decision
112
+
113
+ ## Why
114
+
115
+ ## Details (optional)
116
+
117
+ ## Alternatives considered (optional)
118
+
119
+ ## Current implementation (only when the code differs)
120
+
121
+ ## Related
122
+
123
+ ## Retro Feedback (added as tasks complete)
124
+ ```
125
+
126
+ ### Status
127
+
128
+ | Status | Means |
129
+ | -------------------- | -------------------------------------------------------------------------- |
130
+ | **Not started** | A template waiting for its first decision |
131
+ | **Under evaluation** | Not decided. The options are recorded |
132
+ | **Current plan** | The direction we are working to. It may change |
133
+ | **Decided** | An intentional current decision. Change it only with a Decision Doc update |
134
+
135
+ ### Sections
136
+
137
+ | Section | Holds |
138
+ | ------------------------- | -------------------------------------------------------------------------------- |
139
+ | `Decision` | What was decided |
140
+ | `Why` | The reasons |
141
+ | `Details` | Anything needed to act on the decision |
142
+ | `Alternatives considered` | What was rejected, and why |
143
+ | `Current implementation` | Only when the code differs from the decision: describe the gap |
144
+ | `Related` | Links to related docs |
145
+ | `Retro Feedback` | What went well and what did not, added as tasks linked to this doc are completed |
146
+
147
+ **A doc states the decision, not the code.** When the code does not match yet, the gap goes under `Current implementation`.
148
+
149
+ ### When a decision changes
150
+
151
+ Update the doc, change the **Updated** date, and add a `## History` entry: what changed, why, when, and which work was affected. Keep the original decision and its reason in the history.
152
+
153
+ ---
154
+
155
+ ## 🧭 One file, one menu item, one route
156
+
157
+ The docs menu is built straight from the `docs/` folder, so every doc is in the menu and nothing else is.
158
+
159
+ | Rule | Example |
160
+ | ------------------------------------------------------------- | --------------------------------------------------- |
161
+ | **The folder is the menu group** | `scope/` shows as **Scope** |
162
+ | **The title after the `—` is the menu item** | `# Scope — Future` shows as **Future** |
163
+ | **The file name is that title in kebab-case** | `# Scope — Future` lives in `scope/future.md` |
164
+ | **The route is the folder plus the file name**, without `.md` | `scope/future.md` is served at `/docs/scope/future` |
165
+
166
+ - **Overview comes first** in the menu. Every other group is in alphabetical order, and items are alphabetical within their group.
167
+ - **Link between docs with relative `.md` paths** — `[Future](../scope/future.md)`. The link works in the file and on the site.
168
+ - **Folder and file names are kebab-case**, because they become the route. See [Naming Conventions](/Structure/naming-conventions#when-to-use-kebab-case).
169
+
170
+ The viewer does this automatically. There is no menu file to maintain.
171
+
172
+ ---
173
+
174
+ ## ✍️ Rules for writing
175
+
176
+ - **Use the [Ontology](/ontology).** Use its terms for code, and the project's own ontology for product words.
177
+ - **One decision per file.**
178
+ - **Plain Markdown (`.md`).** No JSX or imports, so every file reads the same for an agent as it does on the page.
179
+ - **One `# Heading` per file**, at the top, in the form `# Group — Menu item`.
180
+ - **Draw diagrams with Mermaid** in a ` ```mermaid ` code block, so the diagram is text and stays in the file.
181
+ - **Write for someone who has never seen the project.** Full sentences, full English words, no shorthand.
182
+
183
+ ### Not finished until the docs are updated
184
+
185
+ **A change is not finished until the docs match it.** If a change makes a doc wrong, the doc is fixed in the same change — the same rule as [test files](/Standards/readable-code#every-function-and-component-has-a-test-file).
186
+
187
+ This applies to everyone writing code, **including AI agents**. An agent that changes how something works updates the Decision Doc that describes it.
188
+
189
+ ---
190
+
191
+ ## 🌐 The `/docs` route
192
+
193
+ The docs appear at `/docs` inside the running project — `http://localhost:3000/docs` — in the same layout as this site.
194
+
195
+ They are switched on by one environment variable:
196
+
197
+ | `DOCS_URL` | What happens at `/docs` |
198
+ | ----------------------------- | -------------------------------- |
199
+ | Set (`http://localhost:3001`) | The docs are shown |
200
+ | Not set | `404` — the route does not exist |
201
+
202
+ ### ⛔ Never in production
203
+
204
+ **`DOCS_URL` is never set in production.** With it unset, the project has no `/docs` route at all, so internal docs cannot be reached on a live site.
205
+
206
+ - Set it in `.env.local` for local development.
207
+ - Set it on a staging or preview environment only if the team wants the docs there.
208
+ - **Do not add it to the production environment.**
209
+
210
+ The docs site also sets `noIndex`, so search engines are told not to index it wherever it is running.
211
+
212
+ ### What goes in Git
213
+
214
+ **The docs are committed. They are not published.** Committing a file to the repository and serving it on the live site are two different things.
215
+
216
+ | Item | In Git? | Why |
217
+ | -------------------------------------------------------------------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------- |
218
+ | `docs/` | ✅ Committed | It is the team's shared record. Developers and AI agents on every machine need it, and it changes in the same pull request as the code |
219
+ | `docsSite/` config files | ✅ Committed | So everyone gets the same viewer |
220
+ | `docsSite/node_modules/`, `docsSite/build/`, `docsSite/.docusaurus/` | ❌ Ignored | Installed and generated files. The `docsSite/.gitignore` from the template covers them |
221
+ | `.env.local` (holds `DOCS_URL`) | ❌ Ignored | Local settings are never committed |
222
+
223
+ **Never add `docs/` to `.gitignore`.** Ignored docs exist on one machine only: the rest of the team, and every agent working from a fresh copy of the repo, would have none.
224
+
225
+ Nothing in `docs/` is shipped with the app. The build only includes files the app imports, and the app never imports from `docs/`.
226
+
227
+ :::caution[Public repositories]
228
+
229
+ Anyone who can read the repository can read its docs. Keep internal projects in a **private** repository.
230
+
231
+ :::
232
+
233
+ ### How the route is wired
234
+
235
+ The project's `next.config.mjs` forwards `/docs` to the docs site, but only when `DOCS_URL` is set:
236
+
237
+ ```js title="next.config.mjs"
238
+ const DOCS_URL = process.env.DOCS_URL;
239
+
240
+ /** @type {import("next").NextConfig} */
241
+ const nextConfig = {
242
+ async rewrites() {
243
+ // The docs are only served when DOCS_URL is set. It is never set in production.
244
+ if (!DOCS_URL) {
245
+ return [];
246
+ }
247
+
248
+ return [
249
+ { source: "/docs", destination: `${DOCS_URL}/docs/` },
250
+ {
251
+ source: "/docs/:path*",
252
+ destination: `${DOCS_URL}/docs/:path*`,
253
+ },
254
+ ];
255
+ },
256
+ };
257
+
258
+ export default nextConfig;
259
+ ```
260
+
261
+ ---
262
+
263
+ ## 🚀 Setting it up
264
+
265
+ 1. **Copy the docs.** Copy the [`docs/` templates](/templates#document-templates) into the project's `docs/` folder. Rename `overview/what-is-it.md` after the project (`what-is-launchpad.md`) and update its title.
266
+
267
+ 2. **Copy the viewer.** Copy the [`docsSite/` template](/templates#docs-site) into the project root. Rename `package.json.txt` to `package.json` and `gitignore.txt` to `.gitignore`, set `PROJECT_NAME` in `docusaurus.config.mjs`, and point the home redirect in `src/pages/index.tsx` at the renamed overview file.
268
+
269
+ 3. **Add the route.** Add the rewrite above to `next.config.mjs`.
270
+
271
+ 4. **Add the scripts** to the project's `package.json`:
272
+
273
+ ```json
274
+ {
275
+ "scripts": {
276
+ "docs:install": "pnpm --dir docsSite install",
277
+ "docs:dev": "pnpm --dir docsSite start",
278
+ "docs:build": "pnpm --dir docsSite build"
279
+ }
280
+ }
281
+ ```
282
+
283
+ 5. **Set the variable** in `.env.local`:
284
+
285
+ ```text
286
+ DOCS_URL=http://localhost:3001
287
+ ```
288
+
289
+ 6. **Run it:**
290
+
291
+ ```bash
292
+ pnpm docs:install # Once
293
+ pnpm docs:dev # Starts the docs site on port 3001
294
+ pnpm dev # Starts the project on port 3000
295
+ ```
296
+
297
+ Open `http://localhost:3000/docs`.
298
+
299
+ :::caution[Do not name the script `docs`]
300
+
301
+ `pnpm docs` is a built-in pnpm command, so a script called `docs` never runs. Use `docs:dev`.
302
+
303
+ :::
304
+
305
+ ---
306
+
307
+ ## 🤖 For AI agents
308
+
309
+ - **Read `docs/` before starting work.** Start with the three `overview/` docs, then the docs for the area being changed.
310
+ - **Read the files directly.** Do not start the docs site to read them.
311
+ - **Check the Status.** `Decided` is settled. `Current plan` may change. `Under evaluation` and `Not started` are **not decisions** — do not treat them as one, and do not invent one. Ask.
312
+ - **Update the docs in the same change** as the code, and change the **Updated** date.
313
+ - **Write into the matching file.** Create a new file only when a topic has no home, in kebab-case, using the [doc format](#-the-doc-format).
314
+ - **Do not edit anything in `docsSite/`** unless the task is about the docs viewer itself.
@@ -0,0 +1,74 @@
1
+ ---
2
+ sidebar_position: 3
3
+ ---
4
+
5
+ # EditorConfig
6
+
7
+ EditorConfig enforces whitespace conventions at the editor level, before any linter or formatter runs. It works across all editors and IDEs without extra plugins (VS Code, JetBrains, Vim, Neovim, etc. all support it natively or via a free extension).
8
+
9
+ ## Setup
10
+
11
+ Copy this file to your project root as `.editorconfig`:
12
+
13
+ ```ini
14
+ root = true
15
+
16
+ [*]
17
+ charset = utf-8
18
+ end_of_line = lf
19
+ indent_size = 2
20
+ indent_style = tab
21
+ insert_final_newline = true
22
+ trim_trailing_whitespace = true
23
+
24
+ # Markdown reads a tab as four spaces, so it uses spaces.
25
+ [*.{md,mdx}]
26
+ indent_style = space
27
+ trim_trailing_whitespace = false
28
+ max_line_length = off
29
+
30
+ # YAML does not allow tabs.
31
+ [*.{yml,yaml}]
32
+ indent_style = space
33
+ indent_size = 2
34
+
35
+ # Python's own style guide uses 4 spaces.
36
+ [*.py]
37
+ indent_style = space
38
+ indent_size = 4
39
+ ```
40
+
41
+ No package installation required — EditorConfig is a file-based standard.
42
+
43
+ ## Rule reference
44
+
45
+ | Rule | Value | Rationale |
46
+ | -------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------- |
47
+ | `charset` | `utf-8` | Universal default; avoids encoding issues on cross-platform teams |
48
+ | `end_of_line` | `lf` | Unix line endings everywhere; Windows devs should set `core.autocrlf = input` in git |
49
+ | `indent_size` | `2` | How wide a tab shows, and the indent for files that use spaces. Python uses `4` |
50
+ | `indent_style` | `tab` | Tabs indent code. Each person sees the indent at the width they like, and files are smaller. Markdown, YAML and Python use spaces |
51
+ | `insert_final_newline` | `true` | POSIX standard; avoids noisy diffs when appending to files |
52
+ | `trim_trailing_whitespace` | `true` | Prevents invisible diff noise; **disabled for Markdown** where trailing spaces are significant |
53
+
54
+ ## Markdown exception
55
+
56
+ In Markdown, two trailing spaces before a newline produce a `<br>` (hard line break). Trimming trailing whitespace would silently corrupt Markdown documents, so `trim_trailing_whitespace = false` is set for `*.md` files.
57
+
58
+ ## Files that use spaces
59
+
60
+ | Files | Why |
61
+ | -------------------------- | ----------------------------------------------------------------- |
62
+ | Markdown (`*.md`, `*.mdx`) | Markdown reads a tab as four spaces, which can break nested lists |
63
+ | YAML (`*.yml`, `*.yaml`) | YAML does not allow tabs |
64
+ | Python (`*.py`) | Python's own style guide uses 4 spaces |
65
+
66
+ ## Alignment with other tools
67
+
68
+ The EditorConfig settings deliberately mirror the Prettier config:
69
+
70
+ - `indent_style: tab` ↔ `useTabs: true`
71
+ - `indent_size: 2` ↔ `tabWidth: 2`
72
+ - `end_of_line: lf` ↔ `endOfLine: "lf"`
73
+
74
+ This means the editor writes the right whitespace from the start, and Prettier never has to fix it.