@fairfox/polly 0.40.0 → 0.49.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.
Files changed (44) hide show
  1. package/README.md +16 -14
  2. package/dist/src/background/index.d.ts +1 -0
  3. package/dist/src/background/index.js +65 -2
  4. package/dist/src/background/index.js.map +8 -7
  5. package/dist/src/background/message-router.js.map +4 -4
  6. package/dist/src/client/index.js.map +2 -2
  7. package/dist/src/elysia/index.js.map +1 -1
  8. package/dist/src/index.js.map +6 -6
  9. package/dist/src/mesh-node.js.map +3 -3
  10. package/dist/src/mesh.js +25 -4
  11. package/dist/src/mesh.js.map +12 -12
  12. package/dist/src/peer.js.map +4 -4
  13. package/dist/src/polly-ui/registry.d.ts +16 -0
  14. package/dist/src/polly-ui/registry.generated.d.ts +20 -0
  15. package/dist/src/shared/adapters/index.js.map +3 -3
  16. package/dist/src/shared/lib/context-helpers.js.map +4 -4
  17. package/dist/src/shared/lib/mesh-webrtc-adapter.d.ts +24 -1
  18. package/dist/src/shared/lib/message-bus.js.map +4 -4
  19. package/dist/src/shared/lib/resource.js.map +3 -3
  20. package/dist/src/shared/lib/state.js.map +3 -3
  21. package/dist/src/shared/state/app-state.js.map +3 -3
  22. package/dist/tools/quality/src/attest.d.ts +55 -0
  23. package/dist/tools/quality/src/cache.d.ts +34 -0
  24. package/dist/tools/quality/src/cli.js +1881 -2
  25. package/dist/tools/quality/src/cli.js.map +14 -4
  26. package/dist/tools/quality/src/config.d.ts +18 -0
  27. package/dist/tools/quality/src/host.d.ts +46 -0
  28. package/dist/tools/quality/src/index.d.ts +7 -0
  29. package/dist/tools/quality/src/index.js +1780 -1
  30. package/dist/tools/quality/src/index.js.map +14 -4
  31. package/dist/tools/quality/src/plugins/cliche-checks.d.ts +16 -0
  32. package/dist/tools/quality/src/plugins/core-checks.d.ts +20 -0
  33. package/dist/tools/quality/src/plugins/core.d.ts +18 -0
  34. package/dist/tools/quality/src/plugins/extra-checks.d.ts +14 -0
  35. package/dist/tools/quality/src/plugins/import-checks.d.ts +16 -0
  36. package/dist/tools/quality/src/plugins/polly-ui.d.ts +31 -0
  37. package/dist/tools/quality/src/types.d.ts +104 -0
  38. package/dist/tools/test/src/browser/index.js.map +1 -1
  39. package/dist/tools/test/src/browser/run.js.map +1 -1
  40. package/dist/tools/verify/src/cli.js +325 -227
  41. package/dist/tools/verify/src/cli.js.map +10 -9
  42. package/dist/tools/verify/src/config.js.map +2 -2
  43. package/dist/tools/visualize/src/cli.js.map +3 -3
  44. package/package.json +9 -2
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Loader for the `quality` block of `polly.config.ts`.
3
+ *
4
+ * Consumers express their plugin set as
5
+ *
6
+ * export default {
7
+ * quality: {
8
+ * plugins: [pollyCorePlugin, pollyUiPlugin, localPlugin],
9
+ * checks: { "polly:no-as-casting": { exclude: ["build"] } },
10
+ * },
11
+ * };
12
+ *
13
+ * If no config is found, the loader returns `pollyCorePlugin` only —
14
+ * that's the minimum useful default and matches the surface every
15
+ * polly consumer already gets.
16
+ */
17
+ import type { QualityRunConfig } from "./types";
18
+ export declare function loadQualityConfig(rootDir: string, explicitPath?: string): Promise<QualityRunConfig>;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Plugin host for `@fairfox/polly/quality`.
3
+ *
4
+ * Loads plugins, validates check ids and per-check config, and runs
5
+ * checks in parallel against a `rootDir`. Each check goes through the
6
+ * cache layer first: a content-hash hit returns the prior outcome
7
+ * without invoking the body; a miss runs and persists the result.
8
+ *
9
+ * Errors thrown inside a check are caught and reported as a failed
10
+ * `CheckRunResult` so one broken plugin does not abort the whole run.
11
+ */
12
+ import type { Check, QualityPlugin, QualityRunConfig, RunReport } from "./types";
13
+ export type RegisteredCheck = {
14
+ check: Check<unknown>;
15
+ plugin: QualityPlugin;
16
+ };
17
+ /**
18
+ * Build a flat id-keyed registry from the configured plugins. Throws on
19
+ * plugin name collision or check id collision (within or across
20
+ * plugins) so misconfiguration fails at load time, not at run time.
21
+ */
22
+ export declare function registerPlugins(plugins: QualityPlugin[]): Map<string, RegisteredCheck>;
23
+ /**
24
+ * Validate that every per-check config block in the run config is
25
+ * accepted by the corresponding check's `validate` function. Surfaces all
26
+ * errors at once rather than aborting on the first.
27
+ */
28
+ export declare function validateRunConfig(registry: Map<string, RegisteredCheck>, runConfig: QualityRunConfig): string[];
29
+ export type RunOptions = {
30
+ rootDir: string;
31
+ /** When set, skip cache reads and writes. */
32
+ noCache?: boolean;
33
+ /** Concurrency cap; defaults to the number of registered checks. */
34
+ concurrency?: number;
35
+ signal?: AbortSignal;
36
+ };
37
+ /**
38
+ * Run a set of checks. If `ids` is undefined, runs every registered check.
39
+ * Returns a `RunReport` with per-check results plus an aggregate `ok`.
40
+ */
41
+ export declare function runChecks(registry: Map<string, RegisteredCheck>, runConfig: QualityRunConfig, ids: string[] | undefined, opts: RunOptions): Promise<RunReport>;
42
+ export declare function listChecks(registry: Map<string, RegisteredCheck>): Array<{
43
+ id: string;
44
+ description: string;
45
+ plugin: string;
46
+ }>;
@@ -38,3 +38,10 @@ export { logger, type QualityLogger, resetLogger, } from "./logger.ts";
38
38
  export { type CheckResult, checkNoAsCasting, isLineClean, suggestFix, type Violation, } from "./no-as-casting";
39
39
  export { checkNoRequire, isLineRequireClean, type NoRequireCheckOptions, type NoRequireCheckResult, type NoRequireViolation, } from "./no-require";
40
40
  export { type CheckGitignoreOptions, type CheckSecretsOptions, checkGitignoreCoversAllowlist, checkSecrets, type GitignoreCheckResult, type SecretsCheckResult, } from "./secrets.ts";
41
+ export { type AttestOptions, type AttestResult, digestRun, runAttest, summariseRunReport, } from "./attest";
42
+ export { type CacheEntry, type CacheInputs, computeInputsHash, getCachedOutcome, setCachedOutcome, } from "./cache";
43
+ export { loadQualityConfig } from "./config";
44
+ export { listChecks, type RegisteredCheck, type RunOptions, registerPlugins, runChecks, validateRunConfig, } from "./host";
45
+ export { POLLY_CORE_VERSION, pollyCorePlugin } from "./plugins/core";
46
+ export { POLLY_UI_PLUGIN_VERSION, pollyUiPlugin } from "./plugins/polly-ui";
47
+ export type { Check, CheckContext, CheckOutcome, CheckRunResult, QualityPlugin, QualityRunConfig, RunReport, } from "./types";