@hearsay-tools/squawk 0.18.0-dev.7082 → 0.18.0-dev.7085
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.
|
@@ -27,6 +27,18 @@ export declare function delegationFailure(error: unknown): {
|
|
|
27
27
|
export declare function createDelegationRoutes(service: DelegationService, credentials: CredentialRegistry): import("hono/hono-base").HonoBase<Env, {
|
|
28
28
|
"/list": {
|
|
29
29
|
$get: {
|
|
30
|
+
output: {
|
|
31
|
+
error: string;
|
|
32
|
+
code?: "invalid_input" | undefined;
|
|
33
|
+
};
|
|
34
|
+
outputFormat: "json";
|
|
35
|
+
status: 400;
|
|
36
|
+
input: {
|
|
37
|
+
query: {
|
|
38
|
+
offset?: string | undefined;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
} | {
|
|
30
42
|
output: {
|
|
31
43
|
workers: {
|
|
32
44
|
workerId: string;
|
|
@@ -64,18 +76,6 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
64
76
|
offset?: string | undefined;
|
|
65
77
|
};
|
|
66
78
|
};
|
|
67
|
-
} | {
|
|
68
|
-
output: {
|
|
69
|
-
error: string;
|
|
70
|
-
code?: "invalid_input" | undefined;
|
|
71
|
-
};
|
|
72
|
-
outputFormat: "json";
|
|
73
|
-
status: 400;
|
|
74
|
-
input: {
|
|
75
|
-
query: {
|
|
76
|
-
offset?: string | undefined;
|
|
77
|
-
};
|
|
78
|
-
};
|
|
79
79
|
};
|
|
80
80
|
};
|
|
81
81
|
} & {
|
|
@@ -613,6 +613,18 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
613
613
|
} & {
|
|
614
614
|
"/:workerId": {
|
|
615
615
|
$get: {
|
|
616
|
+
output: {
|
|
617
|
+
error: string;
|
|
618
|
+
code?: "invalid_input" | undefined;
|
|
619
|
+
};
|
|
620
|
+
outputFormat: "json";
|
|
621
|
+
status: 400;
|
|
622
|
+
input: {
|
|
623
|
+
param: {
|
|
624
|
+
workerId: string;
|
|
625
|
+
};
|
|
626
|
+
};
|
|
627
|
+
} | {
|
|
616
628
|
output: {
|
|
617
629
|
workerId: string;
|
|
618
630
|
parentRunId: string;
|
|
@@ -720,7 +732,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
720
732
|
workerId: string;
|
|
721
733
|
};
|
|
722
734
|
};
|
|
723
|
-
}
|
|
735
|
+
};
|
|
736
|
+
};
|
|
737
|
+
} & {
|
|
738
|
+
"/:workerId/collect": {
|
|
739
|
+
$post: {
|
|
724
740
|
output: {
|
|
725
741
|
error: string;
|
|
726
742
|
code?: "invalid_input" | undefined;
|
|
@@ -731,12 +747,10 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
731
747
|
param: {
|
|
732
748
|
workerId: string;
|
|
733
749
|
};
|
|
750
|
+
} & {
|
|
751
|
+
json: Record<string, never>;
|
|
734
752
|
};
|
|
735
|
-
}
|
|
736
|
-
};
|
|
737
|
-
} & {
|
|
738
|
-
"/:workerId/collect": {
|
|
739
|
-
$post: {
|
|
753
|
+
} | {
|
|
740
754
|
output: {
|
|
741
755
|
workerId: string;
|
|
742
756
|
parentRunId: string;
|
|
@@ -838,7 +852,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
838
852
|
} & {
|
|
839
853
|
json: Record<string, never>;
|
|
840
854
|
};
|
|
841
|
-
}
|
|
855
|
+
};
|
|
856
|
+
};
|
|
857
|
+
} & {
|
|
858
|
+
"/:workerId/steer": {
|
|
859
|
+
$post: {
|
|
842
860
|
output: {
|
|
843
861
|
error: string;
|
|
844
862
|
code?: "invalid_input" | undefined;
|
|
@@ -850,13 +868,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
850
868
|
workerId: string;
|
|
851
869
|
};
|
|
852
870
|
} & {
|
|
853
|
-
json:
|
|
871
|
+
json: {
|
|
872
|
+
text: string;
|
|
873
|
+
};
|
|
854
874
|
};
|
|
855
|
-
}
|
|
856
|
-
};
|
|
857
|
-
} & {
|
|
858
|
-
"/:workerId/steer": {
|
|
859
|
-
$post: {
|
|
875
|
+
} | {
|
|
860
876
|
output: {
|
|
861
877
|
workerId: string;
|
|
862
878
|
state: "delivered" | "queued";
|
|
@@ -872,7 +888,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
872
888
|
text: string;
|
|
873
889
|
};
|
|
874
890
|
};
|
|
875
|
-
}
|
|
891
|
+
};
|
|
892
|
+
};
|
|
893
|
+
} & {
|
|
894
|
+
"/:workerId/stop": {
|
|
895
|
+
$post: {
|
|
876
896
|
output: {
|
|
877
897
|
error: string;
|
|
878
898
|
code?: "invalid_input" | undefined;
|
|
@@ -884,15 +904,9 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
884
904
|
workerId: string;
|
|
885
905
|
};
|
|
886
906
|
} & {
|
|
887
|
-
json:
|
|
888
|
-
text: string;
|
|
889
|
-
};
|
|
907
|
+
json: Record<string, never>;
|
|
890
908
|
};
|
|
891
|
-
}
|
|
892
|
-
};
|
|
893
|
-
} & {
|
|
894
|
-
"/:workerId/stop": {
|
|
895
|
-
$post: {
|
|
909
|
+
} | {
|
|
896
910
|
output: {
|
|
897
911
|
workerId: string;
|
|
898
912
|
state: "stopping" | "terminated";
|
|
@@ -906,7 +920,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
906
920
|
} & {
|
|
907
921
|
json: Record<string, never>;
|
|
908
922
|
};
|
|
909
|
-
}
|
|
923
|
+
};
|
|
924
|
+
};
|
|
925
|
+
} & {
|
|
926
|
+
"/:workerId/destroy": {
|
|
927
|
+
$post: {
|
|
910
928
|
output: {
|
|
911
929
|
error: string;
|
|
912
930
|
code?: "invalid_input" | undefined;
|
|
@@ -920,11 +938,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
920
938
|
} & {
|
|
921
939
|
json: Record<string, never>;
|
|
922
940
|
};
|
|
923
|
-
}
|
|
924
|
-
};
|
|
925
|
-
} & {
|
|
926
|
-
"/:workerId/destroy": {
|
|
927
|
-
$post: {
|
|
941
|
+
} | {
|
|
928
942
|
output: {
|
|
929
943
|
workerId: string;
|
|
930
944
|
state: "complete" | "incomplete";
|
|
@@ -947,20 +961,6 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
947
961
|
} & {
|
|
948
962
|
json: Record<string, never>;
|
|
949
963
|
};
|
|
950
|
-
} | {
|
|
951
|
-
output: {
|
|
952
|
-
error: string;
|
|
953
|
-
code?: "invalid_input" | undefined;
|
|
954
|
-
};
|
|
955
|
-
outputFormat: "json";
|
|
956
|
-
status: 400;
|
|
957
|
-
input: {
|
|
958
|
-
param: {
|
|
959
|
-
workerId: string;
|
|
960
|
-
};
|
|
961
|
-
} & {
|
|
962
|
-
json: Record<string, never>;
|
|
963
|
-
};
|
|
964
964
|
} | {
|
|
965
965
|
output: {
|
|
966
966
|
workerId: string;
|
|
@@ -990,13 +990,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
990
990
|
"/:workerId/diff": {
|
|
991
991
|
$get: {
|
|
992
992
|
output: {
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
diff: string;
|
|
996
|
-
truncated: boolean;
|
|
993
|
+
error: string;
|
|
994
|
+
code?: "invalid_input" | undefined;
|
|
997
995
|
};
|
|
998
996
|
outputFormat: "json";
|
|
999
|
-
status:
|
|
997
|
+
status: 400;
|
|
1000
998
|
input: {
|
|
1001
999
|
param: {
|
|
1002
1000
|
workerId: string;
|
|
@@ -1004,11 +1002,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1004
1002
|
};
|
|
1005
1003
|
} | {
|
|
1006
1004
|
output: {
|
|
1007
|
-
|
|
1008
|
-
|
|
1005
|
+
workerId: string;
|
|
1006
|
+
baselineSha: string;
|
|
1007
|
+
diff: string;
|
|
1008
|
+
truncated: boolean;
|
|
1009
1009
|
};
|
|
1010
1010
|
outputFormat: "json";
|
|
1011
|
-
status:
|
|
1011
|
+
status: 200;
|
|
1012
1012
|
input: {
|
|
1013
1013
|
param: {
|
|
1014
1014
|
workerId: string;
|
|
@@ -59,29 +59,6 @@ export declare function ciProgressPlugs(demand: ActivityDemand): {
|
|
|
59
59
|
export declare function createActivityRoutes(routeDeps: ActivityRouteDeps): import("hono/hono-base").HonoBase<import("hono/types").BlankEnv, {
|
|
60
60
|
"/workspace/activity": {
|
|
61
61
|
$get: {
|
|
62
|
-
output: {
|
|
63
|
-
error: string;
|
|
64
|
-
code?: "invalid_input" | undefined;
|
|
65
|
-
};
|
|
66
|
-
outputFormat: "json";
|
|
67
|
-
status: 400;
|
|
68
|
-
input: {
|
|
69
|
-
query: {
|
|
70
|
-
project?: string | undefined;
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
} | {
|
|
74
|
-
output: {
|
|
75
|
-
error: string;
|
|
76
|
-
};
|
|
77
|
-
outputFormat: "json";
|
|
78
|
-
status: 404 | 409 | 503;
|
|
79
|
-
input: {
|
|
80
|
-
query: {
|
|
81
|
-
project?: string | undefined;
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
} | {
|
|
85
62
|
output: {
|
|
86
63
|
generatedAt: string;
|
|
87
64
|
projects: {
|
|
@@ -312,6 +289,29 @@ export declare function createActivityRoutes(routeDeps: ActivityRouteDeps): impo
|
|
|
312
289
|
project?: string | undefined;
|
|
313
290
|
};
|
|
314
291
|
};
|
|
292
|
+
} | {
|
|
293
|
+
output: {
|
|
294
|
+
error: string;
|
|
295
|
+
code?: "invalid_input" | undefined;
|
|
296
|
+
};
|
|
297
|
+
outputFormat: "json";
|
|
298
|
+
status: 400;
|
|
299
|
+
input: {
|
|
300
|
+
query: {
|
|
301
|
+
project?: string | undefined;
|
|
302
|
+
};
|
|
303
|
+
};
|
|
304
|
+
} | {
|
|
305
|
+
output: {
|
|
306
|
+
error: string;
|
|
307
|
+
};
|
|
308
|
+
outputFormat: "json";
|
|
309
|
+
status: 404 | 409 | 503;
|
|
310
|
+
input: {
|
|
311
|
+
query: {
|
|
312
|
+
project?: string | undefined;
|
|
313
|
+
};
|
|
314
|
+
};
|
|
315
315
|
};
|
|
316
316
|
};
|
|
317
317
|
}, "/", "/workspace/activity">;
|
|
@@ -40,7 +40,7 @@ export declare const reportsRoutes: import("hono/hono-base").HonoBase<ProjectApi
|
|
|
40
40
|
error: string;
|
|
41
41
|
};
|
|
42
42
|
outputFormat: "json";
|
|
43
|
-
status:
|
|
43
|
+
status: 409;
|
|
44
44
|
input: {
|
|
45
45
|
query: {
|
|
46
46
|
q?: string | undefined;
|
|
@@ -53,7 +53,7 @@ export declare const reportsRoutes: import("hono/hono-base").HonoBase<ProjectApi
|
|
|
53
53
|
error: string;
|
|
54
54
|
};
|
|
55
55
|
outputFormat: "json";
|
|
56
|
-
status:
|
|
56
|
+
status: 400;
|
|
57
57
|
input: {
|
|
58
58
|
query: {
|
|
59
59
|
q?: string | undefined;
|
package/dist/server/server.d.ts
CHANGED
|
@@ -4853,19 +4853,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
4853
4853
|
} & {
|
|
4854
4854
|
"/repo/commit/:sha": {
|
|
4855
4855
|
$get: {
|
|
4856
|
-
output: string;
|
|
4857
|
-
outputFormat: "text";
|
|
4858
|
-
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
4859
|
-
input: {
|
|
4860
|
-
query: {
|
|
4861
|
-
structured?: string | undefined;
|
|
4862
|
-
};
|
|
4863
|
-
} & {
|
|
4864
|
-
param: {
|
|
4865
|
-
sha: string;
|
|
4866
|
-
};
|
|
4867
|
-
};
|
|
4868
|
-
} | {
|
|
4869
4856
|
output: {
|
|
4870
4857
|
error: string;
|
|
4871
4858
|
code?: "invalid_input" | undefined;
|
|
@@ -4929,6 +4916,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
4929
4916
|
sha: string;
|
|
4930
4917
|
};
|
|
4931
4918
|
};
|
|
4919
|
+
} | {
|
|
4920
|
+
output: string;
|
|
4921
|
+
outputFormat: "text";
|
|
4922
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
4923
|
+
input: {
|
|
4924
|
+
query: {
|
|
4925
|
+
structured?: string | undefined;
|
|
4926
|
+
};
|
|
4927
|
+
} & {
|
|
4928
|
+
param: {
|
|
4929
|
+
sha: string;
|
|
4930
|
+
};
|
|
4931
|
+
};
|
|
4932
4932
|
};
|
|
4933
4933
|
};
|
|
4934
4934
|
} & {
|
|
@@ -18437,20 +18437,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
18437
18437
|
} & {
|
|
18438
18438
|
"/runs/:id/handoff": {
|
|
18439
18439
|
$get: {
|
|
18440
|
-
output:
|
|
18441
|
-
|
|
18442
|
-
|
|
18440
|
+
output: {
|
|
18441
|
+
error: string;
|
|
18442
|
+
};
|
|
18443
|
+
outputFormat: "json";
|
|
18444
|
+
status: 404;
|
|
18443
18445
|
input: {
|
|
18444
18446
|
param: {
|
|
18445
18447
|
id: string;
|
|
18446
18448
|
};
|
|
18447
18449
|
};
|
|
18448
18450
|
} | {
|
|
18449
|
-
output:
|
|
18450
|
-
|
|
18451
|
-
|
|
18452
|
-
outputFormat: "json";
|
|
18453
|
-
status: 404;
|
|
18451
|
+
output: string;
|
|
18452
|
+
outputFormat: "text";
|
|
18453
|
+
status: 200;
|
|
18454
18454
|
input: {
|
|
18455
18455
|
param: {
|
|
18456
18456
|
id: string;
|
|
@@ -18488,20 +18488,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
18488
18488
|
} & {
|
|
18489
18489
|
"/runs/:id/diff": {
|
|
18490
18490
|
$get: {
|
|
18491
|
-
output:
|
|
18492
|
-
|
|
18493
|
-
|
|
18491
|
+
output: {
|
|
18492
|
+
error: string;
|
|
18493
|
+
};
|
|
18494
|
+
outputFormat: "json";
|
|
18495
|
+
status: 404 | 409;
|
|
18494
18496
|
input: {
|
|
18495
18497
|
param: {
|
|
18496
18498
|
id: string;
|
|
18497
18499
|
};
|
|
18498
18500
|
};
|
|
18499
18501
|
} | {
|
|
18500
|
-
output:
|
|
18501
|
-
|
|
18502
|
-
|
|
18503
|
-
outputFormat: "json";
|
|
18504
|
-
status: 404 | 409;
|
|
18502
|
+
output: string;
|
|
18503
|
+
outputFormat: "text";
|
|
18504
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
18505
18505
|
input: {
|
|
18506
18506
|
param: {
|
|
18507
18507
|
id: string;
|
|
@@ -20860,19 +20860,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
20860
20860
|
} & {
|
|
20861
20861
|
"/repo/commit/:sha": {
|
|
20862
20862
|
$get: {
|
|
20863
|
-
output: string;
|
|
20864
|
-
outputFormat: "text";
|
|
20865
|
-
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
20866
|
-
input: {
|
|
20867
|
-
query: {
|
|
20868
|
-
structured?: string | undefined;
|
|
20869
|
-
};
|
|
20870
|
-
} & {
|
|
20871
|
-
param: {
|
|
20872
|
-
sha: string;
|
|
20873
|
-
};
|
|
20874
|
-
};
|
|
20875
|
-
} | {
|
|
20876
20863
|
output: {
|
|
20877
20864
|
error: string;
|
|
20878
20865
|
code?: "invalid_input" | undefined;
|
|
@@ -20936,6 +20923,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
20936
20923
|
sha: string;
|
|
20937
20924
|
};
|
|
20938
20925
|
};
|
|
20926
|
+
} | {
|
|
20927
|
+
output: string;
|
|
20928
|
+
outputFormat: "text";
|
|
20929
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
20930
|
+
input: {
|
|
20931
|
+
query: {
|
|
20932
|
+
structured?: string | undefined;
|
|
20933
|
+
};
|
|
20934
|
+
} & {
|
|
20935
|
+
param: {
|
|
20936
|
+
sha: string;
|
|
20937
|
+
};
|
|
20938
|
+
};
|
|
20939
20939
|
};
|
|
20940
20940
|
};
|
|
20941
20941
|
} & {
|
|
@@ -34444,20 +34444,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
34444
34444
|
} & {
|
|
34445
34445
|
"/runs/:id/handoff": {
|
|
34446
34446
|
$get: {
|
|
34447
|
-
output:
|
|
34448
|
-
|
|
34449
|
-
|
|
34447
|
+
output: {
|
|
34448
|
+
error: string;
|
|
34449
|
+
};
|
|
34450
|
+
outputFormat: "json";
|
|
34451
|
+
status: 404;
|
|
34450
34452
|
input: {
|
|
34451
34453
|
param: {
|
|
34452
34454
|
id: string;
|
|
34453
34455
|
};
|
|
34454
34456
|
};
|
|
34455
34457
|
} | {
|
|
34456
|
-
output:
|
|
34457
|
-
|
|
34458
|
-
|
|
34459
|
-
outputFormat: "json";
|
|
34460
|
-
status: 404;
|
|
34458
|
+
output: string;
|
|
34459
|
+
outputFormat: "text";
|
|
34460
|
+
status: 200;
|
|
34461
34461
|
input: {
|
|
34462
34462
|
param: {
|
|
34463
34463
|
id: string;
|
|
@@ -34495,20 +34495,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
34495
34495
|
} & {
|
|
34496
34496
|
"/runs/:id/diff": {
|
|
34497
34497
|
$get: {
|
|
34498
|
-
output:
|
|
34499
|
-
|
|
34500
|
-
|
|
34498
|
+
output: {
|
|
34499
|
+
error: string;
|
|
34500
|
+
};
|
|
34501
|
+
outputFormat: "json";
|
|
34502
|
+
status: 404 | 409;
|
|
34501
34503
|
input: {
|
|
34502
34504
|
param: {
|
|
34503
34505
|
id: string;
|
|
34504
34506
|
};
|
|
34505
34507
|
};
|
|
34506
34508
|
} | {
|
|
34507
|
-
output:
|
|
34508
|
-
|
|
34509
|
-
|
|
34510
|
-
outputFormat: "json";
|
|
34511
|
-
status: 404 | 409;
|
|
34509
|
+
output: string;
|
|
34510
|
+
outputFormat: "text";
|
|
34511
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
34512
34512
|
input: {
|
|
34513
34513
|
param: {
|
|
34514
34514
|
id: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hearsay-tools/squawk",
|
|
3
|
-
"version": "0.18.0-dev.
|
|
3
|
+
"version": "0.18.0-dev.7085",
|
|
4
4
|
"description": "Local cockpit for running and tracking AI agent tasks in your repo. Uses your logged-in `claude` CLI and `gh` — zero config, zero database.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@babel/parser": "^8.0.8",
|
|
65
65
|
"@babel/types": "^8.0.8",
|
|
66
|
-
"@open-mercato/cezar-api-client": "0.18.0-dev.
|
|
67
|
-
"@open-mercato/cezar-contract": "0.18.0-dev.
|
|
66
|
+
"@open-mercato/cezar-api-client": "0.18.0-dev.7085",
|
|
67
|
+
"@open-mercato/cezar-contract": "0.18.0-dev.7085",
|
|
68
68
|
"@types/node": "^24.19.1",
|
|
69
69
|
"@types/ws": "^8.18.1",
|
|
70
70
|
"esbuild": "^0.28.1",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"publishConfig": {
|
|
82
82
|
"access": "public"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "a25bc29e06e870f5b82dd452cc8de13ad5ec8c72"
|
|
85
85
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Records the wait-rule oracle (hearsay-tools/squawk#3774, slice 6b): what the text scanners of
|
|
3
|
+
* main a78d9e79e reported for every cell of `src/lint/wait-matrix-cells.testkit.ts`. The scanners
|
|
4
|
+
* are read from git at that commit, so this runs after they are deleted from the tree.
|
|
5
|
+
*
|
|
6
|
+
* node packages/cezar/scripts/record-wait-oracle.ts [--out <dir>]
|
|
7
|
+
*
|
|
8
|
+
* It writes `src/lint/wait-matrix.oracle.json`, or the same file under `--out`.
|
|
9
|
+
*/
|
|
10
|
+
import { execFileSync } from 'node:child_process';
|
|
11
|
+
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
|
|
12
|
+
import { tmpdir } from 'node:os';
|
|
13
|
+
import { join, resolve } from 'node:path';
|
|
14
|
+
import { pathToFileURL } from 'node:url';
|
|
15
|
+
import { matrixCells, type Cell } from '../src/lint/wait-matrix-cells.testkit.ts';
|
|
16
|
+
import { encodeRows, digest, ORACLE_BASE } from '../src/lint/wait-matrix-oracle.testkit.ts';
|
|
17
|
+
|
|
18
|
+
interface Site { rule: string; line: number }
|
|
19
|
+
interface ServerScanner { scanFile(file: string, source: string): { sites: Site[]; errors: { line: number }[] } }
|
|
20
|
+
interface UnitScanner { scanSource(file: string, source: string): Site[] }
|
|
21
|
+
|
|
22
|
+
const packageDir = resolve(import.meta.dirname, '..');
|
|
23
|
+
const repo = resolve(packageDir, '../..');
|
|
24
|
+
const outIndex = process.argv.indexOf('--out');
|
|
25
|
+
const out = outIndex === -1 ? join(packageDir, 'src/lint') : resolve(process.argv[outIndex + 1] ?? '.');
|
|
26
|
+
|
|
27
|
+
/** The base commit's lint directory, extracted so its `.ts` imports resolve against each other. */
|
|
28
|
+
function baseScanners(): { dir: string; server: Promise<ServerScanner>; unit: Promise<UnitScanner> } {
|
|
29
|
+
const dir = mkdtempSync(join(tmpdir(), 'wait-oracle-'));
|
|
30
|
+
const archive = execFileSync('git', ['archive', ORACLE_BASE, 'packages/cezar/src/lint'], { cwd: repo, maxBuffer: 64 * 1024 * 1024 });
|
|
31
|
+
execFileSync('tar', ['-x', '-C', dir], { input: archive });
|
|
32
|
+
const lint = join(dir, 'packages/cezar/src/lint');
|
|
33
|
+
// The unit scanner resolves @babel/parser from the package's node_modules.
|
|
34
|
+
execFileSync('ln', ['-s', join(packageDir, 'node_modules'), join(dir, 'packages/cezar/node_modules')]);
|
|
35
|
+
return {
|
|
36
|
+
dir,
|
|
37
|
+
server: import(pathToFileURL(join(lint, 'test-wait-discipline.ts')).href) as Promise<ServerScanner>,
|
|
38
|
+
unit: import(pathToFileURL(join(lint, 'unit-wait-discipline.ts')).href) as Promise<UnitScanner>,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** One cell's findings as the oracle keeps them: `rule@line`, in report order; `error@line` for a scan error; `throws` for a crash. */
|
|
43
|
+
export function recordCell(cell: Cell, server: ServerScanner, unit: UnitScanner): string[] {
|
|
44
|
+
if (cell.file.startsWith('packages/cezar/src/')) {
|
|
45
|
+
const { sites, errors } = server.scanFile(cell.file.slice('packages/cezar/src/'.length), cell.code);
|
|
46
|
+
return [...sites.map(site => `${site.rule}@${site.line}`), ...errors.map(error => `error@${error.line}`)];
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
return unit.scanSource(cell.file.slice('packages/web/src/'.length), cell.code).map(site => `${site.rule}@${site.line}`);
|
|
50
|
+
} catch {
|
|
51
|
+
return ['throws'];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const scanners = baseScanners();
|
|
56
|
+
try {
|
|
57
|
+
const [server, unit] = await Promise.all([scanners.server, scanners.unit]);
|
|
58
|
+
mkdirSync(out, { recursive: true });
|
|
59
|
+
const profiles: Record<string, { cells: number; digest: string; rows: string }> = {};
|
|
60
|
+
for (const [profile, cells] of Object.entries(matrixCells())) {
|
|
61
|
+
const rows = cells.map(cell => recordCell(cell, server, unit));
|
|
62
|
+
profiles[profile] = { cells: cells.length, digest: digest(cells), rows: encodeRows(rows) };
|
|
63
|
+
console.log(`${profile}: ${cells.length} cells, ${rows.filter(row => row.length > 0).length} with findings`);
|
|
64
|
+
}
|
|
65
|
+
writeFileSync(join(out, 'wait-matrix.oracle.json'), `${JSON.stringify({ base: ORACLE_BASE, profiles }, null, 1)}\n`);
|
|
66
|
+
} finally {
|
|
67
|
+
rmSync(scanners.dir, { recursive: true, force: true });
|
|
68
|
+
}
|