viagen 0.0.12 → 0.0.13

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 CHANGED
@@ -66,6 +66,20 @@ viagen({
66
66
  })
67
67
  ```
68
68
 
69
+ ### Sandbox Files
70
+
71
+ Gitignored files (credentials, service accounts, etc.) aren't included when cloning from remote. To forward them into the sandbox, add a `viagen.sandboxFiles` array to your `package.json`:
72
+
73
+ ```json
74
+ {
75
+ "viagen": {
76
+ "sandboxFiles": ["creds.json", "service-account.json"]
77
+ }
78
+ }
79
+ ```
80
+
81
+ These files are always overlaid into the sandbox regardless of deploy mode.
82
+
69
83
  The default system prompt:
70
84
 
71
85
  ```
package/dist/cli.js CHANGED
@@ -835,6 +835,29 @@ async function sandbox(args) {
835
835
  "Note: Not a git repo \u2014 sandbox will use file upload (ephemeral)."
836
836
  );
837
837
  }
838
+ const pkgPath = join2(cwd, "package.json");
839
+ if (existsSync(pkgPath)) {
840
+ try {
841
+ const pkg = JSON.parse(readFileSync2(pkgPath, "utf-8"));
842
+ const sandboxFiles = pkg.viagen?.sandboxFiles ?? [];
843
+ if (sandboxFiles.length > 0) {
844
+ const extra = [];
845
+ for (const file of sandboxFiles) {
846
+ const fullPath = join2(cwd, file);
847
+ if (existsSync(fullPath)) {
848
+ extra.push({ path: file, content: readFileSync2(fullPath) });
849
+ } else {
850
+ console.log(` Warning: sandboxFiles entry "${file}" not found, skipping.`);
851
+ }
852
+ }
853
+ if (extra.length > 0) {
854
+ overlayFiles = [...overlayFiles ?? [], ...extra];
855
+ console.log(` Including ${extra.length} extra file(s) from sandboxFiles config.`);
856
+ }
857
+ }
858
+ } catch {
859
+ }
860
+ }
838
861
  console.log("");
839
862
  console.log("Creating sandbox...");
840
863
  if (deployGit) {
package/dist/index.d.ts CHANGED
@@ -70,6 +70,12 @@ interface ViagenOptions {
70
70
  ui?: boolean;
71
71
  /** Custom system prompt appended to Claude. Overrides the default. */
72
72
  systemPrompt?: string;
73
+ /**
74
+ * Files to always include in sandbox deployments (e.g. credentials, configs).
75
+ * Paths are relative to the project root. Read from package.json `viagen.sandboxFiles`.
76
+ * @example ["config.json"]
77
+ */
78
+ sandboxFiles?: string[];
73
79
  }
74
80
 
75
81
  declare function viagen(options?: ViagenOptions): Plugin;
package/dist/index.js CHANGED
@@ -1478,7 +1478,10 @@ var docsHtmlCache;
1478
1478
  function getDocsHtml() {
1479
1479
  if (!docsHtmlCache) {
1480
1480
  const dir = dirname(fileURLToPath(import.meta.url));
1481
- docsHtmlCache = readFileSync2(join3(dir, "..", "site", "index.html"), "utf-8");
1481
+ docsHtmlCache = readFileSync2(
1482
+ join3(dir, "..", "site", "index.html"),
1483
+ "utf-8"
1484
+ );
1482
1485
  }
1483
1486
  return docsHtmlCache;
1484
1487
  }
@@ -1512,10 +1515,7 @@ function viagen(options) {
1512
1515
  },
1513
1516
  transformIndexHtml(_html, ctx) {
1514
1517
  if (!opts.ui) return [];
1515
- const url = new URL(
1516
- ctx.originalUrl || ctx.path,
1517
- "http://localhost"
1518
- );
1518
+ const url = new URL(ctx.originalUrl || ctx.path, "http://localhost");
1519
1519
  const isEmbed = url.searchParams.has("_viagen_embed");
1520
1520
  if (isEmbed) {
1521
1521
  if (!opts.overlay) return [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "viagen",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "description": "Vite dev server plugin that exposes endpoints for chatting with Claude Code SDK",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/site/index.html CHANGED
@@ -439,6 +439,26 @@ npx viagen sandbox stop &lt;sandboxId&gt;</code></pre>
439
439
  ui: true, // inject chat panel into pages
440
440
  systemPrompt: '...', // custom system prompt (see below)
441
441
  })</code></pre>
442
+
443
+ <h3 style="margin-top: 32px">Sandbox Files</h3>
444
+ <p
445
+ style="
446
+ font-size: 15px;
447
+ color: var(--text-muted);
448
+ line-height: 1.8;
449
+ margin-top: 8px;
450
+ "
451
+ >
452
+ Gitignored files (credentials, service accounts) aren't
453
+ included when cloning from remote. Forward them into the
454
+ sandbox via <code>package.json</code>:
455
+ </p>
456
+ <pre style="margin-top: 12px"><code>{
457
+ "viagen": {
458
+ "sandboxFiles": ["creds.json"]
459
+ }
460
+ }</code></pre>
461
+
442
462
  <p
443
463
  style="
444
464
  font-size: 15px;