@raintree-technology/hig-doctor-core 0.1.2 → 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.
package/README.md CHANGED
@@ -1,13 +1,10 @@
1
1
  <p align="center">
2
- <img src="https://raw.githubusercontent.com/raintree-technology/hig-doctor/main/brand/hig-doctor-mark.svg" alt="HIG Doctor" width="72" height="72" />
2
+ <img src="https://apple.raintree.technology/logo.svg" alt="HIG Doctor" width="72" height="72" />
3
3
  </p>
4
4
 
5
5
  # @raintree-technology/hig-doctor-core
6
6
 
7
- **Active library for tool authors embedding HIG Doctor audits.** It provides
8
- framework detection, rule metadata, tiered analysis, and report generation.
9
-
10
- The rule engine behind [HIG Doctor](https://github.com/raintree-technology/hig-doctor): framework detection, the Apple HIG rule catalog, tiered analysis (regex → Swift structural → TypeScript-compiler JSX), and the audit pipeline. The [`hig-doctor`](../cli) CLI and [`hig-mcp`](../mcp) server are thin wrappers over this package; embed it directly to run audits from your own tooling.
7
+ The rule engine behind [HIG Doctor](https://github.com/raintree-technology/hig-doctor): framework detection, the Apple HIG rule catalog, tiered analysis (regex → Swift structural → TypeScript-compiler JSX), and the audit pipeline. The [`hig-doctor`](https://github.com/raintree-technology/hig-doctor/tree/main/packages/cli) CLI and [`hig-mcp`](https://github.com/raintree-technology/hig-doctor/tree/main/packages/mcp) server are thin wrappers over this package; embed it directly to run audits from your own tooling.
11
8
 
12
9
  ## Install
13
10
 
@@ -33,28 +30,27 @@ for (const rule of ruleCatalog()) {
33
30
  }
34
31
  ```
35
32
 
36
- Expected result: `audit` returns categorized, engine-tagged findings without
37
- sending source code over the network.
38
-
39
33
  ## Exports
40
34
 
41
- - `audit(dir, skillsDir?, options?)` — full scan → detect → categorize → report, with config, baseline, and cache support.
42
- - `analyzeFile(content, file)` — tiered per-file analysis; every match is tagged `regex` / `swift-structural` / `ast-tsx`.
43
- - `detectPatterns(content, file)` — the regex base tier alone (zero dependencies).
44
- - `ruleCatalog()` / `getRuleById(id)` — stable rule IDs, severities, engines, HIG citations, and fix guidance.
45
- - `toSarif(matches, options)` — SARIF 2.1.0 with optional suggested fixes.
35
+ - `audit(dir, skillsDir?, options?)`: full scan → detect → categorize → report, with config, baseline, and cache support.
36
+ - `analyzeFile(content, file)`: tiered per-file analysis; every match is tagged `regex` / `swift-structural` / `ast-tsx`.
37
+ - `detectPatterns(content, file)`: the regex base tier alone (zero dependencies).
38
+ - `ruleCatalog()` / `getRuleById(id)`: stable rule IDs, severities, engines, HIG citations, and fix guidance.
39
+ - `toSarif(matches, options)`: SARIF 2.1.0 with optional suggested fixes.
46
40
  - `createBaseline` / `applyBaseline`, `loadConfig` / `applyConfig`, `suggestFix` / `applyFixes`, `ScanCache`.
47
41
 
48
42
  The `ast-tsx` tier uses the TypeScript compiler when the optional `typescript` dependency is present, and falls back to the regex tier otherwise.
49
43
 
50
44
  ## Compatibility and limits
51
45
 
52
- The package runs on Node 20+ and Bun. It is a static review aid, not proof of
46
+ The package runs on Node 22+ and Bun. It is a static review aid, not proof of
53
47
  HIG conformance, accessibility, or design quality. Apple-platform checks cite
54
48
  the HIG directly; other surfaces use aligned interface-quality rules. See the
55
- [project guide](../../README.md), [benchmark](../../docs/benchmark.md), and
56
- [security policy](../../SECURITY.md).
49
+ [project guide](https://github.com/raintree-technology/hig-doctor/blob/main/README.md),
50
+ [rule catalog](https://github.com/raintree-technology/hig-doctor#framework-coverage), and
51
+ [security policy](https://github.com/raintree-technology/hig-doctor/blob/main/SECURITY.md).
57
52
 
58
- ## License
53
+ ## Changelog and license
59
54
 
60
- MIT. Apple HIG reference content the engine cites is © Apple Inc. — see the repository [THIRD_PARTY_NOTICES.md](../../THIRD_PARTY_NOTICES.md).
55
+ Release notes: [CHANGELOG.md](https://github.com/raintree-technology/hig-doctor/blob/main/CHANGELOG.md). MIT licensed. Apple HIG content is
56
+ © Apple Inc.; see [THIRD_PARTY_NOTICES.md](https://github.com/raintree-technology/hig-doctor/blob/main/THIRD_PARTY_NOTICES.md).
package/dist/audit.d.ts CHANGED
@@ -28,7 +28,7 @@ export interface AuditResult {
28
28
  baselinePath: string | null;
29
29
  /** Concerns absorbed by the baseline (hidden from results and gating). */
30
30
  baselined: number;
31
- /** Baseline occurrences that no longer match anything — time to re-snapshot. */
31
+ /** Baseline occurrences that no longer match anything (time to re-snapshot). */
32
32
  baselineStale: number;
33
33
  /** Cache hit/miss counts when the cache is enabled, else null. */
34
34
  cacheStats: {
package/dist/cache.d.ts CHANGED
@@ -2,6 +2,7 @@ import { type PatternMatch } from "./patterns";
2
2
  export declare const CACHE_FILENAME = ".hig-cache.json";
3
3
  export declare class ScanCache {
4
4
  private entries;
5
+ private touched;
5
6
  private hits;
6
7
  private misses;
7
8
  private constructor();
@@ -13,7 +14,6 @@ export declare class ScanCache {
13
14
  hits: number;
14
15
  misses: number;
15
16
  };
16
- /** Persist only the keys touched this run, so deleted files don't accumulate. */
17
- save(path: string, touched: Set<string>): Promise<void>;
18
- keyOf(path: string, content: string): string;
17
+ /** Persist only entries read or written this run, so deleted files drop out. */
18
+ save(path: string): Promise<void>;
19
19
  }
package/dist/index.d.ts CHANGED
@@ -11,4 +11,3 @@ export { createBaseline, applyBaseline, loadBaseline, parseBaseline, writeBaseli
11
11
  export { ScanCache, CACHE_FILENAME } from "./cache";
12
12
  export { toSarif, type SarifOptions, } from "./sarif";
13
13
  export { suggestFix, suggestFixInContent, applyFixes, isFixable, type SuggestedFix, type FixApplication, } from "./fixes";
14
- export { runBenchmark, BENCHMARK_CASES, type BenchmarkCase, type BenchmarkReport, type RuleScore, } from "./benchmark";