Skip to content

chore: scope public API to primitives, keep RBAC framework internal pre-publish #55

Description

@rickcedwhat-ai

Context

Before publishing to npm, we want to explicitly exclude the RBAC framework (Play, Playbook, Director, PlayHistory) from the public package surface. These APIs are still moving fast and will eventually live in their own repo that consumes sugar's primitives under the hood (same pattern as smart-table).

The primitives (attemptAction, detectState, relator, clickToOpen, verifiedFill, Outcomes, etc.) are stable enough to publish. The framework is not.

Plan

1. Strip RBAC from the public barrel

Remove play.js, playbook.js, director.js from src/index.ts.

2. Add an internal subpath entry point

Create src/playbook/index.ts re-exporting Play, Playbook, Director, PlayHistory, etc.

3. Compile RBAC to a separate output dir

Add tsconfig.playbook.json that compiles the RBAC source to dist-playbook/. Since package.json has files: ["dist"], this dir is naturally excluded from npm with no .npmignore needed.

4. Wire the subpath export

"exports": {
  ".": {
    "types": "./dist/index.d.ts",
    "import": "./dist/index.js"
  },
  "./playbook": {
    "types": "./dist-playbook/index.d.ts",
    "import": "./dist-playbook/index.js"
  }
}

The ./playbook subpath works in the repo and locally but resolves to nothing when installed from npm — a clear signal it is not public API.

5. Outcomes DSL stays in primitives

Outcomes is useful standalone and the RBAC lib simply imports it. No split needed there.

Future

When the RBAC framework matures, it moves to its own repo (playwright-playbook or similar) that lists @rickcedwhat/playwright-sugar as a peer dependency. Consumers swap the import path, not the API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions