wiggum-cli 0.7.8 → 0.9.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.
- package/dist/ai/conversation/conversation-manager.d.ts +11 -0
- package/dist/ai/conversation/conversation-manager.d.ts.map +1 -1
- package/dist/ai/conversation/conversation-manager.js +14 -0
- package/dist/ai/conversation/conversation-manager.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +4 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/new.d.ts +2 -0
- package/dist/commands/new.d.ts.map +1 -1
- package/dist/commands/new.js +63 -22
- package/dist/commands/new.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +97 -22
- package/dist/index.js.map +1 -1
- package/dist/tui/app.d.ts +108 -0
- package/dist/tui/app.d.ts.map +1 -0
- package/dist/tui/app.js +169 -0
- package/dist/tui/app.js.map +1 -0
- package/dist/tui/components/ChatInput.d.ts +40 -0
- package/dist/tui/components/ChatInput.d.ts.map +1 -0
- package/dist/tui/components/ChatInput.js +61 -0
- package/dist/tui/components/ChatInput.js.map +1 -0
- package/dist/tui/components/MessageList.d.ts +79 -0
- package/dist/tui/components/MessageList.d.ts.map +1 -0
- package/dist/tui/components/MessageList.js +68 -0
- package/dist/tui/components/MessageList.js.map +1 -0
- package/dist/tui/components/PhaseHeader.d.ts +36 -0
- package/dist/tui/components/PhaseHeader.d.ts.map +1 -0
- package/dist/tui/components/PhaseHeader.js +31 -0
- package/dist/tui/components/PhaseHeader.js.map +1 -0
- package/dist/tui/components/StreamingText.d.ts +47 -0
- package/dist/tui/components/StreamingText.d.ts.map +1 -0
- package/dist/tui/components/StreamingText.js +38 -0
- package/dist/tui/components/StreamingText.js.map +1 -0
- package/dist/tui/components/ToolCallCard.d.ts +65 -0
- package/dist/tui/components/ToolCallCard.d.ts.map +1 -0
- package/dist/tui/components/ToolCallCard.js +100 -0
- package/dist/tui/components/ToolCallCard.js.map +1 -0
- package/dist/tui/components/WiggumBanner.d.ts +30 -0
- package/dist/tui/components/WiggumBanner.d.ts.map +1 -0
- package/dist/tui/components/WiggumBanner.js +34 -0
- package/dist/tui/components/WiggumBanner.js.map +1 -0
- package/dist/tui/components/WorkingIndicator.d.ts +45 -0
- package/dist/tui/components/WorkingIndicator.d.ts.map +1 -0
- package/dist/tui/components/WorkingIndicator.js +31 -0
- package/dist/tui/components/WorkingIndicator.js.map +1 -0
- package/dist/tui/components/index.d.ts +16 -0
- package/dist/tui/components/index.d.ts.map +1 -0
- package/dist/tui/components/index.js +10 -0
- package/dist/tui/components/index.js.map +1 -0
- package/dist/tui/demo.d.ts +8 -0
- package/dist/tui/demo.d.ts.map +1 -0
- package/dist/tui/demo.js +69 -0
- package/dist/tui/demo.js.map +1 -0
- package/dist/tui/hooks/index.d.ts +7 -0
- package/dist/tui/hooks/index.d.ts.map +1 -0
- package/dist/tui/hooks/index.js +6 -0
- package/dist/tui/hooks/index.js.map +1 -0
- package/dist/tui/hooks/useSpecGenerator.d.ts +184 -0
- package/dist/tui/hooks/useSpecGenerator.d.ts.map +1 -0
- package/dist/tui/hooks/useSpecGenerator.js +452 -0
- package/dist/tui/hooks/useSpecGenerator.js.map +1 -0
- package/dist/tui/index.d.ts +14 -0
- package/dist/tui/index.d.ts.map +1 -0
- package/dist/tui/index.js +18 -0
- package/dist/tui/index.js.map +1 -0
- package/dist/tui/orchestration/index.d.ts +6 -0
- package/dist/tui/orchestration/index.d.ts.map +1 -0
- package/dist/tui/orchestration/index.js +6 -0
- package/dist/tui/orchestration/index.js.map +1 -0
- package/dist/tui/orchestration/interview-orchestrator.d.ts +136 -0
- package/dist/tui/orchestration/interview-orchestrator.d.ts.map +1 -0
- package/dist/tui/orchestration/interview-orchestrator.js +437 -0
- package/dist/tui/orchestration/interview-orchestrator.js.map +1 -0
- package/dist/tui/screens/InitScreen.d.ts +26 -0
- package/dist/tui/screens/InitScreen.d.ts.map +1 -0
- package/dist/tui/screens/InitScreen.js +30 -0
- package/dist/tui/screens/InitScreen.js.map +1 -0
- package/dist/tui/screens/InterviewScreen.d.ts +44 -0
- package/dist/tui/screens/InterviewScreen.d.ts.map +1 -0
- package/dist/tui/screens/InterviewScreen.js +212 -0
- package/dist/tui/screens/InterviewScreen.js.map +1 -0
- package/dist/tui/screens/MainShell.d.ts +46 -0
- package/dist/tui/screens/MainShell.d.ts.map +1 -0
- package/dist/tui/screens/MainShell.js +196 -0
- package/dist/tui/screens/MainShell.js.map +1 -0
- package/dist/tui/screens/WelcomeScreen.d.ts +45 -0
- package/dist/tui/screens/WelcomeScreen.d.ts.map +1 -0
- package/dist/tui/screens/WelcomeScreen.js +56 -0
- package/dist/tui/screens/WelcomeScreen.js.map +1 -0
- package/dist/tui/screens/index.d.ts +6 -0
- package/dist/tui/screens/index.d.ts.map +1 -0
- package/dist/tui/screens/index.js +5 -0
- package/dist/tui/screens/index.js.map +1 -0
- package/dist/tui/theme.d.ts +66 -0
- package/dist/tui/theme.d.ts.map +1 -0
- package/dist/tui/theme.js +62 -0
- package/dist/tui/theme.js.map +1 -0
- package/package.json +6 -1
- package/src/ai/conversation/conversation-manager.ts +22 -0
- package/src/cli.ts +4 -0
- package/src/commands/new.ts +79 -27
- package/src/index.ts +109 -27
- package/src/tui/app.tsx +297 -0
- package/src/tui/components/ChatInput.tsx +105 -0
- package/src/tui/components/MessageList.tsx +186 -0
- package/src/tui/components/PhaseHeader.tsx +63 -0
- package/src/tui/components/StreamingText.tsx +69 -0
- package/src/tui/components/ToolCallCard.tsx +215 -0
- package/src/tui/components/WiggumBanner.tsx +66 -0
- package/src/tui/components/WorkingIndicator.tsx +72 -0
- package/src/tui/components/index.ts +21 -0
- package/src/tui/demo.tsx +111 -0
- package/src/tui/hooks/index.ts +13 -0
- package/src/tui/hooks/useSpecGenerator.ts +662 -0
- package/src/tui/index.ts +23 -0
- package/src/tui/orchestration/index.ts +10 -0
- package/src/tui/orchestration/interview-orchestrator.ts +559 -0
- package/src/tui/screens/InitScreen.tsx +63 -0
- package/src/tui/screens/InterviewScreen.tsx +319 -0
- package/src/tui/screens/MainShell.tsx +290 -0
- package/src/tui/screens/WelcomeScreen.tsx +141 -0
- package/src/tui/screens/index.ts +6 -0
- package/src/tui/theme.ts +76 -0
- package/tsconfig.json +2 -1
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useSpecGenerator - Event-based SpecGenerator wrapper for React/Ink TUI
|
|
3
|
+
*
|
|
4
|
+
* Wraps the existing SpecGenerator to emit events and manage state:
|
|
5
|
+
* - phase_change -> update PhaseHeader
|
|
6
|
+
* - tool_start / tool_end -> show ToolCallCard
|
|
7
|
+
* - text_delta -> stream to StreamingText
|
|
8
|
+
* - question -> prompt user input
|
|
9
|
+
* - done -> complete flow
|
|
10
|
+
*/
|
|
11
|
+
import type { Message, ToolCall } from '../components/MessageList.js';
|
|
12
|
+
/**
|
|
13
|
+
* Generator phases matching SpecGenerator
|
|
14
|
+
*/
|
|
15
|
+
export type GeneratorPhase = 'context' | 'goals' | 'interview' | 'generation' | 'complete';
|
|
16
|
+
/**
|
|
17
|
+
* Phase configuration for display
|
|
18
|
+
*/
|
|
19
|
+
export interface PhaseConfig {
|
|
20
|
+
/** Phase number (1-based) */
|
|
21
|
+
number: number;
|
|
22
|
+
/** Human-readable phase name */
|
|
23
|
+
name: string;
|
|
24
|
+
/** Description of what happens in this phase */
|
|
25
|
+
description: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Phase configurations for display
|
|
29
|
+
*/
|
|
30
|
+
export declare const PHASE_CONFIGS: Record<GeneratorPhase, PhaseConfig>;
|
|
31
|
+
/**
|
|
32
|
+
* Total number of display phases (excludes 'complete' in progress bar)
|
|
33
|
+
*/
|
|
34
|
+
export declare const TOTAL_DISPLAY_PHASES = 4;
|
|
35
|
+
/**
|
|
36
|
+
* State managed by the useSpecGenerator hook
|
|
37
|
+
*/
|
|
38
|
+
export interface SpecGeneratorState {
|
|
39
|
+
/** Current phase of the generation process */
|
|
40
|
+
phase: GeneratorPhase;
|
|
41
|
+
/** Conversation history for MessageList */
|
|
42
|
+
messages: Message[];
|
|
43
|
+
/** Whether the AI is currently working (thinking/executing) */
|
|
44
|
+
isWorking: boolean;
|
|
45
|
+
/** Status message for working indicator ("Thinking...", "Reading files...", etc.) */
|
|
46
|
+
workingStatus: string;
|
|
47
|
+
/** Current AI question waiting for user answer */
|
|
48
|
+
currentQuestion: string;
|
|
49
|
+
/** Whether waiting for user input */
|
|
50
|
+
awaitingInput: boolean;
|
|
51
|
+
/** Final generated spec when done */
|
|
52
|
+
generatedSpec: string | null;
|
|
53
|
+
/** Error message if something went wrong */
|
|
54
|
+
error: string | null;
|
|
55
|
+
/** Number of interview questions completed */
|
|
56
|
+
questionCount: number;
|
|
57
|
+
/** References added during context phase */
|
|
58
|
+
references: Array<{
|
|
59
|
+
source: string;
|
|
60
|
+
content: string;
|
|
61
|
+
}>;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Options for initializing the spec generator
|
|
65
|
+
*/
|
|
66
|
+
export interface SpecGeneratorOptions {
|
|
67
|
+
/** Name of the feature being specified */
|
|
68
|
+
featureName: string;
|
|
69
|
+
/** Project root directory path */
|
|
70
|
+
projectRoot: string;
|
|
71
|
+
/** AI provider to use */
|
|
72
|
+
provider?: string;
|
|
73
|
+
/** Model ID to use */
|
|
74
|
+
model?: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Return value from useSpecGenerator hook
|
|
78
|
+
*/
|
|
79
|
+
export interface UseSpecGeneratorReturn {
|
|
80
|
+
/** Current state */
|
|
81
|
+
state: SpecGeneratorState;
|
|
82
|
+
/**
|
|
83
|
+
* Submit user's answer to the current question
|
|
84
|
+
* Used during interview phase
|
|
85
|
+
*/
|
|
86
|
+
submitAnswer: (answer: string) => Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* Add a reference URL or file path during context phase
|
|
89
|
+
*/
|
|
90
|
+
addReference: (refUrl: string) => Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Skip context/interview and go directly to generation
|
|
93
|
+
*/
|
|
94
|
+
skipToGeneration: () => Promise<void>;
|
|
95
|
+
/**
|
|
96
|
+
* Move to the next phase
|
|
97
|
+
*/
|
|
98
|
+
advancePhase: () => void;
|
|
99
|
+
/**
|
|
100
|
+
* Reset to initial state
|
|
101
|
+
*/
|
|
102
|
+
reset: () => void;
|
|
103
|
+
/**
|
|
104
|
+
* Initialize the generator with options
|
|
105
|
+
*/
|
|
106
|
+
initialize: (options: SpecGeneratorOptions) => void;
|
|
107
|
+
/**
|
|
108
|
+
* Add a message to the conversation
|
|
109
|
+
*/
|
|
110
|
+
addMessage: (role: 'user' | 'assistant' | 'system', content: string, toolCalls?: ToolCall[]) => void;
|
|
111
|
+
/**
|
|
112
|
+
* Update the streaming message content
|
|
113
|
+
*/
|
|
114
|
+
updateStreamingMessage: (content: string) => void;
|
|
115
|
+
/**
|
|
116
|
+
* Mark the current streaming message as complete
|
|
117
|
+
*/
|
|
118
|
+
completeStreamingMessage: () => void;
|
|
119
|
+
/**
|
|
120
|
+
* Clear working state and re-enable input
|
|
121
|
+
* Call this when AI response is complete and ready for next user input
|
|
122
|
+
*/
|
|
123
|
+
setReady: () => void;
|
|
124
|
+
/**
|
|
125
|
+
* Start a tool execution (shows ToolCallCard)
|
|
126
|
+
*/
|
|
127
|
+
startToolCall: (toolName: string, input: Record<string, unknown>) => string;
|
|
128
|
+
/**
|
|
129
|
+
* Complete a tool execution
|
|
130
|
+
*/
|
|
131
|
+
completeToolCall: (toolId: string, output?: string, error?: string) => void;
|
|
132
|
+
/**
|
|
133
|
+
* Set the current phase (used by orchestrator)
|
|
134
|
+
*/
|
|
135
|
+
setPhase: (phase: GeneratorPhase) => void;
|
|
136
|
+
/**
|
|
137
|
+
* Set the generated spec (used by orchestrator on completion)
|
|
138
|
+
*/
|
|
139
|
+
setGeneratedSpec: (spec: string) => void;
|
|
140
|
+
/**
|
|
141
|
+
* Set an error state (used by orchestrator on error)
|
|
142
|
+
*/
|
|
143
|
+
setError: (error: string) => void;
|
|
144
|
+
/**
|
|
145
|
+
* Set working state with status message (used by orchestrator)
|
|
146
|
+
*/
|
|
147
|
+
setWorking: (isWorking: boolean, status: string) => void;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* useSpecGenerator - React hook wrapping SpecGenerator for TUI use
|
|
151
|
+
*
|
|
152
|
+
* This hook manages the state and provides actions for running the
|
|
153
|
+
* spec generation flow in a React/Ink application.
|
|
154
|
+
*
|
|
155
|
+
* The hook does not directly instantiate SpecGenerator; instead, it
|
|
156
|
+
* provides the state management and action handlers that a screen
|
|
157
|
+
* component can use to orchestrate the flow.
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```tsx
|
|
161
|
+
* function SpecGeneratorScreen({ featureName }: Props) {
|
|
162
|
+
* const { state, submitAnswer, addReference, initialize } = useSpecGenerator();
|
|
163
|
+
*
|
|
164
|
+
* useEffect(() => {
|
|
165
|
+
* initialize({ featureName, projectRoot: process.cwd() });
|
|
166
|
+
* }, []);
|
|
167
|
+
*
|
|
168
|
+
* return (
|
|
169
|
+
* <Box flexDirection="column">
|
|
170
|
+
* <PhaseHeader
|
|
171
|
+
* currentPhase={PHASE_CONFIGS[state.phase].number}
|
|
172
|
+
* totalPhases={TOTAL_DISPLAY_PHASES}
|
|
173
|
+
* phaseName={PHASE_CONFIGS[state.phase].name}
|
|
174
|
+
* />
|
|
175
|
+
* <MessageList messages={state.messages} />
|
|
176
|
+
* {state.isWorking && <WorkingIndicator state="thinking" status={state.workingStatus} />}
|
|
177
|
+
* {state.awaitingInput && <ChatInput onSubmit={submitAnswer} />}
|
|
178
|
+
* </Box>
|
|
179
|
+
* );
|
|
180
|
+
* }
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
183
|
+
export declare function useSpecGenerator(): UseSpecGeneratorReturn;
|
|
184
|
+
//# sourceMappingURL=useSpecGenerator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSpecGenerator.d.ts","sourceRoot":"","sources":["../../../src/tui/hooks/useSpecGenerator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAGtE;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,OAAO,GAAG,WAAW,GAAG,YAAY,GAAG,UAAU,CAAC;AAE3F;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,gDAAgD;IAChD,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,cAAc,EAAE,WAAW,CA0B7D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAEtC;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,8CAA8C;IAC9C,KAAK,EAAE,cAAc,CAAC;IACtB,2CAA2C;IAC3C,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,+DAA+D;IAC/D,SAAS,EAAE,OAAO,CAAC;IACnB,qFAAqF;IACrF,aAAa,EAAE,MAAM,CAAC;IACtB,kDAAkD;IAClD,eAAe,EAAE,MAAM,CAAC;IACxB,qCAAqC;IACrC,aAAa,EAAE,OAAO,CAAC;IACvB,qCAAqC;IACrC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,4CAA4C;IAC5C,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,8CAA8C;IAC9C,aAAa,EAAE,MAAM,CAAC;IACtB,4CAA4C;IAC5C,UAAU,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM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AM,CAAC;IAE5E;;OAEG;IACH,gBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAI5E;;OAEG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IAE1C;;OAEG;IACH,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAEzC;;OAEG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAElC;;OAEG;IACH,UAAU,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1D;AA+CD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,gBAAgB,IAAI,sBAAsB,CA0XzD"}
|
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useSpecGenerator - Event-based SpecGenerator wrapper for React/Ink TUI
|
|
3
|
+
*
|
|
4
|
+
* Wraps the existing SpecGenerator to emit events and manage state:
|
|
5
|
+
* - phase_change -> update PhaseHeader
|
|
6
|
+
* - tool_start / tool_end -> show ToolCallCard
|
|
7
|
+
* - text_delta -> stream to StreamingText
|
|
8
|
+
* - question -> prompt user input
|
|
9
|
+
* - done -> complete flow
|
|
10
|
+
*/
|
|
11
|
+
import { useState, useCallback, useRef } from 'react';
|
|
12
|
+
/**
|
|
13
|
+
* Phase configurations for display
|
|
14
|
+
*/
|
|
15
|
+
export const PHASE_CONFIGS = {
|
|
16
|
+
context: {
|
|
17
|
+
number: 1,
|
|
18
|
+
name: 'Context',
|
|
19
|
+
description: 'Share reference URLs or files',
|
|
20
|
+
},
|
|
21
|
+
goals: {
|
|
22
|
+
number: 2,
|
|
23
|
+
name: 'Goals',
|
|
24
|
+
description: 'Describe what you want to build',
|
|
25
|
+
},
|
|
26
|
+
interview: {
|
|
27
|
+
number: 3,
|
|
28
|
+
name: 'Interview',
|
|
29
|
+
description: 'Answer clarifying questions',
|
|
30
|
+
},
|
|
31
|
+
generation: {
|
|
32
|
+
number: 4,
|
|
33
|
+
name: 'Generation',
|
|
34
|
+
description: 'Generate specification',
|
|
35
|
+
},
|
|
36
|
+
complete: {
|
|
37
|
+
number: 5,
|
|
38
|
+
name: 'Complete',
|
|
39
|
+
description: 'Spec generated',
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Total number of display phases (excludes 'complete' in progress bar)
|
|
44
|
+
*/
|
|
45
|
+
export const TOTAL_DISPLAY_PHASES = 4;
|
|
46
|
+
/**
|
|
47
|
+
* Generate a unique ID for messages and tool calls
|
|
48
|
+
*/
|
|
49
|
+
function generateId() {
|
|
50
|
+
return `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Format tool input for display
|
|
54
|
+
*/
|
|
55
|
+
function formatToolInput(toolName, args) {
|
|
56
|
+
switch (toolName) {
|
|
57
|
+
case 'read_file':
|
|
58
|
+
return String(args.path || '');
|
|
59
|
+
case 'search_codebase':
|
|
60
|
+
return `"${args.pattern || ''}"${args.directory ? ` in ${args.directory}/` : ''}`;
|
|
61
|
+
case 'list_directory':
|
|
62
|
+
return String(args.path || '.');
|
|
63
|
+
case 'tavily_search':
|
|
64
|
+
return `"${args.query || ''}"`;
|
|
65
|
+
case 'resolveLibraryId':
|
|
66
|
+
return String(args.libraryName || '');
|
|
67
|
+
case 'queryDocs':
|
|
68
|
+
return `${args.libraryId} - "${String(args.query || '').slice(0, 40)}..."`;
|
|
69
|
+
default:
|
|
70
|
+
return JSON.stringify(args).slice(0, 50);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Initial state for the generator
|
|
75
|
+
*/
|
|
76
|
+
const initialState = {
|
|
77
|
+
phase: 'context',
|
|
78
|
+
messages: [],
|
|
79
|
+
isWorking: false,
|
|
80
|
+
workingStatus: '',
|
|
81
|
+
currentQuestion: '',
|
|
82
|
+
awaitingInput: false,
|
|
83
|
+
generatedSpec: null,
|
|
84
|
+
error: null,
|
|
85
|
+
questionCount: 0,
|
|
86
|
+
references: [],
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* useSpecGenerator - React hook wrapping SpecGenerator for TUI use
|
|
90
|
+
*
|
|
91
|
+
* This hook manages the state and provides actions for running the
|
|
92
|
+
* spec generation flow in a React/Ink application.
|
|
93
|
+
*
|
|
94
|
+
* The hook does not directly instantiate SpecGenerator; instead, it
|
|
95
|
+
* provides the state management and action handlers that a screen
|
|
96
|
+
* component can use to orchestrate the flow.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```tsx
|
|
100
|
+
* function SpecGeneratorScreen({ featureName }: Props) {
|
|
101
|
+
* const { state, submitAnswer, addReference, initialize } = useSpecGenerator();
|
|
102
|
+
*
|
|
103
|
+
* useEffect(() => {
|
|
104
|
+
* initialize({ featureName, projectRoot: process.cwd() });
|
|
105
|
+
* }, []);
|
|
106
|
+
*
|
|
107
|
+
* return (
|
|
108
|
+
* <Box flexDirection="column">
|
|
109
|
+
* <PhaseHeader
|
|
110
|
+
* currentPhase={PHASE_CONFIGS[state.phase].number}
|
|
111
|
+
* totalPhases={TOTAL_DISPLAY_PHASES}
|
|
112
|
+
* phaseName={PHASE_CONFIGS[state.phase].name}
|
|
113
|
+
* />
|
|
114
|
+
* <MessageList messages={state.messages} />
|
|
115
|
+
* {state.isWorking && <WorkingIndicator state="thinking" status={state.workingStatus} />}
|
|
116
|
+
* {state.awaitingInput && <ChatInput onSubmit={submitAnswer} />}
|
|
117
|
+
* </Box>
|
|
118
|
+
* );
|
|
119
|
+
* }
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
export function useSpecGenerator() {
|
|
123
|
+
const [state, setState] = useState(initialState);
|
|
124
|
+
// Track options for potential re-initialization
|
|
125
|
+
const optionsRef = useRef(null);
|
|
126
|
+
// Track current streaming message ID for updates
|
|
127
|
+
const streamingMessageIdRef = useRef(null);
|
|
128
|
+
// Track active tool calls by ID
|
|
129
|
+
const activeToolCallsRef = useRef(new Map());
|
|
130
|
+
/**
|
|
131
|
+
* Initialize with options
|
|
132
|
+
*/
|
|
133
|
+
const initialize = useCallback((options) => {
|
|
134
|
+
optionsRef.current = options;
|
|
135
|
+
// Add initial system message
|
|
136
|
+
const systemMessage = {
|
|
137
|
+
id: generateId(),
|
|
138
|
+
role: 'system',
|
|
139
|
+
content: `Spec Generator initialized for feature: ${options.featureName}`,
|
|
140
|
+
};
|
|
141
|
+
setState({
|
|
142
|
+
...initialState,
|
|
143
|
+
messages: [systemMessage],
|
|
144
|
+
// Enable input immediately so users can enter context/goals
|
|
145
|
+
awaitingInput: true,
|
|
146
|
+
});
|
|
147
|
+
}, []);
|
|
148
|
+
/**
|
|
149
|
+
* Add a message to the conversation
|
|
150
|
+
*/
|
|
151
|
+
const addMessage = useCallback((role, content, toolCalls) => {
|
|
152
|
+
const message = {
|
|
153
|
+
id: generateId(),
|
|
154
|
+
role,
|
|
155
|
+
content,
|
|
156
|
+
toolCalls,
|
|
157
|
+
};
|
|
158
|
+
setState((prev) => ({
|
|
159
|
+
...prev,
|
|
160
|
+
messages: [...prev.messages, message],
|
|
161
|
+
// Clear awaiting input when assistant responds
|
|
162
|
+
awaitingInput: role === 'assistant' ? false : prev.awaitingInput,
|
|
163
|
+
}));
|
|
164
|
+
}, []);
|
|
165
|
+
/**
|
|
166
|
+
* Add a streaming message (assistant) that will be updated
|
|
167
|
+
*/
|
|
168
|
+
const addStreamingMessage = useCallback((initialContent = '', toolCalls) => {
|
|
169
|
+
const messageId = generateId();
|
|
170
|
+
streamingMessageIdRef.current = messageId;
|
|
171
|
+
const message = {
|
|
172
|
+
id: messageId,
|
|
173
|
+
role: 'assistant',
|
|
174
|
+
content: initialContent,
|
|
175
|
+
toolCalls,
|
|
176
|
+
isStreaming: true,
|
|
177
|
+
};
|
|
178
|
+
setState((prev) => ({
|
|
179
|
+
...prev,
|
|
180
|
+
messages: [...prev.messages, message],
|
|
181
|
+
}));
|
|
182
|
+
return messageId;
|
|
183
|
+
}, []);
|
|
184
|
+
/**
|
|
185
|
+
* Update the streaming message content
|
|
186
|
+
*/
|
|
187
|
+
const updateStreamingMessage = useCallback((content) => {
|
|
188
|
+
const messageId = streamingMessageIdRef.current;
|
|
189
|
+
if (!messageId)
|
|
190
|
+
return;
|
|
191
|
+
setState((prev) => ({
|
|
192
|
+
...prev,
|
|
193
|
+
messages: prev.messages.map((msg) => msg.id === messageId ? { ...msg, content } : msg),
|
|
194
|
+
}));
|
|
195
|
+
}, []);
|
|
196
|
+
/**
|
|
197
|
+
* Mark the current streaming message as complete
|
|
198
|
+
*/
|
|
199
|
+
const completeStreamingMessage = useCallback(() => {
|
|
200
|
+
const messageId = streamingMessageIdRef.current;
|
|
201
|
+
if (!messageId)
|
|
202
|
+
return;
|
|
203
|
+
setState((prev) => ({
|
|
204
|
+
...prev,
|
|
205
|
+
messages: prev.messages.map((msg) => msg.id === messageId ? { ...msg, isStreaming: false } : msg),
|
|
206
|
+
}));
|
|
207
|
+
streamingMessageIdRef.current = null;
|
|
208
|
+
}, []);
|
|
209
|
+
/**
|
|
210
|
+
* Clear working state and re-enable input
|
|
211
|
+
* Call this when AI response is complete and ready for next user input
|
|
212
|
+
*/
|
|
213
|
+
const setReady = useCallback(() => {
|
|
214
|
+
setState((prev) => ({
|
|
215
|
+
...prev,
|
|
216
|
+
isWorking: false,
|
|
217
|
+
workingStatus: '',
|
|
218
|
+
awaitingInput: true,
|
|
219
|
+
}));
|
|
220
|
+
}, []);
|
|
221
|
+
/**
|
|
222
|
+
* Start a tool execution
|
|
223
|
+
*/
|
|
224
|
+
const startToolCall = useCallback((toolName, input) => {
|
|
225
|
+
const toolId = generateId();
|
|
226
|
+
const formattedInput = formatToolInput(toolName, input);
|
|
227
|
+
const toolCall = {
|
|
228
|
+
toolName,
|
|
229
|
+
status: 'running',
|
|
230
|
+
input: formattedInput,
|
|
231
|
+
};
|
|
232
|
+
// If there's a streaming message, add tool call to it
|
|
233
|
+
// Otherwise, create a new assistant message with the tool call
|
|
234
|
+
setState((prev) => {
|
|
235
|
+
const streamingId = streamingMessageIdRef.current;
|
|
236
|
+
if (streamingId) {
|
|
237
|
+
// Add to existing streaming message
|
|
238
|
+
const updatedMessages = prev.messages.map((msg) => {
|
|
239
|
+
if (msg.id === streamingId) {
|
|
240
|
+
const existingToolCalls = msg.toolCalls || [];
|
|
241
|
+
activeToolCallsRef.current.set(toolId, {
|
|
242
|
+
messageId: streamingId,
|
|
243
|
+
index: existingToolCalls.length,
|
|
244
|
+
});
|
|
245
|
+
return {
|
|
246
|
+
...msg,
|
|
247
|
+
toolCalls: [...existingToolCalls, toolCall],
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
return msg;
|
|
251
|
+
});
|
|
252
|
+
return { ...prev, messages: updatedMessages };
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
// Create new message with tool call
|
|
256
|
+
const messageId = generateId();
|
|
257
|
+
streamingMessageIdRef.current = messageId;
|
|
258
|
+
activeToolCallsRef.current.set(toolId, {
|
|
259
|
+
messageId,
|
|
260
|
+
index: 0,
|
|
261
|
+
});
|
|
262
|
+
const newMessage = {
|
|
263
|
+
id: messageId,
|
|
264
|
+
role: 'assistant',
|
|
265
|
+
content: '',
|
|
266
|
+
toolCalls: [toolCall],
|
|
267
|
+
isStreaming: true,
|
|
268
|
+
};
|
|
269
|
+
return {
|
|
270
|
+
...prev,
|
|
271
|
+
messages: [...prev.messages, newMessage],
|
|
272
|
+
isWorking: true,
|
|
273
|
+
workingStatus: `Using ${toolName}...`,
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
return toolId;
|
|
278
|
+
}, []);
|
|
279
|
+
/**
|
|
280
|
+
* Complete a tool execution
|
|
281
|
+
*/
|
|
282
|
+
const completeToolCall = useCallback((toolId, output, error) => {
|
|
283
|
+
const toolInfo = activeToolCallsRef.current.get(toolId);
|
|
284
|
+
if (!toolInfo)
|
|
285
|
+
return;
|
|
286
|
+
const newStatus = error ? 'error' : 'complete';
|
|
287
|
+
setState((prev) => ({
|
|
288
|
+
...prev,
|
|
289
|
+
messages: prev.messages.map((msg) => {
|
|
290
|
+
if (msg.id === toolInfo.messageId && msg.toolCalls) {
|
|
291
|
+
const updatedToolCalls = [...msg.toolCalls];
|
|
292
|
+
if (updatedToolCalls[toolInfo.index]) {
|
|
293
|
+
updatedToolCalls[toolInfo.index] = {
|
|
294
|
+
...updatedToolCalls[toolInfo.index],
|
|
295
|
+
status: newStatus,
|
|
296
|
+
output,
|
|
297
|
+
error,
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
return { ...msg, toolCalls: updatedToolCalls };
|
|
301
|
+
}
|
|
302
|
+
return msg;
|
|
303
|
+
}),
|
|
304
|
+
}));
|
|
305
|
+
activeToolCallsRef.current.delete(toolId);
|
|
306
|
+
}, []);
|
|
307
|
+
/**
|
|
308
|
+
* Advance to the next phase
|
|
309
|
+
*/
|
|
310
|
+
const advancePhase = useCallback(() => {
|
|
311
|
+
setState((prev) => {
|
|
312
|
+
const phaseOrder = ['context', 'goals', 'interview', 'generation', 'complete'];
|
|
313
|
+
const currentIndex = phaseOrder.indexOf(prev.phase);
|
|
314
|
+
const nextPhase = phaseOrder[currentIndex + 1] || 'complete';
|
|
315
|
+
// Add system message for phase change
|
|
316
|
+
const phaseConfig = PHASE_CONFIGS[nextPhase];
|
|
317
|
+
const systemMessage = {
|
|
318
|
+
id: generateId(),
|
|
319
|
+
role: 'system',
|
|
320
|
+
content: `Phase ${phaseConfig.number}: ${phaseConfig.name} - ${phaseConfig.description}`,
|
|
321
|
+
};
|
|
322
|
+
return {
|
|
323
|
+
...prev,
|
|
324
|
+
phase: nextPhase,
|
|
325
|
+
messages: [...prev.messages, systemMessage],
|
|
326
|
+
awaitingInput: nextPhase === 'context' || nextPhase === 'goals' || nextPhase === 'interview',
|
|
327
|
+
};
|
|
328
|
+
});
|
|
329
|
+
}, []);
|
|
330
|
+
/**
|
|
331
|
+
* Submit user's answer
|
|
332
|
+
*/
|
|
333
|
+
const submitAnswer = useCallback(async (answer) => {
|
|
334
|
+
// Add user message
|
|
335
|
+
addMessage('user', answer);
|
|
336
|
+
// Update state
|
|
337
|
+
setState((prev) => ({
|
|
338
|
+
...prev,
|
|
339
|
+
awaitingInput: false,
|
|
340
|
+
isWorking: true,
|
|
341
|
+
workingStatus: 'Thinking...',
|
|
342
|
+
questionCount: prev.phase === 'interview' ? prev.questionCount + 1 : prev.questionCount,
|
|
343
|
+
}));
|
|
344
|
+
// The actual AI processing would be handled by the screen component
|
|
345
|
+
// that orchestrates the SpecGenerator or conversation manager
|
|
346
|
+
}, [addMessage]);
|
|
347
|
+
/**
|
|
348
|
+
* Add a reference during context phase
|
|
349
|
+
*/
|
|
350
|
+
const addReference = useCallback(async (refUrl) => {
|
|
351
|
+
// Add user message showing the reference
|
|
352
|
+
addMessage('user', refUrl);
|
|
353
|
+
setState((prev) => ({
|
|
354
|
+
...prev,
|
|
355
|
+
isWorking: true,
|
|
356
|
+
workingStatus: 'Fetching reference...',
|
|
357
|
+
}));
|
|
358
|
+
// The actual fetching would be handled by the screen component
|
|
359
|
+
}, [addMessage]);
|
|
360
|
+
/**
|
|
361
|
+
* Skip to generation phase
|
|
362
|
+
*/
|
|
363
|
+
const skipToGeneration = useCallback(async () => {
|
|
364
|
+
setState((prev) => {
|
|
365
|
+
const systemMessage = {
|
|
366
|
+
id: generateId(),
|
|
367
|
+
role: 'system',
|
|
368
|
+
content: 'Skipping to specification generation...',
|
|
369
|
+
};
|
|
370
|
+
return {
|
|
371
|
+
...prev,
|
|
372
|
+
phase: 'generation',
|
|
373
|
+
messages: [...prev.messages, systemMessage],
|
|
374
|
+
awaitingInput: false,
|
|
375
|
+
isWorking: true,
|
|
376
|
+
workingStatus: 'Generating specification...',
|
|
377
|
+
};
|
|
378
|
+
});
|
|
379
|
+
}, []);
|
|
380
|
+
/**
|
|
381
|
+
* Reset to initial state
|
|
382
|
+
*/
|
|
383
|
+
const reset = useCallback(() => {
|
|
384
|
+
streamingMessageIdRef.current = null;
|
|
385
|
+
activeToolCallsRef.current.clear();
|
|
386
|
+
optionsRef.current = null;
|
|
387
|
+
setState(initialState);
|
|
388
|
+
}, []);
|
|
389
|
+
/**
|
|
390
|
+
* Set the current phase (used by orchestrator)
|
|
391
|
+
*/
|
|
392
|
+
const setPhase = useCallback((phase) => {
|
|
393
|
+
setState((prev) => ({
|
|
394
|
+
...prev,
|
|
395
|
+
phase,
|
|
396
|
+
}));
|
|
397
|
+
}, []);
|
|
398
|
+
/**
|
|
399
|
+
* Set the generated spec (used by orchestrator on completion)
|
|
400
|
+
*/
|
|
401
|
+
const setGeneratedSpec = useCallback((spec) => {
|
|
402
|
+
setState((prev) => ({
|
|
403
|
+
...prev,
|
|
404
|
+
generatedSpec: spec,
|
|
405
|
+
phase: 'complete',
|
|
406
|
+
isWorking: false,
|
|
407
|
+
awaitingInput: false,
|
|
408
|
+
}));
|
|
409
|
+
}, []);
|
|
410
|
+
/**
|
|
411
|
+
* Set an error state (used by orchestrator on error)
|
|
412
|
+
*/
|
|
413
|
+
const setError = useCallback((error) => {
|
|
414
|
+
setState((prev) => ({
|
|
415
|
+
...prev,
|
|
416
|
+
error,
|
|
417
|
+
isWorking: false,
|
|
418
|
+
}));
|
|
419
|
+
}, []);
|
|
420
|
+
/**
|
|
421
|
+
* Set working state with status message (used by orchestrator)
|
|
422
|
+
*/
|
|
423
|
+
const setWorking = useCallback((isWorking, status) => {
|
|
424
|
+
setState((prev) => ({
|
|
425
|
+
...prev,
|
|
426
|
+
isWorking,
|
|
427
|
+
workingStatus: status,
|
|
428
|
+
awaitingInput: !isWorking && prev.phase !== 'complete',
|
|
429
|
+
}));
|
|
430
|
+
}, []);
|
|
431
|
+
return {
|
|
432
|
+
state,
|
|
433
|
+
submitAnswer,
|
|
434
|
+
addReference,
|
|
435
|
+
skipToGeneration,
|
|
436
|
+
advancePhase,
|
|
437
|
+
reset,
|
|
438
|
+
initialize,
|
|
439
|
+
addMessage,
|
|
440
|
+
updateStreamingMessage,
|
|
441
|
+
completeStreamingMessage,
|
|
442
|
+
setReady,
|
|
443
|
+
startToolCall,
|
|
444
|
+
completeToolCall,
|
|
445
|
+
// Orchestrator-specific actions
|
|
446
|
+
setPhase,
|
|
447
|
+
setGeneratedSpec,
|
|
448
|
+
setError,
|
|
449
|
+
setWorking,
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
//# sourceMappingURL=useSpecGenerator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSpecGenerator.js","sourceRoot":"","sources":["../../../src/tui/hooks/useSpecGenerator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAqBtD;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAwC;IAChE,OAAO,EAAE;QACP,MAAM,EAAE,CAAC;QACT,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,+BAA+B;KAC7C;IACD,KAAK,EAAE;QACL,MAAM,EAAE,CAAC;QACT,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,iCAAiC;KAC/C;IACD,SAAS,EAAE;QACT,MAAM,EAAE,CAAC;QACT,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,6BAA6B;KAC3C;IACD,UAAU,EAAE;QACV,MAAM,EAAE,CAAC;QACT,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,wBAAwB;KACtC;IACD,QAAQ,EAAE;QACR,MAAM,EAAE,CAAC;QACT,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,gBAAgB;KAC9B;CACF,CAAC;AAEF;;GAEG;AACH,MAA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AC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACL,KAAK;QACL,YAAY;QACZ,YAAY;QACZ,gBAAgB;QAChB,YAAY;QACZ,KAAK;QACL,UAAU;QACV,UAAU;QACV,sBAAsB;QACtB,wBAAwB;QACxB,QAAQ;QACR,aAAa;QACb,gBAAgB;QAChB,gCAAgC;QAChC,QAAQ;QACR,gBAAgB;QAChB,QAAQ;QACR,UAAU;KACX,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ink-based Terminal UI for Wiggum CLI
|
|
3
|
+
*
|
|
4
|
+
* This module provides React-based terminal UI components using Ink.
|
|
5
|
+
* It exports the main App component, all screens, reusable components,
|
|
6
|
+
* hooks, and theme utilities.
|
|
7
|
+
*/
|
|
8
|
+
export { App, renderApp } from './app.js';
|
|
9
|
+
export type { AppProps, AppScreen, InterviewAppProps } from './app.js';
|
|
10
|
+
export * from './theme.js';
|
|
11
|
+
export * from './components/index.js';
|
|
12
|
+
export * from './hooks/index.js';
|
|
13
|
+
export * from './screens/index.js';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tui/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAGvE,cAAc,YAAY,CAAC;AAG3B,cAAc,uBAAuB,CAAC;AAGtC,cAAc,kBAAkB,CAAC;AAGjC,cAAc,oBAAoB,CAAC"}
|