The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 24, 22:45 UTC
[codex] Structure mobile native static-check failures (#3302)
Co-authored-by: codex <codex@users.noreply.github.com>
Julius Marminge committed
Jun 20, 2026 at 10:40 UTC
86db35ca6175c3340a18d151a486b77b82664ba7
2 files changed
+37
-6
scripts/mobile-native-static-check.test.ts
new
+18
@@ -0,0 +1,18 @@
1
+import { assert, it } from "@effect/vitest";
2
+
3
+import { NativeStaticCheckCommandError } from "./mobile-native-static-check.ts";
4
+
5
+it("describes failed native static-analysis commands structurally", () => {
6
+ const error = new NativeStaticCheckCommandError({
7
+ command: "swiftlint",
8
+ args: ["lint", "--strict"],
9
+ cwd: "/repo/apps/mobile",
10
+ exitCode: 2,
11
+ });
12
+
13
+ assert.equal(error.command, "swiftlint");
14
+ assert.deepStrictEqual(error.args, ["lint", "--strict"]);
15
+ assert.equal(error.cwd, "/repo/apps/mobile");
16
+ assert.equal(error.exitCode, 2);
17
+ assert.equal(error.message, "Native static check command 'swiftlint' exited with code 2.");
18
+});
scripts/mobile-native-static-check.ts
+19
-6
@@ -4,12 +4,12 @@ import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
4
import * as NodeServices from "@effect/platform-node/NodeServices";
5
import { isCommandAvailable, resolveSpawnCommand } from "@t3tools/shared/shell";
6
import * as Console from "effect/Console";
7
-import * as Data from "effect/Data";
7
import * as Effect from "effect/Effect";
8
import * as FileSystem from "effect/FileSystem";
9
import * as Logger from "effect/Logger";
10
import * as Path from "effect/Path";
11
import * as PlatformError from "effect/PlatformError";
12
+import * as Schema from "effect/Schema";
13
import { Command } from "effect/unstable/cli";
14
import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process";
15
@@ -18,9 +18,19 @@ interface NativeStaticTool {
18
readonly installHint: string;
19
}
20
21
-class NativeStaticCheckError extends Data.TaggedError("NativeStaticCheckError")<{
22
- readonly message: string;
23
-}> {}
21
+export class NativeStaticCheckCommandError extends Schema.TaggedErrorClass<NativeStaticCheckCommandError>()(
22
+ "NativeStaticCheckCommandError",
23
+ {
24
+ command: Schema.String,
25
+ args: Schema.Array(Schema.String),
26
+ cwd: Schema.String,
27
+ exitCode: Schema.Int,
28
+ },
29
+) {
30
+ override get message(): string {
31
+ return `Native static check command '${this.command}' exited with code ${this.exitCode}.`;
32
+ }
33
+}
34
35
const tools = [
36
{
@@ -85,8 +95,11 @@ const runCommand = Effect.fn("runCommand")(function* (
95
const exitCode = Number(yield* child.exitCode);
96
97
if (exitCode !== 0) {
88
- return yield* new NativeStaticCheckError({
89
- message: `Command exited with non-zero exit code (${exitCode})`,
98
+ return yield* new NativeStaticCheckCommandError({
99
+ command,
100
+ args,
101
+ cwd,
102
+ exitCode,
103
});
104
}
105
});