rivet-design 0.1.0
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/LICENSE.md +674 -0
- package/README.md +112 -0
- package/bin/rivet.js +27 -0
- package/dist/index-core.d.ts +15 -0
- package/dist/index-core.d.ts.map +1 -0
- package/dist/index-core.js +38 -0
- package/dist/index-core.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +217 -0
- package/dist/index.js.map +1 -0
- package/dist/routes/components.d.ts +2 -0
- package/dist/routes/components.d.ts.map +1 -0
- package/dist/routes/components.js +58 -0
- package/dist/routes/components.js.map +1 -0
- package/dist/routes/git.d.ts +3 -0
- package/dist/routes/git.d.ts.map +1 -0
- package/dist/routes/git.js +52 -0
- package/dist/routes/git.js.map +1 -0
- package/dist/routes/modifications.d.ts +3 -0
- package/dist/routes/modifications.d.ts.map +1 -0
- package/dist/routes/modifications.js +241 -0
- package/dist/routes/modifications.js.map +1 -0
- package/dist/routes/selection.d.ts +2 -0
- package/dist/routes/selection.d.ts.map +1 -0
- package/dist/routes/selection.js +38 -0
- package/dist/routes/selection.js.map +1 -0
- package/dist/scripts/selection-script.js +724 -0
- package/dist/server.d.ts +9 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +93 -0
- package/dist/server.js.map +1 -0
- package/dist/services/ComponentSearchService.d.ts +12 -0
- package/dist/services/ComponentSearchService.d.ts.map +1 -0
- package/dist/services/ComponentSearchService.js +61 -0
- package/dist/services/ComponentSearchService.js.map +1 -0
- package/dist/services/FileModificationService.d.ts +29 -0
- package/dist/services/FileModificationService.d.ts.map +1 -0
- package/dist/services/FileModificationService.js +82 -0
- package/dist/services/FileModificationService.js.map +1 -0
- package/dist/services/LLMService.d.ts +60 -0
- package/dist/services/LLMService.d.ts.map +1 -0
- package/dist/services/LLMService.js +201 -0
- package/dist/services/LLMService.js.map +1 -0
- package/dist/services/LocalGitService.d.ts +33 -0
- package/dist/services/LocalGitService.d.ts.map +1 -0
- package/dist/services/LocalGitService.js +252 -0
- package/dist/services/LocalGitService.js.map +1 -0
- package/dist/services/ProjectDetectionService.d.ts +26 -0
- package/dist/services/ProjectDetectionService.d.ts.map +1 -0
- package/dist/services/ProjectDetectionService.js +147 -0
- package/dist/services/ProjectDetectionService.js.map +1 -0
- package/dist/services/ScriptInjectionService.d.ts +8 -0
- package/dist/services/ScriptInjectionService.d.ts.map +1 -0
- package/dist/services/ScriptInjectionService.js +178 -0
- package/dist/services/ScriptInjectionService.js.map +1 -0
- package/dist/services/SessionService.d.ts +26 -0
- package/dist/services/SessionService.d.ts.map +1 -0
- package/dist/services/SessionService.js +141 -0
- package/dist/services/SessionService.js.map +1 -0
- package/dist/types/change-types.d.ts +93 -0
- package/dist/types/change-types.d.ts.map +1 -0
- package/dist/types/change-types.js +4 -0
- package/dist/types/change-types.js.map +1 -0
- package/dist/types/proxy-types.d.ts +34 -0
- package/dist/types/proxy-types.d.ts.map +1 -0
- package/dist/types/proxy-types.js +3 -0
- package/dist/types/proxy-types.js.map +1 -0
- package/dist/types/types.d.ts +15 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/types.js +3 -0
- package/dist/types/types.js.map +1 -0
- package/dist/utils/logger.d.ts +20 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +51 -0
- package/dist/utils/logger.js.map +1 -0
- package/package.json +86 -0
- package/src/ui/dist/assets/main-DuNgkeFM.js +105 -0
- package/src/ui/dist/assets/main-DzZ9GWvo.css +1 -0
- package/src/ui/dist/index.html +14 -0
package/README.md
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Rivet Visual Editor
|
|
2
|
+
|
|
3
|
+
An interactive visual editor for web applications that allows you to preview any GitHub repository and eventually edit code visually.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🔗 **Repository Preview**: Clone and preview any public GitHub repository
|
|
8
|
+
- 📱 **Responsive Interface**: Clean, modern UI with sidebar navigation
|
|
9
|
+
- 🚀 **Live Development**: Automatic dev server startup for previewed projects
|
|
10
|
+
- 🗂️ **Project Management**: Track multiple projects with status indicators
|
|
11
|
+
- 🔄 **Hot Reload Ready**: Built-in support for framework hot reloading
|
|
12
|
+
|
|
13
|
+
## Architecture
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
rivet/
|
|
17
|
+
├── client/ # Next.js frontend (port 3000)
|
|
18
|
+
├── backend/ # Express.js API (port 4000)
|
|
19
|
+
├── projects/ # Cloned repositories
|
|
20
|
+
└── setup.sh # Quick setup script
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Quick Start
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Setup (one time)
|
|
27
|
+
./setup.sh
|
|
28
|
+
|
|
29
|
+
# Start development
|
|
30
|
+
yarn dev
|
|
31
|
+
|
|
32
|
+
# Visit http://localhost:3000
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Manual Setup
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# Install dependencies
|
|
39
|
+
yarn install:all
|
|
40
|
+
|
|
41
|
+
# Start services
|
|
42
|
+
yarn dev:frontend # http://localhost:3000
|
|
43
|
+
yarn dev:backend # http://localhost:4000
|
|
44
|
+
|
|
45
|
+
# Or both together
|
|
46
|
+
yarn dev
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Usage
|
|
50
|
+
|
|
51
|
+
1. **Open the Editor**: Visit [http://localhost:3000](http://localhost:3000)
|
|
52
|
+
|
|
53
|
+
2. **Add a Repository**: Enter a GitHub URL in the sidebar:
|
|
54
|
+
```
|
|
55
|
+
https://github.com/vercel/next.js/tree/canary/examples/hello-world
|
|
56
|
+
https://github.com/facebook/create-react-app
|
|
57
|
+
https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
3. **Create Preview**: Click "Create Preview" - this will:
|
|
61
|
+
- Clone the repository
|
|
62
|
+
- Install dependencies (npm/yarn/pnpm auto-detected)
|
|
63
|
+
- Start the development server
|
|
64
|
+
- Display the live preview in an iframe
|
|
65
|
+
|
|
66
|
+
4. **Manage Projects**: View all your projects in the sidebar with status indicators
|
|
67
|
+
|
|
68
|
+
## API Endpoints
|
|
69
|
+
|
|
70
|
+
- `POST /api/create-preview` - Create a new project preview
|
|
71
|
+
- `GET /api/projects` - List all projects
|
|
72
|
+
- `GET /api/projects/:id` - Get specific project
|
|
73
|
+
- `DELETE /api/projects/:id` - Delete project and cleanup
|
|
74
|
+
|
|
75
|
+
## Supported Frameworks
|
|
76
|
+
|
|
77
|
+
Currently supports any project with standard npm scripts:
|
|
78
|
+
- Next.js
|
|
79
|
+
- React (Create React App, Vite)
|
|
80
|
+
- Vue.js
|
|
81
|
+
- Svelte
|
|
82
|
+
- Express.js
|
|
83
|
+
- And many more!
|
|
84
|
+
|
|
85
|
+
## Development
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# Frontend only
|
|
89
|
+
cd client && yarn dev
|
|
90
|
+
|
|
91
|
+
# Backend only
|
|
92
|
+
cd backend && yarn dev
|
|
93
|
+
|
|
94
|
+
# Type checking
|
|
95
|
+
cd backend && yarn typecheck
|
|
96
|
+
cd client && yarn build # Next.js type checks on build
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Roadmap
|
|
100
|
+
|
|
101
|
+
- [x] Repository cloning and preview
|
|
102
|
+
- [x] Project management interface
|
|
103
|
+
- [x] Multiple framework support
|
|
104
|
+
- [ ] Element selection system
|
|
105
|
+
- [ ] Visual code editing
|
|
106
|
+
- [ ] LLM-powered code generation
|
|
107
|
+
- [ ] Real-time collaboration
|
|
108
|
+
- [ ] Deployment integration
|
|
109
|
+
|
|
110
|
+
## License
|
|
111
|
+
|
|
112
|
+
MIT
|
package/bin/rivet.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// Import the compiled main function
|
|
4
|
+
const { main } = require('../dist/index.js');
|
|
5
|
+
|
|
6
|
+
// Handle uncaught exceptions gracefully
|
|
7
|
+
process.on('uncaughtException', (error) => {
|
|
8
|
+
console.error('Uncaught exception:', error);
|
|
9
|
+
process.exit(1);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
process.on('unhandledRejection', (reason, promise) => {
|
|
13
|
+
console.error('Unhandled rejection at:', promise, 'reason:', reason);
|
|
14
|
+
process.exit(1);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
// Handle Ctrl+C gracefully
|
|
18
|
+
process.on('SIGINT', () => {
|
|
19
|
+
console.log('\n👋 Goodbye!');
|
|
20
|
+
process.exit(0);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// Start the CLI
|
|
24
|
+
main().catch((error) => {
|
|
25
|
+
console.error('CLI error:', error);
|
|
26
|
+
process.exit(1);
|
|
27
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { ComponentSearchService } from './services/ComponentSearchService';
|
|
2
|
+
export { FileModificationService } from './services/FileModificationService';
|
|
3
|
+
export { LLMService } from './services/LLMService';
|
|
4
|
+
export { LocalGitService } from './services/LocalGitService';
|
|
5
|
+
export { ProjectDetectionService } from './services/ProjectDetectionService';
|
|
6
|
+
export { ScriptInjectionService } from './services/ScriptInjectionService';
|
|
7
|
+
export { SessionService } from './services/SessionService';
|
|
8
|
+
export * from './types/types';
|
|
9
|
+
export { createLogger } from './utils/logger';
|
|
10
|
+
export type { Project, FrameworkConfig } from './services/ProjectDetectionService';
|
|
11
|
+
export type { RepoInfo } from './services/LocalGitService';
|
|
12
|
+
export type { LLMRequest, CodeModificationResult } from './services/LLMService';
|
|
13
|
+
export type { SessionStatus } from './services/SessionService';
|
|
14
|
+
export type { ChangeRequest, ChangeRecord, ElementContext, CSSChangeData, LLMChangeData, CodeModificationRequest, CodeModificationResponse } from './types/change-types';
|
|
15
|
+
//# sourceMappingURL=index-core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-core.d.ts","sourceRoot":"","sources":["../src/index-core.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAG3D,cAAc,eAAe,CAAC;AAG9B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,YAAY,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACnF,YAAY,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC3D,YAAY,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAChF,YAAY,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,YAAY,EACV,aAAa,EACb,YAAY,EACZ,cAAc,EACd,aAAa,EACb,aAAa,EACb,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.createLogger = exports.SessionService = exports.ScriptInjectionService = exports.ProjectDetectionService = exports.LocalGitService = exports.LLMService = exports.FileModificationService = exports.ComponentSearchService = void 0;
|
|
18
|
+
// Services
|
|
19
|
+
var ComponentSearchService_1 = require("./services/ComponentSearchService");
|
|
20
|
+
Object.defineProperty(exports, "ComponentSearchService", { enumerable: true, get: function () { return ComponentSearchService_1.ComponentSearchService; } });
|
|
21
|
+
var FileModificationService_1 = require("./services/FileModificationService");
|
|
22
|
+
Object.defineProperty(exports, "FileModificationService", { enumerable: true, get: function () { return FileModificationService_1.FileModificationService; } });
|
|
23
|
+
var LLMService_1 = require("./services/LLMService");
|
|
24
|
+
Object.defineProperty(exports, "LLMService", { enumerable: true, get: function () { return LLMService_1.LLMService; } });
|
|
25
|
+
var LocalGitService_1 = require("./services/LocalGitService");
|
|
26
|
+
Object.defineProperty(exports, "LocalGitService", { enumerable: true, get: function () { return LocalGitService_1.LocalGitService; } });
|
|
27
|
+
var ProjectDetectionService_1 = require("./services/ProjectDetectionService");
|
|
28
|
+
Object.defineProperty(exports, "ProjectDetectionService", { enumerable: true, get: function () { return ProjectDetectionService_1.ProjectDetectionService; } });
|
|
29
|
+
var ScriptInjectionService_1 = require("./services/ScriptInjectionService");
|
|
30
|
+
Object.defineProperty(exports, "ScriptInjectionService", { enumerable: true, get: function () { return ScriptInjectionService_1.ScriptInjectionService; } });
|
|
31
|
+
var SessionService_1 = require("./services/SessionService");
|
|
32
|
+
Object.defineProperty(exports, "SessionService", { enumerable: true, get: function () { return SessionService_1.SessionService; } });
|
|
33
|
+
// Types
|
|
34
|
+
__exportStar(require("./types/types"), exports);
|
|
35
|
+
// Utilities
|
|
36
|
+
var logger_1 = require("./utils/logger");
|
|
37
|
+
Object.defineProperty(exports, "createLogger", { enumerable: true, get: function () { return logger_1.createLogger; } });
|
|
38
|
+
//# sourceMappingURL=index-core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-core.js","sourceRoot":"","sources":["../src/index-core.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,WAAW;AACX,4EAA2E;AAAlE,gIAAA,sBAAsB,OAAA;AAC/B,8EAA6E;AAApE,kIAAA,uBAAuB,OAAA;AAChC,oDAAmD;AAA1C,wGAAA,UAAU,OAAA;AACnB,8DAA6D;AAApD,kHAAA,eAAe,OAAA;AACxB,8EAA6E;AAApE,kIAAA,uBAAuB,OAAA;AAChC,4EAA2E;AAAlE,gIAAA,sBAAsB,OAAA;AAC/B,4DAA2D;AAAlD,gHAAA,cAAc,OAAA;AAEvB,QAAQ;AACR,gDAA8B;AAE9B,YAAY;AACZ,yCAA8C;AAArC,sGAAA,YAAY,OAAA"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type CLIOptions = {
|
|
2
|
+
port?: number;
|
|
3
|
+
userPort?: number;
|
|
4
|
+
help?: boolean;
|
|
5
|
+
version?: boolean;
|
|
6
|
+
noBrowser?: boolean;
|
|
7
|
+
debug?: boolean;
|
|
8
|
+
injectPath?: string;
|
|
9
|
+
trackWithGit?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare const main: (args?: string[]) => Promise<void>;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,IAAI,GAAU,OAAM,MAAM,EAA0B,KAAG,OAAO,CAAC,IAAI,CAiG/E,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.main = void 0;
|
|
40
|
+
const server_1 = require("./server");
|
|
41
|
+
const index_core_1 = require("./index-core");
|
|
42
|
+
const open_1 = __importDefault(require("open"));
|
|
43
|
+
const path_1 = __importDefault(require("path"));
|
|
44
|
+
const dotenv = __importStar(require("dotenv"));
|
|
45
|
+
const fs_1 = __importDefault(require("fs"));
|
|
46
|
+
const log = (0, index_core_1.createLogger)('RivetCLI');
|
|
47
|
+
const main = async (args = process.argv.slice(2)) => {
|
|
48
|
+
try {
|
|
49
|
+
// Parse basic CLI arguments first
|
|
50
|
+
const options = parseArgs(args);
|
|
51
|
+
// Load Rivet's own environment variables from its .env.local file
|
|
52
|
+
const rivetEnvPath = path_1.default.resolve(__dirname, '../.env.local');
|
|
53
|
+
if (fs_1.default.existsSync(rivetEnvPath)) {
|
|
54
|
+
dotenv.config({ path: rivetEnvPath });
|
|
55
|
+
log.debug('📝 Loaded Rivet environment variables');
|
|
56
|
+
// Log which LLM configuration is active
|
|
57
|
+
if (process.env.RIVET_PROXY_URL) {
|
|
58
|
+
log.debug('🔗 Proxy mode enabled - using remote LLM proxy');
|
|
59
|
+
}
|
|
60
|
+
else if (process.env.ANTHROPIC_API_KEY || process.env.OPENAI_API_KEY) {
|
|
61
|
+
log.debug('🤖 Direct mode enabled - using local API keys');
|
|
62
|
+
if (process.env.ANTHROPIC_API_KEY) {
|
|
63
|
+
log.debug(' Anthropic (Claude) API key found');
|
|
64
|
+
}
|
|
65
|
+
if (process.env.OPENAI_API_KEY) {
|
|
66
|
+
log.debug(' OpenAI API key found');
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
log.warn('⚠️ No LLM configuration found - AI features will not work');
|
|
71
|
+
log.debug(' Either set RIVET_PROXY_URL for proxy mode,');
|
|
72
|
+
log.debug(' or ANTHROPIC_API_KEY / OPENAI_API_KEY for direct mode');
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
log.warn('⚠️ No Rivet .env.local file found - AI features may not work without API keys');
|
|
77
|
+
log.debug(` Expected at: ${rivetEnvPath}`);
|
|
78
|
+
}
|
|
79
|
+
// Set debug logging level if requested
|
|
80
|
+
if (options.debug) {
|
|
81
|
+
process.env.LOG_LEVEL = 'DEBUG';
|
|
82
|
+
log.debug('🐛 Debug mode enabled - LOG_LEVEL=DEBUG');
|
|
83
|
+
}
|
|
84
|
+
log.info('🎨 Starting Rivet...');
|
|
85
|
+
if (options.help) {
|
|
86
|
+
showHelp();
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (options.version) {
|
|
90
|
+
showVersion();
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const projectDetection = new index_core_1.ProjectDetectionService();
|
|
94
|
+
const project = await projectDetection.detectProject(process.cwd());
|
|
95
|
+
const userDevServerPort = options.userPort || project.devServerPort;
|
|
96
|
+
const rivetPort = options.port || 4000;
|
|
97
|
+
log.debug(`📡 Connecting to project dev server on port ${userDevServerPort}${options.userPort ? ' (user-specified)' : ' (detected)'}`);
|
|
98
|
+
// Inject selection script into user's project
|
|
99
|
+
const scriptInjection = new index_core_1.ScriptInjectionService();
|
|
100
|
+
await scriptInjection.injectScript(process.cwd(), project.framework, options.injectPath, rivetPort);
|
|
101
|
+
await (0, server_1.startServer)({
|
|
102
|
+
port: rivetPort,
|
|
103
|
+
userPort: userDevServerPort,
|
|
104
|
+
trackWithGit: options.trackWithGit ?? true,
|
|
105
|
+
framework: project.framework,
|
|
106
|
+
injectPath: options.injectPath
|
|
107
|
+
});
|
|
108
|
+
// Open browser automatically unless disabled
|
|
109
|
+
if (!options.noBrowser) {
|
|
110
|
+
await (0, open_1.default)(`http://localhost:${rivetPort}`);
|
|
111
|
+
log.info('🌐 Opened Rivet in your browser');
|
|
112
|
+
}
|
|
113
|
+
log.info(`✅ Rivet connected to your ${project.framework} project`);
|
|
114
|
+
log.info('Press Ctrl+C to stop');
|
|
115
|
+
// Run forever until interrupted
|
|
116
|
+
await new Promise(() => { });
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
if (error instanceof Error) {
|
|
120
|
+
log.error('❌', error.message);
|
|
121
|
+
if (error.message.includes('No running dev server found')) {
|
|
122
|
+
log.info('\n💡 Make sure to start your dev server first:');
|
|
123
|
+
log.info(' npm run dev (or)');
|
|
124
|
+
log.info(' yarn dev (or)');
|
|
125
|
+
log.info(' pnpm dev');
|
|
126
|
+
log.info('\nThen run rivet again.');
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
log.error('❌ An unexpected error occurred:', error);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
exports.main = main;
|
|
135
|
+
const parseArgs = (args) => {
|
|
136
|
+
const options = {};
|
|
137
|
+
for (let i = 0; i < args.length; i++) {
|
|
138
|
+
const arg = args[i];
|
|
139
|
+
switch (arg) {
|
|
140
|
+
case '-h':
|
|
141
|
+
case '--help':
|
|
142
|
+
options.help = true;
|
|
143
|
+
break;
|
|
144
|
+
case '-v':
|
|
145
|
+
case '--version':
|
|
146
|
+
options.version = true;
|
|
147
|
+
break;
|
|
148
|
+
case '-p':
|
|
149
|
+
case '--port':
|
|
150
|
+
const portValue = args[++i];
|
|
151
|
+
if (portValue && !isNaN(Number(portValue))) {
|
|
152
|
+
options.port = Number(portValue);
|
|
153
|
+
}
|
|
154
|
+
break;
|
|
155
|
+
case '--user-port':
|
|
156
|
+
const userPortValue = args[++i];
|
|
157
|
+
if (userPortValue && !isNaN(Number(userPortValue))) {
|
|
158
|
+
options.userPort = Number(userPortValue);
|
|
159
|
+
}
|
|
160
|
+
break;
|
|
161
|
+
case '--no-browser':
|
|
162
|
+
options.noBrowser = true;
|
|
163
|
+
break;
|
|
164
|
+
case '-d':
|
|
165
|
+
case '--debug':
|
|
166
|
+
options.debug = true;
|
|
167
|
+
break;
|
|
168
|
+
case '--inject-path':
|
|
169
|
+
const injectPathValue = args[++i];
|
|
170
|
+
if (injectPathValue) {
|
|
171
|
+
options.injectPath = injectPathValue;
|
|
172
|
+
}
|
|
173
|
+
break;
|
|
174
|
+
case '--track-with-git':
|
|
175
|
+
options.trackWithGit = true;
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return options;
|
|
180
|
+
};
|
|
181
|
+
const showHelp = () => {
|
|
182
|
+
console.log(`
|
|
183
|
+
rivet - Local visual web development tool
|
|
184
|
+
|
|
185
|
+
USAGE:
|
|
186
|
+
rivet [options]
|
|
187
|
+
|
|
188
|
+
OPTIONS:
|
|
189
|
+
-h, --help Show this help message
|
|
190
|
+
-v, --version Show version number
|
|
191
|
+
-p, --port PORT Port for Rivet server (default: 4000)
|
|
192
|
+
--user-port PORT Port where your dev server is running (default: 3000)
|
|
193
|
+
-d, --debug Enable debug logging
|
|
194
|
+
--no-browser Don't automatically open browser
|
|
195
|
+
--inject-path Custom path for script injection (e.g., apps/web/app/layout.tsx)
|
|
196
|
+
--track-with-git Enable git tracking (creates branches and commits changes)
|
|
197
|
+
|
|
198
|
+
EXAMPLES:
|
|
199
|
+
rivet # Start Rivet on port 4000, connect to dev server on port 3000
|
|
200
|
+
rivet -p 8080 # Start Rivet on port 8080
|
|
201
|
+
rivet --user-port 5173 # Connect to Vite dev server on port 5173
|
|
202
|
+
rivet --no-browser # Start without opening browser
|
|
203
|
+
|
|
204
|
+
Make sure your dev server is running first (npm run dev, yarn dev, etc.)
|
|
205
|
+
`);
|
|
206
|
+
};
|
|
207
|
+
const showVersion = () => {
|
|
208
|
+
try {
|
|
209
|
+
const packageJsonPath = path_1.default.join(__dirname, '../package.json');
|
|
210
|
+
const packageJson = JSON.parse(fs_1.default.readFileSync(packageJsonPath, 'utf8'));
|
|
211
|
+
console.log(`rivet v${packageJson.version}`);
|
|
212
|
+
}
|
|
213
|
+
catch (error) {
|
|
214
|
+
log.error('Could not read version from package.json');
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAuC;AACvC,6CAA6F;AAC7F,gDAAwB;AACxB,gDAAwB;AACxB,+CAAiC;AAEjC,4CAAoB;AAEpB,MAAM,GAAG,GAAG,IAAA,yBAAY,EAAC,UAAU,CAAC,CAAC;AAc9B,MAAM,IAAI,GAAG,KAAK,EAAE,OAAiB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAiB,EAAE;IAClF,IAAI,CAAC;QACH,kCAAkC;QAClC,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;QAEhC,kEAAkE;QAClE,MAAM,YAAY,GAAG,cAAI,CAAC,OAAO,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;QAC9D,IAAI,YAAE,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;YAChC,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;YACtC,GAAG,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;YAEnD,wCAAwC;YACxC,IAAI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CAAC,YAAE,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,CAAC;QACzE,OAAO,CAAC,GAAG,CAAC,UAAU,WAAW,CAAC,OAAO,EAAE,CAAC,CAAC;IAC/C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;IACxD,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/routes/components.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,qBAAqB,kDAuDjC,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ABOUTME: Component search API routes
|
|
3
|
+
// ABOUTME: Handles searching for React components that match selected DOM elements
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.createComponentRouter = void 0;
|
|
6
|
+
const express_1 = require("express");
|
|
7
|
+
const index_core_1 = require("../index-core");
|
|
8
|
+
const log = (0, index_core_1.createLogger)('ComponentRoutes');
|
|
9
|
+
const createComponentRouter = () => {
|
|
10
|
+
const router = (0, express_1.Router)();
|
|
11
|
+
// Component search endpoint (supports single element or array of elements)
|
|
12
|
+
router.post('/search-components', async (req, res) => {
|
|
13
|
+
try {
|
|
14
|
+
const body = req.body;
|
|
15
|
+
// Handle both single element and array of elements
|
|
16
|
+
const elements = Array.isArray(body) ? body : [body];
|
|
17
|
+
log.info(`Searching for components matching ${elements.length} element(s)`);
|
|
18
|
+
log.debug('Elements summary:', elements.map((el, i) => ({
|
|
19
|
+
index: i,
|
|
20
|
+
tagName: el.tagName,
|
|
21
|
+
className: el.className,
|
|
22
|
+
id: el.id,
|
|
23
|
+
textContent: el.textContent?.substring(0, 30)
|
|
24
|
+
})));
|
|
25
|
+
const projectPath = process.cwd();
|
|
26
|
+
const searchService = new index_core_1.ComponentSearchService();
|
|
27
|
+
// Process all elements in parallel
|
|
28
|
+
const results = await Promise.all(elements.map(async (element, index) => {
|
|
29
|
+
try {
|
|
30
|
+
const matches = await searchService.findMatchingComponents(projectPath, element);
|
|
31
|
+
log.debug(`Element ${index} (${element.tagName}): Found ${matches.length} matches`);
|
|
32
|
+
return { matches, error: null };
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
log.error(`Component search failed for element ${index}:`, error);
|
|
36
|
+
return {
|
|
37
|
+
matches: [],
|
|
38
|
+
error: error instanceof Error ? error.message : 'Unknown error'
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}));
|
|
42
|
+
const totalMatches = results.reduce((sum, result) => sum + result.matches.length, 0);
|
|
43
|
+
log.info(`Search completed: ${totalMatches} total matches across ${elements.length} element(s)`);
|
|
44
|
+
// Always return results array format
|
|
45
|
+
res.json({ results });
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
log.error('Component search failed:', error);
|
|
49
|
+
res.status(500).json({
|
|
50
|
+
error: 'Component search failed',
|
|
51
|
+
details: error instanceof Error ? error.message : 'Unknown error'
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
return router;
|
|
56
|
+
};
|
|
57
|
+
exports.createComponentRouter = createComponentRouter;
|
|
58
|
+
//# sourceMappingURL=components.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.js","sourceRoot":"","sources":["../../src/routes/components.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,mFAAmF;;;AAEnF,qCAAiC;AACjC,8CAAqE;AAErE,MAAM,GAAG,GAAG,IAAA,yBAAY,EAAC,iBAAiB,CAAC,CAAC;AAErC,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACxC,MAAM,MAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;IAExB,2EAA2E;IAC3E,MAAM,CAAC,IAAI,CAAC,oBAAoB,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,E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0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ABOUTME: Git integration API routes
|
|
3
|
+
// ABOUTME: Handles git session status and publishing changes to remote repositories
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.createGitRouter = void 0;
|
|
6
|
+
const express_1 = require("express");
|
|
7
|
+
const index_core_1 = require("../index-core");
|
|
8
|
+
const log = (0, index_core_1.createLogger)('GitRoutes');
|
|
9
|
+
const createGitRouter = (sessionService) => {
|
|
10
|
+
const router = (0, express_1.Router)();
|
|
11
|
+
// Git session status endpoint
|
|
12
|
+
router.get('/git/status', async (req, res) => {
|
|
13
|
+
try {
|
|
14
|
+
if (!sessionService) {
|
|
15
|
+
return res.json({ isGitEnabled: false });
|
|
16
|
+
}
|
|
17
|
+
const status = await sessionService.getSessionStatus();
|
|
18
|
+
res.json(status);
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
log.error('Failed to get git status:', error);
|
|
22
|
+
res.status(500).json({
|
|
23
|
+
error: 'Failed to get git status',
|
|
24
|
+
details: error instanceof Error ? error.message : 'Unknown error'
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
// Publish changes endpoint (push branch and return PR URL)
|
|
29
|
+
router.post('/git/publish', async (req, res) => {
|
|
30
|
+
try {
|
|
31
|
+
if (!sessionService) {
|
|
32
|
+
return res.status(400).json({
|
|
33
|
+
error: 'Git tracking not enabled',
|
|
34
|
+
details: 'Start Rivet with --track-with-git to enable git functionality'
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
const result = await sessionService.publishChanges();
|
|
38
|
+
log.info('Changes published successfully');
|
|
39
|
+
res.json(result);
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
log.error('Failed to publish changes:', error);
|
|
43
|
+
res.status(500).json({
|
|
44
|
+
error: 'Failed to publish changes',
|
|
45
|
+
details: error instanceof Error ? error.message : 'Unknown error'
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
return router;
|
|
50
|
+
};
|
|
51
|
+
exports.createGitRouter = createGitRouter;
|
|
52
|
+
//# sourceMappingURL=git.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/routes/git.ts"],"names":[],"mappings":";AAAA,sCAAsC;AACtC,oFAAoF;;;AAEpF,qCAAiC;AACjC,8CAA6D;AAE7D,MAAM,GAAG,GAAG,IAAA,yBAAY,EAAC,WAAW,CAAC,CAAC;AAE/B,MAAM,eAAe,GAAG,CAAC,cAAqC,EAAE,EAAE;IACvE,MAAM,MAAM,GAAG,IAAA,gBAAM,GAAE,CAAC;IAExB,8BAA8B;IAC9B,MAAM,CAAC,GAAG,CAAC,aAAa,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;QAC3C,IAAI,CAAC;YACH,IAAI,CAAC,cAAc,EAAE,CAAC;gBACpB,OAAO,GAAG,CAAC,IAAI,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC;YAC3C,CAAC;YAED,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,gBAAgB,EAAE,CAAC;YACvD,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,GAAG,CAAC,KAAK,CAAC,2BAA2B,EAAE,KAAK,CAAC,CAAC;YAC9C,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;gBACnB,KAAK,EAAE,0BAA0B;gBACjC,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe;aAClE,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,2DAA2D;IAC3D,MAAM,CAAC,IAAI,CAAC,cAAc,EAAE,KAAK,EAAE,GAAG,EAAE,G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