Skip to content

Commit b69f8a1

Browse files
committed
feat(docs): merge plans.md into make_plan.md, consolidate to 6 rule documents
- Merged unique content from plans.md into make_plan.md (Implementation Plan Creation & Execution) - Deleted docs/plans.md — eliminated redundancy between plan creation and plan formatting docs - Removed 'planning' category from RuleCategory; make_plan stays in 'workflow' - Redirected plans/planning/plan-rules aliases to make_plan in RULE_ALIASES - Updated all 6 doc files to remove plans.md cross-references - Added sleep 3 to command examples in testing.md and git-commands.md for consistency - Updated types/index.ts: removed plans from RULE_METADATA, CATEGORY_INFO, RuleCategory - Updated list-rules.ts: removed planning from category iteration - Updated tests: count 7→6, replaced plans.md test with alias resolution test - Updated .clinerules/project.md to reflect 6-document structure - All 106 tests passing across 4 test files
1 parent 89fc5b8 commit b69f8a1

12 files changed

Lines changed: 313 additions & 424 deletions

File tree

.clinerules/project.md

Lines changed: 273 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,273 @@
1+
# Generated Project Configuration
2+
3+
> **Auto-generated by `analyze_project`** (deep analysis)
4+
> **Project:** codeops-mcp
5+
> **Type:** library
6+
7+
---
8+
9+
## 🚨 MANDATORY: Load CodeOps Rules Before Any Work
10+
11+
**Before ANY planning or implementation, the AI agent MUST load these rules
12+
using the codeops-mcp tools:**
13+
14+
1. `get_rule("agents")` — Load agent behavior rules **(REQUIRED FIRST)**
15+
2. `get_rule("code")` — Load coding standards
16+
3. `get_rule("testing")` — Load testing workflows
17+
4. `get_rule("git-commands")` — Load git commit protocols
18+
19+
These rules are **mandatory** and must be consulted before every task.
20+
**Do NOT skip this step. Do NOT proceed without reading these documents.**
21+
22+
---
23+
24+
## Project Overview
25+
26+
- **Name:** codeops-mcp
27+
- **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:** blendsdk
30+
- **License:** MIT
31+
- **Node Engine:** >=18.0.0
32+
- **Module System:** ESM (`"type": "module"`)
33+
34+
## Toolchain
35+
36+
- **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`)
43+
44+
**Manifest files found:** package.json, tsconfig.json, vitest.config.ts, .releaserc.json, yarn.lock
45+
46+
## Commands
47+
48+
All commands assume execution from the project root. Prefix all shell commands with `clear &&`.
49+
50+
### Build
51+
52+
```bash
53+
clear && yarn build
54+
```
55+
56+
### Test
57+
58+
```bash
59+
# Run all tests (106 tests across 4 test files)
60+
clear && yarn test
61+
62+
# Run tests in watch mode
63+
clear && yarn test:watch
64+
65+
# Run tests with coverage
66+
clear && yarn test:coverage
67+
```
68+
69+
### Verify (before commit)
70+
71+
```bash
72+
# Full verification — run this before any git commit
73+
clear && yarn build && yarn test
74+
```
75+
76+
### Other Commands
77+
78+
```bash
79+
# Watch mode (recompile on change)
80+
clear && yarn watch
81+
82+
# Start the server
83+
clear && yarn start
84+
85+
# Clean dist/
86+
clear && yarn clean
87+
88+
# Update all dependencies
89+
clear && yarn ncu
90+
```
91+
92+
## Project Structure
93+
94+
### Type: Single repository
95+
96+
### Directory Layout
97+
98+
```
99+
docs/ # Rule markdown documents (6 files, shipped with npm package)
100+
agents.md # AI agent behavior rules
101+
code.md # Coding standards (DRY, architecture, type safety)
102+
git-commands.md # Git commit protocols (gitcm/gitcmp)
103+
make_plan.md # Plan creation, execution protocol & implementation plan formatting
104+
project-template.md # Project configuration template
105+
testing.md # Testing standards & workflows
106+
src/ # TypeScript source code
107+
index.ts # Main entry point — MCP server bootstrap
108+
config.ts # Configuration resolution (CLI/env/defaults)
109+
types/ # Type definitions
110+
index.ts # All interfaces, types, constants, and metadata
111+
store/ # Data layer
112+
rule-store.ts # In-memory document store with O(1) lookup + fuzzy matching
113+
search-engine.ts # TF-IDF search engine with field weighting
114+
tools/ # MCP tool implementations (5 tools)
115+
get-rule.ts # get_rule — Retrieve a rule document by name/alias
116+
list-rules.ts # list_rules — List all rules grouped by category
117+
search-rules.ts # search_rules — Full-text search across rules
118+
analyze-project.ts # analyze_project — Scan project + generate/merge project.md
119+
get-setup-guide.ts # get_setup_guide — Setup instructions for new projects
120+
__tests__/ # Test files (Vitest)
121+
store/ # Store layer tests
122+
rule-store.test.ts
123+
search-engine.test.ts
124+
tools/ # Tool layer tests
125+
tools-setup.ts # Shared test fixture (lazy-loaded store + engine)
126+
core-tools.test.ts # Tests for get_rule, list_rules, search_rules, get_setup_guide
127+
analyze-project-merge.test.ts # Tests for analyze_project + merge engine
128+
dist/ # Compiled output (git-ignored)
129+
```
130+
131+
### Architecture Layers
132+
133+
```
134+
┌─────────────────────────────────────────┐
135+
│ MCP Protocol (stdio transport) │
136+
│ index.ts — Server + tool dispatcher │
137+
├─────────────────────────────────────────┤
138+
│ Tools Layer (5 pure functions) │
139+
│ get-rule, list-rules, search-rules, │
140+
│ analyze-project, get-setup-guide │
141+
├─────────────────────────────────────────┤
142+
│ Store Layer │
143+
│ RuleStore (in-memory Map<id, doc>) │
144+
│ SearchEngine (TF-IDF inverted index) │
145+
├─────────────────────────────────────────┤
146+
│ Types Layer │
147+
│ Interfaces, constants, metadata │
148+
├─────────────────────────────────────────┤
149+
│ Config Layer │
150+
│ CLI args → env vars → bundled defaults │
151+
└─────────────────────────────────────────┘
152+
```
153+
154+
## Coding Conventions
155+
156+
### Naming
157+
158+
- **Files:** kebab-case (e.g., `rule-store.ts`, `get-rule.ts`, `analyze-project.ts`)
159+
- **Exception:** `make_plan` uses underscore in ID (matches the doc filename `make_plan.md`)
160+
- **Classes:** PascalCase (e.g., `RuleStore`, `SearchEngine`, `StdioServerTransport`)
161+
- **Functions/Methods:** camelCase (e.g., `getRule`, `findByName`, `resolveConfig`, `analyzeProject`)
162+
- **Interfaces/Types:** PascalCase (e.g., `RuleDocument`, `SearchResult`, `ProjectAnalysis`, `ServerConfig`)
163+
- **Constants:** UPPER_SNAKE_CASE (e.g., `STOP_WORDS`, `FIELD_WEIGHTS`, `AUTO_UPDATE_SECTIONS`, `RULE_METADATA`)
164+
- **Inline constants (objects):** UPPER_SNAKE_CASE (e.g., `TOOL_DEFINITIONS`, `CATEGORY_INFO`)
165+
- **Module-scoped privates:** camelCase (e.g., `cachedStore`, `cachedEngine`)
166+
- **Test fixtures:** UPPER_SNAKE_CASE prefixed with `FIXTURE_` or `SAMPLE_` (e.g., `FIXTURE_FULL_PROJECT_MD`, `SAMPLE_ANALYSIS`)
167+
168+
### Code Style
169+
170+
- **Module format:** ESM with `.js` import extensions (required by Node16 resolution)
171+
- **Imports:** Type-only imports use `import type { ... }` syntax
172+
- **JSDoc:** Every exported function, class, and interface has JSDoc comments with `@param`, `@returns`, `@module` tags
173+
- **Section separators:** `// ============` comment blocks separate logical sections within files
174+
- **Error handling:** Errors caught and returned as formatted markdown strings (`**Error:** message`), never thrown to caller
175+
- **Console output:** All log output goes to `stderr` (stdout reserved for MCP protocol)
176+
- **Access modifiers:** Class members use `protected` for internal/overridable, `public` for API surface
177+
- **Const assertions:** `as const` used for object literals that define fixed shapes (e.g., `FIELD_WEIGHTS`, `type: 'object' as const`)
178+
179+
### Patterns
180+
181+
- **Pure function tools:** Each tool is a standalone exported function taking (store/engine, args) → string
182+
- **Formatter pattern:** Private `format*()` functions handle all markdown output generation
183+
- **Lazy caching:** Test setup uses lazy singleton pattern (`cachedStore ?? build()`)
184+
- **Mutation-in-place:** Project analysis functions mutate the `analysis` object directly (passed by reference)
185+
- **Strategy pattern:** Merge engine uses `SectionMergeStrategy` classification (`auto-update`, `preserve`, `static`)
186+
- **Fuzzy matching chain:** RuleStore.findByName tries 5 strategies in priority order (exact → alias → case-insensitive → partial → title)
187+
188+
## Git & Commit Conventions
189+
190+
### Commit Scope
191+
192+
```
193+
# Use module/feature as scope:
194+
# feat(tools): add new MCP tool
195+
# fix(store): correct fuzzy matching
196+
# test(merge): add merge engine tests
197+
# refactor(types): reorganize interfaces
198+
# docs(rules): update coding standards
199+
200+
# Common scopes: tools, store, types, config, docs, merge, search, rules
201+
```
202+
203+
### Branch Strategy
204+
205+
- **Main branch:** `master` (used by semantic-release, see `.releaserc.json`)
206+
- **Feature branches:** `feature/[name]`
207+
- **Release:** Automated via semantic-release on `master` branch
208+
209+
### Release Process
210+
211+
- **Automated:** semantic-release handles versioning, changelog, npm publish, and GitHub releases
212+
- **Commit convention:** Conventional Commits (feat, fix, chore, etc.)
213+
- **Version:** Currently `1.2.0`
214+
- **Published files:** `dist/`, `docs/`, `README.md`, `LICENSE`
215+
- **Binary:** `codeops-mcp` CLI command (from `dist/index.js`)
216+
217+
## Special Rules (Project-Specific)
218+
219+
```
220+
1. The docs/ directory contains the core rule documents that are SHIPPED with the npm
221+
package. Changes to docs/ files affect ALL users of codeops-mcp. Treat them as public API.
222+
223+
2. stdout is RESERVED for MCP protocol communication. All logging MUST go to stderr
224+
(use console.error, not console.log, except for --version output).
225+
226+
3. Tool functions return formatted markdown strings — they never throw errors.
227+
All error conditions are returned as "**Error:** message" formatted strings.
228+
229+
4. The analyze_project tool has TWO paths:
230+
- Fresh generation: No existing .clinerules/project.md → generate from scratch
231+
- Incremental merge: Existing file found → parse sections, merge with fresh scan,
232+
preserve user customizations (Coding Conventions, Git Conventions, Special Rules),
233+
update auto-detectable sections (Toolchain, Commands, Structure)
234+
235+
5. Tests use the REAL docs/ directory for integration testing (not mocks).
236+
The test setup (tools-setup.ts) uses lazy caching to avoid repeated file I/O.
237+
238+
6. Import paths MUST include .js extension (e.g., './config.js', '../types/index.js')
239+
because of Node16 module resolution with ESM.
240+
241+
7. The 6 rule document IDs are hardcoded in RULE_METADATA and RULE_ALIASES in types/index.ts.
242+
Adding a new rule document requires updating both maps.
243+
244+
8. All test files live under src/__tests__/ mirroring the src/ structure.
245+
Test files are excluded from TypeScript compilation (tsconfig.json exclude).
246+
```
247+
248+
## Test Structure
249+
250+
```
251+
4 test files, 106 total tests:
252+
253+
src/__tests__/store/rule-store.test.ts — 21 tests (loading, lookup, fuzzy matching, categories, metadata)
254+
src/__tests__/store/search-engine.test.ts — 12 tests (indexing, search, scoring, filtering, excerpts)
255+
src/__tests__/tools/core-tools.test.ts — 28 tests (get_rule, list_rules, search_rules, get_setup_guide)
256+
src/__tests__/tools/analyze-project-merge.test.ts — 45 tests (parser, classifier, merge engine, integration)
257+
258+
Test style:
259+
- Integration tests using real docs/ directory
260+
- Temp directory tests for filesystem operations (mkdtemp + cleanup)
261+
- Fixture constants for merge tests (FIXTURE_FULL_PROJECT_MD, SAMPLE_ANALYSIS, etc.)
262+
- beforeAll for shared setup, beforeEach/afterEach for temp dirs
263+
```
264+
265+
## Cross-References
266+
267+
The generic rule files that read this `project.md`:
268+
269+
- **make_plan.md** — Uses verify command, file paths, commit scope, task file path patterns
270+
- **code.md** — Uses language conventions, architecture rules
271+
- **testing.md** — Uses test commands, test locations, test framework
272+
- **git-commands.md** — Uses commit scope, verify command
273+
- **agents.md** — Uses shell commands, verify command

docs/agents.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,6 @@ clear && sleep 3 && scripts/agent.sh finished
583583

584584
- See **code.md** for coding standards, testing requirements, and quality guidelines
585585
- See **testing.md** for test commands and workflow
586-
- See **plans.md** for detailed guidance on creating implementation plans
587-
- See **make_plan.md** for plan creation/execution triggers and session rules
586+
- See **make_plan.md** for plan creation/execution triggers, session rules, and implementation plan formatting
588587
- See **git-commands.md** for git workflow instructions (`gitcm`, `gitcmp`)
589588
- See **`.clinerules/project.md`** for project-specific commands, toolchain, and conventions

docs/code.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ These rules are **mandatory** and must be applied **strictly and consistently**
6868
- Write granular, focused tests that test one thing at a time.
6969
- Each test should have a clear purpose and failure message.
7070
- Small, specific tests are easier to debug when they fail.
71-
- See also: `plans.md` Rule 8 for task-level testing requirements.
71+
- See also: `make_plan.md` Phase 1B for pre-implementation re-evaluation and testing requirements.
7272

7373
---
7474

@@ -387,7 +387,7 @@ These rules are **mandatory** and must be applied **strictly and consistently**
387387
## **Cross-References**
388388
389389
- See **`.clinerules/project.md`** for project-specific language, toolchain, and naming conventions
390-
- See **plans.md** for task-level testing breakdowns and implementation planning
390+
- See **make_plan.md** for task-level testing breakdowns and implementation planning
391391
- See **agents.md** for verification procedures and task completion criteria
392392
- See **testing.md** for test commands and AI testing workflow
393393
- See **git-commands.md** for git workflow instructions

docs/git-commands.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ When the user provides these keywords, Cline should perform the following action
8383

8484
```bash
8585
# Stage changes
86-
clear && git add .
86+
clear && sleep 3 && git add .
8787

8888
# Create commit message file
8989
# (write the message using write_to_file tool to /tmp/git_commit_msg.txt)
@@ -144,7 +144,7 @@ Use the module name, package name, service name, or directory as the scope. Chec
144144

145145
```bash
146146
# Stage changes
147-
clear && git add .
147+
clear && sleep 3 && git add .
148148

149149
# Create commit message file
150150
# (write the message using write_to_file tool to /tmp/git_commit_msg.txt)

docs/make_plan.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,26 @@ Please confirm or adjust before I create the plan.
220220

221221
---
222222

223+
### **Phase 1B: Pre-Implementation Re-evaluation**
224+
225+
**IMPORTANT:** Before creating plan documents, and again before starting each phase during execution, re-evaluate to ensure nothing was missed:
226+
227+
1. **✅ Completeness** — Are all requirements covered? Any missing edge cases?
228+
2. **✅ Context & Reasoning** — Can you explain WHY each phase exists and what problem it solves?
229+
3. **✅ Task Granularity** — Are tasks small enough (2-4 hours)? Can each be tested independently?
230+
4. **✅ Dependencies** — Are all dependencies documented? No circular dependencies?
231+
5. **✅ Testing** — Does every task have testing/validation requirements?
232+
6. **✅ Architecture** — Will any implementation exceed 500 lines? Is splitting planned?
233+
7. **✅ Scope Boundaries** — Are changes properly scoped? Do new files follow existing patterns?
234+
235+
**When to Re-evaluate:**
236+
- ✅ Before creating plan documents (now)
237+
- ✅ After completing each phase (before starting next)
238+
- ✅ When requirements change
239+
- ✅ When discovering new technical constraints
240+
241+
---
242+
223243
### **Phase 2: Create Plan Documents**
224244

225245
#### 2.1 Folder Structure
@@ -953,7 +973,6 @@ When creating and executing plans:
953973
- ✅ Follow **code.md** for coding standards and quality requirements
954974
- ✅ Follow **testing.md** for test commands and workflow
955975
- ✅ Follow **git-commands.md** for `gitcm`/`gitcmp` commit protocol
956-
- ✅ Follow **plans.md** for task granularity and formatting rules
957976
- ✅ Follow **agents.md** for general AI agent behavior rules
958977
- ✅ Read **`.clinerules/project.md`** for project-specific commands and conventions
959978

0 commit comments

Comments
 (0)