@inkeep/create-agents 0.2.2 → 0.3.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/dist/__tests__/utils.test.js +16 -12
- package/dist/templates.js +3 -5
- package/dist/utils.js +10 -8
- package/package.json +1 -1
|
@@ -49,7 +49,7 @@ describe('createAgents - Template and Project ID Logic', () => {
|
|
|
49
49
|
vi.mocked(fs.remove).mockResolvedValue(undefined);
|
|
50
50
|
// Mock templates
|
|
51
51
|
vi.mocked(getAvailableTemplates).mockResolvedValue([
|
|
52
|
-
'weather-
|
|
52
|
+
'weather-project',
|
|
53
53
|
'chatbot',
|
|
54
54
|
'data-analysis',
|
|
55
55
|
]);
|
|
@@ -72,27 +72,27 @@ describe('createAgents - Template and Project ID Logic', () => {
|
|
|
72
72
|
processChdirSpy.mockRestore();
|
|
73
73
|
});
|
|
74
74
|
describe('Default behavior (no template or customProjectId)', () => {
|
|
75
|
-
it('should use weather-
|
|
75
|
+
it('should use weather-project as default template and project ID', async () => {
|
|
76
76
|
await createAgents({
|
|
77
77
|
dirName: 'test-dir',
|
|
78
78
|
openAiKey: 'test-openai-key',
|
|
79
79
|
anthropicKey: 'test-anthropic-key',
|
|
80
80
|
});
|
|
81
|
-
// Should clone base template and weather-
|
|
81
|
+
// Should clone base template and weather-project template
|
|
82
82
|
expect(cloneTemplate).toHaveBeenCalledTimes(2);
|
|
83
83
|
expect(cloneTemplate).toHaveBeenCalledWith('https://github.com/inkeep/create-agents-template', expect.any(String));
|
|
84
|
-
expect(cloneTemplate).toHaveBeenCalledWith('https://github.com/inkeep/agents-cookbook/
|
|
84
|
+
expect(cloneTemplate).toHaveBeenCalledWith('https://github.com/inkeep/agents-cookbook/template-projects/weather-project', 'src/weather-project');
|
|
85
85
|
// Should not call getAvailableTemplates since no template validation needed
|
|
86
86
|
expect(getAvailableTemplates).not.toHaveBeenCalled();
|
|
87
87
|
});
|
|
88
|
-
it('should create project with weather-
|
|
88
|
+
it('should create project with weather-project as project ID', async () => {
|
|
89
89
|
await createAgents({
|
|
90
90
|
dirName: 'test-dir',
|
|
91
91
|
openAiKey: 'test-openai-key',
|
|
92
92
|
anthropicKey: 'test-anthropic-key',
|
|
93
93
|
});
|
|
94
94
|
// Check that inkeep.config.ts is created with correct project ID
|
|
95
|
-
expect(fs.writeFile).toHaveBeenCalledWith('src/weather-
|
|
95
|
+
expect(fs.writeFile).toHaveBeenCalledWith('src/weather-project/inkeep.config.ts', expect.stringContaining('projectId: "weather-project"'));
|
|
96
96
|
});
|
|
97
97
|
});
|
|
98
98
|
describe('Template provided', () => {
|
|
@@ -108,11 +108,11 @@ describe('createAgents - Template and Project ID Logic', () => {
|
|
|
108
108
|
// Should clone base template and the specified template
|
|
109
109
|
expect(cloneTemplate).toHaveBeenCalledTimes(2);
|
|
110
110
|
expect(cloneTemplate).toHaveBeenCalledWith('https://github.com/inkeep/create-agents-template', expect.any(String));
|
|
111
|
-
expect(cloneTemplate).toHaveBeenCalledWith('https://github.com/inkeep/agents-cookbook/
|
|
111
|
+
expect(cloneTemplate).toHaveBeenCalledWith('https://github.com/inkeep/agents-cookbook/template-projects/chatbot', 'src/chatbot');
|
|
112
112
|
expect(fs.writeFile).toHaveBeenCalledWith('src/chatbot/inkeep.config.ts', expect.stringContaining('projectId: "chatbot"'));
|
|
113
113
|
});
|
|
114
114
|
it('should exit with error when template does not exist', async () => {
|
|
115
|
-
vi.mocked(getAvailableTemplates).mockResolvedValue(['weather-
|
|
115
|
+
vi.mocked(getAvailableTemplates).mockResolvedValue(['weather-project', 'chatbot']);
|
|
116
116
|
await expect(createAgents({
|
|
117
117
|
dirName: 'test-dir',
|
|
118
118
|
template: 'non-existent-template',
|
|
@@ -123,7 +123,7 @@ describe('createAgents - Template and Project ID Logic', () => {
|
|
|
123
123
|
});
|
|
124
124
|
it('should show available templates when invalid template is provided', async () => {
|
|
125
125
|
vi.mocked(getAvailableTemplates).mockResolvedValue([
|
|
126
|
-
'weather-
|
|
126
|
+
'weather-project',
|
|
127
127
|
'chatbot',
|
|
128
128
|
'data-analysis',
|
|
129
129
|
]);
|
|
@@ -133,7 +133,7 @@ describe('createAgents - Template and Project ID Logic', () => {
|
|
|
133
133
|
openAiKey: 'test-openai-key',
|
|
134
134
|
})).rejects.toThrow('process.exit called');
|
|
135
135
|
const cancelCall = vi.mocked(p.cancel).mock.calls[0][0];
|
|
136
|
-
expect(cancelCall).toContain('weather-
|
|
136
|
+
expect(cancelCall).toContain('weather-project');
|
|
137
137
|
expect(cancelCall).toContain('chatbot');
|
|
138
138
|
expect(cancelCall).toContain('data-analysis');
|
|
139
139
|
});
|
|
@@ -185,7 +185,7 @@ describe('createAgents - Template and Project ID Logic', () => {
|
|
|
185
185
|
anthropicKey: 'test-key',
|
|
186
186
|
});
|
|
187
187
|
expect(cloneTemplate).toHaveBeenCalledTimes(2);
|
|
188
|
-
expect(cloneTemplate).toHaveBeenCalledWith('https://github.com/inkeep/agents-cookbook/
|
|
188
|
+
expect(cloneTemplate).toHaveBeenCalledWith('https://github.com/inkeep/agents-cookbook/template-projects/my-complex-template', 'src/my-complex-template');
|
|
189
189
|
});
|
|
190
190
|
it('should handle custom project IDs with special characters', async () => {
|
|
191
191
|
await createAgents({
|
|
@@ -237,6 +237,10 @@ function setupDefaultMocks() {
|
|
|
237
237
|
vi.mocked(fs.pathExists).mockResolvedValue(false);
|
|
238
238
|
vi.mocked(fs.ensureDir).mockResolvedValue(undefined);
|
|
239
239
|
vi.mocked(fs.writeFile).mockResolvedValue(undefined);
|
|
240
|
-
vi.mocked(getAvailableTemplates).mockResolvedValue([
|
|
240
|
+
vi.mocked(getAvailableTemplates).mockResolvedValue([
|
|
241
|
+
'weather-project',
|
|
242
|
+
'chatbot',
|
|
243
|
+
'data-analysis',
|
|
244
|
+
]);
|
|
241
245
|
vi.mocked(cloneTemplate).mockResolvedValue(undefined);
|
|
242
246
|
}
|
package/dist/templates.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import fs from 'fs-extra';
|
|
2
1
|
import degit from 'degit';
|
|
2
|
+
import fs from 'fs-extra';
|
|
3
3
|
//Duplicating function here so we dont have to add a dependency on the agents-cli package
|
|
4
4
|
export async function cloneTemplate(templatePath, targetPath) {
|
|
5
5
|
await fs.mkdir(targetPath, { recursive: true });
|
|
@@ -14,9 +14,7 @@ export async function cloneTemplate(templatePath, targetPath) {
|
|
|
14
14
|
}
|
|
15
15
|
export async function getAvailableTemplates() {
|
|
16
16
|
// Fetch the list of templates from your repo
|
|
17
|
-
const response = await fetch('https://api.github.com/repos/inkeep/agents-cookbook/contents/
|
|
17
|
+
const response = await fetch('https://api.github.com/repos/inkeep/agents-cookbook/contents/template-projects');
|
|
18
18
|
const contents = await response.json();
|
|
19
|
-
return contents
|
|
20
|
-
.filter((item) => item.type === 'dir')
|
|
21
|
-
.map((item) => item.name);
|
|
19
|
+
return contents.filter((item) => item.type === 'dir').map((item) => item.name);
|
|
22
20
|
}
|
package/dist/utils.js
CHANGED
|
@@ -66,8 +66,8 @@ export const createAgents = async (args = {}) => {
|
|
|
66
66
|
}
|
|
67
67
|
else {
|
|
68
68
|
// No template or custom project ID provided - use defaults
|
|
69
|
-
projectId = 'weather-
|
|
70
|
-
templateName = 'weather-
|
|
69
|
+
projectId = 'weather-project';
|
|
70
|
+
templateName = 'weather-project';
|
|
71
71
|
}
|
|
72
72
|
p.intro(color.inverse(' Create Agents Directory '));
|
|
73
73
|
// Prompt for directory name if not provided
|
|
@@ -93,7 +93,7 @@ export const createAgents = async (args = {}) => {
|
|
|
93
93
|
// If keys aren't provided via CLI args, prompt for provider selection and keys
|
|
94
94
|
if (!anthropicKey && !openAiKey) {
|
|
95
95
|
const providerChoice = await p.select({
|
|
96
|
-
message: 'Which AI provider
|
|
96
|
+
message: 'Which AI provider would you like to use?',
|
|
97
97
|
options: [
|
|
98
98
|
{ value: 'anthropic', label: 'Anthropic' },
|
|
99
99
|
{ value: 'openai', label: 'OpenAI' },
|
|
@@ -172,7 +172,7 @@ export const createAgents = async (args = {}) => {
|
|
|
172
172
|
try {
|
|
173
173
|
const agentsTemplateRepo = 'https://github.com/inkeep/create-agents-template';
|
|
174
174
|
const projectTemplateRepo = templateName
|
|
175
|
-
? `https://github.com/inkeep/agents-cookbook/
|
|
175
|
+
? `https://github.com/inkeep/agents-cookbook/template-projects/${templateName}`
|
|
176
176
|
: null;
|
|
177
177
|
const directoryPath = path.resolve(process.cwd(), dirName);
|
|
178
178
|
// Check if directory already exists
|
|
@@ -281,13 +281,15 @@ GOOGLE_GENERATIVE_AI_API_KEY=${config.googleKey || 'your-google-key-here'}
|
|
|
281
281
|
INKEEP_AGENTS_MANAGE_API_URL="http://localhost:3002"
|
|
282
282
|
INKEEP_AGENTS_RUN_API_URL="http://localhost:3003"
|
|
283
283
|
|
|
284
|
-
# SigNoz
|
|
284
|
+
# SigNoz Configuration
|
|
285
285
|
SIGNOZ_URL=your-signoz-url-here
|
|
286
286
|
SIGNOZ_API_KEY=your-signoz-api-key-here
|
|
287
287
|
|
|
288
|
-
#
|
|
289
|
-
|
|
290
|
-
|
|
288
|
+
# OTEL Configuration
|
|
289
|
+
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://ingest.us.signoz.cloud:443/v1/traces
|
|
290
|
+
OTEL_EXPORTER_OTLP_TRACES_HEADERS="signoz-ingestion-key=<your-ingestion-key>"
|
|
291
|
+
|
|
292
|
+
# Nango Configuration
|
|
291
293
|
NANGO_SECRET_KEY=
|
|
292
294
|
`;
|
|
293
295
|
await fs.writeFile('.env', envContent);
|