open-index/open-npm huggingface dataset:
npm package: @pyhall/cli
Description: pyhall CLI — Worker Class Protocol taxonomy browser, search, and worker scaffolder
Latest version: 0.2.0

# @pyhall/cli — Worker Class Protocol CLI

The `pyhall` command-line tool for the [Worker Class Protocol](https://workerclassprotocol.dev). Browse the WCP taxonomy, search capabilities and workers, explain WCP concepts, scaffold new workers, and query the pyhall.dev registry.

**WCP version:** 0.1
**Package version:** 0.2.0

## Install

```bash
npm install -g @pyhall/cli
```

## Commands

```
pyhall browse              Browse the WCP taxonomy interactively
pyhall search <query>      Search capabilities, workers, and controls
pyhall explain <id>        Explain a WCP entity (cap.*, wrk.*, ctrl.*)
pyhall scaffold            Scaffold a new WCP worker
pyhall registry status     Check pyhall.dev registry health
pyhall registry verify <id>  Verify a worker's attestation status
pyhall version             Print version info
```

## Quick start

```bash
# Search the taxonomy
pyhall search "file write"

# Explain a capability
pyhall explain cap.fs.write.local.v1

# Check registry health
pyhall registry status

# Verify a worker
pyhall registry verify x.my.worker
```

## Registry commands

The `registry` subcommand queries [api.pyhall.dev](https://pyhall.dev):

```bash
pyhall registry status                          # API health check
pyhall registry verify <worker-id>              # Worker attestation status
pyhall registry verify <worker-id> --registry-url https://api.pyhall.dev
```

## Related packages

- [`@pyhall/core`](https://www.npmjs.com/package/@pyhall/core) — TypeScript routing engine (SDK)
- [`pyhall-wcp`](https://pypi.org/project/pyhall-wcp/) — Python SDK

## Links

- [pyhall.dev](https://pyhall.dev) — Documentation and registry
- [WCP Spec](https://workerclassprotocol.dev) — Protocol specification
- [GitHub](https://github.com/fafolab/pyhall) — Source code

## License

Apache-2.0
npm package: @pyhall/core
Description: PyHall TypeScript — WCP Worker Class Protocol reference implementation
Latest version: 0.2.0

# @pyhall/core — TypeScript WCP Reference Implementation

The TypeScript/Node.js port of [PyHall](../pyhall/) — the Worker Class Protocol reference implementation.

**WCP version:** 0.1
**Package version:** 0.1.0

## Install

```bash
npm install @pyhall/core
```

## Quick start

```typescript
import { makeDecision, Registry, loadRulesFromDoc } from "@pyhall/core";

const rules = loadRulesFromDoc({
  rules: [
    {
      rule_id: "rr_hello_dev_001",
      match: { capability_id: "cap.hello.greet", env: { in: ["dev", "stage"] } },
      decision: {
        candidate_workers_ranked: [
          { worker_species_id: "wrk.hello.greeter", score_hint: 1.0 }
        ],
        required_controls_suggested: ["ctrl.obs.audit-log-append-only"],
        escalation: { policy_gate: false },
        preconditions: {},
      },
    }
  ]
});

const registry = new Registry();
registry.enroll({
  worker_id: "org.example.hello-greeter",
  worker_species_id: "wrk.hello.greeter",
  capabilities: ["cap.hello.greet"],
  currently_implements: ["ctrl.obs.audit-log-append-only"],
});

const decision = makeDecision({
  inp: {
    capability_id: "cap.hello.greet",
    env: "dev",
    data_label: "PUBLIC",
    tenant_risk: "low",
    qos_class: "P2",
    tenant_id: "demo",
    correlation_id: "550e8400-e29b-41d4-a716-446655440000",
  },
  rules,
  registryControlsPresent: registry.controlsPresent(),
  registryWorkerAvailable: (id) => registry.workerAvailable(id),
});

console.log(decision.denied);                      // false
console.log(decision.selected_worker_species_id);  // "wrk.hello.greeter"
console.log(decision.telemetry_envelopes.length);  // 3
```

## Build

```bash
npm run build    # tsc → dist/
npm test         # jest (21 tests)
npm run typecheck  # tsc --noEmit
```

## Package structure

```
src/
  models.ts       — TypeScript interfaces for RouteInput, RouteDecision, etc.
  router.ts       — makeDecision() — the routing engine
  rules.ts        — Rule type, loadRulesFromDoc(), routeFirstMatch()
  registry.ts     — Registry class
  policyGate.ts   — PolicyGate stub
  telemetry.ts    — telemetry envelope builders
  conformance.ts  — conformance validation
  common.ts       — nowUtc(), sha256Hex(), ok/err/partial helpers
  index.ts        — public API exports
workers/examples/
  hello-worker/   — minimal canonical worker example
tests/
  router.test.ts  — Jest test suite (21 tests, mirrors Python)
```

## Design choices vs Python

| Concern | Python | TypeScript |
|---------|--------|------------|
| Data models | Pydantic `BaseModel` | TypeScript `interface` |
| `makeDecision()` signature | Positional args | Single options object |
| UUID | `uuid.uuid4()` | `crypto.randomUUID()` with fallback |
| SHA-256 | `hashlib.sha256` | Node `crypto.createHash` / `SubtleCrypto` for browser |
| Runtime validation | Pydantic | Optional Zod (peer dep) |
| Browser compat | N/A | `src/` has no Node-only APIs except `sha256Hex` |

See [WCP_SPEC.md](https://github.com/fafolab/wcp/blob/main/WCP_SPEC.md) for the protocol specification.