Skip to content

armgit / kwant

Public Imported from GitHub
0

Your own team of AI bots in one self-hosted binary: spaces, every account you have, handoffs, approvals and routines. Open-source, self-hosted alternative to Grok Bot, Claude Duet and OpenAI dots. Rust + React.

0.7.3: Dev desk knows no_git and git-only repos (#368)

Oleksandr Ivanchenko22e27aeaef7e
diff --git a/frontend/src/components/DevDesk.tsx b/frontend/src/components/DevDesk.tsx
index a70c60ac..e1989a7a 100644
--- a/frontend/src/components/DevDesk.tsx
+++ b/frontend/src/components/DevDesk.tsx
@@ -4,7 +4,7 @@
import React, { useCallback, useEffect, useId, useRef, useState, useSyncExternalStore } from 'react';
import { ChevronLeft, Code, RefreshCw } from 'lucide-react';
-import { DEV_FEATURES, DEV_OFF, DevModeState, checkedLabel, DevTeamRef, cardRepoLabel, cardsOfRepo, devApi, devStore, deskStatus, firstRun, repoFilters, reposSummary, statusLine } from '../devMode';
+import { DEV_FEATURES, DEV_OFF, DevModeState, checkedLabel, DevTeamRef, cardRepoLabel, cardsOfRepo, gitOnlyRepo, devApi, devStore, deskStatus, firstRun, repoFilters, reposSummary, statusLine } from '../devMode';
import { FindingAction, LandedPage, ShellCard, asCard, parseCards, parseLandedPage } from '../dev/shellTypes';
import { LandedList, ReleaseNotesSheet, ReviewCard, Rollup } from './DevDeskSlots';
import { useDevMode } from './DevModeSwitch';
@@ -201,6 +201,8 @@ export const DevDeskView: React.FC<DevDeskViewProps> = ({ spaceId, onBack, onSav
const repo = repoPick && filters.some((f) => f.key === repoPick) ? repoPick : null;
const desk = useDesk(spaceId, true, repo);
const repoLabel = useCallback((key: string | null, name?: string | null) => cardRepoLabel(dev, key, name), [dev]);
+ // 0.7.3 (any-git): a repo read with plain git has no forge: no CI tile, no Post button, no "Open on" link.
+ const gitOnly = useCallback((key: string | null) => gitOnlyRepo(dev, key), [dev]);
const [tab, setTab] = useState<Tab>(initialTab);
// Flow F6: opening the desk clears the row badge on every device. On a deep link to /s/<space>/dev
// the store is still empty here, so the first state to arrive (fetched before the server saw the
@@ -502,7 +504,7 @@ export const DevDeskView: React.FC<DevDeskViewProps> = ({ spaceId, onBack, onSav
/>
)}
{landedCards.length ? (
- <LandedList cards={landedCards} reviews={reviews} now={now} onOpenReview={openReview} forge={dev?.forge ?? null} repoLabel={repoLabel} />
+ <LandedList cards={landedCards} reviews={reviews} now={now} onOpenReview={openReview} forge={dev?.forge ?? null} repoLabel={repoLabel} gitOnly={gitOnly} />
) : dev?.status === 'not_connected' ? (
<TermEmpty out="(needs a GitHub connection)" title="Connect GitHub to see what landed." line="The last 5 merges show up here right after." />
) : dev?.status === 'no_repo' ? (
@@ -523,7 +525,7 @@ export const DevDeskView: React.FC<DevDeskViewProps> = ({ spaceId, onBack, onSav
)}
</>
) : reviews.length ? (
- reviews.map((c) => <ReviewCard key={c.id} card={c} onFinding={onFinding} onPost={onPost} forge={dev?.forge ?? null} forgeLogin={dev?.forge_login ?? null} now={now} repoLabel={repoLabel} />)
+ reviews.map((c) => <ReviewCard key={c.id} card={c} onFinding={onFinding} onPost={onPost} forge={dev?.forge ?? null} forgeLogin={dev?.forge_login ?? null} gitOnly={gitOnly(typeof c.repo === 'string' ? c.repo : null)} now={now} repoLabel={repoLabel} />)
) : (
desk.reviews && (
<TermEmpty
diff --git a/frontend/src/components/DevDeskSlots.tsx b/frontend/src/components/DevDeskSlots.tsx
index 64e0b7ba..f3a0305e 100644
--- a/frontend/src/components/DevDeskSlots.tsx
+++ b/frontend/src/components/DevDeskSlots.tsx
@@ -35,6 +35,8 @@ export interface LandedListProps {
forge?: Forge | null;
/** 0.7.2: the card's repo chip text, or null with one repo in the space (`cardRepoLabel`). */
repoLabel?: (repo: string | null, name?: string | null) => string | null;
+ /** 0.7.3 (any-git): is this card's repo read with plain git? Then no CI tile and no "Open on {Forge}" link. */
+ gitOnly?: (repo: string | null) => boolean;
}
export interface ReviewCardProps {
@@ -49,6 +51,8 @@ export interface ReviewCardProps {
now?: number;
/** 0.7.2: the card's repo chip text, or null with one repo in the space (`cardRepoLabel`). */
repoLabel?: (repo: string | null, name?: string | null) => string | null;
+ /** 0.7.3 (any-git): the card's repo is read with plain git: no forge, so no Post button. */
+ gitOnly?: boolean;
}
export interface ReleaseNotesSheetProps {
@@ -67,14 +71,14 @@ export const Rollup: React.FC<RollupProps> = ({ cards = [], ...rest }) => {
return <IrisRollup {...rest} needsYouAreas={needs} />;
};
-export const LandedList: React.FC<LandedListProps> = ({ cards, reviews, now, onOpenReview, forge = null, repoLabel }) => {
+export const LandedList: React.FC<LandedListProps> = ({ cards, reviews, now, onOpenReview, forge = null, repoLabel, gitOnly }) => {
const parsed = useMemo(() => parseLandedCards(cards), [cards]);
const parsedReviews = useMemo(() => parseReviewCards(reviews), [reviews]);
// Cards Iris's parser refuses (no PR number and no commit, wrong kind) still show, as the plain fallback row.
const refused = useMemo(() => cards.filter((c) => parseLanded(c) === null), [cards]);
return (
<>
- {parsed.length > 0 && <IrisLandedList cards={parsed} reviews={parsedReviews} now={now} onOpenReview={onOpenReview} forge={forge} repoLabel={repoLabel} />}
+ {parsed.length > 0 && <IrisLandedList cards={parsed} reviews={parsedReviews} now={now} onOpenReview={onOpenReview} forge={forge} repoLabel={repoLabel} gitOnly={gitOnly} />}
{refused.map((c) => (
<CardFallback key={c.id} raw={c} />
))}
@@ -82,7 +86,7 @@ export const LandedList: React.FC<LandedListProps> = ({ cards, reviews, now, onO
);
};
-export const ReviewCard: React.FC<ReviewCardProps> = ({ card, onFinding, onPost, forge, forgeLogin, sample, now, repoLabel }) => {
+export const ReviewCard: React.FC<ReviewCardProps> = ({ card, onFinding, onPost, forge, forgeLogin, sample, now, repoLabel, gitOnly = false }) => {
const parsed = useMemo(() => parseReview(card), [card]);
if (!parsed) return <CardFallback raw={card} />;
const send = async (cardId: string, findingId: string, action: FindingAction): Promise<Review> => {
@@ -90,14 +94,14 @@ export const ReviewCard: React.FC<ReviewCardProps> = ({ card, onFinding, onPost,
if (!next) throw new Error('The review came back in a shape this app doesn’t know.');
return next;
};
- const post = onPost
+ const post = onPost && !gitOnly
? async (cardId: string): Promise<Review> => {
const next = parseReview(await onPost(cardId));
if (!next) throw new Error('The review came back in a shape this app doesn’t know.');
return next;
}
: undefined;
- return <IrisReviewCard card={parsed} onFinding={send} onPost={post} forge={forge} forgeLogin={forgeLogin} sample={sample} now={now} repoLabel={repoLabel} />;
+ return <IrisReviewCard card={parsed} onFinding={send} onPost={post} forge={gitOnly ? null : forge} forgeLogin={forgeLogin} sample={sample} now={now} repoLabel={repoLabel} />;
};
export const ReleaseNotesSheet: React.FC<ReleaseNotesSheetProps> = ({ card, onSaveToNotion, onDiscard, onClose }) => {
diff --git a/frontend/src/components/DevStatusLine.tsx b/frontend/src/components/DevStatusLine.tsx
index c3354c1b..e81f4f09 100644
--- a/frontend/src/components/DevStatusLine.tsx
+++ b/frontend/src/components/DevStatusLine.tsx
@@ -103,10 +103,12 @@ export const DevStatusLine: React.FC<DevStatusLineProps> = ({ spaceId, state, te
const single = rows.length === 0;
const singleRow: RepoRow | null =
single && state.repos.length === 1
- ? { id: state.repos[0].key, team: state.repos[0].team, teamId: null, repo: state.repos[0], state: '', origin: null, teamNote: null, title: null, led: line.led, action: line.action }
+ ? { id: state.repos[0].key, team: state.repos[0].team, teamId: null, repo: state.repos[0], state: '', origin: null, teamNote: null, title: null, note: line.note, led: line.led, action: line.action }
: null;
// The single line's Link: the one team with none, if there is exactly one; else a repo added by hand.
- const loneTeam = single && line.action === 'link' ? teams.find((t) => !state.repos.some((r) => r.team === t.name)) ?? null : null;
+ // 0.7.3: a lone no_repo row (a remote kwant won't fetch) links its own team's repo.
+ const ownTeam = (r: DevModeState['repos'][number] | undefined) => (r?.status === 'no_repo' && r.team ? teams.find((t) => t.id === r.team_id || t.name === r.team) ?? null : null);
+ const loneTeam = single && line.action === 'link' ? ownTeam(state.repos[0]) ?? teams.find((t) => !state.repos.some((r) => r.team === t.name)) ?? null : null;
const focusAfter = (id: string) => {
requestAnimationFrame(() => {
@@ -201,7 +203,7 @@ export const DevStatusLine: React.FC<DevStatusLineProps> = ({ spaceId, state, te
return (
<div ref={wrap} className="relative" data-dv-status-wrap>
<div role="status" className="dv-statusline kw-dv-statusline" data-dv-status={line.status} data-dv-repos={state.repos.length}>
- <p className="txt" data-dv-status-text>
+ <p className="txt" data-dv-status-text aria-describedby={single && line.note ? `${listId}-note` : undefined}>
<span key={checkedAt ?? 0} className="dv-led" data-s={line.led} data-ping={ping || undefined} data-dv-led={line.led} aria-hidden="true" />
<span className="min-w-0">
{line.parts.map((p, i) =>
@@ -242,6 +244,11 @@ export const DevStatusLine: React.FC<DevStatusLineProps> = ({ spaceId, state, te
</span>
)}
</div>
+ {single && line.note && (
+ <p id={`${listId}-note`} className="kw-dv-line-note" data-dv-line-note>
+ {line.note}
+ </p>
+ )}
{single && linkingId === 'line' && line.action === 'link' && <div className="kw-dv-repo-form-wrap">{linkForm('line', loneTeam, 'line')}</div>}
{single && error && (
<p className="kw-dv-repo-err" role="alert">
@@ -250,7 +257,7 @@ export const DevStatusLine: React.FC<DevStatusLineProps> = ({ spaceId, state, te
)}
{!single && open && (
<ul id={listId} className="kw-dv-repos" aria-label="Repos Dev mode watches" data-dv-repos-list>
- {rows.map((r) => (
+ {rows.map((r, i) => (
<li key={r.id} className="kw-dv-repo" data-dv-repo-row={r.id} data-s={r.repo?.status ?? 'no_repo'}>
<div className="kw-dv-repo-line">
<span className="dv-led" data-s={r.led} aria-hidden="true" />
@@ -283,6 +290,7 @@ export const DevStatusLine: React.FC<DevStatusLineProps> = ({ spaceId, state, te
data-tone={r.state === READY ? 'neutral' : undefined}
title={r.state === READY ? READY_TITLE : r.title ?? undefined}
aria-label={r.state === READY ? READY_TITLE : undefined}
+ aria-describedby={r.note ? `${listId}-note-${i}` : undefined}
>
{r.state}
</span>
@@ -307,6 +315,11 @@ export const DevStatusLine: React.FC<DevStatusLineProps> = ({ spaceId, state, te
{r.origin}
</p>
)}
+ {r.note && (
+ <p id={`${listId}-note-${i}`} className="kw-dv-repo-origin" data-dv-repo-note>
+ {r.note}
+ </p>
+ )}
{note === r.id && r.teamNote && (
<p className="kw-dv-repo-origin" data-dv-team-note-text>
{r.teamNote}
diff --git a/frontend/src/components/dev/LandedCard.tsx b/frontend/src/components/dev/LandedCard.tsx
index 5487c961..23343468 100644
--- a/frontend/src/components/dev/LandedCard.tsx
+++ b/frontend/src/components/dev/LandedCard.tsx
@@ -11,13 +11,14 @@ const TESTS_TONE = { passed: 'text-ok', failed: 'text-bad', none: 'text-zinc-400
const TESTS_LED = { passed: 'ok', failed: 'bad', none: 'off', unknown: 'off' } as const;
/** One merge in plain words (design §4). A commit pushed without a PR (`pr: null`) is the same card, named by its commit. */
-export const LandedCard: React.FC<{ card: Landed; reviews?: ReviewCard[]; onOpenReview?: (pr: number, repo?: string | null) => void; forge?: Forge | null; onRail?: boolean; repoLabel?: (repo: string | null, name?: string | null) => string | null }> = ({
+export const LandedCard: React.FC<{ card: Landed; reviews?: ReviewCard[]; onOpenReview?: (pr: number, repo?: string | null) => void; forge?: Forge | null; onRail?: boolean; repoLabel?: (repo: string | null, name?: string | null) => string | null; gitOnly?: boolean }> = ({
card,
reviews = [],
onOpenReview,
forge = null,
onRail = false,
repoLabel,
+ gitOnly = false,
}) => {
const repoChip = repoLabel ? repoLabel(card.repo, card.repo_name) : null;
const verified = showVerified(card, reviews);
@@ -35,11 +36,12 @@ export const LandedCard: React.FC<{ card: Landed; reviews?: ReviewCard[]; onOpen
const diff = card.links.commit ?? (card.links.pr ? `${card.links.pr}/files` : null);
const headingId = `landed-${card.id || pr || card.sha}-h`;
const MergeIcon = pr === null ? GitCommitHorizontal : GitMerge;
- const github = card.links.pr ?? (pr === null ? card.links.commit : null);
+ // 0.7.3: a plain-git repo has no forge to open the change on.
+ const github = gitOnly ? null : card.links.pr ?? (pr === null ? card.links.commit : null);
const node = landedNode(card);
return (
- <article data-dev-card="landed" data-repo={card.repo ?? undefined} data-pr={pr ?? undefined} data-commit={pr === null ? card.sha : undefined} data-verified={verified || undefined} aria-labelledby={headingId} className="kw-card relative min-w-0 p-4">
+ <article data-dev-card="landed" data-git-only={gitOnly || undefined} data-repo={card.repo ?? undefined} data-pr={pr ?? undefined} data-commit={pr === null ? card.sha : undefined} data-verified={verified || undefined} aria-labelledby={headingId} className="kw-card relative min-w-0 p-4">
{onRail && (
<>
{pr !== null && <span aria-hidden="true" data-rail-arc className="dv-arc" />}
@@ -173,28 +175,30 @@ export const LandedCard: React.FC<{ card: Landed; reviews?: ReviewCard[]; onOpen
)}
<div className="mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 border-t border-hairline pt-2.5 text-meta">
- <span data-tests={card.tests.state} className={`inline-flex items-center gap-[7px] ${TESTS_TONE[card.tests.state]}`}>
- <Led s={TESTS_LED[card.tests.state]} />
- {card.tests.state === 'failed' ? (
- <span>
- {tests}
- {card.links.ci && (
- <>
- {' · '}
- <a href={card.links.ci} target="_blank" rel="noreferrer noopener" className="kw-focus kw-hit rounded text-sky-300 hover:underline">
- see CI
- </a>
- </>
- )}
- </span>
- ) : card.links.ci ? (
- <a href={card.links.ci} target="_blank" rel="noreferrer noopener" className="kw-focus kw-hit rounded hover:underline">
- {tests}
- </a>
- ) : (
- <span>{tests}</span>
- )}
- </span>
+ {!gitOnly && (
+ <span data-tests={card.tests.state} className={`inline-flex items-center gap-[7px] ${TESTS_TONE[card.tests.state]}`}>
+ <Led s={TESTS_LED[card.tests.state]} />
+ {card.tests.state === 'failed' ? (
+ <span>
+ {tests}
+ {card.links.ci && (
+ <>
+ {' · '}
+ <a href={card.links.ci} target="_blank" rel="noreferrer noopener" className="kw-focus kw-hit rounded text-sky-300 hover:underline">
+ see CI
+ </a>
+ </>
+ )}
+ </span>
+ ) : card.links.ci ? (
+ <a href={card.links.ci} target="_blank" rel="noreferrer noopener" className="kw-focus kw-hit rounded hover:underline">
+ {tests}
+ </a>
+ ) : (
+ <span>{tests}</span>
+ )}
+ </span>
+ )}
<span className="text-zinc-400">{card.reviewed_by ? `Reviewed by ${card.reviewed_by}` : 'No bot review'}</span>
{nothingToDo && <span className="text-zinc-400">Nothing to do for you.</span>}
{findingsOpen > 0 && (
@@ -220,7 +224,7 @@ export const LandedCard: React.FC<{ card: Landed; reviews?: ReviewCard[]; onOpen
</span>
)}
<span className="flex items-center gap-3 sm:ml-auto">
- {diff && diff !== github && (
+ {!gitOnly && diff && diff !== github && (
<a href={diff} target="_blank" rel="noreferrer noopener" className="kw-focus kw-hit inline-flex min-h-[44px] items-center rounded text-sky-300 hover:text-sky-200 sm:min-h-0">
Diff
</a>
@@ -237,7 +241,7 @@ export const LandedCard: React.FC<{ card: Landed; reviews?: ReviewCard[]; onOpen
};
/** What landed: one git rail down the left (style v2 §5), day labels sitting on it, a node per card. */
-export const LandedList: React.FC<LandedListProps> = ({ cards, reviews, now = Date.now(), onOpenReview, forge = null, repoLabel }) => (
+export const LandedList: React.FC<LandedListProps> = ({ cards, reviews, now = Date.now(), onOpenReview, forge = null, repoLabel, gitOnly }) => (
<div data-dev-landed-list className="dv-rail space-y-3">
{byDay(cards, now).map((day) => (
<section key={day.label} aria-label={day.label} className="space-y-3">
@@ -246,7 +250,7 @@ export const LandedList: React.FC<LandedListProps> = ({ cards, reviews, now = Da
<span aria-hidden="true" className="h-px flex-1 bg-[var(--kw-hairline)]" />
</h3>
{day.cards.map((c) => (
- <LandedCard key={c.id || c.pr || c.sha} card={c} reviews={reviews} onOpenReview={onOpenReview} forge={forge} repoLabel={repoLabel} onRail />
+ <LandedCard key={c.id || c.pr || c.sha} card={c} reviews={reviews} onOpenReview={onOpenReview} forge={forge} repoLabel={repoLabel} gitOnly={gitOnly?.(c.repo ?? null) ?? false} onRail />
))}
</section>
))}
diff --git a/frontend/src/dev/types.ts b/frontend/src/dev/types.ts
index d7aebe31..11f9ab1c 100644
--- a/frontend/src/dev/types.ts
+++ b/frontend/src/dev/types.ts
@@ -231,6 +231,8 @@ export interface LandedListProps {
onOpenReview?: (pr: number, repo?: string | null) => void;
/** `forge` from GET dev_mode: names the link ("Open on GitHub"). */
forge?: Forge | null;
+ /** 0.7.3 (any-git): is this card's repo read with plain git? Then no CI tile and no "Open on {Forge}" link. */
+ gitOnly?: (repo: string | null) => boolean;
/** 0.7.2: the card's repo chip text, or null with one repo in the space (`cardRepoLabel`). */
repoLabel?: (repo: string | null, name?: string | null) => string | null;
}
diff --git a/frontend/src/devMode.ts b/frontend/src/devMode.ts
index de98edce..420aec2e 100644
--- a/frontend/src/devMode.ts
+++ b/frontend/src/devMode.ts
@@ -34,10 +34,16 @@ export interface DevModeState {
/** 0.7.2 (team repos, T8): every repo Dev mode watches or found, in team order. On an older server it is
* built from the deprecated `repo`/`branch` (and `sources`), so the desk reads one shape. */
repos: DevRepo[];
+ /** 0.7.3 (any-git): with status `no_git`, what to install on the server. null otherwise or on an older server. */
+ install_hint: string | null;
}
/** 0.7.2: one repo of the space, from a team (its repo link or folder) or added by hand. */
-export type RepoStatus = 'watching' | 'not_connected' | 'other_host' | 'error' | 'too_many';
+/** `other_host` is retired in 0.7.3 (git reads every host) but still comes from a 0.7.1 or 0.7.2 server. */
+/** `no_repo` (0.7.3): a team's folder whose remote kwant won't fetch (on this machine, or not a git URL). */
+export type RepoStatus = 'watching' | 'not_connected' | 'no_git' | 'no_repo' | 'other_host' | 'error' | 'too_many';
+/** Who reads a repo: GitHub (reviews, CI, Post) or plain git (landed changes only, until its forge exists). */
+export type RepoProvider = 'github' | 'git';
export interface DevRepo {
/** The dedupe key, `host/owner/name` lowercased. Cards carry it as `repo`; `?repo=` filters by it. */
@@ -54,10 +60,14 @@ export interface DevRepo {
branch: string | null;
status: RepoStatus;
poll_error: string | null;
+ /** 0.7.3: a machine code for the poll error when the server sends one (`too_big`), else null. */
+ poll_code: string | null;
polled_at: string | null;
last_tag: string | null;
- /** Only `hand` rows can be removed. null: no row (other_host, too_many). */
+ /** Only `hand` rows can be removed. null: no row (other_host, no_git, too_many). */
added_by: 'team' | 'hand' | null;
+ /** 0.7.3: `provider` when the server sends it, else `git` for a folder with no remote or a host other than github.com. */
+ provider: RepoProvider;
}
/** Where a space's repo was found: a team's repo link, a git folder with a remote, or a folder with no remote. */
@@ -71,7 +81,8 @@ export interface DevSource {
from: SourceFrom;
}
-export type DevStatus = 'watching' | 'no_repo' | 'not_connected' | 'other_host';
+/** `other_host` is retired in 0.7.3 and kept for older servers; `no_git` is new in 0.7.3. */
+export type DevStatus = 'watching' | 'no_repo' | 'not_connected' | 'no_git' | 'other_host';
export type CheckState = 'found' | 'not_found' | 'not_connected';
@@ -87,7 +98,7 @@ const str = (v: unknown): string | null => (typeof v === 'string' && v.trim() ?
export type Forge = 'github' | 'gitlab' | 'gitea';
export const forgeOf = (v: unknown): Forge | null => (v === 'github' || v === 'gitlab' || v === 'gitea' ? v : null);
const num = (v: unknown): number | null => (typeof v === 'number' && Number.isFinite(v) ? v : null);
-const STATUSES: readonly DevStatus[] = ['watching', 'no_repo', 'not_connected', 'other_host'];
+const STATUSES: readonly DevStatus[] = ['watching', 'no_repo', 'not_connected', 'no_git', 'other_host'];
/** Drops userinfo from a URL-looking repo (`https://user:token@host/…`), so a token never reaches the screen. */
export const stripUserinfo = (repo: string): string => repo.replace(/^([a-z][a-z0-9+.-]*:\/\/)[^/@\s]*@/i, '$1');
@@ -107,7 +118,14 @@ export function parseSources(v: unknown): DevSource[] {
return out;
}
-const REPO_STATUSES: readonly RepoStatus[] = ['watching', 'not_connected', 'other_host', 'error', 'too_many'];
+const REPO_STATUSES: readonly RepoStatus[] = ['watching', 'not_connected', 'no_git', 'no_repo', 'other_host', 'error', 'too_many'];
+
+/** A repo's reader: the server's `provider` when sent, else plain git for a local folder or any host but github.com. */
+export const providerOf = (provider: unknown, from: unknown, host: string | null, key = ''): RepoProvider => {
+ if (provider === 'github' || provider === 'git') return provider;
+ if (from === 'local' || key.startsWith('local:')) return 'git';
+ return host && host.toLowerCase() !== 'github.com' ? 'git' : 'github';
+};
/** A key for a repo the server sent no key for (an older server): `host/owner/name`, lowercased. */
export const repoKey = (repo: string, host: string | null = 'github.com'): string => {
@@ -146,10 +164,12 @@ export function parseRepos(v: unknown): DevRepo[] {
branch: str(o.branch),
status,
poll_error: str(o.poll_error),
+ poll_code: str(o.poll_code),
polled_at: str(o.polled_at),
last_tag: str(o.last_tag),
// A 0.7.1 row migrated without a team reads as hand (api.md T2).
added_by: o.added_by === 'hand' || o.added_by === 'migrated' || (from === 'hand' && o.added_by !== 'team') ? 'hand' : o.added_by === 'team' ? 'team' : null,
+ provider: providerOf(o.provider, from, host, key),
});
}
return out;
@@ -162,7 +182,7 @@ function legacyRepos(o: Record<string, unknown>, sources: DevSource[], status: D
const src = repo ? sources.find((x) => x.repo.toLowerCase() === repo.toLowerCase()) ?? null : status === 'not_connected' || status === 'other_host' ? sources.find((x) => status !== 'other_host' || (x.host && x.host !== 'github.com')) ?? sources[0] ?? null : null;
const name = repo ?? src?.repo ?? null;
if (!name) return [];
- const st: RepoStatus = status === 'not_connected' || status === 'other_host' ? status : src?.from === 'local' ? 'other_host' : 'watching';
+ const st: RepoStatus = status === 'not_connected' || status === 'other_host' || status === 'no_git' ? status : 'watching';
return [
{
key: repoKey(name, src?.host ?? 'github.com'),
@@ -174,10 +194,12 @@ function legacyRepos(o: Record<string, unknown>, sources: DevSource[], status: D
branch: str(o.branch),
status: st,
poll_error: str(o.poll_error),
+ poll_code: str(o.poll_code),
polled_at: str(o.polled_at),
last_tag: null,
// An older server has no DELETE route: its typed repo has no Remove.
added_by: src ? 'team' : null,
+ provider: providerOf(null, src?.from, src?.host ?? null),
},
];
}
@@ -213,6 +235,7 @@ export function parseDevMode(raw: unknown): DevModeState | null {
return n === null ? null : Math.max(0, Math.floor(n));
})(),
repos: Array.isArray(o.repos) ? parseRepos(o.repos) : legacyRepos(o, sources, status),
+ install_hint: str(o.install_hint),
};
}
@@ -268,6 +291,8 @@ export interface RepoRow {
teamNote: string | null;
/** Tooltip for an error row: the poll error, URLs without their userinfo. */
title: string | null;
+ /** 0.7.3: the row's quiet second line (Mira's tooltip): read with git, what to install, a refused address, too big. */
+ note: string | null;
led: Led;
/** The row's one action, or null. */
action: RowAction | null;
@@ -293,6 +318,53 @@ export const NEEDS_GITHUB = 'Needs your GitHub connection';
export const CANT_READ = 'Can’t read it right now. Trying again.';
export const LOCAL_ONLY = 'Local folder, no remote';
export const hostNotRead = (host: string | null) => `${host ?? 'This host'} isn’t read yet`;
+// 0.7.3 (any-git) copy: Mira's dev-mode/any-git/copy-073.md. Never "forge", "mirror", "clone", "provider",
+// "poll", "ref" or a remote URL in anything the person sees.
+/** §1a `no_git`: no git 2.31 or newer on the server. */
+export const NEEDS_GIT = 'Needs git on the server';
+/** §1a: the server's `install_hint` as a full sentence (an early #366 sent it lower-case, with no full stop). */
+const hintSentence = (t: string) => {
+ const x = t.trim();
+ return x.charAt(0).toUpperCase() + x.slice(1).replace(/[\s.]*$/, '.');
+};
+/** §1a tooltip: "Dev mode reads this repo with git. {install_hint} Then press Refresh." */
+export const noGitTip = (hint: string | null = null) =>
+ hint?.trim() ? `Dev mode reads this repo with git. ${hintSentence(hint)} Then press Refresh.` : 'Dev mode reads this repo with git. Install git 2.31 or newer on the server, then press Refresh.';
+/** §1b: a repo read with plain git (GitLab, Gitea, a plain git server or a folder): landed cards only. */
+export const LANDED_ONLY = 'Landed changes only';
+/** §1b tooltips. With no branch name (the remote's default branch) it says "its default branch" (not in Mira's file). */
+export const gitTip = (r: Pick<DevRepo, 'from' | 'team' | 'branch'>) => {
+ const branch = r.branch || 'its default branch';
+ return r.from === 'local'
+ ? `Read from ${r.team ?? 'this team'}’s folder on the server: shows what lands on ${branch}. It has no remote, so there are no reviews or CI checks.`
+ : `Watching with git: shows what lands on ${branch}. Reviews and CI checks work on GitHub repos for now.`;
+};
+/** §1c: the server's too-big error (`poll_code: 'too_big'`, or its exact sentence). */
+const TOO_BIG_ERROR = /too big for Dev mode to read/i;
+const isTooBig = (r: DevRepo) => r.status === 'error' && (r.poll_code === 'too_big' || TOO_BIG_ERROR.test(r.poll_error ?? ''));
+export const TOO_BIG = 'Too big to read';
+/** §1c no-number sentence: the quiet line when the server sends no words. The size is only ever the server's own
+ * words (the 1 GB cap says "(over 1 GB)", a single git answer over 16 MB doesn't), never matched or added here. */
+export const TOO_BIG_SENTENCE = 'This repo is too big for Dev mode to read.';
+const tooBigNote = (r: DevRepo) => safeError(r.poll_error)?.trim() || TOO_BIG_SENTENCE;
+/** §1d `no_repo` row: the repo address points at this server, or isn't a git address. */
+export const CANT_USE = 'Can’t use this repo address';
+export const CANT_USE_SUB = 'Can’t use the repo address';
+export const cantUseTip = (team: string | null) =>
+ `Dev mode only reads https, ssh or git addresses on another computer. This one points at this server, or isn’t a git address. Change it in ${team ?? 'the team'}’s settings or in the folder’s git remote.`;
+/** A row's quiet second line (Mira's tooltip text, shown so keyboard, touch and screen readers get it too). */
+export const repoNote = (r: DevRepo, hint: string | null = null): string | null => {
+ if (r.status === 'no_git') return noGitTip(hint);
+ if (r.status === 'no_repo') return cantUseTip(r.team);
+ if (isTooBig(r)) return tooBigNote(r);
+ return r.provider === 'git' && r.status === 'watching' ? gitTip(r) : null;
+};
+/** Is this card's repo read with plain git (no forge: no CI tile, no Post button, no "Open on" link)? */
+export const gitOnlyRepo = (s: DevModeState | null, key: unknown): boolean => {
+ if (!s || typeof key !== 'string' || !key.trim()) return false;
+ const k = key.toLowerCase();
+ return s.repos.some((r) => r.key === k && r.provider === 'git');
+};
export const teamNoteText = (team: string, from: DevRepo['from']) =>
from === 'folder' ? `Comes from ${team}’s folder. Change it in the team’s settings.` : `Comes from ${team}’s repo link. Change it in the team’s settings.`;
export const removedText = (repo: string) => `Stopped watching ${repo}. Its cards stay.`;
@@ -310,29 +382,35 @@ export const READY_TITLE = 'Will watch when Dev mode is on';
export const DEV_OFF = 'Dev mode is off';
const rowState = (r: DevRepo, on = true): { state: string; led: Led } => {
- if (r.from === 'local') return { state: LOCAL_ONLY, led: 'off' };
switch (r.status) {
case 'watching': {
if (!on) return { state: READY, led: 'off' };
const t = checkedTime(r.polled_at);
- return { state: t ? `Watching · checked ${t}` : 'Watching', led: 'ok' };
+ const what = r.provider === 'git' ? LANDED_ONLY : 'Watching';
+ return { state: t ? `${what} · checked ${t}` : what, led: 'ok' };
}
case 'not_connected':
return { state: NEEDS_GITHUB, led: 'warn' };
+ case 'no_git':
+ return { state: NEEDS_GIT, led: 'warn' };
+ case 'no_repo':
+ return { state: CANT_USE, led: 'warn' };
case 'other_host':
- return { state: hostNotRead(r.host), led: 'off' };
+ // A 0.7.1/0.7.2 server: a folder with no remote, or a host it doesn't read yet.
+ return { state: r.from === 'local' || !r.host ? LOCAL_ONLY : hostNotRead(r.host), led: 'off' };
case 'error':
- return { state: CANT_READ, led: 'bad' };
+ return { state: isTooBig(r) ? TOO_BIG : CANT_READ, led: 'bad' };
default:
return { state: TOO_MANY, led: 'off' };
}
};
const rowOrigin = (r: DevRepo): string | null =>
- r.added_by === 'hand' ? 'Added by you' : r.team && r.from === 'repo' ? `From ${r.team}’s repo link` : r.team && r.from === 'folder' ? `From ${r.team}’s folder` : null;
+ r.added_by === 'hand' ? 'Added by you' : r.team && r.from === 'repo' ? `From ${r.team}’s repo link` : r.team && (r.from === 'folder' || r.from === 'local') ? `From ${r.team}’s folder` : null;
/** A row's one action: Connect GitHub when the repo needs it, else Remove for a hand-added repo. */
-const rowAction = (r: DevRepo): RowAction | null => (r.status === 'not_connected' ? 'connect' : r.added_by === 'hand' ? 'remove' : null);
+const rowAction = (r: DevRepo): RowAction | null =>
+ r.status === 'not_connected' ? 'connect' : r.added_by === 'hand' ? 'remove' : r.status === 'no_repo' && (r.team_id || r.team) ? 'link' : null;
/** Does this team bring a repo (a watched one, or one found in its folder)? */
const teamHasRepo = (s: DevModeState, t: DevTeamRef) => s.repos.some((r) => r.team_id === t.id || r.team === t.name) || s.sources.some((x) => x.team === t.name);
@@ -340,19 +418,20 @@ const teamHasRepo = (s: DevModeState, t: DevTeamRef) => s.repos.some((r) => r.te
/** The space's teams with no repo at all. */
export const teamsWithoutRepo = (s: DevModeState | null, teams: DevTeamRef[] = []): DevTeamRef[] => (s ? teams.filter((t) => !teamHasRepo(s, t)) : []);
-const repoRow = (r: DevRepo, teams: DevTeamRef[], on = true): RepoRow => ({
+const repoRow = (r: DevRepo, teams: DevTeamRef[], on = true, hint: string | null = null): RepoRow => ({
id: r.key,
team: r.team,
teamId: r.team_id ?? teams.find((t) => t.name === r.team)?.id ?? null,
repo: r,
...rowState(r, on),
origin: rowOrigin(r),
- teamNote: r.added_by !== 'hand' && r.team && (r.from === 'repo' || r.from === 'folder') ? teamNoteText(r.team, r.from) : null,
- title: r.status === 'error' ? safeError(r.poll_error) : null,
+ teamNote: r.added_by !== 'hand' && r.team && (r.from === 'repo' || r.from === 'folder' || r.from === 'local') ? teamNoteText(r.team, r.from === 'local' ? 'folder' : r.from) : null,
+ title: r.status === 'error' ? (isTooBig(r) ? tooBigNote(r) : safeError(r.poll_error)) : null,
+ note: repoNote(r, hint),
action: rowAction(r),
});
-const noRepoRow = (t: DevTeamRef): RepoRow => ({ id: `team:${t.id}`, team: t.name, teamId: t.id, repo: null, state: 'No repo', origin: null, teamNote: null, title: null, led: 'off', action: 'link' });
+const noRepoRow = (t: DevTeamRef): RepoRow => ({ id: `team:${t.id}`, team: t.name, teamId: t.id, repo: null, state: 'No repo', origin: null, teamNote: null, title: null, note: null, led: 'off', action: 'link' });
/**
* The Dev desk's repo list (0.7.2, spec §6 and §9b): one row per repo in team order. Teams with no repo
@@ -360,7 +439,7 @@ const noRepoRow = (t: DevTeamRef): RepoRow => ({ id: `team:${t.id}`, team: t.nam
*/
export function repoRows(s: DevModeState | null, teams: DevTeamRef[] = []): RepoRow[] {
if (!s) return [];
- const rows = s.repos.map((r) => repoRow(r, teams, s.on));
+ const rows = s.repos.map((r) => repoRow(r, teams, s.on, s.install_hint));
if (!s.repos.some((r) => r.status === 'watching')) rows.push(...teamsWithoutRepo(s, teams).map(noRepoRow));
return rows;
}
@@ -381,17 +460,20 @@ export interface StatusLine {
collapsed: boolean;
/** §9b: teams with no repo while some repo is watched, folded into one quiet last line. */
noRepoTeams: DevTeamRef[];
+ /** 0.7.3, one repo: the quiet line under it (see repoNote). */
+ note: string | null;
}
const NO_REPO = 'No git repo in this space’s folders yet. The floor and guards are on.';
/** Repos that need the person: not connected or failing (spec §9b: teams with no repo never count). */
-export const needsYouCount = (s: DevModeState) => s.repos.filter((r) => r.status === 'not_connected' || r.status === 'error').length;
+export const needsYouCount = (s: DevModeState) =>
+ s.repos.filter((r) => r.status === 'not_connected' || r.status === 'error' || r.status === 'no_git' || r.status === 'no_repo').length;
/** The summary over several repos: "Watching 4 repos", or "Watching 3 of 4 repos · 1 needs you". */
export function reposSummary(s: DevModeState): string {
const total = s.repos.length;
- const n = s.repos.filter((r) => r.status === 'watching' && r.from !== 'local').length;
+ const n = s.repos.filter((r) => r.status === 'watching').length;
if (!total) return 'No repos yet';
const need = needsYouCount(s);
// Off (answer 2): the same count reads as ready, never as watched.
@@ -409,13 +491,15 @@ export function reposSummary(s: DevModeState): string {
export const noRepoTeamsText = (n: number) => (n === 1 ? '1 team has no repo' : `${n} teams have no repo`);
/** One repo as a single line, as in 0.7.1: "Watching demo-org/app · main". */
-function singleLine(r: DevRepo, on = true): Omit<StatusLine, 'rows' | 'collapsed' | 'noRepoTeams'> {
+function singleLine(r: DevRepo, on = true): Omit<StatusLine, 'rows' | 'collapsed' | 'noRepoTeams' | 'note'> {
const { state, led } = rowState(r, on);
const action = rowAction(r);
- if (r.status === 'watching' && r.from !== 'local' && !on)
- return { status: 'watching', led, action, parts: [{ text: r.repo, mono: true }, { text: ' · ' }, { text: r.branch || 'main', mono: true, branch: true }, { text: ` · ${READY}` }] };
- if (r.status === 'watching' && r.from !== 'local')
- return { status: 'watching', led, action, parts: [{ text: 'Watching ' }, { text: r.repo, mono: true }, { text: ' · ' }, { text: r.branch || 'main', mono: true, branch: true }] };
+ // A git row's branch can be '' (the remote's default, name unknown): no branch, never "main" (copy-073 §3.2).
+ const git = r.provider === 'git';
+ const branch: StatusLine['parts'] = git && !r.branch ? [] : [{ text: ' · ' }, { text: r.branch || 'main', mono: true, branch: true }];
+ if (r.status === 'watching' && !on) return { status: 'watching', led, action, parts: [{ text: r.repo, mono: true }, ...branch, { text: ` · ${READY}` }] };
+ if (r.status === 'watching')
+ return { status: 'watching', led, action, parts: [{ text: 'Watching ' }, { text: r.repo, mono: true }, ...branch, ...(git ? [{ text: ' · landed changes only' }] : [])] };
return { status: r.status, led, action, parts: [{ text: r.repo, mono: true }, { text: ` · ${state}` }] };
}
@@ -426,15 +510,18 @@ export function statusLine(s: DevModeState | null, teams: DevTeamRef[] = []): St
const noRepoTeams = s.repos.some((r) => r.status === 'watching') ? teamsWithoutRepo(s, teams) : [];
// GitHub isn't connected and no repo was read yet: Connect first, as in 0.7.1.
if (rows.length === 0 && s.status === 'not_connected')
- return { status: 'not_connected', parts: [{ text: 'Reviews need your GitHub connection.' }], action: 'connect', led: 'warn', rows: [], collapsed: false, noRepoTeams };
- if (rows.length === 0) return { status: 'no_repo', parts: [{ text: NO_REPO }], action: 'link', led: 'off', rows: [], collapsed: false, noRepoTeams };
+ return { status: 'not_connected', parts: [{ text: 'Reviews need your GitHub connection.' }], action: 'connect', led: 'warn', rows: [], collapsed: false, noRepoTeams, note: null };
+ // 0.7.3: the server can't read a repo without git, and none is watched yet.
+ if (rows.length === 0 && s.status === 'no_git')
+ return { status: 'no_git', parts: [{ text: NEEDS_GIT }], action: null, led: 'warn', rows: [], collapsed: false, noRepoTeams, note: noGitTip(s.install_hint) };
+ if (rows.length === 0) return { status: 'no_repo', parts: [{ text: NO_REPO }], action: 'link', led: 'off', rows: [], collapsed: false, noRepoTeams, note: null };
if (rows.length === 1) {
const r = rows[0];
- if (!r.repo) return { status: 'no_repo', parts: [{ text: NO_REPO }], action: 'link', led: 'off', rows: [], collapsed: false, noRepoTeams };
- return { ...singleLine(r.repo, s.on), rows: [], collapsed: false, noRepoTeams };
+ if (!r.repo) return { status: 'no_repo', parts: [{ text: NO_REPO }], action: 'link', led: 'off', rows: [], collapsed: false, noRepoTeams, note: null };
+ return { ...singleLine(r.repo, s.on), rows: [], collapsed: false, noRepoTeams, note: repoNote(r.repo, s.install_hint) };
}
const led: Led = rows.some((r) => r.led === 'bad') ? 'bad' : rows.some((r) => r.led === 'warn') ? 'warn' : rows.some((r) => r.led === 'ok') ? 'ok' : 'off';
- return { status: s.status, parts: [{ text: reposSummary(s) }], action: null, led, rows, collapsed: rows.length > LIST_OPEN_MAX, noRepoTeams };
+ return { status: s.status, parts: [{ text: reposSummary(s) }], action: null, led, rows, collapsed: rows.length > LIST_OPEN_MAX, noRepoTeams, note: null };
}
/** The toast after the switch turns Dev mode on (flow F3, Mira's flow copy §3). `action` is the
@@ -459,8 +546,13 @@ export function onToast(s: DevModeState | null): OnToast {
const watched = s.repos.filter((r) => r.status === 'watching');
const first = watched[0] ?? s.repos.find((r) => r.from === 'local') ?? null;
if (watched.length > 1) return { title: ON, body: [{ text: `${reposSummary(s)}.` }], action: 'open', checking: false };
- if (first?.from === 'local')
+ // A 0.7.2 server watches nothing in a folder with no remote; 0.7.3 reads it with git (a watching row).
+ if (first?.from === 'local' && first.status !== 'watching')
return { title: GUARDS, body: [{ text: `${first.team ?? 'This team'}’s folder has a local repo with no remote. The floor works now.` }], action: 'open', checking: false };
+ if (first?.provider === 'git') {
+ const on: OnToast['body'] = first.branch ? [{ text: ' on ' }, { text: first.branch, mono: true }] : [];
+ return { title: ON, body: [{ text: 'Watching ' }, { text: first.repo, mono: true }, ...on, { text: '. Landed changes only for now.' }], action: 'open', checking: false };
+ }
return {
title: ON,
body: [{ text: 'Watching ' }, { text: first?.repo ?? s.repo ?? '', mono: true }, { text: ' on ' }, { text: first?.branch || s.branch || 'main', mono: true }, { text: '.' }],
@@ -477,6 +569,15 @@ export function onToast(s: DevModeState | null): OnToast {
checking: false,
};
}
+ case 'no_git': {
+ const repo = s.repos.find((r) => r.status === 'no_git')?.repo ?? s.repo ?? s.sources[0]?.repo;
+ return {
+ title: GUARDS,
+ body: repo ? [{ text: 'Needs git on the server to read ' }, { text: repo, mono: true }, { text: '. The floor works now.' }] : [{ text: 'Needs git on the server to read this repo. The floor works now.' }],
+ action: 'open',
+ checking: false,
+ };
+ }
case 'other_host': {
const host = s.repos.find((r) => r.status === 'other_host' && r.host)?.host ?? s.sources.find((x) => x.host && x.host !== 'github.com')?.host;
return {
@@ -486,8 +587,12 @@ export function onToast(s: DevModeState | null): OnToast {
checking: false,
};
}
- default:
+ default: {
+ // copy-073 §1d: the team has a repo, but its address was refused.
+ const refused = s.repos.find((r) => r.status === 'no_repo');
+ if (refused) return { title: GUARDS, body: [{ text: 'Can’t use ' }, { text: refused.repo, mono: true }, { text: '’s address. The floor works now.' }], action: 'open', checking: false };
return { title: GUARDS, body: [{ text: 'No git repo in this space’s folders yet. The floor works now.' }], action: 'type', checking: false };
+ }
}
}
@@ -496,7 +601,7 @@ export function onToast(s: DevModeState | null): OnToast {
/** The short name on a filter chip: the repo's last part ("app"), or owner/name when two share it. */
export function repoFilters(s: DevModeState | null): Array<{ key: string; label: string; repo: string }> {
- const list = (s?.repos ?? []).filter((r) => r.status !== 'too_many' && r.status !== 'other_host');
+ const list = (s?.repos ?? []).filter((r) => r.status !== 'too_many' && r.status !== 'other_host' && r.status !== 'no_git' && r.status !== 'no_repo');
if (list.length < 2) return [];
const short = (r: DevRepo) => r.repo.replace(/\/+$/, '').split('/').pop() || r.repo;
const counts = new Map<string, number>();
@@ -763,7 +868,7 @@ export const EXPLAINER = {
notOwner: 'Only the space owner can turn on Dev mode.',
} as const;
-export type DevSubState = 'loading' | 'off' | 'disabled' | 'watching' | 'several' | 'partial' | 'no_repo' | 'not_connected' | 'other_host' | 'error' | 'armed';
+export type DevSubState = 'loading' | 'off' | 'disabled' | 'watching' | 'several' | 'partial' | 'no_repo' | 'not_connected' | 'no_git' | 'no_address' | 'other_host' | 'error' | 'armed';
export type DevSubAction = 'repos' | 'link' | 'connect';
export interface DevSub {
@@ -799,7 +904,8 @@ export const devListPending = (s: DevModeState | null, o: { loading?: boolean; t
/**
* The Dev mode row's one line under the label (spec §2). Which state wins: armed, then if any
- * repo is watched several / partial / watching, else error, not_connected, other_host, no_repo. Counts
+ * repo is watched several / partial / watching, else error, not_connected, no_git, a refused address
+ * (no_address), other_host, no_repo. Counts
* come straight from repos[]; nothing is added up beyond counting rows.
*/
export function devSubLine(s: DevModeState | null, o: { armed?: boolean; disabled?: boolean; turningOn?: boolean; loading?: boolean } = {}): DevSub {
@@ -818,6 +924,8 @@ export function devSubLine(s: DevModeState | null, o: { armed?: boolean; disable
if (watching.length) {
if (repos.length === 1) {
const r = watching[0];
+ // copy-073 §3.2: a git row with no branch name shows none, never "main".
+ if (r.provider === 'git' && !r.branch) return sub('watching', 'ok', [{ text: 'Watching ' }, { text: r.repo, repo: true }]);
return sub('watching', 'ok', [{ text: 'Watching ' }, { text: r.repo, repo: true }, { text: ' · ' }, { text: r.branch ?? 'main', branch: true }]);
}
if (watching.length === repos.length) return sub('several', 'ok', `Watching ${watching.length} repos`, 'repos');
@@ -826,6 +934,8 @@ export function devSubLine(s: DevModeState | null, o: { armed?: boolean; disable
const failed = repos.filter((r) => r.status === 'error').length;
if (failed) return sub('error', 'bad', failed === 1 ? 'Can’t read a repo' : `Can’t read ${failed} repos`, 'repos');
if (repos.some((r) => r.status === 'not_connected')) return sub('not_connected', 'warn', 'Needs GitHub', 'connect');
+ if (repos.some((r) => r.status === 'no_git') || s.status === 'no_git') return sub('no_git', 'warn', NEEDS_GIT, 'repos');
+ if (repos.some((r) => r.status === 'no_repo')) return sub('no_address', 'warn', CANT_USE_SUB, 'repos');
const other = repos.find((r) => r.status === 'other_host');
if (other) {
if (other.from === 'local' || !other.host) return sub('other_host', 'off', 'Local folder, no remote');
@@ -1126,6 +1236,7 @@ export const devStore = {
};
export const emptyState = (): DevModeState => ({
+ install_hint: null,
on: false,
repo: null,
branch: null,
diff --git a/frontend/src/styles/devStatus.css b/frontend/src/styles/devStatus.css
index e7a4cb98..c5879ec4 100644
--- a/frontend/src/styles/devStatus.css
+++ b/frontend/src/styles/devStatus.css
@@ -261,6 +261,8 @@
/* 0.7.2 final copy (dev-mode-explainer/spec.md §6, §9b): second line, team note, the quiet no-repo line
and the Remove toast. Muted text is --t3 (AA on the side surface); actions are --accent. */
.kw-dv-repo-origin { margin: -4px 0 6px 18px; font-size: 12px; line-height: 18px; color: var(--t3); overflow-wrap: anywhere; }
+/* 0.7.3: the quiet line under a single repo (plain git: landed only; no_git: what to install). */
+.kw-dv-line-note { margin: 2px 0 6px 18px; font-size: 12px; line-height: 18px; color: var(--t3); overflow-wrap: anywhere; }
.kw-dv-repo-state { overflow-wrap: anywhere; }
.kw-dv-repo[data-s='error'] .kw-dv-repo-state { color: var(--dv-led-bad); }
/* Ada's answer 2: Dev mode off, a `watching` repo is ready, not watched. A neutral chip, never green. */
diff --git a/frontend/tests/devAnyGit.test.mjs b/frontend/tests/devAnyGit.test.mjs
new file mode 100644
index 00000000..06513c6f
--- /dev/null
+++ b/frontend/tests/devAnyGit.test.mjs
@@ -0,0 +1,294 @@
+// 0.7.3 any-git desk (#366; copy: Mira's dev-mode/any-git/copy-073.md): the Dev desk knows `no_git`
+// and refused-address `no_repo` rows and the too-big error, reads plain-git repos (GitLab, Gitea, a folder
+// with no remote) as watching "landed changes only" with a quiet tooltip line, and gives their cards no CI tile, no Post button and no forge link.
+// `other_host` is retired but an older server still sends it. Demo data only: no real repos or tokens.
+process.env.TZ = 'UTC';
+
+import assert from 'node:assert/strict';
+import test from 'node:test';
+import { JSDOM } from 'jsdom';
+import { loadBundled } from './bundle.mjs';
+
+const dom = new JSDOM('<!doctype html><html><body></body></html>', { url: 'http://localhost/s/spc_demo', pretendToBeVisual: true });
+const g = globalThis;
+for (const k of ['window', 'document', 'navigator', 'HTMLElement', 'Element', 'Node', 'Event', 'MouseEvent', 'KeyboardEvent', 'requestAnimationFrame', 'cancelAnimationFrame', 'getComputedStyle', 'localStorage', 'sessionStorage']) {
+ if (!(k in dom.window)) continue;
+ Object.defineProperty(g, k, { value: dom.window[k], configurable: true, writable: true });
+}
+g.window.matchMedia ??= () => ({ matches: false, addEventListener() {}, removeEventListener() {} });
+
+const m = await loadBundled(`
+ export * from './src/devMode';
+ export { parseLanded } from './src/dev/types';
+ export * as fx from './src/dev/fixtures';
+ export { LandedCard } from './src/components/dev/LandedCard';
+ export { DevStatusLine } from './src/components/DevStatusLine';
+ export { Rollup } from './src/components/DevDeskSlots';
+ export { parseLandedPage } from './src/dev/shellTypes';
+ export { renderToStaticMarkup } from 'react-dom/server.browser';
+ export { createElement } from 'react';
+`);
+const h = m.createElement;
+const html = (C, props) => m.renderToStaticMarkup(h(C, props));
+
+const row = (over) => ({ team: null, team_id: null, from: 'folder', branch: 'main', status: 'watching', poll_error: null, polled_at: '2026-11-06T09:00:00Z', last_tag: null, added_by: 'team', ...over });
+const APP = row({ provider: 'github', key: 'github.com/demo-org/app', repo: 'demo-org/app', host: 'github.com', team: 'App', team_id: 'tm_app' });
+const LAB = row({ provider: 'git', key: 'gitlab.example.test/demo/lab', repo: 'https://gitlab.example.test/demo/lab', host: 'gitlab.example.test', team: 'Lab', team_id: 'tm_lab', branch: 'trunk' });
+const NOTES = row({ provider: 'git', key: 'local:notes', repo: 'notes', host: null, team: 'Notes', team_id: 'tm_notes', from: 'local' });
+const NO_GIT = row({ provider: 'git', key: 'gitea.example.test/demo/wiki', repo: 'https://gitea.example.test/demo/wiki', host: 'gitea.example.test', team: 'Wiki', team_id: 'tm_wiki', branch: null, status: 'no_git', polled_at: null, added_by: null });
+const NO_FETCH = row({ provider: 'git', key: 'local:ops', repo: 'file:///srv/ops.git', host: null, team: 'Ops', team_id: 'tm_ops', branch: null, status: 'no_repo', polled_at: null, added_by: null });
+const OLD_LAB = row({ ...LAB, provider: undefined, branch: null, status: 'other_host', polled_at: null, added_by: null });
+const OLD_LOCAL = row({ ...NOTES, provider: undefined, branch: null, status: 'other_host', polled_at: null, added_by: null });
+// A server before 6dd0243: no provider, the desk guesses from the host.
+const noProvider = ({ provider, ...r }) => r;
+const HINT = 'Install git 2.31 or newer on the server.';
+// Mira's copy-073.md §1a–§1d.
+const NO_GIT_TIP = 'Dev mode reads this repo with git. Install git 2.31 or newer on the server. Then press Refresh.';
+const NO_GIT_TIP_OLD = 'Dev mode reads this repo with git. Install git 2.31 or newer on the server, then press Refresh.';
+const GIT_TIP = 'Watching with git: shows what lands on trunk. Reviews and CI checks work on GitHub repos for now.';
+const LOCAL_TIP = 'Read from Notes’s folder on the server: shows what lands on main. It has no remote, so there are no reviews or CI checks.';
+const CANT_USE_TIP = 'Dev mode only reads https, ssh or git addresses on another computer. This one points at this server, or isn’t a git address. Change it in Ops’s settings or in the folder’s git remote.';
+
+const state = (over = {}) => m.parseDevMode({ on: true, repo: null, branch: null, sources: [], status: 'watching', forge: 'github', forge_login: 'kwant-bot', ...over });
+const texts = (parts) => parts.map((p) => p.text);
+
+test('parse: no_git and no_repo rows are kept, install_hint and poll_code are read, other_host still parses', () => {
+ const s = state({ status: 'no_git', install_hint: HINT, repos: [NO_GIT, NO_FETCH, OLD_LAB, { ...APP, key: 'github.com/demo-org/x', status: 'bogus' }] });
+ assert.equal(s.status, 'no_git');
+ assert.equal(s.install_hint, HINT);
+ assert.deepEqual(s.repos.map((r) => [r.key, r.status]), [
+ ['gitea.example.test/demo/wiki', 'no_git'],
+ ['local:ops', 'no_repo'],
+ ['gitlab.example.test/demo/lab', 'other_host'],
+ ]);
+ assert.equal(state({ status: 'other_host', repos: [OLD_LAB] }).status, 'other_host');
+ assert.equal(state({ repos: [APP] }).install_hint, null);
+ assert.equal(state({ repos: [{ ...LAB, status: 'error', poll_code: 'too_big' }] }).repos[0].poll_code, 'too_big');
+ assert.equal(state({ repos: [APP] }).repos[0].poll_code, null);
+});
+
+test('provider: the server’s value wins; else git for a local folder or any host but github.com', () => {
+ const [app, lab, notes] = state({ repos: [APP, LAB, NOTES] }).repos;
+ assert.deepEqual([app.provider, lab.provider, notes.provider], ['github', 'git', 'git']);
+ assert.equal(state({ repos: [{ ...APP, provider: 'git' }] }).repos[0].provider, 'git');
+ // Fallback for a server before 6dd0243 (no provider): the host guess.
+ const [oApp, oLab, oNotes] = state({ repos: [APP, LAB, NOTES].map(noProvider) }).repos;
+ assert.deepEqual([oApp.provider, oLab.provider, oNotes.provider], ['github', 'git', 'git']);
+ assert.equal(state({ repos: [{ ...LAB, provider: 'gitlab' }] }).repos[0].provider, 'git', 'an unknown value falls back to the guess');
+});
+
+test('provider beats the host guess: a GitHub Enterprise host the server calls github keeps CI, Post and its link', () => {
+ const GHE = row({ provider: 'github', key: 'ghe.example.test/demo/core', repo: 'demo/core', host: 'ghe.example.test', team: 'Core', team_id: 'tm_core' });
+ const s = state({ repos: [GHE] });
+ assert.equal(s.repos[0].provider, 'github');
+ assert.equal(m.gitOnlyRepo(s, 'ghe.example.test/demo/core'), false);
+ assert.equal(m.statusLine(s).note, null, 'no plain-git line');
+ assert.deepEqual(texts(m.statusLine(s).parts), ['Watching ', 'demo/core', ' · ', 'main']);
+ assert.equal(m.repoRows(state({ repos: [APP, GHE] }))[1].state, 'Watching · checked 09:00');
+ // The same row from an older server is guessed as plain git.
+ assert.ok(m.gitOnlyRepo(state({ repos: [noProvider(GHE)] }), 'ghe.example.test/demo/core'));
+ // Rendered: what the desk passes to the card for this repo keeps the CI tile and Post.
+ const card = { ...m.parseLanded(m.fx.LANDED_DIRECT), repo: 'ghe.example.test/demo/core' };
+ const out = html(m.LandedCard, { card, forge: 'github', gitOnly: m.gitOnlyRepo(s, card.repo) });
+ assert.match(out, /data-tests="passed"/);
+ assert.match(out, /Open on GitHub/);
+ assert.doesNotMatch(out, /data-git-only/);
+});
+
+test('watching (plain git): "Watching {repo} · {branch} · landed changes only", the tooltip line, no action', () => {
+ const s = state({ repos: [LAB] });
+ const l = m.statusLine(s);
+ assert.equal(l.status, 'watching');
+ assert.equal(l.led, 'ok');
+ assert.deepEqual(texts(l.parts), ['Watching ', 'https://gitlab.example.test/demo/lab', ' · ', 'trunk', ' · landed changes only']);
+ assert.equal(l.note, GIT_TIP);
+ assert.equal(l.action, null);
+ assert.ok(m.gitOnlyRepo(s, 'gitlab.example.test/demo/lab'));
+ assert.ok(m.gitOnlyRepo(s, 'GitLab.example.test/demo/lab'), 'keys match case-blind');
+ assert.deepEqual(texts(m.devSubLine(s).parts), ['Watching ', 'https://gitlab.example.test/demo/lab', ' · ', 'trunk']);
+ assert.deepEqual(texts(m.onToast(s).body), ['Watching ', 'https://gitlab.example.test/demo/lab', ' on ', 'trunk', '. Landed changes only for now.']);
+ assert.equal(m.onToast(s).title, 'Dev mode on');
+ const out = html(m.DevStatusLine, { spaceId: 'spc_demo', state: s });
+ assert.match(out, /data-dv-line-note="true">Watching with git: shows what lands on trunk\. Reviews and CI checks work on GitHub repos for now\.</);
+ assert.match(out, /aria-describedby="[^"]+-note"/, 'the line is described by its note');
+ assert.doesNotMatch(out, /Connect GitHub|Link a repo/);
+ // No branch name (the remote's default): no branch anywhere, never "main".
+ const bare = state({ repos: [{ ...LAB, branch: '' }] });
+ assert.deepEqual(texts(m.statusLine(bare).parts), ['Watching ', 'https://gitlab.example.test/demo/lab', ' · landed changes only']);
+ assert.deepEqual(texts(m.devSubLine(bare).parts), ['Watching ', 'https://gitlab.example.test/demo/lab']);
+ assert.deepEqual(texts(m.onToast(bare).body), ['Watching ', 'https://gitlab.example.test/demo/lab', '. Landed changes only for now.']);
+ assert.match(m.statusLine(bare).note, /shows what lands on its default branch\./);
+});
+
+test('watching (GitHub): no quiet line, cards keep CI and Post', () => {
+ const s = state({ repos: [APP] });
+ assert.equal(m.statusLine(s).note, null);
+ assert.deepEqual(texts(m.statusLine(s).parts), ['Watching ', 'demo-org/app', ' · ', 'main']);
+ assert.equal(m.gitOnlyRepo(s, 'github.com/demo-org/app'), false);
+ assert.equal(m.gitOnlyRepo(s, null), false);
+ assert.deepEqual(texts(m.onToast(s).body), ['Watching ', 'demo-org/app', ' on ', 'main', '.']);
+ assert.doesNotMatch(html(m.DevStatusLine, { spaceId: 'spc_demo', state: s }), /data-dv-line-note/);
+});
+
+test('watching (a folder with no remote): read with git, "Landed changes only", counted as watched', () => {
+ const s = state({ repos: [APP, NOTES] });
+ const rows = m.repoRows(s);
+ assert.equal(rows[1].state, 'Landed changes only · checked 09:00');
+ assert.equal(rows[1].led, 'ok');
+ assert.equal(rows[1].note, LOCAL_TIP);
+ assert.equal(rows[1].origin, 'From Notes’s folder');
+ assert.equal(rows[0].state, 'Watching · checked 09:00');
+ assert.equal(rows[0].note, null);
+ assert.equal(m.repoRows(state({ repos: [APP, { ...NOTES, polled_at: null }] }))[1].state, 'Landed changes only');
+ assert.equal(m.reposSummary(s), 'Watching 2 repos');
+ assert.equal(m.devSubLine(s).state, 'several');
+ assert.deepEqual(m.repoFilters(s).map((f) => f.label), ['app', 'notes']);
+ const out = html(m.DevStatusLine, { spaceId: 'spc_demo', state: s });
+ assert.match(out, /data-dv-repo-note="true">Read from Notes’s folder on the server/);
+ assert.match(out, /data-dv-repo-state="true" aria-describedby="([^"]+-note-1)">Landed changes only · checked 09:00<\/span>/);
+ assert.doesNotMatch(out, /Local folder, no remote/);
+ // The 0.7.1 shape (no repos[]): a local source is no longer turned into other_host.
+ const legacy = m.parseDevMode({ on: true, status: 'watching', repo: 'notes', sources: [{ team: 'Notes', repo: 'notes', host: null, from: 'local' }] });
+ assert.equal(legacy.repos[0].status, 'watching');
+ assert.equal(legacy.repos[0].provider, 'git');
+});
+
+test('no_git: "Needs git on the server", the install_hint tooltip line, needs you, no button', () => {
+ const s = state({ status: 'no_git', install_hint: HINT, repos: [NO_GIT] });
+ const l = m.statusLine(s);
+ assert.equal(l.status, 'no_git');
+ assert.equal(l.led, 'warn');
+ assert.deepEqual(texts(l.parts), ['https://gitea.example.test/demo/wiki', ' · Needs git on the server']);
+ assert.equal(l.note, NO_GIT_TIP);
+ assert.equal(l.action, null);
+ assert.equal(m.needsYouCount(s), 1);
+ assert.deepEqual([m.devSubLine(s).state, m.devSubLine(s).led, m.devSubLine(s).parts[0].text], ['no_git', 'warn', 'Needs git on the server']);
+ const t = m.onToast(s);
+ assert.equal(t.title, 'Dev mode on · guards are up');
+ assert.deepEqual(texts(t.body), ['Needs git on the server to read ', 'https://gitea.example.test/demo/wiki', '. The floor works now.']);
+ assert.equal(t.action, 'open');
+ assert.deepEqual(m.repoFilters(state({ repos: [APP, NO_GIT] })), [], 'a repo Dev mode can’t read gets no filter chip');
+ // The tooltip follows the server's hint (an early #366 sent it lower-case), and an older server's falls back to Mira's table.
+ assert.equal(m.noGitTip('install git 2.40 or newer on the server'), 'Dev mode reads this repo with git. Install git 2.40 or newer on the server. Then press Refresh.');
+ assert.equal(m.noGitTip(null), NO_GIT_TIP_OLD);
+ assert.equal(m.statusLine(state({ status: 'no_git', repos: [NO_GIT] })).note, NO_GIT_TIP_OLD);
+ // No rows at all: the line says it, the tooltip goes under it.
+ const bare = m.statusLine(state({ status: 'no_git', install_hint: HINT, repos: [] }));
+ assert.deepEqual([bare.status, bare.parts[0].text, bare.note, bare.action], ['no_git', 'Needs git on the server', NO_GIT_TIP, null]);
+ // In a list: the row's state and its quiet line, next to a watched repo (partial, 1 needs you).
+ const both = state({ status: 'watching', install_hint: HINT, repos: [APP, NO_GIT] });
+ assert.equal(m.reposSummary(both), 'Watching 1 of 2 repos · 1 needs you');
+ assert.equal(m.repoRows(both)[1].note, NO_GIT_TIP);
+ const out = html(m.DevStatusLine, { spaceId: 'spc_demo', state: both });
+ assert.match(out, />Needs git on the server<\/span>/);
+ assert.match(out, /Dev mode reads this repo with git\. Install git 2\.31 or newer on the server\. Then press Refresh\./);
+ assert.doesNotMatch(out, /Connect GitHub|Link a repo/, 'nothing in the app fixes it: no button');
+});
+
+test('no_repo row (a refused address): "Can’t use this repo address", needs you, Link a repo for its team', () => {
+ const s = state({ status: 'no_repo', repos: [NO_FETCH] });
+ const r = m.repoRows(s)[0];
+ assert.deepEqual([r.state, r.led, r.action, r.note], ['Can’t use this repo address', 'warn', 'link', CANT_USE_TIP]);
+ assert.equal(r.teamNote, 'Comes from Ops’s folder. Change it in the team’s settings.');
+ const l = m.statusLine(s);
+ assert.deepEqual([texts(l.parts), l.action, l.led], [['file:///srv/ops.git', ' · Can’t use this repo address'], 'link', 'warn']);
+ assert.equal(m.needsYouCount(s), 1);
+ assert.deepEqual([m.devSubLine(s).state, m.devSubLine(s).led, m.devSubLine(s).parts[0].text], ['no_address', 'warn', 'Can’t use the repo address']);
+ const t = m.onToast(s);
+ assert.deepEqual([t.title, texts(t.body), t.action], ['Dev mode on · guards are up', ['Can’t use ', 'file:///srv/ops.git', '’s address. The floor works now.'], 'open']);
+ // The true "no repo anywhere" keeps the 0.7.2 copy.
+ assert.equal(m.devSubLine(state({ status: 'no_repo', repos: [] })).parts[0].text, 'No repo yet');
+ assert.match(texts(m.onToast(state({ status: 'no_repo', repos: [] })).body).join(''), /No git repo in this space’s folders yet/);
+ // Sidebar order: no_git wins over a refused address.
+ assert.equal(m.devSubLine(state({ status: 'no_git', repos: [NO_FETCH, NO_GIT] })).state, 'no_git');
+ const out = html(m.DevStatusLine, { spaceId: 'spc_demo', state: s, teams: [{ id: 'tm_ops', name: 'Ops' }] });
+ assert.match(out, /Can’t use this repo address/);
+ assert.match(out, /Dev mode only reads https, ssh or git addresses/);
+ assert.match(out, /Link a repo/);
+});
+
+test('too big (error): the row always reads "Too big to read"; the quiet line is the server\'s own words', () => {
+ const CAP = 'This repo is too big for Dev mode to read (over 1 GB).';
+ const ONE = 'This repo is too big for Dev mode to read.';
+ // 679fe98: both too-big errors carry poll_code too_big. The 1 GB mirror cap:
+ const cap = { ...LAB, status: 'error', poll_code: 'too_big', poll_error: CAP };
+ const r = m.repoRows(state({ repos: [APP, cap] }))[1];
+ assert.deepEqual([r.state, r.led, r.note, r.title], ['Too big to read', 'bad', CAP, CAP]);
+ assert.deepEqual(texts(m.statusLine(state({ repos: [cap] })).parts), ['https://gitlab.example.test/demo/lab', ' · Too big to read']);
+ assert.equal(m.statusLine(state({ repos: [cap] })).note, CAP);
+ // A single git answer over 16 MB: same row, no size anywhere.
+ const one = m.repoRows(state({ repos: [APP, { ...cap, poll_error: ONE }] }))[1];
+ assert.deepEqual([one.state, one.note, one.title], ['Too big to read', ONE, ONE]);
+ // Keyed off the code, not the words; empty words fall back to Mira's no-number sentence.
+ assert.equal(m.repoRows(state({ repos: [APP, { ...cap, poll_error: 'Some other wording.' }] }))[1].state, 'Too big to read');
+ for (const e of ['', ' ', null]) {
+ const x = m.repoRows(state({ repos: [APP, { ...cap, poll_error: e }] }))[1];
+ assert.deepEqual([x.state, x.note, x.title], ['Too big to read', ONE, ONE]);
+ }
+ // Fallback, older server with no code: the exact sentence, and the row text is still just "Too big to read".
+ for (const e of [CAP, ONE]) {
+ const old = m.repoRows(state({ repos: [APP, { ...LAB, status: 'error', poll_error: e }] }))[1];
+ assert.deepEqual([old.state, old.note], ['Too big to read', e]);
+ }
+ // Nothing the desk writes in the row says "(over 1 GB)".
+ for (const rows of [[APP, cap], [cap]]) {
+ const s = state({ repos: rows });
+ const out = html(m.DevStatusLine, { spaceId: 'spc_demo', state: s, teams: [] });
+ assert.doesNotMatch([...m.repoRows(s).map((x) => x.state), ...texts(m.statusLine(s).parts)].join(' '), /over 1 GB/);
+ assert.match(out, /Too big to read/);
+ }
+ // A code on a non-error row changes nothing.
+ assert.equal(m.repoRows(state({ repos: [APP, { ...LAB, poll_code: 'too_big' }] }))[1].state, 'Landed changes only · checked 09:00');
+ // Any other error keeps "Can't read it right now".
+ assert.equal(m.repoRows(state({ repos: [APP, { ...LAB, status: 'error', poll_error: 'Couldn’t reach the repo’s host.' }] }))[1].state, 'Can’t read it right now. Trying again.');
+ assert.equal(m.devSubLine(state({ repos: [cap] })).parts[0].text, 'Can’t read a repo');
+});
+
+test('other_host from an older server shows as before: "{host} isn’t read yet", a folder "Local folder, no remote"', () => {
+ const s = state({ status: 'other_host', repos: [OLD_LAB] });
+ assert.deepEqual(m.statusLine(s).parts.map((p) => p.text), ['https://gitlab.example.test/demo/lab', ' · gitlab.example.test isn’t read yet']);
+ assert.equal(m.devSubLine(s).state, 'other_host');
+ assert.equal(m.onToast(s).title, 'Dev mode on · guards are up');
+ const local = state({ status: 'other_host', repos: [OLD_LOCAL] });
+ assert.match(m.statusLine(local).parts.map((p) => p.text).join(''), /Local folder, no remote/);
+ assert.equal(m.devSubLine(local).parts[0].text, 'Local folder, no remote');
+ assert.equal(m.statusLine(local).note, null, 'no plain-git line: the older server isn’t reading it');
+});
+
+test('a plain-git repo’s landed card: no CI tile, no "Open on GitHub", no Diff link; GitHub cards keep them', () => {
+ const card = { ...m.parseLanded(m.fx.LANDED_DIRECT), repo: 'gitlab.example.test/demo/lab' };
+ const git = html(m.LandedCard, { card, forge: 'github', gitOnly: true });
+ assert.match(git, /data-git-only="true"/);
+ assert.doesNotMatch(git, /data-tests=/);
+ assert.doesNotMatch(git, /Tests passed|see CI/);
+ assert.doesNotMatch(git, /Open on GitHub|Open commit|>Diff</);
+ assert.match(git, /Fix typo in README/, 'the card still says what landed');
+ const gh = html(m.LandedCard, { card, forge: 'github' });
+ assert.match(gh, /data-tests="passed"/);
+ assert.match(gh, /Open on GitHub/);
+ assert.doesNotMatch(gh, /data-git-only/);
+});
+
+test('main_green null (6dd0243: only git-only repos landed): no green or red chip, nothing faked; true and false still show', () => {
+ const page = (main_green, repo) => m.parseLandedPage({
+ cards: [{ ...m.fx.LANDED_DIRECT, repo }],
+ rollup: { since: '2026-11-06T00:00:00Z', until: '2026-11-06T15:00:00Z', count: 1, needs_you: 0, main_green, areas: [{ area: 'Docs', count: 1, first_headline: 'Fix typo' }] },
+ last_tag: null, last_merge: null,
+ });
+ const chip = (p) => html(m.Rollup, { rollup: p.rollup, last_merge: null, branch: 'trunk', cards: p.cards });
+ const gitOnly = page(null, 'gitlab.example.test/demo/lab');
+ assert.equal(gitOnly.rollup.main_green, null);
+ const out = chip(gitOnly);
+ assert.match(out, /data-dev-rollup=/);
+ assert.doesNotMatch(out, /is green|is red|kw-chip-ok|kw-chip-bad/);
+ assert.equal(m.parseLandedPage({ rollup: { count: 0, needs_you: 0, areas: [] } }).rollup.main_green, null, 'a missing field reads as null, not false');
+ assert.match(chip(page(true, 'github.com/demo-org/app')), /trunk is green/);
+ assert.match(chip(page(false, 'github.com/demo-org/app')), /trunk is red/);
+});
+
+test('no_git with 6dd0243’s full-sentence install_hint: one full stop, never two', () => {
+ const tip = m.statusLine(state({ status: 'no_git', install_hint: 'Install git 2.31 or newer on the server.', repos: [NO_GIT] })).note;
+ assert.equal(tip, NO_GIT_TIP);
+ assert.doesNotMatch(tip, /\.\./);
+ assert.equal(m.noGitTip('Install git 2.31 or newer on the server. '), NO_GIT_TIP);
+});
diff --git a/frontend/tests/devAutodetect.test.mjs b/frontend/tests/devAutodetect.test.mjs
index c1271b85..e21e1720 100644
--- a/frontend/tests/devAutodetect.test.mjs
+++ b/frontend/tests/devAutodetect.test.mjs
@@ -181,8 +181,10 @@ test('flow F3: the switch-on toast by status (Mira’s flow copy §3), with its
assert.deepEqual(t({ status: 'no_repo', sources: [] }), ['Dev mode on · guards are up. No git repo in this space’s folders yet. The floor works now.', 'type']);
assert.deepEqual(t({}), ['Dev mode on. Looking for a git repo in your teams’ folders…', 'open'], 'checking: no status yet');
assert.equal(m.onToast(state({})).checking, true);
- assert.equal(t({ status: 'watching', repo: 'demo-docs', sources: [SOURCES[2]] })[1], 'open', 'a local repo is not watched yet');
- assert.match(t({ status: 'watching', repo: 'demo-docs', sources: [SOURCES[2]] })[0], /guards are up\. Docs’s folder has a local repo with no remote/);
+ // 0.7.3 (any-git): a folder with no remote is read with git, so it is watched, landed changes only
+ // (copy-073 §1b). An older server's shape names no branch, so none is shown.
+ assert.equal(t({ status: 'watching', repo: 'demo-docs', sources: [SOURCES[2]] })[1], 'open');
+ assert.match(t({ status: 'watching', repo: 'demo-docs', sources: [SOURCES[2]] })[0], /^Dev mode on\. Watching demo-docs\. Landed changes only for now\.$/);
});
test('first-run block copy (flow copy §5): three numbered lines', () => {