# layout-contracts result

Completed the repository foundation without runtime stubs or dependencies.

- `package.json`: ESM package `rollup-risk` version 0.1.0, MIT, Node >=24,
  export `./src/index.ts`, bin `rollup-risk` -> `./src/cli.ts`, exact required
  test/start scripts. No dependencies, devDependencies or build step.
- `LICENSE`: standard MIT license for rollup-risk contributors, copyright 2026.
- `src/types.ts`: public erasable types for input variants, validation result and
  issue codes, seven factors, scored results and ranked results. No runtime values.
- `docs/architecture.md`: frozen signatures, input validation and issue paths,
  complete scoring rubric and limits, output formatting, ranking rules, Node
  execution conventions and parallel file ownership.

## Frozen contracts

`validateRollups(unknown): ValidationResult`,
`scoreRollup(Rollup): ScoredRollup`, and
`rankRollups(readonly Rollup[]): RankedRollup[]` are synchronous and nonmutating.
Validation accumulates required/unknown/type/value/duplicate errors without
coercion. Empty input is valid; no cross-factor rejection. Results have the
specified discriminated validation shape; scored entries have rollup, score and
ordered factor breakdown; ranked entries add consecutive rank. Public index
reexports functions and types without side effects.

Rubric, in order: stage 0/1/2 earns 0/10/20; live fraud/validity earns 20,
none 0; permissionless proving earns 10 only with live proofs; exit 0 earns 0,
(0,7) earns 5, [7,30) earns 10, >=30 earns 15; single key 0, multisig 5,
council threshold 1 earns 0, otherwise ratio >=3/4 earns 15, >=2/3 earns 10,
else 5; Ethereum blobs/calldata earns 10, external 0; force inclusion earns
10 when true, otherwise 0. Maximum 100. Every factor requires a reason.
Rank by score descending, JS string name ascending, stable exact ties; ranks 1..n.

Parallel ownership is documented for validation, scoring, ranking, API/CLI and
examples/documentation, including all six planned source files, five test files,
README, three example artifacts and example-sources documentation. This item
does not create those later runtime modules or tests.

## Commands and outcomes

All commands exited 0; Node reported v24.21.0. Initial repository file listing
and git status were empty. No install, network access or build was necessary.

```sh
pwd && rg --files -g '!lib/**' -g '!node_modules/**' -g '!artifacts/**' -g '!\.git/**' | head -60
git status --short && node --version
```

Metadata and import assertions:

```sh
node --input-type=module -e 'import assert from "node:assert/strict"; import { readFileSync } from "node:fs"; const p = JSON.parse(readFileSync("package.json", "utf8")); assert.equal(p.name, "rollup-risk"); assert.equal(p.type, "module"); assert.equal(p.engines.node, ">=24"); assert.equal(p.license, "MIT"); assert.equal(p.exports, "./src/index.ts"); assert.deepEqual(p.bin, {"rollup-risk":"./src/cli.ts"}); assert.deepEqual(p.scripts, {test:"node --test test/*.test.ts",start:"node src/cli.ts"}); for (const key of ["dependencies","devDependencies","build"]) assert.equal(Object.hasOwn(p,key),false); const types = await import("./src/types.ts"); assert.deepEqual(Object.keys(types), []); console.log("PASS: package contract and runtime-empty types module");'
```

Reported `PASS: package contract and runtime-empty types module`.

```sh
node src/types.ts && git diff --check && git status --short
mkdir -p test/scratch
node test/scratch/foundation.ts
```

Direct types execution and whitespace check succeeded without errors. Git status
showed only the newly created source paths at that stage. The disposable scratch
fixture uses `import type` for Rollup, ValidationResult and RankedRollup and
asserts identity through a representative council rollup. It reported
`PASS: direct Node 24 .ts execution with public type imports`.
This demonstrates stripping and loading, not static type checking: Node does
not type-check TypeScript. Scratch files are outside the delivered source.

## Remaining work

No unfinished work within this foundation scope. Runtime implementation,
the five complete test suites, executable CLI, README and sourced examples belong
to later owners. Accordingly, `npm test` and CLI execution were not run: their
target files do not yet exist. The package intentionally points to those future
modules rather than adding stubs. The required result is left untracked for upload.
