rivet-design 0.5.7 → 0.5.8
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/dist/index.d.ts.map +1 -1
- package/dist/index.js +115 -16
- package/dist/index.js.map +1 -1
- package/dist/mcp/server.d.ts +1 -5
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +20 -6
- package/dist/mcp/server.js.map +1 -1
- package/dist/routes/agent.d.ts +8 -0
- package/dist/routes/agent.d.ts.map +1 -0
- package/dist/routes/agent.js +79 -0
- package/dist/routes/agent.js.map +1 -0
- package/dist/routes/comments.d.ts +2 -0
- package/dist/routes/comments.d.ts.map +1 -0
- package/dist/routes/comments.js +92 -0
- package/dist/routes/comments.js.map +1 -0
- package/dist/routes/onboarding.d.ts +6 -0
- package/dist/routes/onboarding.d.ts.map +1 -0
- package/dist/routes/onboarding.js +206 -0
- package/dist/routes/onboarding.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/react-instrumentation.js +300 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +12 -1
- package/dist/server.js.map +1 -1
- package/dist/services/AgentBridgeService.d.ts +89 -0
- package/dist/services/AgentBridgeService.d.ts.map +1 -0
- package/dist/services/AgentBridgeService.js +413 -0
- package/dist/services/AgentBridgeService.js.map +1 -0
- package/dist/services/AgentModService.d.ts +76 -0
- package/dist/services/AgentModService.d.ts.map +1 -0
- package/dist/services/AgentModService.js +494 -0
- package/dist/services/AgentModService.js.map +1 -0
- package/dist/services/CommentSessionManager.d.ts +94 -0
- package/dist/services/CommentSessionManager.d.ts.map +1 -0
- package/dist/services/CommentSessionManager.js +260 -0
- package/dist/services/CommentSessionManager.js.map +1 -0
- package/dist/services/ImportResolverService.d.ts +30 -0
- package/dist/services/ImportResolverService.d.ts.map +1 -0
- package/dist/services/ImportResolverService.js +136 -0
- package/dist/services/ImportResolverService.js.map +1 -0
- package/dist/services/ReactComponentPlugin.d.ts +44 -0
- package/dist/services/ReactComponentPlugin.d.ts.map +1 -0
- package/dist/services/ReactComponentPlugin.js +100 -0
- package/dist/services/ReactComponentPlugin.js.map +1 -0
- package/dist/types/agent-protocol.d.ts +55 -0
- package/dist/types/agent-protocol.d.ts.map +1 -0
- package/dist/types/agent-protocol.js +6 -0
- package/dist/types/agent-protocol.js.map +1 -0
- package/dist/types/agent-tools.d.ts +78 -0
- package/dist/types/agent-tools.d.ts.map +1 -0
- package/dist/types/agent-tools.js +7 -0
- package/dist/types/agent-tools.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/skillWriter.d.ts +10 -7
- package/dist/utils/skillWriter.d.ts.map +1 -1
- package/dist/utils/skillWriter.js +51 -53
- package/dist/utils/skillWriter.js.map +1 -1
- package/dist/utils/skills/claude-skill.d.ts +6 -0
- package/dist/utils/skills/claude-skill.d.ts.map +1 -0
- package/dist/utils/skills/claude-skill.js +49 -0
- package/dist/utils/skills/claude-skill.js.map +1 -0
- package/dist/utils/skills/cursor-rules.d.ts +5 -0
- package/dist/utils/skills/cursor-rules.d.ts.map +1 -0
- package/dist/utils/skills/cursor-rules.js +49 -0
- package/dist/utils/skills/cursor-rules.js.map +1 -0
- package/package.json +1 -1
- package/src/ui/dist/assets/{main-DAIpACRO.js → main-Ckx6ZPoZ.js} +26 -26
- package/src/ui/dist/index.html +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-protocol.js","sourceRoot":"","sources":["../../src/types/agent-protocol.ts"],"names":[],"mappings":";AAAA;;GAEG"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool definitions for Agent SDK MCP server
|
|
3
|
+
* Tools proxy execution from hosted server to local CLI
|
|
4
|
+
*/
|
|
5
|
+
import { ComponentNode } from './change-types';
|
|
6
|
+
/**
|
|
7
|
+
* Tool names that the Agent SDK can invoke
|
|
8
|
+
*/
|
|
9
|
+
export type AgentTool = 'search_components' | 'read_file' | 'write_file' | 'glob_files' | 'git_status' | 'git_diff';
|
|
10
|
+
/**
|
|
11
|
+
* Parameters for each tool type
|
|
12
|
+
*/
|
|
13
|
+
export type ToolParams = {
|
|
14
|
+
search_components: {
|
|
15
|
+
className?: string;
|
|
16
|
+
id?: string;
|
|
17
|
+
tagName?: string;
|
|
18
|
+
textContent?: string;
|
|
19
|
+
componentTree?: ComponentNode[];
|
|
20
|
+
};
|
|
21
|
+
read_file: {
|
|
22
|
+
filePath: string;
|
|
23
|
+
};
|
|
24
|
+
write_file: {
|
|
25
|
+
filePath: string;
|
|
26
|
+
search: string;
|
|
27
|
+
replacement: string;
|
|
28
|
+
changes: string;
|
|
29
|
+
};
|
|
30
|
+
glob_files: {
|
|
31
|
+
pattern: string;
|
|
32
|
+
};
|
|
33
|
+
git_status: Record<string, never>;
|
|
34
|
+
git_diff: {
|
|
35
|
+
filePath?: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Generic tool result wrapper
|
|
40
|
+
*/
|
|
41
|
+
export type ToolResult = {
|
|
42
|
+
success: boolean;
|
|
43
|
+
data?: any;
|
|
44
|
+
error?: string;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Specific result types for each tool
|
|
48
|
+
*/
|
|
49
|
+
export type SearchComponentsResult = {
|
|
50
|
+
matches: Array<{
|
|
51
|
+
filePath: string;
|
|
52
|
+
depth?: number;
|
|
53
|
+
}>;
|
|
54
|
+
};
|
|
55
|
+
export type ReadFileResult = {
|
|
56
|
+
content: string;
|
|
57
|
+
filePath: string;
|
|
58
|
+
};
|
|
59
|
+
export type WriteFileResult = {
|
|
60
|
+
filePath: string;
|
|
61
|
+
originalCode: string;
|
|
62
|
+
modifiedCode: string;
|
|
63
|
+
changes: string;
|
|
64
|
+
modificationsApplied: number;
|
|
65
|
+
};
|
|
66
|
+
export type GlobFilesResult = {
|
|
67
|
+
files: string[];
|
|
68
|
+
};
|
|
69
|
+
export type GitStatusResult = {
|
|
70
|
+
staged: string[];
|
|
71
|
+
unstaged: string[];
|
|
72
|
+
untracked: string[];
|
|
73
|
+
};
|
|
74
|
+
export type GitDiffResult = {
|
|
75
|
+
diff: string;
|
|
76
|
+
filePath?: string;
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=agent-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-tools.d.ts","sourceRoot":"","sources":["../../src/types/agent-tools.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C;;GAEG;AACH,MAAM,MAAM,SAAS,GACjB,mBAAmB,GACnB,WAAW,GACX,YAAY,GACZ,YAAY,GACZ,YAAY,GACZ,UAAU,CAAC;AAEf;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,iBAAiB,EAAE;QACjB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,aAAa,CAAC,EAAE,aAAa,EAAE,CAAC;KACjC,CAAC;IACF,SAAS,EAAE;QACT,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,UAAU,EAAE;QACV,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,UAAU,EAAE;QACV,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE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export type CreatePreviewRequest = {
|
|
2
|
+
repoUrl: string;
|
|
3
|
+
repoFullName: string;
|
|
4
|
+
branch: string;
|
|
5
|
+
};
|
|
6
|
+
export type CreatePreviewResponse = {
|
|
7
|
+
projectId: string;
|
|
8
|
+
previewUrl: string;
|
|
9
|
+
status: string;
|
|
10
|
+
};
|
|
11
|
+
export type ApiError = {
|
|
12
|
+
error: string;
|
|
13
|
+
details?: string;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
import { CURSOR_RULES_FILENAME } from './skills/cursor-rules';
|
|
2
|
+
export declare const SKILL_DIR: string;
|
|
2
3
|
export declare const SKILL_PATH: string;
|
|
3
|
-
export
|
|
4
|
-
export declare const SKILL_CONTENT = "[//]: # (rivet-skill-version: 2)\n# Rivet Visual Editor\n\nUse these tools to make visual changes to a running web app and apply them to source code.\n\n## Starting a session\n\n1. Call `detect_project` \u2014 returns `detectedPort` (the actual running port, may differ from `defaultPort`) and `portActive`\n2. If `portActive` is false, start the dev server in the background:\n ```bash\n cd {projectPath} && {packageManager} run {devCommand} &\n ```\n Then call `detect_project` again until `portActive` is true\n3. Call `open_visual_editor({ port: detectedPort })` \u2014 always pass `detectedPort`, never assume the default\n4. Tell the user: \"Rivet is open \u2014 make your visual changes and click 'Send to Claude Code' when ready.\"\n\n## Editing loop\n\n1. Call `watch_for_changes({ sessionId })` \u2014 blocks until the user clicks \"Send to Claude Code\" (up to 60s by default)\n2. If it times out (`hasChanges: false`), call it again to keep waiting\n3. When `hasChanges: true`, apply the changes to the source files listed in `sourceFiles`\n4. Hot reload happens automatically after file changes\n5. Tell the user what you changed, then loop back to step 1\n\n## Ending a session\n\nWhen the user says they're done, call `close_visual_editor({ sessionId })`.\n\n## Rules\n\n- **Always call `detect_project` first** \u2014 never assume the dev server is running\n- **Never auto-commit** after applying visual changes \u2014 let the user decide\n- Use `watch_for_changes` for interactive sessions, not `get_pending_changes`\n- `get_pending_changes` is a non-blocking immediate check \u2014 only use it to poll without blocking\n- The dev server stays running after `close_visual_editor`\n";
|
|
4
|
+
export { CURSOR_RULES_FILENAME };
|
|
5
5
|
/**
|
|
6
6
|
* Write the companion Claude skill file.
|
|
7
|
-
* Idempotent — skips if the
|
|
7
|
+
* Idempotent — skips if the installed version is current or newer.
|
|
8
|
+
* Returns true if the file is current or was successfully written.
|
|
8
9
|
*/
|
|
10
|
+
export declare function writeSkillFileIfNeeded(): boolean;
|
|
9
11
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
+
* Write a Cursor rules file to {projectPath}/.cursor/rules/rivet.mdc.
|
|
13
|
+
* Idempotent — skips if the installed version is current or newer.
|
|
14
|
+
* Returns true if the file is current or was successfully written.
|
|
12
15
|
*/
|
|
13
|
-
export declare function
|
|
16
|
+
export declare function writeCursorRulesIfNeeded(projectPath: string): boolean;
|
|
14
17
|
//# sourceMappingURL=skillWriter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skillWriter.d.ts","sourceRoot":"","sources":["../../src/utils/skillWriter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"skillWriter.d.ts","sourceRoot":"","sources":["../../src/utils/skillWriter.ts"],"names":[],"mappings":"AAUA,OAAO,EAGL,qBAAqB,EACtB,MAAM,uBAAuB,CAAC;AAK/B,eAAO,MAAM,SAAS,QAA2C,CAAC;AAClE,eAAO,MAAM,UAAU,QAA8C,CAAC;AAEtE,OAAO,EAAE,qBAAqB,EAAE,CAAC;AAOjC;;;;GAIG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CA2BhD;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAyBrE"}
|
|
@@ -3,74 +3,45 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.CURSOR_RULES_FILENAME = exports.SKILL_PATH = exports.SKILL_DIR = void 0;
|
|
7
7
|
exports.writeSkillFileIfNeeded = writeSkillFileIfNeeded;
|
|
8
|
+
exports.writeCursorRulesIfNeeded = writeCursorRulesIfNeeded;
|
|
8
9
|
const fs_1 = __importDefault(require("fs"));
|
|
9
10
|
const path_1 = __importDefault(require("path"));
|
|
10
11
|
const os_1 = __importDefault(require("os"));
|
|
11
12
|
const logger_1 = require("./logger");
|
|
13
|
+
const claude_skill_1 = require("./skills/claude-skill");
|
|
14
|
+
const cursor_rules_1 = require("./skills/cursor-rules");
|
|
15
|
+
Object.defineProperty(exports, "CURSOR_RULES_FILENAME", { enumerable: true, get: function () { return cursor_rules_1.CURSOR_RULES_FILENAME; } });
|
|
12
16
|
const log = (0, logger_1.createLogger)('SkillWriter');
|
|
13
|
-
|
|
14
|
-
exports.
|
|
15
|
-
exports.SKILL_PATH = path_1.default.join(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
Use these tools to make visual changes to a running web app and apply them to source code.
|
|
21
|
-
|
|
22
|
-
## Starting a session
|
|
23
|
-
|
|
24
|
-
1. Call \`detect_project\` — returns \`detectedPort\` (the actual running port, may differ from \`defaultPort\`) and \`portActive\`
|
|
25
|
-
2. If \`portActive\` is false, start the dev server in the background:
|
|
26
|
-
\`\`\`bash
|
|
27
|
-
cd {projectPath} && {packageManager} run {devCommand} &
|
|
28
|
-
\`\`\`
|
|
29
|
-
Then call \`detect_project\` again until \`portActive\` is true
|
|
30
|
-
3. Call \`open_visual_editor({ port: detectedPort })\` — always pass \`detectedPort\`, never assume the default
|
|
31
|
-
4. Tell the user: "Rivet is open — make your visual changes and click 'Send to Claude Code' when ready."
|
|
32
|
-
|
|
33
|
-
## Editing loop
|
|
34
|
-
|
|
35
|
-
1. Call \`watch_for_changes({ sessionId })\` — blocks until the user clicks "Send to Claude Code" (up to 60s by default)
|
|
36
|
-
2. If it times out (\`hasChanges: false\`), call it again to keep waiting
|
|
37
|
-
3. When \`hasChanges: true\`, apply the changes to the source files listed in \`sourceFiles\`
|
|
38
|
-
4. Hot reload happens automatically after file changes
|
|
39
|
-
5. Tell the user what you changed, then loop back to step 1
|
|
40
|
-
|
|
41
|
-
## Ending a session
|
|
42
|
-
|
|
43
|
-
When the user says they're done, call \`close_visual_editor({ sessionId })\`.
|
|
44
|
-
|
|
45
|
-
## Rules
|
|
46
|
-
|
|
47
|
-
- **Always call \`detect_project\` first** — never assume the dev server is running
|
|
48
|
-
- **Never auto-commit** after applying visual changes — let the user decide
|
|
49
|
-
- Use \`watch_for_changes\` for interactive sessions, not \`get_pending_changes\`
|
|
50
|
-
- \`get_pending_changes\` is a non-blocking immediate check — only use it to poll without blocking
|
|
51
|
-
- The dev server stays running after \`close_visual_editor\`
|
|
52
|
-
`;
|
|
17
|
+
const SKILLS_BASE = path_1.default.join(os_1.default.homedir(), '.claude', 'skills');
|
|
18
|
+
exports.SKILL_DIR = path_1.default.join(SKILLS_BASE, claude_skill_1.CLAUDE_SKILL_DIR);
|
|
19
|
+
exports.SKILL_PATH = path_1.default.join(exports.SKILL_DIR, claude_skill_1.CLAUDE_SKILL_FILENAME);
|
|
20
|
+
function getInstalledVersion(content, pattern) {
|
|
21
|
+
const match = content.match(pattern);
|
|
22
|
+
return match ? parseInt(match[1], 10) : 0;
|
|
23
|
+
}
|
|
53
24
|
/**
|
|
54
25
|
* Write the companion Claude skill file.
|
|
55
|
-
* Idempotent — skips if the
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Returns true if the skill file is current or was successfully written,
|
|
59
|
-
* false if the write failed.
|
|
26
|
+
* Idempotent — skips if the installed version is current or newer.
|
|
27
|
+
* Returns true if the file is current or was successfully written.
|
|
60
28
|
*/
|
|
61
29
|
function writeSkillFileIfNeeded() {
|
|
62
30
|
try {
|
|
63
|
-
|
|
64
|
-
if (
|
|
65
|
-
fs_1.default.
|
|
31
|
+
// If the old flat file exists at SKILL_DIR, remove it — we need a directory there now
|
|
32
|
+
if (fs_1.default.existsSync(exports.SKILL_DIR) && fs_1.default.statSync(exports.SKILL_DIR).isFile()) {
|
|
33
|
+
fs_1.default.unlinkSync(exports.SKILL_DIR);
|
|
34
|
+
}
|
|
35
|
+
if (!fs_1.default.existsSync(exports.SKILL_DIR)) {
|
|
36
|
+
fs_1.default.mkdirSync(exports.SKILL_DIR, { recursive: true });
|
|
66
37
|
}
|
|
67
38
|
if (fs_1.default.existsSync(exports.SKILL_PATH)) {
|
|
68
39
|
const existing = fs_1.default.readFileSync(exports.SKILL_PATH, 'utf8');
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
40
|
+
const installed = getInstalledVersion(existing, /rivet-skill-version:\s*(\d+)/);
|
|
41
|
+
if (installed >= claude_skill_1.CLAUDE_SKILL_VERSION)
|
|
42
|
+
return true;
|
|
72
43
|
}
|
|
73
|
-
fs_1.default.writeFileSync(exports.SKILL_PATH,
|
|
44
|
+
fs_1.default.writeFileSync(exports.SKILL_PATH, claude_skill_1.CLAUDE_SKILL_CONTENT, 'utf8');
|
|
74
45
|
log.info('Wrote Rivet Claude skill file');
|
|
75
46
|
return true;
|
|
76
47
|
}
|
|
@@ -79,4 +50,31 @@ function writeSkillFileIfNeeded() {
|
|
|
79
50
|
return false;
|
|
80
51
|
}
|
|
81
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Write a Cursor rules file to {projectPath}/.cursor/rules/rivet.mdc.
|
|
55
|
+
* Idempotent — skips if the installed version is current or newer.
|
|
56
|
+
* Returns true if the file is current or was successfully written.
|
|
57
|
+
*/
|
|
58
|
+
function writeCursorRulesIfNeeded(projectPath) {
|
|
59
|
+
try {
|
|
60
|
+
const rulesDir = path_1.default.join(projectPath, '.cursor', 'rules');
|
|
61
|
+
const rulesPath = path_1.default.join(rulesDir, cursor_rules_1.CURSOR_RULES_FILENAME);
|
|
62
|
+
if (fs_1.default.existsSync(rulesPath)) {
|
|
63
|
+
const existing = fs_1.default.readFileSync(rulesPath, 'utf8');
|
|
64
|
+
const installed = getInstalledVersion(existing, /rivet-rules-version:\s*(\d+)/);
|
|
65
|
+
if (installed >= cursor_rules_1.CURSOR_RULES_VERSION)
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
if (!fs_1.default.existsSync(rulesDir)) {
|
|
69
|
+
fs_1.default.mkdirSync(rulesDir, { recursive: true });
|
|
70
|
+
}
|
|
71
|
+
fs_1.default.writeFileSync(rulesPath, cursor_rules_1.CURSOR_RULES_CONTENT, 'utf8');
|
|
72
|
+
log.info('Wrote Rivet Cursor rules file');
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
log.debug('Could not write Cursor rules file:', error);
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
82
80
|
//# sourceMappingURL=skillWriter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skillWriter.js","sourceRoot":"","sources":["../../src/utils/skillWriter.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"skillWriter.js","sourceRoot":"","sources":["../../src/utils/skillWriter.ts"],"names":[],"mappings":";;;;;;AAkCA,wDA2BC;AAOD,4DAyBC;AA7FD,4CAAoB;AACpB,gDAAwB;AACxB,4CAAoB;AACpB,qCAAwC;AACxC,wDAK+B;AAC/B,wDAI+B;AAQtB,sGATP,oCAAqB,OASO;AAN9B,MAAM,GAAG,GAAG,IAAA,qBAAY,EAAC,aAAa,CAAC,CAAC;AAExC,MAAM,WAAW,GAAG,cAAI,CAAC,IAAI,CAAC,YAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AACpD,QAAA,SAAS,GAAG,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,+BAAgB,CAAC,CAAC;AACrD,QAAA,UAAU,GAAG,cAAI,CAAC,IAAI,CAAC,iBAAS,EAAE,oCAAqB,CAAC,CAAC;AAItE,SAAS,mBAAmB,CAAC,OAAe,EAAE,OAAe;IAC3D,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5C,CAAC;AAED;;;;GAIG;AACH,SAAgB,sBAAsB;IACpC,IAAI,CAAC;QACH,sFAAsF;QACtF,IAAI,YAAE,CAAC,UAAU,CAAC,iBAAS,CAAC,IAAI,YAAE,CAAC,QAAQ,CAAC,iBAAS,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;YAChE,YAAE,CAAC,UAAU,CAAC,iBAAS,CAAC,CAAC;QAC3B,CAAC;QAED,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,iBAAS,CAAC,EAAE,CAAC;YAC9B,YAAE,CAAC,SA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CAAC,EAAE,CAAC;YAC7B,YAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC9C,CAAC;QAED,YAAE,CAAC,aAAa,CAAC,SAAS,EAAE,mCAAoB,EAAE,MAAM,CAAC,CAAC;QAC1D,GAAG,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;QAC1C,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,KAAK,CAAC,oCAAoC,EAAE,KAAK,CAAC,CAAC;QACvD,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const CLAUDE_SKILL_VERSION = 4;
|
|
2
|
+
export declare const CLAUDE_SKILL_VERSION_MARKER = "[//]: # (rivet-skill-version: 4)";
|
|
3
|
+
export declare const CLAUDE_SKILL_DIR = "rivet";
|
|
4
|
+
export declare const CLAUDE_SKILL_FILENAME = "SKILL.md";
|
|
5
|
+
export declare const CLAUDE_SKILL_CONTENT = "---\nname: rivet\ndescription: Open the Rivet visual editor to make visual or UI changes to a running web app. Invoke when the user says \"open rivet\", \"use rivet\", \"/rivet\", or wants to visually edit their app.\n---\n\n[//]: # (rivet-skill-version: 4)\n# Rivet Visual Editor\n\nUse these tools to make visual changes to a running web app and apply them to source code.\n\n## Starting a session\n\n1. Call `detect_project` \u2014 returns `detectedPort` (the actual running port, may differ from `defaultPort`) and `portActive`\n2. If `portActive` is false, start the dev server in the background:\n ```bash\n cd {projectPath} && {packageManager} run {devCommand} &\n ```\n Then call `detect_project` again until `portActive` is true\n3. Call `open_visual_editor({ port: detectedPort })` \u2014 always pass `detectedPort`, never assume the default\n4. Tell the user: \"Rivet is open \u2014 make your visual changes and click 'Send to Claude Code' when ready.\"\n\n## Editing loop\n\n1. Call `watch_for_changes({ sessionId })` \u2014 blocks until the user clicks \"Send to Claude Code\" (up to 60s by default)\n2. If it times out (`hasChanges: false`), call it again to keep waiting\n3. When `hasChanges: true`, apply the changes to the source files listed in `sourceFiles`\n4. Hot reload happens automatically after file changes\n5. Tell the user what you changed, then loop back to step 1\n\n## Ending a session\n\nWhen the user says they're done, call `close_visual_editor({ sessionId })`.\n\n## Rules\n\n- **Always call `detect_project` first** \u2014 never assume the dev server is running\n- **Never auto-commit** after applying visual changes \u2014 let the user decide\n- Use `watch_for_changes` for interactive sessions, not `get_pending_changes`\n- `get_pending_changes` is a non-blocking immediate check \u2014 only use it to poll without blocking\n- The dev server stays running after `close_visual_editor`\n";
|
|
6
|
+
//# sourceMappingURL=claude-skill.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-skill.d.ts","sourceRoot":"","sources":["../../../src/utils/skills/claude-skill.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,IAAI,CAAC;AACtC,eAAO,MAAM,2BAA2B,qCAA2D,CAAC;AAEpG,eAAO,MAAM,gBAAgB,UAAU,CAAC;AACxC,eAAO,MAAM,qBAAqB,aAAa,CAAC;AAEhD,eAAO,MAAM,oBAAoB,g5DAwChC,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CLAUDE_SKILL_CONTENT = exports.CLAUDE_SKILL_FILENAME = exports.CLAUDE_SKILL_DIR = exports.CLAUDE_SKILL_VERSION_MARKER = exports.CLAUDE_SKILL_VERSION = void 0;
|
|
4
|
+
exports.CLAUDE_SKILL_VERSION = 4;
|
|
5
|
+
exports.CLAUDE_SKILL_VERSION_MARKER = `[//]: # (rivet-skill-version: ${exports.CLAUDE_SKILL_VERSION})`;
|
|
6
|
+
exports.CLAUDE_SKILL_DIR = 'rivet';
|
|
7
|
+
exports.CLAUDE_SKILL_FILENAME = 'SKILL.md';
|
|
8
|
+
exports.CLAUDE_SKILL_CONTENT = `---
|
|
9
|
+
name: rivet
|
|
10
|
+
description: Open the Rivet visual editor to make visual or UI changes to a running web app. Invoke when the user says "open rivet", "use rivet", "/rivet", or wants to visually edit their app.
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
${exports.CLAUDE_SKILL_VERSION_MARKER}
|
|
14
|
+
# Rivet Visual Editor
|
|
15
|
+
|
|
16
|
+
Use these tools to make visual changes to a running web app and apply them to source code.
|
|
17
|
+
|
|
18
|
+
## Starting a session
|
|
19
|
+
|
|
20
|
+
1. Call \`detect_project\` — returns \`detectedPort\` (the actual running port, may differ from \`defaultPort\`) and \`portActive\`
|
|
21
|
+
2. If \`portActive\` is false, start the dev server in the background:
|
|
22
|
+
\`\`\`bash
|
|
23
|
+
cd {projectPath} && {packageManager} run {devCommand} &
|
|
24
|
+
\`\`\`
|
|
25
|
+
Then call \`detect_project\` again until \`portActive\` is true
|
|
26
|
+
3. Call \`open_visual_editor({ port: detectedPort })\` — always pass \`detectedPort\`, never assume the default
|
|
27
|
+
4. Tell the user: "Rivet is open — make your visual changes and click 'Send to Claude Code' when ready."
|
|
28
|
+
|
|
29
|
+
## Editing loop
|
|
30
|
+
|
|
31
|
+
1. Call \`watch_for_changes({ sessionId })\` — blocks until the user clicks "Send to Claude Code" (up to 60s by default)
|
|
32
|
+
2. If it times out (\`hasChanges: false\`), call it again to keep waiting
|
|
33
|
+
3. When \`hasChanges: true\`, apply the changes to the source files listed in \`sourceFiles\`
|
|
34
|
+
4. Hot reload happens automatically after file changes
|
|
35
|
+
5. Tell the user what you changed, then loop back to step 1
|
|
36
|
+
|
|
37
|
+
## Ending a session
|
|
38
|
+
|
|
39
|
+
When the user says they're done, call \`close_visual_editor({ sessionId })\`.
|
|
40
|
+
|
|
41
|
+
## Rules
|
|
42
|
+
|
|
43
|
+
- **Always call \`detect_project\` first** — never assume the dev server is running
|
|
44
|
+
- **Never auto-commit** after applying visual changes — let the user decide
|
|
45
|
+
- Use \`watch_for_changes\` for interactive sessions, not \`get_pending_changes\`
|
|
46
|
+
- \`get_pending_changes\` is a non-blocking immediate check — only use it to poll without blocking
|
|
47
|
+
- The dev server stays running after \`close_visual_editor\`
|
|
48
|
+
`;
|
|
49
|
+
//# sourceMappingURL=claude-skill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-skill.js","sourceRoot":"","sources":["../../../src/utils/skills/claude-skill.ts"],"names":[],"mappings":";;;AAAa,QAAA,oBAAoB,GAAG,CAAC,CAAC;AACzB,QAAA,2BAA2B,GAAG,iCAAiC,4BAAoB,GAAG,CAAC;AAEvF,QAAA,gBAAgB,GAAG,OAAO,CAAC;AAC3B,QAAA,qBAAqB,GAAG,UAAU,CAAC;AAEnC,QAAA,oBAAoB,GAAG;;;;;EAKlC,mCAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmC5B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const CURSOR_RULES_VERSION = 3;
|
|
2
|
+
export declare const CURSOR_RULES_FILENAME = "rivet.mdc";
|
|
3
|
+
export declare const CURSOR_RULES_VERSION_MARKER = "rivet-rules-version: 3";
|
|
4
|
+
export declare const CURSOR_RULES_CONTENT = "---\ndescription: Rivet visual editor \u2014 apply when the user says \"open rivet\", \"open the visual editor\", or wants to make visual/UI changes to their web app\nalwaysApply: false\n---\n<!-- rivet-rules-version: 3 -->\n# Rivet Visual Editor\n\nUse these tools to make visual changes to a running web app and apply them to source code.\n\n> Tip: type `@rivet.mdc` in chat to invoke this rule manually.\n\n## Starting a session\n\n1. Call `detect_project` \u2014 returns `detectedPort` (the actual running port, may differ from `defaultPort`) and `portActive`\n2. If `portActive` is false, start the dev server in the background:\n ```bash\n cd {projectPath} && {packageManager} run {devCommand} &\n ```\n Then call `detect_project` again until `portActive` is true\n3. Call `open_visual_editor({ port: detectedPort })` \u2014 always pass `detectedPort`, never assume the default\n4. Tell the user: \"Rivet is open \u2014 make your visual changes and click 'Send to Cursor' when ready.\"\n\n## Editing loop\n\n1. Call `watch_for_changes({ sessionId })` \u2014 blocks until the user clicks \"Send to Cursor\" (up to 60s by default)\n2. If it times out (`hasChanges: false`), call it again to keep waiting\n3. When `hasChanges: true`, apply the changes to the source files listed in `sourceFiles`\n4. Hot reload happens automatically after file changes\n5. Tell the user what you changed, then loop back to step 1\n\n## Ending a session\n\nWhen the user says they're done, call `close_visual_editor({ sessionId })`.\n\n## Rules\n\n- **Always call `detect_project` first** \u2014 never assume the dev server is running\n- **Never auto-commit** after applying visual changes \u2014 let the user decide\n- Use `watch_for_changes` for interactive sessions, not `get_pending_changes`\n- `get_pending_changes` is a non-blocking immediate check \u2014 only use it to poll without blocking\n- The dev server stays running after `close_visual_editor`\n";
|
|
5
|
+
//# sourceMappingURL=cursor-rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor-rules.d.ts","sourceRoot":"","sources":["../../../src/utils/skills/cursor-rules.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,IAAI,CAAC;AACtC,eAAO,MAAM,qBAAqB,cAAc,CAAC;AACjD,eAAO,MAAM,2BAA2B,2BAAiD,CAAC;AAE1F,eAAO,MAAM,oBAAoB,s6DAyChC,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CURSOR_RULES_CONTENT = exports.CURSOR_RULES_VERSION_MARKER = exports.CURSOR_RULES_FILENAME = exports.CURSOR_RULES_VERSION = void 0;
|
|
4
|
+
exports.CURSOR_RULES_VERSION = 3;
|
|
5
|
+
exports.CURSOR_RULES_FILENAME = 'rivet.mdc';
|
|
6
|
+
exports.CURSOR_RULES_VERSION_MARKER = `rivet-rules-version: ${exports.CURSOR_RULES_VERSION}`;
|
|
7
|
+
exports.CURSOR_RULES_CONTENT = `---
|
|
8
|
+
description: Rivet visual editor — apply when the user says "open rivet", "open the visual editor", or wants to make visual/UI changes to their web app
|
|
9
|
+
alwaysApply: false
|
|
10
|
+
---
|
|
11
|
+
<!-- ${exports.CURSOR_RULES_VERSION_MARKER} -->
|
|
12
|
+
# Rivet Visual Editor
|
|
13
|
+
|
|
14
|
+
Use these tools to make visual changes to a running web app and apply them to source code.
|
|
15
|
+
|
|
16
|
+
> Tip: type \`@rivet.mdc\` in chat to invoke this rule manually.
|
|
17
|
+
|
|
18
|
+
## Starting a session
|
|
19
|
+
|
|
20
|
+
1. Call \`detect_project\` — returns \`detectedPort\` (the actual running port, may differ from \`defaultPort\`) and \`portActive\`
|
|
21
|
+
2. If \`portActive\` is false, start the dev server in the background:
|
|
22
|
+
\`\`\`bash
|
|
23
|
+
cd {projectPath} && {packageManager} run {devCommand} &
|
|
24
|
+
\`\`\`
|
|
25
|
+
Then call \`detect_project\` again until \`portActive\` is true
|
|
26
|
+
3. Call \`open_visual_editor({ port: detectedPort })\` — always pass \`detectedPort\`, never assume the default
|
|
27
|
+
4. Tell the user: "Rivet is open — make your visual changes and click 'Send to Cursor' when ready."
|
|
28
|
+
|
|
29
|
+
## Editing loop
|
|
30
|
+
|
|
31
|
+
1. Call \`watch_for_changes({ sessionId })\` — blocks until the user clicks "Send to Cursor" (up to 60s by default)
|
|
32
|
+
2. If it times out (\`hasChanges: false\`), call it again to keep waiting
|
|
33
|
+
3. When \`hasChanges: true\`, apply the changes to the source files listed in \`sourceFiles\`
|
|
34
|
+
4. Hot reload happens automatically after file changes
|
|
35
|
+
5. Tell the user what you changed, then loop back to step 1
|
|
36
|
+
|
|
37
|
+
## Ending a session
|
|
38
|
+
|
|
39
|
+
When the user says they're done, call \`close_visual_editor({ sessionId })\`.
|
|
40
|
+
|
|
41
|
+
## Rules
|
|
42
|
+
|
|
43
|
+
- **Always call \`detect_project\` first** — never assume the dev server is running
|
|
44
|
+
- **Never auto-commit** after applying visual changes — let the user decide
|
|
45
|
+
- Use \`watch_for_changes\` for interactive sessions, not \`get_pending_changes\`
|
|
46
|
+
- \`get_pending_changes\` is a non-blocking immediate check — only use it to poll without blocking
|
|
47
|
+
- The dev server stays running after \`close_visual_editor\`
|
|
48
|
+
`;
|
|
49
|
+
//# sourceMappingURL=cursor-rules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor-rules.js","sourceRoot":"","sources":["../../../src/utils/skills/cursor-rules.ts"],"names":[],"mappings":";;;AAAa,QAAA,oBAAoB,GAAG,CAAC,CAAC;AACzB,QAAA,qBAAqB,GAAG,WAAW,CAAC;AACpC,QAAA,2BAA2B,GAAG,wBAAwB,4BAAoB,EAAE,CAAC;AAE7E,QAAA,oBAAoB,GAAG;;;;OAI7B,mCAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqCjC,CAAC"}
|