@nometria-ai/nom 0.2.6 → 0.2.7
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 +1 -1
- package/src/commands/deploy.js +36 -4
- package/src/commands/init.js +3 -6
package/package.json
CHANGED
package/src/commands/deploy.js
CHANGED
|
@@ -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 {
|
|
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
|
-
|
|
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
|
-
|
|
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
|
}
|
package/src/commands/init.js
CHANGED
|
@@ -88,13 +88,10 @@ export async function init(flags) {
|
|
|
88
88
|
const configPath = join(dir, CONFIG_FILE);
|
|
89
89
|
writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n');
|
|
90
90
|
|
|
91
|
-
console.log(`\n Created ${CONFIG_FILE}`);
|
|
92
|
-
|
|
93
|
-
// Auto-generate AI tool configs
|
|
94
|
-
const { setup } = await import('./setup.js');
|
|
95
|
-
await setup({ yes: true });
|
|
91
|
+
console.log(`\n Created ${CONFIG_FILE}\n`);
|
|
96
92
|
|
|
97
93
|
console.log(` Next steps:`);
|
|
98
94
|
console.log(` 1. Run nom login to authenticate`);
|
|
99
|
-
console.log(` 2. Run nom deploy to deploy
|
|
95
|
+
console.log(` 2. Run nom deploy to deploy`);
|
|
96
|
+
console.log(` 3. Run nom setup to generate AI tool configs (optional)\n`);
|
|
100
97
|
}
|