@zibby/core 0.1.1 → 0.1.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zibby/core",
3
- "version": "0.1.1",
3
+ "version": "0.1.6",
4
4
  "description": "Core test automation engine with multi-agent and multi-MCP support",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -22,7 +22,8 @@
22
22
  "./utils/node-schema-parser.js": "./src/utils/node-schema-parser.js",
23
23
  "./templates/register-nodes.js": "./templates/register-nodes.js",
24
24
  "./templates": "./templates/index.js",
25
- "./templates/*": "./templates/*"
25
+ "./templates/*": "./templates/*",
26
+ "./package.json": "./package.json"
26
27
  },
27
28
  "scripts": {
28
29
  "test": "vitest run",
@@ -60,6 +61,7 @@
60
61
  "!templates/**/__tests__/",
61
62
  "!templates/**/*.test.js",
62
63
  "!templates/**/*.spec.js",
64
+ "scripts/",
63
65
  "README.md",
64
66
  "LICENSE"
65
67
  ],
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Export default workflows as JSON for the backend API
4
+ * Run: node packages/core/scripts/export-default-workflows.js
5
+ */
6
+
7
+ import { writeFileSync, mkdirSync, existsSync } from 'fs';
8
+ import { join, dirname } from 'path';
9
+ import { fileURLToPath } from 'url';
10
+ import { WorkflowGraph } from '../src/framework/graph.js';
11
+ import { buildAnalysisGraph } from '../templates/graphs/analysisGraph.js';
12
+
13
+ const __dirname = dirname(fileURLToPath(import.meta.url));
14
+ const outputDir = join(__dirname, '../../../backend/src/data');
15
+
16
+ // Ensure output directory exists
17
+ if (!existsSync(outputDir)) {
18
+ mkdirSync(outputDir, { recursive: true });
19
+ }
20
+
21
+ // Build and serialize analysis workflow
22
+ console.log('Building analysis workflow...');
23
+ const analysisGraph = new WorkflowGraph();
24
+ buildAnalysisGraph(analysisGraph);
25
+ const serializedAnalysis = analysisGraph.serialize();
26
+
27
+ // Add workflow metadata
28
+ const analysisWorkflow = {
29
+ id: 'default_analysis',
30
+ name: 'Analysis Workflow',
31
+ description: 'Analyzes tickets and generates code implementation',
32
+ ...serializedAnalysis,
33
+ createdAt: new Date().toISOString(),
34
+ isDefault: true
35
+ };
36
+
37
+ // Write to JSON file
38
+ const outputPath = join(outputDir, 'default-workflows.json');
39
+ const workflows = {
40
+ analysis: analysisWorkflow
41
+ };
42
+
43
+ writeFileSync(outputPath, JSON.stringify(workflows, null, 2));
44
+ console.log(`✅ Exported default workflows to ${outputPath}`);
45
+
46
+ // Also export as individual files for clarity
47
+ writeFileSync(
48
+ join(outputDir, 'default-analysis-workflow.json'),
49
+ JSON.stringify(analysisWorkflow, null, 2)
50
+ );
51
+ console.log('✅ Exported individual workflow files');
@@ -0,0 +1,174 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Patch cursor-agent CLI to auto-approve MCP tool calls for CI/CD use.
5
+ *
6
+ * This script modifies the cursor-agent source code to bypass the manual
7
+ * approval prompt for MCP tool executions, making it suitable for automated
8
+ * CI/CD pipelines.
9
+ *
10
+ * Usage:
11
+ * node patch-cursor-mcp.js
12
+ */
13
+
14
+ import { readFileSync, writeFileSync, existsSync, readdirSync, statSync } from 'fs';
15
+ import { join, dirname } from 'path';
16
+ import { homedir } from 'os';
17
+ import { fileURLToPath } from 'url';
18
+
19
+ const __filename = fileURLToPath(import.meta.url);
20
+ const __dirname = dirname(__filename);
21
+
22
+ function findLatestCursorAgent() {
23
+ const versionsDir = join(homedir(), '.local/share/cursor-agent/versions');
24
+
25
+ if (!existsSync(versionsDir)) {
26
+ console.error(`❌ Cursor agent versions directory not found: ${versionsDir}`);
27
+ console.error(' Make sure cursor-agent is installed: curl https://cursor.com/install -fsS | bash');
28
+ process.exit(1);
29
+ }
30
+
31
+ const versions = readdirSync(versionsDir)
32
+ .map(name => join(versionsDir, name))
33
+ .filter(path => statSync(path).isDirectory());
34
+
35
+ if (versions.length === 0) {
36
+ console.error(`❌ No cursor-agent versions found in ${versionsDir}`);
37
+ process.exit(1);
38
+ }
39
+
40
+ // Get the latest version by creation time
41
+ const latestVersion = versions
42
+ .map(path => ({ path, ctime: statSync(path).ctimeMs }))
43
+ .sort((a, b) => b.ctime - a.ctime)[0].path;
44
+
45
+ return join(latestVersion, 'index.js');
46
+ }
47
+
48
+ function backupFile(filePath) {
49
+ const backupPath = `${filePath }.backup`;
50
+
51
+ if (existsSync(backupPath)) {
52
+ console.log(`ℹ️ Backup already exists: ${backupPath}`);
53
+ return backupPath;
54
+ }
55
+
56
+ const content = readFileSync(filePath, 'utf8');
57
+ writeFileSync(backupPath, content, 'utf8');
58
+
59
+ console.log(`✅ Backup created: ${backupPath}`);
60
+ return backupPath;
61
+ }
62
+
63
+ function patchMcpApproval(filePath) {
64
+ const content = readFileSync(filePath, 'utf8');
65
+
66
+ // Check if already patched
67
+ if (content.includes('AUTO-APPROVE MCP TOOLS FOR CI/CD')) {
68
+ console.log('✅ File is already patched!');
69
+ return false;
70
+ }
71
+
72
+ // Pattern to match the requestApproval call for MCP
73
+ const pattern = /(\s+const result = await this\.pendingDecisionProvider\.requestApproval\(\{\s+type: OperationType\.Mcp,\s+details: \{\s+name: approvalDetails\.name,\s+toolName: approvalDetails\.toolName,\s+providerIdentifier: approvalDetails\.providerIdentifier,\s+args: approvalDetails\.args,\s+\},\s+toolCallId: args\.toolCallId,\s+\}\);)/;
74
+
75
+ const replacement = ` // AUTO-APPROVE MCP TOOLS FOR CI/CD
76
+ const result = { approved: true };
77
+ /*
78
+ const result = await this.pendingDecisionProvider.requestApproval({
79
+ type: OperationType.Mcp,
80
+ details: {
81
+ name: approvalDetails.name,
82
+ toolName: approvalDetails.toolName,
83
+ providerIdentifier: approvalDetails.providerIdentifier,
84
+ args: approvalDetails.args,
85
+ },
86
+ toolCallId: args.toolCallId,
87
+ });
88
+ */`;
89
+
90
+ const newContent = content.replace(pattern, replacement);
91
+
92
+ if (newContent === content) {
93
+ console.log('ℹ️ Pattern not found - cursor-agent code structure has changed.');
94
+ console.log(' This is OKAY! Newer versions might not need this patch.');
95
+ console.log(' If auto-approval doesn\'t work, cursor-agent team may have fixed it!');
96
+ return false;
97
+ }
98
+
99
+ writeFileSync(filePath, newContent, 'utf8');
100
+ return true;
101
+ }
102
+
103
+ function addApprovalKeyLogging(filePath) {
104
+ const content = readFileSync(filePath, 'utf8');
105
+ const lines = content.split('\n');
106
+
107
+ // Check if already added
108
+ if (lines.some(line => line.includes('🔑 APPROVAL KEY'))) {
109
+ console.log('✅ Approval key logging already enabled!');
110
+ return false;
111
+ }
112
+
113
+ // Find the line with generateApprovalKey and add logging after it
114
+ let targetLineNum = -1;
115
+ for (let i = 0; i < lines.length; i++) {
116
+ if (lines[i].includes('const approvalKey = generateApprovalKey(serverName, server, this.cwd);')) {
117
+ targetLineNum = i;
118
+ break;
119
+ }
120
+ }
121
+
122
+ if (targetLineNum === -1) {
123
+ console.log('⚠️ Could not find approval key generation line');
124
+ return false;
125
+ }
126
+
127
+ // Insert the console.log after the generateApprovalKey line
128
+ const indent = ' ';
129
+ const logLine = `${indent}console.log("🔑 APPROVAL KEY:", serverName, "=>", approvalKey);`;
130
+ lines.splice(targetLineNum + 1, 0, logLine);
131
+
132
+ writeFileSync(filePath, lines.join('\n'), 'utf8');
133
+ return true;
134
+ }
135
+
136
+ function main() {
137
+ console.log('🔧 Patching cursor-agent for CI/CD MCP usage...\n');
138
+ console.log('ℹ️ Note: This patch is temporary and may not be needed in future versions.\n');
139
+
140
+ // Find cursor-agent
141
+ const indexFile = findLatestCursorAgent();
142
+ console.log(`📍 Found cursor-agent: ${indexFile}\n`);
143
+
144
+ // Backup
145
+ backupFile(indexFile);
146
+ console.log();
147
+
148
+ // Apply patches
149
+ const patchedApproval = patchMcpApproval(indexFile);
150
+ if (patchedApproval) {
151
+ console.log('✅ Patched MCP tool auto-approval');
152
+ }
153
+ console.log();
154
+
155
+ const patchedLogging = addApprovalKeyLogging(indexFile);
156
+ if (patchedLogging) {
157
+ console.log('✅ Added approval key logging');
158
+ }
159
+ console.log();
160
+
161
+ if (patchedApproval || patchedLogging) {
162
+ console.log('🎉 cursor-agent is now ready for CI/CD!');
163
+ console.log('\nNext steps:');
164
+ console.log('1. Run: cursor-agent mcp list');
165
+ console.log('2. Copy the approval key shown');
166
+ console.log('3. Add it to ~/.cursor/projects/YOUR_PROJECT/mcp-approvals.json');
167
+ console.log('\n⚠️ If cursor-agent updates break this patch, MCP may work without it.');
168
+ } else {
169
+ console.log('ℹ️ No changes needed - already configured or cursor-agent version doesn\'t need patching!');
170
+ }
171
+ }
172
+
173
+ main();
174
+
@@ -0,0 +1,115 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ echo "🚀 Complete CI/CD Setup (from scratch)"
5
+ echo "======================================="
6
+ echo ""
7
+
8
+ # Get the absolute path to the project
9
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
10
+ PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
11
+
12
+ echo "📍 Project root: $PROJECT_ROOT"
13
+ echo ""
14
+
15
+ # Check OS
16
+ OS="$(uname -s)"
17
+ echo "🖥️ Detected OS: $OS"
18
+ echo ""
19
+
20
+ # Step 1: Check/Install Node.js
21
+ echo "Step 1: Checking Node.js..."
22
+ if command -v node &> /dev/null; then
23
+ NODE_VERSION=$(node --version)
24
+ echo "✓ Node.js installed: $NODE_VERSION"
25
+ else
26
+ echo "✗ Node.js not found!"
27
+ echo " Install: https://nodejs.org/ or use nvm"
28
+ exit 1
29
+ fi
30
+ echo ""
31
+
32
+ # Step 2: Check/Install Python 3
33
+ echo "Step 2: Checking Python 3..."
34
+ if command -v python3 &> /dev/null; then
35
+ PYTHON_VERSION=$(python3 --version)
36
+ echo "✓ Python 3 installed: $PYTHON_VERSION"
37
+ else
38
+ echo "✗ Python 3 not found!"
39
+ exit 1
40
+ fi
41
+ echo ""
42
+
43
+ # Step 3: Install npm dependencies
44
+ echo "Step 3: Installing npm dependencies..."
45
+ cd "$PROJECT_ROOT"
46
+ if [ -f "package.json" ]; then
47
+ npm install --silent > /dev/null 2>&1
48
+ echo "✓ npm dependencies installed"
49
+ else
50
+ echo "✗ package.json not found"
51
+ exit 1
52
+ fi
53
+ echo ""
54
+
55
+ # Step 4: Check/Install cursor-agent
56
+ echo "Step 4: Checking cursor-agent..."
57
+ if command -v cursor-agent &> /dev/null; then
58
+ CURSOR_VERSION=$(cursor-agent --version 2>&1 | head -1 || echo "unknown")
59
+ echo "✓ cursor-agent installed: $CURSOR_VERSION"
60
+ else
61
+ echo "⚠️ cursor-agent not found - installing..."
62
+
63
+ if [ "$OS" = "Darwin" ] || [ "$OS" = "Linux" ]; then
64
+ # Install cursor-agent
65
+ curl -fsSL https://cursor.com/install | bash
66
+
67
+ # Add to PATH for current session
68
+ export PATH="$HOME/.local/bin:$PATH"
69
+
70
+ if command -v cursor-agent &> /dev/null; then
71
+ echo "✓ cursor-agent installed successfully"
72
+ else
73
+ echo "✗ cursor-agent installation failed"
74
+ echo " Manual install: curl https://cursor.com/install -fsS | bash"
75
+ exit 1
76
+ fi
77
+ else
78
+ echo "✗ Unsupported OS for automatic cursor-agent installation"
79
+ echo " Install manually: https://cursor.com/cli"
80
+ exit 1
81
+ fi
82
+ fi
83
+ echo ""
84
+
85
+ # Step 5: Check CURSOR_API_KEY (REQUIRED for CI/CD)
86
+ echo "Step 5: Checking CURSOR_API_KEY..."
87
+ if [ -z "$CURSOR_API_KEY" ]; then
88
+ echo "⚠️ CURSOR_API_KEY not set"
89
+ echo " ⚠️ REQUIRED for CI/CD - cursor-agent will fail without it!"
90
+ echo " Set it as an environment variable in your CI/CD config"
91
+ echo " Get your key from: https://cursor.com/settings"
92
+ echo ""
93
+ echo " Example (GitLab CI):"
94
+ echo " variables:"
95
+ echo " CURSOR_API_KEY: \$CURSOR_API_KEY"
96
+ echo ""
97
+ else
98
+ echo "✓ CURSOR_API_KEY is set"
99
+ fi
100
+ echo ""
101
+
102
+ # Step 6: Run the official Playwright MCP setup
103
+ echo "Step 6: Setting up official Playwright MCP..."
104
+ echo ""
105
+ bash "$SCRIPT_DIR/setup-official-playwright-mcp.sh"
106
+
107
+ echo ""
108
+ echo "======================================="
109
+ echo "✅ Complete CI/CD setup finished!"
110
+ echo "======================================="
111
+ echo ""
112
+ echo "Ready to use in CI/CD:"
113
+ echo " cursor-agent -p 'Navigate to google.com' --mcp-server playwright-official"
114
+ echo ""
115
+
@@ -0,0 +1,197 @@
1
+ #!/bin/bash
2
+
3
+ set -e
4
+
5
+ # Get script directory for relative imports
6
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7
+
8
+ # Step 1: Check cursor-agent
9
+ if ! command -v cursor-agent &> /dev/null; then
10
+ echo "⚠️ cursor-agent not found. Installing..."
11
+ curl https://cursor.com/install -fsS | bash
12
+ export PATH="$HOME/.cursor/bin:$HOME/.local/bin:$PATH"
13
+ fi
14
+
15
+ # Step 2: Find Node.js absolute paths (Cursor GUI doesn't have shell PATH)
16
+ NODE_PATH=$(which node 2>/dev/null || echo "")
17
+ NPX_PATH=$(which npx 2>/dev/null || echo "")
18
+ NODE_BIN_DIR=$(dirname "$NODE_PATH" 2>/dev/null || echo "")
19
+
20
+ if [ -z "$NODE_PATH" ]; then
21
+ echo "❌ node not found. Please install Node.js"
22
+ exit 1
23
+ fi
24
+
25
+ echo " Using Node: $NODE_PATH"
26
+
27
+ # Step 3: Install Zibby MCP Browser (forked Playwright MCP with stable ID support)
28
+ echo "Setting up Zibby MCP Browser..."
29
+ ZIBBY_MCP_DIR="$SCRIPT_DIR/../../mcps/browser"
30
+ ZIBBY_MCP_BIN="$ZIBBY_MCP_DIR/bin/mcp-browser-zibby.js"
31
+
32
+ if [ -f "$ZIBBY_MCP_BIN" ]; then
33
+ # Install dependencies (skip if already resolvable via workspace hoisting)
34
+ if [ ! -d "$ZIBBY_MCP_DIR/node_modules" ]; then
35
+ if "$NODE_PATH" -e "require.resolve('@playwright/mcp', {paths:['$ZIBBY_MCP_DIR']})" 2>/dev/null; then
36
+ echo " ✅ Dependencies available"
37
+ else
38
+ echo " 📥 Installing dependencies..."
39
+ (cd "$ZIBBY_MCP_DIR" && npm install --silent > /dev/null 2>&1) || echo " ⚠️ Could not install dependencies"
40
+ fi
41
+ fi
42
+ echo "Zibby MCP Browser ready"
43
+ else
44
+ echo "Zibby MCP Browser not found at $ZIBBY_MCP_BIN"
45
+ exit 1
46
+ fi
47
+
48
+ # Install ffmpeg for video recording
49
+ echo "🎬 Installing ffmpeg for video recording..."
50
+ if command -v playwright &> /dev/null 2>&1; then
51
+ playwright install ffmpeg > /dev/null 2>&1 && echo " ✅ ffmpeg installed" || echo " ⚠️ Could not install ffmpeg"
52
+ else
53
+ "$NPX_PATH" --yes playwright install ffmpeg > /dev/null 2>&1 && echo " ✅ ffmpeg installed" || echo " ⚠️ Could not install ffmpeg (will disable video)"
54
+ fi
55
+
56
+ # Step 4: Configure MCP
57
+ echo "Configuring Zibby MCP Browser..."
58
+ mkdir -p ~/.cursor
59
+
60
+ # Default viewport size (can be overridden via env)
61
+ VIEWPORT_WIDTH="${ZIBBY_VIEWPORT_WIDTH:-1280}"
62
+ VIEWPORT_HEIGHT="${ZIBBY_VIEWPORT_HEIGHT:-720}"
63
+ VIEWPORT_SIZE="${VIEWPORT_WIDTH}x${VIEWPORT_HEIGHT}"
64
+
65
+ # Build MCP args array
66
+ MCP_ARGS="\"--save-video=${VIEWPORT_SIZE}\", \"--viewport-size=${VIEWPORT_SIZE}\", \"--output-dir=test-results\""
67
+
68
+ # Check if headless mode requested (default is headed)
69
+ if [ "$ZIBBY_HEADLESS" = "1" ]; then
70
+ MCP_ARGS="$MCP_ARGS, \"--headless\""
71
+ echo " Mode: Headless (hidden browser)"
72
+ else
73
+ echo " Mode: Headed (visible browser)"
74
+ fi
75
+
76
+ # Check if video recording requested (default is on)
77
+ if [ "$ZIBBY_VIDEO" != "off" ]; then
78
+ echo " Video: Enabled (${VIEWPORT_SIZE})"
79
+ else
80
+ MCP_ARGS="\"--viewport-size=${VIEWPORT_SIZE}\", \"--output-dir=test-results\""
81
+ if [ "$ZIBBY_HEADLESS" = "1" ]; then
82
+ MCP_ARGS="$MCP_ARGS, \"--headless\""
83
+ fi
84
+ echo " Video: Disabled"
85
+ fi
86
+
87
+ # Check if Zibby Cloud MCP should be included
88
+ if [ "$ZIBBY_CLOUD_SYNC" = "1" ]; then
89
+ LOCAL_MCP_PATH="$SCRIPT_DIR/../../mcp-server/src/index.js"
90
+
91
+ if [ -f "$LOCAL_MCP_PATH" ]; then
92
+ MCP_PKG_DIR="$SCRIPT_DIR/../../mcp-server"
93
+ if [ -f "$MCP_PKG_DIR/package.json" ]; then
94
+ echo " 📦 Installing Zibby Cloud MCP dependencies..."
95
+ (cd "$MCP_PKG_DIR" && npm install --silent > /dev/null 2>&1) || echo " ⚠️ Warning: Could not install dependencies"
96
+ fi
97
+
98
+ cat > ~/.cursor/mcp.json <<EOF
99
+ {
100
+ "mcpServers": {
101
+ "playwright-official": {
102
+ "command": "$NODE_PATH",
103
+ "args": ["$ZIBBY_MCP_BIN", $MCP_ARGS],
104
+ "env": {
105
+ "PATH": "$NODE_BIN_DIR:/usr/bin:/bin:/usr/sbin:/sbin"
106
+ },
107
+ "description": "Zibby MCP Browser - Forked Playwright MCP with stable ID support"
108
+ },
109
+ "zibby": {
110
+ "command": "$NODE_PATH",
111
+ "args": ["$LOCAL_MCP_PATH"],
112
+ "env": {
113
+ "ZIBBY_API_KEY": "${ZIBBY_API_KEY}",
114
+ "PATH": "$NODE_BIN_DIR:/usr/bin:/bin:/usr/sbin:/sbin"
115
+ },
116
+ "description": "Zibby Cloud Sync - Upload test results and artifacts"
117
+ }
118
+ }
119
+ }
120
+ EOF
121
+ echo " + Zibby MCP Browser (stable IDs + event recording)"
122
+ echo " + Zibby Cloud MCP (cloud sync enabled)"
123
+ else
124
+ echo " ⚠️ Cloud sync requested but local MCP server not found"
125
+ cat > ~/.cursor/mcp.json <<EOF
126
+ {
127
+ "mcpServers": {
128
+ "playwright-official": {
129
+ "command": "$NODE_PATH",
130
+ "args": ["$ZIBBY_MCP_BIN", $MCP_ARGS],
131
+ "env": {
132
+ "PATH": "$NODE_BIN_DIR:/usr/bin:/bin:/usr/sbin:/sbin"
133
+ },
134
+ "description": "Zibby MCP Browser - Forked Playwright MCP with stable ID support"
135
+ }
136
+ }
137
+ }
138
+ EOF
139
+ echo " + Zibby MCP Browser (stable IDs + event recording)"
140
+ fi
141
+ else
142
+ cat > ~/.cursor/mcp.json <<EOF
143
+ {
144
+ "mcpServers": {
145
+ "playwright-official": {
146
+ "command": "$NODE_PATH",
147
+ "args": ["$ZIBBY_MCP_BIN", $MCP_ARGS],
148
+ "env": {
149
+ "PATH": "$NODE_BIN_DIR:/usr/bin:/bin:/usr/sbin:/sbin"
150
+ },
151
+ "description": "Zibby MCP Browser - Forked Playwright MCP with stable ID support"
152
+ }
153
+ }
154
+ }
155
+ EOF
156
+ echo " + Zibby MCP Browser (stable IDs + event recording)"
157
+ fi
158
+
159
+ # Step 5: Patch cursor-agent
160
+ echo "Patching cursor-agent..."
161
+ node "$SCRIPT_DIR/patch-cursor-mcp.js" > /dev/null 2>&1 || echo " (patch may not be needed for your version)"
162
+
163
+ # Step 6: Get approval key
164
+ echo "🔑 Getting approval key..."
165
+ APPROVAL_OUTPUT=$(cursor-agent mcp list 2>&1)
166
+
167
+ APPROVAL_KEY_LINE=$(echo "$APPROVAL_OUTPUT" | grep "🔑 APPROVAL KEY.*playwright-official" | head -1)
168
+ echo "$APPROVAL_KEY_LINE"
169
+
170
+ APPROVAL_KEY=$(echo "$APPROVAL_KEY_LINE" | sed -E 's/.*=> ([^ ]+).*/\1/' | head -1)
171
+
172
+ if [ -z "$APPROVAL_KEY" ]; then
173
+ APPROVAL_KEY=$(echo "$APPROVAL_OUTPUT" | grep -oE 'playwright-official-[a-f0-9]+' | head -1)
174
+ fi
175
+
176
+ if [ -z "$APPROVAL_KEY" ]; then
177
+ echo "⚠️ Could not auto-extract approval key"
178
+ echo " This is OK for development - approval key only needed for CI/CD"
179
+ echo " For CI/CD: Run 'cursor-agent mcp list' and save the key"
180
+ else
181
+ # Step 7: Setup workspace approvals (only if we got the key)
182
+ echo "Configuring approvals..."
183
+ WORKSPACE_PATH="$PWD"
184
+ WORKSPACE_ENCODED=$(echo "$WORKSPACE_PATH" | sed 's|^/||' | sed 's|/|-|g')
185
+ APPROVAL_DIR="$HOME/.cursor/projects/$WORKSPACE_ENCODED"
186
+ APPROVAL_FILE="$APPROVAL_DIR/mcp-approvals.json"
187
+
188
+ mkdir -p "$APPROVAL_DIR"
189
+ cat > "$APPROVAL_FILE" <<EOF
190
+ ["$APPROVAL_KEY"]
191
+ EOF
192
+ echo "Auto-approval configured for this workspace"
193
+ fi
194
+
195
+ echo ""
196
+ echo "Zibby MCP Browser ready!"
197
+ echo ""
@@ -0,0 +1,49 @@
1
+ #!/bin/bash
2
+
3
+ # Run Playwright tests with video recording
4
+ # Usage: ./scripts/test-with-video.sh [test-file] [headed]
5
+ #
6
+ # Examples:
7
+ # ./scripts/test-with-video.sh tests/auth/login.spec.js
8
+ # ./scripts/test-with-video.sh tests/auth/login.spec.js headed
9
+
10
+ TEST_FILE="${1:-tests/}"
11
+ HEADED_FLAG=""
12
+
13
+ if [ "$2" = "headed" ]; then
14
+ HEADED_FLAG="--headed"
15
+ fi
16
+
17
+ echo "🎥 Running Playwright tests with video recording..."
18
+ echo " Test: $TEST_FILE"
19
+ echo " Mode: $([ -n "$HEADED_FLAG" ] && echo "Headed (visible)" || echo "Headless")"
20
+ echo ""
21
+
22
+ # Run tests (video is configured in playwright.config.js)
23
+ npx playwright test "$TEST_FILE" --project=chromium $HEADED_FLAG
24
+
25
+ echo ""
26
+ echo "✅ Tests complete!"
27
+ echo ""
28
+ echo "📂 Videos saved in: test-results/"
29
+ echo ""
30
+
31
+ # List videos if any were created
32
+ if ls test-results/*/video.webm 2>/dev/null 1>&2; then
33
+ echo "🎬 Videos created:"
34
+ ls -lh test-results/*/video.webm
35
+ echo ""
36
+ echo "To view videos:"
37
+ echo " 1. Open Finder: open test-results/"
38
+ echo " 2. Or play directly:"
39
+ for video in test-results/*/video.webm; do
40
+ echo " open \"$video\""
41
+ done
42
+ else
43
+ echo "ℹ️ No videos found"
44
+ echo ""
45
+ echo "Video is configured in playwright.config.js:"
46
+ echo " - video: 'on' (always record)"
47
+ echo " - video: 'retain-on-failure' (only failed tests)"
48
+ fi
49
+
@@ -75,18 +75,26 @@ export class CursorAgentStrategy extends AgentStrategy {
75
75
  '/Applications/Cursor.app/Contents/Resources/app/bin/cursor'
76
76
  ];
77
77
 
78
- let cursorBin = 'agent';
78
+ let cursorBin = null;
79
79
  for (const bin of possibleBins) {
80
- if (bin === 'agent') {
81
- cursorBin = bin;
82
- break;
83
- }
84
- if (existsSync(bin)) {
80
+ try {
81
+ if (bin.startsWith('/')) {
82
+ accessSync(bin, constants.X_OK);
83
+ } else {
84
+ execSync(`which ${bin} 2>/dev/null`, { stdio: 'ignore', timeout: 2000 });
85
+ }
85
86
  cursorBin = bin;
87
+ logger.debug(`[Agent] Using binary: ${bin}`);
86
88
  break;
89
+ } catch {
90
+ continue;
87
91
  }
88
92
  }
89
93
 
94
+ if (!cursorBin) {
95
+ throw new Error('Cursor Agent CLI not found. Install it or add it to PATH.');
96
+ }
97
+
90
98
  // File-based structured output: agent writes JSON to this file
91
99
  let resultFilePath = null;
92
100
  if (schema) {