heyquilt 0.3.178 → 0.3.180
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/RELEASES.md +13 -0
- package/package.json +1 -1
- package/src/agent-task-workflow.js +7 -7
- package/src/control.js +9 -4
- package/src/gitstate.js +23 -5
- package/src/mcp.js +2 -2
- package/src/session.js +114 -61
- package/src/tasks.js +12 -2
- package/src/ui/agent-guide.js +1 -1
- package/src/ui/app.css +11 -0
- package/src/ui/board.js +25 -3
- package/src/ui/session.js +28 -1
- package/src/ui-server.js +4 -4
package/RELEASES.md
CHANGED
|
@@ -11,6 +11,19 @@ Format: `## <version> — <YYYY-MM-DD>`, an optional one-line summary, then bull
|
|
|
11
11
|
Lead each bullet with a short bold phrase. Inline `code` and **bold** are rendered;
|
|
12
12
|
nothing else is.
|
|
13
13
|
|
|
14
|
+
## 0.3.180 — 2026-11-19
|
|
15
|
+
|
|
16
|
+
- **You stay with your partner unless you choose a ticket.** In 0.3.179 your folder moved onto a ticket's branch whenever your AI marked a ticket as in progress, which could split you from the person you were building with. Now a person's folder moves only when that person clicks **Open ticket** on the board. Hop in a session and build, with no tickets, and you are both on the same branch, live, as before. Agents that are members of their own are still moved onto the ticket's branch when they take it.
|
|
17
|
+
|
|
18
|
+
## 0.3.179 — 2026-11-18
|
|
19
|
+
|
|
20
|
+
- **A ticket has its own branch.** A ticket is a unit of work, and its work now lives on a git branch of its own. On the board, **Open ticket** moves your folder onto that branch; **Leave** takes it back to the main one. Everyone who has the same ticket open edits live together there, and nobody else gets that work until it is merged.
|
|
21
|
+
- **The card says who is working on a ticket.** "Ada is working here", or "You and Ada are working here" when you have it open too.
|
|
22
|
+
- **Your unfinished work stays where you made it.** A ticket's branch starts from the latest commit, without the uncommitted work on the branch you leave. What you haven't committed on a ticket is still there when you open it again.
|
|
23
|
+
- **When your AI takes a ticket, your folder goes with it.** `quilt_move_task` to In progress opens the ticket for people's AIs as well as agents. Only an agent's ticket has to be committed and pushed before it can go to QA.
|
|
24
|
+
- **A pushed ticket branch reaches everyone on it.** When someone on the ticket commits and pushes, the others' branches move to that commit by themselves.
|
|
25
|
+
- **Moving a ticket to Done from the app works again.** It failed with an error since 0.3.139.
|
|
26
|
+
|
|
14
27
|
## 0.3.178 — 2026-11-18
|
|
15
28
|
|
|
16
29
|
- **An agent works on its own branch for each task.** When an agent that is a member of its own takes a task, its folder moves to a git branch for that task alone (`quilt/<agent>/<task>`), made from the latest commit. What it changes stays on that branch: it no longer shows up in the files you and your partner are editing until it is merged. People are never moved: you keep pairing on the branch you are on.
|
package/package.json
CHANGED
|
@@ -24,18 +24,18 @@ export const TASK_WORKFLOW =
|
|
|
24
24
|
'When finished, move the ticket to QA (not straight to Done) with `qaNotes`: describe the changes you made and how you self-validated them. ' +
|
|
25
25
|
'Keep qaNotes, verified and task comments brief: a few short sentences, no logs or play-by-play. ' +
|
|
26
26
|
'Moving to Done still requires `verified` (what you ran and what you saw). Unit tests passing is not enough when the app itself was not exercised. ' +
|
|
27
|
-
'Get the task\'s files into git before you move it to QA: commit only the files you changed, and push. An agent that joined as its own member is
|
|
27
|
+
'Get the task\'s files into git before you move it to QA: commit only the files you changed, and push. A ticket can have a branch of its own (quilt/<ticket>), where everyone who has the ticket open works together. A person opens one from the board when they want it, and their folder stays where it is otherwise: taking a ticket never moves a person\'s folder. An agent that joined as its own member is moved onto the ticket\'s branch when it takes the ticket: it pushes that branch and opens the pull request itself, and its ticket moves to QA only once the branch is committed and pushed. Quilt does not commit, push, open pull requests or merge them for anyone. Without a folder you cannot commit: say in `qaNotes` which files need committing. Work only in the session has not shipped.'
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
* What an
|
|
31
|
-
* answer): the branch
|
|
30
|
+
* What an AI is told after taking a ticket about the branch its folder is on (Session.openTask's
|
|
31
|
+
* answer): the ticket's branch, or why the folder stayed where it was. '' for nothing.
|
|
32
32
|
*/
|
|
33
33
|
export function taskBranchNote (b) {
|
|
34
34
|
if (!b) return ''
|
|
35
35
|
if (b.stayed) return `\n\nYour folder stays on \`${b.stayed}\`: ${b.why}`
|
|
36
|
-
if (!b.branch) return ''
|
|
37
|
-
const how = b.again ? '
|
|
38
|
-
return `\n\nYour folder is now on \`${b.branch}\`, ${how}.
|
|
36
|
+
if (!b.branch || b.already) return ''
|
|
37
|
+
const how = b.again ? 'this ticket\'s branch, which this folder had from before' : b.remote ? 'this ticket\'s branch, as a partner pushed it' : `this ticket's branch, made from \`${b.from}\``
|
|
38
|
+
return `\n\nYour folder is now on \`${b.branch}\`, ${how}. Everyone who opens the ticket works there with you, live; nobody else gets this work until it is merged. Commit only the files you changed, push with \`git push -u origin ${b.branch}\`, and open the pull request yourself (\`gh pr create\`). An agent's ticket moves to QA only once the branch is committed and pushed.`
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
/** Markdown bullets for AGENTS.md / CLAUDE.md (same steps as TASK_WORKFLOW). */
|
|
@@ -48,7 +48,7 @@ export const TASK_WORKFLOW_MD =
|
|
|
48
48
|
' 5. **QA**: move to `qa` (not straight to Done) with `qaNotes` describing the changes and how you self-validated them.\n' +
|
|
49
49
|
' Keep `qaNotes`, `verified` and task comments brief: a few short sentences, no logs or play-by-play.\n' +
|
|
50
50
|
' 6. **Done** (after QA): `quilt_move_task` to `done` needs `verified`, what you ran and what you saw. Unit tests passing is not enough when the app itself was not exercised.\n' +
|
|
51
|
-
' 7. **Commit and push** before QA: only the files you changed, with a message.
|
|
51
|
+
' 7. **Commit and push** before QA: only the files you changed, with a message. A ticket can have a branch of its own (quilt/<ticket>), where everyone who has the ticket open works together. A person opens one from the board when they want it, and their folder stays where it is otherwise: taking a ticket never moves a person\'s folder. An agent that joined as its own member is moved onto the ticket\'s branch when it takes the ticket: it pushes that branch and opens the pull request itself, and its ticket moves to QA only once the branch is committed and pushed. Quilt does not commit, push or merge for anyone. Without a folder you cannot commit: say in `qaNotes` which files need committing. Work only in the session has not shipped.'
|
|
52
52
|
|
|
53
53
|
/** Scaffolded into AGENTS.md by `quilt setup` when the project has no checklist yet. Owners edit it in place. */
|
|
54
54
|
export const CHECKLIST_SCAFFOLD = `${CHECKLIST_HEADING}
|
package/src/control.js
CHANGED
|
@@ -135,7 +135,7 @@ export async function startControl (session, extras = {}) {
|
|
|
135
135
|
},
|
|
136
136
|
'POST /tasks/update': async (b) => {
|
|
137
137
|
const before = session.taskList().find((t) => t.id === b.id) || null
|
|
138
|
-
// An agent on a branch
|
|
138
|
+
// An agent on a ticket's branch moves a task to QA or Done only once its work there is committed and pushed (session.js taskInGit).
|
|
139
139
|
if ((b.column === 'qa' || b.column === 'done') && before && before.column !== b.column) {
|
|
140
140
|
const inGit = await session.taskInGit()
|
|
141
141
|
if (inGit && !inGit.ok) throw new Error(inGit.why)
|
|
@@ -144,10 +144,15 @@ export async function startControl (session, extras = {}) {
|
|
|
144
144
|
session.noteTaskChange(before, task, b.via)
|
|
145
145
|
if (b.column === 'doing' && task) session.personaSays(b.via, task.title) // taking a task can name an AI session
|
|
146
146
|
if (task && (b.column === 'doing' || b.column === 'done')) session.stitchClock(b.via, b.column === 'doing')
|
|
147
|
-
// An agent taking a
|
|
148
|
-
|
|
149
|
-
|
|
147
|
+
// An agent taking a ticket opens it: its folder moves onto the ticket's branch (session.js openTask). A person's
|
|
148
|
+
// folder never moves because their AI took a ticket: people stay together on the branch they are on, and open a
|
|
149
|
+
// ticket themselves, from the board, when they want its branch.
|
|
150
|
+
const branch = b.column === 'doing' && task && session.kind === 'agent' ? await session.openTask(task.id).catch(() => null) : null
|
|
151
|
+
return { task: branch ? session.taskList().find((t) => t.id === task.id) || task : task, tasks: session.taskList(), ...(branch && !branch.already ? { branch } : {}) }
|
|
150
152
|
},
|
|
153
|
+
// Opening a ticket without moving it on the board, and going back to the default branch.
|
|
154
|
+
'POST /tasks/open': async (b) => ({ branch: await session.openTask(b.id), tasks: session.taskList() }),
|
|
155
|
+
'POST /tasks/leave': async () => ({ branch: await session.leaveTask() }),
|
|
151
156
|
// What an agent gets when it picks a task up: history for its files, the project's checks.
|
|
152
157
|
'POST /tasks/brief': (b) => session.taskBrief(b.id),
|
|
153
158
|
'POST /tasks/comment': (b) => {
|
package/src/gitstate.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// at work in it, and what a file looked like at a commit, so a checkout of another branch is told
|
|
3
3
|
// apart from edits and the folder can follow its branch (session.js). Quilt does two things to git
|
|
4
4
|
// itself, all at the end of this file: it fetches the branch's upstream, it moves the branch forward
|
|
5
|
-
// to a commit it is behind (never merging history), and it checks out
|
|
5
|
+
// to a commit it is behind (never merging history), and it checks out the branch of a ticket someone opens. Every git call is asynchronous (the
|
|
6
6
|
// app's window and its relay connection never wait on git); the file reads below are synchronous.
|
|
7
7
|
import fs from 'node:fs'
|
|
8
8
|
import path from 'node:path'
|
|
@@ -410,14 +410,32 @@ export async function hasBranch (root, name) {
|
|
|
410
410
|
|
|
411
411
|
/**
|
|
412
412
|
* Checks out `branch` in the folder, as `git checkout` does. `create`: a new branch, from the commit
|
|
413
|
-
* the folder is at
|
|
414
|
-
* '' when git did it, else
|
|
413
|
+
* the folder is at, or from `track` (a remote's branch, "origin/x", which it then follows). `force`:
|
|
414
|
+
* tracked files become the commit's, whatever was changed in them (-f). '' when git did it, else
|
|
415
|
+
* git's own words for why not.
|
|
415
416
|
*/
|
|
416
|
-
export async function switchBranch (root, branch, { create = false, force = false } = {}) {
|
|
417
|
-
const r = await call(root, ['checkout', '-q', ...(force ? ['-f'] : []), ...(create ? ['-b'] : []), branch], { timeout: 20000 })
|
|
417
|
+
export async function switchBranch (root, branch, { create = false, force = false, track = null } = {}) {
|
|
418
|
+
const r = await call(root, ['checkout', '-q', ...(force ? ['-f'] : []), ...(create ? ['-b'] : []), branch, ...(create && track ? ['--track', track] : [])], { timeout: 20000 })
|
|
418
419
|
return r.out !== null ? '' : (r.stderr || '').trim().split('\n')[0] || 'git could not check it out'
|
|
419
420
|
}
|
|
420
421
|
|
|
422
|
+
/** The remote a branch with no upstream of its own would use: "origin" when the repository has it, else its only remote, else null. */
|
|
423
|
+
export async function defaultRemote (root) {
|
|
424
|
+
const names = ((await run(root, ['remote'])) || '').split('\n').map((l) => l.trim()).filter(Boolean)
|
|
425
|
+
return names.includes('origin') ? 'origin' : names.length === 1 ? names[0] : null
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/** "<remote>/<branch>" when the repository knows that branch on the remote (as of its last fetch), else null. */
|
|
429
|
+
export async function remoteBranch (root, remote, branch) {
|
|
430
|
+
if (!remote || !branch) return null
|
|
431
|
+
return (await call(root, ['rev-parse', '-q', '--verify', `refs/remotes/${remote}/${branch}^{commit}`])).out !== null ? `${remote}/${branch}` : null
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/** Makes local `branch` follow `upstream` ("origin/x"), as `git branch --set-upstream-to` does; whether git did. */
|
|
435
|
+
export async function follow (root, branch, upstream) {
|
|
436
|
+
return (await call(root, ['branch', '-q', `--set-upstream-to=${upstream}`, branch])).out !== null
|
|
437
|
+
}
|
|
438
|
+
|
|
421
439
|
/** Stages `rels` as they are in the folder (git add); whether git did. */
|
|
422
440
|
export async function stage (root, rels) {
|
|
423
441
|
for (let i = 0; i < rels.length; i += MAX_PATHSPECS) {
|
package/src/mcp.js
CHANGED
|
@@ -259,8 +259,8 @@ export async function runMcp () {
|
|
|
259
259
|
}, { gate: gateFor('quilt_add_task') }))
|
|
260
260
|
|
|
261
261
|
server.registerTool('quilt_move_task', {
|
|
262
|
-
description: 'Move a task on the shared board. "doing" when you start it: you get a briefing (its files, recent changes to them, the project\'s checks), and an agent that is a member of its own is
|
|
263
|
-
'"qa" when you finish implementing and testing: requires `qaNotes` (what changed and how you self-validated); without it the move is refused, and so is an agent\'s move while
|
|
262
|
+
description: 'Move a task on the shared board. "doing" when you start it: you get a briefing (its files, recent changes to them, the project\'s checks), and an agent that is a member of its own is moved onto the ticket\'s own git branch (quilt/<ticket>); a person\'s folder stays where it is. ' +
|
|
263
|
+
'"qa" when you finish implementing and testing: requires `qaNotes` (what changed and how you self-validated); without it the move is refused, and so is an agent\'s move while the ticket\'s branch is not committed and pushed. ' +
|
|
264
264
|
'"done" after QA: requires `verified`, what you ran and what you saw; without it the move is refused.',
|
|
265
265
|
inputSchema: {
|
|
266
266
|
id: z.string().describe('Task id from quilt_tasks'),
|
package/src/session.js
CHANGED
|
@@ -53,7 +53,7 @@ import { HELD_MAP, readHeld, findHeld, settleHeld, renderHeld, versionsOf, versi
|
|
|
53
53
|
import { RELAY_NAME as RELAY_BY, isRelay } from './ui/chat.js'
|
|
54
54
|
import { cleanTyping, TYPING_MS, AGENT_TYPING_MS } from './ui/chat.js'
|
|
55
55
|
import { DEFAULT_KEY } from './branchdocs.js'
|
|
56
|
-
import { headKey, headName, branchTip, busy as gitBusy, leftoverLock, indexStamp, filesAt, blobAt, treeState, watchGit, SETTLE_MS as GIT_SETTLE_MS, STALE_LOCK_MS, upstreamOf, fetchUpstream, aheadBehind, changesBetween, fastForward, stage, hasBranch, switchBranch } from './gitstate.js'
|
|
56
|
+
import { headKey, headName, branchTip, busy as gitBusy, leftoverLock, indexStamp, filesAt, blobAt, treeState, watchGit, SETTLE_MS as GIT_SETTLE_MS, STALE_LOCK_MS, upstreamOf, fetchUpstream, aheadBehind, changesBetween, fastForward, stage, hasBranch, switchBranch, defaultRemote, remoteBranch, follow } from './gitstate.js'
|
|
57
57
|
import { cleanVoice, newCallId, voiceView, inVoice, transcribeSetting, setTranscribe, addLine, readLines, MAX_IN_CALL, CALL_FULL, callAgents, setAgentLeft, notInCall, agentSays, markCallForAgents, namedAgents, callPing, spokenReply, AGENT_REPLY_MS } from './voice.js'
|
|
58
58
|
import { toolInUse } from './agents/common.js'
|
|
59
59
|
|
|
@@ -66,8 +66,8 @@ function slug (s, max = 40) {
|
|
|
66
66
|
return String(s || '').toLowerCase().normalize('NFKD').replace(/[^\w\s-]/g, '').trim().replace(/[\s_]+/g, '-').replace(/-+/g, '-').replace(/^-|-$/g, '').slice(0, max).replace(/-$/, '') || 'work'
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
/**
|
|
70
|
-
export const
|
|
69
|
+
/** A ticket's branch is quilt/<the ticket's title, shortened>. */
|
|
70
|
+
export const TICKET_PREFIX = 'quilt/'
|
|
71
71
|
|
|
72
72
|
/** Whether `root` is a git checkout (a .git folder, or a worktree's pointer file). */
|
|
73
73
|
function hasGitDir (root) {
|
|
@@ -2353,7 +2353,14 @@ export class Session extends EventEmitter {
|
|
|
2353
2353
|
async checkUpstream ({ fetch = false } = {}) {
|
|
2354
2354
|
if (this.stopped || !this.ready || !this.git || !this.git.branch) return
|
|
2355
2355
|
const branch = this.git.branch
|
|
2356
|
-
|
|
2356
|
+
let up = await upstreamOf(this.root)
|
|
2357
|
+
if (!up && branch.startsWith(TICKET_PREFIX)) {
|
|
2358
|
+
// A ticket's branch made here follows nothing yet. Once a partner pushes it, it follows theirs, so their commits come in here too.
|
|
2359
|
+
const remote = await defaultRemote(this.root)
|
|
2360
|
+
if (remote && fetch) await fetchUpstream(this.root, remote)
|
|
2361
|
+
const theirs = await remoteBranch(this.root, remote, branch)
|
|
2362
|
+
if (theirs && !this.stopped && headName(this.root) === branch && await follow(this.root, branch, theirs)) up = await upstreamOf(this.root)
|
|
2363
|
+
}
|
|
2357
2364
|
if (!up || !up.remote || up.remote === '.') { this.setUpstream(null); return }
|
|
2358
2365
|
if (fetch) {
|
|
2359
2366
|
const f = await fetchUpstream(this.root, up.remote)
|
|
@@ -2511,21 +2518,28 @@ export class Session extends EventEmitter {
|
|
|
2511
2518
|
this.setUpstream({ name: facts.name, sha: to, behind: 0, ahead: 0, brought: { count: facts.behind, files: written, at: Date.now() } })
|
|
2512
2519
|
}
|
|
2513
2520
|
|
|
2514
|
-
//
|
|
2515
|
-
//
|
|
2516
|
-
//
|
|
2517
|
-
//
|
|
2518
|
-
//
|
|
2519
|
-
//
|
|
2520
|
-
//
|
|
2521
|
+
// ------------------------------------------------------ ticket branches --
|
|
2522
|
+
// A ticket is a unit of work, and its work is on a branch of its own: quilt/<ticket> (Daniel,
|
|
2523
|
+
// 2026-11-18). Opening a ticket (a person, from the board; an agent, by taking it) moves this folder, a
|
|
2524
|
+
// git clone, onto that branch. A person's folder never moves because their AI took a ticket. Everyone who has the ticket open edits live together there, and nobody else
|
|
2525
|
+
// gets that work until it is merged. The first to open a ticket makes its branch from the latest
|
|
2526
|
+
// commit of the branch they are on, without the uncommitted work everyone has there (the session
|
|
2527
|
+
// keeps that there). An agent's ticket moves to QA only once its work on the branch is committed
|
|
2528
|
+
// and pushed. Nobody has to open a ticket: a folder stays on whatever branch git has it on.
|
|
2521
2529
|
|
|
2522
|
-
/** One
|
|
2523
|
-
|
|
2524
|
-
const p = (this.branchMoves || Promise.resolve()).then(
|
|
2530
|
+
/** One move between branches at a time in this folder (two at once fought over git's index). */
|
|
2531
|
+
branchMove (fn) {
|
|
2532
|
+
const p = (this.branchMoves || Promise.resolve()).then(fn)
|
|
2525
2533
|
this.branchMoves = p.catch(() => {})
|
|
2526
2534
|
return p
|
|
2527
2535
|
}
|
|
2528
2536
|
|
|
2537
|
+
/** Opens ticket `id`: see openTaskNow. */
|
|
2538
|
+
openTask (id) { return this.branchMove(() => this.openTaskNow(id)) }
|
|
2539
|
+
|
|
2540
|
+
/** Leaves the ticket this folder has open: see leaveTaskNow. */
|
|
2541
|
+
leaveTask () { return this.branchMove(() => this.leaveTaskNow()) }
|
|
2542
|
+
|
|
2529
2543
|
/** Waits, a few seconds at most, for git and a move between branches in this folder to finish; whether they have. */
|
|
2530
2544
|
async gitQuiet (ms = 8000) {
|
|
2531
2545
|
const busy = () => !!(this.hold || this.pendingMove || this.gitBusy())
|
|
@@ -2534,6 +2548,22 @@ export class Session extends EventEmitter {
|
|
|
2534
2548
|
return !busy()
|
|
2535
2549
|
}
|
|
2536
2550
|
|
|
2551
|
+
/**
|
|
2552
|
+
* Before Quilt itself checks out another branch: what was saved in this folder is in the session
|
|
2553
|
+
* first. A save the watcher has not reported yet is looked for, git's own work here is waited out,
|
|
2554
|
+
* and so is every save on its way to the relay (`ms` at most). The checkout would otherwise take
|
|
2555
|
+
* the file away before it was shared: lost when it was not committed, and written back over by
|
|
2556
|
+
* the session's older version when the folder came back to the branch. Whether the folder is quiet.
|
|
2557
|
+
*/
|
|
2558
|
+
async savesSent (ms = 8000) {
|
|
2559
|
+
this.scanDisk()
|
|
2560
|
+
this.flushPending()
|
|
2561
|
+
const busy = () => !!(this.hold || this.pendingMove || this.gitBusy() || this.pending.size || this.relayWriting.size)
|
|
2562
|
+
const until = Date.now() + ms
|
|
2563
|
+
while (busy() && Date.now() < until && !this.stopped) await new Promise((resolve) => setTimeout(resolve, 100))
|
|
2564
|
+
return !busy()
|
|
2565
|
+
}
|
|
2566
|
+
|
|
2537
2567
|
/** The folder has arrived on `branch` in git and in the session, and is quiet: waited for, for `ms` at most. */
|
|
2538
2568
|
async arrivedOn (branch, ms = 20000) {
|
|
2539
2569
|
const there = () => !!this.git && this.git.branch === branch && !this.hold && !this.pendingMove
|
|
@@ -2542,52 +2572,75 @@ export class Session extends EventEmitter {
|
|
|
2542
2572
|
return there()
|
|
2543
2573
|
}
|
|
2544
2574
|
|
|
2575
|
+
/** The session's default branch, as git names it. */
|
|
2576
|
+
defaultBranch () { return (this.branchList.find((b) => b && b.default) || {}).key || 'main' }
|
|
2577
|
+
|
|
2578
|
+
/** The ticket whose branch this folder is on, or null. */
|
|
2579
|
+
openedTask () {
|
|
2580
|
+
const here = this.git && this.git.branch
|
|
2581
|
+
return (here && this.taskList().find((t) => t && !t.archived && t.branch === here)) || null
|
|
2582
|
+
}
|
|
2583
|
+
|
|
2584
|
+
/** The ticket's branch: the one it has, or a new name for it (kept on the ticket, so everyone uses the same). */
|
|
2585
|
+
branchOfTask (task) {
|
|
2586
|
+
if (task.branch) return task.branch
|
|
2587
|
+
const taken = new Set(this.taskList().map((t) => t && t.branch).filter(Boolean))
|
|
2588
|
+
const base = `${TICKET_PREFIX}${slug(task.title)}`
|
|
2589
|
+
let name = base
|
|
2590
|
+
for (let n = 2; taken.has(name); n++) name = `${base}-${n}`
|
|
2591
|
+
this.updateTask({ id: task.id, branch: name })
|
|
2592
|
+
return name
|
|
2593
|
+
}
|
|
2594
|
+
|
|
2545
2595
|
/**
|
|
2546
|
-
*
|
|
2547
|
-
*
|
|
2548
|
-
*
|
|
2596
|
+
* Moves this folder onto ticket `id`'s branch. Returns { branch, from } (`already`: it was on it;
|
|
2597
|
+
* `again`: this folder had the branch from before; `remote`: made from the branch a partner
|
|
2598
|
+
* pushed), { stayed, why } when the folder stays where it is, or null when the folder is not a git
|
|
2599
|
+
* clone on a branch (tickets have no branch there).
|
|
2549
2600
|
*/
|
|
2550
|
-
async
|
|
2551
|
-
|
|
2552
|
-
if (!
|
|
2553
|
-
|
|
2554
|
-
const name = `${prefix}${slug(task.title)}`
|
|
2601
|
+
async openTaskNow (id) {
|
|
2602
|
+
const task = this.taskList().find((t) => t && t.id === id)
|
|
2603
|
+
if (!task) throw new Error('no such task')
|
|
2604
|
+
if (this.stopped || !this.git || !this.git.branch) return null
|
|
2555
2605
|
let from = this.git.branch
|
|
2556
|
-
|
|
2557
|
-
if (
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
if (dirty.length) {
|
|
2562
|
-
const why = `${dirty.slice(0, 4).join(', ')}${dirty.length > 4 ? ` and ${dirty.length - 4} more` : ''} ${dirty.length === 1 ? 'is' : 'are'} not committed on it. Commit (or put back) your changes there, then take the task again for a branch of its own.`
|
|
2563
|
-
this.log(`🌿 staying on ${from}: ${why}`)
|
|
2564
|
-
return { stayed: from, why }
|
|
2565
|
-
}
|
|
2566
|
-
const main = (this.branchList.find((b) => b && b.default) || {}).key || 'main'
|
|
2567
|
-
const back = await switchBranch(this.root, main, { force: true })
|
|
2568
|
-
if (back || !(await this.arrivedOn(main))) {
|
|
2569
|
-
const why = `git could not go back to ${main} from it${back ? ` (${back})` : ''}.`
|
|
2570
|
-
this.log(`🌿 staying on ${from}: ${why}`)
|
|
2571
|
-
return { stayed: from, why }
|
|
2572
|
-
}
|
|
2573
|
-
from = main
|
|
2574
|
-
}
|
|
2575
|
-
// A branch named after the task from before (the task was taken, left and taken again) is carried on with.
|
|
2606
|
+
const stays = (why) => { this.log(`🌿 staying on ${from}: ${why}`); return { stayed: from, why } }
|
|
2607
|
+
if (!(await this.savesSent())) return stays('git is at work in this folder. Try again in a moment.')
|
|
2608
|
+
from = this.git.branch
|
|
2609
|
+
const name = this.branchOfTask(task)
|
|
2610
|
+
if (from === name) return { branch: name, from, already: true }
|
|
2576
2611
|
const again = await hasBranch(this.root, name)
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2612
|
+
let remote = null
|
|
2613
|
+
if (!again) {
|
|
2614
|
+
// A new branch is not made on top of another ticket's commits: from the default branch instead.
|
|
2615
|
+
if (from.startsWith(TICKET_PREFIX)) {
|
|
2616
|
+
const main = this.defaultBranch()
|
|
2617
|
+
const back = await switchBranch(this.root, main, { force: true })
|
|
2618
|
+
if (back || !(await this.arrivedOn(main))) return stays(`git could not go back to ${main} from it${back ? ` (${back})` : ''}.`)
|
|
2619
|
+
from = main
|
|
2620
|
+
}
|
|
2621
|
+
// It starts from the latest the remote has (a ticket merged meanwhile is then in it): fetched and brought in now, when that is all it takes.
|
|
2622
|
+
if (this.bringInUpstream) await this.caughtUp(from)
|
|
2623
|
+
if (!(await this.gitQuiet()) || !this.git || this.git.branch !== from) return stays('git is at work in this folder. Try again in a moment.')
|
|
2624
|
+
// A partner who opened the ticket first may have pushed its branch: this folder's then starts from theirs, and follows it.
|
|
2625
|
+
remote = await remoteBranch(this.root, await defaultRemote(this.root), name)
|
|
2626
|
+
}
|
|
2627
|
+
const said = await switchBranch(this.root, name, { create: !again, force: true, track: remote })
|
|
2628
|
+
if (said || !(await this.arrivedOn(name))) return stays(`git could not ${again ? 'check out' : 'make'} ${name}${said ? ` (${said})` : ''}.`)
|
|
2629
|
+
this.log(`🌿 on ${name} for "${task.title}"${again ? '' : ` (made from ${remote || from})`}`)
|
|
2630
|
+
return { branch: name, from, ...(again ? { again: true } : {}), ...(remote ? { remote: true } : {}) }
|
|
2631
|
+
}
|
|
2632
|
+
|
|
2633
|
+
/** Back to the session's default branch from a ticket's. { branch, from }, { stayed, why }, or null when no ticket's branch is checked out. */
|
|
2634
|
+
async leaveTaskNow () {
|
|
2635
|
+
if (this.stopped || !this.git || !this.git.branch || !this.git.branch.startsWith(TICKET_PREFIX)) return null
|
|
2636
|
+
const from = this.git.branch
|
|
2637
|
+
const main = this.defaultBranch()
|
|
2638
|
+
const stays = (why) => { this.log(`🌿 staying on ${from}: ${why}`); return { stayed: from, why } }
|
|
2639
|
+
if (!(await this.savesSent())) return stays('git is at work in this folder. Try again in a moment.')
|
|
2640
|
+
const said = await switchBranch(this.root, main, { force: true })
|
|
2641
|
+
if (said || !(await this.arrivedOn(main))) return stays(`git could not check out ${main}${said ? ` (${said})` : ''}.`)
|
|
2642
|
+
this.log(`🌿 back on ${main}; what you had not committed on ${from} stays there in the session`)
|
|
2643
|
+
return { branch: main, from }
|
|
2591
2644
|
}
|
|
2592
2645
|
|
|
2593
2646
|
/**
|
|
@@ -2611,7 +2664,7 @@ export class Session extends EventEmitter {
|
|
|
2611
2664
|
return false
|
|
2612
2665
|
}
|
|
2613
2666
|
|
|
2614
|
-
/** The files this
|
|
2667
|
+
/** The files this member wrote on the branch it is on (by the session's record) that git has not committed, sorted. */
|
|
2615
2668
|
async ownUncommitted () {
|
|
2616
2669
|
const mine = new Set()
|
|
2617
2670
|
for (const a of this.activity) if (a && a.by === this.name && a.branch === this.branch && typeof a.path === 'string' && a.path) mine.add(a.path)
|
|
@@ -2621,16 +2674,16 @@ export class Session extends EventEmitter {
|
|
|
2621
2674
|
}
|
|
2622
2675
|
|
|
2623
2676
|
/**
|
|
2624
|
-
* Whether
|
|
2625
|
-
* nothing to hold it to (a person, no git clone, a folder not on a
|
|
2677
|
+
* Whether an agent's work on a ticket is in git, asked when it moves a task to QA or Done: null when
|
|
2678
|
+
* there is nothing to hold it to (a person, no git clone, a folder not on a ticket's branch), else
|
|
2626
2679
|
* { ok: true, branch } or { ok: false, why } with what to do.
|
|
2627
2680
|
*/
|
|
2628
2681
|
async taskInGit () {
|
|
2629
|
-
if (this.kind !== 'agent' || !this.git || !this.git.branch || !this.git.branch.startsWith(
|
|
2682
|
+
if (this.kind !== 'agent' || !this.git || !this.git.branch || !this.git.branch.startsWith(TICKET_PREFIX)) return null
|
|
2630
2683
|
const branch = this.git.branch
|
|
2631
2684
|
const dirty = await this.ownUncommitted()
|
|
2632
2685
|
if (dirty.length) {
|
|
2633
|
-
return { ok: false, why: `Get this
|
|
2686
|
+
return { ok: false, why: `Get this ticket's work into git first: ${dirty.slice(0, 6).join(', ')}${dirty.length > 6 ? ` and ${dirty.length - 6} more` : ''} ${dirty.length === 1 ? 'is' : 'are'} not committed on ${branch}. Commit only the files you changed, push with \`git push -u origin ${branch}\`, then move the task again.` }
|
|
2634
2687
|
}
|
|
2635
2688
|
const up = await upstreamOf(this.root)
|
|
2636
2689
|
const tip = await branchTip(this.root, branch)
|
package/src/tasks.js
CHANGED
|
@@ -144,10 +144,11 @@ export function publicTask (value) {
|
|
|
144
144
|
// When it was archived. Tasks archived before this was kept have none; a bad value is dropped, not the task.
|
|
145
145
|
const archivedAt = archived && Number.isFinite(value.archivedAt) && value.archivedAt > 0 ? value.archivedAt : 0
|
|
146
146
|
const pr = storedPull(value.pr)
|
|
147
|
+
const branch = storedBranch(value.branch)
|
|
147
148
|
// "Not for auto pickup": no AI takes it from the board by itself (nextTask, autowork.js) until someone clears it. Kept only when on.
|
|
148
149
|
const noPickup = storedFlag(value.noPickup)
|
|
149
150
|
if (noPickup == null) return null
|
|
150
|
-
return { id: value.id, title, column: value.column, by: value.by, order: value.order, ts: value.ts, ...who, files, conv, verified, qaNotes, recurring, cron, archived, ...(archivedAt ? { archivedAt } : {}), ...(pr ? { pr } : {}), ...(noPickup ? { noPickup: true } : {}) }
|
|
151
|
+
return { id: value.id, title, column: value.column, by: value.by, order: value.order, ts: value.ts, ...who, files, conv, verified, qaNotes, recurring, cron, archived, ...(archivedAt ? { archivedAt } : {}), ...(pr ? { pr } : {}), ...(branch ? { branch } : {}), ...(noPickup ? { noPickup: true } : {}) }
|
|
151
152
|
}
|
|
152
153
|
|
|
153
154
|
/** Tasks still on the board: archived ones are kept, but off the board and out of every listing. */
|
|
@@ -191,6 +192,11 @@ function storedFlag (v) {
|
|
|
191
192
|
return v
|
|
192
193
|
}
|
|
193
194
|
|
|
195
|
+
/** The git branch a ticket's work is on (set when someone first opens the ticket), or ''; a bad value reads as none. */
|
|
196
|
+
export function storedBranch (v) {
|
|
197
|
+
return typeof v === 'string' && v.length <= 200 && /^[A-Za-z0-9][A-Za-z0-9._/-]*$/.test(v) && !v.includes('..') && !v.endsWith('/') && !v.endsWith('.lock') ? v : ''
|
|
198
|
+
}
|
|
199
|
+
|
|
194
200
|
/** The pull request a task's work is in ({ number, url, branch, base }, set by the relay when the branch is pushed), or null; a bad value reads as none. */
|
|
195
201
|
function storedPull (v) {
|
|
196
202
|
if (!v || typeof v !== 'object' || !Number.isInteger(v.number) || v.number < 1 || typeof v.url !== 'string' || v.url.length > 400) return null
|
|
@@ -348,7 +354,7 @@ export function addTask (doc, map, { id = null, title, by, assignee = '', forAi
|
|
|
348
354
|
* Moving an archived task to another column brings it back onto the board.
|
|
349
355
|
* `cron` is 5-field cron or a phrase such as "daily at 9". A schedule turns `recurring` on.
|
|
350
356
|
*/
|
|
351
|
-
export function updateTask (doc, map, { id, title, column, before, assignee, forAi, tool, files, verified, qaNotes, recurring, cron, archived, pr, noPickup } = {}, origin) {
|
|
357
|
+
export function updateTask (doc, map, { id, title, column, before, assignee, forAi, tool, files, verified, qaNotes, recurring, cron, archived, pr, noPickup, branch } = {}, origin) {
|
|
352
358
|
const { valid } = split(map)
|
|
353
359
|
const cur = valid.find((t) => t.id === id)
|
|
354
360
|
if (!cur) throw new Error('no such task')
|
|
@@ -358,6 +364,10 @@ export function updateTask (doc, map, { id, title, column, before, assignee, for
|
|
|
358
364
|
const clean = pr === null ? null : storedPull(pr)
|
|
359
365
|
if (JSON.stringify(clean) !== JSON.stringify(cur.pr || null)) { if (clean) next.pr = clean; else delete next.pr; changed = true }
|
|
360
366
|
}
|
|
367
|
+
if (branch !== undefined) {
|
|
368
|
+
const clean = storedBranch(branch)
|
|
369
|
+
if (clean !== (cur.branch || '')) { if (clean) next.branch = clean; else delete next.branch; changed = true }
|
|
370
|
+
}
|
|
361
371
|
if (title !== undefined) {
|
|
362
372
|
const clean = cleanTitle(title)
|
|
363
373
|
if (!clean) throw new Error('say what the task is')
|
package/src/ui/agent-guide.js
CHANGED
|
@@ -97,7 +97,7 @@ export function agentGuide ({ apiUrl = 'https://api.heyquilt.com', via = 'both'
|
|
|
97
97
|
'',
|
|
98
98
|
'### Getting your work into git',
|
|
99
99
|
'- Work that is only in the session has not shipped. Get it into git yourself as soon as it is finished and tested, before you move its task to QA.',
|
|
100
|
-
cli ? `- ${both ? 'With the CLI, join' : 'Join'} from a git clone of the repository (\`git clone <url>\` first, then \`quilt join\` in it). Git is yours to run, with your own sign-in. Taking a
|
|
100
|
+
cli ? `- ${both ? 'With the CLI, join' : 'Join'} from a git clone of the repository (\`git clone <url>\` first, then \`quilt join\` in it). Git is yours to run, with your own sign-in. A ticket is a unit of work, and its work is on a branch of its own, quilt/<ticket>. Taking a ticket (\`quilt_move_task\` to doing) moves your folder onto that branch, made from the latest commit when nobody opened the ticket before (an agent's folder only: a person's stays where it is unless they open the ticket from the board). Everyone who has the ticket open works there together, live; nobody else gets that work until it is merged. Commit only the files you changed there (never \`git add -A\` or \`git commit -a\`), \`git push -u origin <that branch>\`, and open the pull request yourself (\`gh pr create\`). Your ticket moves to QA only once the branch is committed and pushed. Quilt does not commit, push, open pull requests or merge them for anyone.` : null,
|
|
101
101
|
cli ? `- ${both ? 'With the CLI: s' : 'S'}witching branches moves your folder to that branch's work in the session, and the branch you left keeps its own. Your folder also holds everyone's uncommitted work on the branch you are on, so git may refuse a checkout ("local changes would be overwritten"): switch with \`git checkout -f <branch>\`. Nothing is lost, because the session keeps that work on the branch you leave. A \`git stash\` on its own is put back a moment later.` : null,
|
|
102
102
|
cli ? `- ${both ? 'With the CLI: c' : 'C'}ommits pushed to your branch's upstream (a partner's push, a pull request merged on GitHub) come into your folder by themselves: about once a minute, and when a partner's folder moves, Quilt fetches the upstream and moves your branch forward to them, keeping the session's uncommitted work. There is nothing to pull. For that the folder needs fetch credentials that work without a prompt (a credential helper, an SSH key, or a token in the remote's URL). Quilt leaves two cases to your own git, and \`quilt_status\` says so under "Git": your branch has commits of its own that the upstream hasn't, and a commit changed the same lines as uncommitted work (commit it first). In both, pull with \`git pull --rebase --autostash\` (or \`--no-rebase\` to merge) and settle any conflict. While git is stopped on a conflict (a merge, rebase, cherry-pick or revert) your folder is paused: nothing is shared from it or written to it until you settle it and commit. Quilt never rewrites or force-pushes history, and neither should you.` : null,
|
|
103
103
|
http ? `- ${both ? 'Over HTTP you have no folder, so ' : 'You have no folder, so '}you cannot commit. What you write is in the session and in every member's folder, and someone with a folder commits it: say in your task's \`qaNotes\` which files need committing. Quilt never rewrites or force-pushes history.` : null,
|
package/src/ui/app.css
CHANGED
|
@@ -2776,6 +2776,17 @@ body.has-asks .ws { height: calc(100vh - var(--update-bar, 0px) - var(--asks-bar
|
|
|
2776
2776
|
.task-nopickup-x { margin-left: 2px; opacity: .55; font-weight: 700; }
|
|
2777
2777
|
.task-nopickup:hover .task-nopickup-x, .task-nopickup:focus-visible .task-nopickup-x { opacity: 1; }
|
|
2778
2778
|
.task-nopickup:hover, .task-nopickup:focus-visible { background: color-mix(in srgb, var(--warn) 20%, transparent); outline: none; }
|
|
2779
|
+
/* A ticket's branch on its card (board.js ticketHtml): who is working there, and Open or Leave. */
|
|
2780
|
+
.task-ticket { display: flex; align-items: center; gap: 6px; margin: 6px 0 0; min-height: 24px; }
|
|
2781
|
+
.task-ticket-who { display: inline-flex; align-items: center; gap: 5px; flex: 1; min-width: 0; font-size: 11.5px; color: var(--muted); }
|
|
2782
|
+
.task-ticket-who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
2783
|
+
.task-ticket-who svg { width: 12px; height: 12px; flex: none; }
|
|
2784
|
+
.task-ticket.here .task-ticket-who { color: var(--accent); }
|
|
2785
|
+
.task button.task-ticket-btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; flex: none; margin-left: auto; padding: 2px 9px; border: 1px solid var(--border-strong); border-radius: 999px; background: transparent; color: var(--text); font: inherit; font-size: 11.5px; cursor: pointer; }
|
|
2786
|
+
.task-ticket > .task-ticket-btn:only-child { flex: 1; margin-left: 0; }
|
|
2787
|
+
.task button.task-ticket-btn svg { width: 12px; height: 12px; flex: none; }
|
|
2788
|
+
.task button.task-ticket-btn:hover, .task button.task-ticket-btn:focus-visible { border-color: var(--accent); color: var(--accent); outline: none; }
|
|
2789
|
+
.task button.task-ticket-btn:disabled { opacity: .5; cursor: default; }
|
|
2779
2790
|
/* A cloud AI's own name in chat, then whose AI it is ("Juniper Daniel's AI"). */
|
|
2780
2791
|
.msg .head .ai-tag { font-size: 10.5px; padding: 0 7px; }
|
|
2781
2792
|
.signup-form { width: 100%; text-align: left; }
|
package/src/ui/board.js
CHANGED
|
@@ -25,7 +25,7 @@ const COLUMNS = [
|
|
|
25
25
|
* `archived` shows the archived tasks in place of the columns. `show` keeps only some tasks:
|
|
26
26
|
* '' everyone's, 'none' unassigned ones, `p:name` a person's, `a:name` that person's AI's.
|
|
27
27
|
*/
|
|
28
|
-
export function renderBoard (tasks, me, people = [], assignTo = '', { archived = false, show = '', closedGroups = [] } = {}) {
|
|
28
|
+
export function renderBoard (tasks, me, people = [], assignTo = '', { archived = false, show = '', closedGroups = [], git = null } = {}) {
|
|
29
29
|
const every = (Array.isArray(tasks) ? tasks : []).filter(Boolean)
|
|
30
30
|
const all = every.filter((t) => showsTask(t, show))
|
|
31
31
|
const list = all.filter((t) => !t.archived)
|
|
@@ -34,7 +34,7 @@ export function renderBoard (tasks, me, people = [], assignTo = '', { archived =
|
|
|
34
34
|
const cols = COLUMNS.map((col) => {
|
|
35
35
|
const cards = list.filter((t) => t && t.column === col.id)
|
|
36
36
|
const body = cards.length
|
|
37
|
-
? cards.map((t) => card(t, col, me, people)).join('')
|
|
37
|
+
? cards.map((t) => card(t, col, me, people, git)).join('')
|
|
38
38
|
: `<p class="board-empty">${col.id === 'todo' ? 'Nothing here yet.' : 'Nothing here.'}</p>`
|
|
39
39
|
const n = cards.length
|
|
40
40
|
// When the board is too narrow for every column, session.js folds some to a strip:
|
|
@@ -444,7 +444,28 @@ export function matchesSearch (text, query) {
|
|
|
444
444
|
return words.every((w) => text.includes(w))
|
|
445
445
|
}
|
|
446
446
|
|
|
447
|
-
|
|
447
|
+
/**
|
|
448
|
+
* A ticket's branch on its card. `git`: { branch: the branch this folder is on, on: Map of a branch
|
|
449
|
+
* to the others whose folders are on it }, or null when this folder is not a git clone (tickets
|
|
450
|
+
* have no branch here: nothing is shown). Opening a ticket moves your folder onto its branch;
|
|
451
|
+
* everyone who has it open works there together. Open: Leave takes your folder back.
|
|
452
|
+
*/
|
|
453
|
+
export function ticketHtml (t, git) {
|
|
454
|
+
if (!git || !git.branch) return ''
|
|
455
|
+
const here = !!t.branch && t.branch === git.branch
|
|
456
|
+
const others = (t.branch && git.on && git.on.get(t.branch)) || []
|
|
457
|
+
const names = others.length > 2 ? `${others.slice(0, 2).join(', ')} +${others.length - 2}` : others.join(' and ')
|
|
458
|
+
const who = here ? (names ? `You and ${names} are working here` : 'You are working here') : names ? `${names} ${others.length === 1 ? 'is' : 'are'} working here` : ''
|
|
459
|
+
const tip = t.branch ? `Its branch: ${t.branch}` : 'It gets a branch of its own when someone opens it'
|
|
460
|
+
return `<div class="task-ticket${here ? ' here' : ''}" title="${esc(tip)}">
|
|
461
|
+
${who ? `<span class="task-ticket-who">${I.branch}<span>${esc(who)}</span></span>` : ''}
|
|
462
|
+
${here
|
|
463
|
+
? `<button type="button" class="task-ticket-btn" data-task-leave title="Take your folder back to the session's main branch. What you have not committed stays on this ticket.">Leave</button>`
|
|
464
|
+
: `<button type="button" class="task-ticket-btn" data-task-open title="Move your folder onto this ticket's branch. Everyone who has the ticket open works there together.">${I.branch}<span>Open ticket</span></button>`}
|
|
465
|
+
</div>`
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
function card (t, col, me, people, git = null) {
|
|
448
469
|
const who = t.by === me ? 'You' : (t.by || '')
|
|
449
470
|
const mine = t.assignee === me && !t.forAi ? ' mine' : t.assignee === me && t.forAi ? ' mine-ai' : ''
|
|
450
471
|
const moves = col.moves.map((m) =>
|
|
@@ -462,6 +483,7 @@ function card (t, col, me, people) {
|
|
|
462
483
|
<p class="task-title" title="Click to rename">${esc(t.title)}</p>
|
|
463
484
|
</div>
|
|
464
485
|
${noPickupHtml(t)}
|
|
486
|
+
${ticketHtml(t, git)}
|
|
465
487
|
<select class="task-assign" aria-label="Assign ${esc(t.title)}">${assignOptions(t, me, people)}</select>
|
|
466
488
|
${recurHtml(t)}
|
|
467
489
|
${filesHtml(t.files)}
|
package/src/ui/session.js
CHANGED
|
@@ -1770,6 +1770,29 @@ function bindBoard () {
|
|
|
1770
1770
|
catch (err) { toast(err.message) }
|
|
1771
1771
|
return
|
|
1772
1772
|
}
|
|
1773
|
+
const ticket = e.target.closest('[data-task-open], [data-task-leave]')
|
|
1774
|
+
if (ticket) {
|
|
1775
|
+
// Opening a ticket moves this folder onto its branch; leaving takes it back (session.js openTask, leaveTask).
|
|
1776
|
+
const id = ticket.closest('.task')?.dataset.task
|
|
1777
|
+
const task = (sum()?.status.tasks || []).find((t) => t.id === id)
|
|
1778
|
+
if (!id || !task || ticket.disabled) return
|
|
1779
|
+
const opening = ticket.matches('[data-task-open]')
|
|
1780
|
+
ticket.disabled = true
|
|
1781
|
+
try {
|
|
1782
|
+
const sid = current
|
|
1783
|
+
const r = await api('POST', `/api/sessions/${sid}/tasks/${opening ? 'open' : 'leave'}`, opening ? { id } : {})
|
|
1784
|
+
if (sid !== current) return
|
|
1785
|
+
const s = state.sessions.get(sid)
|
|
1786
|
+
if (s && r.tasks) s.status.tasks = r.tasks
|
|
1787
|
+
const b = r.branch
|
|
1788
|
+
if (!b) toast(opening ? 'This folder is not a git clone, so tickets have no branch here.' : 'You are not on a ticket\'s branch.')
|
|
1789
|
+
else if (b.stayed) toast(`Your folder stays on ${b.stayed}: ${b.why}`)
|
|
1790
|
+
else if (opening) toast(`Your folder is on "${task.title}" now (${b.branch}).`)
|
|
1791
|
+
else toast(`Your folder is back on ${b.branch}. What you had not committed stays on the ticket.`)
|
|
1792
|
+
paintBoard({ force: true })
|
|
1793
|
+
} catch (err) { toast(err.message) } finally { ticket.disabled = false }
|
|
1794
|
+
return
|
|
1795
|
+
}
|
|
1773
1796
|
const removeFile = e.target.closest('[data-file-remove]')
|
|
1774
1797
|
if (removeFile) {
|
|
1775
1798
|
const id = removeFile.closest('.task')?.dataset.task
|
|
@@ -1910,7 +1933,11 @@ function renderMain () {
|
|
|
1910
1933
|
// A task an older app gave to one of someone's AI sessions ("Dana · login") is that person's.
|
|
1911
1934
|
const who = owners(sum())
|
|
1912
1935
|
const tasks = (st.tasks || []).map((t) => (t && who.has(t.assignee) ? { ...t, assignee: who.get(t.assignee) } : t))
|
|
1913
|
-
|
|
1936
|
+
// Tickets and their branches: where this folder is in git, and who else is on which branch.
|
|
1937
|
+
const on = new Map()
|
|
1938
|
+
for (const p of st.peers || []) if (p && p.branch && p.name !== st.me.name) on.set(p.branch, [...new Set([...(on.get(p.branch) || []), p.name])])
|
|
1939
|
+
const git = st.git && st.git.branch ? { branch: st.git.branch, on } : null
|
|
1940
|
+
const html = renderBoard(tasks, me(), taskPeople(st), assignTo, { archived: !!w.archived, show, closedGroups: w.archiveClosed || [], git })
|
|
1914
1941
|
// Status ticks arrive every few seconds. Re-rendering an unchanged board
|
|
1915
1942
|
// would throw away hover, selection and scroll for nothing.
|
|
1916
1943
|
if (html === lastBoard.html && lastBoard.el && el.firstElementChild === lastBoard.el) return
|
package/src/ui-server.js
CHANGED
|
@@ -1183,11 +1183,11 @@ export async function startUi ({ port = 7420, onShutdown, preview = false, repor
|
|
|
1183
1183
|
'POST /api/sessions/:id/tasks': (b, id) => ({ task: get(id).addTask(b), tasks: get(id).taskList() }),
|
|
1184
1184
|
'POST /api/sessions/:id/tasks/update': async (b, id) => {
|
|
1185
1185
|
const s = get(id)
|
|
1186
|
-
|
|
1187
|
-
// Done merges the task's pull request first (relay-commit.js): refused with the reason when it can't be.
|
|
1188
|
-
const finished = b.column === 'done' && before && before.column !== 'done' ? await s.finishTask(b.id) : null
|
|
1189
|
-
return { task: s.updateTask(b), tasks: s.taskList(), ...(finished && finished.merged ? { merged: finished.merged } : {}) }
|
|
1186
|
+
return { task: s.updateTask(b), tasks: s.taskList() }
|
|
1190
1187
|
},
|
|
1188
|
+
// Opening a ticket moves this folder onto the ticket's branch (session.js openTask); leaving goes back to the default branch.
|
|
1189
|
+
'POST /api/sessions/:id/tasks/open': async (b, id) => { const s = get(id); const branch = await s.openTask(b.id); pushStatus(id); return { branch, tasks: s.taskList() } },
|
|
1190
|
+
'POST /api/sessions/:id/tasks/leave': async (b, id) => { const branch = await get(id).leaveTask(); pushStatus(id); return { branch } },
|
|
1191
1191
|
'POST /api/sessions/:id/tasks/delete': (b, id) => { get(id).deleteTask(b.id); return { tasks: get(id).taskList() } },
|
|
1192
1192
|
'POST /api/sessions/:id/tasks/comment': (b, id) => ({ ...get(id).commentTask(b), tasks: get(id).taskList() }),
|
|
1193
1193
|
'GET /api/sessions/:id/feed': (b, id, url) => {
|