@raintree-technology/hig-doctor-core 0.1.3 → 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 +14 -18
- package/dist/audit.d.ts +1 -1
- package/dist/cache.d.ts +3 -3
- package/dist/index.d.ts +0 -1
- package/dist/index.js +27 -494
- package/package.json +7 -8
- package/src/analyze.ts +1 -1
- package/src/audit-generator.ts +5 -130
- package/src/audit.ts +7 -13
- package/src/baseline.ts +0 -0
- package/src/benchmark.ts +1 -1
- package/src/cache.ts +12 -11
- package/src/categorizer.ts +2 -28
- package/src/config.ts +3 -3
- package/src/index.ts +1 -10
- package/src/patterns.ts +8 -9
- package/src/scanner.ts +3 -5
- package/CHANGELOG.md +0 -58
- package/src/audit-generator.test.ts +0 -166
- package/src/audit.test.ts +0 -121
- package/src/baseline.test.ts +0 -83
- package/src/benchmark.test.ts +0 -29
- package/src/cache.test.ts +0 -90
- package/src/categorizer.test.ts +0 -51
- package/src/config.test.ts +0 -156
- package/src/engines/ast-tsx.test.ts +0 -121
- package/src/engines/swift-structural.test.ts +0 -39
- package/src/fixes.test.ts +0 -152
- package/src/patterns.test.ts +0 -872
- package/src/sarif.test.ts +0 -39
- package/src/scanner.test.ts +0 -196
package/README.md
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="https://
|
|
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
|
-
|
|
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?)
|
|
42
|
-
- `analyzeFile(content, file)
|
|
43
|
-
- `detectPatterns(content, file)
|
|
44
|
-
- `ruleCatalog()` / `getRuleById(id)
|
|
45
|
-
- `toSarif(matches, options)
|
|
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
|
|
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](
|
|
56
|
-
[
|
|
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
|
-
##
|
|
53
|
+
## Changelog and license
|
|
59
54
|
|
|
60
|
-
|
|
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
|
|
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
|
|
17
|
-
save(path: string
|
|
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";
|