@agenticc/cli 1.0.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/LICENSE +21 -0
- package/README.md +160 -0
- package/dist/commands/create.d.ts +9 -0
- package/dist/commands/create.d.ts.map +1 -0
- package/dist/commands/create.js +84 -0
- package/dist/commands/create.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts.d.ts +3 -0
- package/dist/prompts.d.ts.map +1 -0
- package/dist/prompts.js +120 -0
- package/dist/prompts.js.map +1 -0
- package/dist/templates/env.d.ts +3 -0
- package/dist/templates/env.d.ts.map +1 -0
- package/dist/templates/env.js +30 -0
- package/dist/templates/env.js.map +1 -0
- package/dist/templates/generator.d.ts +3 -0
- package/dist/templates/generator.d.ts.map +1 -0
- package/dist/templates/generator.js +122 -0
- package/dist/templates/generator.js.map +1 -0
- package/dist/templates/gitignore.d.ts +3 -0
- package/dist/templates/gitignore.d.ts.map +1 -0
- package/dist/templates/gitignore.js +36 -0
- package/dist/templates/gitignore.js.map +1 -0
- package/dist/templates/main.d.ts +3 -0
- package/dist/templates/main.d.ts.map +1 -0
- package/dist/templates/main.js +146 -0
- package/dist/templates/main.js.map +1 -0
- package/dist/templates/package-json.d.ts +3 -0
- package/dist/templates/package-json.d.ts.map +1 -0
- package/dist/templates/package-json.js +48 -0
- package/dist/templates/package-json.js.map +1 -0
- package/dist/templates/prisma.d.ts +3 -0
- package/dist/templates/prisma.d.ts.map +1 -0
- package/dist/templates/prisma.js +38 -0
- package/dist/templates/prisma.js.map +1 -0
- package/dist/templates/readme.d.ts +3 -0
- package/dist/templates/readme.d.ts.map +1 -0
- package/dist/templates/readme.js +71 -0
- package/dist/templates/readme.js.map +1 -0
- package/dist/templates/tsconfig.d.ts +3 -0
- package/dist/templates/tsconfig.d.ts.map +1 -0
- package/dist/templates/tsconfig.js +23 -0
- package/dist/templates/tsconfig.js.map +1 -0
- package/dist/types.d.ts +16 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +82 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 AI Agent Team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# @ai-agent/cli
|
|
2
|
+
|
|
3
|
+
CLI tool for scaffolding AI Agent projects with the [@ai-agent/core](https://github.com/ai-agent-framework/core) framework.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @ai-agent/cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or use directly with npx:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx @ai-agent/cli my-agent-project
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
### Interactive Mode
|
|
20
|
+
|
|
21
|
+
Run the CLI without arguments for an interactive setup:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
create-ai-agent
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
You'll be prompted to choose:
|
|
28
|
+
- Project name
|
|
29
|
+
- Template type (chatbot, Q&A bot, task automation)
|
|
30
|
+
- Storage backend (Prisma, in-memory)
|
|
31
|
+
- LLM provider (OpenAI, Anthropic, custom)
|
|
32
|
+
|
|
33
|
+
### Command Line Options
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
create-ai-agent [project-name] [options]
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**Options:**
|
|
40
|
+
|
|
41
|
+
- `-t, --template <template>` - Template to use
|
|
42
|
+
- `chatbot-prisma` - Chatbot with Prisma database storage
|
|
43
|
+
- `chatbot-memory` - Chatbot with in-memory storage
|
|
44
|
+
- `qa-bot` - Q&A bot with knowledge base
|
|
45
|
+
- `task-automation` - Task automation with custom tools
|
|
46
|
+
|
|
47
|
+
- `-s, --storage <storage>` - Storage backend
|
|
48
|
+
- `prisma` - Prisma ORM (PostgreSQL/MySQL/SQLite)
|
|
49
|
+
- `memory` - In-memory storage (development)
|
|
50
|
+
|
|
51
|
+
- `--skip-install` - Skip npm install
|
|
52
|
+
- `--skip-git` - Skip git initialization
|
|
53
|
+
|
|
54
|
+
**Examples:**
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# Create a chatbot with Prisma storage
|
|
58
|
+
create-ai-agent my-chatbot -t chatbot-prisma -s prisma
|
|
59
|
+
|
|
60
|
+
# Create a Q&A bot with in-memory storage
|
|
61
|
+
create-ai-agent my-qa-bot -t qa-bot -s memory
|
|
62
|
+
|
|
63
|
+
# Create a project without installing dependencies
|
|
64
|
+
create-ai-agent my-agent --skip-install
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Templates
|
|
68
|
+
|
|
69
|
+
### Chatbot with Prisma
|
|
70
|
+
|
|
71
|
+
Production-ready chatbot with database persistence using Prisma ORM.
|
|
72
|
+
|
|
73
|
+
**Features:**
|
|
74
|
+
- Conversation history stored in database
|
|
75
|
+
- Support for PostgreSQL, MySQL, or SQLite
|
|
76
|
+
- Session management
|
|
77
|
+
- Ready for production deployment
|
|
78
|
+
|
|
79
|
+
### Chatbot with Memory
|
|
80
|
+
|
|
81
|
+
Simple chatbot with in-memory storage for development and testing.
|
|
82
|
+
|
|
83
|
+
**Features:**
|
|
84
|
+
- Fast setup with no database required
|
|
85
|
+
- Perfect for development and prototyping
|
|
86
|
+
- Easy to understand code structure
|
|
87
|
+
|
|
88
|
+
### Q&A Bot
|
|
89
|
+
|
|
90
|
+
Knowledge base bot with RAG (Retrieval-Augmented Generation).
|
|
91
|
+
|
|
92
|
+
**Features:**
|
|
93
|
+
- Load documents from markdown files
|
|
94
|
+
- Semantic search over knowledge base
|
|
95
|
+
- Answer questions based on your documents
|
|
96
|
+
- Extensible knowledge management
|
|
97
|
+
|
|
98
|
+
### Task Automation
|
|
99
|
+
|
|
100
|
+
Agent with custom tools for task automation.
|
|
101
|
+
|
|
102
|
+
**Features:**
|
|
103
|
+
- Example calculator tool included
|
|
104
|
+
- Easy to add custom tools
|
|
105
|
+
- Tool calling and execution
|
|
106
|
+
- Workflow automation
|
|
107
|
+
|
|
108
|
+
## Project Structure
|
|
109
|
+
|
|
110
|
+
Generated projects follow this structure:
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
my-agent-project/
|
|
114
|
+
├── src/
|
|
115
|
+
│ ├── index.ts # Main application entry
|
|
116
|
+
│ └── tools/ # Custom tools (task-automation)
|
|
117
|
+
├── prisma/ # Database schema (Prisma projects)
|
|
118
|
+
│ └── schema.prisma
|
|
119
|
+
├── knowledge/ # Knowledge base (Q&A bot)
|
|
120
|
+
│ └── example.md
|
|
121
|
+
├── .env.example # Environment variables template
|
|
122
|
+
├── .gitignore
|
|
123
|
+
├── package.json
|
|
124
|
+
├── tsconfig.json
|
|
125
|
+
└── README.md
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## After Creation
|
|
129
|
+
|
|
130
|
+
1. **Configure environment variables:**
|
|
131
|
+
```bash
|
|
132
|
+
cd my-agent-project
|
|
133
|
+
cp .env.example .env
|
|
134
|
+
# Edit .env and add your API keys
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
2. **Set up database (Prisma projects only):**
|
|
138
|
+
```bash
|
|
139
|
+
npm run db:migrate
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
3. **Run the project:**
|
|
143
|
+
```bash
|
|
144
|
+
npm run dev
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Requirements
|
|
148
|
+
|
|
149
|
+
- Node.js >= 18.0.0
|
|
150
|
+
- npm or pnpm
|
|
151
|
+
|
|
152
|
+
## Documentation
|
|
153
|
+
|
|
154
|
+
- [AI Agent Core Documentation](https://github.com/ai-agent-framework/core)
|
|
155
|
+
- [API Reference](https://github.com/ai-agent-framework/core/blob/main/docs/API.md)
|
|
156
|
+
- [Usage Guide](https://github.com/ai-agent-framework/core/blob/main/docs/USAGE_GUIDE.md)
|
|
157
|
+
|
|
158
|
+
## License
|
|
159
|
+
|
|
160
|
+
MIT
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface CreateOptions {
|
|
2
|
+
template?: string;
|
|
3
|
+
storage?: string;
|
|
4
|
+
skipInstall?: boolean;
|
|
5
|
+
skipGit?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function createProject(projectName?: string, options?: CreateOptions): Promise<void>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=create.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AASA,UAAU,aAAa;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wBAAsB,aAAa,CACjC,WAAW,CAAC,EAAE,MAAM,EACpB,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC,CAuFf"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { execSync } from 'child_process';
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
import ora from 'ora';
|
|
6
|
+
import { promptForConfig } from '../prompts.js';
|
|
7
|
+
import { generateTemplateFiles } from '../templates/generator.js';
|
|
8
|
+
export async function createProject(projectName, options = {}) {
|
|
9
|
+
console.log(chalk.bold.cyan('\n🤖 AI Agent Project Generator\n'));
|
|
10
|
+
try {
|
|
11
|
+
// Get configuration from prompts
|
|
12
|
+
const config = await promptForConfig(projectName, options);
|
|
13
|
+
// Validate project directory
|
|
14
|
+
const projectPath = path.join(process.cwd(), config.projectName);
|
|
15
|
+
if (await fs.pathExists(projectPath)) {
|
|
16
|
+
console.error(chalk.red(`\n❌ Directory "${config.projectName}" already exists!\n`));
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
19
|
+
// Create project directory
|
|
20
|
+
const spinner = ora('Creating project directory...').start();
|
|
21
|
+
await fs.ensureDir(projectPath);
|
|
22
|
+
spinner.succeed('Project directory created');
|
|
23
|
+
// Generate and write template files
|
|
24
|
+
spinner.start('Generating project files...');
|
|
25
|
+
const files = generateTemplateFiles(config);
|
|
26
|
+
for (const file of files) {
|
|
27
|
+
const filePath = path.join(projectPath, file.path);
|
|
28
|
+
await fs.ensureDir(path.dirname(filePath));
|
|
29
|
+
await fs.writeFile(filePath, file.content, 'utf-8');
|
|
30
|
+
}
|
|
31
|
+
spinner.succeed('Project files generated');
|
|
32
|
+
// Initialize git
|
|
33
|
+
if (!config.skipGit) {
|
|
34
|
+
spinner.start('Initializing git repository...');
|
|
35
|
+
try {
|
|
36
|
+
execSync('git init', { cwd: projectPath, stdio: 'ignore' });
|
|
37
|
+
execSync('git add .', { cwd: projectPath, stdio: 'ignore' });
|
|
38
|
+
execSync('git commit -m "Initial commit from @ai-agent/cli"', {
|
|
39
|
+
cwd: projectPath,
|
|
40
|
+
stdio: 'ignore',
|
|
41
|
+
});
|
|
42
|
+
spinner.succeed('Git repository initialized');
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
spinner.warn('Git initialization skipped (git not available)');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// Install dependencies
|
|
49
|
+
if (!config.skipInstall) {
|
|
50
|
+
spinner.start('Installing dependencies (this may take a while)...');
|
|
51
|
+
try {
|
|
52
|
+
execSync('npm install', { cwd: projectPath, stdio: 'ignore' });
|
|
53
|
+
spinner.succeed('Dependencies installed');
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
spinner.fail('Failed to install dependencies');
|
|
57
|
+
console.error(chalk.yellow('\nYou can install them manually by running:'));
|
|
58
|
+
console.error(chalk.cyan(` cd ${config.projectName}`));
|
|
59
|
+
console.error(chalk.cyan(' npm install\n'));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
// Print success message
|
|
63
|
+
console.log(chalk.bold.green('\n✅ Project created successfully!\n'));
|
|
64
|
+
console.log(chalk.bold('Next steps:\n'));
|
|
65
|
+
console.log(chalk.cyan(` cd ${config.projectName}`));
|
|
66
|
+
if (config.skipInstall) {
|
|
67
|
+
console.log(chalk.cyan(' npm install'));
|
|
68
|
+
}
|
|
69
|
+
console.log(chalk.cyan(' cp .env.example .env'));
|
|
70
|
+
console.log(chalk.yellow(' # Edit .env and add your API keys'));
|
|
71
|
+
if (config.storage === 'prisma') {
|
|
72
|
+
console.log(chalk.cyan(' npm run db:migrate'));
|
|
73
|
+
}
|
|
74
|
+
console.log(chalk.cyan(' npm run dev'));
|
|
75
|
+
console.log(chalk.bold('\n📚 Documentation:\n'));
|
|
76
|
+
console.log(' https://github.com/ai-agent-framework/core\n');
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
console.error(chalk.red('\n❌ Error creating project:\n'));
|
|
80
|
+
console.error(error);
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAUlE,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,WAAoB,EACpB,UAAyB,EAAE;IAE3B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC,CAAC;IAElE,IAAI,CAAC;QACH,iCAAiC;QACjC,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,WAAW,EAAE,OAAiC,CAAC,CAAC;QAErF,6BAA6B;QAC7B,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;QAEjE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AC;QAEtD,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;YACvB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC;QAC3C,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC,CAAC;QAClD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,qCAAqC,CAAC,CAAC,CAAC;QAEjE,IAAI,MAAM,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;YAChC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC;QAClD,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC;QAEzC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC,CAAC;QACjD,OAAO,CAAC,GAAG,CAAC,gDAAgD,CAAC,CAAC;IAChE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC,CAAC;QAC1D,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { createProject } from './commands/create.js';
|
|
4
|
+
const program = new Command();
|
|
5
|
+
program
|
|
6
|
+
.name('create-ai-agent')
|
|
7
|
+
.description('CLI tool for scaffolding AI Agent projects')
|
|
8
|
+
.version('1.0.0');
|
|
9
|
+
program
|
|
10
|
+
.argument('[project-name]', 'Name of the project to create')
|
|
11
|
+
.option('-t, --template <template>', 'Template to use (chatbot-prisma, chatbot-memory, qa-bot, task-automation)')
|
|
12
|
+
.option('-s, --storage <storage>', 'Storage backend (prisma, memory, mongodb, redis)')
|
|
13
|
+
.option('--skip-install', 'Skip npm install')
|
|
14
|
+
.option('--skip-git', 'Skip git initialization')
|
|
15
|
+
.action(createProject);
|
|
16
|
+
program.parse();
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,iBAAiB,CAAC;KACvB,WAAW,CAAC,4CAA4C,CAAC;KACzD,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,OAAO;KACJ,QAAQ,CAAC,gBAAgB,EAAE,+BAA+B,CAAC;KAC3D,MAAM,CACL,2BAA2B,EAC3B,2EAA2E,CAC5E;KACA,MAAM,CAAC,yBAAyB,EAAE,kDAAkD,CAAC;KACrF,MAAM,CAAC,gBAAgB,EAAE,kBAAkB,CAAC;KAC5C,MAAM,CAAC,YAAY,EAAE,yBAAyB,CAAC;KAC/C,MAAM,CAAC,aAAa,CAAC,CAAC;AAEzB,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAA0C,MAAM,YAAY,CAAC;AAExF,wBAAsB,eAAe,CACnC,WAAW,CAAC,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAC/B,OAAO,CAAC,aAAa,CAAC,CAqHxB"}
|
package/dist/prompts.js
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import inquirer from 'inquirer';
|
|
2
|
+
export async function promptForConfig(projectName, options) {
|
|
3
|
+
const answers = await inquirer.prompt([
|
|
4
|
+
{
|
|
5
|
+
type: 'input',
|
|
6
|
+
name: 'projectName',
|
|
7
|
+
message: 'What is your project name?',
|
|
8
|
+
default: projectName || 'my-ai-agent',
|
|
9
|
+
when: !projectName,
|
|
10
|
+
validate: (input) => {
|
|
11
|
+
if (!input || input.trim().length === 0) {
|
|
12
|
+
return 'Project name is required';
|
|
13
|
+
}
|
|
14
|
+
if (!/^[a-z0-9-_]+$/i.test(input)) {
|
|
15
|
+
return 'Project name can only contain letters, numbers, hyphens, and underscores';
|
|
16
|
+
}
|
|
17
|
+
return true;
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
type: 'list',
|
|
22
|
+
name: 'template',
|
|
23
|
+
message: 'Which template would you like to use?',
|
|
24
|
+
choices: [
|
|
25
|
+
{
|
|
26
|
+
name: 'Chatbot with Prisma (Production-ready with database)',
|
|
27
|
+
value: 'chatbot-prisma',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: 'Chatbot with Memory (Simple in-memory storage)',
|
|
31
|
+
value: 'chatbot-memory',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'Q&A Bot (Knowledge base with RAG)',
|
|
35
|
+
value: 'qa-bot',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: 'Task Automation (Custom tools and workflows)',
|
|
39
|
+
value: 'task-automation',
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
when: !options?.template,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
type: 'list',
|
|
46
|
+
name: 'storage',
|
|
47
|
+
message: 'Which storage backend would you like to use?',
|
|
48
|
+
choices: [
|
|
49
|
+
{
|
|
50
|
+
name: 'Prisma (PostgreSQL/MySQL/SQLite)',
|
|
51
|
+
value: 'prisma',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'Memory (In-memory, for development)',
|
|
55
|
+
value: 'memory',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: 'MongoDB (Coming soon)',
|
|
59
|
+
value: 'mongodb',
|
|
60
|
+
disabled: true,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: 'Redis (Coming soon)',
|
|
64
|
+
value: 'redis',
|
|
65
|
+
disabled: true,
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
when: (answers) => {
|
|
69
|
+
if (options?.storage)
|
|
70
|
+
return false;
|
|
71
|
+
const template = options?.template || answers.template;
|
|
72
|
+
return template !== 'qa-bot' && template !== 'task-automation';
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
type: 'list',
|
|
77
|
+
name: 'llmProvider',
|
|
78
|
+
message: 'Which LLM provider would you like to use?',
|
|
79
|
+
choices: [
|
|
80
|
+
{
|
|
81
|
+
name: 'OpenAI (GPT-4, GPT-3.5)',
|
|
82
|
+
value: 'openai',
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: 'Anthropic (Claude)',
|
|
86
|
+
value: 'anthropic',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: 'Custom (I will configure my own)',
|
|
90
|
+
value: 'custom',
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
when: !options?.llmProvider,
|
|
94
|
+
},
|
|
95
|
+
]);
|
|
96
|
+
// Set defaults based on template
|
|
97
|
+
const template = (options?.template || answers.template);
|
|
98
|
+
let storage = (options?.storage || answers.storage);
|
|
99
|
+
// Default storage based on template
|
|
100
|
+
if (!storage) {
|
|
101
|
+
if (template === 'chatbot-prisma') {
|
|
102
|
+
storage = 'prisma';
|
|
103
|
+
}
|
|
104
|
+
else if (template === 'chatbot-memory') {
|
|
105
|
+
storage = 'memory';
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
storage = 'memory'; // Default for qa-bot and task-automation
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
projectName: (projectName || answers.projectName),
|
|
113
|
+
template,
|
|
114
|
+
storage,
|
|
115
|
+
llmProvider: (options?.llmProvider || answers.llmProvider),
|
|
116
|
+
skipInstall: options?.skipInstall || false,
|
|
117
|
+
skipGit: options?.skipGit || false,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAGhC,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,WAAoB,EACpB,OAAgC;IAEhC,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAyB;QAC5D;YACE,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,aAAa;YACnB,OAAO,EAAE,4BAA4B;YACrC,OAAO,EAAE,WAAW,IAAI,aAAa;YACrC,IAAI,EAAE,CAAC,WAAW;YAClB,QAAQ,EAAE,CAAC,KAAa,EAAE,EAAE;gBAC1B,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;oBACxC,OAAO,0BAA0B,CAAC;gBACpC,CAAC;gBACD,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;oBAClC,OAAO,0EAA0E,CAAC;gBACpF,CAAC;gBACD,OAAO,IAAI,CAAC;YACd,CAAC;SACF;QACD;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,UAAU;YAChB,O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(config) {
|
|
2
|
+
const lines = ['# LLM Provider Configuration'];
|
|
3
|
+
if (config.llmProvider === 'openai') {
|
|
4
|
+
lines.push('OPENAI_API_KEY=your-openai-api-key-here');
|
|
5
|
+
lines.push('# OPENAI_MODEL=gpt-4');
|
|
6
|
+
}
|
|
7
|
+
else if (config.llmProvider === 'anthropic') {
|
|
8
|
+
lines.push('ANTHROPIC_API_KEY=your-anthropic-api-key-here');
|
|
9
|
+
lines.push('# ANTHROPIC_MODEL=claude-3-5-sonnet-20241022');
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
lines.push('# Configure your custom LLM provider here');
|
|
13
|
+
lines.push('LLM_API_KEY=your-api-key-here');
|
|
14
|
+
lines.push('LLM_BASE_URL=https://api.example.com');
|
|
15
|
+
}
|
|
16
|
+
lines.push('');
|
|
17
|
+
if (config.storage === 'prisma') {
|
|
18
|
+
lines.push('# Database Configuration');
|
|
19
|
+
lines.push('# For SQLite (development)');
|
|
20
|
+
lines.push('DATABASE_URL="file:./dev.db"');
|
|
21
|
+
lines.push('');
|
|
22
|
+
lines.push('# For PostgreSQL (production)');
|
|
23
|
+
lines.push('# DATABASE_URL="postgresql://user:password@localhost:5432/mydb"');
|
|
24
|
+
lines.push('');
|
|
25
|
+
lines.push('# For MySQL (production)');
|
|
26
|
+
lines.push('# DATABASE_URL="mysql://user:password@localhost:3306/mydb"');
|
|
27
|
+
}
|
|
28
|
+
return lines.join('\n');
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/templates/env.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,eAAe,CAAC,MAAqB;IACnD,MAAM,KAAK,GAAa,CAAC,8BAA8B,CAAC,CAAC;IAEzD,IAAI,MAAM,CAAC,WAAW,KAAK,QAAQ,EAAE,CAAC;QACpC,KAAK,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAA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qBAAqB,CAAC,MAAM,EAAE,aAAa,GAAG,YAAY,EAAE,CAyD3E"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { generatePackageJson } from './package-json.js';
|
|
2
|
+
import { generateTsConfig } from './tsconfig.js';
|
|
3
|
+
import { generateEnvFile } from './env.js';
|
|
4
|
+
import { generateReadme } from './readme.js';
|
|
5
|
+
import { generateGitignore } from './gitignore.js';
|
|
6
|
+
import { generateMainFile } from './main.js';
|
|
7
|
+
import { generatePrismaSchema } from './prisma.js';
|
|
8
|
+
export function generateTemplateFiles(config) {
|
|
9
|
+
const files = [];
|
|
10
|
+
// Core files
|
|
11
|
+
files.push({
|
|
12
|
+
path: 'package.json',
|
|
13
|
+
content: generatePackageJson(config),
|
|
14
|
+
});
|
|
15
|
+
files.push({
|
|
16
|
+
path: 'tsconfig.json',
|
|
17
|
+
content: generateTsConfig(config),
|
|
18
|
+
});
|
|
19
|
+
files.push({
|
|
20
|
+
path: '.env.example',
|
|
21
|
+
content: generateEnvFile(config),
|
|
22
|
+
});
|
|
23
|
+
files.push({
|
|
24
|
+
path: 'README.md',
|
|
25
|
+
content: generateReadme(config),
|
|
26
|
+
});
|
|
27
|
+
files.push({
|
|
28
|
+
path: '.gitignore',
|
|
29
|
+
content: generateGitignore(config),
|
|
30
|
+
});
|
|
31
|
+
files.push({
|
|
32
|
+
path: 'src/index.ts',
|
|
33
|
+
content: generateMainFile(config),
|
|
34
|
+
});
|
|
35
|
+
// Template-specific files
|
|
36
|
+
if (config.template === 'chatbot-prisma' || config.storage === 'prisma') {
|
|
37
|
+
files.push({
|
|
38
|
+
path: 'prisma/schema.prisma',
|
|
39
|
+
content: generatePrismaSchema(config),
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
if (config.template === 'qa-bot') {
|
|
43
|
+
files.push({
|
|
44
|
+
path: 'knowledge/example.md',
|
|
45
|
+
content: generateExampleKnowledge(),
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
if (config.template === 'task-automation') {
|
|
49
|
+
files.push({
|
|
50
|
+
path: 'src/tools/calculator.ts',
|
|
51
|
+
content: generateCalculatorTool(),
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
return files;
|
|
55
|
+
}
|
|
56
|
+
function generateExampleKnowledge() {
|
|
57
|
+
return `# Example Knowledge Document
|
|
58
|
+
|
|
59
|
+
This is an example knowledge document for your AI agent.
|
|
60
|
+
|
|
61
|
+
## Features
|
|
62
|
+
|
|
63
|
+
The AI Agent framework provides:
|
|
64
|
+
- Stateless architecture for scalability
|
|
65
|
+
- Pluggable storage backends
|
|
66
|
+
- RAG (Retrieval-Augmented Generation)
|
|
67
|
+
- Custom tool support
|
|
68
|
+
- Multiple LLM providers
|
|
69
|
+
|
|
70
|
+
## Usage
|
|
71
|
+
|
|
72
|
+
Add your own markdown files to this directory, and the agent will automatically load them into the knowledge base.
|
|
73
|
+
`;
|
|
74
|
+
}
|
|
75
|
+
function generateCalculatorTool() {
|
|
76
|
+
return `import type { Tool } from '@agenticc/core';
|
|
77
|
+
|
|
78
|
+
export const calculatorTool: Tool = {
|
|
79
|
+
name: 'calculator',
|
|
80
|
+
description: 'Perform basic arithmetic operations',
|
|
81
|
+
parameters: {
|
|
82
|
+
type: 'object',
|
|
83
|
+
properties: {
|
|
84
|
+
operation: {
|
|
85
|
+
type: 'string',
|
|
86
|
+
enum: ['add', 'subtract', 'multiply', 'divide'],
|
|
87
|
+
description: 'The arithmetic operation to perform',
|
|
88
|
+
},
|
|
89
|
+
a: {
|
|
90
|
+
type: 'number',
|
|
91
|
+
description: 'First number',
|
|
92
|
+
},
|
|
93
|
+
b: {
|
|
94
|
+
type: 'number',
|
|
95
|
+
description: 'Second number',
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
required: ['operation', 'a', 'b'],
|
|
99
|
+
},
|
|
100
|
+
execute: async (params: { operation: string; a: number; b: number }) => {
|
|
101
|
+
const { operation, a, b } = params;
|
|
102
|
+
|
|
103
|
+
switch (operation) {
|
|
104
|
+
case 'add':
|
|
105
|
+
return { result: a + b };
|
|
106
|
+
case 'subtract':
|
|
107
|
+
return { result: a - b };
|
|
108
|
+
case 'multiply':
|
|
109
|
+
return { result: a * b };
|
|
110
|
+
case 'divide':
|
|
111
|
+
if (b === 0) {
|
|
112
|
+
throw new Error('Cannot divide by zero');
|
|
113
|
+
}
|
|
114
|
+
return { result: a / b };
|
|
115
|
+
default:
|
|
116
|
+
throw new Error(\`Unknown operation: \${operation}\`);
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
`;
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../src/templates/generator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,MAAM,UAAU,qBAAqB,CAAC,MAAqB;IACzD,MAAM,KAAK,GAAmB,EAAE,CAAC;IAEjC,aAAa;IACb,KAAK,CAAC,IAAI,CAAC;QACT,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE,mBAAmB,CAAC,MAAM,CAAC;KACrC,CAAC,CAAC;IAEH,KAAK,CAAC,IAAI,CAAC;QACT,IAAI,EAAE,eAAe;QACrB,OAAO,EAAE,gBAAgB,CAAC,MAAM,CAAC;KAClC,CAAC,CAAC;IAEH,KAAK,CAAC,IAAI,CAAC;QACT,IA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
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitignore.d.ts","sourceRoot":"","sources":["../../src/templates/gitignore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CAoC/D"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export function generateGitignore(config) {
|
|
2
|
+
const lines = [
|
|
3
|
+
'# Dependencies',
|
|
4
|
+
'node_modules/',
|
|
5
|
+
'',
|
|
6
|
+
'# Build output',
|
|
7
|
+
'dist/',
|
|
8
|
+
'*.tsbuildinfo',
|
|
9
|
+
'',
|
|
10
|
+
'# Environment variables',
|
|
11
|
+
'.env',
|
|
12
|
+
'.env.local',
|
|
13
|
+
'',
|
|
14
|
+
'# IDE',
|
|
15
|
+
'.vscode/',
|
|
16
|
+
'.idea/',
|
|
17
|
+
'*.swp',
|
|
18
|
+
'*.swo',
|
|
19
|
+
'',
|
|
20
|
+
'# OS',
|
|
21
|
+
'.DS_Store',
|
|
22
|
+
'Thumbs.db',
|
|
23
|
+
'',
|
|
24
|
+
'# Logs',
|
|
25
|
+
'*.log',
|
|
26
|
+
'logs/',
|
|
27
|
+
];
|
|
28
|
+
if (config.storage === 'prisma') {
|
|
29
|
+
lines.push('');
|
|
30
|
+
lines.push('# Database');
|
|
31
|
+
lines.push('*.db');
|
|
32
|
+
lines.push('*.db-journal');
|
|
33
|
+
}
|
|
34
|
+
return lines.join('\n');
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=gitignore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitignore.js","sourceRoot":"","sources":["../../src/templates/gitignore.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,iBAAiB,CAAC,MAAqB;IACrD,MAAM,KAAK,GAAG;QACZ,gBAAgB;QAChB,eAAe;QACf,EAAE;QACF,gBAAgB;QAChB,OAAO;QACP,eAAe;QACf,EAAE;QACF,yBAAyB;QACzB,MAAM;QACN,YAAY;QACZ,EAAE;QACF,OAAO;QACP,UAAU;QACV,QAAQ;QACR,OAAO;QACP,OAAO;QACP,EAAE;QACF,MAAM;QACN,WAAW;QACX,WAAW;QACX,EAAE;QACF,QAAQ;QACR,OAAO;QACP,OAAO;KACR,CAAC;IAEF,IAAI,MAAM,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACzB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnB,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC7B,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/templates/main.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CAuJ9D"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
export function generateMainFile(config) {
|
|
2
|
+
const lines = ["import 'dotenv/config';", "import { Agent } from '@agenticc/core';"];
|
|
3
|
+
// Import storage
|
|
4
|
+
if (config.storage === 'prisma') {
|
|
5
|
+
lines.push("import { PrismaClient } from '@prisma/client';");
|
|
6
|
+
lines.push("import { PrismaStorage } from '@agenticc/storage-prisma';");
|
|
7
|
+
}
|
|
8
|
+
else if (config.storage === 'memory') {
|
|
9
|
+
lines.push("import { MemoryStorage } from '@agenticc/storage-memory';");
|
|
10
|
+
}
|
|
11
|
+
// Import tools for task automation
|
|
12
|
+
if (config.template === 'task-automation') {
|
|
13
|
+
lines.push("import { calculatorTool } from './tools/calculator.js';");
|
|
14
|
+
}
|
|
15
|
+
lines.push('');
|
|
16
|
+
lines.push('async function main() {');
|
|
17
|
+
// Initialize storage
|
|
18
|
+
if (config.storage === 'prisma') {
|
|
19
|
+
lines.push(' // Initialize Prisma storage');
|
|
20
|
+
lines.push(' const prisma = new PrismaClient();');
|
|
21
|
+
lines.push(' const storage = new PrismaStorage(prisma);');
|
|
22
|
+
lines.push('');
|
|
23
|
+
}
|
|
24
|
+
else if (config.storage === 'memory') {
|
|
25
|
+
lines.push(' // Initialize in-memory storage');
|
|
26
|
+
lines.push(' const storage = new MemoryStorage();');
|
|
27
|
+
lines.push('');
|
|
28
|
+
}
|
|
29
|
+
// Initialize agent
|
|
30
|
+
lines.push(' // Initialize agent');
|
|
31
|
+
lines.push(' const agent = new Agent({');
|
|
32
|
+
lines.push(' llm: {');
|
|
33
|
+
if (config.llmProvider === 'openai') {
|
|
34
|
+
lines.push(" provider: 'openai',");
|
|
35
|
+
lines.push(' apiKey: process.env.OPENAI_API_KEY!,');
|
|
36
|
+
lines.push(" model: process.env.OPENAI_MODEL || 'gpt-4',");
|
|
37
|
+
}
|
|
38
|
+
else if (config.llmProvider === 'anthropic') {
|
|
39
|
+
lines.push(" provider: 'anthropic',");
|
|
40
|
+
lines.push(' apiKey: process.env.ANTHROPIC_API_KEY!,');
|
|
41
|
+
lines.push(" model: process.env.ANTHROPIC_MODEL || 'claude-3-5-sonnet-20241022',");
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
lines.push(" provider: 'custom',");
|
|
45
|
+
lines.push(' apiKey: process.env.LLM_API_KEY!,');
|
|
46
|
+
lines.push(' baseURL: process.env.LLM_BASE_URL,');
|
|
47
|
+
}
|
|
48
|
+
lines.push(' },');
|
|
49
|
+
lines.push(' });');
|
|
50
|
+
lines.push('');
|
|
51
|
+
// Add tools for task automation
|
|
52
|
+
if (config.template === 'task-automation') {
|
|
53
|
+
lines.push(' // Register custom tools');
|
|
54
|
+
lines.push(' await agent.loadPlugin({');
|
|
55
|
+
lines.push(" name: 'calculator-plugin',");
|
|
56
|
+
lines.push(' tools: [calculatorTool],');
|
|
57
|
+
lines.push(' initialize: async () => {');
|
|
58
|
+
lines.push(" console.log('Calculator plugin loaded');");
|
|
59
|
+
lines.push(' },');
|
|
60
|
+
lines.push(' });');
|
|
61
|
+
lines.push('');
|
|
62
|
+
}
|
|
63
|
+
// Add knowledge for qa-bot
|
|
64
|
+
if (config.template === 'qa-bot') {
|
|
65
|
+
lines.push(' // Load knowledge base');
|
|
66
|
+
lines.push(" const fs = await import('fs/promises');");
|
|
67
|
+
lines.push(" const path = await import('path');");
|
|
68
|
+
lines.push(" const knowledgeDir = path.join(process.cwd(), 'knowledge');");
|
|
69
|
+
lines.push(' const files = await fs.readdir(knowledgeDir);');
|
|
70
|
+
lines.push(' ');
|
|
71
|
+
lines.push(' for (const file of files) {');
|
|
72
|
+
lines.push(" if (file.endsWith('.md')) {");
|
|
73
|
+
lines.push(" const content = await fs.readFile(path.join(knowledgeDir, file), 'utf-8');");
|
|
74
|
+
lines.push(" await agent.addKnowledge(content, 'documentation', file);");
|
|
75
|
+
lines.push(' console.log(`Loaded knowledge: ${file}`);');
|
|
76
|
+
lines.push(' }');
|
|
77
|
+
lines.push(' }');
|
|
78
|
+
lines.push('');
|
|
79
|
+
}
|
|
80
|
+
// Main conversation loop
|
|
81
|
+
if (config.template === 'chatbot-prisma' || config.template === 'chatbot-memory') {
|
|
82
|
+
lines.push(' // Start conversation');
|
|
83
|
+
lines.push(" const sessionId = 'default-session';");
|
|
84
|
+
lines.push(" console.log('AI Agent ready! Type your message (or \\'exit\\' to quit)\\n');");
|
|
85
|
+
lines.push('');
|
|
86
|
+
lines.push(' // Simple REPL');
|
|
87
|
+
lines.push(" const readline = await import('readline');");
|
|
88
|
+
lines.push(' const rl = readline.createInterface({');
|
|
89
|
+
lines.push(' input: process.stdin,');
|
|
90
|
+
lines.push(' output: process.stdout,');
|
|
91
|
+
lines.push(' });');
|
|
92
|
+
lines.push('');
|
|
93
|
+
lines.push(' const askQuestion = () => {');
|
|
94
|
+
lines.push(" rl.question('You: ', async (input) => {");
|
|
95
|
+
lines.push(' const message = input.trim();');
|
|
96
|
+
lines.push('');
|
|
97
|
+
lines.push(" if (message.toLowerCase() === 'exit') {");
|
|
98
|
+
lines.push(' rl.close();');
|
|
99
|
+
lines.push(' process.exit(0);');
|
|
100
|
+
lines.push(' }');
|
|
101
|
+
lines.push('');
|
|
102
|
+
lines.push(' if (!message) {');
|
|
103
|
+
lines.push(' askQuestion();');
|
|
104
|
+
lines.push(' return;');
|
|
105
|
+
lines.push(' }');
|
|
106
|
+
lines.push('');
|
|
107
|
+
lines.push(' // Load conversation history');
|
|
108
|
+
lines.push(' const history = await storage.getHistory(sessionId);');
|
|
109
|
+
lines.push('');
|
|
110
|
+
lines.push(' // Get response from agent');
|
|
111
|
+
lines.push(' const response = await agent.chat(message, { sessionId, history });');
|
|
112
|
+
lines.push('');
|
|
113
|
+
lines.push(' console.log(`\\nAgent: ${response.content}\\n`);');
|
|
114
|
+
lines.push('');
|
|
115
|
+
lines.push(' // Save messages to storage');
|
|
116
|
+
lines.push(' await storage.saveMessage(sessionId, {');
|
|
117
|
+
lines.push(' id: crypto.randomUUID(),');
|
|
118
|
+
lines.push(" role: 'user',");
|
|
119
|
+
lines.push(' content: message,');
|
|
120
|
+
lines.push(' timestamp: new Date(),');
|
|
121
|
+
lines.push(' });');
|
|
122
|
+
lines.push('');
|
|
123
|
+
lines.push(' await storage.saveMessage(sessionId, {');
|
|
124
|
+
lines.push(' id: crypto.randomUUID(),');
|
|
125
|
+
lines.push(" role: 'assistant',");
|
|
126
|
+
lines.push(' content: response.content,');
|
|
127
|
+
lines.push(' timestamp: new Date(),');
|
|
128
|
+
lines.push(' });');
|
|
129
|
+
lines.push('');
|
|
130
|
+
lines.push(' askQuestion();');
|
|
131
|
+
lines.push(' });');
|
|
132
|
+
lines.push(' };');
|
|
133
|
+
lines.push('');
|
|
134
|
+
lines.push(' askQuestion();');
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
lines.push(' // Example usage');
|
|
138
|
+
lines.push(" const response = await agent.chat('Hello! What can you help me with?');");
|
|
139
|
+
lines.push(" console.log('Agent:', response.content);");
|
|
140
|
+
}
|
|
141
|
+
lines.push('}');
|
|
142
|
+
lines.push('');
|
|
143
|
+
lines.push('main().catch(console.error);');
|
|
144
|
+
return lines.join('\n');
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/templates/main.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,gBAAgB,CAAC,MAAqB;IACpD,MAAM,KAAK,GAAa,CAAC,yBAAyB,EAAE,yCAAyC,CAAC,CAAC;IAE/F,iBAAiB;IACjB,IAAI,MAAM,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,KAAK,CAAC,IAAI,CAAC,gDAAgD,CAAC,CAAC;QAC7D,KAAK,CAAC,IAAI,CAAC,2DAA2D,CAAC,CAAC;IAC1E,CAAC;SAAM,IAAI,MAAM,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QACvC,KAAK,CAAC,IAAI,CAAC,2DAA2D,CAAC,CAAC;IAC1E,CAAC;IAED,mCAAmC;IACnC,IAAI,MAAM,CAAC,QAAQ,KAAK,iBAAiB,EAAE,CAAC;QAC1C,KAAK,CAAC,IAAI,CAAC,yDAAyD,CAAC,CAAC;IACxE,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IAEtC,qBAAqB;IACrB,IAAI,MAAM,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,KAAK,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;QAC7C,KAAK,CAAC,IAAI,CAAC,sCAAsC,CAAC,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CAAoC,CAAC,CAAC;QACjD,KAAK,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;QAC7C,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACxB,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QACnC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACtB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnB,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IACjC,CAAC;SAAM,CAAC;QACN,KAAK,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QACjC,KAAK,CAAC,IAAI,CAAC,2EAA2E,CAAC,CAAC;QACxF,KAAK,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;IAC3D,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAChB,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;IAE3C,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-json.d.ts","sourceRoot":"","sources":["../../src/templates/package-json.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CAoDjE"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export function generatePackageJson(config) {
|
|
2
|
+
const dependencies = {
|
|
3
|
+
'@agenticc/core': '^1.0.0',
|
|
4
|
+
dotenv: '^16.0.0',
|
|
5
|
+
};
|
|
6
|
+
const devDependencies = {
|
|
7
|
+
'@types/node': '^22.0.0',
|
|
8
|
+
tsx: '^4.0.0',
|
|
9
|
+
typescript: '^5.0.0',
|
|
10
|
+
};
|
|
11
|
+
// Add storage dependencies
|
|
12
|
+
if (config.storage === 'prisma') {
|
|
13
|
+
dependencies['@ai-agent/storage-prisma'] = '^1.0.0';
|
|
14
|
+
dependencies['@prisma/client'] = '^5.0.0';
|
|
15
|
+
devDependencies['prisma'] = '^5.0.0';
|
|
16
|
+
}
|
|
17
|
+
else if (config.storage === 'memory') {
|
|
18
|
+
dependencies['@ai-agent/storage-memory'] = '^1.0.0';
|
|
19
|
+
}
|
|
20
|
+
// Add LLM provider dependencies (already included in @ai-agent/core)
|
|
21
|
+
// OpenAI and Anthropic SDKs are peer dependencies
|
|
22
|
+
const scripts = {
|
|
23
|
+
start: 'tsx src/index.ts',
|
|
24
|
+
dev: 'tsx watch src/index.ts',
|
|
25
|
+
build: 'tsc',
|
|
26
|
+
typecheck: 'tsc --noEmit',
|
|
27
|
+
};
|
|
28
|
+
if (config.storage === 'prisma') {
|
|
29
|
+
scripts['db:migrate'] = 'prisma migrate dev';
|
|
30
|
+
scripts['db:studio'] = 'prisma studio';
|
|
31
|
+
scripts['db:generate'] = 'prisma generate';
|
|
32
|
+
}
|
|
33
|
+
const pkg = {
|
|
34
|
+
name: config.projectName,
|
|
35
|
+
version: '1.0.0',
|
|
36
|
+
description: `AI Agent project created with @ai-agent/cli`,
|
|
37
|
+
type: 'module',
|
|
38
|
+
private: true,
|
|
39
|
+
scripts,
|
|
40
|
+
dependencies,
|
|
41
|
+
devDependencies,
|
|
42
|
+
engines: {
|
|
43
|
+
node: '>=18.0.0',
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
return JSON.stringify(pkg, null, 2);
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=package-json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-json.js","sourceRoot":"","sources":["../../src/templates/package-json.ts"],"names":[],"mappings":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AAC;IAEF,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prisma.d.ts","sourceRoot":"","sources":["../../src/templates/prisma.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAoCnE"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export function generatePrismaSchema(_config) {
|
|
2
|
+
return `// This is your Prisma schema file
|
|
3
|
+
// Learn more: https://pris.ly/d/prisma-schema
|
|
4
|
+
|
|
5
|
+
generator client {
|
|
6
|
+
provider = "prisma-client-js"
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
datasource db {
|
|
10
|
+
provider = "sqlite" // Change to "postgresql" or "mysql" for production
|
|
11
|
+
url = env("DATABASE_URL")
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
model Session {
|
|
15
|
+
id String @id @default(uuid())
|
|
16
|
+
messages Message[]
|
|
17
|
+
createdAt DateTime @default(now())
|
|
18
|
+
updatedAt DateTime @updatedAt
|
|
19
|
+
active Boolean @default(true)
|
|
20
|
+
metadata Json?
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
model Message {
|
|
24
|
+
id String @id @default(uuid())
|
|
25
|
+
sessionId String
|
|
26
|
+
session Session @relation(fields: [sessionId], references: [id], onDelete: Cascade)
|
|
27
|
+
role String // 'user' | 'assistant' | 'system'
|
|
28
|
+
content String
|
|
29
|
+
timestamp DateTime @default(now())
|
|
30
|
+
toolCalls Json?
|
|
31
|
+
metadata Json?
|
|
32
|
+
|
|
33
|
+
@@index([sessionId])
|
|
34
|
+
@@index([timestamp])
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=prisma.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prisma.js","sourceRoot":"","sources":["../../src/templates/prisma.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,oBAAoB,CAAC,OAAsB;IACzD,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCR,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readme.d.ts","sourceRoot":"","sources":["../../src/templates/readme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,wBAAgB,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CA4E5D"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export function generateReadme(config) {
|
|
2
|
+
const lines = [
|
|
3
|
+
`# ${config.projectName}`,
|
|
4
|
+
'',
|
|
5
|
+
`AI Agent project created with @ai-agent/cli`,
|
|
6
|
+
'',
|
|
7
|
+
'## Setup',
|
|
8
|
+
'',
|
|
9
|
+
'1. Install dependencies:',
|
|
10
|
+
'```bash',
|
|
11
|
+
'npm install',
|
|
12
|
+
'```',
|
|
13
|
+
'',
|
|
14
|
+
'2. Copy `.env.example` to `.env` and configure your API keys:',
|
|
15
|
+
'```bash',
|
|
16
|
+
'cp .env.example .env',
|
|
17
|
+
'```',
|
|
18
|
+
'',
|
|
19
|
+
];
|
|
20
|
+
if (config.storage === 'prisma') {
|
|
21
|
+
lines.push('3. Set up the database:');
|
|
22
|
+
lines.push('```bash');
|
|
23
|
+
lines.push('npm run db:migrate');
|
|
24
|
+
lines.push('```');
|
|
25
|
+
lines.push('');
|
|
26
|
+
}
|
|
27
|
+
lines.push('## Running');
|
|
28
|
+
lines.push('');
|
|
29
|
+
lines.push('Development mode with auto-reload:');
|
|
30
|
+
lines.push('```bash');
|
|
31
|
+
lines.push('npm run dev');
|
|
32
|
+
lines.push('```');
|
|
33
|
+
lines.push('');
|
|
34
|
+
lines.push('Production mode:');
|
|
35
|
+
lines.push('```bash');
|
|
36
|
+
lines.push('npm start');
|
|
37
|
+
lines.push('```');
|
|
38
|
+
lines.push('');
|
|
39
|
+
lines.push('## Project Structure');
|
|
40
|
+
lines.push('');
|
|
41
|
+
lines.push('```');
|
|
42
|
+
lines.push(`${config.projectName}/`);
|
|
43
|
+
lines.push('├── src/');
|
|
44
|
+
lines.push('│ └── index.ts # Main application entry point');
|
|
45
|
+
if (config.template === 'task-automation') {
|
|
46
|
+
lines.push('│ └── tools/ # Custom tool definitions');
|
|
47
|
+
}
|
|
48
|
+
if (config.storage === 'prisma') {
|
|
49
|
+
lines.push('├── prisma/');
|
|
50
|
+
lines.push('│ └── schema.prisma # Database schema');
|
|
51
|
+
}
|
|
52
|
+
if (config.template === 'qa-bot') {
|
|
53
|
+
lines.push('├── knowledge/ # Knowledge base documents');
|
|
54
|
+
}
|
|
55
|
+
lines.push('├── .env # Environment variables (create from .env.example)');
|
|
56
|
+
lines.push('├── package.json');
|
|
57
|
+
lines.push('└── tsconfig.json');
|
|
58
|
+
lines.push('```');
|
|
59
|
+
lines.push('');
|
|
60
|
+
lines.push('## Documentation');
|
|
61
|
+
lines.push('');
|
|
62
|
+
lines.push('- [@agenticc/core Documentation](https://github.com/Chajian/agentic)');
|
|
63
|
+
lines.push('- [API Reference](https://github.com/Chajian/agentic/blob/main/docs/API.md)');
|
|
64
|
+
lines.push('- [Usage Guide](https://github.com/Chajian/agentic/blob/main/docs/USAGE_GUIDE.md)');
|
|
65
|
+
lines.push('');
|
|
66
|
+
lines.push('## License');
|
|
67
|
+
lines.push('');
|
|
68
|
+
lines.push('MIT');
|
|
69
|
+
return lines.join('\n');
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=readme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readme.js","sourceRoot":"","sources":["../../src/templates/readme.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,cAAc,CAAC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CAAC;IACzB,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAElB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsconfig.d.ts","sourceRoot":"","sources":["../../src/templates/tsconfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAsB/D"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export function generateTsConfig(_config) {
|
|
2
|
+
const tsconfig = {
|
|
3
|
+
compilerOptions: {
|
|
4
|
+
target: 'ES2022',
|
|
5
|
+
module: 'ESNext',
|
|
6
|
+
lib: ['ES2022'],
|
|
7
|
+
moduleResolution: 'bundler',
|
|
8
|
+
resolveJsonModule: true,
|
|
9
|
+
allowJs: true,
|
|
10
|
+
outDir: './dist',
|
|
11
|
+
rootDir: './src',
|
|
12
|
+
esModuleInterop: true,
|
|
13
|
+
forceConsistentCasingInFileNames: true,
|
|
14
|
+
strict: true,
|
|
15
|
+
skipLibCheck: true,
|
|
16
|
+
allowSyntheticDefaultImports: true,
|
|
17
|
+
},
|
|
18
|
+
include: ['src/**/*'],
|
|
19
|
+
exclude: ['node_modules', 'dist'],
|
|
20
|
+
};
|
|
21
|
+
return JSON.stringify(tsconfig, null, 2);
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=tsconfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsconfig.js","sourceRoot":"","sources":["../../src/templates/tsconfig.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,gBAAgB,CAAC,OAAsB;IACrD,MAAM,QAAQ,GAAG;QACf,eAAe,EAAE;YACf,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE,QAAQ;YAChB,GAAG,EAAE,CAAC,QAAQ,CAAC;YACf,gBAAgB,EAAE,SAAS;YAC3B,iBAAiB,EAAE,IAAI;YACvB,OAAO,EAAE,IAAI;YACb,MAAM,EAAE,QAAQ;YAChB,OAAO,EAAE,OAAO;YAChB,eAAe,EAAE,IAAI;YACrB,gCAAgC,EAAE,IAAI;YACtC,MAAM,EAAE,IAAI;YACZ,YAAY,EAAE,IAAI;YAClB,4BAA4B,EAAE,IAAI;SACnC;QACD,OAAO,EAAE,CAAC,UAAU,CAAC;QACrB,OAAO,EAAE,CAAC,cAAc,EAAE,MAAM,CAAC;KAClC,CAAC;IAEF,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAC3C,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type TemplateType = 'chatbot-prisma' | 'chatbot-memory' | 'qa-bot' | 'task-automation';
|
|
2
|
+
export type StorageType = 'prisma' | 'memory' | 'mongodb' | 'redis';
|
|
3
|
+
export type LLMProvider = 'openai' | 'anthropic' | 'custom';
|
|
4
|
+
export interface ProjectConfig {
|
|
5
|
+
projectName: string;
|
|
6
|
+
template: TemplateType;
|
|
7
|
+
storage: StorageType;
|
|
8
|
+
llmProvider: LLMProvider;
|
|
9
|
+
skipInstall: boolean;
|
|
10
|
+
skipGit: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface TemplateFile {
|
|
13
|
+
path: string;
|
|
14
|
+
content: string;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,QAAQ,GAAG,iBAAiB,CAAC;AAC9F,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC;AACpE,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE5D,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,EAAE,WAAW,CAAC;IACrB,WAAW,EAAE,WAAW,CAAC;IACzB,WAAW,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agenticc/cli",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "CLI tool for scaffolding Agentic projects",
|
|
6
|
+
"bin": {
|
|
7
|
+
"create-agentic": "./dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public",
|
|
19
|
+
"registry": "https://registry.npmjs.org/"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist",
|
|
23
|
+
"templates",
|
|
24
|
+
"README.md",
|
|
25
|
+
"LICENSE"
|
|
26
|
+
],
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "https://github.com/Chajian/agentic.git"
|
|
30
|
+
},
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/Chajian/agentic/issues"
|
|
33
|
+
},
|
|
34
|
+
"homepage": "https://github.com/Chajian/agentic#readme",
|
|
35
|
+
"keywords": [
|
|
36
|
+
"ai",
|
|
37
|
+
"agent",
|
|
38
|
+
"cli",
|
|
39
|
+
"scaffolding",
|
|
40
|
+
"generator",
|
|
41
|
+
"create",
|
|
42
|
+
"template"
|
|
43
|
+
],
|
|
44
|
+
"author": "Chajian <xylyjy@gmail.com>",
|
|
45
|
+
"license": "MIT",
|
|
46
|
+
"scripts": {
|
|
47
|
+
"dev": "tsx watch --tsconfig ./tsconfig.json src/index.ts",
|
|
48
|
+
"build": "tsc && tsc-alias",
|
|
49
|
+
"start": "node dist/index.js",
|
|
50
|
+
"clean": "rimraf dist",
|
|
51
|
+
"typecheck": "tsc --noEmit",
|
|
52
|
+
"lint": "eslint .",
|
|
53
|
+
"lint:fix": "eslint . --fix",
|
|
54
|
+
"format": "prettier --write src/**/*.ts",
|
|
55
|
+
"format:check": "prettier --check src/**/*.ts",
|
|
56
|
+
"test": "vitest --run",
|
|
57
|
+
"test:coverage": "vitest --run --coverage",
|
|
58
|
+
"test:watch": "vitest",
|
|
59
|
+
"prepublishOnly": "npm run clean && npm run build && npm run typecheck"
|
|
60
|
+
},
|
|
61
|
+
"dependencies": {
|
|
62
|
+
"chalk": "^5.3.0",
|
|
63
|
+
"commander": "^12.0.0",
|
|
64
|
+
"fs-extra": "^11.2.0",
|
|
65
|
+
"inquirer": "^9.2.0",
|
|
66
|
+
"ora": "^8.0.0"
|
|
67
|
+
},
|
|
68
|
+
"devDependencies": {
|
|
69
|
+
"@types/fs-extra": "^11.0.0",
|
|
70
|
+
"@types/inquirer": "^9.0.0",
|
|
71
|
+
"@types/node": "^22.10.2",
|
|
72
|
+
"@vitest/coverage-v8": "^2.1.9",
|
|
73
|
+
"rimraf": "^6.0.1",
|
|
74
|
+
"tsc-alias": "^1.8.10",
|
|
75
|
+
"tsx": "^4.19.2",
|
|
76
|
+
"typescript": "^5.7.2",
|
|
77
|
+
"vitest": "^2.1.8"
|
|
78
|
+
},
|
|
79
|
+
"engines": {
|
|
80
|
+
"node": ">=18.0.0"
|
|
81
|
+
}
|
|
82
|
+
}
|