apphx 1.1.0 → 2.0.1
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 +50 -182
- package/benchmarks/peer-context-worker.mjs +186 -0
- package/benchmarks/peer-context.mjs +150 -0
- package/dist/apple-types.js.map +1 -1
- package/dist/cli.js +370 -118
- package/dist/cli.js.map +1 -1
- package/dist/config.js +42 -4
- package/dist/config.js.map +1 -1
- package/dist/dependencies.js +455 -16
- package/dist/dependencies.js.map +1 -1
- package/dist/export-options.js +44 -2
- package/dist/export-options.js.map +1 -1
- package/dist/flutter.js +13 -25
- package/dist/flutter.js.map +1 -1
- package/dist/go-dependencies.js +389 -0
- package/dist/go-dependencies.js.map +1 -0
- package/dist/inbox.js +7 -8
- package/dist/inbox.js.map +1 -1
- package/dist/integrations.js +30 -3
- package/dist/integrations.js.map +1 -1
- package/dist/isolation.js +190 -0
- package/dist/isolation.js.map +1 -0
- package/dist/macos.js +57 -0
- package/dist/macos.js.map +1 -0
- package/dist/mygo-build.js +55 -0
- package/dist/mygo-build.js.map +1 -0
- package/dist/policy.js +22 -0
- package/dist/policy.js.map +1 -0
- package/dist/preflight.js +1 -1
- package/dist/process.js +3 -3
- package/dist/project-profiles.js +163 -0
- package/dist/project-profiles.js.map +1 -0
- package/dist/proof.js +33 -0
- package/dist/proof.js.map +1 -0
- package/dist/remote.js +1 -1
- package/dist/runner.js +269 -287
- package/dist/runner.js.map +1 -1
- package/dist/scheduler.js +0 -3
- package/dist/scheduler.js.map +1 -1
- package/dist/schemas.js +156 -44
- package/dist/schemas.js.map +1 -1
- package/dist/store.js +166 -44
- package/dist/store.js.map +1 -1
- package/dist/vendor/obfuscator/dist/cli.js +72 -0
- package/dist/vendor/obfuscator/dist/cli.js.map +1 -0
- package/dist/vendor/obfuscator/dist/code.js +585 -0
- package/dist/vendor/obfuscator/dist/code.js.map +1 -0
- package/dist/vendor/obfuscator/dist/common.js +262 -0
- package/dist/vendor/obfuscator/dist/common.js.map +1 -0
- package/dist/vendor/obfuscator/dist/config.js +123 -0
- package/dist/vendor/obfuscator/dist/config.js.map +1 -0
- package/dist/vendor/obfuscator/dist/content.js +89 -0
- package/dist/vendor/obfuscator/dist/content.js.map +1 -0
- package/dist/vendor/obfuscator/dist/obfuscate.js +93 -0
- package/dist/vendor/obfuscator/dist/obfuscate.js.map +1 -0
- package/dist/vendor/obfuscator/dist/png.js +283 -0
- package/dist/vendor/obfuscator/dist/png.js.map +1 -0
- package/dist/vendor/obfuscator/dist/project.js +159 -0
- package/dist/vendor/obfuscator/dist/project.js.map +1 -0
- package/dist/vendor/obfuscator/dist/resources.js +335 -0
- package/dist/vendor/obfuscator/dist/resources.js.map +1 -0
- package/dist/vendor/obfuscator/package.json +22 -0
- package/dist/workspace.js +113 -0
- package/dist/workspace.js.map +1 -0
- package/evals/control.mjs +73 -0
- package/evals/expectations.mjs +37 -0
- package/evals/host.mjs +51 -0
- package/evals/oracle.mjs +80 -0
- package/evals/policy.mjs +268 -0
- package/examples/android-java.factory.json +18 -0
- package/examples/android-java.json +16 -0
- package/examples/existing-project.factory.json +18 -0
- package/examples/existing-project.json +17 -0
- package/examples/expo.eas.json +17 -0
- package/examples/expo.factory.json +18 -0
- package/examples/expo.json +16 -0
- package/examples/factory.json +0 -2
- package/examples/flutter.factory.json +13 -0
- package/examples/flutter.json +16 -0
- package/examples/luggage.json +5 -3
- package/examples/mygo-web.factory.json +18 -0
- package/examples/mygo-web.json +16 -0
- package/examples/mygo.factory.json +18 -0
- package/examples/mygo.json +16 -0
- package/examples/react-native.factory.json +18 -0
- package/examples/react-native.json +16 -0
- package/examples/runtime/android-java/app/build.gradle +7 -0
- package/examples/runtime/android-java/app/src/main/AndroidManifest.xml +8 -0
- package/examples/runtime/android-java/app/src/main/java/dev/apphx/runtime/MainActivity.java +44 -0
- package/examples/runtime/android-java/sdk-build.mjs +29 -0
- package/examples/runtime/android-java/settings.gradle +2 -0
- package/examples/runtime/android-ui.mjs +70 -0
- package/examples/runtime/mygo-native/go.mod +13 -0
- package/examples/runtime/mygo-native/go.sum +10 -0
- package/examples/runtime/mygo-native/main.go +173 -0
- package/examples/runtime/mygo-native/main_test.go +14 -0
- package/examples/runtime/mygo-native/mygo.json +1 -0
- package/examples/runtime/mygo-web/bun.lock +15 -0
- package/examples/runtime/mygo-web/go.mod +9 -0
- package/examples/runtime/mygo-web/go.sum +8 -0
- package/examples/runtime/mygo-web/index.html +1 -0
- package/examples/runtime/mygo-web/main.go +60 -0
- package/examples/runtime/mygo-web/mygo.config.ts +10 -0
- package/examples/runtime/mygo-web/package.json +1 -0
- package/examples/runtime/mygo-web/src/main.ts +23 -0
- package/examples/runtime/mygo-web/src/mygo.ts +14 -0
- package/examples/swift.factory.json +18 -0
- package/examples/swift.json +16 -0
- package/examples/uni-app.factory.json +18 -0
- package/examples/uni-app.json +16 -0
- package/package.json +12 -5
- package/scripts/bundle-obfuscator.mjs +19 -0
- package/scripts/runtime-smoke.mjs +209 -0
- package/skills/apphx/SKILL.md +94 -17
- package/skills/apphx/resources/google-play-research-result.json +6 -0
- package/skills/apphx/resources/local-research-result.json +6 -0
- package/skills/apphx/resources/requirement.json +5 -8
- package/skills/apphx/resources/research-result.json +5 -14
- package/skills/apphx/resources/review-result.json +1 -1
- package/dist/apple.js +0 -900
- package/dist/apple.js.map +0 -1
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { inside } from "./config.js";
|
|
2
|
+
import { parseGoManifest } from "./go-dependencies.js";
|
|
3
|
+
import { generatedModulePaths, isGeneratedPath } from "./dependencies.js";
|
|
4
|
+
import { lstatSync, readFileSync, readdirSync } from "node:fs";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import { parseDocument } from "yaml";
|
|
7
|
+
// src/project-profiles.ts
|
|
8
|
+
function file(root, path) {
|
|
9
|
+
const absolute = inside(root, path);
|
|
10
|
+
const stat = lstatSync(absolute, { throwIfNoEntry: false });
|
|
11
|
+
if (!stat) return void 0;
|
|
12
|
+
if (!stat.isFile() || stat.isSymbolicLink()) throw new Error(`Project manifest must be a regular source file: ${path}`);
|
|
13
|
+
return readFileSync(absolute, "utf8");
|
|
14
|
+
}
|
|
15
|
+
function json(root, path, comments = false) {
|
|
16
|
+
let text = file(root, path);
|
|
17
|
+
if (text === void 0) return void 0;
|
|
18
|
+
if (comments) text = text.replace(/"(?:\\.|[^"\\])*"|\/\*[\s\S]*?\*\/|\/\/[^\r\n]*/g, (token) => token.startsWith("/") ? "" : token);
|
|
19
|
+
const value = JSON.parse(text);
|
|
20
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error(`Expected a project manifest object: ${path}`);
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
function directories(root, framework, current = "", moduleOutputs = [...generatedModulePaths(root, framework)]) {
|
|
24
|
+
const result = [current];
|
|
25
|
+
for (const entry of readdirSync(join(root, current), { withFileTypes: true })) {
|
|
26
|
+
const path = current ? `${current}/${entry.name}` : entry.name;
|
|
27
|
+
if (isGeneratedPath(path, framework) || moduleOutputs.some((output) => path === output || path.startsWith(`${output}/`))) continue;
|
|
28
|
+
const stat = lstatSync(join(root, path));
|
|
29
|
+
if (stat.isSymbolicLink()) throw new Error(`Project source symlinks are not trusted: ${path}`);
|
|
30
|
+
if (stat.isDirectory()) result.push(...directories(root, framework, path, moduleOutputs));
|
|
31
|
+
}
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
/** The caller resolves project.directory; this function never generates or ejects a project. */
|
|
35
|
+
function assertProject(root, spec) {
|
|
36
|
+
const fail = (manifest) => {
|
|
37
|
+
throw new Error(`${spec.framework} build completion requires ${manifest} in the project directory`);
|
|
38
|
+
};
|
|
39
|
+
if (spec.platform === "macos" && spec.framework !== "mygo") fail("an existing supported iOS or Android platform; macOS is supported only for MyGo");
|
|
40
|
+
if (spec.framework === "mygo") {
|
|
41
|
+
if (spec.platform !== "macos") fail("the macOS platform");
|
|
42
|
+
const mod = file(root, "go.mod");
|
|
43
|
+
if (mod === void 0 || !parseGoManifest(mod).requires.has("github.com/egoist/mygo")) fail("a go.mod requiring github.com/egoist/mygo");
|
|
44
|
+
const native = json(root, "mygo.json");
|
|
45
|
+
const web = file(root, "mygo.config.ts");
|
|
46
|
+
if (native === void 0 === (web === void 0)) fail("exactly one mygo.json or mygo.config.ts");
|
|
47
|
+
if (web !== void 0 && !json(root, "package.json") && !json(root, "frontend/package.json")) fail("the original package.json or frontend/package.json for mygo.config.ts");
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (spec.framework === "flutter") {
|
|
51
|
+
const text = file(root, "pubspec.yaml");
|
|
52
|
+
if (!text) fail("a Flutter pubspec.yaml");
|
|
53
|
+
const document = parseDocument(text);
|
|
54
|
+
if (document.errors.length) throw new Error(`Invalid pubspec.yaml: ${document.errors.map((error) => error.message).join("; ")}`);
|
|
55
|
+
const value = document.toJS();
|
|
56
|
+
if (!value || typeof value.name !== "string" || value.dependencies?.flutter?.sdk !== "flutter") fail("a named pubspec.yaml with dependencies.flutter.sdk: flutter");
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (spec.framework === "android-java") {
|
|
60
|
+
if (spec.platform !== "android") fail("the Android platform");
|
|
61
|
+
const settings = file(root, "settings.gradle") ?? file(root, "settings.gradle.kts");
|
|
62
|
+
const application = directories(root, spec.framework).some((directory) => {
|
|
63
|
+
const prefix = directory ? `${directory}/` : "";
|
|
64
|
+
if ((file(root, `${prefix}build.gradle`) ?? file(root, `${prefix}build.gradle.kts`)) === void 0) return false;
|
|
65
|
+
const manifest = file(root, `${prefix}src/main/AndroidManifest.xml`)?.replace(/<!--[\s\S]*?-->/g, "");
|
|
66
|
+
return !!manifest && /<manifest\b/.test(manifest) && /<application\b/.test(manifest) && /<\/manifest\s*>/.test(manifest);
|
|
67
|
+
});
|
|
68
|
+
if (settings === void 0 || !application) fail("Gradle settings/build files and an application module src/main/AndroidManifest.xml");
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (spec.framework === "swift") {
|
|
72
|
+
if (spec.platform !== "ios") fail("the iOS platform");
|
|
73
|
+
const swift = file(root, "Package.swift");
|
|
74
|
+
if (swift && /swift-tools-version\s*:/.test(swift) && /\bPackage\s*\(/.test(swift)) return;
|
|
75
|
+
for (const directory of directories(root, spec.framework)) if (directory.endsWith(".xcodeproj")) {
|
|
76
|
+
const project = file(root, `${directory}/project.pbxproj`);
|
|
77
|
+
if (project && /\bPBXProject\b/.test(project)) return;
|
|
78
|
+
}
|
|
79
|
+
fail("a Swift Package.swift or an Xcode .xcodeproj/project.pbxproj");
|
|
80
|
+
}
|
|
81
|
+
const pkg = json(root, "package.json");
|
|
82
|
+
const dependencies = {
|
|
83
|
+
...pkg?.dependencies,
|
|
84
|
+
...pkg?.devDependencies
|
|
85
|
+
};
|
|
86
|
+
if (spec.framework === "uni-app") {
|
|
87
|
+
const source = json(root, "src/manifest.json", true) ? "src/" : "";
|
|
88
|
+
const manifest = json(root, `${source}manifest.json`, true);
|
|
89
|
+
const pages = json(root, `${source}pages.json`, true);
|
|
90
|
+
if (!manifest || !Array.isArray(pages?.pages) || !pages.pages.length) fail("manifest.json and nonempty pages.json at the root or under src/");
|
|
91
|
+
const cli = typeof dependencies["@dcloudio/uni-app"] === "string" && !!dependencies["@dcloudio/uni-app"];
|
|
92
|
+
const classic = !!file(root, `${source}App.vue`) && !!(file(root, `${source}main.js`) ?? file(root, `${source}main.ts`));
|
|
93
|
+
if (!cli && !classic) fail("a uni-app CLI package.json or HBuilderX App.vue and main.js/main.ts");
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const required = spec.framework === "react-native" ? "react-native" : "expo";
|
|
97
|
+
if (!pkg || typeof dependencies[required] !== "string" || !dependencies[required]) fail(`package.json declaring ${required}`);
|
|
98
|
+
}
|
|
99
|
+
function buildInstructions(spec) {
|
|
100
|
+
return `${`Build the ${spec.platform} application using the ${spec.framework} stack. ${spec.project?.sourceDir ? "Preserve the imported project and its existing native structure." : "Preserve any existing project, including a prepared predecessor; generate a real runnable project only when none exists in the designated project directory."}`}\n${{
|
|
101
|
+
flutter: "Use a Flutter pubspec.yaml, Dart sources and the selected platform runner. Resolve dependencies with flutter pub get; keep pubspec.lock. Do not modify the Flutter SDK.",
|
|
102
|
+
"android-java": "Use a Java Android application with Gradle settings/build files and AndroidManifest.xml. Keep the Gradle wrapper and dependency locks; use the existing application module rather than rewriting it.",
|
|
103
|
+
swift: "Use the existing Xcode project or Swift package, Swift sources and iOS application configuration. Keep Package.resolved and Podfile.lock when used. Do not replace an existing Xcode project with a package.",
|
|
104
|
+
"react-native": "Use package.json with react-native and the existing iOS/Android native projects. Keep the package-manager lockfile and native dependency locks. Do not migrate to Expo or regenerate native projects.",
|
|
105
|
+
expo: "Use package.json with expo and the existing Expo application configuration. Preserve managed or prebuilt structure; do not force expo prebuild or eject. Cloud builds require the owner-configured permission and packaging commands.",
|
|
106
|
+
"uni-app": "Preserve either the existing CLI package.json with @dcloudio/uni-app or the classic HBuilderX App.vue/main.js/main.ts project without requiring npm. Keep manifest.json/pages.json (root or src) and existing native structure; use the owner-configured HBuilderX/CLI Android/iOS packager, not a fabricated artifact.",
|
|
107
|
+
mygo: "Preserve native-UI Go-only projects with go.mod and mygo.json, or existing web projects with go.mod, mygo.config.ts and their original package.json (at the root or under frontend/) and package manager; keep exactly one MyGo config and require github.com/egoist/mygo in go.mod. Native projects need neither package.json nor Bun nor Xcode. Do not rewrite a web project or require Bun solely because its config is TypeScript; preserve its existing runtime and frontend scripts. Preserve the pinned MyGo tool/module version in go.mod; do not use @latest or install tools automatically. Prepare go.sum, any go.work/go.work.sum, frontend dependency locks and generated frontend bindings before proof, preserving the original frontend build process. Use Go vet/tests plus an owner-implemented real macOS desktop acceptance harness that launches and drives the actual app; go test or a headless view test alone is not desktop acceptance, and no iOS simulator is involved. Never generate a stub acceptance command. Packaging stays local-only through the frozen direct go tool mygo build command (or owner-configured pinned direct MyGo invocation), with -sign - and -skip-notarize; never upload, notarize or access signing keychains. Use the frozen output path, architecture and app/dmg target; do not replace the owner packaging profile."
|
|
108
|
+
}[spec.framework]}\nImplement the acceptance criteria, run the configured checks and runtime evidence commands, and leave packaging to the frozen owner command profile. Never replace checks with no-ops or claim unobserved SDK/build results.`;
|
|
109
|
+
}
|
|
110
|
+
function doctorCommands(framework, platform) {
|
|
111
|
+
const commands = [];
|
|
112
|
+
if (framework === "mygo") {
|
|
113
|
+
if (platform !== "macos") throw new Error("MyGo doctor supports only macOS");
|
|
114
|
+
return [
|
|
115
|
+
{
|
|
116
|
+
name: "Go",
|
|
117
|
+
argv: ["go", "version"]
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: "macOS code signing",
|
|
121
|
+
argv: ["/usr/bin/which", "codesign"]
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
name: "macOS disk images",
|
|
125
|
+
argv: ["hdiutil", "help"]
|
|
126
|
+
}
|
|
127
|
+
];
|
|
128
|
+
}
|
|
129
|
+
if (platform === "macos") throw new Error("macOS doctor supports only MyGo");
|
|
130
|
+
if (framework === "flutter") commands.push({
|
|
131
|
+
name: "Flutter",
|
|
132
|
+
argv: ["flutter", "--version"]
|
|
133
|
+
});
|
|
134
|
+
else if (framework === "swift") commands.push({
|
|
135
|
+
name: "Swift",
|
|
136
|
+
argv: ["swift", "--version"]
|
|
137
|
+
});
|
|
138
|
+
else if (framework === "react-native" || framework === "expo") commands.push({
|
|
139
|
+
name: "Node.js",
|
|
140
|
+
argv: ["node", "--version"]
|
|
141
|
+
}, {
|
|
142
|
+
name: "npm",
|
|
143
|
+
argv: ["npm", "--version"]
|
|
144
|
+
});
|
|
145
|
+
if (platform === "ios") commands.push({
|
|
146
|
+
name: "Xcode",
|
|
147
|
+
argv: ["xcodebuild", "-version"]
|
|
148
|
+
}, {
|
|
149
|
+
name: "Xcode tools",
|
|
150
|
+
argv: ["xcrun", "--version"]
|
|
151
|
+
});
|
|
152
|
+
else commands.push({
|
|
153
|
+
name: "Java",
|
|
154
|
+
argv: ["java", "-version"]
|
|
155
|
+
}, {
|
|
156
|
+
name: "Android platform tools",
|
|
157
|
+
argv: ["adb", "version"]
|
|
158
|
+
});
|
|
159
|
+
return commands;
|
|
160
|
+
}
|
|
161
|
+
export { assertProject, buildInstructions, doctorCommands };
|
|
162
|
+
|
|
163
|
+
//# sourceMappingURL=project-profiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-profiles.js","names":[],"sources":["../src/project-profiles.ts"],"sourcesContent":["import { lstatSync, readFileSync, readdirSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { parseDocument } from 'yaml';\nimport { inside } from './config.js';\nimport { generatedModulePaths, isGeneratedPath } from './dependencies.js';\nimport { parseGoManifest } from './go-dependencies.js';\nimport type { Framework, Platform, Spec } from './schemas.js';\n\nfunction file(root: string, path: string): string | undefined {\n const absolute = inside(root, path);\n const stat = lstatSync(absolute, { throwIfNoEntry: false });\n if (!stat) return undefined;\n if (!stat.isFile() || stat.isSymbolicLink()) throw new Error(`Project manifest must be a regular source file: ${path}`);\n return readFileSync(absolute, 'utf8');\n}\n\nfunction json(root: string, path: string, comments = false): Record<string, unknown> | undefined {\n let text = file(root, path);\n if (text === undefined) return undefined;\n if (comments) text = text.replace(/\"(?:\\\\.|[^\"\\\\])*\"|\\/\\*[\\s\\S]*?\\*\\/|\\/\\/[^\\r\\n]*/g, token => token.startsWith('/') ? '' : token);\n const value: unknown = JSON.parse(text);\n if (!value || typeof value !== 'object' || Array.isArray(value)) throw new Error(`Expected a project manifest object: ${path}`);\n return value as Record<string, unknown>;\n}\n\nfunction directories(root: string, framework: Framework, current = '', moduleOutputs = [...generatedModulePaths(root, framework)]): string[] {\n const result = [current];\n for (const entry of readdirSync(join(root, current), { withFileTypes: true })) {\n const path = current ? `${current}/${entry.name}` : entry.name;\n if (isGeneratedPath(path, framework) || moduleOutputs.some(output => path === output || path.startsWith(`${output}/`))) continue;\n const stat = lstatSync(join(root, path));\n if (stat.isSymbolicLink()) throw new Error(`Project source symlinks are not trusted: ${path}`);\n if (stat.isDirectory()) result.push(...directories(root, framework, path, moduleOutputs));\n }\n return result;\n}\n\n/** The caller resolves project.directory; this function never generates or ejects a project. */\nexport function assertProject(root: string, spec: Spec): void {\n const fail = (manifest: string): never => { throw new Error(`${spec.framework} build completion requires ${manifest} in the project directory`); };\n if (spec.platform === 'macos' && spec.framework !== 'mygo') fail('an existing supported iOS or Android platform; macOS is supported only for MyGo');\n if (spec.framework === 'mygo') {\n if (spec.platform !== 'macos') fail('the macOS platform');\n const mod = file(root, 'go.mod');\n if (mod === undefined || !parseGoManifest(mod).requires.has('github.com/egoist/mygo')) fail('a go.mod requiring github.com/egoist/mygo');\n const native = json(root, 'mygo.json');\n const web = file(root, 'mygo.config.ts');\n if ((native === undefined) === (web === undefined)) fail('exactly one mygo.json or mygo.config.ts');\n if (web !== undefined && !json(root, 'package.json') && !json(root, 'frontend/package.json')) fail('the original package.json or frontend/package.json for mygo.config.ts');\n return;\n }\n if (spec.framework === 'flutter') {\n const text = file(root, 'pubspec.yaml');\n if (!text) fail('a Flutter pubspec.yaml');\n const document = parseDocument(text!);\n if (document.errors.length) throw new Error(`Invalid pubspec.yaml: ${document.errors.map(error => error.message).join('; ')}`);\n const value = document.toJS();\n if (!value || typeof value.name !== 'string' || value.dependencies?.flutter?.sdk !== 'flutter') fail('a named pubspec.yaml with dependencies.flutter.sdk: flutter');\n return;\n }\n if (spec.framework === 'android-java') {\n if (spec.platform !== 'android') fail('the Android platform');\n const settings = file(root, 'settings.gradle') ?? file(root, 'settings.gradle.kts');\n const application = directories(root, spec.framework).some(directory => {\n const prefix = directory ? `${directory}/` : '';\n const build = file(root, `${prefix}build.gradle`) ?? file(root, `${prefix}build.gradle.kts`);\n if (build === undefined) return false;\n const manifest = file(root, `${prefix}src/main/AndroidManifest.xml`)?.replace(/<!--[\\s\\S]*?-->/g, '');\n return !!manifest && /<manifest\\b/.test(manifest) && /<application\\b/.test(manifest) && /<\\/manifest\\s*>/.test(manifest);\n });\n if (settings === undefined || !application) fail('Gradle settings/build files and an application module src/main/AndroidManifest.xml');\n return;\n }\n if (spec.framework === 'swift') {\n if (spec.platform !== 'ios') fail('the iOS platform');\n const swift = file(root, 'Package.swift');\n if (swift && /swift-tools-version\\s*:/.test(swift) && /\\bPackage\\s*\\(/.test(swift)) return;\n for (const directory of directories(root, spec.framework)) {\n if (directory.endsWith('.xcodeproj')) {\n const project = file(root, `${directory}/project.pbxproj`);\n if (project && /\\bPBXProject\\b/.test(project)) return;\n }\n }\n fail('a Swift Package.swift or an Xcode .xcodeproj/project.pbxproj');\n }\n const pkg = json(root, 'package.json');\n const dependencies = { ...(pkg?.dependencies as Record<string, unknown> | undefined), ...(pkg?.devDependencies as Record<string, unknown> | undefined) };\n if (spec.framework === 'uni-app') {\n const source = json(root, 'src/manifest.json', true) ? 'src/' : '';\n const manifest = json(root, `${source}manifest.json`, true);\n const pages = json(root, `${source}pages.json`, true);\n if (!manifest || !Array.isArray(pages?.pages) || !pages.pages.length) fail('manifest.json and nonempty pages.json at the root or under src/');\n const cli = typeof dependencies['@dcloudio/uni-app'] === 'string' && !!dependencies['@dcloudio/uni-app'];\n const classic = !!file(root, `${source}App.vue`) && !!(file(root, `${source}main.js`) ?? file(root, `${source}main.ts`));\n if (!cli && !classic) fail('a uni-app CLI package.json or HBuilderX App.vue and main.js/main.ts');\n return;\n }\n const required = spec.framework === 'react-native' ? 'react-native' : 'expo';\n if (!pkg || typeof dependencies[required] !== 'string' || !dependencies[required]) fail(`package.json declaring ${required}`);\n}\n\nexport function buildInstructions(spec: Spec): string {\n const context = `Build the ${spec.platform} application using the ${spec.framework} stack. ${spec.project?.sourceDir ? 'Preserve the imported project and its existing native structure.' : 'Preserve any existing project, including a prepared predecessor; generate a real runnable project only when none exists in the designated project directory.'}`;\n const guidance: Record<Framework, string> = {\n flutter: 'Use a Flutter pubspec.yaml, Dart sources and the selected platform runner. Resolve dependencies with flutter pub get; keep pubspec.lock. Do not modify the Flutter SDK.',\n 'android-java': 'Use a Java Android application with Gradle settings/build files and AndroidManifest.xml. Keep the Gradle wrapper and dependency locks; use the existing application module rather than rewriting it.',\n swift: 'Use the existing Xcode project or Swift package, Swift sources and iOS application configuration. Keep Package.resolved and Podfile.lock when used. Do not replace an existing Xcode project with a package.',\n 'react-native': 'Use package.json with react-native and the existing iOS/Android native projects. Keep the package-manager lockfile and native dependency locks. Do not migrate to Expo or regenerate native projects.',\n expo: 'Use package.json with expo and the existing Expo application configuration. Preserve managed or prebuilt structure; do not force expo prebuild or eject. Cloud builds require the owner-configured permission and packaging commands.',\n 'uni-app': 'Preserve either the existing CLI package.json with @dcloudio/uni-app or the classic HBuilderX App.vue/main.js/main.ts project without requiring npm. Keep manifest.json/pages.json (root or src) and existing native structure; use the owner-configured HBuilderX/CLI Android/iOS packager, not a fabricated artifact.',\n mygo: 'Preserve native-UI Go-only projects with go.mod and mygo.json, or existing web projects with go.mod, mygo.config.ts and their original package.json (at the root or under frontend/) and package manager; keep exactly one MyGo config and require github.com/egoist/mygo in go.mod. Native projects need neither package.json nor Bun nor Xcode. Do not rewrite a web project or require Bun solely because its config is TypeScript; preserve its existing runtime and frontend scripts. Preserve the pinned MyGo tool/module version in go.mod; do not use @latest or install tools automatically. Prepare go.sum, any go.work/go.work.sum, frontend dependency locks and generated frontend bindings before proof, preserving the original frontend build process. Use Go vet/tests plus an owner-implemented real macOS desktop acceptance harness that launches and drives the actual app; go test or a headless view test alone is not desktop acceptance, and no iOS simulator is involved. Never generate a stub acceptance command. Packaging stays local-only through the frozen direct go tool mygo build command (or owner-configured pinned direct MyGo invocation), with -sign - and -skip-notarize; never upload, notarize or access signing keychains. Use the frozen output path, architecture and app/dmg target; do not replace the owner packaging profile.',\n };\n return `${context}\\n${guidance[spec.framework]}\\nImplement the acceptance criteria, run the configured checks and runtime evidence commands, and leave packaging to the frozen owner command profile. Never replace checks with no-ops or claim unobserved SDK/build results.`;\n}\n\nexport function doctorCommands(framework: Framework, platform: Platform): Array<{ name: string; argv: string[] }> {\n const commands: Array<{ name: string; argv: string[] }> = [];\n if (framework === 'mygo') {\n if (platform !== 'macos') throw new Error('MyGo doctor supports only macOS');\n return [\n { name: 'Go', argv: ['go', 'version'] },\n { name: 'macOS code signing', argv: ['/usr/bin/which', 'codesign'] },\n { name: 'macOS disk images', argv: ['hdiutil', 'help'] },\n ];\n }\n if (platform === 'macos') throw new Error('macOS doctor supports only MyGo');\n if (framework === 'flutter') commands.push({ name: 'Flutter', argv: ['flutter', '--version'] });\n else if (framework === 'swift') commands.push({ name: 'Swift', argv: ['swift', '--version'] });\n else if (framework === 'react-native' || framework === 'expo') commands.push({ name: 'Node.js', argv: ['node', '--version'] }, { name: 'npm', argv: ['npm', '--version'] });\n if (platform === 'ios') commands.push({ name: 'Xcode', argv: ['xcodebuild', '-version'] }, { name: 'Xcode tools', argv: ['xcrun', '--version'] });\n else commands.push({ name: 'Java', argv: ['java', '-version'] }, { name: 'Android platform tools', argv: ['adb', 'version'] });\n return commands;\n}\n"],"mappings":";;;;;;;AAQA,SAAS,KAAK,MAAc,MAAkC;CAC5D,MAAM,WAAW,OAAO,MAAM,IAAI;CAClC,MAAM,OAAO,UAAU,UAAU,EAAE,gBAAgB,MAAM,CAAC;CAC1D,IAAI,CAAC,MAAM,OAAO,KAAA;CAClB,IAAI,CAAC,KAAK,OAAO,KAAK,KAAK,eAAe,GAAG,MAAM,IAAI,MAAM,mDAAmD,MAAM;CACtH,OAAO,aAAa,UAAU,MAAM;AACtC;AAEA,SAAS,KAAK,MAAc,MAAc,WAAW,OAA4C;CAC/F,IAAI,OAAO,KAAK,MAAM,IAAI;CAC1B,IAAI,SAAS,KAAA,GAAW,OAAO,KAAA;CAC/B,IAAI,UAAU,OAAO,KAAK,QAAQ,qDAAoD,UAAS,MAAM,WAAW,GAAG,IAAI,KAAK,KAAK;CACjI,MAAM,QAAiB,KAAK,MAAM,IAAI;CACtC,IAAI,CAAC,SA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
// src/proof.ts
|
|
2
|
+
function verificationContract(config) {
|
|
3
|
+
return {
|
|
4
|
+
verification: config.verification,
|
|
5
|
+
executionEnv: config.executionEnv,
|
|
6
|
+
toolchain: config.toolchain,
|
|
7
|
+
packaging: config.packaging,
|
|
8
|
+
apple: config.apple,
|
|
9
|
+
packageTarget: config.packageTarget,
|
|
10
|
+
allowCloudBuild: config.allowCloudBuild,
|
|
11
|
+
isolation: config.isolation,
|
|
12
|
+
obfuscation: config.obfuscation
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
function verificationConfigChanged(job, config) {
|
|
16
|
+
return JSON.stringify(verificationContract(job.config)) !== JSON.stringify(verificationContract(config)) || job.verifiedDigest != null && !job.verifiedDependencyDigest;
|
|
17
|
+
}
|
|
18
|
+
function invalidateVerification() {
|
|
19
|
+
return {
|
|
20
|
+
verifiedDigest: null,
|
|
21
|
+
verifiedDependencyDigest: null,
|
|
22
|
+
screenshotDigest: null,
|
|
23
|
+
verifiedAt: void 0,
|
|
24
|
+
review: null,
|
|
25
|
+
reviewPolicyContextDigest: null,
|
|
26
|
+
artifact: null,
|
|
27
|
+
ipaPath: null,
|
|
28
|
+
archiveDigest: null
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export { invalidateVerification, verificationConfigChanged };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=proof.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proof.js","names":[],"sources":["../src/proof.ts"],"sourcesContent":["import type { Config, Job } from './schemas.js';\n\nfunction verificationContract(config: Config) {\n return {\n verification: config.verification, executionEnv: config.executionEnv, toolchain: config.toolchain,\n packaging: config.packaging, apple: config.apple, packageTarget: config.packageTarget, allowCloudBuild: config.allowCloudBuild,\n isolation: config.isolation, obfuscation: config.obfuscation,\n };\n}\n\nexport function verificationConfigChanged(job: Job, config: Config): boolean {\n return JSON.stringify(verificationContract(job.config)) !== JSON.stringify(verificationContract(config))\n || (job.verifiedDigest != null && !job.verifiedDependencyDigest);\n}\n\nexport function invalidateVerification(): Partial<Job> {\n return {\n verifiedDigest: null, verifiedDependencyDigest: null, screenshotDigest: null, verifiedAt: undefined,\n review: null, reviewPolicyContextDigest: null, artifact: null, ipaPath: null, archiveDigest: null,\n };\n}\n"],"mappings":";AAEA,SAAS,qBAAqB,QAAgB;CAC5C,OAAO;EACL,cAAc,OAAO;EAAc,cAAc,OAAO;EAAc,WAAW,OAAO;EACxF,WAAW,OAAO;EAAW,OAAO,OAAO;EAAO,eAAe,OAAO;EAAe,iBAAiB,OAAO;EAC/G,WAAW,OAAO;EAAW,aAAa,OAAO;CACnD;AACF;AAEA,SAAgB,0BAA0B,KAAU,QAAyB;CAC3E,OAAO,KAAK,UAAU,qBAAqB,IAAI,MAAM,CAAC,MAAM,KAAK,UAAU,qBAAqB,MAAM,CAAC,KACjG,IAAI,kBAAkB,QAAQ,CAAC,IAAI;AAC3C;AAEA,SAAgB,yBAAuC;CACrD,OAAO;EACL,gBAAgB;EAAM,0BAA0B;EAAM,kBAAkB;EAAM,YAAY,KAAA;EAC1F,QAAQ;EAAM,2BAA2B;EAAM,UAAU;EAAM,SAAS;EAAM,eAAe;CAC/F;AACF"}
|
package/dist/remote.js
CHANGED
|
@@ -2,8 +2,8 @@ import { toError } from "./schemas.js";
|
|
|
2
2
|
import { loadJSON } from "./config.js";
|
|
3
3
|
import { parseRequirement } from "./requirements.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
import { posix } from "node:path";
|
|
6
5
|
import { spawn } from "node:child_process";
|
|
6
|
+
import { posix } from "node:path";
|
|
7
7
|
// src/remote.ts
|
|
8
8
|
const remotePath = z.string().min(1).refine((value) => posix.isAbsolute(value) && !value.includes("\0") && !/[\r\n]/.test(value), "Use an absolute path on the Mac worker");
|
|
9
9
|
const RemoteSchema = z.strictObject({
|