@agent-creator/cli 0.4.2
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/README.md +9 -0
- package/dist/package.json +36 -0
- package/dist/src/capabilities/agent-core/capability.config.d.ts +2 -0
- package/dist/src/capabilities/agent-core/capability.config.js +6 -0
- package/dist/src/capabilities/agent-core/fileLoader.d.ts +3 -0
- package/dist/src/capabilities/agent-core/fileLoader.js +40 -0
- package/dist/src/capabilities/agent-core/files/base/.env.example +4 -0
- package/dist/src/capabilities/agent-core/files/base/README.md +69 -0
- package/dist/src/capabilities/agent-core/files/base/agent.config.ts +31 -0
- package/dist/src/capabilities/agent-core/files/base/package.json +33 -0
- package/dist/src/capabilities/agent-core/files/base/src/cli.ts +46 -0
- package/dist/src/capabilities/agent-core/files/base/src/dev.ts +1 -0
- package/dist/src/capabilities/agent-core/files/base/src/env.ts +23 -0
- package/dist/src/capabilities/agent-core/files/base/src/index.ts +31 -0
- package/dist/src/capabilities/agent-core/files/base/src/skills/index.ts +9 -0
- package/dist/src/capabilities/agent-core/files/base/tests/agent.test.ts +25 -0
- package/dist/src/capabilities/agent-core/files/base/tsconfig.json +17 -0
- package/dist/src/capabilities/agent-core/files/service/next.config.ts +15 -0
- package/dist/src/capabilities/agent-core/files/service/package.json +30 -0
- package/dist/src/capabilities/agent-core/files/service/src/app/api/agent/route.ts +10 -0
- package/dist/src/capabilities/agent-core/files/service/src/app/api/agent/stream/route.ts +53 -0
- package/dist/src/capabilities/agent-core/files/service/src/app/globals.css +34 -0
- package/dist/src/capabilities/agent-core/files/service/src/app/layout.tsx +19 -0
- package/dist/src/capabilities/agent-core/files/service/src/app/page.tsx +7 -0
- package/dist/src/capabilities/agent-core/files/service/src/components/AgentChat.tsx +146 -0
- package/dist/src/capabilities/capabilityRegistry.d.ts +3 -0
- package/dist/src/capabilities/capabilityRegistry.js +16 -0
- package/dist/src/capabilities/index.d.ts +1 -0
- package/dist/src/capabilities/index.js +1 -0
- package/dist/src/cli/cli.d.ts +3 -0
- package/dist/src/cli/cli.js +63 -0
- package/dist/src/commands/addSkill.d.ts +2 -0
- package/dist/src/commands/addSkill.js +58 -0
- package/dist/src/commands/addTool.d.ts +3 -0
- package/dist/src/commands/addTool.js +7 -0
- package/dist/src/commands/create.d.ts +2 -0
- package/dist/src/commands/create.js +32 -0
- package/dist/src/commands/dev.d.ts +1 -0
- package/dist/src/commands/dev.js +11 -0
- package/dist/src/commands/trace.d.ts +7 -0
- package/dist/src/commands/trace.js +35 -0
- package/dist/src/commands/validate.d.ts +1 -0
- package/dist/src/commands/validate.js +166 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +3 -0
- package/dist/src/schemas/agentConfig.schema.d.ts +103 -0
- package/dist/src/schemas/agentConfig.schema.js +26 -0
- package/dist/src/schemas/capability.schema.d.ts +25 -0
- package/dist/src/schemas/capability.schema.js +11 -0
- package/dist/src/types/capability.d.ts +11 -0
- package/dist/src/types/capability.js +1 -0
- package/dist/src/types/cli.d.ts +10 -0
- package/dist/src/types/cli.js +1 -0
- package/dist/src/utils/fs.d.ts +4 -0
- package/dist/src/utils/fs.js +21 -0
- package/dist/src/utils/logger.d.ts +6 -0
- package/dist/src/utils/logger.js +14 -0
- package/dist/src/utils/packageManager.d.ts +1 -0
- package/dist/src/utils/packageManager.js +5 -0
- package/dist/src/utils/path.d.ts +2 -0
- package/dist/src/utils/path.js +7 -0
- package/dist/src/utils/string.d.ts +4 -0
- package/dist/src/utils/string.js +21 -0
- package/dist/src/version.d.ts +4 -0
- package/dist/src/version.js +5 -0
- package/package.json +36 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const agentConfigSchema: z.ZodObject<{
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
capability: z.ZodLiteral<"agent-core">;
|
|
5
|
+
version: z.ZodString;
|
|
6
|
+
configVersion: z.ZodString;
|
|
7
|
+
capabilityVersion: z.ZodString;
|
|
8
|
+
generatedBy: z.ZodObject<{
|
|
9
|
+
name: z.ZodLiteral<"agent-creator">;
|
|
10
|
+
version: z.ZodString;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
name: "agent-creator";
|
|
13
|
+
version: string;
|
|
14
|
+
}, {
|
|
15
|
+
name: "agent-creator";
|
|
16
|
+
version: string;
|
|
17
|
+
}>;
|
|
18
|
+
service: z.ZodObject<{
|
|
19
|
+
enabled: z.ZodBoolean;
|
|
20
|
+
framework: z.ZodOptional<z.ZodLiteral<"next">>;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
enabled: boolean;
|
|
23
|
+
framework?: "next" | undefined;
|
|
24
|
+
}, {
|
|
25
|
+
enabled: boolean;
|
|
26
|
+
framework?: "next" | undefined;
|
|
27
|
+
}>;
|
|
28
|
+
model: z.ZodObject<{
|
|
29
|
+
baseUrl: z.ZodString;
|
|
30
|
+
apiKey: z.ZodString;
|
|
31
|
+
model: z.ZodString;
|
|
32
|
+
timeoutMs: z.ZodNumber;
|
|
33
|
+
maxRetries: z.ZodNumber;
|
|
34
|
+
}, "strip", z.ZodTypeAny, {
|
|
35
|
+
model: string;
|
|
36
|
+
baseUrl: string;
|
|
37
|
+
apiKey: string;
|
|
38
|
+
timeoutMs: number;
|
|
39
|
+
maxRetries: number;
|
|
40
|
+
}, {
|
|
41
|
+
model: string;
|
|
42
|
+
baseUrl: string;
|
|
43
|
+
apiKey: string;
|
|
44
|
+
timeoutMs: number;
|
|
45
|
+
maxRetries: number;
|
|
46
|
+
}>;
|
|
47
|
+
skills: z.ZodObject<{
|
|
48
|
+
enabled: z.ZodArray<z.ZodString, "many">;
|
|
49
|
+
}, "strip", z.ZodTypeAny, {
|
|
50
|
+
enabled: string[];
|
|
51
|
+
}, {
|
|
52
|
+
enabled: string[];
|
|
53
|
+
}>;
|
|
54
|
+
}, "strip", z.ZodTypeAny, {
|
|
55
|
+
service: {
|
|
56
|
+
enabled: boolean;
|
|
57
|
+
framework?: "next" | undefined;
|
|
58
|
+
};
|
|
59
|
+
name: string;
|
|
60
|
+
capability: "agent-core";
|
|
61
|
+
version: string;
|
|
62
|
+
configVersion: string;
|
|
63
|
+
capabilityVersion: string;
|
|
64
|
+
generatedBy: {
|
|
65
|
+
name: "agent-creator";
|
|
66
|
+
version: string;
|
|
67
|
+
};
|
|
68
|
+
model: {
|
|
69
|
+
model: string;
|
|
70
|
+
baseUrl: string;
|
|
71
|
+
apiKey: string;
|
|
72
|
+
timeoutMs: number;
|
|
73
|
+
maxRetries: number;
|
|
74
|
+
};
|
|
75
|
+
skills: {
|
|
76
|
+
enabled: string[];
|
|
77
|
+
};
|
|
78
|
+
}, {
|
|
79
|
+
service: {
|
|
80
|
+
enabled: boolean;
|
|
81
|
+
framework?: "next" | undefined;
|
|
82
|
+
};
|
|
83
|
+
name: string;
|
|
84
|
+
capability: "agent-core";
|
|
85
|
+
version: string;
|
|
86
|
+
configVersion: string;
|
|
87
|
+
capabilityVersion: string;
|
|
88
|
+
generatedBy: {
|
|
89
|
+
name: "agent-creator";
|
|
90
|
+
version: string;
|
|
91
|
+
};
|
|
92
|
+
model: {
|
|
93
|
+
model: string;
|
|
94
|
+
baseUrl: string;
|
|
95
|
+
apiKey: string;
|
|
96
|
+
timeoutMs: number;
|
|
97
|
+
maxRetries: number;
|
|
98
|
+
};
|
|
99
|
+
skills: {
|
|
100
|
+
enabled: string[];
|
|
101
|
+
};
|
|
102
|
+
}>;
|
|
103
|
+
export type AgentConfigShape = z.infer<typeof agentConfigSchema>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const agentConfigSchema = z.object({
|
|
3
|
+
name: z.string().min(1),
|
|
4
|
+
capability: z.literal('agent-core'),
|
|
5
|
+
version: z.string().min(1),
|
|
6
|
+
configVersion: z.string().min(1),
|
|
7
|
+
capabilityVersion: z.string().min(1),
|
|
8
|
+
generatedBy: z.object({
|
|
9
|
+
name: z.literal('agent-creator'),
|
|
10
|
+
version: z.string().min(1),
|
|
11
|
+
}),
|
|
12
|
+
service: z.object({
|
|
13
|
+
enabled: z.boolean(),
|
|
14
|
+
framework: z.literal('next').optional(),
|
|
15
|
+
}),
|
|
16
|
+
model: z.object({
|
|
17
|
+
baseUrl: z.string(),
|
|
18
|
+
apiKey: z.string(),
|
|
19
|
+
model: z.string(),
|
|
20
|
+
timeoutMs: z.number().positive(),
|
|
21
|
+
maxRetries: z.number().int().nonnegative(),
|
|
22
|
+
}),
|
|
23
|
+
skills: z.object({
|
|
24
|
+
enabled: z.array(z.string().min(1)),
|
|
25
|
+
}),
|
|
26
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const capabilityNameSchema: z.ZodLiteral<"agent-core">;
|
|
3
|
+
export declare const capabilityFileSchema: z.ZodObject<{
|
|
4
|
+
path: z.ZodString;
|
|
5
|
+
content: z.ZodString;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
path: string;
|
|
8
|
+
content: string;
|
|
9
|
+
}, {
|
|
10
|
+
path: string;
|
|
11
|
+
content: string;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const capabilityDefinitionSchema: z.ZodObject<{
|
|
14
|
+
name: z.ZodLiteral<"agent-core">;
|
|
15
|
+
description: z.ZodString;
|
|
16
|
+
files: z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodUnknown>;
|
|
17
|
+
}, "strip", z.ZodTypeAny, {
|
|
18
|
+
files: (...args: unknown[]) => unknown;
|
|
19
|
+
name: "agent-core";
|
|
20
|
+
description: string;
|
|
21
|
+
}, {
|
|
22
|
+
files: (...args: unknown[]) => unknown;
|
|
23
|
+
name: "agent-core";
|
|
24
|
+
description: string;
|
|
25
|
+
}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const capabilityNameSchema = z.literal('agent-core');
|
|
3
|
+
export const capabilityFileSchema = z.object({
|
|
4
|
+
path: z.string().min(1),
|
|
5
|
+
content: z.string(),
|
|
6
|
+
});
|
|
7
|
+
export const capabilityDefinitionSchema = z.object({
|
|
8
|
+
name: capabilityNameSchema,
|
|
9
|
+
description: z.string().min(1),
|
|
10
|
+
files: z.function(),
|
|
11
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CreateOptions } from './cli.js';
|
|
2
|
+
export type AgentCapabilityName = 'agent-core';
|
|
3
|
+
export interface AgentCapabilityFile {
|
|
4
|
+
path: string;
|
|
5
|
+
content: string;
|
|
6
|
+
}
|
|
7
|
+
export interface AgentCapabilityDefinition {
|
|
8
|
+
name: AgentCapabilityName;
|
|
9
|
+
description: string;
|
|
10
|
+
files: (projectName: string, options?: CreateOptions) => Promise<AgentCapabilityFile[]> | AgentCapabilityFile[];
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AgentCapabilityName } from './capability.js';
|
|
2
|
+
export interface CreateOptions {
|
|
3
|
+
capability?: AgentCapabilityName | string;
|
|
4
|
+
packageManager?: 'npm' | string;
|
|
5
|
+
force?: boolean;
|
|
6
|
+
mode?: 'package' | 'service' | string;
|
|
7
|
+
}
|
|
8
|
+
export interface AddToolOptions {
|
|
9
|
+
permission?: 'public' | 'external_api' | 'user_private' | string;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function pathExists(target: string): Promise<boolean>;
|
|
2
|
+
export declare function ensureDir(target: string): Promise<void>;
|
|
3
|
+
export declare function writeFileEnsured(filePath: string, content: string): Promise<void>;
|
|
4
|
+
export declare function readText(filePath: string): Promise<string>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
export async function pathExists(target) {
|
|
4
|
+
try {
|
|
5
|
+
await fs.access(target);
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
catch {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export async function ensureDir(target) {
|
|
13
|
+
await fs.mkdir(target, { recursive: true });
|
|
14
|
+
}
|
|
15
|
+
export async function writeFileEnsured(filePath, content) {
|
|
16
|
+
await ensureDir(path.dirname(filePath));
|
|
17
|
+
await fs.writeFile(filePath, content, 'utf8');
|
|
18
|
+
}
|
|
19
|
+
export async function readText(filePath) {
|
|
20
|
+
return fs.readFile(filePath, 'utf8');
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function installCommand(packageManager: string): string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export function toKebabCase(value) {
|
|
2
|
+
return value
|
|
3
|
+
.trim()
|
|
4
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1-$2')
|
|
5
|
+
.replace(/[\s_]+/g, '-')
|
|
6
|
+
.replace(/-+/g, '-')
|
|
7
|
+
.toLowerCase();
|
|
8
|
+
}
|
|
9
|
+
export function toCamelCase(value) {
|
|
10
|
+
const kebab = toKebabCase(value);
|
|
11
|
+
return kebab.replace(/-([a-z0-9])/g, (_, char) => char.toUpperCase());
|
|
12
|
+
}
|
|
13
|
+
export function toToolName(value) {
|
|
14
|
+
const normalized = toKebabCase(value).replace(/-/g, '.');
|
|
15
|
+
return normalized.includes('.') ? normalized : `${normalized}.run`;
|
|
16
|
+
}
|
|
17
|
+
export function assertSafeName(value) {
|
|
18
|
+
if (!/^[a-zA-Z0-9_-]+$/.test(value)) {
|
|
19
|
+
throw new Error('Name may only contain letters, numbers, underscores, and hyphens.');
|
|
20
|
+
}
|
|
21
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agent-creator/cli",
|
|
3
|
+
"version": "0.4.2",
|
|
4
|
+
"description": "CLI for creating projects powered by @agent-creator/core.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"agent": "./dist/src/index.js"
|
|
8
|
+
},
|
|
9
|
+
"main": "./dist/src/index.js",
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"README.md",
|
|
13
|
+
"package.json"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "node ../../scripts/clean-cli.mjs && tsc -p tsconfig.json && node ../../scripts/copy-capabilities.mjs",
|
|
17
|
+
"dev": "tsx src/index.ts",
|
|
18
|
+
"test": "vitest run",
|
|
19
|
+
"validate": "tsx src/index.ts validate",
|
|
20
|
+
"check:package": "npm pack --dry-run --json"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@agent-creator/core": "file:../core",
|
|
24
|
+
"commander": "^12.1.0",
|
|
25
|
+
"typescript": "^5.9.3",
|
|
26
|
+
"zod": "^3.23.8"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@types/node": "^20.14.12",
|
|
30
|
+
"tsx": "^4.16.2",
|
|
31
|
+
"vitest": "^2.0.5"
|
|
32
|
+
},
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=18"
|
|
35
|
+
}
|
|
36
|
+
}
|