viagen 0.0.1

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 ADDED
@@ -0,0 +1,36 @@
1
+ # Viagen (Vite Agent)
2
+
3
+ A Vite plugin that exposes endpoints for chatting with Claude Code. Add it to any Vite app, spin up a sandbox, and remotely chat with your app to make changes.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install viagen
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ Add the plugin to your `vite.config.ts`:
14
+
15
+ ```ts
16
+ import { defineConfig } from 'vite'
17
+ import { viagen } from 'viagen'
18
+
19
+ export default defineConfig({
20
+ plugins: [viagen()],
21
+ })
22
+ ```
23
+
24
+ Set the `ANTHROPIC_API_KEY` environment variable, then start your dev server. The plugin adds endpoints under `/via/*`:
25
+
26
+ - `GET /via/health` — Returns env var configuration status
27
+ - `GET /via/chat` — *(coming soon)* Chat with Claude Code to modify your app
28
+
29
+ ## Development
30
+
31
+ ```bash
32
+ npm install
33
+ npm run dev # Start the playground dev server
34
+ npm run build # Build the plugin with tsup
35
+ npm run typecheck # Run TypeScript type checking
36
+ ```
package/dist/index.cjs ADDED
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ default: () => index_default,
24
+ viagen: () => viagen
25
+ });
26
+ module.exports = __toCommonJS(index_exports);
27
+ function viagen() {
28
+ return {
29
+ name: "viagen",
30
+ configureServer(server) {
31
+ server.middlewares.use("/via/health", (_req, res) => {
32
+ const required = ["ANTHROPIC_API_KEY"];
33
+ const missing = required.filter((key) => !process.env[key]);
34
+ res.setHeader("Content-Type", "application/json");
35
+ if (missing.length === 0) {
36
+ res.end(JSON.stringify({ status: "ok", configured: true }));
37
+ } else {
38
+ res.end(
39
+ JSON.stringify({ status: "error", configured: false, missing })
40
+ );
41
+ }
42
+ });
43
+ }
44
+ };
45
+ }
46
+ var index_default = viagen;
47
+ // Annotate the CommonJS export names for ESM import in node:
48
+ 0 && (module.exports = {
49
+ viagen
50
+ });
@@ -0,0 +1,5 @@
1
+ import { Plugin } from 'vite';
2
+
3
+ declare function viagen(): Plugin;
4
+
5
+ export { viagen as default, viagen };
@@ -0,0 +1,5 @@
1
+ import { Plugin } from 'vite';
2
+
3
+ declare function viagen(): Plugin;
4
+
5
+ export { viagen as default, viagen };
package/dist/index.js ADDED
@@ -0,0 +1,25 @@
1
+ // src/index.ts
2
+ function viagen() {
3
+ return {
4
+ name: "viagen",
5
+ configureServer(server) {
6
+ server.middlewares.use("/via/health", (_req, res) => {
7
+ const required = ["ANTHROPIC_API_KEY"];
8
+ const missing = required.filter((key) => !process.env[key]);
9
+ res.setHeader("Content-Type", "application/json");
10
+ if (missing.length === 0) {
11
+ res.end(JSON.stringify({ status: "ok", configured: true }));
12
+ } else {
13
+ res.end(
14
+ JSON.stringify({ status: "error", configured: false, missing })
15
+ );
16
+ }
17
+ });
18
+ }
19
+ };
20
+ }
21
+ var index_default = viagen;
22
+ export {
23
+ index_default as default,
24
+ viagen
25
+ };
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "viagen",
3
+ "version": "0.0.1",
4
+ "description": "Vite dev server plugin that exposes endpoints for chatting with Claude Code SDK",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsup",
21
+ "dev": "vite --config playground/vite.config.ts playground",
22
+ "preview": "vite preview --config playground/vite.config.ts playground",
23
+ "typecheck": "tsc --noEmit"
24
+ },
25
+ "peerDependencies": {
26
+ "vite": ">=4"
27
+ },
28
+ "devDependencies": {
29
+ "@types/node": "^25.2.3",
30
+ "tsup": "^8.5.1",
31
+ "typescript": "~5.9.3",
32
+ "vite": "^7.3.1"
33
+ }
34
+ }