@arcadialdev/arcality 2.2.6 → 2.2.9

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": "@arcadialdev/arcality",
3
- "version": "2.2.6",
3
+ "version": "2.2.9",
4
4
  "description": "AI-powered QA testing tool — Autonomous web testing agent by Arcadial",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -6,6 +6,7 @@
6
6
  import 'dotenv/config';
7
7
  import fs from "node:fs";
8
8
  import path from "node:path";
9
+ import { createRequire } from 'node:module';
9
10
  import { spawn, exec } from "node:child_process";
10
11
  import chalk from "chalk";
11
12
  import { fileURLToPath } from 'url';
@@ -309,7 +310,7 @@ function run(cmd, args, options = {}) {
309
310
 
310
311
  const p = spawn(cmd, args, {
311
312
  stdio: ["ignore", "pipe", "pipe"],
312
- shell: process.platform === "win32",
313
+ shell: false, // IMPORTANT: shell:false prevents Windows CMD from splitting paths with spaces
313
314
  windowsHide: true,
314
315
  env: { ...options.env || process.env, NODE_PATH: newNodePath },
315
316
  });
@@ -711,9 +712,23 @@ async function main() {
711
712
  console.log(chalk.gray(`\n>> ARCALITY_PROJECT_ID: ${finalProjectId}`));
712
713
  }
713
714
 
714
- // Always use Arcality's own Playwright CLI to avoid version conflicts
715
- // We invoke via `node cli.js` to avoid Windows shell path-with-spaces issues
716
- const playwrightCli = path.join(PROJECT_ROOT, 'node_modules', 'playwright', 'cli.js');
715
+ // Resolve playwright CLI using Node's module resolution algorithm.
716
+ // This handles BOTH cases:
717
+ // - Global install: playwright is inside arcality's own node_modules
718
+ // - Local install: playwright is hoisted to the project's root node_modules
719
+ let playwrightCli;
720
+ try {
721
+ const arcalityRequire = createRequire(path.join(PROJECT_ROOT, 'package.json'));
722
+ playwrightCli = arcalityRequire.resolve('playwright/cli');
723
+ } catch {
724
+ // Fallback: try local hoisted path (project_root/../../playwright)
725
+ const hoistedPath = path.join(PROJECT_ROOT, '..', '..', 'playwright', 'cli.js');
726
+ if (fs.existsSync(hoistedPath)) {
727
+ playwrightCli = hoistedPath;
728
+ } else {
729
+ playwrightCli = path.join(PROJECT_ROOT, 'node_modules', 'playwright', 'cli.js');
730
+ }
731
+ }
717
732
  const configFile = path.join(PROJECT_ROOT, 'playwright.config.ts');
718
733
 
719
734
  try {
@@ -801,12 +816,15 @@ async function main() {
801
816
  globalReportProcess = null;
802
817
  }
803
818
 
804
- console.log(chalk.blue(`🌐 Opening Arcality Report: ${arcalityPath}`));
805
-
806
- if (process.platform === "win32") {
807
- exec(`start "" "${arcalityPath}"`);
819
+ if (fs.existsSync(arcalityPath)) {
820
+ console.log(chalk.blue(`🌐 Opening Arcality Report: ${arcalityPath}`));
821
+ if (process.platform === "win32") {
822
+ exec(`start "" "${arcalityPath}"`);
823
+ } else {
824
+ exec(`open "${arcalityPath}"`);
825
+ }
808
826
  } else {
809
- exec(`open "${arcalityPath}"`);
827
+ console.log(chalk.yellow(`⚠️ Report not generated (test may have crashed before completing).`));
810
828
  }
811
829
 
812
830
  await new Promise(resolve => setTimeout(resolve, 2000));
package/scripts/init.mjs CHANGED
@@ -235,18 +235,24 @@ async function main() {
235
235
 
236
236
  if (!res.ok) {
237
237
  const errText = await res.text().catch(() => '');
238
- sCreate.stop(chalk.red(`❌ Failed to create project (HTTP ${res.status}): ${errText}`));
239
- process.exit(1);
238
+ // If response is HTML (e.g. Cloudflare 521), show a clean message
239
+ const isHtml = errText.trim().startsWith('<');
240
+ const displayError = isHtml
241
+ ? `The Arcality backend server is temporarily unavailable (HTTP ${res.status}). The project will be saved locally only.`
242
+ : `HTTP ${res.status}: ${errText.slice(0, 200)}`;
243
+
244
+ sCreate.stop(chalk.yellow(`⚠️ ${displayError}`));
245
+ // Don't exit — write the config with a local-only project ID so user can still run
246
+ projectId = projectId || `local_${Date.now()}`;
247
+ } else {
248
+ const created = await res.json();
249
+ projectId = created.id || created.Id;
250
+ organizationId = organizationId || created.organizationId || created.organization_id || null;
251
+ sCreate.stop(chalk.green(`✅ Project created: "${projectName.trim()}" (${projectId})`));
240
252
  }
241
-
242
- const created = await res.json();
243
- projectId = created.id || created.Id;
244
- organizationId = organizationId || created.organizationId || created.organization_id || null;
245
-
246
- sCreate.stop(chalk.green(`✅ Project created: "${projectName.trim()}" (${projectId})`));
247
253
  } catch (err) {
248
- sCreate.stop(chalk.red(`❌ Error creating project: ${err.message}`));
249
- process.exit(1);
254
+ sCreate.stop(chalk.yellow(`⚠️ Could not reach Arcality server: ${err.message}. Continuing in local mode.`));
255
+ projectId = projectId || `local_${Date.now()}`;
250
256
  }
251
257
 
252
258
  // ── Step 6: Write arcality.config ──