@framingui/mcp-server 0.6.26 → 0.6.28
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 -3
- 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 +16 -0
- package/dist/auth/state.d.ts.map +1 -1
- package/dist/auth/state.js +54 -15
- package/dist/auth/state.js.map +1 -1
- package/dist/auth/verify.d.ts +9 -0
- package/dist/auth/verify.d.ts.map +1 -1
- package/dist/auth/verify.js.map +1 -1
- package/dist/billing/quota-policy.d.ts +13 -0
- package/dist/billing/quota-policy.d.ts.map +1 -0
- package/dist/billing/quota-policy.js +32 -0
- package/dist/billing/quota-policy.js.map +1 -0
- package/dist/billing/tool-metering.d.ts +10 -0
- package/dist/billing/tool-metering.d.ts.map +1 -0
- package/dist/billing/tool-metering.js +126 -0
- package/dist/billing/tool-metering.js.map +1 -0
- package/dist/billing/usage-ledger.d.ts +61 -0
- package/dist/billing/usage-ledger.d.ts.map +1 -0
- package/dist/billing/usage-ledger.js +102 -0
- package/dist/billing/usage-ledger.js.map +1 -0
- package/dist/billing/usage-sync.d.ts +3 -0
- package/dist/billing/usage-sync.d.ts.map +1 -0
- package/dist/billing/usage-sync.js +40 -0
- package/dist/billing/usage-sync.js.map +1 -0
- package/dist/cli/agent-md-templates.d.ts.map +1 -1
- package/dist/cli/agent-md-templates.js +58 -38
- package/dist/cli/agent-md-templates.js.map +1 -1
- package/dist/cli/commands.d.ts +2 -0
- package/dist/cli/commands.d.ts.map +1 -0
- package/dist/cli/commands.js +20 -0
- package/dist/cli/commands.js.map +1 -0
- package/dist/cli/guide-template.d.ts.map +1 -1
- package/dist/cli/guide-template.js +20 -36
- package/dist/cli/guide-template.js.map +1 -1
- package/dist/cli/help.d.ts +5 -0
- package/dist/cli/help.d.ts.map +1 -0
- package/dist/cli/help.js +59 -0
- package/dist/cli/help.js.map +1 -0
- package/dist/cli/init.d.ts +2 -3
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +33 -48
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/package-manager.d.ts +5 -0
- package/dist/cli/package-manager.d.ts.map +1 -0
- package/dist/cli/package-manager.js +34 -0
- package/dist/cli/package-manager.js.map +1 -0
- package/dist/cli/update.d.ts +8 -0
- package/dist/cli/update.d.ts.map +1 -0
- package/dist/cli/update.js +53 -0
- package/dist/cli/update.js.map +1 -0
- package/dist/commands/slash-command-adapters.d.ts +9 -0
- package/dist/commands/slash-command-adapters.d.ts.map +1 -0
- package/dist/commands/slash-command-adapters.js +116 -0
- package/dist/commands/slash-command-adapters.js.map +1 -0
- 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/component-props.d.ts +30 -0
- package/dist/data/component-props.d.ts.map +1 -0
- package/dist/data/component-props.js +537 -0
- package/dist/data/component-props.js.map +1 -0
- package/dist/data/component-registry.d.ts +30 -0
- package/dist/data/component-registry.d.ts.map +1 -0
- package/dist/data/component-registry.js +320 -0
- package/dist/data/component-registry.js.map +1 -0
- package/dist/data/examples/screen-examples.d.ts +38 -0
- package/dist/data/examples/screen-examples.d.ts.map +1 -0
- package/dist/data/examples/screen-examples.js +500 -0
- package/dist/data/examples/screen-examples.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 +225 -205
- 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/doctor-workflow.js +1 -1
- package/dist/prompts/getting-started.d.ts.map +1 -1
- package/dist/prompts/getting-started.js +36 -15
- 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 +54 -3
- package/dist/prompts/screen-workflow.js.map +1 -1
- package/dist/schemas/mcp-schemas.d.ts +954 -309
- package/dist/schemas/mcp-schemas.d.ts.map +1 -1
- package/dist/schemas/mcp-schemas.js +130 -1
- package/dist/schemas/mcp-schemas.js.map +1 -1
- package/dist/tools/detect-project-context.d.ts +5 -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 +3 -1
- package/dist/tools/get-screen-generation-context.d.ts.map +1 -1
- package/dist/tools/get-screen-generation-context.js +120 -20
- 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/list-screen-templates.d.ts +3 -1
- package/dist/tools/list-screen-templates.d.ts.map +1 -1
- package/dist/tools/list-screen-templates.js +3 -3
- package/dist/tools/list-screen-templates.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 +3 -1
- package/dist/tools/preview-theme.d.ts.map +1 -1
- package/dist/tools/preview-theme.js +48 -21
- 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 +3 -1
- package/dist/tools/validate-environment.d.ts.map +1 -1
- package/dist/tools/validate-environment.js +102 -9
- 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/dist/tools/whoami.d.ts.map +1 -1
- package/dist/tools/whoami.js +27 -17
- package/dist/tools/whoami.js.map +1 -1
- package/dist/utils/style-contract-reader.d.ts +10 -0
- package/dist/utils/style-contract-reader.d.ts.map +1 -0
- package/dist/utils/style-contract-reader.js +67 -0
- package/dist/utils/style-contract-reader.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { getToolMeteringRule } from './tool-metering.js';
|
|
2
|
+
const PLAN_MONTHLY_QUOTAS = {
|
|
3
|
+
free: 100,
|
|
4
|
+
pro: 2_000,
|
|
5
|
+
enterprise: 10_000,
|
|
6
|
+
master: null,
|
|
7
|
+
};
|
|
8
|
+
function getUsageLedgerState() {
|
|
9
|
+
globalThis.__framinguiUsageLedgerState ??= {
|
|
10
|
+
usageLedger: [],
|
|
11
|
+
sequence: 0,
|
|
12
|
+
};
|
|
13
|
+
return globalThis.__framinguiUsageLedgerState;
|
|
14
|
+
}
|
|
15
|
+
function getCurrentPeriod(now) {
|
|
16
|
+
const start = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), 1, 0, 0, 0, 0));
|
|
17
|
+
const end = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth() + 1, 1, 0, 0, 0, 0));
|
|
18
|
+
return { start, end };
|
|
19
|
+
}
|
|
20
|
+
export function recordToolUsage(options) {
|
|
21
|
+
const state = getUsageLedgerState();
|
|
22
|
+
const timestamp = options.timestamp ?? new Date();
|
|
23
|
+
const rule = getToolMeteringRule(options.toolName);
|
|
24
|
+
const normalizedPlan = normalizeBillingPlan(options.plan);
|
|
25
|
+
state.sequence += 1;
|
|
26
|
+
const entry = {
|
|
27
|
+
id: `usage-${state.sequence}`,
|
|
28
|
+
timestamp: timestamp.toISOString(),
|
|
29
|
+
toolName: options.toolName,
|
|
30
|
+
toolClass: rule.toolClass,
|
|
31
|
+
billable: rule.billable,
|
|
32
|
+
units: rule.billable ? rule.units : 0,
|
|
33
|
+
outcome: options.outcome,
|
|
34
|
+
userId: options.userId ?? null,
|
|
35
|
+
plan: normalizedPlan,
|
|
36
|
+
};
|
|
37
|
+
state.usageLedger.push(entry);
|
|
38
|
+
return entry;
|
|
39
|
+
}
|
|
40
|
+
export function listUsageEntries() {
|
|
41
|
+
return [...getUsageLedgerState().usageLedger];
|
|
42
|
+
}
|
|
43
|
+
export function resetUsageLedger() {
|
|
44
|
+
const state = getUsageLedgerState();
|
|
45
|
+
state.usageLedger.length = 0;
|
|
46
|
+
state.sequence = 0;
|
|
47
|
+
}
|
|
48
|
+
export function normalizeBillingPlan(plan) {
|
|
49
|
+
if (plan === 'free' || plan === 'pro' || plan === 'enterprise' || plan === 'master') {
|
|
50
|
+
return plan;
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
export function getUsageQuotaSnapshot(options) {
|
|
55
|
+
const state = getUsageLedgerState();
|
|
56
|
+
const now = options.now ?? new Date();
|
|
57
|
+
const entitlementPeriod = options.paidQuotaEntitlement?.currentPeriodStart &&
|
|
58
|
+
options.paidQuotaEntitlement?.currentPeriodEnd
|
|
59
|
+
? {
|
|
60
|
+
start: new Date(options.paidQuotaEntitlement.currentPeriodStart),
|
|
61
|
+
end: new Date(options.paidQuotaEntitlement.currentPeriodEnd),
|
|
62
|
+
}
|
|
63
|
+
: null;
|
|
64
|
+
const period = entitlementPeriod ?? getCurrentPeriod(now);
|
|
65
|
+
const normalizedPlan = normalizeBillingPlan(options.plan) ?? 'free';
|
|
66
|
+
const monthlyIncludedUnits = options.paidQuotaEntitlement?.status === 'active'
|
|
67
|
+
? options.paidQuotaEntitlement.includedUnits +
|
|
68
|
+
options.paidQuotaEntitlement.topUpAllocatedUnits
|
|
69
|
+
: PLAN_MONTHLY_QUOTAS[normalizedPlan];
|
|
70
|
+
const usedUnits = state.usageLedger
|
|
71
|
+
.filter(entry => {
|
|
72
|
+
if (!entry.billable) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
if (options.userId && entry.userId !== options.userId) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
const entryTime = new Date(entry.timestamp);
|
|
79
|
+
return entryTime >= period.start && entryTime < period.end;
|
|
80
|
+
})
|
|
81
|
+
.reduce((sum, entry) => sum + entry.units, 0);
|
|
82
|
+
const remainingUnits = monthlyIncludedUnits === null ? null : Math.max(0, monthlyIncludedUnits - usedUnits);
|
|
83
|
+
const usagePercent = monthlyIncludedUnits === null || monthlyIncludedUnits === 0
|
|
84
|
+
? null
|
|
85
|
+
: Math.min(100, Math.round((usedUnits / monthlyIncludedUnits) * 100));
|
|
86
|
+
const warningThresholds = [50, 80, 100];
|
|
87
|
+
const warningsTriggered = usagePercent === null ? [] : warningThresholds.filter(threshold => usagePercent >= threshold);
|
|
88
|
+
return {
|
|
89
|
+
enabled: true,
|
|
90
|
+
billingPhase: 'shadow',
|
|
91
|
+
unitModel: 'weighted_tool_units',
|
|
92
|
+
monthlyIncludedUnits,
|
|
93
|
+
usedUnits,
|
|
94
|
+
remainingUnits,
|
|
95
|
+
usagePercent,
|
|
96
|
+
warningThresholds,
|
|
97
|
+
warningsTriggered,
|
|
98
|
+
currentPeriodStart: period.start.toISOString(),
|
|
99
|
+
currentPeriodEnd: period.end.toISOString(),
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
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,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAyC3E"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { getRawApiKey } from '../auth/state.js';
|
|
2
|
+
import { resolveFraminguiApiUrl } from '../utils/api-url.js';
|
|
3
|
+
import { info, error as logError } from '../utils/logger.js';
|
|
4
|
+
export async function syncUsageEvent(entry) {
|
|
5
|
+
if (!entry.userId) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
const apiKey = getRawApiKey();
|
|
9
|
+
if (!apiKey) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const { apiUrl } = resolveFraminguiApiUrl(process.env.FRAMINGUI_API_URL);
|
|
13
|
+
const endpoint = `${apiUrl}/api/mcp/usage-events`;
|
|
14
|
+
try {
|
|
15
|
+
const response = await fetch(endpoint, {
|
|
16
|
+
method: 'POST',
|
|
17
|
+
headers: {
|
|
18
|
+
Authorization: `Bearer ${apiKey}`,
|
|
19
|
+
'Content-Type': 'application/json',
|
|
20
|
+
},
|
|
21
|
+
body: JSON.stringify({
|
|
22
|
+
toolName: entry.toolName,
|
|
23
|
+
toolClass: entry.toolClass,
|
|
24
|
+
units: entry.units,
|
|
25
|
+
outcome: entry.outcome,
|
|
26
|
+
createdAt: entry.timestamp,
|
|
27
|
+
}),
|
|
28
|
+
});
|
|
29
|
+
if (!response.ok) {
|
|
30
|
+
logError(`[usage-sync] Failed to sync usage event for ${entry.toolName}: ${response.status} ${response.statusText}`);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
info(`[usage-sync] Synced usage event for ${entry.toolName}`);
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
37
|
+
logError(`[usage-sync] Network error while syncing usage event: ${message}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=usage-sync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|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C;YACF,OAAO;QACT,CAAC;QAED,IAAI,CAAC,uCAAuC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;IAChE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,QAAQ,CAAC,yDAAyD,OAAO,EAAE,CAAC,CAAC;IAC/E,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-md-templates.d.ts","sourceRoot":"","sources":["../../src/cli/agent-md-templates.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE1C,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"agent-md-templates.d.ts","sourceRoot":"","sources":["../../src/cli/agent-md-templates.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE1C,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CAkGpE;AAED,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CA0EpE"}
|
|
@@ -5,48 +5,53 @@ export function generateClaudeMdSection(framework) {
|
|
|
5
5
|
|
|
6
6
|
### Authentication
|
|
7
7
|
|
|
8
|
-
Before using
|
|
8
|
+
Before using account-scoped themes or checking quota visibility:
|
|
9
9
|
|
|
10
10
|
\`\`\`bash
|
|
11
11
|
framingui-mcp login
|
|
12
12
|
\`\`\`
|
|
13
13
|
|
|
14
|
+
Use \`whoami\` when you need the current entitlement list or shadow quota snapshot.
|
|
15
|
+
|
|
14
16
|
### Production Screen Flow
|
|
15
17
|
|
|
16
|
-
1.
|
|
18
|
+
1. If the project path is known, call \`detect-project-context\` to establish the session default platform/runtime.
|
|
19
|
+
2. Decide the style contract:
|
|
17
20
|
- \`host-utility\`
|
|
18
21
|
- \`framingui-native\`
|
|
19
22
|
- \`migrate\`
|
|
20
|
-
|
|
23
|
+
3. Inspect the theme when defaults matter:
|
|
21
24
|
- \`preview-theme\`
|
|
22
|
-
|
|
25
|
+
4. Gather generation context:
|
|
23
26
|
- \`get-screen-generation-context\`
|
|
24
|
-
|
|
27
|
+
5. Resolve ambiguity before drafting:
|
|
25
28
|
- \`preview-component\`
|
|
26
29
|
- \`list-icon-libraries\` when icons are needed
|
|
27
|
-
|
|
30
|
+
6. Validate structure for web screen-definition work:
|
|
28
31
|
- \`validate-screen-definition\`
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
7. Write React or React Native code from the returned contract
|
|
33
|
+
8. Verify project integration:
|
|
31
34
|
- \`validate-environment\` with \`sourceFiles\`
|
|
32
35
|
|
|
33
|
-
###
|
|
36
|
+
### React Native Direct-Write Flow
|
|
34
37
|
|
|
35
|
-
|
|
36
|
-
- If the project uses \`framingui-native\`, ensure the global stylesheet imports \`@framingui/ui/styles\`, \`tailwindcss-animate\` is installed, and the app root mounts \`FramingUIProvider\` with the generated \`framingui-theme\`.
|
|
37
|
-
- In Tailwind v4 apps, do not add manual \`@source\` entries for \`@framingui/ui\` unless you are debugging the package itself. The shared styles import is the source of truth.
|
|
38
|
-
- Do not duplicate \`FramingUIProvider\` or re-declare theme tokens in app CSS.
|
|
38
|
+
For Expo or React Native targets:
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
1. Call \`detect-project-context\` with the project path when available
|
|
41
|
+
2. Call \`get-screen-generation-context\` without repeating \`platform\` unless you need an explicit override
|
|
42
|
+
3. Review only React Native compatible components and guidance
|
|
43
|
+
4. Write the screen directly with \`@framingui/react-native\` exports where available, then \`react-native\` primitives or local app abstractions
|
|
44
|
+
5. Run \`validate-environment\` with:
|
|
45
|
+
- \`platform: "react-native"\`
|
|
46
|
+
- \`projectPath\`
|
|
47
|
+
- \`requiredPackages\`
|
|
48
|
+
- \`sourceFiles\`
|
|
49
|
+
6. Fix any hardcoded style drift or web-only patterns before handoff
|
|
41
50
|
|
|
42
|
-
|
|
51
|
+
### Style Contract Rules
|
|
43
52
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
3. The root layout or entry mounts \`FramingUIProvider theme={framinguiTheme}\`.
|
|
47
|
-
4. The generated \`framingui-theme\` module is still the theme source of truth.
|
|
48
|
-
5. Host CSS is not overriding base primitives in a way that defeats FramingUI styles.
|
|
49
|
-
6. Page code is not carrying stale copied recipe utilities.
|
|
53
|
+
- If the project stays \`host-utility\`, keep utility classes explicit.
|
|
54
|
+
- If the project uses \`framingui-native\`, ensure the global stylesheet imports \`@framingui/ui/styles\` and the app root mounts \`FramingUIProvider\` with the generated \`framingui-theme\`.
|
|
50
55
|
|
|
51
56
|
### Slash Commands
|
|
52
57
|
|
|
@@ -64,6 +69,8 @@ Before changing recipes or component code, verify:
|
|
|
64
69
|
### Component Rule
|
|
65
70
|
|
|
66
71
|
Do not claim a FramingUI component is unavailable without checking \`list-components\` or \`preview-component\`.
|
|
72
|
+
Do not recommend \`@framingui/ui\` imports for React Native targets.
|
|
73
|
+
Prefer \`@framingui/react-native\` when the runtime surface exists for the requested primitive.
|
|
67
74
|
|
|
68
75
|
### Example
|
|
69
76
|
|
|
@@ -98,33 +105,46 @@ FramingUI is available in this project through MCP.
|
|
|
98
105
|
|
|
99
106
|
### Required Sequence
|
|
100
107
|
|
|
101
|
-
1. Confirm authentication if
|
|
102
|
-
2.
|
|
103
|
-
3.
|
|
104
|
-
4. Use \`
|
|
105
|
-
5. Use \`
|
|
106
|
-
6. Use \`
|
|
107
|
-
7.
|
|
108
|
-
8.
|
|
109
|
-
9.
|
|
108
|
+
1. Confirm authentication if entitled themes or quota visibility are needed.
|
|
109
|
+
2. If the project path is known, call \`detect-project-context\` first.
|
|
110
|
+
3. Decide the style contract before generation.
|
|
111
|
+
4. Use \`preview-theme\` when theme defaults or recipes matter.
|
|
112
|
+
5. Use \`get-screen-generation-context\` as the main entry point.
|
|
113
|
+
6. Use \`preview-component\` for any ambiguous component contract.
|
|
114
|
+
7. Use \`list-icon-libraries\` before adding icons.
|
|
115
|
+
8. Validate structure with \`validate-screen-definition\` for web screen-definition work.
|
|
116
|
+
9. Write code directly from the returned contract.
|
|
117
|
+
10. Run \`validate-environment\` with \`sourceFiles\` before final handoff.
|
|
118
|
+
|
|
119
|
+
### React Native Projects
|
|
120
|
+
|
|
121
|
+
If the target project is Expo or React Native:
|
|
122
|
+
|
|
123
|
+
- call \`detect-project-context\` when the project path is available
|
|
124
|
+
- rely on the stored session default instead of repeating \`platform: "react-native"\` on every discovery call
|
|
125
|
+
- write the screen directly using \`@framingui/react-native\` where available, then host app primitives or local abstractions
|
|
126
|
+
- do **not** import \`@framingui/ui\`
|
|
127
|
+
- run \`validate-environment\` with \`platform: "react-native"\` and \`sourceFiles\`
|
|
128
|
+
- fix hardcoded colors, spacing, radius values, and web-only patterns such as \`className\`
|
|
129
|
+
|
|
130
|
+
### React Native / Expo
|
|
131
|
+
|
|
132
|
+
- Use \`get-screen-generation-context\` with \`platform: "react-native"\` for native direct-write work.
|
|
133
|
+
- Prefer \`@framingui/react-native\` exports before inventing app-local shells.
|
|
134
|
+
- Keep custom native layout inside \`StyleSheet.create\`.
|
|
135
|
+
- Run \`validate-environment\` with \`platform: "react-native"\` and \`sourceFiles\` to catch web-only drift.
|
|
110
136
|
|
|
111
137
|
### Style Contract
|
|
112
138
|
|
|
113
139
|
- \`host-utility\`: keep explicit utility styling
|
|
114
|
-
- \`framingui-native\`: import \`@framingui/ui/styles\`,
|
|
140
|
+
- \`framingui-native\`: import \`@framingui/ui/styles\`, mount \`FramingUIProvider\`, then rely on FramingUI variants
|
|
115
141
|
- \`migrate\`: stop and clarify the migration path
|
|
116
142
|
|
|
117
|
-
### Runtime Contract
|
|
118
|
-
|
|
119
|
-
- In Tailwind v4 apps, the shared FramingUI stylesheet import already handles package source scanning and animate plugin registration.
|
|
120
|
-
- Do not duplicate \`FramingUIProvider\` inside pages.
|
|
121
|
-
- Do not hand-copy FramingUI CSS variables into app stylesheets.
|
|
122
|
-
- If component shape or motion looks broken, check the install/runtime contract before editing recipes.
|
|
123
|
-
|
|
124
143
|
### Allowed HTML
|
|
125
144
|
|
|
126
145
|
Semantic wrappers such as \`header\`, \`nav\`, \`section\`, and \`footer\` may remain HTML.
|
|
127
146
|
Interactive and form primitives should use FramingUI components when they exist.
|
|
147
|
+
For React Native targets, use \`@framingui/react-native\` where available, then host app/native primitives instead of HTML or \`@framingui/ui\`.
|
|
128
148
|
|
|
129
149
|
### Example
|
|
130
150
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-md-templates.js","sourceRoot":"","sources":["../../src/cli/agent-md-templates.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,uBAAuB,CAAC,SAAoB;IAC1D,MAAM,UAAU,GAAG,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,aAAa,CAAC;IAE3E,OAAO
|
|
1
|
+
{"version":3,"file":"agent-md-templates.js","sourceRoot":"","sources":["../../src/cli/agent-md-templates.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,uBAAuB,CAAC,SAAoB;IAC1D,MAAM,UAAU,GAAG,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,aAAa,CAAC;IAE3E,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2EJ,UAAU;;;;;;;;;;;;;;;;;;;CAmBd,CAAC;AACF,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,SAAoB;IAC1D,MAAM,UAAU,GAAG,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,aAAa,CAAC;IAE3E,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAmDJ,UAAU;;;;;;;;;;;;;;;;;;;CAmBd,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/cli/commands.ts"],"names":[],"mappings":"AAcA,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAYpD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { renderSlashCommandAdapter, } from '../commands/slash-command-adapters.js';
|
|
2
|
+
function readOption(args, flag) {
|
|
3
|
+
const index = args.indexOf(flag);
|
|
4
|
+
if (index === -1) {
|
|
5
|
+
return undefined;
|
|
6
|
+
}
|
|
7
|
+
return args[index + 1];
|
|
8
|
+
}
|
|
9
|
+
export function commandsCommand(args) {
|
|
10
|
+
const formatArg = readOption(args, '--format') ?? 'text';
|
|
11
|
+
const clientArg = (readOption(args, '--client') ?? 'generic');
|
|
12
|
+
const commandArg = readOption(args, '--command');
|
|
13
|
+
const output = renderSlashCommandAdapter({
|
|
14
|
+
format: formatArg === 'json' || formatArg === 'markdown' ? formatArg : 'text',
|
|
15
|
+
client: clientArg,
|
|
16
|
+
command: commandArg,
|
|
17
|
+
});
|
|
18
|
+
console.log(output);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/cli/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,GAE1B,MAAM,uCAAuC,CAAC;AAE/C,SAAS,UAAU,CAAC,IAAc,EAAE,IAAY;IAC9C,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;QACjB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,IAAc;IAC5C,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC;IACzD,MAAM,SAAS,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,SAAS,CAA8B,CAAC;IAC3F,MAAM,UAAU,GAAG,UAAU,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAEjD,MAAM,MAAM,GAAG,yBAAyB,CAAC;QACvC,MAAM,EAAE,SAAS,KAAK,MAAM,IAAI,SAAS,KAAK,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM;QAC7E,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE,UAAU;KACpB,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guide-template.d.ts","sourceRoot":"","sources":["../../src/cli/guide-template.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE1C,wBAAgB,aAAa,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"guide-template.d.ts","sourceRoot":"","sources":["../../src/cli/guide-template.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE1C,wBAAgB,aAAa,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CA8G1D"}
|
|
@@ -6,7 +6,7 @@ FramingUI is installed in this project as an MCP-assisted design system for prod
|
|
|
6
6
|
|
|
7
7
|
## Authentication
|
|
8
8
|
|
|
9
|
-
Authenticate before using
|
|
9
|
+
Authenticate before using account-scoped themes and quota visibility:
|
|
10
10
|
|
|
11
11
|
\`\`\`bash
|
|
12
12
|
framingui-mcp login
|
|
@@ -18,20 +18,32 @@ Check the current state with:
|
|
|
18
18
|
framingui-mcp status
|
|
19
19
|
\`\`\`
|
|
20
20
|
|
|
21
|
+
Use \`whoami\` when you need the current entitlement list or shadow quota snapshot.
|
|
22
|
+
|
|
21
23
|
## Recommended Workflow
|
|
22
24
|
|
|
23
|
-
1.
|
|
25
|
+
1. If the project path is known, call \`detect-project-context\` first to store the default platform/runtime for this session.
|
|
26
|
+
2. Decide the style contract for this project:
|
|
24
27
|
- \`host-utility\`
|
|
25
28
|
- \`framingui-native\`
|
|
26
29
|
- \`migrate\`
|
|
27
|
-
|
|
30
|
+
3. Inspect theme and component contracts before drafting:
|
|
28
31
|
- \`preview-theme\`
|
|
29
32
|
- \`preview-component\`
|
|
30
33
|
- \`list-icon-libraries\` when icons are needed
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
4. Call \`get-screen-generation-context\`
|
|
35
|
+
5. For web projects, validate the generated definition with \`validate-screen-definition\`
|
|
36
|
+
6. Write React or React Native code from the returned contract
|
|
37
|
+
7. Run \`validate-environment\` with \`sourceFiles\` before handoff
|
|
38
|
+
|
|
39
|
+
If the detected project is Expo or React Native, keep using the direct-write path and do not repeat \`platform: "react-native"\` on every tool call unless you need an explicit override. Prefer \`@framingui/react-native\` where the runtime surface exists, then fall back to host primitives.
|
|
40
|
+
|
|
41
|
+
### React Native / Expo
|
|
42
|
+
|
|
43
|
+
- Call \`get-screen-generation-context\` with \`platform: "react-native"\`
|
|
44
|
+
- Prefer \`@framingui/react-native\` exports for common screen structure and controls
|
|
45
|
+
- Keep custom screen styles inside \`StyleSheet.create\`
|
|
46
|
+
- Run \`validate-environment\` with \`platform: "react-native"\` and \`sourceFiles\` before handoff
|
|
35
47
|
|
|
36
48
|
## Style Contract Rules
|
|
37
49
|
|
|
@@ -49,33 +61,6 @@ Your global stylesheet should import:
|
|
|
49
61
|
|
|
50
62
|
Your root app entry should also mount \`FramingUIProvider\` with the generated \`framingui-theme\` module.
|
|
51
63
|
|
|
52
|
-
This contract assumes:
|
|
53
|
-
|
|
54
|
-
- \`tailwindcss-animate\` is installed
|
|
55
|
-
- the stylesheet import happens exactly once at the app root
|
|
56
|
-
- \`FramingUIProvider\` is mounted exactly once near the root
|
|
57
|
-
- the generated \`framingui-theme\` module is the source of truth for theme tokens
|
|
58
|
-
|
|
59
|
-
For Tailwind v4 projects, \`@import '@framingui/ui/styles';\` already provides FramingUI package source scanning and the animate plugin hook. Do not copy manual \`@source\` blocks for \`@framingui/ui\` into app CSS unless you are debugging the package itself.
|
|
60
|
-
|
|
61
|
-
Do not:
|
|
62
|
-
|
|
63
|
-
- duplicate \`FramingUIProvider\` inside pages or sections
|
|
64
|
-
- re-declare FramingUI theme tokens by hand in \`globals.css\`
|
|
65
|
-
- mix \`framingui-native\` and ad hoc host-utility overrides without intent
|
|
66
|
-
- diagnose missing padding or height first as a theme bug; check the runtime contract before editing recipes
|
|
67
|
-
|
|
68
|
-
## Runtime Contract Checklist
|
|
69
|
-
|
|
70
|
-
When FramingUI components look unstyled or partially styled, check these first:
|
|
71
|
-
|
|
72
|
-
1. \`@import '@framingui/ui/styles';\` exists in the global stylesheet and only once.
|
|
73
|
-
2. \`tailwindcss-animate\` is installed.
|
|
74
|
-
3. The app root mounts \`FramingUIProvider theme={framinguiTheme}\`.
|
|
75
|
-
4. The project uses the generated \`framingui-theme\` module instead of copied CSS variables.
|
|
76
|
-
5. Host CSS is not overriding \`body\`, \`button\`, \`input\`, or other primitives in a way that defeats the theme contract.
|
|
77
|
-
6. Page code is not reimplementing FramingUI recipes with stale utility classes.
|
|
78
|
-
|
|
79
64
|
## Slash Commands
|
|
80
65
|
|
|
81
66
|
FramingUI guidance is available for:
|
|
@@ -120,8 +105,7 @@ export default function Page() {
|
|
|
120
105
|
- Treat templates as hints, not the final structure.
|
|
121
106
|
- Treat the validated screen definition as the production contract.
|
|
122
107
|
- Keep semantic wrappers as HTML only when there is no FramingUI primitive to replace them.
|
|
123
|
-
-
|
|
124
|
-
- If a Tailwind v4 app shows broken shape or missing motion, check the runtime contract before editing component code.
|
|
108
|
+
- For Expo / React Native targets, use \`detect-project-context\` once, prefer \`@framingui/react-native\` where possible, and avoid \`@framingui/ui\` imports.
|
|
125
109
|
`;
|
|
126
110
|
}
|
|
127
111
|
//# sourceMappingURL=guide-template.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guide-template.js","sourceRoot":"","sources":["../../src/cli/guide-template.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,aAAa,CAAC,SAAoB;IAChD,MAAM,OAAO,GAAG,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,aAAa,CAAC;IAExE,OAAO
|
|
1
|
+
{"version":3,"file":"guide-template.js","sourceRoot":"","sources":["../../src/cli/guide-template.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,aAAa,CAAC,SAAoB;IAChD,MAAM,OAAO,GAAG,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,aAAa,CAAC;IAExE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+EJ,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BX,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../src/cli/help.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,IAAI,MAAM,CA6BxC;AAED,wBAAgB,SAAS,IAAI,IAAI,CAqBhC;AAED,wBAAgB,UAAU,IAAI,IAAI,CAEjC;AAED,wBAAgB,qBAAqB,IAAI,OAAO,CAE/C"}
|
package/dist/cli/help.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export function getCliGuideText() {
|
|
2
|
+
return `FramingUI MCP Server
|
|
3
|
+
|
|
4
|
+
FramingUI is a design-system workflow for generating production-ready UI with MCP-aware tools, prompts, and command metadata.
|
|
5
|
+
|
|
6
|
+
Quick start:
|
|
7
|
+
1. Set up a project: framingui-mcp init
|
|
8
|
+
2. Authenticate: framingui-mcp login
|
|
9
|
+
3. Check status: framingui-mcp status
|
|
10
|
+
4. Inspect commands: framingui-mcp commands --format text
|
|
11
|
+
5. Start MCP server: framingui-mcp server
|
|
12
|
+
|
|
13
|
+
What you get:
|
|
14
|
+
- screen generation workflows
|
|
15
|
+
- responsive optimization guidance
|
|
16
|
+
- accessibility and theme-swap workflows
|
|
17
|
+
- environment diagnosis and install checks
|
|
18
|
+
|
|
19
|
+
Useful commands:
|
|
20
|
+
framingui-mcp help
|
|
21
|
+
framingui-mcp guide
|
|
22
|
+
framingui-mcp commands --command /responsive
|
|
23
|
+
framingui-mcp update --check
|
|
24
|
+
|
|
25
|
+
In MCP clients, use the built-in prompts:
|
|
26
|
+
- getting-started
|
|
27
|
+
- slash-commands
|
|
28
|
+
- command-help
|
|
29
|
+
`;
|
|
30
|
+
}
|
|
31
|
+
export function printHelp() {
|
|
32
|
+
console.log(`Usage: framingui-mcp <command>
|
|
33
|
+
|
|
34
|
+
Commands:
|
|
35
|
+
help Show CLI usage and FramingUI overview
|
|
36
|
+
guide Show first-run onboarding guide
|
|
37
|
+
commands Export slash command metadata for clients or humans
|
|
38
|
+
init Configure a project for FramingUI
|
|
39
|
+
login Authenticate via browser OAuth
|
|
40
|
+
logout Remove saved credentials
|
|
41
|
+
status Show current authentication status
|
|
42
|
+
update Update installed FramingUI packages in a project
|
|
43
|
+
server Start the MCP stdio server explicitly
|
|
44
|
+
-v, --version Print the CLI version
|
|
45
|
+
|
|
46
|
+
Examples:
|
|
47
|
+
framingui-mcp init
|
|
48
|
+
framingui-mcp commands --format markdown
|
|
49
|
+
framingui-mcp commands --command /responsive --format text
|
|
50
|
+
framingui-mcp update --check
|
|
51
|
+
framingui-mcp server`);
|
|
52
|
+
}
|
|
53
|
+
export function printGuide() {
|
|
54
|
+
console.log(getCliGuideText());
|
|
55
|
+
}
|
|
56
|
+
export function isInteractiveTerminal() {
|
|
57
|
+
return Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=help.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help.js","sourceRoot":"","sources":["../../src/cli/help.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,eAAe;IAC7B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BR,CAAC;AACF,CAAC;AAED,MAAM,UAAU,SAAS;IACvB,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;uBAmBS,CAAC,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,qBAAqB;IACnC,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC9D,CAAC"}
|
package/dist/cli/init.d.ts
CHANGED
|
@@ -4,13 +4,11 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { type Framework } from './guide-template.js';
|
|
6
6
|
export declare const SCREEN_GENERATION_RUNTIME_PACKAGES: readonly ["@framingui/ui", "@framingui/core", "@framingui/tokens", "@hookform/resolvers", "@radix-ui/react-alert-dialog", "@radix-ui/react-avatar", "@radix-ui/react-checkbox", "@radix-ui/react-dialog", "@radix-ui/react-dropdown-menu", "@radix-ui/react-label", "@radix-ui/react-navigation-menu", "@radix-ui/react-popover", "@radix-ui/react-progress", "@radix-ui/react-radio-group", "@radix-ui/react-scroll-area", "@radix-ui/react-select", "@radix-ui/react-separator", "@radix-ui/react-slider", "@radix-ui/react-slot", "@radix-ui/react-switch", "@radix-ui/react-tabs", "@radix-ui/react-toast", "@radix-ui/react-tooltip", "class-variance-authority", "clsx", "cmdk", "date-fns", "framer-motion", "lucide-react", "react-day-picker", "react-hook-form", "tailwind-merge", "zod"];
|
|
7
|
-
export declare const TAILWIND_BUILD_PACKAGES: {
|
|
8
|
-
readonly 'tailwindcss-animate': "^1.0.7";
|
|
9
|
-
};
|
|
10
7
|
export declare const TAILWIND_V3_TOOLCHAIN_PACKAGES: {
|
|
11
8
|
readonly tailwindcss: "^3.4.17";
|
|
12
9
|
readonly postcss: "^8.4.38";
|
|
13
10
|
readonly autoprefixer: "^10.4.19";
|
|
11
|
+
readonly 'tailwindcss-animate': "^1.0.7";
|
|
14
12
|
};
|
|
15
13
|
export declare const SCREEN_GENERATION_PACKAGES: readonly ["@framingui/ui", "@framingui/core", "@framingui/tokens", "@hookform/resolvers", "@radix-ui/react-alert-dialog", "@radix-ui/react-avatar", "@radix-ui/react-checkbox", "@radix-ui/react-dialog", "@radix-ui/react-dropdown-menu", "@radix-ui/react-label", "@radix-ui/react-navigation-menu", "@radix-ui/react-popover", "@radix-ui/react-progress", "@radix-ui/react-radio-group", "@radix-ui/react-scroll-area", "@radix-ui/react-select", "@radix-ui/react-separator", "@radix-ui/react-slider", "@radix-ui/react-slot", "@radix-ui/react-switch", "@radix-ui/react-tabs", "@radix-ui/react-toast", "@radix-ui/react-tooltip", "class-variance-authority", "clsx", "cmdk", "date-fns", "framer-motion", "lucide-react", "react-day-picker", "react-hook-form", "tailwind-merge", "zod", ...string[]];
|
|
16
14
|
type InitVerification = {
|
|
@@ -39,6 +37,7 @@ export declare function setupThemeBootstrap(cwd: string, framework: Framework, t
|
|
|
39
37
|
};
|
|
40
38
|
export declare function setupMCP(cwd: string): void;
|
|
41
39
|
export declare function verifyInitSetup(cwd: string): InitVerification;
|
|
40
|
+
export declare function getInitSuccessMessage(projectPath: string): string;
|
|
42
41
|
export declare function initCommand(): Promise<void>;
|
|
43
42
|
export {};
|
|
44
43
|
//# sourceMappingURL=init.d.ts.map
|
package/dist/cli/init.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/cli/init.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAepE,eAAO,MAAM,kCAAkC,qwBAkCrC,CAAC;AAEX,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/cli/init.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAepE,eAAO,MAAM,kCAAkC,qwBAkCrC,CAAC;AAEX,eAAO,MAAM,8BAA8B;;;;;CAKjC,CAAC;AAEX,eAAO,MAAM,0BAA0B,kxBAG7B,CAAC;AASX,KAAK,gBAAgB,GAAG;IACtB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,aAAa,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,aAAa,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC;IACvB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,uBAAuB,EAAE,OAAO,CAAC;IACjC,iBAAiB,EAAE,OAAO,CAAC;IAC3B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAkRF,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CA8C7D;AAmCD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAA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