clayton-forge 0.1.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/src/index.ts ADDED
@@ -0,0 +1,115 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from "commander";
3
+ import chalk from "chalk";
4
+ import { commandNew } from "./commands/new";
5
+ import { commandRun } from "./commands/run";
6
+ import { commandTest } from "./commands/test";
7
+
8
+ const pkg = require("../package.json");
9
+
10
+ // ─────────────────────────────────────────────
11
+ // Banner
12
+ // ─────────────────────────────────────────────
13
+
14
+ function printBanner() {
15
+ console.log("");
16
+ console.log(chalk.bold.cyan(" CLAYTON FORGE") + chalk.gray(` v${pkg.version}`));
17
+ console.log(chalk.gray(" Build AI agents with confidence."));
18
+ console.log(chalk.gray(" https://github.com/devclaytonn10/clayton-forge"));
19
+ console.log("");
20
+ }
21
+
22
+ // ─────────────────────────────────────────────
23
+ // CLI
24
+ // ─────────────────────────────────────────────
25
+
26
+ const program = new Command();
27
+
28
+ program
29
+ .name("cforge")
30
+ .description("Clayton Forge — AI agent platform CLI")
31
+ .version(pkg.version, "-v, --version", "Output the current version")
32
+ .addHelpText("before", "\n CLAYTON FORGE — Build AI agents with confidence.\n");
33
+
34
+ // ─────────────────────────────────────────────
35
+ // cforge new [name]
36
+ // ─────────────────────────────────────────────
37
+
38
+ program
39
+ .command("new [name]")
40
+ .description("Create a new agent with an interactive wizard")
41
+ .action(async (name?: string) => {
42
+ await commandNew(name ? undefined : undefined);
43
+ });
44
+
45
+ // ─────────────────────────────────────────────
46
+ // cforge run [agent-dir] [input]
47
+ // ─────────────────────────────────────────────
48
+
49
+ program
50
+ .command("run [agent-dir]")
51
+ .description("Execute an agent")
52
+ .option("-i, --input <text>", "Input text (skips interactive prompt for single-variable agents)")
53
+ .action(async (agentDir?: string, options?: { input?: string }) => {
54
+ await commandRun(agentDir, options?.input);
55
+ });
56
+
57
+ // ─────────────────────────────────────────────
58
+ // cforge test [agent-dir]
59
+ // ─────────────────────────────────────────────
60
+
61
+ program
62
+ .command("test [agent-dir]")
63
+ .description("Run the agent's test suite")
64
+ .action(async (agentDir?: string) => {
65
+ await commandTest(agentDir);
66
+ });
67
+
68
+ // ─────────────────────────────────────────────
69
+ // cforge validate
70
+ // ─────────────────────────────────────────────
71
+
72
+ program
73
+ .command("validate [agent-dir]")
74
+ .description("Validate agent.yaml without running the agent")
75
+ .action(async (agentDir?: string) => {
76
+ const { parseAgentFile, findAgentFile } = await import("@clayton-forge/core");
77
+ const path = require("path");
78
+ const fs = require("fs");
79
+
80
+ const searchDir = agentDir ? path.resolve(agentDir) : process.cwd();
81
+ const agentPath = fs.existsSync(path.join(searchDir, "agent.yaml"))
82
+ ? path.join(searchDir, "agent.yaml")
83
+ : findAgentFile(searchDir);
84
+
85
+ if (!agentPath) {
86
+ console.error(chalk.red("✗ No agent.yaml found."));
87
+ process.exit(1);
88
+ }
89
+
90
+ try {
91
+ const agent = parseAgentFile(agentPath);
92
+ console.log(chalk.green(`\n ✓ Valid agent.yaml`));
93
+ console.log(chalk.gray(` Name: ${agent.name} v${agent.version}`));
94
+ console.log(chalk.gray(` Type: ${agent.type}`));
95
+ console.log(chalk.gray(` LLM: ${agent.llm.provider}${agent.llm.model ? ` / ${agent.llm.model}` : ""}`));
96
+ console.log("");
97
+ } catch (err) {
98
+ console.error(chalk.red(`\n ✗ ${err instanceof Error ? err.message : err}`));
99
+ console.log("");
100
+ process.exit(1);
101
+ }
102
+ });
103
+
104
+ // ─────────────────────────────────────────────
105
+ // Default: banner + help
106
+ // ─────────────────────────────────────────────
107
+
108
+ program.addHelpCommand(true);
109
+
110
+ if (process.argv.length <= 2) {
111
+ printBanner();
112
+ program.help();
113
+ }
114
+
115
+ program.parse(process.argv);
Binary file
package/tsconfig.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist",
5
+ "rootDir": "./src"
6
+ },
7
+ "include": ["src/**/*"],
8
+ "exclude": ["node_modules", "dist"]
9
+ }
Binary file