@inkeep/create-agents 0.27.0 → 0.28.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/utils.js +31 -6
- package/package.json +2 -2
package/dist/utils.js
CHANGED
|
@@ -7,6 +7,27 @@ import { ANTHROPIC_MODELS, GOOGLE_MODELS, OPENAI_MODELS } from '@inkeep/agents-c
|
|
|
7
7
|
import fs from 'fs-extra';
|
|
8
8
|
import color from 'picocolors';
|
|
9
9
|
import { cloneTemplate, getAvailableTemplates } from './templates.js';
|
|
10
|
+
// Shared validation utility
|
|
11
|
+
const DIRECTORY_VALIDATION = {
|
|
12
|
+
pattern: /^[a-zA-Z0-9][a-zA-Z0-9_-]*$/,
|
|
13
|
+
reservedNames: /^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])$/i,
|
|
14
|
+
minLength: 1,
|
|
15
|
+
maxLength: 255,
|
|
16
|
+
validate(value) {
|
|
17
|
+
if (!value || value.trim() === '')
|
|
18
|
+
return 'Directory name is required';
|
|
19
|
+
if (value.length < this.minLength || value.length > this.maxLength) {
|
|
20
|
+
return `Directory name must be between ${this.minLength} and ${this.maxLength} characters`;
|
|
21
|
+
}
|
|
22
|
+
if (this.reservedNames.test(value)) {
|
|
23
|
+
return 'Directory name cannot be a reserved system name';
|
|
24
|
+
}
|
|
25
|
+
if (!this.pattern.test(value)) {
|
|
26
|
+
return 'Directory name can only contain letters, numbers, and hyphens (-), and underscores (_) and must start with a letter or number';
|
|
27
|
+
}
|
|
28
|
+
return undefined;
|
|
29
|
+
},
|
|
30
|
+
};
|
|
10
31
|
const execAsync = promisify(exec);
|
|
11
32
|
export const defaultGoogleModelConfigurations = {
|
|
12
33
|
base: {
|
|
@@ -73,12 +94,7 @@ export const createAgents = async (args = {}) => {
|
|
|
73
94
|
message: 'What do you want to name your agents directory?',
|
|
74
95
|
placeholder: 'agents',
|
|
75
96
|
defaultValue: 'agents',
|
|
76
|
-
validate: (value) =>
|
|
77
|
-
if (!value || value.trim() === '') {
|
|
78
|
-
return 'Directory name is required';
|
|
79
|
-
}
|
|
80
|
-
return undefined;
|
|
81
|
-
},
|
|
97
|
+
validate: (value) => DIRECTORY_VALIDATION.validate(value),
|
|
82
98
|
});
|
|
83
99
|
if (p.isCancel(dirResponse)) {
|
|
84
100
|
p.cancel('Operation cancelled');
|
|
@@ -86,6 +102,13 @@ export const createAgents = async (args = {}) => {
|
|
|
86
102
|
}
|
|
87
103
|
dirName = dirResponse;
|
|
88
104
|
}
|
|
105
|
+
else {
|
|
106
|
+
// Validate the provided dirName
|
|
107
|
+
const validationError = DIRECTORY_VALIDATION.validate(dirName);
|
|
108
|
+
if (validationError) {
|
|
109
|
+
throw new Error(validationError);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
89
112
|
if (!anthropicKey && !openAiKey && !googleKey) {
|
|
90
113
|
const providerChoice = await p.select({
|
|
91
114
|
message: 'Which AI provider would you like to use?',
|
|
@@ -323,6 +346,8 @@ async function installDependencies() {
|
|
|
323
346
|
async function initializeGit() {
|
|
324
347
|
try {
|
|
325
348
|
await execAsync('git init');
|
|
349
|
+
await execAsync('git add .');
|
|
350
|
+
await execAsync('git commit -m "Initial commit from inkeep/create-agents"');
|
|
326
351
|
}
|
|
327
352
|
catch (error) {
|
|
328
353
|
console.error('Error initializing git:', error instanceof Error ? error.message : 'Unknown error');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/create-agents",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"description": "Create an Inkeep Agent Framework project",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"fs-extra": "^11.0.0",
|
|
35
35
|
"picocolors": "^1.0.0",
|
|
36
36
|
"drizzle-kit": "^0.31.5",
|
|
37
|
-
"@inkeep/agents-core": "0.
|
|
37
|
+
"@inkeep/agents-core": "0.28.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/degit": "^2.8.6",
|