A WordPress-inspired CMS whose entire backend is PiCloud Rhai scripts deployed with pic apply, plus a SvelteKit frontend. Built to dogfood the project tool, CLI, and SDK; exercises docs/kv/files/users, docs+queue+cron +pubsub triggers, the transactional-outbox notification chain, a docs before-interceptor, set_if CAS, SSE, per-app CORS, env overlays, and a durable Workflow (validate -> enrich || seo -> publish -> finalize) started with workflow::start and polled with workflow::run_status, visualized live with Svelte Flow. FINDINGS.md / SECURITY.md capture every gap, surprise, and security issue found (each tagged [PiCloud] vs [CMS]); the platform fixes for the actionable ones ship in the preceding commit. Also folds in the read-only `pic` allowlist entries added to .claude/settings.json during the session (fewer-permission-prompts). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
14 lines
650 B
Plaintext
14 lines
650 B
Plaintext
// workflow step: seo — score the post on a few SEO heuristics. Runs in PARALLEL
|
|
// with `enrich`. Output { score, warnings } (advisory; doesn't block publish).
|
|
let b = ctx.request.body;
|
|
let post = docs::collection("posts").get(b.post_id);
|
|
let d = post.data;
|
|
let warnings = [];
|
|
let score = 100;
|
|
if d.tags == () || d.tags.len() == 0 { warnings.push("no tags"); score -= 30; }
|
|
let tlen = if d.title == () { 0 } else { d.title.len() };
|
|
if tlen < 10 { warnings.push("title is short (<10 chars)"); score -= 20; }
|
|
if tlen > 70 { warnings.push("title is long (>70 chars)"); score -= 10; }
|
|
if score < 0 { score = 0; }
|
|
#{ score: score, warnings: warnings }
|