ryco-cli 0.1.5 → 0.1.7
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 +50 -2
- package/dist/{AzureDevOpsSourceControlProvider-CdgNqZ5j.cjs → AzureDevOpsSourceControlProvider-5exivY-1.cjs} +2 -2
- package/dist/{AzureDevOpsSourceControlProvider-OsyDSESj.mjs → AzureDevOpsSourceControlProvider-CF5LuCHp.mjs} +3 -3
- package/dist/{BitbucketSourceControlProvider-DBTH98i4.cjs → BitbucketSourceControlProvider-1GWENqcl.cjs} +2 -2
- package/dist/{BitbucketSourceControlProvider-SQ3gKdFs.mjs → BitbucketSourceControlProvider-CKH09tfT.mjs} +3 -3
- package/dist/{BunPTY-B_vjRZN4.mjs → BunPTY-BWhtEA50.mjs} +1 -1
- package/dist/{ClaudeDriver-D9yC2F0b.cjs → ClaudeDriver-BXLdjrht.cjs} +187 -8
- package/dist/{ClaudeDriver-2dTtrsFD.mjs → ClaudeDriver-WwWFTu61.mjs} +188 -9
- package/dist/{CodexDriver-CIDYevQX.mjs → CodexDriver-93-TmCrO.mjs} +16 -8
- package/dist/{CodexDriver-BC2B-qpT.cjs → CodexDriver-BboMT9uk.cjs} +15 -7
- package/dist/{CodexTextGeneration-DNeO-8GE.cjs → CodexTextGeneration-0pRbJji3.cjs} +3 -3
- package/dist/{CodexTextGeneration-CjknB1Xl.mjs → CodexTextGeneration-BU9Myn87.mjs} +4 -4
- package/dist/{CopilotDriver-NPhlLrk2.mjs → CopilotDriver-BASi8pJ0.mjs} +15 -8
- package/dist/{CopilotDriver-BGChrP5c.cjs → CopilotDriver-DCsv-17W.cjs} +14 -7
- package/dist/{CursorDriver-CYxn4_c1.cjs → CursorDriver-BTSiM3A8.cjs} +163 -16
- package/dist/{CursorDriver-BcAVbT8D.mjs → CursorDriver-D5LvIqUk.mjs} +164 -17
- package/dist/{ForgejoSourceControlProvider-D3wP2Cav.cjs → ForgejoSourceControlProvider-BTXRDCGB.cjs} +2 -2
- package/dist/{ForgejoSourceControlProvider-BjCE3730.mjs → ForgejoSourceControlProvider-e-4hvvZ_.mjs} +3 -3
- package/dist/{GitHubSourceControlProvider-DByZ_cnw.mjs → GitHubSourceControlProvider-26IofDAO.mjs} +3 -3
- package/dist/{GitHubSourceControlProvider-DU_7IvMa.cjs → GitHubSourceControlProvider-DWmwkA_y.cjs} +2 -2
- package/dist/{GitLabSourceControlProvider-BVJ5IqTS.cjs → GitLabSourceControlProvider-D-YHnxRe.cjs} +2 -2
- package/dist/{GitLabSourceControlProvider-BdMCIjXb.mjs → GitLabSourceControlProvider-DePct78W.mjs} +3 -3
- package/dist/{Metrics-BCOc3Ml2.mjs → Metrics-6Xj17Se3.mjs} +94 -2
- package/dist/{Metrics-DNOriWhP.cjs → Metrics-CIW1QH7M.cjs} +128 -0
- package/dist/{NodePTY-_u3kQLvd.mjs → NodePTY-C_cR3Ayy.mjs} +1 -1
- package/dist/{OpenCodeDriver-fwqXoVyH.mjs → OpenCodeDriver-BhvLOmvn.mjs} +336 -43
- package/dist/{OpenCodeDriver-DyR83FcY.cjs → OpenCodeDriver-CVeZ4n9-.cjs} +335 -42
- package/dist/{SourceControlProviderDiscoveryCatalog-DqQVhwYM.cjs → SourceControlProviderDiscoveryCatalog-DeFR5xH3.cjs} +98 -161
- package/dist/{SourceControlProviderDiscoveryCatalog-CQiMyDCC.mjs → SourceControlProviderDiscoveryCatalog-mJV_Xitr.mjs} +100 -145
- package/dist/bin.cjs +30639 -28744
- package/dist/bin.mjs +30602 -28709
- package/dist/client/assets/{AnimatedHeight-CYuVQOpY.js → AnimatedHeight-BSU0lzYs.js} +1 -1
- package/dist/client/assets/AppearanceSettings-D7q0ujGK.js +1 -0
- package/dist/client/assets/BranchToolbar.logic-CZIFSvhd.js +1 -0
- package/dist/client/assets/ChatRightPanel-CWHOIuiQ.js +188 -0
- package/dist/client/assets/ChatThreadRouteView-bA7xWXzc.js +1 -0
- package/dist/client/assets/CommandPaletteDialog-DNYaVOZO.js +1 -0
- package/dist/client/assets/CompositeRoot-B_KEfCUE.js +1 -0
- package/dist/client/assets/ConnectionsSettings-CLZPbx_K.js +1 -0
- package/dist/client/assets/DiagnosticsSettings-DtzPCb6N.js +1 -0
- package/dist/client/assets/DialogHandle-DuHnmWoE.js +1 -0
- package/dist/client/assets/{DialogRoot-DaMwpoP_.js → DialogRoot-BV25qAcA.js} +1 -1
- package/dist/client/assets/DialogTitle-DQsi-RTa.js +1 -0
- package/dist/client/assets/DialogTrigger-D0fA01C6.js +1 -0
- package/dist/client/assets/DialogViewport-CMV_BePU.js +1 -0
- package/dist/client/assets/DraftChatThreadRouteView-BoiKnrii.js +1 -0
- package/dist/client/assets/JetBrainsIcons-BcPxJlMf.js +1 -0
- package/dist/client/assets/KeybindingsSettings-LuI98pdF.js +7 -0
- package/dist/client/assets/McpServersSettings-BFMuWYVV.js +6 -0
- package/dist/client/assets/NoActiveThreadState-C2q_O1kP.js +1 -0
- package/dist/client/assets/OpinionatedPluginsSettings-Bqwct37O.js +1 -0
- package/dist/client/assets/ProjectFavicon-D2imiJ8M.js +1 -0
- package/dist/client/assets/{ProviderUpdateLaunchNotification.logic-BFzNCo3I.js → ProviderUpdateLaunchNotification.logic-CJgA--nK.js} +1 -1
- package/dist/client/assets/ProvidersSettingsPanel-B97vbeu6.js +1 -0
- package/dist/client/assets/{RedactedSensitiveText-UnZZJnFF.js → RedactedSensitiveText-B2GFTyfq.js} +1 -1
- package/dist/client/assets/RootAppShell-C1xTR98P.js +12 -0
- package/dist/client/assets/SettingsDialog-Q0Q8O5oH.js +2 -0
- package/dist/client/assets/SourceControlSettings-KAvoPTNi.js +1 -0
- package/dist/client/assets/StatisticsPanel-BzsQ444K.js +64 -0
- package/dist/client/assets/ThreadStatusIndicators-Cw_jLVQf.js +1 -0
- package/dist/client/assets/{ThreadTerminalDrawer-BXoXAbsR.js → ThreadTerminalDrawer-D1WnSemH.js} +17 -17
- package/dist/client/assets/ThreadWorkspacePanel-L4qCPTOA.js +166 -0
- package/dist/client/assets/{alert-dialog-BJQbh5gX.js → alert-dialog-CNmKa0BK.js} +1 -1
- package/dist/client/assets/chart-column-BWSKYZ_a.js +1 -0
- package/dist/client/assets/{chatThreadActions--n7v5mnB.js → chatThreadActions-TtDsiwDC.js} +1 -1
- package/dist/client/assets/chevron-up-zopJ_99l.js +1 -0
- package/dist/client/assets/{clamp-NYtK3f5s.js → clamp-Ds6WJu8j.js} +1 -1
- package/dist/client/assets/clipboard-copy-BoJGpdmJ.js +1 -0
- package/dist/client/assets/clock-CzUHThzk.js +1 -0
- package/dist/client/assets/commandPaletteStore-KebG835b.js +1 -0
- package/dist/client/assets/composerDraftStore-DpPEQ6BN.js +21 -0
- package/dist/client/assets/desktopUpdateAtoms-BQ0GGEfM.js +2 -0
- package/dist/client/assets/{download-Bi4-cFbc.js → download-CUiRE0N9.js} +1 -1
- package/dist/client/assets/{draft-input-BGSRgOW7.js → draft-input-CwpGDtoT.js} +1 -1
- package/dist/client/assets/editorPreferences-jN7DKbyt.js +1 -0
- package/dist/client/assets/empty-CBuXePtg.js +1 -0
- package/dist/client/assets/{group-Dwm-OV-r.js → group-BpZvxjG5.js} +1 -1
- package/dist/client/assets/{index-BI5yFj9n.js → index-BKzXTNJ_.js} +2 -2
- package/dist/client/assets/{input-BfUa3JUD.js → input-CgDawd6k.js} +1 -1
- package/dist/client/assets/kbd-QYSL97CK.js +1 -0
- package/dist/client/assets/{keybindings--G1bkIjA.js → keybindings-CUTRYI_A.js} +1 -1
- package/dist/client/assets/{keyboard-B87VTfPa.js → keyboard-DFFiI7JY.js} +1 -1
- package/dist/client/assets/keyedQuery-DiOCbGH0.js +0 -0
- package/dist/client/assets/main-BgFGju3e.js +9 -0
- package/dist/client/assets/main-D0UFdwts.css +2 -0
- package/dist/client/assets/palette-BXCL909c.js +1 -0
- package/dist/client/assets/play-DI2LZohg.js +1 -0
- package/dist/client/assets/plus-DzgIfHUF.js +1 -0
- package/dist/client/assets/projectAtoms-DXXpuERK.js +1 -0
- package/dist/client/assets/providerDriverMeta-CRNNp0q3.js +1 -0
- package/dist/client/assets/providerIconUtils-D-DFhem2.js +47 -0
- package/dist/client/assets/radio-group-_PPYg3YY.js +1 -0
- package/dist/client/assets/{refresh-cw-CRxaXR0E.js → refresh-cw-BsQTNBXl.js} +1 -1
- package/dist/client/assets/{resolveAriaLabelledBy-D4fWpj84.js → resolveAriaLabelledBy-CRHo_s16.js} +1 -1
- package/dist/client/assets/rightPanelRouteSearch-CfmZ7osj.js +1 -0
- package/dist/client/assets/scale-DDEJ-tvn.js +1 -0
- package/dist/client/assets/scroll-area-HgsI-ErG.js +1 -0
- package/dist/client/assets/separator-ClnL4mUB.js +1 -0
- package/dist/client/assets/{server-tdx7WxLI.js → server-Bbs3L-6_.js} +1 -1
- package/dist/client/assets/session-logic-CKQkgIwo.js +4 -0
- package/dist/client/assets/settingsDialogStore-SG-W1q0A.js +1 -0
- package/dist/client/assets/settingsLayout-G5xVm-ZT.js +1 -0
- package/dist/client/assets/shallow-Dmd-gez1.js +1 -0
- package/dist/client/assets/sidebar-_u7SGgmC.js +1 -0
- package/dist/client/assets/sidebarStatusText-BTYnwflG.js +1 -0
- package/dist/client/assets/skeleton-CmUvhZGP.js +1 -0
- package/dist/client/assets/storeSelectors-DhJRpdiw.js +1 -0
- package/dist/client/assets/threadSelectionStore-ygmA4DNA.js +1 -0
- package/dist/client/assets/toast-DmA_ziPT.js +1 -0
- package/dist/client/assets/toggle-DGS7tKuj.js +1 -0
- package/dist/client/assets/{toggle-group-DdKXHoT3.js → toggle-group-Dtv1ZUFW.js} +1 -1
- package/dist/client/assets/tokenModePresentation-Dor1DnBx.js +1 -0
- package/dist/client/assets/{trash-2-CZQem-sz.js → trash-2-C2G3VGoV.js} +1 -1
- package/dist/client/assets/triangle-alert-Bpz3xGu5.js +1 -0
- package/dist/client/assets/undo-2-C3rtxuqZ.js +1 -0
- package/dist/client/assets/useHandleNewThread-ypSbzG0P.js +1 -0
- package/dist/client/assets/useLabelableId-Bc7KEnHU.js +1 -0
- package/dist/client/assets/useNavigate-_4hWGSey.js +1 -0
- package/dist/client/assets/useTheme-HcKmBfpF.js +1 -0
- package/dist/client/assets/{vscode-icons-E8NUFd62.js → vscode-icons-DdSTtxYd.js} +1 -1
- package/dist/client/assets/{wrench-DEteICtk.js → wrench-C4jdis40.js} +1 -1
- package/dist/client/assets/x-CG2WU63t.js +1 -0
- package/dist/client/index.html +1 -1
- package/dist/{collectUint8StreamText-DuFJyaQh.mjs → collectUint8StreamText-Lv4GGI79.mjs} +488 -16
- package/dist/{collectUint8StreamText-DbCOJom3.cjs → collectUint8StreamText-uNXVRHOf.cjs} +510 -14
- package/dist/{makeManagedServerProvider-C3cQUDkZ.cjs → makeManagedServerProvider-3SD-Q5xh.cjs} +1 -1
- package/dist/{makeManagedServerProvider-wFGZ2-vd.mjs → makeManagedServerProvider-CkPEptun.mjs} +2 -2
- package/package.json +1 -1
- package/dist/client/assets/AppearanceSettings-BBbC8CV5.js +0 -1
- package/dist/client/assets/BranchToolbar.logic-Di2EkKiO.js +0 -1
- package/dist/client/assets/ChatRightPanel-BJ_cVP66.js +0 -188
- package/dist/client/assets/ChatThreadRouteView-DmxD3m2U.js +0 -1
- package/dist/client/assets/CommandPaletteDialog-CAzz6bsT.js +0 -1
- package/dist/client/assets/CompositeRoot-BvXCwn2c.js +0 -1
- package/dist/client/assets/ConnectionsSettings-Cmxm0y2u.js +0 -1
- package/dist/client/assets/DialogHandle-CXNAm3QY.js +0 -1
- package/dist/client/assets/DialogTitle-KXmfgzP3.js +0 -1
- package/dist/client/assets/DialogTrigger-NHyQnW3X.js +0 -1
- package/dist/client/assets/DialogViewport-CL0WR9a5.js +0 -1
- package/dist/client/assets/DraftChatThreadRouteView-C_hqauF6.js +0 -1
- package/dist/client/assets/JetBrainsIcons-BcR8pCma.js +0 -1
- package/dist/client/assets/KeybindingsSettings-m2AteGOl.js +0 -7
- package/dist/client/assets/McpServersSettings-DndIDxgA.js +0 -6
- package/dist/client/assets/NoActiveThreadState-Bt-Wkv-C.js +0 -1
- package/dist/client/assets/OpinionatedPluginsSettings-oDtdE6qx.js +0 -1
- package/dist/client/assets/ProjectFavicon-j9IX_7-B.js +0 -1
- package/dist/client/assets/ProvidersSettingsPanel-CvlIBNVJ.js +0 -1
- package/dist/client/assets/QueryClientProvider-BZxRKpeb.js +0 -1
- package/dist/client/assets/RootAppShell-CyHZ_F5P.js +0 -12
- package/dist/client/assets/SettingsDialog-BYJ8AhQp.js +0 -2
- package/dist/client/assets/SourceControlSettings-7xU6VH6N.js +0 -1
- package/dist/client/assets/ThreadStatusIndicators-M9FWDEex.js +0 -1
- package/dist/client/assets/ThreadWorkspacePanel-D1J63TVD.js +0 -166
- package/dist/client/assets/codexUsageLimits-BJQiZCqn.js +0 -1
- package/dist/client/assets/commandPaletteStore-oFMPKPmp.js +0 -1
- package/dist/client/assets/composerDraftStore-xu3n5gdX.js +0 -21
- package/dist/client/assets/desktopUpdateReactQuery-YSCkifKp.js +0 -2
- package/dist/client/assets/empty-BTxheW4B.js +0 -1
- package/dist/client/assets/environmentApi-BFHi_M02.js +0 -1
- package/dist/client/assets/folder-open-DJmHEPv9.js +0 -1
- package/dist/client/assets/kbd-Dd57M8OY.js +0 -1
- package/dist/client/assets/main-BQf5U-fz.js +0 -9
- package/dist/client/assets/main-DrwkwNo9.css +0 -2
- package/dist/client/assets/mutation-DJZgOJRu.js +0 -1
- package/dist/client/assets/plus-B10j9MbZ.js +0 -1
- package/dist/client/assets/providerDriverMeta-B6xuq7ij.js +0 -1
- package/dist/client/assets/providerIconUtils-Ch6hejVW.js +0 -47
- package/dist/client/assets/rightPanelRouteSearch-CTMFCS6R.js +0 -1
- package/dist/client/assets/scroll-area-BgFq7GRd.js +0 -1
- package/dist/client/assets/separator-CB3Ctlvi.js +0 -1
- package/dist/client/assets/session-logic-CaiGe4hy.js +0 -4
- package/dist/client/assets/settingsDialogStore-9vo22xKp.js +0 -1
- package/dist/client/assets/settingsLayout-B5o13iGO.js +0 -1
- package/dist/client/assets/sidebar-Bbdql7Af.js +0 -1
- package/dist/client/assets/skeleton-C8OZcsPq.js +0 -1
- package/dist/client/assets/storeSelectors-DBRyhCGm.js +0 -1
- package/dist/client/assets/threadRoutes-CfldSp4X.js +0 -1
- package/dist/client/assets/threadSelectionStore-BggKwzmQ.js +0 -1
- package/dist/client/assets/toast-DE-WwLMa.js +0 -1
- package/dist/client/assets/toggle-BFMa0a0Y.js +0 -1
- package/dist/client/assets/useHandleNewThread-DOPZAFqE.js +0 -1
- package/dist/client/assets/useLabelableId-BzWaBebJ.js +0 -1
- package/dist/client/assets/useNavigate-B1qgM5mt.js +0 -1
- package/dist/client/assets/useTheme-C7Ji7x06.js +0 -1
- package/dist/client/assets/x-b9324xm-.js +0 -1
- package/dist/{NodeSqliteClient-BXy61fAd.mjs → NodeSqliteClient-A1TEgwj_.mjs} +1 -1
- package/dist/{NodeSqliteClient-homCO8-6.cjs → NodeSqliteClient-B5aDHbNc.cjs} +2 -2
|
@@ -1,53 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
const require_collectUint8StreamText = require("./collectUint8StreamText-
|
|
3
|
+
const require_collectUint8StreamText = require("./collectUint8StreamText-uNXVRHOf.cjs");
|
|
4
4
|
let effect = require("effect");
|
|
5
5
|
let effect_unstable_process = require("effect/unstable/process");
|
|
6
|
-
//#region ../../packages/shared/src/schemaJson.ts
|
|
7
|
-
const decodeJsonResult = (schema) => {
|
|
8
|
-
const decode = effect.Schema.decodeExit(effect.Schema.fromJsonString(schema));
|
|
9
|
-
return (input) => {
|
|
10
|
-
const result = decode(input);
|
|
11
|
-
if (effect.Exit.isFailure(result)) return effect.Result.fail(result.cause);
|
|
12
|
-
return effect.Result.succeed(result.value);
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
const formatSchemaError = (cause) => {
|
|
16
|
-
const squashed = effect.Cause.squash(cause);
|
|
17
|
-
return effect.Schema.isSchemaError(squashed) ? effect.SchemaIssue.makeFormatterDefault()(squashed.issue) : effect.Cause.pretty(cause);
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* A `Getter` that parses a lenient JSON string (tolerating trailing commas
|
|
21
|
-
* and JS-style comments) into an unknown value.
|
|
22
|
-
*
|
|
23
|
-
* Mirrors `SchemaGetter.parseJson()` but uses `parseLenientJson` instead
|
|
24
|
-
* of `JSON.parse`.
|
|
25
|
-
*/
|
|
26
|
-
const parseLenientJsonGetter = effect.SchemaGetter.onSome((input) => effect.Effect.try({
|
|
27
|
-
try: () => {
|
|
28
|
-
let stripped = input.replace(/("(?:[^"\\]|\\.)*")|\/\/[^\n]*/g, (match, stringLiteral) => stringLiteral ? match : "");
|
|
29
|
-
stripped = stripped.replace(/("(?:[^"\\]|\\.)*")|\/\*[\s\S]*?\*\//g, (match, stringLiteral) => stringLiteral ? match : "");
|
|
30
|
-
stripped = stripped.replace(/,(\s*[}\]])/g, "$1");
|
|
31
|
-
return effect.Option.some(JSON.parse(stripped));
|
|
32
|
-
},
|
|
33
|
-
catch: (e) => new effect.SchemaIssue.InvalidValue(effect.Option.some(input), { message: String(e) })
|
|
34
|
-
}));
|
|
35
|
-
/**
|
|
36
|
-
* Schema transformation: lenient JSONC string ↔ unknown.
|
|
37
|
-
*
|
|
38
|
-
* Same API as `SchemaTransformation.fromJsonString`, but the decode side
|
|
39
|
-
* strips trailing commas and JS-style comments before parsing.
|
|
40
|
-
* Encoding produces strict JSON via `JSON.stringify`.
|
|
41
|
-
*/
|
|
42
|
-
const fromLenientJsonString = new effect.SchemaTransformation.Transformation(parseLenientJsonGetter, effect.SchemaGetter.stringifyJson());
|
|
43
|
-
/**
|
|
44
|
-
* Build a schema that decodes a lenient JSON string into `A`.
|
|
45
|
-
*
|
|
46
|
-
* Drop-in replacement for `Schema.fromJsonString(schema)` that tolerates
|
|
47
|
-
* trailing commas and comments in the input.
|
|
48
|
-
*/
|
|
49
|
-
const fromLenientJson = (schema) => effect.Schema.String.pipe(effect.Schema.decodeTo(schema, fromLenientJsonString));
|
|
50
|
-
//#endregion
|
|
51
6
|
//#region src/vcs/VcsProcess.ts
|
|
52
7
|
var VcsProcess = class extends effect.Context.Service()("ryco/vcs/VcsProcess") {};
|
|
53
8
|
const DEFAULT_TIMEOUT_MS = 3e4;
|
|
@@ -163,103 +118,6 @@ const make = effect.Effect.fn("makeVcsProcess")(function* () {
|
|
|
163
118
|
});
|
|
164
119
|
const layer = effect.Layer.effect(VcsProcess, make());
|
|
165
120
|
//#endregion
|
|
166
|
-
//#region src/sourceControl/SourceControlProvider.ts
|
|
167
|
-
function parseSourceControlOwnerRef(headSelector) {
|
|
168
|
-
const match = /^([^:/\s]+):(.+)$/u.exec(headSelector.trim());
|
|
169
|
-
const owner = match?.[1]?.trim();
|
|
170
|
-
const refName = match?.[2]?.trim();
|
|
171
|
-
return owner && refName ? {
|
|
172
|
-
owner,
|
|
173
|
-
refName
|
|
174
|
-
} : void 0;
|
|
175
|
-
}
|
|
176
|
-
function normalizeSourceBranch(headSelector) {
|
|
177
|
-
return parseSourceControlOwnerRef(headSelector)?.refName ?? headSelector.trim();
|
|
178
|
-
}
|
|
179
|
-
function sourceBranch(input) {
|
|
180
|
-
return input.source?.refName ?? normalizeSourceBranch(input.headSelector);
|
|
181
|
-
}
|
|
182
|
-
function sourceControlRefFromInput(input) {
|
|
183
|
-
return input.source ?? parseSourceControlOwnerRef(input.headSelector);
|
|
184
|
-
}
|
|
185
|
-
var SourceControlProvider = class extends effect.Context.Service()("ryco/source-control/SourceControlProvider") {};
|
|
186
|
-
//#endregion
|
|
187
|
-
//#region src/sourceControl/gitHubAuthStatus.ts
|
|
188
|
-
const GitHubAuthStatusAccountSchema = effect.Schema.Struct({
|
|
189
|
-
state: effect.Schema.String,
|
|
190
|
-
error: effect.Schema.optional(effect.Schema.String),
|
|
191
|
-
active: effect.Schema.Boolean,
|
|
192
|
-
host: effect.Schema.String,
|
|
193
|
-
login: effect.Schema.String
|
|
194
|
-
});
|
|
195
|
-
const GitHubAuthStatusSchema = effect.Schema.Struct({ hosts: effect.Schema.Record(effect.Schema.String, effect.Schema.Array(GitHubAuthStatusAccountSchema)) });
|
|
196
|
-
const decodeGitHubAuthStatusJson = effect.Schema.decodeUnknownOption(effect.Schema.fromJsonString(GitHubAuthStatusSchema));
|
|
197
|
-
function nonEmptyString(value) {
|
|
198
|
-
const trimmed = value.trim();
|
|
199
|
-
return trimmed.length > 0 ? trimmed : null;
|
|
200
|
-
}
|
|
201
|
-
function parseGitHubAuthStatus(text) {
|
|
202
|
-
return effect.Option.match(decodeGitHubAuthStatusJson(text), {
|
|
203
|
-
onNone: () => ({
|
|
204
|
-
parsed: false,
|
|
205
|
-
accounts: []
|
|
206
|
-
}),
|
|
207
|
-
onSome: (status) => ({
|
|
208
|
-
parsed: true,
|
|
209
|
-
accounts: Object.values(status.hosts).flatMap((accounts) => accounts.flatMap((account) => {
|
|
210
|
-
const host = nonEmptyString(account.host);
|
|
211
|
-
const login = nonEmptyString(account.login);
|
|
212
|
-
if (host === null || login === null) return [];
|
|
213
|
-
return [{
|
|
214
|
-
host: host.toLowerCase(),
|
|
215
|
-
account: login,
|
|
216
|
-
authenticated: account.state === "success",
|
|
217
|
-
active: account.active,
|
|
218
|
-
error: account.error?.trim() || null
|
|
219
|
-
}];
|
|
220
|
-
}))
|
|
221
|
-
})
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
function findAuthenticatedGitHubAccount(accounts) {
|
|
225
|
-
return accounts.find((account) => account.authenticated && account.active) ?? accounts.find((account) => account.authenticated);
|
|
226
|
-
}
|
|
227
|
-
//#endregion
|
|
228
|
-
//#region src/sourceControl/gitLabAuthStatus.ts
|
|
229
|
-
const HOST_LINE_PATTERN = /^(?:[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?|\[[a-f0-9:.]+\])(?::\d+)?$/iu;
|
|
230
|
-
const LOGGED_IN_PATTERN = /Logged in to .+? as\s+([^\s(]+)/iu;
|
|
231
|
-
function parseGitLabAuthStatusHosts(text) {
|
|
232
|
-
const hosts = [];
|
|
233
|
-
let currentHost = null;
|
|
234
|
-
let currentLines = [];
|
|
235
|
-
const flush = () => {
|
|
236
|
-
if (currentHost === null) return;
|
|
237
|
-
const account = LOGGED_IN_PATTERN.exec(currentLines.join("\n"))?.[1]?.trim() || null;
|
|
238
|
-
hosts.push({
|
|
239
|
-
host: currentHost,
|
|
240
|
-
account,
|
|
241
|
-
authenticated: account !== null
|
|
242
|
-
});
|
|
243
|
-
currentHost = null;
|
|
244
|
-
currentLines = [];
|
|
245
|
-
};
|
|
246
|
-
for (const rawLine of text.split(/\r?\n/)) {
|
|
247
|
-
const line = rawLine.trim();
|
|
248
|
-
if (line.length === 0) continue;
|
|
249
|
-
if (rawLine.length === rawLine.trimStart().length && HOST_LINE_PATTERN.test(line)) {
|
|
250
|
-
flush();
|
|
251
|
-
currentHost = line.toLowerCase();
|
|
252
|
-
continue;
|
|
253
|
-
}
|
|
254
|
-
if (currentHost !== null) currentLines.push(line);
|
|
255
|
-
}
|
|
256
|
-
flush();
|
|
257
|
-
return hosts;
|
|
258
|
-
}
|
|
259
|
-
function findAuthenticatedGitLabHost(hosts) {
|
|
260
|
-
return hosts.find((host) => host.authenticated);
|
|
261
|
-
}
|
|
262
|
-
//#endregion
|
|
263
121
|
//#region src/sourceControl/SourceControlProviderDiscovery.ts
|
|
264
122
|
function firstNonEmptyLine(text) {
|
|
265
123
|
const line = text.split(/\r?\n/).map((entry) => entry.trim()).find((entry) => entry.length > 0);
|
|
@@ -404,6 +262,103 @@ const refineUnknownRemoteProvider = effect.Effect.fn("refineUnknownRemoteProvide
|
|
|
404
262
|
} : context;
|
|
405
263
|
});
|
|
406
264
|
//#endregion
|
|
265
|
+
//#region src/sourceControl/SourceControlProvider.ts
|
|
266
|
+
function parseSourceControlOwnerRef(headSelector) {
|
|
267
|
+
const match = /^([^:/\s]+):(.+)$/u.exec(headSelector.trim());
|
|
268
|
+
const owner = match?.[1]?.trim();
|
|
269
|
+
const refName = match?.[2]?.trim();
|
|
270
|
+
return owner && refName ? {
|
|
271
|
+
owner,
|
|
272
|
+
refName
|
|
273
|
+
} : void 0;
|
|
274
|
+
}
|
|
275
|
+
function normalizeSourceBranch(headSelector) {
|
|
276
|
+
return parseSourceControlOwnerRef(headSelector)?.refName ?? headSelector.trim();
|
|
277
|
+
}
|
|
278
|
+
function sourceBranch(input) {
|
|
279
|
+
return input.source?.refName ?? normalizeSourceBranch(input.headSelector);
|
|
280
|
+
}
|
|
281
|
+
function sourceControlRefFromInput(input) {
|
|
282
|
+
return input.source ?? parseSourceControlOwnerRef(input.headSelector);
|
|
283
|
+
}
|
|
284
|
+
var SourceControlProvider = class extends effect.Context.Service()("ryco/source-control/SourceControlProvider") {};
|
|
285
|
+
//#endregion
|
|
286
|
+
//#region src/sourceControl/gitHubAuthStatus.ts
|
|
287
|
+
const GitHubAuthStatusAccountSchema = effect.Schema.Struct({
|
|
288
|
+
state: effect.Schema.String,
|
|
289
|
+
error: effect.Schema.optional(effect.Schema.String),
|
|
290
|
+
active: effect.Schema.Boolean,
|
|
291
|
+
host: effect.Schema.String,
|
|
292
|
+
login: effect.Schema.String
|
|
293
|
+
});
|
|
294
|
+
const GitHubAuthStatusSchema = effect.Schema.Struct({ hosts: effect.Schema.Record(effect.Schema.String, effect.Schema.Array(GitHubAuthStatusAccountSchema)) });
|
|
295
|
+
const decodeGitHubAuthStatusJson = effect.Schema.decodeUnknownOption(effect.Schema.fromJsonString(GitHubAuthStatusSchema));
|
|
296
|
+
function nonEmptyString(value) {
|
|
297
|
+
const trimmed = value.trim();
|
|
298
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
299
|
+
}
|
|
300
|
+
function parseGitHubAuthStatus(text) {
|
|
301
|
+
return effect.Option.match(decodeGitHubAuthStatusJson(text), {
|
|
302
|
+
onNone: () => ({
|
|
303
|
+
parsed: false,
|
|
304
|
+
accounts: []
|
|
305
|
+
}),
|
|
306
|
+
onSome: (status) => ({
|
|
307
|
+
parsed: true,
|
|
308
|
+
accounts: Object.values(status.hosts).flatMap((accounts) => accounts.flatMap((account) => {
|
|
309
|
+
const host = nonEmptyString(account.host);
|
|
310
|
+
const login = nonEmptyString(account.login);
|
|
311
|
+
if (host === null || login === null) return [];
|
|
312
|
+
return [{
|
|
313
|
+
host: host.toLowerCase(),
|
|
314
|
+
account: login,
|
|
315
|
+
authenticated: account.state === "success",
|
|
316
|
+
active: account.active,
|
|
317
|
+
error: account.error?.trim() || null
|
|
318
|
+
}];
|
|
319
|
+
}))
|
|
320
|
+
})
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
function findAuthenticatedGitHubAccount(accounts) {
|
|
324
|
+
return accounts.find((account) => account.authenticated && account.active) ?? accounts.find((account) => account.authenticated);
|
|
325
|
+
}
|
|
326
|
+
//#endregion
|
|
327
|
+
//#region src/sourceControl/gitLabAuthStatus.ts
|
|
328
|
+
const HOST_LINE_PATTERN = /^(?:[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?|\[[a-f0-9:.]+\])(?::\d+)?$/iu;
|
|
329
|
+
const LOGGED_IN_PATTERN = /Logged in to .+? as\s+([^\s(]+)/iu;
|
|
330
|
+
function parseGitLabAuthStatusHosts(text) {
|
|
331
|
+
const hosts = [];
|
|
332
|
+
let currentHost = null;
|
|
333
|
+
let currentLines = [];
|
|
334
|
+
const flush = () => {
|
|
335
|
+
if (currentHost === null) return;
|
|
336
|
+
const account = LOGGED_IN_PATTERN.exec(currentLines.join("\n"))?.[1]?.trim() || null;
|
|
337
|
+
hosts.push({
|
|
338
|
+
host: currentHost,
|
|
339
|
+
account,
|
|
340
|
+
authenticated: account !== null
|
|
341
|
+
});
|
|
342
|
+
currentHost = null;
|
|
343
|
+
currentLines = [];
|
|
344
|
+
};
|
|
345
|
+
for (const rawLine of text.split(/\r?\n/)) {
|
|
346
|
+
const line = rawLine.trim();
|
|
347
|
+
if (line.length === 0) continue;
|
|
348
|
+
if (rawLine.length === rawLine.trimStart().length && HOST_LINE_PATTERN.test(line)) {
|
|
349
|
+
flush();
|
|
350
|
+
currentHost = line.toLowerCase();
|
|
351
|
+
continue;
|
|
352
|
+
}
|
|
353
|
+
if (currentHost !== null) currentLines.push(line);
|
|
354
|
+
}
|
|
355
|
+
flush();
|
|
356
|
+
return hosts;
|
|
357
|
+
}
|
|
358
|
+
function findAuthenticatedGitLabHost(hosts) {
|
|
359
|
+
return hosts.find((host) => host.authenticated);
|
|
360
|
+
}
|
|
361
|
+
//#endregion
|
|
407
362
|
//#region src/sourceControl/SourceControlProviderDiscoveryCatalog.ts
|
|
408
363
|
function parseGitHubAuth(input) {
|
|
409
364
|
const output = combinedAuthOutput(input);
|
|
@@ -584,12 +539,6 @@ Object.defineProperty(exports, "azureDevOpsDiscovery", {
|
|
|
584
539
|
return azureDevOpsDiscovery;
|
|
585
540
|
}
|
|
586
541
|
});
|
|
587
|
-
Object.defineProperty(exports, "decodeJsonResult", {
|
|
588
|
-
enumerable: true,
|
|
589
|
-
get: function() {
|
|
590
|
-
return decodeJsonResult;
|
|
591
|
-
}
|
|
592
|
-
});
|
|
593
542
|
Object.defineProperty(exports, "detailFromCause", {
|
|
594
543
|
enumerable: true,
|
|
595
544
|
get: function() {
|
|
@@ -602,18 +551,6 @@ Object.defineProperty(exports, "firstNonEmptyLine", {
|
|
|
602
551
|
return firstNonEmptyLine;
|
|
603
552
|
}
|
|
604
553
|
});
|
|
605
|
-
Object.defineProperty(exports, "formatSchemaError", {
|
|
606
|
-
enumerable: true,
|
|
607
|
-
get: function() {
|
|
608
|
-
return formatSchemaError;
|
|
609
|
-
}
|
|
610
|
-
});
|
|
611
|
-
Object.defineProperty(exports, "fromLenientJson", {
|
|
612
|
-
enumerable: true,
|
|
613
|
-
get: function() {
|
|
614
|
-
return fromLenientJson;
|
|
615
|
-
}
|
|
616
|
-
});
|
|
617
554
|
Object.defineProperty(exports, "githubDiscovery", {
|
|
618
555
|
enumerable: true,
|
|
619
556
|
get: function() {
|
|
@@ -1,53 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { An as
|
|
4
|
-
import {
|
|
3
|
+
import { An as VcsOutputDecodeError, Mn as VcsProcessSpawnError, Nn as VcsProcessTimeoutError, jn as VcsProcessExitError, t as collectUint8StreamText } from "./collectUint8StreamText-Lv4GGI79.mjs";
|
|
4
|
+
import { Context, Duration, Effect, Layer, Option, Schema, Sink, Stream } from "effect";
|
|
5
5
|
import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process";
|
|
6
|
-
//#region ../../packages/shared/src/schemaJson.ts
|
|
7
|
-
const decodeJsonResult = (schema) => {
|
|
8
|
-
const decode = Schema.decodeExit(Schema.fromJsonString(schema));
|
|
9
|
-
return (input) => {
|
|
10
|
-
const result = decode(input);
|
|
11
|
-
if (Exit.isFailure(result)) return Result.fail(result.cause);
|
|
12
|
-
return Result.succeed(result.value);
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
const formatSchemaError = (cause) => {
|
|
16
|
-
const squashed = Cause.squash(cause);
|
|
17
|
-
return Schema.isSchemaError(squashed) ? SchemaIssue.makeFormatterDefault()(squashed.issue) : Cause.pretty(cause);
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* A `Getter` that parses a lenient JSON string (tolerating trailing commas
|
|
21
|
-
* and JS-style comments) into an unknown value.
|
|
22
|
-
*
|
|
23
|
-
* Mirrors `SchemaGetter.parseJson()` but uses `parseLenientJson` instead
|
|
24
|
-
* of `JSON.parse`.
|
|
25
|
-
*/
|
|
26
|
-
const parseLenientJsonGetter = SchemaGetter.onSome((input) => Effect.try({
|
|
27
|
-
try: () => {
|
|
28
|
-
let stripped = input.replace(/("(?:[^"\\]|\\.)*")|\/\/[^\n]*/g, (match, stringLiteral) => stringLiteral ? match : "");
|
|
29
|
-
stripped = stripped.replace(/("(?:[^"\\]|\\.)*")|\/\*[\s\S]*?\*\//g, (match, stringLiteral) => stringLiteral ? match : "");
|
|
30
|
-
stripped = stripped.replace(/,(\s*[}\]])/g, "$1");
|
|
31
|
-
return Option.some(JSON.parse(stripped));
|
|
32
|
-
},
|
|
33
|
-
catch: (e) => new SchemaIssue.InvalidValue(Option.some(input), { message: String(e) })
|
|
34
|
-
}));
|
|
35
|
-
/**
|
|
36
|
-
* Schema transformation: lenient JSONC string ↔ unknown.
|
|
37
|
-
*
|
|
38
|
-
* Same API as `SchemaTransformation.fromJsonString`, but the decode side
|
|
39
|
-
* strips trailing commas and JS-style comments before parsing.
|
|
40
|
-
* Encoding produces strict JSON via `JSON.stringify`.
|
|
41
|
-
*/
|
|
42
|
-
const fromLenientJsonString = new SchemaTransformation.Transformation(parseLenientJsonGetter, SchemaGetter.stringifyJson());
|
|
43
|
-
/**
|
|
44
|
-
* Build a schema that decodes a lenient JSON string into `A`.
|
|
45
|
-
*
|
|
46
|
-
* Drop-in replacement for `Schema.fromJsonString(schema)` that tolerates
|
|
47
|
-
* trailing commas and comments in the input.
|
|
48
|
-
*/
|
|
49
|
-
const fromLenientJson = (schema) => Schema.String.pipe(Schema.decodeTo(schema, fromLenientJsonString));
|
|
50
|
-
//#endregion
|
|
51
6
|
//#region src/vcs/VcsProcess.ts
|
|
52
7
|
var VcsProcess = class extends Context.Service()("ryco/vcs/VcsProcess") {};
|
|
53
8
|
const DEFAULT_TIMEOUT_MS = 3e4;
|
|
@@ -163,103 +118,6 @@ const make = Effect.fn("makeVcsProcess")(function* () {
|
|
|
163
118
|
});
|
|
164
119
|
const layer = Layer.effect(VcsProcess, make());
|
|
165
120
|
//#endregion
|
|
166
|
-
//#region src/sourceControl/SourceControlProvider.ts
|
|
167
|
-
function parseSourceControlOwnerRef(headSelector) {
|
|
168
|
-
const match = /^([^:/\s]+):(.+)$/u.exec(headSelector.trim());
|
|
169
|
-
const owner = match?.[1]?.trim();
|
|
170
|
-
const refName = match?.[2]?.trim();
|
|
171
|
-
return owner && refName ? {
|
|
172
|
-
owner,
|
|
173
|
-
refName
|
|
174
|
-
} : void 0;
|
|
175
|
-
}
|
|
176
|
-
function normalizeSourceBranch(headSelector) {
|
|
177
|
-
return parseSourceControlOwnerRef(headSelector)?.refName ?? headSelector.trim();
|
|
178
|
-
}
|
|
179
|
-
function sourceBranch(input) {
|
|
180
|
-
return input.source?.refName ?? normalizeSourceBranch(input.headSelector);
|
|
181
|
-
}
|
|
182
|
-
function sourceControlRefFromInput(input) {
|
|
183
|
-
return input.source ?? parseSourceControlOwnerRef(input.headSelector);
|
|
184
|
-
}
|
|
185
|
-
var SourceControlProvider = class extends Context.Service()("ryco/source-control/SourceControlProvider") {};
|
|
186
|
-
//#endregion
|
|
187
|
-
//#region src/sourceControl/gitHubAuthStatus.ts
|
|
188
|
-
const GitHubAuthStatusAccountSchema = Schema.Struct({
|
|
189
|
-
state: Schema.String,
|
|
190
|
-
error: Schema.optional(Schema.String),
|
|
191
|
-
active: Schema.Boolean,
|
|
192
|
-
host: Schema.String,
|
|
193
|
-
login: Schema.String
|
|
194
|
-
});
|
|
195
|
-
const GitHubAuthStatusSchema = Schema.Struct({ hosts: Schema.Record(Schema.String, Schema.Array(GitHubAuthStatusAccountSchema)) });
|
|
196
|
-
const decodeGitHubAuthStatusJson = Schema.decodeUnknownOption(Schema.fromJsonString(GitHubAuthStatusSchema));
|
|
197
|
-
function nonEmptyString(value) {
|
|
198
|
-
const trimmed = value.trim();
|
|
199
|
-
return trimmed.length > 0 ? trimmed : null;
|
|
200
|
-
}
|
|
201
|
-
function parseGitHubAuthStatus(text) {
|
|
202
|
-
return Option.match(decodeGitHubAuthStatusJson(text), {
|
|
203
|
-
onNone: () => ({
|
|
204
|
-
parsed: false,
|
|
205
|
-
accounts: []
|
|
206
|
-
}),
|
|
207
|
-
onSome: (status) => ({
|
|
208
|
-
parsed: true,
|
|
209
|
-
accounts: Object.values(status.hosts).flatMap((accounts) => accounts.flatMap((account) => {
|
|
210
|
-
const host = nonEmptyString(account.host);
|
|
211
|
-
const login = nonEmptyString(account.login);
|
|
212
|
-
if (host === null || login === null) return [];
|
|
213
|
-
return [{
|
|
214
|
-
host: host.toLowerCase(),
|
|
215
|
-
account: login,
|
|
216
|
-
authenticated: account.state === "success",
|
|
217
|
-
active: account.active,
|
|
218
|
-
error: account.error?.trim() || null
|
|
219
|
-
}];
|
|
220
|
-
}))
|
|
221
|
-
})
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
function findAuthenticatedGitHubAccount(accounts) {
|
|
225
|
-
return accounts.find((account) => account.authenticated && account.active) ?? accounts.find((account) => account.authenticated);
|
|
226
|
-
}
|
|
227
|
-
//#endregion
|
|
228
|
-
//#region src/sourceControl/gitLabAuthStatus.ts
|
|
229
|
-
const HOST_LINE_PATTERN = /^(?:[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?|\[[a-f0-9:.]+\])(?::\d+)?$/iu;
|
|
230
|
-
const LOGGED_IN_PATTERN = /Logged in to .+? as\s+([^\s(]+)/iu;
|
|
231
|
-
function parseGitLabAuthStatusHosts(text) {
|
|
232
|
-
const hosts = [];
|
|
233
|
-
let currentHost = null;
|
|
234
|
-
let currentLines = [];
|
|
235
|
-
const flush = () => {
|
|
236
|
-
if (currentHost === null) return;
|
|
237
|
-
const account = LOGGED_IN_PATTERN.exec(currentLines.join("\n"))?.[1]?.trim() || null;
|
|
238
|
-
hosts.push({
|
|
239
|
-
host: currentHost,
|
|
240
|
-
account,
|
|
241
|
-
authenticated: account !== null
|
|
242
|
-
});
|
|
243
|
-
currentHost = null;
|
|
244
|
-
currentLines = [];
|
|
245
|
-
};
|
|
246
|
-
for (const rawLine of text.split(/\r?\n/)) {
|
|
247
|
-
const line = rawLine.trim();
|
|
248
|
-
if (line.length === 0) continue;
|
|
249
|
-
if (rawLine.length === rawLine.trimStart().length && HOST_LINE_PATTERN.test(line)) {
|
|
250
|
-
flush();
|
|
251
|
-
currentHost = line.toLowerCase();
|
|
252
|
-
continue;
|
|
253
|
-
}
|
|
254
|
-
if (currentHost !== null) currentLines.push(line);
|
|
255
|
-
}
|
|
256
|
-
flush();
|
|
257
|
-
return hosts;
|
|
258
|
-
}
|
|
259
|
-
function findAuthenticatedGitLabHost(hosts) {
|
|
260
|
-
return hosts.find((host) => host.authenticated);
|
|
261
|
-
}
|
|
262
|
-
//#endregion
|
|
263
121
|
//#region src/sourceControl/SourceControlProviderDiscovery.ts
|
|
264
122
|
function firstNonEmptyLine(text) {
|
|
265
123
|
const line = text.split(/\r?\n/).map((entry) => entry.trim()).find((entry) => entry.length > 0);
|
|
@@ -404,6 +262,103 @@ const refineUnknownRemoteProvider = Effect.fn("refineUnknownRemoteProvider")(fun
|
|
|
404
262
|
} : context;
|
|
405
263
|
});
|
|
406
264
|
//#endregion
|
|
265
|
+
//#region src/sourceControl/SourceControlProvider.ts
|
|
266
|
+
function parseSourceControlOwnerRef(headSelector) {
|
|
267
|
+
const match = /^([^:/\s]+):(.+)$/u.exec(headSelector.trim());
|
|
268
|
+
const owner = match?.[1]?.trim();
|
|
269
|
+
const refName = match?.[2]?.trim();
|
|
270
|
+
return owner && refName ? {
|
|
271
|
+
owner,
|
|
272
|
+
refName
|
|
273
|
+
} : void 0;
|
|
274
|
+
}
|
|
275
|
+
function normalizeSourceBranch(headSelector) {
|
|
276
|
+
return parseSourceControlOwnerRef(headSelector)?.refName ?? headSelector.trim();
|
|
277
|
+
}
|
|
278
|
+
function sourceBranch(input) {
|
|
279
|
+
return input.source?.refName ?? normalizeSourceBranch(input.headSelector);
|
|
280
|
+
}
|
|
281
|
+
function sourceControlRefFromInput(input) {
|
|
282
|
+
return input.source ?? parseSourceControlOwnerRef(input.headSelector);
|
|
283
|
+
}
|
|
284
|
+
var SourceControlProvider = class extends Context.Service()("ryco/source-control/SourceControlProvider") {};
|
|
285
|
+
//#endregion
|
|
286
|
+
//#region src/sourceControl/gitHubAuthStatus.ts
|
|
287
|
+
const GitHubAuthStatusAccountSchema = Schema.Struct({
|
|
288
|
+
state: Schema.String,
|
|
289
|
+
error: Schema.optional(Schema.String),
|
|
290
|
+
active: Schema.Boolean,
|
|
291
|
+
host: Schema.String,
|
|
292
|
+
login: Schema.String
|
|
293
|
+
});
|
|
294
|
+
const GitHubAuthStatusSchema = Schema.Struct({ hosts: Schema.Record(Schema.String, Schema.Array(GitHubAuthStatusAccountSchema)) });
|
|
295
|
+
const decodeGitHubAuthStatusJson = Schema.decodeUnknownOption(Schema.fromJsonString(GitHubAuthStatusSchema));
|
|
296
|
+
function nonEmptyString(value) {
|
|
297
|
+
const trimmed = value.trim();
|
|
298
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
299
|
+
}
|
|
300
|
+
function parseGitHubAuthStatus(text) {
|
|
301
|
+
return Option.match(decodeGitHubAuthStatusJson(text), {
|
|
302
|
+
onNone: () => ({
|
|
303
|
+
parsed: false,
|
|
304
|
+
accounts: []
|
|
305
|
+
}),
|
|
306
|
+
onSome: (status) => ({
|
|
307
|
+
parsed: true,
|
|
308
|
+
accounts: Object.values(status.hosts).flatMap((accounts) => accounts.flatMap((account) => {
|
|
309
|
+
const host = nonEmptyString(account.host);
|
|
310
|
+
const login = nonEmptyString(account.login);
|
|
311
|
+
if (host === null || login === null) return [];
|
|
312
|
+
return [{
|
|
313
|
+
host: host.toLowerCase(),
|
|
314
|
+
account: login,
|
|
315
|
+
authenticated: account.state === "success",
|
|
316
|
+
active: account.active,
|
|
317
|
+
error: account.error?.trim() || null
|
|
318
|
+
}];
|
|
319
|
+
}))
|
|
320
|
+
})
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
function findAuthenticatedGitHubAccount(accounts) {
|
|
324
|
+
return accounts.find((account) => account.authenticated && account.active) ?? accounts.find((account) => account.authenticated);
|
|
325
|
+
}
|
|
326
|
+
//#endregion
|
|
327
|
+
//#region src/sourceControl/gitLabAuthStatus.ts
|
|
328
|
+
const HOST_LINE_PATTERN = /^(?:[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?|\[[a-f0-9:.]+\])(?::\d+)?$/iu;
|
|
329
|
+
const LOGGED_IN_PATTERN = /Logged in to .+? as\s+([^\s(]+)/iu;
|
|
330
|
+
function parseGitLabAuthStatusHosts(text) {
|
|
331
|
+
const hosts = [];
|
|
332
|
+
let currentHost = null;
|
|
333
|
+
let currentLines = [];
|
|
334
|
+
const flush = () => {
|
|
335
|
+
if (currentHost === null) return;
|
|
336
|
+
const account = LOGGED_IN_PATTERN.exec(currentLines.join("\n"))?.[1]?.trim() || null;
|
|
337
|
+
hosts.push({
|
|
338
|
+
host: currentHost,
|
|
339
|
+
account,
|
|
340
|
+
authenticated: account !== null
|
|
341
|
+
});
|
|
342
|
+
currentHost = null;
|
|
343
|
+
currentLines = [];
|
|
344
|
+
};
|
|
345
|
+
for (const rawLine of text.split(/\r?\n/)) {
|
|
346
|
+
const line = rawLine.trim();
|
|
347
|
+
if (line.length === 0) continue;
|
|
348
|
+
if (rawLine.length === rawLine.trimStart().length && HOST_LINE_PATTERN.test(line)) {
|
|
349
|
+
flush();
|
|
350
|
+
currentHost = line.toLowerCase();
|
|
351
|
+
continue;
|
|
352
|
+
}
|
|
353
|
+
if (currentHost !== null) currentLines.push(line);
|
|
354
|
+
}
|
|
355
|
+
flush();
|
|
356
|
+
return hosts;
|
|
357
|
+
}
|
|
358
|
+
function findAuthenticatedGitLabHost(hosts) {
|
|
359
|
+
return hosts.find((host) => host.authenticated);
|
|
360
|
+
}
|
|
361
|
+
//#endregion
|
|
407
362
|
//#region src/sourceControl/SourceControlProviderDiscoveryCatalog.ts
|
|
408
363
|
function parseGitHubAuth(input) {
|
|
409
364
|
const output = combinedAuthOutput(input);
|
|
@@ -566,4 +521,4 @@ function makeForgejoDiscovery(forgejo) {
|
|
|
566
521
|
};
|
|
567
522
|
}
|
|
568
523
|
//#endregion
|
|
569
|
-
export {
|
|
524
|
+
export { makeForgejoDiscovery as a, sourceBranch as c, firstNonEmptyLine as d, probeSourceControlProvider as f, layer as h, makeBitbucketDiscovery as i, sourceControlRefFromInput as l, VcsProcess as m, githubDiscovery as n, SourceControlProvider as o, refineUnknownRemoteProvider as p, gitlabDiscovery as r, parseSourceControlOwnerRef as s, azureDevOpsDiscovery as t, detailFromCause as u };
|