Why: the 8788 project-member runtime delivery finished (code merged via #526/#530) but its card and operation records lived only on an unpushed task branch, leaving the worktree impossible to recycle and the record invisible on main. Evidence: card status "已完成(运行目标)" on feature/project-member-runtime 835d807; branch diff against merge-base touches only .task (card + 29 operation records); credential scan finds only variable-based Authorization headers and sha256 digests. Impact: adds .task/archive/feature-project-member-runtime.md and .task/artifacts/project-member-runtime/**; no code, gitlink or policy change. Refs: worktree cleanup 2026-10-18 Co-authored-by: Cursor <cursoragent@cursor.com>
22 lines
1.2 KiB
Python
22 lines
1.2 KiB
Python
import json,urllib.request,urllib.error
|
|
from pathlib import Path
|
|
W=Path('/tmp/project-member-runtime-8788-20261013');BASE='http://127.0.0.1:8788'
|
|
CREDS=json.loads((W/'credentials.json').read_text())
|
|
def request(owner,path,method='GET',data=None,raw=False,headers=None):
|
|
h={'Authorization':'Bearer '+CREDS[owner],'Origin':BASE}
|
|
if headers:h.update(headers)
|
|
if data is not None and not isinstance(data,bytes):data=json.dumps(data).encode();h['Content-Type']='application/json'
|
|
r=urllib.request.Request(BASE+path,method=method,data=data,headers=h)
|
|
try:
|
|
with urllib.request.urlopen(r,timeout=30) as x:code=x.status;body=x.read()
|
|
except urllib.error.HTTPError as e:code=e.code;body=e.read()
|
|
if raw:return code,body
|
|
try:return code,json.loads(body)
|
|
except (ValueError,UnicodeDecodeError):return code,{'non_json_bytes':len(body)}
|
|
def command(owner,name,params):
|
|
code,out=request(owner,'/api/commands/'+name,'POST',{'params':params,'entrance':'workspace'})
|
|
assert code==200 and out.get('receipt',{}).get('state')=='committed',f'{name} rejected status={code}'
|
|
return out['payload']
|
|
def save(name,obj):
|
|
p=W/name;p.write_text(json.dumps(obj,ensure_ascii=False,indent=2)+'\n');p.chmod(0o600)
|