@notis_ai/cli 0.2.0-beta.16.1 → 0.2.0
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/README.md +4 -6
- package/package.json +1 -6
- package/src/command-specs/apps.js +10 -77
- package/src/runtime/app-platform.js +69 -309
- package/src/runtime/app-preview-server.js +96 -136
- package/template/app/globals.css +0 -3
- package/template/app/layout.tsx +0 -7
- package/template/app/page.tsx +0 -55
- package/template/components/ui/badge.tsx +0 -28
- package/template/components/ui/button.tsx +0 -53
- package/template/components/ui/card.tsx +0 -56
- package/template/components.json +0 -20
- package/template/lib/utils.ts +0 -6
- package/template/notis.config.ts +0 -18
- package/template/package.json +0 -32
- package/template/packages/notis-sdk/package.json +0 -26
- package/template/packages/notis-sdk/src/config.ts +0 -48
- package/template/packages/notis-sdk/src/helpers.ts +0 -131
- package/template/packages/notis-sdk/src/hooks/useAppState.ts +0 -50
- package/template/packages/notis-sdk/src/hooks/useBackend.ts +0 -41
- package/template/packages/notis-sdk/src/hooks/useCollectionItem.ts +0 -58
- package/template/packages/notis-sdk/src/hooks/useDatabase.ts +0 -87
- package/template/packages/notis-sdk/src/hooks/useDocument.ts +0 -61
- package/template/packages/notis-sdk/src/hooks/useNotis.ts +0 -31
- package/template/packages/notis-sdk/src/hooks/useNotisNavigation.ts +0 -49
- package/template/packages/notis-sdk/src/hooks/useTool.ts +0 -49
- package/template/packages/notis-sdk/src/hooks/useTools.ts +0 -56
- package/template/packages/notis-sdk/src/hooks/useUpsertDocument.ts +0 -57
- package/template/packages/notis-sdk/src/index.ts +0 -47
- package/template/packages/notis-sdk/src/provider.tsx +0 -44
- package/template/packages/notis-sdk/src/runtime.ts +0 -159
- package/template/packages/notis-sdk/src/styles.css +0 -123
- package/template/packages/notis-sdk/src/ui.ts +0 -15
- package/template/packages/notis-sdk/src/vite.ts +0 -54
- package/template/packages/notis-sdk/tsconfig.json +0 -15
- package/template/postcss.config.mjs +0 -8
- package/template/tailwind.config.ts +0 -58
- package/template/tsconfig.json +0 -22
- package/template/vite.config.ts +0 -10
package/README.md
CHANGED
|
@@ -84,7 +84,7 @@ Examples:
|
|
|
84
84
|
|
|
85
85
|
Scaffold a new Notis app project.
|
|
86
86
|
|
|
87
|
-
When to use: Start a new Notis app. Creates a
|
|
87
|
+
When to use: Start a new Notis app. Creates a Next.js project with @notis/sdk pre-configured.
|
|
88
88
|
|
|
89
89
|
Examples:
|
|
90
90
|
- `notis apps init "Mind the Flo"`
|
|
@@ -106,7 +106,7 @@ Examples:
|
|
|
106
106
|
|
|
107
107
|
### `notis apps dev [dir]`
|
|
108
108
|
|
|
109
|
-
Run the
|
|
109
|
+
Run the Next.js dev server for local development.
|
|
110
110
|
|
|
111
111
|
When to use: Iterate on app UI with hot reload. SDK hooks return mock data.
|
|
112
112
|
|
|
@@ -126,9 +126,9 @@ Examples:
|
|
|
126
126
|
|
|
127
127
|
### `notis apps preview [dir]`
|
|
128
128
|
|
|
129
|
-
Serve the built
|
|
129
|
+
Serve the built artifact locally for testing.
|
|
130
130
|
|
|
131
|
-
When to use: Smoke-test the exact
|
|
131
|
+
When to use: Smoke-test the exact artifact that will be deployed. Databases use seed data.
|
|
132
132
|
|
|
133
133
|
Options:
|
|
134
134
|
- `--port <number>` — Server port (default: 8787).
|
|
@@ -156,13 +156,11 @@ When to use: Ship the installed app to production for the linked user/team app.
|
|
|
156
156
|
Options:
|
|
157
157
|
- `--app-id <id>` — Override linked app ID.
|
|
158
158
|
- `--skip-build` — Skip the build step (use existing .notis/output/).
|
|
159
|
-
- `--direct` — Upload directly to Supabase storage, bypassing the backend server. Auto-fallback on network errors.
|
|
160
159
|
|
|
161
160
|
Examples:
|
|
162
161
|
- `notis apps deploy`
|
|
163
162
|
- `notis apps deploy --skip-build`
|
|
164
163
|
- `notis apps deploy --app-id abc123`
|
|
165
|
-
- `notis apps deploy --direct`
|
|
166
164
|
|
|
167
165
|
### `notis apps doctor [dir]`
|
|
168
166
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@notis_ai/cli",
|
|
3
|
-
"version": "0.2.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Agent-first Notis CLI for apps, databases, and generic tool execution",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -9,13 +9,11 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
"bin/",
|
|
11
11
|
"src/",
|
|
12
|
-
"template/",
|
|
13
12
|
"README.md"
|
|
14
13
|
],
|
|
15
14
|
"scripts": {
|
|
16
15
|
"docs:generate": "node ./scripts/generate-docs.js",
|
|
17
16
|
"docs:check": "node ./scripts/generate-docs.js --check",
|
|
18
|
-
"release:prepare": "node ./scripts/prepare-publish.js --apply",
|
|
19
17
|
"test": "node --test"
|
|
20
18
|
},
|
|
21
19
|
"engines": {
|
|
@@ -31,8 +29,5 @@
|
|
|
31
29
|
"ai",
|
|
32
30
|
"agent-skills"
|
|
33
31
|
],
|
|
34
|
-
"publishConfig": {
|
|
35
|
-
"access": "public"
|
|
36
|
-
},
|
|
37
32
|
"license": "MIT"
|
|
38
33
|
}
|
|
@@ -22,7 +22,6 @@ import {
|
|
|
22
22
|
scaffoldProject,
|
|
23
23
|
collectArtifactFiles,
|
|
24
24
|
runProjectScript,
|
|
25
|
-
directDeploy,
|
|
26
25
|
} from '../runtime/app-platform.js';
|
|
27
26
|
import { startPreviewServer } from '../runtime/app-preview-server.js';
|
|
28
27
|
import {
|
|
@@ -44,18 +43,6 @@ function appsTable(apps) {
|
|
|
44
43
|
]);
|
|
45
44
|
}
|
|
46
45
|
|
|
47
|
-
async function assertDirectDeployAccess(runtime, appId) {
|
|
48
|
-
const result = await runToolCommand({
|
|
49
|
-
runtime,
|
|
50
|
-
toolName: 'notis_list_apps',
|
|
51
|
-
});
|
|
52
|
-
const apps = result.payload.apps || [];
|
|
53
|
-
const hasAccess = apps.some((app) => (app.app_id || app.id) === appId);
|
|
54
|
-
if (!hasAccess) {
|
|
55
|
-
throw usageError(`Direct deploy requires access to app ${appId}.`);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
46
|
// ---------------------------------------------------------------------------
|
|
60
47
|
// Handlers
|
|
61
48
|
// ---------------------------------------------------------------------------
|
|
@@ -85,7 +72,7 @@ async function appsInitHandler(ctx) {
|
|
|
85
72
|
humanSummary: `Scaffolded "${ctx.args.name}" in ${projectDir}`,
|
|
86
73
|
hints: [
|
|
87
74
|
{ command: `cd ${projectDir} && npm install`, reason: 'Install dependencies' },
|
|
88
|
-
{ command: 'npm run dev', reason: 'Start the
|
|
75
|
+
{ command: 'npm run dev', reason: 'Start the Next.js dev server' },
|
|
89
76
|
],
|
|
90
77
|
});
|
|
91
78
|
}
|
|
@@ -93,16 +80,13 @@ async function appsInitHandler(ctx) {
|
|
|
93
80
|
async function appsCreateHandler(ctx) {
|
|
94
81
|
const projectDir = ctx.args.dir ? resolveProjectDir(ctx.args.dir) : null;
|
|
95
82
|
const idempotencyKey = nextIdempotencyKey(ctx.globalOptions);
|
|
96
|
-
const icon = ctx.options.icon
|
|
97
|
-
? (ctx.options.icon.startsWith('lucide:') ? ctx.options.icon : `lucide:${ctx.options.icon}`)
|
|
98
|
-
: undefined;
|
|
99
83
|
const result = await runToolCommand({
|
|
100
84
|
runtime: ctx.runtime,
|
|
101
85
|
toolName: 'notis_create_app',
|
|
102
86
|
arguments_: {
|
|
103
87
|
name: ctx.args.name,
|
|
104
88
|
description: ctx.options.description || undefined,
|
|
105
|
-
icon,
|
|
89
|
+
icon: ctx.options.icon || undefined,
|
|
106
90
|
},
|
|
107
91
|
mutating: true,
|
|
108
92
|
idempotencyKey,
|
|
@@ -220,19 +204,6 @@ async function appsDeployHandler(ctx) {
|
|
|
220
204
|
await buildArtifact(projectDir);
|
|
221
205
|
}
|
|
222
206
|
|
|
223
|
-
// Direct deploy mode: upload to Supabase storage directly
|
|
224
|
-
if (ctx.options.direct) {
|
|
225
|
-
await assertDirectDeployAccess(ctx.runtime, appId);
|
|
226
|
-
const { version } = await directDeploy(projectDir, appId);
|
|
227
|
-
return ctx.output.emitSuccess({
|
|
228
|
-
command: ctx.spec.command_path.join(' '),
|
|
229
|
-
data: { app_id: appId, version, mode: 'direct' },
|
|
230
|
-
humanSummary: `Deployed to app ${appId} (version ${version}) via direct upload`,
|
|
231
|
-
meta: { mutating: true },
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
// Standard deploy via backend server, with auto-fallback to direct
|
|
236
207
|
const files = collectArtifactFiles(projectDir);
|
|
237
208
|
const manifest = readManifest(projectDir);
|
|
238
209
|
|
|
@@ -253,39 +224,6 @@ async function appsDeployHandler(ctx) {
|
|
|
253
224
|
if (error.code === 'conflict') {
|
|
254
225
|
throw toolConflictToError(error.details, 'Deploy conflict');
|
|
255
226
|
}
|
|
256
|
-
|
|
257
|
-
// Auto-fallback to direct deploy on network errors
|
|
258
|
-
const isNetworkError = error.code === 'network_error'
|
|
259
|
-
|| error.code === 'network_timeout'
|
|
260
|
-
|| (error.message && /fetch failed|ECONNREFUSED|network/i.test(error.message));
|
|
261
|
-
|
|
262
|
-
if (isNetworkError) {
|
|
263
|
-
try {
|
|
264
|
-
await assertDirectDeployAccess(ctx.runtime, appId);
|
|
265
|
-
} catch (accessError) {
|
|
266
|
-
throw usageError(
|
|
267
|
-
`Backend deploy failed (${error.message}) and direct fallback was blocked because app access ` +
|
|
268
|
-
`could not be verified (${accessError.message}).`,
|
|
269
|
-
);
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
try {
|
|
273
|
-
const { version } = await directDeploy(projectDir, appId);
|
|
274
|
-
return ctx.output.emitSuccess({
|
|
275
|
-
command: ctx.spec.command_path.join(' '),
|
|
276
|
-
data: { app_id: appId, version, mode: 'direct-fallback' },
|
|
277
|
-
humanSummary: `Backend unavailable -- deployed to app ${appId} (version ${version}) via direct upload`,
|
|
278
|
-
warnings: ['Backend server was unreachable. Used direct Supabase upload as fallback.'],
|
|
279
|
-
meta: { mutating: true },
|
|
280
|
-
});
|
|
281
|
-
} catch (directError) {
|
|
282
|
-
throw usageError(
|
|
283
|
-
`Backend deploy failed (${error.message}) and direct fallback also failed (${directError.message}). ` +
|
|
284
|
-
'Check server/.env for Supabase credentials or start the backend server.',
|
|
285
|
-
);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
|
|
289
227
|
throw error;
|
|
290
228
|
}
|
|
291
229
|
|
|
@@ -304,14 +242,16 @@ async function appsDeployHandler(ctx) {
|
|
|
304
242
|
async function appsDoctorHandler(ctx) {
|
|
305
243
|
const projectDir = resolveProjectDir(ctx.args.dir || '.');
|
|
306
244
|
const problems = detectProjectProblems(projectDir);
|
|
245
|
+
const warnings = detectProjectWarnings(projectDir);
|
|
307
246
|
|
|
308
247
|
let appConfig = null;
|
|
309
248
|
try {
|
|
310
249
|
appConfig = await loadAppConfig(projectDir);
|
|
250
|
+
const configWarnings = detectProjectWarnings(projectDir, appConfig);
|
|
251
|
+
warnings.push(...configWarnings.filter((w) => !warnings.includes(w)));
|
|
311
252
|
} catch {
|
|
312
253
|
problems.push('Failed to load notis.config.ts');
|
|
313
254
|
}
|
|
314
|
-
const warnings = detectProjectWarnings(projectDir, appConfig);
|
|
315
255
|
|
|
316
256
|
const linkedState = readLinkedState(projectDir);
|
|
317
257
|
const status = problems.length ? 'unhealthy' : warnings.length ? 'warnings' : 'healthy';
|
|
@@ -346,7 +286,7 @@ export const appsCommandSpecs = [
|
|
|
346
286
|
{
|
|
347
287
|
command_path: ['apps', 'init'],
|
|
348
288
|
summary: 'Scaffold a new Notis app project.',
|
|
349
|
-
when_to_use: 'Start a new Notis app. Creates a
|
|
289
|
+
when_to_use: 'Start a new Notis app. Creates a Next.js project with @notis/sdk pre-configured.',
|
|
350
290
|
args_schema: {
|
|
351
291
|
arguments: [
|
|
352
292
|
{ token: '<name>', description: 'Display name for the app.' },
|
|
@@ -357,7 +297,6 @@ export const appsCommandSpecs = [
|
|
|
357
297
|
examples: ['notis apps init "Mind the Flo"', 'notis apps init "My App" ./my-app'],
|
|
358
298
|
mutates: true,
|
|
359
299
|
idempotent: false,
|
|
360
|
-
require_auth: false,
|
|
361
300
|
backend_call: { type: 'local', name: 'scaffold_project' },
|
|
362
301
|
handler: appsInitHandler,
|
|
363
302
|
},
|
|
@@ -386,7 +325,7 @@ export const appsCommandSpecs = [
|
|
|
386
325
|
},
|
|
387
326
|
{
|
|
388
327
|
command_path: ['apps', 'dev'],
|
|
389
|
-
summary: 'Run the
|
|
328
|
+
summary: 'Run the Next.js dev server for local development.',
|
|
390
329
|
when_to_use: 'Iterate on app UI with hot reload. SDK hooks return mock data.',
|
|
391
330
|
args_schema: {
|
|
392
331
|
arguments: [
|
|
@@ -397,7 +336,6 @@ export const appsCommandSpecs = [
|
|
|
397
336
|
examples: ['notis apps dev', 'notis apps dev ./my-app'],
|
|
398
337
|
mutates: false,
|
|
399
338
|
idempotent: true,
|
|
400
|
-
require_auth: false,
|
|
401
339
|
backend_call: { type: 'local', name: 'next_dev' },
|
|
402
340
|
handler: appsDevHandler,
|
|
403
341
|
},
|
|
@@ -414,14 +352,13 @@ export const appsCommandSpecs = [
|
|
|
414
352
|
examples: ['notis apps build', 'notis apps build ./my-app'],
|
|
415
353
|
mutates: true,
|
|
416
354
|
idempotent: true,
|
|
417
|
-
require_auth: false,
|
|
418
355
|
backend_call: { type: 'local', name: 'next_build_and_package' },
|
|
419
356
|
handler: appsBuildHandler,
|
|
420
357
|
},
|
|
421
358
|
{
|
|
422
359
|
command_path: ['apps', 'preview'],
|
|
423
|
-
summary: 'Serve the built
|
|
424
|
-
when_to_use: 'Smoke-test the exact
|
|
360
|
+
summary: 'Serve the built artifact locally for testing.',
|
|
361
|
+
when_to_use: 'Smoke-test the exact artifact that will be deployed. Databases use seed data.',
|
|
425
362
|
args_schema: {
|
|
426
363
|
arguments: [
|
|
427
364
|
{ token: '[dir]', key: 'dir', description: 'Project directory (default: current dir).' },
|
|
@@ -433,7 +370,6 @@ export const appsCommandSpecs = [
|
|
|
433
370
|
examples: ['notis apps preview', 'notis apps preview --port 3000'],
|
|
434
371
|
mutates: false,
|
|
435
372
|
idempotent: true,
|
|
436
|
-
require_auth: false,
|
|
437
373
|
backend_call: { type: 'local', name: 'preview_server' },
|
|
438
374
|
handler: appsPreviewHandler,
|
|
439
375
|
},
|
|
@@ -451,7 +387,6 @@ export const appsCommandSpecs = [
|
|
|
451
387
|
examples: ['notis apps link abc123', 'notis apps link abc123 ./my-app'],
|
|
452
388
|
mutates: true,
|
|
453
389
|
idempotent: true,
|
|
454
|
-
require_auth: false,
|
|
455
390
|
backend_call: { type: 'local', name: 'write_link_state' },
|
|
456
391
|
handler: appsLinkHandler,
|
|
457
392
|
},
|
|
@@ -467,10 +402,9 @@ export const appsCommandSpecs = [
|
|
|
467
402
|
options: [
|
|
468
403
|
{ flags: '--app-id <id>', description: 'Override linked app ID.' },
|
|
469
404
|
{ flags: '--skip-build', description: 'Skip the build step (use existing .notis/output/).' },
|
|
470
|
-
{ flags: '--direct', description: 'Upload directly to Supabase storage, bypassing the backend server. Auto-fallback on network errors.' },
|
|
471
405
|
],
|
|
472
406
|
},
|
|
473
|
-
examples: ['notis apps deploy', 'notis apps deploy --skip-build', 'notis apps deploy --app-id abc123'
|
|
407
|
+
examples: ['notis apps deploy', 'notis apps deploy --skip-build', 'notis apps deploy --app-id abc123'],
|
|
474
408
|
mutates: true,
|
|
475
409
|
idempotent: true,
|
|
476
410
|
backend_call: { type: 'tool', name: 'notis_save_app_files' },
|
|
@@ -489,7 +423,6 @@ export const appsCommandSpecs = [
|
|
|
489
423
|
examples: ['notis apps doctor', 'notis apps doctor ./my-app'],
|
|
490
424
|
mutates: false,
|
|
491
425
|
idempotent: true,
|
|
492
|
-
require_auth: false,
|
|
493
426
|
backend_call: { type: 'local', name: 'project_health_check' },
|
|
494
427
|
handler: appsDoctorHandler,
|
|
495
428
|
},
|