@lovek4d/kickflip 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTEXT.md +105 -68
- package/README.md +1 -1
- package/SKILL.md +27 -21
- package/bin/kickflip.mjs +27 -18
- package/bin/wait-events.mjs +2 -2
- package/board/agents.mjs +2 -0
- package/board/arch-review.mjs +4 -4
- package/board/bin/board.mjs +199 -79
- package/board/build-script.mjs +2 -1
- package/board/domain.mjs +9 -7
- package/board/finish.mjs +4 -4
- package/board/headless.mjs +9 -4
- package/board/on-host.mjs +1 -1
- package/board/onboarding.mjs +11 -0
- package/board/prototype-base.mjs +1 -0
- package/board/prototype-page.mjs +1 -0
- package/board/public/app-arch.js +1 -1
- package/board/public/app-asks.js +6 -6
- package/board/public/app-banner.js +7 -13
- package/board/public/app-cards.js +75 -37
- package/board/public/app-core.js +26 -8
- package/board/public/app-header.js +8 -8
- package/board/public/app-lanes.js +67 -58
- package/board/public/app-needs.js +140 -10
- package/board/public/app-reader.js +1 -1
- package/board/public/app-snapshot.js +46 -72
- package/board/public/app-threads.js +78 -75
- package/board/public/app.html +9 -4
- package/board/public/app.js +114 -38
- package/board/public/attach.js +2 -2
- package/board/public/dialogs.js +9 -39
- package/board/public/hub-kit.js +66 -4
- package/board/public/hub.css +2 -0
- package/board/public/linear-key.js +46 -35
- package/board/public/new-task.js +20 -39
- package/board/public/progress-review.html +46 -0
- package/board/public/progress-review.js +158 -0
- package/board/public/prototype-kit.js +137 -7
- package/board/public/prototype-switcher.js +152 -123
- package/board/public/prototype.html +57 -3
- package/board/public/router.js +7 -6
- package/board/public/shell.js +68 -26
- package/board/public/sidebar.css +1 -0
- package/board/public/sidebar.js +16 -30
- package/board/public/style.css +205 -83
- package/board/public/ui-cards.js +91 -65
- package/board/public/ui-enums.js +1 -1
- package/board/public/ui-header.js +27 -18
- package/board/public/ui-hub.js +12 -1
- package/board/public/ui-links.js +7 -7
- package/board/public/ui-order.js +12 -10
- package/board/public/ui-page-header.js +19 -7
- package/board/public/ui-patch.js +7 -33
- package/board/public/ui-progress-bar.js +28 -0
- package/board/public/ui-questions.js +47 -52
- package/board/public/ui-sidebar.js +34 -26
- package/board/public/ui-snapshot.js +43 -52
- package/board/public/ui-threads.js +59 -30
- package/board/public/ui.js +125 -18
- package/board/public/view-hub-settings.js +22 -67
- package/board/public/view-hub.js +19 -4
- package/board/public/view-notes.js +27 -7
- package/board/public/view-questions.js +205 -240
- package/board/public/view-settings.js +313 -76
- package/board/render-check.mjs +10 -0
- package/board/review.mjs +1 -1
- package/board/server.mjs +19 -20
- package/board/stop.mjs +1 -0
- package/board/store.mjs +29 -15
- package/board/sync.mjs +2 -0
- package/board/tickets.mjs +3 -3
- package/board/transcript.mjs +2 -0
- package/board/worktree.mjs +25 -20
- package/hooks-plugin/hooks/board-data-gate.mjs +50 -0
- package/hooks-plugin/hooks/hooks.json +9 -0
- package/hooks-plugin/hooks/usage-gate.mjs +20 -3
- package/hub/board-repo.mjs +1 -1
- package/hub/boards.mjs +4 -4
- package/hub/front-door.mjs +5 -5
- package/hub/github.mjs +3 -3
- package/hub/hub.mjs +11 -11
- package/hub/incoming.mjs +2 -2
- package/hub/linear.mjs +1 -2
- package/hub/live.mjs +2 -2
- package/hub/locks.mjs +1 -1
- package/hub/owner-checks.mjs +1 -1
- package/hub/pr-report.mjs +2 -2
- package/hub/presence.mjs +1 -1
- package/hub/push.mjs +2 -2
- package/hub/readiness.mjs +1 -2
- package/hub/review-send.mjs +1 -0
- package/hub/secrets.mjs +2 -0
- package/hub/self-restart.mjs +2 -0
- package/hub/sessions.mjs +2 -2
- package/hub/share.mjs +1 -0
- package/hub/slack.mjs +2 -2
- package/hub/stream.mjs +10 -13
- package/hub/try.mjs +7 -7
- package/hub/upgrade.mjs +1 -1
- package/hub/usage.mjs +3 -3
- package/hub/views.mjs +1 -1
- package/package.json +2 -1
- package/shared/audit.mjs +4 -0
- package/shared/card-prs.mjs +1 -1
- package/shared/fake-gh.mjs +17 -4
- package/shared/machine-gate.mjs +2 -0
- package/shared/prototype-frame.js +1 -0
- package/shared/service.mjs +4 -4
- package/shared/usage-gate.mjs +1 -1
- package/board/public/ui-phase-bars.js +0 -17
package/hub/views.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var F=Object.defineProperty;var s=(e,t)=>F(e,"name",{value:t,configurable:!0});import{clock as d,holdLine as S,sendWords as V,snoozeEnd as y}from"./schedule.mjs";import{CHOICES as H,FOREVER as $,durationEnd as W,endOf as M}from"./duration.mjs";import{siteIcon as B}from"./icons.mjs";import{codexStatus as G}from"../shared/codex.mjs";const Z=s(e=>e.charAt(0).toUpperCase()+e.slice(1),"capital"),O=s((e,t)=>`${e} ${t}${e===1?"":"s"}`,"plural"),p=s(e=>{const[t,n]=e.split(":").map(Number),o=new Date;return o.setHours(t,n,0,0),d(o,o)},"timeOfDay"),j=s(e=>`checks every ${e.every===1?"minute":`${e.every} min`} while you\u2019re ${e.present?"here":"away"}${e.low?", slower while GitHub\u2019s points are low":""}`,"cadenceLine"),J=s((e,t,n)=>`${j(t)}${e.hold?`; ${S(e.hold,n)}`:""}`,"nowLine"),C=s((e,t)=>e.hold?S(e.hold,t):"pushes go out after each check","deviceLine"),Q=s(e=>`${p(e.quiet.start)} \u2013 ${p(e.quiet.end)}${e.quiet.hold?" \xB7 pushes held":""}`,"quietSummary"),X="checks every minute while you're here, every 5 when away",Y=s((e,t)=>e.count?`${e.count} push${e.count===1?"":"es"} queued; next send ${V(e.nextFlushAt,t)}.`:"No pushes queued.","queuedLine");function ee({running:e=!1,nextAt:t,last:n=null},o){if(e)return"Checking GitHub now";const a=`Next check ${d(t,o)}`;if(!n)return a;const u=n.failed.length?"could not reach GitHub for every PR":n.watched?`${O(n.watched,"PR")}, ${n.changes.length?`${n.changes.length} changed`:"no change"}`:"no PRs watched";return`${a} \xB7 last ${d(new Date(n.at),o)}, ${u}`}s(ee,"pollLine");function te(e,t,n){return{title:Z(J(e,t,n)),lines:[ee(t,n),Y(e,n)],count:e.count}}s(te,"pollingNow");function ne(e,t){const n={port:"down \xB7 not answering",files:"down \xB7 folder missing"}[e.serves]||"down \xB7 restarting";if(e.state!=="up")return{tone:e.state==="down"?"down":"wait",word:e.state==="down"?n:e.state,lines:[]};if(!t)return{tone:"ok",word:"up",lines:[]};const o=t.filter(r=>!r.ok),a=o.filter(r=>r.state==="broken"),u=t.find(r=>r.link==="events"),l=u?.listen==="asleep"||u?.listen==="waking"?u.listen:u?.ok?"listening":"not listening",c=a.length?`degraded \xB7 ${l}`:o.length?`up \xB7 ${l} \xB7 ${o.length} settling`:`up \xB7 ${l} \xB7 every link passes`;return{tone:o.length?"wait":"ok",word:c,lines:o.map(r=>({link:r.link,detail:`${r.state==="broken"?"":"settling: "}${r.detail}`}))}}s(ne,"siteHealth");const R=[{value:"always",label:"Always on",description:s(()=>"Codex implements and reviews. Work pauses when it runs out.","description")},{value:"auto",label:"Auto",description:s(e=>`Codex implements and reviews, and ${e} takes over while it's out.`,"description")},{value:"off",label:"Off",description:s(e=>`${e} implements and reviews.`,"description")}],oe=s((e,t,n)=>({usable:t.usable,tag:t.usable?null:t.reason,share:e,choices:R.map(({value:o,label:a})=>({value:o,label:a,on:o===e})),description:t.usable?R.find(o=>o.value===e).description(_[n]):t.words,fix:t.fix}),"codexView"),_={opus:"Opus",sonnet:"Sonnet",auto:"Claude"},P=[{value:"opus",label:"Opus",description:"Always Opus. Auto would give small cards to Sonnet."},{value:"auto",label:"Auto",description:"Auto: small cards get Sonnet, the rest get Opus."},{value:"sonnet",label:"Sonnet",description:"Always Sonnet. Auto would give large cards to Opus."}],se=s(e=>({model:e,builder:_[e],choices:P.map(({value:t,label:n})=>({value:t,label:n,on:t===e})),description:P.find(t=>t.value===e).description}),"claudeView");function me({now:e,st:t,poll:n,sidebar:o,rows:a,links:u=new Map,code:l={},host:c="",version:r,rules:h=[],remembered:w=new Map,integrations:m=[],codexShare:g="off",claudeModel:A="auto",codex:L=G({installed:!1}),awake:q=null}){const b=new Set(o.sites.filter(i=>i.board).map(i=>i.route)),N=!!(l.running&&l.running===l.onDisk),z=N?` \xB7 runs the code in its files (${l.onDisk})`:"",D=s(i=>({route:i.route,title:i.title,icon:B(i.route,i),href:`/${encodeURIComponent(i.route)}/`,...ne(i,u.get(i.route)),remembered:w.get(i.route)||[],restart:b.has(i.route)&&i.restart===!0}),"site"),U=[["Boards",a.filter(i=>b.has(i.route))],["Pages",a.filter(i=>!b.has(i.route))]].filter(([,i])=>i.length).map(([i,K])=>({label:i,sites:K.map(D)}));return{hub:{tone:o.hub.tone,word:o.hub.word,detail:`${o.hub.detail}${z}`,restart:!N},awake:q&&f(q,e,E),groups:U,integrations:m,usage:o.usage,pause:o.pause,codex:oe(g,L,A),claude:se(A),empty:a.length===0,polling:te(t,n,e),notifications:{on:t.settings.notifications.on,text:o.notifications.text,device:C(t,e)},hold:t.hold&&t.hold.why!=="off"?{text:`Notifications ${S(t.hold,e)}`,end:t.hold.why==="snoozed"}:null,rules:h.length?O(h.length,"rule"):"None yet",sites:O(a.length,"site"),host:c,version:r,total:o.total}}s(me,"hubView");const ge="That snooze ends in the past or more than 30 days on. Pick another time.",ye="That keep awake ends in the past or more than 30 days on. Pick another time.",T="until you end it",E="until you turn it off",I="until you resume",f=s((e,t,n)=>e===$?n:`until ${d(e,t)}`,"untilWords"),v=s((e,t)=>H.map(([n,o])=>({value:n,label:o,until:f(W(e,n),e,t)})),"durationChoices"),ie=s((e,t)=>e.on?M(e.snoozed_until,t):null,"snoozedUntil");function $e({now:e,st:t,rules:n=[],linear:o={set:!1},slack:a={set:!1},awake:u={until:null,unsupported:null},pausedUntil:l=null}){const c=t.settings,r=c.notifications,h=ie(r,e),w=t.count?` The ${t.count} queued push${t.count===1?" is":"es are"} dropped now.`:"",m=h&&`Snoozed ${f(h,e,T)}`,g=l&&`Paused ${f(l,e,I)}`;return{pause:{on:l?{title:g}:null,summary:l===$?"Paused \xB7 forever":g||"Off",choices:l?null:v(e,I)},snoozed:h?{title:m,summary:h===$?"Snoozed \xB7 forever":m}:null,device:C(t,e),on:{on:r.on,sub:r.on?"On. Turn off to drop every push, urgent ones too.":"Off. Every push is dropped, urgent ones too. Needs you and the badge still update.",confirm:`Turn off notifications? Every push is dropped until you turn them back on, urgent ones too.${w} Needs you and the badge still update.`},snooze:r.on&&!h?{choices:v(e,T)}:null,awake:{unsupported:u.unsupported,on:u.until?{title:`Keeping awake ${f(u.until,e,E)}`}:null,choices:u.unsupported||u.until?null:v(e,E),summary:u.unsupported||(u.until?u.until===$?"On \xB7 forever":`On until ${d(u.until,e)}`:"Off")},weekends:{on:r.weekends_off,sub:`Pushes wait from Friday ${p(c.quiet.start)} until Monday ${p(c.quiet.end)}. Urgent ones still go.`},quiet:le(c,e),rules:n,linear:ae(o),slack:re(a)}}s($e,"settingsView");const ue={display_information:{name:"Kickflip"},oauth_config:{scopes:{user:["chat:write","im:write","reactions:write","users:read"]}}},x={url:`https://api.slack.com/apps?new_app=1&manifest_json=${encodeURIComponent(JSON.stringify(ue))}`,label:"a new Slack app"};function re(e){const t=e.team?`${e.team} workspace`:"",n=`Make ${x.label}, install it to your workspace, then paste its User OAuth Token (xoxp-\u2026) here.`;return e.set?e.refused?{set:!0,refused:!0,title:t||"Slack token",down:"doesn\u2019t work",sub:`Slack refused the token. ${n}`,keys:x,summary:t?`Token doesn\u2019t work \xB7 ${t}`:"Token doesn\u2019t work"}:{set:!0,title:t,sub:`Token \u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022 \xB7 sends as ${e.user}`,summary:`Token set \xB7 ${t}`}:{set:!1,title:"No token",sub:n,keys:x,summary:"No token"}}s(re,"slackWords");const k={url:"https://linear.app/settings/account/security",label:"Linear \u203A Settings \u203A Security & access \u203A Personal API keys"};function ae(e){const t=e.workspace?`${e.workspace} workspace`:"";return e.set?e.refused?{set:!0,refused:!0,title:t||"Linear key",down:"doesn\u2019t work",sub:`Linear refused the key. Make a new one in ${k.label} and paste it here.`,keys:k,summary:t?`Key doesn\u2019t work \xB7 ${t}`:"Key doesn\u2019t work"}:{set:!0,title:t,sub:"Key \u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",summary:`Key set \xB7 ${t}`}:{set:!1,title:"No key",sub:`Make a personal API key in ${k.label}, then paste it here.`,keys:k,summary:"No key"}}s(ae,"linearWords");function le(e,t){const n=e.quiet,[o,a]=[p(n.start),p(n.end)],u=y(t,"tonight",e),l=[["Snooze tonight",`Until ${d(u,t)}${n.hold?`, then quiet hours hold pushes until ${d(y(u,"morning",e),t)}`:""}.`],["Snooze morning",`Until ${d(y(t,"morning",e),t)}.`],["Snooze monday",`Until ${d(y(t,"monday",e),t)}.`],["Off on weekends",e.notifications.weekends_off?`Pushes wait from Friday ${o} until Monday ${a}.`:"Off."],["Daily wake",`Every board wakes once at ${a}, when quiet hours end.`]];return{start:n.start,end:n.end,summary:Q(e),hint:X,hold:{on:n.hold,sub:n.hold?`Pushes queued after ${o} wait until ${a}. Urgent ones still go.`:"Off. Pushes go out all night."},reads:l.map(([c,r])=>({title:c,sub:r}))}}s(le,"quietView");function ke(e){return e?e.ok?{sent:e.sent,count:e.count,ok:!0,message:`Sent ${e.count} queued push${e.count===1?"":"es"}.`}:{sent:e.sent,count:e.count,ok:!1,message:"Could not send the queue. It stays queued for the next check."}:{sent:0,count:0,ok:!0,message:"Nothing was queued."}}s(ke,"flushView");export{ye as AWAKE_REFUSED,X as QUIET_HINT,ge as SNOOZE_REFUSED,j as cadenceLine,Z as capital,v as durationChoices,ke as flushView,me as hubView,J as nowLine,O as plural,ee as pollLine,Q as quietSummary,$e as settingsView,ne as siteHealth};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lovek4d/kickflip",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Follow and steer Claude Code sessions from your phone.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"repository": {
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"CONTEXT.md",
|
|
27
27
|
"!**/*.test.mjs",
|
|
28
28
|
"!board/mini-dom.mjs",
|
|
29
|
+
"!board/board-fixture.mjs",
|
|
29
30
|
"!hub/fake-device.mjs",
|
|
30
31
|
"!shared/test-helpers.mjs"
|
|
31
32
|
]
|
package/shared/audit.mjs
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var $=Object.defineProperty;var i=(t,n)=>$(t,"name",{value:n,configurable:!0});import o from"node:fs";import x from"node:os";import f from"node:path";const l=30,m=864e5,E=i(t=>f.join(t,"data","audit.jsonl"),"boardAudit"),J=i((t=x.homedir())=>f.join(t,".claude","kickflip","audit.jsonl"),"hubAudit");function A(t){let n;try{n=o.openSync(t,"r")}catch(r){if(r.code==="ENOENT")return null;throw r}try{const r=Buffer.alloc(64),a=o.readSync(n,r,0,r.length,0);return Date.parse(r.toString("utf8",0,a).match(/^\{"at":"([^"]+)"/)?.[1])}finally{o.closeSync(n)}}i(A,"oldestAt");function k(t,{call:n,key:r,result:a,reason:c,inputs:e},{now:s=new Date,once:S=!1}={}){if(S){const u=y(t,{key:r,now:s}).findLast(N=>N.call===n);if(u?.result===a&&u.reason===c)return}const p=JSON.stringify({at:s.toISOString(),call:n,...r?{key:r}:{},result:a,reason:c,inputs:e})+`
|
|
2
|
+
`;o.mkdirSync(f.dirname(t),{recursive:!0});const h=s.getTime()-l*m;if(!(A(t)<h))return o.appendFileSync(t,p);const g=y(t,{now:s}).map(u=>JSON.stringify(u)+`
|
|
3
|
+
`).join(""),d=`${t}.${process.pid}.tmp`;o.writeFileSync(d,g+p),o.renameSync(d,t)}i(k,"audit");function y(t,{key:n,now:r=new Date}={}){let a;try{a=o.readFileSync(t,"utf8")}catch(e){if(e.code==="ENOENT")return[];throw e}const c=r.getTime()-l*m;return a.split(`
|
|
4
|
+
`).flatMap(e=>{try{return[JSON.parse(e)]}catch{return[]}}).filter(e=>Date.parse(e.at)>=c&&(!n||e.key===n))}i(y,"readAudit");function F(t){return t.length?t.flatMap(n=>[`${n.at} ${[n.call,n.key].filter(Boolean).join(" ")}: ${n.result}. ${n.reason}`,` inputs: ${JSON.stringify(n.inputs??{})}`]):[`No calls in the last ${l} days.`]}i(F,"auditLines");export{l as AUDIT_DAYS,k as audit,F as auditLines,E as boardAudit,J as hubAudit,y as readAudit};
|
package/shared/card-prs.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var i=Object.defineProperty;var t=(e,r)=>i(e,"name",{value:r,configurable:!0});const s=/^(?:([\w.-]+\/[\w.-]+)#)?([1-9]\d*)$/,o=t(e=>Array.isArray(e?.prs)?e.prs:Number.isInteger(e?.pr)?[{number:e.pr}]:[],"storedPRs"),l=t((e,r)=>o(e).map(n=>({repo:n.repo||r,number:n.number,...n.merged_at?{merged_at:n.merged_at}:{}})).filter(n=>n.repo),"cardPRs"),m=t(e=>o(e).length>0,"hasPR"),u=t(({repo:e,number:r})=>`${e}#${r}`,"prKeyOf"),d=t(({repo:e,number:r})=>`https://github.com/${e}/pull/${r}`,"prURL"),x=t((e,r)=>e.map(n=>n.repo&&n.repo!==r?u(n):`#${n.number}`).join(", "),"prNames");function g(e){const r=s.exec(String(e).trim());return r?{...r[1]?{repo:r[1]}:{},number:Number(r[2])}:null}t(g,"parsePRRef");const a=["MERGED","CLOSED"],c=t(e=>e.checks?.state==="fail"||!!e.failing?.length,"failing");function p(e){return e?.state?a.includes(e.state)?5:e.isDraft?1:c(e)?2:e.reviewDecision==="APPROVED"?4:3:0}t(p,"readiness");function R(e){if(!e.length)return-1;const r=e.map(p);return r.every(n=>n===5)?Math.max(0,e.findIndex(n=>n.state==="MERGED")):r.indexOf(Math.min(...r))}t(R,"leastReady");const h=t(e=>e.length>0&&e.every(r=>a.includes(r?.state))&&e.some(r=>r.state==="MERGED"),"allLanded");export{h as allLanded,l as cardPRs,m as hasPR,R as leastReady,g as parsePRRef,u as prKeyOf,x as prNames,d as prURL,o as storedPRs};
|
package/shared/fake-gh.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var p=Object.defineProperty;var t=(e
|
|
2
|
-
`).filter(Boolean).map(JSON.parse)}catch{return[]}},"jsonl"),f=t(
|
|
1
|
+
var p=Object.defineProperty;var t=(s,e)=>p(s,"name",{value:e,configurable:!0});import n from"node:fs";import l from"node:path";import{PR_VIEW_FIELDS as g}from"../hub/pr-report.mjs";const o=t((s,e,r,i)=>{const a=l.join(s,e,`${String(r).replace(/[/#]/g,"__")}.json`);n.mkdirSync(l.dirname(a),{recursive:!0}),n.writeFileSync(a,JSON.stringify(i))},"write"),y=t((s,e,r)=>o(s,"pr",e,r),"writePR"),v=t((s,e,r)=>o(s,"issue-comments",e,r),"writeIssueComments"),x=t((s,e,r)=>o(s,"review-comments",e,r),"writeReviewComments"),b=t((s,e,r)=>o(s,"reviews",e,r),"writeReviews"),_=t((s,e,r)=>o(s,"merge",e,r),"writeMerge"),j=t((s,e,r)=>o(s,"ready",e,r),"writeReady"),S=t((s,e,r)=>o(s,"open",e,r),"writeOpen"),R=t((s,e)=>o(s,"","user",e),"writeUser"),O=t((s,e,r={login:e})=>o(s,"github-users",e,r),"writeGithubUser"),N=t((s,e,r)=>o(s,"collaborators",e.replace("/","__"),r),"writeCollaborators"),k=t((s,e)=>o(s,"","accounts",e),"writeAccounts"),c=t((s,e)=>{try{return n.readFileSync(l.join(s,e),"utf8").trim().split(`
|
|
2
|
+
`).filter(Boolean).map(JSON.parse)}catch{return[]}},"jsonl"),f=t(s=>c(s,"calls.jsonl"),"calls"),$=t((s,e)=>o(s,"","rate",e),"writeRate"),q=t(s=>f(s).filter(e=>e[0]==="api"&&e[1]==="graphql").map(e=>[...e[3].matchAll(/repository\(owner: "([^"]+)", name: "([^"]+)"\) \{ pullRequest\(number: (\d+)\)/g)].map(([,r,i,a])=>`${r}/${i}#${a}`)),"queried"),E=t(s=>c(s,"tokens.jsonl"),"tokens");function J({head:s="abc1234567",failing:e=[],pending:r=0,...i}={}){return{state:"OPEN",isDraft:!1,reviewDecision:"REVIEW_REQUIRED",mergeable:"MERGEABLE",mergeStateStatus:"BLOCKED",headRefOid:s,statusCheckRollup:[...e.map(a=>({__typename:"CheckRun",name:a,status:"COMPLETED",conclusion:"FAILURE"})),...Array.from({length:r},(a,u)=>({__typename:"CheckRun",name:`ci-${u}`,status:"IN_PROGRESS",conclusion:""}))],...i}}t(J,"prView");function A(s){const e=l.join(s,"bin");return n.mkdirSync(e,{recursive:!0}),n.writeFileSync(l.join(e,"gh"),`#!${process.execPath}
|
|
3
3
|
const fs = require('node:fs');
|
|
4
4
|
const path = require('node:path');
|
|
5
|
-
const dir = ${JSON.stringify(
|
|
5
|
+
const dir = ${JSON.stringify(s)};
|
|
6
6
|
const args = process.argv.slice(2);
|
|
7
7
|
fs.appendFileSync(path.join(dir, 'calls.jsonl'), JSON.stringify(args) + '\\n');
|
|
8
8
|
fs.appendFileSync(path.join(dir, 'tokens.jsonl'), JSON.stringify({ args, token: process.env.GH_TOKEN || null }) + '\\n');
|
|
@@ -46,6 +46,11 @@ if (args.length === 4 && args[0] === 'api' && args[2] === '-f' && args[3].starts
|
|
|
46
46
|
console.log(JSON.stringify({ html_url: 'https://github.com/' + args[1].slice('repos/'.length) }));
|
|
47
47
|
process.exit(0);
|
|
48
48
|
}
|
|
49
|
+
// A Comment review posted with gh api repos/<repo>/pulls/<n>/reviews -f body=\u2026 -f event=\u2026 -f commit_id=\u2026: answers its html_url.
|
|
50
|
+
if (args.length === 8 && args[0] === 'api' && args[2] === '-f' && args[4] === '-f' && args[6] === '-f' && /^repos\\/[^/]+\\/[^/]+\\/pulls\\/\\d+\\/reviews$/.test(args[1])) {
|
|
51
|
+
console.log(JSON.stringify({ html_url: 'https://github.com/' + args[1].slice('repos/'.length).replace('/pulls/', '/pull/').replace(/\\/reviews$/, '') + '#pullrequestreview-1' }));
|
|
52
|
+
process.exit(0);
|
|
53
|
+
}
|
|
49
54
|
// The hub's one GraphQL query (hub/pr-report.mjs fetchPRs), answered from the same fixtures as the REST calls: each
|
|
50
55
|
// aliased PR from its pr, issue-comments, review-comments and reviews fixtures, the viewer from user.json and the rate
|
|
51
56
|
// limit from rate.json. A PR without a fixture, or {fail: true}, comes back null with an error, as GitHub answers.
|
|
@@ -58,6 +63,9 @@ if (args.length === 4 && args[0] === 'api' && args[1] === 'graphql' && args[2] =
|
|
|
58
63
|
const list = (folder, repo, n) => { const v = read(fixture(folder, repo, n), []); return Array.isArray(v) ? v : []; };
|
|
59
64
|
const data = { viewer: user ? { login: user.login } : null, rateLimit: rate };
|
|
60
65
|
const errors = [];
|
|
66
|
+
for (const [, alias, owner, name] of args[3].matchAll(/(open\\d+): repository\\(owner: "([^"]+)", name: "([^"]+)"\\) \\{ pullRequests\\(/g)) {
|
|
67
|
+
data[alias] = { pullRequests: { nodes: read(path.join(dir, 'open', owner + '__' + name + '.json'), []) } };
|
|
68
|
+
}
|
|
61
69
|
for (const [, alias, owner, name, n] of args[3].matchAll(/(\\w+): repository\\(owner: "([^"]+)", name: "([^"]+)"\\) \\{ pullRequest\\(number: (\\d+)\\)/g)) {
|
|
62
70
|
const repo = owner + '/' + name;
|
|
63
71
|
const view = read(fixture('pr', repo, n), null);
|
|
@@ -84,6 +92,11 @@ let file;
|
|
|
84
92
|
let list = false;
|
|
85
93
|
if (args.length === 7 && args[0] === 'pr' && args[1] === 'view' && /^\\d+$/.test(args[2]) && args[3] === '--repo' && args[5] === '--json' && args[6] === ${JSON.stringify(g)}) file = fixture('pr', args[4], args[2]);
|
|
86
94
|
else if (args.length === 2 && args[0] === 'api' && args[1] === 'user') file = path.join(dir, 'user.json');
|
|
95
|
+
else if (args.length === 2 && args[0] === 'api' && /^users\\/[\\w-]+$/.test(args[1])) file = path.join(dir, 'github-users', args[1].slice(6) + '.json');
|
|
96
|
+
else if (args.length === 4 && args[0] === 'api' && args[1] === '--paginate' && args[2] === '--slurp' && /^repos\\/[^/]+\\/[^/]+\\/collaborators$/.test(args[3])) {
|
|
97
|
+
file = path.join(dir, 'collaborators', args[3].split('/').slice(1, 3).join('__') + '.json');
|
|
98
|
+
list = true;
|
|
99
|
+
}
|
|
87
100
|
else if (args.length === 4 && args[0] === 'api' && args[1] === '--paginate' && args[2] === '--slurp') {
|
|
88
101
|
const match = /^repos\\/([^/]+\\/[^/]+)\\/(issues|pulls)\\/(\\d+)\\/(comments\\?since=.+|reviews)$/.exec(args[3]);
|
|
89
102
|
if (!match || (match[2] === 'issues' && match[4] === 'reviews')) process.exit(1);
|
|
@@ -102,4 +115,4 @@ if (list) {
|
|
|
102
115
|
try { if (JSON.parse(value).fail) fail(); } catch {}
|
|
103
116
|
console.log(value);
|
|
104
117
|
}
|
|
105
|
-
`,{mode:493}),
|
|
118
|
+
`,{mode:493}),e}t(A,"fakeGh");export{f as calls,A as fakeGh,J as prView,q as queried,E as tokens,k as writeAccounts,N as writeCollaborators,O as writeGithubUser,v as writeIssueComments,_ as writeMerge,S as writeOpen,y as writePR,$ as writeRate,j as writeReady,x as writeReviewComments,b as writeReviews,R as writeUser};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var k=Object.defineProperty;var s=(e,t)=>k(e,"name",{value:t,configurable:!0});import i from"node:fs";import c from"node:os";import _ from"node:path";import{execFileSync as M}from"node:child_process";import{audit as d,hubAudit as y}from"./audit.mjs";const f=4,h=3,v=10*6e4,A=Object.freeze({state:"normal",reason:null}),D={1:"normal",2:"warn",4:"critical"},F=s(e=>D[e]??null,"pressureOf");function N(){let e=null;try{e=Number(M("sysctl",["-n","kern.memorystatus_vm_pressure_level"],{encoding:"utf8",timeout:2e3,stdio:["ignore","pipe","ignore"]}).trim())}catch{}return{load:c.loadavg()[0],cores:c.cpus().length,pressure:F(e)}}s(N,"readMachine");function R(e,{load:t,cores:r,pressure:o}){const a=(e==="busy"?h:f)*r;return o==="critical"||t>=a?"busy":"normal"}s(R,"machineState");const b=s((e=c.homedir())=>_.join(e,".claude","kickflip","machine-state.json"),"machineFile"),g=s(e=>{try{return JSON.parse(i.readFileSync(b(e),"utf8"))}catch{return null}},"readFile");function T(e=c.homedir()){const t=g(e);return t?.state==="busy"?{state:"busy",reason:t.reason}:A}s(T,"readMachineState");function z({home:e=c.homedir(),reading:t=N(),now:r=new Date}={}){const o=g(e),a=o?.state??"normal",n=R(a,t),O=n==="busy"?t.pressure==="critical"?"memory pressure critical":"load high":null,l={reading:t,previous:o?.state??null,hold:f,release:h},u=`1-minute load ${t.load.toFixed(1)}`,p=n!==a,S=!o?.logged_at||r.getTime()-Date.parse(o.logged_at)>=v;if(p&&n==="busy"){const E=t.pressure==="critical"?"memory pressure is critical":`${u} is at least ${f}\xD7 its ${t.cores} cores`;d(y(e),{call:"machine-busy",result:n,reason:`This Mac is busy: ${E}, so no new work starts.`,inputs:l},{now:r})}else p?d(y(e),{call:"machine-eased",result:n,reason:`Memory pressure is ${t.pressure??"unread"} and ${u} is under ${h}\xD7 its ${t.cores} cores, so new work starts again.`,inputs:l},{now:r}):S&&d(y(e),{call:"machine-reading",result:n,reason:`Memory pressure is ${t.pressure??"unread"} and ${u} on ${t.cores} cores.`,inputs:l},{now:r});const $={state:n,reason:O,at:r.toISOString(),reading:t,logged_at:p||S?r.toISOString():o.logged_at},m=b(e);i.mkdirSync(_.dirname(m),{recursive:!0});const x=`${m}.${process.pid}.tmp`;return i.writeFileSync(x,JSON.stringify($)+`
|
|
2
|
+
`),i.renameSync(x,m),$}s(z,"checkMachine");export{f as HOLD_LOAD,A as MACHINE_NORMAL,h as RELEASE_LOAD,z as checkMachine,b as machineFile,R as machineState,F as pressureOf,N as readMachine,T as readMachineState};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(){const n=new URLSearchParams(location.search);let a=n.get("variant"),e=n.get("state");const r=[];addEventListener("message",t=>{if(!(t.source!==parent||t.data?.kickflip!=="prototype")){a=t.data.take??null,e=t.data.state??null;for(const s of r)s(a,e)}}),globalThis.KickflipPrototype={get take(){return a},get state(){return e},on(t){r.push(t),t(a,e)}}})();
|
package/shared/service.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var S=Object.defineProperty;var n=(i,u)=>S(i,"name",{value:u,configurable:!0});import p from"node:fs";import v from"node:os";import $ from"node:path";import{spawnSync as A}from"node:child_process";const d="local.claude.kickflip-hub",m="kickflip-hub.service";function
|
|
2
|
-
`)[0]}}n(
|
|
1
|
+
var S=Object.defineProperty;var n=(i,u)=>S(i,"name",{value:u,configurable:!0});import p from"node:fs";import v from"node:os";import $ from"node:path";import{spawnSync as A}from"node:child_process";const d="local.claude.kickflip-hub",m="kickflip-hub.service";function T(i,u,{env:g=process.env,timeout:o=1e4}={}){const r=A(i,u,{encoding:"utf8",env:g,timeout:o});return{status:r.status??1,stdout:r.stdout||"",error:(r.error?.message||r.stderr||`exit ${r.status}`).trim().split(`
|
|
2
|
+
`)[0]}}n(T,"runCommand");function D({platform:i=process.platform,home:u=v.homedir(),uid:g=process.getuid?.(),env:o=process.env,run:r=T}={}){const a=n((t,s,c={})=>{try{return r(t,s,{env:o,...c})}catch(l){return{status:1,stdout:"",error:l.message}}},"exec");if(i==="darwin")return E({home:u,uid:g,exec:a});if(i==="linux")return L({home:u,uid:g,exec:a});const e=`kickflip keeps the hub running with launchd on macOS or systemd on Linux, not on ${i}`;return{manager:null,item:"hub service",file:null,id:null,restartCommand:"node hub/hub.mjs from the kickflip folder",definition:n(()=>null,"definition"),install:n(async()=>{throw new Error(e)},"install"),restart:n(()=>e,"restart"),remove:n(()=>{},"remove"),status:n(()=>({installed:!1,running:!1,detail:e}),"status"),notes:n(()=>[],"notes")}}n(D,"hubService");const b=12e4;function E({home:i,uid:u,exec:g}){const o=$.join(i,"Library","LaunchAgents"),r=`gui/${u}`,a=$.join(o,`${d}.plist`),e=n((t,s)=>g("launchctl",t,s),"launchctl");return{manager:"launchd",item:"hub login item",file:a,id:`${r}/${d}`,restartCommand:`launchctl kickstart -k gui/$(id -u)/${d}`,definition({node:t,entry:s,state:c,port:l,log:h}){const y=n(w=>String(w).replaceAll("&","&").replaceAll("<","<").replaceAll(">",">"),"xml");return`<?xml version="1.0" encoding="UTF-8"?>
|
|
3
3
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
4
4
|
<plist version="1.0">
|
|
5
5
|
<dict>
|
|
@@ -15,7 +15,7 @@ var S=Object.defineProperty;var n=(i,u)=>S(i,"name",{value:u,configurable:!0});i
|
|
|
15
15
|
<key>StandardErrorPath</key><string>${y(h)}</string>
|
|
16
16
|
</dict>
|
|
17
17
|
</plist>
|
|
18
|
-
`},async install(t,{wait:s=n(l=>new Promise(h=>setTimeout(h,l)),"wait"),dryRun:c=!1}={}){if(c)return[`would write ${a} and start ${r}/${d}`];p.mkdirSync(o,{recursive:!0}),p.writeFileSync(a,t),e(["bootout",`${r}/${d}`]),await s(500);const l=e(["bootstrap",r,a]);if(l.status===0)return[`started ${r}/${d} from ${a}`];throw new Error(l.error)},restart(){const t=e(["kickstart","-k",`${r}/${d}`],{timeout:b});return t.status===0?null:t.error},remove(){e(["bootout",`${r}/${d}`]),p.rmSync(a,{force:!0})},status(){const t=e(["print",`${r}/${d}`]),s=p.existsSync(a),c=s&&t.status===0&&/\bstate = running\b/.test(t.stdout||"");return{installed:s,running:c,detail:c?"running":s?"not running":"not installed"}},notes:n(()=>[],"notes")}}n(
|
|
18
|
+
`},async install(t,{wait:s=n(l=>new Promise(h=>setTimeout(h,l)),"wait"),dryRun:c=!1}={}){if(c)return[`would write ${a} and start ${r}/${d}`];p.mkdirSync(o,{recursive:!0}),p.writeFileSync(a,t),e(["bootout",`${r}/${d}`]),await s(500);const l=e(["bootstrap",r,a]);if(l.status===0)return[`started ${r}/${d} from ${a}`];throw new Error(l.error)},restart(){const t=e(["kickstart","-k",`${r}/${d}`],{timeout:b});return t.status===0?null:t.error},remove(){e(["bootout",`${r}/${d}`]),p.rmSync(a,{force:!0})},status(){const t=e(["print",`${r}/${d}`]),s=p.existsSync(a),c=s&&t.status===0&&/\bstate = running\b/.test(t.stdout||"");return{installed:s,running:c,detail:c?"running":s?"not running":"not installed"}},notes:n(()=>[],"notes")}}n(E,"launchd");const k=n(i=>String(i).replaceAll("%","%%").replaceAll("$","$$$$").replace(/[\r\n]/g," "),"unitValue"),f=n(i=>`"${k(i).replaceAll("\\","\\\\").replaceAll('"','\\"')}"`,"execWord");function L({home:i,uid:u,exec:g}){const o=$.join(i,".config","systemd","user",m),r=n((e,t)=>g("systemctl",["--user",...e],t),"systemctl"),a=n(e=>{const t=r(e);if(t.status!==0)throw new Error(`systemctl --user ${e.join(" ")}: ${t.error}`)},"step");return{manager:"systemd",item:"hub service",file:o,id:m,restartCommand:`systemctl --user restart ${m}`,definition({node:e,entry:t,state:s,port:c,log:l}){return`[Unit]
|
|
19
19
|
Description=kickflip hub
|
|
20
20
|
|
|
21
21
|
[Service]
|
|
@@ -30,4 +30,4 @@ StandardError=append:${k(l)}
|
|
|
30
30
|
|
|
31
31
|
[Install]
|
|
32
32
|
WantedBy=default.target
|
|
33
|
-
`},async install(e,{dryRun:t=!1}={}){return t?[`would write ${o}, enable and start ${m}`]:(p.mkdirSync($.dirname(o),{recursive:!0}),p.writeFileSync(o,e),a(["daemon-reload"]),a(["enable",m]),a(["restart",m]),[`enabled and started ${m} from ${o}`])},restart(){const e=r(["restart",m],{timeout:b});return e.status===0?null:e.error},remove(){r(["disable","--now",m]),p.rmSync(o,{force:!0}),r(["daemon-reload"])},status(){const e=r(["is-active",m]),t=p.existsSync(o),s=t&&e.status===0&&(e.stdout||"").trim()==="active";return{installed:t,running:s,detail:s?"running":t?"not running":"not installed"}},notes(){const e=g("loginctl",["show-user",String(u),"--property=Linger"]),t=e.status===0&&/^Linger=yes$/m.test(e.stdout||"");return[{item:"hub without a login",state:t?"ok":"optional",detail:t?"the user lingers, so the hub runs with nobody logged in":"the hub stops when your last login session ends",fix:'sudo loginctl enable-linger "$USER"'},{item:"macOS-only parts",state:"note",detail:"
|
|
33
|
+
`},async install(e,{dryRun:t=!1}={}){return t?[`would write ${o}, enable and start ${m}`]:(p.mkdirSync($.dirname(o),{recursive:!0}),p.writeFileSync(o,e),a(["daemon-reload"]),a(["enable",m]),a(["restart",m]),[`enabled and started ${m} from ${o}`])},restart(){const e=r(["restart",m],{timeout:b});return e.status===0?null:e.error},remove(){r(["disable","--now",m]),p.rmSync(o,{force:!0}),r(["daemon-reload"])},status(){const e=r(["is-active",m]),t=p.existsSync(o),s=t&&e.status===0&&(e.stdout||"").trim()==="active";return{installed:t,running:s,detail:s?"running":t?"not running":"not installed"}},notes(){const e=g("loginctl",["show-user",String(u),"--property=Linger"]),t=e.status===0&&/^Linger=yes$/m.test(e.stdout||"");return[{item:"hub without a login",state:t?"ok":"optional",detail:t?"the user lingers, so the hub runs with nobody logged in":"the hub stops when your last login session ends",fix:'sudo loginctl enable-linger "$USER"'},{item:"macOS-only parts",state:"note",detail:"The owner reads away from the host, since presence comes from macOS ioreg, so only a page tap makes the hub check every minute"}]}}}n(L,"systemd");export{d as LOGIN_LABEL,m as UNIT,D as hubService,T as runCommand};
|
package/shared/usage-gate.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var P=Object.defineProperty;var t=(e,s)=>P(e,"name",{value:s,configurable:!0});import W from"node:fs";import f from"node:os";import j from"node:path";import{usageReader as F}from"../hub/usage.mjs";import{readSettingsFile as h,writeSettingsFile as $,readCodexShare as H,readClaudeModel as U}from"../hub/push.mjs";import{FOREVER as C,durationEnd as I,storedEnd as v}from"../hub/duration.mjs";import{codexStatus as G,codexStatusReader as L,effectiveCodexShare as B}from"./codex.mjs";import{MACHINE_NORMAL as z,readMachineState as J}from"./machine-gate.mjs";const K=t(e=>Number.isInteger(e)&&e>=50&&e<=100&&e%5===0,"validPauseAt"),l=t(e=>Number(e),"timeOf"),T=["five_hour","seven_day"],b=t((e,s)=>e===C||typeof e=="string"&&Date.parse(e)>l(s)?e:null,"pausedUntil");function V(e,s=new Date){if(e==="off")return null;const o=I(new Date(l(s)),e);if(!o)throw Object.assign(new Error("A pause ends after now and within 30 days: <n>m, <n>h, <n>d, <n>w, forever or a date and time; or off."),{status:400});return v(o)}t(V,"pauseEnd");const q=t(e=>e===C?"until the owner resumes it":`until ${e}`,"pauseUntilWords");function Q({claude:e,codex:s,pauseAt:o=90,keepGoing:n,hubPause:a,boardPause:u,machine:r=z,now:d=Date.now()}={}){const c=K(o)?o:90,x=t(w=>c===100?null:T.find(i=>{const p=w?.[i];return p?.state==="live"&&Number.isFinite(p.used_percentage)&&p.used_percentage>=c&&(!p.resets_at||Date.parse(p.resets_at)>l(d))})||null,"past"),g=t((w,i)=>({window:i,used:i?w[i].used_percentage:null,resets_at:i?w[i].resets_at:null}),"details"),m=x(e),k=g(e,m),R=m&&n?.window===m&&Math.abs(Date.parse(n.until)-Date.parse(k.resets_at))<=3e5&&l(d)<Date.parse(n.until),M=x(s),S={past:!!M,...g(s,M)},_=b(a,d)?"hub":b(u,d)?"board":null;return _?{pause_at:c,state:"paused",manual:_,window:null,used:null,resets_at:b(_==="hub"?a:u,d),codex:S,machine:r}:{pause_at:c,state:m?R?"going":"paused":"normal",manual:null,...k,codex:S,machine:r}}t(Q,"usageGate");const X=t(e=>{try{return JSON.parse(W.readFileSync(j.join(e,"board.json"),"utf8"))||{}}catch{return{}}},"readBoardJson"),Y=t((e,s=Date.now())=>b(X(e).paused_until,s),"boardPausedUntil"),D=new Map;function A({home:e=f.homedir(),now:s=Date.now(),dir:o=null}={}){let n=D.get(e);n||(n={now:l(s)},n.usage=F({home:e,now:t(()=>n.now,"now")}),n.codex=L({home:e,now:t(()=>n.now,"now")}),D.set(e,n)),n.now=l(s);const a=h(e);return Q({...n.usage({codexShare:H(n.codex(),e)}),pauseAt:a.pauseAt,keepGoing:a.keepGoing,hubPause:a.paused_until,boardPause:o?Y(o,s):null,machine:J(e),now:s})}t(A,"readUsageGate");function le(e,{home:s=f.homedir(),now:o=new Date}={}){const n=V(e,o),{paused_until:a,...u}=h(s);return $(n?{...u,paused_until:n}:u,s),n}t(le,"setHubPause");function pe(e,{home:s=f.homedir()}={}){if(!/^(?:50|55|60|65|70|75|80|85|90|95|100)$/.test(String(e)))throw Object.assign(new Error("pause-at takes 50..100 in steps of 5"),{status:400});$({...h(s),pauseAt:Number(e)},s)}t(pe,"setPauseAt");function fe(e,{home:s=f.homedir(),now:o=Date.now()}={}){if(!["on","off"].includes(e))throw Object.assign(new Error("keep-going takes on or off"),{status:400});const n=h(s);if(e==="on"){const a=A({home:s,now:o});if(a.state!=="paused")throw Object.assign(new Error("Nothing is paused."),{status:409});n.keepGoing={window:a.window,until:a.resets_at}}else delete n.keepGoing;$(n,s)}t(fe,"setKeepGoing");const he=t(e=>{try{return["github-change","check-github","card-unblocked","overnight-triage","pr-review","owner-check-broken"].includes(JSON.parse(e).kind)}catch{return!1}},"heldUsageEvent");function xe({home:e=f.homedir(),now:s=Date.now(),card:o={}}={}){const n=G({home:e}),a={codex:n.reason??"usable",claudeModel:U(e),size:o.size??null,cardModel:o.model??null},u=t(d=>{const{model:c,reason:x}=Z(a.claudeModel,o);return{kind:"claude",model:c,reason:`${d} ${x}`,inputs:a}},"claude");if(!n.usable)return u(n.words);if(a.codexShare=B(h(e).codexShare,n),a.codexShare==="off")return u("Codex share is off.");const r=A({home:e,now:s});return Object.assign(a,{pauseAt:r.pause_at,codexUsage:r.codex}),r.codex.past?u(`Codex is at ${Math.round(r.codex.used)}%, past the ${r.pause_at}% line until ${r.codex.resets_at}.`):{kind:"codex",reason:`Codex share is ${a.codexShare} and Codex is under the ${r.pause_at}% line.`,inputs:a}}t(xe,"builderPick");const E={opus:"Opus",sonnet:"Sonnet"};function Z(e,s){return e!=="auto"?{model:e,reason:`Claude model is ${E[e]}.`}:s.model?{model:s.model,reason:`Claude model is Auto and the card asks for Claude ${E[s.model]}.`}:s.size==="small"?{model:"sonnet",reason:"Claude model is Auto and the card is small."}:{model:"opus",reason:"Claude model is Auto and the card isn't small."}}t(Z,"claudePick");const N={hub:["the hub","Pause hub in Hub settings"],board:["this board","Pause board in Board settings"]},ee=t(e=>e.manual?`Work is paused: the owner paused ${N[e.manual][0]} ${q(e.resets_at)}. ${N[e.manual][1]} resumes it.`:e.state==="paused"?se(e):y(e),"pauseReason"),y=t(e=>`Work is held: this Mac is busy (${e.machine.reason}). It starts again when the Mac eases.`,"busyReason"),me="Held: this Mac is busy. It starts again when the Mac eases.",we=t(e=>e.state==="paused"||e.machine.state==="busy","holdsWork"),be=t(e=>`usage paused ${e.resets_at} ${e.manual?`manual ${e.manual}`:`${e.window} ${e.used}%`}`,"pausedLine"),se=t(e=>`Work is paused: Claude's ${O(e.window)} usage is at ${Math.round(e.used)}%. Resumes at ${e.resets_at}. The owner can tap Keep going on the Hub page.`,"usagePauseReason"),_e=t((e,s)=>!!e.manual||e.machine.state==="busy"||(s==="codex"?e.codex.past:e.state==="paused"),"heldFor"),O=t(e=>e==="five_hour"?"5-hour":"weekly","windowWord"),$e=t((e,s)=>s==="codex"&&!e.manual&&e.codex.past?`Codex is paused: its ${O(e.codex.window)} usage is at ${Math.round(e.codex.used)}%, past the ${e.pause_at}% line. Resumes at ${e.codex.resets_at}.`:s==="codex"&&!e.manual?y(e):ee(e),"pauseReasonFor");export{me as MACHINE_HELD_LINE,Y as boardPausedUntil,xe as builderPick,_e as heldFor,he as heldUsageEvent,we as holdsWork,V as pauseEnd,ee as pauseReason,$e as pauseReasonFor,q as pauseUntilWords,be as pausedLine,A as readUsageGate,le as setHubPause,fe as setKeepGoing,pe as setPauseAt,Q as usageGate,K as validPauseAt};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// The phase bars: one bar per phase, those reached filled, a running one pulsing. An In Progress card draws the five
|
|
2
|
-
// build phases (ui-cards.js) and a starting board's sidebar row its three start steps (ui-sidebar.js)
|
|
3
|
-
// (docs/adr/2026-11-04-1914-a-new-board-shows-its-start-steps-and-clone-progress.md). It needs nothing else, since
|
|
4
|
-
// hub/hub.mjs renders the shell's first sidebar with it in a vm context. style.css draws the bars.
|
|
5
|
-
(function () {
|
|
6
|
-
const esc = (v) => String(v ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
7
|
-
// strip: {reached, running, dim, label, fill, plan}, or null for no bars. reached counts the phases reached, the last of
|
|
8
|
-
// them running when running is set; fill, a percent, fills the next bar that far; plan draws them in the planner blue.
|
|
9
|
-
function phaseBars(strip, phases) {
|
|
10
|
-
if (!strip) return '';
|
|
11
|
-
const { reached, running, dim, label, fill, plan } = strip;
|
|
12
|
-
const bar = (i) => (i === reached - 1 && running ? '<i class="now"></i>' : i < reached ? '<i class="done"></i>'
|
|
13
|
-
: i === reached && fill !== undefined ? `<i class="fill" style="--p:${fill}%"></i>` : '<i class=""></i>');
|
|
14
|
-
return `<span class="phase-bars${dim ? ' dim' : ''}${plan ? ' plan' : ''}" role="img" aria-label="${esc(label)}" title="${esc(label)}">${phases.map((_, i) => bar(i)).join('')}</span>`;
|
|
15
|
-
}
|
|
16
|
-
Object.assign(globalThis.BoardUI ||= {}, { phaseBars });
|
|
17
|
-
})();
|