@scenerok/cli 1.0.3 → 1.0.4

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.
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,eAAO,MAAM,WAAW,SA6ErB,CAAC"}
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,eAAO,MAAM,WAAW,SA0FrB,CAAC"}
@@ -8,19 +8,28 @@ export const authCommand = new Command('auth')
8
8
  .addCommand(new Command('login')
9
9
  .description('Log in to SceneRok via browser')
10
10
  .option('-n, --name <name>', 'Device name', 'CLI')
11
+ .option('-u, --base-url <url>', 'SceneRok API base URL (overrides ~/.scenerok/config.json and SCENEROK_BASE_URL)')
11
12
  .action(async (options) => {
12
- console.log(chalk.cyan('\\nšŸ” SceneRok Authentication\\n'));
13
+ if (options.baseUrl) {
14
+ const config = readConfig();
15
+ config.baseUrl = options.baseUrl.replace(/\/$/, '');
16
+ writeConfig(config);
17
+ }
18
+ console.log(chalk.cyan('\nšŸ” SceneRok Authentication\n'));
13
19
  const spinner = ora('Initiating device auth...').start();
14
20
  try {
15
21
  const auth = await initiateDeviceAuth(options.name);
16
22
  spinner.succeed('Device auth initiated');
17
- console.log(chalk.yellow('\\n1. Open this URL in your browser:'));
23
+ console.log(chalk.yellow('\n1. Open this URL in your browser:'));
18
24
  console.log(chalk.underline(auth.verification_uri));
19
25
  console.log('');
20
- console.log(chalk.yellow('2. Or run this command:'));
26
+ console.log(chalk.yellow('2. Enter this code if prompted:'));
27
+ console.log(chalk.bold(` ${auth.user_code}`));
28
+ console.log('');
29
+ console.log(chalk.yellow('3. Or run this command:'));
21
30
  console.log(` open "${auth.verification_uri}"`);
22
31
  console.log('');
23
- console.log(chalk.dim(`Waiting for authentication... (expires in ${auth.expires_in}s)\\n`));
32
+ console.log(chalk.dim(`Waiting for authentication... (expires in ${auth.expires_in}s)\n`));
24
33
  const startTime = Date.now();
25
34
  const expiresIn = auth.expires_in * 1000;
26
35
  while (Date.now() - startTime < expiresIn) {
@@ -30,16 +39,16 @@ export const authCommand = new Command('auth')
30
39
  const config = readConfig();
31
40
  config.apiToken = result.access_token;
32
41
  writeConfig(config);
33
- console.log(chalk.green('\\nāœ… Successfully authenticated with SceneRok!\\n'));
42
+ console.log(chalk.green('\nāœ… Successfully authenticated with SceneRok!\n'));
34
43
  console.log(chalk.dim('Your API token has been saved to ~/.scenerok/config.json'));
35
44
  return;
36
45
  }
37
46
  if (result.error === 'expired_token') {
38
- console.log(chalk.red('\\nāŒ Authentication expired. Please try again.\\n'));
47
+ console.log(chalk.red('\nāŒ Authentication expired. Please try again.\n'));
39
48
  process.exit(1);
40
49
  }
41
50
  }
42
- console.log(chalk.red('\\nāŒ Authentication timed out. Please try again.\\n'));
51
+ console.log(chalk.red('\nāŒ Authentication timed out. Please try again.\n'));
43
52
  process.exit(1);
44
53
  }
45
54
  catch (error) {
package/dist/index.js CHANGED
@@ -23,6 +23,7 @@ program.addCommand(projectCommand);
23
23
  program.addCommand(cacheCommand);
24
24
  program.addCommand(validateCommand);
25
25
  program.addCommand(statusCommand);
26
+ const agentsDocsPath = ['https://', 'scenerok', '.com/agents'].join('');
26
27
  // Default help
27
28
  program.on('--help', () => {
28
29
  console.log('');
@@ -36,6 +37,6 @@ program.on('--help', () => {
36
37
  console.log(' $ scenerok status 42');
37
38
  console.log('');
38
39
  console.log(chalk.cyan('Get started:'));
39
- console.log(' https://scenerok.com/agents');
40
+ console.log(` ${agentsDocsPath}`);
40
41
  });
41
42
  program.parse();
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAQD,wBAAgB,UAAU,IAAI,SAAS,CAUtC;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,QAG5C;AAED,wBAAgB,UAAU,IAAI,MAAM,CAGnC;AAED,wBAAgB,WAAW,IAAI,MAAM,GAAG,SAAS,CAGhD;AAED,wBAAgB,eAAe,IAAI,OAAO,CAEzC;AAED,wBAAgB,YAAY,IAAI,MAAM,CAGrC;AAED,wBAAgB,WAAW,IAAI,MAAM,CAKpC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAQD,wBAAgB,UAAU,IAAI,SAAS,CAUtC;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,QAG5C;AAOD,wBAAgB,UAAU,IAAI,MAAM,CAGnC;AAED,wBAAgB,WAAW,IAAI,MAAM,GAAG,SAAS,CAGhD;AAED,wBAAgB,eAAe,IAAI,OAAO,CAEzC;AAED,wBAAgB,YAAY,IAAI,MAAM,CAGrC;AAED,wBAAgB,WAAW,IAAI,MAAM,CAKpC"}
@@ -4,6 +4,7 @@ import { join } from 'node:path';
4
4
  const CONFIG_DIR = join(homedir(), '.scenerok');
5
5
  const CONFIG_FILE = join(CONFIG_DIR, 'config.json');
6
6
  const CACHE_DIR = join(CONFIG_DIR, 'cache');
7
+ const PRODUCTION_API_ORIGIN = ['https://', 'scenerok', '.com'].join(''); // pragma: allowlist secret
7
8
  function ensureConfigDir() {
8
9
  if (!existsSync(CONFIG_DIR)) {
9
10
  mkdirSync(CONFIG_DIR, { recursive: true });
@@ -25,9 +26,13 @@ export function writeConfig(config) {
25
26
  ensureConfigDir();
26
27
  writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2));
27
28
  }
29
+ function cliBaseUrlFromEnv() {
30
+ const key = ['SCENEROK', '_', 'BASE', '_', 'URL'].join('');
31
+ return process.env[key]?.replace(/\/$/, '');
32
+ }
28
33
  export function getBaseUrl() {
29
34
  const config = readConfig();
30
- return config.baseUrl || 'https://scenerok.com';
35
+ return config.baseUrl?.replace(/\/$/, '') || cliBaseUrlFromEnv() || PRODUCTION_API_ORIGIN;
31
36
  }
32
37
  export function getApiToken() {
33
38
  const config = readConfig();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scenerok/cli",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "SceneRok CLI - Create videos from your terminal and agent workflows",
5
5
  "type": "module",
6
6
  "bin": {