@townco/cli 0.1.115 → 0.1.117
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.
|
@@ -5,6 +5,7 @@ declare const _default: {
|
|
|
5
5
|
readonly model: string | undefined;
|
|
6
6
|
readonly tools: readonly string[];
|
|
7
7
|
readonly systemPrompt: string | undefined;
|
|
8
|
+
readonly mcps: string | undefined;
|
|
8
9
|
readonly init: string | undefined;
|
|
9
10
|
readonly claude: true | undefined;
|
|
10
11
|
readonly yes: true | undefined;
|
|
@@ -14,6 +15,7 @@ declare const _default: {
|
|
|
14
15
|
readonly model: [import("@optique/core").ValueParserResult<string> | undefined] | undefined;
|
|
15
16
|
readonly tools: readonly (import("@optique/core").ValueParserResult<string> | undefined)[];
|
|
16
17
|
readonly systemPrompt: [import("@optique/core").ValueParserResult<string> | undefined] | undefined;
|
|
18
|
+
readonly mcps: [import("@optique/core").ValueParserResult<string> | undefined] | undefined;
|
|
17
19
|
readonly init: [import("@optique/core").ValueParserResult<string> | undefined] | undefined;
|
|
18
20
|
readonly claude: [import("@optique/core").ValueParserResult<true> | undefined] | undefined;
|
|
19
21
|
readonly yes: [import("@optique/core").ValueParserResult<true> | undefined] | undefined;
|
|
@@ -24,6 +26,7 @@ declare const _default: {
|
|
|
24
26
|
readonly model: string | undefined;
|
|
25
27
|
readonly tools: readonly string[];
|
|
26
28
|
readonly systemPrompt: string | undefined;
|
|
29
|
+
readonly mcps: string | undefined;
|
|
27
30
|
readonly init: string | undefined;
|
|
28
31
|
readonly claude: true | undefined;
|
|
29
32
|
readonly yes: true | undefined;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import { command, constant, flag, message, multiple, object, option, optional, string, } from "@optique/core";
|
|
3
|
+
import { McpConfigSchema } from "@townco/agent/definition";
|
|
3
4
|
import { initForClaudeCode } from "@townco/agent/scaffold";
|
|
4
5
|
import { isInsideTownProject } from "@townco/agent/storage";
|
|
5
6
|
import inquirer from "inquirer";
|
|
7
|
+
import { z } from "zod";
|
|
6
8
|
import { createCommand } from "../lib/command";
|
|
7
9
|
import { createCommand as createAgentCommand } from "./create";
|
|
8
10
|
import { createProjectCommand } from "./create-project";
|
|
@@ -13,13 +15,39 @@ export default createCommand({
|
|
|
13
15
|
model: optional(option("-m", "--model", string())),
|
|
14
16
|
tools: multiple(option("-t", "--tool", string())),
|
|
15
17
|
systemPrompt: optional(option("-p", "--prompt", string())),
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
mcps: optional(option("--mcps", string(), {
|
|
19
|
+
description: message `MCP servers configuration (JSON array)`,
|
|
20
|
+
})),
|
|
21
|
+
init: optional(option("--init", string(), {
|
|
22
|
+
description: message `Initialize a new project at the given path`,
|
|
23
|
+
})),
|
|
24
|
+
claude: optional(flag("--claude", {
|
|
25
|
+
description: message `Add Claude Code integration to existing project`,
|
|
26
|
+
})),
|
|
27
|
+
yes: optional(flag("-y", "--yes", {
|
|
28
|
+
description: message `Skip confirmation prompts`,
|
|
29
|
+
})),
|
|
19
30
|
}), {
|
|
20
|
-
brief: message `Create a new agent or project
|
|
31
|
+
brief: message `Create a new agent or project`,
|
|
21
32
|
}),
|
|
22
|
-
impl: async ({ name, model, tools, systemPrompt, init, claude, yes }) => {
|
|
33
|
+
impl: async ({ name, model, tools, systemPrompt, mcps: mcpsJson, init, claude, yes, }) => {
|
|
34
|
+
// Parse and validate MCPs if provided
|
|
35
|
+
let mcps;
|
|
36
|
+
if (mcpsJson) {
|
|
37
|
+
try {
|
|
38
|
+
const parsed = JSON.parse(mcpsJson);
|
|
39
|
+
mcps = z.array(McpConfigSchema).parse(parsed);
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
if (err instanceof z.ZodError) {
|
|
43
|
+
console.error("Invalid MCP configuration:", err.issues);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
console.error("Invalid JSON for --mcps:", err instanceof Error ? err.message : err);
|
|
47
|
+
}
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
23
51
|
// Handle --claude flag (initialize .claude in existing project)
|
|
24
52
|
if (claude === true) {
|
|
25
53
|
if (init !== null && init !== undefined) {
|
|
@@ -48,16 +76,20 @@ export default createCommand({
|
|
|
48
76
|
// Check if we're inside a Town project
|
|
49
77
|
const projectRoot = await isInsideTownProject();
|
|
50
78
|
if (projectRoot === null) {
|
|
51
|
-
// Not in a project -
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
79
|
+
// Not in a project - auto-initialize if --yes, otherwise prompt
|
|
80
|
+
let shouldInit = yes === true;
|
|
81
|
+
if (!shouldInit) {
|
|
82
|
+
const answer = await inquirer.prompt([
|
|
83
|
+
{
|
|
84
|
+
type: "confirm",
|
|
85
|
+
name: "initProject",
|
|
86
|
+
message: "Not inside a Town project. Initialize project in current directory?",
|
|
87
|
+
default: true,
|
|
88
|
+
},
|
|
89
|
+
]);
|
|
90
|
+
shouldInit = answer.initProject;
|
|
91
|
+
}
|
|
92
|
+
if (shouldInit) {
|
|
61
93
|
// Initialize project first
|
|
62
94
|
await createProjectCommand({ path: process.cwd() });
|
|
63
95
|
// Then create agent
|
|
@@ -66,6 +98,7 @@ export default createCommand({
|
|
|
66
98
|
...(model !== undefined && { model }),
|
|
67
99
|
...(tools.length > 0 && { tools }),
|
|
68
100
|
...(systemPrompt !== undefined && { systemPrompt }),
|
|
101
|
+
...(mcps !== undefined && { mcps }),
|
|
69
102
|
...(yes === true && { yes: true }),
|
|
70
103
|
agentsDir: join(process.cwd(), "agents"),
|
|
71
104
|
});
|
|
@@ -86,6 +119,7 @@ export default createCommand({
|
|
|
86
119
|
...(model !== undefined && { model }),
|
|
87
120
|
...(tools.length > 0 && { tools }),
|
|
88
121
|
...(systemPrompt !== undefined && { systemPrompt }),
|
|
122
|
+
...(mcps !== undefined && { mcps }),
|
|
89
123
|
...(yes === true && { yes: true }),
|
|
90
124
|
agentsDir: join(projectRoot, "agents"),
|
|
91
125
|
});
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import type { McpConfigSchema } from "@townco/agent/definition";
|
|
2
|
+
import type { z } from "zod";
|
|
3
|
+
type McpConfig = z.infer<typeof McpConfigSchema>;
|
|
1
4
|
interface CreateCommandProps {
|
|
2
5
|
name?: string;
|
|
3
6
|
model?: string;
|
|
4
7
|
tools?: readonly string[];
|
|
5
8
|
systemPrompt?: string;
|
|
9
|
+
mcps?: McpConfig[];
|
|
6
10
|
overwrite?: boolean;
|
|
7
11
|
yes?: boolean;
|
|
8
12
|
agentsDir: string;
|
package/dist/commands/create.js
CHANGED
|
@@ -70,7 +70,7 @@ function NameInput({ nameInput, setNameInput, onSubmit }) {
|
|
|
70
70
|
] }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "Enter: Continue \u2022 Esc: Cancel" }) })
|
|
71
71
|
] }));
|
|
72
72
|
}
|
|
73
|
-
function CreateApp({ name: initialName, model: initialModel, tools: initialTools, systemPrompt: initialSystemPrompt, overwrite = false, yes = false, agentsDir, }) {
|
|
73
|
+
function CreateApp({ name: initialName, model: initialModel, tools: initialTools, systemPrompt: initialSystemPrompt, mcps: initialMcps, overwrite = false, yes = false, agentsDir, }) {
|
|
74
74
|
// Determine the starting stage based on what's provided
|
|
75
75
|
const determineInitialStage = () => {
|
|
76
76
|
// If --yes flag is set and we have name and model, skip directly to done
|
|
@@ -114,6 +114,7 @@ function CreateApp({ name: initialName, model: initialModel, tools: initialTools
|
|
|
114
114
|
model,
|
|
115
115
|
systemPrompt: agentDef.systemPrompt || "You are a helpful assistant.",
|
|
116
116
|
tools: agentDef.tools || [],
|
|
117
|
+
...(initialMcps && initialMcps.length > 0 && { mcps: initialMcps }),
|
|
117
118
|
hooks: [
|
|
118
119
|
{
|
|
119
120
|
type: "tool_response",
|
|
@@ -160,7 +161,7 @@ function CreateApp({ name: initialName, model: initialModel, tools: initialTools
|
|
|
160
161
|
}
|
|
161
162
|
});
|
|
162
163
|
}
|
|
163
|
-
}, [stage, scaffoldStatus, agentDef, overwrite, agentsDir]);
|
|
164
|
+
}, [stage, scaffoldStatus, agentDef, overwrite, agentsDir, initialMcps]);
|
|
164
165
|
// Name stage
|
|
165
166
|
if (stage === "name") {
|
|
166
167
|
return (_jsx(NameInput, { nameInput: nameInput, setNameInput: setNameInput, onSubmit: () => {
|
package/dist/index.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@townco/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.117",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"town": "./dist/index.js"
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"build": "tsgo"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@townco/tsconfig": "0.1.
|
|
18
|
+
"@townco/tsconfig": "0.1.109",
|
|
19
19
|
"@types/archiver": "^7.0.0",
|
|
20
20
|
"@types/bun": "^1.3.1",
|
|
21
21
|
"@types/ignore-walk": "^4.0.3",
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@optique/core": "^0.6.2",
|
|
26
26
|
"@optique/run": "^0.6.2",
|
|
27
|
-
"@townco/agent": "0.1.
|
|
28
|
-
"@townco/apiclient": "0.0.
|
|
29
|
-
"@townco/core": "0.0.
|
|
30
|
-
"@townco/debugger": "0.1.
|
|
31
|
-
"@townco/env": "0.1.
|
|
32
|
-
"@townco/secret": "0.1.
|
|
33
|
-
"@townco/ui": "0.1.
|
|
27
|
+
"@townco/agent": "0.1.120",
|
|
28
|
+
"@townco/apiclient": "0.0.32",
|
|
29
|
+
"@townco/core": "0.0.90",
|
|
30
|
+
"@townco/debugger": "0.1.68",
|
|
31
|
+
"@townco/env": "0.1.62",
|
|
32
|
+
"@townco/secret": "0.1.112",
|
|
33
|
+
"@townco/ui": "0.1.112",
|
|
34
34
|
"@trpc/client": "^11.7.2",
|
|
35
35
|
"archiver": "^7.0.1",
|
|
36
36
|
"eventsource": "^4.1.0",
|
|
@@ -40,7 +40,8 @@
|
|
|
40
40
|
"inquirer": "^12.10.0",
|
|
41
41
|
"open": "^10.2.0",
|
|
42
42
|
"superjson": "^2.2.5",
|
|
43
|
-
"ts-pattern": "^5.9.0"
|
|
43
|
+
"ts-pattern": "^5.9.0",
|
|
44
|
+
"zod": "^4.1.12"
|
|
44
45
|
},
|
|
45
46
|
"peerDependencies": {
|
|
46
47
|
"react": ">=19.0.0"
|