omni-rest 0.4.8 → 0.5.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.
Files changed (70) hide show
  1. package/.cursor/rules/omni-rest.mdc +15 -0
  2. package/.kiro/agent-guide.md +16 -0
  3. package/.kiro/specs/frontend-enhancements.md +243 -0
  4. package/.kiro/specs/frontend-generator/.config.kiro +1 -0
  5. package/.kiro/specs/frontend-generator/design.md +478 -0
  6. package/.kiro/specs/frontend-generator/requirements.md +312 -0
  7. package/.kiro/specs/frontend-generator/tasks.md +164 -0
  8. package/AGENTS.md +27 -0
  9. package/AI/PORTABLE_API_PLAYBOOK.md +84 -0
  10. package/AI/PROJECT_INTELLIGENCE.md +120 -0
  11. package/AI/codex/omni-rest/SKILL.md +37 -0
  12. package/CLAUDE.md +11 -0
  13. package/README.md +537 -520
  14. package/dist/adapters/express.d.mts +1 -1
  15. package/dist/adapters/express.d.ts +1 -1
  16. package/dist/adapters/express.js +765 -167
  17. package/dist/adapters/express.js.map +1 -1
  18. package/dist/adapters/express.mjs +765 -167
  19. package/dist/adapters/express.mjs.map +1 -1
  20. package/dist/adapters/fastify.d.mts +1 -1
  21. package/dist/adapters/fastify.d.ts +1 -1
  22. package/dist/adapters/fastify.js +746 -151
  23. package/dist/adapters/fastify.js.map +1 -1
  24. package/dist/adapters/fastify.mjs +746 -151
  25. package/dist/adapters/fastify.mjs.map +1 -1
  26. package/dist/adapters/hapi.d.mts +37 -0
  27. package/dist/adapters/hapi.d.ts +37 -0
  28. package/dist/adapters/hapi.js +1214 -0
  29. package/dist/adapters/hapi.js.map +1 -0
  30. package/dist/adapters/hapi.mjs +1212 -0
  31. package/dist/adapters/hapi.mjs.map +1 -0
  32. package/dist/adapters/hono.d.mts +27 -0
  33. package/dist/adapters/hono.d.ts +27 -0
  34. package/dist/adapters/hono.js +1227 -0
  35. package/dist/adapters/hono.js.map +1 -0
  36. package/dist/adapters/hono.mjs +1225 -0
  37. package/dist/adapters/hono.mjs.map +1 -0
  38. package/dist/adapters/koa.d.mts +30 -0
  39. package/dist/adapters/koa.d.ts +30 -0
  40. package/dist/adapters/koa.js +1192 -0
  41. package/dist/adapters/koa.js.map +1 -0
  42. package/dist/adapters/koa.mjs +1190 -0
  43. package/dist/adapters/koa.mjs.map +1 -0
  44. package/dist/adapters/nestjs.d.mts +29 -0
  45. package/dist/adapters/nestjs.d.ts +29 -0
  46. package/dist/adapters/nestjs.js +1350 -0
  47. package/dist/adapters/nestjs.js.map +1 -0
  48. package/dist/adapters/nestjs.mjs +1348 -0
  49. package/dist/adapters/nestjs.mjs.map +1 -0
  50. package/dist/adapters/nextjs.d.mts +1 -1
  51. package/dist/adapters/nextjs.d.ts +1 -1
  52. package/dist/adapters/nextjs.js +701 -145
  53. package/dist/adapters/nextjs.js.map +1 -1
  54. package/dist/adapters/nextjs.mjs +701 -145
  55. package/dist/adapters/nextjs.mjs.map +1 -1
  56. package/dist/cli.js +557 -215
  57. package/dist/cli.js.map +1 -1
  58. package/dist/cli.mjs +557 -215
  59. package/dist/cli.mjs.map +1 -1
  60. package/dist/index.d.mts +7 -88
  61. package/dist/index.d.ts +7 -88
  62. package/dist/index.js +1407 -433
  63. package/dist/index.js.map +1 -1
  64. package/dist/index.mjs +1405 -434
  65. package/dist/index.mjs.map +1 -1
  66. package/dist/types-s-sMlBeU.d.mts +260 -0
  67. package/dist/types-s-sMlBeU.d.ts +260 -0
  68. package/package.json +141 -125
  69. package/dist/types-CLcDS1BU.d.mts +0 -130
  70. package/dist/types-CLcDS1BU.d.ts +0 -130
@@ -0,0 +1,15 @@
1
+ ---
2
+ description: Omni Rest repository instructions for Cursor and other compatible agents.
3
+ ---
4
+
5
+ # Omni Rest
6
+
7
+ Use [AI/PROJECT_INTELLIGENCE.md](../../AI/PROJECT_INTELLIGENCE.md) as the source of truth.
8
+
9
+ ## Rules
10
+
11
+ - Read the runtime files before editing.
12
+ - Keep changes aligned with existing package boundaries.
13
+ - Do not assume the README is current if source files disagree.
14
+ - Preserve public exports unless the user asks for a breaking change.
15
+ - Add or update tests for behavior changes.
@@ -0,0 +1,16 @@
1
+ # Omni Rest Agent Guide
2
+
3
+ Use [AI/PROJECT_INTELLIGENCE.md](../AI/PROJECT_INTELLIGENCE.md) before working in this repo.
4
+
5
+ ## Summary
6
+
7
+ - This repo is a Prisma-to-REST toolkit with adapters and generators.
8
+ - Runtime source lives in `src/`.
9
+ - Frontend generation lives in `src/frontend/`.
10
+ - `omni-rest-client/` is the companion frontend generator package.
11
+
12
+ ## Working Notes
13
+
14
+ - Trust source files over docs when they disagree.
15
+ - Keep changes small and localized.
16
+ - Validate runtime changes with tests where possible.
@@ -0,0 +1,243 @@
1
+ # Frontend Generator Enhancements
2
+
3
+ ## Overview
4
+ Enhance the frontend generator to provide better UX and Next.js App Router support with automatic page generation and menu data.
5
+
6
+ ## 1. Interactive Multi-Select Improvements
7
+
8
+ ### Current State
9
+ - Users type numbers: "1,3,5" or "all"
10
+ - Not intuitive, requires reading list and typing
11
+
12
+ ### Proposed Enhancement
13
+ - Add `inquirer` or `prompts` package for better CLI UX
14
+ - Arrow keys to navigate, spacebar to select/deselect
15
+ - Visual checkboxes showing selected state
16
+ - "Select all" / "Deselect all" shortcuts
17
+
18
+ ### Implementation
19
+ ```typescript
20
+ import prompts from 'prompts';
21
+
22
+ async function multiSelect(prompt: string, items: string[]): Promise<number[]> {
23
+ const choices = items.map((item, i) => ({ title: item, value: i, selected: true }));
24
+ const response = await prompts({
25
+ type: 'multiselect',
26
+ name: 'indices',
27
+ message: prompt,
28
+ choices,
29
+ hint: '- Space to select. Return to submit'
30
+ });
31
+ return response.indices || [];
32
+ }
33
+ ```
34
+
35
+ ## 2. Smart Directory Detection
36
+
37
+ ### Current State
38
+ - Always outputs to `src/` or `app/` (Next.js without src)
39
+ - Doesn't detect if project uses `src/` structure
40
+
41
+ ### Proposed Logic
42
+ ```typescript
43
+ function detectProjectStructure(frontendDir: string) {
44
+ const hasSrc = fs.existsSync(path.join(frontendDir, 'src'));
45
+ const hasApp = fs.existsSync(path.join(frontendDir, 'app'));
46
+ const hasSrcApp = fs.existsSync(path.join(frontendDir, 'src', 'app'));
47
+
48
+ return {
49
+ usesSrc: hasSrc,
50
+ usesAppRouter: hasApp || hasSrcApp,
51
+ basePath: hasSrc ? 'src' : '.',
52
+ };
53
+ }
54
+ ```
55
+
56
+ ### Output Structure
57
+
58
+ #### Next.js App Router (with src/)
59
+ ```
60
+ src/
61
+ ├── app/
62
+ │ └── (autogenerated-omni)/
63
+ │ ├── users/
64
+ │ │ └── page.tsx # User management page
65
+ │ ├── products/
66
+ │ │ └── page.tsx # Product management page
67
+ │ └── layout.tsx # Shared layout (optional)
68
+ ├── components/
69
+ │ ├── data-table.tsx
70
+ │ ├── form-generator.tsx
71
+ │ ├── user/
72
+ │ │ ├── UserColumns.tsx
73
+ │ │ ├── UserTable.tsx
74
+ │ │ └── UserForm.tsx
75
+ │ └── product/
76
+ │ ├── ProductColumns.tsx
77
+ │ ├── ProductTable.tsx
78
+ │ └── ProductForm.tsx
79
+ ├── hooks/
80
+ │ ├── useUser.ts
81
+ │ └── useProduct.ts
82
+ └── lib/
83
+ └── menu-data.ts # Generated menu structure
84
+ ```
85
+
86
+ #### Next.js App Router (without src/)
87
+ ```
88
+ app/
89
+ └── (autogenerated-omni)/
90
+ ├── users/
91
+ │ └── page.tsx
92
+ └── products/
93
+ └── page.tsx
94
+ components/
95
+ hooks/
96
+ lib/
97
+ └── menu-data.ts
98
+ ```
99
+
100
+ #### Vite/React (with src/)
101
+ ```
102
+ src/
103
+ ├── components/
104
+ ├── hooks/
105
+ └── lib/
106
+ └── menu-data.ts
107
+ ```
108
+
109
+ ## 3. Next.js Page Generation
110
+
111
+ ### Page Template
112
+ ```typescript
113
+ // app/(autogenerated-omni)/users/page.tsx
114
+ 'use client'
115
+
116
+ import { UserTable } from '@/components/user/UserTable'
117
+
118
+ export default function UsersPage() {
119
+ return (
120
+ <div className="container mx-auto py-10">
121
+ <h1 className="text-3xl font-bold mb-6">Users</h1>
122
+ <UserTable />
123
+ </div>
124
+ )
125
+ }
126
+ ```
127
+
128
+ ### Route Group Benefits
129
+ - `(autogenerated-omni)` doesn't appear in URL
130
+ - Easy to identify generated pages
131
+ - Can share layout across all generated pages
132
+ - Can be easily deleted/regenerated
133
+
134
+ ## 4. Menu Data Generation
135
+
136
+ ### File: `lib/menu-data.ts` or `src/lib/menu-data.ts`
137
+
138
+ ```typescript
139
+ /**
140
+ * Auto-generated menu data for omni-rest CRUD pages
141
+ * Generated by omni-rest — do not edit manually.
142
+ */
143
+
144
+ export interface MenuItem {
145
+ label: string;
146
+ href: string;
147
+ icon?: string;
148
+ }
149
+
150
+ export const omniRestMenuItems: MenuItem[] = [
151
+ {
152
+ label: 'Users',
153
+ href: '/users',
154
+ },
155
+ {
156
+ label: 'Products',
157
+ href: '/products',
158
+ },
159
+ {
160
+ label: 'Orders',
161
+ href: '/orders',
162
+ },
163
+ // ... more items
164
+ ];
165
+
166
+ // Grouped by category (if we detect relationships)
167
+ export const omniRestMenuGroups = {
168
+ 'User Management': [
169
+ { label: 'Users', href: '/users' },
170
+ { label: 'Roles', href: '/roles' },
171
+ ],
172
+ 'E-commerce': [
173
+ { label: 'Products', href: '/products' },
174
+ { label: 'Orders', href: '/orders' },
175
+ { label: 'Categories', href: '/categories' },
176
+ ],
177
+ };
178
+ ```
179
+
180
+ ### Usage in Sidebar
181
+ ```typescript
182
+ import { omniRestMenuItems } from '@/lib/menu-data'
183
+
184
+ export function Sidebar() {
185
+ return (
186
+ <nav>
187
+ {omniRestMenuItems.map(item => (
188
+ <Link key={item.href} href={item.href}>
189
+ {item.label}
190
+ </Link>
191
+ ))}
192
+ </nav>
193
+ )
194
+ }
195
+ ```
196
+
197
+ ## 5. Implementation Plan
198
+
199
+ ### Phase 1: Directory Detection (v0.2.8)
200
+ - [x] Detect `src/` usage
201
+ - [ ] Detect App Router vs Pages Router
202
+ - [ ] Update `resolveOutputDir` logic
203
+ - [ ] Add tests for directory detection
204
+
205
+ ### Phase 2: Next.js Page Generation (v0.2.9)
206
+ - [ ] Generate page.tsx files in App Router
207
+ - [ ] Use route groups `(autogenerated-omni)`
208
+ - [ ] Generate shared layout if needed
209
+ - [ ] Add proper imports with path aliases
210
+
211
+ ### Phase 3: Menu Data Generation (v0.2.10)
212
+ - [ ] Generate `menu-data.ts` file
213
+ - [ ] Include all generated routes
214
+ - [ ] Add TypeScript types
215
+ - [ ] Document usage in README
216
+
217
+ ### Phase 4: Better Interactive UX (v0.3.0)
218
+ - [ ] Add `prompts` dependency
219
+ - [ ] Implement arrow-key multi-select
220
+ - [ ] Add visual feedback
221
+ - [ ] Update documentation
222
+
223
+ ## 6. Configuration Options
224
+
225
+ Add new CLI flags:
226
+ ```bash
227
+ npx omni-rest generate:frontend \
228
+ --autopilot \
229
+ --generate-pages # Generate Next.js pages (default: true for Next.js)
230
+ --generate-menu # Generate menu-data.ts (default: true)
231
+ --route-group <name> # Custom route group name (default: autogenerated-omni)
232
+ ```
233
+
234
+ ## 7. Breaking Changes
235
+
236
+ None - all enhancements are additive and backward compatible.
237
+
238
+ ## 8. Documentation Updates
239
+
240
+ - Update CLI docs with new flags
241
+ - Add Next.js App Router guide
242
+ - Add menu integration examples
243
+ - Add migration guide for existing projects
@@ -0,0 +1 @@
1
+ {"specId": "79688110-a99e-4d68-9638-a75d66f00592", "workflowType": "requirements-first", "specType": "feature"}