viagen 0.0.4 → 0.0.5
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 +4 -2
- package/dist/cli.js +5 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -2
- package/package.json +1 -1
- package/site/index.html +6 -3
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ A Vite plugin and CLI tool that enables you to use Claude Code in a sandbox —
|
|
|
11
11
|
## Step 1 — Add viagen to your app
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
npm install viagen
|
|
14
|
+
npm install --save-dev viagen
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
```ts
|
|
@@ -72,7 +72,9 @@ The default system prompt:
|
|
|
72
72
|
You are embedded in a Vite dev server as the "viagen" plugin. Your job is to
|
|
73
73
|
help build and modify the app. Files you edit will trigger Vite HMR
|
|
74
74
|
automatically. You can read .viagen/server.log to check recent Vite dev server
|
|
75
|
-
output (compile errors, HMR updates, warnings).
|
|
75
|
+
output (compile errors, HMR updates, warnings). When running in a sandbox with
|
|
76
|
+
git, the gh CLI is available and authenticated — you can create pull requests,
|
|
77
|
+
comment on issues, and manage releases. Be concise.
|
|
76
78
|
```
|
|
77
79
|
|
|
78
80
|
Recent build errors are automatically appended to give Claude context about what went wrong. To customize the prompt, you can replace it entirely or extend the default:
|
package/dist/cli.js
CHANGED
|
@@ -76,7 +76,7 @@ async function deploySandbox(opts) {
|
|
|
76
76
|
"user.email",
|
|
77
77
|
opts.git.userEmail
|
|
78
78
|
]);
|
|
79
|
-
await sandbox2.runCommand("git", ["checkout", opts.git.branch]);
|
|
79
|
+
await sandbox2.runCommand("git", ["checkout", "-B", opts.git.branch]);
|
|
80
80
|
await sandbox2.runCommand("bash", [
|
|
81
81
|
"-c",
|
|
82
82
|
`echo 'https://x-access-token:${opts.git.token}@${extractHost(opts.git.remoteUrl)}' > ~/.git-credentials`
|
|
@@ -87,6 +87,10 @@ async function deploySandbox(opts) {
|
|
|
87
87
|
"credential.helper",
|
|
88
88
|
"store"
|
|
89
89
|
]);
|
|
90
|
+
await sandbox2.runCommand("bash", [
|
|
91
|
+
"-c",
|
|
92
|
+
"apt-get update -qq && apt-get install -y -qq gh > /dev/null 2>&1 || true"
|
|
93
|
+
]);
|
|
90
94
|
if (opts.overlayFiles && opts.overlayFiles.length > 0) {
|
|
91
95
|
await sandbox2.writeFiles(opts.overlayFiles);
|
|
92
96
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Plugin } from 'vite';
|
|
2
2
|
|
|
3
|
-
declare const DEFAULT_SYSTEM_PROMPT = "You are embedded in a Vite dev server as the \"viagen\" plugin. Your job is to help build and modify the app. Files you edit will trigger Vite HMR automatically. You can read .viagen/server.log to check recent Vite dev server output (compile errors, HMR updates, warnings). Be concise.";
|
|
3
|
+
declare const DEFAULT_SYSTEM_PROMPT = "You are embedded in a Vite dev server as the \"viagen\" plugin. Your job is to help build and modify the app. Files you edit will trigger Vite HMR automatically. You can read .viagen/server.log to check recent Vite dev server output (compile errors, HMR updates, warnings). When running in a sandbox with git, the gh CLI is available and authenticated \u2014 you can create pull requests, comment on issues, and manage releases. Be concise.";
|
|
4
4
|
|
|
5
5
|
interface GitInfo {
|
|
6
6
|
/** HTTPS remote URL (transformed from SSH if needed). */
|
package/dist/index.js
CHANGED
|
@@ -112,7 +112,7 @@ function readBody(req) {
|
|
|
112
112
|
req.on("error", reject);
|
|
113
113
|
});
|
|
114
114
|
}
|
|
115
|
-
var DEFAULT_SYSTEM_PROMPT = `You are embedded in a Vite dev server as the "viagen" plugin. Your job is to help build and modify the app. Files you edit will trigger Vite HMR automatically. You can read .viagen/server.log to check recent Vite dev server output (compile errors, HMR updates, warnings). Be concise.`;
|
|
115
|
+
var DEFAULT_SYSTEM_PROMPT = `You are embedded in a Vite dev server as the "viagen" plugin. Your job is to help build and modify the app. Files you edit will trigger Vite HMR automatically. You can read .viagen/server.log to check recent Vite dev server output (compile errors, HMR updates, warnings). When running in a sandbox with git, the gh CLI is available and authenticated \u2014 you can create pull requests, comment on issues, and manage releases. Be concise.`;
|
|
116
116
|
function findClaudeBin() {
|
|
117
117
|
const _require = createRequire(import.meta.url);
|
|
118
118
|
const pkgPath = _require.resolve("@anthropic-ai/claude-code/package.json");
|
|
@@ -964,7 +964,7 @@ async function deploySandbox(opts) {
|
|
|
964
964
|
"user.email",
|
|
965
965
|
opts.git.userEmail
|
|
966
966
|
]);
|
|
967
|
-
await sandbox.runCommand("git", ["checkout", opts.git.branch]);
|
|
967
|
+
await sandbox.runCommand("git", ["checkout", "-B", opts.git.branch]);
|
|
968
968
|
await sandbox.runCommand("bash", [
|
|
969
969
|
"-c",
|
|
970
970
|
`echo 'https://x-access-token:${opts.git.token}@${extractHost(opts.git.remoteUrl)}' > ~/.git-credentials`
|
|
@@ -975,6 +975,10 @@ async function deploySandbox(opts) {
|
|
|
975
975
|
"credential.helper",
|
|
976
976
|
"store"
|
|
977
977
|
]);
|
|
978
|
+
await sandbox.runCommand("bash", [
|
|
979
|
+
"-c",
|
|
980
|
+
"apt-get update -qq && apt-get install -y -qq gh > /dev/null 2>&1 || true"
|
|
981
|
+
]);
|
|
978
982
|
if (opts.overlayFiles && opts.overlayFiles.length > 0) {
|
|
979
983
|
await sandbox.writeFiles(opts.overlayFiles);
|
|
980
984
|
}
|
package/package.json
CHANGED
package/site/index.html
CHANGED
|
@@ -231,9 +231,9 @@
|
|
|
231
231
|
<section>
|
|
232
232
|
<h2>Step 1 — Add viagen to your app</h2>
|
|
233
233
|
<div class="install">
|
|
234
|
-
<code>npm install viagen</code>
|
|
234
|
+
<code>npm install --save-dev viagen</code>
|
|
235
235
|
<button
|
|
236
|
-
onclick="navigator.clipboard.writeText('npm install viagen').then(()=>{this.textContent='Copied!';setTimeout(()=>this.textContent='Copy',1500)})"
|
|
236
|
+
onclick="navigator.clipboard.writeText('npm install --save-dev viagen').then(()=>{this.textContent='Copied!';setTimeout(()=>this.textContent='Copy',1500)})"
|
|
237
237
|
>
|
|
238
238
|
Copy
|
|
239
239
|
</button>
|
|
@@ -338,7 +338,10 @@ npx viagen sandbox stop <sandboxId></code></pre>
|
|
|
338
338
|
Your job is to help build and modify the app. Files you edit
|
|
339
339
|
will trigger Vite HMR automatically. You can read
|
|
340
340
|
.viagen/server.log to check recent Vite dev server output
|
|
341
|
-
(compile errors, HMR updates, warnings).
|
|
341
|
+
(compile errors, HMR updates, warnings). When running in a
|
|
342
|
+
sandbox with git, the gh CLI is available and authenticated —
|
|
343
|
+
you can create pull requests, comment on issues, and manage
|
|
344
|
+
releases. Be concise.</code></pre>
|
|
342
345
|
<p
|
|
343
346
|
style="
|
|
344
347
|
font-size: 15px;
|