@activatus/code-standards 2.0.0 → 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 (51) hide show
  1. package/README.md +12 -13
  2. package/docs/Guides/_category_.json +2 -2
  3. package/docs/Guides/migrating.md +33 -16
  4. package/docs/Guides/setup.md +46 -18
  5. package/docs/Standards/_category_.json +2 -2
  6. package/docs/Standards/agent-skills.md +29 -29
  7. package/docs/Standards/agent-specs.md +17 -32
  8. package/docs/Standards/direnv.mdx +8 -8
  9. package/docs/Standards/documentation.md +5 -2
  10. package/docs/Standards/editorconfig.md +23 -21
  11. package/docs/Standards/eslint.md +593 -402
  12. package/docs/Standards/human-readable-names.md +61 -21
  13. package/docs/Standards/lint-errors.md +37 -5
  14. package/docs/Standards/prettier.md +35 -26
  15. package/docs/Standards/readable-code.md +30 -0
  16. package/docs/Standards/stylelint.md +26 -11
  17. package/docs/Standards/styling.md +9 -3
  18. package/docs/Standards/tech-stack.md +3 -1
  19. package/docs/Structure/_category_.json +2 -2
  20. package/docs/Structure/component-organization.md +9 -2
  21. package/docs/Structure/folder-structure.md +26 -13
  22. package/docs/Structure/naming-conventions.md +0 -2
  23. package/docs/intro.md +1 -3
  24. package/docs/ontology.md +21 -26
  25. package/docs/templates.mdx +15 -38
  26. package/docs/version-history.md +133 -6
  27. package/package.json +6 -2
  28. package/scripts/renameSymbol.mjs +188 -0
  29. package/static/templates/.editorconfig +8 -11
  30. package/static/templates/AGENTS.md +16 -13
  31. package/static/templates/docs/development/coding-standards.md +4 -0
  32. package/static/templates/docsSite/docusaurus.config.mjs +144 -0
  33. package/static/templates/docsSite/sidebars.mjs +7 -0
  34. package/static/templates/docsSite/src/css/custom.css +6 -0
  35. package/static/templates/docsSite/tsconfig.json +5 -5
  36. package/static/templates/eslint/base/eslint.config.mjs +95 -70
  37. package/static/templates/eslint/nextjs/eslint.config.mjs +170 -126
  38. package/static/templates/eslint/react/eslint.config.mjs +160 -125
  39. package/static/templates/eslint/typescript/eslint.config.mjs +143 -115
  40. package/static/templates/globals.css +9 -9
  41. package/static/templates/next.config.mjs +13 -10
  42. package/static/templates/prettier.config.mjs +26 -0
  43. package/static/templates/stylelint/css/stylelint.config.mjs +37 -25
  44. package/static/templates/stylelint/scss/stylelint.config.mjs +10 -7
  45. package/docs/Standards/branch-naming.md +0 -66
  46. package/docs/Standards/conventional-commits.md +0 -189
  47. package/static/templates/.commitlintrc.json +0 -3
  48. package/static/templates/docsSite/docusaurus.config.ts +0 -119
  49. package/static/templates/docsSite/sidebars.ts +0 -8
  50. package/static/templates/husky/commit-msg +0 -1
  51. package/static/templates/prettier.config.js +0 -17
@@ -1,189 +0,0 @@
1
- ---
2
- sidebar_position: 6
3
- ---
4
-
5
- # Conventional Commits
6
-
7
- All Activatus repositories follow the [Conventional Commits 1.0.0](https://www.conventionalcommits.org/en/v1.0.0/) specification for commit messages. This gives us machine-readable history, automatic changelogs, and a shared vocabulary for what a commit does.
8
-
9
- ## Format
10
-
11
- ```text
12
- <type>(<scope>): <description>
13
-
14
- [optional body]
15
-
16
- [optional footer(s)]
17
- ```
18
-
19
- The first line (header) must not exceed **72 characters**. Everything else is optional.
20
-
21
- ## Quick examples
22
-
23
- ```text
24
- feat(authentication): add magic-link login flow
25
- fix(api): handle null response from payment provider
26
- docs: clarify AGENTS.md authoring guide
27
- refactor(ui): extract Button into shared component library
28
- chore(deps): bump eslint-config to v0.2.0
29
- feat!: drop support for Node 18
30
- ```
31
-
32
- ## Type reference
33
-
34
- | Type | When to use |
35
- | --- | --- |
36
- | `feat` | A new feature visible to users or API consumers |
37
- | `fix` | A bug fix |
38
- | `docs` | Documentation changes only |
39
- | `style` | Formatting or whitespace — no logic change |
40
- | `refactor` | Code restructuring with no feature or bug change |
41
- | `perf` | A performance improvement |
42
- | `test` | Adding or correcting tests |
43
- | `build` | Build system or dependency changes |
44
- | `ci` | CI/CD pipeline changes |
45
- | `chore` | Maintenance that doesn't fit elsewhere |
46
- | `revert` | Reverts a previous commit |
47
-
48
- ## Scope
49
-
50
- The scope is optional and goes in parentheses after the type. It names the part of the codebase the commit touches:
51
-
52
- ```text
53
- feat(authentication): ...
54
- fix(checkout): ...
55
- refactor(ui/button): ...
56
- ```
57
-
58
- Use lowercase, kebab-case names. If a commit spans many areas, omit the scope rather than writing a vague one.
59
-
60
- ## Description
61
-
62
- - Imperative, present tense: **"add"** not "added" or "adds"
63
- - No capital letter at the start
64
- - No period at the end
65
- - Describes *what* the commit does, not *how*
66
-
67
- ```text
68
- ✓ feat: add dark mode toggle
69
- ✗ feat: Added dark mode toggle.
70
- ✗ feat: dark mode
71
- ```
72
-
73
- ## Body
74
-
75
- The body explains the *why* behind a change — context that won't be obvious from the diff. Wrap at 72 characters.
76
-
77
- ```text
78
- fix(api): retry on transient 503 from payments provider
79
-
80
- The payments API returns a 503 during brief maintenance windows.
81
- Previously this caused checkout to fail immediately. Now we retry
82
- up to 3 times with exponential back-off before surfacing an error.
83
- ```
84
-
85
- ## Breaking changes
86
-
87
- Signal a breaking change in one of two ways:
88
-
89
- **Inline `!` after the type** (for the header only):
90
-
91
- ```text
92
- feat!: remove deprecated /v1/users endpoint
93
- ```
94
-
95
- **`BREAKING CHANGE:` footer** (required when a body explains the break):
96
-
97
- ```text
98
- feat(api)!: require explicit content-type header on all requests
99
-
100
- BREAKING CHANGE: requests without a Content-Type header now return
101
- 400. Previously the API defaulted to application/json.
102
- ```
103
-
104
- A breaking change bumps the **major** version in SemVer (`1.0.0` → `2.0.0`).
105
-
106
- ## Versioning implications
107
-
108
- When using [Changesets](https://github.com/changesets/changesets) or a changelog tool that understands Conventional Commits:
109
-
110
- | Commit type | SemVer bump |
111
- | --- | --- |
112
- | `fix`, `perf` | patch (`1.0.0` → `1.0.1`) |
113
- | `feat` | minor (`1.0.0` → `1.1.0`) |
114
- | Any with `!` or `BREAKING CHANGE` | major (`1.0.0` → `2.0.0`) |
115
- | All others (`docs`, `chore`, `ci`, …) | none |
116
-
117
- ## Multi-commit PRs
118
-
119
- Each commit in a PR should be independently meaningful and deployable. Prefer:
120
-
121
- ```text
122
- feat(authentication): scaffold magic-link token model
123
- feat(authentication): add magic-link send endpoint
124
- feat(authentication): add magic-link verify endpoint
125
- test(authentication): add integration tests for magic-link flow
126
- docs(authentication): document magic-link API in AGENTS.md
127
- ```
128
-
129
- Over a single `feat(authentication): implement magic-link` that touches everything at once. Granular commits make `git bisect` and revert effective.
130
-
131
- ## People commit, not AI agents
132
-
133
- Commits are made by people. [AI agents never commit code](/Standards/agent-specs#agents-never-commit-code) — an agent leaves its changes uncommitted, and a person reviews them and writes the commit.
134
-
135
- Branches follow the [Branch Naming](/Standards/branch-naming) standard.
136
-
137
- ## Enforcing commit messages
138
-
139
- Every project uses [Commitlint](https://commitlint.io) with a [Husky](https://typicode.github.io/husky/) git hook, so a commit with a badly formatted message is refused. **Set up both — the config file on its own enforces nothing.**
140
-
141
- ### Setup
142
-
143
- 1. Install the packages:
144
-
145
- ```bash
146
- pnpm add -D @commitlint/cli @commitlint/config-conventional husky
147
- ```
148
-
149
- 2. Add the `prepare` script to `package.json`, so the hooks are installed whenever someone runs `pnpm install`:
150
-
151
- ```json
152
- {
153
- "scripts": {
154
- "prepare": "husky"
155
- }
156
- }
157
- ```
158
-
159
- 3. Add [`.commitlintrc.json`](/templates#commitlint) to the project root.
160
-
161
- 4. Add the hook file [`.husky/commit-msg`](/templates#husky):
162
-
163
- ```text title=".husky/commit-msg"
164
- pnpm exec commitlint --edit "$1"
165
- ```
166
-
167
- 5. Run `pnpm install` once to activate the hook.
168
-
169
- After that, every commit runs the `commit-msg` hook.
170
-
171
- ### Lint before every commit
172
-
173
- Add a second hook, [`.husky/pre-commit`](/templates#husky), so code that breaks the standards cannot be committed:
174
-
175
- ```text title=".husky/pre-commit"
176
- pnpm lint
177
- ```
178
-
179
- If `pnpm lint` reports an error, the commit is refused. See [Fixing Lint Errors](/Standards/lint-errors).
180
-
181
- ### Configuration
182
-
183
- The configuration is in `.commitlintrc.json`:
184
-
185
- ```json
186
- {
187
- "extends": ["@commitlint/config-conventional"]
188
- }
189
- ```
@@ -1,3 +0,0 @@
1
- {
2
- "extends": ["@commitlint/config-conventional"]
3
- }
@@ -1,119 +0,0 @@
1
- import {themes as prismThemes} from 'prism-react-renderer';
2
- import type {Config} from '@docusaurus/types';
3
- import type * as Preset from '@docusaurus/preset-classic';
4
-
5
- const TITLE_SEPARATOR = ' — ';
6
- const FIRST_GROUP = 'overview';
7
-
8
- // Each doc is titled "# Group — Menu item". The folder is the menu group and the
9
- // part after the dash is the menu item. Overview comes first; everything else is alphabetical.
10
- const generateSidebarItems = async ({defaultSidebarItemsGenerator, docs: pages, ...remainingArguments}) => {
11
- const items = await defaultSidebarItemsGenerator({docs: pages, ...remainingArguments});
12
- const titleById = new Map(pages.map((page) => [page.id, page.title]));
13
-
14
- const labelled = items.map((item) => {
15
- if (item.type !== 'category') {
16
- return item;
17
- }
18
-
19
- const children = item.items
20
- .map((child) => {
21
- if (child.type !== 'doc') {
22
- return child;
23
- }
24
- const title = titleById.get(child.id) ?? child.id;
25
- const label = title.includes(TITLE_SEPARATOR) ? title.split(TITLE_SEPARATOR)[1] : title;
26
- return {...child, label};
27
- })
28
- .sort((first, second) => first.label.localeCompare(second.label));
29
-
30
- const firstDoc = item.items.find((child) => child.type === 'doc');
31
- const firstTitle = firstDoc ? (titleById.get(firstDoc.id) ?? '') : '';
32
- const label = firstTitle.includes(TITLE_SEPARATOR) ? firstTitle.split(TITLE_SEPARATOR)[0] : item.label;
33
- const folder = firstDoc ? firstDoc.id.split('/')[0] : item.label;
34
-
35
- return {...item, label, items: children, customProps: {folder}};
36
- });
37
-
38
- return labelled.sort((first, second) => {
39
- const firstFolder = first.customProps?.folder ?? '';
40
- const secondFolder = second.customProps?.folder ?? '';
41
- if (firstFolder === FIRST_GROUP) {
42
- return -1;
43
- }
44
- if (secondFolder === FIRST_GROUP) {
45
- return 1;
46
- }
47
- return String(first.label).localeCompare(String(second.label));
48
- });
49
- };
50
-
51
- // TODO: set the project name
52
- const PROJECT_NAME = 'Project Name';
53
-
54
- const config: Config = {
55
- title: `${PROJECT_NAME} Docs`,
56
- favicon: 'images/logo.svg',
57
-
58
- // The docs are only ever served behind the app's /docs route, so this URL is a placeholder.
59
- url: 'http://localhost:3000',
60
- baseUrl: '/docs/',
61
-
62
- // Internal docs must never be indexed by search engines.
63
- noIndex: true,
64
-
65
- onBrokenLinks: 'throw',
66
-
67
- markdown: {
68
- // Plain .md files are read as CommonMark, so < and { in a doc never break the build.
69
- format: 'detect',
70
- mermaid: true,
71
- },
72
-
73
- presets: [
74
- [
75
- 'classic',
76
- {
77
- docs: {
78
- // The Markdown lives in the project's root docs/ folder, not inside this site.
79
- path: '../docs',
80
- routeBasePath: '/',
81
- sidebarPath: './sidebars.ts',
82
- sidebarItemsGenerator: generateSidebarItems,
83
- },
84
- blog: false,
85
- theme: {
86
- customCss: './src/css/custom.css',
87
- },
88
- } satisfies Preset.Options,
89
- ],
90
- ],
91
-
92
- themes: [['@getcanary/docusaurus-theme-search-pagefind', {}], '@docusaurus/theme-mermaid'],
93
-
94
- themeConfig: {
95
- tableOfContents: {
96
- minHeadingLevel: 2,
97
- maxHeadingLevel: 3,
98
- },
99
- colorMode: {
100
- defaultMode: 'light',
101
- respectPrefersColorScheme: true,
102
- },
103
- navbar: {
104
- title: `${PROJECT_NAME} Docs`,
105
- logo: {
106
- alt: 'Logo',
107
- src: 'images/logo.svg',
108
- },
109
- items: [],
110
- },
111
- prism: {
112
- theme: prismThemes.oneLight,
113
- darkTheme: prismThemes.oneDark,
114
- additionalLanguages: ['bash', 'json'],
115
- },
116
- } satisfies Preset.ThemeConfig,
117
- };
118
-
119
- export default config;
@@ -1,8 +0,0 @@
1
- import type {SidebarsConfig} from '@docusaurus/plugin-content-docs';
2
-
3
- const sidebars: SidebarsConfig = {
4
- // Built from the folder structure of the project's docs/ folder
5
- docsSidebar: [{type: 'autogenerated', dirName: '.'}],
6
- };
7
-
8
- export default sidebars;
@@ -1 +0,0 @@
1
- pnpm exec commitlint --edit "$1"
@@ -1,17 +0,0 @@
1
- /** @type {import("prettier").Config & import("prettier-plugin-tailwindcss").PluginOptions} */
2
- const config = {
3
- printWidth: 100,
4
- tabWidth: 2,
5
- useTabs: false,
6
- singleQuote: false,
7
- trailingComma: "all",
8
- bracketSpacing: true,
9
- bracketSameLine: false,
10
- arrowParens: "always",
11
- semi: true,
12
- endOfLine: "lf",
13
- plugins: ["prettier-plugin-tailwindcss"],
14
- tailwindStylesheet: "./app/globals.css",
15
- };
16
-
17
- export default config;