@ramme-io/create-app 3.0.3 → 3.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/index.js CHANGED
@@ -26,6 +26,21 @@ if (!projectName) {
26
26
  const templatePath = path.resolve(__dirname, 'template');
27
27
  const destinationPath = path.resolve(process.cwd(), projectName);
28
28
 
29
+ // What the new app calls itself, in package.json and on screen.
30
+ //
31
+ // `projectName` is a destination path — `my-app`, `./apps/my-app`, or something
32
+ // with a capital and a space in it. An npm name may be none of those, so the
33
+ // last segment is lowercased and stripped to the characters npm accepts. This
34
+ // is also what the tab title and the header wordmark say, which is why it is
35
+ // derived once here rather than twice with different rules.
36
+ const appSlug =
37
+ path
38
+ .basename(projectName)
39
+ .trim()
40
+ .toLowerCase()
41
+ .replace(/[^a-z0-9._-]+/g, '-')
42
+ .replace(/^[-_.]+|[-_.]+$/g, '') || 'app';
43
+
29
44
  // THE STABILITY PACT: pinned target ranges for the public release.
30
45
  //
31
46
  // One shared constant used to cover all three packages, which silently broke
@@ -40,9 +55,9 @@ const destinationPath = path.resolve(process.cwd(), projectName);
40
55
  // versions match what was just published, not merely that the build passes —
41
56
  // a stale pin builds fine, it just ships the wrong framework.
42
57
  const RELEASE_VERSIONS = {
43
- '@ramme-io/ui': '^4.0.1',
44
- '@ramme-io/kernel': '^5.0.1',
45
- '@ramme-io/shared': '^3.1.1',
58
+ '@ramme-io/ui': '^4.1.0',
59
+ '@ramme-io/kernel': '^7.0.0',
60
+ '@ramme-io/shared': '^3.1.2',
46
61
  };
47
62
 
48
63
  try {
@@ -80,17 +95,113 @@ try {
80
95
  }
81
96
  }
82
97
 
98
+ // The copied template is named after the template ("ramme-starter"), which
99
+ // is the monorepo's workspace name and has nothing to do with the app being
100
+ // created. Left alone, every scaffolded app on earth shares one name.
101
+ pkg.name = appSlug;
102
+
83
103
  fs.writeJsonSync(targetPkgPath, pkg, { spaces: 2 });
84
104
  console.log('✅ Supply chain hardened. Workspace dependencies stripped.');
85
105
  }
86
106
 
87
- // 4. Handle Gitignore
107
+ // 4. IDENTITY — the app is called what the user named it.
108
+ //
109
+ // The template is branded for the monorepo it lives in: index.html carries
110
+ // the framework's own title, and vercel.json installs and builds from three
111
+ // directories up through a turbo filter naming this template's workspace.
112
+ // None of that is true of the app being created, and the title is visible
113
+ // before React has even mounted.
114
+ //
115
+ // src/config/app.config.ts is the one place the running app reads its name
116
+ // from, so setting it here is what makes `pnpm dev` show the right name with
117
+ // no .env file and no edit.
118
+ const identity = [
119
+ {
120
+ file: 'index.html',
121
+ find: /<title>[\s\S]*?<\/title>/,
122
+ replace: `<title>${appSlug}</title>`,
123
+ },
124
+ {
125
+ file: 'src/config/app.config.ts',
126
+ find: /name: import\.meta\.env\.VITE_APP_NAME \?\? '[^']*'/,
127
+ replace: `name: import.meta.env.VITE_APP_NAME ?? '${appSlug}'`,
128
+ },
129
+ ];
130
+
131
+ for (const { file, find, replace } of identity) {
132
+ const target = path.join(destinationPath, file);
133
+ if (!fs.existsSync(target)) continue;
134
+
135
+ const before = fs.readFileSync(target, 'utf8');
136
+ const after = before.replace(find, replace);
137
+
138
+ // Loud rather than silent. If a template edit moves one of these lines, the
139
+ // substitution stops matching and every app scaffolded after it is called
140
+ // "App Name" — which looks like a design choice rather than a bug.
141
+ if (after === before) {
142
+ console.warn(` ⚠️ Could not set the app name in ${file} — its name line has moved.`);
143
+ continue;
144
+ }
145
+ fs.writeFileSync(target, after);
146
+ }
147
+
148
+ // The monorepo's build commands cannot work in a standalone repo: there is no
149
+ // directory three levels up and no turbo filter to resolve. Removing them
150
+ // lets Vercel use the app's own `build` script. Deliberately NO
151
+ // ignoreCommand — see deploy-ignore.test.ts; it would ship a turborepo
152
+ // assumption into a repo that has no turbo.json.
153
+ const vercelPath = path.join(destinationPath, 'vercel.json');
154
+ if (fs.existsSync(vercelPath)) {
155
+ const vercel = fs.readJsonSync(vercelPath);
156
+ delete vercel.installCommand;
157
+ delete vercel.buildCommand;
158
+ fs.writeJsonSync(vercelPath, vercel, { spaces: 2 });
159
+ }
160
+
161
+ console.log(` 🏷️ App name set to "${appSlug}"`);
162
+
163
+ // 5. AGENT RULES — one file, under every name an agent looks for.
164
+ //
165
+ // The monorepo does this with symlinks (.clinerules -> AGENTS.md, git mode
166
+ // 120000), which is drift-proof and completely useless here: npm pack DROPS
167
+ // symlinks. Measured, not assumed — a symlinked entry vanishes from the
168
+ // tarball entirely while a real dotfile survives. So the copies are written
169
+ // at scaffold time instead: nothing is duplicated in git, every agent gets
170
+ // the full text, and it works on every OS.
171
+ //
172
+ // CLAUDE.md is the exception. Claude Code does not read AGENTS.md on its own
173
+ // but does resolve `@file` imports, so it gets a real pointer rather than a
174
+ // copy — which means it never drifts.
175
+ const agentsPath = path.join(destinationPath, 'AGENTS.md');
176
+ if (fs.existsSync(agentsPath)) {
177
+ const rules = fs.readFileSync(agentsPath, 'utf8');
178
+ for (const name of ['.cursorrules', '.clinerules', '.windsurfrules', '.rammerules']) {
179
+ fs.writeFileSync(path.join(destinationPath, name), rules);
180
+ }
181
+ fs.writeFileSync(
182
+ path.join(destinationPath, 'CLAUDE.md'),
183
+ '@AGENTS.md\n\n' +
184
+ '## Claude Code specifics\n\n' +
185
+ 'The import above is the whole file — `AGENTS.md` is the single source of\n' +
186
+ 'truth for every agent working in this project, and the other rules files\n' +
187
+ '(`.cursorrules`, `.clinerules`, `.windsurfrules`, `.rammerules`) are copies\n' +
188
+ 'of it for agents that look for a different filename.\n\n' +
189
+ 'Run `/context` to confirm it loaded.\n',
190
+ );
191
+ console.log(' 🤖 Agent rules written: CLAUDE.md, .cursorrules, .clinerules, .windsurfrules, .rammerules');
192
+ } else {
193
+ // Loud rather than silent: without this the app ships with no rules for any
194
+ // agent, which is the thing the framework is meant to guarantee.
195
+ console.warn(' ⚠️ AGENTS.md missing from the template — no agent rules were written.');
196
+ }
197
+
198
+ // 6. Handle Gitignore
88
199
  const gitignorePath = path.join(destinationPath, 'gitignore');
89
200
  if (fs.existsSync(gitignorePath)) {
90
201
  fs.renameSync(gitignorePath, path.join(destinationPath, '.gitignore'));
91
202
  }
92
203
 
93
- // 5. ONBOARDING INSTRUCTIONS — Premium Unboxing Experience
204
+ // 7. ONBOARDING INSTRUCTIONS — Premium Unboxing Experience
94
205
  console.log('\n╔═══════════════════════════════════════╗');
95
206
  console.log('║ ║');
96
207
  console.log('║ ✨ Your project is ready! ║');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ramme-io/create-app",
3
- "version": "3.0.3",
3
+ "version": "3.2.0",
4
4
  "description": "The official CLI to create Ramme applications.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -22,8 +22,5 @@
22
22
  ],
23
23
  "dependencies": {
24
24
  "fs-extra": "^11.2.0"
25
- },
26
- "scripts": {
27
- "test": "echo \"Error: no test specified\" && exit 1"
28
25
  }
29
26
  }
@@ -0,0 +1,6 @@
1
+ # Copy to .env and edit. Vite only exposes variables prefixed VITE_.
2
+
3
+ # What the app calls itself: tab title, header wordmark, footer, assistant.
4
+ # Unset falls back to the `name` in src/config/app.config.ts, which the
5
+ # scaffolder already set to your project name.
6
+ VITE_APP_NAME="App Name"
@@ -151,6 +151,49 @@ Layout shell: `src/templates/dashboard/DashboardLayout.tsx`
151
151
 
152
152
  ---
153
153
 
154
+ ## Component sourcing — in this order
155
+
156
+ ```
157
+ 1st: @ramme-io/ui → Button, Card, Input, Icon, Sidebar, Modal, Drawer, StatCard…
158
+ 2nd: @ramme-io/kernel → SmartTable, AutoForm, useCrudLocalStorage, useDataQuery…
159
+ 3rd: src/features/<name> → local wrappers around kernel primitives
160
+ ```
161
+
162
+ Before creating any component, search the inventory. Run it — do not guess:
163
+
164
+ ```bash
165
+ cat node_modules/@ramme-io/ui/src/wizardManifest.ts
166
+ ```
167
+
168
+ Generated from each component's `@wizard` annotation, it carries the id,
169
+ description, tags, props and import path for every component, and it is the
170
+ authoritative answer to "does this already exist?". If it exists, use it.
171
+
172
+ Before writing state logic, check `@ramme-io/kernel` hooks. Before adding a
173
+ dependency, check the capability table above.
174
+
175
+ ## Where things live
176
+
177
+ ```
178
+ src/
179
+ config/
180
+ app.manifest.ts ← App identity, entities, theme defaults
181
+ sitemap.ts ← Route registry (add new pages here)
182
+ component-registry.tsx ← Component resolver for AI-driven rendering
183
+ navigation.ts ← User menu, settings menu, footer links
184
+ data/
185
+ mockData.ts ← Seed data + DATA_REGISTRY (DataLake)
186
+ features/
187
+ <domain>/pages/ ← Feature pages (FSD pattern)
188
+ templates/
189
+ dashboard/DashboardLayout ← Canonical layout (sidebar + header + Outlet)
190
+ components/
191
+ ProtectedAppShell.tsx ← Root shell (WorkflowEngine, Inspector, AI Chat, Settings)
192
+ layout/AppChromeHost.tsx ← Viewport orchestrator (header/sidebar/canvas slots)
193
+ pages/
194
+ InventoryManager.tsx ← Golden Path exemplar — copy this pattern for new pages
195
+ ```
196
+
154
197
  ## Do Not
155
198
 
156
199
  - ❌ Raw HTML `<button>` — use `<Button>` from `@ramme-io/ui`
@@ -159,6 +202,7 @@ Layout shell: `src/templates/dashboard/DashboardLayout.tsx`
159
202
  - ❌ Hardcoded hex colors — use `text-primary`, `text-foreground`, CSS vars
160
203
  - ❌ `h-screen` or `overflow-hidden` in page components — AppChromeHost owns the viewport
161
204
  - ❌ Inline business logic in components — extract to hooks
205
+ - ❌ `<Flex>`, `<Box>`, `<Stack>` — Ramme has no such components
162
206
  - ❌ Installing packages without `pnpm`
163
207
  - ❌ **Installing anything before checking the capability table above.** Charts,
164
208
  tables, forms, date pickers, realtime, AI, and state are all already wired.
@@ -167,40 +211,24 @@ Layout shell: `src/templates/dashboard/DashboardLayout.tsx`
167
211
 
168
212
  ---
169
213
 
170
- ## Copy-Pastable Agent Context Prompts
171
-
172
- ### Cursor / Windsurf System Prompt
173
- ```
174
- You are working inside a Ramme Framework application.
175
-
176
- Framework laws: read .rammerules before writing any code.
177
- Capability table: read AGENTS.md "What is already wired" before installing anything.
178
- Component library: @ramme-io/ui (Button, Card, Input, Icon, Sidebar, Modal, Drawer, StatCard, etc.)
179
- Data/Logic layer: @ramme-io/kernel (SmartTable, AutoForm, useCrudLocalStorage, useDataQuery, useAuth, etc.)
214
+ ## Your coding agent already has this
180
215
 
181
- Before building a component, search the inventory:
182
- cat node_modules/@ramme-io/ui/src/wizardManifest.ts
216
+ You do not need to paste a system prompt anywhere. When this project was
217
+ created, this file was written out under every name the common agents look for:
183
218
 
184
- Golden Path: src/pages/InventoryManager.tsx shows the canonical page pattern.
185
- Route flow: page → src/config/component-registry.tsx → src/config/sitemap.ts
186
-
187
- Never use raw HTML buttons or inputs. Never use bg-white or bg-black. Always use @ramme-io/ui primitives.
188
- Charts, tables, forms, date pickers, realtime, AI and state are already wired — never install a package for them.
189
- ```
190
-
191
- ### Claude Project Knowledge / System Prompt
192
- ```
193
- Project: Ramme Framework starter application.
194
- Stack: React 18, TypeScript, Vite, Tailwind CSS, React Router v6, Zustand.
195
- UI Layer: @ramme-io/ui — import all components from here first.
196
- Logic Layer: @ramme-io/kernel — SmartTable, AutoForm, data hooks, auth, MQTT.
197
-
198
- Rules file: .rammerules (read it).
199
- Capability table: AGENTS.md "What is already wired" — consult before adding any dependency.
200
- Component inventory: node_modules/@ramme-io/ui/src/wizardManifest.ts — search before building.
201
- Golden Path exemplar: src/pages/InventoryManager.tsx.
202
- To add a page: create in src/features/<domain>/pages/, register in component-registry.tsx, add to sitemap.ts.
203
-
204
- Styling: Tailwind only. Use CSS vars (text-foreground, bg-card, text-primary) — never hardcoded hex.
205
- Package manager: pnpm only.
206
- ```
219
+ | your agent | reads |
220
+ |---|---|
221
+ | Claude Code | `CLAUDE.md` (imports this file) |
222
+ | Cursor | `.cursorrules` |
223
+ | Cline | `.clinerules` |
224
+ | Windsurf | `.windsurfrules` |
225
+ | anything else | point it at `AGENTS.md` |
226
+
227
+ They are copies of this file, written once when the project was created. They
228
+ do not re-sync on their own, so when you change the rules: **edit `AGENTS.md`,
229
+ then copy it over the others.** `AGENTS.md` is the one meant to be read by a
230
+ human; the rest exist only because each agent looks for a different filename.
231
+
232
+ That is the whole trick: the rules travel with the project instead of living in
233
+ your head or in a chat window, so an agent that has never seen this codebase
234
+ still builds from the same parts as the last one.
@@ -1,5 +1,82 @@
1
1
  # ramme-starter
2
2
 
3
+ ## 2.0.16
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [1342f1c]
8
+ - @ramme-io/shared@3.3.1
9
+ - @ramme-io/kernel@7.3.1
10
+ - @ramme-io/ui@4.2.3
11
+
12
+ ## 2.0.15
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies [73306a0]
17
+ - Updated dependencies [e543c11]
18
+ - @ramme-io/shared@3.3.0
19
+ - @ramme-io/kernel@7.3.0
20
+ - @ramme-io/ui@4.2.2
21
+
22
+ ## 2.0.14
23
+
24
+ ### Patch Changes
25
+
26
+ - Updated dependencies [94f9b84]
27
+ - @ramme-io/kernel@7.2.0
28
+
29
+ ## 2.0.13
30
+
31
+ ### Patch Changes
32
+
33
+ - Updated dependencies [304992d]
34
+ - Updated dependencies [82add86]
35
+ - @ramme-io/shared@3.2.0
36
+ - @ramme-io/kernel@7.1.0
37
+ - @ramme-io/ui@4.2.1
38
+
39
+ ## 2.0.12
40
+
41
+ ### Patch Changes
42
+
43
+ - Updated dependencies [185bca7]
44
+ - Updated dependencies [a153685]
45
+ - @ramme-io/ui@4.2.0
46
+ - @ramme-io/kernel@7.0.0
47
+
48
+ ## 2.0.11
49
+
50
+ ### Patch Changes
51
+
52
+ - Updated dependencies [9b17f09]
53
+ - @ramme-io/kernel@6.0.3
54
+
55
+ ## 2.0.10
56
+
57
+ ### Patch Changes
58
+
59
+ - Updated dependencies [e5b42ef]
60
+ - Updated dependencies [61d9ab7]
61
+ - @ramme-io/ui@4.1.1
62
+ - @ramme-io/kernel@6.0.2
63
+
64
+ ## 2.0.9
65
+
66
+ ### Patch Changes
67
+
68
+ - Updated dependencies [bbe9654]
69
+ - @ramme-io/kernel@6.0.1
70
+
71
+ ## 2.0.8
72
+
73
+ ### Patch Changes
74
+
75
+ - Updated dependencies
76
+ - @ramme-io/ui@4.1.0
77
+ - @ramme-io/kernel@6.0.0
78
+ - @ramme-io/shared@3.1.2
79
+
3
80
  ## 2.0.7
4
81
 
5
82
  ### Patch Changes
@@ -1 +1,7 @@
1
1
  node_modules
2
+
3
+ # Local environment. .env.example is the committed one; VITE_APP_NAME and any
4
+ # key you add here must never reach the repo.
5
+ .env
6
+ .env.*
7
+ !.env.example
@@ -2,9 +2,11 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
- <link rel="icon" type="image/svg+xml" href="/orange.png" />
5
+ <link rel="icon" type="image/svg+xml" href="/rocket.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>Ramme | The High-Fidelity Creator Framework</title>
7
+ <!-- Replaced with the project name by `npm create @ramme-io/app <name>`.
8
+ Once React mounts, PageTitleUpdater owns this. -->
9
+ <title>App Name</title>
8
10
  </head>
9
11
  <body>
10
12
  <div id="root"></div>
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "ramme-starter",
3
3
  "private": true,
4
- "version": "2.0.7",
4
+ "version": "2.0.16",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
8
8
  "dev:agent": "pnpm build && pnpm lint && pnpm test",
9
- "build": "tsc && vite build",
9
+ "build": "tsc --noEmit -p tsconfig.app.json && vite build",
10
+ "typecheck": "tsc --noEmit -p tsconfig.app.json",
10
11
  "lint": "eslint . --max-warnings 0",
11
12
  "preview": "vite preview",
12
13
  "test": "vitest run",
@@ -0,0 +1,18 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="32" height="32" role="img" aria-label="Rocket">
2
+ <!--
3
+ The scaffolded app's default mark. Deliberately generic: a new app should not
4
+ ship somebody else's logo in the browser tab.
5
+
6
+ Drawn rather than an emoji in a <text> node, because an emoji favicon renders
7
+ as whatever the viewer's platform font decides — different on every OS, and
8
+ absent where no emoji font is installed. Flat fills with a dark outline so the
9
+ silhouette survives being scaled to 16px on both light and dark tab bars.
10
+ -->
11
+ <g fill="none" stroke="#2a3142" stroke-width="1.6" stroke-linejoin="round" stroke-linecap="round">
12
+ <path d="M16 2c4 4.2 6 9 6 14v4H10v-4c0-5 2-9.8 6-14z" fill="#e9ecf4" />
13
+ <path d="M10 16l-4 5v4l4-3z" fill="#9aa4bd" />
14
+ <path d="M22 16l4 5v4l-4-3z" fill="#9aa4bd" />
15
+ <path d="M13 22h6l-3 7z" fill="#ff8a3d" />
16
+ <circle cx="16" cy="12" r="3" fill="#5b8def" />
17
+ </g>
18
+ </svg>
@@ -4,7 +4,6 @@ import {
4
4
  Button,
5
5
  SearchInput,
6
6
  DataTable,
7
- Checkbox,
8
7
  type ColDef
9
8
  } from '@ramme-io/ui';
10
9
 
@@ -1,10 +1,11 @@
1
1
  // src/components/AppFooter.tsx
2
2
  import React from 'react';
3
+ import { APP } from '../config/app.config';
3
4
 
4
5
  const AppFooter: React.FC = () => {
5
6
  return (
6
7
  <footer className="py-6 text-center text-muted-foreground">
7
- <p>&copy; {new Date().getFullYear()} Ramme. All Rights Reserved.</p>
8
+ <p>&copy; {new Date().getFullYear()} {APP.name}. All rights reserved.</p>
8
9
  </footer>
9
10
  );
10
11
  };
@@ -17,6 +17,7 @@ import React from 'react';
17
17
  import { useNavigate } from 'react-router-dom';
18
18
  import { Icon, UserNav, ButtonItem } from '@ramme-io/ui';
19
19
  import { useAuth, useSettingsStore } from '@ramme-io/kernel';
20
+ import { APP } from '../config/app.config';
20
21
 
21
22
  interface AppHeaderProps {
22
23
  title?: string;
@@ -78,7 +79,7 @@ const AppHeader: React.FC<AppHeaderProps> = ({
78
79
  <UserNav
79
80
  user={{
80
81
  name: user?.name ?? 'Demo Operator',
81
- email: user?.email ?? 'operator@ramme.local',
82
+ email: user?.email ?? APP.supportEmail,
82
83
  }}
83
84
  trigger={
84
85
  <div className="flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-muted/50 transition-colors">
@@ -7,6 +7,7 @@
7
7
  import React, { useEffect } from 'react';
8
8
  import { useLocation } from 'react-router-dom';
9
9
  import { useSitemap, type SitemapEntry } from '@ramme-io/kernel'; // Import our context hook
10
+ import { useAppConfig } from '../features/config/AppConfigContext';
10
11
 
11
12
  // Helper function to recursively find a route by path
12
13
  const findRouteByPath = (
@@ -39,6 +40,9 @@ const findRouteByPath = (
39
40
  const PageTitleUpdater: React.FC = () => {
40
41
  const location = useLocation();
41
42
  const sitemap = useSitemap(); // Get the sitemap from the current layout's context
43
+ // The app's own name — seeded from src/config/app.config.ts, and re-read here
44
+ // so renaming the app at runtime retitles the tab without a reload.
45
+ const { appName } = useAppConfig();
42
46
 
43
47
  useEffect(() => {
44
48
  // Determine the base path prefix based on the current top-level route
@@ -54,13 +58,13 @@ const PageTitleUpdater: React.FC = () => {
54
58
  const currentRoute = findRouteByPath(sitemap, location.pathname, baseRoutePrefix);
55
59
 
56
60
  if (currentRoute) {
57
- document.title = `Ramme - ${currentRoute.title}`;
61
+ document.title = `${appName} — ${currentRoute.title}`;
58
62
  } else {
59
63
  // Fallback title if no route is matched (e.g., for 404 or base layout path)
60
- document.title = 'Ramme - App Starter';
64
+ document.title = appName;
61
65
  }
62
- // Rerun effect whenever the pathname or the sitemap context changes
63
- }, [location.pathname, sitemap]);
66
+ // Rerun effect whenever the pathname, the sitemap context or the name changes
67
+ }, [location.pathname, sitemap, appName]);
64
68
 
65
69
  return null; // This component doesn't render anything itself
66
70
  };
@@ -1,5 +1,5 @@
1
1
  import { Outlet } from 'react-router-dom';
2
- import { ChatFAB, AppShell as RammeAppShell } from '@ramme-io/ui';
2
+ import { ChatFAB, AppShell } from '@ramme-io/ui';
3
3
  import {
4
4
  useWorkflowEngine,
5
5
  useSettingsStore,
@@ -9,10 +9,15 @@ import {
9
9
  RammeInspector,
10
10
  AIChatPanel
11
11
  } from '@ramme-io/kernel';
12
+ import { APP } from '../config/app.config';
12
13
 
14
+ // The assistant introduces itself as this app, not as the framework underneath
15
+ // it. Rewrite this for what your app actually does — the more specific it is,
16
+ // the more useful the answers.
13
17
  const SYSTEM_PROMPT = `
14
- You are the Ramme OS Assistant, embedded inside the Industrial Telemetry Sandbox.
15
- Ramme is a high-performance, browser-native modular web-OS built on a Kernel + UI layer architecture.
18
+ You are the assistant embedded in ${APP.name}.
19
+ Help the user operate this app: explain what a screen shows, and answer
20
+ questions about the data in front of them.
16
21
  `.trim();
17
22
 
18
23
  export const ProtectedAppShell = () => {
@@ -34,7 +39,7 @@ export const ProtectedAppShell = () => {
34
39
  const { mode, toggle } = useSpatialStore();
35
40
 
36
41
  return (
37
- <RammeAppShell
42
+ <AppShell
38
43
  isInspectorOpen={isInspectorOpen}
39
44
  setInspectorOpen={setInspectorOpen}
40
45
  inspectorWidth={inspectorWidth}
@@ -65,6 +70,6 @@ export const ProtectedAppShell = () => {
65
70
  isOpen={isSettingsOpen}
66
71
  onClose={() => toggleSettings(false)}
67
72
  />
68
- </RammeAppShell>
73
+ </AppShell>
69
74
  );
70
75
  };
@@ -121,7 +121,7 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({ isOpen, onClose, o
121
121
  value={keyInput}
122
122
  onChange={(e) => { setKeyInput(e.target.value); setError(''); }}
123
123
  placeholder="AIzaSy..."
124
- className="w-full px-3 py-2.5 rounded-md border border-border bg-background text-foreground text-sm font-mono focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary transition-colors"
124
+ className="w-full px-3 py-2.5 rounded-md border border-border bg-background text-foreground font-mono focus:outline-none focus:ring-2 focus:ring-primary/30 focus:border-primary transition-colors"
125
125
  onKeyDown={(e) => e.key === 'Enter' && handleSave()}
126
126
  autoFocus
127
127
  />
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Who this app says it is.
3
+ *
4
+ * One constant, read by every piece of chrome: the header wordmark, the footer,
5
+ * the browser tab, the manifest meta and the assistant's persona. Renaming the
6
+ * app is this file, not a search across nine components.
7
+ *
8
+ * `npm create @ramme-io/app <name>` rewrites `name` below to the project name,
9
+ * so a freshly scaffolded app is already itself. `VITE_APP_NAME` overrides it at
10
+ * build time, which is what a deploy uses when the same source ships under more
11
+ * than one name.
12
+ *
13
+ * Deliberately not a hook and not React state: a build-time constant cannot
14
+ * flicker on first paint the way a value read from localStorage can. The
15
+ * runtime-editable name lives in AppConfigContext and seeds from here.
16
+ */
17
+ export const APP = {
18
+ /** Wordmark, tab title, footer, and the name the assistant calls itself. */
19
+ name: import.meta.env.VITE_APP_NAME ?? 'App Name',
20
+
21
+ /** One line under the name where a layout offers room for it. */
22
+ tagline: 'Your tagline goes here',
23
+
24
+ /** Fallback shown in the user menu before a real session exists. */
25
+ supportEmail: 'operator@example.com',
26
+
27
+ /**
28
+ * Prefix for this app's localStorage keys.
29
+ *
30
+ * Unscoped keys ('app_name') collide between two apps served from the same
31
+ * origin — a real failure mode on localhost, where every dev server is
32
+ * http://localhost. Change this and the app forgets its saved preferences,
33
+ * which is the correct trade for not reading another app's.
34
+ */
35
+ storageNamespace: 'app',
36
+ } as const;
@@ -1,11 +1,12 @@
1
1
  import type { AppSpecification } from '@ramme-io/kernel';
2
+ import { APP } from './app.config';
2
3
 
3
4
  export const appManifest: AppSpecification = {
4
5
  meta: {
5
- name: "Ramme Starter",
6
- version: "2.0.0",
7
- description: "AI-agent optimised Ramme framework starter — KPI dashboard, CRUD, charts, and onboarding built in.",
8
- author: "Ramme Framework",
6
+ name: APP.name,
7
+ version: "1.0.0",
8
+ description: "A starter app — KPI dashboard, CRUD, charts and onboarding, ready to rename.",
9
+ author: "Your Team",
9
10
  },
10
11
  config: {
11
12
  theme: 'dark',
@@ -1,6 +1,9 @@
1
- import { useState } from 'react';
2
- import { Card, Button, Icon, Badge } from '@ramme-io/ui';
3
- import { RammeCodeBlock } from '../../../components/RammeCodeBlock';
1
+ import {
2
+ CodeBlock,
3
+ Card,
4
+ Icon,
5
+ Badge,
6
+ } from '@ramme-io/ui';
4
7
 
5
8
  const CURSOR_WINDSURF_PROMPT = `You are working inside a Ramme Framework application.
6
9
 
@@ -90,25 +93,14 @@ interface CopyBlockProps {
90
93
  }
91
94
 
92
95
  function CopyBlock({ label, code, language = 'text', badge }: CopyBlockProps) {
93
- const [copied, setCopied] = useState(false);
94
- const copy = () => {
95
- navigator.clipboard.writeText(code);
96
- setCopied(true);
97
- setTimeout(() => setCopied(false), 2000);
98
- };
99
96
  return (
100
97
  <div className="space-y-2">
101
- <div className="flex items-center justify-between">
98
+ {badge && (
102
99
  <div className="flex items-center gap-2">
103
- <span className="text-sm font-medium text-foreground">{label}</span>
104
- {badge && <Badge variant="secondary">{badge}</Badge>}
100
+ <Badge variant="secondary">{badge}</Badge>
105
101
  </div>
106
- <Button variant="ghost" size="sm" onClick={copy}>
107
- <Icon name={copied ? 'check' : 'copy'} size={14} className="mr-1.5" />
108
- {copied ? 'Copied!' : 'Copy'}
109
- </Button>
110
- </div>
111
- <RammeCodeBlock code={code} language={language} />
102
+ )}
103
+ <CodeBlock code={code} language={language} filename={label} />
112
104
  </div>
113
105
  );
114
106
  }
@@ -1,4 +1,5 @@
1
- import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react';
1
+ import { createContext, useContext, useState, useEffect, ReactNode } from 'react';
2
+ import { APP } from '../../config/app.config';
2
3
 
3
4
  interface AppConfigContextType {
4
5
  appName: string;
@@ -9,24 +10,38 @@ interface AppConfigContextType {
9
10
 
10
11
  const AppConfigContext = createContext<AppConfigContextType | undefined>(undefined);
11
12
 
13
+ /**
14
+ * Keys are namespaced per app.
15
+ *
16
+ * Two apps served from http://localhost on different ports share one origin and
17
+ * therefore one localStorage, so a bare 'app_name' means the second app you run
18
+ * inherits the first one's settings.
19
+ */
20
+ const key = (name: string) => `${APP.storageNamespace}:${name}`;
21
+
12
22
  export const AppConfigProvider = ({ children }: { children: ReactNode }) => {
13
- const [appName, setAppName] = useState(() => localStorage.getItem('app_name') || 'Ramme App');
14
-
23
+ // Seeded from the build-time constant, then editable at runtime. A saved name
24
+ // wins, because someone typed it.
25
+ const [appName, setAppName] = useState(() => localStorage.getItem(key('app_name')) || APP.name);
26
+
15
27
  const [enableCRT, setEnableCRT] = useState(() => {
16
- const stored = localStorage.getItem('app_enable_crt');
28
+ const stored = localStorage.getItem(key('enable_crt'));
17
29
  // Default to false for clean marketing site clarity
18
- return stored !== null ? JSON.parse(stored) : false;
30
+ return stored !== null ? JSON.parse(stored) : false;
19
31
  });
20
32
 
33
+ // Note: this does NOT write document.title. PageTitleUpdater owns the tab,
34
+ // because it is the only one that knows the current route — when both wrote
35
+ // it, whichever effect ran last won and the title flickered between
36
+ // "<app>" and "<app> — <page>".
21
37
  useEffect(() => {
22
- localStorage.setItem('app_name', appName);
23
- document.title = appName;
38
+ localStorage.setItem(key('app_name'), appName);
24
39
  }, [appName]);
25
40
 
26
41
  // Sync state to LocalStorage and DOM
27
42
  useEffect(() => {
28
- localStorage.setItem('app_enable_crt', JSON.stringify(enableCRT));
29
-
43
+ localStorage.setItem(key('enable_crt'), JSON.stringify(enableCRT));
44
+
30
45
  if (enableCRT) {
31
46
  document.body.classList.add('crt-mode');
32
47
  } else {
@@ -1,5 +1,3 @@
1
- import React from 'react';
2
-
3
1
  export default function SettingsPage() {
4
2
  return (
5
3
  <div className="p-6">
@@ -9,6 +9,7 @@ import { sitemap } from '../../config/sitemap';
9
9
  import PageTitleUpdater from '../../components/PageTitleUpdater';
10
10
  import AppChromeHost from '../../components/layout/AppChromeHost';
11
11
  import AppHeader from '../../components/AppHeader';
12
+ import { APP } from '../../config/app.config';
12
13
 
13
14
  const DashboardLayout: React.FC = () => {
14
15
  const navigate = useNavigate();
@@ -73,7 +74,7 @@ const DashboardLayout: React.FC = () => {
73
74
  <AppChromeHost
74
75
  header={
75
76
  <AppHeader
76
- title="Ramme Starter"
77
+ title={APP.name}
77
78
  onMobileMenuClick={() => setIsMobileMenuOpen(true)}
78
79
  />
79
80
  }
@@ -1,7 +1,6 @@
1
1
  // @vitest-environment jsdom
2
2
  import { describe, it, expect, beforeEach } from 'vitest';
3
3
  import { render } from '@testing-library/react';
4
- import React from 'react';
5
4
  import { BrowserRouter } from 'react-router-dom';
6
5
  import { ManifestProvider, AuthProvider, MqttProvider } from '@ramme-io/kernel';
7
6
  import { ThemeProvider, ToastProvider } from '@ramme-io/ui';
@@ -1,4 +0,0 @@
1
- # Ramme Framework Architectural Rules
2
- - Zero-Jank Mandate: Every animation and chart rendering must be hardware-accelerated. Never introduce unbuffered high-frequency state updates to the UI thread. Use the 15Hz Refresh Shield from `@ramme-io/kernel` for rapid data.
3
- - The Golden Path: Refer to `src/pages/InventoryManager.tsx` as the canonical reference for state orchestration, CRUD tables, AutoForm binding, and chart rendering.
4
- - Sitemap-Driven Routing: Routes must be registered inside `src/config/sitemap.ts`. The App Shell resolves sitemaps dynamically.
@@ -1,150 +0,0 @@
1
- # .rammerules — Ramme Framework Laws
2
- # This file is the authoritative law file for all coding agents and developers.
3
- # Read this before writing any code.
4
-
5
- ## 1. Identity
6
-
7
- This is a **Ramme Framework** application — an AI-native, browser-based web OS built on a
8
- two-layer architecture:
9
-
10
- - `@ramme-io/ui` — Tier 1 Atoms: pure presentational components, no data fetching
11
- - `@ramme-io/kernel` — Tier 2 Logic: data hooks, stores, providers, auth, MQTT, SmartTable
12
-
13
- ## 2. The Reuse-Over-Build Mandate
14
-
15
- Before creating any UI component, search the inventory. Run this — do not guess:
16
-
17
- cat node_modules/@ramme-io/ui/src/wizardManifest.ts
18
-
19
- Generated from each component's `@wizard` annotation, it carries the id,
20
- description, tags, props, and import path for every component. It is the
21
- authoritative answer to "does this already exist?". `AUTO_REGISTRY`
22
- (exported from `@ramme-io/ui`) is the runtime lookup of the same set — useful
23
- for dynamic rendering, but the manifest is what you read to find things.
24
-
25
- Before writing any state logic, check `@ramme-io/kernel` hooks first.
26
- Before adding a dependency, check the capability table in AGENTS.md — charts,
27
- tables, forms, date pickers, realtime, AI and state are already wired.
28
-
29
- If a component or hook exists — USE IT. Do not recreate it.
30
-
31
- ## 3. Component Sourcing Hierarchy
32
-
33
- ```
34
- 1st: @ramme-io/ui → Button, Card, Input, Icon, Sidebar, Modal, Drawer, StatCard…
35
- 2nd: @ramme-io/kernel → SmartTable, AutoForm, useCrudLocalStorage, useDataQuery…
36
- 3rd: src/features/<name> → Local "Smart Block" wrappers around kernel primitives
37
- ```
38
-
39
- ## 4. Route Addition Flow (The Golden Path)
40
-
41
- To add a new page to the dashboard:
42
-
43
- 1. Create the page component in `src/features/<domain>/pages/MyPage.tsx`
44
- - Use `@ramme-io/ui` primitives only (no raw HTML buttons, no raw HTML inputs)
45
- - Keep business logic in hooks, not in the component
46
- 2. Add the component to `src/config/component-registry.tsx`
47
- 3. Add the route entry to `src/config/sitemap.ts`
48
-
49
- Reference exemplar: `src/pages/InventoryManager.tsx`
50
-
51
- ## 5. Data Contract
52
-
53
- All app data flows through the DataLake:
54
-
55
- ```ts
56
- // main.tsx
57
- initializeDataLake(DATA_REGISTRY);
58
-
59
- // In DATA_REGISTRY (src/data/mockData.ts), register all entities:
60
- export const DATA_REGISTRY: Record<string, any[]> = {
61
- inventory: INGREDIENTS,
62
- };
63
-
64
- // In a page component, read + write via kernel hooks:
65
- const { data, createItem } = useCrudLocalStorage('ramme_db_<entityId>', SEED_DATA);
66
- const query = useDataQuery(data, { sort: { field: 'name', direction: 'asc' } });
67
- ```
68
-
69
- DataLake key: the `id` field in `SmartTable` must match the key in `DATA_REGISTRY`.
70
-
71
- ## 6. Layout Laws
72
-
73
- - NEVER hardcode `h-screen`, `fixed top-0 left-0`, or `overflow-hidden` inside page components.
74
- - Page components are rendered inside `<Outlet />` inside `AppChromeHost` — the viewport is
75
- already locked. Let content scroll naturally.
76
- - Use `<div className="p-6 space-y-6">` as the page wrapper.
77
- - The `AppChromeHost` slot pattern handles: header (App scope), sidebar (Section scope),
78
- canvas (Content scope). Never fight this.
79
-
80
- ## 7. Styling Laws
81
-
82
- - Use Tailwind utility classes.
83
- - NEVER use `style={{ color: '#hex' }}` — always use theme CSS variables:
84
- `text-foreground`, `text-muted-foreground`, `bg-card`, `bg-primary`, `border-border`
85
- - NEVER use `bg-white` or `bg-black` — they break dark mode.
86
- - NEVER use `<Flex>`, `<Box>`, or `<Stack>` components — Ramme does not use those.
87
-
88
- ## 8. Anti-Patterns (Do Not Do These)
89
-
90
- ```tsx
91
- // ❌ Raw HTML button
92
- <button className="bg-blue-500 text-white px-4 py-2 rounded">Save</button>
93
-
94
- // ✅ Framework button
95
- import { Button } from '@ramme-io/ui';
96
- <Button variant="primary">Save</Button>
97
- ```
98
-
99
- ```tsx
100
- // ❌ Hardcoded layout sizing
101
- <div className="h-screen w-full fixed top-0">
102
-
103
- // ✅ Let AppChromeHost handle the viewport
104
- <div className="p-6 space-y-6">
105
- ```
106
-
107
- ```tsx
108
- // ❌ Inline business logic
109
- const handleSave = async () => { /* 50 lines */ };
110
-
111
- // ✅ Domain hook
112
- const { saveItem } = useInventoryItem();
113
- ```
114
-
115
- ```tsx
116
- // ❌ Hardcoded colors
117
- <div style={{ color: '#0ea5e9' }}>
118
-
119
- // ✅ CSS variable
120
- <div className="text-primary">
121
- ```
122
-
123
- ## 9. Package Manager
124
-
125
- This project uses `pnpm` exclusively. Never run `npm install` or `yarn add`.
126
-
127
- ## 10. Key File Map
128
-
129
- ```
130
- src/
131
- config/
132
- app.manifest.ts ← App identity, entities, theme defaults
133
- sitemap.ts ← Route registry (add new pages here)
134
- component-registry.tsx ← Component resolver for AI-driven rendering
135
- navigation.ts ← User menu, settings menu, footer links
136
- data/
137
- mockData.ts ← Seed data + DATA_REGISTRY (DataLake)
138
- features/
139
- <domain>/pages/ ← Feature pages (FSD pattern)
140
- config/AppConfigContext ← App-level config state
141
- visualizations/SmartChart ← Chart wrapper around Recharts
142
- templates/
143
- dashboard/DashboardLayout ← Canonical layout (sidebar + header + Outlet)
144
- components/
145
- ProtectedAppShell.tsx ← Root shell (WorkflowEngine, Inspector, AI Chat, Settings)
146
- AppHeader.tsx ← Top bar (logo + UserNav)
147
- layout/AppChromeHost.tsx ← Viewport orchestrator (header/sidebar/canvas slots)
148
- pages/
149
- InventoryManager.tsx ← Golden Path exemplar — copy this pattern for new pages
150
- ```
Binary file
Binary file
@@ -1,66 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
3
- import { oneDark } from 'react-syntax-highlighter/dist/esm/styles/prism';
4
- import { Icon, Button } from '@ramme-io/ui';
5
-
6
- interface RammeCodeBlockProps {
7
- code: string;
8
- language?: string;
9
- variant?: 'info' | 'success' | 'secondary' | 'primary';
10
- title?: string;
11
- }
12
-
13
- export const RammeCodeBlock: React.FC<RammeCodeBlockProps> = ({
14
- code,
15
- language = 'tsx',
16
- variant = 'primary',
17
- title
18
- }) => {
19
- const [copied, setCopied] = useState(false);
20
-
21
- const accentColor = `var(--app-${variant}-color)`;
22
-
23
- const copy = () => {
24
- navigator.clipboard.writeText(code);
25
- setCopied(true);
26
- setTimeout(() => setCopied(false), 2000);
27
- };
28
-
29
- return (
30
- <div className="group relative rounded-xl overflow-hidden border border-border bg-[#0d0d0d] animate-in fade-in zoom-in-95 duration-500">
31
- {/* Header / Title Bar */}
32
- <div className="px-4 py-2 bg-white/5 border-b border-white/10 flex justify-between items-center">
33
- <div className="flex items-center gap-2">
34
- <div className="w-2 h-2 rounded-full" style={{ backgroundColor: accentColor }} />
35
- <span className="text-[10px] font-bold uppercase tracking-widest opacity-60 text-foreground">
36
- {title || language}
37
- </span>
38
- </div>
39
- <Button variant="ghost" size="icon" className="h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity" onClick={copy}>
40
- <Icon name={copied ? "check" : "copy"} size={12} style={{ color: copied ? 'var(--app-success-color)' : 'inherit' }} />
41
- </Button>
42
- </div>
43
-
44
- {/* Syntax Highlighting */}
45
- <SyntaxHighlighter
46
- language={language}
47
- style={oneDark}
48
- customStyle={{
49
- margin: 0,
50
- padding: '1.5rem',
51
- fontSize: '0.85rem',
52
- background: 'transparent',
53
- lineHeight: '1.6',
54
- }}
55
- >
56
- {code}
57
- </SyntaxHighlighter>
58
-
59
- {/* Dynamic Background Glow (Compliant with Theme) */}
60
- <div
61
- className="absolute -right-20 -bottom-20 w-40 h-40 blur-[80px] opacity-10 pointer-events-none"
62
- style={{ backgroundColor: accentColor }}
63
- />
64
- </div>
65
- );
66
- };