@calibrate-ds/cli 0.1.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/dist/__tests__/component-slug.test.d.ts +2 -0
- package/dist/__tests__/component-slug.test.d.ts.map +1 -0
- package/dist/__tests__/component-slug.test.js +54 -0
- package/dist/__tests__/component-slug.test.js.map +1 -0
- package/dist/__tests__/lock-changes.test.d.ts +2 -0
- package/dist/__tests__/lock-changes.test.d.ts.map +1 -0
- package/dist/__tests__/lock-changes.test.js +81 -0
- package/dist/__tests__/lock-changes.test.js.map +1 -0
- package/dist/__tests__/permissions.test.d.ts +2 -0
- package/dist/__tests__/permissions.test.d.ts.map +1 -0
- package/dist/__tests__/permissions.test.js +67 -0
- package/dist/__tests__/permissions.test.js.map +1 -0
- package/dist/__tests__/stamp-in-lock.test.d.ts +2 -0
- package/dist/__tests__/stamp-in-lock.test.d.ts.map +1 -0
- package/dist/__tests__/stamp-in-lock.test.js +102 -0
- package/dist/__tests__/stamp-in-lock.test.js.map +1 -0
- package/dist/__tests__/status-logic.test.d.ts +2 -0
- package/dist/__tests__/status-logic.test.d.ts.map +1 -0
- package/dist/__tests__/status-logic.test.js +74 -0
- package/dist/__tests__/status-logic.test.js.map +1 -0
- package/dist/__tests__/team-roster.test.d.ts +2 -0
- package/dist/__tests__/team-roster.test.d.ts.map +1 -0
- package/dist/__tests__/team-roster.test.js +97 -0
- package/dist/__tests__/team-roster.test.js.map +1 -0
- package/dist/ai/claude-provider.d.ts +13 -0
- package/dist/ai/claude-provider.d.ts.map +1 -0
- package/dist/ai/claude-provider.js +335 -0
- package/dist/ai/claude-provider.js.map +1 -0
- package/dist/ai/enhance-doc.d.ts +24 -0
- package/dist/ai/enhance-doc.d.ts.map +1 -0
- package/dist/ai/enhance-doc.js +272 -0
- package/dist/ai/enhance-doc.js.map +1 -0
- package/dist/ai/openai-provider.d.ts +13 -0
- package/dist/ai/openai-provider.d.ts.map +1 -0
- package/dist/ai/openai-provider.js +345 -0
- package/dist/ai/openai-provider.js.map +1 -0
- package/dist/ai/prompt-utils.d.ts +23 -0
- package/dist/ai/prompt-utils.d.ts.map +1 -0
- package/dist/ai/prompt-utils.js +67 -0
- package/dist/ai/prompt-utils.js.map +1 -0
- package/dist/commands/ai.d.ts +8 -0
- package/dist/commands/ai.d.ts.map +1 -0
- package/dist/commands/ai.js +576 -0
- package/dist/commands/ai.js.map +1 -0
- package/dist/commands/apply.d.ts +4 -0
- package/dist/commands/apply.d.ts.map +1 -0
- package/dist/commands/apply.js +98 -0
- package/dist/commands/apply.js.map +1 -0
- package/dist/commands/assign.d.ts +5 -0
- package/dist/commands/assign.d.ts.map +1 -0
- package/dist/commands/assign.js +180 -0
- package/dist/commands/assign.js.map +1 -0
- package/dist/commands/ci.d.ts +4 -0
- package/dist/commands/ci.d.ts.map +1 -0
- package/dist/commands/ci.js +84 -0
- package/dist/commands/ci.js.map +1 -0
- package/dist/commands/context.d.ts +19 -0
- package/dist/commands/context.d.ts.map +1 -0
- package/dist/commands/context.js +297 -0
- package/dist/commands/context.js.map +1 -0
- package/dist/commands/diff.d.ts +2 -0
- package/dist/commands/diff.d.ts.map +1 -0
- package/dist/commands/diff.js +119 -0
- package/dist/commands/diff.js.map +1 -0
- package/dist/commands/doctor.d.ts +5 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +348 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/document-system.d.ts +5 -0
- package/dist/commands/document-system.d.ts.map +1 -0
- package/dist/commands/document-system.js +84 -0
- package/dist/commands/document-system.js.map +1 -0
- package/dist/commands/document.d.ts +6 -0
- package/dist/commands/document.d.ts.map +1 -0
- package/dist/commands/document.js +276 -0
- package/dist/commands/document.js.map +1 -0
- package/dist/commands/export.d.ts +11 -0
- package/dist/commands/export.d.ts.map +1 -0
- package/dist/commands/export.js +74 -0
- package/dist/commands/export.js.map +1 -0
- package/dist/commands/generate-components.d.ts +4 -0
- package/dist/commands/generate-components.d.ts.map +1 -0
- package/dist/commands/generate-components.js +62 -0
- package/dist/commands/generate-components.js.map +1 -0
- package/dist/commands/generate-composites.d.ts +2 -0
- package/dist/commands/generate-composites.d.ts.map +1 -0
- package/dist/commands/generate-composites.js +31 -0
- package/dist/commands/generate-composites.js.map +1 -0
- package/dist/commands/generate-tokens.d.ts +2 -0
- package/dist/commands/generate-tokens.d.ts.map +1 -0
- package/dist/commands/generate-tokens.js +48 -0
- package/dist/commands/generate-tokens.js.map +1 -0
- package/dist/commands/help-topics.d.ts +2 -0
- package/dist/commands/help-topics.d.ts.map +1 -0
- package/dist/commands/help-topics.js +324 -0
- package/dist/commands/help-topics.js.map +1 -0
- package/dist/commands/implement.d.ts +5 -0
- package/dist/commands/implement.d.ts.map +1 -0
- package/dist/commands/implement.js +595 -0
- package/dist/commands/implement.js.map +1 -0
- package/dist/commands/import-tokens.d.ts +2 -0
- package/dist/commands/import-tokens.d.ts.map +1 -0
- package/dist/commands/import-tokens.js +42 -0
- package/dist/commands/import-tokens.js.map +1 -0
- package/dist/commands/init.d.ts +6 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +410 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/inspect-component.d.ts +2 -0
- package/dist/commands/inspect-component.d.ts.map +1 -0
- package/dist/commands/inspect-component.js +146 -0
- package/dist/commands/inspect-component.js.map +1 -0
- package/dist/commands/log.d.ts +4 -0
- package/dist/commands/log.d.ts.map +1 -0
- package/dist/commands/log.js +109 -0
- package/dist/commands/log.js.map +1 -0
- package/dist/commands/onboarding.d.ts +9 -0
- package/dist/commands/onboarding.d.ts.map +1 -0
- package/dist/commands/onboarding.js +63 -0
- package/dist/commands/onboarding.js.map +1 -0
- package/dist/commands/plan.d.ts +3 -0
- package/dist/commands/plan.d.ts.map +1 -0
- package/dist/commands/plan.js +108 -0
- package/dist/commands/plan.js.map +1 -0
- package/dist/commands/prompt.d.ts +5 -0
- package/dist/commands/prompt.d.ts.map +1 -0
- package/dist/commands/prompt.js +77 -0
- package/dist/commands/prompt.js.map +1 -0
- package/dist/commands/prune.d.ts +2 -0
- package/dist/commands/prune.d.ts.map +1 -0
- package/dist/commands/prune.js +95 -0
- package/dist/commands/prune.js.map +1 -0
- package/dist/commands/remove.d.ts +2 -0
- package/dist/commands/remove.d.ts.map +1 -0
- package/dist/commands/remove.js +76 -0
- package/dist/commands/remove.js.map +1 -0
- package/dist/commands/scaffold.d.ts +2 -0
- package/dist/commands/scaffold.d.ts.map +1 -0
- package/dist/commands/scaffold.js +47 -0
- package/dist/commands/scaffold.js.map +1 -0
- package/dist/commands/scan.d.ts +2 -0
- package/dist/commands/scan.d.ts.map +1 -0
- package/dist/commands/scan.js +91 -0
- package/dist/commands/scan.js.map +1 -0
- package/dist/commands/stamp.d.ts +11 -0
- package/dist/commands/stamp.d.ts.map +1 -0
- package/dist/commands/stamp.js +147 -0
- package/dist/commands/stamp.js.map +1 -0
- package/dist/commands/status.d.ts +7 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +219 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/team.d.ts +7 -0
- package/dist/commands/team.d.ts.map +1 -0
- package/dist/commands/team.js +173 -0
- package/dist/commands/team.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +303 -0
- package/dist/index.js.map +1 -0
- package/dist/onboarding/content.d.ts +39 -0
- package/dist/onboarding/content.d.ts.map +1 -0
- package/dist/onboarding/content.js +82 -0
- package/dist/onboarding/content.js.map +1 -0
- package/dist/utils/component-slug.d.ts +10 -0
- package/dist/utils/component-slug.d.ts.map +1 -0
- package/dist/utils/component-slug.js +13 -0
- package/dist/utils/component-slug.js.map +1 -0
- package/dist/utils/framework-registry.d.ts +41 -0
- package/dist/utils/framework-registry.d.ts.map +1 -0
- package/dist/utils/framework-registry.js +82 -0
- package/dist/utils/framework-registry.js.map +1 -0
- package/dist/utils/gitignore.d.ts +4 -0
- package/dist/utils/gitignore.d.ts.map +1 -0
- package/dist/utils/gitignore.js +67 -0
- package/dist/utils/gitignore.js.map +1 -0
- package/dist/utils/lock-changes.d.ts +14 -0
- package/dist/utils/lock-changes.d.ts.map +1 -0
- package/dist/utils/lock-changes.js +26 -0
- package/dist/utils/lock-changes.js.map +1 -0
- package/dist/utils/logger.d.ts +9 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +32 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/permissions.d.ts +17 -0
- package/dist/utils/permissions.d.ts.map +1 -0
- package/dist/utils/permissions.js +37 -0
- package/dist/utils/permissions.js.map +1 -0
- package/dist/utils/status-logic.d.ts +16 -0
- package/dist/utils/status-logic.d.ts.map +1 -0
- package/dist/utils/status-logic.js +32 -0
- package/dist/utils/status-logic.js.map +1 -0
- package/dist/utils/storybook-setup.d.ts +5 -0
- package/dist/utils/storybook-setup.d.ts.map +1 -0
- package/dist/utils/storybook-setup.js +104 -0
- package/dist/utils/storybook-setup.js.map +1 -0
- package/dist/utils/team-roster.d.ts +35 -0
- package/dist/utils/team-roster.d.ts.map +1 -0
- package/dist/utils/team-roster.js +99 -0
- package/dist/utils/team-roster.js.map +1 -0
- package/package.json +44 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import { createRequire } from "node:module";
|
|
4
|
+
import { registerGenerator, registerAIProvider, MockImplementationProvider, registerDesignToolAdapter, figmaAdapter } from "@calibrate-ds/core";
|
|
5
|
+
const require = createRequire(import.meta.url);
|
|
6
|
+
const { version } = require("../package.json");
|
|
7
|
+
import { ptbReactGenerator } from "@calibrate-ds/generator-react";
|
|
8
|
+
import { createInitCommand } from "./commands/init.js";
|
|
9
|
+
import { scanCommand } from "./commands/scan.js";
|
|
10
|
+
import { diffCommand } from "./commands/diff.js";
|
|
11
|
+
import { importTokensCommand } from "./commands/import-tokens.js";
|
|
12
|
+
import { generateTokensCommand } from "./commands/generate-tokens.js";
|
|
13
|
+
import { generateComponentsCommand } from "./commands/generate-components.js";
|
|
14
|
+
import { contextComponentCommand, contextListCommand, contextResolveCommand, contextOpenCommand } from "./commands/context.js";
|
|
15
|
+
import { planCommand, planImplementCommand } from "./commands/plan.js";
|
|
16
|
+
import { applyCommand } from "./commands/apply.js";
|
|
17
|
+
import { pruneCommand } from "./commands/prune.js";
|
|
18
|
+
import { promptComponentCommand } from "./commands/prompt.js";
|
|
19
|
+
import { implementComponentCommand } from "./commands/implement.js";
|
|
20
|
+
import { exportContextCommand, exportContextComponentCommand } from "./commands/export.js";
|
|
21
|
+
import { learnCommand, flowCommand } from "./commands/onboarding.js";
|
|
22
|
+
import { statusCommand } from "./commands/status.js";
|
|
23
|
+
import { stampComponentCommand } from "./commands/stamp.js";
|
|
24
|
+
import { assignCommand } from "./commands/assign.js";
|
|
25
|
+
import { logCommand } from "./commands/log.js";
|
|
26
|
+
import { joinCommand, teamCommand, teamRoleCommand } from "./commands/team.js";
|
|
27
|
+
import { doctorCommand, doctorComponentCommand, doctorTokensCommand, doctorContextCommand } from "./commands/doctor.js";
|
|
28
|
+
import { aiStatusCommand, aiProvidersCommand, aiListCommand, aiSetupCommand, aiUseCommand, aiRemoveCommand, aiModelCommand } from "./commands/ai.js";
|
|
29
|
+
import { documentComponentCommand } from "./commands/document.js";
|
|
30
|
+
import { documentSystemCommand } from "./commands/document-system.js";
|
|
31
|
+
import { ciSetupCommand } from "./commands/ci.js";
|
|
32
|
+
import { removeCommand } from "./commands/remove.js";
|
|
33
|
+
import { helpCommand } from "./commands/help-topics.js";
|
|
34
|
+
import { ClaudeProvider } from "./ai/claude-provider.js";
|
|
35
|
+
import { OpenAIProvider } from "./ai/openai-provider.js";
|
|
36
|
+
// Register default design tool adapters
|
|
37
|
+
registerDesignToolAdapter(figmaAdapter);
|
|
38
|
+
// Register default generators
|
|
39
|
+
registerGenerator("react", ptbReactGenerator);
|
|
40
|
+
// Register built-in AI providers
|
|
41
|
+
registerAIProvider("mock", () => new MockImplementationProvider());
|
|
42
|
+
registerAIProvider("claude", (apiKey, model) => new ClaudeProvider(apiKey, model));
|
|
43
|
+
registerAIProvider("openai", (apiKey, model) => new OpenAIProvider(apiKey, model));
|
|
44
|
+
const program = new Command();
|
|
45
|
+
program
|
|
46
|
+
.name("ptb")
|
|
47
|
+
.description("Calibrate: Local-first Design System Compiler")
|
|
48
|
+
.version(version)
|
|
49
|
+
.addHelpText("after", `
|
|
50
|
+
Quick Start:
|
|
51
|
+
ptb init Set up ptb.config.json in your project
|
|
52
|
+
ptb scan Fetch the design system snapshot from Figma
|
|
53
|
+
ptb generate-components Scaffold typed React shells from the snapshot
|
|
54
|
+
ptb generate-tokens Generate CSS design tokens
|
|
55
|
+
ptb export context Write .ptb/context/ files for AI IDEs (commit these)
|
|
56
|
+
ptb context component <name> View rich design context for a component
|
|
57
|
+
ptb implement component <name> AI-write a component using design context
|
|
58
|
+
ptb document component <name> Generate MDX docs for a component
|
|
59
|
+
ptb ai setup Connect an AI provider (claude / openai)
|
|
60
|
+
ptb status Check component freshness vs. latest design
|
|
61
|
+
ptb doctor component . Audit health of all components
|
|
62
|
+
|
|
63
|
+
Run 'ptb <command> --help' for sub-command details.
|
|
64
|
+
Run 'ptb guide <topic>' for a focused workflow reference. Topics: setup · context · implement · document · status · team · ai · doctor · ci`);
|
|
65
|
+
program.addCommand(createInitCommand());
|
|
66
|
+
program
|
|
67
|
+
.command("status")
|
|
68
|
+
.description("Check the freshness of implemented components against the latest design context")
|
|
69
|
+
.option("--fail-on-stale", "Exit with code 1 if any component is stale or has errors (for CI)")
|
|
70
|
+
.option("--json", "Output results as JSON")
|
|
71
|
+
.option("--mine", "Show only components assigned to you")
|
|
72
|
+
.option("--team", "Show workload distribution grouped by assignee")
|
|
73
|
+
.action((opts) => statusCommand({ failOnStale: opts.failOnStale, json: opts.json, mine: opts.mine, team: opts.team }));
|
|
74
|
+
const stampProgram = program
|
|
75
|
+
.command("stamp")
|
|
76
|
+
.description("Record that a component has been implemented to match the current design");
|
|
77
|
+
stampProgram
|
|
78
|
+
.command("component <name>")
|
|
79
|
+
.description("Stamp a component as implemented. Use '.' for all components.")
|
|
80
|
+
.option("-m <message>", "Note describing what was implemented or changed")
|
|
81
|
+
.action((name, opts) => stampComponentCommand(name, { m: opts.m }));
|
|
82
|
+
program
|
|
83
|
+
.command("assign <name> [person]")
|
|
84
|
+
.description("Assign a component to a developer. Use '.' for all pending. Defaults to current git user.")
|
|
85
|
+
.option("--clear", "Remove the assignment")
|
|
86
|
+
.action((name, person, opts) => assignCommand(name, { to: person, clear: opts.clear }));
|
|
87
|
+
program
|
|
88
|
+
.command("log")
|
|
89
|
+
.description("Show history of design changes and stamps from git")
|
|
90
|
+
.option("-n <number>", "Number of entries to show (default 30)", parseInt)
|
|
91
|
+
.action((opts) => logCommand({ n: opts.n }));
|
|
92
|
+
program
|
|
93
|
+
.command("join")
|
|
94
|
+
.description("Register yourself in the team roster (ptb-team.json) so others can assign work to you")
|
|
95
|
+
.action(joinCommand);
|
|
96
|
+
const teamProgram = program
|
|
97
|
+
.command("team")
|
|
98
|
+
.description("Show the team roster with stamp counts and assigned workload")
|
|
99
|
+
.action(teamCommand);
|
|
100
|
+
teamProgram
|
|
101
|
+
.command("role <handle> <role>")
|
|
102
|
+
.description("Set a team member's role: lead or member. Only leads can run this.")
|
|
103
|
+
.action(teamRoleCommand);
|
|
104
|
+
program
|
|
105
|
+
.command("learn")
|
|
106
|
+
.description("Rich onboarding walkthrough and troubleshooting for PTB")
|
|
107
|
+
.action(learnCommand);
|
|
108
|
+
const flowProgram = program
|
|
109
|
+
.command("flow")
|
|
110
|
+
.description("Step-by-step action guides for different PTB workflows");
|
|
111
|
+
flowProgram
|
|
112
|
+
.command("direct")
|
|
113
|
+
.description("Checklist for the Direct Fetch workflow (Organization / Enterprise)")
|
|
114
|
+
.action(() => flowCommand("direct"));
|
|
115
|
+
flowProgram
|
|
116
|
+
.command("plugin")
|
|
117
|
+
.description("Checklist for the Plugin Export workflow (Figma Pro — requires Calibrate plugin)")
|
|
118
|
+
.action(() => flowCommand("plugin"));
|
|
119
|
+
program
|
|
120
|
+
.command("import-tokens <path>")
|
|
121
|
+
.description("Import a PTB-friendly token JSON export into the local project")
|
|
122
|
+
.action(importTokensCommand);
|
|
123
|
+
program
|
|
124
|
+
.command("diff")
|
|
125
|
+
.description("Show design changes not yet stamped. Uses stamp baseline when available so changes are never lost across multiple scans.")
|
|
126
|
+
.action(diffCommand);
|
|
127
|
+
const planProgram = program
|
|
128
|
+
.command("plan")
|
|
129
|
+
.description("Plan likely affected generated files based on design changes from the previous snapshot")
|
|
130
|
+
.action(planCommand);
|
|
131
|
+
planProgram
|
|
132
|
+
.command("implement <name>")
|
|
133
|
+
.description("Plan the implementation order and readiness for a specific component")
|
|
134
|
+
.action(planImplementCommand);
|
|
135
|
+
program
|
|
136
|
+
.command("apply")
|
|
137
|
+
.description("Safely regenerate only the generated files affected by design changes")
|
|
138
|
+
.option("-p, --prune", "Remove stale generated component folders during apply")
|
|
139
|
+
.action(applyCommand);
|
|
140
|
+
program
|
|
141
|
+
.command("prune")
|
|
142
|
+
.description("Remove stale generated component folders that are no longer in the design system")
|
|
143
|
+
.action(pruneCommand);
|
|
144
|
+
const ciProgram = program
|
|
145
|
+
.command("ci")
|
|
146
|
+
.description("CI/CD integration utilities");
|
|
147
|
+
ciProgram
|
|
148
|
+
.command("setup")
|
|
149
|
+
.description("Generate a GitHub Actions workflow that checks PTB component freshness on every PR")
|
|
150
|
+
.option("--force", "Overwrite an existing ptb.yml workflow file")
|
|
151
|
+
.action((opts) => ciSetupCommand({ force: opts.force }));
|
|
152
|
+
program
|
|
153
|
+
.command("scan")
|
|
154
|
+
.description("Scan the Figma design system and save the raw model")
|
|
155
|
+
.action(scanCommand);
|
|
156
|
+
program
|
|
157
|
+
.command("generate-tokens")
|
|
158
|
+
.description("Deterministically scaffold design system tokens based on current snapshot model variables")
|
|
159
|
+
.action(generateTokensCommand);
|
|
160
|
+
program
|
|
161
|
+
.command("generate-components [name]")
|
|
162
|
+
.description("Scaffold typed React components. Use '.' for all, or provide a component name.")
|
|
163
|
+
.option("--force", "Overwrite existing files")
|
|
164
|
+
.action(generateComponentsCommand);
|
|
165
|
+
// Clean subcommand aliases: ptb generate components / ptb generate tokens
|
|
166
|
+
const generateProgram = program
|
|
167
|
+
.command("generate")
|
|
168
|
+
.description("Generate design system artifacts from the latest snapshot");
|
|
169
|
+
generateProgram
|
|
170
|
+
.command("components [name]")
|
|
171
|
+
.description("Scaffold typed components (alias for generate-components). Use '.' for all.")
|
|
172
|
+
.option("--force", "Overwrite existing files")
|
|
173
|
+
.action(generateComponentsCommand);
|
|
174
|
+
generateProgram
|
|
175
|
+
.command("tokens")
|
|
176
|
+
.description("Scaffold design tokens (alias for generate-tokens)")
|
|
177
|
+
.action(generateTokensCommand);
|
|
178
|
+
// NEW: Context Command
|
|
179
|
+
const contextProgram = program
|
|
180
|
+
.command("context")
|
|
181
|
+
.description("Query design system context e.g. ptb context component Button or ptb context component .");
|
|
182
|
+
contextProgram
|
|
183
|
+
.command("component <name>")
|
|
184
|
+
.description("Retrieve rich context for a component. Use '.' for a summary of all components. e.g. ptb context component Button")
|
|
185
|
+
.option("--json", "Output results in clean, structured JSON")
|
|
186
|
+
.action(contextComponentCommand);
|
|
187
|
+
contextProgram
|
|
188
|
+
.command("list")
|
|
189
|
+
.description("List all exported component context files")
|
|
190
|
+
.action(contextListCommand);
|
|
191
|
+
contextProgram
|
|
192
|
+
.command("resolve <query>")
|
|
193
|
+
.description("Resolve a component query to its context file")
|
|
194
|
+
.action(contextResolveCommand);
|
|
195
|
+
contextProgram
|
|
196
|
+
.command("open <query>")
|
|
197
|
+
.description("Resolve a component and print ONLY the context file path")
|
|
198
|
+
.action(contextOpenCommand);
|
|
199
|
+
// NEW: Prompt Command
|
|
200
|
+
const promptProgram = program
|
|
201
|
+
.command("prompt")
|
|
202
|
+
.description("Generate AI implementation prompts from design context");
|
|
203
|
+
promptProgram
|
|
204
|
+
.command("component <name>")
|
|
205
|
+
.description("Generate an AI-ready implementation prompt for a specific component")
|
|
206
|
+
.option("-f, --framework <name>", "Target framework for the prompt (e.g. react, vue, flutter)")
|
|
207
|
+
.option("--format <format>", "Output format: text (default) or json")
|
|
208
|
+
.action(promptComponentCommand);
|
|
209
|
+
// NEW: Implement Command
|
|
210
|
+
const implementProgram = program
|
|
211
|
+
.command("implement")
|
|
212
|
+
.description("AI-write components from design context e.g. ptb implement component Button");
|
|
213
|
+
implementProgram
|
|
214
|
+
.command("component <name>")
|
|
215
|
+
.description("Implement a component using AI. Use '.' for all. e.g. ptb implement component Button")
|
|
216
|
+
.option("-f, --framework <name>", "Target framework (e.g. react, vue, flutter)")
|
|
217
|
+
.option("--force", "Overwrite existing files")
|
|
218
|
+
.action(implementComponentCommand);
|
|
219
|
+
// NEW: Export Command
|
|
220
|
+
const exportProgram = program
|
|
221
|
+
.command("export")
|
|
222
|
+
.description("Export design system artifacts for external tools");
|
|
223
|
+
const exportContextProgram = exportProgram
|
|
224
|
+
.command("context")
|
|
225
|
+
.description("Write .ptb/context/ files for AI IDEs — run this after scan so AI can read component intent e.g. ptb export context")
|
|
226
|
+
.action(exportContextCommand);
|
|
227
|
+
exportContextProgram
|
|
228
|
+
.command("component <name>")
|
|
229
|
+
.description("Export context for a specific component")
|
|
230
|
+
.action(exportContextComponentCommand);
|
|
231
|
+
// Doctor Command
|
|
232
|
+
const doctorProgram = program
|
|
233
|
+
.command("doctor")
|
|
234
|
+
.description("Audit the health of your design system and component context richness")
|
|
235
|
+
.action(doctorCommand);
|
|
236
|
+
doctorProgram
|
|
237
|
+
.command("component <name>")
|
|
238
|
+
.description("Deep health audit for a component. Use '.' for all components scorecard.")
|
|
239
|
+
.action(doctorComponentCommand);
|
|
240
|
+
doctorProgram
|
|
241
|
+
.command("context <name>")
|
|
242
|
+
.description("Score context quality for AI IDEs. Use '.' for all components.")
|
|
243
|
+
.action(doctorContextCommand);
|
|
244
|
+
doctorProgram
|
|
245
|
+
.command("tokens")
|
|
246
|
+
.description("Check token coverage and resolution across the design system")
|
|
247
|
+
.action(doctorTokensCommand);
|
|
248
|
+
// AI Command
|
|
249
|
+
const aiProgram = program
|
|
250
|
+
.command("ai")
|
|
251
|
+
.description("Manage AI provider configuration and verify setup")
|
|
252
|
+
.action(aiStatusCommand);
|
|
253
|
+
aiProgram
|
|
254
|
+
.command("list")
|
|
255
|
+
.description("List all saved AI providers and which is active")
|
|
256
|
+
.action(aiListCommand);
|
|
257
|
+
aiProgram
|
|
258
|
+
.command("providers")
|
|
259
|
+
.description("Alias for 'ai list'")
|
|
260
|
+
.action(aiProvidersCommand);
|
|
261
|
+
aiProgram
|
|
262
|
+
.command("use <provider>")
|
|
263
|
+
.description("Switch the active AI provider")
|
|
264
|
+
.action(aiUseCommand);
|
|
265
|
+
aiProgram
|
|
266
|
+
.command("setup")
|
|
267
|
+
.description("Add or reconfigure an AI provider interactively")
|
|
268
|
+
.action(aiSetupCommand);
|
|
269
|
+
aiProgram
|
|
270
|
+
.command("remove <provider>")
|
|
271
|
+
.description("Remove a saved AI provider config")
|
|
272
|
+
.action(aiRemoveCommand);
|
|
273
|
+
aiProgram
|
|
274
|
+
.command("model [model-id]")
|
|
275
|
+
.description("Change the model for the active provider (interactive if no model-id given)")
|
|
276
|
+
.action(aiModelCommand);
|
|
277
|
+
// Document Command
|
|
278
|
+
const documentProgram = program
|
|
279
|
+
.command("document")
|
|
280
|
+
.description("Generate MDX docs and Storybook stories e.g. ptb document component Button or ptb document system");
|
|
281
|
+
documentProgram
|
|
282
|
+
.command("component <name>")
|
|
283
|
+
.description("Generate docs for a component. Use '.' for all components.")
|
|
284
|
+
.option("--force", "Overwrite existing docs")
|
|
285
|
+
.option("--no-ai", "Skip AI prose enhancement, output deterministic tables only")
|
|
286
|
+
.option("--format <format>", "Skip prompt: mdx | stories | both")
|
|
287
|
+
.action(documentComponentCommand);
|
|
288
|
+
documentProgram
|
|
289
|
+
.command("system")
|
|
290
|
+
.description("Generate CLAUDE.md and components.md at the DS package root")
|
|
291
|
+
.option("--force", "Overwrite existing files")
|
|
292
|
+
.option("--no-ai", "Skip AI intent map generation")
|
|
293
|
+
.action(documentSystemCommand);
|
|
294
|
+
program
|
|
295
|
+
.command("remove")
|
|
296
|
+
.description("Remove all PTB configuration and metadata from this project")
|
|
297
|
+
.action(removeCommand);
|
|
298
|
+
program
|
|
299
|
+
.command("guide [topic]")
|
|
300
|
+
.description("Detailed workflow guide for a feature area. Topics: setup, context, implement, document, status, team, ai, doctor, ci")
|
|
301
|
+
.action((topic) => helpCommand(topic));
|
|
302
|
+
program.parse(process.argv);
|
|
303
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEhJ,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAwB,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE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C,qBAAqB,CAAC,CAAC;AAEnC,OAAO;KACF,OAAO,CAAC,QAAQ,CAAC;KACjB,WAAW,CAAC,6DAA6D,CAAC;KAC1E,MAAM,CAAC,aAAa,CAAC,CAAC;AAE3B,OAAO;KACF,OAAO,CAAC,eAAe,CAAC;KACxB,WAAW,CAAC,uHAAuH,CAAC;KACpI,MAAM,CAAC,CAAC,KAAc,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;AAEpD,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export declare const LEARN_CONTENT: {
|
|
2
|
+
intro: {
|
|
3
|
+
title: string;
|
|
4
|
+
description: string;
|
|
5
|
+
};
|
|
6
|
+
prerequisites: {
|
|
7
|
+
item: string;
|
|
8
|
+
detail: string;
|
|
9
|
+
}[];
|
|
10
|
+
workflowOverview: string[];
|
|
11
|
+
pluginWorkflow: string[];
|
|
12
|
+
directWorkflow: string[];
|
|
13
|
+
tokenImport: {
|
|
14
|
+
description: string;
|
|
15
|
+
manualCommand: string;
|
|
16
|
+
pluginPath: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export declare const FLOW_DIRECT: {
|
|
20
|
+
before: string;
|
|
21
|
+
steps: {
|
|
22
|
+
step: number;
|
|
23
|
+
action: string;
|
|
24
|
+
command: string;
|
|
25
|
+
}[];
|
|
26
|
+
};
|
|
27
|
+
export declare const FLOW_PLUGIN: {
|
|
28
|
+
before: string;
|
|
29
|
+
steps: {
|
|
30
|
+
step: number;
|
|
31
|
+
action: string;
|
|
32
|
+
command: string;
|
|
33
|
+
}[];
|
|
34
|
+
};
|
|
35
|
+
export declare const TROUBLESHOOTING: {
|
|
36
|
+
issue: string;
|
|
37
|
+
fix: string;
|
|
38
|
+
}[];
|
|
39
|
+
//# sourceMappingURL=content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../src/onboarding/content.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;CAqCzB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;CASvB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;CAUvB,CAAC;AAEF,eAAO,MAAM,eAAe;;;GAqB3B,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export const LEARN_CONTENT = {
|
|
2
|
+
intro: {
|
|
3
|
+
title: "Welcome to Calibrate",
|
|
4
|
+
description: "PTB is a local-first design system compiler that bridges the gap between Figma and your codebase. It scans your Figma designs, builds a rich design system model, and exports AI-ready context for seamless implementation."
|
|
5
|
+
},
|
|
6
|
+
prerequisites: [
|
|
7
|
+
{ item: "PTB CLI", detail: "Installed and linked globally" },
|
|
8
|
+
{ item: "Figma Personal Access Token", detail: "Generate one in your Figma Account Settings" },
|
|
9
|
+
{ item: "Figma File Key", detail: "In a URL like figma.com/design/\x1b[1m<FILE_KEY>\x1b[0m/..., use the \x1b[1m<FILE_KEY>\x1b[0m part" },
|
|
10
|
+
{ item: "Calibrate (Figma plugin)", detail: "Required for the Plugin Export Workflow (Figma Pro). Install from the Figma plugin marketplace." }
|
|
11
|
+
],
|
|
12
|
+
workflowOverview: [
|
|
13
|
+
"Initialize your project: \x1b[1mptb init\x1b[0m",
|
|
14
|
+
"Scan your Figma design: \x1b[1mptb scan\x1b[0m",
|
|
15
|
+
"Export AI-ready context: \x1b[1mptb export context\x1b[0m",
|
|
16
|
+
"List available components: \x1b[1mptb context list\x1b[0m",
|
|
17
|
+
"Resolve a specific component: \x1b[1mptb context resolve <component>\x1b[0m"
|
|
18
|
+
],
|
|
19
|
+
pluginWorkflow: [
|
|
20
|
+
"Use the Calibrate Figma plugin to export variables/tokens.",
|
|
21
|
+
"Save the export to: \x1b[1m.ptb/imported-tokens.json\x1b[0m",
|
|
22
|
+
"Or use: \x1b[1mptb import-tokens <path>\x1b[0m",
|
|
23
|
+
"Run \x1b[1mptb scan\x1b[0m to sync design changes.",
|
|
24
|
+
"Run \x1b[1mptb apply\x1b[0m to regenerate affected code."
|
|
25
|
+
],
|
|
26
|
+
directWorkflow: [
|
|
27
|
+
"Note: No Figma plugin is required for this mode.",
|
|
28
|
+
"PTB fetches the needed design/token data directly from the Figma API.",
|
|
29
|
+
"Run \x1b[1mptb scan\x1b[0m to fetch and sync Figma state.",
|
|
30
|
+
"Run \x1b[1mptb apply\x1b[0m to update your local UI library.",
|
|
31
|
+
"Use \x1b[1mptb diff\x1b[0m to inspect incoming design changes."
|
|
32
|
+
],
|
|
33
|
+
tokenImport: {
|
|
34
|
+
description: "PTB favors a deterministic token pipeline. Use the Calibrate Figma plugin to export design tokens directly if you are on Figma Pro.",
|
|
35
|
+
manualCommand: "ptb import-tokens <path/to/tokens.json>",
|
|
36
|
+
pluginPath: ".ptb/imported-tokens.json"
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
export const FLOW_DIRECT = {
|
|
40
|
+
before: "Setup: Direct Fetch Workflow (Organization / Enterprise). No plugin required.",
|
|
41
|
+
steps: [
|
|
42
|
+
{ step: 1, action: "Run \x1b[1mptb init\x1b[0m to set up your configuration.", command: "ptb init" },
|
|
43
|
+
{ step: 2, action: "Run \x1b[1mptb scan\x1b[0m to fetch design data via API.", command: "ptb scan" },
|
|
44
|
+
{ step: 3, action: "Run \x1b[1mptb export context\x1b[0m to generate AI-ready JSON files.", command: "ptb export context" },
|
|
45
|
+
{ step: 4, action: "Use \x1b[1mptb context list\x1b[0m to see what was exported.", command: "ptb context list" },
|
|
46
|
+
{ step: 5, action: "Feed context files to your AI IDE for implementation.", command: "ptb context resolve <name>" }
|
|
47
|
+
]
|
|
48
|
+
};
|
|
49
|
+
export const FLOW_PLUGIN = {
|
|
50
|
+
before: "Setup: Plugin Export Workflow (Figma Pro). Requires the Calibrate Figma plugin.",
|
|
51
|
+
steps: [
|
|
52
|
+
{ step: 1, action: "Install the \x1b[1mCalibrate\x1b[0m plugin from the Figma marketplace.", command: "Figma Plugin Marketplace" },
|
|
53
|
+
{ step: 2, action: "Export tokens from Figma using Calibrate.", command: "Figma → Calibrate → Export" },
|
|
54
|
+
{ step: 3, action: "Place the export at \x1b[1m.ptb/imported-tokens.json\x1b[0m.", command: "ptb import-tokens <path>" },
|
|
55
|
+
{ step: 4, action: "Run \x1b[1mptb scan\x1b[0m to sync Figma state.", command: "ptb scan" },
|
|
56
|
+
{ step: 5, action: "Run \x1b[1mptb apply\x1b[0m to update your local UI library.", command: "ptb apply" },
|
|
57
|
+
{ step: 6, action: "Use \x1b[1mptb diff\x1b[0m to inspect incoming design changes.", command: "ptb diff" }
|
|
58
|
+
]
|
|
59
|
+
};
|
|
60
|
+
export const TROUBLESHOOTING = [
|
|
61
|
+
{
|
|
62
|
+
issue: "ptb.config.json missing",
|
|
63
|
+
fix: "Run \x1b[1mptb init\x1b[0m to generate a base configuration."
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
issue: "imported tokens missing",
|
|
67
|
+
fix: "Ensure tokens are at \x1b[1m.ptb/imported-tokens.json\x1b[0m or run \x1b[1mptb import-tokens <path>\x1b[0m."
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
issue: "latest snapshot missing",
|
|
71
|
+
fix: "You need to run \x1b[1mptb scan\x1b[0m at least once to create a local design snapshot."
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
issue: "context files not exported yet",
|
|
75
|
+
fix: "Run \x1b[1mptb export context\x1b[0m to generate the JSON files used by list/resolve commands."
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
issue: "CLI command not found",
|
|
79
|
+
fix: "Ensure you have the latest version installed and linked:\n \x1b[1mpnpm --filter @calibrate-ds/cli link --global\x1b[0m"
|
|
80
|
+
}
|
|
81
|
+
];
|
|
82
|
+
//# sourceMappingURL=content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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|
|
2
|
+
export declare function toComponentSlug(name: string): string;
|
|
3
|
+
/**
|
|
4
|
+
* Find the ptb.lock key matching a name (by slug or display name).
|
|
5
|
+
* Returns undefined when no component matches.
|
|
6
|
+
*/
|
|
7
|
+
export declare function findComponentSlug(name: string, components: Record<string, {
|
|
8
|
+
displayName: string;
|
|
9
|
+
}>): string | undefined;
|
|
10
|
+
//# sourceMappingURL=component-slug.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-slug.d.ts","sourceRoot":"","sources":["../../src/utils/component-slug.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC7B,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,GACpD,MAAM,GAAG,SAAS,CAKpB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Normalize a component name or display name into a ptb.lock slug. */
|
|
2
|
+
export function toComponentSlug(name) {
|
|
3
|
+
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Find the ptb.lock key matching a name (by slug or display name).
|
|
7
|
+
* Returns undefined when no component matches.
|
|
8
|
+
*/
|
|
9
|
+
export function findComponentSlug(name, components) {
|
|
10
|
+
const slug = toComponentSlug(name);
|
|
11
|
+
return Object.keys(components).find(k => k === slug || components[k].displayName.toLowerCase() === name.toLowerCase());
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=component-slug.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-slug.js","sourceRoot":"","sources":["../../src/utils/component-slug.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,MAAM,UAAU,eAAe,CAAC,IAAY;IACxC,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AAClF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAC7B,IAAY,EACZ,UAAmD;IAEnD,MAAM,IAAI,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IACnC,OAAO,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAC/B,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,WAAW,EAAE,KAAK,IAAI,CAAC,WAAW,EAAE,CACpF,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework registry — single source of truth for every framework PTB knows about.
|
|
3
|
+
* Adding a new framework: add one entry to FRAMEWORKS, everything else adapts.
|
|
4
|
+
*/
|
|
5
|
+
export type FrameworkId = "react" | "vue" | "svelte" | "react-native";
|
|
6
|
+
export type FrameworkDefinition = {
|
|
7
|
+
/** Stable identifier used in ptb.config.json */
|
|
8
|
+
id: FrameworkId;
|
|
9
|
+
displayName: string;
|
|
10
|
+
/** Any of these deps in a package.json → this framework is detected */
|
|
11
|
+
detectionDeps: string[];
|
|
12
|
+
/** Runtime deps for a new component library package */
|
|
13
|
+
runtimeDeps: string[];
|
|
14
|
+
/** Dev deps for a new component library package */
|
|
15
|
+
devDeps: string[];
|
|
16
|
+
/** Peer deps to declare in the library's package.json */
|
|
17
|
+
peerDeps: string[];
|
|
18
|
+
/** Storybook framework packages — null means no web Storybook support */
|
|
19
|
+
storybookVite: string | null;
|
|
20
|
+
storybookWebpack: string | null;
|
|
21
|
+
/** Source file extension for generated components */
|
|
22
|
+
fileExtension: string;
|
|
23
|
+
/** tsconfig jsx setting — undefined means no jsx needed */
|
|
24
|
+
tsconfigJsx?: string;
|
|
25
|
+
/** Whether a PTB code generator exists for this framework */
|
|
26
|
+
hasGenerator: boolean;
|
|
27
|
+
};
|
|
28
|
+
export declare const FRAMEWORKS: Record<FrameworkId, FrameworkDefinition>;
|
|
29
|
+
export declare const FRAMEWORK_LIST: FrameworkDefinition[];
|
|
30
|
+
export declare function getFramework(id: string): FrameworkDefinition | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Detect framework from a merged deps object.
|
|
33
|
+
* react-native is checked first because RN packages also include "react".
|
|
34
|
+
*/
|
|
35
|
+
export declare function detectFrameworkFromDeps(deps: Record<string, string>): FrameworkDefinition | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Return the right Storybook framework package given a bundler.
|
|
38
|
+
* Returns null if the framework has no web Storybook support (e.g. React Native).
|
|
39
|
+
*/
|
|
40
|
+
export declare function storybookPackageFor(fw: FrameworkDefinition, bundler: "vite" | "webpack"): string | null;
|
|
41
|
+
//# sourceMappingURL=framework-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framework-registry.d.ts","sourceRoot":"","sources":["../../src/utils/framework-registry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,cAAc,CAAC;AAEtE,MAAM,MAAM,mBAAmB,GAAG;IAC9B,gDAAgD;IAChD,EAAE,EAAE,WAAW,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,uEAAuE;IACvE,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,uDAAuD;IACvD,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,mDAAmD;IACnD,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,yDAAyD;IACzD,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,yEAAyE;IACzE,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,qDAAqD;IACrD,aAAa,EAAE,MAAM,CAAC;IACtB,2DAA2D;IAC3D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6DAA6D;IAC7D,YAAY,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,WAAW,EAAE,mBAAmB,CAoD/D,CAAC;AAEF,eAAO,MAAM,cAAc,uBAA4B,CAAC;AAExD,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAExE;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACnC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC7B,mBAAmB,GAAG,SAAS,CAOjC;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAC/B,EAAE,EAAE,mBAAmB,EACvB,OAAO,EAAE,MAAM,GAAG,SAAS,GAC5B,MAAM,GAAG,IAAI,CAEf"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework registry — single source of truth for every framework PTB knows about.
|
|
3
|
+
* Adding a new framework: add one entry to FRAMEWORKS, everything else adapts.
|
|
4
|
+
*/
|
|
5
|
+
export const FRAMEWORKS = {
|
|
6
|
+
react: {
|
|
7
|
+
id: "react",
|
|
8
|
+
displayName: "React",
|
|
9
|
+
detectionDeps: ["react"],
|
|
10
|
+
runtimeDeps: ["react", "react-dom"],
|
|
11
|
+
devDeps: ["@types/react", "@types/react-dom", "typescript"],
|
|
12
|
+
peerDeps: ["react", "react-dom"],
|
|
13
|
+
storybookVite: "@storybook/react-vite",
|
|
14
|
+
storybookWebpack: "@storybook/react-webpack5",
|
|
15
|
+
fileExtension: "tsx",
|
|
16
|
+
tsconfigJsx: "react-jsx",
|
|
17
|
+
hasGenerator: true,
|
|
18
|
+
},
|
|
19
|
+
vue: {
|
|
20
|
+
id: "vue",
|
|
21
|
+
displayName: "Vue 3",
|
|
22
|
+
detectionDeps: ["vue"],
|
|
23
|
+
runtimeDeps: ["vue"],
|
|
24
|
+
devDeps: ["@vue/tsconfig", "typescript", "vue-tsc"],
|
|
25
|
+
peerDeps: ["vue"],
|
|
26
|
+
storybookVite: "@storybook/vue3-vite",
|
|
27
|
+
storybookWebpack: null,
|
|
28
|
+
fileExtension: "vue",
|
|
29
|
+
hasGenerator: false,
|
|
30
|
+
},
|
|
31
|
+
svelte: {
|
|
32
|
+
id: "svelte",
|
|
33
|
+
displayName: "Svelte",
|
|
34
|
+
detectionDeps: ["svelte"],
|
|
35
|
+
runtimeDeps: ["svelte"],
|
|
36
|
+
devDeps: ["@sveltejs/vite-plugin-svelte", "svelte-check", "typescript"],
|
|
37
|
+
peerDeps: ["svelte"],
|
|
38
|
+
storybookVite: "@storybook/svelte-vite",
|
|
39
|
+
storybookWebpack: null,
|
|
40
|
+
fileExtension: "svelte",
|
|
41
|
+
hasGenerator: false,
|
|
42
|
+
},
|
|
43
|
+
"react-native": {
|
|
44
|
+
id: "react-native",
|
|
45
|
+
displayName: "React Native",
|
|
46
|
+
// Check react-native before react since RN projects also have "react"
|
|
47
|
+
detectionDeps: ["react-native"],
|
|
48
|
+
runtimeDeps: ["react", "react-native"],
|
|
49
|
+
devDeps: ["@types/react", "@types/react-native", "typescript"],
|
|
50
|
+
peerDeps: ["react", "react-native"],
|
|
51
|
+
storybookVite: null,
|
|
52
|
+
storybookWebpack: null,
|
|
53
|
+
fileExtension: "tsx",
|
|
54
|
+
tsconfigJsx: "react-native",
|
|
55
|
+
hasGenerator: false,
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
export const FRAMEWORK_LIST = Object.values(FRAMEWORKS);
|
|
59
|
+
export function getFramework(id) {
|
|
60
|
+
return FRAMEWORKS[id];
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Detect framework from a merged deps object.
|
|
64
|
+
* react-native is checked first because RN packages also include "react".
|
|
65
|
+
*/
|
|
66
|
+
export function detectFrameworkFromDeps(deps) {
|
|
67
|
+
const order = ["react-native", "react", "vue", "svelte"];
|
|
68
|
+
for (const id of order) {
|
|
69
|
+
const fw = FRAMEWORKS[id];
|
|
70
|
+
if (fw.detectionDeps.some(dep => dep in deps))
|
|
71
|
+
return fw;
|
|
72
|
+
}
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Return the right Storybook framework package given a bundler.
|
|
77
|
+
* Returns null if the framework has no web Storybook support (e.g. React Native).
|
|
78
|
+
*/
|
|
79
|
+
export function storybookPackageFor(fw, bundler) {
|
|
80
|
+
return bundler === "vite" ? fw.storybookVite : fw.storybookWebpack;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=framework-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framework-registry.js","sourceRoot":"","sources":["../../src/utils/framework-registry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA2BH,MAAM,CAAC,MAAM,UAAU,GAA6C;IAChE,KAAK,EAAE;QACH,EAAE,EAAE,OAAO;QACX,WAAW,EAAE,OAAO;QACpB,aAAa,EAAE,CAAC,OAAO,CAAC;QACxB,WAAW,EAAE,CAAC,OAAO,EAAE,WAAW,CAAC;QACnC,OAAO,EAAE,CAAC,cAAc,EAAE,kBAAkB,EAAE,YAAY,CAAC;QAC3D,QAAQ,EAAE,CAAC,OAAO,EAAE,WAAW,CAAC;QAChC,aAAa,EAAE,uBAAuB;QACtC,gBAAgB,EAAE,2BAA2B;QAC7C,aAAa,EAAE,KAAK;QACpB,WAAW,EAAE,WAAW;QACxB,YAAY,EAAE,IAAI;KACrB;IACD,GAAG,EAAE;QACD,EAAE,EAAE,KAAK;QACT,WAAW,EAAE,OAAO;QACpB,aAAa,EAAE,CAAC,KAAK,CAAC;QACtB,WAAW,EAAE,CAAC,KAAK,CAAC;QACpB,OAAO,EAAE,CAAC,eAAe,EAAE,YAAY,EAAE,SAAS,CAAC;QACnD,QAAQ,EAAE,C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