Cline rules
.clinerules/project.mdCline rules
Quality
91/100
Scores the file, not the repository.Length
1,466 words
39 headings · 9 code blocksRepository
0
— · pushed 53 days agoLast changed
3 days ago
First indexed 3 days ago.1# Generated Project Configuration23> **Auto-generated by `analyze_project`** (deep analysis)4> **Project:** codeops-mcp5> **Type:** library67---89## 🚨 MANDATORY: Load CodeOps Rules Before Any Work1011**Before ANY planning or implementation, the AI agent MUST load these rules12using the codeops-mcp tools:**13141. `get_rule("agents")` — Load agent behavior rules **(REQUIRED FIRST)**152. `get_rule("code")` — Load coding standards163. `get_rule("testing")` — Load testing workflows174. `get_rule("git-commands")` — Load git commit protocols1819These rules are **mandatory** and must be consulted before every task.20**Do NOT skip this step. Do NOT proceed without reading these documents.**2122---2324## Project Overview2526- **Name:** codeops-mcp27- **Description:** MCP (Model Context Protocol) server providing AI coding agents with universal, language-agnostic development rules. Includes coding standards, testing workflows, git conventions, plan creation/execution protocols, and intelligent project analysis for auto-generating project configurations.28- **Type:** library (MCP server, published to npm)29- **Author:** blendsdk30- **License:** MIT31- **Node Engine:** >=18.0.032- **Module System:** ESM (`"type": "module"`)3334## Toolchain3536- **Language(s):** TypeScript (ES2022 target, Node16 module resolution)37- **Framework(s):** MCP SDK (`@modelcontextprotocol/sdk`)38- **Package Manager:** yarn (v1, lockfile: `yarn.lock`)39- **Test Framework:** Vitest (v2.x, `vitest run`)40- **Build:** `tsc` (TypeScript compiler, outputs to `dist/`)41- **Release:** semantic-release (with changelog, git, github, npm plugins)42- **TypeScript Config:** Strict mode enabled (`strict: true`, `noUnusedLocals`, `noUnusedParameters`, `noImplicitReturns`, `noFallthroughCasesInSwitch`)4344**Manifest files found:** package.json, tsconfig.json, vitest.config.ts, .releaserc.json, yarn.lock4546## Commands4748All commands assume execution from the project root. Prefix all shell commands with `clear &&`.4950### Build5152```bash53clear && yarn build54```5556### Test5758```bash59# Run all tests (107 tests across 4 test files)60clear && yarn test6162# Run tests in watch mode63clear && yarn test:watch6465# Run tests with coverage66clear && yarn test:coverage67```6869### Verify (before commit)7071```bash72# Full verification — run this before any git commit73clear && yarn build && yarn test74```7576### Other Commands7778```bash79# Watch mode (recompile on change)80clear && yarn watch8182# Start the server83clear && yarn start8485# Clean dist/86clear && yarn clean8788# Update all dependencies89clear && yarn ncu90```9192## Project Structure9394### Type: Single repository9596### Directory Layout9798```99docs/ # Rule markdown documents (12 files, shipped with npm package)100 agents.md # AI agent behavior rules101 code.md # Coding standards (DRY, architecture, type safety)102 git-commands.md # Git commit protocols (gitcm/gitcmp)103 grill_me.md # Deep disambiguation protocol (grill_me)104 make_plan.md # Plan creation, execution protocol & implementation plan formatting105 preflight.md # Preflight review protocol — multi-dimensional quality audit (preflight)106 project-template.md # Project configuration template107 requirements.md # Requirements gathering & documentation (make_requirements)108 retro_requirements.md # Reverse requirements engineering (retro_requirements)109 techdocs.md # Technical architecture documentation (make_techdocs)110 testing.md # Testing standards & workflows111 upgrade_plan.md # Plan & requirements upgrade protocol (upgrade_plan, upgrade_requirements)112src/ # TypeScript source code113 index.ts # Main entry point — MCP server bootstrap114 config.ts # Configuration resolution (CLI/env/defaults)115 types/ # Type definitions116 index.ts # All interfaces, types, constants, and metadata117 store/ # Data layer118 rule-store.ts # In-memory document store with O(1) lookup + fuzzy matching119 search-engine.ts # TF-IDF search engine with field weighting120 tools/ # MCP tool implementations (5 tools)121 get-rule.ts # get_rule — Retrieve a rule document by name/alias122 list-rules.ts # list_rules — List all rules grouped by category123 search-rules.ts # search_rules — Full-text search across rules124 analyze-project.ts # analyze_project — Scan project + generate/merge project.md125 get-setup-guide.ts # get_setup_guide — Setup instructions for new projects126 __tests__/ # Test files (Vitest)127 store/ # Store layer tests128 rule-store.test.ts129 search-engine.test.ts130 tools/ # Tool layer tests131 tools-setup.ts # Shared test fixture (lazy-loaded store + engine)132 core-tools.test.ts # Tests for get_rule, list_rules, search_rules, get_setup_guide133 analyze-project-merge.test.ts # Tests for analyze_project + merge engine134dist/ # Compiled output (git-ignored)135```136137### Architecture Layers138139```140┌─────────────────────────────────────────┐141│ MCP Protocol (stdio transport) │142│ index.ts — Server + tool dispatcher │143├─────────────────────────────────────────┤144│ Tools Layer (5 pure functions) │145│ get-rule, list-rules, search-rules, │146│ analyze-project, get-setup-guide │147├─────────────────────────────────────────┤148│ Store Layer │149│ RuleStore (in-memory Map<id, doc>) │150│ SearchEngine (TF-IDF inverted index) │151├─────────────────────────────────────────┤152│ Types Layer │153│ Interfaces, constants, metadata │154├─────────────────────────────────────────┤155│ Config Layer │156│ CLI args → env vars → bundled defaults │157└─────────────────────────────────────────┘158```159160## Coding Conventions161162### Naming163164- **Files:** kebab-case (e.g., `rule-store.ts`, `get-rule.ts`, `analyze-project.ts`)165- **Exception:** `make_plan` uses underscore in ID (matches the doc filename `make_plan.md`)166- **Classes:** PascalCase (e.g., `RuleStore`, `SearchEngine`, `StdioServerTransport`)167- **Functions/Methods:** camelCase (e.g., `getRule`, `findByName`, `resolveConfig`, `analyzeProject`)168- **Interfaces/Types:** PascalCase (e.g., `RuleDocument`, `SearchResult`, `ProjectAnalysis`, `ServerConfig`)169- **Constants:** UPPER_SNAKE_CASE (e.g., `STOP_WORDS`, `FIELD_WEIGHTS`, `AUTO_UPDATE_SECTIONS`, `RULE_METADATA`)170- **Inline constants (objects):** UPPER_SNAKE_CASE (e.g., `TOOL_DEFINITIONS`, `CATEGORY_INFO`)171- **Module-scoped privates:** camelCase (e.g., `cachedStore`, `cachedEngine`)172- **Test fixtures:** UPPER_SNAKE_CASE prefixed with `FIXTURE_` or `SAMPLE_` (e.g., `FIXTURE_FULL_PROJECT_MD`, `SAMPLE_ANALYSIS`)173174### Code Style175176- **Module format:** ESM with `.js` import extensions (required by Node16 resolution)177- **Imports:** Type-only imports use `import type { ... }` syntax178- **JSDoc:** Every exported function, class, and interface has JSDoc comments with `@param`, `@returns`, `@module` tags179- **Section separators:** `// ============` comment blocks separate logical sections within files180- **Error handling:** Errors caught and returned as formatted markdown strings (`**Error:** message`), never thrown to caller181- **Console output:** All log output goes to `stderr` (stdout reserved for MCP protocol)182- **Access modifiers:** Class members use `protected` for internal/overridable, `public` for API surface183- **Const assertions:** `as const` used for object literals that define fixed shapes (e.g., `FIELD_WEIGHTS`, `type: 'object' as const`)184185### Patterns186187- **Pure function tools:** Each tool is a standalone exported function taking (store/engine, args) → string188- **Formatter pattern:** Private `format*()` functions handle all markdown output generation189- **Lazy caching:** Test setup uses lazy singleton pattern (`cachedStore ?? build()`)190- **Mutation-in-place:** Project analysis functions mutate the `analysis` object directly (passed by reference)191- **Strategy pattern:** Merge engine uses `SectionMergeStrategy` classification (`auto-update`, `preserve`, `static`)192- **Fuzzy matching chain:** RuleStore.findByName tries 5 strategies in priority order (exact → alias → case-insensitive → partial → title)193194## Git & Commit Conventions195196### Commit Scope197198```199# Use module/feature as scope:200# feat(tools): add new MCP tool201# fix(store): correct fuzzy matching202# test(merge): add merge engine tests203# refactor(types): reorganize interfaces204# docs(rules): update coding standards205206# Common scopes: tools, store, types, config, docs, merge, search, rules207```208209### Branch Strategy210211- **Main branch:** `master` (used by semantic-release, see `.releaserc.json`)212- **Feature branches:** `feature/[name]`213- **Release:** Automated via semantic-release on `master` branch214215### Release Process216217- **Automated:** semantic-release handles versioning, changelog, npm publish, and GitHub releases218- **Commit convention:** Conventional Commits (feat, fix, chore, etc.)219- **Version:** Currently `1.2.0`220- **Published files:** `dist/`, `docs/`, `README.md`, `LICENSE`221- **Binary:** `codeops-mcp` CLI command (from `dist/index.js`)222223## Special Rules (Project-Specific)224225```2261. The docs/ directory contains the core rule documents that are SHIPPED with the npm227 package. Changes to docs/ files affect ALL users of codeops-mcp. Treat them as public API.2282292. stdout is RESERVED for MCP protocol communication. All logging MUST go to stderr230 (use console.error, not console.log, except for --version output).2312323. Tool functions return formatted markdown strings — they never throw errors.233 All error conditions are returned as "**Error:** message" formatted strings.2342354. The analyze_project tool has TWO paths:236 - Fresh generation: No existing .clinerules/project.md → generate from scratch237 - Incremental merge: Existing file found → parse sections, merge with fresh scan,238 preserve user customizations (Coding Conventions, Git Conventions, Special Rules),239 update auto-detectable sections (Toolchain, Commands, Structure)2402415. Tests use the REAL docs/ directory for integration testing (not mocks).242 The test setup (tools-setup.ts) uses lazy caching to avoid repeated file I/O.2432446. Import paths MUST include .js extension (e.g., './config.js', '../types/index.js')245 because of Node16 module resolution with ESM.2462477. The 12 rule document IDs are hardcoded in RULE_METADATA and RULE_ALIASES in types/index.ts.248 Adding a new rule document requires updating both maps.2492508. All test files live under src/__tests__/ mirroring the src/ structure.251 Test files are excluded from TypeScript compilation (tsconfig.json exclude).252```253254## Test Structure255256```2574 test files, 107 total tests:258259src/__tests__/store/rule-store.test.ts — 22 tests (loading, lookup, fuzzy matching, categories, metadata)260src/__tests__/store/search-engine.test.ts — 12 tests (indexing, search, scoring, filtering, excerpts)261src/__tests__/tools/core-tools.test.ts — 28 tests (get_rule, list_rules, search_rules, get_setup_guide)262src/__tests__/tools/analyze-project-merge.test.ts — 45 tests (parser, classifier, merge engine, integration)263264Test style:265- Integration tests using real docs/ directory266- Temp directory tests for filesystem operations (mkdtemp + cleanup)267- Fixture constants for merge tests (FIXTURE_FULL_PROJECT_MD, SAMPLE_ANALYSIS, etc.)268- beforeAll for shared setup, beforeEach/afterEach for temp dirs269```270271## Cross-References272273The generic rule files that read this `project.md`:274275- **make_plan.md** — Uses verify command, file paths, commit scope, task file path patterns276- **code.md** — Uses language conventions, architecture rules277- **testing.md** — Uses test commands, test locations, test framework278- **git-commands.md** — Uses commit scope, verify command279- **agents.md** — Uses shell commands, verify command280- **requirements.md** — Uses project type, tech stack, and conventions for requirements discovery281- **retro_requirements.md** — Uses project type, tech stack for codebase analysis adaptation282
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| bashdeban/fastmind.clinerules/.project-consistency-keeper2.md · 5 | Cline rules | setupbuildtestlint-format+11 | 100/100 | 3 days ago | |
| JCodesMore/ai-website-cloner-template.clinerules · 31k | Cline rules | buildlint-formatstylearch+3 | 97/100 | 2 days ago | |
| BryaanF/LiantPortfolio.clinerules/project-guidelines.md · 0 | Cline rules | buildstylearchgit+2 | 96/100 | 3 days ago | |
| u9401066/zotero-keeper.clinerules/50-pubmed-project.md · 7 | Cline rules | testlint-formatstylearch+1 | 94/100 | 3 days ago | |
| u9401066/zotero-keepervscode-extension/resources/repo-assets/pubmed-search-mcp/.clinerules/50-pubmed-project.md · 7 | Cline rules | testlint-formatstylearch+1 | 94/100 | 3 days ago | |
| VaillerTeeter/HoshimiNest.clinerules/project-identity.md · 1 | Cline rules | setuparchtypesdo-not | 93/100 | yesterday | |
| HerringtonDarkholme/megarepo.clinerules/02-development.md · 17 | Cline rules | setupbuildteststyle+3 | 92/100 | 3 days ago | |
| u9401066/zotero-keeper.clinerules/60-pubmed-python.md · 7 | Cline rules | setuptestlint-formatstyle+2 | 86/100 | 3 days ago |
