@townco/cli 0.1.45 → 0.1.46

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.
@@ -66,8 +66,6 @@ function CreateApp({ name: initialName, model: initialModel, tools: initialTools
66
66
  return "model";
67
67
  if (!initialTools || initialTools.length === 0)
68
68
  return "tools";
69
- if (!initialSystemPrompt)
70
- return "systemPrompt";
71
69
  return "review";
72
70
  };
73
71
  const [stage, setStage] = useState(determineInitialStage());
@@ -75,43 +73,14 @@ function CreateApp({ name: initialName, model: initialModel, tools: initialTools
75
73
  name: initialName || "",
76
74
  model: initialModel || "",
77
75
  tools: initialTools ? [...initialTools] : [],
78
- systemPrompt: initialSystemPrompt || "",
76
+ systemPrompt: initialSystemPrompt || "You are a helpful assistant.",
79
77
  });
80
78
  const [nameInput, setNameInput] = useState(initialName || "");
81
- const [systemPromptInput, setSystemPromptInput] = useState(initialSystemPrompt || "");
82
- const [isEditingPrompt, setIsEditingPrompt] = useState(false);
83
- const [promptEditMode, setPromptEditMode] = useState(null);
84
79
  const [reviewSelection, setReviewSelection] = useState(null);
85
80
  const [isEditingFromReview, setIsEditingFromReview] = useState(false);
86
81
  const [scaffoldStatus, setScaffoldStatus] = useState("pending");
87
82
  const [scaffoldError, setScaffoldError] = useState(null);
88
83
  const [agentPath, setAgentPath] = useState(null);
89
- // Handle opening editor when systemPrompt stage is entered from review
90
- useEffect(() => {
91
- (async () => {
92
- if (stage === "systemPrompt" &&
93
- isEditingFromReview &&
94
- !isEditingPrompt &&
95
- promptEditMode === null) {
96
- // Trigger editor opening
97
- setIsEditingPrompt(true);
98
- const editorContent = await openInEditor(agentDef.systemPrompt || "You are a helpful assistant.");
99
- if (editorContent !== null) {
100
- // Editor worked
101
- setAgentDef({ ...agentDef, systemPrompt: editorContent });
102
- setIsEditingPrompt(false);
103
- setIsEditingFromReview(false);
104
- setStage("review");
105
- }
106
- else {
107
- // Fallback to inline
108
- setPromptEditMode("inline");
109
- setIsEditingPrompt(false);
110
- setSystemPromptInput(agentDef.systemPrompt || "You are a helpful assistant.");
111
- }
112
- }
113
- })();
114
- }, [stage, isEditingFromReview, isEditingPrompt, promptEditMode, agentDef]);
115
84
  // Handle scaffolding when entering "done" stage
116
85
  useEffect(() => {
117
86
  if (stage === "done" && scaffoldStatus === "pending") {
@@ -126,7 +95,7 @@ function CreateApp({ name: initialName, model: initialModel, tools: initialTools
126
95
  const model = agentDef.model;
127
96
  const definition = {
128
97
  model,
129
- systemPrompt: agentDef.systemPrompt || null,
98
+ systemPrompt: agentDef.systemPrompt || "You are a helpful assistant.",
130
99
  tools: agentDef.tools || [],
131
100
  hooks: [
132
101
  {
@@ -197,62 +166,15 @@ function CreateApp({ name: initialName, model: initialModel, tools: initialTools
197
166
  }
198
167
  // Tools selection stage
199
168
  if (stage === "tools") {
200
- return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { marginBottom: 1, children: _jsxs(Text, { bold: true, children: ["Select tools for agent: ", agentDef.name] }) }), _jsx(MultiSelect, { options: AVAILABLE_TOOLS, selected: agentDef.tools || [], onChange: (tools) => setAgentDef({ ...agentDef, tools }), onSubmit: async () => {
169
+ return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { marginBottom: 1, children: _jsxs(Text, { bold: true, children: ["Select tools for agent: ", agentDef.name] }) }), _jsx(MultiSelect, { options: AVAILABLE_TOOLS, selected: agentDef.tools || [], onChange: (tools) => setAgentDef({ ...agentDef, tools }), onSubmit: () => {
201
170
  // If editing from review, just go back to review
202
171
  if (isEditingFromReview) {
203
172
  setIsEditingFromReview(false);
204
- setStage("review");
205
- return;
206
- }
207
- // If systemPrompt was provided via flag, skip to review
208
- if (initialSystemPrompt) {
209
- setStage("review");
210
- return;
211
- }
212
- setStage("systemPrompt");
213
- // Attempt to open editor
214
- setIsEditingPrompt(true);
215
- const editorContent = await openInEditor(agentDef.systemPrompt || "You are a helpful assistant.");
216
- if (editorContent !== null) {
217
- // Editor worked
218
- setAgentDef({ ...agentDef, systemPrompt: editorContent });
219
- setIsEditingPrompt(false);
220
- setStage("review");
221
- }
222
- else {
223
- // Fallback to inline
224
- setPromptEditMode("inline");
225
- setIsEditingPrompt(false);
226
- setSystemPromptInput(agentDef.systemPrompt || "You are a helpful assistant.");
227
173
  }
174
+ // Go directly to review stage
175
+ setStage("review");
228
176
  }, onCancel: () => setStage("model") })] }));
229
177
  }
230
- // System prompt stage (inline fallback)
231
- if (stage === "systemPrompt") {
232
- if (isEditingPrompt) {
233
- return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { bold: true, children: "Opening editor for system prompt..." }) }), _jsx(Text, { dimColor: true, children: "You can edit the system prompt in your preferred editor." })] }));
234
- }
235
- if (promptEditMode === "inline") {
236
- return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { bold: true, children: "Enter system prompt (multi-line supported):" }) }), _jsx(InputBox, { value: systemPromptInput, onChange: setSystemPromptInput, onSubmit: () => {
237
- setAgentDef({ ...agentDef, systemPrompt: systemPromptInput });
238
- if (isEditingFromReview) {
239
- setIsEditingFromReview(false);
240
- setPromptEditMode(null);
241
- }
242
- setStage("review");
243
- }, onEscape: () => {
244
- if (isEditingFromReview) {
245
- setIsEditingFromReview(false);
246
- setPromptEditMode(null);
247
- setStage("review");
248
- }
249
- else {
250
- setStage("tools");
251
- }
252
- }, isSubmitting: false, attachedFiles: [] }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "Enter: Continue \u2022 Esc: Back" }) })] }));
253
- }
254
- return null;
255
- }
256
178
  // Review stage
257
179
  if (stage === "review") {
258
180
  return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { bold: true, children: "Review Agent Configuration:" }) }), _jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsxs(Text, { children: [_jsx(Text, { bold: true, children: "Name: " }), agentDef.name] }), _jsxs(Text, { children: [_jsx(Text, { bold: true, children: "Model: " }), agentDef.model] }), _jsxs(Text, { children: [_jsx(Text, { bold: true, children: "Tools: " }), agentDef.tools && agentDef.tools.length > 0
@@ -278,11 +200,6 @@ function CreateApp({ name: initialName, model: initialModel, tools: initialTools
278
200
  value: "tools",
279
201
  description: "Go back and change tool selection",
280
202
  },
281
- {
282
- label: "Edit system prompt",
283
- value: "systemPrompt",
284
- description: "Go back and change the system prompt",
285
- },
286
203
  ], selected: reviewSelection, onChange: (value) => {
287
204
  setReviewSelection(value);
288
205
  }, onSubmit: (value) => {
@@ -293,8 +210,7 @@ function CreateApp({ name: initialName, model: initialModel, tools: initialTools
293
210
  }
294
211
  else if (value === "name" ||
295
212
  value === "model" ||
296
- value === "tools" ||
297
- value === "systemPrompt") {
213
+ value === "tools") {
298
214
  // Set flag so we return to review after editing
299
215
  setIsEditingFromReview(true);
300
216
  setStage(value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@townco/cli",
3
- "version": "0.1.45",
3
+ "version": "0.1.46",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "town": "./dist/index.js"
@@ -15,17 +15,17 @@
15
15
  "build": "tsc"
16
16
  },
17
17
  "devDependencies": {
18
- "@townco/tsconfig": "0.1.37",
18
+ "@townco/tsconfig": "0.1.38",
19
19
  "@types/bun": "^1.3.1",
20
20
  "@types/react": "^19.2.2"
21
21
  },
22
22
  "dependencies": {
23
23
  "@optique/core": "^0.6.2",
24
24
  "@optique/run": "^0.6.2",
25
- "@townco/agent": "0.1.45",
26
- "@townco/core": "0.0.18",
27
- "@townco/secret": "0.1.40",
28
- "@townco/ui": "0.1.40",
25
+ "@townco/agent": "0.1.46",
26
+ "@townco/core": "0.0.19",
27
+ "@townco/secret": "0.1.41",
28
+ "@townco/ui": "0.1.41",
29
29
  "@types/inquirer": "^9.0.9",
30
30
  "ink": "^6.4.0",
31
31
  "ink-text-input": "^6.0.0",