Langsung ke konten
Skillpedia
Website & UI (frontend)41k Β· #6843

validating-and-publishing-canvases

Fungsinya

Skill ini memvalidasi sumber canvas, memeriksa izin yang dideklarasikan, dan mempublikasikannya ke PostHog dengan aman. Ditujukan untuk pembuat yang ingin merilis perubahan canvas tanpa merusaknya atau menghilangkan pekerjaan orang lain.

Kapan dipakai

  • βœ“Saat Anda selesai mengedit canvas dan ingin mempublikasikannya.
  • βœ“Saat publikasi gagal karena error validasi atau konflik versi.
  • βœ“Saat Anda ingin menguji versi baru sebelum membuatnya aktif.

Link skill

https://github.com/PostHog/posthog/blob/master/products/canvas/skills/validating-and-publishing-canvases/SKILL.md

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/PostHog/posthog/blob/master/products/canvas/skills/validating-and-publishing-canvases/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œPeriksa canvas saya dari masalah dan publikasikan, tetapi pastikan tidak ada perubahan orang lain yang tertimpa.”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

AI membaca versi terkini, memperbaiki pesan validasi yang diterimanya, dan mempublikasikan terhadap versi yang tepat itu sehingga pekerjaan yang lebih baru tidak tertimpa. Build baru kemudian masuk antrean, dan canvas menampilkan build sukses terakhir sampai build itu selesai.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.

Validating and publishing canvases

A canvas's source lives in PostHog, versioned per publish. Publishing is guarded: every edit is based on a specific version, and the server refuses to overwrite newer work. Every publish queues a server-side build, and the canvas renders the last successful build.

The source project

canvas-source-retrieve returns:

  • project β€” schemaVersion (1), files (path β†’ content), entryHtml ("index.html"), dependencies (exact platform-pinned versions), canvasSdkVersion, capabilities.
  • current_version_id β€” the version your edits are based on. Keep it; the publish needs it. It is null for a canvas that has never been published β€” pass that null on the first publish.

Keep index.html and dependencies exactly as returned. You may add relative source files and admitted assets to the project. Use ?worker for a self-contained module worker and represent binary assets as base64 entries in assets; new npm dependencies or dependency-version drift fail validation.

Declare capabilities

The host enforces project.capabilities at runtime, so an undeclared ph call builds fine and then dies in the rendered canvas. Declare:

  • capabilities.posthog.insights β€” every insight short id the canvas passes to ph.loadInsight.
  • capabilities.posthog.captureEvents β€” every event name it passes to ph.capture.
  • capabilities.posthog.inlineQueries: true β€” when it calls ph.query at all.
  • capabilities.posthog.agentRequests: true β€” when it calls ph.agent.request.
  • capabilities.connectors β€” one { "provider", "tools" } entry per third-party provider the canvas reads through ph.connectors.call, listing every tool it calls on that provider. A provider is a native id (github) or mcp:<server host> (mcp:mcp.calendly.com). Unknown providers, unregistered native tools, and private MCP hosts fail validation; every declared tool must have is_read_only: true in the catalog. An upstream hint alone does not grant access. A canvas with connectors cannot declare shared state.
  • capabilities.network.origins β€” each exact HTTPS origin used by fetch, XMLHttpRequest, or an external stylesheet, image, font, media file, or frame. Remote scripts remain blocked. Do not include paths, credentials, queries, fragments, or wildcards. The host must be public: loopback and private IPs, single-label names like intranet, and the .local, .localhost, .internal, and .home.arpa suffixes are all rejected, so a local dev host such as https://localhost:8010 fails validation with an invalid_network_origin error. Data sent to a declared origin leaves PostHog and appears in the capability review before promotion.

Before validation, inventory every literal external URL in every source file. Classify navigation links and ph.openExternal() URLs as navigation; they do not need a network origin. For every request or resource URL, declare its scheme + host + optional port only. Include every origin a request redirects to and every secondary origin a stylesheet references for fonts or images. Never infer that one CDN hostname covers another.

Validation rejects undeclared literal calls and resource URLs (capability_missing_* diagnostics) so you can fix them before publishing. Dynamic URLs and redirect destinations cannot be inferred, so the inventory is still required even when validation is clean.

Validate until clean

canvas-validate-create is side-effect free; call it as often as needed. Diagnostics carry severity, a stable code, a message, and (for file-specific problems) path and line:

  • error diagnostics block publishing β€” fix all of them. Common ones: import_not_allowed (bare imports are limited to the dependencies returned in the source project), forbidden_dynamic_import / forbidden_require / forbidden_inline_script, invalid_path, capability_missing_insight / capability_missing_capture_event / capability_missing_inline_queries / capability_missing_agent_requests / capability_missing_network_origin, dependency_not_admitted / dependency_version_mismatch, platform_token_redeclared (a CSS variable named like a Quill token that the platform stylesheet sets on every element, so the value never applies; prefix your own variables), and path/size violations.
  • warning diagnostics don't block, but heed them: network_fetch / network_xhr mean the code reaches for the network directly.
Pertanyaan umum

Bagaimana jika publikasi gagal karena konflik?

Artinya seseorang mengubah canvas setelah dibaca. AI membaca versi terbaru, menggabungkan perubahannya, dan mencoba lagi.

Mengapa saya masih melihat versi lama setelah publikasi?

PostHog menampilkan build sukses terakhir, dan build yang baru muncul setelah build dalam antrean selesai.

Mengapa panggilan data gagal setelah publikasi?

Sumber data harus dideklarasikan di pengaturan canvas sebelum canvas dapat menggunakannya.

Detail

Deskripsi asli dari pembuat

Validate and publish a canvas source project safely: the source-project shape, declared capabilities, reading the current version pointer, iterating on validation diagnostics, guarded publishing with expected_current_version_id, staging a draft build and promoting it, waiting out the queued build, and recovering from a 409 version_conflict or a 429 capacity limit without overwriting concurrent work. Use whenever a canvas edit is ready to save, a draft build is wanted, a canvas publish or build returns diagnostics or a conflict, or a task needs to understand canvas version history.

repo: PostHog/posthog

Popularitas

Bintang GitHub
41k
Peringkat
#6843
Lisensi
β€”
Diperbarui
2/11/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa