@framingui/mcp-server 0.6.25 → 0.6.27
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/LICENSE +21 -0
- package/dist/__tests__/react-native-contract.test.d.ts +2 -0
- package/dist/__tests__/react-native-contract.test.d.ts.map +1 -0
- package/dist/__tests__/react-native-contract.test.js +50 -0
- package/dist/__tests__/react-native-contract.test.js.map +1 -0
- package/dist/auth/state.d.ts +5 -0
- package/dist/auth/state.d.ts.map +1 -1
- package/dist/auth/state.js +33 -0
- package/dist/auth/state.js.map +1 -1
- package/dist/cli/agent-md-templates.d.ts.map +1 -1
- package/dist/cli/agent-md-templates.js +53 -15
- package/dist/cli/agent-md-templates.js.map +1 -1
- package/dist/cli/guide-template.d.ts.map +1 -1
- package/dist/cli/guide-template.js +17 -6
- package/dist/cli/guide-template.js.map +1 -1
- package/dist/cli/init.d.ts +1 -0
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +12 -7
- package/dist/cli/init.js.map +1 -1
- package/dist/data/component-fallback-catalog.d.ts +26 -0
- package/dist/data/component-fallback-catalog.d.ts.map +1 -0
- package/dist/data/component-fallback-catalog.js +149 -0
- package/dist/data/component-fallback-catalog.js.map +1 -0
- package/dist/data/react-native-runtime-catalog.d.ts +24 -0
- package/dist/data/react-native-runtime-catalog.d.ts.map +1 -0
- package/dist/data/react-native-runtime-catalog.js +265 -0
- package/dist/data/react-native-runtime-catalog.js.map +1 -0
- package/dist/index.js +111 -44
- package/dist/index.js.map +1 -1
- package/dist/platform-support.d.ts +22 -0
- package/dist/platform-support.d.ts.map +1 -0
- package/dist/platform-support.js +148 -0
- package/dist/platform-support.js.map +1 -0
- package/dist/project-context-resolution.d.ts +7 -0
- package/dist/project-context-resolution.d.ts.map +1 -0
- package/dist/project-context-resolution.js +21 -0
- package/dist/project-context-resolution.js.map +1 -0
- package/dist/project-context-state.d.ts +12 -0
- package/dist/project-context-state.d.ts.map +1 -0
- package/dist/project-context-state.js +14 -0
- package/dist/project-context-state.js.map +1 -0
- package/dist/project-context.d.ts +15 -0
- package/dist/project-context.d.ts.map +1 -0
- package/dist/project-context.js +78 -0
- package/dist/project-context.js.map +1 -0
- package/dist/prompts/getting-started.d.ts.map +1 -1
- package/dist/prompts/getting-started.js +27 -7
- package/dist/prompts/getting-started.js.map +1 -1
- package/dist/prompts/screen-workflow.d.ts.map +1 -1
- package/dist/prompts/screen-workflow.js +53 -2
- package/dist/prompts/screen-workflow.js.map +1 -1
- package/dist/schemas/mcp-schemas.d.ts +1011 -481
- package/dist/schemas/mcp-schemas.d.ts.map +1 -1
- package/dist/schemas/mcp-schemas.js +98 -0
- package/dist/schemas/mcp-schemas.js.map +1 -1
- package/dist/tools/detect-project-context.d.ts +3 -0
- package/dist/tools/detect-project-context.d.ts.map +1 -0
- package/dist/tools/detect-project-context.js +36 -0
- package/dist/tools/detect-project-context.js.map +1 -0
- package/dist/tools/get-screen-generation-context.d.ts.map +1 -1
- package/dist/tools/get-screen-generation-context.js +118 -18
- package/dist/tools/get-screen-generation-context.js.map +1 -1
- package/dist/tools/list-components.d.ts.map +1 -1
- package/dist/tools/list-components.js +42 -3
- package/dist/tools/list-components.js.map +1 -1
- package/dist/tools/preview-component.d.ts.map +1 -1
- package/dist/tools/preview-component.js +57 -7
- package/dist/tools/preview-component.js.map +1 -1
- package/dist/tools/preview-theme.d.ts.map +1 -1
- package/dist/tools/preview-theme.js +20 -2
- package/dist/tools/preview-theme.js.map +1 -1
- package/dist/tools/theme-authority.js +1 -1
- package/dist/tools/theme-authority.js.map +1 -1
- package/dist/tools/validate-environment.d.ts.map +1 -1
- package/dist/tools/validate-environment.js +99 -2
- package/dist/tools/validate-environment.js.map +1 -1
- package/dist/tools/validate-screen-definition.d.ts.map +1 -1
- package/dist/tools/validate-screen-definition.js +41 -7
- package/dist/tools/validate-screen-definition.js.map +1 -1
- package/package.json +15 -16
- package/dist/cli/commands.d.ts +0 -2
- package/dist/cli/commands.d.ts.map +0 -1
- package/dist/cli/commands.js +0 -20
- package/dist/cli/commands.js.map +0 -1
- package/dist/cli/help.d.ts +0 -5
- package/dist/cli/help.d.ts.map +0 -1
- package/dist/cli/help.js +0 -59
- package/dist/cli/help.js.map +0 -1
- package/dist/cli/package-manager.d.ts +0 -5
- package/dist/cli/package-manager.d.ts.map +0 -1
- package/dist/cli/package-manager.js +0 -34
- package/dist/cli/package-manager.js.map +0 -1
- package/dist/cli/update.d.ts +0 -8
- package/dist/cli/update.d.ts.map +0 -1
- package/dist/cli/update.js +0 -53
- package/dist/cli/update.js.map +0 -1
- package/dist/commands/slash-command-adapters.d.ts +0 -9
- package/dist/commands/slash-command-adapters.d.ts.map +0 -1
- package/dist/commands/slash-command-adapters.js +0 -116
- package/dist/commands/slash-command-adapters.js.map +0 -1
- package/dist/data/component-props.d.ts +0 -30
- package/dist/data/component-props.d.ts.map +0 -1
- package/dist/data/component-props.js +0 -537
- package/dist/data/component-props.js.map +0 -1
- package/dist/data/component-registry.d.ts +0 -30
- package/dist/data/component-registry.d.ts.map +0 -1
- package/dist/data/component-registry.js +0 -320
- package/dist/data/component-registry.js.map +0 -1
- package/dist/data/examples/screen-examples.d.ts +0 -38
- package/dist/data/examples/screen-examples.d.ts.map +0 -1
- package/dist/data/examples/screen-examples.js +0 -500
- package/dist/data/examples/screen-examples.js.map +0 -1
- package/dist/utils/style-contract-reader.d.ts +0 -10
- package/dist/utils/style-contract-reader.d.ts.map +0 -1
- package/dist/utils/style-contract-reader.js +0 -67
- package/dist/utils/style-contract-reader.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-context.d.ts","sourceRoot":"","sources":["../src/project-context.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAInG,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,cAAc,CAAC;IACzB,WAAW,EAAE,kBAAkB,CAAC;CACjC;AAED,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,sBAAsB,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,0BAA0B,CAoCpF;AAED,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,MAAM,EACnB,mBAAmB,CAAC,EAAE,MAAM,GAC3B,cAAc,CAgChB"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
import { readPackageJson } from './utils/package-json-reader.js';
|
|
4
|
+
const EXPO_CONFIG_CANDIDATES = ['app.json', 'app.config.js', 'app.config.ts', 'app.config.mjs'];
|
|
5
|
+
export function detectProjectContext(projectPath) {
|
|
6
|
+
const readResult = readPackageJson(projectPath);
|
|
7
|
+
if (!readResult.success || !readResult.packageJson || !readResult.installedPackages) {
|
|
8
|
+
return {
|
|
9
|
+
success: false,
|
|
10
|
+
error: readResult.error || 'Failed to read package.json',
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
const rootPath = projectPath.endsWith('package.json') ? path.dirname(projectPath) : projectPath;
|
|
14
|
+
const resolvedRootPath = path.resolve(rootPath);
|
|
15
|
+
const packageJsonPath = path.resolve(projectPath.endsWith('package.json') ? projectPath : path.join(rootPath, 'package.json'));
|
|
16
|
+
const installedPackages = readResult.installedPackages;
|
|
17
|
+
const runtime = detectRuntime(resolvedRootPath, installedPackages);
|
|
18
|
+
return {
|
|
19
|
+
success: true,
|
|
20
|
+
context: {
|
|
21
|
+
projectPath: resolvedRootPath,
|
|
22
|
+
packageJsonPath,
|
|
23
|
+
platform: runtime === 'web' ? 'web' : 'react-native',
|
|
24
|
+
environment: {
|
|
25
|
+
runtime,
|
|
26
|
+
projectType: runtime,
|
|
27
|
+
packageManager: detectPackageManager(resolvedRootPath, typeof readResult.packageJson.packageManager === 'string'
|
|
28
|
+
? readResult.packageJson.packageManager
|
|
29
|
+
: undefined),
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export function detectPackageManager(projectPath, packageManagerField) {
|
|
35
|
+
if (packageManagerField) {
|
|
36
|
+
if (packageManagerField.startsWith('pnpm')) {
|
|
37
|
+
return 'pnpm';
|
|
38
|
+
}
|
|
39
|
+
if (packageManagerField.startsWith('yarn')) {
|
|
40
|
+
return 'yarn';
|
|
41
|
+
}
|
|
42
|
+
if (packageManagerField.startsWith('bun')) {
|
|
43
|
+
return 'bun';
|
|
44
|
+
}
|
|
45
|
+
if (packageManagerField.startsWith('npm')) {
|
|
46
|
+
return 'npm';
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (fs.existsSync(path.join(projectPath, 'pnpm-lock.yaml'))) {
|
|
50
|
+
return 'pnpm';
|
|
51
|
+
}
|
|
52
|
+
if (fs.existsSync(path.join(projectPath, 'yarn.lock'))) {
|
|
53
|
+
return 'yarn';
|
|
54
|
+
}
|
|
55
|
+
if (fs.existsSync(path.join(projectPath, 'bun.lock')) ||
|
|
56
|
+
fs.existsSync(path.join(projectPath, 'bun.lockb'))) {
|
|
57
|
+
return 'bun';
|
|
58
|
+
}
|
|
59
|
+
if (fs.existsSync(path.join(projectPath, 'package-lock.json'))) {
|
|
60
|
+
return 'npm';
|
|
61
|
+
}
|
|
62
|
+
return 'unknown';
|
|
63
|
+
}
|
|
64
|
+
function detectRuntime(projectPath, installedPackages) {
|
|
65
|
+
const hasExpoDependency = Boolean(installedPackages.expo);
|
|
66
|
+
const hasReactNativeDependency = Boolean(installedPackages['react-native']);
|
|
67
|
+
const hasExpoConfig = EXPO_CONFIG_CANDIDATES.some(fileName => fs.existsSync(path.join(projectPath, fileName)));
|
|
68
|
+
const hasNativeFolders = fs.existsSync(path.join(projectPath, 'ios')) ||
|
|
69
|
+
fs.existsSync(path.join(projectPath, 'android'));
|
|
70
|
+
if (hasExpoDependency || hasExpoConfig) {
|
|
71
|
+
return 'expo';
|
|
72
|
+
}
|
|
73
|
+
if (hasReactNativeDependency || hasNativeFolders) {
|
|
74
|
+
return 'react-native';
|
|
75
|
+
}
|
|
76
|
+
return 'web';
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=project-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-context.js","sourceRoot":"","sources":["../src/project-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAGjE,MAAM,sBAAsB,GAAG,CAAC,UAAU,EAAE,eAAe,EAAE,eAAe,EAAE,gBAAgB,CAAC,CAAC;AAehG,MAAM,UAAU,oBAAoB,CAAC,WAAmB;IACtD,MAAM,UAAU,GAAG,eAAe,CAAC,WAAW,CAAC,CAAC;IAEhD,IAAI,CAAC,UAAU,CAAC,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,IAAI,CAAC,UAAU,CAAC,iBAAiB,EAAE,CAAC;QACpF,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,6BAA6B;SACzD,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC;IAChG,MAAM,gBAAgB,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAChD,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAClC,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,C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C;IAED,IAAI,wBAAwB,IAAI,gBAAgB,EAAE,CAAC;QACjD,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getting-started.d.ts","sourceRoot":"","sources":["../../src/prompts/getting-started.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,wBAAgB,uBAAuB;;;;;;;;
|
|
1
|
+
{"version":3,"file":"getting-started.d.ts","sourceRoot":"","sources":["../../src/prompts/getting-started.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,wBAAgB,uBAAuB;;;;;;;;EA+HtC"}
|
|
@@ -67,7 +67,19 @@ You can call \`list-themes\` and \`preview-theme\` directly after authentication
|
|
|
67
67
|
- pebble - Round minimal
|
|
68
68
|
- square-minimalism - Square minimalism
|
|
69
69
|
|
|
70
|
-
## Step 4:
|
|
70
|
+
## Step 4: Bootstrap Project Context
|
|
71
|
+
|
|
72
|
+
If the project path is known, call \`detect-project-context\` before the main workflow.
|
|
73
|
+
|
|
74
|
+
\`\`\`
|
|
75
|
+
1. Call detect-project-context with the project root or package.json path
|
|
76
|
+
2. Let FramingUI store the detected default platform/runtime for the session
|
|
77
|
+
3. Continue with discovery tools without repeating platform flags unless overriding on purpose
|
|
78
|
+
\`\`\`
|
|
79
|
+
|
|
80
|
+
For Expo / React Native targets, this is the preferred path. If no project path is available, you can still pass \`platform: "react-native"\` explicitly as a fallback.
|
|
81
|
+
|
|
82
|
+
## Step 5: Check Component Availability
|
|
71
83
|
|
|
72
84
|
Before creating screen definitions:
|
|
73
85
|
|
|
@@ -77,19 +89,26 @@ Before creating screen definitions:
|
|
|
77
89
|
3. Identify components needed for your screen
|
|
78
90
|
\`\`\`
|
|
79
91
|
|
|
80
|
-
## Step
|
|
92
|
+
## Step 6: Generate Your First Screen
|
|
81
93
|
|
|
82
94
|
Follow the 3-step workflow:
|
|
83
95
|
|
|
84
96
|
**Step 1/3:** Call \`get-screen-generation-context\` with your screen description
|
|
85
97
|
- Returns: Template hints, component suggestions with inline props, schema
|
|
86
98
|
- Use \`includeExamples: false\` when you want a smaller response and do not need sample screen definitions
|
|
99
|
+
- If \`detect-project-context\` already ran, omit \`platform\` and let the stored default apply
|
|
87
100
|
|
|
88
101
|
**Step 2/3:** Create Screen Definition JSON, then call \`validate-screen-definition\`
|
|
89
102
|
- Returns: Validation results, errors with auto-fix patches, suggestions
|
|
90
103
|
|
|
91
104
|
**After validation passes:** Write React code directly using the components and props from Step 1
|
|
92
105
|
|
|
106
|
+
For Expo / React Native targets:
|
|
107
|
+
- use the direct-write guidance from \`get-screen-generation-context\`
|
|
108
|
+
- prefer \`@framingui/react-native\` exports where that runtime surface exists
|
|
109
|
+
- do **not** import \`@framingui/ui\`
|
|
110
|
+
- run \`validate-environment\` with \`sourceFiles\` before handoff
|
|
111
|
+
|
|
93
112
|
**Step 3/3 (Optional):** Call \`validate-environment\` with project path
|
|
94
113
|
- Returns: Missing packages, install commands, Tailwind config status
|
|
95
114
|
|
|
@@ -98,11 +117,12 @@ Follow the 3-step workflow:
|
|
|
98
117
|
1. ❌ Skipping authentication - All themes require licenses
|
|
99
118
|
2. ❌ Assuming whoami is a hard prerequisite - it is optional session inspection, not a hidden unlock step
|
|
100
119
|
3. ❌ Using non-existent theme IDs - Only 6 themes exist
|
|
101
|
-
4. ❌ Skipping
|
|
102
|
-
5. ❌
|
|
103
|
-
6. ❌
|
|
104
|
-
7. ❌
|
|
105
|
-
8. ❌
|
|
120
|
+
4. ❌ Skipping detect-project-context when the project path is known - you lose automatic platform defaults
|
|
121
|
+
5. ❌ Skipping validate-screen-definition for web work - Always validate before writing code
|
|
122
|
+
6. ❌ Ignoring dependencies warnings - Check required packages before running code
|
|
123
|
+
7. ❌ Using unlicensed themes - Only use themes from whoami licensedThemes list
|
|
124
|
+
8. ❌ Parsing MCP transcript text with shell/python/json tools - Use tool output directly instead
|
|
125
|
+
9. ❌ Treating templateMatch as the source of truth - components and preview tools are the contract
|
|
106
126
|
|
|
107
127
|
## Need Help?
|
|
108
128
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getting-started.js","sourceRoot":"","sources":["../../src/prompts/getting-started.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,UAAU,uBAAuB;IACrC,OAAO;QACL,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE
|
|
1
|
+
{"version":3,"file":"getting-started.js","sourceRoot":"","sources":["../../src/prompts/getting-started.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,UAAU,uBAAuB;IACrC,OAAO;QACL,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kEAmHkD;iBACzD;aACF;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screen-workflow.d.ts","sourceRoot":"","sources":["../../src/prompts/screen-workflow.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,wBAAgB,uBAAuB;;;;;;;;
|
|
1
|
+
{"version":3,"file":"screen-workflow.d.ts","sourceRoot":"","sources":["../../src/prompts/screen-workflow.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,wBAAgB,uBAAuB;;;;;;;;EA0MtC"}
|
|
@@ -24,10 +24,29 @@ The production workflow is **guarded direct write**:
|
|
|
24
24
|
- ✅ Write React code directly using FramingUI components and props from context
|
|
25
25
|
- ✅ Verify dependencies, Tailwind setup, and raw HTML/style escapes before delivery
|
|
26
26
|
|
|
27
|
+
React Native is also supported through a **direct-write contract path**:
|
|
28
|
+
- ✅ Prefer \`detect-project-context\` once when the project path is known
|
|
29
|
+
- ✅ Gather platform-aware component guidance without repeating platform flags
|
|
30
|
+
- ✅ Write Expo / React Native code directly using \`@framingui/react-native\` where available, then host primitives or app abstractions for the rest
|
|
31
|
+
- ✅ Use \`validate-environment\` with \`sourceFiles\` for package checks and QC
|
|
32
|
+
- 🚫 Do not import \`@framingui/ui\` into React Native projects
|
|
33
|
+
|
|
27
34
|
This is **not** the old \`generate_screen\`-first workflow.
|
|
28
35
|
\`generate_screen\` may still be used as an optional helper, but the default production path is:
|
|
29
36
|
|
|
30
|
-
|
|
37
|
+
If the project path is known:
|
|
38
|
+
|
|
39
|
+
\`detect-project-context\` → \`preview-theme\` → \`get-screen-generation-context\` → \`preview-component\` / \`list-icon-libraries\` when needed → \`validate-screen-definition\` → write code directly → \`validate-environment\`
|
|
40
|
+
|
|
41
|
+
If the project path is not known, start at \`get-screen-generation-context\` and use explicit platform overrides only when needed.
|
|
42
|
+
|
|
43
|
+
## React Native Note
|
|
44
|
+
|
|
45
|
+
For Expo or React Native projects:
|
|
46
|
+
- pass \`"platform": "react-native"\` to \`get-screen-generation-context\`
|
|
47
|
+
- prefer \`@framingui/react-native\` exports over app-local wrappers for common UI
|
|
48
|
+
- write code directly with \`StyleSheet.create\`
|
|
49
|
+
- run \`validate-environment\` with \`sourceFiles\` to catch web-only imports, \`className\`, and raw token drift
|
|
31
50
|
|
|
32
51
|
## Step 1/4: Gather Context
|
|
33
52
|
|
|
@@ -46,6 +65,15 @@ Use this at the start of every screen task.
|
|
|
46
65
|
|
|
47
66
|
Set \`includeExamples: false\` when you want a smaller response and do not need example screen definitions.
|
|
48
67
|
|
|
68
|
+
For React Native direct-write work without a detected session default, pass:
|
|
69
|
+
\`\`\`json
|
|
70
|
+
{
|
|
71
|
+
"description": "Profile screen with subscription card and settings actions",
|
|
72
|
+
"platform": "react-native",
|
|
73
|
+
"includeExamples": false
|
|
74
|
+
}
|
|
75
|
+
\`\`\`
|
|
76
|
+
|
|
49
77
|
**What to review from the response:**
|
|
50
78
|
- \`templateMatch\` as a layout hint only
|
|
51
79
|
- \`components\` as the source of truth for imports, props, and variants
|
|
@@ -136,15 +164,38 @@ Use it to verify:
|
|
|
136
164
|
|
|
137
165
|
If the tool reports missing setup or raw primitive drift, fix the code before delivery.
|
|
138
166
|
|
|
167
|
+
## React Native Direct-Write Path
|
|
168
|
+
|
|
169
|
+
Use this instead of the web screen-definition path when the target app is Expo or React Native.
|
|
170
|
+
|
|
171
|
+
1. Call \`detect-project-context\` with \`projectPath\` when the app path is available
|
|
172
|
+
2. Call \`get-screen-generation-context\` and let the stored session default pick React Native automatically
|
|
173
|
+
3. If the project path is not available, call \`get-screen-generation-context\` with \`platform: "react-native"\`
|
|
174
|
+
4. Review React Native compatible components and hints
|
|
175
|
+
5. Write the screen directly using \`@framingui/react-native\` exports where available, then \`react-native\` primitives or local app abstractions
|
|
176
|
+
6. Run \`validate-environment\` with:
|
|
177
|
+
- \`platform: "react-native"\`
|
|
178
|
+
- \`projectPath\`
|
|
179
|
+
- \`requiredPackages\`
|
|
180
|
+
- \`sourceFiles\`
|
|
181
|
+
7. Fix missing packages, hardcoded color/spacing/radius values, and web-only patterns such as \`className\`
|
|
182
|
+
|
|
183
|
+
React Native rules:
|
|
184
|
+
- Do **not** import \`@framingui/ui\`
|
|
185
|
+
- Do **not** require Tailwind or CSS imports
|
|
186
|
+
- Prefer \`StyleSheet\` plus \`@framingui/react-native\` helpers or host app token helpers over raw style literals
|
|
187
|
+
- Treat \`@framingui/react-native\` as a minimal runtime, not as full \`@framingui/ui\` parity or code generation
|
|
188
|
+
|
|
139
189
|
## Best Practices
|
|
140
190
|
|
|
141
|
-
1. Start with \`
|
|
191
|
+
1. Start with \`detect-project-context\` when project path is known
|
|
142
192
|
2. Use \`includeExamples: false\` unless examples are actually needed
|
|
143
193
|
3. Treat \`templateMatch\` as a hint, not a hard constraint
|
|
144
194
|
4. Treat \`components\` as the source of truth
|
|
145
195
|
5. Validate the definition before writing JSX
|
|
146
196
|
6. Never parse MCP transcript text with shell or Python JSON tooling
|
|
147
197
|
7. Run \`validate-environment\` before handoff
|
|
198
|
+
8. Use the React Native direct-write path when the target project is Expo or React Native
|
|
148
199
|
|
|
149
200
|
## Optional Helper Path
|
|
150
201
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screen-workflow.js","sourceRoot":"","sources":["../../src/prompts/screen-workflow.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,UAAU,uBAAuB;IACrC,OAAO;QACL,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE
|
|
1
|
+
{"version":3,"file":"screen-workflow.js","sourceRoot":"","sources":["../../src/prompts/screen-workflow.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,UAAU,uBAAuB;IACrC,OAAO;QACL,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gMA8LgL;iBACvL;aACF;SACF;KACF,CAAC;AACJ,CAAC"}
|