@projectarachne/cli 0.1.0-beta.1
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/LICENSE +75 -0
- package/README.md +40 -0
- package/bin/arachne +2 -0
- package/bin/arachne.js +2 -0
- package/dist/arachne.d.ts +3 -0
- package/dist/arachne.d.ts.map +1 -0
- package/dist/arachne.js +4 -0
- package/dist/arachne.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +145 -0
- package/dist/index.js.map +1 -0
- package/dist/serve.d.ts +6 -0
- package/dist/serve.d.ts.map +1 -0
- package/dist/serve.js +83 -0
- package/dist/serve.js.map +1 -0
- package/dist/templates.d.ts +3 -0
- package/dist/templates.d.ts.map +1 -0
- package/dist/templates.js +22 -0
- package/dist/templates.js.map +1 -0
- package/dist/tui/App.d.ts +2 -0
- package/dist/tui/App.d.ts.map +1 -0
- package/dist/tui/App.js +1078 -0
- package/dist/tui/App.js.map +1 -0
- package/dist/tui/components/Box.d.ts +19 -0
- package/dist/tui/components/Box.d.ts.map +1 -0
- package/dist/tui/components/Box.js +9 -0
- package/dist/tui/components/Box.js.map +1 -0
- package/dist/tui/components/ChatInput.d.ts +12 -0
- package/dist/tui/components/ChatInput.d.ts.map +1 -0
- package/dist/tui/components/ChatInput.js +10 -0
- package/dist/tui/components/ChatInput.js.map +1 -0
- package/dist/tui/components/CommandInput.d.ts +15 -0
- package/dist/tui/components/CommandInput.d.ts.map +1 -0
- package/dist/tui/components/CommandInput.js +92 -0
- package/dist/tui/components/CommandInput.js.map +1 -0
- package/dist/tui/components/Content.d.ts +18 -0
- package/dist/tui/components/Content.d.ts.map +1 -0
- package/dist/tui/components/Content.js +22 -0
- package/dist/tui/components/Content.js.map +1 -0
- package/dist/tui/components/DagView.d.ts +8 -0
- package/dist/tui/components/DagView.d.ts.map +1 -0
- package/dist/tui/components/DagView.js +49 -0
- package/dist/tui/components/DagView.js.map +1 -0
- package/dist/tui/components/Footer.d.ts +9 -0
- package/dist/tui/components/Footer.d.ts.map +1 -0
- package/dist/tui/components/Footer.js +6 -0
- package/dist/tui/components/Footer.js.map +1 -0
- package/dist/tui/components/Frame.d.ts +6 -0
- package/dist/tui/components/Frame.d.ts.map +1 -0
- package/dist/tui/components/Frame.js +10 -0
- package/dist/tui/components/Frame.js.map +1 -0
- package/dist/tui/components/GoalInput.d.ts +10 -0
- package/dist/tui/components/GoalInput.d.ts.map +1 -0
- package/dist/tui/components/GoalInput.js +8 -0
- package/dist/tui/components/GoalInput.js.map +1 -0
- package/dist/tui/components/Header.d.ts +8 -0
- package/dist/tui/components/Header.d.ts.map +1 -0
- package/dist/tui/components/Header.js +8 -0
- package/dist/tui/components/Header.js.map +1 -0
- package/dist/tui/components/Help.d.ts +6 -0
- package/dist/tui/components/Help.d.ts.map +1 -0
- package/dist/tui/components/Help.js +8 -0
- package/dist/tui/components/Help.js.map +1 -0
- package/dist/tui/components/HomeView.d.ts +2 -0
- package/dist/tui/components/HomeView.d.ts.map +1 -0
- package/dist/tui/components/HomeView.js +8 -0
- package/dist/tui/components/HomeView.js.map +1 -0
- package/dist/tui/components/OutputView.d.ts +9 -0
- package/dist/tui/components/OutputView.d.ts.map +1 -0
- package/dist/tui/components/OutputView.js +40 -0
- package/dist/tui/components/OutputView.js.map +1 -0
- package/dist/tui/components/PlannerView.d.ts +17 -0
- package/dist/tui/components/PlannerView.d.ts.map +1 -0
- package/dist/tui/components/PlannerView.js +62 -0
- package/dist/tui/components/PlannerView.js.map +1 -0
- package/dist/tui/components/Settings.d.ts +6 -0
- package/dist/tui/components/Settings.d.ts.map +1 -0
- package/dist/tui/components/Settings.js +210 -0
- package/dist/tui/components/Settings.js.map +1 -0
- package/dist/tui/components/Sidebar.d.ts +12 -0
- package/dist/tui/components/Sidebar.d.ts.map +1 -0
- package/dist/tui/components/Sidebar.js +9 -0
- package/dist/tui/components/Sidebar.js.map +1 -0
- package/dist/tui/components/Splash.d.ts +7 -0
- package/dist/tui/components/Splash.d.ts.map +1 -0
- package/dist/tui/components/Splash.js +56 -0
- package/dist/tui/components/Splash.js.map +1 -0
- package/dist/tui/components/StepEditor.d.ts +13 -0
- package/dist/tui/components/StepEditor.d.ts.map +1 -0
- package/dist/tui/components/StepEditor.js +33 -0
- package/dist/tui/components/StepEditor.js.map +1 -0
- package/dist/tui/components/ThemeDesigner.d.ts +9 -0
- package/dist/tui/components/ThemeDesigner.d.ts.map +1 -0
- package/dist/tui/components/ThemeDesigner.js +45 -0
- package/dist/tui/components/ThemeDesigner.js.map +1 -0
- package/dist/tui/components/WorkflowPicker.d.ts +8 -0
- package/dist/tui/components/WorkflowPicker.d.ts.map +1 -0
- package/dist/tui/components/WorkflowPicker.js +11 -0
- package/dist/tui/components/WorkflowPicker.js.map +1 -0
- package/dist/tui/components/index.d.ts +20 -0
- package/dist/tui/components/index.d.ts.map +1 -0
- package/dist/tui/components/index.js +20 -0
- package/dist/tui/components/index.js.map +1 -0
- package/dist/tui/index.d.ts +2 -0
- package/dist/tui/index.d.ts.map +1 -0
- package/dist/tui/index.js +7 -0
- package/dist/tui/index.js.map +1 -0
- package/dist/tui/services/context.d.ts +11 -0
- package/dist/tui/services/context.d.ts.map +1 -0
- package/dist/tui/services/context.js +134 -0
- package/dist/tui/services/context.js.map +1 -0
- package/dist/tui/services/executor.d.ts +13 -0
- package/dist/tui/services/executor.d.ts.map +1 -0
- package/dist/tui/services/executor.js +186 -0
- package/dist/tui/services/executor.js.map +1 -0
- package/dist/tui/services/generateSteps.d.ts +7 -0
- package/dist/tui/services/generateSteps.d.ts.map +1 -0
- package/dist/tui/services/generateSteps.js +238 -0
- package/dist/tui/services/generateSteps.js.map +1 -0
- package/dist/tui/services/providers.d.ts +16 -0
- package/dist/tui/services/providers.d.ts.map +1 -0
- package/dist/tui/services/providers.js +246 -0
- package/dist/tui/services/providers.js.map +1 -0
- package/dist/tui/services/settings.d.ts +29 -0
- package/dist/tui/services/settings.d.ts.map +1 -0
- package/dist/tui/services/settings.js +107 -0
- package/dist/tui/services/settings.js.map +1 -0
- package/dist/tui/services/theme.d.ts +45 -0
- package/dist/tui/services/theme.d.ts.map +1 -0
- package/dist/tui/services/theme.js +205 -0
- package/dist/tui/services/theme.js.map +1 -0
- package/dist/tui/services/themeGenerator.d.ts +4 -0
- package/dist/tui/services/themeGenerator.d.ts.map +1 -0
- package/dist/tui/services/themeGenerator.js +93 -0
- package/dist/tui/services/themeGenerator.js.map +1 -0
- package/dist/tui/services/user.d.ts +3 -0
- package/dist/tui/services/user.d.ts.map +1 -0
- package/dist/tui/services/user.js +40 -0
- package/dist/tui/services/user.js.map +1 -0
- package/dist/tui/theme-context.d.ts +4 -0
- package/dist/tui/theme-context.d.ts.map +1 -0
- package/dist/tui/theme-context.js +6 -0
- package/dist/tui/theme-context.js.map +1 -0
- package/dist/tui/types.d.ts +81 -0
- package/dist/tui/types.d.ts.map +1 -0
- package/dist/tui/types.js +3 -0
- package/dist/tui/types.js.map +1 -0
- package/dist/tui.d.ts +2 -0
- package/dist/tui.d.ts.map +1 -0
- package/dist/tui.js +241 -0
- package/dist/tui.js.map +1 -0
- package/package.json +52 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
3
|
+
import { useTheme } from '../theme-context.js';
|
|
4
|
+
import TextInput from 'ink-text-input';
|
|
5
|
+
import SelectInput from 'ink-select-input';
|
|
6
|
+
export const StepEditor = ({ step, providers, editing, onPromptChange, onProviderSelect, onModelSelect, onEditingChange, }) => {
|
|
7
|
+
const theme = useTheme();
|
|
8
|
+
const availableProviders = providers.filter((p) => p.available && p.supportsAgentic);
|
|
9
|
+
const providerItems = availableProviders.map((p) => ({
|
|
10
|
+
label: p.displayName,
|
|
11
|
+
value: p.name,
|
|
12
|
+
}));
|
|
13
|
+
const currentProvider = providers.find((p) => p.name === step.provider);
|
|
14
|
+
const modelItems = currentProvider?.models.map((m) => ({
|
|
15
|
+
label: m.name,
|
|
16
|
+
value: m.id,
|
|
17
|
+
})) || [];
|
|
18
|
+
// Handle provider selection - auto-transition to model
|
|
19
|
+
const handleProviderSelect = (item) => {
|
|
20
|
+
onProviderSelect(item.value);
|
|
21
|
+
// Auto-transition to model selection
|
|
22
|
+
if (onEditingChange) {
|
|
23
|
+
setTimeout(() => onEditingChange('model'), 50);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
return (_jsxs(Box, { flexDirection: "column", paddingX: 1, children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: theme.colors.accent, bold: true, children: step.title || step.id }) }), _jsx(Box, { borderStyle: "single", borderColor: theme.colors.panel.border, marginBottom: 1 }), _jsxs(Box, { marginBottom: 1, children: [_jsx(Text, { color: theme.colors.muted, children: "Provider: " }), editing === 'provider' ? (_jsx(SelectInput, { items: providerItems, initialIndex: Math.max(0, providerItems.findIndex((i) => i.value === step.provider)), onSelect: handleProviderSelect })) : editing === 'model' && onModelSelect ? (_jsxs(_Fragment, { children: [_jsx(Text, { color: theme.colors.accent, children: currentProvider?.displayName || step.provider }), _jsx(Text, { color: theme.colors.muted, children: " / " }), _jsx(SelectInput, { items: modelItems, initialIndex: Math.max(0, modelItems.findIndex((i) => i.value === step.model)), onSelect: (item) => onModelSelect(item.value) })] })) : (_jsxs(_Fragment, { children: [_jsx(Text, { color: theme.colors.accent, children: currentProvider?.displayName || step.provider }), _jsx(Text, { color: theme.colors.muted, children: " / " }), _jsx(Text, { color: theme.colors.text, children: step.model || currentProvider?.defaultModel || 'default' })] }))] }), _jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: theme.colors.muted, children: "Prompt:" }) }), _jsx(Box, { borderStyle: "round", borderColor: editing === 'prompt' ? theme.colors.panel.borderFocus : theme.colors.panel.border, padding: 1, flexDirection: "column", height: 4, children: editing === 'prompt' ? (_jsx(TextInput, { value: step.prompt, onChange: onPromptChange, placeholder: "Enter prompt..." })) : ((() => {
|
|
27
|
+
const preview = step.prompt.replace(/\s+/g, ' ').trim();
|
|
28
|
+
return preview ? (_jsx(Text, { color: theme.colors.text, wrap: "truncate", children: preview })) : (_jsx(Text, { color: theme.colors.muted, dimColor: true, children: "No prompt defined. Press [E] to edit." }));
|
|
29
|
+
})()) }), !editing && (_jsx(Box, { marginTop: 1, children: _jsx(Text, { color: theme.colors.muted, dimColor: true, children: "Press [V] to view full prompt \u2022 [E] to edit" }) }))] }), step.output && (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsx(Text, { color: theme.colors.muted, children: "Output:" }), _jsx(Box, { borderStyle: "round", borderColor: theme.colors.success, padding: 1, marginTop: 1, children: _jsx(Text, { color: theme.colors.success, wrap: "wrap", children: step.output.length > 200
|
|
30
|
+
? step.output.slice(0, 200) + '...'
|
|
31
|
+
: step.output }) })] })), step.error && (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsx(Text, { color: theme.colors.danger, children: "Error:" }), _jsx(Box, { borderStyle: "round", borderColor: theme.colors.danger, padding: 1, marginTop: 1, children: _jsx(Text, { color: theme.colors.danger, wrap: "wrap", children: step.error }) })] }))] }));
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=StepEditor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StepEditor.js","sourceRoot":"","sources":["../../../src/tui/components/StepEditor.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAa3C,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EACzB,IAAI,EACJ,SAAS,EACT,OAAO,EACP,cAAc,EACd,gBAAgB,EAChB,aAAa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,EAAE,IAAI,EAAC,MAAM,YAC1C,IAAI,CAAC,KAAK,GACN,GACH,IACF,CACP,IACG,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ProviderName } from '../types.js';
|
|
2
|
+
interface ThemeDesignerProps {
|
|
3
|
+
provider: ProviderName;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
onSaved: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const ThemeDesigner: ({ provider, onClose, onSaved }: ThemeDesignerProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=ThemeDesigner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeDesigner.d.ts","sourceRoot":"","sources":["../../../src/tui/components/ThemeDesigner.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAKhD,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,eAAO,MAAM,aAAa,GAAI,gCAAgC,kBAAkB,4CAuF/E,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Box, Text, useInput } from 'ink';
|
|
4
|
+
import TextInput from 'ink-text-input';
|
|
5
|
+
import { useTheme } from '../theme-context.js';
|
|
6
|
+
import { generateThemeFromDescription } from '../services/themeGenerator.js';
|
|
7
|
+
import { getThemesDir } from '../services/theme.js';
|
|
8
|
+
export const ThemeDesigner = ({ provider, onClose, onSaved }) => {
|
|
9
|
+
const theme = useTheme();
|
|
10
|
+
const [description, setDescription] = useState('');
|
|
11
|
+
const [status, setStatus] = useState('');
|
|
12
|
+
const [error, setError] = useState(null);
|
|
13
|
+
const [isGenerating, setIsGenerating] = useState(false);
|
|
14
|
+
useInput((input, key) => {
|
|
15
|
+
if (key.escape && !isGenerating) {
|
|
16
|
+
onClose();
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (input.toLowerCase() === 'q' && !isGenerating) {
|
|
20
|
+
onClose();
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const handleSubmit = async () => {
|
|
24
|
+
if (!description.trim() || isGenerating)
|
|
25
|
+
return;
|
|
26
|
+
setIsGenerating(true);
|
|
27
|
+
setError(null);
|
|
28
|
+
setStatus('Generating theme...');
|
|
29
|
+
try {
|
|
30
|
+
await generateThemeFromDescription(description, provider, setStatus);
|
|
31
|
+
setStatus('Theme saved.');
|
|
32
|
+
onSaved();
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
36
|
+
setError(message);
|
|
37
|
+
setStatus('Failed to generate theme.');
|
|
38
|
+
}
|
|
39
|
+
finally {
|
|
40
|
+
setIsGenerating(false);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: theme.colors.panel.borderFocus, padding: 1, width: 70, children: [_jsxs(Box, { marginBottom: 1, justifyContent: "space-between", children: [_jsx(Text, { color: theme.colors.accent, bold: true, children: "Theme Studio" }), _jsx(Text, { color: theme.colors.muted, children: "[Esc] to close" })] }), _jsx(Text, { color: theme.colors.muted, children: "Describe a terminal theme. Arachne will generate a theme.json for you." }), _jsxs(Text, { color: theme.colors.muted, dimColor: true, children: ["Folder: ", getThemesDir()] }), _jsx(Box, { marginTop: 1, borderStyle: "round", borderColor: theme.colors.panel.border, paddingX: 1, children: _jsx(TextInput, { value: description, onChange: setDescription, onSubmit: handleSubmit, placeholder: "e.g., neon noir with teal highlights and warm warnings" }) }), _jsxs(Box, { marginTop: 1, children: [status && (_jsx(Text, { color: isGenerating ? theme.colors.warning : theme.colors.success, children: status })), error && (_jsx(Text, { color: theme.colors.danger, children: error }))] }), _jsx(Box, { marginTop: 1, children: _jsxs(Text, { color: theme.colors.muted, dimColor: true, children: ["Provider: ", provider, " \u2022 Enter to generate"] }) })] }));
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=ThemeDesigner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeDesigner.js","sourceRoot":"","sources":["../../../src/tui/components/ThemeDesigner.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC1C,OAAO,SAAS,MAAM,gBAAgB,CAAC;AAEvC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAQpD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAsB,EAAE,EAAE;IAClF,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IACnD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IACzC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IACxD,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAExD,QAAQ,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QACtB,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,YAAY,EAAE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KAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,+BAAuB,IAClD,EAEN,KAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,uFAExB,EACP,MAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,+BAC9B,YAAY,EAAE,IAClB,EAEP,KAAC,GAAG,IAAC,SAAS,EAAE,CAAC,EAAE,WAAW,EAAC,OAAO,EAAC,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,YACxF,KAAC,SAAS,IACR,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,cAAc,EACxB,QAAQ,EAAE,YAAY,EACtB,WAAW,EAAC,wDAAwD,GACpE,GACE,EAEN,MAAC,GAAG,IAAC,SAAS,EAAE,CAAC,aACd,MAAM,IAAI,CACT,KAAC,IAAI,IAAC,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,YACpE,MAAM,GACF,CACR,EACA,KAAK,IAAI,CACR,KAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,YAC7B,KAAK,GACD,CACR,IACG,EAEN,KAAC,GAAG,IAAC,SAAS,EAAE,CAAC,YACf,MAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,iCAC5B,QAAQ,iCACd,GACH,IACF,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { WorkflowFile } from '../types.js';
|
|
2
|
+
interface WorkflowPickerProps {
|
|
3
|
+
workflows: WorkflowFile[];
|
|
4
|
+
selectedIndex: number;
|
|
5
|
+
}
|
|
6
|
+
export declare const WorkflowPicker: ({ workflows, selectedIndex }: WorkflowPickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=WorkflowPicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkflowPicker.d.ts","sourceRoot":"","sources":["../../../src/tui/components/WorkflowPicker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,UAAU,mBAAmB;IAC3B,SAAS,EAAE,YAAY,EAAE,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,cAAc,GAAI,8BAA8B,mBAAmB,4CAoC/E,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
3
|
+
import { useTheme } from '../theme-context.js';
|
|
4
|
+
export const WorkflowPicker = ({ workflows, selectedIndex }) => {
|
|
5
|
+
const theme = useTheme();
|
|
6
|
+
return (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsx(Text, { color: theme.colors.accent, bold: true, children: "LOAD WORKFLOW" }), _jsx(Box, { marginTop: 1, flexDirection: "column", children: workflows.length === 0 ? (_jsx(Text, { color: theme.colors.muted, dimColor: true, children: "No workflow files found in this directory." })) : (workflows.map((wf, index) => {
|
|
7
|
+
const isSelected = index === selectedIndex;
|
|
8
|
+
return (_jsxs(Text, { color: isSelected ? theme.colors.accent : theme.colors.text, bold: isSelected, children: [isSelected ? '▶ ' : ' ', wf.name] }, wf.path));
|
|
9
|
+
})) }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: theme.colors.muted, dimColor: true, children: "\u2191\u2193 Navigate \u2022 Enter to load \u2022 Esc to cancel" }) })] }));
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=WorkflowPicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|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,IAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,sFAElC,GACH,IACF,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { Header } from './Header.js';
|
|
2
|
+
export { Footer } from './Footer.js';
|
|
3
|
+
export { Sidebar } from './Sidebar.js';
|
|
4
|
+
export { Content } from './Content.js';
|
|
5
|
+
export { DagView } from './DagView.js';
|
|
6
|
+
export { StepEditor } from './StepEditor.js';
|
|
7
|
+
export { OutputView } from './OutputView.js';
|
|
8
|
+
export { StyledBox, Section } from './Box.js';
|
|
9
|
+
export { GoalInput } from './GoalInput.js';
|
|
10
|
+
export { Splash } from './Splash.js';
|
|
11
|
+
export { CommandInput, COMMANDS } from './CommandInput.js';
|
|
12
|
+
export { Help } from './Help.js';
|
|
13
|
+
export { Settings } from './Settings.js';
|
|
14
|
+
export { HomeView } from './HomeView.js';
|
|
15
|
+
export { Frame } from './Frame.js';
|
|
16
|
+
export { ChatInput } from './ChatInput.js';
|
|
17
|
+
export { ThemeDesigner } from './ThemeDesigner.js';
|
|
18
|
+
export { WorkflowPicker } from './WorkflowPicker.js';
|
|
19
|
+
export { PlannerView } from './PlannerView.js';
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tui/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { Header } from './Header.js';
|
|
2
|
+
export { Footer } from './Footer.js';
|
|
3
|
+
export { Sidebar } from './Sidebar.js';
|
|
4
|
+
export { Content } from './Content.js';
|
|
5
|
+
export { DagView } from './DagView.js';
|
|
6
|
+
export { StepEditor } from './StepEditor.js';
|
|
7
|
+
export { OutputView } from './OutputView.js';
|
|
8
|
+
export { StyledBox, Section } from './Box.js';
|
|
9
|
+
export { GoalInput } from './GoalInput.js';
|
|
10
|
+
export { Splash } from './Splash.js';
|
|
11
|
+
export { CommandInput, COMMANDS } from './CommandInput.js';
|
|
12
|
+
export { Help } from './Help.js';
|
|
13
|
+
export { Settings } from './Settings.js';
|
|
14
|
+
export { HomeView } from './HomeView.js';
|
|
15
|
+
export { Frame } from './Frame.js';
|
|
16
|
+
export { ChatInput } from './ChatInput.js';
|
|
17
|
+
export { ThemeDesigner } from './ThemeDesigner.js';
|
|
18
|
+
export { WorkflowPicker } from './WorkflowPicker.js';
|
|
19
|
+
export { PlannerView } from './PlannerView.js';
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tui/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tui/index.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,MAAM,YAElB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tui/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,EAAE;IACzB,MAAM,CAAC,KAAC,GAAG,KAAG,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC;AAC1C,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface ProjectContext {
|
|
2
|
+
workingDir: string;
|
|
3
|
+
files: string[];
|
|
4
|
+
projectType: string;
|
|
5
|
+
packageJson?: Record<string, unknown>;
|
|
6
|
+
gitStatus: string;
|
|
7
|
+
gitBranch: string;
|
|
8
|
+
summary: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function scanProjectContext(workingDir: string): Promise<ProjectContext>;
|
|
11
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/tui/services/context.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AA2GD,wBAAsB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CA6BpF"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { readdir, readFile } from 'node:fs/promises';
|
|
2
|
+
import { join, relative } from 'node:path';
|
|
3
|
+
import { execSync } from 'node:child_process';
|
|
4
|
+
const IGNORE_DIRS = [
|
|
5
|
+
'node_modules',
|
|
6
|
+
'.git',
|
|
7
|
+
'dist',
|
|
8
|
+
'build',
|
|
9
|
+
'.next',
|
|
10
|
+
'target',
|
|
11
|
+
'__pycache__',
|
|
12
|
+
'.venv',
|
|
13
|
+
'venv',
|
|
14
|
+
'.cache',
|
|
15
|
+
'coverage',
|
|
16
|
+
];
|
|
17
|
+
const IGNORE_FILES = [
|
|
18
|
+
'.DS_Store',
|
|
19
|
+
'package-lock.json',
|
|
20
|
+
'yarn.lock',
|
|
21
|
+
'pnpm-lock.yaml',
|
|
22
|
+
'Cargo.lock',
|
|
23
|
+
];
|
|
24
|
+
const MAX_FILES = 100;
|
|
25
|
+
const MAX_DEPTH = 5;
|
|
26
|
+
async function walkDir(dir, baseDir, depth = 0) {
|
|
27
|
+
if (depth > MAX_DEPTH)
|
|
28
|
+
return [];
|
|
29
|
+
const files = [];
|
|
30
|
+
try {
|
|
31
|
+
const entries = await readdir(dir, { withFileTypes: true });
|
|
32
|
+
for (const entry of entries) {
|
|
33
|
+
if (files.length >= MAX_FILES)
|
|
34
|
+
break;
|
|
35
|
+
const fullPath = join(dir, entry.name);
|
|
36
|
+
const relativePath = relative(baseDir, fullPath);
|
|
37
|
+
if (entry.isDirectory()) {
|
|
38
|
+
if (IGNORE_DIRS.includes(entry.name))
|
|
39
|
+
continue;
|
|
40
|
+
if (entry.name.startsWith('.'))
|
|
41
|
+
continue;
|
|
42
|
+
const subFiles = await walkDir(fullPath, baseDir, depth + 1);
|
|
43
|
+
files.push(...subFiles);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
if (IGNORE_FILES.includes(entry.name))
|
|
47
|
+
continue;
|
|
48
|
+
files.push(relativePath);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
// Ignore permission errors
|
|
54
|
+
}
|
|
55
|
+
return files;
|
|
56
|
+
}
|
|
57
|
+
function detectProjectType(files) {
|
|
58
|
+
if (files.some((f) => f === 'package.json')) {
|
|
59
|
+
if (files.some((f) => f.includes('next.config')))
|
|
60
|
+
return 'Next.js';
|
|
61
|
+
if (files.some((f) => f.endsWith('.tsx') || f.endsWith('.jsx')))
|
|
62
|
+
return 'React';
|
|
63
|
+
if (files.some((f) => f === 'tsconfig.json'))
|
|
64
|
+
return 'TypeScript/Node';
|
|
65
|
+
return 'Node.js';
|
|
66
|
+
}
|
|
67
|
+
if (files.some((f) => f === 'Cargo.toml'))
|
|
68
|
+
return 'Rust';
|
|
69
|
+
if (files.some((f) => f === 'pyproject.toml' || f === 'setup.py'))
|
|
70
|
+
return 'Python';
|
|
71
|
+
if (files.some((f) => f === 'go.mod'))
|
|
72
|
+
return 'Go';
|
|
73
|
+
if (files.some((f) => f === 'Gemfile'))
|
|
74
|
+
return 'Ruby';
|
|
75
|
+
if (files.some((f) => f.endsWith('.java')))
|
|
76
|
+
return 'Java';
|
|
77
|
+
return 'Unknown';
|
|
78
|
+
}
|
|
79
|
+
function getGitInfo(workingDir) {
|
|
80
|
+
try {
|
|
81
|
+
const branch = execSync('git branch --show-current', {
|
|
82
|
+
cwd: workingDir,
|
|
83
|
+
encoding: 'utf-8',
|
|
84
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
85
|
+
}).trim();
|
|
86
|
+
const status = execSync('git status --short', {
|
|
87
|
+
cwd: workingDir,
|
|
88
|
+
encoding: 'utf-8',
|
|
89
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
90
|
+
}).trim();
|
|
91
|
+
return { branch: branch || 'main', status: status || 'clean' };
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
return { branch: 'N/A', status: 'not a git repo' };
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
async function readPackageJson(workingDir) {
|
|
98
|
+
try {
|
|
99
|
+
const content = await readFile(join(workingDir, 'package.json'), 'utf-8');
|
|
100
|
+
return JSON.parse(content);
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
export async function scanProjectContext(workingDir) {
|
|
107
|
+
const files = await walkDir(workingDir, workingDir);
|
|
108
|
+
const projectType = detectProjectType(files);
|
|
109
|
+
const { branch, status } = getGitInfo(workingDir);
|
|
110
|
+
const packageJson = await readPackageJson(workingDir);
|
|
111
|
+
// Build summary for LLM
|
|
112
|
+
const fileTree = files.slice(0, 50).join('\n');
|
|
113
|
+
const summary = `
|
|
114
|
+
Working Directory: ${workingDir}
|
|
115
|
+
Project Type: ${projectType}
|
|
116
|
+
Git Branch: ${branch}
|
|
117
|
+
Git Status: ${status === 'clean' ? 'clean' : 'has changes'}
|
|
118
|
+
${packageJson ? `Package: ${packageJson.name || 'unnamed'}` : ''}
|
|
119
|
+
|
|
120
|
+
Files (${files.length} total):
|
|
121
|
+
${fileTree}
|
|
122
|
+
${files.length > 50 ? `... and ${files.length - 50} more files` : ''}
|
|
123
|
+
`.trim();
|
|
124
|
+
return {
|
|
125
|
+
workingDir,
|
|
126
|
+
files,
|
|
127
|
+
projectType,
|
|
128
|
+
packageJson,
|
|
129
|
+
gitStatus: status,
|
|
130
|
+
gitBranch: branch,
|
|
131
|
+
summary,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/tui/services/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAQ,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAA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;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,UAAkB;IACzD,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACpD,MAAM,WAAW,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC7C,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;IAClD,MAAM,WAAW,GAAG,MAAM,eAAe,CAAC,UAAU,CAAC,CAAC;IAEtD,wBAAwB;IACxB,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/C,MAAM,OAAO,GAAG;qBACG,UAAU;gBACf,WAAW;cACb,MAAM;cACN,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa;EACxD,WAAW,CAAC,CAAC,CAAC,YAAY,WAAW,CAAC,IAAI,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE;;SAEvD,KAAK,CAAC,MAAM;EACnB,QAAQ;EACR,KAAK,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC,WAAW,KAAK,CAAC,MAAM,GAAG,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE;CACnE,CAAC,IAAI,EAAE,CAAC;IAEP,OAAO;QACL,UAAU;QACV,KAAK;QACL,WAAW;QACX,WAAW;QACX,SAAS,EAAE,MAAM;QACjB,SAAS,EAAE,MAAM;QACjB,OAAO;KACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Step, ApprovalMode } from '../types.js';
|
|
2
|
+
import type { ProjectContext } from './context.js';
|
|
3
|
+
export type ExecutorCallback = (output: string) => void;
|
|
4
|
+
export interface ExecutionResult {
|
|
5
|
+
success: boolean;
|
|
6
|
+
output: string;
|
|
7
|
+
error?: string;
|
|
8
|
+
commitHash?: string;
|
|
9
|
+
duration: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function executeStep(step: Step, workingDir: string, approvalMode: ApprovalMode, context: ProjectContext | null, onOutput?: ExecutorCallback): Promise<ExecutionResult>;
|
|
12
|
+
export declare function rollbackStep(commitHash: string, workingDir: string): Promise<boolean>;
|
|
13
|
+
//# sourceMappingURL=executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/tui/services/executor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,MAAM,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;AA+BxD,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAmCD,wBAAsB,WAAW,CAC/B,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,cAAc,GAAG,IAAI,EAC9B,QAAQ,CAAC,EAAE,gBAAgB,GAC1B,OAAO,CAAC,eAAe,CAAC,CA+H1B;AAED,wBAAsB,YAAY,CAChC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,OAAO,CAAC,CAclB"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { spawn, execSync } from 'node:child_process';
|
|
2
|
+
import { buildExecutionCommand } from './providers.js';
|
|
3
|
+
import { getProviderEnv, hasApiKey } from './settings.js';
|
|
4
|
+
// Strip ANSI escape codes that corrupt Ink rendering
|
|
5
|
+
function stripAnsi(text) {
|
|
6
|
+
// Remove all ANSI escape sequences
|
|
7
|
+
return text.replace(/\x1b\[[0-9;]*[a-zA-Z]/g, '')
|
|
8
|
+
.replace(/\x1b\][^\x07]*\x07/g, '') // OSC sequences
|
|
9
|
+
.replace(/\r/g, ''); // Carriage returns cause line overwrites
|
|
10
|
+
}
|
|
11
|
+
// Extract meaningful status from stderr (codex progress output)
|
|
12
|
+
function parseStderr(text) {
|
|
13
|
+
const clean = stripAnsi(text).trim();
|
|
14
|
+
if (!clean)
|
|
15
|
+
return null;
|
|
16
|
+
// Extract only meaningful lines
|
|
17
|
+
const lines = clean.split('\n').filter(line => {
|
|
18
|
+
const l = line.trim();
|
|
19
|
+
// Keep status indicators
|
|
20
|
+
if (l.startsWith('✓') || l.startsWith('→') || l.startsWith('•'))
|
|
21
|
+
return true;
|
|
22
|
+
if (l.startsWith('Plan update'))
|
|
23
|
+
return true;
|
|
24
|
+
// Skip timing noise
|
|
25
|
+
if (l.includes('succeeded in') && l.length < 30)
|
|
26
|
+
return false;
|
|
27
|
+
// Skip empty or very short
|
|
28
|
+
if (l.length < 3)
|
|
29
|
+
return false;
|
|
30
|
+
return false; // Skip most stderr by default
|
|
31
|
+
});
|
|
32
|
+
return lines.length > 0 ? lines.join('\n') : null;
|
|
33
|
+
}
|
|
34
|
+
function gitCommit(workingDir, message) {
|
|
35
|
+
try {
|
|
36
|
+
// Check if there are changes to commit
|
|
37
|
+
const status = execSync('git status --porcelain', {
|
|
38
|
+
cwd: workingDir,
|
|
39
|
+
encoding: 'utf-8',
|
|
40
|
+
}).trim();
|
|
41
|
+
if (!status) {
|
|
42
|
+
return null; // No changes to commit
|
|
43
|
+
}
|
|
44
|
+
// Stage all changes
|
|
45
|
+
execSync('git add -A', { cwd: workingDir, stdio: 'pipe' });
|
|
46
|
+
// Commit
|
|
47
|
+
execSync(`git commit -m "${message}"`, {
|
|
48
|
+
cwd: workingDir,
|
|
49
|
+
stdio: 'pipe',
|
|
50
|
+
});
|
|
51
|
+
// Get commit hash
|
|
52
|
+
const hash = execSync('git rev-parse --short HEAD', {
|
|
53
|
+
cwd: workingDir,
|
|
54
|
+
encoding: 'utf-8',
|
|
55
|
+
}).trim();
|
|
56
|
+
return hash;
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
export async function executeStep(step, workingDir, approvalMode, context, onOutput) {
|
|
63
|
+
const startTime = Date.now();
|
|
64
|
+
// Warn if manual mode - it's limited
|
|
65
|
+
if (approvalMode === 'manual') {
|
|
66
|
+
onOutput?.('⚠️ Manual approval mode has limited support.\n');
|
|
67
|
+
onOutput?.(' CLI prompts may not display correctly.\n');
|
|
68
|
+
onOutput?.(' Consider using "auto" or "auto_edit" mode.\n\n');
|
|
69
|
+
}
|
|
70
|
+
return new Promise((resolve) => {
|
|
71
|
+
// Build the execution prompt WITH project context
|
|
72
|
+
const contextSection = context ? `
|
|
73
|
+
PROJECT CONTEXT:
|
|
74
|
+
${context.summary}
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
` : '';
|
|
78
|
+
const executionPrompt = `You are executing step "${step.id}" of a workflow.
|
|
79
|
+
${contextSection}
|
|
80
|
+
TASK: ${step.title || step.id}
|
|
81
|
+
|
|
82
|
+
INSTRUCTIONS:
|
|
83
|
+
${step.prompt}
|
|
84
|
+
|
|
85
|
+
Execute this task now. You have full access to the filesystem. Create, modify, or delete files as needed. Be thorough and complete the task fully.`;
|
|
86
|
+
// Get the correct command and args for this provider (with verbose flag)
|
|
87
|
+
const { command, args } = buildExecutionCommand(step.provider, step.model, approvalMode, executionPrompt);
|
|
88
|
+
// Get API key env vars for this provider
|
|
89
|
+
const providerEnv = getProviderEnv(step.provider);
|
|
90
|
+
const usingApiKey = hasApiKey(step.provider);
|
|
91
|
+
onOutput?.(`\n${'═'.repeat(50)}\n`);
|
|
92
|
+
onOutput?.(`Step: ${step.title || step.id}\n`);
|
|
93
|
+
onOutput?.(`Provider: ${step.provider}${step.model ? ` (${step.model})` : ''}\n`);
|
|
94
|
+
onOutput?.(`Auth: ${usingApiKey ? 'API Key' : 'CLI Auth'}\n`);
|
|
95
|
+
onOutput?.(`Mode: ${approvalMode}\n`);
|
|
96
|
+
if (context) {
|
|
97
|
+
onOutput?.(`Project: ${context.projectType} | Branch: ${context.gitBranch}\n`);
|
|
98
|
+
}
|
|
99
|
+
onOutput?.(`${'─'.repeat(50)}\n\n`);
|
|
100
|
+
const child = spawn(command, args, {
|
|
101
|
+
cwd: workingDir,
|
|
102
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
103
|
+
env: { ...process.env, ...providerEnv },
|
|
104
|
+
});
|
|
105
|
+
let stdout = '';
|
|
106
|
+
let stderr = '';
|
|
107
|
+
child.stdout.on('data', (data) => {
|
|
108
|
+
const text = data.toString();
|
|
109
|
+
stdout += text;
|
|
110
|
+
// Strip ANSI codes to prevent Ink rendering corruption
|
|
111
|
+
const clean = stripAnsi(text);
|
|
112
|
+
if (clean.trim()) {
|
|
113
|
+
onOutput?.(clean);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
child.stderr.on('data', (data) => {
|
|
117
|
+
const text = data.toString();
|
|
118
|
+
stderr += text;
|
|
119
|
+
// Only show meaningful status from stderr
|
|
120
|
+
const status = parseStderr(text);
|
|
121
|
+
if (status) {
|
|
122
|
+
onOutput?.(status + '\n');
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
child.on('close', (code) => {
|
|
126
|
+
const duration = Date.now() - startTime;
|
|
127
|
+
if (code !== 0) {
|
|
128
|
+
onOutput?.(`\n❌ Step failed (exit code ${code})\n`);
|
|
129
|
+
if (stderr) {
|
|
130
|
+
onOutput?.(`Error: ${stderr}\n`);
|
|
131
|
+
}
|
|
132
|
+
resolve({
|
|
133
|
+
success: false,
|
|
134
|
+
output: stdout,
|
|
135
|
+
error: stderr || 'Step failed with non-zero exit code',
|
|
136
|
+
duration,
|
|
137
|
+
});
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
// Try to commit changes
|
|
141
|
+
const commitHash = gitCommit(workingDir, `arachne: ${step.id} - ${step.title || 'completed'}`);
|
|
142
|
+
onOutput?.(`\n${'─'.repeat(50)}\n`);
|
|
143
|
+
if (commitHash) {
|
|
144
|
+
onOutput?.(`✓ Step completed in ${(duration / 1000).toFixed(1)}s\n`);
|
|
145
|
+
onOutput?.(`✓ Changes committed: ${commitHash}\n`);
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
onOutput?.(`✓ Step completed in ${(duration / 1000).toFixed(1)}s (no file changes)\n`);
|
|
149
|
+
}
|
|
150
|
+
resolve({
|
|
151
|
+
success: true,
|
|
152
|
+
output: stdout,
|
|
153
|
+
commitHash: commitHash || undefined,
|
|
154
|
+
duration,
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
child.on('error', (error) => {
|
|
158
|
+
const duration = Date.now() - startTime;
|
|
159
|
+
onOutput?.(`\n❌ Failed to start ${step.provider}: ${error.message}\n`);
|
|
160
|
+
onOutput?.(`Make sure '${command}' is installed and in your PATH.\n`);
|
|
161
|
+
resolve({
|
|
162
|
+
success: false,
|
|
163
|
+
output: '',
|
|
164
|
+
error: error.message,
|
|
165
|
+
duration,
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
export async function rollbackStep(commitHash, workingDir) {
|
|
171
|
+
try {
|
|
172
|
+
execSync(`git revert --no-commit ${commitHash}`, {
|
|
173
|
+
cwd: workingDir,
|
|
174
|
+
stdio: 'pipe',
|
|
175
|
+
});
|
|
176
|
+
execSync('git commit -m "arachne: rollback"', {
|
|
177
|
+
cwd: workingDir,
|
|
178
|
+
stdio: 'pipe',
|
|
179
|
+
});
|
|
180
|
+
return true;
|
|
181
|
+
}
|
|
182
|
+
catch {
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
185
|
+
}
|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CAAC,CAAC;YACzF,CAAC;YAED,OAAO,CAAC;gBACN,OAAO,EAAE,IAAI;gBACb,MAAM,EAAE,MAAM;gBACd,UAAU,EAAE,UAAU,IAAI,SAAS;gBACnC,QAAQ;aACT,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YAC1B,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;YACxC,QAAQ,EAAE,CAAC,uBAAuB,IAAI,CAAC,QAAQ,KAAK,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;YACvE,QAAQ,EAAE,CAAC,cAAc,OAAO,oCAAoC,CAAC,CAAC;YACtE,OAAO,CAAC;gBACN,OAAO,EAAE,KAAK;gBACd,MAAM,EAAE,EAAE;gBACV,KAAK,EAAE,KAAK,CAAC,OAAO;gBACpB,QAAQ;aACT,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,UAAkB,EAClB,UAAkB;IAElB,IAAI,CAAC;QACH,QAAQ,CAAC,0BAA0B,UAAU,EAAE,EAAE;YAC/C,GAAG,EAAE,UAAU;YACf,KAAK,EAAE,MAAM;SACd,CAAC,CAAC;QACH,QAAQ,CAAC,mCAAmC,EAAE;YAC5C,GAAG,EAAE,UAAU;YACf,KAAK,EAAE,MAAM;SACd,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Step, ProviderName, PlannerPhase } from '../types.js';
|
|
2
|
+
import type { ProjectContext } from './context.js';
|
|
3
|
+
export type GenerateCallback = (status: string) => void;
|
|
4
|
+
export type GenerateStreamCallback = (chunk: string, source: 'stdout' | 'stderr') => void;
|
|
5
|
+
export declare const generateStepsFromGoal: (goal: string, context: ProjectContext, provider?: ProviderName, onStatus?: GenerateCallback, onStream?: GenerateStreamCallback) => Promise<Step[]>;
|
|
6
|
+
export declare const generatePlanFromGoal: (goal: string, context: ProjectContext, provider?: ProviderName, onStatus?: GenerateCallback, onStream?: GenerateStreamCallback) => Promise<PlannerPhase[]>;
|
|
7
|
+
//# sourceMappingURL=generateSteps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateSteps.d.ts","sourceRoot":"","sources":["../../../src/tui/services/generateSteps.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AA6DnD,MAAM,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;AACxD,MAAM,MAAM,sBAAsB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,GAAG,QAAQ,KAAK,IAAI,CAAC;AAE1F,eAAO,MAAM,qBAAqB,GAChC,MAAM,MAAM,EACZ,SAAS,cAAc,EACvB,WAAU,YAAuB,EACjC,WAAW,gBAAgB,EAC3B,WAAW,sBAAsB,KAChC,OAAO,CAAC,IAAI,EAAE,CA+FhB,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,MAAM,MAAM,EACZ,SAAS,cAAc,EACvB,WAAU,YAAuB,EACjC,WAAW,gBAAgB,EAC3B,WAAW,sBAAsB,KAChC,OAAO,CAAC,YAAY,EAAE,CAgHxB,CAAC"}
|