@hanzo/dev 4.0.1 → 4.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.
- package/LICENSE +21 -0
- package/dist/{BinaryViewer-qn8xfPZp.js → BinaryViewer-CmFUK4zZ.js} +2 -2
- package/dist/{ChatMarkdown-Cyujn3JJ.js → ChatMarkdown-nvEI7iCv.js} +4 -4
- package/dist/{DiffCommentAnnotation-BZu1TP6E.js → DiffCommentAnnotation-BPTN_2a6.js} +1 -1
- package/dist/{DiffFileTree-CcJ91zOM.js → DiffFileTree-B_br90vY.js} +2 -2
- package/dist/{DiffPanel-BXC88NMs.js → DiffPanel-V5R5TPuK.js} +5 -5
- package/dist/{ExpandedImageDialog-BZnGRBJR.js → ExpandedImageDialog-CAorLacL.js} +1 -1
- package/dist/{FileExplorerPane-vBJS6V75.js → FileExplorerPane-CeHulcPz.js} +1 -1
- package/dist/{FilePreviewPanel-jJHWsMzm.js → FilePreviewPanel-BVNLvWOc.js} +8 -8
- package/dist/{MermaidDiagram-paNwQY33.js → MermaidDiagram-CTolIzQD.js} +1 -1
- package/dist/{MermaidFilePreview-B9KxfnIN.js → MermaidFilePreview-CP2zP4FU.js} +1 -1
- package/dist/{MermaidViewer-CAEGpLyD.js → MermaidViewer-BDfYkS9E.js} +2 -2
- package/dist/{NotebookPreview-D01mMCpR.js → NotebookPreview-Cybs5uM0.js} +1 -1
- package/dist/{OfficeFilePreview-DWaRgfQU.js → OfficeFilePreview-7JsmSoKU.js} +1 -1
- package/dist/{OfficeViewer-BudrZbBA.js → OfficeViewer-CJoojlJK.js} +1 -1
- package/dist/{OpenInPicker-Dd3ifHa1.js → OpenInPicker-BIMWUxBP.js} +7 -7
- package/dist/{OpenXmlOfficeViewer-CXcKdq7k.js → OpenXmlOfficeViewer-C24Kj8DM.js} +1 -1
- package/dist/{PreviewImage-C4Ku4z7v.js → PreviewImage-oY5YnuTr.js} +1 -1
- package/dist/{PreviewImageContent-BwOB9Lyd.js → PreviewImageContent-n6eLzY99.js} +1 -1
- package/dist/{PullRequestCodeTab-BcwyMk7d.js → PullRequestCodeTab-Dv_0kVad.js} +7 -7
- package/dist/{PullRequestReviewAnnotation-BU5t_1fC.js → PullRequestReviewAnnotation-LeuwO-iH.js} +4 -4
- package/dist/builder/activity.d.ts +16 -0
- package/dist/builder/activity.js +51 -0
- package/dist/builder/address.d.ts +11 -0
- package/dist/builder/address.js +50 -0
- package/dist/builder/ago.d.ts +2 -0
- package/dist/builder/ago.js +18 -0
- package/dist/builder/api/agents.d.ts +139 -0
- package/dist/builder/api/agents.js +253 -0
- package/dist/builder/api/auto.d.ts +166 -0
- package/dist/builder/api/auto.js +300 -0
- package/dist/builder/api/billing.d.ts +263 -0
- package/dist/builder/api/billing.js +401 -0
- package/dist/builder/api/call.d.ts +53 -0
- package/dist/builder/api/call.js +123 -0
- package/dist/builder/api/capabilities.d.ts +14 -0
- package/dist/builder/api/capabilities.js +41 -0
- package/dist/builder/api/changes.d.ts +74 -0
- package/dist/builder/api/changes.js +75 -0
- package/dist/builder/api/chat.d.ts +12 -0
- package/dist/builder/api/chat.js +28 -0
- package/dist/builder/api/cli.d.ts +59 -0
- package/dist/builder/api/cli.js +133 -0
- package/dist/builder/api/codebases.d.ts +46 -0
- package/dist/builder/api/codebases.js +100 -0
- package/dist/builder/api/coding.d.ts +117 -0
- package/dist/builder/api/coding.js +222 -0
- package/dist/builder/api/connectors.d.ts +76 -0
- package/dist/builder/api/connectors.js +111 -0
- package/dist/builder/api/consent.d.ts +22 -0
- package/dist/builder/api/consent.js +28 -0
- package/dist/builder/api/conversations.d.ts +20 -0
- package/dist/builder/api/conversations.js +23 -0
- package/dist/builder/api/draft.d.ts +38 -0
- package/dist/builder/api/draft.js +87 -0
- package/dist/builder/api/environment.d.ts +55 -0
- package/dist/builder/api/environment.js +126 -0
- package/dist/builder/api/gallery.d.ts +32 -0
- package/dist/builder/api/gallery.js +85 -0
- package/dist/builder/api/git.d.ts +31 -0
- package/dist/builder/api/git.js +47 -0
- package/dist/builder/api/github.d.ts +176 -0
- package/dist/builder/api/github.js +271 -0
- package/dist/builder/api/keys.d.ts +35 -0
- package/dist/builder/api/keys.js +72 -0
- package/dist/builder/api/library.d.ts +116 -0
- package/dist/builder/api/library.js +214 -0
- package/dist/builder/api/limits.d.ts +69 -0
- package/dist/builder/api/limits.js +86 -0
- package/dist/builder/api/links.d.ts +51 -0
- package/dist/builder/api/links.js +75 -0
- package/dist/builder/api/machines.d.ts +122 -0
- package/dist/builder/api/machines.js +238 -0
- package/dist/builder/api/mcp.d.ts +10 -0
- package/dist/builder/api/mcp.js +47 -0
- package/dist/builder/api/members.d.ts +35 -0
- package/dist/builder/api/members.js +95 -0
- package/dist/builder/api/memory.d.ts +14 -0
- package/dist/builder/api/memory.js +35 -0
- package/dist/builder/api/models.d.ts +17 -0
- package/dist/builder/api/models.js +20 -0
- package/dist/builder/api/places.d.ts +32 -0
- package/dist/builder/api/places.js +29 -0
- package/dist/builder/api/platform.d.ts +68 -0
- package/dist/builder/api/platform.js +87 -0
- package/dist/builder/api/plugins.d.ts +42 -0
- package/dist/builder/api/plugins.js +175 -0
- package/dist/builder/api/pref.d.ts +77 -0
- package/dist/builder/api/pref.js +93 -0
- package/dist/builder/api/profile.d.ts +11 -0
- package/dist/builder/api/profile.js +41 -0
- package/dist/builder/api/projects.d.ts +99 -0
- package/dist/builder/api/projects.js +166 -0
- package/dist/builder/api/provider.d.ts +49 -0
- package/dist/builder/api/provider.js +96 -0
- package/dist/builder/api/sandbox.d.ts +90 -0
- package/dist/builder/api/sandbox.js +223 -0
- package/dist/builder/api/sessions.d.ts +123 -0
- package/dist/builder/api/sessions.js +255 -0
- package/dist/builder/api/skills.d.ts +82 -0
- package/dist/builder/api/skills.js +117 -0
- package/dist/builder/api/sse.d.ts +24 -0
- package/dist/builder/api/sse.js +68 -0
- package/dist/builder/api/studio.d.ts +59 -0
- package/dist/builder/api/studio.js +91 -0
- package/dist/builder/api/talk.d.ts +48 -0
- package/dist/builder/api/talk.js +81 -0
- package/dist/builder/api/tools.d.ts +34 -0
- package/dist/builder/api/tools.js +37 -0
- package/dist/builder/api/turn.d.ts +202 -0
- package/dist/builder/api/turn.js +772 -0
- package/dist/builder/api/verdict.d.ts +3 -0
- package/dist/builder/api/verdict.js +21 -0
- package/dist/builder/api/webhooks.d.ts +47 -0
- package/dist/builder/api/webhooks.js +82 -0
- package/dist/builder/api/work.d.ts +110 -0
- package/dist/builder/api/work.js +218 -0
- package/dist/builder/ask.d.ts +51 -0
- package/dist/builder/ask.js +147 -0
- package/dist/builder/automations.d.ts +33 -0
- package/dist/builder/automations.js +453 -0
- package/dist/builder/awake.d.ts +24 -0
- package/dist/builder/awake.js +68 -0
- package/dist/builder/back.d.ts +30 -0
- package/dist/builder/back.js +105 -0
- package/dist/builder/builder.d.ts +12 -0
- package/dist/builder/builder.js +162 -0
- package/dist/builder/carry.d.ts +48 -0
- package/dist/builder/carry.js +278 -0
- package/dist/builder/choice.d.ts +134 -0
- package/dist/builder/choice.js +152 -0
- package/dist/builder/claims.d.ts +13 -0
- package/dist/builder/claims.js +35 -0
- package/dist/builder/clipboard.d.ts +2 -0
- package/dist/builder/clipboard.js +10 -0
- package/dist/builder/customize/agents.d.ts +11 -0
- package/dist/builder/customize/agents.js +513 -0
- package/dist/builder/customize/connectors.d.ts +2 -0
- package/dist/builder/customize/connectors.js +319 -0
- package/dist/builder/customize/drafted.d.ts +4 -0
- package/dist/builder/customize/drafted.js +92 -0
- package/dist/builder/customize/index.d.ts +8 -0
- package/dist/builder/customize/index.js +127 -0
- package/dist/builder/customize/inventory.d.ts +14 -0
- package/dist/builder/customize/inventory.js +127 -0
- package/dist/builder/customize/load.d.ts +9 -0
- package/dist/builder/customize/load.js +22 -0
- package/dist/builder/customize/ocean.d.ts +41 -0
- package/dist/builder/customize/ocean.js +332 -0
- package/dist/builder/customize/plugins.d.ts +2 -0
- package/dist/builder/customize/plugins.js +136 -0
- package/dist/builder/customize/roles.d.ts +4 -0
- package/dist/builder/customize/roles.js +105 -0
- package/dist/builder/customize/say.d.ts +13 -0
- package/dist/builder/customize/say.js +32 -0
- package/dist/builder/customize/skills.d.ts +2 -0
- package/dist/builder/customize/skills.js +208 -0
- package/dist/builder/customize/ui.d.ts +152 -0
- package/dist/builder/customize/ui.js +208 -0
- package/dist/builder/data.d.ts +57 -0
- package/dist/builder/data.js +322 -0
- package/dist/builder/design.d.ts +140 -0
- package/dist/builder/design.js +175 -0
- package/dist/builder/desk.d.ts +48 -0
- package/dist/builder/desk.js +449 -0
- package/dist/builder/dev-mode.d.ts +43 -0
- package/dist/builder/dev-mode.js +120 -0
- package/dist/builder/door.d.ts +11 -0
- package/dist/builder/door.js +126 -0
- package/dist/builder/environment.d.ts +23 -0
- package/dist/builder/environment.js +193 -0
- package/dist/builder/files.d.ts +23 -0
- package/dist/builder/files.js +175 -0
- package/dist/builder/find.d.ts +7 -0
- package/dist/builder/find.js +80 -0
- package/dist/builder/foot.d.ts +30 -0
- package/dist/builder/foot.js +79 -0
- package/dist/builder/forge.d.ts +4 -0
- package/dist/builder/forge.js +570 -0
- package/dist/builder/gear.d.ts +60 -0
- package/dist/builder/gear.js +180 -0
- package/dist/builder/git.d.ts +21 -0
- package/dist/builder/git.js +118 -0
- package/dist/builder/gutter.d.ts +17 -0
- package/dist/builder/gutter.js +25 -0
- package/dist/builder/handoff.d.ts +8 -0
- package/dist/builder/handoff.js +22 -0
- package/dist/builder/host.d.ts +189 -0
- package/dist/builder/host.js +46 -0
- package/dist/builder/index.d.ts +108 -0
- package/dist/builder/index.js +99 -0
- package/dist/builder/landing.d.ts +34 -0
- package/dist/builder/landing.js +725 -0
- package/dist/builder/library.d.ts +21 -0
- package/dist/builder/library.js +526 -0
- package/dist/builder/local.d.ts +80 -0
- package/dist/builder/local.js +124 -0
- package/dist/builder/make.d.ts +10 -0
- package/dist/builder/make.js +120 -0
- package/dist/builder/markdown.d.ts +49 -0
- package/dist/builder/markdown.js +125 -0
- package/dist/builder/marks.d.ts +15 -0
- package/dist/builder/marks.js +18 -0
- package/dist/builder/merge.d.ts +223 -0
- package/dist/builder/merge.js +380 -0
- package/dist/builder/meter.d.ts +31 -0
- package/dist/builder/meter.js +54 -0
- package/dist/builder/mind.d.ts +107 -0
- package/dist/builder/mind.js +335 -0
- package/dist/builder/names.d.ts +40 -0
- package/dist/builder/names.js +189 -0
- package/dist/builder/nav.d.ts +28 -0
- package/dist/builder/nav.js +218 -0
- package/dist/builder/out.d.ts +16 -0
- package/dist/builder/out.js +24 -0
- package/dist/builder/page.d.ts +55 -0
- package/dist/builder/page.js +217 -0
- package/dist/builder/pane.d.ts +30 -0
- package/dist/builder/pane.js +21 -0
- package/dist/builder/panel.d.ts +101 -0
- package/dist/builder/panel.js +408 -0
- package/dist/builder/pdf.d.ts +139 -0
- package/dist/builder/pdf.js +847 -0
- package/dist/builder/pick.d.ts +10 -0
- package/dist/builder/pick.js +38 -0
- package/dist/builder/plain.d.ts +59 -0
- package/dist/builder/plain.js +209 -0
- package/dist/builder/plan.d.ts +63 -0
- package/dist/builder/plan.js +155 -0
- package/dist/builder/plans.d.ts +1 -0
- package/dist/builder/plans.js +157 -0
- package/dist/builder/plugin.d.ts +60 -0
- package/dist/builder/plugin.js +1 -0
- package/dist/builder/plugins/design.d.ts +8 -0
- package/dist/builder/plugins/design.js +71 -0
- package/dist/builder/plugins/index.d.ts +46 -0
- package/dist/builder/plugins/index.js +117 -0
- package/dist/builder/plugins/pdf.d.ts +18 -0
- package/dist/builder/plugins/pdf.js +83 -0
- package/dist/builder/plugins/project.d.ts +5 -0
- package/dist/builder/plugins/project.js +68 -0
- package/dist/builder/plugins/research.d.ts +24 -0
- package/dist/builder/plugins/research.js +147 -0
- package/dist/builder/plugins/sketch.d.ts +9 -0
- package/dist/builder/plugins/sketch.js +101 -0
- package/dist/builder/plugins/slides.d.ts +14 -0
- package/dist/builder/plugins/slides.js +55 -0
- package/dist/builder/plugins/template.d.ts +13 -0
- package/dist/builder/plugins/template.js +95 -0
- package/dist/builder/prefs.d.ts +29 -0
- package/dist/builder/prefs.js +91 -0
- package/dist/builder/preview-url.d.ts +47 -0
- package/dist/builder/preview-url.js +107 -0
- package/dist/builder/project.d.ts +18 -0
- package/dist/builder/project.js +591 -0
- package/dist/builder/prose.d.ts +4 -0
- package/dist/builder/prose.js +57 -0
- package/dist/builder/publish.d.ts +18 -0
- package/dist/builder/publish.js +141 -0
- package/dist/builder/question.d.ts +33 -0
- package/dist/builder/question.js +64 -0
- package/dist/builder/redesign.d.ts +32 -0
- package/dist/builder/redesign.js +117 -0
- package/dist/builder/removal.d.ts +71 -0
- package/dist/builder/removal.js +73 -0
- package/dist/builder/reply.d.ts +50 -0
- package/dist/builder/reply.js +196 -0
- package/dist/builder/roles.d.ts +10 -0
- package/dist/builder/roles.js +28 -0
- package/dist/builder/route.d.ts +85 -0
- package/dist/builder/route.js +126 -0
- package/dist/builder/run.d.ts +4 -0
- package/dist/builder/run.js +804 -0
- package/dist/builder/runmeta.d.ts +16 -0
- package/dist/builder/runmeta.js +69 -0
- package/dist/builder/say.d.ts +2 -0
- package/dist/builder/say.js +7 -0
- package/dist/builder/scheduled.d.ts +3 -0
- package/dist/builder/scheduled.js +328 -0
- package/dist/builder/section.d.ts +27 -0
- package/dist/builder/section.js +60 -0
- package/dist/builder/settings/account.d.ts +1 -0
- package/dist/builder/settings/account.js +111 -0
- package/dist/builder/settings/billing.d.ts +1 -0
- package/dist/builder/settings/billing.js +210 -0
- package/dist/builder/settings/capabilities.d.ts +1 -0
- package/dist/builder/settings/capabilities.js +66 -0
- package/dist/builder/settings/card.d.ts +31 -0
- package/dist/builder/settings/card.js +140 -0
- package/dist/builder/settings/code.d.ts +1 -0
- package/dist/builder/settings/code.js +70 -0
- package/dist/builder/settings/credits.d.ts +10 -0
- package/dist/builder/settings/credits.js +123 -0
- package/dist/builder/settings/environments.d.ts +1 -0
- package/dist/builder/settings/environments.js +60 -0
- package/dist/builder/settings/general.d.ts +1 -0
- package/dist/builder/settings/general.js +58 -0
- package/dist/builder/settings/index.d.ts +4 -0
- package/dist/builder/settings/index.js +25 -0
- package/dist/builder/settings/integrations.d.ts +8 -0
- package/dist/builder/settings/integrations.js +138 -0
- package/dist/builder/settings/keys.d.ts +1 -0
- package/dist/builder/settings/keys.js +114 -0
- package/dist/builder/settings/list.d.ts +10 -0
- package/dist/builder/settings/list.js +28 -0
- package/dist/builder/settings/machines.d.ts +4 -0
- package/dist/builder/settings/machines.js +243 -0
- package/dist/builder/settings/members.d.ts +1 -0
- package/dist/builder/settings/members.js +77 -0
- package/dist/builder/settings/memory.d.ts +1 -0
- package/dist/builder/settings/memory.js +62 -0
- package/dist/builder/settings/notifications.d.ts +1 -0
- package/dist/builder/settings/notifications.js +111 -0
- package/dist/builder/settings/plan.d.ts +17 -0
- package/dist/builder/settings/plan.js +131 -0
- package/dist/builder/settings/privacy.d.ts +1 -0
- package/dist/builder/settings/privacy.js +76 -0
- package/dist/builder/settings/sections.d.ts +16 -0
- package/dist/builder/settings/sections.js +34 -0
- package/dist/builder/settings/shared.d.ts +6 -0
- package/dist/builder/settings/shared.js +58 -0
- package/dist/builder/settings/ui.d.ts +50 -0
- package/dist/builder/settings/ui.js +53 -0
- package/dist/builder/settings/usage.d.ts +1 -0
- package/dist/builder/settings/usage.js +24 -0
- package/dist/builder/shared.d.ts +26 -0
- package/dist/builder/shared.js +15 -0
- package/dist/builder/shelf.d.ts +16 -0
- package/dist/builder/shelf.js +219 -0
- package/dist/builder/side.d.ts +40 -0
- package/dist/builder/side.js +208 -0
- package/dist/builder/site.d.ts +75 -0
- package/dist/builder/site.js +138 -0
- package/dist/builder/spend.d.ts +21 -0
- package/dist/builder/spend.js +80 -0
- package/dist/builder/standing.d.ts +36 -0
- package/dist/builder/standing.js +66 -0
- package/dist/builder/suggest.d.ts +238 -0
- package/dist/builder/suggest.js +463 -0
- package/dist/builder/suggestions.d.ts +49 -0
- package/dist/builder/suggestions.js +260 -0
- package/dist/builder/summary.d.ts +60 -0
- package/dist/builder/summary.js +81 -0
- package/dist/builder/sync.d.ts +1 -0
- package/dist/builder/sync.js +164 -0
- package/dist/builder/tabs.d.ts +85 -0
- package/dist/builder/tabs.js +288 -0
- package/dist/builder/talk.d.ts +5 -0
- package/dist/builder/talk.js +108 -0
- package/dist/builder/thread.d.ts +60 -0
- package/dist/builder/thread.js +302 -0
- package/dist/builder/tools.d.ts +22 -0
- package/dist/builder/tools.js +52 -0
- package/dist/builder/transcript.d.ts +47 -0
- package/dist/builder/transcript.js +108 -0
- package/dist/builder/voice.d.ts +8 -0
- package/dist/builder/voice.js +24 -0
- package/dist/{changedFileKind-DqgCCDUs.js → changedFileKind-D6QYvIez.js} +1 -1
- package/dist/core.js +1 -0
- package/dist/{decodeImagePreview-CesVZYP4.js → decodeImagePreview-DnfFEjhw.js} +1 -1
- package/dist/{embed-DYP-OUlb.js → embed-c030vUqM.js} +11 -11
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -1
- package/dist/{micromark-util-decode-string-NQjVkmZH.js → micromark-util-decode-string-C-5AXkOV.js} +5 -3
- package/dist/{readBinaryPreview-D2X4Uahu.js → readBinaryPreview-BAQ4fFjm.js} +1 -1
- package/dist/{useTextFieldSpeech-CyOZZPrV.js → useTextFieldSpeech-COa9XcRx.js} +1 -1
- package/package.json +101 -11
- /package/{index.d.ts → dist/core.d.ts} +0 -0
- /package/{keymap.d.ts → dist/keymap.d.ts} +0 -0
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The projects an organization works on and their issues, merged.
|
|
3
|
+
*
|
|
4
|
+
* A project is a repository: granted by the org's GitHub connection, mirrored
|
|
5
|
+
* onto the forge, or made there. The same repository arrives from several
|
|
6
|
+
* sources and is one row. An issue is read from the forge and from the task
|
|
7
|
+
* service's mirror of GitHub; the same issue (the same link) is one row with
|
|
8
|
+
* every source that carried it named.
|
|
9
|
+
*
|
|
10
|
+
* Which project an issue is for is the issue's own repository — the GitHub
|
|
11
|
+
* address its mirror records, or the forge repository it is filed on — and
|
|
12
|
+
* never the board it sits on: a board's key is not a repository.
|
|
13
|
+
*
|
|
14
|
+
* Pure: every function here takes rows and answers rows, so the screens and the
|
|
15
|
+
* tests share one reading of what is the same, what belongs where, and what
|
|
16
|
+
* comes first.
|
|
17
|
+
*/
|
|
18
|
+
export type Source = 'github' | 'forge' | 'linear' | 'agent' | 'board';
|
|
19
|
+
export interface Project {
|
|
20
|
+
/** `owner/name`, lower case: the one address every source is matched on. */
|
|
21
|
+
key: string;
|
|
22
|
+
owner: string;
|
|
23
|
+
name: string;
|
|
24
|
+
description: string;
|
|
25
|
+
/** Null when no source said. */
|
|
26
|
+
private: boolean | null;
|
|
27
|
+
/** The default branch, or '' when no source said. */
|
|
28
|
+
branch: string;
|
|
29
|
+
/** RFC 3339: the latest push, update or issue any source reports, or ''. */
|
|
30
|
+
activity: string;
|
|
31
|
+
/** Open issues, or null when the work could not be read. */
|
|
32
|
+
issues: number | null;
|
|
33
|
+
/** Open pull requests on the forge, or null when the work could not be read. */
|
|
34
|
+
pulls: number | null;
|
|
35
|
+
/** Granted by the org's GitHub connection. */
|
|
36
|
+
linked: boolean;
|
|
37
|
+
/** On the forge: mirrored from GitHub, or made there. */
|
|
38
|
+
mirrored: boolean;
|
|
39
|
+
/** The forge's own name for it, which is what a run and an environment name; '' when it is not known to be there. */
|
|
40
|
+
forge: string;
|
|
41
|
+
/** RFC 3339: when its link last synced, or ''. */
|
|
42
|
+
synced: string;
|
|
43
|
+
/** Its link's state: `synced`, `conflict`, `pending`, `paused`, `linked` when its forge copy could not be read; '' with no link. */
|
|
44
|
+
status: string;
|
|
45
|
+
/** The org's project (GET /v1/project) that builds from it, by slug, or ''. */
|
|
46
|
+
slug: string;
|
|
47
|
+
/** The name GitHub's listing says it takes on the forge once brought there, or ''. */
|
|
48
|
+
codebase: string;
|
|
49
|
+
/** Its page on GitHub, or ''. */
|
|
50
|
+
url: string;
|
|
51
|
+
}
|
|
52
|
+
export interface Issue {
|
|
53
|
+
/** What makes two rows the same issue: its link, else its handle on its board, else its id. */
|
|
54
|
+
key: string;
|
|
55
|
+
/** `owner/name` of the repository it is filed on, once known; '' until then. */
|
|
56
|
+
repo: string;
|
|
57
|
+
/** The forge repository a forge row is filed on, by name; ''. */
|
|
58
|
+
forge: string;
|
|
59
|
+
/** What an index row says its repository is, unchecked: a run's repo, or a Linear team's key. Resolved, never used raw. */
|
|
60
|
+
hint: string;
|
|
61
|
+
number: number;
|
|
62
|
+
title: string;
|
|
63
|
+
body: string;
|
|
64
|
+
state: 'open' | 'closed';
|
|
65
|
+
labels: string[];
|
|
66
|
+
assignees: string[];
|
|
67
|
+
/** The issue's own page, https only, or ''. */
|
|
68
|
+
url: string;
|
|
69
|
+
sources: Source[];
|
|
70
|
+
/** RFC 3339, or ''. */
|
|
71
|
+
updated: string;
|
|
72
|
+
/** RFC 3339: when it was opened, or ''. */
|
|
73
|
+
created: string;
|
|
74
|
+
/** What the task service files it as: `issue`, `pr`, `task`, `bug`, … */
|
|
75
|
+
kind: string;
|
|
76
|
+
/** The board's column for it as the task service names it: `backlog`, `todo`, `in_progress`, `done`, `canceled`, or its own word. */
|
|
77
|
+
status: string;
|
|
78
|
+
/** `none` unless the board says otherwise. */
|
|
79
|
+
priority: string;
|
|
80
|
+
/** A pull request, not an issue. */
|
|
81
|
+
pull: boolean;
|
|
82
|
+
/** The board it was read from. Shown, filtered on, never resolved as a repository. */
|
|
83
|
+
board: string;
|
|
84
|
+
}
|
|
85
|
+
/** `owner/name` as one key, whatever case either source used. */
|
|
86
|
+
export declare const keyOf: (owner: string, name: string) => string;
|
|
87
|
+
/**
|
|
88
|
+
* An issue's link as one key: https only, no query or fragment, no trailing
|
|
89
|
+
* slash, lower case. The same issue read twice has the same key.
|
|
90
|
+
*/
|
|
91
|
+
export declare function canon(url: string): string;
|
|
92
|
+
/** The repository and number a GitHub or forge issue link names, or null. */
|
|
93
|
+
export declare function parse(url: string): {
|
|
94
|
+
repo: string;
|
|
95
|
+
number: number;
|
|
96
|
+
pull: boolean;
|
|
97
|
+
} | null;
|
|
98
|
+
/** Whether every word of `q` is somewhere in `text`. */
|
|
99
|
+
export declare function matches(q: string, ...text: string[]): boolean;
|
|
100
|
+
/** A repository GitHub's listing grants, in the fields a project takes from it. */
|
|
101
|
+
export interface Granted {
|
|
102
|
+
owner: string;
|
|
103
|
+
name: string;
|
|
104
|
+
private: boolean;
|
|
105
|
+
default_branch: string;
|
|
106
|
+
pushed_at: string;
|
|
107
|
+
codebase: string;
|
|
108
|
+
}
|
|
109
|
+
/** A repository the forge lists, in the fields a project takes from it. */
|
|
110
|
+
export interface Held {
|
|
111
|
+
org: string;
|
|
112
|
+
name: string;
|
|
113
|
+
description: string;
|
|
114
|
+
branch: string;
|
|
115
|
+
public: boolean;
|
|
116
|
+
updated: string;
|
|
117
|
+
}
|
|
118
|
+
/** A repository linked from GitHub (GET /v1/sync), in the fields a project takes from it. */
|
|
119
|
+
export interface Linked {
|
|
120
|
+
owner: string;
|
|
121
|
+
name: string;
|
|
122
|
+
forge: string;
|
|
123
|
+
synced: string;
|
|
124
|
+
status: string;
|
|
125
|
+
branch: string;
|
|
126
|
+
}
|
|
127
|
+
/** One of the org's projects (GET /v1/project) that builds from a repository. */
|
|
128
|
+
export interface Site {
|
|
129
|
+
slug: string;
|
|
130
|
+
/** Its clone address. */
|
|
131
|
+
repo: string;
|
|
132
|
+
branch: string;
|
|
133
|
+
/** RFC 3339, or ''. */
|
|
134
|
+
updated: string;
|
|
135
|
+
}
|
|
136
|
+
/** The account and repository an https clone address names, and whether the host is GitHub. */
|
|
137
|
+
export declare function addressOf(url: string): {
|
|
138
|
+
owner: string;
|
|
139
|
+
name: string;
|
|
140
|
+
github: boolean;
|
|
141
|
+
} | null;
|
|
142
|
+
/**
|
|
143
|
+
* The project an issue is for, or null. Its GitHub address first, then the
|
|
144
|
+
* forge repository it is filed on, then what an index row says — matched
|
|
145
|
+
* against the org's own projects, an `owner/name` exactly, a bare name only when
|
|
146
|
+
* one project answers to it. A board's key is never consulted.
|
|
147
|
+
*/
|
|
148
|
+
export declare function place(i: Pick<Issue, 'repo' | 'forge' | 'hint'>, list: Project[]): Project | null;
|
|
149
|
+
/** Whether a clone address is the forge's own. */
|
|
150
|
+
export declare function forgeHost(url: string): boolean;
|
|
151
|
+
/** What the org's projects are assembled from. */
|
|
152
|
+
export interface Parts {
|
|
153
|
+
/** GitHub's grants to the org's connection: empty for anyone it does not answer. */
|
|
154
|
+
granted?: Granted[];
|
|
155
|
+
/** The repositories linked from GitHub, each with its forge copy. */
|
|
156
|
+
linked?: Linked[];
|
|
157
|
+
/** The forge's repositories. */
|
|
158
|
+
held?: Held[];
|
|
159
|
+
/** The org's projects that build from a repository. */
|
|
160
|
+
sites?: Site[];
|
|
161
|
+
/** Every issue and pull request, or null when they were not read. */
|
|
162
|
+
work?: Issue[] | null;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Every project the org works on, one row per repository: the repositories it
|
|
166
|
+
* linked from GitHub, GitHub's grants, the forge's repositories and the ones its
|
|
167
|
+
* issues are filed on, and the org's projects that build from one — each with
|
|
168
|
+
* its open work counted from `work` (null counts when the work was not read).
|
|
169
|
+
*
|
|
170
|
+
* A forge repository is the GitHub one it copies when a link targets it, when
|
|
171
|
+
* GitHub names it as that repository's `codebase`, or when it sits in a forge
|
|
172
|
+
* namespace named like the GitHub owner (an issue's link says which namespace).
|
|
173
|
+
*/
|
|
174
|
+
export declare function assemble({ granted, linked, held, sites, work }: Parts): Project[];
|
|
175
|
+
/** Each issue with the project it is for named as its `repo`, where one answers. */
|
|
176
|
+
export declare function attach(list: Issue[], projects: Project[]): Issue[];
|
|
177
|
+
/** Most recent activity first; the unknown last; the address breaks a tie, so the order never shuffles. */
|
|
178
|
+
export declare function byActivity(a: Project, b: Project): number;
|
|
179
|
+
export interface ProjectFilter {
|
|
180
|
+
q?: string;
|
|
181
|
+
/** One owner, or '' for every one. */
|
|
182
|
+
owner?: string;
|
|
183
|
+
/** Only those with an open issue or pull request. */
|
|
184
|
+
open?: boolean;
|
|
185
|
+
}
|
|
186
|
+
export declare function pickProjects(list: Project[], f?: ProjectFilter): Project[];
|
|
187
|
+
/** The owners named, once each whatever the case, in name order. */
|
|
188
|
+
export declare function owners(...names: string[][]): string[];
|
|
189
|
+
/**
|
|
190
|
+
* One row per issue. The same issue read from several sources is the row the
|
|
191
|
+
* most recently updated one describes, with every source named and every label
|
|
192
|
+
* and assignee any of them carries.
|
|
193
|
+
*/
|
|
194
|
+
export declare function issues(...lists: Issue[][]): Issue[];
|
|
195
|
+
/** Every label and assignee the list carries, for its filters, in name order. */
|
|
196
|
+
export declare function facets(list: Issue[]): {
|
|
197
|
+
labels: string[];
|
|
198
|
+
assignees: string[];
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* Where a run on issue `i` works, on project `p`: where the issue lives, so the
|
|
202
|
+
* run's pull request is opened beside it. A GitHub issue's run works on GitHub
|
|
203
|
+
* (a linked project's forge copy is the forge's own repository, and a pull
|
|
204
|
+
* request there would not reach GitHub's issue); a forge issue's on the forge.
|
|
205
|
+
* Any other issue (a Linear or a board's row) works wherever the project can be
|
|
206
|
+
* worked on: its forge copy, else GitHub. Null when the project is neither.
|
|
207
|
+
*/
|
|
208
|
+
export declare function home(i: Pick<Issue, 'sources'>, p: Pick<Project, 'linked' | 'forge'>): 'github' | 'forge' | null;
|
|
209
|
+
/**
|
|
210
|
+
* The number a run on `p` closes for issue `i`, or 0: the issue's own number,
|
|
211
|
+
* when the run works where the issue lives. A board's or Linear's number closes
|
|
212
|
+
* nothing, and neither does a GitHub issue run on the forge, or the reverse.
|
|
213
|
+
*/
|
|
214
|
+
export declare function closes(i: Pick<Issue, 'sources' | 'number'>, p: Pick<Project, 'linked' | 'forge'>): number;
|
|
215
|
+
/** How a person refers to an issue: `#N` where N is the repository's own number, else the board's handle. */
|
|
216
|
+
export declare function handle(i: Pick<Issue, 'sources' | 'number' | 'board'>): string;
|
|
217
|
+
/**
|
|
218
|
+
* What New's composer holds for an issue: its title and handle, its link, and
|
|
219
|
+
* its body — the ask a person would write. `#N` only when the run closes N; any
|
|
220
|
+
* other number is the board's (`LINEAR-5`), so the agent cannot mistake it for
|
|
221
|
+
* an issue on the repository it works on.
|
|
222
|
+
*/
|
|
223
|
+
export declare function ask(i: Pick<Issue, 'title' | 'number' | 'url' | 'body' | 'board' | 'sources'>, closing?: number): string;
|
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The projects an organization works on and their issues, merged.
|
|
3
|
+
*
|
|
4
|
+
* A project is a repository: granted by the org's GitHub connection, mirrored
|
|
5
|
+
* onto the forge, or made there. The same repository arrives from several
|
|
6
|
+
* sources and is one row. An issue is read from the forge and from the task
|
|
7
|
+
* service's mirror of GitHub; the same issue (the same link) is one row with
|
|
8
|
+
* every source that carried it named.
|
|
9
|
+
*
|
|
10
|
+
* Which project an issue is for is the issue's own repository — the GitHub
|
|
11
|
+
* address its mirror records, or the forge repository it is filed on — and
|
|
12
|
+
* never the board it sits on: a board's key is not a repository.
|
|
13
|
+
*
|
|
14
|
+
* Pure: every function here takes rows and answers rows, so the screens and the
|
|
15
|
+
* tests share one reading of what is the same, what belongs where, and what
|
|
16
|
+
* comes first.
|
|
17
|
+
*/
|
|
18
|
+
/** `owner/name` as one key, whatever case either source used. */
|
|
19
|
+
export const keyOf = (owner, name) => (owner && name ? `${owner}/${name}`.toLowerCase() : '');
|
|
20
|
+
const time = (iso) => {
|
|
21
|
+
const t = Date.parse(iso);
|
|
22
|
+
return Number.isFinite(t) ? t : 0;
|
|
23
|
+
};
|
|
24
|
+
const later = (a, b) => (time(b) > time(a) ? b : a);
|
|
25
|
+
/**
|
|
26
|
+
* An issue's link as one key: https only, no query or fragment, no trailing
|
|
27
|
+
* slash, lower case. The same issue read twice has the same key.
|
|
28
|
+
*/
|
|
29
|
+
export function canon(url) {
|
|
30
|
+
try {
|
|
31
|
+
const u = new URL(url);
|
|
32
|
+
if (u.protocol !== 'https:')
|
|
33
|
+
return '';
|
|
34
|
+
return `https://${u.host}${u.pathname.replace(/\/+$/, '')}`.toLowerCase();
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return '';
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/** The repository and number a GitHub or forge issue link names, or null. */
|
|
41
|
+
export function parse(url) {
|
|
42
|
+
const m = canon(url).match(/^https:\/\/[^/]+\/([^/]+)\/([^/]+)\/(issues|pull|pulls)\/(\d+)$/);
|
|
43
|
+
return m ? { repo: `${m[1]}/${m[2]}`, number: Number(m[4]), pull: m[3] !== 'issues' } : null;
|
|
44
|
+
}
|
|
45
|
+
/** Whether every word of `q` is somewhere in `text`. */
|
|
46
|
+
export function matches(q, ...text) {
|
|
47
|
+
const words = q.trim().toLowerCase().split(/\s+/).filter(Boolean);
|
|
48
|
+
if (!words.length)
|
|
49
|
+
return true;
|
|
50
|
+
const hay = text.join(' ').toLowerCase();
|
|
51
|
+
return words.every((w) => hay.includes(w));
|
|
52
|
+
}
|
|
53
|
+
/** The account and repository an https clone address names, and whether the host is GitHub. */
|
|
54
|
+
export function addressOf(url) {
|
|
55
|
+
try {
|
|
56
|
+
const u = new URL(url.trim());
|
|
57
|
+
if (u.protocol !== 'https:')
|
|
58
|
+
return null;
|
|
59
|
+
const parts = u.pathname.replace(/\.git$/, '').split('/').filter(Boolean);
|
|
60
|
+
if (parts.length < 2)
|
|
61
|
+
return null;
|
|
62
|
+
const github = u.hostname.toLowerCase() === 'github.com';
|
|
63
|
+
if (github && parts.length !== 2)
|
|
64
|
+
return null;
|
|
65
|
+
return { owner: parts[parts.length - 2], name: parts[parts.length - 1], github };
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const blank = (owner, name) => ({
|
|
72
|
+
key: keyOf(owner, name),
|
|
73
|
+
owner,
|
|
74
|
+
name,
|
|
75
|
+
description: '',
|
|
76
|
+
private: null,
|
|
77
|
+
branch: '',
|
|
78
|
+
activity: '',
|
|
79
|
+
issues: null,
|
|
80
|
+
pulls: null,
|
|
81
|
+
linked: false,
|
|
82
|
+
mirrored: false,
|
|
83
|
+
forge: '',
|
|
84
|
+
synced: '',
|
|
85
|
+
status: '',
|
|
86
|
+
slug: '',
|
|
87
|
+
codebase: '',
|
|
88
|
+
url: '',
|
|
89
|
+
});
|
|
90
|
+
/**
|
|
91
|
+
* The project an issue is for, or null. Its GitHub address first, then the
|
|
92
|
+
* forge repository it is filed on, then what an index row says — matched
|
|
93
|
+
* against the org's own projects, an `owner/name` exactly, a bare name only when
|
|
94
|
+
* one project answers to it. A board's key is never consulted.
|
|
95
|
+
*/
|
|
96
|
+
export function place(i, list) {
|
|
97
|
+
if (i.repo)
|
|
98
|
+
return list.find((p) => p.key === i.repo.toLowerCase()) ?? null;
|
|
99
|
+
if (i.forge) {
|
|
100
|
+
const f = i.forge.toLowerCase();
|
|
101
|
+
return list.find((p) => p.forge.toLowerCase() === f) ?? list.find((p) => p.codebase === f) ?? null;
|
|
102
|
+
}
|
|
103
|
+
const hint = i.hint
|
|
104
|
+
.trim()
|
|
105
|
+
.toLowerCase()
|
|
106
|
+
.replace(/^(https?:\/\/)?github\.com\//, '')
|
|
107
|
+
.replace(/\.git$/, '');
|
|
108
|
+
if (!hint)
|
|
109
|
+
return null;
|
|
110
|
+
if (hint.includes('/'))
|
|
111
|
+
return list.find((p) => p.key === hint) ?? null;
|
|
112
|
+
const named = list.filter((p) => p.forge.toLowerCase() === hint || p.codebase === hint || p.name.toLowerCase() === hint);
|
|
113
|
+
return named.length === 1 ? named[0] : null;
|
|
114
|
+
}
|
|
115
|
+
/** Whether a clone address is the forge's own. */
|
|
116
|
+
export function forgeHost(url) {
|
|
117
|
+
try {
|
|
118
|
+
const u = new URL(url);
|
|
119
|
+
return u.protocol === 'https:' && (u.hostname.toLowerCase() === 'git.hanzo.ai' || u.pathname.startsWith('/v1/git/'));
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Every project the org works on, one row per repository: the repositories it
|
|
127
|
+
* linked from GitHub, GitHub's grants, the forge's repositories and the ones its
|
|
128
|
+
* issues are filed on, and the org's projects that build from one — each with
|
|
129
|
+
* its open work counted from `work` (null counts when the work was not read).
|
|
130
|
+
*
|
|
131
|
+
* A forge repository is the GitHub one it copies when a link targets it, when
|
|
132
|
+
* GitHub names it as that repository's `codebase`, or when it sits in a forge
|
|
133
|
+
* namespace named like the GitHub owner (an issue's link says which namespace).
|
|
134
|
+
*/
|
|
135
|
+
export function assemble({ granted = [], linked = [], held = [], sites = [], work = null }) {
|
|
136
|
+
const out = new Map();
|
|
137
|
+
// Each project by its forge name and by its codebase name, kept as it is put, so a forge row finds its own in one look.
|
|
138
|
+
const byForge = new Map();
|
|
139
|
+
const byCodebase = new Map();
|
|
140
|
+
const put = (p) => {
|
|
141
|
+
if (!p.key)
|
|
142
|
+
return;
|
|
143
|
+
out.set(p.key, p);
|
|
144
|
+
if (p.forge)
|
|
145
|
+
byForge.set(p.forge.toLowerCase(), p.key);
|
|
146
|
+
if (p.codebase)
|
|
147
|
+
byCodebase.set(p.codebase, p.key);
|
|
148
|
+
};
|
|
149
|
+
const at = (owner, name) => out.get(keyOf(owner, name)) ?? blank(owner, name);
|
|
150
|
+
for (const l of linked) {
|
|
151
|
+
const p = at(l.owner, l.name);
|
|
152
|
+
put({
|
|
153
|
+
...p,
|
|
154
|
+
branch: p.branch || l.branch,
|
|
155
|
+
activity: later(p.activity, l.synced),
|
|
156
|
+
linked: true,
|
|
157
|
+
mirrored: p.mirrored || (l.forge !== '' && l.status !== 'pending'),
|
|
158
|
+
forge: p.forge || (l.status === 'pending' ? '' : l.forge),
|
|
159
|
+
synced: later(p.synced, l.synced),
|
|
160
|
+
// A link whose forge copy could not be read says only that it is linked.
|
|
161
|
+
status: l.status || 'linked',
|
|
162
|
+
url: `https://github.com/${l.owner}/${l.name}`,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
for (const g of granted) {
|
|
166
|
+
const p = at(g.owner, g.name);
|
|
167
|
+
put({
|
|
168
|
+
...p,
|
|
169
|
+
private: g.private,
|
|
170
|
+
branch: p.branch || g.default_branch,
|
|
171
|
+
activity: later(p.activity, g.pushed_at),
|
|
172
|
+
linked: true,
|
|
173
|
+
codebase: g.codebase.toLowerCase(),
|
|
174
|
+
url: `https://github.com/${g.owner}/${g.name}`,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
const all = () => [...out.values()];
|
|
178
|
+
// Forge namespaces, as the forge's own issue links spell them.
|
|
179
|
+
const spaces = new Set();
|
|
180
|
+
for (const i of work ?? []) {
|
|
181
|
+
const where = i.forge ? parse(i.url) : null;
|
|
182
|
+
if (where)
|
|
183
|
+
spaces.add(where.repo.split('/')[0].toLowerCase());
|
|
184
|
+
}
|
|
185
|
+
const named = (key) => (key ? out.get(key) : undefined);
|
|
186
|
+
const onForge = (name, owner) => {
|
|
187
|
+
const n = name.toLowerCase();
|
|
188
|
+
return (named(byForge.get(n)) ??
|
|
189
|
+
named(byCodebase.get(n)) ??
|
|
190
|
+
[...spaces].map((space) => out.get(keyOf(space, name))).find((p) => p !== undefined) ??
|
|
191
|
+
at(owner, name));
|
|
192
|
+
};
|
|
193
|
+
for (const h of held) {
|
|
194
|
+
const p = onForge(h.name, h.org);
|
|
195
|
+
put({
|
|
196
|
+
...p,
|
|
197
|
+
description: p.description || h.description,
|
|
198
|
+
// A linked repository's visibility is GitHub's own, never its forge copy's: unknown until GitHub says.
|
|
199
|
+
private: p.linked ? p.private : (p.private ?? !h.public),
|
|
200
|
+
branch: p.branch || h.branch,
|
|
201
|
+
activity: later(p.activity, h.updated),
|
|
202
|
+
mirrored: true,
|
|
203
|
+
// A link's copy keeps its own name: a forge repository of the same address is not it.
|
|
204
|
+
forge: p.forge || h.name,
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
for (const i of work ?? []) {
|
|
208
|
+
if (!i.forge)
|
|
209
|
+
continue;
|
|
210
|
+
const where = parse(i.url);
|
|
211
|
+
const p = onForge(i.forge, where ? where.repo.split('/')[0] : '');
|
|
212
|
+
put({ ...p, mirrored: true, forge: p.forge || i.forge });
|
|
213
|
+
}
|
|
214
|
+
for (const site of sites) {
|
|
215
|
+
const where = addressOf(site.repo);
|
|
216
|
+
// GitHub's, or the forge's own (git.hanzo.ai, or the platform's /v1/git); a site built from anywhere else is not a project here.
|
|
217
|
+
if (!where || (!where.github && !forgeHost(site.repo)))
|
|
218
|
+
continue;
|
|
219
|
+
const p = where.github ? at(where.owner, where.name) : onForge(where.name, where.owner);
|
|
220
|
+
put({
|
|
221
|
+
...p,
|
|
222
|
+
branch: p.branch || site.branch,
|
|
223
|
+
activity: later(p.activity, site.updated),
|
|
224
|
+
linked: p.linked || where.github,
|
|
225
|
+
mirrored: p.mirrored || !where.github,
|
|
226
|
+
forge: p.forge || (where.github ? '' : where.name),
|
|
227
|
+
slug: p.slug || site.slug,
|
|
228
|
+
url: p.url || (where.github ? `https://github.com/${where.owner}/${where.name}` : ''),
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
if (work) {
|
|
232
|
+
const counted = new Map();
|
|
233
|
+
const list = all();
|
|
234
|
+
for (const i of work) {
|
|
235
|
+
const p = place(i, list);
|
|
236
|
+
if (!p)
|
|
237
|
+
continue;
|
|
238
|
+
const c = counted.get(p.key) ?? { issues: 0, pulls: 0, last: '' };
|
|
239
|
+
if (i.state === 'open' && i.pull)
|
|
240
|
+
c.pulls++;
|
|
241
|
+
else if (i.state === 'open')
|
|
242
|
+
c.issues++;
|
|
243
|
+
c.last = later(c.last, i.updated);
|
|
244
|
+
counted.set(p.key, c);
|
|
245
|
+
}
|
|
246
|
+
for (const p of list) {
|
|
247
|
+
const c = counted.get(p.key);
|
|
248
|
+
put({ ...p, issues: c?.issues ?? 0, pulls: c?.pulls ?? 0, activity: later(p.activity, c?.last ?? '') });
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return all();
|
|
252
|
+
}
|
|
253
|
+
/** Each issue with the project it is for named as its `repo`, where one answers. */
|
|
254
|
+
export function attach(list, projects) {
|
|
255
|
+
return list.map((i) => {
|
|
256
|
+
const p = place(i, projects);
|
|
257
|
+
return p ? { ...i, repo: `${p.owner}/${p.name}` } : i;
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
/** Most recent activity first; the unknown last; the address breaks a tie, so the order never shuffles. */
|
|
261
|
+
export function byActivity(a, b) {
|
|
262
|
+
return time(b.activity) - time(a.activity) || a.key.localeCompare(b.key);
|
|
263
|
+
}
|
|
264
|
+
export function pickProjects(list, f = {}) {
|
|
265
|
+
return list
|
|
266
|
+
.filter((p) => !f.owner || p.owner.toLowerCase() === f.owner.toLowerCase())
|
|
267
|
+
.filter((p) => !f.open || (p.issues ?? 0) + (p.pulls ?? 0) > 0)
|
|
268
|
+
.filter((p) => matches(f.q ?? '', `${p.owner}/${p.name}`, p.description))
|
|
269
|
+
.sort(byActivity);
|
|
270
|
+
}
|
|
271
|
+
/** The owners named, once each whatever the case, in name order. */
|
|
272
|
+
export function owners(...names) {
|
|
273
|
+
const seen = new Map();
|
|
274
|
+
for (const n of names.flat())
|
|
275
|
+
if (n && !seen.has(n.toLowerCase()))
|
|
276
|
+
seen.set(n.toLowerCase(), n);
|
|
277
|
+
return [...seen.values()].sort((a, b) => a.localeCompare(b));
|
|
278
|
+
}
|
|
279
|
+
const union = (a, b) => {
|
|
280
|
+
const out = [...a];
|
|
281
|
+
const have = new Set(a.map((x) => x.toLowerCase()));
|
|
282
|
+
for (const x of b) {
|
|
283
|
+
if (have.has(x.toLowerCase()))
|
|
284
|
+
continue;
|
|
285
|
+
have.add(x.toLowerCase());
|
|
286
|
+
out.push(x);
|
|
287
|
+
}
|
|
288
|
+
return out;
|
|
289
|
+
};
|
|
290
|
+
/**
|
|
291
|
+
* One row per issue. The same issue read from several sources is the row the
|
|
292
|
+
* most recently updated one describes, with every source named and every label
|
|
293
|
+
* and assignee any of them carries.
|
|
294
|
+
*/
|
|
295
|
+
export function issues(...lists) {
|
|
296
|
+
const out = new Map();
|
|
297
|
+
for (const i of lists.flat()) {
|
|
298
|
+
if (!i.key)
|
|
299
|
+
continue;
|
|
300
|
+
const had = out.get(i.key);
|
|
301
|
+
if (!had) {
|
|
302
|
+
out.set(i.key, { ...i, sources: [...new Set(i.sources)] });
|
|
303
|
+
continue;
|
|
304
|
+
}
|
|
305
|
+
const [lead, rest] = time(i.updated) > time(had.updated) ? [i, had] : [had, i];
|
|
306
|
+
out.set(i.key, {
|
|
307
|
+
...lead,
|
|
308
|
+
repo: lead.repo || rest.repo,
|
|
309
|
+
forge: lead.forge || rest.forge,
|
|
310
|
+
hint: lead.hint || rest.hint,
|
|
311
|
+
number: lead.number || rest.number,
|
|
312
|
+
title: lead.title || rest.title,
|
|
313
|
+
body: lead.body || rest.body,
|
|
314
|
+
url: lead.url || rest.url,
|
|
315
|
+
board: lead.board || rest.board,
|
|
316
|
+
labels: union(lead.labels, rest.labels),
|
|
317
|
+
assignees: union(lead.assignees, rest.assignees),
|
|
318
|
+
sources: [...new Set([...had.sources, ...i.sources])],
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
return [...out.values()];
|
|
322
|
+
}
|
|
323
|
+
/** Every label and assignee the list carries, for its filters, in name order. */
|
|
324
|
+
export function facets(list) {
|
|
325
|
+
const order = (a, b) => a.localeCompare(b);
|
|
326
|
+
return {
|
|
327
|
+
labels: list.reduce((acc, i) => union(acc, i.labels), []).sort(order),
|
|
328
|
+
assignees: list.reduce((acc, i) => union(acc, i.assignees), []).sort(order),
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Where a run on issue `i` works, on project `p`: where the issue lives, so the
|
|
333
|
+
* run's pull request is opened beside it. A GitHub issue's run works on GitHub
|
|
334
|
+
* (a linked project's forge copy is the forge's own repository, and a pull
|
|
335
|
+
* request there would not reach GitHub's issue); a forge issue's on the forge.
|
|
336
|
+
* Any other issue (a Linear or a board's row) works wherever the project can be
|
|
337
|
+
* worked on: its forge copy, else GitHub. Null when the project is neither.
|
|
338
|
+
*/
|
|
339
|
+
export function home(i, p) {
|
|
340
|
+
if (i.sources.includes('github') && p.linked)
|
|
341
|
+
return 'github';
|
|
342
|
+
if (i.sources.includes('forge') && p.forge)
|
|
343
|
+
return 'forge';
|
|
344
|
+
return p.forge ? 'forge' : p.linked ? 'github' : null;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* The number a run on `p` closes for issue `i`, or 0: the issue's own number,
|
|
348
|
+
* when the run works where the issue lives. A board's or Linear's number closes
|
|
349
|
+
* nothing, and neither does a GitHub issue run on the forge, or the reverse.
|
|
350
|
+
*/
|
|
351
|
+
export function closes(i, p) {
|
|
352
|
+
if (i.number <= 0)
|
|
353
|
+
return 0;
|
|
354
|
+
const at = home(i, p);
|
|
355
|
+
if (at === 'github' && i.sources.includes('github'))
|
|
356
|
+
return i.number;
|
|
357
|
+
if (at === 'forge' && i.sources.includes('forge'))
|
|
358
|
+
return i.number;
|
|
359
|
+
return 0;
|
|
360
|
+
}
|
|
361
|
+
/** How a person refers to an issue: `#N` where N is the repository's own number, else the board's handle. */
|
|
362
|
+
export function handle(i) {
|
|
363
|
+
if (!i.number)
|
|
364
|
+
return '';
|
|
365
|
+
if (i.sources.includes('github') || i.sources.includes('forge'))
|
|
366
|
+
return `#${i.number}`;
|
|
367
|
+
return i.board ? `${i.board}-${i.number}` : '';
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* What New's composer holds for an issue: its title and handle, its link, and
|
|
371
|
+
* its body — the ask a person would write. `#N` only when the run closes N; any
|
|
372
|
+
* other number is the board's (`LINEAR-5`), so the agent cannot mistake it for
|
|
373
|
+
* an issue on the repository it works on.
|
|
374
|
+
*/
|
|
375
|
+
export function ask(i, closing = 0) {
|
|
376
|
+
const tag = closing ? `#${closing}` : i.board && i.number ? `${i.board}-${i.number}` : '';
|
|
377
|
+
const head = tag ? `${i.title} (${tag})` : i.title;
|
|
378
|
+
const body = i.body.trim();
|
|
379
|
+
return [head, i.url, body ? `\n${body}` : ''].filter(Boolean).join('\n');
|
|
380
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Read } from './data.ts';
|
|
2
|
+
import { type Standing } from './standing.ts';
|
|
3
|
+
import { type Label } from './plan.ts';
|
|
4
|
+
/** The ink a share is said in: quiet until it is close, and the one red when it is used. */
|
|
5
|
+
export declare const INK: {
|
|
6
|
+
readonly ok: '$soft';
|
|
7
|
+
readonly near: '$yellow10';
|
|
8
|
+
readonly limited: '$red10';
|
|
9
|
+
};
|
|
10
|
+
/** A plan's name with its rung beside it, small: `Max` `20x`. A family's name is a name; Free and the like are words. */
|
|
11
|
+
export declare function Title({ label, size }: {
|
|
12
|
+
label: Label;
|
|
13
|
+
size?: '$3' | '$5' | '$6';
|
|
14
|
+
}): import("react").JSX.Element;
|
|
15
|
+
/** The standing, drawn: what `Meter` shows once it has read. */
|
|
16
|
+
export declare function Reading({ s, onPlans, onBilling, now }: {
|
|
17
|
+
s: Standing;
|
|
18
|
+
onPlans: () => void;
|
|
19
|
+
onBilling: () => void;
|
|
20
|
+
now?: number;
|
|
21
|
+
}): import("react").JSX.Element;
|
|
22
|
+
/**
|
|
23
|
+
* The block an account menu leads with: `read` is `useStanding`, asked while
|
|
24
|
+
* the menu is open. `onPlans` opens the plans and `onBilling` the page credits
|
|
25
|
+
* live on; the host says where each is.
|
|
26
|
+
*/
|
|
27
|
+
export declare function Meter({ read, onPlans, onBilling }: {
|
|
28
|
+
read: Read<Standing | null>;
|
|
29
|
+
onPlans: () => void;
|
|
30
|
+
onBilling: () => void;
|
|
31
|
+
}): import("react").JSX.Element;
|