@celsoft/coordinator 0.0.0 → 0.1.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.
Files changed (131) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +107 -0
  3. package/THIRD_PARTY_NOTICES.md +2005 -0
  4. package/agents/console.md +20 -0
  5. package/agents/free.md +110 -0
  6. package/build/0-JP6XL6LB.js +17 -0
  7. package/build/1-A52YZWNS.js +17 -0
  8. package/build/2-CLH2NM6F.js +32 -0
  9. package/build/3-4N467IB6.js +45 -0
  10. package/build/4-WL5H4LUW.js +29 -0
  11. package/build/_layout.svelte-KPUSX7LQ.js +27 -0
  12. package/build/_page.svelte-22H56UR6.js +7972 -0
  13. package/build/_page.svelte-CVWUNRQC.js +135 -0
  14. package/build/_page.svelte-LTZXBHMT.js +57 -0
  15. package/build/_server.ts-3KVBYN6P.js +20 -0
  16. package/build/_server.ts-3POPKVEM.js +47 -0
  17. package/build/_server.ts-5735T2V5.js +31 -0
  18. package/build/_server.ts-5VXGNWV2.js +38 -0
  19. package/build/_server.ts-645KP7WP.js +42 -0
  20. package/build/_server.ts-A3AA24Z2.js +28 -0
  21. package/build/_server.ts-CITUOEM6.js +58 -0
  22. package/build/_server.ts-I7HMTPOA.js +25 -0
  23. package/build/_server.ts-M5BQ4LLX.js +30 -0
  24. package/build/_server.ts-OB4O27HF.js +683 -0
  25. package/build/_server.ts-OJT7HE7M.js +15 -0
  26. package/build/_server.ts-OYGWVLZM.js +12 -0
  27. package/build/_server.ts-T75UVMQP.js +38 -0
  28. package/build/_server.ts-WYZYNHUZ.js +28 -0
  29. package/build/_server.ts-Z26EB47B.js +486 -0
  30. package/build/chunk-4CIG53L5.js +33 -0
  31. package/build/chunk-BJTJS3XY.js +338 -0
  32. package/build/chunk-F2CNWJZM.js +14 -0
  33. package/build/chunk-HGYE3UTU.js +416 -0
  34. package/build/chunk-KAYW2W7H.js +1311 -0
  35. package/build/chunk-LFP3UPCM.js +10 -0
  36. package/build/chunk-M44JEFEH.js +62 -0
  37. package/build/chunk-MC5AGLMY.js +39 -0
  38. package/build/chunk-NCZ77J5E.js +19798 -0
  39. package/build/chunk-NVNLDPUJ.js +2122 -0
  40. package/build/chunk-PDCON4KS.js +494 -0
  41. package/build/chunk-Q4OQNY5M.js +25 -0
  42. package/build/chunk-QCUOR2U5.js +75 -0
  43. package/build/chunk-R6RYZZWA.js +46 -0
  44. package/build/chunk-SOJTASZC.js +51 -0
  45. package/build/chunk-SU26PJVX.js +410 -0
  46. package/build/chunk-U5BSBG4R.js +506 -0
  47. package/build/chunk-UEKOZGRO.js +37 -0
  48. package/build/chunk-W6EFUWJ2.js +9 -0
  49. package/build/chunk-WOPREK6Q.js +117 -0
  50. package/build/chunk-WWJ3F4QS.js +127 -0
  51. package/build/chunk-ZGZJEEE3.js +1091 -0
  52. package/build/client/_app/immutable/assets/0.BGa5ZNDM.css +1 -0
  53. package/build/client/_app/immutable/chunks/BUrrLYDt.js +2 -0
  54. package/build/client/_app/immutable/chunks/BgFr_EyZ.js +4 -0
  55. package/build/client/_app/immutable/chunks/Bjy-W4x2.js +82 -0
  56. package/build/client/_app/immutable/chunks/C8qZab0y.js +56 -0
  57. package/build/client/_app/immutable/chunks/C90fLsA5.js +4 -0
  58. package/build/client/_app/immutable/chunks/CRzLMJPS.js +1 -0
  59. package/build/client/_app/immutable/chunks/DLT1iIlz.js +2 -0
  60. package/build/client/_app/immutable/chunks/pIrVVOVY.js +2 -0
  61. package/build/client/_app/immutable/entry/app.0DERehLW.js +3 -0
  62. package/build/client/_app/immutable/entry/payload.DSmR2FwN.js +2 -0
  63. package/build/client/_app/immutable/entry/start.B7srFiqh.js +3 -0
  64. package/build/client/_app/immutable/nodes/0.aD9vJoxR.js +2 -0
  65. package/build/client/_app/immutable/nodes/1.Br4FL91i.js +2 -0
  66. package/build/client/_app/immutable/nodes/2.vl6OYfu3.js +8 -0
  67. package/build/client/_app/immutable/nodes/3.VYqJOLAF.js +2 -0
  68. package/build/client/_app/immutable/nodes/4.jF9UVlFN.js +2 -0
  69. package/build/client/_app/version.json +1 -0
  70. package/build/client/apple-touch-icon.png +0 -0
  71. package/build/client/favicon.ico +0 -0
  72. package/build/client/favicon.svg +48 -0
  73. package/build/client/icon-192.png +0 -0
  74. package/build/client/icon-512.png +0 -0
  75. package/build/client/icon-maskable-512.png +0 -0
  76. package/build/client/icon.svg +44 -0
  77. package/build/client/manifest.webmanifest +15 -0
  78. package/build/error.svelte-JXZDY65F.js +51 -0
  79. package/build/handler.js +716 -0
  80. package/build/hooks.server-34IMHRKC.js +43 -0
  81. package/build/instance-NP3FJIWW.js +2967 -0
  82. package/client/client.mjs +28 -0
  83. package/client/hooks.mjs +7 -0
  84. package/client/register.mjs +5 -0
  85. package/dist/cli.js +62826 -0
  86. package/dist/port.js +36691 -0
  87. package/package.json +20 -1
  88. package/skills/agents/.claude-plugin/plugin.json +5 -0
  89. package/skills/agents/hooks/hooks.json +1 -0
  90. package/skills/agents/hooks/register.ts +57 -0
  91. package/skills/agents/skills/bus-work/SKILL.md +66 -0
  92. package/skills/agents/skills/plan/SKILL.md +98 -0
  93. package/skills/console/.claude-plugin/plugin.json +5 -0
  94. package/skills/console/hooks/hooks.json +1 -0
  95. package/skills/console/hooks/register.ts +10 -0
  96. package/skills/console/skills/bus/SKILL.md +61 -0
  97. package/skills/default/.claude-plugin/plugin.json +5 -0
  98. package/skills/default/skills/git-workflow/SKILL.md +294 -0
  99. package/skills/default/skills/git-workflow/mise-tasks/_lib.sh +107 -0
  100. package/skills/default/skills/git-workflow/mise-tasks/clone +36 -0
  101. package/skills/default/skills/git-workflow/mise-tasks/repo-list +8 -0
  102. package/skills/default/skills/git-workflow/mise-tasks/unpushed +26 -0
  103. package/skills/default/skills/git-workflow/mise-tasks/worktree-add +60 -0
  104. package/skills/default/skills/github/SKILL.md +208 -0
  105. package/skills/default/skills/github/scripts/gh-org +196 -0
  106. package/skills/default/skills/plan-page/SKILL.md +300 -0
  107. package/skills/default/skills/plan-page/assets/index.html +854 -0
  108. package/skills/default/skills/plan-page/scripts/inline +46 -0
  109. package/skills/default/skills/plan-page/scripts/stage +26 -0
  110. package/skills/default/skills/secrets/SKILL.md +134 -0
  111. package/skills/default/skills/secrets/scripts/secrets-check +87 -0
  112. package/skills/default/skills/writing-style/SKILL.md +45 -0
  113. package/skills/extra/.claude-plugin/plugin.json +5 -0
  114. package/skills/extra/skills/artifacts/SKILL.md +52 -0
  115. package/skills/extra/skills/github-actions/SKILL.md +78 -0
  116. package/skills/extra/skills/github-actions/scan +32 -0
  117. package/skills/extra/skills/markdown-review/SKILL.md +70 -0
  118. package/skills/extra/skills/markdown-review/assets/index.html +201 -0
  119. package/skills/extra/skills/markdown-review/scripts/stage +36 -0
  120. package/skills/extra/skills/mise-usage/SKILL.md +155 -0
  121. package/skills/extra/skills/plugin-authoring/SKILL.md +317 -0
  122. package/skills/extra/skills/project-conventions/SKILL.md +64 -0
  123. package/skills/extra/skills/questions/SKILL.md +156 -0
  124. package/skills/extra/skills/questions/assets/index.html +376 -0
  125. package/skills/extra/skills/questions/scripts/stage +26 -0
  126. package/skills/extra/skills/serve/SKILL.md +165 -0
  127. package/skills/extra/skills/serve/scripts/serve +268 -0
  128. package/skills/extra/skills/serve/scripts/server.py +345 -0
  129. package/skills/extra/skills/skill-dependencies/SKILL.md +65 -0
  130. package/skills/extra/skills/skill-maintenance/SKILL.md +101 -0
  131. package/skills/extra/skills/ticketing/SKILL.md +125 -0
@@ -0,0 +1,416 @@
1
+ import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
2
+ import {
3
+ external_exports,
4
+ isRepo,
5
+ splitAt
6
+ } from "./chunk-NCZ77J5E.js";
7
+
8
+ // build/server/chunks/track.js
9
+ var AnchoredPath = external_exports.string().regex(/^(\$COORDINATOR_ROOT|\$DEVELOPMENT|~)(\/.*)?$/, `A path under $COORDINATOR_ROOT, $DEVELOPMENT, or ~, never an absolute one.`);
10
+ var ChecklistSelection = external_exports.union([
11
+ external_exports.literal("all"),
12
+ external_exports.literal("none"),
13
+ external_exports.array(external_exports.string())
14
+ ]);
15
+ function isSelected(selection, item) {
16
+ if (selection === "all") return !item.disabled;
17
+ if (selection === "none") return false;
18
+ return selection.includes(item.id);
19
+ }
20
+ var PartName = external_exports.string().regex(/^[a-z0-9]+(-[a-z0-9]+)*$/, "Name it in lowercase words joined by hyphens.").max(40, "Keep it to 40 characters.");
21
+ var ProfileName = PartName;
22
+ var EVENTS = {
23
+ agent_started: {
24
+ label: "Agent started",
25
+ when: "An agent starts or resumes in the repo.",
26
+ how: "Its handlers are added to the agent's start prompt, after who and where it is.",
27
+ source: "The launch, building the start prompt."
28
+ },
29
+ plan_approved: {
30
+ label: "Plan approved",
31
+ when: "The agent records that the user approved its plan, before it builds.",
32
+ how: "Its handlers reach the agent in a bus Message, which wakes it.",
33
+ source: "issue_plan with approved: true, from the issue's holder."
34
+ },
35
+ land_refused: {
36
+ label: "Land refused",
37
+ when: "The bus refuses the agent's land, or the landing fails.",
38
+ how: "Its handlers reach the agent in a bus Message, which wakes it.",
39
+ source: "A Landing ending refused or failed."
40
+ },
41
+ pr_feedback: {
42
+ label: "PR feedback",
43
+ when: "The agent's PR gets a review, a comment, a failed check, or a conflict.",
44
+ how: "Its handlers reach the agent in a bus Message, which wakes it.",
45
+ source: "The PR watcher, telling the slot what changed."
46
+ },
47
+ lead_given: {
48
+ label: "Lead given",
49
+ when: "The user gives the agent's slot a lead.",
50
+ how: "Its handlers follow the handover, in a bus Message to the agent.",
51
+ source: "The lead Message Type, or a follower brought up under a lead."
52
+ },
53
+ lead_cleared: {
54
+ label: "Lead cleared",
55
+ when: "The user clears the agent's lead.",
56
+ how: "Its handlers follow the release, in a bus Message to the agent.",
57
+ source: "The lead Message Type with no lead."
58
+ },
59
+ follower_added: {
60
+ label: "Follower added",
61
+ when: "The agent's slot becomes the lead of another.",
62
+ how: "Its handlers follow the briefing, in a bus Message to the agent.",
63
+ source: "The lead Message Type, or a follower brought up under it."
64
+ },
65
+ follower_removed: {
66
+ label: "Follower removed",
67
+ when: "The user clears the lead of one of the agent's followers.",
68
+ how: "Its handlers follow the notice, in a bus Message to the agent.",
69
+ source: "The lead Message Type with no lead."
70
+ },
71
+ turn_ended: {
72
+ label: "Turn ended",
73
+ when: "The agent finishes a turn and comes to rest; each handler of it, a Reminder, is given every so many turns, as it says.",
74
+ how: "Its handlers come in a quiet bus Message that never wakes the agent; it hears of it on its next turn, and no other is given while one waits.",
75
+ source: "The tracker, seeing the agent come to rest in Herdr."
76
+ },
77
+ landed: {
78
+ label: "Landed",
79
+ when: "The agent's work reaches the default branch, before the agent ends.",
80
+ how: "Its handlers reach the agent in a bus Message, which wakes it.",
81
+ source: "The bus recording the landing, from land or landed."
82
+ }
83
+ };
84
+ var Event = external_exports.enum(Object.keys(EVENTS));
85
+ var COMMON_VARIABLES = {
86
+ repo: "The agent's repo, as org/repo.",
87
+ track: "The agent's track.",
88
+ slot: "The agent's slot, as org/repo@track.",
89
+ worktree: "The folder the agent works in.",
90
+ user: "Your name."
91
+ };
92
+ var EVENT_VARIABLES = {
93
+ plan_approved: { issue: "The issue whose plan was approved." },
94
+ land_refused: { issue: "The issue the landing was for." },
95
+ pr_feedback: { issue: "The issue the PR is for." },
96
+ landed: { issue: "The issue the work landed for." },
97
+ lead_given: { lead: "The agent's new lead, a slot." },
98
+ lead_cleared: { lead: "The slot that led the agent." },
99
+ follower_added: { follower: "The agent's new follower, a slot." },
100
+ follower_removed: { follower: "The slot that followed the agent." },
101
+ turn_ended: { turns: "How many turns the agent has finished." }
102
+ };
103
+ var variablesOf = (event) => ({
104
+ ...COMMON_VARIABLES,
105
+ ...EVENT_VARIABLES[event]
106
+ });
107
+ var PART_KINDS = {
108
+ profile: {
109
+ label: "Profile",
110
+ plural: "Profiles"
111
+ },
112
+ skill_group: {
113
+ label: "Skills",
114
+ plural: "Skills"
115
+ },
116
+ handler: {
117
+ label: "Event handler",
118
+ plural: "Event handlers"
119
+ },
120
+ event: {
121
+ label: "Event",
122
+ plural: "Events"
123
+ },
124
+ skill: {
125
+ label: "Skill",
126
+ plural: "Skills"
127
+ },
128
+ action: {
129
+ label: "Action",
130
+ plural: "Actions"
131
+ },
132
+ attachment: {
133
+ label: "Attached folder",
134
+ plural: "Attached folders"
135
+ }
136
+ };
137
+ var EditableKind = external_exports.enum(["profile", "attachment"]);
138
+ var Description = external_exports.string().max(300, "Keep it to 300 characters.");
139
+ var GROUP_FIELDS = {
140
+ description: Description,
141
+ skills: external_exports.array(external_exports.string())
142
+ };
143
+ var Every = external_exports.number({ error: "Say how many turns." }).int("Say a whole number of turns.").min(1, "At least every turn.").max(100, "At most every 100 turns.");
144
+ var everyText = (event, every) => event !== "turn_ended" ? null : (every ?? 10) === 1 ? "Every turn" : `Every ${every ?? 10} turns`;
145
+ var Selection = ChecklistSelection;
146
+ var OnFor = external_exports.string().regex(/^(\*|[A-Za-z0-9_.-]+\/(\*|[A-Za-z0-9_.-]+))$/, "Name a Repo as org/repo, an org as org/*, or every Repo as *.");
147
+ var onFor = (on, repo) => on.some((r) => r === "*" || r === repo || r === repo.split("/")[0] + "/*");
148
+ var ACTION_VIEWS = {
149
+ repo: {
150
+ label: "The repo view",
151
+ variables: ["repo", "user"]
152
+ },
153
+ slot: {
154
+ label: "The slot view",
155
+ variables: [
156
+ "repo",
157
+ "slot",
158
+ "track",
159
+ "user"
160
+ ]
161
+ },
162
+ issue: {
163
+ label: "The issue view",
164
+ variables: [
165
+ "repo",
166
+ "issue",
167
+ "user"
168
+ ]
169
+ }
170
+ };
171
+ external_exports.object({
172
+ name: PartName,
173
+ description: Description.default(""),
174
+ skills: GROUP_FIELDS.skills.default([])
175
+ });
176
+ external_exports.enum([
177
+ "default",
178
+ "extra",
179
+ "attached",
180
+ "npx",
181
+ "plugin"
182
+ ]);
183
+ external_exports.object({ attachments: external_exports.record(external_exports.string(), external_exports.lazy(() => AttachmentSchema)).default({}) });
184
+ var WRITING_RULE = "A task is the agent's first prompt, read beside its brief: the goal, numbered steps with the commands that matter, then what done looks like; a page at most, with know-how used again in a skill the profile chooses. A handler is said at every firing of its event, and a reminder every few turns, so keep each to a few lines. No length is enforced; long text dilutes what matters.";
185
+ var ProfileHandlerSchema = external_exports.object({
186
+ name: PartName,
187
+ event: Event,
188
+ text: external_exports.string(),
189
+ every: Every.optional()
190
+ });
191
+ var ProfileActionSchema = external_exports.object({
192
+ name: PartName,
193
+ description: Description.default(""),
194
+ label: external_exports.string().trim().min(1, "Name the button.").max(24, "Keep it to 24 characters."),
195
+ view: external_exports.enum([
196
+ "repo",
197
+ "slot",
198
+ "issue"
199
+ ]),
200
+ task: external_exports.string().trim().min(1, "Say what the agent is to do.")
201
+ });
202
+ external_exports.object({
203
+ name: PartName,
204
+ description: Description.default(""),
205
+ skills: external_exports.record(PartName, Selection).default({}),
206
+ on_for: external_exports.array(OnFor).default([]),
207
+ handlers: external_exports.array(ProfileHandlerSchema).default([]),
208
+ actions: external_exports.array(ProfileActionSchema).default([])
209
+ });
210
+ var ATTACHMENT_FIELDS = {
211
+ description: Description,
212
+ path: external_exports.string().trim().min(1, "Name the folder.")
213
+ };
214
+ var AttachmentSchema = external_exports.object({
215
+ name: PartName,
216
+ description: Description.default(""),
217
+ path: AnchoredPath
218
+ });
219
+ external_exports.strictObject({
220
+ description: Description,
221
+ skills: external_exports.record(PartName, Selection),
222
+ on_for: external_exports.array(OnFor),
223
+ handlers: external_exports.array(ProfileHandlerSchema),
224
+ actions: external_exports.array(ProfileActionSchema)
225
+ }).partial(), external_exports.strictObject(ATTACHMENT_FIELDS).partial();
226
+ function actionsFor(profiles, repo, view) {
227
+ return profiles.filter((p) => !p.base && (p.defaults ? !p.off_for?.includes(repo) : onFor(p.on_for, repo))).flatMap((p) => p.actions.filter((a) => !view || a.view === view).map((a) => ({
228
+ ...a,
229
+ profile: p.name
230
+ })));
231
+ }
232
+ function profilesFor(profiles, repo, settings) {
233
+ const rank = (p) => settings.order.includes(p.name) ? settings.order.indexOf(p.name) : settings.order.length;
234
+ const on = profiles.filter((p) => !p.base && !p.defaults && onFor(p.on_for, repo)).sort((a, b) => rank(a) - rank(b) || a.name.localeCompare(b.name));
235
+ return [
236
+ ...profiles.filter((p) => p.base),
237
+ ...settings.defaults === "off" ? [] : profiles.filter((p) => p.defaults),
238
+ ...on
239
+ ];
240
+ }
241
+ var profileHash = (name) => "#pf=" + encodeURIComponent(name);
242
+ var tabOf = (kind) => kind === "handler" ? "event" : kind === "attachment" ? "skill_group" : kind;
243
+ var partHash = (kind, name) => `#sk=${kind}:${encodeURIComponent(name)}`;
244
+ var LandingMethod = external_exports.enum(["push", "pr"]);
245
+ var LandScript = external_exports.string().trim().max(300).transform((v) => v || null).nullable().refine((v) => v === null || /^[\w.@+-]+(\/[\w.@+-]+)*\.mjs$/.test(v) && !v.split("/").includes(".."), "Name a .mjs file in the repo, by its path from the repo's root, such as scripts/before-landing.mjs.");
246
+ var DURING_EVERY = {
247
+ "1": "Every minute",
248
+ "2": "Every 2 minutes",
249
+ "5": "Every 5 minutes",
250
+ "15": "Every 15 minutes"
251
+ };
252
+ var REPO_CATEGORIES = {
253
+ work: {
254
+ title: "Work",
255
+ description: "How its agents' work reaches the default branch through the bus. Each change is saved on the repo and applies at once.",
256
+ icon: "box"
257
+ },
258
+ commands: {
259
+ title: "Landing scripts",
260
+ description: "Scripts in this repo, each a .mjs file, the server runs with its own Node around each landing. Each is read from the repo's checkout, so only landed code runs. Each change is saved on the repo and applies to the next land.",
261
+ icon: "terminal"
262
+ },
263
+ agents: {
264
+ title: "Agents",
265
+ description: "How its Agents run: the Profiles they get after base, naming the skills they load and the Event Handlers they are told. Each change applies from the next Agent's start.",
266
+ icon: "users"
267
+ }
268
+ };
269
+ var REPO_SETTINGS = {
270
+ order: {
271
+ label: "Profile order",
272
+ description: "The order its agents get the Profiles on for it, after base: the skills of each are added, and their Event Handlers told in turn. A Profile on for it but not named here comes last.",
273
+ category: "agents",
274
+ default: [],
275
+ schema: external_exports.array(ProfileName)
276
+ },
277
+ defaults: {
278
+ label: "defaults",
279
+ description: "Whether its agents get the built-in defaults Profile, the Default Skills. On unless you turn it off.",
280
+ category: "agents",
281
+ options: {
282
+ on: "On",
283
+ off: "Off"
284
+ },
285
+ default: "on",
286
+ schema: external_exports.enum(["on", "off"])
287
+ },
288
+ landing: {
289
+ label: "Landing Method",
290
+ description: "Push: agents' work moves the default branch and is pushed. Pull request: it is pushed as the slot's branch and opened as a PR. Until one is chosen, land is refused.",
291
+ category: "work",
292
+ options: {
293
+ push: "Push to the default branch",
294
+ pr: "Pull request"
295
+ },
296
+ default: null,
297
+ schema: LandingMethod.nullable()
298
+ },
299
+ pre_land: {
300
+ label: "Before landing",
301
+ description: "Runs on the slot's worktree once land's checks pass, before anything is pushed, as the default branch has the script, never the slot's branch. If it fails, nothing lands and the agent is told why, with the end of its output.",
302
+ category: "commands",
303
+ default: null,
304
+ placeholder: "scripts/before-landing.mjs",
305
+ schema: LandScript
306
+ },
307
+ during_land: {
308
+ label: "During landing",
309
+ description: "Runs in the repo's checkout while a landing's PR is open, on the schedule below, until it merges or closes. The bus expects nothing of it: it never waits on it or reads its result.",
310
+ category: "commands",
311
+ default: null,
312
+ placeholder: "scripts/during-landing.mjs",
313
+ schema: LandScript
314
+ },
315
+ during_every: {
316
+ label: "During landing runs",
317
+ description: "How often During landing runs. A run never starts while the last one is still going.",
318
+ category: "commands",
319
+ options: DURING_EVERY,
320
+ default: "2",
321
+ schema: external_exports.enum(Object.keys(DURING_EVERY))
322
+ },
323
+ post_land: {
324
+ label: "After landing",
325
+ description: "Runs in the repo's checkout once the work is on the default branch: after the push, or when its PR merges. If it fails, the work stays landed and you and the agent are told why.",
326
+ category: "commands",
327
+ default: null,
328
+ placeholder: "scripts/after-landing.mjs",
329
+ schema: LandScript
330
+ }
331
+ };
332
+ var RepoSettingsSchema = external_exports.object(Object.fromEntries(Object.entries(REPO_SETTINGS).map(([name, f]) => [name, f.schema.default(f.default)])));
333
+ var RepoSettingsChange = external_exports.strictObject(Object.fromEntries(Object.entries(REPO_SETTINGS).map(([name, f]) => [name, f.schema.describe(f.description).optional()]))).refine((c) => Object.keys(c).length > 0, "Name at least one setting.");
334
+ var NONE_LABEL = "Not chosen";
335
+ var repoSettingsSchema = (listed = {}) => external_exports.object(Object.fromEntries(Object.entries(REPO_CATEGORIES).map(([id, c]) => [id, external_exports.object(Object.fromEntries(Object.entries(REPO_SETTINGS).filter(([, f]) => f.category === id).map(([name, f]) => {
336
+ if (Array.isArray(f.default)) return [name, external_exports.array(external_exports.string()).default(f.default).meta({
337
+ title: f.label,
338
+ description: f.description
339
+ })];
340
+ if (!f.options) return [name, external_exports.string().default(f.default ?? "").meta({
341
+ title: f.label,
342
+ description: f.description,
343
+ mono: true,
344
+ placeholder: f.placeholder
345
+ })];
346
+ const options = {
347
+ ...f.options,
348
+ ...listed[name]
349
+ };
350
+ const values = [...f.default === null ? [""] : [], ...Object.keys(options)];
351
+ return [name, external_exports.enum(values).default(f.default ?? "").meta({
352
+ title: f.label,
353
+ description: f.description,
354
+ labels: {
355
+ [""]: NONE_LABEL,
356
+ ...options
357
+ }
358
+ })];
359
+ }))).meta(c)])));
360
+ function shownSettings(settings) {
361
+ const out = {};
362
+ for (const [name, f] of Object.entries(REPO_SETTINGS)) (out[f.category] ??= {})[name] = settings[name] ?? "";
363
+ return out;
364
+ }
365
+ var storedValue = (v) => v === "" ? null : v;
366
+ function settingLabel(name, value) {
367
+ return value == null ? NONE_LABEL : REPO_SETTINGS[name].options?.[String(value)] ?? String(value);
368
+ }
369
+ var TRACK_RULE = `A track is a git branch name of at most 100 characters, such as fix-login or web/login: no spaces or ~^:?*[\\, no .. or //, and no part starting with a dot or ending in .lock.`;
370
+ var BRANCH_RULE = "Not a git branch name.";
371
+ var BAD = /[\x00-\x20\x7f~^:?*[\\]|\.\.|\/\/|@\{|^[-/]|\/$|\.$|(^|\/)\.|\.lock(\/|$)/;
372
+ function isBranch(value) {
373
+ return !!value && value !== "@" && value !== "HEAD" && !BAD.test(value);
374
+ }
375
+ var Branch = external_exports.string().refine(isBranch, BRANCH_RULE);
376
+ var Track = external_exports.string().max(100, TRACK_RULE).refine(isBranch, TRACK_RULE);
377
+ function isSlot(value) {
378
+ const [repo, track] = splitAt(value, "@");
379
+ return isRepo(repo) && Track.safeParse(track).success;
380
+ }
381
+ var Slot = external_exports.string().refine(isSlot, { error: (i) => `'${String(i.input)}' is not a slot, org/repo@track` });
382
+ function caseClash(track, known) {
383
+ const lower = track.toLowerCase();
384
+ for (const k of known) if (k !== track && k.toLowerCase() === lower) return k;
385
+ return null;
386
+ }
387
+
388
+ export {
389
+ isSelected,
390
+ PartName,
391
+ EVENTS,
392
+ variablesOf,
393
+ PART_KINDS,
394
+ EditableKind,
395
+ everyText,
396
+ onFor,
397
+ ACTION_VIEWS,
398
+ WRITING_RULE,
399
+ actionsFor,
400
+ profilesFor,
401
+ profileHash,
402
+ tabOf,
403
+ partHash,
404
+ LandingMethod,
405
+ RepoSettingsSchema,
406
+ RepoSettingsChange,
407
+ repoSettingsSchema,
408
+ shownSettings,
409
+ storedValue,
410
+ settingLabel,
411
+ Branch,
412
+ Track,
413
+ isSlot,
414
+ Slot,
415
+ caseClash
416
+ };