@notis_ai/cli 0.2.0-beta.32.1 → 0.2.0-beta.35.1

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.
Files changed (68) hide show
  1. package/README.md +41 -106
  2. package/dist/scaffolds/notes/app/globals.css +3 -0
  3. package/dist/scaffolds/notes/app/layout.tsx +6 -0
  4. package/dist/scaffolds/notes/app/page.tsx +1465 -0
  5. package/dist/scaffolds/notes/components/ui/badge.tsx +28 -0
  6. package/dist/scaffolds/notes/components/ui/button.tsx +53 -0
  7. package/dist/scaffolds/notes/components/ui/card.tsx +56 -0
  8. package/dist/scaffolds/notes/components.json +20 -0
  9. package/dist/scaffolds/notes/lib/utils.ts +6 -0
  10. package/dist/scaffolds/notes/notis.config.ts +31 -0
  11. package/dist/scaffolds/notes/package.json +31 -0
  12. package/dist/scaffolds/notes/postcss.config.mjs +8 -0
  13. package/dist/scaffolds/notes/tailwind.config.ts +58 -0
  14. package/dist/scaffolds/notes/tsconfig.json +22 -0
  15. package/dist/scaffolds/notes/vite.config.ts +10 -0
  16. package/dist/scaffolds.json +13 -0
  17. package/package.json +7 -3
  18. package/skills/notis-apps/SKILL.md +168 -0
  19. package/skills/notis-apps/cli.md +208 -0
  20. package/skills/notis-cli/SKILL.md +263 -0
  21. package/skills/notis-query/cli.md +40 -0
  22. package/src/cli.js +1 -1
  23. package/src/command-specs/apps.js +211 -46
  24. package/src/command-specs/helpers.js +0 -60
  25. package/src/command-specs/index.js +0 -6
  26. package/src/command-specs/meta.js +7 -6
  27. package/src/command-specs/tools.js +1 -33
  28. package/src/runtime/app-dev-server.js +30 -2
  29. package/src/runtime/app-platform.js +376 -24
  30. package/src/runtime/profiles.js +2 -2
  31. package/src/runtime/transport.js +2 -2
  32. package/template/.harness/index.html.tmpl +1 -50
  33. package/template/app/page.tsx +41 -6
  34. package/template/metadata/cover.png +0 -0
  35. package/template/metadata/screenshot-1.png +0 -0
  36. package/template/metadata/screenshot-2.png +0 -0
  37. package/template/metadata/screenshot-3.png +0 -0
  38. package/template/notis.config.ts +10 -6
  39. package/template/package.json +2 -2
  40. package/template/packages/{notis-sdk → sdk}/src/components/MultiSelectActionBar.tsx +2 -1
  41. package/template/packages/{notis-sdk → sdk}/src/components/MultiSelectCheckbox.tsx +2 -2
  42. package/template/packages/{notis-sdk → sdk}/src/components/MultiSelectDragOverlay.tsx +2 -2
  43. package/template/packages/{notis-sdk → sdk}/src/config.ts +1 -1
  44. package/template/packages/{notis-sdk → sdk}/src/hooks/useMultiSelect.ts +4 -3
  45. package/template/packages/sdk/src/hooks/useNotis.ts +30 -0
  46. package/template/packages/{notis-sdk → sdk}/src/hooks/useNotisNavigation.ts +3 -3
  47. package/template/packages/{notis-sdk → sdk}/src/hooks/useTool.ts +22 -7
  48. package/template/packages/{notis-sdk → sdk}/src/index.ts +3 -24
  49. package/template/packages/{notis-sdk → sdk}/src/provider.tsx +1 -1
  50. package/template/packages/sdk/src/runtime.ts +80 -0
  51. package/src/command-specs/auth.js +0 -178
  52. package/src/command-specs/db.js +0 -163
  53. package/template/packages/notis-sdk/src/helpers.ts +0 -131
  54. package/template/packages/notis-sdk/src/hooks/useAppState.ts +0 -50
  55. package/template/packages/notis-sdk/src/hooks/useCollectionItem.ts +0 -58
  56. package/template/packages/notis-sdk/src/hooks/useDatabase.ts +0 -88
  57. package/template/packages/notis-sdk/src/hooks/useDocument.ts +0 -61
  58. package/template/packages/notis-sdk/src/hooks/useNotis.ts +0 -33
  59. package/template/packages/notis-sdk/src/hooks/useUpsertDocument.ts +0 -58
  60. package/template/packages/notis-sdk/src/runtime.ts +0 -182
  61. /package/template/packages/{notis-sdk → sdk}/package.json +0 -0
  62. /package/template/packages/{notis-sdk → sdk}/src/hooks/useBackend.ts +0 -0
  63. /package/template/packages/{notis-sdk → sdk}/src/hooks/useTools.ts +0 -0
  64. /package/template/packages/{notis-sdk → sdk}/src/hooks/useTopBarSearch.ts +0 -0
  65. /package/template/packages/{notis-sdk → sdk}/src/styles.css +0 -0
  66. /package/template/packages/{notis-sdk → sdk}/src/ui.ts +0 -0
  67. /package/template/packages/{notis-sdk → sdk}/src/vite.ts +0 -0
  68. /package/template/packages/{notis-sdk → sdk}/tsconfig.json +0 -0
@@ -1,61 +0,0 @@
1
- 'use client';
2
-
3
- import { useCallback, useEffect, useState } from 'react';
4
- import { useNotisRuntime } from '../provider';
5
- import type { DocumentRecord } from '../runtime';
6
-
7
- interface UseDocumentResult {
8
- document: DocumentRecord | null;
9
- loading: boolean;
10
- error: Error | null;
11
- refetch: () => void;
12
- }
13
-
14
- /**
15
- * Fetch a single document by ID.
16
- *
17
- * ```tsx
18
- * const { document, loading } = useDocument(documentId);
19
- * ```
20
- */
21
- export function useDocument(documentId: string | null | undefined): UseDocumentResult {
22
- const runtime = useNotisRuntime();
23
- const [document, setDocument] = useState<DocumentRecord | null>(null);
24
- const [loading, setLoading] = useState(true);
25
- const [error, setError] = useState<Error | null>(null);
26
- const [fetchKey, setFetchKey] = useState(0);
27
-
28
- const refetch = useCallback(() => setFetchKey((k) => k + 1), []);
29
-
30
- useEffect(() => {
31
- if (!runtime || !documentId) {
32
- setLoading(false);
33
- return;
34
- }
35
-
36
- let cancelled = false;
37
- setLoading(true);
38
- setError(null);
39
-
40
- runtime
41
- .getDocument({ documentId })
42
- .then((result) => {
43
- if (!cancelled) {
44
- setDocument(result);
45
- setLoading(false);
46
- }
47
- })
48
- .catch((err) => {
49
- if (!cancelled) {
50
- setError(err instanceof Error ? err : new Error(String(err)));
51
- setLoading(false);
52
- }
53
- });
54
-
55
- return () => {
56
- cancelled = true;
57
- };
58
- }, [runtime, documentId, fetchKey]);
59
-
60
- return { document, loading, error, refetch };
61
- }
@@ -1,33 +0,0 @@
1
- 'use client';
2
-
3
- import { useNotisRuntime } from '../provider';
4
- import type { AppDescriptor, RouteDescriptor, DatabaseDescriptor, CollectionItemDetail } from '../runtime';
5
-
6
- interface NotisContext {
7
- /** App metadata (id, name, icon, description). Null before runtime loads. */
8
- app: AppDescriptor | null;
9
- /** Current route descriptor. Null before runtime loads. */
10
- route: RouteDescriptor | null;
11
- /** Databases declared by this app. Empty before runtime loads. */
12
- databases: DatabaseDescriptor[];
13
- /** Selected collection item for the current route, when applicable. */
14
- collectionItem: CollectionItemDetail | null;
15
- /** Whether the runtime is loaded and available. */
16
- ready: boolean;
17
- }
18
-
19
- /**
20
- * Access app-level metadata: the app descriptor, current route, and declared
21
- * databases. Returns safe defaults when the portal runtime is not available.
22
- */
23
- export function useNotis(): NotisContext {
24
- const runtime = useNotisRuntime();
25
-
26
- return {
27
- app: runtime?.app ?? null,
28
- route: runtime?.route ?? null,
29
- databases: runtime?.databases ?? [],
30
- collectionItem: runtime?.context?.collectionItem ?? null,
31
- ready: runtime !== null,
32
- };
33
- }
@@ -1,58 +0,0 @@
1
- 'use client';
2
-
3
- import { useCallback, useState } from 'react';
4
- import { useNotisRuntime } from '../provider';
5
- import type { DocumentRecord } from '../runtime';
6
-
7
- interface UpsertArgs {
8
- databaseSlug: string;
9
- documentId?: string;
10
- title?: string;
11
- properties?: Record<string, unknown>;
12
- contentBlocknote?: Array<Record<string, unknown>> | null;
13
- }
14
-
15
- interface UseUpsertDocumentResult {
16
- upsert: (args: UpsertArgs) => Promise<DocumentRecord>;
17
- loading: boolean;
18
- error: Error | null;
19
- }
20
-
21
- /**
22
- * Create or update a document in a Notis database.
23
- *
24
- * ```tsx
25
- * const { upsert, loading } = useUpsertDocument();
26
- * await upsert({ databaseSlug: 'tasks', title: 'New task', properties: { status: 'Open' } });
27
- * ```
28
- */
29
- export function useUpsertDocument(): UseUpsertDocumentResult {
30
- const runtime = useNotisRuntime();
31
- const [loading, setLoading] = useState(false);
32
- const [error, setError] = useState<Error | null>(null);
33
-
34
- const upsert = useCallback(
35
- async (args: UpsertArgs): Promise<DocumentRecord> => {
36
- if (!runtime) {
37
- throw new Error('Notis runtime not available. Ensure NotisProvider is mounted.');
38
- }
39
-
40
- setLoading(true);
41
- setError(null);
42
-
43
- try {
44
- const result = await runtime.upsertDocument(args);
45
- return result.document;
46
- } catch (err) {
47
- const e = err instanceof Error ? err : new Error(String(err));
48
- setError(e);
49
- throw e;
50
- } finally {
51
- setLoading(false);
52
- }
53
- },
54
- [runtime],
55
- );
56
-
57
- return { upsert, loading, error };
58
- }
@@ -1,182 +0,0 @@
1
- /**
2
- * NotisRuntime is the bridge between app code running in the browser and the
3
- * Notis platform. The portal owns the runtime and injects it through
4
- * `NotisProvider` when the app is rendered.
5
- *
6
- * App code should never reach for globals. Use the hooks from `@notis/sdk`
7
- * (useDatabase, useTool, etc.) which read from the NotisProvider context.
8
- */
9
-
10
- // ---------------------------------------------------------------------------
11
- // Database types
12
- // ---------------------------------------------------------------------------
13
-
14
- export interface DatabaseProperty {
15
- name: string;
16
- type: 'title' | 'rich_text' | 'number' | 'checkbox' | 'date' | 'select' | 'multi_select' | 'status' | 'relation' | 'formula' | 'files';
17
- description?: string;
18
- options?: Array<{ name: string; id?: string }>;
19
- }
20
-
21
- export interface DatabaseDescriptor {
22
- slug: string;
23
- title: string;
24
- description?: string | null;
25
- icon?: string | null;
26
- properties: DatabaseProperty[];
27
- }
28
-
29
- export interface DocumentRecord {
30
- id: string;
31
- title: string;
32
- properties: Record<string, unknown>;
33
- icon?: string | null;
34
- cover?: string | null;
35
- databaseSlug?: string;
36
- contentBlocknote?: Array<Record<string, unknown>> | null;
37
- contentMarkdown?: string | null;
38
- plainText?: string | null;
39
- createdAt?: string | null;
40
- lastEditedTime?: string | null;
41
- }
42
-
43
- // ---------------------------------------------------------------------------
44
- // Tool types
45
- // ---------------------------------------------------------------------------
46
-
47
- export interface ToolDescriptor {
48
- name: string;
49
- description?: string;
50
- input_schema?: Record<string, unknown>;
51
- }
52
-
53
- // ---------------------------------------------------------------------------
54
- // Route types
55
- // ---------------------------------------------------------------------------
56
-
57
- export interface RouteDescriptor {
58
- slug: string;
59
- path: string;
60
- name: string;
61
- icon?: string | null;
62
- parentSlug?: string | null;
63
- default?: boolean;
64
- collection?: {
65
- database: string;
66
- titleProperty: string;
67
- parentProperty?: string | null;
68
- sidebar?: {
69
- mode: 'flat-list' | 'tree';
70
- allowCreate: boolean;
71
- } | null;
72
- } | null;
73
- }
74
-
75
- export interface CollectionItem {
76
- id: string;
77
- title: string;
78
- icon?: string | null;
79
- }
80
-
81
- export interface CollectionItemDetail extends CollectionItem {
82
- properties: Record<string, unknown>;
83
- }
84
-
85
- export interface CollectionTreeItem extends CollectionItem {
86
- parent_id: string | null;
87
- has_children: boolean;
88
- }
89
-
90
- // ---------------------------------------------------------------------------
91
- // App descriptor
92
- // ---------------------------------------------------------------------------
93
-
94
- export interface AppDescriptor {
95
- id: string;
96
- name: string;
97
- icon?: string | null;
98
- description?: string | null;
99
- }
100
-
101
- // ---------------------------------------------------------------------------
102
- // Query types
103
- // ---------------------------------------------------------------------------
104
-
105
- export interface QueryFilter {
106
- filters?: Array<{
107
- property: string;
108
- operator: string;
109
- value: unknown;
110
- }>;
111
- sorts?: Array<{
112
- property: string;
113
- direction: 'asc' | 'desc';
114
- }>;
115
- page_size?: number;
116
- }
117
-
118
- export interface NotisRuntimeContext {
119
- collectionItem?: CollectionItemDetail | null;
120
- }
121
-
122
- // ---------------------------------------------------------------------------
123
- // NotisRuntime
124
- // ---------------------------------------------------------------------------
125
-
126
- export interface NotisRuntime {
127
- app: AppDescriptor;
128
- route: RouteDescriptor;
129
- databases: DatabaseDescriptor[];
130
- context: NotisRuntimeContext;
131
-
132
- navigate?: (payload: { kind: string; [key: string]: unknown }) => void;
133
-
134
- registerTopBarSearch?: (
135
- config:
136
- | {
137
- onChange: (value: string) => void;
138
- placeholder?: string;
139
- onSubmit?: () => void | Promise<void>;
140
- }
141
- | null,
142
- ) => void;
143
- setTopBarSearchValue?: (value: string) => void;
144
- setTopBarSearchLoading?: (loading: boolean) => void;
145
-
146
- listTools(): Promise<ToolDescriptor[]>;
147
- callTool(name: string, args?: Record<string, unknown>): Promise<unknown>;
148
-
149
- queryDatabase(args: {
150
- databaseSlug: string;
151
- query?: QueryFilter;
152
- offset?: number;
153
- }): Promise<{ documents: DocumentRecord[] }>;
154
-
155
- getDocument(args: {
156
- documentId: string;
157
- }): Promise<DocumentRecord>;
158
-
159
- upsertDocument(args: {
160
- databaseSlug: string;
161
- documentId?: string;
162
- title?: string;
163
- properties?: Record<string, unknown>;
164
- contentBlocknote?: Array<Record<string, unknown>> | null;
165
- }): Promise<{ status: string; document: DocumentRecord }>;
166
-
167
- listCollectionItems(args?: {
168
- databaseSlug?: string;
169
- pageSize?: number;
170
- }): Promise<{ items: CollectionItem[] }>;
171
-
172
- listCollectionTree?(args?: {
173
- databaseSlug?: string;
174
- pageSize?: number;
175
- }): Promise<{ items: CollectionTreeItem[] }>;
176
-
177
- request(path: string, options?: {
178
- method?: string;
179
- headers?: Record<string, string>;
180
- body?: unknown;
181
- }): Promise<unknown>;
182
- }
File without changes