@fairfox/polly 0.40.0 → 0.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Public registry surface for `@fairfox/polly/ui`.
3
+ *
4
+ * The actual data is generated from polly-ui's canonical sources by
5
+ * `scripts/build-polly-ui-registry.ts` into `registry.generated.ts`.
6
+ * This file pins the public re-export so the generator can refresh
7
+ * `registry.generated.ts` without changing the import path consumers
8
+ * use.
9
+ *
10
+ * Tokens and components are exposed as `readonly` arrays. Adding a
11
+ * token to `theme.css` (or a component to `index.ts`) shows up here
12
+ * after the next `bun run build:lib` pass; the surface is intended as
13
+ * the source of truth for downstream conformance checks like
14
+ * `polly-ui:css-vars` and `polly-ui:shared-components`.
15
+ */
16
+ export { type PollyUiComponent, type PollyUiToken, type PollyUiTokenCategory, pollyUiComponents, pollyUiTokens, } from "./registry.generated";
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Generated by scripts/build-polly-ui-registry.ts.
3
+ *
4
+ * Do not edit by hand. Edit src/polly-ui/theme.css, src/polly-ui/index.ts,
5
+ * or tools/quality/src/check-shared-components.ts and re-run the
6
+ * generator to refresh this file.
7
+ */
8
+ export type PollyUiTokenCategory = "color" | "spacing" | "radius" | "typography" | "motion" | "sizing" | "shadow" | "z-index" | "other";
9
+ export type PollyUiToken = {
10
+ name: string;
11
+ category: PollyUiTokenCategory;
12
+ default: string;
13
+ };
14
+ export type PollyUiComponent = {
15
+ name: string;
16
+ replaces: string[];
17
+ importPath: string;
18
+ };
19
+ export declare const pollyUiTokens: readonly PollyUiToken[];
20
+ export declare const pollyUiComponents: readonly PollyUiComponent[];
@@ -0,0 +1,55 @@
1
+ /**
2
+ * `polly quality attest` — sign a passing run and post a GitHub commit status.
3
+ *
4
+ * The flow:
5
+ * 1. Refuse on a dirty working tree (porcelain non-empty).
6
+ * 2. Resolve the current commit sha and the gh user.
7
+ * 3. Run every registered check via the cache. A red result aborts
8
+ * with no status posted.
9
+ * 4. Compute a digest of the commit sha plus a sorted summary of
10
+ * check results.
11
+ * 5. Post a GitHub commit status named `polly/attested/<user>` to
12
+ * that sha via the local `gh` CLI (which carries the user's
13
+ * existing authentication).
14
+ * 6. Cache the signed entry at
15
+ * `.cache/polly-quality/attest/<commit>.json` so a re-invocation
16
+ * on the same commit short-circuits to a status refresh.
17
+ *
18
+ * Auth lives in the user's `gh` CLI install rather than a `GITHUB_TOKEN`
19
+ * env var: every contributor running `polly quality attest` already
20
+ * authenticated `gh` for issue and PR work, and shelling out keeps the
21
+ * dependency surface zero.
22
+ */
23
+ import { type RegisteredCheck } from "./host";
24
+ import type { CheckRunResult, QualityRunConfig, RunReport } from "./types";
25
+ export type AttestOptions = {
26
+ rootDir: string;
27
+ registry: Map<string, RegisteredCheck>;
28
+ runConfig: QualityRunConfig;
29
+ /**
30
+ * When set, the deploy preflight command (read from
31
+ * `runConfig.attestDeploy`) runs before the post and the status
32
+ * name becomes `polly/deploy-attested/<user>`.
33
+ */
34
+ deploy?: boolean;
35
+ /** Override for the `polly` segment of the status context. */
36
+ contextPrefix?: string;
37
+ };
38
+ export type AttestResult = {
39
+ ok: boolean;
40
+ /** Posted (or would-have-posted) status context. */
41
+ context: string;
42
+ /** Commit sha the status was attached to. */
43
+ sha: string;
44
+ /** Fingerprint of the run. */
45
+ digest: string;
46
+ /** Summary lines for the CLI reporter. */
47
+ messages: string[];
48
+ /** When non-empty, attest aborted before posting. */
49
+ error?: string;
50
+ /** Underlying check report for downstream display. */
51
+ report?: RunReport;
52
+ };
53
+ export declare function summariseRunReport(report: RunReport): string;
54
+ export declare function digestRun(sha: string, results: CheckRunResult[]): string;
55
+ export declare function runAttest(opts: AttestOptions): Promise<AttestResult>;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Content-hash cache for the quality plugin host.
3
+ *
4
+ * Each check declares the files and extras that determine its result.
5
+ * The cache hashes those into a key, looks up `.cache/polly-quality/<id>.json`,
6
+ * and returns the prior result on hit. A miss re-runs the check body and
7
+ * writes a fresh entry.
8
+ *
9
+ * Files that are missing on disk hash as the literal string `<absent>`
10
+ * so removing a declared input invalidates the entry deterministically.
11
+ * Atomic writes go through a temp file + rename so a process crashing
12
+ * mid-write cannot leave a partial JSON behind that later parses to a
13
+ * malformed entry. A corrupt entry is treated as a miss with a warning;
14
+ * the check re-runs and overwrites it.
15
+ */
16
+ import type { CheckOutcome } from "./types";
17
+ export type CacheInputs = {
18
+ files: string[];
19
+ extras?: Record<string, string>;
20
+ };
21
+ export type CacheEntry = {
22
+ hash: string;
23
+ outcome: CheckOutcome;
24
+ /** Wall-clock time the entry was written; useful for debugging stale caches. */
25
+ writtenAt: string;
26
+ };
27
+ /**
28
+ * Compute a deterministic SHA-256 over (sorted file paths + content hashes
29
+ * + sorted extras). Identical inputs in any order produce the same hash;
30
+ * adding, removing, renaming, or modifying any input changes it.
31
+ */
32
+ export declare function computeInputsHash(inputs: CacheInputs, rootDir: string): Promise<string>;
33
+ export declare function getCachedOutcome(rootDir: string, checkId: string, hash: string): Promise<CheckOutcome | null>;
34
+ export declare function setCachedOutcome(rootDir: string, checkId: string, hash: string, outcome: CheckOutcome): Promise<void>;