heyquilt 0.3.177 → 0.3.178
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 +6 -0
- package/package.json +1 -1
- package/src/agent-task-workflow.js +14 -2
- package/src/control.js +9 -2
- package/src/gitstate.js +17 -2
- package/src/mcp.js +5 -5
- package/src/session.js +135 -1
- package/src/ui/agent-guide.js +1 -1
package/RELEASES.md
CHANGED
|
@@ -11,6 +11,12 @@ 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.178 — 2026-11-18
|
|
15
|
+
|
|
16
|
+
- **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.
|
|
17
|
+
- **An agent's task reaches QA only when its work is in git.** The agent commits and pushes its branch and opens the pull request itself. Until the branch is committed and pushed, moving the task to QA or Done is refused, with what to do.
|
|
18
|
+
- **When the pull request is merged, the work comes to you.** Your branch moves to the merge by itself, as with any other commit, and your uncommitted work stays.
|
|
19
|
+
|
|
14
20
|
## 0.3.177 — 2026-11-17
|
|
15
21
|
|
|
16
22
|
- **No more boxes.** Every edit is shared with everyone as it is made, in a git folder or any other. Nothing is kept out of your folder until someone commits it, and there is nothing to unpack.
|
package/package.json
CHANGED
|
@@ -24,7 +24,19 @@ 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
|
|
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 put on a branch of its own when it takes a task (quilt/<agent>/<task>): it pushes that branch and opens the pull request itself, and its task 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
|
+
|
|
29
|
+
/**
|
|
30
|
+
* What an agent is told after taking a task about the branch its folder is on (Session.branchForTask's
|
|
31
|
+
* answer): the branch made or carried on with, or why the folder stayed where it was. '' for nothing.
|
|
32
|
+
*/
|
|
33
|
+
export function taskBranchNote (b) {
|
|
34
|
+
if (!b) return ''
|
|
35
|
+
if (b.stayed) return `\n\nYour folder stays on \`${b.stayed}\`: ${b.why}`
|
|
36
|
+
if (!b.branch) return ''
|
|
37
|
+
const how = b.again ? 'the branch this task had before' : `a branch of its own for this task, made from \`${b.from}\``
|
|
38
|
+
return `\n\nYour folder is now on \`${b.branch}\`, ${how}. What you change is on that branch only, not on \`${b.from}\`. Commit only the files you changed, push with \`git push -u origin ${b.branch}\`, and open the pull request yourself (\`gh pr create\`). The task moves to QA once the branch is committed and pushed.`
|
|
39
|
+
}
|
|
28
40
|
|
|
29
41
|
/** Markdown bullets for AGENTS.md / CLAUDE.md (same steps as TASK_WORKFLOW). */
|
|
30
42
|
export const TASK_WORKFLOW_MD =
|
|
@@ -36,7 +48,7 @@ export const TASK_WORKFLOW_MD =
|
|
|
36
48
|
' 5. **QA**: move to `qa` (not straight to Done) with `qaNotes` describing the changes and how you self-validated them.\n' +
|
|
37
49
|
' Keep `qaNotes`, `verified` and task comments brief: a few short sentences, no logs or play-by-play.\n' +
|
|
38
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' +
|
|
39
|
-
' 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. An agent that joined as its own member is on a branch of its own for the task (quilt/<agent>/<task>, made when it takes the task): it pushes that branch and opens the pull request itself, and its task 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.'
|
|
40
52
|
|
|
41
53
|
/** Scaffolded into AGENTS.md by `quilt setup` when the project has no checklist yet. Owners edit it in place. */
|
|
42
54
|
export const CHECKLIST_SCAFFOLD = `${CHECKLIST_HEADING}
|
package/src/control.js
CHANGED
|
@@ -133,13 +133,20 @@ export async function startControl (session, extras = {}) {
|
|
|
133
133
|
session.noteTaskChange(null, task, b.via)
|
|
134
134
|
return { task, tasks: session.taskList() }
|
|
135
135
|
},
|
|
136
|
-
'POST /tasks/update': (b) => {
|
|
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 of its own moves a task to QA or Done only once its work there is committed and pushed (session.js taskInGit).
|
|
139
|
+
if ((b.column === 'qa' || b.column === 'done') && before && before.column !== b.column) {
|
|
140
|
+
const inGit = await session.taskInGit()
|
|
141
|
+
if (inGit && !inGit.ok) throw new Error(inGit.why)
|
|
142
|
+
}
|
|
138
143
|
const task = session.updateTask(b)
|
|
139
144
|
session.noteTaskChange(before, task, b.via)
|
|
140
145
|
if (b.column === 'doing' && task) session.personaSays(b.via, task.title) // taking a task can name an AI session
|
|
141
146
|
if (task && (b.column === 'doing' || b.column === 'done')) session.stitchClock(b.via, b.column === 'doing')
|
|
142
|
-
|
|
147
|
+
// An agent taking a task gets a branch of its own for it (session.js branchForTask).
|
|
148
|
+
const branch = b.column === 'doing' && task ? await session.branchForTask(task).catch(() => null) : null
|
|
149
|
+
return { task, tasks: session.taskList(), ...(branch ? { branch } : {}) }
|
|
143
150
|
},
|
|
144
151
|
// What an agent gets when it picks a task up: history for its files, the project's checks.
|
|
145
152
|
'POST /tasks/brief': (b) => session.taskBrief(b.id),
|
package/src/gitstate.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// What git is doing to a synced folder: which branch (or commit) the folder is on, whether git is
|
|
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
|
-
// itself,
|
|
5
|
-
//
|
|
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 a branch for an agent's task. 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'
|
|
@@ -403,6 +403,21 @@ export async function changesBetween (root, from, to) {
|
|
|
403
403
|
return changes
|
|
404
404
|
}
|
|
405
405
|
|
|
406
|
+
/** Whether the repository has a local branch called `name`. */
|
|
407
|
+
export async function hasBranch (root, name) {
|
|
408
|
+
return (await call(root, ['rev-parse', '-q', '--verify', `refs/heads/${name}`])).out !== null
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Checks out `branch` in the folder, as `git checkout` does. `create`: a new branch, from the commit
|
|
413
|
+
* the folder is at. `force`: tracked files become the commit's, whatever was changed in them (-f).
|
|
414
|
+
* '' when git did it, else git's own words for why not.
|
|
415
|
+
*/
|
|
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 })
|
|
418
|
+
return r.out !== null ? '' : (r.stderr || '').trim().split('\n')[0] || 'git could not check it out'
|
|
419
|
+
}
|
|
420
|
+
|
|
406
421
|
/** Stages `rels` as they are in the folder (git add); whether git did. */
|
|
407
422
|
export async function stage (root, rels) {
|
|
408
423
|
for (let i = 0; i < rels.length; i += MAX_PATHSPECS) {
|
package/src/mcp.js
CHANGED
|
@@ -29,7 +29,7 @@ import { pickAgent, agentWhoami, agentAccess, readAgent, savedAgents } from './a
|
|
|
29
29
|
import { setSessionWorkspace, announceSessionStarted, announceWhenReported, apiUrl, readAccount, resumeAccount } from './account.js'
|
|
30
30
|
import { registerWorkspaceTools, bytesFetcher, isInside } from './workspace-tools.js'
|
|
31
31
|
import { quiltHome } from './legacy.js'
|
|
32
|
-
import { TASK_WORKFLOW, pickupBrief, doneRefusal, verifiedEnough, verifiedLine, qaRefusal, qaNotesEnough, qaNotesLine, MAX_VERIFIED } from './agent-task-workflow.js'
|
|
32
|
+
import { TASK_WORKFLOW, pickupBrief, taskBranchNote, doneRefusal, verifiedEnough, verifiedLine, qaRefusal, qaNotesEnough, qaNotesLine, MAX_VERIFIED } from './agent-task-workflow.js'
|
|
33
33
|
import { formatHistory } from './history.js'
|
|
34
34
|
import { renderInbox, describeEvent, INBOX_HOW } from './inbox.js'
|
|
35
35
|
import { renderConversation, renderContext, CONVERSATION_DESCRIPTION } from './conversation.js'
|
|
@@ -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). ' +
|
|
263
|
-
'"qa" when you finish implementing and testing: requires `qaNotes` (what changed and how you self-validated); without it the move is refused. ' +
|
|
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 put on a git branch of its own for the task. ' +
|
|
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 its 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'),
|
|
@@ -275,8 +275,8 @@ export async function runMcp () {
|
|
|
275
275
|
const patch = { id, column }
|
|
276
276
|
if (column === 'qa') patch.qaNotes = qaNotes
|
|
277
277
|
if (column === 'done') patch.verified = verified
|
|
278
|
-
const { task } = await call(d, 'POST', '/tasks/update', patch)
|
|
279
|
-
if (column === 'doing') return pickupBrief({ ...brief, task: { ...task, comments: brief.task.comments } })
|
|
278
|
+
const { task, branch } = await call(d, 'POST', '/tasks/update', patch)
|
|
279
|
+
if (column === 'doing') return pickupBrief({ ...brief, task: { ...task, comments: brief.task.comments } }) + taskBranchNote(branch)
|
|
280
280
|
if (column === 'qa') return `Moved "${task.title}" to QA. Notes: ${qaNotesLine(task)}` + await nextUp(d)
|
|
281
281
|
if (column === 'done') return `Moved "${task.title}" to Done. Verified: ${verifiedLine(task)}` + await nextUp(d)
|
|
282
282
|
return `Moved "${task.title}" to ${columnName(task.column)}.`
|
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 } 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 } 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,6 +66,9 @@ 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
|
+
/** The branches an agent owns: quilt/<its name>/<its task>. */
|
|
70
|
+
export const agentPrefix = (name) => `quilt/${slug(name, 30)}/`
|
|
71
|
+
|
|
69
72
|
/** Whether `root` is a git checkout (a .git folder, or a worktree's pointer file). */
|
|
70
73
|
function hasGitDir (root) {
|
|
71
74
|
try { fs.statSync(path.join(root, '.git')); return true } catch { return false }
|
|
@@ -2508,6 +2511,137 @@ export class Session extends EventEmitter {
|
|
|
2508
2511
|
this.setUpstream({ name: facts.name, sha: to, behind: 0, ahead: 0, brought: { count: facts.behind, files: written, at: Date.now() } })
|
|
2509
2512
|
}
|
|
2510
2513
|
|
|
2514
|
+
// -------------------------------------------------------- task branches --
|
|
2515
|
+
// An agent that is a member of its own (never a person, or a person's AI session) works on a branch
|
|
2516
|
+
// of its own for each task. Taking a task moves its folder, a git clone, onto quilt/<agent>/<task>,
|
|
2517
|
+
// made from the commit the folder is at and without the uncommitted work everyone has on the branch
|
|
2518
|
+
// it leaves (the session keeps that there). The agent commits and pushes there with its own git, and
|
|
2519
|
+
// its tasks move to QA only once that is done. People's folders are never moved: they pair on the
|
|
2520
|
+
// branch they are on.
|
|
2521
|
+
|
|
2522
|
+
/** One branch move at a time in this agent's folder (two at once fought over git's index). */
|
|
2523
|
+
branchForTask (task) {
|
|
2524
|
+
const p = (this.branchMoves || Promise.resolve()).then(() => this.branchForTaskNow(task))
|
|
2525
|
+
this.branchMoves = p.catch(() => {})
|
|
2526
|
+
return p
|
|
2527
|
+
}
|
|
2528
|
+
|
|
2529
|
+
/** Waits, a few seconds at most, for git and a move between branches in this folder to finish; whether they have. */
|
|
2530
|
+
async gitQuiet (ms = 8000) {
|
|
2531
|
+
const busy = () => !!(this.hold || this.pendingMove || this.gitBusy())
|
|
2532
|
+
const until = Date.now() + ms
|
|
2533
|
+
while (busy() && Date.now() < until) await new Promise((resolve) => setTimeout(resolve, 200))
|
|
2534
|
+
return !busy()
|
|
2535
|
+
}
|
|
2536
|
+
|
|
2537
|
+
/** The folder has arrived on `branch` in git and in the session, and is quiet: waited for, for `ms` at most. */
|
|
2538
|
+
async arrivedOn (branch, ms = 20000) {
|
|
2539
|
+
const there = () => !!this.git && this.git.branch === branch && !this.hold && !this.pendingMove
|
|
2540
|
+
const until = Date.now() + ms
|
|
2541
|
+
while (!there() && Date.now() < until) await new Promise((resolve) => setTimeout(resolve, 200))
|
|
2542
|
+
return there()
|
|
2543
|
+
}
|
|
2544
|
+
|
|
2545
|
+
/**
|
|
2546
|
+
* This agent took `task`: its folder goes onto the task's branch. Returns { branch, from } (where
|
|
2547
|
+
* it is now, and the branch it was made from or left), { stayed, why } when the folder stays where
|
|
2548
|
+
* it is, or null when there is nothing to do (a person, no git clone, on the task's branch already).
|
|
2549
|
+
*/
|
|
2550
|
+
async branchForTaskNow (task) {
|
|
2551
|
+
if (this.kind !== 'agent' || this.stopped || !this.git || !this.git.branch || !task || !task.title) return null
|
|
2552
|
+
if (!(await this.gitQuiet())) return null
|
|
2553
|
+
const prefix = agentPrefix(this.name)
|
|
2554
|
+
const name = `${prefix}${slug(task.title)}`
|
|
2555
|
+
let from = this.git.branch
|
|
2556
|
+
if (from === name) return null
|
|
2557
|
+
if (from.startsWith(prefix)) {
|
|
2558
|
+
// On another task's branch: left for the default branch, so the new task starts from there and
|
|
2559
|
+
// not on top of the other's commits. Work of its own not committed yet would be left behind.
|
|
2560
|
+
const dirty = await this.ownUncommitted()
|
|
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.
|
|
2576
|
+
const again = await hasBranch(this.root, name)
|
|
2577
|
+
// A new one starts from the latest the remote has of the branch it is made from (the agent's last
|
|
2578
|
+
// task, merged meanwhile, is then in it): fetched and brought in now, when that is all it takes.
|
|
2579
|
+
if (!again && this.bringInUpstream) {
|
|
2580
|
+
await this.caughtUp(from)
|
|
2581
|
+
if (!(await this.gitQuiet()) || !this.git || this.git.branch !== from) return null
|
|
2582
|
+
}
|
|
2583
|
+
const said = await switchBranch(this.root, name, { create: !again, force: true })
|
|
2584
|
+
if (said || !(await this.arrivedOn(name))) {
|
|
2585
|
+
const why = `git could not ${again ? 'check out' : 'make'} ${name}${said ? ` (${said})` : ''}.`
|
|
2586
|
+
this.log(`🌿 staying on ${from}: ${why}`)
|
|
2587
|
+
return { stayed: from, why }
|
|
2588
|
+
}
|
|
2589
|
+
this.log(`🌿 on ${name} for "${task.title}"${again ? '' : ` (made from ${from})`}: commit and push there`)
|
|
2590
|
+
return { branch: name, from, ...(again ? { again: true } : {}) }
|
|
2591
|
+
}
|
|
2592
|
+
|
|
2593
|
+
/**
|
|
2594
|
+
* Fetches `branch`'s upstream and waits, `ms` at most, for the folder to have its commits (bringIn
|
|
2595
|
+
* runs once the folder is in step with the session, which takes a moment just after arriving on the
|
|
2596
|
+
* branch). Whether the branch is at its upstream; false too when its commits are left to the person's git.
|
|
2597
|
+
*/
|
|
2598
|
+
async caughtUp (branch, ms = 15000) {
|
|
2599
|
+
const until = Date.now() + ms
|
|
2600
|
+
for (let first = true; Date.now() < until; first = false) {
|
|
2601
|
+
await this.gitQuiet()
|
|
2602
|
+
await this.checkUpstream({ fetch: first }).catch(() => {})
|
|
2603
|
+
const up = await upstreamOf(this.root)
|
|
2604
|
+
const tip = await branchTip(this.root, branch)
|
|
2605
|
+
if (!up || !up.sha || !tip || this.stopped) return false
|
|
2606
|
+
if (up.sha === tip) return true
|
|
2607
|
+
const n = await aheadBehind(this.root, tip, up.sha)
|
|
2608
|
+
if (!n || !n.behind || (this.upstream && this.upstream.sha === up.sha && this.upstream.waiting)) return false
|
|
2609
|
+
await new Promise((resolve) => setTimeout(resolve, 1000))
|
|
2610
|
+
}
|
|
2611
|
+
return false
|
|
2612
|
+
}
|
|
2613
|
+
|
|
2614
|
+
/** The files this agent wrote on the branch it is on (by the session's record) that git has not committed, sorted. */
|
|
2615
|
+
async ownUncommitted () {
|
|
2616
|
+
const mine = new Set()
|
|
2617
|
+
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)
|
|
2618
|
+
if (!mine.size) return []
|
|
2619
|
+
const st = await treeState(this.root, [...mine])
|
|
2620
|
+
return st ? [...mine].filter((rel) => st.dirty.has(rel)).sort() : []
|
|
2621
|
+
}
|
|
2622
|
+
|
|
2623
|
+
/**
|
|
2624
|
+
* Whether this agent's work is in git, asked when it moves a task to QA or Done: null when there is
|
|
2625
|
+
* nothing to hold it to (a person, no git clone, a folder not on a branch of the agent's own), else
|
|
2626
|
+
* { ok: true, branch } or { ok: false, why } with what to do.
|
|
2627
|
+
*/
|
|
2628
|
+
async taskInGit () {
|
|
2629
|
+
if (this.kind !== 'agent' || !this.git || !this.git.branch || !this.git.branch.startsWith(agentPrefix(this.name))) return null
|
|
2630
|
+
const branch = this.git.branch
|
|
2631
|
+
const dirty = await this.ownUncommitted()
|
|
2632
|
+
if (dirty.length) {
|
|
2633
|
+
return { ok: false, why: `Get this task'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
|
+
}
|
|
2635
|
+
const up = await upstreamOf(this.root)
|
|
2636
|
+
const tip = await branchTip(this.root, branch)
|
|
2637
|
+
if (!up || !up.sha || !tip) return { ok: false, why: `Push ${branch} first: \`git push -u origin ${branch}\`. Open the pull request yourself (\`gh pr create\`), then move the task again.` }
|
|
2638
|
+
if (up.sha !== tip) {
|
|
2639
|
+
const n = await aheadBehind(this.root, tip, up.sha)
|
|
2640
|
+
if (!n || n.ahead) return { ok: false, why: `Push ${branch} first: it has ${n ? `${n.ahead} commit${n.ahead === 1 ? '' : 's'}` : 'commits'} the remote doesn't (\`git push\`). Then move the task again.` }
|
|
2641
|
+
}
|
|
2642
|
+
return { ok: true, branch }
|
|
2643
|
+
}
|
|
2644
|
+
|
|
2511
2645
|
/**
|
|
2512
2646
|
* Puts back the .git an older Quilt set aside in this folder (git-aside.js), once, when the session
|
|
2513
2647
|
* starts and the relay has synced. A folder that got a new .git meanwhile keeps both. Whether git came back.
|
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
|
|
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 task (\`quilt_move_task\` to doing) puts your folder on a branch of your own for it, quilt/<you>/<task>, made from the commit your folder is at: what you change is on that branch only, 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\`). The task 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,
|