* feat(harmony): project HarmonyOS package inventory evidence First HarmonyOS increment from #1431: HAP, HSP, and App Pack roots are classified through the hardened ZIP reader and projected into an execution-free application graph with packaging-model hints, exact component paths and hashes, App Pack children by path, runtime-family hints, and path-based N-API bridge hypotheses. HarmonyOS .har stays unclassified by suffix because .har also names HTTP Archive JSON. Adds the project_harmony_application_graph tool (CLI and MCP), synthetic composition coverage, a pinned real-package verify lane, and docs. * refactor(domain): share application graph projection scaffolding The HarmonyOS projection mirrors the Android and Apple projections by design, which pushed jscpd duplication over its 2.5 percent budget. Extract the identical pieces (inventory input schema, projected component schema and occurrence flattening, bridge candidate schema factory, coverage assembly, comparator, canonical digest) into domain/mobileApplicationGraphProjection.ts and route all three projections plus the composition fixtures through it. Duplication drops from 2.52 to 2.49 percent with no behavior change: projection ids, classifications, and limitations are byte-identical. * fix(harmony): address review, stable app-pack roots, and rotated fixture - rebased onto main; the shared projection scaffolding now keeps main's nativeRuntimeConvention loop and the harmony runtime families adopt the same react-native/flutter/unity path conventions - the .app App Pack suffix is now a root-input rule only (verified ZIP magic in classifyRootFormat and BinaryTargetResolver); nested .app ZIP members inside other packages keep the generic zip classification, with a regression test, so existing inventories do not change - the signing limitation now states that an empty signing list does not mean unsigned because packaging-tool signatures live in the ZIP signing block, and the app-pack root rule is disclosed as suffix-based - repinned the real-package fixture to the current VHome 2.6.14-beta asset after the upstream deleted v5.0.111-beta and replaced the v2.6.14-beta asset within hours; the pin records both observed digests --------- Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
56 lines
2.2 KiB
TypeScript
56 lines
2.2 KiB
TypeScript
import { AsarArtifactReader } from "../AsarArtifactReader.js";
|
|
import type { ArtifactReader } from "../ArtifactReader.js";
|
|
import { DirectoryArtifactReader } from "../DirectoryArtifactReader.js";
|
|
import { MachOSliceArtifactReader } from "../MachOSliceArtifactReader.js";
|
|
import { NativeDmgArtifactReader } from "../NativeDmgArtifactReader.js";
|
|
import { ZipArtifactReader } from "../ZipArtifactReader.js";
|
|
import type { ArtifactOccurrence } from "../../domain/artifactGraph.js";
|
|
import {
|
|
isZipPackageFormat,
|
|
ZIP_NON_ENTRY_TAIL_LIMITATION,
|
|
} from "../../domain/zipPackageFormat.js";
|
|
import type { StableRegularFileDescriptor } from "../../filesystem/RegularFile.js";
|
|
|
|
export const createReader = (
|
|
path: string,
|
|
format: ArtifactOccurrence["artifact_format"],
|
|
environment: Readonly<NodeJS.ProcessEnv>,
|
|
rootSource?: StableRegularFileDescriptor,
|
|
): ArtifactReader | undefined => {
|
|
if (isZipPackageFormat(format))
|
|
return new ZipArtifactReader(path, format, undefined, rootSource);
|
|
switch (format) {
|
|
case "directory":
|
|
return new DirectoryArtifactReader(path);
|
|
case "asar":
|
|
return new AsarArtifactReader(path);
|
|
case "mach-o-universal":
|
|
return process.platform === "darwin"
|
|
? new MachOSliceArtifactReader(path, environment, undefined, rootSource)
|
|
: undefined;
|
|
case "dmg":
|
|
if (process.platform !== "darwin") return undefined;
|
|
return new NativeDmgArtifactReader(path, environment);
|
|
default:
|
|
return undefined;
|
|
}
|
|
};
|
|
|
|
export const inventoryLimitations = (
|
|
format: ArtifactOccurrence["artifact_format"],
|
|
reader: ArtifactReader | undefined,
|
|
): string[] => {
|
|
if (reader !== undefined)
|
|
return isZipPackageFormat(reader.format)
|
|
? [ZIP_NON_ENTRY_TAIL_LIMITATION]
|
|
: [];
|
|
// dmg and pkg reach here only after classifyRootFormat matched their bytes.
|
|
if (format === "dmg" || format === "pkg")
|
|
return [
|
|
`${format.toUpperCase()} root hash is observed; child inventory requires a native macOS adapter.`,
|
|
];
|
|
if (format === "mach-o-universal" && process.platform !== "darwin")
|
|
return ["Universal Mach-O slices require the native macOS lipo adapter."];
|
|
return ["Artifact has no child container entries."];
|
|
};
|