openscout 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.
Files changed (3) hide show
  1. package/dist/cli.d.ts +11 -0
  2. package/dist/cli.js +233 -0
  3. package/package.json +30 -0
package/dist/cli.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ declare const VERSION = "0.1.0";
3
+ declare const BRAND = "\u001B[32m\u25C6\u001B[0m";
4
+ declare const args: string[];
5
+ declare const command: string;
6
+ declare function printBrand(): void;
7
+ declare function help(): void;
8
+ declare function init(): Promise<void>;
9
+ declare function add(): Promise<void>;
10
+ declare function list(): Promise<void>;
11
+ declare function run(): Promise<void>;
package/dist/cli.js ADDED
@@ -0,0 +1,233 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ const VERSION = "0.1.0";
4
+ const BRAND = "\x1b[32m◆\x1b[0m";
5
+ const args = process.argv.slice(2);
6
+ const command = args[0];
7
+ function print(msg) {
8
+ console.log(msg);
9
+ }
10
+ function printBrand() {
11
+ print(`\n ${BRAND} \x1b[1mOpenScout\x1b[0m v${VERSION}\n`);
12
+ }
13
+ function help() {
14
+ printBrand();
15
+ print(" \x1b[2mAgent-forward development platform for builders\x1b[0m\n");
16
+ print(" \x1b[1mUsage:\x1b[0m");
17
+ print(" openscout <command> [options]\n");
18
+ print(" \x1b[1mCommands:\x1b[0m");
19
+ print(" init Scaffold a new agent workspace");
20
+ print(" add <type> Add an agent, tool, or workflow");
21
+ print(" run Run your agents");
22
+ print(" list List configured agents and tools");
23
+ print(" --help, -h Show this help message");
24
+ print(" --version, -v Show version\n");
25
+ print(" \x1b[1mExamples:\x1b[0m");
26
+ print(" npx openscout init");
27
+ print(" openscout add agent --name reviewer");
28
+ print(" openscout run\n");
29
+ print(` \x1b[2mhttps://openscout.app\x1b[0m\n`);
30
+ }
31
+ async function init() {
32
+ printBrand();
33
+ const cwd = process.cwd();
34
+ const projectName = cwd.split("/").pop() || "my-project";
35
+ print(` Initializing OpenScout in \x1b[1m${projectName}\x1b[0m...\n`);
36
+ // Create config directory
37
+ const fs = await import("node:fs/promises");
38
+ const path = await import("node:path");
39
+ const configDir = path.join(cwd, ".openscout");
40
+ await fs.mkdir(configDir, { recursive: true });
41
+ // Create config file
42
+ const config = {
43
+ name: projectName,
44
+ version: "0.1.0",
45
+ agents: [],
46
+ tools: [],
47
+ workflows: [],
48
+ settings: {
49
+ model: "auto",
50
+ local: true,
51
+ streaming: true,
52
+ },
53
+ };
54
+ await fs.writeFile(path.join(configDir, "config.json"), JSON.stringify(config, null, 2) + "\n");
55
+ // Create agents directory
56
+ await fs.mkdir(path.join(configDir, "agents"), { recursive: true });
57
+ // Create tools directory
58
+ await fs.mkdir(path.join(configDir, "tools"), { recursive: true });
59
+ // Create example agent
60
+ const exampleAgent = {
61
+ name: "scout",
62
+ description: "Default agent for general tasks",
63
+ model: "auto",
64
+ tools: [],
65
+ instructions: "You are a helpful development agent.",
66
+ };
67
+ await fs.writeFile(path.join(configDir, "agents", "scout.json"), JSON.stringify(exampleAgent, null, 2) + "\n");
68
+ print(" \x1b[32m✓\x1b[0m Created .openscout/config.json");
69
+ print(" \x1b[32m✓\x1b[0m Created .openscout/agents/scout.json");
70
+ print(" \x1b[32m✓\x1b[0m Created .openscout/agents/");
71
+ print(" \x1b[32m✓\x1b[0m Created .openscout/tools/\n");
72
+ print(" \x1b[1mNext steps:\x1b[0m");
73
+ print(" openscout add agent --name <name>");
74
+ print(" openscout run\n");
75
+ }
76
+ async function add() {
77
+ const type = args[1];
78
+ if (!type) {
79
+ print("\n \x1b[31m✗\x1b[0m Missing type. Usage: openscout add <agent|tool>\n");
80
+ process.exit(1);
81
+ }
82
+ const nameIdx = args.indexOf("--name");
83
+ const name = nameIdx !== -1 ? args[nameIdx + 1] : undefined;
84
+ if (!name) {
85
+ print(`\n \x1b[31m✗\x1b[0m Missing --name. Usage: openscout add ${type} --name <name>\n`);
86
+ process.exit(1);
87
+ }
88
+ const fs = await import("node:fs/promises");
89
+ const path = await import("node:path");
90
+ const cwd = process.cwd();
91
+ const configDir = path.join(cwd, ".openscout");
92
+ // Check if initialized
93
+ try {
94
+ await fs.access(path.join(configDir, "config.json"));
95
+ }
96
+ catch {
97
+ print("\n \x1b[31m✗\x1b[0m Not initialized. Run \x1b[1mopenscout init\x1b[0m first.\n");
98
+ process.exit(1);
99
+ }
100
+ if (type === "agent") {
101
+ const agent = {
102
+ name,
103
+ description: "",
104
+ model: "auto",
105
+ tools: [],
106
+ instructions: `You are the ${name} agent.`,
107
+ };
108
+ await fs.writeFile(path.join(configDir, "agents", `${name}.json`), JSON.stringify(agent, null, 2) + "\n");
109
+ // Update config
110
+ const configRaw = await fs.readFile(path.join(configDir, "config.json"), "utf-8");
111
+ const config = JSON.parse(configRaw);
112
+ config.agents.push(name);
113
+ await fs.writeFile(path.join(configDir, "config.json"), JSON.stringify(config, null, 2) + "\n");
114
+ print(`\n \x1b[32m✓\x1b[0m Added agent \x1b[1m${name}\x1b[0m`);
115
+ print(` \x1b[2m→ .openscout/agents/${name}.json\x1b[0m\n`);
116
+ }
117
+ else if (type === "tool") {
118
+ const tool = {
119
+ name,
120
+ description: "",
121
+ command: "",
122
+ };
123
+ await fs.writeFile(path.join(configDir, "tools", `${name}.json`), JSON.stringify(tool, null, 2) + "\n");
124
+ const configRaw = await fs.readFile(path.join(configDir, "config.json"), "utf-8");
125
+ const config = JSON.parse(configRaw);
126
+ config.tools.push(name);
127
+ await fs.writeFile(path.join(configDir, "config.json"), JSON.stringify(config, null, 2) + "\n");
128
+ print(`\n \x1b[32m✓\x1b[0m Added tool \x1b[1m${name}\x1b[0m`);
129
+ print(` \x1b[2m→ .openscout/tools/${name}.json\x1b[0m\n`);
130
+ }
131
+ else {
132
+ print(`\n \x1b[31m✗\x1b[0m Unknown type: ${type}. Use \x1b[1magent\x1b[0m or \x1b[1mtool\x1b[0m.\n`);
133
+ process.exit(1);
134
+ }
135
+ }
136
+ async function list() {
137
+ const fs = await import("node:fs/promises");
138
+ const path = await import("node:path");
139
+ const cwd = process.cwd();
140
+ const configPath = path.join(cwd, ".openscout", "config.json");
141
+ try {
142
+ await fs.access(configPath);
143
+ }
144
+ catch {
145
+ print("\n \x1b[31m✗\x1b[0m Not initialized. Run \x1b[1mopenscout init\x1b[0m first.\n");
146
+ process.exit(1);
147
+ }
148
+ const configRaw = await fs.readFile(configPath, "utf-8");
149
+ const config = JSON.parse(configRaw);
150
+ printBrand();
151
+ print(" \x1b[1mAgents:\x1b[0m");
152
+ if (config.agents.length === 0) {
153
+ print(" \x1b[2m(none — run openscout add agent --name <name>)\x1b[0m");
154
+ }
155
+ else {
156
+ for (const a of config.agents) {
157
+ print(` ${BRAND} ${a}`);
158
+ }
159
+ }
160
+ print("\n \x1b[1mTools:\x1b[0m");
161
+ if (config.tools.length === 0) {
162
+ print(" \x1b[2m(none — run openscout add tool --name <name>)\x1b[0m");
163
+ }
164
+ else {
165
+ for (const t of config.tools) {
166
+ print(` ▣ ${t}`);
167
+ }
168
+ }
169
+ print("");
170
+ }
171
+ async function run() {
172
+ const fs = await import("node:fs/promises");
173
+ const path = await import("node:path");
174
+ const cwd = process.cwd();
175
+ const configPath = path.join(cwd, ".openscout", "config.json");
176
+ try {
177
+ await fs.access(configPath);
178
+ }
179
+ catch {
180
+ print("\n \x1b[31m✗\x1b[0m Not initialized. Run \x1b[1mopenscout init\x1b[0m first.\n");
181
+ process.exit(1);
182
+ }
183
+ const configRaw = await fs.readFile(configPath, "utf-8");
184
+ const config = JSON.parse(configRaw);
185
+ printBrand();
186
+ print(" Starting agents...\n");
187
+ if (config.agents.length === 0) {
188
+ print(" \x1b[33m!\x1b[0m No agents configured. Add one with:");
189
+ print(" openscout add agent --name <name>\n");
190
+ return;
191
+ }
192
+ for (const name of config.agents) {
193
+ const agentPath = path.join(cwd, ".openscout", "agents", `${name}.json`);
194
+ try {
195
+ const raw = await fs.readFile(agentPath, "utf-8");
196
+ const agent = JSON.parse(raw);
197
+ print(` \x1b[32m●\x1b[0m ${agent.name} \x1b[2m— ${agent.description || agent.instructions}\x1b[0m`);
198
+ }
199
+ catch {
200
+ print(` \x1b[33m○\x1b[0m ${name} \x1b[2m— config not found\x1b[0m`);
201
+ }
202
+ }
203
+ print("\n \x1b[2mAgent runtime coming soon.\x1b[0m\n");
204
+ }
205
+ // Route
206
+ switch (command) {
207
+ case "init":
208
+ init();
209
+ break;
210
+ case "add":
211
+ add();
212
+ break;
213
+ case "run":
214
+ run();
215
+ break;
216
+ case "list":
217
+ case "ls":
218
+ list();
219
+ break;
220
+ case "--version":
221
+ case "-v":
222
+ print(VERSION);
223
+ break;
224
+ case "--help":
225
+ case "-h":
226
+ case undefined:
227
+ help();
228
+ break;
229
+ default:
230
+ print(`\n \x1b[31m✗\x1b[0m Unknown command: ${command}\n`);
231
+ help();
232
+ process.exit(1);
233
+ }
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "openscout",
3
+ "version": "0.1.0",
4
+ "description": "Agent-forward development platform for builders",
5
+ "type": "module",
6
+ "bin": {
7
+ "openscout": "./dist/cli.js"
8
+ },
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "scripts": {
13
+ "build": "tsc",
14
+ "dev": "tsc --watch",
15
+ "prepublishOnly": "tsc"
16
+ },
17
+ "keywords": [
18
+ "agents",
19
+ "ai",
20
+ "development",
21
+ "cli",
22
+ "local-first"
23
+ ],
24
+ "author": "Arach Tchoupani",
25
+ "license": "MIT",
26
+ "devDependencies": {
27
+ "@types/node": "^22",
28
+ "typescript": "^5"
29
+ }
30
+ }