|
| 1 | +# Contributing to @takk/mcpcustoms |
| 2 | + |
| 3 | +Thanks for considering a contribution. This document is the canonical guide for proposing changes to `@takk/mcpcustoms`. |
| 4 | + |
| 5 | +The project is open source under [Apache License 2.0](../LICENSE). The package surface and stability promise are documented in [SPEC.md](../SPEC.md); the live roadmap and deferred work are in [TASK.md](../TASK.md). |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +## 1. Code of conduct |
| 10 | + |
| 11 | +Be respectful, be precise, and assume good faith. The maintainer reads every issue and PR personally; disrespectful, harmful, or manipulative behavior is grounds for removal from the project. |
| 12 | + |
| 13 | +--- |
| 14 | + |
| 15 | +## 2. Contributor license |
| 16 | + |
| 17 | +Every contribution is governed by the Apache License 2.0 (the same license the project is published under). Sign off every commit with `git commit -s` (Developer Certificate of Origin): |
| 18 | + |
| 19 | +```bash |
| 20 | +git commit -s -m "fix(detectors): tighten the path-traversal pattern" |
| 21 | +``` |
| 22 | + |
| 23 | +The `-s` flag appends a `Signed-off-by:` trailer that attests you have the right to submit the change under Apache 2.0. PRs without DCO sign-off are not merged. |
| 24 | + |
| 25 | +--- |
| 26 | + |
| 27 | +## 3. Local setup |
| 28 | + |
| 29 | +### 3.1 Prerequisites |
| 30 | + |
| 31 | +- **Node 20, 22, or 24.** CI runs the full matrix; pick one for local dev. `.nvmrc` pins the LTS line. |
| 32 | +- **pnpm 9 or 10.** The repo uses `pnpm` for install and scripts. `npm` and `yarn` also work but `pnpm-lock.yaml` is the source of truth. |
| 33 | +- **git** with `git commit -s` configured (DCO). |
| 34 | + |
| 35 | +### 3.2 Clone and install |
| 36 | + |
| 37 | +```bash |
| 38 | +git clone https://github.com/davccavalcante/mcpcustoms.git |
| 39 | +cd mcpcustoms |
| 40 | +pnpm install |
| 41 | +``` |
| 42 | + |
| 43 | +### 3.3 Verify locally |
| 44 | + |
| 45 | +```bash |
| 46 | +pnpm verify # lint + typecheck + test + build + smoke + publint |
| 47 | +# or run individually: |
| 48 | +pnpm lint |
| 49 | +pnpm typecheck |
| 50 | +pnpm test |
| 51 | +pnpm test:coverage |
| 52 | +pnpm build |
| 53 | +pnpm publint |
| 54 | +``` |
| 55 | + |
| 56 | +Current baseline (verify before opening a PR): **158 tests passing across 19 suites**. Coverage `lines 95.7% / statements 95.3% / functions 98.6% / branches 89.1%`. |
| 57 | + |
| 58 | +--- |
| 59 | + |
| 60 | +## 4. Branch and commit conventions |
| 61 | + |
| 62 | +### 4.1 Branch names |
| 63 | + |
| 64 | +- `fix/<short-slug>`: bug fixes |
| 65 | +- `feat/<short-slug>`: new optional surface (minor bump) |
| 66 | +- `docs/<short-slug>`: README/SPEC/CHANGELOG-only changes |
| 67 | +- `chore/<short-slug>`: tooling, deps, CI |
| 68 | +- `refactor/<short-slug>`: internal restructuring with no API change |
| 69 | + |
| 70 | +Avoid PRs larger than ~500 LOC; split into smaller logically-coherent PRs. |
| 71 | + |
| 72 | +### 4.2 Commit style |
| 73 | + |
| 74 | +[Conventional Commits](https://www.conventionalcommits.org/) are encouraged but not enforced. What IS enforced: |
| 75 | + |
| 76 | +- **One commit per logical change.** No `WIP` or `fixup` commits in the merged history. |
| 77 | +- **Imperative subject up to 70 chars.** Body wrap at 72 cols. |
| 78 | +- **DCO sign-off (`git commit -s`).** |
| 79 | +- **No commit credits to AI assistants.** This is the Creator's discipline. |
| 80 | + |
| 81 | +### 4.3 What requires a discussion before coding |
| 82 | + |
| 83 | +Open a GitHub Issue first if your change touches: |
| 84 | + |
| 85 | +- New public export (SemVer minor/major impact, see [SPEC.md §5](../SPEC.md#5-stability-promise)). |
| 86 | +- New telemetry event kind. |
| 87 | +- The on-disk JSON snapshot schema of the file state backend. |
| 88 | +- The CLI flags or subcommands. |
| 89 | +- The `Detector`, `Policy`, `StateBackend`, or `Signer` interface, or the `Verdict` shape. |
| 90 | + |
| 91 | +For docs-only fixes, typos, or contained internal refactors, skip the issue and open a PR directly. |
| 92 | + |
| 93 | +--- |
| 94 | + |
| 95 | +## 5. Pull request workflow |
| 96 | + |
| 97 | +### 5.1 Before opening |
| 98 | + |
| 99 | +- All checks green: `pnpm verify`. |
| 100 | +- Coverage thresholds preserved or improved (see `vitest.config.ts`). |
| 101 | +- For any change that touches the public API: `SPEC.md` and `README.md` updated. |
| 102 | +- For any deprecated surface: `@deprecated` JSDoc + runtime `console.warn` (debounced) + a `### Deprecated` section in the next `CHANGELOG.md` entry. |
| 103 | + |
| 104 | +### 5.2 PR description |
| 105 | + |
| 106 | +Fill the [PULL_REQUEST_TEMPLATE.md](./PULL_REQUEST_TEMPLATE.md) honestly. Empty sections are not acceptable; write "N/A" with a one-line reason if a section truly does not apply. |
| 107 | + |
| 108 | +### 5.3 Review |
| 109 | + |
| 110 | +The maintainer reviews every PR personally. Expect: |
| 111 | + |
| 112 | +- Surgical line-by-line read. |
| 113 | +- Question on intent before merge (Creator's discipline: "if you notice any problem, error, or inconsistency, ask before acting"). |
| 114 | +- Required for governance-touching changes: explicit Creator approval before merge. |
| 115 | + |
| 116 | +### 5.4 After merge |
| 117 | + |
| 118 | +CI publishes nothing on merge to `main`. Publishing is a Creator-triggered, two-step flow via `release.yml` then `npm-publish.yml` (see [RELEASING.md](./RELEASING.md)). |
| 119 | + |
| 120 | +--- |
| 121 | + |
| 122 | +## 6. Tests |
| 123 | + |
| 124 | +Add tests for any non-trivial change. Patterns: |
| 125 | + |
| 126 | +- **Vitest** (`tests/**/*.test.ts`). One file per surface area. Inject the clock for time-dependent behavior; detectors are pure functions and need no mocks. |
| 127 | +- **Determinism, not network.** Inspection performs no I/O, so tests run fully offline with no fixtures, no real credentials, and no network calls. |
| 128 | +- **CLI tests run in-process.** The CLI is exercised by calling `runCli` over an injected `CliIO` (see `tests/cli.test.ts`), never by spawning a `tsx` wrapper, so exit codes and signals are the CLI's own. The distribution smoke (`scripts/smoke-dist.mjs`) spawns the built `dist/cli/index.js` with `node` directly. |
| 129 | + |
| 130 | +Every fix-able bug ships with a regression test that fails pre-fix and passes post-fix. |
| 131 | + |
| 132 | +--- |
| 133 | + |
| 134 | +## 7. Security disclosure |
| 135 | + |
| 136 | +Do NOT open a public GitHub Issue for security vulnerabilities. Email `davcavalcante@proton.me` with the prefix `[SECURITY]` and we will coordinate fix + disclosure timeline privately. |
| 137 | + |
| 138 | +--- |
| 139 | + |
| 140 | +## 8. Releasing |
| 141 | + |
| 142 | +Releases are maintainer-only. The full runbook lives in [RELEASING.md](./RELEASING.md). Contributors do not tag, do not publish, do not edit historical CHANGELOG entries (those are immutable per Keep a Changelog). |
| 143 | + |
| 144 | +When proposing a change that warrants a release, indicate in your PR description which SemVer bump you believe it triggers (patch / minor / major per [SPEC.md §5.2](../SPEC.md#52-semver-policy)). The maintainer makes the final call. |
| 145 | + |
| 146 | +--- |
| 147 | + |
| 148 | +## 9. Communication |
| 149 | + |
| 150 | +- **GitHub Issues** for bug reports + feature requests (see [ISSUE_TEMPLATE/](./ISSUE_TEMPLATE)). |
| 151 | +- **GitHub Discussions** (if enabled) for design conversations. |
| 152 | +- **Email** `davcavalcante@proton.me` for anything private, sensitive, or trademark/licence-related. |
| 153 | + |
| 154 | +The project's primary language for code, docs, CI, issues, and PRs is **English**. Use English in PR descriptions and code comments. |
| 155 | + |
| 156 | +--- |
| 157 | + |
| 158 | +## Contact |
| 159 | + |
| 160 | +**David C Cavalcante** |
| 161 | +- Email: [davcavalcante@proton.me](mailto:davcavalcante@proton.me) |
| 162 | +- LinkedIn: [linkedin.com/in/hellodav](https://linkedin.com/in/hellodav) |
| 163 | +- GitHub: [github.com/davccavalcante](https://github.com/davccavalcante) |
| 164 | +- X: [x.com/davccavalcante](https://x.com/davccavalcante) |
| 165 | +- Project site: [takk.ag](https://takk.ag) |
0 commit comments