dev3000 0.0.174 → 0.0.176

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.
Files changed (75) hide show
  1. package/README.md +0 -4
  2. package/dist/cdp-monitor.d.ts +5 -1
  3. package/dist/cdp-monitor.d.ts.map +1 -1
  4. package/dist/cdp-monitor.js +273 -46
  5. package/dist/cdp-monitor.js.map +1 -1
  6. package/dist/cli.js +154 -217
  7. package/dist/cli.js.map +1 -1
  8. package/dist/commands/crawl.d.ts.map +1 -1
  9. package/dist/commands/crawl.js +4 -43
  10. package/dist/commands/crawl.js.map +1 -1
  11. package/dist/commands/errors.d.ts.map +1 -1
  12. package/dist/commands/errors.js +4 -53
  13. package/dist/commands/errors.js.map +1 -1
  14. package/dist/commands/fix.d.ts.map +1 -1
  15. package/dist/commands/fix.js +5 -74
  16. package/dist/commands/fix.js.map +1 -1
  17. package/dist/commands/logs.d.ts.map +1 -1
  18. package/dist/commands/logs.js +4 -53
  19. package/dist/commands/logs.js.map +1 -1
  20. package/dist/commands/skill-runner.d.ts +15 -0
  21. package/dist/commands/skill-runner.d.ts.map +1 -0
  22. package/dist/commands/skill-runner.js +615 -0
  23. package/dist/commands/skill-runner.js.map +1 -0
  24. package/dist/dev-environment.d.ts +6 -3
  25. package/dist/dev-environment.d.ts.map +1 -1
  26. package/dist/dev-environment.js +123 -105
  27. package/dist/dev-environment.js.map +1 -1
  28. package/dist/skills/d3k/internal-skill.md +145 -0
  29. package/dist/skills/index.test.ts +28 -1
  30. package/dist/skills/index.ts +58 -7
  31. package/dist/utils/agent-browser.d.ts.map +1 -1
  32. package/dist/utils/agent-browser.js +6 -3
  33. package/dist/utils/agent-browser.js.map +1 -1
  34. package/dist/utils/agent-detection.d.ts +1 -0
  35. package/dist/utils/agent-detection.d.ts.map +1 -1
  36. package/dist/utils/agent-detection.js +11 -0
  37. package/dist/utils/agent-detection.js.map +1 -1
  38. package/dist/utils/agent-selection.js +3 -3
  39. package/dist/utils/agent-selection.js.map +1 -1
  40. package/dist/utils/browser-command-argv.d.ts +1 -1
  41. package/dist/utils/browser-command-argv.d.ts.map +1 -1
  42. package/dist/utils/browser-command-argv.js +1 -1
  43. package/dist/utils/browser-command-argv.js.map +1 -1
  44. package/dist/utils/cli-options.d.ts +5 -0
  45. package/dist/utils/cli-options.d.ts.map +1 -0
  46. package/dist/utils/cli-options.js +36 -0
  47. package/dist/utils/cli-options.js.map +1 -0
  48. package/dist/utils/project-name.d.ts +2 -0
  49. package/dist/utils/project-name.d.ts.map +1 -1
  50. package/dist/utils/project-name.js +6 -0
  51. package/dist/utils/project-name.js.map +1 -1
  52. package/dist/utils/session.d.ts +14 -0
  53. package/dist/utils/session.d.ts.map +1 -0
  54. package/dist/utils/session.js +65 -0
  55. package/dist/utils/session.js.map +1 -0
  56. package/dist/utils/version-check.js +2 -2
  57. package/dist/utils/version-check.js.map +1 -1
  58. package/package.json +10 -19
  59. package/dist/commands/cloud-check-pr.d.ts +0 -9
  60. package/dist/commands/cloud-check-pr.d.ts.map +0 -1
  61. package/dist/commands/cloud-check-pr.js +0 -243
  62. package/dist/commands/cloud-check-pr.js.map +0 -1
  63. package/dist/commands/cloud-fix.d.ts +0 -13
  64. package/dist/commands/cloud-fix.d.ts.map +0 -1
  65. package/dist/commands/cloud-fix.js +0 -79
  66. package/dist/commands/cloud-fix.js.map +0 -1
  67. package/dist/commands/find-component.d.ts +0 -8
  68. package/dist/commands/find-component.d.ts.map +0 -1
  69. package/dist/commands/find-component.js +0 -182
  70. package/dist/commands/find-component.js.map +0 -1
  71. package/dist/skills/d3k/SKILL.md +0 -126
  72. package/dist/skills/index.d.ts +0 -46
  73. package/dist/skills/index.d.ts.map +0 -1
  74. package/dist/skills/index.js +0 -174
  75. package/dist/skills/index.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dev3000",
3
- "version": "0.0.174",
3
+ "version": "0.0.176",
4
4
  "description": "AI-powered development tools with browser monitoring and skill integration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -15,7 +15,7 @@
15
15
  "README.md"
16
16
  ],
17
17
  "scripts": {
18
- "build": "tsc && mkdir -p dist/src && cp src/loading.html dist/src/ && cp src/tui-interface-impl.tsx dist/src/ && cp -r src/skills dist/",
18
+ "build": "tsc && mkdir -p dist/src && cp src/loading.html dist/src/ && cp src/tui-interface-impl.tsx dist/src/ && rm -rf dist/skills && cp -r src/skills dist/",
19
19
  "typegen": "./scripts/typegen.sh",
20
20
  "typecheck": "bun run --filter '*' typecheck",
21
21
  "format": "biome format --write .",
@@ -25,11 +25,13 @@
25
25
  "test-postinstall": "tsx scripts/test-postinstall.ts",
26
26
  "test-release": "./scripts/test-release.sh",
27
27
  "canary:smoke": "bun run scripts/canary-smoke-test.ts",
28
+ "build:skill-runner-shell": "bun run scripts/build-skill-runner-shell-artifact.ts",
28
29
  "_postinstall": "node scripts/check-install.js || exit 0",
29
30
  "_prepare": "husky",
30
31
  "release": "./scripts/release.sh",
31
32
  "canary": "./scripts/canary.sh",
32
- "build:binaries": "bun run scripts/build-binaries.ts"
33
+ "build:binaries": "bun run scripts/build-binaries.ts",
34
+ "smoke:skill-runner-install": "bun run scripts/smoke-skill-runner-install.ts"
33
35
  },
34
36
  "keywords": [
35
37
  "nextjs",
@@ -42,44 +44,33 @@
42
44
  "claude"
43
45
  ],
44
46
  "dependencies": {
45
- "@biomejs/biome": "2.4.6",
46
47
  "@opentui/core": "0.1.86",
47
- "@vercel/next-browser": "0.1.6",
48
- "@vercel/sandbox": "1.9.0",
49
48
  "agent-browser": "0.24.0",
50
- "ai": "6.0.116",
51
49
  "chalk": "^5.3.0",
52
50
  "commander": "14.0.3",
53
51
  "ink": "6.8.0",
54
52
  "ink-select-input": "^6.2.0",
55
53
  "ink-spinner": "^5.0.0",
56
- "ms": "^2.1.3",
57
- "next": "16.2.1-canary.5",
58
54
  "ora": "9.3.0",
59
55
  "package-manager-detector": "^1.3.0",
60
56
  "portless": "0.5.2",
61
57
  "react": "19.2.4",
62
- "react-dom": "19.2.4",
63
- "typescript": "^5.0.0",
64
- "workflow": "4.2.0-beta.72",
65
58
  "ws": "^8.18.3"
66
59
  },
67
60
  "devDependencies": {
68
- "@types/ms": "^2.1.0",
61
+ "@biomejs/biome": "2.4.6",
69
62
  "@types/node": "25.3.5",
70
63
  "@types/react": "19.2.14",
71
- "@types/react-dom": "19.2.3",
72
64
  "@types/ws": "^8.5.12",
73
65
  "husky": "^9.0.0",
74
- "react-devtools-core": "^7.0.1",
75
66
  "tsx": "^4.20.3",
76
- "turbo": "2.8.14",
67
+ "typescript": "^5.0.0",
77
68
  "vitest": "4.0.18"
78
69
  },
79
70
  "optionalDependencies": {
80
- "@d3k/darwin-arm64": "0.0.174",
81
- "@d3k/linux-x64": "0.0.174",
82
- "@d3k/windows-x64": "0.0.174",
71
+ "@d3k/darwin-arm64": "0.0.176",
72
+ "@d3k/linux-x64": "0.0.176",
73
+ "@d3k/windows-x64": "0.0.176",
83
74
  "@opentui/core-linux-x64": "0.1.86"
84
75
  },
85
76
  "engines": {
@@ -1,9 +0,0 @@
1
- interface CheckPROptions {
2
- prNumber?: string;
3
- repo?: string;
4
- url?: string;
5
- debug?: boolean;
6
- }
7
- export declare function cloudCheckPR(options: CheckPROptions): Promise<void>;
8
- export {};
9
- //# sourceMappingURL=cloud-check-pr.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cloud-check-pr.d.ts","sourceRoot":"","sources":["../../src/commands/cloud-check-pr.ts"],"names":[],"mappings":"AAIA,UAAU,cAAc;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE,cAAc,iBA6GzD"}
@@ -1,243 +0,0 @@
1
- import chalk from "chalk";
2
- import { execFileSync } from "child_process";
3
- import { isValidRepoArg } from "../utils/repo-validate.js";
4
- export async function cloudCheckPR(options) {
5
- const { prNumber, repo, url, debug = false } = options;
6
- if (prNumber && !/^\d+$/.test(prNumber)) {
7
- console.error(chalk.red("❌ Invalid PR number (must be digits only)"));
8
- process.exit(1);
9
- }
10
- if (repo && !isValidRepoArg(repo)) {
11
- console.error(chalk.red("❌ Invalid repo format. Use 'owner/name' or a GitHub URL."));
12
- process.exit(1);
13
- }
14
- if (debug) {
15
- console.log(chalk.gray("[DEBUG] Starting cloud check-pr"));
16
- console.log(chalk.gray(`[DEBUG] PR number: ${prNumber || "auto-detect"}`));
17
- console.log(chalk.gray(`[DEBUG] Repo: ${repo || "auto-detect"}`));
18
- console.log(chalk.gray(`[DEBUG] URL: ${url || "auto-detect"}`));
19
- }
20
- // Step 1: Get repo info
21
- console.log(chalk.blue("📦 Getting repository information..."));
22
- const repoInfo = await getRepoInfo(repo, debug);
23
- if (!repoInfo) {
24
- console.error(chalk.red("❌ Failed to get repository information"));
25
- console.error(chalk.yellow("Make sure you're in a git repository with a GitHub remote"));
26
- process.exit(1);
27
- }
28
- console.log(chalk.green(`✓ Repository: ${repoInfo.owner}/${repoInfo.name}`));
29
- // Step 2: Get PR number (from arg or detect from current branch)
30
- const prNum = prNumber || (await detectPRNumber(repoInfo, debug));
31
- if (!prNum) {
32
- console.error(chalk.red("❌ No PR number provided and couldn't detect from current branch"));
33
- console.error(chalk.yellow("Usage: dev3000 cloud check-pr <pr-number>"));
34
- process.exit(1);
35
- }
36
- console.log(chalk.blue(`🔍 Fetching PR #${prNum} details...`));
37
- // Step 3: Fetch PR details from GitHub
38
- const prDetails = await fetchPRDetails(repoInfo.owner, repoInfo.name, prNum, debug);
39
- if (!prDetails) {
40
- console.error(chalk.red(`❌ Failed to fetch PR #${prNum}`));
41
- process.exit(1);
42
- }
43
- console.log(chalk.green(`✓ PR #${prNum}: ${prDetails.title}`));
44
- console.log(chalk.gray(` Branch: ${prDetails.branch}`));
45
- console.log(chalk.gray(` Author: ${prDetails.author}`));
46
- // Step 4: Find Vercel preview URL (use provided URL or auto-detect)
47
- let previewUrl = null;
48
- if (url) {
49
- console.log(chalk.blue("🔗 Using provided preview URL..."));
50
- previewUrl = url;
51
- }
52
- else {
53
- console.log(chalk.blue("🔗 Finding Vercel preview URL..."));
54
- previewUrl = await findVercelPreview(repoInfo, prDetails.branch, debug);
55
- }
56
- if (!previewUrl) {
57
- console.error(chalk.red("❌ No Vercel preview deployment found for this PR"));
58
- console.error(chalk.yellow("Make sure the PR has a Vercel deployment, or provide --url"));
59
- process.exit(1);
60
- }
61
- console.log(chalk.green(`✓ Preview URL: ${previewUrl}`));
62
- // Step 5: Analyze PR changes to determine what pages to check
63
- console.log(chalk.blue("📝 Analyzing PR changes..."));
64
- const changedFiles = await getChangedFiles(repoInfo.owner, repoInfo.name, prNum, debug);
65
- console.log(chalk.gray(` Changed files: ${changedFiles.length}`));
66
- // Step 6: Run workflow to check the PR
67
- console.log(chalk.blue("🤖 Running AI-powered PR verification..."));
68
- console.log(chalk.gray("This may take a few minutes..."));
69
- const result = await runPRCheckWorkflow({
70
- previewUrl,
71
- prTitle: prDetails.title,
72
- prBody: prDetails.body,
73
- changedFiles,
74
- repoOwner: repoInfo.owner,
75
- repoName: repoInfo.name,
76
- prNumber: prNum,
77
- debug
78
- });
79
- // Step 7: Display results
80
- console.log(`\n${chalk.bold("📊 PR Check Results")}`);
81
- console.log(chalk.gray("─".repeat(60)));
82
- if (result.success) {
83
- console.log(chalk.green("✓ All checks passed"));
84
- }
85
- else {
86
- console.log(chalk.red("✗ Some checks failed"));
87
- }
88
- console.log(`\n${chalk.bold("Full Report:")}`);
89
- console.log(result.reportUrl);
90
- if (result.prComment) {
91
- console.log(`\n${chalk.gray("A comment will be posted to the PR with these results")}`);
92
- }
93
- }
94
- async function getRepoInfo(repoArg, debug) {
95
- try {
96
- if (repoArg) {
97
- // Parse from provided repo URL or owner/name
98
- const match = repoArg.match(/(?:github\.com\/)?([^/]+)\/([^/]+)/);
99
- if (match) {
100
- return {
101
- owner: match[1],
102
- name: match[2].replace(/\.git$/, ""),
103
- branch: execFileSync("git", ["branch", "--show-current"], { encoding: "utf-8" }).trim()
104
- };
105
- }
106
- }
107
- // Auto-detect from current directory using our script
108
- const scriptPath = new URL("../../scripts/get-repo-info.sh", import.meta.url).pathname;
109
- const result = execFileSync("bash", [scriptPath], { encoding: "utf-8" });
110
- const info = JSON.parse(result);
111
- if (debug) {
112
- console.log(chalk.gray(`[DEBUG] Repo info: ${JSON.stringify(info, null, 2)}`));
113
- }
114
- return {
115
- owner: info.repoOwner,
116
- name: info.repoName,
117
- branch: info.currentBranch
118
- };
119
- }
120
- catch (error) {
121
- if (debug) {
122
- console.error(chalk.gray(`[DEBUG] Error getting repo info: ${error}`));
123
- }
124
- return null;
125
- }
126
- }
127
- async function detectPRNumber(repoInfo, debug) {
128
- try {
129
- // Use gh CLI to find PR for current branch
130
- const result = execFileSync("gh", ["pr", "list", "--head", repoInfo.branch, "--json", "number", "--jq", ".[0].number"], { encoding: "utf-8" }).trim();
131
- if (debug) {
132
- console.log(chalk.gray(`[DEBUG] Detected PR number: ${result}`));
133
- }
134
- return result || null;
135
- }
136
- catch (error) {
137
- if (debug) {
138
- console.error(chalk.gray(`[DEBUG] Error detecting PR number: ${error}`));
139
- }
140
- return null;
141
- }
142
- }
143
- async function fetchPRDetails(owner, repo, prNumber, debug) {
144
- try {
145
- const result = execFileSync("gh", ["api", `repos/${owner}/${repo}/pulls/${prNumber}`, "--jq", "{title,body,branch:.head.ref,author:.user.login}"], { encoding: "utf-8" });
146
- const details = JSON.parse(result);
147
- if (debug) {
148
- console.log(chalk.gray(`[DEBUG] PR details: ${JSON.stringify(details, null, 2)}`));
149
- }
150
- return details;
151
- }
152
- catch (error) {
153
- if (debug) {
154
- console.error(chalk.gray(`[DEBUG] Error fetching PR details: ${error}`));
155
- }
156
- return null;
157
- }
158
- }
159
- async function findVercelPreview(_repoInfo, branch, debug) {
160
- try {
161
- // Use vc CLI to find deployments for this branch
162
- // Pass --token if VERCEL_TOKEN is set (for CI environments)
163
- const tokenArgs = process.env.VERCEL_TOKEN ? ["--token", process.env.VERCEL_TOKEN] : [];
164
- const result = execFileSync("vc", ["ls", "--yes", ...tokenArgs], { encoding: "utf-8" });
165
- const lines = result
166
- .split("\n")
167
- .map((line) => line.trim())
168
- .filter(Boolean);
169
- const match = lines.find((line) => line.includes(branch));
170
- const previewUrl = match ? match.split(/\s+/)[1] : "";
171
- if (debug) {
172
- console.log(chalk.gray(`[DEBUG] Found preview URL: ${previewUrl}`));
173
- }
174
- return previewUrl || null;
175
- }
176
- catch (error) {
177
- if (debug) {
178
- console.error(chalk.gray(`[DEBUG] Error finding Vercel preview: ${error}`));
179
- }
180
- return null;
181
- }
182
- }
183
- async function getChangedFiles(owner, repo, prNumber, debug) {
184
- try {
185
- const result = execFileSync("gh", ["api", `repos/${owner}/${repo}/pulls/${prNumber}/files`, "--jq", ".[].filename"], { encoding: "utf-8" });
186
- const files = result.trim().split("\n").filter(Boolean);
187
- if (debug) {
188
- console.log(chalk.gray(`[DEBUG] Changed files: ${files.join(", ")}`));
189
- }
190
- return files;
191
- }
192
- catch (error) {
193
- if (debug) {
194
- console.error(chalk.gray(`[DEBUG] Error getting changed files: ${error}`));
195
- }
196
- return [];
197
- }
198
- }
199
- // biome-ignore lint/suspicious/noExplicitAny: Workflow response has dynamic structure
200
- async function runPRCheckWorkflow(params) {
201
- const { previewUrl, prTitle, prBody, changedFiles, repoOwner, repoName, prNumber, debug } = params;
202
- // Call the workflow API endpoint (we'll create this next)
203
- const apiBase = process.env.DEV3000_API_URL || "https://dev3000.ai";
204
- const workflowUrl = `${apiBase}/api/cloud/check-pr`;
205
- try {
206
- const response = await fetch(workflowUrl, {
207
- method: "POST",
208
- headers: {
209
- "Content-Type": "application/json"
210
- },
211
- body: JSON.stringify({
212
- previewUrl,
213
- prTitle,
214
- prBody,
215
- changedFiles,
216
- repoOwner,
217
- repoName,
218
- prNumber
219
- })
220
- });
221
- if (!response.ok) {
222
- throw new Error(`HTTP ${response.status}: ${response.statusText}`);
223
- }
224
- const result = await response.json();
225
- if (debug) {
226
- console.log(chalk.gray(`[DEBUG] Workflow result: ${JSON.stringify(result, null, 2)}`));
227
- }
228
- return result;
229
- }
230
- catch (error) {
231
- if (debug) {
232
- console.error(chalk.gray(`[DEBUG] Error running workflow: ${error}`));
233
- }
234
- // For now, return a mock result since we haven't built the workflow yet
235
- return {
236
- success: true,
237
- reportUrl: `${previewUrl}#pr-check-report`,
238
- prComment: true,
239
- message: "PR check workflow not yet implemented - coming soon!"
240
- };
241
- }
242
- }
243
- //# sourceMappingURL=cloud-check-pr.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cloud-check-pr.js","sourceRoot":"","sources":["../../src/commands/cloud-check-pr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAS1D,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAAuB;IACxD,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,KAAK,EAAE,GAAG,OAAO,CAAA;IAEtD,IAAI,QAAQ,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QACxC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAC,CAAA;QACrE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;IAED,IAAI,IAAI,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC;QAClC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,0DAA0D,CAAC,CAAC,CAAA;QACpF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC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N,YAAY;gBACZ,SAAS;gBACT,QAAQ;gBACR,QAAQ;aACT,CAAC;SACH,CAAC,CAAA;QAEF,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,QAAQ,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAA;QACpE,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;QAEpC,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,4BAA4B,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;QACxF,CAAC;QAED,OAAO,MAAM,CAAA;IACf,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,mCAAmC,KAAK,EAAE,CAAC,CAAC,CAAA;QACvE,CAAC;QAED,wEAAwE;QACxE,OAAO;YACL,OAAO,EAAE,IAAI;YACb,SAAS,EAAE,GAAG,UAAU,kBAAkB;YAC1C,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,sDAAsD;SAChE,CAAA;IACH,CAAC;AACH,CAAC"}
@@ -1,13 +0,0 @@
1
- export interface CloudFixOptions {
2
- debug?: boolean;
3
- repo?: string;
4
- branch?: string;
5
- projectDir?: string;
6
- }
7
- /**
8
- * Cloud Fix Command
9
- *
10
- * Starts a cloud workflow run for the current repo.
11
- */
12
- export declare function cloudFix(options?: CloudFixOptions): Promise<void>;
13
- //# sourceMappingURL=cloud-fix.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cloud-fix.d.ts","sourceRoot":"","sources":["../../src/commands/cloud-fix.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAID;;;;GAIG;AACH,wBAAsB,QAAQ,CAAC,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAuF3E"}
@@ -1,79 +0,0 @@
1
- import { detectProject } from "../utils/project-detector.js";
2
- import { isValidRepoArg } from "../utils/repo-validate.js";
3
- const DEFAULT_API_URL = "https://dev3000.ai";
4
- /**
5
- * Cloud Fix Command
6
- *
7
- * Starts a cloud workflow run for the current repo.
8
- */
9
- export async function cloudFix(options = {}) {
10
- const { debug = false, repo, branch, projectDir } = options;
11
- if (repo && !isValidRepoArg(repo)) {
12
- throw new Error("Invalid repo format. Use 'owner/name' or a GitHub URL.");
13
- }
14
- const project = repo && branch
15
- ? {
16
- repoUrl: repo,
17
- branch,
18
- relativePath: projectDir || "",
19
- name: projectDir || "app"
20
- }
21
- : await (async () => {
22
- console.log("🔍 Detecting project...");
23
- return await detectProject();
24
- })();
25
- const repoUrl = project.repoUrl;
26
- const repoBranch = branch || project.branch || "main";
27
- const projectName = projectDir || project.relativePath || project.name || "app";
28
- console.log("🚀 Starting cloud fix workflow...");
29
- console.log(` Repository: ${repoUrl}`);
30
- console.log(` Branch: ${repoBranch}`);
31
- console.log(` Project: ${projectName}`);
32
- console.log();
33
- const apiBase = process.env.DEV3000_API_URL || DEFAULT_API_URL;
34
- const workflowUrl = `${apiBase}/api/cloud/start-fix`;
35
- const headers = {
36
- "Content-Type": "application/json"
37
- };
38
- if (process.env.WORKFLOW_TEST_BYPASS_TOKEN) {
39
- headers["x-test-bypass-token"] = process.env.WORKFLOW_TEST_BYPASS_TOKEN;
40
- }
41
- if (process.env.VERCEL_OIDC_TOKEN) {
42
- headers["x-vercel-oidc-token"] = process.env.VERCEL_OIDC_TOKEN;
43
- }
44
- if (debug) {
45
- console.log(` API: ${workflowUrl}`);
46
- console.log(` Test bypass token: ${process.env.WORKFLOW_TEST_BYPASS_TOKEN ? "provided" : "not provided"}`);
47
- }
48
- const response = await fetch(workflowUrl, {
49
- method: "POST",
50
- headers,
51
- body: JSON.stringify({
52
- repoUrl,
53
- repoBranch,
54
- projectName
55
- })
56
- });
57
- if (!response.ok) {
58
- const errorText = await response.text();
59
- throw new Error(`Workflow request failed: ${response.status} - ${errorText}`);
60
- }
61
- const result = (await response.json());
62
- if (result.success) {
63
- console.log("✅ Workflow started successfully");
64
- if (result.runId) {
65
- console.log(` Run ID: ${result.runId}`);
66
- }
67
- if (result.projectName) {
68
- console.log(` Project: ${result.projectName}`);
69
- }
70
- console.log(` Track progress at: ${apiBase}/workflows`);
71
- }
72
- else {
73
- console.log("⚠️ Workflow start returned an unexpected response");
74
- if (debug) {
75
- console.log(JSON.stringify(result, null, 2));
76
- }
77
- }
78
- }
79
- //# sourceMappingURL=cloud-fix.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cloud-fix.js","sourceRoot":"","sources":["../../src/commands/cloud-fix.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAS1D,MAAM,eAAe,GAAG,oBAAoB,CAAA;AAE5C;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,UAA2B,EAAE;IAC1D,MAAM,EAAE,KAAK,GAAG,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAA;IAE3D,IAAI,IAAI,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAA;IAC3E,CAAC;IAED,MAAM,OAAO,GACX,IAAI,IAAI,MAAM;QACZ,CAAC,CAAC;YACE,OAAO,EAAE,IAAI;YACb,MAAM;YACN,YAAY,EAAE,U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AS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;QAC9C,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -1,8 +0,0 @@
1
- /**
2
- * d3k find-component - Find React component source for a DOM selector
3
- *
4
- * Uses agent-browser to inspect DOM elements and extract React component info.
5
- * Returns grep patterns to locate the source file.
6
- */
7
- export declare function findComponent(selector: string): Promise<void>;
8
- //# sourceMappingURL=find-component.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"find-component.d.ts","sourceRoot":"","sources":["../../src/commands/find-component.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAmEH,wBAAsB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA+HnE"}
@@ -1,182 +0,0 @@
1
- /**
2
- * d3k find-component - Find React component source for a DOM selector
3
- *
4
- * Uses agent-browser to inspect DOM elements and extract React component info.
5
- * Returns grep patterns to locate the source file.
6
- */
7
- import { spawnSync } from "node:child_process";
8
- import { existsSync, readdirSync, readFileSync } from "node:fs";
9
- import { homedir } from "node:os";
10
- import { join } from "node:path";
11
- import chalk from "chalk";
12
- function findActiveSessions() {
13
- const sessionDir = join(homedir(), ".d3k");
14
- if (!existsSync(sessionDir)) {
15
- return [];
16
- }
17
- try {
18
- const entries = readdirSync(sessionDir, { withFileTypes: true });
19
- const sessions = [];
20
- for (const entry of entries) {
21
- if (entry.isDirectory()) {
22
- const sessionFile = join(sessionDir, entry.name, "session.json");
23
- if (existsSync(sessionFile)) {
24
- try {
25
- const content = JSON.parse(readFileSync(sessionFile, "utf-8"));
26
- if (content.pid) {
27
- try {
28
- process.kill(content.pid, 0);
29
- sessions.push(content);
30
- }
31
- catch {
32
- // Process not running
33
- }
34
- }
35
- }
36
- catch {
37
- // Skip invalid files
38
- }
39
- }
40
- }
41
- }
42
- return sessions;
43
- }
44
- catch {
45
- return [];
46
- }
47
- }
48
- function runAgentBrowser(args) {
49
- try {
50
- const result = spawnSync("d3k", ["agent-browser", "--cdp", "9222", ...args], {
51
- encoding: "utf-8",
52
- timeout: 30000
53
- });
54
- if (result.status === 0) {
55
- return { success: true, output: result.stdout || "" };
56
- }
57
- else {
58
- return { success: false, output: result.stderr || result.stdout || "Unknown error" };
59
- }
60
- }
61
- catch (error) {
62
- return { success: false, output: error instanceof Error ? error.message : String(error) };
63
- }
64
- }
65
- export async function findComponent(selector) {
66
- const sessions = findActiveSessions();
67
- if (sessions.length === 0) {
68
- console.log(chalk.red("❌ No active d3k sessions found."));
69
- console.log(chalk.gray("Make sure d3k is running first."));
70
- process.exit(1);
71
- }
72
- console.log(chalk.cyan(`🔍 Finding component for: ${selector}`));
73
- console.log();
74
- // JavaScript to extract React component info from DOM element
75
- const extractScript = `
76
- (function() {
77
- const el = document.querySelector(${JSON.stringify(selector)});
78
- if (!el) return JSON.stringify({ error: 'Element not found' });
79
-
80
- // Find React Fiber
81
- const fiberKey = Object.keys(el).find(k => k.startsWith('__reactFiber$'));
82
- if (!fiberKey) return JSON.stringify({ error: 'Not a React element' });
83
-
84
- let fiber = el[fiberKey];
85
- let componentSource = null;
86
- let componentName = null;
87
-
88
- // Walk up the fiber tree to find a function component
89
- while (fiber) {
90
- if (typeof fiber.type === 'function') {
91
- componentName = fiber.type.displayName || fiber.type.name || 'Anonymous';
92
- try {
93
- componentSource = fiber.type.toString().slice(0, 2000);
94
- } catch (e) {
95
- componentSource = null;
96
- }
97
- break;
98
- }
99
- fiber = fiber.return;
100
- }
101
-
102
- // Extract useful patterns from the component source
103
- const patterns = [];
104
- if (componentSource) {
105
- // Find JSX component references like <Button, <Card
106
- const jsxMatches = componentSource.match(/<([A-Z][a-zA-Z0-9]+)/g);
107
- if (jsxMatches) {
108
- jsxMatches.forEach(m => patterns.push(m.slice(1)));
109
- }
110
-
111
- // Find className patterns
112
- const classMatches = componentSource.match(/className[=:]\\s*["'\`]([^"'\`]+)["'\`]/g);
113
- if (classMatches) {
114
- classMatches.slice(0, 3).forEach(m => {
115
- const cls = m.match(/["'\`]([^"'\`]+)["'\`]/);
116
- if (cls) patterns.push('className.*' + cls[1].split(' ')[0]);
117
- });
118
- }
119
- }
120
-
121
- return JSON.stringify({
122
- componentName,
123
- patterns,
124
- sourcePreview: componentSource ? componentSource.slice(0, 500) : null
125
- });
126
- })()
127
- `;
128
- const result = runAgentBrowser(["eval", extractScript]);
129
- if (!result.success) {
130
- console.log(chalk.red(`❌ Failed to inspect element: ${result.output}`));
131
- process.exit(1);
132
- }
133
- try {
134
- // Extract JSON from output
135
- const jsonMatch = result.output.match(/\{.*\}/s);
136
- if (!jsonMatch) {
137
- console.log(chalk.red("❌ Could not parse response"));
138
- console.log(chalk.gray(result.output));
139
- process.exit(1);
140
- }
141
- const data = JSON.parse(jsonMatch[0]);
142
- if (data.error) {
143
- console.log(chalk.red(`❌ ${data.error}`));
144
- if (data.error === "Element not found") {
145
- console.log(chalk.gray(`Make sure the selector "${selector}" matches an element on the page.`));
146
- }
147
- else if (data.error === "Not a React element") {
148
- console.log(chalk.gray("This element doesn't appear to be rendered by React."));
149
- }
150
- process.exit(1);
151
- }
152
- console.log(chalk.green(`✅ Found component: ${data.componentName || "Unknown"}`));
153
- console.log();
154
- if (data.patterns && data.patterns.length > 0) {
155
- console.log(chalk.cyan("Search patterns to find source file:"));
156
- console.log();
157
- // Component name pattern
158
- if (data.componentName && data.componentName !== "Anonymous") {
159
- console.log(chalk.white(` grep -r "function ${data.componentName}" src/`));
160
- console.log(chalk.white(` grep -r "const ${data.componentName}" src/`));
161
- console.log(chalk.white(` grep -r "export.*${data.componentName}" src/`));
162
- }
163
- // Additional patterns
164
- data.patterns.slice(0, 5).forEach((pattern) => {
165
- console.log(chalk.gray(` grep -r "${pattern}" src/`));
166
- });
167
- }
168
- if (data.sourcePreview) {
169
- console.log();
170
- console.log(chalk.cyan("Source preview (transpiled):"));
171
- console.log(chalk.gray("─".repeat(50)));
172
- console.log(chalk.gray(data.sourcePreview));
173
- console.log(chalk.gray("─".repeat(50)));
174
- }
175
- }
176
- catch {
177
- console.log(chalk.red(`❌ Failed to parse component info`));
178
- console.log(chalk.gray(result.output.slice(0, 500)));
179
- process.exit(1);
180
- }
181
- }
182
- //# sourceMappingURL=find-component.js.map