@patricio0312rev/agentkit 0.1.0 → 0.2.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/CHANGELOG.md +65 -0
- package/README.md +5 -34
- package/RELEASE.md +175 -0
- package/package.json +1 -1
- package/src/commands/init.js +44 -3
- package/src/lib/config.js +1 -1
- package/src/lib/generator.js +63 -24
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to AgentKit will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- N/A
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
- N/A
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
- N/A
|
|
18
|
+
|
|
19
|
+
## [0.2.0] - 2025-12-28
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
- Model selection for Claude Code agents (sonnet, opus, haiku, or inherit from parent)
|
|
23
|
+
- Interactive model selection prompt when choosing Claude Code tool
|
|
24
|
+
- Automatic model field injection in agent frontmatter
|
|
25
|
+
- Automated GitHub Actions workflow for npm publishing
|
|
26
|
+
- `RELEASE.md` documentation for publishing process
|
|
27
|
+
- `CHANGELOG.md` for tracking version changes
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
- Claude Code folder structure: agents now placed directly in `.claude/agents` (no department subfolders)
|
|
31
|
+
- Folder path validation now allows forward slashes for nested paths
|
|
32
|
+
- Default folder for Claude Code changed from `.claude` to `.claude/agents`
|
|
33
|
+
|
|
34
|
+
### Fixed
|
|
35
|
+
- Folder validation rejecting valid paths with forward slashes
|
|
36
|
+
- Model field not being added to agent frontmatter due to regex pattern mismatch
|
|
37
|
+
|
|
38
|
+
## [0.1.0] - 2025-12-27
|
|
39
|
+
|
|
40
|
+
### Added
|
|
41
|
+
- Initial release of AgentKit
|
|
42
|
+
- Support for Claude Code, Cursor, GitHub Copilot, Aider, and Universal AI tools
|
|
43
|
+
- 7 department categories: Engineering, Design, Marketing, Product, Project Management, Studio Operations, Testing
|
|
44
|
+
- 35+ pre-configured AI agent templates
|
|
45
|
+
- Interactive CLI for agent selection
|
|
46
|
+
- Department-based organization
|
|
47
|
+
- Custom folder naming
|
|
48
|
+
- Non-interactive mode with flags
|
|
49
|
+
|
|
50
|
+
### Changed
|
|
51
|
+
- N/A
|
|
52
|
+
|
|
53
|
+
### Fixed
|
|
54
|
+
- N/A
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Release Types
|
|
59
|
+
|
|
60
|
+
- **Added** - New features
|
|
61
|
+
- **Changed** - Changes in existing functionality
|
|
62
|
+
- **Deprecated** - Soon-to-be removed features
|
|
63
|
+
- **Removed** - Removed features
|
|
64
|
+
- **Fixed** - Bug fixes
|
|
65
|
+
- **Security** - Security fixes
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
AgentKit is a CLI tool that helps you set up specialized AI agents for your development workflow. Get 42 pre-built agents across 7 departments—from engineering and design to marketing and testing—all optimized for rapid app development.
|
|
6
6
|
|
|
7
|
-
[](https://www.npmjs.com/package/agentkit)
|
|
7
|
+
[](https://www.npmjs.com/package/@patricio0312rev/agentkit)
|
|
8
8
|
[](https://opensource.org/licenses/MIT)
|
|
9
9
|
|
|
10
10
|
---
|
|
@@ -24,7 +24,7 @@ AgentKit is a CLI tool that helps you set up specialized AI agents for your deve
|
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
26
|
# Install globally
|
|
27
|
-
npm install -g agentkit
|
|
27
|
+
npm install -g @patricio0312rev/agentkit
|
|
28
28
|
|
|
29
29
|
# Or use directly with npx
|
|
30
30
|
npx agentkit init
|
|
@@ -185,35 +185,6 @@ Copilot automatically uses `.github/copilot-instructions.md` for all suggestions
|
|
|
185
185
|
|
|
186
186
|
---
|
|
187
187
|
|
|
188
|
-
## 🔧 Configuration Options
|
|
189
|
-
|
|
190
|
-
```bash
|
|
191
|
-
agentkit init [options]
|
|
192
|
-
|
|
193
|
-
Options:
|
|
194
|
-
-t, --tool <tool> AI tool (claude-code, cursor, copilot, aider, universal)
|
|
195
|
-
-f, --folder <name> Custom folder name
|
|
196
|
-
-d, --departments <list> Comma-separated list of departments
|
|
197
|
-
--agents <list> Comma-separated list of specific agents
|
|
198
|
-
--skip-prompts Skip all interactive prompts (requires all flags)
|
|
199
|
-
-h, --help Display help for command
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
**Examples:**
|
|
203
|
-
|
|
204
|
-
```bash
|
|
205
|
-
# Full engineering department
|
|
206
|
-
agentkit init -t cursor -d engineering --skip-prompts
|
|
207
|
-
|
|
208
|
-
# Specific agents only
|
|
209
|
-
agentkit init -t cursor -d engineering --agents backend-architect,frontend-developer --skip-prompts
|
|
210
|
-
|
|
211
|
-
# Multiple departments
|
|
212
|
-
agentkit init -t claude-code -d engineering,design,marketing --skip-prompts
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
---
|
|
216
|
-
|
|
217
188
|
## 📚 Documentation
|
|
218
189
|
|
|
219
190
|
Each generated agent includes:
|
|
@@ -335,8 +306,8 @@ agentkit init \
|
|
|
335
306
|
|
|
336
307
|
```bash
|
|
337
308
|
# If installed globally, try:
|
|
338
|
-
npm uninstall -g agentkit
|
|
339
|
-
npm install -g agentkit
|
|
309
|
+
npm uninstall -g @patricio0312rev/agentkit
|
|
310
|
+
npm install -g @patricio0312rev/agentkit
|
|
340
311
|
|
|
341
312
|
# Or use npx:
|
|
342
313
|
npx agentkit init
|
|
@@ -351,7 +322,7 @@ npx agentkit init
|
|
|
351
322
|
**3. Permission errors during installation**
|
|
352
323
|
|
|
353
324
|
```bash
|
|
354
|
-
sudo npm install -g agentkit
|
|
325
|
+
sudo npm install -g @patricio0312rev/agentkit
|
|
355
326
|
# Or use npx to avoid global install
|
|
356
327
|
```
|
|
357
328
|
|
package/RELEASE.md
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# Release Process
|
|
2
|
+
|
|
3
|
+
This document explains how to publish new versions of AgentKit to npm using the automated GitHub Actions workflow.
|
|
4
|
+
|
|
5
|
+
## One-Time Setup
|
|
6
|
+
|
|
7
|
+
### 1. Get NPM Access Token
|
|
8
|
+
|
|
9
|
+
1. Log in to [npmjs.com](https://www.npmjs.com/)
|
|
10
|
+
2. Click on your profile icon → **Access Tokens**
|
|
11
|
+
3. Click **Generate New Token** → **Classic Token**
|
|
12
|
+
4. Select **Automation** type (allows CI/CD publishing)
|
|
13
|
+
5. Copy the generated token (starts with `npm_...`)
|
|
14
|
+
|
|
15
|
+
### 2. Add NPM Token to GitHub Secrets
|
|
16
|
+
|
|
17
|
+
1. Go to your GitHub repository: `https://github.com/patricio0312rev/agentkit`
|
|
18
|
+
2. Click **Settings** → **Secrets and variables** → **Actions**
|
|
19
|
+
3. Click **New repository secret**
|
|
20
|
+
4. Name: `NPM_TOKEN`
|
|
21
|
+
5. Value: Paste your npm token
|
|
22
|
+
6. Click **Add secret**
|
|
23
|
+
|
|
24
|
+
That's it! The `GITHUB_TOKEN` is automatically provided by GitHub Actions.
|
|
25
|
+
|
|
26
|
+
## Publishing a New Release
|
|
27
|
+
|
|
28
|
+
### Step 1: Update Version
|
|
29
|
+
|
|
30
|
+
Update the version in `package.json`:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# For patch release (0.1.0 → 0.1.1)
|
|
34
|
+
npm version patch
|
|
35
|
+
|
|
36
|
+
# For minor release (0.1.0 → 0.2.0)
|
|
37
|
+
npm version minor
|
|
38
|
+
|
|
39
|
+
# For major release (0.1.0 → 1.0.0)
|
|
40
|
+
npm version major
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
This command will:
|
|
44
|
+
- Update `package.json` version
|
|
45
|
+
- Create a git commit with the version change
|
|
46
|
+
- Create a git tag (e.g., `v0.1.1`)
|
|
47
|
+
|
|
48
|
+
### Step 2: Update Changelog (Optional but Recommended)
|
|
49
|
+
|
|
50
|
+
Create or update `CHANGELOG.md` with release notes:
|
|
51
|
+
|
|
52
|
+
```markdown
|
|
53
|
+
## [0.1.1] - 2025-01-XX
|
|
54
|
+
|
|
55
|
+
### Added
|
|
56
|
+
- Model selection for Claude Code agents
|
|
57
|
+
- Direct agent placement in .claude/agents folder
|
|
58
|
+
|
|
59
|
+
### Changed
|
|
60
|
+
- Updated folder structure for Claude Code
|
|
61
|
+
|
|
62
|
+
### Fixed
|
|
63
|
+
- Bug fixes...
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Commit the changelog:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
git add CHANGELOG.md
|
|
70
|
+
git commit -m "docs: update changelog for v0.1.1"
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Step 3: Push Tags to Trigger Release
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Push commits
|
|
77
|
+
git push origin main
|
|
78
|
+
|
|
79
|
+
# Push tags (this triggers the GitHub Action)
|
|
80
|
+
git push origin --tags
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Step 4: Monitor the Release
|
|
84
|
+
|
|
85
|
+
1. Go to **Actions** tab in GitHub repository
|
|
86
|
+
2. You should see the "Publish to npm" workflow running
|
|
87
|
+
3. The workflow will:
|
|
88
|
+
- Install dependencies
|
|
89
|
+
- Run tests
|
|
90
|
+
- Verify version matches tag
|
|
91
|
+
- Publish to npm
|
|
92
|
+
- Create GitHub release
|
|
93
|
+
|
|
94
|
+
### Step 5: Verify Publication
|
|
95
|
+
|
|
96
|
+
Check that the package was published:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
npm view @patricio0312rev/agentkit version
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Visit the npm page:
|
|
103
|
+
https://www.npmjs.com/package/@patricio0312rev/agentkit
|
|
104
|
+
|
|
105
|
+
## Manual Release (If Needed)
|
|
106
|
+
|
|
107
|
+
If the automated workflow fails, you can publish manually:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# Make sure you're on the correct version
|
|
111
|
+
npm version <patch|minor|major>
|
|
112
|
+
|
|
113
|
+
# Login to npm
|
|
114
|
+
npm login
|
|
115
|
+
|
|
116
|
+
# Publish
|
|
117
|
+
npm publish --access public
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Release Checklist
|
|
121
|
+
|
|
122
|
+
Before releasing, ensure:
|
|
123
|
+
|
|
124
|
+
- [ ] All tests pass: `npm test`
|
|
125
|
+
- [ ] Code is linted and formatted
|
|
126
|
+
- [ ] Version is bumped in `package.json`
|
|
127
|
+
- [ ] `CHANGELOG.md` is updated
|
|
128
|
+
- [ ] All changes are committed
|
|
129
|
+
- [ ] Tags are pushed to GitHub
|
|
130
|
+
|
|
131
|
+
## Version Numbering Guidelines
|
|
132
|
+
|
|
133
|
+
Follow [Semantic Versioning](https://semver.org/):
|
|
134
|
+
|
|
135
|
+
- **PATCH** (0.1.X) - Bug fixes, small improvements
|
|
136
|
+
- **MINOR** (0.X.0) - New features, backward compatible
|
|
137
|
+
- **MAJOR** (X.0.0) - Breaking changes
|
|
138
|
+
|
|
139
|
+
## Troubleshooting
|
|
140
|
+
|
|
141
|
+
### "Version already exists" error
|
|
142
|
+
|
|
143
|
+
You tried to publish a version that already exists on npm. Bump the version again:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
npm version patch
|
|
147
|
+
git push origin --tags
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### "Permission denied" error
|
|
151
|
+
|
|
152
|
+
Your `NPM_TOKEN` might be invalid or expired:
|
|
153
|
+
1. Generate a new token on npmjs.com
|
|
154
|
+
2. Update the GitHub secret
|
|
155
|
+
|
|
156
|
+
### Workflow doesn't trigger
|
|
157
|
+
|
|
158
|
+
Make sure you pushed the tag:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
git push origin --tags
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
The workflow only runs when tags matching `v*.*.*` are pushed.
|
|
165
|
+
|
|
166
|
+
## Quick Reference
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
# Complete release process
|
|
170
|
+
npm version patch # Bump version
|
|
171
|
+
git add CHANGELOG.md # Add changelog
|
|
172
|
+
git commit -m "docs: update changelog"
|
|
173
|
+
git push origin main # Push commits
|
|
174
|
+
git push origin --tags # Push tags → triggers workflow
|
|
175
|
+
```
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patricio0312rev/agentkit",
|
|
3
3
|
"displayName": "AgentKit",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.2.0",
|
|
5
5
|
"description": "CLI tool to scaffold AI agent configurations for Claude Code, Cursor, and other AI coding assistants",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"bin": {
|
package/src/commands/init.js
CHANGED
|
@@ -50,7 +50,8 @@ function buildConfigFromFlags(options) {
|
|
|
50
50
|
agents: options.agents
|
|
51
51
|
? options.agents.split(",").map((a) => a.trim())
|
|
52
52
|
: [],
|
|
53
|
-
|
|
53
|
+
model: options.model === "inherit" ? undefined : options.model,
|
|
54
|
+
stack: [],
|
|
54
55
|
};
|
|
55
56
|
}
|
|
56
57
|
|
|
@@ -91,8 +92,8 @@ async function promptUser(options) {
|
|
|
91
92
|
validate: (input) => {
|
|
92
93
|
if (!input.trim()) return "Folder name cannot be empty";
|
|
93
94
|
if (input.includes(" ")) return "Folder name cannot contain spaces";
|
|
94
|
-
if (input.includes("\\")
|
|
95
|
-
return "Folder name cannot contain
|
|
95
|
+
if (input.includes("\\"))
|
|
96
|
+
return "Folder name cannot contain backslashes";
|
|
96
97
|
return true;
|
|
97
98
|
},
|
|
98
99
|
},
|
|
@@ -102,6 +103,46 @@ async function promptUser(options) {
|
|
|
102
103
|
answers.folder = options.folder;
|
|
103
104
|
}
|
|
104
105
|
|
|
106
|
+
// Step 2.5: Model selection for Claude Code
|
|
107
|
+
if (answers.tool === "claude-code" && !options.model) {
|
|
108
|
+
const modelChoices = [
|
|
109
|
+
{
|
|
110
|
+
name: `${chalk.bold("Sonnet")} ${chalk.gray("→")} ${chalk.dim("Balanced performance - best for most agents")}`,
|
|
111
|
+
value: "sonnet",
|
|
112
|
+
short: "Sonnet",
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: `${chalk.bold("Opus")} ${chalk.gray("→")} ${chalk.dim("Most capable for complex reasoning tasks")}`,
|
|
116
|
+
value: "opus",
|
|
117
|
+
short: "Opus",
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: `${chalk.bold("Haiku")} ${chalk.gray("→")} ${chalk.dim("Fast and efficient for simple tasks")}`,
|
|
121
|
+
value: "haiku",
|
|
122
|
+
short: "Haiku",
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: `${chalk.bold("Inherit from parent")} ${chalk.gray("→")} ${chalk.dim("Use the same model as the main conversation")}`,
|
|
126
|
+
value: "inherit",
|
|
127
|
+
short: "Inherit from parent",
|
|
128
|
+
},
|
|
129
|
+
];
|
|
130
|
+
|
|
131
|
+
const modelAnswer = await inquirer.prompt([
|
|
132
|
+
{
|
|
133
|
+
type: "list",
|
|
134
|
+
name: "model",
|
|
135
|
+
message: "Select model for agents:",
|
|
136
|
+
choices: modelChoices,
|
|
137
|
+
default: "sonnet",
|
|
138
|
+
},
|
|
139
|
+
]);
|
|
140
|
+
answers.model =
|
|
141
|
+
modelAnswer.model === "inherit" ? undefined : modelAnswer.model;
|
|
142
|
+
} else if (options.model) {
|
|
143
|
+
answers.model = options.model === "inherit" ? undefined : options.model;
|
|
144
|
+
}
|
|
145
|
+
|
|
105
146
|
// Step 3: Select departments
|
|
106
147
|
if (!options.departments) {
|
|
107
148
|
const deptChoices = Object.entries(DEPARTMENTS).map(([key, value]) => ({
|
package/src/lib/config.js
CHANGED
package/src/lib/generator.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const fs = require(
|
|
2
|
-
const path = require(
|
|
3
|
-
const { TOOLS, DEPARTMENTS } = require(
|
|
4
|
-
const { generateReadme } = require(
|
|
5
|
-
const { generateToolSpecificFiles } = require(
|
|
1
|
+
const fs = require("fs-extra");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const { TOOLS, DEPARTMENTS } = require("./config");
|
|
4
|
+
const { generateReadme } = require("../utils/readme");
|
|
5
|
+
const { generateToolSpecificFiles } = require("../utils/tool-specific");
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Main generator function that creates AI agent configuration
|
|
@@ -16,7 +16,7 @@ async function generateAgents(config) {
|
|
|
16
16
|
targetDir,
|
|
17
17
|
agentsGenerated: 0,
|
|
18
18
|
filesCreated: [],
|
|
19
|
-
errors: []
|
|
19
|
+
errors: [],
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
try {
|
|
@@ -29,18 +29,21 @@ async function generateAgents(config) {
|
|
|
29
29
|
result.filesCreated.push(...agentResult.files);
|
|
30
30
|
|
|
31
31
|
// Generate README
|
|
32
|
-
const readmePath = path.join(targetDir,
|
|
32
|
+
const readmePath = path.join(targetDir, "README.md");
|
|
33
33
|
const readmeContent = generateReadme(config, result);
|
|
34
34
|
await fs.writeFile(readmePath, readmeContent);
|
|
35
35
|
result.filesCreated.push(readmePath);
|
|
36
36
|
|
|
37
37
|
// Generate tool-specific files (e.g., .cursorrules, copilot-instructions.md)
|
|
38
|
-
const toolFiles = await generateToolSpecificFiles(
|
|
38
|
+
const toolFiles = await generateToolSpecificFiles(
|
|
39
|
+
config,
|
|
40
|
+
targetDir,
|
|
41
|
+
agentResult.agentsList
|
|
42
|
+
);
|
|
39
43
|
result.filesCreated.push(...toolFiles);
|
|
40
44
|
|
|
41
45
|
result.success = true;
|
|
42
46
|
return result;
|
|
43
|
-
|
|
44
47
|
} catch (error) {
|
|
45
48
|
result.errors.push(error.message);
|
|
46
49
|
throw error;
|
|
@@ -58,22 +61,28 @@ async function generateDepartmentAgents(config, targetDir) {
|
|
|
58
61
|
const files = [];
|
|
59
62
|
const agentsList = [];
|
|
60
63
|
|
|
64
|
+
// For Claude Code, agents go directly in .claude/agents, not in department subfolders
|
|
65
|
+
const isClaudeCode = config.tool === "claude-code";
|
|
66
|
+
|
|
61
67
|
for (const dept of config.departments) {
|
|
62
68
|
const deptInfo = DEPARTMENTS[dept];
|
|
63
69
|
if (!deptInfo) continue;
|
|
64
70
|
|
|
65
|
-
|
|
71
|
+
// Only create department subdirectories for non-Claude Code tools
|
|
72
|
+
const deptDir = isClaudeCode ? targetDir : path.join(targetDir, dept);
|
|
66
73
|
await fs.ensureDir(deptDir);
|
|
67
74
|
|
|
68
75
|
// Determine which agents to generate
|
|
69
76
|
let agentsToGenerate = deptInfo.agents;
|
|
70
|
-
|
|
77
|
+
|
|
71
78
|
// Filter if specific agents were selected
|
|
72
79
|
if (config.agents && config.agents.length > 0) {
|
|
73
|
-
agentsToGenerate = agentsToGenerate.filter(agent => {
|
|
80
|
+
agentsToGenerate = agentsToGenerate.filter((agent) => {
|
|
74
81
|
// Support both "agent-name" and "dept/agent-name" formats
|
|
75
|
-
return
|
|
76
|
-
|
|
82
|
+
return (
|
|
83
|
+
config.agents.includes(agent) ||
|
|
84
|
+
config.agents.includes(`${dept}/${agent}`)
|
|
85
|
+
);
|
|
77
86
|
});
|
|
78
87
|
}
|
|
79
88
|
|
|
@@ -100,13 +109,18 @@ async function generateDepartmentAgents(config, targetDir) {
|
|
|
100
109
|
* @returns {Promise<string|null>} Path to created file or null
|
|
101
110
|
*/
|
|
102
111
|
async function generateAgentFile(dept, agent, deptDir, config) {
|
|
103
|
-
const sourceFile = path.join(
|
|
112
|
+
const sourceFile = path.join(
|
|
113
|
+
__dirname,
|
|
114
|
+
"../../templates/departments",
|
|
115
|
+
dept,
|
|
116
|
+
`${agent}.md`
|
|
117
|
+
);
|
|
104
118
|
const targetFile = path.join(deptDir, `${agent}.md`);
|
|
105
119
|
|
|
106
120
|
try {
|
|
107
121
|
// Check if template exists
|
|
108
122
|
if (await fs.pathExists(sourceFile)) {
|
|
109
|
-
let content = await fs.readFile(sourceFile,
|
|
123
|
+
let content = await fs.readFile(sourceFile, "utf8");
|
|
110
124
|
|
|
111
125
|
// Process content based on config
|
|
112
126
|
content = processAgentContent(content, config);
|
|
@@ -115,7 +129,7 @@ async function generateAgentFile(dept, agent, deptDir, config) {
|
|
|
115
129
|
return targetFile;
|
|
116
130
|
} else {
|
|
117
131
|
// Generate basic template if source doesn't exist
|
|
118
|
-
const basicTemplate = generateBasicAgentTemplate(dept, agent);
|
|
132
|
+
const basicTemplate = generateBasicAgentTemplate(dept, agent, config);
|
|
119
133
|
await fs.writeFile(targetFile, basicTemplate);
|
|
120
134
|
return targetFile;
|
|
121
135
|
}
|
|
@@ -134,17 +148,34 @@ async function generateAgentFile(dept, agent, deptDir, config) {
|
|
|
134
148
|
function processAgentContent(content, config) {
|
|
135
149
|
let processed = content;
|
|
136
150
|
|
|
151
|
+
// Add model field to frontmatter for Claude Code agents
|
|
152
|
+
if (config.tool === "claude-code" && config.model) {
|
|
153
|
+
const frontmatterMatch = processed.match(/^---\n([\s\S]*?)\n---/);
|
|
154
|
+
if (frontmatterMatch) {
|
|
155
|
+
const frontmatterContent = frontmatterMatch[1];
|
|
156
|
+
|
|
157
|
+
const updatedFrontmatter = frontmatterContent.replace(
|
|
158
|
+
/(tools:.*?)($|\n)/,
|
|
159
|
+
`$1\nmodel: ${config.model}$2`
|
|
160
|
+
);
|
|
161
|
+
processed = processed.replace(
|
|
162
|
+
/^---\n[\s\S]*?\n---/,
|
|
163
|
+
`---\n${updatedFrontmatter}\n---`
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
137
168
|
// Remove examples if requested
|
|
138
169
|
if (config.skipExamples) {
|
|
139
170
|
// Remove content between <example> tags
|
|
140
|
-
processed = processed.replace(/<example>[\s\S]*?<\/example>/g,
|
|
171
|
+
processed = processed.replace(/<example>[\s\S]*?<\/example>/g, "");
|
|
141
172
|
// Clean up extra whitespace
|
|
142
|
-
processed = processed.replace(/\n{3,}/g,
|
|
173
|
+
processed = processed.replace(/\n{3,}/g, "\n\n");
|
|
143
174
|
}
|
|
144
175
|
|
|
145
176
|
// Add tech stack information if provided
|
|
146
177
|
if (config.stack && config.stack.length > 0) {
|
|
147
|
-
const stackSection = `\n\n## Tech Stack Context\n\nThis project uses: ${config.stack.join(
|
|
178
|
+
const stackSection = `\n\n## Tech Stack Context\n\nThis project uses: ${config.stack.join(", ")}\n`;
|
|
148
179
|
// Insert before the main content or at the end
|
|
149
180
|
processed += stackSection;
|
|
150
181
|
}
|
|
@@ -156,19 +187,27 @@ function processAgentContent(content, config) {
|
|
|
156
187
|
* Generate a basic agent template when source file doesn't exist
|
|
157
188
|
* @param {string} dept - Department name
|
|
158
189
|
* @param {string} agent - Agent name
|
|
190
|
+
* @param {Object} config - Configuration object
|
|
159
191
|
* @returns {string} Basic template content
|
|
160
192
|
*/
|
|
161
|
-
function generateBasicAgentTemplate(dept, agent) {
|
|
193
|
+
function generateBasicAgentTemplate(dept, agent, config) {
|
|
162
194
|
const deptInfo = DEPARTMENTS[dept];
|
|
195
|
+
const modelLine =
|
|
196
|
+
config.tool === "claude-code" && config.model
|
|
197
|
+
? `\nmodel: ${config.model}`
|
|
198
|
+
: "";
|
|
163
199
|
return `<!-- ${dept}/${agent}.md -->
|
|
164
200
|
---
|
|
165
201
|
name: ${agent}
|
|
166
202
|
description: AI agent for ${deptInfo.name}
|
|
167
203
|
color: blue
|
|
168
|
-
tools: Read, Write, MultiEdit
|
|
204
|
+
tools: Read, Write, MultiEdit${modelLine}
|
|
169
205
|
---
|
|
170
206
|
|
|
171
|
-
# ${agent
|
|
207
|
+
# ${agent
|
|
208
|
+
.split("-")
|
|
209
|
+
.map((w) => w.charAt(0).toUpperCase() + w.slice(1))
|
|
210
|
+
.join(" ")}
|
|
172
211
|
|
|
173
212
|
This is a placeholder agent file. Please add specific instructions and responsibilities.
|
|
174
213
|
|
|
@@ -189,5 +228,5 @@ This is a placeholder agent file. Please add specific instructions and responsib
|
|
|
189
228
|
module.exports = {
|
|
190
229
|
generateAgents,
|
|
191
230
|
generateDepartmentAgents,
|
|
192
|
-
generateAgentFile
|
|
231
|
+
generateAgentFile,
|
|
193
232
|
};
|