Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.
Python aicode-complexitycode-healthcode-intelligencecode-qualitydead-codedeveloper-toolsdocumentationgit-analyticsmcpopen-sourcepythonrefactoringstatic-analysistechnical-debt
feat(vscode): Publish to repowise.dev command and one-time prompts (#3006)
Swati Ahuja93f35bed7b1c
diff --git a/packages/vscode/README.md b/packages/vscode/README.mdindex 657df56ed..58fce0c9a 100644--- a/packages/vscode/README.md+++ b/packages/vscode/README.md@@ -109,13 +109,23 @@ The quickest way to tune Repowise is **Repowise: Open Settings**, a friendly pan| `repowise.diagnostics.enabled` | `false` | Also publish high-severity findings to the Problems panel || `repowise.docDrift.diagnostics.enabled` | `true` | Flag lines in visible markdown files whose paths, links, anchors, commands or code symbols no longer exist |+## Take it further with repowise.dev++The same engine, hosted. Run **Repowise: Publish to repowise.dev** (or `repowise publish`) and repowise.dev indexes this repo from GitHub, free for public repos:++- **Use your index from Claude.ai and ChatGPT.** Each hosted repo has an MCP address that cloud AI apps can reach; they cannot reach your laptop.+- **Keep it fresh on every push.** No manual updates; the index follows the repo (Pro, free for 10 days with a card).+- **The PR bot comments on every pull request** with the callers a change reaches and the tests to run first.++[See what hosted adds](https://repowise.dev/hosted?src=vscode_listing) · [Open Repowise's own repo on repowise.dev](https://repowise.dev/repo/repowise-dev/repowise?src=vscode_listing)+## Privacy-The extension talks only to the local Repowise CLI and server on your machine and reads the index under `.repowise/` in your project. It sends no telemetry of its own, and nothing about your code leaves your machine through this extension.+The extension talks only to the local Repowise CLI and server on your machine and reads the index under `.repowise/` in your project. It sends no telemetry of its own, and nothing about your code leaves your machine through this extension unless you run **Publish to repowise.dev**, which asks repowise.dev to index the repo's GitHub remote. Links to repowise.dev carry only where they were clicked: no install id, and never VS Code's machine id.## Learn more-- [repowise.dev](https://www.repowise.dev) and the [live demo](https://www.repowise.dev)+- [repowise.dev](https://repowise.dev/?src=vscode_listing) and the [live demo](https://repowise.dev/repo/repowise-dev/repowise?src=vscode_listing)- [Documentation](https://docs.repowise.dev)- [GitHub](https://github.com/repowise-dev/repowise) (AGPL-3.0, free and open source)- [Discord](https://discord.gg/cQVpuDB6rh)diff --git a/packages/vscode/media/walkthrough/share-team.md b/packages/vscode/media/walkthrough/share-team.mdnew file mode 100644index 000000000..b682f74a2--- /dev/null+++ b/packages/vscode/media/walkthrough/share-team.md@@ -0,0 +1,14 @@+# Share with your team and connect Claude.ai++Your index lives on this machine. **Repowise: Publish to repowise.dev** runs+`repowise publish`, which asks repowise.dev to index the same repo from GitHub+(nothing is uploaded, and only what you have pushed is published). You then get:++- one link your team can open in any browser, with nothing to install;+- an MCP address to add in Claude.ai or ChatGPT, which cannot reach your laptop;+- an index that stays up to date on every push (Pro).++Public repos publish free on a free account (up to 2, no card). Private repos and+more repos need Pro, free for 10 days with a card.++[See what hosted adds](https://repowise.dev/hosted?src=vscode_walkthrough#team)diff --git a/packages/vscode/package.json b/packages/vscode/package.jsonindex 0b46cff3b..2dd8ff3d9 100644--- a/packages/vscode/package.json+++ b/packages/vscode/package.json@@ -252,6 +252,12 @@"title": "Open Settings","category": "Repowise","icon": "$(gear)"+ },+ {+ "command": "repowise.publish",+ "title": "Publish to repowise.dev",+ "category": "Repowise",+ "icon": "$(cloud-upload)"}],"menus": {@@ -320,7 +326,7 @@{"view": "repowise.home","when": "isWorkspaceTrusted && repowise.state == 'not-installed'",- "contents": "The repowise CLI was not found on your PATH.\n\nInstall it, then set it up for this repository.\n\n[Check Setup](command:repowise.checkSetup)\n\nIf the CLI lives at a custom location, set `repowise.cliPath` in settings."+ "contents": "The repowise CLI was not found on your PATH.\n\nInstall it, then set it up for this repository.\n\n[Check Setup](command:repowise.checkSetup)\n\nIf the CLI lives at a custom location, set `repowise.cliPath` in settings.\n\nNo Python? Read any public repo on repowise.dev, nothing to install, free.\n\n[Try repowise.dev](https://repowise.dev/hosted?src=vscode_no_python#link)"},{"view": "repowise.home",@@ -523,6 +529,15 @@"markdown": "media/walkthrough/connect-mcp.md"},"completionEvents": ["onCommand:repowise.configureMcp"]+ },+ {+ "id": "shareTeam",+ "title": "Share with your team and connect Claude.ai",+ "description": "Publish this repo to repowise.dev: one link your team can open, and an MCP address for Claude.ai and ChatGPT. Free for public repos.\n[Publish It Free](command:repowise.publish)",+ "media": {+ "markdown": "media/walkthrough/share-team.md"+ },+ "completionEvents": ["onCommand:repowise.publish"]}]}diff --git a/packages/vscode/src/constants.ts b/packages/vscode/src/constants.tsindex 5c9018d65..66343a81f 100644--- a/packages/vscode/src/constants.ts+++ b/packages/vscode/src/constants.ts@@ -41,6 +41,7 @@ export const Commands = {showKnowledgeGraph: "repowise.showKnowledgeGraph",showDecisionTimeline: "repowise.showDecisionTimeline",showSettings: "repowise.showSettings",+ publish: "repowise.publish",} as const;/**@@ -57,6 +58,8 @@ export const InternalCommands = {handPlanToCopilot: "repowise.handPlanToCopilot",/** Hand a refactoring plan to Claude Code; bound to code actions. */handPlanToClaudeCode: "repowise.handPlanToClaudeCode",+ /** The one-time "publish to repowise.dev" prompt; fired after setup succeeds. */+ offerPublish: "repowise.offerPublish",} as const;/**diff --git a/packages/vscode/src/extension.ts b/packages/vscode/src/extension.tsindex 008416e99..0c306d5f3 100644--- a/packages/vscode/src/extension.ts+++ b/packages/vscode/src/extension.ts@@ -9,6 +9,7 @@ import { createCliRunner } from "./core/cliRunner";import { RepowiseContext } from "./core/context";import { registerStatusBar } from "./features/statusBar";import { registerOnboarding } from "./features/onboarding";+import { registerHosted } from "./features/hosted";import { registerServerManager } from "./features/serverManager";import { registerMcp } from "./features/mcp";import { registerDiagnostics } from "./features/diagnostics";@@ -83,6 +84,7 @@ export function activate(extCtx: vscode.ExtensionContext): void {extCtx.subscriptions.push(registerStatusBar(ctx),registerOnboarding(ctx),+ registerHosted(ctx, extCtx.globalState),registerServerManager(ctx),registerMcp(ctx),registerDiagnostics(ctx),diff --git a/packages/vscode/src/features/hosted.ts b/packages/vscode/src/features/hosted.tsnew file mode 100644index 000000000..bffaccf8d--- /dev/null+++ b/packages/vscode/src/features/hosted.ts@@ -0,0 +1,49 @@+import * as vscode from "vscode";+import { Commands, InternalCommands } from "../constants";+import type { RepowiseContext } from "../core/context";+import { hostedStoryUrl } from "../shared/hostedLinks";++/** globalState key: the post-setup publish prompt has been shown once. */+const SETUP_PROMPT_SHOWN = "repowise.hosted.setupPromptShown";++/**+ * repowise.dev from the editor: the `repowise.publish` command (runs the CLI's+ * `repowise publish` in a terminal, so the flow and its messages live in one+ * place) and the one-time prompt after setup succeeds. Every link carries its+ * `src` and nothing else: no install id, never `vscode.env.machineId`.+ */+export function registerHosted(+ ctx: RepowiseContext,+ globalState: vscode.Memento,+): vscode.Disposable {+ function runPublish(): void {+ const cliPath = ctx.config.cliPath();+ const exe = cliPath ? (cliPath.includes(" ") ? `"${cliPath}"` : cliPath) : "repowise";+ const terminal =+ vscode.window.terminals.find((t) => t.name === "Repowise") ??+ vscode.window.createTerminal("Repowise");+ terminal.show();+ terminal.sendText(`${exe} publish`);+ }++ async function offerAfterSetup(): Promise<void> {+ if (globalState.get<boolean>(SETUP_PROMPT_SHOWN)) return;+ // Shown once, whatever the answer: it is never repeated.+ await globalState.update(SETUP_PROMPT_SHOWN, true);+ const choice = await vscode.window.showInformationMessage(+ "Also use this repo from Claude.ai / ChatGPT: publish it to repowise.dev. " ++ "Free for public repos.",+ "Publish it free",+ "Learn more",+ );+ if (choice === "Publish it free") runPublish();+ if (choice === "Learn more") {+ await vscode.env.openExternal(vscode.Uri.parse(hostedStoryUrl("vscode_setup_done", "mcp")));+ }+ }++ return vscode.Disposable.from(+ vscode.commands.registerCommand(Commands.publish, runPublish),+ vscode.commands.registerCommand(InternalCommands.offerPublish, offerAfterSetup),+ );+}diff --git a/packages/vscode/src/features/onboarding.ts b/packages/vscode/src/features/onboarding.tsindex 7169d25bc..0e4dea287 100644--- a/packages/vscode/src/features/onboarding.ts+++ b/packages/vscode/src/features/onboarding.ts@@ -1,5 +1,5 @@import * as vscode from "vscode";-import { Commands } from "../constants";+import { Commands, InternalCommands } from "../constants";import type { RepowiseContext } from "../core/context";/** Grace period before the one deferred CLI-presence probe runs. */@@ -120,6 +120,8 @@ export function registerOnboarding(ctx: RepowiseContext): vscode.Disposable {if (choice === "Start Server") {void vscode.commands.executeCommand(Commands.startServer);}+ // Then, once ever, what repowise.dev adds (owned by the hosted feature).+ void vscode.commands.executeCommand(InternalCommands.offerPublish);})();};watcher.onDidCreate(onCreated);diff --git a/packages/vscode/src/features/statusBar.ts b/packages/vscode/src/features/statusBar.tsindex 1e5011852..7a3f4d3a2 100644--- a/packages/vscode/src/features/statusBar.ts+++ b/packages/vscode/src/features/statusBar.ts@@ -56,7 +56,14 @@ export function registerStatusBar(ctx: RepowiseContext): vscode.Disposable {const lines = ["Connected to the local Repowise server."];if (detail?.version) lines.push(`Version ${detail.version}`);if (detail?.url) lines.push(detail.url);- item.tooltip = lines.join("\n");+ // One quiet way to the hosted side, inside the tooltip rather than as+ // another status-bar item.+ const tooltip = new vscode.MarkdownString(lines.join(" \n"));+ tooltip.appendMarkdown(+ `\n\n[Publish / Share on repowise.dev](command:${Commands.publish}) (free for public repos)`,+ );+ tooltip.isTrusted = { enabledCommands: [Commands.publish] };+ item.tooltip = tooltip;item.command = Commands.showLog;item.backgroundColor = undefined;break;diff --git a/packages/vscode/src/shared/hostedLinks.ts b/packages/vscode/src/shared/hostedLinks.tsnew file mode 100644index 000000000..1474e3509--- /dev/null+++ b/packages/vscode/src/shared/hostedLinks.ts@@ -0,0 +1,13 @@+/**+ * Links from the extension to the repowise.dev/hosted story. Dependency-free+ * (no 'vscode' import) so the rules are testable on their own.+ */++export const SITE_URL = "https://repowise.dev";++/** `https://repowise.dev/hosted?src=…#moment`. Only `src`: a link someone+ * opens never carries an install or machine id. */+export function hostedStoryUrl(src: string, moment: string): string {+ const params = new URLSearchParams({ src });+ return `${SITE_URL}/hosted?${params.toString()}#${moment}`;+}diff --git a/packages/vscode/src/test/extension.test.ts b/packages/vscode/src/test/extension.test.tsindex c279a5106..18040731e 100644--- a/packages/vscode/src/test/extension.test.ts+++ b/packages/vscode/src/test/extension.test.ts@@ -64,6 +64,24 @@ describe("Repowise extension", () => {}});+ it("ends the walkthrough on publishing, linked with its source", () => {+ const manifest = getExtension().packageJSON as {+ contributes: {+ walkthroughs: Array<{ steps: Array<{ id: string; description: string }> }>;+ viewsWelcome: Array<{ when: string; contents: string }>;+ };+ };+ const steps = manifest.contributes.walkthroughs[0]?.steps ?? [];+ const last = steps[steps.length - 1];+ assert.ok(last);+ assert.strictEqual(last.id, "shareTeam");+ assert.ok(last.description.includes(`command:${Commands.publish}`));+ const notInstalled = manifest.contributes.viewsWelcome.find((v) =>+ v.when.includes("not-installed"),+ );+ assert.ok(notInstalled?.contents.includes("src=vscode_no_python"));+ });+it("runs Show Log without throwing", async () => {const ext = getExtension();await ext.activate();diff --git a/packages/vscode/webview/src/hostedLinks.test.ts b/packages/vscode/webview/src/hostedLinks.test.tsnew file mode 100644index 000000000..9aec86c89--- /dev/null+++ b/packages/vscode/webview/src/hostedLinks.test.ts@@ -0,0 +1,10 @@+import { describe, it, expect } from "vitest";+import { hostedStoryUrl } from "../../src/shared/hostedLinks";++describe("hostedStoryUrl", () => {+ it("opens the story at its moment, tagged with the surface and nothing else", () => {+ expect(hostedStoryUrl("vscode_setup_done", "mcp")).toBe(+ "https://repowise.dev/hosted?src=vscode_setup_done#mcp",+ );+ });+});