@vetala/vetala 0.1.0-beta
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.
Potentially problematic release.
This version of @vetala/vetala might be problematic. Click here for more details.
- package/CONTRIBUTING.md +77 -0
- package/LICENSE +184 -0
- package/README.md +136 -0
- package/THIRD_PARTY_LICENSES.md +17 -0
- package/dist/src/agent.d.ts +30 -0
- package/dist/src/agent.js +216 -0
- package/dist/src/agent.js.map +1 -0
- package/dist/src/approvals.d.ts +18 -0
- package/dist/src/approvals.js +81 -0
- package/dist/src/approvals.js.map +1 -0
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/cli.js +87 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/config.d.ts +12 -0
- package/dist/src/config.js +183 -0
- package/dist/src/config.js.map +1 -0
- package/dist/src/context-memory.d.ts +7 -0
- package/dist/src/context-memory.js +96 -0
- package/dist/src/context-memory.js.map +1 -0
- package/dist/src/ink/command-suggestions.d.ts +7 -0
- package/dist/src/ink/command-suggestions.js +179 -0
- package/dist/src/ink/command-suggestions.js.map +1 -0
- package/dist/src/ink/ink-terminal-ui.d.ts +36 -0
- package/dist/src/ink/ink-terminal-ui.js +79 -0
- package/dist/src/ink/ink-terminal-ui.js.map +1 -0
- package/dist/src/ink/repl-app.d.ts +9 -0
- package/dist/src/ink/repl-app.js +789 -0
- package/dist/src/ink/repl-app.js.map +1 -0
- package/dist/src/ink/transcript-cards.d.ts +6 -0
- package/dist/src/ink/transcript-cards.js +24 -0
- package/dist/src/ink/transcript-cards.js.map +1 -0
- package/dist/src/path-policy.d.ts +11 -0
- package/dist/src/path-policy.js +67 -0
- package/dist/src/path-policy.js.map +1 -0
- package/dist/src/process-utils.d.ts +13 -0
- package/dist/src/process-utils.js +52 -0
- package/dist/src/process-utils.js.map +1 -0
- package/dist/src/repl.d.ts +9 -0
- package/dist/src/repl.js +13 -0
- package/dist/src/repl.js.map +1 -0
- package/dist/src/sarvam/client.d.ts +15 -0
- package/dist/src/sarvam/client.js +208 -0
- package/dist/src/sarvam/client.js.map +1 -0
- package/dist/src/sarvam/models.d.ts +2 -0
- package/dist/src/sarvam/models.js +7 -0
- package/dist/src/sarvam/models.js.map +1 -0
- package/dist/src/search-provider.d.ts +6 -0
- package/dist/src/search-provider.js +8 -0
- package/dist/src/search-provider.js.map +1 -0
- package/dist/src/session-store.d.ts +19 -0
- package/dist/src/session-store.js +318 -0
- package/dist/src/session-store.js.map +1 -0
- package/dist/src/skills/runtime.d.ts +26 -0
- package/dist/src/skills/runtime.js +317 -0
- package/dist/src/skills/runtime.js.map +1 -0
- package/dist/src/skills/types.d.ts +25 -0
- package/dist/src/skills/types.js +2 -0
- package/dist/src/skills/types.js.map +1 -0
- package/dist/src/terminal-ui.d.ts +29 -0
- package/dist/src/terminal-ui.js +236 -0
- package/dist/src/terminal-ui.js.map +1 -0
- package/dist/src/tools/filesystem.d.ts +2 -0
- package/dist/src/tools/filesystem.js +622 -0
- package/dist/src/tools/filesystem.js.map +1 -0
- package/dist/src/tools/git.d.ts +2 -0
- package/dist/src/tools/git.js +326 -0
- package/dist/src/tools/git.js.map +1 -0
- package/dist/src/tools/index.d.ts +6 -0
- package/dist/src/tools/index.js +21 -0
- package/dist/src/tools/index.js.map +1 -0
- package/dist/src/tools/registry.d.ts +15 -0
- package/dist/src/tools/registry.js +59 -0
- package/dist/src/tools/registry.js.map +1 -0
- package/dist/src/tools/shell.d.ts +2 -0
- package/dist/src/tools/shell.js +97 -0
- package/dist/src/tools/shell.js.map +1 -0
- package/dist/src/tools/skill.d.ts +3 -0
- package/dist/src/tools/skill.js +130 -0
- package/dist/src/tools/skill.js.map +1 -0
- package/dist/src/tools/web.d.ts +3 -0
- package/dist/src/tools/web.js +144 -0
- package/dist/src/tools/web.js.map +1 -0
- package/dist/src/types.d.ts +236 -0
- package/dist/src/types.js +2 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/workspace-trust.d.ts +3 -0
- package/dist/src/workspace-trust.js +31 -0
- package/dist/src/workspace-trust.js.map +1 -0
- package/dist/src/xdg.d.ts +9 -0
- package/dist/src/xdg.js +77 -0
- package/dist/src/xdg.js.map +1 -0
- package/package.json +57 -0
- package/skill/agents-md-generator/SKILL.md +75 -0
- package/skill/agents-md-generator/references/agents_md_template.md +160 -0
- package/skill/agents-md-generator/references/loc_measurement.md +67 -0
- package/skill/agents-md-generator/references/monorepo_detection.md +78 -0
- package/skill/agents-md-generator/references/monorepo_strategy.md +60 -0
- package/skill/agents-md-generator/references/read_only_commands.md +151 -0
- package/skill/agents-md-generator/references/update_strategy.md +160 -0
- package/skill/agents-md-generator/references/working_agreements.md +53 -0
- package/skill/biz-opportunity-scout/SKILL.md +53 -0
- package/skill/biz-opportunity-scout/references/competitive_analysis.md +84 -0
- package/skill/biz-opportunity-scout/references/market_sizing.md +68 -0
- package/skill/biz-opportunity-scout/references/pmf_indicators.md +94 -0
- package/skill/biz-opportunity-scout/references/report_template.md +243 -0
- package/skill/biz-opportunity-scout/references/unit_economics.md +97 -0
- package/skill/code-review/SKILL.md +86 -0
- package/skill/code-review/references/change_analysis.md +116 -0
- package/skill/code-review/references/git_operations.md +115 -0
- package/skill/code-review/references/impact_detection.md +149 -0
- package/skill/code-review/references/output_format.md +137 -0
- package/skill/code-review/references/severity_criteria.md +100 -0
- package/skill/code-security-audit/SKILL.md +123 -0
- package/skill/code-security-audit/references/audit_process.md +277 -0
- package/skill/code-security-audit/references/remediation_patterns.md +599 -0
- package/skill/code-security-audit/references/report_format.md +391 -0
- package/skill/code-security-audit/references/security_domains.md +830 -0
- package/skill/code-security-audit/references/vulnerability_patterns.md +813 -0
- package/skill/composition-patterns/SKILL.md +83 -0
- package/skill/composition-patterns/rules/architecture-avoid-boolean-props.md +100 -0
- package/skill/composition-patterns/rules/architecture-compound-components.md +112 -0
- package/skill/composition-patterns/rules/patterns-children-over-render-props.md +87 -0
- package/skill/composition-patterns/rules/patterns-explicit-variants.md +100 -0
- package/skill/composition-patterns/rules/react19-no-forwardref.md +42 -0
- package/skill/composition-patterns/rules/state-context-interface.md +191 -0
- package/skill/composition-patterns/rules/state-decouple-implementation.md +113 -0
- package/skill/composition-patterns/rules/state-lift-state.md +125 -0
- package/skill/deploy-to-vercel/SKILL.md +293 -0
- package/skill/deploy-to-vercel/resources/deploy-sandbox.sh +301 -0
- package/skill/deploy-to-vercel/resources/deploy.sh +301 -0
- package/skill/doc/SKILL_GUIDELINES.md +138 -0
- package/skill/git-workflow/SKILL.md +94 -0
- package/skill/git-workflow/references/advanced-git.md +632 -0
- package/skill/git-workflow/references/branching-strategies.md +344 -0
- package/skill/git-workflow/references/ci-cd-integration.md +683 -0
- package/skill/git-workflow/references/code-quality-tools.md +351 -0
- package/skill/git-workflow/references/commit-conventions.md +439 -0
- package/skill/git-workflow/references/github-releases.md +288 -0
- package/skill/git-workflow/references/pull-request-workflow.md +773 -0
- package/skill/git-workflow/scripts/verify-git-workflow.sh +263 -0
- package/skill/jetbrains-vmoptions/SKILL.md +51 -0
- package/skill/jetbrains-vmoptions/references/common-options.md +357 -0
- package/skill/jetbrains-vmoptions/references/gc-options.md +350 -0
- package/skill/jetbrains-vmoptions/references/memory-options.md +339 -0
- package/skill/jetbrains-vmoptions/references/prerequisite-check.md +65 -0
- package/skill/kysely-converter/SKILL.md +62 -0
- package/skill/kysely-converter/references/delete.md +323 -0
- package/skill/kysely-converter/references/insert.md +386 -0
- package/skill/kysely-converter/references/operators.md +331 -0
- package/skill/kysely-converter/references/select.md +1000 -0
- package/skill/kysely-converter/references/update.md +349 -0
- package/skill/kysely-converter/references/window_function.md +537 -0
- package/skill/react-best-practices/SKILL.md +131 -0
- package/skill/react-best-practices/rules/advanced-event-handler-refs.md +55 -0
- package/skill/react-best-practices/rules/advanced-init-once.md +42 -0
- package/skill/react-best-practices/rules/advanced-use-latest.md +39 -0
- package/skill/react-best-practices/rules/async-api-routes.md +38 -0
- package/skill/react-best-practices/rules/async-defer-await.md +80 -0
- package/skill/react-best-practices/rules/async-dependencies.md +51 -0
- package/skill/react-best-practices/rules/async-parallel.md +28 -0
- package/skill/react-best-practices/rules/async-suspense-boundaries.md +99 -0
- package/skill/react-best-practices/rules/bundle-barrel-imports.md +59 -0
- package/skill/react-best-practices/rules/bundle-conditional.md +31 -0
- package/skill/react-best-practices/rules/bundle-defer-third-party.md +49 -0
- package/skill/react-best-practices/rules/bundle-dynamic-imports.md +35 -0
- package/skill/react-best-practices/rules/bundle-preload.md +50 -0
- package/skill/react-best-practices/rules/client-event-listeners.md +74 -0
- package/skill/react-best-practices/rules/client-localstorage-schema.md +71 -0
- package/skill/react-best-practices/rules/client-passive-event-listeners.md +48 -0
- package/skill/react-best-practices/rules/client-swr-dedup.md +56 -0
- package/skill/react-best-practices/rules/js-batch-dom-css.md +107 -0
- package/skill/react-best-practices/rules/js-cache-function-results.md +80 -0
- package/skill/react-best-practices/rules/js-cache-property-access.md +28 -0
- package/skill/react-best-practices/rules/js-cache-storage.md +70 -0
- package/skill/react-best-practices/rules/js-combine-iterations.md +32 -0
- package/skill/react-best-practices/rules/js-early-exit.md +50 -0
- package/skill/react-best-practices/rules/js-hoist-regexp.md +45 -0
- package/skill/react-best-practices/rules/js-index-maps.md +37 -0
- package/skill/react-best-practices/rules/js-length-check-first.md +49 -0
- package/skill/react-best-practices/rules/js-min-max-loop.md +82 -0
- package/skill/react-best-practices/rules/js-set-map-lookups.md +24 -0
- package/skill/react-best-practices/rules/js-tosorted-immutable.md +57 -0
- package/skill/react-best-practices/rules/rendering-activity.md +26 -0
- package/skill/react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
- package/skill/react-best-practices/rules/rendering-conditional-render.md +40 -0
- package/skill/react-best-practices/rules/rendering-content-visibility.md +38 -0
- package/skill/react-best-practices/rules/rendering-hoist-jsx.md +46 -0
- package/skill/react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
- package/skill/react-best-practices/rules/rendering-hydration-suppress-warning.md +30 -0
- package/skill/react-best-practices/rules/rendering-svg-precision.md +28 -0
- package/skill/react-best-practices/rules/rendering-usetransition-loading.md +75 -0
- package/skill/react-best-practices/rules/rerender-defer-reads.md +39 -0
- package/skill/react-best-practices/rules/rerender-dependencies.md +45 -0
- package/skill/react-best-practices/rules/rerender-derived-state-no-effect.md +40 -0
- package/skill/react-best-practices/rules/rerender-derived-state.md +29 -0
- package/skill/react-best-practices/rules/rerender-functional-setstate.md +74 -0
- package/skill/react-best-practices/rules/rerender-lazy-state-init.md +58 -0
- package/skill/react-best-practices/rules/rerender-memo-with-default-value.md +38 -0
- package/skill/react-best-practices/rules/rerender-memo.md +44 -0
- package/skill/react-best-practices/rules/rerender-move-effect-to-event.md +45 -0
- package/skill/react-best-practices/rules/rerender-simple-expression-in-memo.md +35 -0
- package/skill/react-best-practices/rules/rerender-transitions.md +40 -0
- package/skill/react-best-practices/rules/rerender-use-ref-transient-values.md +73 -0
- package/skill/react-best-practices/rules/server-after-nonblocking.md +73 -0
- package/skill/react-best-practices/rules/server-auth-actions.md +96 -0
- package/skill/react-best-practices/rules/server-cache-lru.md +41 -0
- package/skill/react-best-practices/rules/server-cache-react.md +76 -0
- package/skill/react-best-practices/rules/server-dedup-props.md +65 -0
- package/skill/react-best-practices/rules/server-hoist-static-io.md +142 -0
- package/skill/react-best-practices/rules/server-parallel-fetching.md +83 -0
- package/skill/react-best-practices/rules/server-serialization.md +38 -0
- package/skill/react-native-skills/SKILL.md +115 -0
- package/skill/react-native-skills/rules/animation-derived-value.md +53 -0
- package/skill/react-native-skills/rules/animation-gesture-detector-press.md +95 -0
- package/skill/react-native-skills/rules/animation-gpu-properties.md +65 -0
- package/skill/react-native-skills/rules/design-system-compound-components.md +66 -0
- package/skill/react-native-skills/rules/fonts-config-plugin.md +71 -0
- package/skill/react-native-skills/rules/imports-design-system-folder.md +68 -0
- package/skill/react-native-skills/rules/js-hoist-intl.md +61 -0
- package/skill/react-native-skills/rules/list-performance-callbacks.md +44 -0
- package/skill/react-native-skills/rules/list-performance-function-references.md +132 -0
- package/skill/react-native-skills/rules/list-performance-images.md +53 -0
- package/skill/react-native-skills/rules/list-performance-inline-objects.md +97 -0
- package/skill/react-native-skills/rules/list-performance-item-expensive.md +94 -0
- package/skill/react-native-skills/rules/list-performance-item-memo.md +82 -0
- package/skill/react-native-skills/rules/list-performance-item-types.md +104 -0
- package/skill/react-native-skills/rules/list-performance-virtualize.md +67 -0
- package/skill/react-native-skills/rules/monorepo-native-deps-in-app.md +46 -0
- package/skill/react-native-skills/rules/monorepo-single-dependency-versions.md +63 -0
- package/skill/react-native-skills/rules/navigation-native-navigators.md +188 -0
- package/skill/react-native-skills/rules/react-compiler-destructure-functions.md +50 -0
- package/skill/react-native-skills/rules/react-compiler-reanimated-shared-values.md +48 -0
- package/skill/react-native-skills/rules/react-state-dispatcher.md +91 -0
- package/skill/react-native-skills/rules/react-state-fallback.md +56 -0
- package/skill/react-native-skills/rules/react-state-minimize.md +65 -0
- package/skill/react-native-skills/rules/rendering-no-falsy-and.md +74 -0
- package/skill/react-native-skills/rules/rendering-text-in-text-component.md +36 -0
- package/skill/react-native-skills/rules/scroll-position-no-state.md +82 -0
- package/skill/react-native-skills/rules/state-ground-truth.md +80 -0
- package/skill/react-native-skills/rules/ui-expo-image.md +66 -0
- package/skill/react-native-skills/rules/ui-image-gallery.md +104 -0
- package/skill/react-native-skills/rules/ui-measure-views.md +78 -0
- package/skill/react-native-skills/rules/ui-menus.md +174 -0
- package/skill/react-native-skills/rules/ui-native-modals.md +77 -0
- package/skill/react-native-skills/rules/ui-pressable.md +61 -0
- package/skill/react-native-skills/rules/ui-safe-area-scroll.md +65 -0
- package/skill/react-native-skills/rules/ui-scrollview-content-inset.md +45 -0
- package/skill/react-native-skills/rules/ui-styling.md +87 -0
- package/skill/react-vite-guide/SKILL.md +101 -0
- package/skill/react-vite-guide/references/composition-patterns.md +709 -0
- package/skill/react-vite-guide/references/performance-optimization.md +1222 -0
- package/skill/react-vite-guide/references/vite-specific.md +385 -0
- package/skill/react-vite-guide/references/web-interface.md +146 -0
- package/skill/skill-maker/SKILL.md +52 -0
- package/skill/skill-maker/references/content_spec.md +67 -0
- package/skill/skill-maker/references/frontmatter_spec.md +96 -0
- package/skill/skill-maker/references/input_validation.md +90 -0
- package/skill/skill-maker/references/skill_structure.md +74 -0
- package/skill/system-prompt-creator/SKILL.md +50 -0
- package/skill/system-prompt-creator/references/data_format_selection.md +135 -0
- package/skill/system-prompt-creator/references/multi_prompt_architecture.md +386 -0
- package/skill/system-prompt-creator/references/prompt_structure.md +140 -0
- package/skill/system-prompt-creator/references/quality_criteria.md +83 -0
- package/skill/typst-creator/SKILL.md +51 -0
- package/skill/typst-creator/references/layout.md +401 -0
- package/skill/typst-creator/references/math.md +297 -0
- package/skill/typst-creator/references/scripting.md +237 -0
- package/skill/typst-creator/references/styling.md +217 -0
- package/skill/typst-creator/references/syntax.md +234 -0
- package/skill/web-design-guidelines/SKILL.md +35 -0
- package/terminal.png +0 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Decouple State Management from UI
|
|
3
|
+
impact: MEDIUM
|
|
4
|
+
impactDescription: enables swapping state implementations without changing UI
|
|
5
|
+
tags: composition, state, architecture
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Decouple State Management from UI
|
|
9
|
+
|
|
10
|
+
The provider component should be the only place that knows how state is managed.
|
|
11
|
+
UI components consume the context interface—they don't know if state comes from
|
|
12
|
+
useState, Zustand, or a server sync.
|
|
13
|
+
|
|
14
|
+
**Incorrect (UI coupled to state implementation):**
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
function ChannelComposer({ channelId }: { channelId: string }) {
|
|
18
|
+
// UI component knows about global state implementation
|
|
19
|
+
const state = useGlobalChannelState(channelId)
|
|
20
|
+
const { submit, updateInput } = useChannelSync(channelId)
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Composer.Frame>
|
|
24
|
+
<Composer.Input
|
|
25
|
+
value={state.input}
|
|
26
|
+
onChange={(text) => sync.updateInput(text)}
|
|
27
|
+
/>
|
|
28
|
+
<Composer.Submit onPress={() => sync.submit()} />
|
|
29
|
+
</Composer.Frame>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Correct (state management isolated in provider):**
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
// Provider handles all state management details
|
|
38
|
+
function ChannelProvider({
|
|
39
|
+
channelId,
|
|
40
|
+
children,
|
|
41
|
+
}: {
|
|
42
|
+
channelId: string
|
|
43
|
+
children: React.ReactNode
|
|
44
|
+
}) {
|
|
45
|
+
const { state, update, submit } = useGlobalChannel(channelId)
|
|
46
|
+
const inputRef = useRef(null)
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<Composer.Provider
|
|
50
|
+
state={state}
|
|
51
|
+
actions={{ update, submit }}
|
|
52
|
+
meta={{ inputRef }}
|
|
53
|
+
>
|
|
54
|
+
{children}
|
|
55
|
+
</Composer.Provider>
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// UI component only knows about the context interface
|
|
60
|
+
function ChannelComposer() {
|
|
61
|
+
return (
|
|
62
|
+
<Composer.Frame>
|
|
63
|
+
<Composer.Header />
|
|
64
|
+
<Composer.Input />
|
|
65
|
+
<Composer.Footer>
|
|
66
|
+
<Composer.Submit />
|
|
67
|
+
</Composer.Footer>
|
|
68
|
+
</Composer.Frame>
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Usage
|
|
73
|
+
function Channel({ channelId }: { channelId: string }) {
|
|
74
|
+
return (
|
|
75
|
+
<ChannelProvider channelId={channelId}>
|
|
76
|
+
<ChannelComposer />
|
|
77
|
+
</ChannelProvider>
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Different providers, same UI:**
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
// Local state for ephemeral forms
|
|
86
|
+
function ForwardMessageProvider({ children }) {
|
|
87
|
+
const [state, setState] = useState(initialState)
|
|
88
|
+
const forwardMessage = useForwardMessage()
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<Composer.Provider
|
|
92
|
+
state={state}
|
|
93
|
+
actions={{ update: setState, submit: forwardMessage }}
|
|
94
|
+
>
|
|
95
|
+
{children}
|
|
96
|
+
</Composer.Provider>
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Global synced state for channels
|
|
101
|
+
function ChannelProvider({ channelId, children }) {
|
|
102
|
+
const { state, update, submit } = useGlobalChannel(channelId)
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<Composer.Provider state={state} actions={{ update, submit }}>
|
|
106
|
+
{children}
|
|
107
|
+
</Composer.Provider>
|
|
108
|
+
)
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
The same `Composer.Input` component works with both providers because it only
|
|
113
|
+
depends on the context interface, not the implementation.
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Lift State into Provider Components
|
|
3
|
+
impact: HIGH
|
|
4
|
+
impactDescription: enables state sharing outside component boundaries
|
|
5
|
+
tags: composition, state, context, providers
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Lift State into Provider Components
|
|
9
|
+
|
|
10
|
+
Move state management into dedicated provider components. This allows sibling
|
|
11
|
+
components outside the main UI to access and modify state without prop drilling
|
|
12
|
+
or awkward refs.
|
|
13
|
+
|
|
14
|
+
**Incorrect (state trapped inside component):**
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
function ForwardMessageComposer() {
|
|
18
|
+
const [state, setState] = useState(initialState)
|
|
19
|
+
const forwardMessage = useForwardMessage()
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Composer.Frame>
|
|
23
|
+
<Composer.Input />
|
|
24
|
+
<Composer.Footer />
|
|
25
|
+
</Composer.Frame>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Problem: How does this button access composer state?
|
|
30
|
+
function ForwardMessageDialog() {
|
|
31
|
+
return (
|
|
32
|
+
<Dialog>
|
|
33
|
+
<ForwardMessageComposer />
|
|
34
|
+
<MessagePreview /> {/* Needs composer state */}
|
|
35
|
+
<DialogActions>
|
|
36
|
+
<CancelButton />
|
|
37
|
+
<ForwardButton /> {/* Needs to call submit */}
|
|
38
|
+
</DialogActions>
|
|
39
|
+
</Dialog>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Incorrect (useEffect to sync state up):**
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
function ForwardMessageDialog() {
|
|
48
|
+
const [input, setInput] = useState('')
|
|
49
|
+
return (
|
|
50
|
+
<Dialog>
|
|
51
|
+
<ForwardMessageComposer onInputChange={setInput} />
|
|
52
|
+
<MessagePreview input={input} />
|
|
53
|
+
</Dialog>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function ForwardMessageComposer({ onInputChange }) {
|
|
58
|
+
const [state, setState] = useState(initialState)
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
onInputChange(state.input) // Sync on every change 😬
|
|
61
|
+
}, [state.input])
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Incorrect (reading state from ref on submit):**
|
|
66
|
+
|
|
67
|
+
```tsx
|
|
68
|
+
function ForwardMessageDialog() {
|
|
69
|
+
const stateRef = useRef(null)
|
|
70
|
+
return (
|
|
71
|
+
<Dialog>
|
|
72
|
+
<ForwardMessageComposer stateRef={stateRef} />
|
|
73
|
+
<ForwardButton onPress={() => submit(stateRef.current)} />
|
|
74
|
+
</Dialog>
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Correct (state lifted to provider):**
|
|
80
|
+
|
|
81
|
+
```tsx
|
|
82
|
+
function ForwardMessageProvider({ children }: { children: React.ReactNode }) {
|
|
83
|
+
const [state, setState] = useState(initialState)
|
|
84
|
+
const forwardMessage = useForwardMessage()
|
|
85
|
+
const inputRef = useRef(null)
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<Composer.Provider
|
|
89
|
+
state={state}
|
|
90
|
+
actions={{ update: setState, submit: forwardMessage }}
|
|
91
|
+
meta={{ inputRef }}
|
|
92
|
+
>
|
|
93
|
+
{children}
|
|
94
|
+
</Composer.Provider>
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function ForwardMessageDialog() {
|
|
99
|
+
return (
|
|
100
|
+
<ForwardMessageProvider>
|
|
101
|
+
<Dialog>
|
|
102
|
+
<ForwardMessageComposer />
|
|
103
|
+
<MessagePreview /> {/* Custom components can access state and actions */}
|
|
104
|
+
<DialogActions>
|
|
105
|
+
<CancelButton />
|
|
106
|
+
<ForwardButton /> {/* Custom components can access state and actions */}
|
|
107
|
+
</DialogActions>
|
|
108
|
+
</Dialog>
|
|
109
|
+
</ForwardMessageProvider>
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function ForwardButton() {
|
|
114
|
+
const { actions } = use(Composer.Context)
|
|
115
|
+
return <Button onPress={actions.submit}>Forward</Button>
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
The ForwardButton lives outside the Composer.Frame but still has access to the
|
|
120
|
+
submit action because it's within the provider. Even though it's a one-off
|
|
121
|
+
component, it can still access the composer's state and actions from outside the
|
|
122
|
+
UI itself.
|
|
123
|
+
|
|
124
|
+
**Key insight:** Components that need shared state don't have to be visually
|
|
125
|
+
nested inside each other—they just need to be within the same provider.
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: deploy-to-vercel
|
|
3
|
+
description: Deploy applications and websites to Vercel. Use when the user requests deployment actions like "deploy my app", "deploy and give me the link", "push this live", or "create a preview deployment".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Deploy to Vercel
|
|
7
|
+
|
|
8
|
+
Deploy any project to Vercel. **Always deploy as preview** (not production) unless the user explicitly asks for production.
|
|
9
|
+
|
|
10
|
+
The goal is to get the user into the best long-term setup: their project linked to Vercel with git-push deploys. Every method below tries to move the user closer to that state.
|
|
11
|
+
|
|
12
|
+
## Step 1: Gather Project State
|
|
13
|
+
|
|
14
|
+
Run all four checks before deciding which method to use:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# 1. Check for a git remote
|
|
18
|
+
git remote get-url origin 2>/dev/null
|
|
19
|
+
|
|
20
|
+
# 2. Check if locally linked to a Vercel project (either file means linked)
|
|
21
|
+
cat .vercel/project.json 2>/dev/null || cat .vercel/repo.json 2>/dev/null
|
|
22
|
+
|
|
23
|
+
# 3. Check if the Vercel CLI is installed and authenticated
|
|
24
|
+
vercel whoami 2>/dev/null
|
|
25
|
+
|
|
26
|
+
# 4. List available teams (if authenticated)
|
|
27
|
+
vercel teams list --format json 2>/dev/null
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Team selection
|
|
31
|
+
|
|
32
|
+
If the user belongs to multiple teams, present all available team slugs as a bulleted list and ask which one to deploy to. Once the user picks a team, proceed immediately to the next step — do not ask for additional confirmation.
|
|
33
|
+
|
|
34
|
+
Pass the team slug via `--scope` on all subsequent CLI commands (`vercel deploy`, `vercel link`, `vercel inspect`, etc.):
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
vercel deploy [path] -y --no-wait --scope <team-slug>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
If the project is already linked (`.vercel/project.json` or `.vercel/repo.json` exists), the `orgId` in those files determines the team — no need to ask again. If there is only one team (or just a personal account), skip the prompt and use it directly.
|
|
41
|
+
|
|
42
|
+
**About the `.vercel/` directory:** A linked project has either:
|
|
43
|
+
- `.vercel/project.json` — created by `vercel link` (single project linking). Contains `projectId` and `orgId`.
|
|
44
|
+
- `.vercel/repo.json` — created by `vercel link --repo` (repo-based linking). Contains `orgId`, `remoteName`, and a `projects` array mapping directories to Vercel project IDs.
|
|
45
|
+
|
|
46
|
+
Either file means the project is linked. Check for both.
|
|
47
|
+
|
|
48
|
+
**Do NOT** use `vercel project inspect`, `vercel ls`, or `vercel link` to detect state in an unlinked directory — without a `.vercel/` config, they will interactively prompt (or with `--yes`, silently link as a side-effect). Only `vercel whoami` is safe to run anywhere.
|
|
49
|
+
|
|
50
|
+
## Step 2: Choose a Deploy Method
|
|
51
|
+
|
|
52
|
+
### Linked (`.vercel/` exists) + has git remote → Git Push
|
|
53
|
+
|
|
54
|
+
This is the ideal state. The project is linked and has git integration.
|
|
55
|
+
|
|
56
|
+
1. **Ask the user before pushing.** Never push without explicit approval:
|
|
57
|
+
```
|
|
58
|
+
This project is connected to Vercel via git. I can commit and push to
|
|
59
|
+
trigger a deployment. Want me to proceed?
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
2. **Commit and push:**
|
|
63
|
+
```bash
|
|
64
|
+
git add .
|
|
65
|
+
git commit -m "deploy: <description of changes>"
|
|
66
|
+
git push
|
|
67
|
+
```
|
|
68
|
+
Vercel automatically builds from the push. Non-production branches get preview deployments; the production branch (usually `main`) gets a production deployment.
|
|
69
|
+
|
|
70
|
+
3. **Retrieve the preview URL.** If the CLI is authenticated:
|
|
71
|
+
```bash
|
|
72
|
+
sleep 5
|
|
73
|
+
vercel ls --format json
|
|
74
|
+
```
|
|
75
|
+
The JSON output has a `deployments` array. Find the latest entry — its `url` field is the preview URL.
|
|
76
|
+
|
|
77
|
+
If the CLI is not authenticated, tell the user to check the Vercel dashboard or the commit status checks on their git provider for the preview URL.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
### Linked (`.vercel/` exists) + no git remote → `vercel deploy`
|
|
82
|
+
|
|
83
|
+
The project is linked but there's no git repo. Deploy directly with the CLI.
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
vercel deploy [path] -y --no-wait
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Use `--no-wait` so the CLI returns immediately with the deployment URL instead of blocking until the build finishes (builds can take a while). Then check on the deployment status with:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
vercel inspect <deployment-url>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
For production deploys (only if user explicitly asks):
|
|
96
|
+
```bash
|
|
97
|
+
vercel deploy [path] --prod -y --no-wait
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
### Not linked + CLI is authenticated → Link first, then deploy
|
|
103
|
+
|
|
104
|
+
The CLI is working but the project isn't linked yet. This is the opportunity to get the user into the best state.
|
|
105
|
+
|
|
106
|
+
1. **Ask the user which team to deploy to.** Present the team slugs from Step 1 as a bulleted list. If there's only one team (or just a personal account), skip this step.
|
|
107
|
+
|
|
108
|
+
2. **Once a team is selected, proceed directly to linking.** Tell the user what will happen but do not ask for separate confirmation:
|
|
109
|
+
```
|
|
110
|
+
Linking this project to <team name> on Vercel. This will create a Vercel
|
|
111
|
+
project to deploy to and enable automatic deployments on future git pushes.
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
3. **If a git remote exists**, use repo-based linking with the selected team scope:
|
|
115
|
+
```bash
|
|
116
|
+
vercel link --repo --scope <team-slug>
|
|
117
|
+
```
|
|
118
|
+
This reads the git remote URL and matches it to existing Vercel projects that deploy from that repo. It creates `.vercel/repo.json`. This is much more reliable than `vercel link` (without `--repo`), which tries to match by directory name and often fails when the local folder and Vercel project are named differently.
|
|
119
|
+
|
|
120
|
+
**If there is no git remote**, fall back to standard linking:
|
|
121
|
+
```bash
|
|
122
|
+
vercel link --scope <team-slug>
|
|
123
|
+
```
|
|
124
|
+
This prompts the user to select or create a project. It creates `.vercel/project.json`.
|
|
125
|
+
|
|
126
|
+
4. **Then deploy using the best available method:**
|
|
127
|
+
- If a git remote exists → commit and push (see git push method above)
|
|
128
|
+
- If no git remote → `vercel deploy [path] -y --no-wait --scope <team-slug>`, then `vercel inspect <url>` to check status
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
### Not linked + CLI not authenticated → Install, auth, link, deploy
|
|
133
|
+
|
|
134
|
+
The Vercel CLI isn't set up at all.
|
|
135
|
+
|
|
136
|
+
1. **Install the CLI (if not already installed):**
|
|
137
|
+
```bash
|
|
138
|
+
npm install -g vercel
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
2. **Authenticate:**
|
|
142
|
+
```bash
|
|
143
|
+
vercel login
|
|
144
|
+
```
|
|
145
|
+
The user completes auth in their browser. If running in a non-interactive environment where login is not possible, skip to the **no-auth fallback** below.
|
|
146
|
+
|
|
147
|
+
3. **Ask which team to deploy to** — present team slugs from `vercel teams list --format json` as a bulleted list. If only one team / personal account, skip. Once selected, proceed immediately.
|
|
148
|
+
|
|
149
|
+
4. **Link the project** with the selected team scope (use `--repo` if a git remote exists, plain `vercel link` otherwise):
|
|
150
|
+
```bash
|
|
151
|
+
vercel link --repo --scope <team-slug> # if git remote exists
|
|
152
|
+
vercel link --scope <team-slug> # if no git remote
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
5. **Deploy** using the best available method (git push if remote exists, otherwise `vercel deploy -y --no-wait --scope <team-slug>`, then `vercel inspect <url>` to check status).
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
### No-Auth Fallback — Browserless sandbox
|
|
160
|
+
|
|
161
|
+
**When to use:** Last resort when the CLI can't be installed or authenticated in a browserless sandbox. This requires no authentication — it returns a **Preview URL** (live site) and a **Claim URL** (transfer to your Vercel account).
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
bash /mnt/skills/user/deploy-to-vercel/resources/deploy.sh [path]
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**Arguments:**
|
|
168
|
+
- `path` - Directory to deploy, or a `.tgz` file (defaults to current directory)
|
|
169
|
+
|
|
170
|
+
**Examples:**
|
|
171
|
+
```bash
|
|
172
|
+
# Deploy current directory
|
|
173
|
+
bash /mnt/skills/user/deploy-to-vercel/resources/deploy.sh
|
|
174
|
+
|
|
175
|
+
# Deploy specific project
|
|
176
|
+
bash /mnt/skills/user/deploy-to-vercel/resources/deploy.sh /path/to/project
|
|
177
|
+
|
|
178
|
+
# Deploy existing tarball
|
|
179
|
+
bash /mnt/skills/user/deploy-to-vercel/resources/deploy.sh /path/to/project.tgz
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
The script auto-detects the framework from `package.json`, packages the project (excluding `node_modules`, `.git`, `.env`), uploads it, and waits for the build to complete.
|
|
183
|
+
|
|
184
|
+
**Tell the user:** "Your deployment is ready at [previewUrl]. Claim it at [claimUrl] to manage your deployment."
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
### No-Auth Fallback — Restricted CLI sandbox
|
|
189
|
+
|
|
190
|
+
**When to use:** In a restricted CLI sandbox where the Vercel CLI may not be authenticated. Try the CLI first, and fall back to the deploy script if auth fails.
|
|
191
|
+
|
|
192
|
+
1. **Check whether the Vercel CLI is installed** (no escalation needed for this check):
|
|
193
|
+
```bash
|
|
194
|
+
command -v vercel
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
2. **If `vercel` is installed**, try deploying with the CLI:
|
|
198
|
+
```bash
|
|
199
|
+
vercel deploy [path] -y --no-wait
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
3. **If `vercel` is not installed, or the CLI fails with "No existing credentials found"**, use the fallback script:
|
|
203
|
+
```bash
|
|
204
|
+
skill_dir="<path-to-skill>"
|
|
205
|
+
|
|
206
|
+
# Deploy current directory
|
|
207
|
+
bash "$skill_dir/resources/deploy-sandbox.sh"
|
|
208
|
+
|
|
209
|
+
# Deploy specific project
|
|
210
|
+
bash "$skill_dir/resources/deploy-sandbox.sh" /path/to/project
|
|
211
|
+
|
|
212
|
+
# Deploy existing tarball
|
|
213
|
+
bash "$skill_dir/resources/deploy-sandbox.sh" /path/to/project.tgz
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
The script handles framework detection, packaging, and deployment. It waits for the build to complete and returns JSON with `previewUrl` and `claimUrl`.
|
|
217
|
+
|
|
218
|
+
**Tell the user:** "Your deployment is ready at [previewUrl]. Claim it at [claimUrl] to manage your deployment."
|
|
219
|
+
|
|
220
|
+
**Escalated network access:** Only escalate the actual deploy command if sandboxing blocks the network call (`sandbox_permissions=require_escalated`). Do **not** escalate the `command -v vercel` check.
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## Environment Notes
|
|
225
|
+
|
|
226
|
+
### Terminal-based agents
|
|
227
|
+
|
|
228
|
+
You have full shell access. Do NOT use the `/mnt/skills/` path. Follow the decision flow above using the CLI directly.
|
|
229
|
+
|
|
230
|
+
For the no-auth fallback, run the deploy script from the skill's installed location:
|
|
231
|
+
```bash
|
|
232
|
+
bash <installed-skill-path>/deploy-to-vercel/resources/deploy.sh [path]
|
|
233
|
+
```
|
|
234
|
+
The path may vary depending on where the user installed the skill.
|
|
235
|
+
|
|
236
|
+
### Browser-only sandboxes
|
|
237
|
+
|
|
238
|
+
You likely cannot run `vercel login` or `git push`. Go directly to the **no-auth fallback — Browserless sandbox**.
|
|
239
|
+
|
|
240
|
+
### Restricted CLI sandboxes
|
|
241
|
+
|
|
242
|
+
Check if the CLI is available first, then fall back to the deploy script. Go to the **no-auth fallback — Restricted CLI sandbox**.
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## Output
|
|
247
|
+
|
|
248
|
+
Always show the user the deployment URL.
|
|
249
|
+
|
|
250
|
+
- **Git push:** Use `vercel ls --format json` to find the preview URL. If the CLI isn't authenticated, tell the user to check the Vercel dashboard or commit status checks.
|
|
251
|
+
- **CLI deploy:** Show the URL returned by `vercel deploy --no-wait`. Use `vercel inspect <url>` to check build status and report it to the user.
|
|
252
|
+
- **No-auth fallback:** Show both the preview URL and the claim URL:
|
|
253
|
+
```
|
|
254
|
+
Deployment successful!
|
|
255
|
+
|
|
256
|
+
Preview URL: https://my-app-abc123.vercel.app
|
|
257
|
+
Claim URL: https://vercel.com/claim-deployment?code=...
|
|
258
|
+
|
|
259
|
+
View your site at the Preview URL.
|
|
260
|
+
To transfer this deployment to your Vercel account, visit the Claim URL.
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
**Do not** curl or fetch the deployed URL to verify it works. Just return the link.
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## Troubleshooting
|
|
268
|
+
|
|
269
|
+
### Network Egress Error (sandboxed environments)
|
|
270
|
+
|
|
271
|
+
If deployment fails due to network restrictions in the current environment, tell the user:
|
|
272
|
+
|
|
273
|
+
```
|
|
274
|
+
Deployment failed due to network restrictions. To fix this:
|
|
275
|
+
|
|
276
|
+
1. Open the environment's network or capability settings
|
|
277
|
+
2. Allow access to *.vercel.com
|
|
278
|
+
3. Try deploying again
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
### Escalated Network Access (sandboxed environments)
|
|
282
|
+
|
|
283
|
+
If deployment fails due to network issues (timeouts, DNS errors, connection resets) in a sandboxed environment, rerun with escalated permissions (`sandbox_permissions=require_escalated`). Do not escalate the initial CLI availability check — only escalate the actual deploy command.
|
|
284
|
+
|
|
285
|
+
Example guidance to the user:
|
|
286
|
+
```
|
|
287
|
+
The deploy needs escalated network access to deploy to Vercel. I can rerun
|
|
288
|
+
the command with escalated permissions — want me to proceed?
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### CLI Auth Failure
|
|
292
|
+
|
|
293
|
+
If `vercel login` or `vercel deploy` fails with authentication errors, fall back to the appropriate no-auth deploy script for the current environment.
|