@klitchevo/code-council 0.0.8 → 0.0.13
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.
- package/README.md +74 -3
- package/dist/chunk-Y77R7523.js +142 -0
- package/dist/index.js +1397 -103
- package/dist/tps-audit-GNK4VIKA.js +11 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -18,6 +18,8 @@ An MCP (Model Context Protocol) server that provides AI-powered code review usin
|
|
|
18
18
|
- 🔒 **Backend Review** - Security, architecture, and performance analysis
|
|
19
19
|
- 📋 **Plan Review** - Review implementation plans before writing code
|
|
20
20
|
- 📝 **Git Changes Review** - Review staged, unstaged, branch diffs, or specific commits
|
|
21
|
+
- 💬 **Council Discussions** - Multi-turn conversations with the AI council for deeper exploration
|
|
22
|
+
- 🏭 **TPS Audit** - Toyota Production System analysis for flow, waste, bottlenecks, and quality
|
|
21
23
|
- ⚡ **Parallel Execution** - All models run concurrently for fast results
|
|
22
24
|
|
|
23
25
|
## Quick Start
|
|
@@ -257,6 +259,72 @@ Use review_git_changes to review my staged changes
|
|
|
257
259
|
Use review_git_changes with review_type=commit and commit_hash=abc123 to review that commit
|
|
258
260
|
```
|
|
259
261
|
|
|
262
|
+
### `discuss_with_council`
|
|
263
|
+
|
|
264
|
+
Have multi-turn conversations with the AI council. Start a discussion, get feedback from all models, then ask follow-up questions while maintaining context.
|
|
265
|
+
|
|
266
|
+
**Parameters:**
|
|
267
|
+
- `message` (required): Your message or question for the council
|
|
268
|
+
- `session_id` (optional): Session ID to continue an existing discussion (omit to start new)
|
|
269
|
+
- `discussion_type` (optional): `code_review`, `plan_review`, or `general` (default: `general`)
|
|
270
|
+
- `context` (optional): Additional context (code snippets, plan details, etc.)
|
|
271
|
+
|
|
272
|
+
**Example usage in Claude:**
|
|
273
|
+
```
|
|
274
|
+
Use discuss_with_council to ask: What's the best way to implement error handling in a Node.js API?
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
**Continuing a discussion:**
|
|
278
|
+
```
|
|
279
|
+
Use discuss_with_council with session_id=<id-from-previous-response> to ask: Can you elaborate on the circuit breaker pattern you mentioned?
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
**Key features:**
|
|
283
|
+
- Each model maintains its own conversation history for authentic diverse perspectives
|
|
284
|
+
- Sessions persist for 30 minutes of inactivity
|
|
285
|
+
- Rate limited to 10 requests per minute per session
|
|
286
|
+
- Context windowing keeps conversations efficient
|
|
287
|
+
|
|
288
|
+
### `tps_audit`
|
|
289
|
+
|
|
290
|
+
Analyze any codebase using Toyota Production System (TPS) principles. Generates beautiful HTML reports with scores for flow, waste, bottlenecks, and quality.
|
|
291
|
+
|
|
292
|
+
**Parameters:**
|
|
293
|
+
- `path` (optional): Path to repository root (auto-detects git root if not provided)
|
|
294
|
+
- `focus_areas` (optional): Specific areas to focus on (e.g., `["flow", "security", "performance"]`)
|
|
295
|
+
- `max_files` (optional): Maximum files to analyze (default: 50, max: 100)
|
|
296
|
+
- `file_types` (optional): File extensions to include (default: common source files)
|
|
297
|
+
- `include_sensitive` (optional): Include potentially sensitive files (default: false)
|
|
298
|
+
- `output_format` (optional): `html`, `markdown`, or `json` (default: `html`)
|
|
299
|
+
|
|
300
|
+
**Example usage in Claude:**
|
|
301
|
+
```
|
|
302
|
+
Use tps_audit to analyze this repository
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
```
|
|
306
|
+
Use tps_audit with output_format=markdown and focus_areas=["security", "performance"]
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
**What it analyzes:**
|
|
310
|
+
- **Flow**: How data and control flow through the system, entry points, pathways
|
|
311
|
+
- **Muda (Waste)**: The 7 wastes - defects, overproduction, waiting, transportation, inventory, motion, extra-processing
|
|
312
|
+
- **Bottlenecks**: Where flow is constrained, severity and impact
|
|
313
|
+
- **Jidoka**: Built-in quality, fail-fast patterns, error handling
|
|
314
|
+
- **Recommendations**: Prioritized improvements with effort/impact ratings
|
|
315
|
+
|
|
316
|
+
**Security features:**
|
|
317
|
+
- Automatically skips sensitive files (`.env`, credentials, keys, tokens)
|
|
318
|
+
- Scans file contents for embedded secrets (AWS keys, GitHub PATs, etc.)
|
|
319
|
+
- Validates paths to prevent directory traversal attacks
|
|
320
|
+
- Enforces size limits to prevent resource exhaustion
|
|
321
|
+
|
|
322
|
+
**Output:**
|
|
323
|
+
Reports are saved to `.code-council/` directory:
|
|
324
|
+
- `tps-audit.html` - Interactive styled report with glass-morphism dark theme
|
|
325
|
+
- `tps-audit.md` - Markdown version
|
|
326
|
+
- `tps-audit.json` - Raw JSON data
|
|
327
|
+
|
|
260
328
|
### `list_review_config`
|
|
261
329
|
|
|
262
330
|
Show which AI models are currently configured for each review type.
|
|
@@ -272,6 +340,8 @@ You can customize which AI models are used for reviews by setting environment va
|
|
|
272
340
|
- `FRONTEND_REVIEW_MODELS` - Models for frontend reviews
|
|
273
341
|
- `BACKEND_REVIEW_MODELS` - Models for backend reviews
|
|
274
342
|
- `PLAN_REVIEW_MODELS` - Models for plan reviews
|
|
343
|
+
- `DISCUSSION_MODELS` - Models for council discussions
|
|
344
|
+
- `TPS_AUDIT_MODELS` - Models for TPS codebase audits
|
|
275
345
|
- `TEMPERATURE` - Control response randomness (0.0-2.0, default: 0.3)
|
|
276
346
|
- `MAX_TOKENS` - Maximum response tokens (default: 16384)
|
|
277
347
|
|
|
@@ -299,9 +369,10 @@ You can customize which AI models are used for reviews by setting environment va
|
|
|
299
369
|
|
|
300
370
|
**Default Models:**
|
|
301
371
|
If you don't specify models, the server uses these defaults:
|
|
302
|
-
- `minimax/minimax-m2.1`
|
|
303
|
-
- `z-ai/glm-4.7`
|
|
304
|
-
- `
|
|
372
|
+
- `minimax/minimax-m2.1` - Fast, cost-effective reasoning
|
|
373
|
+
- `z-ai/glm-4.7` - Strong multilingual capabilities
|
|
374
|
+
- `moonshotai/kimi-k2-thinking` - Advanced reasoning with thinking
|
|
375
|
+
- `deepseek/deepseek-v3.2` - State-of-the-art open model
|
|
305
376
|
|
|
306
377
|
**Finding Models:**
|
|
307
378
|
Browse all available models at [OpenRouter Models](https://openrouter.ai/models). Popular choices include:
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
// src/prompts/tps-audit.ts
|
|
2
|
+
var SYSTEM_PROMPT = `You are an expert Toyota Production System (TPS) consultant analyzing software codebases. Your role is to "walk the production line" - examining how code flows from input to output, identifying waste (muda), spotting bottlenecks, and suggesting continuous improvement (kaizen).
|
|
3
|
+
|
|
4
|
+
## TPS Principles for Software
|
|
5
|
+
|
|
6
|
+
### 1. FLOW (Nagare)
|
|
7
|
+
Analyze how data and control flow through the system:
|
|
8
|
+
- Identify entry points and exit points
|
|
9
|
+
- Map the critical paths
|
|
10
|
+
- Look for smooth, uninterrupted flow
|
|
11
|
+
- Identify where flow is blocked or redirected
|
|
12
|
+
- Check for single-piece flow vs batch processing
|
|
13
|
+
|
|
14
|
+
### 2. WASTE (Muda) - The 7 Wastes in Software
|
|
15
|
+
Identify instances of each waste type:
|
|
16
|
+
|
|
17
|
+
**Defects**: Bugs, error-prone code, missing validation
|
|
18
|
+
**Overproduction**: Features nobody uses, over-engineered solutions
|
|
19
|
+
**Waiting**: Blocking I/O, synchronous when async would work, slow tests
|
|
20
|
+
**Non-utilized Talent**: Manual tasks that could be automated, repetitive code
|
|
21
|
+
**Transportation**: Unnecessary data transformation, excessive API calls
|
|
22
|
+
**Inventory**: Dead code, unused imports/exports, stale dependencies
|
|
23
|
+
**Motion**: Complex navigation, scattered related code, poor organization
|
|
24
|
+
**Extra-processing**: Premature optimization, unnecessary abstraction layers
|
|
25
|
+
|
|
26
|
+
### 3. BOTTLENECKS
|
|
27
|
+
Identify constraints that limit throughput:
|
|
28
|
+
- Synchronous operations that block
|
|
29
|
+
- Single points of failure
|
|
30
|
+
- Resource contention
|
|
31
|
+
- N+1 queries or API calls
|
|
32
|
+
- Sequential operations that could be parallel
|
|
33
|
+
|
|
34
|
+
### 4. PULL vs PUSH
|
|
35
|
+
Evaluate if work is demand-driven:
|
|
36
|
+
- Lazy evaluation vs eager computation
|
|
37
|
+
- On-demand loading vs preloading everything
|
|
38
|
+
- Event-driven vs polling
|
|
39
|
+
- Streaming vs buffering all data
|
|
40
|
+
|
|
41
|
+
### 5. JIDOKA (Built-in Quality)
|
|
42
|
+
Assess quality mechanisms:
|
|
43
|
+
- Error handling and recovery
|
|
44
|
+
- Validation at boundaries
|
|
45
|
+
- Fail-fast patterns
|
|
46
|
+
- Type safety usage
|
|
47
|
+
- Test coverage signals
|
|
48
|
+
|
|
49
|
+
### 6. STANDARDIZATION
|
|
50
|
+
Look for consistency:
|
|
51
|
+
- Code style consistency
|
|
52
|
+
- Pattern usage consistency
|
|
53
|
+
- Error handling patterns
|
|
54
|
+
- Naming conventions
|
|
55
|
+
- File organization
|
|
56
|
+
|
|
57
|
+
## Scoring Guidelines
|
|
58
|
+
|
|
59
|
+
**Overall Score (0-100)**:
|
|
60
|
+
- 90-100: Exceptional flow, minimal waste, excellent quality
|
|
61
|
+
- 70-89: Good practices, some waste, room for improvement
|
|
62
|
+
- 50-69: Average, significant waste or flow issues
|
|
63
|
+
- 30-49: Poor flow, excessive waste, quality concerns
|
|
64
|
+
- 0-29: Critical issues, major redesign needed
|
|
65
|
+
|
|
66
|
+
**Flow Score**: How smoothly does data/control move through the system?
|
|
67
|
+
**Waste Score**: Higher = less waste (100 = no waste identified)
|
|
68
|
+
**Quality Score**: Built-in quality mechanisms, error handling, type safety
|
|
69
|
+
|
|
70
|
+
## Output Requirements
|
|
71
|
+
|
|
72
|
+
You MUST respond with valid JSON matching the TpsAnalysis interface. Do not include any text before or after the JSON.
|
|
73
|
+
|
|
74
|
+
Focus on:
|
|
75
|
+
1. Actionable findings with specific file/line references
|
|
76
|
+
2. Prioritized recommendations (quick wins first)
|
|
77
|
+
3. Concrete suggestions, not vague advice
|
|
78
|
+
4. Balanced assessment - acknowledge strengths too
|
|
79
|
+
5. Effort estimates for recommendations`;
|
|
80
|
+
function buildUserMessage(aggregatedContent, options) {
|
|
81
|
+
const parts = [];
|
|
82
|
+
if (options?.repoName) {
|
|
83
|
+
parts.push(`## Repository: ${options.repoName}`);
|
|
84
|
+
}
|
|
85
|
+
if (options?.focusAreas && options.focusAreas.length > 0) {
|
|
86
|
+
parts.push(
|
|
87
|
+
`## Focus Areas
|
|
88
|
+
Pay special attention to: ${options.focusAreas.join(", ")}`
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
if (options?.additionalContext) {
|
|
92
|
+
parts.push(`## Additional Context
|
|
93
|
+
${options.additionalContext}`);
|
|
94
|
+
}
|
|
95
|
+
parts.push(`## Codebase to Audit
|
|
96
|
+
|
|
97
|
+
Analyze this codebase using Toyota Production System principles. Walk the production line from entry points through to outputs. Identify waste, bottlenecks, and improvement opportunities.
|
|
98
|
+
|
|
99
|
+
${aggregatedContent}
|
|
100
|
+
|
|
101
|
+
## Response Format
|
|
102
|
+
|
|
103
|
+
Respond with ONLY valid JSON matching the TpsAnalysis interface. Include:
|
|
104
|
+
- Scores for overall, flow, waste, and quality (0-100)
|
|
105
|
+
- Flow analysis with entry points and pathways
|
|
106
|
+
- Specific bottlenecks with locations and suggestions
|
|
107
|
+
- Waste items categorized by the 7 types
|
|
108
|
+
- Jidoka (built-in quality) assessment
|
|
109
|
+
- Prioritized recommendations
|
|
110
|
+
- Summary with strengths, concerns, and quick wins
|
|
111
|
+
|
|
112
|
+
Your JSON response:`);
|
|
113
|
+
return parts.join("\n\n");
|
|
114
|
+
}
|
|
115
|
+
function parseTpsAnalysis(response) {
|
|
116
|
+
try {
|
|
117
|
+
let jsonStr = response.trim();
|
|
118
|
+
if (jsonStr.startsWith("```json")) {
|
|
119
|
+
jsonStr = jsonStr.slice(7);
|
|
120
|
+
} else if (jsonStr.startsWith("```")) {
|
|
121
|
+
jsonStr = jsonStr.slice(3);
|
|
122
|
+
}
|
|
123
|
+
if (jsonStr.endsWith("```")) {
|
|
124
|
+
jsonStr = jsonStr.slice(0, -3);
|
|
125
|
+
}
|
|
126
|
+
jsonStr = jsonStr.trim();
|
|
127
|
+
const parsed = JSON.parse(jsonStr);
|
|
128
|
+
if (typeof parsed.scores?.overall !== "number" || !Array.isArray(parsed.bottlenecks) || !Array.isArray(parsed.recommendations)) {
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
return parsed;
|
|
132
|
+
} catch {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export {
|
|
138
|
+
SYSTEM_PROMPT,
|
|
139
|
+
buildUserMessage,
|
|
140
|
+
parseTpsAnalysis
|
|
141
|
+
};
|
|
142
|
+
//# sourceMappingURL=chunk-Y77R7523.js.map
|