@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.
Files changed (66) hide show
  1. package/README.md +9 -0
  2. package/dist/package.json +36 -0
  3. package/dist/src/capabilities/agent-core/capability.config.d.ts +2 -0
  4. package/dist/src/capabilities/agent-core/capability.config.js +6 -0
  5. package/dist/src/capabilities/agent-core/fileLoader.d.ts +3 -0
  6. package/dist/src/capabilities/agent-core/fileLoader.js +40 -0
  7. package/dist/src/capabilities/agent-core/files/base/.env.example +4 -0
  8. package/dist/src/capabilities/agent-core/files/base/README.md +69 -0
  9. package/dist/src/capabilities/agent-core/files/base/agent.config.ts +31 -0
  10. package/dist/src/capabilities/agent-core/files/base/package.json +33 -0
  11. package/dist/src/capabilities/agent-core/files/base/src/cli.ts +46 -0
  12. package/dist/src/capabilities/agent-core/files/base/src/dev.ts +1 -0
  13. package/dist/src/capabilities/agent-core/files/base/src/env.ts +23 -0
  14. package/dist/src/capabilities/agent-core/files/base/src/index.ts +31 -0
  15. package/dist/src/capabilities/agent-core/files/base/src/skills/index.ts +9 -0
  16. package/dist/src/capabilities/agent-core/files/base/tests/agent.test.ts +25 -0
  17. package/dist/src/capabilities/agent-core/files/base/tsconfig.json +17 -0
  18. package/dist/src/capabilities/agent-core/files/service/next.config.ts +15 -0
  19. package/dist/src/capabilities/agent-core/files/service/package.json +30 -0
  20. package/dist/src/capabilities/agent-core/files/service/src/app/api/agent/route.ts +10 -0
  21. package/dist/src/capabilities/agent-core/files/service/src/app/api/agent/stream/route.ts +53 -0
  22. package/dist/src/capabilities/agent-core/files/service/src/app/globals.css +34 -0
  23. package/dist/src/capabilities/agent-core/files/service/src/app/layout.tsx +19 -0
  24. package/dist/src/capabilities/agent-core/files/service/src/app/page.tsx +7 -0
  25. package/dist/src/capabilities/agent-core/files/service/src/components/AgentChat.tsx +146 -0
  26. package/dist/src/capabilities/capabilityRegistry.d.ts +3 -0
  27. package/dist/src/capabilities/capabilityRegistry.js +16 -0
  28. package/dist/src/capabilities/index.d.ts +1 -0
  29. package/dist/src/capabilities/index.js +1 -0
  30. package/dist/src/cli/cli.d.ts +3 -0
  31. package/dist/src/cli/cli.js +63 -0
  32. package/dist/src/commands/addSkill.d.ts +2 -0
  33. package/dist/src/commands/addSkill.js +58 -0
  34. package/dist/src/commands/addTool.d.ts +3 -0
  35. package/dist/src/commands/addTool.js +7 -0
  36. package/dist/src/commands/create.d.ts +2 -0
  37. package/dist/src/commands/create.js +32 -0
  38. package/dist/src/commands/dev.d.ts +1 -0
  39. package/dist/src/commands/dev.js +11 -0
  40. package/dist/src/commands/trace.d.ts +7 -0
  41. package/dist/src/commands/trace.js +35 -0
  42. package/dist/src/commands/validate.d.ts +1 -0
  43. package/dist/src/commands/validate.js +166 -0
  44. package/dist/src/index.d.ts +2 -0
  45. package/dist/src/index.js +3 -0
  46. package/dist/src/schemas/agentConfig.schema.d.ts +103 -0
  47. package/dist/src/schemas/agentConfig.schema.js +26 -0
  48. package/dist/src/schemas/capability.schema.d.ts +25 -0
  49. package/dist/src/schemas/capability.schema.js +11 -0
  50. package/dist/src/types/capability.d.ts +11 -0
  51. package/dist/src/types/capability.js +1 -0
  52. package/dist/src/types/cli.d.ts +10 -0
  53. package/dist/src/types/cli.js +1 -0
  54. package/dist/src/utils/fs.d.ts +4 -0
  55. package/dist/src/utils/fs.js +21 -0
  56. package/dist/src/utils/logger.d.ts +6 -0
  57. package/dist/src/utils/logger.js +14 -0
  58. package/dist/src/utils/packageManager.d.ts +1 -0
  59. package/dist/src/utils/packageManager.js +5 -0
  60. package/dist/src/utils/path.d.ts +2 -0
  61. package/dist/src/utils/path.js +7 -0
  62. package/dist/src/utils/string.d.ts +4 -0
  63. package/dist/src/utils/string.js +21 -0
  64. package/dist/src/version.d.ts +4 -0
  65. package/dist/src/version.js +5 -0
  66. 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,6 @@
1
+ export declare const logger: {
2
+ info(message: string): void;
3
+ success(message: string): void;
4
+ warn(message: string): void;
5
+ error(message: string): void;
6
+ };
@@ -0,0 +1,14 @@
1
+ export const logger = {
2
+ info(message) {
3
+ console.log(message);
4
+ },
5
+ success(message) {
6
+ console.log(message);
7
+ },
8
+ warn(message) {
9
+ console.warn(message);
10
+ },
11
+ error(message) {
12
+ console.error(message);
13
+ },
14
+ };
@@ -0,0 +1 @@
1
+ export declare function installCommand(packageManager: string): string;
@@ -0,0 +1,5 @@
1
+ export function installCommand(packageManager) {
2
+ if (packageManager === 'npm')
3
+ return 'npm install';
4
+ return `${packageManager} install`;
5
+ }
@@ -0,0 +1,2 @@
1
+ export declare function resolveProjectPath(name: string, cwd?: string): string;
2
+ export declare function normalizePath(filePath: string): string;
@@ -0,0 +1,7 @@
1
+ import path from 'node:path';
2
+ export function resolveProjectPath(name, cwd = process.cwd()) {
3
+ return path.resolve(cwd, name);
4
+ }
5
+ export function normalizePath(filePath) {
6
+ return filePath.split(path.sep).join('/');
7
+ }
@@ -0,0 +1,4 @@
1
+ export declare function toKebabCase(value: string): string;
2
+ export declare function toCamelCase(value: string): string;
3
+ export declare function toToolName(value: string): string;
4
+ export declare function assertSafeName(value: string): void;
@@ -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
+ }
@@ -0,0 +1,4 @@
1
+ export declare const CLI_VERSION: string;
2
+ export declare const SUPPORTED_CONFIG_VERSIONS: readonly ["0.1"];
3
+ export declare const CURRENT_CONFIG_VERSION = "0.1";
4
+ export declare const AGENT_CORE_CAPABILITY_VERSION = "0.4.2";
@@ -0,0 +1,5 @@
1
+ import packageJson from '../package.json' with { type: 'json' };
2
+ export const CLI_VERSION = packageJson.version;
3
+ export const SUPPORTED_CONFIG_VERSIONS = ['0.1'];
4
+ export const CURRENT_CONFIG_VERSION = '0.1';
5
+ export const AGENT_CORE_CAPABILITY_VERSION = '0.4.2';
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
+ }