@nometria-ai/nom 0.2.6 → 0.2.8

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": "@nometria-ai/nom",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "description": "Deploy any project to any cloud from your terminal. One command, zero config.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -5,16 +5,36 @@
5
5
  import { execSync } from 'node:child_process';
6
6
  import { existsSync } from 'node:fs';
7
7
  import { join } from 'node:path';
8
- import { readConfig, resolveEnv, updateConfig } from '../lib/config.js';
8
+ import { readConfig, resolveEnv, updateConfig, configExists } from '../lib/config.js';
9
9
  import { detectServices } from '../lib/detect.js';
10
- import { requireApiKey } from '../lib/auth.js';
10
+ import { getApiKey } from '../lib/auth.js';
11
11
  import { apiRequest, uploadFile } from '../lib/api.js';
12
12
  import { createTarball } from '../lib/tar.js';
13
13
  import { createSpinner } from '../lib/spinner.js';
14
14
  import { confirm } from '../lib/prompt.js';
15
+ import { login } from './login.js';
16
+ import { init } from './init.js';
15
17
 
16
18
  export async function deploy(flags) {
17
- const apiKey = requireApiKey();
19
+ // Auto-login if not authenticated
20
+ let apiKey = getApiKey();
21
+ if (!apiKey) {
22
+ console.log('\n No credentials found. Signing in first...\n');
23
+ await login(flags);
24
+ apiKey = getApiKey();
25
+ if (!apiKey) {
26
+ const err = new Error('Not authenticated');
27
+ err.code = 'ERR_AUTH';
28
+ throw err;
29
+ }
30
+ }
31
+
32
+ // Auto-init if no nometria.json
33
+ if (!configExists(process.cwd())) {
34
+ console.log(' No nometria.json found. Setting up project...\n');
35
+ await init({ yes: true });
36
+ }
37
+
18
38
  const config = readConfig();
19
39
  const envVars = resolveEnv(config.env);
20
40
  const appName = config.name || config.app_id;
@@ -100,8 +120,13 @@ export async function deploy(flags) {
100
120
 
101
121
  // Step 5: Poll for status via Deno function
102
122
  const deployId = deployResult.deploy_id || appName;
103
- console.log(`\n Dashboard: https://nometria.com/AppDetails?app_id=${deployId}\n`);
123
+ const dashboardUrl = `https://nometria.com/AppDetails?app_id=${deployId}`;
124
+ console.log(`\n Dashboard: ${dashboardUrl}`);
125
+ console.log(` You can close this terminal — check the dashboard for progress.\n`);
126
+
104
127
  let finalStatus;
128
+ const pollStart = Date.now();
129
+ const POLL_TIMEOUT_MS = 10 * 60 * 1000; // 10 minutes
105
130
  while (true) {
106
131
  await sleep(3000);
107
132
  try {
@@ -129,6 +154,13 @@ export async function deploy(flags) {
129
154
  deploySpinner.fail(`${isResync ? 'Resync' : 'Deploy'} failed: ${statusResult.data?.errorMessage || 'unknown error'}`);
130
155
  process.exit(1);
131
156
  }
157
+
158
+ // Timeout: if instance is running but status stuck at deploying, show URL and exit
159
+ if (Date.now() - pollStart > POLL_TIMEOUT_MS && instanceState === 'running') {
160
+ finalStatus = statusResult;
161
+ deploySpinner.succeed('Deploy in progress — check dashboard for final status');
162
+ break;
163
+ }
132
164
  } catch {
133
165
  // Keep polling on transient errors
134
166
  }