tycono 0.1.95-beta.2 → 0.1.96-beta.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 (2) hide show
  1. package/bin/tycono.ts +63 -0
  2. package/package.json +7 -1
package/bin/tycono.ts CHANGED
@@ -20,6 +20,8 @@ function printHelp(): void {
20
20
 
21
21
  Usage:
22
22
  tycono [path] Start the server (optionally point to a company directory)
23
+ tycono tui Start API server + TUI mode
24
+ tycono tui --attach Connect TUI to existing API server
23
25
  tycono --help Show this help message
24
26
  tycono --version Show version
25
27
 
@@ -27,6 +29,8 @@ function printHelp(): void {
27
29
  tycono Start in current directory
28
30
  tycono ./my-company Start with existing company folder
29
31
  tycono /path/to/akb Start with absolute path
32
+ tycono tui Start with terminal UI
33
+ PORT=3000 tycono tui --attach Attach TUI to running server
30
34
 
31
35
  AI Engine (auto-detected):
32
36
  1. Claude Code CLI Install from https://claude.ai/download (recommended)
@@ -190,6 +194,49 @@ async function startServer(): Promise<void> {
190
194
  process.on('SIGTERM', shutdown);
191
195
  }
192
196
 
197
+ async function startServerForTui(): Promise<void> {
198
+ // Load .env from current directory
199
+ const dotenvPath = path.resolve(process.cwd(), '.env');
200
+ if (fs.existsSync(dotenvPath)) {
201
+ const { config } = await import('dotenv');
202
+ config({ path: dotenvPath });
203
+ }
204
+
205
+ if (!process.env.COMPANY_ROOT) {
206
+ process.env.COMPANY_ROOT = process.cwd();
207
+ }
208
+
209
+ process.env.NODE_ENV = 'production';
210
+ const auth = detectAuth();
211
+ process.env.EXECUTION_ENGINE = auth.engine === 'claude-cli' ? 'claude-cli' : auth.engine === 'direct-api' ? 'direct-api' : 'none';
212
+
213
+ const port = process.env.PORT ? Number(process.env.PORT) : await findFreePort();
214
+ process.env.PORT = String(port);
215
+
216
+ const { createHttpServer } = await import('../src/api/src/create-server.js');
217
+ const server = createHttpServer();
218
+
219
+ const host = process.env.HOST || '0.0.0.0';
220
+
221
+ await new Promise<void>((resolve) => {
222
+ server.listen(port, host, () => resolve());
223
+ });
224
+
225
+ console.log(` API server started on port ${port}`);
226
+
227
+ // Graceful shutdown
228
+ const shutdown = () => {
229
+ server.close(() => process.exit(0));
230
+ setTimeout(() => process.exit(1), 5000);
231
+ };
232
+ process.on('SIGINT', shutdown);
233
+ process.on('SIGTERM', shutdown);
234
+
235
+ // Start TUI
236
+ const { startTui } = await import('../src/tui/index.tsx');
237
+ await startTui({ port });
238
+ }
239
+
193
240
  export async function main(args: string[]): Promise<void> {
194
241
  const command = args[0];
195
242
 
@@ -203,6 +250,22 @@ export async function main(args: string[]): Promise<void> {
203
250
  return;
204
251
  }
205
252
 
253
+ // tui subcommand: start API server + TUI mode
254
+ if (command === 'tui') {
255
+ const attachMode = args.includes('--attach');
256
+ // If --attach, skip server start — just connect to existing API
257
+ if (attachMode) {
258
+ const port = process.env.PORT ? Number(process.env.PORT) : 3000;
259
+ const { startTui } = await import('../src/tui/index.tsx');
260
+ await startTui({ port });
261
+ return;
262
+ }
263
+
264
+ // Start API server, then TUI
265
+ await startServerForTui();
266
+ return;
267
+ }
268
+
206
269
  if (command && !command.startsWith('-')) {
207
270
  // Treat as path to company directory
208
271
  const resolved = path.resolve(command);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tycono",
3
- "version": "0.1.95-beta.2",
3
+ "version": "0.1.96-beta.0",
4
4
  "description": "Build an AI company. Watch them work.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -36,7 +36,12 @@
36
36
  "express": "^5.0.1",
37
37
  "glob": "^11.0.1",
38
38
  "gray-matter": "^4.0.3",
39
+ "ink": "^5.2.1",
40
+ "ink-select-input": "^6.2.0",
41
+ "ink-spinner": "^5.0.0",
42
+ "ink-text-input": "^6.0.0",
39
43
  "marked": "^15.0.6",
44
+ "react": "^18.3.1",
40
45
  "tsx": "^4.19.3",
41
46
  "tyconoforge": "^0.1.0-beta.0",
42
47
  "yaml": "^2.7.0"
@@ -45,6 +50,7 @@
45
50
  "@types/cors": "^2.8.17",
46
51
  "@types/express": "^5.0.0",
47
52
  "@types/node": "^22.13.4",
53
+ "@types/react": "^19.2.14",
48
54
  "tsup": "^8.5.1",
49
55
  "typescript": "^5.7.3"
50
56
  },