Skip to content

Commit 632836c

Browse files
authored
Merge pull request #9 from getcodesetu/codex-ide-feature-foundation
Codex ide feature foundation
2 parents 697a583 + 14ca7cf commit 632836c

9 files changed

Lines changed: 732 additions & 5 deletions

File tree

‎apps/jetbrains/src/main/kotlin/ai/codesetu/toolwindow/CodeSetuToolWindowFactory.kt‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import ai.codesetu.settings.CodeSetuModelCatalog
1212
import ai.codesetu.settings.CodeSetuSettingsState
1313
import ai.codesetu.settings.providerDefaults
1414
import ai.codesetu.settings.resolveCodeSetuModel
15+
import com.intellij.ide.BrowserUtil
1516
import com.intellij.openapi.Disposable
1617
import com.intellij.openapi.application.ApplicationManager
1718
import com.intellij.openapi.application.ReadAction
@@ -98,6 +99,11 @@ class CodeSetuChatPanel(private val project: Project) : Disposable {
9899
when (obj["type"]?.jsonPrimitive?.contentOrNull) {
99100
"ready" -> onReady()
100101
"selectModel" -> showModelPicker()
102+
"configureProvider" -> ApplicationManager.getApplication().invokeLater { configureProvider() }
103+
"openUrl" -> {
104+
val url = obj["url"]?.jsonPrimitive?.contentOrNull ?: return
105+
ApplicationManager.getApplication().invokeLater { BrowserUtil.browse(url) }
106+
}
101107
"sendMessage" -> {
102108
val text = obj["text"]?.jsonPrimitive?.contentOrNull ?: return
103109
val include = obj["includeIdeContext"]?.jsonPrimitive?.booleanOrNull ?: true
@@ -272,6 +278,7 @@ class CodeSetuChatPanel(private val project: Project) : Disposable {
272278
CodeSetuSettingsState.getInstance().setApiKey(token)
273279
}
274280
pushModelLabel()
281+
pushWelcome()
275282
}
276283

277284
private fun pushModelLabel() {
@@ -303,9 +310,23 @@ class CodeSetuChatPanel(private val project: Project) : Disposable {
303310
ready = true
304311
pending.forEach { executeJs(it) }
305312
pending.clear()
313+
pushWelcome()
306314
}
307315
}
308316

317+
// The welcome panel shows on first use, when no provider key is configured.
318+
// Once the user has a key (or sends a message), it stays hidden for the
319+
// session.
320+
private fun pushWelcome() {
321+
push(message("welcome") { put("show", !isConfigured()) })
322+
}
323+
324+
private fun isConfigured(): Boolean {
325+
if (CodeSetuSettingsState.getInstance().getApiKey().isNotBlank()) return true
326+
return sequenceOf("CODESETU_API_KEY", "SARVAM_API_KEY", "HF_TOKEN")
327+
.any { !System.getenv(it).isNullOrBlank() }
328+
}
329+
309330
private fun executeJs(json: String) {
310331
browser.cefBrowser.executeJavaScript("window.__codesetuReceive($json)", browser.cefBrowser.url ?: "", 0)
311332
}

‎apps/jetbrains/src/main/resources/META-INF/plugin.xml‎

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,56 @@
44
<vendor url="https://github.com/getcodesetu/codesetu">CodeSetu Maintainers</vendor>
55

66
<description><![CDATA[
7-
Open-source AI coding assistant for JetBrains IDEs.
8-
Multi-provider — works with Sarvam, OpenAI-compatible APIs (Ollama, vLLM, OpenRouter), and local self-hosted deployments.
9-
Built for Indian developers, public-sector teams, and air-gapped enterprises.<br/><br/>
10-
This plugin is in early scaffold. Source: <a href="https://github.com/getcodesetu/codesetu">github.com/getcodesetu/codesetu</a>
11-
&middot; Community: <a href="https://discord.gg/sjVKU8cpC6">Discord</a>
7+
<h2>CodeSetu — Open-source AI coding assistant for JetBrains IDEs</h2>
8+
9+
<p>
10+
A privacy-aware, multi-provider Copilot / Cursor alternative for Indian developers,
11+
enterprises, public-sector teams, and air-gapped deployments.
12+
<b>Bring your own model.</b>
13+
</p>
14+
15+
<h3>What you get</h3>
16+
<ul>
17+
<li><b>Chat tool window</b> — streamed, markdown-rendered replies with rendered code blocks, in a polished CodeSetu webview.</li>
18+
<li><b>Selected-code actions</b> — Explain, Refactor, Write Tests, Fix Bug, Add Docs, right from the editor context menu.</li>
19+
<li><b>Repo-aware context</b> — active file, selection, and cursor neighborhood are attached automatically (toggleable per message).</li>
20+
<li><b>In-chat provider &amp; model switcher</b> — change providers, base URLs, and models without leaving the chat.</li>
21+
<li><b>Workspace skills &amp; checks</b> — drop <code>.codesetu/skills/*.md</code> and <code>.codesetu/checks/*.md</code> files; they are folded into the system prompt.</li>
22+
<li><b>Multi-turn conversation history</b> — kept per session.</li>
23+
</ul>
24+
25+
<h3>Works with</h3>
26+
<ul>
27+
<li><b>Sarvam</b> — Indic-aware hosted models.</li>
28+
<li><b>Hugging Face</b> — the hosted router (<code>router.huggingface.co/v1</code>), your dedicated Inference Endpoints, or self-hosted TGI. Any served chat model (Llama, Qwen, DeepSeek, Mistral, Gemma…) with your <code>hf_…</code> token.</li>
29+
<li><b>OpenAI-compatible</b> — Ollama, vLLM, SGLang, OpenRouter, LM Studio, any compatible endpoint.</li>
30+
<li><b>Self-hosted &amp; air-gapped</b> — bring your own URL. No outbound calls beyond the provider you configure.</li>
31+
</ul>
32+
33+
<h3>Privacy &amp; security</h3>
34+
<ul>
35+
<li>API keys live in the OS <b>PasswordSafe</b> (keychain) — never in plaintext settings XML.</li>
36+
<li>Common secret files (<code>.env*</code>, <code>*.pem</code>, <code>*.key</code>, <code>secrets/</code>, …) are excluded from auto-collected workspace context.</li>
37+
<li>No CodeSetu telemetry. Your prompts go only to the provider you configured.</li>
38+
<li>100% open-source under Apache 2.0.</li>
39+
</ul>
40+
41+
<h3>Quick start</h3>
42+
<ol>
43+
<li>Install the plugin and restart the IDE.</li>
44+
<li>Open the <b>CodeSetu</b> tool window (right dock).</li>
45+
<li>Click the <b>provider · model</b> chip in the composer → <b>Configure provider / endpoint…</b> → pick Sarvam, Hugging Face, or OpenAI-compatible, paste your key, and start chatting.</li>
46+
</ol>
47+
48+
<p><b>Selected-code actions:</b> right-click any selection → <i>Explain / Refactor / Write Tests / Fix Bug / Add Docs with CodeSetu</i>.</p>
49+
50+
<h3>Links</h3>
51+
<ul>
52+
<li><a href="https://github.com/getcodesetu/codesetu">Source on GitHub</a></li>
53+
<li><a href="https://github.com/getcodesetu/codesetu/blob/main/INSTALL.md">Install &amp; setup guide</a></li>
54+
<li><a href="https://discord.gg/sjVKU8cpC6">Community Discord</a></li>
55+
<li><a href="https://github.com/getcodesetu/codesetu/issues">Report an issue</a></li>
56+
</ul>
1257
]]></description>
1358

1459
<change-notes><![CDATA[

‎apps/jetbrains/src/main/resources/webview/chat.html‎

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,104 @@
107107
border: 1px solid var(--vscode-inputValidation-errorBorder);
108108
}
109109

110+
#welcome[hidden] {
111+
display: none;
112+
}
113+
114+
.welcome-card {
115+
padding: 14px 16px;
116+
border: 1px solid var(--vscode-input-border, var(--vscode-widget-border));
117+
border-radius: 12px;
118+
background: var(--vscode-editor-inactiveSelectionBackground);
119+
}
120+
121+
.welcome-card h2 {
122+
margin: 0 0 6px;
123+
font-size: 16px;
124+
line-height: 1.25;
125+
}
126+
127+
.welcome-card h3 {
128+
margin: 14px 0 6px;
129+
font-size: 11px;
130+
font-weight: 600;
131+
letter-spacing: 0.6px;
132+
text-transform: uppercase;
133+
color: var(--vscode-descriptionForeground);
134+
}
135+
136+
.welcome-card p {
137+
margin: 0 0 10px;
138+
color: var(--vscode-descriptionForeground);
139+
}
140+
141+
.welcome-steps,
142+
.welcome-bullets {
143+
margin: 0 0 8px 18px;
144+
padding: 0;
145+
}
146+
147+
.welcome-steps li,
148+
.welcome-bullets li {
149+
margin: 4px 0;
150+
}
151+
152+
.welcome-bullets b {
153+
color: var(--vscode-foreground);
154+
}
155+
156+
.welcome-bullets code {
157+
font-family: var(--vscode-editor-font-family, monospace);
158+
font-size: 0.92em;
159+
padding: 1px 4px;
160+
border-radius: 4px;
161+
background: var(--vscode-textCodeBlock-background, rgba(127, 127, 127, 0.12));
162+
}
163+
164+
.welcome-tip {
165+
margin: 12px 0 0;
166+
padding: 8px 10px;
167+
border-radius: 6px;
168+
background: var(--vscode-textCodeBlock-background, rgba(127, 127, 127, 0.08));
169+
color: var(--vscode-foreground);
170+
font-size: 0.95em;
171+
}
172+
173+
.welcome-actions {
174+
display: flex;
175+
gap: 10px;
176+
align-items: center;
177+
flex-wrap: wrap;
178+
}
179+
180+
.welcome-actions .primary {
181+
padding: 6px 12px;
182+
border: 0;
183+
border-radius: 7px;
184+
cursor: pointer;
185+
font: inherit;
186+
color: var(--vscode-button-foreground);
187+
background: var(--vscode-button-background);
188+
}
189+
190+
.welcome-actions .primary:hover {
191+
background: var(--vscode-button-hoverBackground);
192+
}
193+
194+
.welcome-actions .link {
195+
padding: 6px 4px;
196+
border: 0;
197+
background: transparent;
198+
cursor: pointer;
199+
font: inherit;
200+
color: var(--vscode-descriptionForeground);
201+
text-decoration: underline;
202+
}
203+
204+
.welcome-actions .link:hover {
205+
color: var(--vscode-foreground);
206+
}
207+
110208
.composer-wrap {
111209
position: relative;
112210
display: grid;
@@ -392,6 +490,87 @@
392490
<body>
393491
<main>
394492
<section id="transcript" aria-live="polite"></section>
493+
<section id="welcome" hidden>
494+
<div class="welcome-card">
495+
<h2>Welcome to CodeSetu</h2>
496+
<p>
497+
A privacy-aware, open-source AI coding assistant.
498+
<b>Bring your own model</b> — Sarvam, Hugging Face, or any OpenAI-compatible API
499+
(Ollama, vLLM, local). Your key is stored in the OS keychain; your prompts go only to
500+
the provider you configure.
501+
</p>
502+
503+
<h3>Get started in 30 seconds</h3>
504+
<ol class="welcome-steps">
505+
<li>Click <b>Configure provider</b> below.</li>
506+
<li>Pick a provider, paste your API key (stored in the OS keychain).</li>
507+
<li>Type a question and hit send.</li>
508+
</ol>
509+
510+
<div class="welcome-actions">
511+
<button id="welcome-configure" type="button" class="primary">Configure provider</button>
512+
<button id="welcome-docs" type="button" class="link">Learn more</button>
513+
</div>
514+
515+
<h3>What you can do</h3>
516+
<ul class="welcome-bullets">
517+
<li>
518+
<b>Repo-aware chat</b> — your active file and selection are attached automatically.
519+
Toggle this off any time from the <b>+</b> menu in the composer.
520+
</li>
521+
<li>
522+
<b>Selected-code actions</b> — select code, right-click, then pick
523+
<i>Explain / Refactor / Write Tests / Fix Bug / Add Docs with CodeSetu</i>.
524+
</li>
525+
<li>
526+
<b>Switch on the fly</b> — click the <b>provider · model</b> chip in the composer to
527+
change models or providers without leaving the chat.
528+
</li>
529+
<li>
530+
<b>Workspace skills</b> — drop <code>.codesetu/skills/*.md</code> files at the project
531+
root; they're folded into the system prompt for every message.
532+
</li>
533+
</ul>
534+
535+
<h3>Try these prompts</h3>
536+
<ul class="welcome-bullets">
537+
<li>
538+
<b>Understand:</b> &ldquo;Explain what this file does and how the main function fits
539+
in.&rdquo;
540+
</li>
541+
<li>
542+
<b>Refactor:</b> &ldquo;Refactor the selected function for readability without
543+
changing behavior. List the changes.&rdquo;
544+
</li>
545+
<li>
546+
<b>Test:</b> &ldquo;Write unit tests for the selected function — happy path plus edge
547+
cases.&rdquo;
548+
</li>
549+
<li>
550+
<b>Debug:</b> &ldquo;Why might this function throw a null-pointer exception? Give the
551+
smallest safe fix.&rdquo;
552+
</li>
553+
<li>
554+
<b>Document:</b> &ldquo;Add JSDoc comments to the selected function — describe each
555+
parameter and the return value.&rdquo;
556+
</li>
557+
<li>
558+
<b>Translate:</b> &ldquo;Translate the selected Python snippet to TypeScript with
559+
equivalent types.&rdquo;
560+
</li>
561+
<li>
562+
<b>Generate:</b> &ldquo;Generate a regex that matches Indian phone numbers (+91, 10
563+
digits, optional spaces).&rdquo;
564+
</li>
565+
</ul>
566+
567+
<p class="welcome-tip">
568+
<b>Tip:</b> Open the <b>+</b> menu in the composer to toggle
569+
<b>Include IDE context</b> off when asking a general question — keeps prompts small and
570+
your code out of the request.
571+
</p>
572+
</div>
573+
</section>
395574
<form id="chat-form" class="composer-wrap">
396575
<div class="composer-shell">
397576
<textarea id="message" aria-label="Message" placeholder="Ask CodeSetu"></textarea>
@@ -471,6 +650,9 @@
471650
const includeContext = document.getElementById("include-context");
472651
const modelChip = document.getElementById("model-chip");
473652
const modelLabel = document.getElementById("model-label");
653+
const welcome = document.getElementById("welcome");
654+
const welcomeConfigure = document.getElementById("welcome-configure");
655+
const welcomeDocs = document.getElementById("welcome-docs");
474656
let activeAssistantMessage;
475657
let activeAssistantRaw = "";
476658

@@ -589,6 +771,8 @@
589771
message.textContent = text;
590772
}
591773
transcript.appendChild(message);
774+
// First real message hides the welcome panel for the rest of the session.
775+
welcome.hidden = true;
592776
message.scrollIntoView({ block: "end", behavior: "smooth" });
593777
return message;
594778
}
@@ -623,6 +807,14 @@
623807
post({ type: "selectModel" });
624808
});
625809

810+
welcomeConfigure.addEventListener("click", () => {
811+
post({ type: "configureProvider" });
812+
});
813+
814+
welcomeDocs.addEventListener("click", () => {
815+
post({ type: "openUrl", url: "https://github.com/getcodesetu/codesetu" });
816+
});
817+
626818
document.addEventListener("click", (event) => {
627819
const target = event.target;
628820
if (!(target instanceof Element)) {
@@ -681,6 +873,10 @@
681873
modelLabel.textContent = message.text;
682874
}
683875

876+
if (message.type === "welcome") {
877+
welcome.hidden = !message.show;
878+
}
879+
684880
if (message.type === "busy") {
685881
const isBusy = Boolean(message.value);
686882
send.disabled = isBusy;

‎docs/marketplace/README.md‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# JetBrains Marketplace pages
2+
3+
Standalone markdown sources for the **JetBrains Marketplace Custom Pages** under
4+
the CodeSetu vendor profile. Paste each file into the corresponding page on
5+
[plugins.jetbrains.com](https://plugins.jetbrains.com) (the Marketplace UI
6+
accepts markdown).
7+
8+
These pages complement the plugin listing description (which is rendered from
9+
`apps/jetbrains/src/main/resources/META-INF/plugin.xml`). The listing is the
10+
landing page; these are deeper docs.
11+
12+
| File | Suggested page title |
13+
| -------------------------------------------------- | -------------------- |
14+
| [quickstart.md](quickstart.md) | Quickstart |
15+
| [examples.md](examples.md) | Examples |
16+
| [providers-and-models.md](providers-and-models.md) | Providers & Models |
17+
| [privacy-and-security.md](privacy-and-security.md) | Privacy & Security |
18+
| [faq.md](faq.md) | FAQ |
19+
20+
Keep these in sync with the plugin description and `INSTALL.md` when you ship a
21+
release.

0 commit comments

Comments
 (0)