Docs

DSL Adapter

@cuitty/scrape/dsl is the package entry point for the .cuitty authoring layer. The current implementation exports the adapter descriptor and artifact serialization helper.

Adapter Descriptor

scrapeDslBlockAdapter describes the product, block name, extensions, and legacy formats.

import { scrapeDslBlockAdapter } from "@cuitty/scrape/dsl";

console.log(scrapeDslBlockAdapter.product);
console.log(scrapeDslBlockAdapter.block);
console.log(scrapeDslBlockAdapter.extensions.join(","));

The scrape Block

A rendered block includes:

FieldSource
urlartifact.source.url
intentartifact.source.intent
pathartifact.path
step blocksRecorded artifact steps and selector targets

artifactToCuitty

artifactToCuitty(artifact) converts a ScrapeArtifact into a best-effort .cuitty block.

import { artifactToCuitty } from "@cuitty/scrape/dsl";
import type { ScrapeArtifact } from "@cuitty/scrape/types";

const artifact: ScrapeArtifact = {
  id: "art_example",
  version: 1,
  source: { url: "https://example.com", intent: "Click continue" },
  path: "interactive",
  steps: [
    {
      id: "s0",
      verb: "click",
      selectors: { testId: "continue" },
    },
  ],
  healing: { enabled: true, healCount: 0 },
  createdAt: new Date(0).toISOString(),
  createdBy: "docs",
};

console.log(artifactToCuitty(artifact));

Integration with @cuitty/dsl

The full shared DSL adapter and round-trip parser live in the suite-level DSL work. Until that lands, this package exposes the scrape-side descriptor and serializer so downstream integrations can depend on the public subpath without importing engine code.

Current Limits

The shipped helper serializes artifacts. It does not yet parse arbitrary .cuitty text back into a ScrapeRequest, validate a Zod block schema, or perform full import/export round trips. Those items are tracked in the DSL implementation work.