cornfield 0.31.0 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/core/strings.js +5 -4
- package/explorer/deep-link.js +1 -1
- package/explorer/explorer.css +57 -13
- package/explorer/file-url.js +40 -0
- package/explorer/forge-panel-model.js +1 -1
- package/explorer/forge-panel.js +276 -61
- package/explorer/index.html +44 -34
- package/explorer/main.js +1 -0
- package/explorer/panels.js +13 -9
- package/explorer/proposal-model.js +42 -0
- package/explorer/proposal.js +17 -1
- package/explorer/runs-model.js +15 -0
- package/explorer/state.js +2 -0
- package/package.json +1 -1
- package/server/server.js +1 -1
package/README.md
CHANGED
|
@@ -41,9 +41,9 @@ ssh -L 3350:127.0.0.1:3350 you@the-machine
|
|
|
41
41
|
- **The map.** WebGL2 (Canvas 2D fallback), 5,000 nodes and 15,000 edges at frame rate. Orbit, data-flow and House views, layers, search, focus, freeform drag. `/?fixture=5k&bench=1` measures it. All of it works by keyboard, and a screen reader is told where you are: [docs/accessibility.md](docs/accessibility.md).
|
|
42
42
|
- **Derived, not drawn by hand.** `cornfield sync` runs the derivers named in your config and merges what they find into `topology.json`; hand-written parts (descriptions, flows, anything of a type no deriver owns) are kept. `cornfield validate` fails on drift, so CI keeps the map honest.
|
|
43
43
|
- **Proposals.** `docs/specs/proposals/NNNN-slug.json` says what a change would add, change and remove, with scenarios. cornfield lists them from your checkout, from every git worktree in the configured worktrees folder and, with sign-in, from your open spec PRs, and shows Before / Diff / After, the scenario player, what-if edits, and Approve / Send back. Writing, reviewing and landing one in your repo: [docs/proposals.md](docs/proposals.md). The format and its validator: [core/proposal.js](core/proposal.js).
|
|
44
|
-
- **Issues and pull requests.** With a forge in the config and sign-in, a panel of its pull requests and issues (GitHub; Forgejo behind the same interface), with filters. Select a pull request and the nodes its files are light up on the map, and a failing check lights the tests it names. A Deploys list reads the forge's workflow runs and lights what a selected deploy restarted, from a mapping in the config ([docs/deploys.md](docs/deploys.md)). A maintainer can land a green pull request, re-run a failed check, start a spec on an issue and open the build issue of an approved spec, each one button with a confirm step. A bottom sheet on a phone. A **Release notes
|
|
44
|
+
- **Issues and pull requests.** With a forge in the config and sign-in, a panel of its pull requests and issues (GitHub; Forgejo behind the same interface), with filters. Select a pull request and the nodes its files are light up on the map, and a failing check lights the tests it names. A Deploys list reads the forge's workflow runs and lights what a selected deploy restarted, from a mapping in the config ([docs/deploys.md](docs/deploys.md)). A maintainer can land a green pull request, re-run a failed check, start a spec on an issue and open the build issue of an approved spec, each one button with a confirm step. A bottom sheet on a phone. A **Release notes …** action on the PRs list drafts the notes from the pull requests merged since the last tag, grouped by what they changed on the map, to copy or to post as a draft release (never published); `cornfield notes` prints the same Markdown. [docs/issues-and-prs.md](docs/issues-and-prs.md).
|
|
45
45
|
- **Threads.** The panel's Threads tab shows ideas (issues labelled `idea`) and spec PRs' conversations from the forge, read-only, and lights the nodes they mention with `[[node-id]]` or `[[repo/path]]`; a node's panel lists the threads that mention it. "New idea" opens an issue as you. Hooks tell outside code when a thread opens, gets a comment or is linked to the map. Nothing is kept in cornfield. [docs/threads.md](docs/threads.md).
|
|
46
|
-
- **Agents, tracked.** The panel's
|
|
46
|
+
- **Agents, tracked.** The panel's Runs tab groups branches, spec PRs and PRs by the issue and the proposal they belong to, and marks the work agents made (by author, bot account, label or branch prefix, set in the config). Nothing is launched. [docs/agents.md](docs/agents.md).
|
|
47
47
|
- **Personas, not people.** `topology.personas.json` holds archetypes (Admin, Member, Guest); scenarios act as them, never as a real person.
|
|
48
48
|
- **The cloud you do not control.** `topology.cloud.json` describes the outside services; the cloud deriver's detectors (hosts in code, Dockerfiles, container images, CI workflows, a Caddyfile) keep it complete in both directions. "Cloudflare is down" plays as an outage: what breaks now, at the next deploy, at the next certificate renewal. [docs/cloud.md](docs/cloud.md).
|
|
49
49
|
- **The house, optional.** A House view of floors, rooms, devices, machines and people (as counts), read from a source: a JSON file in your repo, your own API, later Home Assistant. cornfield only displays it. [docs/house.md](docs/house.md).
|
package/core/strings.js
CHANGED
|
@@ -31,13 +31,13 @@ export const STRINGS = Object.freeze({
|
|
|
31
31
|
sendBackWithNote: 'Send back with this note',
|
|
32
32
|
reviewNoteLabel: 'Note for the drafting agent',
|
|
33
33
|
reviewNotePlaceholder: 'What should change?',
|
|
34
|
-
// The
|
|
35
|
-
|
|
34
|
+
// The Work panel: its tabs run in the order of the loop
|
|
35
|
+
tabSpecs: 'Specs',
|
|
36
|
+
tabPulls: 'PRs',
|
|
36
37
|
tabIssues: 'Issues',
|
|
37
38
|
tabThreads: 'Threads',
|
|
39
|
+
tabRuns: 'Runs',
|
|
38
40
|
tabDeploys: 'Deploys',
|
|
39
|
-
tabAgents: 'Agents',
|
|
40
|
-
tabNotes: 'Release notes',
|
|
41
41
|
newIdea: 'New idea',
|
|
42
42
|
landIt: 'Land it',
|
|
43
43
|
// Agent runs
|
|
@@ -48,6 +48,7 @@ export const STRINGS = Object.freeze({
|
|
|
48
48
|
continueRun: 'Continue',
|
|
49
49
|
reply: 'Reply',
|
|
50
50
|
// The node panel
|
|
51
|
+
openFile: 'Open file',
|
|
51
52
|
openRoute: 'Open route',
|
|
52
53
|
startRun: 'Start a run',
|
|
53
54
|
copySpec: 'Copy Spec',
|
package/explorer/deep-link.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Links from chat that land in the right place (issue #103, docs/agents.md "Deep links"):
|
|
5
5
|
*
|
|
6
|
-
* ?run=<runId> the
|
|
6
|
+
* ?run=<runId> the Runs tab, that run lit and in view
|
|
7
7
|
* ?issue=<n> the Issues tab, that issue's Start an agent button focused
|
|
8
8
|
* ?proposal=<slug>&start=1 the proposal opened (proposal.js) and the Start dialog on it
|
|
9
9
|
*
|
package/explorer/explorer.css
CHANGED
|
@@ -748,14 +748,14 @@ button.hx-proposal-item:focus-visible { outline: var(--corn-focus-width) solid v
|
|
|
748
748
|
.hx-forge { position: absolute; top: 0; left: 0; bottom: 0; width: var(--hx-forge-w); border-left: 0; transform: translateX(-100%); box-shadow: var(--corn-shadow-lg); }
|
|
749
749
|
.hx-forge.forge-open { transform: translateX(0); }
|
|
750
750
|
/* The proposal bar and the player make room for it: 12px past its edge, and the node panel's 480px (+24) when that is open too */
|
|
751
|
-
.hx-stage:has(.forge-open) .hx-proposal-bar { left: calc(var(--hx-forge-w) + 12px); width: min(
|
|
752
|
-
.hx-stage:has(.forge-open):has(.drawer-open) .hx-proposal-bar { width: min(
|
|
751
|
+
.hx-stage:has(.forge-open) .hx-proposal-bar { left: calc(var(--hx-forge-w) + 12px); width: min(960px, calc(100% - var(--hx-forge-w) - 36px)); }
|
|
752
|
+
.hx-stage:has(.forge-open):has(.drawer-open) .hx-proposal-bar { width: min(960px, calc(100% - var(--hx-forge-w) - 540px)); }
|
|
753
753
|
}
|
|
754
754
|
@media (max-width: 767px) {
|
|
755
755
|
.hx-forge:not(.forge-open) { display: none; }
|
|
756
756
|
.hx-forge { max-height: 60dvh; }
|
|
757
757
|
.hx-forge[data-sheet-state="peek"] .hx-forge-body { flex: none; padding: 0 var(--corn-space-5) var(--corn-space-3); gap: var(--corn-space-1); overflow: hidden; }
|
|
758
|
-
.hx-forge[data-sheet-state="peek"] .hx-forge-body > :not(.hx-forge-head):not(#forge-
|
|
758
|
+
.hx-forge[data-sheet-state="peek"] .hx-forge-body > :not(.hx-forge-head):not(#forge-bar), .hx-forge[data-sheet-state="peek"] #forge-filter-chip { display: none; }
|
|
759
759
|
.hx-forge[data-sheet-state="peek"] .hx-forge-head { padding-bottom: 0; border-bottom: 0; }
|
|
760
760
|
.hx-forge[data-sheet-state="peek"] .hx-forge-head .hx-btn { display: none; }
|
|
761
761
|
}
|
|
@@ -764,11 +764,25 @@ button.hx-proposal-item:focus-visible { outline: var(--corn-focus-width) solid v
|
|
|
764
764
|
.hx-forge-head { display: flex; align-items: center; gap: var(--corn-space-3); padding-bottom: var(--corn-space-3); border-bottom: var(--corn-border) solid var(--corn-surface-2); }
|
|
765
765
|
.hx-forge-head .hx-drawer-title { flex: 1; min-width: 0; }
|
|
766
766
|
.hx-forge-status, .hx-forge-rate { font-size: var(--corn-text-xs); line-height: 1.5; }
|
|
767
|
-
.hx-forge-controls { display: flex; flex-direction: column; gap: var(--corn-space-3); }
|
|
768
|
-
|
|
769
|
-
.hx-forge-
|
|
767
|
+
.hx-forge-controls { display: flex; flex-direction: column; gap: var(--corn-space-3); padding: var(--corn-space-3); border: var(--corn-border) solid var(--corn-line); border-radius: var(--corn-radius); background: var(--corn-surface-2); } /* the Filter chip's box */
|
|
768
|
+
/* The tabs, in the order of the loop: underlined here, pills that scroll sideways on a phone (below) */
|
|
769
|
+
.hx-forge-tabs { display: flex; gap: calc(var(--corn-space-1) / 2); margin: 0 calc(var(--corn-space-4) * -1); padding: 0 var(--corn-space-4); border-bottom: var(--corn-border) solid var(--corn-line); overflow-x: auto; scrollbar-width: none; }
|
|
770
|
+
.hx-forge-tabs::-webkit-scrollbar { display: none; }
|
|
771
|
+
.hx-forge-tab { flex: none; display: inline-flex; align-items: baseline; gap: var(--corn-space-1); padding: var(--corn-space-2) var(--corn-space-3) var(--corn-space-3); border: 0; border-bottom: var(--corn-border-strong) solid transparent; background: none; white-space: nowrap; color: var(--corn-text-2); font-size: var(--corn-text-sm); font-weight: 500; }
|
|
770
772
|
.hx-forge-tab:hover { color: var(--corn-text); }
|
|
771
|
-
.hx-forge-tab[aria-pressed="true"] {
|
|
773
|
+
.hx-forge-tab[aria-pressed="true"] { border-bottom-color: var(--corn-accent); color: var(--corn-text); font-weight: 600; }
|
|
774
|
+
.hx-forge-tab:focus-visible, .hx-forge-chip:focus-visible, .hx-forge-back:focus-visible { outline: var(--corn-focus-width) solid var(--corn-focus); outline-offset: -2px; }
|
|
775
|
+
.hx-forge-count { color: var(--corn-text-3); font-size: var(--corn-text-xs); font-weight: 500; }
|
|
776
|
+
.hx-forge-count[hidden] { display: none; }
|
|
777
|
+
/* The status line and the Filter chip; the focus is put on the title (a heading, tabindex -1) when the panel opens, so it shows no ring */
|
|
778
|
+
.hx-forge-body > * { flex-shrink: 0; } /* a tall detail scrolls the body; it must not squash the tabs */
|
|
779
|
+
.hx-forge .hx-drawer-title:focus-visible, .hx-forge-notes-title:focus-visible { outline: none; }
|
|
780
|
+
.hx-forge-bar { display: flex; align-items: center; gap: var(--corn-space-3); min-height: 28px; }
|
|
781
|
+
.hx-forge-bar .hx-forge-status { flex: 1; min-width: 0; }
|
|
782
|
+
.hx-forge-chip { flex: none; display: inline-flex; align-items: center; gap: var(--corn-space-1); min-height: 24px; padding: 0 var(--corn-space-3); border: var(--corn-border) solid var(--corn-line); border-radius: var(--corn-radius-pill); background: none; color: var(--corn-text-2); font-size: var(--corn-text-xs); }
|
|
783
|
+
.hx-forge-chip:hover { background: var(--corn-surface-3); color: var(--corn-text); }
|
|
784
|
+
.hx-forge-chip[aria-expanded="true"], .hx-forge-chip.is-on { border-color: var(--corn-accent); color: var(--corn-text); }
|
|
785
|
+
.hx-forge-bar[hidden], .hx-forge-chip[hidden], .hx-forge-controls[hidden], .hx-forge-foot[hidden], .hx-forge-detail[hidden], .hx-forge-notes[hidden] { display: none; }
|
|
772
786
|
.hx-forge-filters { display: grid; grid-template-columns: 1fr 1fr; gap: var(--corn-space-2) var(--corn-space-3); }
|
|
773
787
|
.hx-forge-field { display: flex; flex-direction: column; gap: calc(var(--corn-space-1) / 2); min-width: 0; font-size: var(--corn-text-2xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--corn-text-3); }
|
|
774
788
|
.hx-forge-field--text { grid-column: 1 / -1; }
|
|
@@ -801,10 +815,11 @@ a.hx-forge-row:hover, button.hx-forge-row:hover { background: var(--corn-surface
|
|
|
801
815
|
.hx-forge-state--draft, .hx-forge-state--running, .hx-forge-state--queued { color: var(--corn-warn); }
|
|
802
816
|
.hx-forge-state--neutral, .hx-forge-state--skipped, .hx-forge-state--cancelled { color: var(--corn-text-3); }
|
|
803
817
|
|
|
804
|
-
.hx-forge-detail { display: flex; flex-direction: column; gap: var(--corn-space-
|
|
805
|
-
.hx-forge-detail-
|
|
806
|
-
|
|
807
|
-
.hx-forge-sub, .hx-forge-subact, .hx-forge-runs-title
|
|
818
|
+
.hx-forge-detail { display: flex; flex-direction: column; gap: var(--corn-space-3); }
|
|
819
|
+
.hx-forge-detail-title, .hx-forge-notes-title { margin: 0; min-width: 0; font-size: var(--corn-text-lg); font-weight: 700; letter-spacing: -0.01em; color: var(--corn-text); overflow-wrap: anywhere; }
|
|
820
|
+
/* A section's label, in sentence case */
|
|
821
|
+
.hx-forge-sub, .hx-forge-subact, .hx-forge-runs-title { margin: var(--corn-space-1) 0 0; font-size: var(--corn-text-sm); font-weight: 600; color: var(--corn-text-3); }
|
|
822
|
+
.hx-forge-confirm-title { margin: var(--corn-space-1) 0 0; font-size: var(--corn-text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--corn-text-2); }
|
|
808
823
|
.hx-forge-check { display: flex; flex-wrap: wrap; align-items: center; gap: calc(var(--corn-space-1) / 2) var(--corn-space-2); }
|
|
809
824
|
.hx-forge-check .hx-link { display: inline-flex; align-items: center; min-height: 24px; }
|
|
810
825
|
.hx-forge-lights { flex-basis: 100%; font-size: var(--corn-text-xs); line-height: 1.5; }
|
|
@@ -813,7 +828,6 @@ a.hx-forge-row:hover, button.hx-forge-row:hover { background: var(--corn-surface
|
|
|
813
828
|
.hx-forge-fstatus { flex: none; min-width: var(--hx-forge-status-w); color: var(--corn-text-3); font-size: var(--corn-text-xs); }
|
|
814
829
|
.hx-forge-del { color: var(--corn-bad); }
|
|
815
830
|
.hx-forge-act { align-self: flex-start; min-height: 24px; padding: calc(var(--corn-space-1) / 2) var(--corn-space-3); }
|
|
816
|
-
.hx-forge-detail > .hx-forge-act { padding: var(--corn-space-2) var(--corn-space-4); }
|
|
817
831
|
.hx-forge-why { margin: 0; font-size: var(--corn-text-xs); line-height: 1.5; }
|
|
818
832
|
.hx-forge-step { display: flex; flex-direction: column; gap: var(--corn-space-1); }
|
|
819
833
|
.hx-forge-startspec { flex: none; align-self: center; }
|
|
@@ -864,6 +878,35 @@ a.hx-forge-row:hover, button.hx-forge-row:hover { background: var(--corn-surface
|
|
|
864
878
|
.hx-forge-confirm { padding: var(--corn-space-3); border: var(--corn-border) solid var(--corn-line); border-left: calc(var(--corn-border-strong) * 2) solid var(--corn-added-text); border-radius: var(--corn-radius); background: color-mix(in srgb, var(--corn-ground) 55%, transparent); line-height: 1.5; }
|
|
865
879
|
.hx-forge-runs { display: flex; flex-direction: column; gap: var(--corn-space-2); margin: var(--corn-space-1) 0 var(--corn-space-3); }
|
|
866
880
|
.hx-forge-runs[hidden] { display: none; }
|
|
881
|
+
/* A Specs row: title and state on one line, a line of what it is, the facts */
|
|
882
|
+
.hx-forge-line { display: flex; align-items: center; gap: var(--corn-space-3); }
|
|
883
|
+
.hx-forge-line .hx-forge-title { flex: 1; min-width: 0; }
|
|
884
|
+
.hx-forge-sum { color: var(--corn-text-2); line-height: 1.4; overflow-wrap: anywhere; }
|
|
885
|
+
.hx-forge-facts { display: flex; flex-wrap: wrap; gap: 0 var(--corn-space-3); }
|
|
886
|
+
.hx-forge-add { color: var(--corn-added-text); }
|
|
887
|
+
.hx-forge-chg { color: var(--corn-warn); }
|
|
888
|
+
/* A selection replaces the list, with a back control named by the list; Land it is the one primary action */
|
|
889
|
+
.hx-forge-back { align-self: flex-start; display: inline-flex; align-items: center; gap: var(--corn-space-2); min-height: 28px; margin-left: calc(var(--corn-space-2) * -1); padding: 0 var(--corn-space-3) 0 var(--corn-space-2); border: 0; border-radius: var(--corn-radius-sm); background: none; color: var(--corn-text-2); font-size: var(--corn-text-xs); }
|
|
890
|
+
.hx-forge-back:hover { background: var(--corn-surface-3); color: var(--corn-text); }
|
|
891
|
+
.hx-forge-dmeta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--corn-space-1) var(--corn-space-3); }
|
|
892
|
+
.hx-forge-cta { display: flex; flex-wrap: wrap; gap: var(--corn-space-3); }
|
|
893
|
+
.hx-forge-cta .hx-btn { min-height: 32px; justify-content: center; }
|
|
894
|
+
.hx-forge-cta .hx-btn--approve { flex: 1; }
|
|
895
|
+
.hx-forge-cta .hx-btn[disabled] { background: var(--corn-surface-3); border-color: var(--corn-line); color: var(--corn-text-3); box-shadow: none; cursor: default; }
|
|
896
|
+
.hx-forge-open { text-decoration: none; color: var(--corn-text-2); }
|
|
897
|
+
.hx-forge-runline { display: flex; flex-wrap: wrap; align-items: center; gap: var(--corn-space-2); padding: var(--corn-space-2) var(--corn-space-3); border: var(--corn-border) solid var(--corn-line); border-radius: var(--corn-radius-sm); background: var(--corn-surface-2); }
|
|
898
|
+
/* The foot of a list: Release notes … on PRs, New idea on Specs and Threads */
|
|
899
|
+
.hx-forge-foot { display: flex; flex-direction: column; gap: var(--corn-space-3); margin-top: auto; padding-top: var(--corn-space-3); border-top: var(--corn-border) solid var(--corn-line); }
|
|
900
|
+
.hx-forge-foot > .hx-btn { align-self: flex-start; }
|
|
901
|
+
/* A phone: the tabs are pills, and everything a thumb has to hit is 44px */
|
|
902
|
+
@media (max-width: 767px) {
|
|
903
|
+
.hx-forge-tabs { gap: var(--corn-space-2); padding-bottom: var(--corn-space-3); border-bottom: 0; }
|
|
904
|
+
.hx-forge-tab { align-items: center; min-height: 44px; padding: 0 var(--corn-space-4); border: var(--corn-border) solid var(--corn-line); border-radius: var(--corn-radius-pill); }
|
|
905
|
+
.hx-forge-tab[aria-pressed="true"] { background: var(--corn-accent); border-color: var(--corn-accent); color: var(--corn-text-on-accent); }
|
|
906
|
+
.hx-forge-tab[aria-pressed="true"] .hx-forge-count { color: inherit; }
|
|
907
|
+
.hx-forge .hx-btn, .hx-forge .hx-close, .hx-forge-chip, .hx-forge-back, .hx-forge-node, .hx-forge-toggle, .hx-forge-select, .hx-forge-input, .hx-forge-check .hx-link, .hx-forge-out { min-height: 44px; min-width: 44px; }
|
|
908
|
+
.hx-forge .hx-close { display: inline-flex; align-items: center; justify-content: center; }
|
|
909
|
+
}
|
|
867
910
|
|
|
868
911
|
/* Threads (forge-panel.js, docs/threads.md): messages as written, read-only; a node's "Threads" opens one */
|
|
869
912
|
.hx-thread-msgs { display: flex; flex-direction: column; gap: var(--corn-space-3); margin: 0; padding: 0; list-style: none; }
|
|
@@ -923,6 +966,7 @@ a.hx-forge-row:hover, button.hx-forge-row:hover { background: var(--corn-surface
|
|
|
923
966
|
/* ---- the node panel (panels.js, #138): type · name · one line · facts · mockups · threads · the diff · the actions ------------ */
|
|
924
967
|
.hx-drawer-id { flex: 1; min-width: 0; }
|
|
925
968
|
.hx-kicker { display: flex; flex-wrap: wrap; align-items: center; margin: 0 0 var(--corn-space-2); font-size: var(--corn-text-sm); color: var(--corn-text-3); }
|
|
969
|
+
#drawer-host { white-space: pre; } /* the kicker is a flex row, which drops a leading space: keep " · host" */
|
|
926
970
|
.hx-diffpill { margin-left: var(--corn-space-3); padding: 0 var(--corn-space-3); border-radius: var(--corn-radius-pill); border: var(--corn-border) dashed var(--corn-added); color: var(--corn-added-text); font-size: var(--corn-text-xs); }
|
|
927
971
|
.hx-drawer-id .hx-drawer-title { font-size: var(--corn-text-xl); font-weight: 650; letter-spacing: -0.01em; line-height: 1.25; }
|
|
928
972
|
.hx-drawer-id .hx-drawer-title.hx-mono { font-family: var(--corn-mono); }
|
|
@@ -969,7 +1013,7 @@ a.hx-forge-row:hover, button.hx-forge-row:hover { background: var(--corn-surface
|
|
|
969
1013
|
}
|
|
970
1014
|
.hx-drawer .hx-whatif-drawer { font-size: var(--corn-text-md); color: var(--corn-text-2); }
|
|
971
1015
|
.hx-drawer .hx-whatif-drawer select { max-width: 100%; }
|
|
972
|
-
.hx-drawer-foot .hx-btn--quiet { border-color: transparent; background: none; }
|
|
1016
|
+
.hx-drawer-foot .hx-btn--quiet { border-color: transparent; background: none; text-decoration: none; }
|
|
973
1017
|
.hx-more { display: contents; }
|
|
974
1018
|
.hx-more[hidden] { display: none; }
|
|
975
1019
|
.hx-more-btn { display: block; margin-top: var(--corn-space-1); min-height: 0; padding: 0; font-size: var(--corn-text-sm); }
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module explorer/file-url
|
|
3
|
+
*
|
|
4
|
+
* `fileUrl(forge, path, ref)`: where a node's file is on the forge's web site, or null. `forge` is the client config's
|
|
5
|
+
* `{ type, url, repo }` (server/server.js); `ref` a branch name, or `HEAD` (the repo's default branch, on GitHub and on
|
|
6
|
+
* Forgejo/Gitea 1.21 and later) when none is given. Only GitHub and Forgejo/Gitea exist (server/forge-*.js).
|
|
7
|
+
* The path must be repo-relative: no `..`, no absolute path, no scheme, no backslash, no control character. The URL is
|
|
8
|
+
* built with `URL`, each segment encoded, and only `https:` is allowed, with no user name and no backslash in `forge.url`
|
|
9
|
+
* (`https://github.com@evil.test` is evil.test).
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
// The page of a file at a branch, per forge
|
|
13
|
+
const SHAPE = { github: 'blob', forgejo: 'src/branch' };
|
|
14
|
+
|
|
15
|
+
/** The segments of a repo-relative path (or branch name), or null when it is not one */
|
|
16
|
+
function segments(path) {
|
|
17
|
+
if (typeof path !== 'string' || !path || /[\\\u0000-\u001f\u007f]/.test(path) || path.startsWith('/') || /^[A-Za-z][A-Za-z0-9+.-]*:/.test(path)) return null;
|
|
18
|
+
const parts = path.split('/');
|
|
19
|
+
return parts.every((s) => s && s !== '.' && s !== '..') ? parts : null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** @returns {string | null} */
|
|
23
|
+
export function fileUrl(forge, path, ref) {
|
|
24
|
+
const kind = forge && Object.hasOwn(SHAPE, forge.type) && SHAPE[forge.type];
|
|
25
|
+
const file = segments(path);
|
|
26
|
+
const branch = segments(ref || 'HEAD');
|
|
27
|
+
const repo = segments(forge && forge.repo);
|
|
28
|
+
if (!kind || !file || !branch || !repo || repo.length !== 2) return null;
|
|
29
|
+
try {
|
|
30
|
+
const base = new URL(forge.url);
|
|
31
|
+
if (base.protocol !== 'https:' || base.username || base.password || String(forge.url).includes('\\')) return null;
|
|
32
|
+
const enc = (s) => s.map(encodeURIComponent).join('/');
|
|
33
|
+
base.pathname = `${base.pathname.replace(/\/+$/, '')}/${enc(repo)}/${kind}/${enc(branch)}/${enc(file)}`;
|
|
34
|
+
base.search = '';
|
|
35
|
+
base.hash = '';
|
|
36
|
+
return base.href;
|
|
37
|
+
} catch {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -406,7 +406,7 @@ export function mergeBlock(detail) {
|
|
|
406
406
|
if (!checks.length) return 'It has no checks, so nothing says it works.';
|
|
407
407
|
const words = { queued: 'is waiting to run', running: 'is still running', failure: 'failed', cancelled: 'was cancelled' };
|
|
408
408
|
const not = checks.filter((c) => !GREEN.includes(c.state));
|
|
409
|
-
if (not.length) return `
|
|
409
|
+
if (not.length) return `Can't land yet: ${not.map((c) => `${c.name} ${words[c.state] || c.state}`).join(', ')}.`;
|
|
410
410
|
if (detail.stale) return 'This is an older answer from the forge: refresh before landing it.';
|
|
411
411
|
return null;
|
|
412
412
|
}
|