viagen 0.0.13 → 0.0.16
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/README.md +12 -9
- package/dist/cli.js +12 -8
- package/dist/index.d.ts +6 -0
- package/dist/index.js +578 -46
- package/package.json +3 -4
- package/site/.viagen/server.log +0 -1
- package/site/icon.png +0 -0
- package/site/icon.svg +0 -2
- package/site/index.html +0 -618
- package/site/vite.config.ts +0 -7
package/README.md
CHANGED
|
@@ -62,23 +62,23 @@ viagen({
|
|
|
62
62
|
panelWidth: 420, // chat panel width in px
|
|
63
63
|
overlay: true, // fix button on error overlay
|
|
64
64
|
ui: true, // inject chat panel into pages
|
|
65
|
+
sandboxFiles: [...], // copy files manually into sandbox
|
|
65
66
|
systemPrompt: '...', // custom system prompt (see below)
|
|
67
|
+
editable: ['src','conf'], // files/dirs editable in the UI
|
|
66
68
|
})
|
|
67
69
|
```
|
|
68
70
|
|
|
69
|
-
###
|
|
71
|
+
### Editable Files
|
|
70
72
|
|
|
71
|
-
|
|
73
|
+
Add a file editor panel to the chat UI:
|
|
72
74
|
|
|
73
|
-
```
|
|
74
|
-
{
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
}
|
|
75
|
+
```ts
|
|
76
|
+
viagen({
|
|
77
|
+
editable: ['src/components', '.env', 'vite.config.ts']
|
|
78
|
+
})
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
Paths can be files or directories (directories include all files within). The editor appears as a "Files" tab in the chat panel. `.env` files get a key-value form with masked values.
|
|
82
82
|
|
|
83
83
|
The default system prompt:
|
|
84
84
|
|
|
@@ -126,6 +126,9 @@ GET /via/health — check API key status
|
|
|
126
126
|
GET /via/error — latest build error (if any)
|
|
127
127
|
GET /via/ui — standalone chat interface
|
|
128
128
|
GET /via/iframe — split view (app + chat side by side)
|
|
129
|
+
GET /via/files — list editable files (when configured)
|
|
130
|
+
GET /via/file?path= — read file content
|
|
131
|
+
POST /via/file — write file content { path, content }
|
|
129
132
|
```
|
|
130
133
|
|
|
131
134
|
When `VIAGEN_AUTH_TOKEN` is set (always on in sandboxes), pass the token as a `Bearer` header or `?token=` query param.
|
package/dist/cli.js
CHANGED
|
@@ -835,11 +835,11 @@ async function sandbox(args) {
|
|
|
835
835
|
"Note: Not a git repo \u2014 sandbox will use file upload (ephemeral)."
|
|
836
836
|
);
|
|
837
837
|
}
|
|
838
|
-
const
|
|
839
|
-
if (existsSync(
|
|
838
|
+
const configPath = join2(cwd, ".viagen", "config.json");
|
|
839
|
+
if (existsSync(configPath)) {
|
|
840
840
|
try {
|
|
841
|
-
const
|
|
842
|
-
const sandboxFiles =
|
|
841
|
+
const config = JSON.parse(readFileSync2(configPath, "utf-8"));
|
|
842
|
+
const sandboxFiles = config.sandboxFiles ?? [];
|
|
843
843
|
if (sandboxFiles.length > 0) {
|
|
844
844
|
const extra = [];
|
|
845
845
|
for (const file of sandboxFiles) {
|
|
@@ -852,7 +852,7 @@ async function sandbox(args) {
|
|
|
852
852
|
}
|
|
853
853
|
if (extra.length > 0) {
|
|
854
854
|
overlayFiles = [...overlayFiles ?? [], ...extra];
|
|
855
|
-
console.log(` Including ${extra.length} extra file(s) from sandboxFiles
|
|
855
|
+
console.log(` Including ${extra.length} extra file(s) from sandboxFiles.`);
|
|
856
856
|
}
|
|
857
857
|
}
|
|
858
858
|
} catch {
|
|
@@ -882,19 +882,23 @@ async function sandbox(args) {
|
|
|
882
882
|
} : void 0,
|
|
883
883
|
timeoutMinutes
|
|
884
884
|
});
|
|
885
|
+
const iframeUrl = result.url.replace("?token=", "via/iframe?token=");
|
|
886
|
+
const chatUrl = result.url.replace("?token=", "via/ui?token=");
|
|
885
887
|
console.log("");
|
|
886
888
|
console.log("Sandbox deployed!");
|
|
887
889
|
console.log("");
|
|
888
|
-
console.log(`
|
|
890
|
+
console.log(` App: ${result.url}`);
|
|
891
|
+
console.log(` Split view: ${iframeUrl}`);
|
|
892
|
+
console.log(` Chat only: ${chatUrl}`);
|
|
893
|
+
console.log("");
|
|
889
894
|
console.log(` Sandbox ID: ${result.sandboxId}`);
|
|
890
895
|
console.log(
|
|
891
896
|
` Mode: ${result.mode === "git" ? "git clone (can push)" : "file upload (ephemeral)"}`
|
|
892
897
|
);
|
|
893
|
-
console.log(` Token: ${result.token}`);
|
|
894
898
|
console.log(` Timeout: ${timeoutMinutes ?? 30} minutes`);
|
|
895
899
|
console.log("");
|
|
896
900
|
console.log(`Stop with: npx viagen sandbox stop ${result.sandboxId}`);
|
|
897
|
-
openBrowser2(
|
|
901
|
+
openBrowser2(iframeUrl);
|
|
898
902
|
}
|
|
899
903
|
function help() {
|
|
900
904
|
console.log("viagen \u2014 Claude Code in your Vite dev server");
|
package/dist/index.d.ts
CHANGED
|
@@ -76,6 +76,12 @@ interface ViagenOptions {
|
|
|
76
76
|
* @example ["config.json"]
|
|
77
77
|
*/
|
|
78
78
|
sandboxFiles?: string[];
|
|
79
|
+
/**
|
|
80
|
+
* Files and directories editable through the UI file panel.
|
|
81
|
+
* Paths are relative to the project root. Directories include all files within.
|
|
82
|
+
* @example ['src/components', '.env', 'vite.config.ts']
|
|
83
|
+
*/
|
|
84
|
+
editable?: string[];
|
|
79
85
|
}
|
|
80
86
|
|
|
81
87
|
declare function viagen(options?: ViagenOptions): Plugin;
|