@townco/cli 0.1.4 → 0.1.6

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/package.json CHANGED
@@ -1,9 +1,7 @@
1
1
  {
2
2
  "name": "@townco/cli",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "type": "module",
5
- "main": "./dist/index.js",
6
- "types": "./dist/index.d.ts",
7
5
  "bin": {
8
6
  "townco": "./dist/index.js"
9
7
  },
@@ -16,33 +14,29 @@
16
14
  "type": "git",
17
15
  "url": "git+https://github.com/federicoweber/agent_hub.git"
18
16
  },
19
- "author": "Federico Weber",
20
- "engines": {
21
- "bun": ">=1.3.0"
22
- },
23
17
  "scripts": {
24
18
  "check": "tsc --noEmit",
25
19
  "build": "tsc"
26
20
  },
27
- "peerDependencies": {
28
- "react": ">=19.0.0"
29
- },
30
21
  "devDependencies": {
31
- "@townco/tsconfig": "^0.1.0",
22
+ "@townco/tsconfig": "0.1.3",
32
23
  "@types/bun": "^1.3.1",
33
- "@types/react": "^19.2.2",
34
- "react": "^19.2.0"
24
+ "@types/react": "^19.2.2"
35
25
  },
36
26
  "dependencies": {
37
27
  "@optique/core": "^0.6.2",
38
28
  "@optique/run": "^0.6.2",
39
- "@townco/secret": "^0.1.0",
40
- "@townco/ui": "^0.1.0",
41
- "@townco/agent": "^0.1.0",
29
+ "@townco/agent": "0.1.6",
30
+ "@townco/secret": "0.1.6",
31
+ "@townco/ui": "0.1.6",
42
32
  "@types/inquirer": "^9.0.9",
43
33
  "ink": "^6.4.0",
44
34
  "ink-text-input": "^6.0.0",
45
35
  "inquirer": "^12.10.0",
36
+ "open": "^10.2.0",
46
37
  "ts-pattern": "^5.9.0"
38
+ },
39
+ "peerDependencies": {
40
+ "react": ">=19.0.0"
47
41
  }
48
42
  }
package/tui/App.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import type { CliConfig } from "./cli.js";
2
2
  export interface AppProps {
3
- config: CliConfig;
3
+ config: CliConfig;
4
4
  }
5
- export declare function App({ config }: AppProps): import("react/jsx-runtime").JSX.Element;
5
+ export declare function App({
6
+ config,
7
+ }: AppProps): import("react/jsx-runtime").JSX.Element;
package/tui/App.js CHANGED
@@ -1,28 +1,41 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
1
  import { AcpClient } from "@townco/ui";
3
2
  import { ChatView } from "@townco/ui/tui";
4
3
  import { Box, Text } from "ink";
5
4
  import { useMemo } from "react";
5
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
6
  export function App({ config }) {
7
- // Create ACP client
8
- const client = useMemo(() => {
9
- try {
10
- const newClient = new AcpClient({
11
- type: "stdio",
12
- options: {
13
- agentPath: config.agentPath,
14
- workingDirectory: config.workingDir ?? process.cwd(),
15
- },
16
- });
17
- return newClient;
18
- }
19
- catch (error) {
20
- console.error("Failed to create client:", error);
21
- return null;
22
- }
23
- }, [config.agentPath, config.workingDir]);
24
- if (!client) {
25
- return (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsx(Text, { color: "red", bold: true, children: "Error: Failed to create ACP client" }), _jsx(Text, { color: "gray", children: "Please check your agent path and try again." })] }));
26
- }
27
- return _jsx(ChatView, { client: client });
7
+ // Create ACP client
8
+ const client = useMemo(() => {
9
+ try {
10
+ const newClient = new AcpClient({
11
+ type: "stdio",
12
+ options: {
13
+ agentPath: config.agentPath,
14
+ workingDirectory: config.workingDir ?? process.cwd(),
15
+ },
16
+ });
17
+ return newClient;
18
+ } catch (error) {
19
+ console.error("Failed to create client:", error);
20
+ return null;
21
+ }
22
+ }, [config.agentPath, config.workingDir]);
23
+ if (!client) {
24
+ return _jsxs(Box, {
25
+ flexDirection: "column",
26
+ padding: 1,
27
+ children: [
28
+ _jsx(Text, {
29
+ color: "red",
30
+ bold: true,
31
+ children: "Error: Failed to create ACP client",
32
+ }),
33
+ _jsx(Text, {
34
+ color: "gray",
35
+ children: "Please check your agent path and try again.",
36
+ }),
37
+ ],
38
+ });
39
+ }
40
+ return _jsx(ChatView, { client: client });
28
41
  }
package/tui/cli.d.ts CHANGED
@@ -2,11 +2,24 @@ import type { InferValue } from "@optique/core/parser";
2
2
  /**
3
3
  * CLI configuration using Optique
4
4
  */
5
- export declare const cliParser: import("@optique/core/parser").Parser<{
5
+ export declare const cliParser: import("@optique/core/parser").Parser<
6
+ {
6
7
  readonly agentPath: string;
7
8
  readonly workingDir: string | undefined;
8
- }, {
9
- readonly agentPath: import("@optique/core/valueparser").ValueParserResult<string> | undefined;
10
- readonly workingDir: [[import("@optique/core/valueparser").ValueParserResult<string> | undefined] | undefined] | undefined;
11
- }>;
9
+ },
10
+ {
11
+ readonly agentPath:
12
+ | import("@optique/core/valueparser").ValueParserResult<string>
13
+ | undefined;
14
+ readonly workingDir:
15
+ | [
16
+ | [
17
+ | import("@optique/core/valueparser").ValueParserResult<string>
18
+ | undefined,
19
+ ]
20
+ | undefined,
21
+ ]
22
+ | undefined;
23
+ }
24
+ >;
12
25
  export type CliConfig = InferValue<typeof cliParser>;
package/tui/cli.js CHANGED
@@ -5,10 +5,15 @@ import { string } from "@optique/core/valueparser";
5
5
  * CLI configuration using Optique
6
6
  */
7
7
  export const cliParser = object({
8
- agentPath: option("-a", "--agent", string(), {
9
- description: [text("Path to the ACP agent executable")],
10
- }),
11
- workingDir: withDefault(optional(option("-d", "--dir", string(), {
12
- description: [text("Working directory for the agent")],
13
- })), process.cwd()),
8
+ agentPath: option("-a", "--agent", string(), {
9
+ description: [text("Path to the ACP agent executable")],
10
+ }),
11
+ workingDir: withDefault(
12
+ optional(
13
+ option("-d", "--dir", string(), {
14
+ description: [text("Working directory for the agent")],
15
+ }),
16
+ ),
17
+ process.cwd(),
18
+ ),
14
19
  });
package/tui/index.js CHANGED
@@ -1,30 +1,31 @@
1
1
  #!/usr/bin/env node
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
2
  import { run } from "@optique/run";
4
3
  import { render } from "ink";
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
5
  import { App } from "./App.js";
6
6
  import { cliParser } from "./cli.js";
7
+
7
8
  /**
8
9
  * Agent Hub TUI
9
10
  * Terminal chat interface for ACP agents
10
11
  */
11
12
  async function main() {
12
- // Parse CLI arguments
13
- const config = run(cliParser, {
14
- help: "both", // Show help for both commands and the program
15
- programName: "agent-tui",
16
- description: [
17
- {
18
- type: "text",
19
- text: "Terminal chat interface for Agent Client Protocol (ACP) agents",
20
- },
21
- ],
22
- version: "0.0.1",
23
- });
24
- // Render the app
25
- render(_jsx(App, { config: config }));
13
+ // Parse CLI arguments
14
+ const config = run(cliParser, {
15
+ help: "both", // Show help for both commands and the program
16
+ programName: "agent-tui",
17
+ description: [
18
+ {
19
+ type: "text",
20
+ text: "Terminal chat interface for Agent Client Protocol (ACP) agents",
21
+ },
22
+ ],
23
+ version: "0.0.1",
24
+ });
25
+ // Render the app
26
+ render(_jsx(App, { config: config }));
26
27
  }
27
28
  main().catch((error) => {
28
- console.error("Fatal error:", error);
29
- process.exit(1);
29
+ console.error("Fatal error:", error);
30
+ process.exit(1);
30
31
  });