reading-stone 0.0.0-stage → 0.2.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 (72) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +11 -0
  3. package/README.md +274 -2
  4. package/dist/analysis.d.ts +341 -0
  5. package/dist/analysis.js +392 -0
  6. package/dist/cognitive.d.ts +163 -0
  7. package/dist/cognitive.js +380 -0
  8. package/dist/complexity.d.ts +102 -0
  9. package/dist/complexity.js +163 -0
  10. package/dist/coverage.d.ts +78 -0
  11. package/dist/coverage.js +635 -0
  12. package/dist/detector.d.ts +41 -0
  13. package/dist/detector.js +2134 -0
  14. package/dist/discovery.d.ts +330 -0
  15. package/dist/discovery.js +930 -0
  16. package/dist/doc-coverage.d.ts +155 -0
  17. package/dist/doc-coverage.js +543 -0
  18. package/dist/extract.d.ts +209 -0
  19. package/dist/extract.js +498 -0
  20. package/dist/index.d.ts +64 -0
  21. package/dist/index.js +54 -0
  22. package/dist/internal.d.ts +75 -0
  23. package/dist/internal.js +63 -0
  24. package/dist/main.d.ts +8 -0
  25. package/dist/main.js +39 -0
  26. package/dist/models.d.ts +185 -0
  27. package/dist/models.js +170 -0
  28. package/dist/program.d.ts +207 -0
  29. package/dist/program.js +662 -0
  30. package/dist/protocol.d.ts +88 -0
  31. package/dist/protocol.js +74 -0
  32. package/dist/quality/assertions.d.ts +81 -0
  33. package/dist/quality/assertions.js +425 -0
  34. package/dist/quality/collect.d.ts +66 -0
  35. package/dist/quality/collect.js +412 -0
  36. package/dist/quality/inference.d.ts +86 -0
  37. package/dist/quality/inference.js +603 -0
  38. package/dist/quality/matchers.d.ts +129 -0
  39. package/dist/quality/matchers.js +220 -0
  40. package/dist/quality/pairing.d.ts +133 -0
  41. package/dist/quality/pairing.js +770 -0
  42. package/dist/quality/pipeline.d.ts +59 -0
  43. package/dist/quality/pipeline.js +202 -0
  44. package/dist/quality/types.d.ts +127 -0
  45. package/dist/quality/types.js +92 -0
  46. package/dist/safeio.d.ts +107 -0
  47. package/dist/safeio.js +314 -0
  48. package/dist/server.d.ts +19 -0
  49. package/dist/server.js +451 -0
  50. package/dist/signals/adapter.d.ts +103 -0
  51. package/dist/signals/adapter.js +323 -0
  52. package/dist/signals/caller-index.d.ts +117 -0
  53. package/dist/signals/caller-index.js +147 -0
  54. package/dist/signals/caller.d.ts +76 -0
  55. package/dist/signals/caller.js +108 -0
  56. package/dist/signals/evidence.d.ts +233 -0
  57. package/dist/signals/evidence.js +578 -0
  58. package/dist/signals/interface.d.ts +68 -0
  59. package/dist/signals/interface.js +87 -0
  60. package/dist/signals/jsdoc.d.ts +27 -0
  61. package/dist/signals/jsdoc.js +233 -0
  62. package/dist/signals/naming.d.ts +26 -0
  63. package/dist/signals/naming.js +160 -0
  64. package/dist/signals/routing.d.ts +163 -0
  65. package/dist/signals/routing.js +416 -0
  66. package/dist/signals/types.d.ts +146 -0
  67. package/dist/signals/types.js +99 -0
  68. package/dist/signals/visibility.d.ts +23 -0
  69. package/dist/signals/visibility.js +82 -0
  70. package/dist/taxonomy.d.ts +89 -0
  71. package/dist/taxonomy.js +217 -0
  72. package/package.json +61 -4
@@ -0,0 +1,78 @@
1
+ import type { Writable } from "node:stream";
2
+ /**
3
+ * One coverage entry (data-model.md's CoverageEntry; FR-024): a fnMap
4
+ * function with its attributed statement counts. Field names mirror the
5
+ * wire payload exactly — no camelCase/wire split applies to this record —
6
+ * and the entity is an immutable value record (convention pack AP-004).
7
+ */
8
+ export interface CoverageEntry {
9
+ /** Root-relative POSIX path of the file the fnMap function belongs to. */
10
+ readonly file: string;
11
+ /** The fnMap name verbatim, including `(anonymous_N)` forms. */
12
+ readonly function: string;
13
+ /** 1-based fnMap `decl.start.line` — the declaration start line. */
14
+ readonly start_line: number;
15
+ /** The fnMap `loc.end.line` — the body end line. */
16
+ readonly end_line: number;
17
+ /** Attributed statements with execution count > 0 (integer ≥ 0). */
18
+ readonly covered_stmts: number;
19
+ /** All attributed statements (integer ≥ 0). */
20
+ readonly total_stmts: number;
21
+ /** `(covered * 100) / total` at full float precision; 0 when total is 0. */
22
+ readonly percentage: number;
23
+ }
24
+ /**
25
+ * The `coverage` method's entry (FR-023–FR-026; the analyze-shaped surface
26
+ * T018 established): the serialized `CoverageEntry[]` payload — one entry
27
+ * per fnMap function of every conforming, contained, in-scope file entry,
28
+ * assembled in the `(file, start_line, function)` total order, and mapped
29
+ * through `serializeCoverageEntry` so every entry on the returned array is
30
+ * already wire-shaped.
31
+ *
32
+ * The returned array — not a `{functions: [...]}` wrapper — is the
33
+ * documented result shape the server wraps into its JSON-RPC success
34
+ * response (T029); both this entry and the payload are deterministic pure
35
+ * functions of the analyzed tree and artifact (Constitution Principle I:
36
+ * byte-identical repeat responses). The full degradation ladder (FR-025)
37
+ * resolves to the empty array, never a thrown error: only `resolveRoot`'s
38
+ * `InvalidRootPathError` escapes, for the server to map to `-32602`.
39
+ *
40
+ * Unlike `analyze`/`computeComplexity` there is no pipeline to prepare and
41
+ * no compiler context to own: the tree is never walked (discovery
42
+ * confinement is deliberately absent — FR-024 pins root containment and
43
+ * `patterns` only, so a document entry with no on-disk source still
44
+ * reports, research R10), and no native resource outlives the call.
45
+ *
46
+ * @param rootPath Absolute or relative project root; validated and
47
+ * realpath-resolved by `resolveRoot` (an invalid root throws
48
+ * `InvalidRootPathError`, the server maps to `-32602`). Document keys
49
+ * are contained against both this request's cwd-resolved spelling and
50
+ * the realpath form (see `containedRelativePath`).
51
+ * @param patterns The raw `patterns` parameter value; shape-validated by
52
+ * the server (`-32602`, T019) before analysis runs, normalized here
53
+ * through the same FR-001 helpers `analyze` filters with.
54
+ * @param stderr Injected diagnostic sink (Testability principle); defaults
55
+ * to `process.stderr`. Stdout is never touched.
56
+ * @returns The serialized coverage entries, `(file, start_line,
57
+ * function)`-sorted; empty on every degradation-ladder rung.
58
+ */
59
+ export declare function parseCoverage(rootPath: string, patterns: unknown, stderr?: Writable): Promise<readonly Record<string, unknown>[]>;
60
+ /**
61
+ * Serializes a `CoverageEntry` to its wire shape (FR-024): exactly the
62
+ * seven fields, emitted in the canonical sorted-key order the protocol
63
+ * layer's sorted-key serializer produces — so the server's `serialize`
64
+ * pass re-orders these keys as a structural no-op and each entry is
65
+ * wire-final in the form that serializer defines.
66
+ *
67
+ * A pure projection, deliberately without the fail-loud field validation
68
+ * `models.ts`'s record serializers apply (the `serializeComplexityEntry`
69
+ * precedent): every `CoverageEntry` is constructed at this module's single
70
+ * site from fields whose validity is structural — validated document
71
+ * strings and numbers — and the wire shape itself (exactly these seven
72
+ * keys) is pinned by `tests/coverage.test.ts`'s wire-invariant assertions.
73
+ *
74
+ * @param entry The coverage entry to serialize.
75
+ * @returns A JSON-ready object with `covered_stmts`, `end_line`, `file`,
76
+ * `function`, `percentage`, `start_line`, and `total_stmts`.
77
+ */
78
+ export declare function serializeCoverageEntry(entry: CoverageEntry): Record<string, unknown>;