@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,301 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Vercel deployment script for restricted sandboxes (via claimable deploy endpoint)
|
|
4
|
+
# Usage: ./deploy-sandbox.sh [project-path]
|
|
5
|
+
# Returns: JSON with previewUrl, claimUrl, deploymentId, projectId
|
|
6
|
+
|
|
7
|
+
set -euo pipefail
|
|
8
|
+
|
|
9
|
+
DEPLOY_ENDPOINT="https://codex-deploy-skills.vercel.sh/api/deploy"
|
|
10
|
+
|
|
11
|
+
# Detect framework from package.json
|
|
12
|
+
detect_framework() {
|
|
13
|
+
local pkg_json="$1"
|
|
14
|
+
|
|
15
|
+
if [ ! -f "$pkg_json" ]; then
|
|
16
|
+
echo "null"
|
|
17
|
+
return
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
local content=$(cat "$pkg_json")
|
|
21
|
+
|
|
22
|
+
# Helper to check if a package exists in dependencies or devDependencies.
|
|
23
|
+
# Use exact matching by default, with a separate prefix matcher for scoped
|
|
24
|
+
# package families like "@remix-run/".
|
|
25
|
+
has_dep_exact() {
|
|
26
|
+
echo "$content" | grep -q "\"$1\""
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
has_dep_prefix() {
|
|
30
|
+
echo "$content" | grep -q "\"$1"
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
# Order matters - check more specific frameworks first
|
|
34
|
+
|
|
35
|
+
# Blitz
|
|
36
|
+
if has_dep_exact "blitz"; then echo "blitzjs"; return; fi
|
|
37
|
+
|
|
38
|
+
# Next.js
|
|
39
|
+
if has_dep_exact "next"; then echo "nextjs"; return; fi
|
|
40
|
+
|
|
41
|
+
# Gatsby
|
|
42
|
+
if has_dep_exact "gatsby"; then echo "gatsby"; return; fi
|
|
43
|
+
|
|
44
|
+
# Remix
|
|
45
|
+
if has_dep_prefix "@remix-run/"; then echo "remix"; return; fi
|
|
46
|
+
|
|
47
|
+
# React Router (v7 framework mode)
|
|
48
|
+
if has_dep_prefix "@react-router/"; then echo "react-router"; return; fi
|
|
49
|
+
|
|
50
|
+
# TanStack Start
|
|
51
|
+
if has_dep_exact "@tanstack/start"; then echo "tanstack-start"; return; fi
|
|
52
|
+
|
|
53
|
+
# Astro
|
|
54
|
+
if has_dep_exact "astro"; then echo "astro"; return; fi
|
|
55
|
+
|
|
56
|
+
# Hydrogen (Shopify)
|
|
57
|
+
if has_dep_exact "@shopify/hydrogen"; then echo "hydrogen"; return; fi
|
|
58
|
+
|
|
59
|
+
# SvelteKit
|
|
60
|
+
if has_dep_exact "@sveltejs/kit"; then echo "sveltekit-1"; return; fi
|
|
61
|
+
|
|
62
|
+
# Svelte (standalone)
|
|
63
|
+
if has_dep_exact "svelte"; then echo "svelte"; return; fi
|
|
64
|
+
|
|
65
|
+
# Nuxt
|
|
66
|
+
if has_dep_exact "nuxt"; then echo "nuxtjs"; return; fi
|
|
67
|
+
|
|
68
|
+
# Vue with Vitepress
|
|
69
|
+
if has_dep_exact "vitepress"; then echo "vitepress"; return; fi
|
|
70
|
+
|
|
71
|
+
# Vue with Vuepress
|
|
72
|
+
if has_dep_exact "vuepress"; then echo "vuepress"; return; fi
|
|
73
|
+
|
|
74
|
+
# Gridsome
|
|
75
|
+
if has_dep_exact "gridsome"; then echo "gridsome"; return; fi
|
|
76
|
+
|
|
77
|
+
# SolidStart
|
|
78
|
+
if has_dep_exact "@solidjs/start"; then echo "solidstart-1"; return; fi
|
|
79
|
+
|
|
80
|
+
# Docusaurus
|
|
81
|
+
if has_dep_exact "@docusaurus/core"; then echo "docusaurus-2"; return; fi
|
|
82
|
+
|
|
83
|
+
# RedwoodJS
|
|
84
|
+
if has_dep_prefix "@redwoodjs/"; then echo "redwoodjs"; return; fi
|
|
85
|
+
|
|
86
|
+
# Hexo
|
|
87
|
+
if has_dep_exact "hexo"; then echo "hexo"; return; fi
|
|
88
|
+
|
|
89
|
+
# Eleventy
|
|
90
|
+
if has_dep_exact "@11ty/eleventy"; then echo "eleventy"; return; fi
|
|
91
|
+
|
|
92
|
+
# Angular / Ionic Angular
|
|
93
|
+
if has_dep_exact "@ionic/angular"; then echo "ionic-angular"; return; fi
|
|
94
|
+
if has_dep_exact "@angular/core"; then echo "angular"; return; fi
|
|
95
|
+
|
|
96
|
+
# Ionic React
|
|
97
|
+
if has_dep_exact "@ionic/react"; then echo "ionic-react"; return; fi
|
|
98
|
+
|
|
99
|
+
# Create React App
|
|
100
|
+
if has_dep_exact "react-scripts"; then echo "create-react-app"; return; fi
|
|
101
|
+
|
|
102
|
+
# Ember
|
|
103
|
+
if has_dep_exact "ember-cli" || has_dep_exact "ember-source"; then echo "ember"; return; fi
|
|
104
|
+
|
|
105
|
+
# Dojo
|
|
106
|
+
if has_dep_exact "@dojo/framework"; then echo "dojo"; return; fi
|
|
107
|
+
|
|
108
|
+
# Polymer
|
|
109
|
+
if has_dep_prefix "@polymer/"; then echo "polymer"; return; fi
|
|
110
|
+
|
|
111
|
+
# Preact
|
|
112
|
+
if has_dep_exact "preact"; then echo "preact"; return; fi
|
|
113
|
+
|
|
114
|
+
# Stencil
|
|
115
|
+
if has_dep_exact "@stencil/core"; then echo "stencil"; return; fi
|
|
116
|
+
|
|
117
|
+
# UmiJS
|
|
118
|
+
if has_dep_exact "umi"; then echo "umijs"; return; fi
|
|
119
|
+
|
|
120
|
+
# Sapper (legacy Svelte)
|
|
121
|
+
if has_dep_exact "sapper"; then echo "sapper"; return; fi
|
|
122
|
+
|
|
123
|
+
# Saber
|
|
124
|
+
if has_dep_exact "saber"; then echo "saber"; return; fi
|
|
125
|
+
|
|
126
|
+
# Sanity
|
|
127
|
+
if has_dep_exact "sanity"; then echo "sanity-v3"; return; fi
|
|
128
|
+
if has_dep_prefix "@sanity/"; then echo "sanity"; return; fi
|
|
129
|
+
|
|
130
|
+
# Storybook
|
|
131
|
+
if has_dep_prefix "@storybook/"; then echo "storybook"; return; fi
|
|
132
|
+
|
|
133
|
+
# NestJS
|
|
134
|
+
if has_dep_exact "@nestjs/core"; then echo "nestjs"; return; fi
|
|
135
|
+
|
|
136
|
+
# Elysia
|
|
137
|
+
if has_dep_exact "elysia"; then echo "elysia"; return; fi
|
|
138
|
+
|
|
139
|
+
# Hono
|
|
140
|
+
if has_dep_exact "hono"; then echo "hono"; return; fi
|
|
141
|
+
|
|
142
|
+
# Fastify
|
|
143
|
+
if has_dep_exact "fastify"; then echo "fastify"; return; fi
|
|
144
|
+
|
|
145
|
+
# h3
|
|
146
|
+
if has_dep_exact "h3"; then echo "h3"; return; fi
|
|
147
|
+
|
|
148
|
+
# Nitro
|
|
149
|
+
if has_dep_exact "nitropack"; then echo "nitro"; return; fi
|
|
150
|
+
|
|
151
|
+
# Express
|
|
152
|
+
if has_dep_exact "express"; then echo "express"; return; fi
|
|
153
|
+
|
|
154
|
+
# Vite (generic - check last among JS frameworks)
|
|
155
|
+
if has_dep_exact "vite"; then echo "vite"; return; fi
|
|
156
|
+
|
|
157
|
+
# Parcel
|
|
158
|
+
if has_dep_exact "parcel"; then echo "parcel"; return; fi
|
|
159
|
+
|
|
160
|
+
# No framework detected
|
|
161
|
+
echo "null"
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
# Parse arguments
|
|
165
|
+
INPUT_PATH="${1:-.}"
|
|
166
|
+
|
|
167
|
+
# Create temp directory for packaging
|
|
168
|
+
TEMP_DIR=$(mktemp -d)
|
|
169
|
+
TARBALL="$TEMP_DIR/project.tgz"
|
|
170
|
+
STAGING_DIR="$TEMP_DIR/staging"
|
|
171
|
+
CLEANUP_TEMP=true
|
|
172
|
+
|
|
173
|
+
cleanup() {
|
|
174
|
+
if [ "$CLEANUP_TEMP" = true ]; then
|
|
175
|
+
rm -rf "$TEMP_DIR"
|
|
176
|
+
fi
|
|
177
|
+
}
|
|
178
|
+
trap cleanup EXIT
|
|
179
|
+
|
|
180
|
+
echo "Preparing deployment..." >&2
|
|
181
|
+
|
|
182
|
+
# Check if input is a .tgz file or a directory
|
|
183
|
+
FRAMEWORK="null"
|
|
184
|
+
|
|
185
|
+
if [ -f "$INPUT_PATH" ] && [[ "$INPUT_PATH" == *.tgz ]]; then
|
|
186
|
+
# Input is already a tarball, use it directly
|
|
187
|
+
echo "Using provided tarball..." >&2
|
|
188
|
+
TARBALL="$INPUT_PATH"
|
|
189
|
+
CLEANUP_TEMP=false
|
|
190
|
+
# Can't detect framework from tarball, leave as null
|
|
191
|
+
elif [ -d "$INPUT_PATH" ]; then
|
|
192
|
+
# Input is a directory, need to tar it
|
|
193
|
+
PROJECT_PATH=$(cd "$INPUT_PATH" && pwd)
|
|
194
|
+
|
|
195
|
+
# Detect framework from package.json
|
|
196
|
+
FRAMEWORK=$(detect_framework "$PROJECT_PATH/package.json")
|
|
197
|
+
|
|
198
|
+
# Stage files into a temporary directory to avoid mutating the source tree.
|
|
199
|
+
mkdir -p "$STAGING_DIR"
|
|
200
|
+
echo "Staging project files..." >&2
|
|
201
|
+
tar -C "$PROJECT_PATH" \
|
|
202
|
+
--exclude='node_modules' \
|
|
203
|
+
--exclude='.git' \
|
|
204
|
+
--exclude='.env' \
|
|
205
|
+
--exclude='.env.*' \
|
|
206
|
+
-cf - . | tar -C "$STAGING_DIR" -xf -
|
|
207
|
+
|
|
208
|
+
# Check if this is a static HTML project (no package.json)
|
|
209
|
+
if [ ! -f "$PROJECT_PATH/package.json" ]; then
|
|
210
|
+
# Find HTML files in root
|
|
211
|
+
HTML_FILES=$(find "$STAGING_DIR" -maxdepth 1 -name "*.html" -type f)
|
|
212
|
+
HTML_COUNT=$(printf '%s\n' "$HTML_FILES" | sed '/^$/d' | wc -l | tr -d '[:space:]')
|
|
213
|
+
|
|
214
|
+
# If there's exactly one HTML file and it's not index.html, rename it
|
|
215
|
+
if [ "$HTML_COUNT" -eq 1 ]; then
|
|
216
|
+
HTML_FILE=$(echo "$HTML_FILES" | head -1)
|
|
217
|
+
BASENAME=$(basename "$HTML_FILE")
|
|
218
|
+
if [ "$BASENAME" != "index.html" ]; then
|
|
219
|
+
echo "Renaming $BASENAME to index.html..." >&2
|
|
220
|
+
mv "$HTML_FILE" "$STAGING_DIR/index.html"
|
|
221
|
+
fi
|
|
222
|
+
fi
|
|
223
|
+
fi
|
|
224
|
+
|
|
225
|
+
# Create tarball from the staging directory
|
|
226
|
+
echo "Creating deployment package..." >&2
|
|
227
|
+
tar -czf "$TARBALL" -C "$STAGING_DIR" .
|
|
228
|
+
else
|
|
229
|
+
echo "Error: Input must be a directory or a .tgz file" >&2
|
|
230
|
+
exit 1
|
|
231
|
+
fi
|
|
232
|
+
|
|
233
|
+
if [ "$FRAMEWORK" != "null" ]; then
|
|
234
|
+
echo "Detected framework: $FRAMEWORK" >&2
|
|
235
|
+
fi
|
|
236
|
+
|
|
237
|
+
# Deploy
|
|
238
|
+
echo "Deploying..." >&2
|
|
239
|
+
RESPONSE=$(curl -s -X POST "$DEPLOY_ENDPOINT" -F "file=@$TARBALL" -F "framework=$FRAMEWORK")
|
|
240
|
+
|
|
241
|
+
# Check for error in response
|
|
242
|
+
if echo "$RESPONSE" | grep -q '"error"'; then
|
|
243
|
+
ERROR_MSG=$(echo "$RESPONSE" | grep -o '"error":"[^"]*"' | cut -d'"' -f4)
|
|
244
|
+
echo "Error: $ERROR_MSG" >&2
|
|
245
|
+
exit 1
|
|
246
|
+
fi
|
|
247
|
+
|
|
248
|
+
# Extract URLs from response
|
|
249
|
+
PREVIEW_URL=$(echo "$RESPONSE" | grep -o '"previewUrl":"[^"]*"' | cut -d'"' -f4)
|
|
250
|
+
CLAIM_URL=$(echo "$RESPONSE" | grep -o '"claimUrl":"[^"]*"' | cut -d'"' -f4)
|
|
251
|
+
|
|
252
|
+
if [ -z "$PREVIEW_URL" ]; then
|
|
253
|
+
echo "Error: Could not extract preview URL from response" >&2
|
|
254
|
+
echo "$RESPONSE" >&2
|
|
255
|
+
exit 1
|
|
256
|
+
fi
|
|
257
|
+
|
|
258
|
+
echo "Deployment started. Waiting for build to complete..." >&2
|
|
259
|
+
echo "Preview URL: $PREVIEW_URL" >&2
|
|
260
|
+
|
|
261
|
+
# Poll the preview URL until it returns a non-5xx response (5xx = still building)
|
|
262
|
+
MAX_ATTEMPTS=60 # 5 minutes max (60 * 5 seconds)
|
|
263
|
+
ATTEMPT=0
|
|
264
|
+
|
|
265
|
+
while [ $ATTEMPT -lt $MAX_ATTEMPTS ]; do
|
|
266
|
+
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" "$PREVIEW_URL")
|
|
267
|
+
|
|
268
|
+
if [ "$HTTP_STATUS" -eq 200 ]; then
|
|
269
|
+
echo "" >&2
|
|
270
|
+
echo "Deployment ready!" >&2
|
|
271
|
+
break
|
|
272
|
+
elif [ "$HTTP_STATUS" -ge 500 ]; then
|
|
273
|
+
# 5xx means still building/deploying
|
|
274
|
+
echo "Building... (attempt $((ATTEMPT + 1))/$MAX_ATTEMPTS)" >&2
|
|
275
|
+
sleep 5
|
|
276
|
+
ATTEMPT=$((ATTEMPT + 1))
|
|
277
|
+
elif [ "$HTTP_STATUS" -ge 400 ] && [ "$HTTP_STATUS" -lt 500 ]; then
|
|
278
|
+
# 4xx might be an error or the app itself returns 4xx - it's responding
|
|
279
|
+
echo "" >&2
|
|
280
|
+
echo "Deployment ready (returned $HTTP_STATUS)!" >&2
|
|
281
|
+
break
|
|
282
|
+
else
|
|
283
|
+
# Any other status, assume it's ready
|
|
284
|
+
echo "" >&2
|
|
285
|
+
echo "Deployment ready!" >&2
|
|
286
|
+
break
|
|
287
|
+
fi
|
|
288
|
+
done
|
|
289
|
+
|
|
290
|
+
if [ $ATTEMPT -eq $MAX_ATTEMPTS ]; then
|
|
291
|
+
echo "" >&2
|
|
292
|
+
echo "Warning: Timed out waiting for deployment, but it may still be building." >&2
|
|
293
|
+
fi
|
|
294
|
+
|
|
295
|
+
echo "" >&2
|
|
296
|
+
echo "Preview URL: $PREVIEW_URL" >&2
|
|
297
|
+
echo "Claim URL: $CLAIM_URL" >&2
|
|
298
|
+
echo "" >&2
|
|
299
|
+
|
|
300
|
+
# Output JSON for programmatic use
|
|
301
|
+
echo "$RESPONSE"
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Vercel Deployment Script (via claimable deploy endpoint)
|
|
4
|
+
# Usage: ./deploy.sh [project-path]
|
|
5
|
+
# Returns: JSON with previewUrl, claimUrl, deploymentId, projectId
|
|
6
|
+
|
|
7
|
+
set -euo pipefail
|
|
8
|
+
|
|
9
|
+
DEPLOY_ENDPOINT="https://claude-skills-deploy.vercel.com/api/deploy"
|
|
10
|
+
|
|
11
|
+
# Detect framework from package.json
|
|
12
|
+
detect_framework() {
|
|
13
|
+
local pkg_json="$1"
|
|
14
|
+
|
|
15
|
+
if [ ! -f "$pkg_json" ]; then
|
|
16
|
+
echo "null"
|
|
17
|
+
return
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
local content=$(cat "$pkg_json")
|
|
21
|
+
|
|
22
|
+
# Helper to check if a package exists in dependencies or devDependencies.
|
|
23
|
+
# Use exact matching by default, with a separate prefix matcher for scoped
|
|
24
|
+
# package families like "@remix-run/".
|
|
25
|
+
has_dep_exact() {
|
|
26
|
+
echo "$content" | grep -q "\"$1\""
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
has_dep_prefix() {
|
|
30
|
+
echo "$content" | grep -q "\"$1"
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
# Order matters - check more specific frameworks first
|
|
34
|
+
|
|
35
|
+
# Blitz
|
|
36
|
+
if has_dep_exact "blitz"; then echo "blitzjs"; return; fi
|
|
37
|
+
|
|
38
|
+
# Next.js
|
|
39
|
+
if has_dep_exact "next"; then echo "nextjs"; return; fi
|
|
40
|
+
|
|
41
|
+
# Gatsby
|
|
42
|
+
if has_dep_exact "gatsby"; then echo "gatsby"; return; fi
|
|
43
|
+
|
|
44
|
+
# Remix
|
|
45
|
+
if has_dep_prefix "@remix-run/"; then echo "remix"; return; fi
|
|
46
|
+
|
|
47
|
+
# React Router (v7 framework mode)
|
|
48
|
+
if has_dep_prefix "@react-router/"; then echo "react-router"; return; fi
|
|
49
|
+
|
|
50
|
+
# TanStack Start
|
|
51
|
+
if has_dep_exact "@tanstack/start"; then echo "tanstack-start"; return; fi
|
|
52
|
+
|
|
53
|
+
# Astro
|
|
54
|
+
if has_dep_exact "astro"; then echo "astro"; return; fi
|
|
55
|
+
|
|
56
|
+
# Hydrogen (Shopify)
|
|
57
|
+
if has_dep_exact "@shopify/hydrogen"; then echo "hydrogen"; return; fi
|
|
58
|
+
|
|
59
|
+
# SvelteKit
|
|
60
|
+
if has_dep_exact "@sveltejs/kit"; then echo "sveltekit-1"; return; fi
|
|
61
|
+
|
|
62
|
+
# Svelte (standalone)
|
|
63
|
+
if has_dep_exact "svelte"; then echo "svelte"; return; fi
|
|
64
|
+
|
|
65
|
+
# Nuxt
|
|
66
|
+
if has_dep_exact "nuxt"; then echo "nuxtjs"; return; fi
|
|
67
|
+
|
|
68
|
+
# Vue with Vitepress
|
|
69
|
+
if has_dep_exact "vitepress"; then echo "vitepress"; return; fi
|
|
70
|
+
|
|
71
|
+
# Vue with Vuepress
|
|
72
|
+
if has_dep_exact "vuepress"; then echo "vuepress"; return; fi
|
|
73
|
+
|
|
74
|
+
# Gridsome
|
|
75
|
+
if has_dep_exact "gridsome"; then echo "gridsome"; return; fi
|
|
76
|
+
|
|
77
|
+
# SolidStart
|
|
78
|
+
if has_dep_exact "@solidjs/start"; then echo "solidstart-1"; return; fi
|
|
79
|
+
|
|
80
|
+
# Docusaurus
|
|
81
|
+
if has_dep_exact "@docusaurus/core"; then echo "docusaurus-2"; return; fi
|
|
82
|
+
|
|
83
|
+
# RedwoodJS
|
|
84
|
+
if has_dep_prefix "@redwoodjs/"; then echo "redwoodjs"; return; fi
|
|
85
|
+
|
|
86
|
+
# Hexo
|
|
87
|
+
if has_dep_exact "hexo"; then echo "hexo"; return; fi
|
|
88
|
+
|
|
89
|
+
# Eleventy
|
|
90
|
+
if has_dep_exact "@11ty/eleventy"; then echo "eleventy"; return; fi
|
|
91
|
+
|
|
92
|
+
# Angular / Ionic Angular
|
|
93
|
+
if has_dep_exact "@ionic/angular"; then echo "ionic-angular"; return; fi
|
|
94
|
+
if has_dep_exact "@angular/core"; then echo "angular"; return; fi
|
|
95
|
+
|
|
96
|
+
# Ionic React
|
|
97
|
+
if has_dep_exact "@ionic/react"; then echo "ionic-react"; return; fi
|
|
98
|
+
|
|
99
|
+
# Create React App
|
|
100
|
+
if has_dep_exact "react-scripts"; then echo "create-react-app"; return; fi
|
|
101
|
+
|
|
102
|
+
# Ember
|
|
103
|
+
if has_dep_exact "ember-cli" || has_dep_exact "ember-source"; then echo "ember"; return; fi
|
|
104
|
+
|
|
105
|
+
# Dojo
|
|
106
|
+
if has_dep_exact "@dojo/framework"; then echo "dojo"; return; fi
|
|
107
|
+
|
|
108
|
+
# Polymer
|
|
109
|
+
if has_dep_prefix "@polymer/"; then echo "polymer"; return; fi
|
|
110
|
+
|
|
111
|
+
# Preact
|
|
112
|
+
if has_dep_exact "preact"; then echo "preact"; return; fi
|
|
113
|
+
|
|
114
|
+
# Stencil
|
|
115
|
+
if has_dep_exact "@stencil/core"; then echo "stencil"; return; fi
|
|
116
|
+
|
|
117
|
+
# UmiJS
|
|
118
|
+
if has_dep_exact "umi"; then echo "umijs"; return; fi
|
|
119
|
+
|
|
120
|
+
# Sapper (legacy Svelte)
|
|
121
|
+
if has_dep_exact "sapper"; then echo "sapper"; return; fi
|
|
122
|
+
|
|
123
|
+
# Saber
|
|
124
|
+
if has_dep_exact "saber"; then echo "saber"; return; fi
|
|
125
|
+
|
|
126
|
+
# Sanity
|
|
127
|
+
if has_dep_exact "sanity"; then echo "sanity-v3"; return; fi
|
|
128
|
+
if has_dep_prefix "@sanity/"; then echo "sanity"; return; fi
|
|
129
|
+
|
|
130
|
+
# Storybook
|
|
131
|
+
if has_dep_prefix "@storybook/"; then echo "storybook"; return; fi
|
|
132
|
+
|
|
133
|
+
# NestJS
|
|
134
|
+
if has_dep_exact "@nestjs/core"; then echo "nestjs"; return; fi
|
|
135
|
+
|
|
136
|
+
# Elysia
|
|
137
|
+
if has_dep_exact "elysia"; then echo "elysia"; return; fi
|
|
138
|
+
|
|
139
|
+
# Hono
|
|
140
|
+
if has_dep_exact "hono"; then echo "hono"; return; fi
|
|
141
|
+
|
|
142
|
+
# Fastify
|
|
143
|
+
if has_dep_exact "fastify"; then echo "fastify"; return; fi
|
|
144
|
+
|
|
145
|
+
# h3
|
|
146
|
+
if has_dep_exact "h3"; then echo "h3"; return; fi
|
|
147
|
+
|
|
148
|
+
# Nitro
|
|
149
|
+
if has_dep_exact "nitropack"; then echo "nitro"; return; fi
|
|
150
|
+
|
|
151
|
+
# Express
|
|
152
|
+
if has_dep_exact "express"; then echo "express"; return; fi
|
|
153
|
+
|
|
154
|
+
# Vite (generic - check last among JS frameworks)
|
|
155
|
+
if has_dep_exact "vite"; then echo "vite"; return; fi
|
|
156
|
+
|
|
157
|
+
# Parcel
|
|
158
|
+
if has_dep_exact "parcel"; then echo "parcel"; return; fi
|
|
159
|
+
|
|
160
|
+
# No framework detected
|
|
161
|
+
echo "null"
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
# Parse arguments
|
|
165
|
+
INPUT_PATH="${1:-.}"
|
|
166
|
+
|
|
167
|
+
# Create temp directory for packaging
|
|
168
|
+
TEMP_DIR=$(mktemp -d)
|
|
169
|
+
TARBALL="$TEMP_DIR/project.tgz"
|
|
170
|
+
STAGING_DIR="$TEMP_DIR/staging"
|
|
171
|
+
CLEANUP_TEMP=true
|
|
172
|
+
|
|
173
|
+
cleanup() {
|
|
174
|
+
if [ "$CLEANUP_TEMP" = true ]; then
|
|
175
|
+
rm -rf "$TEMP_DIR"
|
|
176
|
+
fi
|
|
177
|
+
}
|
|
178
|
+
trap cleanup EXIT
|
|
179
|
+
|
|
180
|
+
echo "Preparing deployment..." >&2
|
|
181
|
+
|
|
182
|
+
# Check if input is a .tgz file or a directory
|
|
183
|
+
FRAMEWORK="null"
|
|
184
|
+
|
|
185
|
+
if [ -f "$INPUT_PATH" ] && [[ "$INPUT_PATH" == *.tgz ]]; then
|
|
186
|
+
# Input is already a tarball, use it directly
|
|
187
|
+
echo "Using provided tarball..." >&2
|
|
188
|
+
TARBALL="$INPUT_PATH"
|
|
189
|
+
CLEANUP_TEMP=false
|
|
190
|
+
# Can't detect framework from tarball, leave as null
|
|
191
|
+
elif [ -d "$INPUT_PATH" ]; then
|
|
192
|
+
# Input is a directory, need to tar it
|
|
193
|
+
PROJECT_PATH=$(cd "$INPUT_PATH" && pwd)
|
|
194
|
+
|
|
195
|
+
# Detect framework from package.json
|
|
196
|
+
FRAMEWORK=$(detect_framework "$PROJECT_PATH/package.json")
|
|
197
|
+
|
|
198
|
+
# Stage files into a temporary directory to avoid mutating the source tree.
|
|
199
|
+
mkdir -p "$STAGING_DIR"
|
|
200
|
+
echo "Staging project files..." >&2
|
|
201
|
+
tar -C "$PROJECT_PATH" \
|
|
202
|
+
--exclude='node_modules' \
|
|
203
|
+
--exclude='.git' \
|
|
204
|
+
--exclude='.env' \
|
|
205
|
+
--exclude='.env.*' \
|
|
206
|
+
-cf - . | tar -C "$STAGING_DIR" -xf -
|
|
207
|
+
|
|
208
|
+
# Check if this is a static HTML project (no package.json)
|
|
209
|
+
if [ ! -f "$PROJECT_PATH/package.json" ]; then
|
|
210
|
+
# Find HTML files in root
|
|
211
|
+
HTML_FILES=$(find "$STAGING_DIR" -maxdepth 1 -name "*.html" -type f)
|
|
212
|
+
HTML_COUNT=$(printf '%s\n' "$HTML_FILES" | sed '/^$/d' | wc -l | tr -d '[:space:]')
|
|
213
|
+
|
|
214
|
+
# If there's exactly one HTML file and it's not index.html, rename it
|
|
215
|
+
if [ "$HTML_COUNT" -eq 1 ]; then
|
|
216
|
+
HTML_FILE=$(echo "$HTML_FILES" | head -1)
|
|
217
|
+
BASENAME=$(basename "$HTML_FILE")
|
|
218
|
+
if [ "$BASENAME" != "index.html" ]; then
|
|
219
|
+
echo "Renaming $BASENAME to index.html..." >&2
|
|
220
|
+
mv "$HTML_FILE" "$STAGING_DIR/index.html"
|
|
221
|
+
fi
|
|
222
|
+
fi
|
|
223
|
+
fi
|
|
224
|
+
|
|
225
|
+
# Create tarball from the staging directory
|
|
226
|
+
echo "Creating deployment package..." >&2
|
|
227
|
+
tar -czf "$TARBALL" -C "$STAGING_DIR" .
|
|
228
|
+
else
|
|
229
|
+
echo "Error: Input must be a directory or a .tgz file" >&2
|
|
230
|
+
exit 1
|
|
231
|
+
fi
|
|
232
|
+
|
|
233
|
+
if [ "$FRAMEWORK" != "null" ]; then
|
|
234
|
+
echo "Detected framework: $FRAMEWORK" >&2
|
|
235
|
+
fi
|
|
236
|
+
|
|
237
|
+
# Deploy
|
|
238
|
+
echo "Deploying..." >&2
|
|
239
|
+
RESPONSE=$(curl -s -X POST "$DEPLOY_ENDPOINT" -F "file=@$TARBALL" -F "framework=$FRAMEWORK")
|
|
240
|
+
|
|
241
|
+
# Check for error in response
|
|
242
|
+
if echo "$RESPONSE" | grep -q '"error"'; then
|
|
243
|
+
ERROR_MSG=$(echo "$RESPONSE" | grep -o '"error":"[^"]*"' | cut -d'"' -f4)
|
|
244
|
+
echo "Error: $ERROR_MSG" >&2
|
|
245
|
+
exit 1
|
|
246
|
+
fi
|
|
247
|
+
|
|
248
|
+
# Extract URLs from response
|
|
249
|
+
PREVIEW_URL=$(echo "$RESPONSE" | grep -o '"previewUrl":"[^"]*"' | cut -d'"' -f4)
|
|
250
|
+
CLAIM_URL=$(echo "$RESPONSE" | grep -o '"claimUrl":"[^"]*"' | cut -d'"' -f4)
|
|
251
|
+
|
|
252
|
+
if [ -z "$PREVIEW_URL" ]; then
|
|
253
|
+
echo "Error: Could not extract preview URL from response" >&2
|
|
254
|
+
echo "$RESPONSE" >&2
|
|
255
|
+
exit 1
|
|
256
|
+
fi
|
|
257
|
+
|
|
258
|
+
echo "Deployment started. Waiting for build to complete..." >&2
|
|
259
|
+
echo "Preview URL: $PREVIEW_URL" >&2
|
|
260
|
+
|
|
261
|
+
# Poll the preview URL until it returns a non-5xx response (5xx = still building)
|
|
262
|
+
MAX_ATTEMPTS=60 # 5 minutes max (60 * 5 seconds)
|
|
263
|
+
ATTEMPT=0
|
|
264
|
+
|
|
265
|
+
while [ $ATTEMPT -lt $MAX_ATTEMPTS ]; do
|
|
266
|
+
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" "$PREVIEW_URL")
|
|
267
|
+
|
|
268
|
+
if [ "$HTTP_STATUS" -eq 200 ]; then
|
|
269
|
+
echo "" >&2
|
|
270
|
+
echo "Deployment ready!" >&2
|
|
271
|
+
break
|
|
272
|
+
elif [ "$HTTP_STATUS" -ge 500 ]; then
|
|
273
|
+
# 5xx means still building/deploying
|
|
274
|
+
echo "Building... (attempt $((ATTEMPT + 1))/$MAX_ATTEMPTS)" >&2
|
|
275
|
+
sleep 5
|
|
276
|
+
ATTEMPT=$((ATTEMPT + 1))
|
|
277
|
+
elif [ "$HTTP_STATUS" -ge 400 ] && [ "$HTTP_STATUS" -lt 500 ]; then
|
|
278
|
+
# 4xx might be an error or the app itself returns 4xx - it's responding
|
|
279
|
+
echo "" >&2
|
|
280
|
+
echo "Deployment ready (returned $HTTP_STATUS)!" >&2
|
|
281
|
+
break
|
|
282
|
+
else
|
|
283
|
+
# Any other status, assume it's ready
|
|
284
|
+
echo "" >&2
|
|
285
|
+
echo "Deployment ready!" >&2
|
|
286
|
+
break
|
|
287
|
+
fi
|
|
288
|
+
done
|
|
289
|
+
|
|
290
|
+
if [ $ATTEMPT -eq $MAX_ATTEMPTS ]; then
|
|
291
|
+
echo "" >&2
|
|
292
|
+
echo "Warning: Timed out waiting for deployment, but it may still be building." >&2
|
|
293
|
+
fi
|
|
294
|
+
|
|
295
|
+
echo "" >&2
|
|
296
|
+
echo "Preview URL: $PREVIEW_URL" >&2
|
|
297
|
+
echo "Claim URL: $CLAIM_URL" >&2
|
|
298
|
+
echo "" >&2
|
|
299
|
+
|
|
300
|
+
# Output JSON for programmatic use
|
|
301
|
+
echo "$RESPONSE"
|