@milkenjoyer/toolchain 0.7.3 → 0.8.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 +6 -0
- package/dist/compatible-D8n_sQHa.mjs +160 -0
- package/dist/compatible-n7uFGrI3.d.mts +91 -0
- package/dist/compatible.d.mts +2 -91
- package/dist/compatible.mjs +1 -160
- package/dist/effect-tsgo-D0QfeKGD.mjs +27 -0
- package/dist/effect-tsgo.mjs +1 -27
- package/dist/exceptions-Bq-9MxoR.mjs +3 -0
- package/dist/exceptions-LNZ022dl.d.mts +7 -0
- package/dist/exceptions.d.mts +2 -6
- package/dist/exceptions.mjs +1 -3
- package/dist/guard.d.mts +3 -3
- package/dist/guard.mjs +5 -5
- package/dist/lint-JSnPsGO1.mjs +140 -0
- package/dist/lint.mjs +1 -140
- package/dist/proof.d.mts +1 -0
- package/dist/proof.mjs +141 -0
- package/dist/rules-vHmNoAU0.mjs +117 -0
- package/dist/rules.mjs +1 -117
- package/dist/versions-C7LKZGr3.mjs +142 -0
- package/dist/versions-D02TrtKw.d.mts +46 -0
- package/dist/versions.d.mts +2 -46
- package/dist/versions.mjs +1 -142
- package/package.json +7 -2
- package/src/proof.ts +216 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import * as Arr from "effect/Array";
|
|
2
|
+
import { dual } from "effect/Function";
|
|
3
|
+
import * as Option from "effect/Option";
|
|
4
|
+
import * as R from "effect/Record";
|
|
5
|
+
import * as Schema from "effect/Schema";
|
|
6
|
+
import * as Str from "effect/String";
|
|
7
|
+
// src/versions.ts
|
|
8
|
+
const nodeVersion = "26.13.0";
|
|
9
|
+
const families = [
|
|
10
|
+
{
|
|
11
|
+
name: "vite-plus",
|
|
12
|
+
version: "1.5.0",
|
|
13
|
+
packages: ["vite-plus"],
|
|
14
|
+
scopes: []
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: "alchemy",
|
|
18
|
+
version: "2.0.0-beta.85",
|
|
19
|
+
packages: [
|
|
20
|
+
"@alchemy.run/domain",
|
|
21
|
+
"alchemy",
|
|
22
|
+
"@alchemy.run/github",
|
|
23
|
+
"@alchemy.run/test"
|
|
24
|
+
],
|
|
25
|
+
scopes: ["@alchemy.run/"]
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: "foldkit",
|
|
29
|
+
version: "0.170.0",
|
|
30
|
+
packages: ["foldkit", "@foldkit/ui"],
|
|
31
|
+
scopes: []
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: "@foldkit/vite-plugin",
|
|
35
|
+
version: "0.29.0",
|
|
36
|
+
packages: ["@foldkit/vite-plugin"],
|
|
37
|
+
scopes: []
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "@foldkit/devtools-mcp",
|
|
41
|
+
version: "0.26.0",
|
|
42
|
+
packages: ["@foldkit/devtools-mcp"],
|
|
43
|
+
scopes: []
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: "@foldkit/oxlint-plugin",
|
|
47
|
+
version: "0.15.4",
|
|
48
|
+
packages: ["@foldkit/oxlint-plugin"],
|
|
49
|
+
scopes: []
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: "effect",
|
|
53
|
+
version: "4.1.2",
|
|
54
|
+
packages: [
|
|
55
|
+
"effect",
|
|
56
|
+
"@effect/platform-browser",
|
|
57
|
+
"@effect/platform-bun",
|
|
58
|
+
"@effect/platform-node",
|
|
59
|
+
"@effect/platform-node-shared",
|
|
60
|
+
"@effect/vitest"
|
|
61
|
+
],
|
|
62
|
+
scopes: ["@effect/"]
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: "@effect/tsgo",
|
|
66
|
+
version: "0.67.3",
|
|
67
|
+
packages: ["@effect/tsgo"],
|
|
68
|
+
scopes: []
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: "ultracite",
|
|
72
|
+
version: "8.1.1",
|
|
73
|
+
packages: ["ultracite"],
|
|
74
|
+
scopes: []
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: "@mpsuesser/oxlint-plugin-effect",
|
|
78
|
+
version: "0.6.0",
|
|
79
|
+
packages: ["@mpsuesser/oxlint-plugin-effect"],
|
|
80
|
+
scopes: []
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: "effect-oxlint",
|
|
84
|
+
version: "0.4.0",
|
|
85
|
+
packages: ["effect-oxlint"],
|
|
86
|
+
scopes: []
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: "typescript",
|
|
90
|
+
version: "7.0.2",
|
|
91
|
+
packages: ["typescript"],
|
|
92
|
+
scopes: []
|
|
93
|
+
}
|
|
94
|
+
];
|
|
95
|
+
const fixed = [
|
|
96
|
+
{
|
|
97
|
+
name: "oxlint",
|
|
98
|
+
version: "1.91.0",
|
|
99
|
+
by: "vite-plus"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: "@oxlint/plugins",
|
|
103
|
+
version: "1.91.0",
|
|
104
|
+
by: "vite-plus"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: "oxlint-tsgolint",
|
|
108
|
+
version: "7.0.2005",
|
|
109
|
+
by: "vite-plus"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: "oxfmt",
|
|
113
|
+
version: "0.76.0",
|
|
114
|
+
by: "vite-plus"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: "vitest",
|
|
118
|
+
version: "5.1.0",
|
|
119
|
+
by: "vite-plus"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: "vite",
|
|
123
|
+
version: "npm:@voidzero-dev/vite-plus-core@1.5.0",
|
|
124
|
+
by: "vite-plus"
|
|
125
|
+
}
|
|
126
|
+
];
|
|
127
|
+
const catalog = {
|
|
128
|
+
families,
|
|
129
|
+
fixed
|
|
130
|
+
};
|
|
131
|
+
const lead = (family) => family.packages[0] ?? family.name;
|
|
132
|
+
const inScope = (current, family, name) => Arr.some(family.scopes, (scope) => Str.startsWith(scope)(name)) && Arr.every(current.families, (other) => other === family || !other.packages.includes(name));
|
|
133
|
+
const familyOf = dual((args) => Schema.is(Schema.String)(args[0]), (name, current = catalog) => Option.orElse(Arr.findFirst(current.families, (family) => family.packages.includes(name)), () => Arr.findFirst(current.families, (family) => inScope(current, family, name))));
|
|
134
|
+
const lookupNamed = (entries) => dual((args) => Schema.is(Schema.String)(args[0]), (name, current = catalog) => Arr.findFirst(entries(current), (entry) => entry.name === name));
|
|
135
|
+
const fixedOf = lookupNamed((current) => current.fixed);
|
|
136
|
+
const familyNamed = lookupNamed((current) => current.families);
|
|
137
|
+
const fixedBy = dual((args) => Schema.is(Schema.String)(args[0]), (family, current = catalog) => Arr.filter(current.fixed, (entry) => entry.by === family));
|
|
138
|
+
const ownerOf = dual((args) => Schema.is(Schema.String)(args[0]), (name, current = catalog) => Option.orElse(familyOf(name, current), () => Option.flatMap(fixedOf(name, current), (entry) => familyNamed(entry.by, current))));
|
|
139
|
+
const versionOf = dual((args) => Schema.is(Schema.String)(args[0]), (name, current = catalog) => Option.orElse(Option.map(familyOf(name, current), (family) => family.version), () => Option.map(fixedOf(name, current), (entry) => entry.version)));
|
|
140
|
+
const pinned = (current) => R.fromEntries([...Arr.flatMap(current.families, (family) => Arr.map(family.packages, (name) => [name, family.version])), ...Arr.map(current.fixed, (entry) => [entry.name, entry.version])]);
|
|
141
|
+
const versions = pinned(catalog);
|
|
142
|
+
export { fixed as a, lead as c, pinned as d, versionOf as f, familyOf as i, nodeVersion as l, families as n, fixedBy as o, versions as p, familyNamed as r, fixedOf as s, catalog as t, ownerOf as u };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as Option from "effect/Option";
|
|
2
|
+
type Family = {
|
|
3
|
+
readonly name: string;
|
|
4
|
+
readonly version: string;
|
|
5
|
+
readonly packages: ReadonlyArray<string>;
|
|
6
|
+
readonly scopes: ReadonlyArray<string>;
|
|
7
|
+
};
|
|
8
|
+
type Fixed = {
|
|
9
|
+
readonly name: string;
|
|
10
|
+
readonly version: string;
|
|
11
|
+
readonly by: string;
|
|
12
|
+
};
|
|
13
|
+
declare const nodeVersion = "26.13.0";
|
|
14
|
+
declare const families: ReadonlyArray<Family>;
|
|
15
|
+
declare const fixed: ReadonlyArray<Fixed>;
|
|
16
|
+
type Catalog = {
|
|
17
|
+
readonly families: ReadonlyArray<Family>;
|
|
18
|
+
readonly fixed: ReadonlyArray<Fixed>;
|
|
19
|
+
};
|
|
20
|
+
declare const catalog: Catalog;
|
|
21
|
+
declare const lead: (family: Family) => string;
|
|
22
|
+
declare const familyOf: {
|
|
23
|
+
(current?: Catalog): (name: string) => Option.Option<Family>;
|
|
24
|
+
(name: string, current?: Catalog): Option.Option<Family>;
|
|
25
|
+
};
|
|
26
|
+
type NamedLookup<A> = {
|
|
27
|
+
(current?: Catalog): (name: string) => Option.Option<A>;
|
|
28
|
+
(name: string, current?: Catalog): Option.Option<A>;
|
|
29
|
+
};
|
|
30
|
+
declare const fixedOf: NamedLookup<Fixed>;
|
|
31
|
+
declare const familyNamed: NamedLookup<Family>;
|
|
32
|
+
declare const fixedBy: {
|
|
33
|
+
(current?: Catalog): (family: string) => ReadonlyArray<Fixed>;
|
|
34
|
+
(family: string, current?: Catalog): ReadonlyArray<Fixed>;
|
|
35
|
+
};
|
|
36
|
+
declare const ownerOf: {
|
|
37
|
+
(current?: Catalog): (name: string) => Option.Option<Family>;
|
|
38
|
+
(name: string, current?: Catalog): Option.Option<Family>;
|
|
39
|
+
};
|
|
40
|
+
declare const versionOf: {
|
|
41
|
+
(current?: Catalog): (name: string) => Option.Option<string>;
|
|
42
|
+
(name: string, current?: Catalog): Option.Option<string>;
|
|
43
|
+
};
|
|
44
|
+
declare const pinned: (current: Catalog) => Readonly<Record<string, string>>;
|
|
45
|
+
declare const versions: Readonly<Record<string, string>>;
|
|
46
|
+
export { families as a, fixed as c, lead as d, nodeVersion as f, versions as g, versionOf as h, catalog as i, fixedBy as l, pinned as m, Family as n, familyNamed as o, ownerOf as p, Fixed as r, familyOf as s, Catalog as t, fixedOf as u };
|
package/dist/versions.d.mts
CHANGED
|
@@ -1,46 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
export
|
|
3
|
-
readonly name: string;
|
|
4
|
-
readonly version: string;
|
|
5
|
-
readonly packages: ReadonlyArray<string>;
|
|
6
|
-
readonly scopes: ReadonlyArray<string>;
|
|
7
|
-
};
|
|
8
|
-
export type Fixed = {
|
|
9
|
-
readonly name: string;
|
|
10
|
-
readonly version: string;
|
|
11
|
-
readonly by: string;
|
|
12
|
-
};
|
|
13
|
-
export declare const nodeVersion = "26.13.0";
|
|
14
|
-
export declare const families: ReadonlyArray<Family>;
|
|
15
|
-
export declare const fixed: ReadonlyArray<Fixed>;
|
|
16
|
-
export type Catalog = {
|
|
17
|
-
readonly families: ReadonlyArray<Family>;
|
|
18
|
-
readonly fixed: ReadonlyArray<Fixed>;
|
|
19
|
-
};
|
|
20
|
-
export declare const catalog: Catalog;
|
|
21
|
-
export declare const lead: (family: Family) => string;
|
|
22
|
-
export declare const familyOf: {
|
|
23
|
-
(current?: Catalog): (name: string) => Option.Option<Family>;
|
|
24
|
-
(name: string, current?: Catalog): Option.Option<Family>;
|
|
25
|
-
};
|
|
26
|
-
type NamedLookup<A> = {
|
|
27
|
-
(current?: Catalog): (name: string) => Option.Option<A>;
|
|
28
|
-
(name: string, current?: Catalog): Option.Option<A>;
|
|
29
|
-
};
|
|
30
|
-
export declare const fixedOf: NamedLookup<Fixed>;
|
|
31
|
-
export declare const familyNamed: NamedLookup<Family>;
|
|
32
|
-
export declare const fixedBy: {
|
|
33
|
-
(current?: Catalog): (family: string) => ReadonlyArray<Fixed>;
|
|
34
|
-
(family: string, current?: Catalog): ReadonlyArray<Fixed>;
|
|
35
|
-
};
|
|
36
|
-
export declare const ownerOf: {
|
|
37
|
-
(current?: Catalog): (name: string) => Option.Option<Family>;
|
|
38
|
-
(name: string, current?: Catalog): Option.Option<Family>;
|
|
39
|
-
};
|
|
40
|
-
export declare const versionOf: {
|
|
41
|
-
(current?: Catalog): (name: string) => Option.Option<string>;
|
|
42
|
-
(name: string, current?: Catalog): Option.Option<string>;
|
|
43
|
-
};
|
|
44
|
-
export declare const pinned: (current: Catalog) => Readonly<Record<string, string>>;
|
|
45
|
-
export declare const versions: Readonly<Record<string, string>>;
|
|
46
|
-
export {};
|
|
1
|
+
import { a as families, c as fixed, d as lead, f as nodeVersion, g as versions, h as versionOf, i as catalog, l as fixedBy, m as pinned, n as Family, o as familyNamed, p as ownerOf, r as Fixed, s as familyOf, t as Catalog, u as fixedOf } from "./versions-D02TrtKw.mjs";
|
|
2
|
+
export { Catalog, Family, Fixed, catalog, families, familyNamed, familyOf, fixed, fixedBy, fixedOf, lead, nodeVersion, ownerOf, pinned, versionOf, versions };
|
package/dist/versions.mjs
CHANGED
|
@@ -1,142 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { dual } from "effect/Function";
|
|
3
|
-
import * as Option from "effect/Option";
|
|
4
|
-
import * as R from "effect/Record";
|
|
5
|
-
import * as Schema from "effect/Schema";
|
|
6
|
-
import * as Str from "effect/String";
|
|
7
|
-
// src/versions.ts
|
|
8
|
-
const nodeVersion = "26.13.0";
|
|
9
|
-
const families = [
|
|
10
|
-
{
|
|
11
|
-
name: "vite-plus",
|
|
12
|
-
version: "1.5.0",
|
|
13
|
-
packages: ["vite-plus"],
|
|
14
|
-
scopes: []
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
name: "alchemy",
|
|
18
|
-
version: "2.0.0-beta.85",
|
|
19
|
-
packages: [
|
|
20
|
-
"@alchemy.run/domain",
|
|
21
|
-
"alchemy",
|
|
22
|
-
"@alchemy.run/github",
|
|
23
|
-
"@alchemy.run/test"
|
|
24
|
-
],
|
|
25
|
-
scopes: ["@alchemy.run/"]
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
name: "foldkit",
|
|
29
|
-
version: "0.170.0",
|
|
30
|
-
packages: ["foldkit", "@foldkit/ui"],
|
|
31
|
-
scopes: []
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
name: "@foldkit/vite-plugin",
|
|
35
|
-
version: "0.29.0",
|
|
36
|
-
packages: ["@foldkit/vite-plugin"],
|
|
37
|
-
scopes: []
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
name: "@foldkit/devtools-mcp",
|
|
41
|
-
version: "0.26.0",
|
|
42
|
-
packages: ["@foldkit/devtools-mcp"],
|
|
43
|
-
scopes: []
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
name: "@foldkit/oxlint-plugin",
|
|
47
|
-
version: "0.15.4",
|
|
48
|
-
packages: ["@foldkit/oxlint-plugin"],
|
|
49
|
-
scopes: []
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
name: "effect",
|
|
53
|
-
version: "4.1.2",
|
|
54
|
-
packages: [
|
|
55
|
-
"effect",
|
|
56
|
-
"@effect/platform-browser",
|
|
57
|
-
"@effect/platform-bun",
|
|
58
|
-
"@effect/platform-node",
|
|
59
|
-
"@effect/platform-node-shared",
|
|
60
|
-
"@effect/vitest"
|
|
61
|
-
],
|
|
62
|
-
scopes: ["@effect/"]
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
name: "@effect/tsgo",
|
|
66
|
-
version: "0.67.3",
|
|
67
|
-
packages: ["@effect/tsgo"],
|
|
68
|
-
scopes: []
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
name: "ultracite",
|
|
72
|
-
version: "8.1.1",
|
|
73
|
-
packages: ["ultracite"],
|
|
74
|
-
scopes: []
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
name: "@mpsuesser/oxlint-plugin-effect",
|
|
78
|
-
version: "0.6.0",
|
|
79
|
-
packages: ["@mpsuesser/oxlint-plugin-effect"],
|
|
80
|
-
scopes: []
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
name: "effect-oxlint",
|
|
84
|
-
version: "0.4.0",
|
|
85
|
-
packages: ["effect-oxlint"],
|
|
86
|
-
scopes: []
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
name: "typescript",
|
|
90
|
-
version: "7.0.2",
|
|
91
|
-
packages: ["typescript"],
|
|
92
|
-
scopes: []
|
|
93
|
-
}
|
|
94
|
-
];
|
|
95
|
-
const fixed = [
|
|
96
|
-
{
|
|
97
|
-
name: "oxlint",
|
|
98
|
-
version: "1.91.0",
|
|
99
|
-
by: "vite-plus"
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
name: "@oxlint/plugins",
|
|
103
|
-
version: "1.91.0",
|
|
104
|
-
by: "vite-plus"
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
name: "oxlint-tsgolint",
|
|
108
|
-
version: "7.0.2005",
|
|
109
|
-
by: "vite-plus"
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
name: "oxfmt",
|
|
113
|
-
version: "0.76.0",
|
|
114
|
-
by: "vite-plus"
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
name: "vitest",
|
|
118
|
-
version: "5.1.0",
|
|
119
|
-
by: "vite-plus"
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
name: "vite",
|
|
123
|
-
version: "npm:@voidzero-dev/vite-plus-core@1.5.0",
|
|
124
|
-
by: "vite-plus"
|
|
125
|
-
}
|
|
126
|
-
];
|
|
127
|
-
const catalog = {
|
|
128
|
-
families,
|
|
129
|
-
fixed
|
|
130
|
-
};
|
|
131
|
-
const lead = (family) => family.packages[0] ?? family.name;
|
|
132
|
-
const inScope = (current, family, name) => Arr.some(family.scopes, (scope) => Str.startsWith(scope)(name)) && Arr.every(current.families, (other) => other === family || !other.packages.includes(name));
|
|
133
|
-
const familyOf = dual((args) => Schema.is(Schema.String)(args[0]), (name, current = catalog) => Option.orElse(Arr.findFirst(current.families, (family) => family.packages.includes(name)), () => Arr.findFirst(current.families, (family) => inScope(current, family, name))));
|
|
134
|
-
const lookupNamed = (entries) => dual((args) => Schema.is(Schema.String)(args[0]), (name, current = catalog) => Arr.findFirst(entries(current), (entry) => entry.name === name));
|
|
135
|
-
const fixedOf = lookupNamed((current) => current.fixed);
|
|
136
|
-
const familyNamed = lookupNamed((current) => current.families);
|
|
137
|
-
const fixedBy = dual((args) => Schema.is(Schema.String)(args[0]), (family, current = catalog) => Arr.filter(current.fixed, (entry) => entry.by === family));
|
|
138
|
-
const ownerOf = dual((args) => Schema.is(Schema.String)(args[0]), (name, current = catalog) => Option.orElse(familyOf(name, current), () => Option.flatMap(fixedOf(name, current), (entry) => familyNamed(entry.by, current))));
|
|
139
|
-
const versionOf = dual((args) => Schema.is(Schema.String)(args[0]), (name, current = catalog) => Option.orElse(Option.map(familyOf(name, current), (family) => family.version), () => Option.map(fixedOf(name, current), (entry) => entry.version)));
|
|
140
|
-
const pinned = (current) => R.fromEntries([...Arr.flatMap(current.families, (family) => Arr.map(family.packages, (name) => [name, family.version])), ...Arr.map(current.fixed, (entry) => [entry.name, entry.version])]);
|
|
141
|
-
const versions = pinned(catalog);
|
|
142
|
-
export { catalog, families, familyNamed, familyOf, fixed, fixedBy, fixedOf, lead, nodeVersion, ownerOf, pinned, versionOf, versions };
|
|
1
|
+
export { t as catalog, n as families, r as familyNamed, i as familyOf, a as fixed, o as fixedBy, s as fixedOf, c as lead, l as nodeVersion, u as ownerOf, d as pinned, f as versionOf, p as versions } from "./versions-C7LKZGr3.mjs";
|
package/package.json
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milkenjoyer/toolchain",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/birbprophet/agent-kit.git",
|
|
7
7
|
"directory": "packages/toolchain"
|
|
8
8
|
},
|
|
9
|
+
"bin": {
|
|
10
|
+
"proof": "./src/proof.ts"
|
|
11
|
+
},
|
|
9
12
|
"files": [
|
|
10
13
|
"dist",
|
|
11
14
|
"licenses",
|
|
12
15
|
"node-version",
|
|
13
16
|
"renovate.json",
|
|
17
|
+
"src/proof.ts",
|
|
14
18
|
"tsconfig.base.json",
|
|
15
19
|
"vscode/extensions.json",
|
|
16
20
|
"vscode/settings.json"
|
|
@@ -86,8 +90,10 @@
|
|
|
86
90
|
"prepack": "vp pack"
|
|
87
91
|
},
|
|
88
92
|
"dependencies": {
|
|
93
|
+
"@effect/platform-node": "4.1.2",
|
|
89
94
|
"@effect/tsgo": "0.67.3",
|
|
90
95
|
"@foldkit/oxlint-plugin": "0.15.4",
|
|
96
|
+
"@octokit/rest": "22.0.1",
|
|
91
97
|
"effect": "4.1.2",
|
|
92
98
|
"effect-oxlint": "0.4.0",
|
|
93
99
|
"semver": "7.8.6",
|
|
@@ -95,7 +101,6 @@
|
|
|
95
101
|
},
|
|
96
102
|
"devDependencies": {
|
|
97
103
|
"@birbprophet/test-kit": "0.0.0",
|
|
98
|
-
"@effect/platform-node": "4.1.2",
|
|
99
104
|
"@effect/vitest": "4.1.2",
|
|
100
105
|
"@mpsuesser/oxlint-plugin-effect": "0.6.0",
|
|
101
106
|
"@types/semver": "7.8.0",
|
package/src/proof.ts
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import { NodeServices } from "@effect/platform-node";
|
|
3
|
+
import { Octokit } from "@octokit/rest";
|
|
4
|
+
import * as Cause from "effect/Cause";
|
|
5
|
+
import * as Config from "effect/Config";
|
|
6
|
+
import * as Data from "effect/Data";
|
|
7
|
+
import * as Effect from "effect/Effect";
|
|
8
|
+
import { Base64 } from "effect/encoding";
|
|
9
|
+
import * as Exit from "effect/Exit";
|
|
10
|
+
import { FileSystem } from "effect/FileSystem";
|
|
11
|
+
import { Path } from "effect/Path";
|
|
12
|
+
import { ChildProcess } from "effect/process";
|
|
13
|
+
import * as Redacted from "effect/Redacted";
|
|
14
|
+
import * as Schema from "effect/Schema";
|
|
15
|
+
import * as Stream from "effect/Stream";
|
|
16
|
+
|
|
17
|
+
class ProofError extends Data.TaggedError("ProofError")<{
|
|
18
|
+
readonly message: string;
|
|
19
|
+
}> {}
|
|
20
|
+
|
|
21
|
+
type Kind = "image" | "video";
|
|
22
|
+
|
|
23
|
+
const kinds = new Map<string, Kind>([
|
|
24
|
+
[".png", "image"],
|
|
25
|
+
[".jpg", "image"],
|
|
26
|
+
[".jpeg", "image"],
|
|
27
|
+
[".gif", "image"],
|
|
28
|
+
[".webp", "image"],
|
|
29
|
+
[".mp4", "video"],
|
|
30
|
+
[".webm", "video"],
|
|
31
|
+
[".mov", "video"],
|
|
32
|
+
]);
|
|
33
|
+
|
|
34
|
+
const github = <A>(request: () => Promise<A>) =>
|
|
35
|
+
Effect.tryPromise({
|
|
36
|
+
try: request,
|
|
37
|
+
catch: (cause) =>
|
|
38
|
+
new ProofError({
|
|
39
|
+
message: cause instanceof Error ? cause.message : String(cause),
|
|
40
|
+
}),
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const preview = Effect.fn("proof.preview")(function* (
|
|
44
|
+
file: string,
|
|
45
|
+
gif: string
|
|
46
|
+
) {
|
|
47
|
+
const ffmpeg = yield* ChildProcess.make(
|
|
48
|
+
"ffmpeg",
|
|
49
|
+
[
|
|
50
|
+
"-loglevel",
|
|
51
|
+
"error",
|
|
52
|
+
"-i",
|
|
53
|
+
file,
|
|
54
|
+
"-t",
|
|
55
|
+
"30",
|
|
56
|
+
"-vf",
|
|
57
|
+
"fps=8,scale='min(720,iw)':-2:flags=lanczos,split[a][b];[a]palettegen[p];[b][p]paletteuse",
|
|
58
|
+
"-loop",
|
|
59
|
+
"0",
|
|
60
|
+
gif,
|
|
61
|
+
],
|
|
62
|
+
{ stdin: "ignore" }
|
|
63
|
+
).pipe(
|
|
64
|
+
Effect.mapError(
|
|
65
|
+
() => new ProofError({ message: `A video needs ffmpeg: ${file}` })
|
|
66
|
+
)
|
|
67
|
+
);
|
|
68
|
+
const [stderr, code] = yield* Effect.all(
|
|
69
|
+
[ffmpeg.stderr.pipe(Stream.decodeText, Stream.mkString), ffmpeg.exitCode],
|
|
70
|
+
{ concurrency: "unbounded" }
|
|
71
|
+
);
|
|
72
|
+
if (Number(code) !== 0)
|
|
73
|
+
return yield* new ProofError({
|
|
74
|
+
message: `ffmpeg failed for ${file}: ${stderr}`,
|
|
75
|
+
});
|
|
76
|
+
return gif;
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
const proof = Effect.fn("proof")(function* (
|
|
80
|
+
octokit: Octokit,
|
|
81
|
+
owner: string,
|
|
82
|
+
repo: string,
|
|
83
|
+
files: ReadonlyArray<string>
|
|
84
|
+
) {
|
|
85
|
+
const fs = yield* FileSystem;
|
|
86
|
+
const path = yield* Path;
|
|
87
|
+
const media = yield* Effect.forEach(
|
|
88
|
+
files,
|
|
89
|
+
(file, index) => {
|
|
90
|
+
const kind = kinds.get(path.extname(file).toLowerCase());
|
|
91
|
+
return kind === undefined
|
|
92
|
+
? new ProofError({ message: `Unknown extension: ${file}` })
|
|
93
|
+
: Effect.succeed({
|
|
94
|
+
file,
|
|
95
|
+
kind,
|
|
96
|
+
name: `${index + 1}-${path.basename(file).replaceAll(/[^\w.-]/gu, "-")}`,
|
|
97
|
+
});
|
|
98
|
+
},
|
|
99
|
+
{ concurrency: 1 }
|
|
100
|
+
);
|
|
101
|
+
const { data: repository } = yield* github(() =>
|
|
102
|
+
octokit.rest.repos.get({ owner, repo })
|
|
103
|
+
);
|
|
104
|
+
if (repository.visibility !== "private")
|
|
105
|
+
return yield* new ProofError({
|
|
106
|
+
message: `${owner}/${repo} is not private, so proof stays local`,
|
|
107
|
+
});
|
|
108
|
+
const temporary = yield* fs.makeTempDirectoryScoped({ prefix: "proof-" });
|
|
109
|
+
const uploads = yield* Effect.forEach(
|
|
110
|
+
media,
|
|
111
|
+
({ file, kind, name }) => {
|
|
112
|
+
if (kind === "image") return Effect.succeed([{ file, name }]);
|
|
113
|
+
return Effect.map(
|
|
114
|
+
preview(file, path.join(temporary, `${name}.gif`)),
|
|
115
|
+
(gif) => [
|
|
116
|
+
{ file, name },
|
|
117
|
+
{ file: gif, name: `${name}.gif` },
|
|
118
|
+
]
|
|
119
|
+
);
|
|
120
|
+
},
|
|
121
|
+
{ concurrency: 1 }
|
|
122
|
+
);
|
|
123
|
+
const tree = yield* Effect.forEach(
|
|
124
|
+
uploads.flat(),
|
|
125
|
+
({ file, name }) =>
|
|
126
|
+
Effect.gen(function* () {
|
|
127
|
+
const content = Base64.encode(yield* fs.readFile(file));
|
|
128
|
+
const { data } = yield* github(() =>
|
|
129
|
+
octokit.rest.git.createBlob({
|
|
130
|
+
owner,
|
|
131
|
+
repo,
|
|
132
|
+
encoding: "base64",
|
|
133
|
+
content,
|
|
134
|
+
})
|
|
135
|
+
);
|
|
136
|
+
return {
|
|
137
|
+
path: name,
|
|
138
|
+
mode: "100644" as const,
|
|
139
|
+
type: "blob" as const,
|
|
140
|
+
sha: data.sha,
|
|
141
|
+
};
|
|
142
|
+
}),
|
|
143
|
+
{ concurrency: 1 }
|
|
144
|
+
);
|
|
145
|
+
const { data: root } = yield* github(() =>
|
|
146
|
+
octokit.rest.git.createTree({ owner, repo, tree })
|
|
147
|
+
);
|
|
148
|
+
const { data: commit } = yield* github(() =>
|
|
149
|
+
octokit.rest.git.createCommit({
|
|
150
|
+
owner,
|
|
151
|
+
repo,
|
|
152
|
+
tree: root.sha,
|
|
153
|
+
parents: [],
|
|
154
|
+
message: "Verifier proof",
|
|
155
|
+
})
|
|
156
|
+
);
|
|
157
|
+
yield* github(() =>
|
|
158
|
+
octokit.rest.git.createRef({
|
|
159
|
+
owner,
|
|
160
|
+
repo,
|
|
161
|
+
ref: `refs/proof/${commit.sha}`,
|
|
162
|
+
sha: commit.sha,
|
|
163
|
+
})
|
|
164
|
+
);
|
|
165
|
+
const url = (name: string) =>
|
|
166
|
+
`https://github.com/${[owner, repo, "raw", commit.sha, name].map(encodeURIComponent).join("/")}`;
|
|
167
|
+
return media.map(({ name, kind }) =>
|
|
168
|
+
kind === "image"
|
|
169
|
+
? `})`
|
|
170
|
+
: `[})](${url(name)})`
|
|
171
|
+
);
|
|
172
|
+
}, Effect.scoped);
|
|
173
|
+
|
|
174
|
+
if (import.meta.main) {
|
|
175
|
+
const [repository = "", ...files] = process.argv.slice(2);
|
|
176
|
+
const [, owner, repo] = /^([^/#\s]+)\/([^/#\s]+)$/u.exec(repository) ?? [];
|
|
177
|
+
if (owner === undefined || repo === undefined || files.length === 0) {
|
|
178
|
+
process.stderr.write("usage: proof <owner/repo> <file>...\n");
|
|
179
|
+
process.exitCode = 2;
|
|
180
|
+
} else {
|
|
181
|
+
const exit = await Effect.runPromiseExit(
|
|
182
|
+
Effect.gen(function* () {
|
|
183
|
+
const token = yield* Config.schema(
|
|
184
|
+
Schema.Redacted(Schema.NonEmptyString),
|
|
185
|
+
"GH_TOKEN"
|
|
186
|
+
).pipe(
|
|
187
|
+
Config.orElse(() =>
|
|
188
|
+
Config.schema(
|
|
189
|
+
Schema.Redacted(Schema.NonEmptyString),
|
|
190
|
+
"GITHUB_TOKEN"
|
|
191
|
+
)
|
|
192
|
+
),
|
|
193
|
+
Effect.mapError(
|
|
194
|
+
() =>
|
|
195
|
+
new ProofError({ message: "Missing GH_TOKEN or GITHUB_TOKEN" })
|
|
196
|
+
)
|
|
197
|
+
);
|
|
198
|
+
return yield* proof(
|
|
199
|
+
new Octokit({ auth: Redacted.value(token) }),
|
|
200
|
+
owner,
|
|
201
|
+
repo,
|
|
202
|
+
files
|
|
203
|
+
);
|
|
204
|
+
}).pipe(Effect.provide(NodeServices.layer))
|
|
205
|
+
);
|
|
206
|
+
if (Exit.isSuccess(exit))
|
|
207
|
+
process.stdout.write(`${exit.value.join("\n")}\n`);
|
|
208
|
+
else {
|
|
209
|
+
const error = Cause.squash(exit.cause);
|
|
210
|
+
process.stderr.write(
|
|
211
|
+
`${error instanceof Error ? error.message : String(error)}\n`
|
|
212
|
+
);
|
|
213
|
+
process.exitCode = 1;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|