|
|
|
|
@@ -1,51 +1,121 @@
|
|
|
|
|
import React from 'react'
|
|
|
|
|
|
|
|
|
|
import type { BootstrapResult, DiscoverResult } from '../../global.js'
|
|
|
|
|
import logoIcon from '../../design/assets/logo-icon.png'
|
|
|
|
|
import { Badge, Button, Icon, Input, Radio, Tag } from '../ui/index.js'
|
|
|
|
|
import { Badge, Button, Icon, Input, Radio, Select, Tag } from '../ui/index.js'
|
|
|
|
|
|
|
|
|
|
// Onboarding / first connect — welcome → connect gitea → choose repo → bootstrap
|
|
|
|
|
export function OnboardingScreen({ onDone }: { onDone: (dest: 'focus' | 'capture') => void }) {
|
|
|
|
|
const [step, setStep] = React.useState<number>(0)
|
|
|
|
|
const [conn, setConn] = React.useState<'idle' | 'testing' | 'ok'>('idle')
|
|
|
|
|
const [repo, setRepo] = React.useState('stephen/commitea')
|
|
|
|
|
const [boot, setBoot] = React.useState<number>(-1) // -1 idle, 0..2 running, 3 done
|
|
|
|
|
/**
|
|
|
|
|
* First-run onboarding — a real, live wizard. Welcome → Connect (live token
|
|
|
|
|
* discovery) → Repo (pick from the repos that token can actually reach) →
|
|
|
|
|
* Bootstrap (apply the label schema + create the pm-state sidecar, for real),
|
|
|
|
|
* then into the app. Every step talks to the main-process bridge; nothing here
|
|
|
|
|
* is faked. The token is saved encrypted in main only after a successful bootstrap.
|
|
|
|
|
*/
|
|
|
|
|
export function OnboardingScreen({ onConnected }: { onConnected: (dest: 'focus' | 'capture') => void }) {
|
|
|
|
|
const [step, setStep] = React.useState(0)
|
|
|
|
|
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
|
if (conn !== 'testing') return
|
|
|
|
|
const t = setTimeout(() => setConn('ok'), 1100)
|
|
|
|
|
return () => clearTimeout(t)
|
|
|
|
|
}, [conn])
|
|
|
|
|
// connect step
|
|
|
|
|
const [baseUrl, setBaseUrl] = React.useState('https://gitea.stephenmann.io')
|
|
|
|
|
const [token, setToken] = React.useState('')
|
|
|
|
|
const [discovery, setDiscovery] = React.useState<'idle' | 'testing' | 'ok'>('idle')
|
|
|
|
|
const [found, setFound] = React.useState<{ user: string; owners: string[]; reposByOwner: Record<string, string[]> } | null>(null)
|
|
|
|
|
const [error, setError] = React.useState<string | null>(null)
|
|
|
|
|
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
|
if (boot < 0 || boot >= 3) return
|
|
|
|
|
const t = setTimeout(() => setBoot(boot + 1), 700)
|
|
|
|
|
return () => clearTimeout(t)
|
|
|
|
|
}, [boot])
|
|
|
|
|
// repo step
|
|
|
|
|
const [owner, setOwner] = React.useState('')
|
|
|
|
|
const [repo, setRepo] = React.useState('')
|
|
|
|
|
|
|
|
|
|
// bootstrap step
|
|
|
|
|
const [boot, setBoot] = React.useState<'idle' | 'running' | 'done'>('idle')
|
|
|
|
|
const [bootResult, setBootResult] = React.useState<Extract<BootstrapResult, { ok: true }> | null>(null)
|
|
|
|
|
|
|
|
|
|
const repoCount = found ? found.owners.reduce((n, o) => n + (found.reposByOwner[o]?.length ?? 0), 0) : 0
|
|
|
|
|
|
|
|
|
|
const test = async () => {
|
|
|
|
|
if (!baseUrl.trim() || !token.trim() || discovery === 'testing') return
|
|
|
|
|
setError(null)
|
|
|
|
|
setDiscovery('testing')
|
|
|
|
|
const res: DiscoverResult = await window.commitea.config
|
|
|
|
|
.discover({ baseUrl: baseUrl.trim(), token: token.trim() })
|
|
|
|
|
.catch(() => ({ ok: false as const, error: 'unreachable' }))
|
|
|
|
|
if (!res.ok) {
|
|
|
|
|
setDiscovery('idle')
|
|
|
|
|
setFound(null)
|
|
|
|
|
setError(
|
|
|
|
|
res.error === '401' || res.error === '403'
|
|
|
|
|
? 'The token was rejected — check it has repo + issue scopes.'
|
|
|
|
|
: res.error === '404'
|
|
|
|
|
? "Couldn't reach that Gitea — check the URL."
|
|
|
|
|
: `Connection failed${res.error ? ` (${res.error})` : ''}.`,
|
|
|
|
|
)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
setFound({ user: res.user, owners: res.owners, reposByOwner: res.reposByOwner })
|
|
|
|
|
setDiscovery('ok')
|
|
|
|
|
const o = res.owners.includes(res.user) ? res.user : res.owners[0] ?? ''
|
|
|
|
|
setOwner(o)
|
|
|
|
|
setRepo(res.reposByOwner[o]?.[0] ?? '')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const runBootstrap = async () => {
|
|
|
|
|
if (!found || boot === 'running') return
|
|
|
|
|
setError(null)
|
|
|
|
|
setBoot('running')
|
|
|
|
|
const res = await window.commitea.config
|
|
|
|
|
.bootstrap({ baseUrl: baseUrl.trim(), token: token.trim(), owner, repo, underOrg: owner !== found.user })
|
|
|
|
|
.catch(() => ({ ok: false as const, error: 'unreachable' }))
|
|
|
|
|
if (!res.ok) {
|
|
|
|
|
setBoot('idle')
|
|
|
|
|
setError(`Bootstrap failed${res.error ? ` (${res.error})` : ''}. Nothing was half-applied — you can retry.`)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
// persist the connection now that the repo is prepared
|
|
|
|
|
await window.commitea.config.set({ baseUrl: baseUrl.trim(), owner, repo, token: token.trim() })
|
|
|
|
|
setBootResult(res)
|
|
|
|
|
setBoot('done')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const STEPS = ['Welcome', 'Connect', 'Repo', 'Bootstrap']
|
|
|
|
|
const BOOT_TASKS = [
|
|
|
|
|
'Create stephen/pm-state (the sidecar)',
|
|
|
|
|
'Apply the label schema to stephen/commitea',
|
|
|
|
|
'Install a webhook · endpoint :48731',
|
|
|
|
|
]
|
|
|
|
|
const repoOptions = found?.reposByOwner[owner] ?? []
|
|
|
|
|
|
|
|
|
|
const Frame = ({ children, footer }: { children: React.ReactNode; footer?: React.ReactNode }) => (
|
|
|
|
|
<div style={{
|
|
|
|
|
background: 'var(--surface-card)', border: '1px solid var(--line-1)', borderRadius: 'var(--radius-3)',
|
|
|
|
|
boxShadow: 'var(--shadow-jade-line), var(--shadow-2)', padding: '30px 36px',
|
|
|
|
|
display: 'flex', flexDirection: 'column', gap: 16, width: '100%',
|
|
|
|
|
}}>
|
|
|
|
|
<div
|
|
|
|
|
style={{
|
|
|
|
|
background: 'var(--surface-card)',
|
|
|
|
|
border: '1px solid var(--line-1)',
|
|
|
|
|
borderRadius: 'var(--radius-3)',
|
|
|
|
|
boxShadow: 'var(--shadow-jade-line), var(--shadow-2)',
|
|
|
|
|
padding: '30px 36px',
|
|
|
|
|
display: 'flex',
|
|
|
|
|
flexDirection: 'column',
|
|
|
|
|
gap: 16,
|
|
|
|
|
width: '100%',
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{children}
|
|
|
|
|
{footer ? <div style={{ display: 'flex', gap: 8, justifyContent: 'flex-end', borderTop: '1px solid var(--line-1)', paddingTop: 16 }}>{footer}</div> : null}
|
|
|
|
|
{error ? <p style={{ font: 'var(--text-agent)', color: 'var(--danger)', margin: 0 }}>{error}</p> : null}
|
|
|
|
|
{footer ? (
|
|
|
|
|
<div style={{ display: 'flex', gap: 8, justifyContent: 'flex-end', borderTop: '1px solid var(--line-1)', paddingTop: 16 }}>
|
|
|
|
|
{footer}
|
|
|
|
|
</div>
|
|
|
|
|
) : null}
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div style={{
|
|
|
|
|
minHeight: '100vh', background: 'var(--surface-app)', display: 'flex', flexDirection: 'column',
|
|
|
|
|
alignItems: 'center', justifyContent: 'center', padding: 32, gap: 22,
|
|
|
|
|
}} data-screen-label="onboarding">
|
|
|
|
|
{/* brand */}
|
|
|
|
|
<div
|
|
|
|
|
style={{
|
|
|
|
|
minHeight: '100vh',
|
|
|
|
|
background: 'var(--surface-app)',
|
|
|
|
|
display: 'flex',
|
|
|
|
|
flexDirection: 'column',
|
|
|
|
|
alignItems: 'center',
|
|
|
|
|
justifyContent: 'center',
|
|
|
|
|
padding: 32,
|
|
|
|
|
gap: 22,
|
|
|
|
|
}}
|
|
|
|
|
data-screen-label="onboarding"
|
|
|
|
|
>
|
|
|
|
|
<div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
|
|
|
|
|
<img src={logoIcon} width="34" height="34" alt="" style={{ borderRadius: 8, display: 'block' }} />
|
|
|
|
|
<span style={{ font: '400 27px/1 var(--font-serif-display)', color: 'var(--ink-1)' }}>
|
|
|
|
|
@@ -58,15 +128,24 @@ export function OnboardingScreen({ onDone }: { onDone: (dest: 'focus' | 'capture
|
|
|
|
|
{STEPS.map((s, i) => (
|
|
|
|
|
<div key={s} style={{ display: 'flex', alignItems: 'center', gap: 14 }}>
|
|
|
|
|
<span style={{ display: 'inline-flex', alignItems: 'center', gap: 7 }}>
|
|
|
|
|
<span style={{
|
|
|
|
|
width: 20, height: 20, borderRadius: '50%', textAlign: 'center',
|
|
|
|
|
font: '500 10.5px/20px var(--font-mono)',
|
|
|
|
|
background: i < step ? 'var(--accent)' : i === step ? 'var(--spruce-2)' : 'var(--paper-2)',
|
|
|
|
|
color: i < step ? 'var(--ink-inverse)' : i === step ? 'var(--accent-text)' : 'var(--ink-3)',
|
|
|
|
|
}}>{i < step ? '✓' : i + 1}</span>
|
|
|
|
|
<span style={{ font: `${i === step ? 600 : 400} 12px/1 var(--font-sans)`, color: i === step ? 'var(--ink-1)' : 'var(--ink-3)' }}>{s}</span>
|
|
|
|
|
<span
|
|
|
|
|
style={{
|
|
|
|
|
width: 20,
|
|
|
|
|
height: 20,
|
|
|
|
|
borderRadius: '50%',
|
|
|
|
|
textAlign: 'center',
|
|
|
|
|
font: '500 10.5px/20px var(--font-mono)',
|
|
|
|
|
background: i < step ? 'var(--accent)' : i === step ? 'var(--spruce-2)' : 'var(--paper-2)',
|
|
|
|
|
color: i < step ? 'var(--ink-inverse)' : i === step ? 'var(--accent-text)' : 'var(--ink-3)',
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{i < step ? '✓' : i + 1}
|
|
|
|
|
</span>
|
|
|
|
|
<span style={{ font: `${i === step ? 600 : 400} 12px/1 var(--font-sans)`, color: i === step ? 'var(--ink-1)' : 'var(--ink-3)' }}>
|
|
|
|
|
{s}
|
|
|
|
|
</span>
|
|
|
|
|
</span>
|
|
|
|
|
{i < STEPS.length - 1 ? <span style={{ width: 24, height: 1, background: 'var(--line-2)' }}></span> : null}
|
|
|
|
|
{i < STEPS.length - 1 ? <span style={{ width: 24, height: 1, background: 'var(--line-2)' }} /> : null}
|
|
|
|
|
</div>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
@@ -76,8 +155,8 @@ export function OnboardingScreen({ onDone }: { onDone: (dest: 'focus' | 'capture
|
|
|
|
|
<Frame footer={<Button iconRight="arrow-right" onClick={() => setStep(1)}>Begin</Button>}>
|
|
|
|
|
<h1 style={{ font: 'var(--text-title)', color: 'var(--ink-1)', margin: 0 }}>Good morning.</h1>
|
|
|
|
|
<p style={{ font: 'var(--text-agent-lg)', color: 'var(--ink-2)', margin: 0 }}>
|
|
|
|
|
I'm Reginald, your project manager. I interview you instead of making you fill in forms,
|
|
|
|
|
I forecast in honest ranges, and I never do the arithmetic myself — there's a scheduler for that.
|
|
|
|
|
I'm Reginald, your project manager. I interview you instead of making you fill in forms, I forecast in
|
|
|
|
|
honest ranges, and I never do the arithmetic myself — there's a scheduler for that.
|
|
|
|
|
</p>
|
|
|
|
|
<p style={{ font: 'var(--text-body)', color: 'var(--ink-2)', margin: 0 }}>
|
|
|
|
|
Your plans live in your own Gitea as ordinary issues and labels. Delete me and nothing human is lost.
|
|
|
|
|
@@ -86,79 +165,196 @@ export function OnboardingScreen({ onDone }: { onDone: (dest: 'focus' | 'capture
|
|
|
|
|
) : null}
|
|
|
|
|
|
|
|
|
|
{step === 1 ? (
|
|
|
|
|
<Frame footer={<>
|
|
|
|
|
<Button variant="ghost" onClick={() => setStep(0)}>Back</Button>
|
|
|
|
|
<Button iconRight="arrow-right" disabled={conn !== 'ok'} onClick={() => setStep(2)}>Continue</Button>
|
|
|
|
|
</>}>
|
|
|
|
|
<Frame
|
|
|
|
|
footer={
|
|
|
|
|
<>
|
|
|
|
|
<Button variant="ghost" onClick={() => setStep(0)}>
|
|
|
|
|
Back
|
|
|
|
|
</Button>
|
|
|
|
|
<Button iconRight="arrow-right" disabled={discovery !== 'ok'} onClick={() => setStep(2)}>
|
|
|
|
|
Continue
|
|
|
|
|
</Button>
|
|
|
|
|
</>
|
|
|
|
|
}
|
|
|
|
|
>
|
|
|
|
|
<h1 style={{ font: 'var(--text-title)', color: 'var(--ink-1)', margin: 0 }}>Your Gitea</h1>
|
|
|
|
|
<Input label="Base URL" icon="link" mono defaultValue="https://gitea.stephenmann.io" />
|
|
|
|
|
<Input label="Access token" icon="keyboard" mono type="password" defaultValue="ct_9f2e81c4a7d6" hint="Scopes: repo, issue. Nothing more." />
|
|
|
|
|
<Input
|
|
|
|
|
label="Base URL"
|
|
|
|
|
icon="link"
|
|
|
|
|
mono
|
|
|
|
|
value={baseUrl}
|
|
|
|
|
onChange={(e) => {
|
|
|
|
|
setBaseUrl(e.target.value)
|
|
|
|
|
setDiscovery('idle')
|
|
|
|
|
setFound(null)
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
<Input
|
|
|
|
|
label="Access token"
|
|
|
|
|
icon="keyboard"
|
|
|
|
|
mono
|
|
|
|
|
type="password"
|
|
|
|
|
value={token}
|
|
|
|
|
placeholder="gitea PAT"
|
|
|
|
|
hint="Scopes: repo, issue. Nothing more."
|
|
|
|
|
onChange={(e) => {
|
|
|
|
|
setToken(e.target.value)
|
|
|
|
|
setDiscovery('idle')
|
|
|
|
|
}}
|
|
|
|
|
onKeyDown={(e) => {
|
|
|
|
|
if (e.key === 'Enter') {
|
|
|
|
|
e.preventDefault()
|
|
|
|
|
void test()
|
|
|
|
|
}
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
<div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
|
|
|
|
|
<Button variant="secondary" icon={conn === 'testing' ? 'loader-circle' : 'zap'} disabled={conn === 'testing'} onClick={() => setConn('testing')}>
|
|
|
|
|
{conn === 'testing' ? 'Ringing the bell…' : 'Test connection'}
|
|
|
|
|
<Button
|
|
|
|
|
variant="secondary"
|
|
|
|
|
icon={discovery === 'testing' ? 'loader-circle' : 'zap'}
|
|
|
|
|
disabled={discovery === 'testing' || !baseUrl.trim() || !token.trim()}
|
|
|
|
|
onClick={() => void test()}
|
|
|
|
|
>
|
|
|
|
|
{discovery === 'testing' ? 'Ringing the bell…' : 'Test connection'}
|
|
|
|
|
</Button>
|
|
|
|
|
{conn === 'ok' ? <Badge tone="ok" dot>connected · 3 repos visible</Badge> : null}
|
|
|
|
|
{discovery === 'ok' ? (
|
|
|
|
|
<Badge tone="ok" dot>
|
|
|
|
|
connected · {repoCount} repo{repoCount === 1 ? '' : 's'} visible
|
|
|
|
|
</Badge>
|
|
|
|
|
) : null}
|
|
|
|
|
</div>
|
|
|
|
|
</Frame>
|
|
|
|
|
) : null}
|
|
|
|
|
|
|
|
|
|
{step === 2 ? (
|
|
|
|
|
<Frame footer={<>
|
|
|
|
|
<Button variant="ghost" onClick={() => setStep(1)}>Back</Button>
|
|
|
|
|
<Button iconRight="arrow-right" onClick={() => setStep(3)}>Continue</Button>
|
|
|
|
|
</>}>
|
|
|
|
|
<Frame
|
|
|
|
|
footer={
|
|
|
|
|
<>
|
|
|
|
|
<Button variant="ghost" onClick={() => setStep(1)}>
|
|
|
|
|
Back
|
|
|
|
|
</Button>
|
|
|
|
|
<Button iconRight="arrow-right" disabled={!owner || !repo} onClick={() => setStep(3)}>
|
|
|
|
|
Continue
|
|
|
|
|
</Button>
|
|
|
|
|
</>
|
|
|
|
|
}
|
|
|
|
|
>
|
|
|
|
|
<h1 style={{ font: 'var(--text-title)', color: 'var(--ink-1)', margin: 0 }}>Which repo shall I manage?</h1>
|
|
|
|
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
|
|
|
|
|
{['stephen/commitea', 'stephen/novelpad', 'stephen/infra'].map((r: string) => (
|
|
|
|
|
<label key={r} style={{
|
|
|
|
|
display: 'flex', alignItems: 'center', gap: 10, padding: '10px 14px', cursor: 'pointer',
|
|
|
|
|
background: repo === r ? 'var(--spruce-1)' : 'var(--paper-0)',
|
|
|
|
|
border: `1px solid ${repo === r ? 'var(--spruce-3)' : 'var(--line-1)'}`,
|
|
|
|
|
borderRadius: 'var(--radius-2)',
|
|
|
|
|
}}>
|
|
|
|
|
<Radio name="repo" checked={repo === r} onChange={() => setRepo(r)} />
|
|
|
|
|
<Icon name="git-branch" size={14} style={{ color: 'var(--ink-3)' }} />
|
|
|
|
|
<span style={{ font: 'var(--text-data)', color: 'var(--ink-1)' }}>{r}</span>
|
|
|
|
|
</label>
|
|
|
|
|
))}
|
|
|
|
|
{found && found.owners.length > 1 ? (
|
|
|
|
|
<Select
|
|
|
|
|
label="Owner"
|
|
|
|
|
value={owner}
|
|
|
|
|
options={found.owners.map((o) => ({ value: o, label: o }))}
|
|
|
|
|
onChange={(e) => {
|
|
|
|
|
const o = e.target.value
|
|
|
|
|
setOwner(o)
|
|
|
|
|
setRepo(found.reposByOwner[o]?.[0] ?? '')
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
) : null}
|
|
|
|
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 8, maxHeight: 260, overflowY: 'auto' }}>
|
|
|
|
|
{repoOptions.map((r) => {
|
|
|
|
|
const full = `${owner}/${r}`
|
|
|
|
|
const selected = repo === r
|
|
|
|
|
return (
|
|
|
|
|
<label
|
|
|
|
|
key={r}
|
|
|
|
|
style={{
|
|
|
|
|
display: 'flex',
|
|
|
|
|
alignItems: 'center',
|
|
|
|
|
gap: 10,
|
|
|
|
|
padding: '10px 14px',
|
|
|
|
|
cursor: 'pointer',
|
|
|
|
|
background: selected ? 'var(--spruce-1)' : 'var(--paper-0)',
|
|
|
|
|
border: `1px solid ${selected ? 'var(--spruce-3)' : 'var(--line-1)'}`,
|
|
|
|
|
borderRadius: 'var(--radius-2)',
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Radio name="repo" checked={selected} onChange={() => setRepo(r)} />
|
|
|
|
|
<Icon name="git-branch" size={14} style={{ color: 'var(--ink-3)' }} />
|
|
|
|
|
<span style={{ font: 'var(--text-data)', color: 'var(--ink-1)' }}>{full}</span>
|
|
|
|
|
</label>
|
|
|
|
|
)
|
|
|
|
|
})}
|
|
|
|
|
</div>
|
|
|
|
|
<p style={{ font: 'var(--text-caption)', color: 'var(--ink-3)', margin: 0 }}>One to start. You can add more later in Settings.</p>
|
|
|
|
|
<p style={{ font: 'var(--text-caption)', color: 'var(--ink-3)', margin: 0 }}>
|
|
|
|
|
One to start. You can switch later in Settings.
|
|
|
|
|
</p>
|
|
|
|
|
</Frame>
|
|
|
|
|
) : null}
|
|
|
|
|
|
|
|
|
|
{step === 3 ? (
|
|
|
|
|
<Frame footer={boot === 3 ? <>
|
|
|
|
|
<Button variant="ghost" onClick={() => onDone('focus')}>Just look around</Button>
|
|
|
|
|
<Button icon="sparkles" onClick={() => onDone('capture')}>Start a capture</Button>
|
|
|
|
|
</> : <>
|
|
|
|
|
<Button variant="ghost" onClick={() => setStep(2)} disabled={boot >= 0}>Back</Button>
|
|
|
|
|
<Button disabled={boot >= 0} onClick={() => setBoot(0)}>Make it so</Button>
|
|
|
|
|
</>}>
|
|
|
|
|
<Frame
|
|
|
|
|
footer={
|
|
|
|
|
boot === 'done' ? (
|
|
|
|
|
<>
|
|
|
|
|
<Button variant="ghost" onClick={() => onConnected('focus')}>
|
|
|
|
|
Just look around
|
|
|
|
|
</Button>
|
|
|
|
|
<Button icon="sparkles" onClick={() => onConnected('capture')}>
|
|
|
|
|
Start a capture
|
|
|
|
|
</Button>
|
|
|
|
|
</>
|
|
|
|
|
) : (
|
|
|
|
|
<>
|
|
|
|
|
<Button variant="ghost" onClick={() => setStep(2)} disabled={boot === 'running'}>
|
|
|
|
|
Back
|
|
|
|
|
</Button>
|
|
|
|
|
<Button icon={boot === 'running' ? 'loader-circle' : undefined} disabled={boot === 'running'} onClick={() => void runBootstrap()}>
|
|
|
|
|
{boot === 'running' ? 'Preparing…' : 'Make it so'}
|
|
|
|
|
</Button>
|
|
|
|
|
</>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
>
|
|
|
|
|
<h1 style={{ font: 'var(--text-title)', color: 'var(--ink-1)', margin: 0 }}>
|
|
|
|
|
{boot === 3 ? 'All set.' : 'With your approval'}
|
|
|
|
|
{boot === 'done' ? 'All set.' : 'With your approval'}
|
|
|
|
|
</h1>
|
|
|
|
|
<p style={{ font: 'var(--text-body)', color: 'var(--ink-2)', margin: 0 }}>
|
|
|
|
|
I'll prepare <span style={{ font: 'var(--text-data)', color: 'var(--ink-1)' }}>{owner}/{repo}</span>: apply
|
|
|
|
|
the label schema, and create the pm-state sidecar for machine-derived state.
|
|
|
|
|
</p>
|
|
|
|
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
|
|
|
|
|
{BOOT_TASKS.map((t: string, i: number) => (
|
|
|
|
|
<div key={t} style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
|
|
|
|
|
<span style={{ display: 'inline-flex', color: boot > i ? 'var(--ok)' : boot === i ? 'var(--warn)' : 'var(--ink-3)' }}>
|
|
|
|
|
<Icon name={boot > i ? 'circle-check' : boot === i ? 'loader-circle' : 'circle-dashed'} size={15} />
|
|
|
|
|
</span>
|
|
|
|
|
<span style={{ font: 'var(--text-body)', color: boot > i ? 'var(--ink-1)' : 'var(--ink-2)', whiteSpace: 'nowrap' }}>{t}</span>
|
|
|
|
|
</div>
|
|
|
|
|
))}
|
|
|
|
|
<BootTask
|
|
|
|
|
state={boot}
|
|
|
|
|
label={
|
|
|
|
|
bootResult
|
|
|
|
|
? bootResult.labels.created.length
|
|
|
|
|
? `Applied the label schema (${bootResult.labels.created.length} created, ${bootResult.labels.existing.length} already there)`
|
|
|
|
|
: `Label schema already applied (${bootResult.labels.existing.length} labels)`
|
|
|
|
|
: `Apply the label schema to ${owner}/${repo}`
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
<BootTask
|
|
|
|
|
state={boot}
|
|
|
|
|
label={
|
|
|
|
|
bootResult
|
|
|
|
|
? bootResult.pmState === 'created'
|
|
|
|
|
? `Created ${owner}/${bootResult.pmStateRepo} (the sidecar)`
|
|
|
|
|
: `${owner}/${bootResult.pmStateRepo} already exists`
|
|
|
|
|
: `Create ${owner}/${repo}-pm-state (the sidecar)`
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 5, paddingLeft: 25 }}>
|
|
|
|
|
{['est/1d', 'est/2d', 'est/3d', 'est/5d', 'est/8d', 'p/1', 'p/2', 'p/3', 'p/4', 'deadline/hard'].map((l: string) => <Tag key={l} label={l} />)}
|
|
|
|
|
{(bootResult ? [...bootResult.labels.created, ...bootResult.labels.existing] : [
|
|
|
|
|
'est/1d',
|
|
|
|
|
'est/2d',
|
|
|
|
|
'est/3d',
|
|
|
|
|
'est/5d',
|
|
|
|
|
'est/8d',
|
|
|
|
|
'p/1',
|
|
|
|
|
'p/2',
|
|
|
|
|
'p/3',
|
|
|
|
|
'p/4',
|
|
|
|
|
'deadline/hard',
|
|
|
|
|
]).map((l) => (
|
|
|
|
|
<Tag key={l} label={l} />
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{boot === 3 ? (
|
|
|
|
|
<p style={{ font: 'var(--text-agent)', color: 'var(--ink-2)', margin: 0 }}>
|
|
|
|
|
The pot is empty. Tell me what you're planning and I'll draw up the tickets.
|
|
|
|
|
</p>
|
|
|
|
|
) : (
|
|
|
|
|
<p style={{ font: 'var(--text-caption)', color: 'var(--ink-3)', margin: 0 }}>
|
|
|
|
|
No bot comments, no body frontmatter, no synthetic issues — ever. Labels are the only footprint.
|
|
|
|
|
</p>
|
|
|
|
|
)}
|
|
|
|
|
<p style={{ font: 'var(--text-caption)', color: 'var(--ink-3)', margin: 0 }}>
|
|
|
|
|
No bot comments, no body frontmatter, no synthetic issues — ever. Labels are the only footprint.
|
|
|
|
|
</p>
|
|
|
|
|
</Frame>
|
|
|
|
|
) : null}
|
|
|
|
|
</div>
|
|
|
|
|
@@ -167,3 +363,16 @@ export function OnboardingScreen({ onDone }: { onDone: (dest: 'focus' | 'capture
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function BootTask({ state, label }: { state: 'idle' | 'running' | 'done'; label: string }) {
|
|
|
|
|
const icon = state === 'done' ? 'circle-check' : state === 'running' ? 'loader-circle' : 'circle-dashed'
|
|
|
|
|
const color = state === 'done' ? 'var(--ok)' : state === 'running' ? 'var(--warn)' : 'var(--ink-3)'
|
|
|
|
|
return (
|
|
|
|
|
<div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>
|
|
|
|
|
<span style={{ display: 'inline-flex', color }}>
|
|
|
|
|
<Icon name={icon} size={15} />
|
|
|
|
|
</span>
|
|
|
|
|
<span style={{ font: 'var(--text-body)', color: state === 'done' ? 'var(--ink-1)' : 'var(--ink-2)' }}>{label}</span>
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|