@dinyangetoh/codeplug-cli 0.1.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.
- package/README.md +291 -0
- package/dist/cli/commands/config.d.ts +4 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- package/dist/cli/commands/config.js +35 -0
- package/dist/cli/commands/config.js.map +1 -0
- package/dist/cli/commands/convention.d.ts +8 -0
- package/dist/cli/commands/convention.d.ts.map +1 -0
- package/dist/cli/commands/convention.js +92 -0
- package/dist/cli/commands/convention.js.map +1 -0
- package/dist/cli/commands/conventionPrompts.d.ts +3 -0
- package/dist/cli/commands/conventionPrompts.d.ts.map +1 -0
- package/dist/cli/commands/conventionPrompts.js +46 -0
- package/dist/cli/commands/conventionPrompts.js.map +1 -0
- package/dist/cli/commands/docs.d.ts +5 -0
- package/dist/cli/commands/docs.d.ts.map +1 -0
- package/dist/cli/commands/docs.js +49 -0
- package/dist/cli/commands/docs.js.map +1 -0
- package/dist/cli/commands/export.d.ts +3 -0
- package/dist/cli/commands/export.d.ts.map +1 -0
- package/dist/cli/commands/export.js +49 -0
- package/dist/cli/commands/export.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +114 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/config/ConfigManager.d.ts +15 -0
- package/dist/config/ConfigManager.d.ts.map +1 -0
- package/dist/config/ConfigManager.js +69 -0
- package/dist/config/ConfigManager.js.map +1 -0
- package/dist/config/ConventionSchema.d.ts +85 -0
- package/dist/config/ConventionSchema.d.ts.map +1 -0
- package/dist/config/ConventionSchema.js +22 -0
- package/dist/config/ConventionSchema.js.map +1 -0
- package/dist/config/defaults.d.ts +13 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/defaults.js +28 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/types.d.ts +138 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +2 -0
- package/dist/config/types.js.map +1 -0
- package/dist/core/analyzer/AstAnalyzer.d.ts +17 -0
- package/dist/core/analyzer/AstAnalyzer.d.ts.map +1 -0
- package/dist/core/analyzer/AstAnalyzer.js +95 -0
- package/dist/core/analyzer/AstAnalyzer.js.map +1 -0
- package/dist/core/analyzer/ConventionDetector.d.ts +6 -0
- package/dist/core/analyzer/ConventionDetector.d.ts.map +1 -0
- package/dist/core/analyzer/ConventionDetector.js +38 -0
- package/dist/core/analyzer/ConventionDetector.js.map +1 -0
- package/dist/core/analyzer/PatternAggregator.d.ts +11 -0
- package/dist/core/analyzer/PatternAggregator.d.ts.map +1 -0
- package/dist/core/analyzer/PatternAggregator.js +94 -0
- package/dist/core/analyzer/PatternAggregator.js.map +1 -0
- package/dist/core/analyzer/visitors/ComponentVisitor.d.ts +6 -0
- package/dist/core/analyzer/visitors/ComponentVisitor.d.ts.map +1 -0
- package/dist/core/analyzer/visitors/ComponentVisitor.js +80 -0
- package/dist/core/analyzer/visitors/ComponentVisitor.js.map +1 -0
- package/dist/core/analyzer/visitors/ErrorHandlingVisitor.d.ts +6 -0
- package/dist/core/analyzer/visitors/ErrorHandlingVisitor.d.ts.map +1 -0
- package/dist/core/analyzer/visitors/ErrorHandlingVisitor.js +48 -0
- package/dist/core/analyzer/visitors/ErrorHandlingVisitor.js.map +1 -0
- package/dist/core/analyzer/visitors/ImportVisitor.d.ts +6 -0
- package/dist/core/analyzer/visitors/ImportVisitor.d.ts.map +1 -0
- package/dist/core/analyzer/visitors/ImportVisitor.js +68 -0
- package/dist/core/analyzer/visitors/ImportVisitor.js.map +1 -0
- package/dist/core/analyzer/visitors/NamingVisitor.d.ts +7 -0
- package/dist/core/analyzer/visitors/NamingVisitor.d.ts.map +1 -0
- package/dist/core/analyzer/visitors/NamingVisitor.js +88 -0
- package/dist/core/analyzer/visitors/NamingVisitor.js.map +1 -0
- package/dist/core/analyzer/visitors/StructureVisitor.d.ts +6 -0
- package/dist/core/analyzer/visitors/StructureVisitor.d.ts.map +1 -0
- package/dist/core/analyzer/visitors/StructureVisitor.js +8 -0
- package/dist/core/analyzer/visitors/StructureVisitor.js.map +1 -0
- package/dist/core/analyzer/visitors/TestVisitor.d.ts +6 -0
- package/dist/core/analyzer/visitors/TestVisitor.d.ts.map +1 -0
- package/dist/core/analyzer/visitors/TestVisitor.js +47 -0
- package/dist/core/analyzer/visitors/TestVisitor.js.map +1 -0
- package/dist/core/analyzer/visitors/types.d.ts +13 -0
- package/dist/core/analyzer/visitors/types.d.ts.map +1 -0
- package/dist/core/analyzer/visitors/types.js +2 -0
- package/dist/core/analyzer/visitors/types.js.map +1 -0
- package/dist/core/classifier/ConfidenceGate.d.ts +9 -0
- package/dist/core/classifier/ConfidenceGate.d.ts.map +1 -0
- package/dist/core/classifier/ConfidenceGate.js +11 -0
- package/dist/core/classifier/ConfidenceGate.js.map +1 -0
- package/dist/core/classifier/DriftClassifier.d.ts +17 -0
- package/dist/core/classifier/DriftClassifier.d.ts.map +1 -0
- package/dist/core/classifier/DriftClassifier.js +293 -0
- package/dist/core/classifier/DriftClassifier.js.map +1 -0
- package/dist/core/exporter/ExportEngine.d.ts +7 -0
- package/dist/core/exporter/ExportEngine.d.ts.map +1 -0
- package/dist/core/exporter/ExportEngine.js +52 -0
- package/dist/core/exporter/ExportEngine.js.map +1 -0
- package/dist/core/exporter/FreshnessChecker.d.ts +8 -0
- package/dist/core/exporter/FreshnessChecker.d.ts.map +1 -0
- package/dist/core/exporter/FreshnessChecker.js +49 -0
- package/dist/core/exporter/FreshnessChecker.js.map +1 -0
- package/dist/core/exporter/formatters/CiFormatter.d.ts +8 -0
- package/dist/core/exporter/formatters/CiFormatter.d.ts.map +1 -0
- package/dist/core/exporter/formatters/CiFormatter.js +51 -0
- package/dist/core/exporter/formatters/CiFormatter.js.map +1 -0
- package/dist/core/exporter/formatters/ClaudeFormatter.d.ts +9 -0
- package/dist/core/exporter/formatters/ClaudeFormatter.d.ts.map +1 -0
- package/dist/core/exporter/formatters/ClaudeFormatter.js +60 -0
- package/dist/core/exporter/formatters/ClaudeFormatter.js.map +1 -0
- package/dist/core/exporter/formatters/CopilotFormatter.d.ts +9 -0
- package/dist/core/exporter/formatters/CopilotFormatter.d.ts.map +1 -0
- package/dist/core/exporter/formatters/CopilotFormatter.js +50 -0
- package/dist/core/exporter/formatters/CopilotFormatter.js.map +1 -0
- package/dist/core/exporter/formatters/CursorFormatter.d.ts +9 -0
- package/dist/core/exporter/formatters/CursorFormatter.d.ts.map +1 -0
- package/dist/core/exporter/formatters/CursorFormatter.js +51 -0
- package/dist/core/exporter/formatters/CursorFormatter.js.map +1 -0
- package/dist/core/exporter/formatters/JsonFormatter.d.ts +8 -0
- package/dist/core/exporter/formatters/JsonFormatter.d.ts.map +1 -0
- package/dist/core/exporter/formatters/JsonFormatter.js +22 -0
- package/dist/core/exporter/formatters/JsonFormatter.js.map +1 -0
- package/dist/core/exporter/formatters/types.d.ts +7 -0
- package/dist/core/exporter/formatters/types.d.ts.map +1 -0
- package/dist/core/exporter/formatters/types.js +2 -0
- package/dist/core/exporter/formatters/types.js.map +1 -0
- package/dist/core/generator/DocGenerator.d.ts +14 -0
- package/dist/core/generator/DocGenerator.d.ts.map +1 -0
- package/dist/core/generator/DocGenerator.js +136 -0
- package/dist/core/generator/DocGenerator.js.map +1 -0
- package/dist/core/generator/PipelineOrchestrator.d.ts +11 -0
- package/dist/core/generator/PipelineOrchestrator.d.ts.map +1 -0
- package/dist/core/generator/PipelineOrchestrator.js +26 -0
- package/dist/core/generator/PipelineOrchestrator.js.map +1 -0
- package/dist/core/generator/StalenessTracker.d.ts +13 -0
- package/dist/core/generator/StalenessTracker.d.ts.map +1 -0
- package/dist/core/generator/StalenessTracker.js +76 -0
- package/dist/core/generator/StalenessTracker.js.map +1 -0
- package/dist/core/generator/documents/ArchitectureGenerator.d.ts +13 -0
- package/dist/core/generator/documents/ArchitectureGenerator.d.ts.map +1 -0
- package/dist/core/generator/documents/ArchitectureGenerator.js +101 -0
- package/dist/core/generator/documents/ArchitectureGenerator.js.map +1 -0
- package/dist/core/generator/documents/ContributingGenerator.d.ts +10 -0
- package/dist/core/generator/documents/ContributingGenerator.d.ts.map +1 -0
- package/dist/core/generator/documents/ContributingGenerator.js +90 -0
- package/dist/core/generator/documents/ContributingGenerator.js.map +1 -0
- package/dist/core/generator/documents/ConventionsGenerator.d.ts +8 -0
- package/dist/core/generator/documents/ConventionsGenerator.d.ts.map +1 -0
- package/dist/core/generator/documents/ConventionsGenerator.js +65 -0
- package/dist/core/generator/documents/ConventionsGenerator.js.map +1 -0
- package/dist/core/generator/documents/OnboardingGenerator.d.ts +12 -0
- package/dist/core/generator/documents/OnboardingGenerator.d.ts.map +1 -0
- package/dist/core/generator/documents/OnboardingGenerator.js +116 -0
- package/dist/core/generator/documents/OnboardingGenerator.js.map +1 -0
- package/dist/core/generator/documents/ReadmeGenerator.d.ts +12 -0
- package/dist/core/generator/documents/ReadmeGenerator.d.ts.map +1 -0
- package/dist/core/generator/documents/ReadmeGenerator.js +118 -0
- package/dist/core/generator/documents/ReadmeGenerator.js.map +1 -0
- package/dist/core/generator/documents/types.d.ts +18 -0
- package/dist/core/generator/documents/types.d.ts.map +1 -0
- package/dist/core/generator/documents/types.js +2 -0
- package/dist/core/generator/documents/types.js.map +1 -0
- package/dist/core/generator/llm/LlmClient.d.ts +12 -0
- package/dist/core/generator/llm/LlmClient.d.ts.map +1 -0
- package/dist/core/generator/llm/LlmClient.js +26 -0
- package/dist/core/generator/llm/LlmClient.js.map +1 -0
- package/dist/core/generator/llm/healthCheck.d.ts +6 -0
- package/dist/core/generator/llm/healthCheck.d.ts.map +1 -0
- package/dist/core/generator/llm/healthCheck.js +19 -0
- package/dist/core/generator/llm/healthCheck.js.map +1 -0
- package/dist/core/generator/llm/providerPresets.d.ts +8 -0
- package/dist/core/generator/llm/providerPresets.d.ts.map +1 -0
- package/dist/core/generator/llm/providerPresets.js +9 -0
- package/dist/core/generator/llm/providerPresets.js.map +1 -0
- package/dist/core/generator/pipelines/ExtractionPipeline.d.ts +7 -0
- package/dist/core/generator/pipelines/ExtractionPipeline.d.ts.map +1 -0
- package/dist/core/generator/pipelines/ExtractionPipeline.js +13 -0
- package/dist/core/generator/pipelines/ExtractionPipeline.js.map +1 -0
- package/dist/core/generator/pipelines/NerPipeline.d.ts +12 -0
- package/dist/core/generator/pipelines/NerPipeline.d.ts.map +1 -0
- package/dist/core/generator/pipelines/NerPipeline.js +17 -0
- package/dist/core/generator/pipelines/NerPipeline.js.map +1 -0
- package/dist/core/generator/pipelines/SummarizationPipeline.d.ts +7 -0
- package/dist/core/generator/pipelines/SummarizationPipeline.d.ts.map +1 -0
- package/dist/core/generator/pipelines/SummarizationPipeline.js +13 -0
- package/dist/core/generator/pipelines/SummarizationPipeline.js.map +1 -0
- package/dist/core/git/GitIntegration.d.ts +30 -0
- package/dist/core/git/GitIntegration.d.ts.map +1 -0
- package/dist/core/git/GitIntegration.js +92 -0
- package/dist/core/git/GitIntegration.js.map +1 -0
- package/dist/core/git/PreCommitHook.d.ts +9 -0
- package/dist/core/git/PreCommitHook.d.ts.map +1 -0
- package/dist/core/git/PreCommitHook.js +80 -0
- package/dist/core/git/PreCommitHook.js.map +1 -0
- package/dist/core/scorer/AutoFixer.d.ts +12 -0
- package/dist/core/scorer/AutoFixer.d.ts.map +1 -0
- package/dist/core/scorer/AutoFixer.js +121 -0
- package/dist/core/scorer/AutoFixer.js.map +1 -0
- package/dist/core/scorer/ComplianceScorer.d.ts +7 -0
- package/dist/core/scorer/ComplianceScorer.d.ts.map +1 -0
- package/dist/core/scorer/ComplianceScorer.js +76 -0
- package/dist/core/scorer/ComplianceScorer.js.map +1 -0
- package/dist/core/scorer/TrendTracker.d.ts +6 -0
- package/dist/core/scorer/TrendTracker.d.ts.map +1 -0
- package/dist/core/scorer/TrendTracker.js +45 -0
- package/dist/core/scorer/TrendTracker.js.map +1 -0
- package/dist/core/scorer/ViolationDetector.d.ts +17 -0
- package/dist/core/scorer/ViolationDetector.d.ts.map +1 -0
- package/dist/core/scorer/ViolationDetector.js +178 -0
- package/dist/core/scorer/ViolationDetector.js.map +1 -0
- package/dist/models/ModelManager.d.ts +15 -0
- package/dist/models/ModelManager.d.ts.map +1 -0
- package/dist/models/ModelManager.js +72 -0
- package/dist/models/ModelManager.js.map +1 -0
- package/dist/models/ModelRegistry.d.ts +12 -0
- package/dist/models/ModelRegistry.d.ts.map +1 -0
- package/dist/models/ModelRegistry.js +76 -0
- package/dist/models/ModelRegistry.js.map +1 -0
- package/dist/storage/ConventionStore.d.ts +11 -0
- package/dist/storage/ConventionStore.d.ts.map +1 -0
- package/dist/storage/ConventionStore.js +37 -0
- package/dist/storage/ConventionStore.js.map +1 -0
- package/dist/storage/ScoreStore.d.ts +18 -0
- package/dist/storage/ScoreStore.d.ts.map +1 -0
- package/dist/storage/ScoreStore.js +112 -0
- package/dist/storage/ScoreStore.js.map +1 -0
- package/dist/storage/ViolationStore.d.ts +11 -0
- package/dist/storage/ViolationStore.d.ts.map +1 -0
- package/dist/storage/ViolationStore.js +30 -0
- package/dist/storage/ViolationStore.js.map +1 -0
- package/package.json +75 -0
- package/templates/claude/CLAUDE.md.hbs +15 -0
- package/templates/copilot/copilot-instructions.md.hbs +13 -0
- package/templates/cursor/conventions.mdc.hbs +16 -0
package/README.md
ADDED
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
# CodePlug
|
|
2
|
+
|
|
3
|
+
**The source of truth for codebase understanding and governance.**
|
|
4
|
+
|
|
5
|
+
CodePlug is a local-first CLI tool that detects your codebase's coding conventions, enforces them with drift detection and compliance scoring, generates living documentation, and exports convention context for AI coding agents.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- **Convention Detection** -- AST analysis with on-device ML identifies naming patterns, folder structure, component styles, test organization, error handling, and import conventions across your TypeScript/JavaScript codebase.
|
|
12
|
+
- **Drift & Compliance** -- Classifies git diffs against stored conventions, scores compliance with severity-weighted metrics, tracks trends over time, and auto-fixes what it can.
|
|
13
|
+
- **Living Documentation** -- Generates and maintains README, ARCHITECTURE, CONVENTIONS, CONTRIBUTING, and ONBOARDING docs using ML summarization and optional LLM enhancement.
|
|
14
|
+
- **AI Agent Export** -- Exports your conventions as `CLAUDE.md`, `.cursor/rules`, `.github/copilot-instructions.md`, structured JSON, and SARIF-format CI reports.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# Install globally
|
|
22
|
+
npm install -g @dinyangetoh/codeplug-cli
|
|
23
|
+
|
|
24
|
+
# Navigate to your project
|
|
25
|
+
cd your-project
|
|
26
|
+
|
|
27
|
+
# Detect and confirm conventions
|
|
28
|
+
codeplug convention init
|
|
29
|
+
|
|
30
|
+
# Check compliance
|
|
31
|
+
codeplug convention audit
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Prerequisites
|
|
37
|
+
|
|
38
|
+
- **Node.js 20+** (required)
|
|
39
|
+
- **Git** (required for drift detection and history analysis)
|
|
40
|
+
- **Ollama** (optional, for LLM-enhanced documentation -- any OpenAI-compatible provider works)
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Installation
|
|
45
|
+
|
|
46
|
+
### Global install
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npm install -g @dinyangetoh/codeplug-cli
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Local development
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
git clone <repo-url>
|
|
56
|
+
cd codeplug
|
|
57
|
+
npm install
|
|
58
|
+
npm run build
|
|
59
|
+
node dist/cli/index.js --help
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Usage
|
|
65
|
+
|
|
66
|
+
### Convention Detection
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# Detect and interactively confirm conventions
|
|
70
|
+
codeplug convention init
|
|
71
|
+
|
|
72
|
+
# Re-run detection, overwrite existing conventions
|
|
73
|
+
codeplug convention init --force
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Compliance Audit
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# Full compliance report
|
|
80
|
+
codeplug convention audit
|
|
81
|
+
|
|
82
|
+
# Audit only changes from the last 7 days
|
|
83
|
+
codeplug convention audit --since 7d
|
|
84
|
+
|
|
85
|
+
# CI mode -- exits non-zero if score drops below threshold
|
|
86
|
+
codeplug convention audit --ci
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Drift Detection
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Check recent commits for convention drift
|
|
93
|
+
codeplug convention drift
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Compliance Score
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
# Show current score
|
|
100
|
+
codeplug convention score
|
|
101
|
+
|
|
102
|
+
# Show score history and trend chart
|
|
103
|
+
codeplug convention score --trend
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Auto-Fix
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# Apply all safe auto-fixes
|
|
110
|
+
codeplug convention fix --auto
|
|
111
|
+
|
|
112
|
+
# Fix a specific finding by ID
|
|
113
|
+
codeplug convention fix --id naming-pascal-components
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Documentation Generation
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
# Generate all 5 documents
|
|
120
|
+
codeplug docs generate
|
|
121
|
+
|
|
122
|
+
# Generate a specific document
|
|
123
|
+
codeplug docs generate --doc ARCHITECTURE
|
|
124
|
+
|
|
125
|
+
# Tune for audience and style
|
|
126
|
+
codeplug docs generate --audience junior --style concise
|
|
127
|
+
|
|
128
|
+
# Check which docs are stale
|
|
129
|
+
codeplug docs status
|
|
130
|
+
|
|
131
|
+
# Regenerate only stale sections
|
|
132
|
+
codeplug docs update
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Export for AI Agents
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
# Export for a specific target
|
|
139
|
+
codeplug export --target claude
|
|
140
|
+
codeplug export --target cursor
|
|
141
|
+
codeplug export --target copilot
|
|
142
|
+
|
|
143
|
+
# Export all targets at once
|
|
144
|
+
codeplug export --all
|
|
145
|
+
|
|
146
|
+
# Check if exports are up to date
|
|
147
|
+
codeplug export --check
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Configuration
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# View all settings
|
|
154
|
+
codeplug config list
|
|
155
|
+
|
|
156
|
+
# Get a specific value
|
|
157
|
+
codeplug config get llm.provider
|
|
158
|
+
|
|
159
|
+
# Set values
|
|
160
|
+
codeplug config set llm.provider openai
|
|
161
|
+
codeplug config set llm.model gpt-4o
|
|
162
|
+
codeplug config set llm.apiKey sk-...
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Configuration
|
|
168
|
+
|
|
169
|
+
CodePlug stores project-level configuration in `.codeplug/config.json`. The `config` command manages this file.
|
|
170
|
+
|
|
171
|
+
### LLM Provider
|
|
172
|
+
|
|
173
|
+
The default provider is Ollama (local). Setting a provider auto-fills its base URL and default model:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
codeplug config set llm.provider ollama # local, no API key needed
|
|
177
|
+
codeplug config set llm.provider openai # sets baseUrl + model automatically
|
|
178
|
+
codeplug config set llm.provider anthropic
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
You can also set individual fields for custom endpoints:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
codeplug config set llm.baseUrl https://my-proxy.example.com/v1
|
|
185
|
+
codeplug config set llm.model my-custom-model
|
|
186
|
+
codeplug config set llm.apiKey my-key
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Model Tier
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
# Full-size models (default) -- best quality, ~1.1GB disk, 8GB+ RAM recommended
|
|
193
|
+
codeplug config set models.tier default
|
|
194
|
+
|
|
195
|
+
# Lightweight models -- reduced quality, ~420MB disk, 4GB RAM minimum
|
|
196
|
+
codeplug config set models.tier lite
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Switching to `lite` prints a warning about potential quality degradation.
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## Supported LLM Providers
|
|
204
|
+
|
|
205
|
+
All providers work through a single unified client via the OpenAI SDK.
|
|
206
|
+
|
|
207
|
+
| Provider | Setup |
|
|
208
|
+
|----------|-------|
|
|
209
|
+
| Ollama | `codeplug config set llm.provider ollama` (default, no API key) |
|
|
210
|
+
| OpenAI | `codeplug config set llm.provider openai` then set `llm.apiKey` |
|
|
211
|
+
| Anthropic | `codeplug config set llm.provider anthropic` then set `llm.apiKey` |
|
|
212
|
+
| Gemini | `codeplug config set llm.provider gemini` then set `llm.apiKey` |
|
|
213
|
+
| OpenRouter | `codeplug config set llm.provider openrouter` then set `llm.apiKey` |
|
|
214
|
+
| Groq | `codeplug config set llm.provider groq` then set `llm.apiKey` |
|
|
215
|
+
| DeepSeek | `codeplug config set llm.provider deepseek` then set `llm.apiKey` |
|
|
216
|
+
| Grok | `codeplug config set llm.provider grok` then set `llm.apiKey` |
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## Model Tiers
|
|
221
|
+
|
|
222
|
+
| | Default | Lite |
|
|
223
|
+
|---|---------|------|
|
|
224
|
+
| Target machine | 8GB+ RAM | 4GB+ RAM |
|
|
225
|
+
| Disk usage | ~1.1GB | ~420MB |
|
|
226
|
+
| Classification | CodeBERT-base (125M params) | CodeBERTa-small (84M params) |
|
|
227
|
+
| Summarization | BART-large-CNN (406M params) | DistilBART (230M params) |
|
|
228
|
+
| NER | BERT-base-NER (110M params) | DistilBERT-NER (66M params) |
|
|
229
|
+
| When to use | Production quality, CI pipelines | Local development on constrained hardware |
|
|
230
|
+
|
|
231
|
+
Models are downloaded on first use and cached in `~/.codeplug/models/`.
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## Development
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
# Install dependencies
|
|
239
|
+
npm install
|
|
240
|
+
|
|
241
|
+
# Build
|
|
242
|
+
npm run build
|
|
243
|
+
|
|
244
|
+
# Type check without emitting
|
|
245
|
+
npm run typecheck
|
|
246
|
+
|
|
247
|
+
# Run tests
|
|
248
|
+
npm test
|
|
249
|
+
|
|
250
|
+
# Run tests in watch mode
|
|
251
|
+
npm run test:watch
|
|
252
|
+
|
|
253
|
+
# Run with coverage
|
|
254
|
+
npm run coverage
|
|
255
|
+
|
|
256
|
+
# Lint
|
|
257
|
+
npm run lint
|
|
258
|
+
|
|
259
|
+
# Lint with auto-fix
|
|
260
|
+
npm run lint:fix
|
|
261
|
+
|
|
262
|
+
# Watch build during development
|
|
263
|
+
npm run dev
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## Project Structure
|
|
269
|
+
|
|
270
|
+
```
|
|
271
|
+
src/
|
|
272
|
+
cli/commands/ Command handlers (convention, docs, export, config)
|
|
273
|
+
config/ ConfigManager, Zod schemas, types, provider presets
|
|
274
|
+
core/
|
|
275
|
+
analyzer/ AST analysis engine + 6 visitors + PatternAggregator
|
|
276
|
+
classifier/ Drift classification + confidence gating
|
|
277
|
+
scorer/ Compliance scoring, violation detection, auto-fix, trends
|
|
278
|
+
generator/ Doc generation, ML pipelines, LLM client, staleness tracking
|
|
279
|
+
exporter/ Export engine + 5 formatters (Claude, Cursor, Copilot, JSON, CI)
|
|
280
|
+
git/ Git integration + pre-commit hook management
|
|
281
|
+
models/ ML model manager + tier-aware registry
|
|
282
|
+
storage/ ConventionStore, ScoreStore (sql.js), ViolationStore
|
|
283
|
+
templates/ Export templates (Claude, Cursor, Copilot)
|
|
284
|
+
tests/ Unit tests, integration tests, fixture repos
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
## License
|
|
290
|
+
|
|
291
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/config.ts"],"names":[],"mappings":"AAEA,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAqB/E;AAED,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAahE;AAED,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAOtD"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export async function handleConfigSet(key, value) {
|
|
2
|
+
const chalk = (await import('chalk')).default;
|
|
3
|
+
const { ConfigManager } = await import('../../config/ConfigManager.js');
|
|
4
|
+
const config = new ConfigManager(process.cwd());
|
|
5
|
+
await config.load();
|
|
6
|
+
const tierWarning = key === 'models.tier' && value === 'lite';
|
|
7
|
+
config.set(key, value);
|
|
8
|
+
await config.save();
|
|
9
|
+
console.log(chalk.green(`ā
Set ${key} = ${value}`));
|
|
10
|
+
if (tierWarning) {
|
|
11
|
+
console.log(chalk.yellow('\nā Model tier set to "lite". Lighter models will be used for classification,\n' +
|
|
12
|
+
' summarization, and NER. This reduces disk/RAM usage but may lower detection\n' +
|
|
13
|
+
' accuracy and documentation quality. Recommended only for machines with < 8GB RAM.'));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export async function handleConfigGet(key) {
|
|
17
|
+
const chalk = (await import('chalk')).default;
|
|
18
|
+
const { ConfigManager } = await import('../../config/ConfigManager.js');
|
|
19
|
+
const config = new ConfigManager(process.cwd());
|
|
20
|
+
await config.load();
|
|
21
|
+
const value = config.get(key);
|
|
22
|
+
if (value === undefined) {
|
|
23
|
+
console.log(chalk.yellow(`Key "${key}" not found.`));
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
console.log(`${key} = ${typeof value === 'object' ? JSON.stringify(value, null, 2) : value}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export async function handleConfigList() {
|
|
30
|
+
const { ConfigManager } = await import('../../config/ConfigManager.js');
|
|
31
|
+
const config = new ConfigManager(process.cwd());
|
|
32
|
+
await config.load();
|
|
33
|
+
console.log(JSON.stringify(config.getAll(), null, 2));
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/cli/commands/config.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,GAAW,EAAE,KAAa;IAC9D,MAAM,KAAK,GAAG,CAAC,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IAC9C,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,+BAA+B,CAAC,CAAC;IAExE,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAChD,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;IAEpB,MAAM,WAAW,GAAG,GAAG,KAAK,aAAa,IAAI,KAAK,KAAK,MAAM,CAAC;IAE9D,MAAM,CAAC,GAAG,CAAC,GAA2B,EAAE,KAAK,CAAC,CAAC;IAC/C,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;IAEpB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,GAAG,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC;IAEpD,IAAI,WAAW,EAAE,CAAC;QAChB,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AAC,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ConventionInitOptions, ConventionAuditOptions, ConventionScoreOptions, ConventionFixOptions } from '../../config/types.js';
|
|
2
|
+
export declare function handleConventionInit(options: ConventionInitOptions): Promise<void>;
|
|
3
|
+
export declare function handleConventionAudit(options: ConventionAuditOptions): Promise<void>;
|
|
4
|
+
export declare function handleConventionDrift(): Promise<void>;
|
|
5
|
+
export declare function handleConventionScore(options: ConventionScoreOptions): Promise<void>;
|
|
6
|
+
export declare function handleConventionFix(options: ConventionFixOptions): Promise<void>;
|
|
7
|
+
export declare function handleConventionShow(commit: string): Promise<void>;
|
|
8
|
+
//# sourceMappingURL=convention.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convention.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/convention.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAEzI,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CA8BxF;AAED,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAuB1F;AAED,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC,CAc3D;AAED,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAe1F;AAED,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAYtF;AAED,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAIxE"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
export async function handleConventionInit(options) {
|
|
2
|
+
const chalk = (await import('chalk')).default;
|
|
3
|
+
const ora = (await import('ora')).default;
|
|
4
|
+
const { AstAnalyzer } = await import('../../core/analyzer/AstAnalyzer.js');
|
|
5
|
+
const { ConventionDetector } = await import('../../core/analyzer/ConventionDetector.js');
|
|
6
|
+
const { ConventionStore } = await import('../../storage/ConventionStore.js');
|
|
7
|
+
const store = new ConventionStore(process.cwd());
|
|
8
|
+
if (!options.force && await store.exists()) {
|
|
9
|
+
console.log(chalk.yellow('Conventions already exist. Use --force to re-detect.'));
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const spinner = ora('Analysing codebase...').start();
|
|
13
|
+
const analyzer = new AstAnalyzer(process.cwd());
|
|
14
|
+
const analysisResult = await analyzer.analyze();
|
|
15
|
+
spinner.succeed(`Analysed ${analysisResult.fileCount} files in ${analysisResult.durationMs}ms`);
|
|
16
|
+
const detector = new ConventionDetector();
|
|
17
|
+
const candidates = await detector.detect(analysisResult);
|
|
18
|
+
const { confirmConventions } = await import('./conventionPrompts.js');
|
|
19
|
+
const confirmed = await confirmConventions(candidates);
|
|
20
|
+
await store.save(confirmed);
|
|
21
|
+
console.log(chalk.green(`\nā
Conventions saved to .codeplug/conventions.json`));
|
|
22
|
+
console.log(chalk.dim(` Run 'codeplug convention audit' to check current compliance.`));
|
|
23
|
+
}
|
|
24
|
+
export async function handleConventionAudit(options) {
|
|
25
|
+
const chalk = (await import('chalk')).default;
|
|
26
|
+
const { ConventionStore } = await import('../../storage/ConventionStore.js');
|
|
27
|
+
const { ViolationDetector } = await import('../../core/scorer/ViolationDetector.js');
|
|
28
|
+
const { ComplianceScorer } = await import('../../core/scorer/ComplianceScorer.js');
|
|
29
|
+
const store = new ConventionStore(process.cwd());
|
|
30
|
+
if (!await store.exists()) {
|
|
31
|
+
console.log(chalk.yellow('No conventions found. Run "codeplug convention init" first.'));
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const conventions = await store.load();
|
|
35
|
+
const detector = new ViolationDetector(process.cwd());
|
|
36
|
+
const violations = await detector.detect(conventions, options);
|
|
37
|
+
const scorer = new ComplianceScorer();
|
|
38
|
+
const score = scorer.calculate(violations);
|
|
39
|
+
scorer.printReport(score, violations);
|
|
40
|
+
if (options.ci && score.total < (score.threshold ?? 70)) {
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export async function handleConventionDrift() {
|
|
45
|
+
const chalk = (await import('chalk')).default;
|
|
46
|
+
const { ConventionStore } = await import('../../storage/ConventionStore.js');
|
|
47
|
+
const { DriftClassifier } = await import('../../core/classifier/DriftClassifier.js');
|
|
48
|
+
const store = new ConventionStore(process.cwd());
|
|
49
|
+
if (!await store.exists()) {
|
|
50
|
+
console.log(chalk.yellow('No conventions found. Run "codeplug convention init" first.'));
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const conventions = await store.load();
|
|
54
|
+
const classifier = new DriftClassifier();
|
|
55
|
+
await classifier.checkRecentCommits(conventions);
|
|
56
|
+
}
|
|
57
|
+
export async function handleConventionScore(options) {
|
|
58
|
+
const chalk = (await import('chalk')).default;
|
|
59
|
+
const { ScoreStore } = await import('../../storage/ScoreStore.js');
|
|
60
|
+
const scoreStore = new ScoreStore(process.cwd());
|
|
61
|
+
if (options.trend) {
|
|
62
|
+
await scoreStore.printTrend();
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
const latest = await scoreStore.getLatest();
|
|
66
|
+
if (!latest) {
|
|
67
|
+
console.log(chalk.yellow('No scores recorded yet. Run "codeplug convention audit" first.'));
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
console.log(chalk.bold(`š Compliance Score: ${latest.score}/100`));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
export async function handleConventionFix(options) {
|
|
74
|
+
const chalk = (await import('chalk')).default;
|
|
75
|
+
const { AutoFixer } = await import('../../core/scorer/AutoFixer.js');
|
|
76
|
+
const fixer = new AutoFixer(process.cwd());
|
|
77
|
+
if (options.id) {
|
|
78
|
+
await fixer.fixById(options.id);
|
|
79
|
+
}
|
|
80
|
+
else if (options.auto) {
|
|
81
|
+
await fixer.fixAll();
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
console.log(chalk.yellow('Specify --auto or --id <id>. Run "codeplug convention audit" to see findings.'));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
export async function handleConventionShow(commit) {
|
|
88
|
+
const chalk = (await import('chalk')).default;
|
|
89
|
+
console.log(chalk.dim(`Showing findings for commit ${commit}...`));
|
|
90
|
+
console.log(chalk.yellow('Not yet implemented. Coming in Phase 2.'));
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=convention.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convention.js","sourceRoot":"","sources":["../../../src/cli/commands/convention.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,OAA8B;IACvE,MAAM,KAAK,GAAG,CAAC,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IAC9C,MAAM,GAAG,GAAG,CAAC,MAAM,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC;IAC1C,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,MAAM,CAAC,oCAAoC,CAAC,CAAC;IAC3E,MAAM,EAAE,kBAAkB,EAAE,GAAG,MAAM,MAAM,CAAC,2CAA2C,CAAC,CAAC;IACzF,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,MAAM,CAAC,kCAAkC,CAAC,CAAC;IAE7E,MAAM,KAAK,GAAG,IAAI,eAAe,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAEjD,IAAI,CAAC,OAAO,CAAC,KAAK,IAAI,MAAM,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;QAC3C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,sDAAsD,CAAC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AAG,IAAI,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAC3C,IAAI,OAAO,CAAC,EAAE,EAAE,CAAC;QACf,MAAM,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAClC,CAAC;SAAM,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACxB,MAAM,KAAK,CAAC,MAAM,EAAE,CAAC;IACvB,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,+EAA+E,CAAC,CAAC,CAAC;IAC7G,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,MAAc;IACvD,MAAM,KAAK,GAAG,CAAC,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IAC9C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,+BAA+B,MAAM,KAAK,CAAC,CAAC,CAAC;IACnE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,yCAAyC,CAAC,CAAC,CAAC;AACvE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conventionPrompts.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/conventionPrompts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAE7E,wBAAsB,kBAAkB,CAAC,UAAU,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAqDjG"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export async function confirmConventions(candidates) {
|
|
2
|
+
const { confirm, input } = await import('@inquirer/prompts');
|
|
3
|
+
const chalk = (await import('chalk')).default;
|
|
4
|
+
const confirmed = [];
|
|
5
|
+
console.log(chalk.bold('\nš Detected patterns ā confirm or adjust:\n'));
|
|
6
|
+
for (let i = 0; i < candidates.length; i++) {
|
|
7
|
+
const c = candidates[i];
|
|
8
|
+
const label = `[${i + 1}/${candidates.length}]`;
|
|
9
|
+
const confidenceColor = c.confidence >= 90 ? chalk.green : c.confidence >= 75 ? chalk.yellow : chalk.red;
|
|
10
|
+
console.log(` ${chalk.bold(label)} ${c.dimension}: ${c.rule} ${confidenceColor(`(confidence: ${c.confidence}%)`)}`);
|
|
11
|
+
if (c.examples.length > 0) {
|
|
12
|
+
console.log(chalk.dim(` Found: ${c.examples.slice(0, 3).join(', ')}`));
|
|
13
|
+
}
|
|
14
|
+
const accepted = await confirm({ message: 'Accept?', default: true });
|
|
15
|
+
if (accepted) {
|
|
16
|
+
confirmed.push({
|
|
17
|
+
id: c.id,
|
|
18
|
+
dimension: c.dimension,
|
|
19
|
+
rule: c.rule,
|
|
20
|
+
confidence: c.confidence,
|
|
21
|
+
confirmed: true,
|
|
22
|
+
examples: c.examples,
|
|
23
|
+
severity: c.severity,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
const custom = await input({
|
|
28
|
+
message: 'Specify alternative (or press Enter to skip):',
|
|
29
|
+
});
|
|
30
|
+
if (custom.trim()) {
|
|
31
|
+
confirmed.push({
|
|
32
|
+
id: c.id,
|
|
33
|
+
dimension: c.dimension,
|
|
34
|
+
rule: custom.trim(),
|
|
35
|
+
confidence: 100,
|
|
36
|
+
confirmed: true,
|
|
37
|
+
examples: [],
|
|
38
|
+
severity: c.severity,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
console.log('');
|
|
43
|
+
}
|
|
44
|
+
return confirmed;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=conventionPrompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conventionPrompts.js","sourceRoot":"","sources":["../../../src/cli/commands/conventionPrompts.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC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,GAAG,MAAM,OAAO,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAEtE,IAAI,QAAQ,EAAE,CAAC;YACb,SAAS,CAAC,IAAI,CAAC;gBACb,EAAE,EAAE,CAAC,CAAC,EAAE;gBACR,SAAS,EAAE,CAAC,CAAC,SAAS;gBACtB,IAAI,EAAE,CAAC,CAAC,IAAI;gBACZ,UAAU,EAAE,CAAC,CAAC,UAAU;gBACxB,SAAS,EAAE,IAAI;gBACf,QAAQ,EAAE,CAAC,CAAC,QAAQ;gBACpB,QAAQ,EAAE,CAAC,CAAC,QAAQ;aACrB,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC;gBACzB,OAAO,EAAE,+CAA+C;aACzD,CAAC,CAAC;YAEH,IAAI,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;gBAClB,SAAS,CAAC,IAAI,CAAC;oBACb,EAAE,EAAE,CAAC,CAAC,EAAE;oBACR,SAAS,EAAE,CAAC,CAAC,SAAS;oBACtB,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE;oBACnB,UAAU,EAAE,GAAG;oBACf,SAAS,EAAE,IAAI;oBACf,QAAQ,EAAE,EAAE;oBACZ,QAAQ,EAAE,CAAC,CAAC,QAAQ;iBACrB,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAClB,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { DocsGenerateOptions } from '../../config/types.js';
|
|
2
|
+
export declare function handleDocsGenerate(options: DocsGenerateOptions): Promise<void>;
|
|
3
|
+
export declare function handleDocsStatus(): Promise<void>;
|
|
4
|
+
export declare function handleDocsUpdate(): Promise<void>;
|
|
5
|
+
//# sourceMappingURL=docs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEjE,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAmBpF;AAED,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAmBtD;AAED,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CActD"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export async function handleDocsGenerate(options) {
|
|
2
|
+
const chalk = (await import('chalk')).default;
|
|
3
|
+
const ora = (await import('ora')).default;
|
|
4
|
+
const { DocGenerator } = await import('../../core/generator/DocGenerator.js');
|
|
5
|
+
const generator = new DocGenerator(process.cwd());
|
|
6
|
+
const spinner = ora('Generating documentation...').start();
|
|
7
|
+
try {
|
|
8
|
+
const result = await generator.generate(options);
|
|
9
|
+
spinner.succeed(`Generated ${result.docsCreated} documents in ${result.durationMs}ms`);
|
|
10
|
+
for (const doc of result.documents) {
|
|
11
|
+
console.log(chalk.green(` ā
${doc}`));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
catch (err) {
|
|
15
|
+
spinner.fail('Documentation generation failed');
|
|
16
|
+
throw err;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export async function handleDocsStatus() {
|
|
20
|
+
const chalk = (await import('chalk')).default;
|
|
21
|
+
const { StalenessTracker } = await import('../../core/generator/StalenessTracker.js');
|
|
22
|
+
const tracker = new StalenessTracker(process.cwd());
|
|
23
|
+
const status = await tracker.check();
|
|
24
|
+
console.log(chalk.bold('\nš Documentation Status\n'));
|
|
25
|
+
for (const doc of status) {
|
|
26
|
+
const icon = doc.stale ? 'ā ļø ' : 'ā
';
|
|
27
|
+
const suffix = doc.stale ? chalk.yellow(` Stale ā ${doc.reason}`) : chalk.green(' Up to date');
|
|
28
|
+
console.log(` ${icon} ${doc.name.padEnd(22)}${suffix}`);
|
|
29
|
+
}
|
|
30
|
+
const staleCount = status.filter((d) => d.stale).length;
|
|
31
|
+
if (staleCount > 0) {
|
|
32
|
+
console.log(chalk.dim(`\nā Run: codeplug docs update (regenerates stale sections only)`));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export async function handleDocsUpdate() {
|
|
36
|
+
const ora = (await import('ora')).default;
|
|
37
|
+
const { DocGenerator } = await import('../../core/generator/DocGenerator.js');
|
|
38
|
+
const generator = new DocGenerator(process.cwd());
|
|
39
|
+
const spinner = ora('Updating stale documentation...').start();
|
|
40
|
+
try {
|
|
41
|
+
const result = await generator.update();
|
|
42
|
+
spinner.succeed(`Updated ${result.docsUpdated} documents`);
|
|
43
|
+
}
|
|
44
|
+
catch (err) {
|
|
45
|
+
spinner.fail('Documentation update failed');
|
|
46
|
+
throw err;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=docs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs.js","sourceRoot":"","sources":["../../../src/cli/commands/docs.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,OAA4B;IACnE,MAAM,KAAK,GAAG,CAAC,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IAC9C,MAAM,GAAG,GAAG,CAAC,MAAM,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC;IAC1C,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,MAAM,CAAC,sCAAsC,CAAC,CAAC;IAE9E,MAAM,SAAS,GAAG,IAAI,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAClD,MAAM,OAAO,GAAG,GAAG,CAAC,6BAA6B,CAAC,CAAC,KAAK,EAAE,CAAC;IAE3D,IAAI,CAAC;QACH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EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAoDxE"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export async function handleExport(options) {
|
|
2
|
+
const chalk = (await import('chalk')).default;
|
|
3
|
+
const ora = (await import('ora')).default;
|
|
4
|
+
const { ExportEngine } = await import('../../core/exporter/ExportEngine.js');
|
|
5
|
+
const { ConventionStore } = await import('../../storage/ConventionStore.js');
|
|
6
|
+
const store = new ConventionStore(process.cwd());
|
|
7
|
+
if (!await store.exists()) {
|
|
8
|
+
console.log(chalk.yellow('No conventions found. Run "codeplug convention init" first.'));
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
if (options.check) {
|
|
12
|
+
const { FreshnessChecker } = await import('../../core/exporter/FreshnessChecker.js');
|
|
13
|
+
const checker = new FreshnessChecker(process.cwd());
|
|
14
|
+
const fresh = await checker.check();
|
|
15
|
+
if (fresh) {
|
|
16
|
+
console.log(chalk.green('ā
All exports are up to date.'));
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
console.log(chalk.yellow('ā ļø Exports are stale. Run "codeplug export --all" to update.'));
|
|
20
|
+
}
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const conventions = await store.load();
|
|
24
|
+
const engine = new ExportEngine(process.cwd());
|
|
25
|
+
const targets = options.all
|
|
26
|
+
? ['claude', 'cursor', 'copilot', 'json', 'ci']
|
|
27
|
+
: options.target
|
|
28
|
+
? [options.target]
|
|
29
|
+
: options.format
|
|
30
|
+
? [options.format]
|
|
31
|
+
: [];
|
|
32
|
+
if (targets.length === 0) {
|
|
33
|
+
console.log(chalk.yellow('Specify --target, --format, or --all.'));
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const spinner = ora(`Exporting for ${targets.join(', ')}...`).start();
|
|
37
|
+
try {
|
|
38
|
+
const result = await engine.export(conventions, targets);
|
|
39
|
+
spinner.succeed(`Exported ${result.filesWritten} files`);
|
|
40
|
+
for (const file of result.files) {
|
|
41
|
+
console.log(chalk.green(` ā
${file}`));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
catch (err) {
|
|
45
|
+
spinner.fail('Export failed');
|
|
46
|
+
throw err;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=export.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.js","sourceRoot":"","sources":["../../../src/cli/commands/export.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAAsB;IACvD,MAAM,KAAK,GAAG,CAAC,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IAC9C,MAAM,GAAG,GAAG,CAAC,MAAM,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC;IAC1C,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,MAAM,CAAC,qCAAqC,CAAC,CAAC;IAC7E,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,MAAM,CAAC,kCAAkC,CAAC,CAAC;IAE7E,MAAM,KAAK,GAAG,IAAI,eAAe,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACjD,IAAI,CAAC,MAAM,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;QAC1B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,6DAA6D,CAAC,CAAC,CAAC;QACzF,OAAO;IACT,CAAC;IAED,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,EAAE,gBAAgB,EAAE,GAAG,MAAM,MAAM,CAAC,yCAAyC,CAAC,CAAC;QACrF,MAAM,OAAO,GAAG,IAAI,gBAAgB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QACpD,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;QACpC,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,CAAC,GAAG,CAAC,KA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