reposets 0.1.0 → 0.2.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/500.js +190 -80
- package/index.d.ts +8 -8
- package/package.json +2 -2
package/500.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Context, Data, Effect, Layer, Option, Ref, Schema } from "effect";
|
|
2
2
|
import { blake2b } from "blakejs";
|
|
3
3
|
import tweetnacl from "tweetnacl";
|
|
4
|
+
import { AppDirsConfig, ConfigError, ConfigFile, FirstMatch, Jsonifiable, TomlCodec, UpwardWalk, XdgConfig, XdgConfigLive, XdgSavePath, taplo, tombi } from "xdg-effect";
|
|
4
5
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
5
6
|
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
6
|
-
import { AppDirsConfig, ConfigError, ConfigFile, FirstMatch, TomlCodec, UpwardWalk, XdgConfig, XdgConfigLive, XdgSavePath } from "xdg-effect";
|
|
7
7
|
import { Octokit } from "@octokit/rest";
|
|
8
8
|
class ResolveError extends Data.TaggedError("ResolveError") {
|
|
9
9
|
}
|
|
@@ -34,9 +34,9 @@ const ResourceFileKind = Schema.Struct({
|
|
|
34
34
|
}).annotations({
|
|
35
35
|
title: "File entries",
|
|
36
36
|
description: "Named entries with file path values, resolved relative to config directory",
|
|
37
|
-
jsonSchema: {
|
|
38
|
-
|
|
39
|
-
}
|
|
37
|
+
jsonSchema: tombi({
|
|
38
|
+
additionalKeyLabel: "name"
|
|
39
|
+
})
|
|
40
40
|
})
|
|
41
41
|
});
|
|
42
42
|
const ResourceValueKind = Schema.Struct({
|
|
@@ -44,14 +44,14 @@ const ResourceValueKind = Schema.Struct({
|
|
|
44
44
|
key: Schema.String,
|
|
45
45
|
value: Schema.Union(Schema.String, Schema.Record({
|
|
46
46
|
key: Schema.String,
|
|
47
|
-
value:
|
|
47
|
+
value: Jsonifiable
|
|
48
48
|
}))
|
|
49
49
|
}).annotations({
|
|
50
50
|
title: "Value entries",
|
|
51
51
|
description: "Named entries with inline values. Strings used as-is, objects JSON-stringified.",
|
|
52
|
-
jsonSchema: {
|
|
53
|
-
|
|
54
|
-
}
|
|
52
|
+
jsonSchema: tombi({
|
|
53
|
+
additionalKeyLabel: "name"
|
|
54
|
+
})
|
|
55
55
|
})
|
|
56
56
|
});
|
|
57
57
|
const ResourceResolvedKind = Schema.Struct({
|
|
@@ -61,20 +61,30 @@ const ResourceResolvedKind = Schema.Struct({
|
|
|
61
61
|
}).annotations({
|
|
62
62
|
title: "Resolved entries",
|
|
63
63
|
description: "Named entries mapped to credential labels. Values come from the active credential profile.",
|
|
64
|
-
jsonSchema: {
|
|
65
|
-
|
|
66
|
-
}
|
|
64
|
+
jsonSchema: tombi({
|
|
65
|
+
additionalKeyLabel: "name"
|
|
66
|
+
})
|
|
67
67
|
})
|
|
68
68
|
});
|
|
69
69
|
const SecretGroupSchema = Schema.Union(ResourceFileKind, ResourceValueKind, ResourceResolvedKind).annotations({
|
|
70
70
|
identifier: "SecretGroup",
|
|
71
71
|
title: "Secret group",
|
|
72
|
-
description: "A group of secrets. Must be exactly one kind: file, value, or resolved."
|
|
72
|
+
description: "A group of secrets. Must be exactly one kind: file, value, or resolved.",
|
|
73
|
+
jsonSchema: taplo({
|
|
74
|
+
links: {
|
|
75
|
+
key: "https://github.com/spencerbeggs/reposets/blob/main/docs/secrets-and-variables.md"
|
|
76
|
+
}
|
|
77
|
+
})
|
|
73
78
|
});
|
|
74
79
|
const VariableGroupSchema = Schema.Union(ResourceFileKind, ResourceValueKind, ResourceResolvedKind).annotations({
|
|
75
80
|
identifier: "VariableGroup",
|
|
76
81
|
title: "Variable group",
|
|
77
|
-
description: "A group of variables. Must be exactly one kind: file, value, or resolved."
|
|
82
|
+
description: "A group of variables. Must be exactly one kind: file, value, or resolved.",
|
|
83
|
+
jsonSchema: taplo({
|
|
84
|
+
links: {
|
|
85
|
+
key: "https://github.com/spencerbeggs/reposets/blob/main/docs/secrets-and-variables.md"
|
|
86
|
+
}
|
|
87
|
+
})
|
|
78
88
|
});
|
|
79
89
|
const CleanupScopeSchema = Schema.Union(Schema.Boolean, Schema.Struct({
|
|
80
90
|
preserve: Schema.Array(Schema.String).annotations({
|
|
@@ -184,7 +194,12 @@ const CleanupSchema = Schema.Struct({
|
|
|
184
194
|
}).annotations({
|
|
185
195
|
identifier: "Cleanup",
|
|
186
196
|
title: "Cleanup configuration",
|
|
187
|
-
description: "Controls deletion of resources not declared in config. All disabled by default."
|
|
197
|
+
description: "Controls deletion of resources not declared in config. All disabled by default.",
|
|
198
|
+
jsonSchema: taplo({
|
|
199
|
+
links: {
|
|
200
|
+
key: "https://github.com/spencerbeggs/reposets/blob/main/docs/cleanup.md"
|
|
201
|
+
}
|
|
202
|
+
})
|
|
188
203
|
});
|
|
189
204
|
const ReviewerTypeSchema = Schema.Literal("User", "Team").annotations({
|
|
190
205
|
title: "Reviewer type",
|
|
@@ -194,7 +209,7 @@ const ReviewerSchema = Schema.Struct({
|
|
|
194
209
|
type: ReviewerTypeSchema,
|
|
195
210
|
id: Schema.Int.annotations({
|
|
196
211
|
title: "Reviewer ID",
|
|
197
|
-
description: "The ID of the user or team"
|
|
212
|
+
description: "The numeric GitHub ID of the user or team"
|
|
198
213
|
})
|
|
199
214
|
}).annotations({
|
|
200
215
|
identifier: "Reviewer",
|
|
@@ -247,7 +262,14 @@ const EnvironmentSchema = Schema.Struct({
|
|
|
247
262
|
title: "Deployment environment",
|
|
248
263
|
description: "Configuration for a GitHub deployment environment",
|
|
249
264
|
jsonSchema: {
|
|
250
|
-
|
|
265
|
+
...tombi({
|
|
266
|
+
tableKeysOrder: "schema"
|
|
267
|
+
}),
|
|
268
|
+
...taplo({
|
|
269
|
+
links: {
|
|
270
|
+
key: "https://github.com/spencerbeggs/reposets/blob/main/docs/environments.md"
|
|
271
|
+
}
|
|
272
|
+
})
|
|
251
273
|
}
|
|
252
274
|
});
|
|
253
275
|
const ResolvedRefSchema = Schema.Struct({
|
|
@@ -314,37 +336,48 @@ const RulesetConditionsSchema = Schema.Struct({
|
|
|
314
336
|
});
|
|
315
337
|
const RequiredReviewerSchema = Schema.Struct({
|
|
316
338
|
file_patterns: Schema.Array(Schema.String).annotations({
|
|
339
|
+
title: "File patterns",
|
|
317
340
|
description: "File patterns this reviewer must approve (fnmatch syntax)"
|
|
318
341
|
}),
|
|
319
342
|
minimum_approvals: Schema.Int.annotations({
|
|
343
|
+
title: "Minimum approvals",
|
|
320
344
|
description: "Minimum approvals required from this team (0 = optional)"
|
|
321
345
|
}),
|
|
322
346
|
reviewer: Schema.Struct({
|
|
323
347
|
id: Schema.Int.annotations({
|
|
348
|
+
title: "Team ID",
|
|
324
349
|
description: "Team ID"
|
|
325
350
|
}),
|
|
326
351
|
type: Schema.Literal("Team")
|
|
352
|
+
}).annotations({
|
|
353
|
+
title: "Reviewer team"
|
|
327
354
|
})
|
|
328
355
|
});
|
|
329
356
|
const StatusCheckSchema = Schema.Struct({
|
|
330
357
|
context: Schema.String.annotations({
|
|
358
|
+
title: "Context",
|
|
331
359
|
description: "The status check context name that must be present on the commit"
|
|
332
360
|
}),
|
|
333
361
|
integration_id: Schema.optional(Schema.Union(Schema.Int, ResolvedRefSchema).annotations({
|
|
362
|
+
title: "Integration ID",
|
|
334
363
|
description: "The integration ID, or a { resolved } reference to a credential label"
|
|
335
364
|
}))
|
|
336
365
|
});
|
|
337
366
|
const WorkflowFileSchema = Schema.Struct({
|
|
338
367
|
path: Schema.String.annotations({
|
|
368
|
+
title: "Workflow path",
|
|
339
369
|
description: "Path to the workflow file"
|
|
340
370
|
}),
|
|
341
371
|
ref: Schema.optional(Schema.String.annotations({
|
|
372
|
+
title: "Ref",
|
|
342
373
|
description: "Branch or tag of the workflow file"
|
|
343
374
|
})),
|
|
344
375
|
repository_id: Schema.Union(Schema.Int, ResolvedRefSchema).annotations({
|
|
376
|
+
title: "Repository ID",
|
|
345
377
|
description: "Repository ID, or a { resolved } reference to a credential label"
|
|
346
378
|
}),
|
|
347
379
|
sha: Schema.optional(Schema.String.annotations({
|
|
380
|
+
title: "SHA",
|
|
348
381
|
description: "Commit SHA of the workflow file"
|
|
349
382
|
}))
|
|
350
383
|
});
|
|
@@ -555,31 +588,31 @@ const sharedRulesetFields = {
|
|
|
555
588
|
conditions: Schema.optional(RulesetConditionsSchema),
|
|
556
589
|
bypass_actors: Schema.optional(Schema.Array(BypassActorSchema)),
|
|
557
590
|
creation: Schema.optional(Schema.Boolean.annotations({
|
|
558
|
-
title: "
|
|
591
|
+
title: "Restrict creation",
|
|
559
592
|
description: "When true, adds a creation rule"
|
|
560
593
|
})),
|
|
561
594
|
update: Schema.optional(Schema.Boolean.annotations({
|
|
562
|
-
title: "
|
|
595
|
+
title: "Restrict updates",
|
|
563
596
|
description: "When true, adds an update rule with update_allows_fetch_and_merge: true"
|
|
564
597
|
})),
|
|
565
598
|
deletion: Schema.optional(Schema.Boolean.annotations({
|
|
566
|
-
title: "
|
|
599
|
+
title: "Restrict deletion",
|
|
567
600
|
description: "When true, adds a deletion rule"
|
|
568
601
|
})),
|
|
569
602
|
required_linear_history: Schema.optional(Schema.Boolean.annotations({
|
|
570
|
-
title: "
|
|
603
|
+
title: "Require linear history",
|
|
571
604
|
description: "When true, adds a required_linear_history rule"
|
|
572
605
|
})),
|
|
573
606
|
required_signatures: Schema.optional(Schema.Boolean.annotations({
|
|
574
|
-
title: "
|
|
607
|
+
title: "Require signatures",
|
|
575
608
|
description: "When true, adds a required_signatures rule"
|
|
576
609
|
})),
|
|
577
610
|
non_fast_forward: Schema.optional(Schema.Boolean.annotations({
|
|
578
|
-
title: "
|
|
611
|
+
title: "Prevent non-fast-forward",
|
|
579
612
|
description: "When true, adds a non_fast_forward rule"
|
|
580
613
|
})),
|
|
581
614
|
deployments: Schema.optional(Schema.Array(Schema.String).annotations({
|
|
582
|
-
title: "
|
|
615
|
+
title: "Required deployments",
|
|
583
616
|
description: "Deployment environments that must succeed; converts to required_deployments rule"
|
|
584
617
|
})),
|
|
585
618
|
targets: Schema.optional(TargetsSchema),
|
|
@@ -620,7 +653,20 @@ const BranchRulesetSchema = Schema.Struct({
|
|
|
620
653
|
title: "Branch ruleset",
|
|
621
654
|
description: "A ruleset that applies to branches",
|
|
622
655
|
jsonSchema: {
|
|
623
|
-
|
|
656
|
+
...tombi({
|
|
657
|
+
tableKeysOrder: "schema"
|
|
658
|
+
}),
|
|
659
|
+
...taplo({
|
|
660
|
+
initKeys: [
|
|
661
|
+
"name",
|
|
662
|
+
"type",
|
|
663
|
+
"enforcement",
|
|
664
|
+
"targets"
|
|
665
|
+
],
|
|
666
|
+
links: {
|
|
667
|
+
key: "https://github.com/spencerbeggs/reposets/blob/main/docs/rulesets.md"
|
|
668
|
+
}
|
|
669
|
+
})
|
|
624
670
|
}
|
|
625
671
|
});
|
|
626
672
|
const TagRulesetSchema = Schema.Struct({
|
|
@@ -638,16 +684,31 @@ const TagRulesetSchema = Schema.Struct({
|
|
|
638
684
|
title: "Tag ruleset",
|
|
639
685
|
description: "A ruleset that applies to tags",
|
|
640
686
|
jsonSchema: {
|
|
641
|
-
|
|
687
|
+
...tombi({
|
|
688
|
+
tableKeysOrder: "schema"
|
|
689
|
+
}),
|
|
690
|
+
...taplo({
|
|
691
|
+
initKeys: [
|
|
692
|
+
"name",
|
|
693
|
+
"type",
|
|
694
|
+
"enforcement",
|
|
695
|
+
"targets"
|
|
696
|
+
],
|
|
697
|
+
links: {
|
|
698
|
+
key: "https://github.com/spencerbeggs/reposets/blob/main/docs/rulesets.md"
|
|
699
|
+
}
|
|
700
|
+
})
|
|
642
701
|
}
|
|
643
702
|
});
|
|
644
703
|
const RulesetSchema = Schema.Union(BranchRulesetSchema, TagRulesetSchema).annotations({
|
|
645
704
|
identifier: "Ruleset",
|
|
646
705
|
title: "Repository ruleset",
|
|
647
706
|
description: "A set of rules to apply when specified conditions are met",
|
|
648
|
-
jsonSchema: {
|
|
649
|
-
|
|
650
|
-
|
|
707
|
+
jsonSchema: taplo({
|
|
708
|
+
links: {
|
|
709
|
+
key: "https://github.com/spencerbeggs/reposets/blob/main/docs/rulesets.md"
|
|
710
|
+
}
|
|
711
|
+
})
|
|
651
712
|
});
|
|
652
713
|
function buildRulesetPayload(ruleset) {
|
|
653
714
|
const rules = [];
|
|
@@ -878,9 +939,9 @@ const SecretScopesSchema = Schema.Struct({
|
|
|
878
939
|
}).annotations({
|
|
879
940
|
title: "Environment secret scopes",
|
|
880
941
|
description: "Map of environment names to secret group references",
|
|
881
|
-
jsonSchema: {
|
|
882
|
-
|
|
883
|
-
}
|
|
942
|
+
jsonSchema: tombi({
|
|
943
|
+
additionalKeyLabel: "environment_name"
|
|
944
|
+
})
|
|
884
945
|
}))
|
|
885
946
|
}).annotations({
|
|
886
947
|
identifier: "SecretScopes",
|
|
@@ -906,9 +967,9 @@ const VariableScopesSchema = Schema.Struct({
|
|
|
906
967
|
}).annotations({
|
|
907
968
|
title: "Environment variable scopes",
|
|
908
969
|
description: "Map of environment names to variable group references",
|
|
909
|
-
jsonSchema: {
|
|
910
|
-
|
|
911
|
-
}
|
|
970
|
+
jsonSchema: tombi({
|
|
971
|
+
additionalKeyLabel: "environment_name"
|
|
972
|
+
})
|
|
912
973
|
}))
|
|
913
974
|
}).annotations({
|
|
914
975
|
identifier: "VariableScopes",
|
|
@@ -933,9 +994,9 @@ const GroupSchema = Schema.Struct({
|
|
|
933
994
|
"repo-three"
|
|
934
995
|
]
|
|
935
996
|
],
|
|
936
|
-
jsonSchema: {
|
|
937
|
-
|
|
938
|
-
}
|
|
997
|
+
jsonSchema: tombi({
|
|
998
|
+
arrayValuesOrder: "ascending"
|
|
999
|
+
})
|
|
939
1000
|
}),
|
|
940
1001
|
credentials: Schema.optional(Schema.String.annotations({
|
|
941
1002
|
title: "Credential profile",
|
|
@@ -982,7 +1043,17 @@ const GroupSchema = Schema.Struct({
|
|
|
982
1043
|
title: "Repository group",
|
|
983
1044
|
description: "A named group of repositories with their resource assignments",
|
|
984
1045
|
jsonSchema: {
|
|
985
|
-
|
|
1046
|
+
...tombi({
|
|
1047
|
+
tableKeysOrder: "schema"
|
|
1048
|
+
}),
|
|
1049
|
+
...taplo({
|
|
1050
|
+
initKeys: [
|
|
1051
|
+
"repos"
|
|
1052
|
+
],
|
|
1053
|
+
links: {
|
|
1054
|
+
key: "https://github.com/spencerbeggs/reposets/blob/main/docs/configuration.md"
|
|
1055
|
+
}
|
|
1056
|
+
})
|
|
986
1057
|
}
|
|
987
1058
|
});
|
|
988
1059
|
const SquashMergeCommitTitleSchema = Schema.Literal("PR_TITLE", "COMMIT_OR_PR_TITLE").annotations({
|
|
@@ -1068,13 +1139,20 @@ const SettingsGroupSchema = Schema.Struct({
|
|
|
1068
1139
|
}))
|
|
1069
1140
|
}, {
|
|
1070
1141
|
key: Schema.String,
|
|
1071
|
-
value:
|
|
1142
|
+
value: Jsonifiable
|
|
1072
1143
|
}).annotations({
|
|
1073
1144
|
identifier: "SettingsGroup",
|
|
1074
1145
|
title: "Settings group",
|
|
1075
1146
|
description: "GitHub repository settings to apply. Known fields are typed; additional fields are passed through to the API.",
|
|
1076
1147
|
jsonSchema: {
|
|
1077
|
-
|
|
1148
|
+
...tombi({
|
|
1149
|
+
tableKeysOrder: "schema"
|
|
1150
|
+
}),
|
|
1151
|
+
...taplo({
|
|
1152
|
+
links: {
|
|
1153
|
+
key: "https://github.com/spencerbeggs/reposets/blob/main/docs/configuration.md"
|
|
1154
|
+
}
|
|
1155
|
+
})
|
|
1078
1156
|
}
|
|
1079
1157
|
});
|
|
1080
1158
|
const LogLevelSchema = Schema.Literal("silent", "info", "verbose", "debug").annotations({
|
|
@@ -1102,10 +1180,10 @@ const ConfigSchema = Schema.Struct({
|
|
|
1102
1180
|
value: SettingsGroupSchema
|
|
1103
1181
|
}).annotations({
|
|
1104
1182
|
title: "Settings groups",
|
|
1105
|
-
description: "Named groups of GitHub repository settings
|
|
1106
|
-
jsonSchema: {
|
|
1107
|
-
|
|
1108
|
-
}
|
|
1183
|
+
description: "Named groups of GitHub repository settings to apply",
|
|
1184
|
+
jsonSchema: tombi({
|
|
1185
|
+
additionalKeyLabel: "setting_group"
|
|
1186
|
+
})
|
|
1109
1187
|
}), {
|
|
1110
1188
|
default: ()=>({})
|
|
1111
1189
|
}),
|
|
@@ -1115,9 +1193,9 @@ const ConfigSchema = Schema.Struct({
|
|
|
1115
1193
|
}).annotations({
|
|
1116
1194
|
title: "Secret groups",
|
|
1117
1195
|
description: "Named groups of secrets. Each group is one kind: file, value, or resolved.",
|
|
1118
|
-
jsonSchema: {
|
|
1119
|
-
|
|
1120
|
-
}
|
|
1196
|
+
jsonSchema: tombi({
|
|
1197
|
+
additionalKeyLabel: "secret_group"
|
|
1198
|
+
})
|
|
1121
1199
|
}), {
|
|
1122
1200
|
default: ()=>({})
|
|
1123
1201
|
}),
|
|
@@ -1127,9 +1205,9 @@ const ConfigSchema = Schema.Struct({
|
|
|
1127
1205
|
}).annotations({
|
|
1128
1206
|
title: "Variable groups",
|
|
1129
1207
|
description: "Named groups of variables. Each group is one kind: file, value, or resolved.",
|
|
1130
|
-
jsonSchema: {
|
|
1131
|
-
|
|
1132
|
-
}
|
|
1208
|
+
jsonSchema: tombi({
|
|
1209
|
+
additionalKeyLabel: "variable_group"
|
|
1210
|
+
})
|
|
1133
1211
|
}), {
|
|
1134
1212
|
default: ()=>({})
|
|
1135
1213
|
}),
|
|
@@ -1138,10 +1216,10 @@ const ConfigSchema = Schema.Struct({
|
|
|
1138
1216
|
value: RulesetSchema
|
|
1139
1217
|
}).annotations({
|
|
1140
1218
|
title: "Rulesets",
|
|
1141
|
-
description: "Named rulesets defining branch
|
|
1142
|
-
jsonSchema: {
|
|
1143
|
-
|
|
1144
|
-
}
|
|
1219
|
+
description: "Named rulesets defining branch and tag protection rules",
|
|
1220
|
+
jsonSchema: tombi({
|
|
1221
|
+
additionalKeyLabel: "ruleset_name"
|
|
1222
|
+
})
|
|
1145
1223
|
}), {
|
|
1146
1224
|
default: ()=>({})
|
|
1147
1225
|
}),
|
|
@@ -1151,9 +1229,9 @@ const ConfigSchema = Schema.Struct({
|
|
|
1151
1229
|
}).annotations({
|
|
1152
1230
|
title: "Environments",
|
|
1153
1231
|
description: "Named deployment environment configurations",
|
|
1154
|
-
jsonSchema: {
|
|
1155
|
-
|
|
1156
|
-
}
|
|
1232
|
+
jsonSchema: tombi({
|
|
1233
|
+
additionalKeyLabel: "environment_name"
|
|
1234
|
+
})
|
|
1157
1235
|
}), {
|
|
1158
1236
|
default: ()=>({})
|
|
1159
1237
|
}),
|
|
@@ -1162,17 +1240,28 @@ const ConfigSchema = Schema.Struct({
|
|
|
1162
1240
|
value: GroupSchema
|
|
1163
1241
|
}).annotations({
|
|
1164
1242
|
title: "Groups",
|
|
1165
|
-
description: "Named groups of repositories with their settings, secrets, variables, and
|
|
1166
|
-
jsonSchema: {
|
|
1167
|
-
|
|
1168
|
-
}
|
|
1243
|
+
description: "Named groups of repositories with their settings, secrets, variables, rulesets, and environment assignments",
|
|
1244
|
+
jsonSchema: tombi({
|
|
1245
|
+
additionalKeyLabel: "group_name"
|
|
1246
|
+
})
|
|
1169
1247
|
})
|
|
1170
1248
|
}).annotations({
|
|
1171
1249
|
identifier: "Config",
|
|
1172
1250
|
title: "reposets Configuration",
|
|
1173
|
-
description: "Configuration for syncing GitHub repository settings, secrets, variables, and
|
|
1251
|
+
description: "Configuration for syncing GitHub repository settings, secrets, variables, rulesets, and deployment environments",
|
|
1174
1252
|
jsonSchema: {
|
|
1175
|
-
|
|
1253
|
+
...tombi({
|
|
1254
|
+
tableKeysOrder: "schema"
|
|
1255
|
+
}),
|
|
1256
|
+
...taplo({
|
|
1257
|
+
initKeys: [
|
|
1258
|
+
"owner",
|
|
1259
|
+
"groups"
|
|
1260
|
+
],
|
|
1261
|
+
links: {
|
|
1262
|
+
key: "https://github.com/spencerbeggs/reposets/blob/main/docs/configuration.md"
|
|
1263
|
+
}
|
|
1264
|
+
})
|
|
1176
1265
|
}
|
|
1177
1266
|
});
|
|
1178
1267
|
const ResolveSectionSchema = Schema.Struct({
|
|
@@ -1182,9 +1271,9 @@ const ResolveSectionSchema = Schema.Struct({
|
|
|
1182
1271
|
}).annotations({
|
|
1183
1272
|
title: "1Password references",
|
|
1184
1273
|
description: "Named values resolved via 1Password SDK. Values are op:// reference strings.",
|
|
1185
|
-
jsonSchema: {
|
|
1186
|
-
|
|
1187
|
-
}
|
|
1274
|
+
jsonSchema: tombi({
|
|
1275
|
+
additionalKeyLabel: "label"
|
|
1276
|
+
})
|
|
1188
1277
|
})),
|
|
1189
1278
|
file: Schema.optional(Schema.Record({
|
|
1190
1279
|
key: Schema.String,
|
|
@@ -1192,32 +1281,37 @@ const ResolveSectionSchema = Schema.Struct({
|
|
|
1192
1281
|
}).annotations({
|
|
1193
1282
|
title: "File references",
|
|
1194
1283
|
description: "Named values read from files. Values are file paths relative to the credentials directory.",
|
|
1195
|
-
jsonSchema: {
|
|
1196
|
-
|
|
1197
|
-
}
|
|
1284
|
+
jsonSchema: tombi({
|
|
1285
|
+
additionalKeyLabel: "label"
|
|
1286
|
+
})
|
|
1198
1287
|
})),
|
|
1199
1288
|
value: Schema.optional(Schema.Record({
|
|
1200
1289
|
key: Schema.String,
|
|
1201
1290
|
value: Schema.Union(Schema.String, Schema.Record({
|
|
1202
1291
|
key: Schema.String,
|
|
1203
|
-
value:
|
|
1292
|
+
value: Jsonifiable
|
|
1204
1293
|
}))
|
|
1205
1294
|
}).annotations({
|
|
1206
1295
|
title: "Inline values",
|
|
1207
1296
|
description: "Named inline values. Strings are used as-is, objects are JSON-stringified.",
|
|
1208
|
-
jsonSchema: {
|
|
1209
|
-
|
|
1210
|
-
}
|
|
1297
|
+
jsonSchema: tombi({
|
|
1298
|
+
additionalKeyLabel: "label"
|
|
1299
|
+
})
|
|
1211
1300
|
}))
|
|
1212
1301
|
}).annotations({
|
|
1213
1302
|
identifier: "ResolveSection",
|
|
1214
1303
|
title: "Resolve section",
|
|
1215
|
-
description: "Named values resolved from 1Password, files, or inline. Referenced by
|
|
1304
|
+
description: "Named values resolved from 1Password, files, or inline. Referenced by resolved entries in secret and variable groups.",
|
|
1305
|
+
jsonSchema: taplo({
|
|
1306
|
+
links: {
|
|
1307
|
+
key: "https://github.com/spencerbeggs/reposets/blob/main/docs/credentials.md"
|
|
1308
|
+
}
|
|
1309
|
+
})
|
|
1216
1310
|
});
|
|
1217
1311
|
const CredentialProfileSchema = Schema.Struct({
|
|
1218
1312
|
github_token: Schema.String.annotations({
|
|
1219
1313
|
title: "GitHub token",
|
|
1220
|
-
description: "A GitHub personal access token (fine-grained) with
|
|
1314
|
+
description: "A GitHub personal access token (fine-grained) with administration, secrets, variables, environments, and GPG keys permissions",
|
|
1221
1315
|
examples: [
|
|
1222
1316
|
"ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
|
1223
1317
|
]
|
|
@@ -1233,7 +1327,15 @@ const CredentialProfileSchema = Schema.Struct({
|
|
|
1233
1327
|
}).annotations({
|
|
1234
1328
|
identifier: "CredentialProfile",
|
|
1235
1329
|
title: "Credential profile",
|
|
1236
|
-
description: "Authentication credentials for a GitHub account with optional
|
|
1330
|
+
description: "Authentication credentials for a GitHub account with optional named values for secret and variable resolution",
|
|
1331
|
+
jsonSchema: taplo({
|
|
1332
|
+
initKeys: [
|
|
1333
|
+
"github_token"
|
|
1334
|
+
],
|
|
1335
|
+
links: {
|
|
1336
|
+
key: "https://github.com/spencerbeggs/reposets/blob/main/docs/credentials.md"
|
|
1337
|
+
}
|
|
1338
|
+
})
|
|
1237
1339
|
});
|
|
1238
1340
|
const CredentialsSchema = Schema.Struct({
|
|
1239
1341
|
profiles: Schema.optionalWith(Schema.Record({
|
|
@@ -1242,16 +1344,24 @@ const CredentialsSchema = Schema.Struct({
|
|
|
1242
1344
|
}).annotations({
|
|
1243
1345
|
title: "Credential profiles",
|
|
1244
1346
|
description: "Named credential profiles. If only one profile is defined, it is used automatically for all repo groups.",
|
|
1245
|
-
jsonSchema: {
|
|
1246
|
-
|
|
1247
|
-
}
|
|
1347
|
+
jsonSchema: tombi({
|
|
1348
|
+
additionalKeyLabel: "profile_name"
|
|
1349
|
+
})
|
|
1248
1350
|
}), {
|
|
1249
1351
|
default: ()=>({})
|
|
1250
1352
|
})
|
|
1251
1353
|
}).annotations({
|
|
1252
1354
|
identifier: "Credentials",
|
|
1253
1355
|
title: "reposets Credentials",
|
|
1254
|
-
description: "Authentication profiles for reposets. This file should be gitignored."
|
|
1356
|
+
description: "Authentication profiles for reposets. This file should be gitignored.",
|
|
1357
|
+
jsonSchema: taplo({
|
|
1358
|
+
initKeys: [
|
|
1359
|
+
"profiles"
|
|
1360
|
+
],
|
|
1361
|
+
links: {
|
|
1362
|
+
key: "https://github.com/spencerbeggs/reposets/blob/main/docs/credentials.md"
|
|
1363
|
+
}
|
|
1364
|
+
})
|
|
1255
1365
|
});
|
|
1256
1366
|
const CONFIG_FILENAME = "reposets.config.toml";
|
|
1257
1367
|
const CREDENTIALS_FILENAME = "reposets.credentials.toml";
|
package/index.d.ts
CHANGED
|
@@ -143,14 +143,14 @@ export declare const ConfigSchema: Schema.Struct<{
|
|
|
143
143
|
web_commit_signoff_required: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
|
|
144
144
|
}, readonly [{
|
|
145
145
|
readonly key: typeof Schema.String;
|
|
146
|
-
readonly value:
|
|
146
|
+
readonly value: Schema.SchemaClass<unknown, unknown, never>;
|
|
147
147
|
}]>>, {
|
|
148
148
|
default: () => {};
|
|
149
149
|
}>;
|
|
150
150
|
secrets: Schema.optionalWith<Schema.Record$<typeof Schema.String, Schema.Union<[Schema.Struct<{
|
|
151
151
|
file: Schema.Record$<typeof Schema.String, typeof Schema.String>;
|
|
152
152
|
}>, Schema.Struct<{
|
|
153
|
-
value: Schema.Record$<typeof Schema.String, Schema.Union<[typeof Schema.String, Schema.Record$<typeof Schema.String,
|
|
153
|
+
value: Schema.Record$<typeof Schema.String, Schema.Union<[typeof Schema.String, Schema.Record$<typeof Schema.String, Schema.SchemaClass<unknown, unknown, never>>]>>;
|
|
154
154
|
}>, Schema.Struct<{
|
|
155
155
|
resolved: Schema.Record$<typeof Schema.String, typeof Schema.String>;
|
|
156
156
|
}>]>>, {
|
|
@@ -159,7 +159,7 @@ export declare const ConfigSchema: Schema.Struct<{
|
|
|
159
159
|
variables: Schema.optionalWith<Schema.Record$<typeof Schema.String, Schema.Union<[Schema.Struct<{
|
|
160
160
|
file: Schema.Record$<typeof Schema.String, typeof Schema.String>;
|
|
161
161
|
}>, Schema.Struct<{
|
|
162
|
-
value: Schema.Record$<typeof Schema.String, Schema.Union<[typeof Schema.String, Schema.Record$<typeof Schema.String,
|
|
162
|
+
value: Schema.Record$<typeof Schema.String, Schema.Union<[typeof Schema.String, Schema.Record$<typeof Schema.String, Schema.SchemaClass<unknown, unknown, never>>]>>;
|
|
163
163
|
}>, Schema.Struct<{
|
|
164
164
|
resolved: Schema.Record$<typeof Schema.String, typeof Schema.String>;
|
|
165
165
|
}>]>>, {
|
|
@@ -469,7 +469,7 @@ export declare const CredentialProfileSchema: Schema.Struct<{
|
|
|
469
469
|
resolve: Schema.optional<Schema.Struct<{
|
|
470
470
|
op: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.String>>;
|
|
471
471
|
file: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.String>>;
|
|
472
|
-
value: Schema.optional<Schema.Record$<typeof Schema.String, Schema.Union<[typeof Schema.String, Schema.Record$<typeof Schema.String,
|
|
472
|
+
value: Schema.optional<Schema.Record$<typeof Schema.String, Schema.Union<[typeof Schema.String, Schema.Record$<typeof Schema.String, Schema.SchemaClass<unknown, unknown, never>>]>>>;
|
|
473
473
|
}>>;
|
|
474
474
|
}>;
|
|
475
475
|
|
|
@@ -493,7 +493,7 @@ export declare const CredentialsSchema: Schema.Struct<{
|
|
|
493
493
|
resolve: Schema.optional<Schema.Struct<{
|
|
494
494
|
op: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.String>>;
|
|
495
495
|
file: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.String>>;
|
|
496
|
-
value: Schema.optional<Schema.Record$<typeof Schema.String, Schema.Union<[typeof Schema.String, Schema.Record$<typeof Schema.String,
|
|
496
|
+
value: Schema.optional<Schema.Record$<typeof Schema.String, Schema.Union<[typeof Schema.String, Schema.Record$<typeof Schema.String, Schema.SchemaClass<unknown, unknown, never>>]>>>;
|
|
497
497
|
}>>;
|
|
498
498
|
}>>, {
|
|
499
499
|
default: () => {};
|
|
@@ -1370,7 +1370,7 @@ export declare type ResolveSection = typeof ResolveSectionSchema.Type;
|
|
|
1370
1370
|
export declare const ResolveSectionSchema: Schema.Struct<{
|
|
1371
1371
|
op: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.String>>;
|
|
1372
1372
|
file: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.String>>;
|
|
1373
|
-
value: Schema.optional<Schema.Record$<typeof Schema.String, Schema.Union<[typeof Schema.String, Schema.Record$<typeof Schema.String,
|
|
1373
|
+
value: Schema.optional<Schema.Record$<typeof Schema.String, Schema.Union<[typeof Schema.String, Schema.Record$<typeof Schema.String, Schema.SchemaClass<unknown, unknown, never>>]>>>;
|
|
1374
1374
|
}>;
|
|
1375
1375
|
|
|
1376
1376
|
export declare type Ruleset = typeof RulesetSchema.Type;
|
|
@@ -1597,7 +1597,7 @@ export declare type SecretGroup = typeof SecretGroupSchema.Type;
|
|
|
1597
1597
|
export declare const SecretGroupSchema: Schema.Union<[Schema.Struct<{
|
|
1598
1598
|
file: Schema.Record$<typeof Schema.String, typeof Schema.String>;
|
|
1599
1599
|
}>, Schema.Struct<{
|
|
1600
|
-
value: Schema.Record$<typeof Schema.String, Schema.Union<[typeof Schema.String, Schema.Record$<typeof Schema.String,
|
|
1600
|
+
value: Schema.Record$<typeof Schema.String, Schema.Union<[typeof Schema.String, Schema.Record$<typeof Schema.String, Schema.SchemaClass<unknown, unknown, never>>]>>;
|
|
1601
1601
|
}>, Schema.Struct<{
|
|
1602
1602
|
resolved: Schema.Record$<typeof Schema.String, typeof Schema.String>;
|
|
1603
1603
|
}>]>;
|
|
@@ -1666,7 +1666,7 @@ export declare type VariableGroup = typeof VariableGroupSchema.Type;
|
|
|
1666
1666
|
export declare const VariableGroupSchema: Schema.Union<[Schema.Struct<{
|
|
1667
1667
|
file: Schema.Record$<typeof Schema.String, typeof Schema.String>;
|
|
1668
1668
|
}>, Schema.Struct<{
|
|
1669
|
-
value: Schema.Record$<typeof Schema.String, Schema.Union<[typeof Schema.String, Schema.Record$<typeof Schema.String,
|
|
1669
|
+
value: Schema.Record$<typeof Schema.String, Schema.Union<[typeof Schema.String, Schema.Record$<typeof Schema.String, Schema.SchemaClass<unknown, unknown, never>>]>>;
|
|
1670
1670
|
}>, Schema.Struct<{
|
|
1671
1671
|
resolved: Schema.Record$<typeof Schema.String, typeof Schema.String>;
|
|
1672
1672
|
}>]>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reposets",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "CLI tool to sync GitHub repo settings, secrets and rulesets across personal repositories",
|
|
6
6
|
"keywords": [
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"effect": "^3.21.1",
|
|
55
55
|
"smol-toml": ">=1.6.1",
|
|
56
56
|
"tweetnacl": "^1.0.3",
|
|
57
|
-
"xdg-effect": "^0.
|
|
57
|
+
"xdg-effect": "^0.3.3"
|
|
58
58
|
},
|
|
59
59
|
"engines": {
|
|
60
60
|
"node": ">=20.0.0"
|