Skip to content

Commit 2c35e77

Browse files
wishket-pjwJeremyDev87
authored andcommitted
feat: Template-based init and config update suggestions
- Add template-based init (no API key required) - Add --ai flag for AI-powered initialization - Implement framework templates and ConfigDiffService - Add suggest_config_updates MCP tool - Update all documentation close #86
1 parent b325ac4 commit 2c35e77

38 files changed

Lines changed: 2615 additions & 171 deletions

.github/dependabot.yml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
version: 2
22
updates:
3-
- package-ecosystem: "npm"
4-
directory: "/mcp-server"
3+
- package-ecosystem: 'npm'
4+
directory: '/mcp-server'
55
schedule:
6-
interval: "weekly"
7-
day: "monday"
6+
interval: 'weekly'
7+
day: 'monday'
88
open-pull-requests-limit: 10
99
labels:
10-
- "dependencies"
11-
- "security"
10+
- 'dependencies'
11+
- 'security'
1212
commit-message:
13-
prefix: "chore(deps)"
13+
prefix: 'chore(deps)'
1414
groups:
1515
dev-dependencies:
16-
dependency-type: "development"
16+
dependency-type: 'development'
1717
update-types:
18-
- "minor"
19-
- "patch"
18+
- 'minor'
19+
- 'patch'
2020
production-dependencies:
21-
dependency-type: "production"
21+
dependency-type: 'production'
2222
update-types:
23-
- "patch"
23+
- 'patch'
2424

25-
- package-ecosystem: "github-actions"
26-
directory: "/"
25+
- package-ecosystem: 'github-actions'
26+
directory: '/'
2727
schedule:
28-
interval: "weekly"
29-
day: "monday"
28+
interval: 'weekly'
29+
day: 'monday'
3030
labels:
31-
- "dependencies"
32-
- "github-actions"
31+
- 'dependencies'
32+
- 'github-actions'
3333
commit-message:
34-
prefix: "chore(ci)"
34+
prefix: 'chore(ci)'

.github/release-drafter.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ categories:
3030
- title: '📚 Documentation'
3131
labels:
3232
- 'documentation'
33-
- 'Documentation'
33+
- 'Documentation'
3434
- title: '🧰 Maintenance'
3535
labels:
3636
- 'chore'
@@ -41,9 +41,9 @@ categories:
4141
- 'Build'
4242
- title: '🛠 Dependencies'
4343
labels:
44-
- 'dependencies'
44+
- 'dependencies'
4545
- 'Dependencies'
4646
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
4747
template: |
4848
## Changes
49-
$CHANGES
49+
$CHANGES

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,12 @@ Codingbuddy provides a unified rules system that works with Cursor, Claude Code,
2626
## Quick Start
2727

2828
```bash
29-
# Initialize your project (analyzes codebase and creates config)
29+
# Initialize your project (no API key required)
3030
npx codingbuddy init
3131

32+
# Optional: AI-powered initialization for deeper analysis
33+
# npx codingbuddy init --ai # Requires ANTHROPIC_API_KEY
34+
3235
# Add to your AI tool (example: Claude Desktop)
3336
# See docs/supported-tools.md for other AI tools
3437
```

apps/mcp-server/src/cli/cli.types.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,12 @@ export interface InitOptions {
2828
format: 'js' | 'json';
2929
/** Force overwrite existing config */
3030
force: boolean;
31-
/** Anthropic API key */
31+
/** Use AI to generate config (requires API key) */
32+
useAi?: boolean;
33+
/** Anthropic API key (only used with --ai flag) */
3234
apiKey?: string;
35+
/** Response language for AI and comments */
36+
language?: string;
3337
}
3438

3539
/**

apps/mcp-server/src/cli/init/config.writer.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ export type ConfigFormat = 'js' | 'json';
2727
export interface WriteConfigOptions {
2828
/** Output format (default: 'js') */
2929
format?: ConfigFormat;
30+
/** Write raw content without formatting (for pre-rendered templates) */
31+
raw?: boolean;
3032
}
3133

3234
/**
@@ -71,22 +73,34 @@ export async function findExistingConfig(
7173
* Write configuration file to project root
7274
*
7375
* @param projectRoot - Project root directory
74-
* @param config - Configuration to write
76+
* @param config - Configuration object or pre-rendered string (when raw: true)
7577
* @param options - Write options
7678
* @returns Path to written file
7779
*/
7880
export async function writeConfig(
7981
projectRoot: string,
80-
config: CodingBuddyConfig,
82+
config: CodingBuddyConfig | string,
8183
options: WriteConfigOptions = {},
8284
): Promise<string> {
8385
const format = options.format ?? 'js';
8486

8587
const fileName =
8688
format === 'json' ? 'codingbuddy.config.json' : 'codingbuddy.config.js';
8789

88-
const content =
89-
format === 'json' ? formatConfigAsJson(config) : formatConfigAsJs(config);
90+
let content: string;
91+
92+
if (options.raw && typeof config === 'string') {
93+
// Use pre-rendered content as-is
94+
content = config;
95+
} else if (typeof config === 'object') {
96+
// Format the config object
97+
content =
98+
format === 'json' ? formatConfigAsJson(config) : formatConfigAsJs(config);
99+
} else {
100+
throw new Error(
101+
'Invalid config: expected object or string with raw option',
102+
);
103+
}
90104

91105
const filePath = path.join(projectRoot, fileName);
92106

0 commit comments

Comments
 (0)