janito 1.6.0__py3-none-any.whl → 1.8.0__py3-none-any.whl
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.
- janito/__init__.py +1 -1
- janito/agent/config.py +3 -3
- janito/agent/config_defaults.py +3 -2
- janito/agent/conversation.py +73 -27
- janito/agent/conversation_api.py +104 -4
- janito/agent/conversation_exceptions.py +6 -0
- janito/agent/conversation_tool_calls.py +17 -3
- janito/agent/event.py +24 -0
- janito/agent/event_dispatcher.py +24 -0
- janito/agent/event_handler_protocol.py +5 -0
- janito/agent/event_system.py +15 -0
- janito/agent/message_handler.py +4 -1
- janito/agent/message_handler_protocol.py +5 -0
- janito/agent/openai_client.py +5 -6
- janito/agent/openai_schema_generator.py +23 -4
- janito/agent/platform_discovery.py +90 -0
- janito/agent/profile_manager.py +34 -110
- janito/agent/queued_message_handler.py +22 -3
- janito/agent/rich_message_handler.py +3 -1
- janito/agent/templates/profiles/system_prompt_template_base.txt.j2 +14 -0
- janito/agent/templates/profiles/system_prompt_template_base_pt.txt.j2 +13 -0
- janito/agent/test_handler_protocols.py +47 -0
- janito/agent/tests/__init__.py +1 -0
- janito/agent/tool_base.py +1 -1
- janito/agent/tool_executor.py +109 -0
- janito/agent/tool_registry.py +3 -75
- janito/agent/tool_use_tracker.py +46 -0
- janito/agent/tools/__init__.py +11 -8
- janito/agent/tools/ask_user.py +26 -12
- janito/agent/tools/create_directory.py +50 -18
- janito/agent/tools/create_file.py +60 -29
- janito/agent/tools/dir_walk_utils.py +16 -0
- janito/agent/tools/fetch_url.py +10 -11
- janito/agent/tools/find_files.py +49 -40
- janito/agent/tools/get_lines.py +60 -25
- janito/agent/tools/memory.py +48 -0
- janito/agent/tools/move_file.py +72 -23
- janito/agent/tools/outline_file/__init__.py +85 -0
- janito/agent/tools/outline_file/formatting.py +20 -0
- janito/agent/tools/outline_file/markdown_outline.py +14 -0
- janito/agent/tools/outline_file/python_outline.py +71 -0
- janito/agent/tools/present_choices.py +62 -0
- janito/agent/tools/present_choices_test.py +18 -0
- janito/agent/tools/remove_directory.py +31 -26
- janito/agent/tools/remove_file.py +31 -13
- janito/agent/tools/replace_text_in_file.py +135 -36
- janito/agent/tools/run_bash_command.py +113 -97
- janito/agent/tools/run_powershell_command.py +169 -0
- janito/agent/tools/run_python_command.py +53 -29
- janito/agent/tools/search_outline.py +17 -0
- janito/agent/tools/search_text.py +208 -0
- janito/agent/tools/tools_utils.py +47 -4
- janito/agent/tools/utils.py +14 -15
- janito/agent/tools/validate_file_syntax.py +163 -0
- janito/cli/_print_config.py +1 -1
- janito/cli/arg_parser.py +36 -4
- janito/cli/config_commands.py +1 -1
- janito/cli/logging_setup.py +7 -2
- janito/cli/main.py +97 -3
- janito/cli/runner/__init__.py +0 -2
- janito/cli/runner/_termweb_log_utils.py +17 -0
- janito/cli/runner/cli_main.py +121 -89
- janito/cli/runner/config.py +6 -4
- janito/cli/termweb_starter.py +73 -0
- janito/cli_chat_shell/chat_loop.py +52 -13
- janito/cli_chat_shell/chat_state.py +1 -1
- janito/cli_chat_shell/chat_ui.py +2 -3
- janito/cli_chat_shell/commands/__init__.py +17 -6
- janito/cli_chat_shell/commands/{history_reset.py → history_start.py} +13 -5
- janito/cli_chat_shell/commands/lang.py +16 -0
- janito/cli_chat_shell/commands/prompt.py +42 -0
- janito/cli_chat_shell/commands/session_control.py +36 -1
- janito/cli_chat_shell/commands/sum.py +49 -0
- janito/cli_chat_shell/commands/termweb_log.py +86 -0
- janito/cli_chat_shell/commands/utility.py +5 -2
- janito/cli_chat_shell/commands/verbose.py +29 -0
- janito/cli_chat_shell/load_prompt.py +47 -8
- janito/cli_chat_shell/session_manager.py +9 -1
- janito/cli_chat_shell/shell_command_completer.py +20 -0
- janito/cli_chat_shell/ui.py +110 -93
- janito/i18n/__init__.py +35 -0
- janito/i18n/messages.py +23 -0
- janito/i18n/pt.py +46 -0
- janito/rich_utils.py +43 -43
- janito/termweb/app.py +95 -0
- janito/termweb/static/editor.html +238 -0
- janito/termweb/static/editor.html.bak +238 -0
- janito/termweb/static/explorer.html.bak +59 -0
- janito/termweb/static/favicon.ico +0 -0
- janito/termweb/static/favicon.ico.bak +0 -0
- janito/termweb/static/index.html +55 -0
- janito/termweb/static/index.html.bak +55 -0
- janito/termweb/static/index.html.bak.bak +175 -0
- janito/termweb/static/landing.html.bak +36 -0
- janito/termweb/static/termicon.svg +1 -0
- janito/termweb/static/termweb.css +235 -0
- janito/termweb/static/termweb.css.bak +286 -0
- janito/termweb/static/termweb.js +187 -0
- janito/termweb/static/termweb.js.bak +187 -0
- janito/termweb/static/termweb.js.bak.bak +157 -0
- janito/termweb/static/termweb_quickopen.js +135 -0
- janito/termweb/static/termweb_quickopen.js.bak +125 -0
- janito/web/app.py +10 -13
- {janito-1.6.0.dist-info → janito-1.8.0.dist-info}/METADATA +73 -32
- janito-1.8.0.dist-info/RECORD +127 -0
- {janito-1.6.0.dist-info → janito-1.8.0.dist-info}/WHEEL +1 -1
- janito/agent/tool_registry_core.py +0 -2
- janito/agent/tools/get_file_outline.py +0 -117
- janito/agent/tools/py_compile_file.py +0 -40
- janito/agent/tools/replace_file.py +0 -51
- janito/agent/tools/search_files.py +0 -71
- janito/cli/runner/scan.py +0 -44
- janito/cli_chat_shell/commands/system.py +0 -73
- janito-1.6.0.dist-info/RECORD +0 -81
- {janito-1.6.0.dist-info → janito-1.8.0.dist-info}/entry_points.txt +0 -0
- {janito-1.6.0.dist-info → janito-1.8.0.dist-info}/licenses/LICENSE +0 -0
- {janito-1.6.0.dist-info → janito-1.8.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,238 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<link rel="icon" type="image/svg+xml" href="/static/termicon.svg">
|
5
|
+
<link rel="shortcut icon" type="image/x-icon" href="/static/favicon.ico">
|
6
|
+
<meta charset="UTF-8">
|
7
|
+
<title>TermWeb Editor — janito.dev</title>
|
8
|
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/codemirror.min.css">
|
9
|
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/theme/dracula.min.css">
|
10
|
+
<link rel="stylesheet" href="/static/termweb.css">
|
11
|
+
<style>
|
12
|
+
html, body {
|
13
|
+
height: 100%;
|
14
|
+
margin: 0;
|
15
|
+
padding: 0;
|
16
|
+
}
|
17
|
+
body {
|
18
|
+
display: flex;
|
19
|
+
flex-direction: column;
|
20
|
+
min-height: 100vh;
|
21
|
+
background: #181a1b;
|
22
|
+
color: #eee;
|
23
|
+
transition: background 0.2s, color 0.2s;
|
24
|
+
}
|
25
|
+
body.light-theme {
|
26
|
+
background: #f5f5f5;
|
27
|
+
color: #222;
|
28
|
+
}
|
29
|
+
.main {
|
30
|
+
flex: 1 1 auto;
|
31
|
+
display: flex;
|
32
|
+
flex-direction: column;
|
33
|
+
justify-content: stretch;
|
34
|
+
align-items: stretch;
|
35
|
+
min-height: 0;
|
36
|
+
}
|
37
|
+
.editor-pane {
|
38
|
+
flex: 1 1 auto;
|
39
|
+
display: flex;
|
40
|
+
flex-direction: column;
|
41
|
+
height: 100%;
|
42
|
+
min-height: 0;
|
43
|
+
}
|
44
|
+
.CodeMirror {
|
45
|
+
flex: 1 1 auto;
|
46
|
+
height: 100% !important;
|
47
|
+
min-height: 0;
|
48
|
+
font-size: 1.1em;
|
49
|
+
background: #282a36;
|
50
|
+
color: #f8f8f2;
|
51
|
+
border-radius: 0;
|
52
|
+
border: none;
|
53
|
+
transition: background 0.2s, color 0.2s;
|
54
|
+
}
|
55
|
+
body.light-theme .CodeMirror {
|
56
|
+
background: #fff;
|
57
|
+
color: #222;
|
58
|
+
}
|
59
|
+
.footer {
|
60
|
+
flex-shrink: 0;
|
61
|
+
background: #222;
|
62
|
+
color: #eee;
|
63
|
+
padding: 12px 0 8px 0;
|
64
|
+
text-align: center;
|
65
|
+
width: 100%;
|
66
|
+
position: fixed;
|
67
|
+
left: 0;
|
68
|
+
bottom: 0;
|
69
|
+
z-index: 100;
|
70
|
+
transition: background 0.2s, color 0.2s;
|
71
|
+
}
|
72
|
+
body.light-theme .footer {
|
73
|
+
background: #eaeaea;
|
74
|
+
color: #222;
|
75
|
+
}
|
76
|
+
.footer ul {
|
77
|
+
list-style: none;
|
78
|
+
padding: 0;
|
79
|
+
margin: 8px 0 0 0;
|
80
|
+
display: flex;
|
81
|
+
justify-content: center;
|
82
|
+
gap: 2em;
|
83
|
+
}
|
84
|
+
.footer li {
|
85
|
+
display: inline;
|
86
|
+
}
|
87
|
+
.header {
|
88
|
+
background: #222;
|
89
|
+
color: #fff;
|
90
|
+
padding: 10px 0;
|
91
|
+
text-align: center;
|
92
|
+
font-size: 1.3em;
|
93
|
+
font-weight: bold;
|
94
|
+
position: relative;
|
95
|
+
transition: background 0.2s, color 0.2s;
|
96
|
+
}
|
97
|
+
body.light-theme .header {
|
98
|
+
background: #eaeaea;
|
99
|
+
color: #222;
|
100
|
+
}
|
101
|
+
.theme-switcher {
|
102
|
+
position: absolute;
|
103
|
+
right: 20px;
|
104
|
+
top: 10px;
|
105
|
+
background: #444;
|
106
|
+
color: #fff;
|
107
|
+
border: none;
|
108
|
+
border-radius: 4px;
|
109
|
+
padding: 6px 14px;
|
110
|
+
cursor: pointer;
|
111
|
+
font-size: 1em;
|
112
|
+
transition: background 0.2s, color 0.2s;
|
113
|
+
}
|
114
|
+
body.light-theme .theme-switcher {
|
115
|
+
background: #ddd;
|
116
|
+
color: #222;
|
117
|
+
}
|
118
|
+
</style>
|
119
|
+
</head>
|
120
|
+
<body>
|
121
|
+
<div class="header">
|
122
|
+
TermWeb Editor
|
123
|
+
<button class="save-btn" id="save-btn" style="margin-right:12px;background:#4caf50;color:#fff;border:none;border-radius:4px;padding:6px 14px;cursor:pointer;font-size:1em;">Gravar</button>
|
124
|
+
<button class="theme-switcher" id="theme-switcher">Alternate to light theme</button>
|
125
|
+
</div>
|
126
|
+
<div class="main">
|
127
|
+
<div class="editor-pane">
|
128
|
+
<textarea id="code" name="code"></textarea>
|
129
|
+
</div>
|
130
|
+
</div>
|
131
|
+
<div class="footer">
|
132
|
+
<div class="subtitle">
|
133
|
+
Desenvolvido por <a href="https://janito.dev" target="_blank">janito.dev</a> — agente de programação com IA
|
134
|
+
</div>
|
135
|
+
<ul>
|
136
|
+
<li>🌐 <a href="https://janito.dev" target="_blank">janito.dev</a></li>
|
137
|
+
<li>📚 <a href="https://docs.janito.dev" target="_blank">Documentation</a></li>
|
138
|
+
<li>💻 <a href="https://github.com/joaompinto/janito" target="_blank">GitHub</a></li>
|
139
|
+
</ul>
|
140
|
+
<span style="font-size:0.9em;opacity:0.7;">_generated by janito.dev_</span>
|
141
|
+
</div>
|
142
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/codemirror.min.js"></script>
|
143
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/mode/python/python.min.js"></script>
|
144
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/theme/dracula.min.js"></script>
|
145
|
+
<script>
|
146
|
+
// --- Load file content via AJAX if ?path=... is present ---
|
147
|
+
function getQueryParam(name) {
|
148
|
+
const url = new URL(window.location.href);
|
149
|
+
return url.searchParams.get(name);
|
150
|
+
}
|
151
|
+
const filePath = getQueryParam('path');
|
152
|
+
let initialContent = `# Bem-vindo ao TermWeb!\n# Este é um editor CodeMirror ao vivo.\n\nprint("Olá, janito.dev!")`;
|
153
|
+
if (filePath) {
|
154
|
+
fetch(`/api/explorer/${encodeURIComponent(filePath)}`)
|
155
|
+
.then(resp => resp.json())
|
156
|
+
.then(data => {
|
157
|
+
if (data.type === 'file') {
|
158
|
+
initialContent = data.content;
|
159
|
+
if (window.editorInstance) {
|
160
|
+
window.editorInstance.setValue(initialContent);
|
161
|
+
}
|
162
|
+
} else if (data.error) {
|
163
|
+
initialContent = '# Error: ' + data.error;
|
164
|
+
if (window.editorInstance) {
|
165
|
+
window.editorInstance.setValue(initialContent);
|
166
|
+
}
|
167
|
+
}
|
168
|
+
})
|
169
|
+
.catch(err => {
|
170
|
+
initialContent = '# Error ao carregar arquivo: ' + err;
|
171
|
+
if (window.editorInstance) {
|
172
|
+
window.editorInstance.setValue(initialContent);
|
173
|
+
}
|
174
|
+
});
|
175
|
+
}
|
176
|
+
document.addEventListener('DOMContentLoaded', function() {
|
177
|
+
var editorInstance = CodeMirror.fromTextArea(document.getElementById('code'), {
|
178
|
+
lineNumbers: true,
|
179
|
+
mode: 'python',
|
180
|
+
theme: 'dracula',
|
181
|
+
indentUnit: 4,
|
182
|
+
tabSize: 4,
|
183
|
+
});
|
184
|
+
window.editorInstance = editorInstance;
|
185
|
+
editorInstance.setSize('100%', 'calc(100vh - 60px - 70px)'); // header/footer height
|
186
|
+
editorInstance.setValue(initialContent);
|
187
|
+
|
188
|
+
// Theme switcher logic
|
189
|
+
var themeSwitcher = document.getElementById('theme-switcher');
|
190
|
+
var isDark = true;
|
191
|
+
themeSwitcher.addEventListener('click', function() {
|
192
|
+
isDark = !isDark;
|
193
|
+
if (isDark) {
|
194
|
+
document.body.classList.remove('light-theme');
|
195
|
+
editorInstance.setOption('theme', 'dracula');
|
196
|
+
themeSwitcher.textContent = 'Alternate to light theme';
|
197
|
+
} else {
|
198
|
+
document.body.classList.add('light-theme');
|
199
|
+
editorInstance.setOption('theme', 'default');
|
200
|
+
themeSwitcher.textContent = 'Alternate to dark theme';
|
201
|
+
}
|
202
|
+
});
|
203
|
+
// Set initial state
|
204
|
+
document.body.classList.remove('light-theme');
|
205
|
+
editorInstance.setOption('theme', 'dracula');
|
206
|
+
themeSwitcher.textContent = 'Alternate to light theme';
|
207
|
+
// Botão de Gravar
|
208
|
+
var saveBtn = document.getElementById('save-btn');
|
209
|
+
saveBtn.addEventListener('click', function() {
|
210
|
+
if (!filePath) {
|
211
|
+
alert('Nenhum arquivo aberto para gravar.');
|
212
|
+
return;
|
213
|
+
}
|
214
|
+
const content = editorInstance.getValue();
|
215
|
+
fetch(`/api/explorer/${encodeURIComponent(filePath)}`, {
|
216
|
+
method: 'POST',
|
217
|
+
headers: {
|
218
|
+
'Content-Type': 'application/json',
|
219
|
+
},
|
220
|
+
body: JSON.stringify({ content }),
|
221
|
+
})
|
222
|
+
.then(resp => resp.json())
|
223
|
+
.then(data => {
|
224
|
+
if (data.success) {
|
225
|
+
saveBtn.textContent = 'Gravado!';
|
226
|
+
setTimeout(() => saveBtn.textContent = 'Gravar', 1200);
|
227
|
+
} else {
|
228
|
+
alert('Error saving: ' + (data.error || 'desconhecido'));
|
229
|
+
}
|
230
|
+
})
|
231
|
+
.catch(err => {
|
232
|
+
alert('Error saving: ' + err);
|
233
|
+
});
|
234
|
+
});
|
235
|
+
});
|
236
|
+
</script>
|
237
|
+
</body>
|
238
|
+
</html>
|
@@ -0,0 +1,238 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<link rel="icon" type="image/svg+xml" href="/static/termicon.svg">
|
5
|
+
<link rel="shortcut icon" type="image/x-icon" href="/static/favicon.ico">
|
6
|
+
<meta charset="UTF-8">
|
7
|
+
<title>TermWeb Editor — janito.dev</title>
|
8
|
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/codemirror.min.css">
|
9
|
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/theme/dracula.min.css">
|
10
|
+
<link rel="stylesheet" href="/static/termweb.css">
|
11
|
+
<style>
|
12
|
+
html, body {
|
13
|
+
height: 100%;
|
14
|
+
margin: 0;
|
15
|
+
padding: 0;
|
16
|
+
}
|
17
|
+
body {
|
18
|
+
display: flex;
|
19
|
+
flex-direction: column;
|
20
|
+
min-height: 100vh;
|
21
|
+
background: #181a1b;
|
22
|
+
color: #eee;
|
23
|
+
transition: background 0.2s, color 0.2s;
|
24
|
+
}
|
25
|
+
body.light-theme {
|
26
|
+
background: #f5f5f5;
|
27
|
+
color: #222;
|
28
|
+
}
|
29
|
+
.main {
|
30
|
+
flex: 1 1 auto;
|
31
|
+
display: flex;
|
32
|
+
flex-direction: column;
|
33
|
+
justify-content: stretch;
|
34
|
+
align-items: stretch;
|
35
|
+
min-height: 0;
|
36
|
+
}
|
37
|
+
.editor-pane {
|
38
|
+
flex: 1 1 auto;
|
39
|
+
display: flex;
|
40
|
+
flex-direction: column;
|
41
|
+
height: 100%;
|
42
|
+
min-height: 0;
|
43
|
+
}
|
44
|
+
.CodeMirror {
|
45
|
+
flex: 1 1 auto;
|
46
|
+
height: 100% !important;
|
47
|
+
min-height: 0;
|
48
|
+
font-size: 1.1em;
|
49
|
+
background: #282a36;
|
50
|
+
color: #f8f8f2;
|
51
|
+
border-radius: 0;
|
52
|
+
border: none;
|
53
|
+
transition: background 0.2s, color 0.2s;
|
54
|
+
}
|
55
|
+
body.light-theme .CodeMirror {
|
56
|
+
background: #fff;
|
57
|
+
color: #222;
|
58
|
+
}
|
59
|
+
.footer {
|
60
|
+
flex-shrink: 0;
|
61
|
+
background: #222;
|
62
|
+
color: #eee;
|
63
|
+
padding: 12px 0 8px 0;
|
64
|
+
text-align: center;
|
65
|
+
width: 100%;
|
66
|
+
position: fixed;
|
67
|
+
left: 0;
|
68
|
+
bottom: 0;
|
69
|
+
z-index: 100;
|
70
|
+
transition: background 0.2s, color 0.2s;
|
71
|
+
}
|
72
|
+
body.light-theme .footer {
|
73
|
+
background: #eaeaea;
|
74
|
+
color: #222;
|
75
|
+
}
|
76
|
+
.footer ul {
|
77
|
+
list-style: none;
|
78
|
+
padding: 0;
|
79
|
+
margin: 8px 0 0 0;
|
80
|
+
display: flex;
|
81
|
+
justify-content: center;
|
82
|
+
gap: 2em;
|
83
|
+
}
|
84
|
+
.footer li {
|
85
|
+
display: inline;
|
86
|
+
}
|
87
|
+
.header {
|
88
|
+
background: #222;
|
89
|
+
color: #fff;
|
90
|
+
padding: 10px 0;
|
91
|
+
text-align: center;
|
92
|
+
font-size: 1.3em;
|
93
|
+
font-weight: bold;
|
94
|
+
position: relative;
|
95
|
+
transition: background 0.2s, color 0.2s;
|
96
|
+
}
|
97
|
+
body.light-theme .header {
|
98
|
+
background: #eaeaea;
|
99
|
+
color: #222;
|
100
|
+
}
|
101
|
+
.theme-switcher {
|
102
|
+
position: absolute;
|
103
|
+
right: 20px;
|
104
|
+
top: 10px;
|
105
|
+
background: #444;
|
106
|
+
color: #fff;
|
107
|
+
border: none;
|
108
|
+
border-radius: 4px;
|
109
|
+
padding: 6px 14px;
|
110
|
+
cursor: pointer;
|
111
|
+
font-size: 1em;
|
112
|
+
transition: background 0.2s, color 0.2s;
|
113
|
+
}
|
114
|
+
body.light-theme .theme-switcher {
|
115
|
+
background: #ddd;
|
116
|
+
color: #222;
|
117
|
+
}
|
118
|
+
</style>
|
119
|
+
</head>
|
120
|
+
<body>
|
121
|
+
<div class="header">
|
122
|
+
TermWeb Editor
|
123
|
+
<button class="save-btn" id="save-btn" style="margin-right:12px;background:#4caf50;color:#fff;border:none;border-radius:4px;padding:6px 14px;cursor:pointer;font-size:1em;">Gravar</button>
|
124
|
+
<button class="theme-switcher" id="theme-switcher">Alternate to light theme</button>
|
125
|
+
</div>
|
126
|
+
<div class="main">
|
127
|
+
<div class="editor-pane">
|
128
|
+
<textarea id="code" name="code"></textarea>
|
129
|
+
</div>
|
130
|
+
</div>
|
131
|
+
<div class="footer">
|
132
|
+
<div class="subtitle">
|
133
|
+
Desenvolvido por <a href="https://janito.dev" target="_blank">janito.dev</a> — agente de programação com IA
|
134
|
+
</div>
|
135
|
+
<ul>
|
136
|
+
<li>🌐 <a href="https://janito.dev" target="_blank">janito.dev</a></li>
|
137
|
+
<li>📚 <a href="https://docs.janito.dev" target="_blank">Documentation</a></li>
|
138
|
+
<li>💻 <a href="https://github.com/joaompinto/janito" target="_blank">GitHub</a></li>
|
139
|
+
</ul>
|
140
|
+
<span style="font-size:0.9em;opacity:0.7;">_generated by janito.dev_</span>
|
141
|
+
</div>
|
142
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/codemirror.min.js"></script>
|
143
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/mode/python/python.min.js"></script>
|
144
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/theme/dracula.min.js"></script>
|
145
|
+
<script>
|
146
|
+
// --- Load file content via AJAX if ?path=... is present ---
|
147
|
+
function getQueryParam(name) {
|
148
|
+
const url = new URL(window.location.href);
|
149
|
+
return url.searchParams.get(name);
|
150
|
+
}
|
151
|
+
const filePath = getQueryParam('path');
|
152
|
+
let initialContent = `# Bem-vindo ao TermWeb!\n# Este é um editor CodeMirror ao vivo.\n\nprint("Olá, janito.dev!")`;
|
153
|
+
if (filePath) {
|
154
|
+
fetch(`/api/explorer/${encodeURIComponent(filePath)}`)
|
155
|
+
.then(resp => resp.json())
|
156
|
+
.then(data => {
|
157
|
+
if (data.type === 'file') {
|
158
|
+
initialContent = data.content;
|
159
|
+
if (window.editorInstance) {
|
160
|
+
window.editorInstance.setValue(initialContent);
|
161
|
+
}
|
162
|
+
} else if (data.error) {
|
163
|
+
initialContent = '# Errorr: ' + data.error;
|
164
|
+
if (window.editorInstance) {
|
165
|
+
window.editorInstance.setValue(initialContent);
|
166
|
+
}
|
167
|
+
}
|
168
|
+
})
|
169
|
+
.catch(err => {
|
170
|
+
initialContent = '# Error ao carregar arquivo: ' + err;
|
171
|
+
if (window.editorInstance) {
|
172
|
+
window.editorInstance.setValue(initialContent);
|
173
|
+
}
|
174
|
+
});
|
175
|
+
}
|
176
|
+
document.addEventListener('DOMContentLoaded', function() {
|
177
|
+
var editorInstance = CodeMirror.fromTextArea(document.getElementById('code'), {
|
178
|
+
lineNumbers: true,
|
179
|
+
mode: 'python',
|
180
|
+
theme: 'dracula',
|
181
|
+
indentUnit: 4,
|
182
|
+
tabSize: 4,
|
183
|
+
});
|
184
|
+
window.editorInstance = editorInstance;
|
185
|
+
editorInstance.setSize('100%', 'calc(100vh - 60px - 70px)'); // header/footer height
|
186
|
+
editorInstance.setValue(initialContent);
|
187
|
+
|
188
|
+
// Theme switcher logic
|
189
|
+
var themeSwitcher = document.getElementById('theme-switcher');
|
190
|
+
var isDark = true;
|
191
|
+
themeSwitcher.addEventListener('click', function() {
|
192
|
+
isDark = !isDark;
|
193
|
+
if (isDark) {
|
194
|
+
document.body.classList.remove('light-theme');
|
195
|
+
editorInstance.setOption('theme', 'dracula');
|
196
|
+
themeSwitcher.textContent = 'Alternate to light theme';
|
197
|
+
} else {
|
198
|
+
document.body.classList.add('light-theme');
|
199
|
+
editorInstance.setOption('theme', 'default');
|
200
|
+
themeSwitcher.textContent = 'Alternate to dark theme';
|
201
|
+
}
|
202
|
+
});
|
203
|
+
// Set initial state
|
204
|
+
document.body.classList.remove('light-theme');
|
205
|
+
editorInstance.setOption('theme', 'dracula');
|
206
|
+
themeSwitcher.textContent = 'Alternate to light theme';
|
207
|
+
// Botão de Gravar
|
208
|
+
var saveBtn = document.getElementById('save-btn');
|
209
|
+
saveBtn.addEventListener('click', function() {
|
210
|
+
if (!filePath) {
|
211
|
+
alert('Nenhum arquivo aberto para gravar.');
|
212
|
+
return;
|
213
|
+
}
|
214
|
+
const content = editorInstance.getValue();
|
215
|
+
fetch(`/api/explorer/${encodeURIComponent(filePath)}`, {
|
216
|
+
method: 'POST',
|
217
|
+
headers: {
|
218
|
+
'Content-Type': 'application/json',
|
219
|
+
},
|
220
|
+
body: JSON.stringify({ content }),
|
221
|
+
})
|
222
|
+
.then(resp => resp.json())
|
223
|
+
.then(data => {
|
224
|
+
if (data.success) {
|
225
|
+
saveBtn.textContent = 'Gravado!';
|
226
|
+
setTimeout(() => saveBtn.textContent = 'Gravar', 1200);
|
227
|
+
} else {
|
228
|
+
alert('Errorr saving: ' + (data.error || 'desconhecido'));
|
229
|
+
}
|
230
|
+
})
|
231
|
+
.catch(err => {
|
232
|
+
alert('Errorr saving: ' + err);
|
233
|
+
});
|
234
|
+
});
|
235
|
+
});
|
236
|
+
</script>
|
237
|
+
</body>
|
238
|
+
</html>
|
@@ -0,0 +1,59 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<link rel="icon" type="image/svg+xml" href="/static/termicon.svg">
|
5
|
+
<link rel="shortcut icon" type="image/x-icon" href="/static/favicon.ico">
|
6
|
+
<meta charset="UTF-8">
|
7
|
+
<title>TermWeb File Explorer — janito.dev</title>
|
8
|
+
<link rel="stylesheet" href="/static/termweb.css">
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
<div class="header">
|
12
|
+
TermWeb File Explorer
|
13
|
+
<button class="theme-switcher" id="theme-switcher">Switch to Light Theme</button>
|
14
|
+
</div>
|
15
|
+
<div class="toolbar" id="explorer-toolbar">
|
16
|
+
<button id="view-list" class="view-toggle active" title="List View">☰</button>
|
17
|
+
<button id="view-icons" class="view-toggle" title="Icon View">■</button>
|
18
|
+
</div>
|
19
|
+
<div class="main" id="explorer-main">
|
20
|
+
<!-- Directory/File browser will be injected here -->
|
21
|
+
</div>
|
22
|
+
<div class="footer">
|
23
|
+
<div class="subtitle">
|
24
|
+
Powered by <a href="https://janito.dev" target="_blank">janito.dev</a> — AI-powered coding agent
|
25
|
+
</div>
|
26
|
+
<ul>
|
27
|
+
<li>🌐 <a href="https://janito.dev" target="_blank">janito.dev</a></li>
|
28
|
+
<li>📚 <a href="https://docs.janito.dev" target="_blank">Documentation</a></li>
|
29
|
+
<li>💻 <a href="https://github.com/joaompinto/janito" target="_blank">GitHub</a></li>
|
30
|
+
</ul>
|
31
|
+
<span style="font-size:0.9em;opacity:0.7;">_generated by janito.dev_</span>
|
32
|
+
</div>
|
33
|
+
<script src="/static/termweb.js"></script>
|
34
|
+
<script>
|
35
|
+
// Theme switcher logic
|
36
|
+
function setTheme(dark) {
|
37
|
+
if (dark) {
|
38
|
+
document.body.classList.add('dark-theme');
|
39
|
+
document.body.classList.remove('light-theme');
|
40
|
+
localStorage.setItem('theme', 'dark');
|
41
|
+
document.getElementById('theme-switcher').textContent = 'Switch to Light Theme';
|
42
|
+
} else {
|
43
|
+
document.body.classList.remove('dark-theme');
|
44
|
+
document.body.classList.add('light-theme');
|
45
|
+
localStorage.setItem('theme', 'light');
|
46
|
+
document.getElementById('theme-switcher').textContent = 'Switch to Dark Theme';
|
47
|
+
}
|
48
|
+
}
|
49
|
+
document.addEventListener('DOMContentLoaded', function() {
|
50
|
+
// Initial theme
|
51
|
+
var theme = localStorage.getItem('theme') || 'dark';
|
52
|
+
setTheme(theme === 'dark');
|
53
|
+
document.getElementById('theme-switcher').onclick = function() {
|
54
|
+
setTheme(document.body.classList.contains('light-theme'));
|
55
|
+
};
|
56
|
+
});
|
57
|
+
</script>
|
58
|
+
</body>
|
59
|
+
</html>
|
File without changes
|
File without changes
|
@@ -0,0 +1,55 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<title>TermWeb — janito.dev</title>
|
6
|
+
<link rel="icon" type="image/svg+xml" href="/static/termicon.svg">
|
7
|
+
<link rel="shortcut icon" type="image/x-icon" href="/static/favicon.ico">
|
8
|
+
<link rel="stylesheet" href="/static/termweb.css">
|
9
|
+
<!-- CodeMirror CSS -->
|
10
|
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/codemirror.min.css">
|
11
|
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/theme/dracula.min.css">
|
12
|
+
</head>
|
13
|
+
<body>
|
14
|
+
<!-- Quick Open Modal (Ctrl+P) -->
|
15
|
+
<div id="quickopen-modal" style="display:none;position:fixed;top:0;left:0;width:100vw;height:100vh;z-index:1000;background:rgba(0,0,0,0.35);align-items:center;justify-content:center;">
|
16
|
+
<div style="background:#222;padding:2em 2em 1em 2em;border-radius:1em;box-shadow:0 8px 32px #000a;min-width:340px;max-width:90vw;">
|
17
|
+
<input id="quickopen-input" type="text" placeholder="Type to search files..." autocomplete="off" />
|
18
|
+
<ul id="quickopen-results"></ul>
|
19
|
+
<div style="text-align:right;margin-top:0.5em;"><small>Pressione Esc para fechar</small></div>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<div class="header">
|
24
|
+
<img src="/static/termicon.svg" alt="TermWeb Logo" class="header-logo">
|
25
|
+
<span class="header-title">TermWeb</span>
|
26
|
+
<span class="header-subtitle">Explorador de Projetos com IA</span>
|
27
|
+
<button class="theme-switcher" id="theme-switcher">Alternate para tema claro</button>
|
28
|
+
</div>
|
29
|
+
<div class="toolbar" id="explorer-toolbar">
|
30
|
+
<button id="view-list" class="view-toggle active" title="Visualização em Lista">☰ List</button>
|
31
|
+
<button id="view-icons" class="view-toggle" title="Visualização em Ícones">■ Icons</button>
|
32
|
+
</div>
|
33
|
+
<div class="main">
|
34
|
+
<div id="explorer-main"></div>
|
35
|
+
<div id="explorer-preview" class="preview-pane"></div>
|
36
|
+
</div>
|
37
|
+
<div class="footer">
|
38
|
+
<div class="subtitle">
|
39
|
+
Desenvolvido por <a href="https://janito.dev" target="_blank">janito.dev</a> — agente de programação com IA
|
40
|
+
</div>
|
41
|
+
<ul>
|
42
|
+
<li>🌐 <a href="https://janito.dev" target="_blank">janito.dev</a></li>
|
43
|
+
<li>📚 <a href="https://docs.janito.dev" target="_blank">Documentação</a></li>
|
44
|
+
<li>💻 <a href="https://github.com/joaompinto/janito" target="_blank">GitHub</a></li>
|
45
|
+
</ul>
|
46
|
+
<span style="font-size:0.9em;opacity:0.7;">_generated by janito.dev_</span>
|
47
|
+
</div>
|
48
|
+
<script src="/static/termweb.js"></script>
|
49
|
+
<script src="/static/termweb_quickopen.js"></script>
|
50
|
+
<!-- CodeMirror JS -->
|
51
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/codemirror.min.js"></script>
|
52
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/mode/python/python.min.js"></script>
|
53
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/theme/dracula.min.js"></script>
|
54
|
+
</body>
|
55
|
+
</html>
|
@@ -0,0 +1,55 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<title>TermWeb — janito.dev</title>
|
6
|
+
<link rel="icon" type="image/svg+xml" href="/static/termicon.svg">
|
7
|
+
<link rel="shortcut icon" type="image/x-icon" href="/static/favicon.ico">
|
8
|
+
<link rel="stylesheet" href="/static/termweb.css">
|
9
|
+
<!-- CodeMirror CSS -->
|
10
|
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/codemirror.min.css">
|
11
|
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/theme/dracula.min.css">
|
12
|
+
</head>
|
13
|
+
<body>
|
14
|
+
<!-- Quick Open Modal (Ctrl+P) -->
|
15
|
+
<div id="quickopen-modal" style="display:none;position:fixed;top:0;left:0;width:100vw;height:100vh;z-index:1000;background:rgba(0,0,0,0.35);align-items:center;justify-content:center;">
|
16
|
+
<div style="background:#222;padding:2em 2em 1em 2em;border-radius:1em;box-shadow:0 8px 32px #000a;min-width:340px;max-width:90vw;">
|
17
|
+
<input id="quickopen-input" type="text" placeholder="Type to search files..." autocomplete="off" />
|
18
|
+
<ul id="quickopen-results"></ul>
|
19
|
+
<div style="text-align:right;margin-top:0.5em;"><small>Pressione Esc para fechar</small></div>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<div class="header">
|
24
|
+
<img src="/static/termicon.svg" alt="TermWeb Logo" class="header-logo">
|
25
|
+
<span class="header-title">TermWeb</span>
|
26
|
+
<span class="header-subtitle">Explorador de Projetos com IA</span>
|
27
|
+
<button class="theme-switcher" id="theme-switcher">Alternar para tema claro</button>
|
28
|
+
</div>
|
29
|
+
<div class="toolbar" id="explorer-toolbar">
|
30
|
+
<button id="view-list" class="view-toggle active" title="Visualização em Lista">☰ List</button>
|
31
|
+
<button id="view-icons" class="view-toggle" title="Visualização em Ícones">■ Icons</button>
|
32
|
+
</div>
|
33
|
+
<div class="main">
|
34
|
+
<div id="explorer-main"></div>
|
35
|
+
<div id="explorer-preview" class="preview-pane"></div>
|
36
|
+
</div>
|
37
|
+
<div class="footer">
|
38
|
+
<div class="subtitle">
|
39
|
+
Desenvolvido por <a href="https://janito.dev" target="_blank">janito.dev</a> — agente de programação com IA
|
40
|
+
</div>
|
41
|
+
<ul>
|
42
|
+
<li>🌐 <a href="https://janito.dev" target="_blank">janito.dev</a></li>
|
43
|
+
<li>📚 <a href="https://docs.janito.dev" target="_blank">Documentação</a></li>
|
44
|
+
<li>💻 <a href="https://github.com/joaompinto/janito" target="_blank">GitHub</a></li>
|
45
|
+
</ul>
|
46
|
+
<span style="font-size:0.9em;opacity:0.7;">_generated by janito.dev_</span>
|
47
|
+
</div>
|
48
|
+
<script src="/static/termweb.js"></script>
|
49
|
+
<script src="/static/termweb_quickopen.js"></script>
|
50
|
+
<!-- CodeMirror JS -->
|
51
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/codemirror.min.js"></script>
|
52
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/mode/python/python.min.js"></script>
|
53
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/theme/dracula.min.js"></script>
|
54
|
+
</body>
|
55
|
+
</html>
|