@zibby/cli 0.1.5 → 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/bin/zibby.js CHANGED
@@ -44,7 +44,7 @@ program
44
44
  program
45
45
  .command('run')
46
46
  .description('Run a test specification')
47
- .argument('[spec-path]', 'Path to test spec file (e.g., test-specs/auth/login.txt)')
47
+ .argument('[spec-path]', 'Path to test spec file or inline test description in quotes')
48
48
  .option('--sources <ids>', 'Comma-separated test case IDs to fetch from cloud')
49
49
  .option('--execution <id>', 'Execution ID containing the test cases (required with --sources)')
50
50
  .option('--agent <type>', 'Agent to use (claude, cursor) - overrides config')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zibby/cli",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Zibby CLI - Test automation generator and runner",
5
5
  "type": "module",
6
6
  "bin": {
@@ -33,7 +33,7 @@
33
33
  "dependencies": {
34
34
  "@aws-sdk/client-sqs": "^3.1000.0",
35
35
  "@zibby/skills": "*",
36
- "@zibby/core": "^0.1.1",
36
+ "@zibby/core": "^0.1.0",
37
37
  "chalk": "^5.3.0",
38
38
  "commander": "^12.0.0",
39
39
  "dotenv": "^17.2.3",
@@ -1,5 +1,5 @@
1
1
  import { runTest, logger, DEFAULT_OUTPUT_BASE, SESSIONS_DIR, DEFAULT_MODELS } from '@zibby/core';
2
- import { readFileSync, existsSync, statSync } from 'fs';
2
+ import { readFileSync, existsSync, statSync, mkdirSync, writeFileSync, rmSync } from 'fs';
3
3
  import { resolve, join } from 'path';
4
4
  import { glob } from 'glob';
5
5
  import chalk from 'chalk';
@@ -522,8 +522,6 @@ export async function runCommand(specPath, options) {
522
522
 
523
523
  console.log(chalk.green(`✓ Fetched ${testCases.length} test case(s)`));
524
524
 
525
- // Write each test case to a temp spec file and run sequentially
526
- const { mkdirSync, writeFileSync } = await import('fs');
527
525
  const tmpDir = resolve(process.cwd(), '.zibby-tmp');
528
526
  mkdirSync(tmpDir, { recursive: true });
529
527
 
@@ -541,8 +539,6 @@ export async function runCommand(specPath, options) {
541
539
  await runCommand(tmpSpec, childOptions);
542
540
  }
543
541
 
544
- // Cleanup
545
- const { rmSync } = await import('fs');
546
542
  rmSync(tmpDir, { recursive: true, force: true });
547
543
  return;
548
544
  }
@@ -550,11 +546,24 @@ export async function runCommand(specPath, options) {
550
546
  if (!specPath && !options.sources) {
551
547
  console.log(chalk.red('\n❌ Missing test spec path\n'));
552
548
  console.log(chalk.white('Usage:'));
553
- console.log(chalk.gray(' zibby run <spec-path> Run a test spec file'));
554
- console.log(chalk.gray(' zibby run test-specs/login.txt Example\n'));
549
+ console.log(chalk.gray(' zibby run test-specs/login.txt Run a spec file'));
550
+ console.log(chalk.gray(' zibby run "login and check dashboard" Run inline spec\n'));
555
551
  process.exit(1);
556
552
  }
557
553
 
554
+ const isInlineSpec = specPath
555
+ && !specPath.endsWith('.txt')
556
+ && !existsSync(resolve(process.cwd(), specPath))
557
+ && specPath.includes(' ');
558
+
559
+ if (isInlineSpec) {
560
+ const tmpDir = resolve(process.cwd(), '.zibby-tmp');
561
+ mkdirSync(tmpDir, { recursive: true });
562
+ const tmpSpec = resolve(tmpDir, `inline-${Date.now()}.txt`);
563
+ writeFileSync(tmpSpec, specPath, 'utf-8');
564
+ specPath = tmpSpec;
565
+ }
566
+
558
567
  const fullSpecPath = resolve(process.cwd(), specPath);
559
568
 
560
569
  if (!existsSync(fullSpecPath)) {
@@ -913,6 +922,7 @@ export async function runCommand(specPath, options) {
913
922
  // Check if error is from user interruption
914
923
  if (error.message.includes('Interrupted by user')) {
915
924
  console.log(chalk.yellow('Test execution was interrupted\n'));
925
+ cleanupInlineSpec(isInlineSpec);
916
926
  process.exit(130);
917
927
  }
918
928
 
@@ -920,7 +930,15 @@ export async function runCommand(specPath, options) {
920
930
  if (error.stack) {
921
931
  console.log(chalk.gray(error.stack));
922
932
  }
933
+ cleanupInlineSpec(isInlineSpec);
923
934
  process.exit(1);
924
935
  }
936
+
937
+ cleanupInlineSpec(isInlineSpec);
938
+ }
939
+
940
+ function cleanupInlineSpec(isInline) {
941
+ if (!isInline) return;
942
+ try { rmSync(resolve(process.cwd(), '.zibby-tmp'), { recursive: true, force: true }); } catch {}
925
943
  }
926
944