@yunhozz/arc 0.2.2 → 0.2.3
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/MANIFEST.sha256 +52 -27
- package/README.md +4 -6
- package/claude/agents/arc-implementer.md +1 -1
- package/claude/agents/arc-planner.md +1 -1
- package/claude/skill/SKILL.md +1 -1
- package/claude/skill/references/arc-visual-companion.md +33 -0
- package/claude/skill/references/coordination.md +3 -3
- package/claude/skill/references/planning.md +3 -3
- package/claude/skill/references/verification.md +1 -1
- package/claude/skill/references/visual-companion.md +293 -15
- package/codex/agents/arc-implementer.toml +1 -1
- package/codex/agents/arc-planner.toml +2 -2
- package/codex/skill/SKILL.md +1 -1
- package/codex/skill/references/arc-visual-companion.md +39 -0
- package/codex/skill/references/coordination.md +2 -2
- package/codex/skill/references/planning.md +3 -3
- package/codex/skill/references/verification.md +1 -1
- package/codex/skill/references/visual-companion.md +290 -18
- package/lib/installer/install.mjs +5 -7
- package/lib/installer/manifest.mjs +22 -7
- package/lib/installer/package-references.mjs +10 -5
- package/lib/installer/plan.mjs +1 -1
- package/lib/installer/superpowers.mjs +26 -1
- package/lib/installer/transaction.mjs +3 -3
- package/lib/installer/upgrade.mjs +2 -9
- package/lib/management/operations.mjs +2 -6
- package/lib/release/artifact.mjs +6 -4
- package/package.json +12 -2
- package/scripts/update-manifest.mjs +7 -9
- package/claude/skill/references/superpowers/brainstorming/visual-companion.md +0 -299
- package/codex/skill/references/superpowers/brainstorming/visual-companion.md +0 -299
- package/scripts/update-superpowers-local.sh +0 -4
- /package/claude/skill/references/{superpowers/brainstorming/SKILL.md → brainstorming.md} +0 -0
- /package/claude/skill/references/{superpowers/brainstorming/builder-check-prompt.md → builder-check-prompt.md} +0 -0
- /package/claude/skill/references/{superpowers/brainstorming/scripts → scripts}/frame-template.html +0 -0
- /package/claude/skill/references/{superpowers/brainstorming/scripts → scripts}/helper.js +0 -0
- /package/claude/skill/references/{superpowers/brainstorming/scripts → scripts}/server.cjs +0 -0
- /package/claude/skill/references/{superpowers/brainstorming/scripts → scripts}/start-server.sh +0 -0
- /package/claude/skill/references/{superpowers/brainstorming/scripts → scripts}/stop-server.sh +0 -0
- /package/claude/skill/references/{superpowers/LICENSE → superpowers-LICENSE} +0 -0
- /package/claude/skill/references/{superpowers/provenance.json → superpowers-provenance.json} +0 -0
- /package/claude/skill/references/{superpowers/test-driven-development/SKILL.md → test-driven-development.md} +0 -0
- /package/claude/skill/references/{superpowers/test-driven-development/writing-good-tests.md → writing-good-tests.md} +0 -0
- /package/claude/skill/references/{superpowers/writing-plans/SKILL.md → writing-plans.md} +0 -0
- /package/codex/skill/references/{superpowers/brainstorming/SKILL.md → brainstorming.md} +0 -0
- /package/codex/skill/references/{superpowers/brainstorming/builder-check-prompt.md → builder-check-prompt.md} +0 -0
- /package/codex/skill/references/{superpowers/brainstorming/scripts → scripts}/frame-template.html +0 -0
- /package/codex/skill/references/{superpowers/brainstorming/scripts → scripts}/helper.js +0 -0
- /package/codex/skill/references/{superpowers/brainstorming/scripts → scripts}/server.cjs +0 -0
- /package/codex/skill/references/{superpowers/brainstorming/scripts → scripts}/start-server.sh +0 -0
- /package/codex/skill/references/{superpowers/brainstorming/scripts → scripts}/stop-server.sh +0 -0
- /package/codex/skill/references/{superpowers/LICENSE → superpowers-LICENSE} +0 -0
- /package/codex/skill/references/{superpowers/provenance.json → superpowers-provenance.json} +0 -0
- /package/codex/skill/references/{superpowers/test-driven-development/SKILL.md → test-driven-development.md} +0 -0
- /package/codex/skill/references/{superpowers/test-driven-development/writing-good-tests.md → writing-good-tests.md} +0 -0
- /package/codex/skill/references/{superpowers/writing-plans/SKILL.md → writing-plans.md} +0 -0
|
@@ -2,7 +2,7 @@ import path from 'node:path';
|
|
|
2
2
|
import {createHash} from 'node:crypto';
|
|
3
3
|
import {readCheckedFile,sameIdentity,typeOf,metadataOf} from './targets.mjs';
|
|
4
4
|
export const REQUIRED=Object.freeze({
|
|
5
|
-
'brainstorming':['SKILL.md','visual-companion.md','scripts/start-server.sh','scripts/stop-server.sh','scripts/server.cjs','scripts/helper.js','scripts/frame-template.html'],
|
|
5
|
+
'brainstorming':['SKILL.md','visual-companion.md','builder-check-prompt.md','scripts/start-server.sh','scripts/stop-server.sh','scripts/server.cjs','scripts/helper.js','scripts/frame-template.html'],
|
|
6
6
|
'writing-plans':['SKILL.md'],
|
|
7
7
|
'test-driven-development':['SKILL.md','writing-good-tests.md'],
|
|
8
8
|
});
|
|
@@ -10,6 +10,12 @@ export const SKILLS=Object.freeze(Object.keys(REQUIRED));
|
|
|
10
10
|
export const REPOSITORY='https://github.com/obra/superpowers';
|
|
11
11
|
export const DYNAMIC_ROOTS=Object.freeze(['codex','claude'].map(platform=>`${platform}/skill/references/superpowers`));
|
|
12
12
|
export const isDynamicReferencePath=name=>DYNAMIC_ROOTS.some(root=>name===root||name.startsWith(root+'/'));
|
|
13
|
+
export const REFERENCE_PATH_MAP=Object.freeze([
|
|
14
|
+
['brainstorming/SKILL.md','brainstorming.md'],['writing-plans/SKILL.md','writing-plans.md'],['test-driven-development/SKILL.md','test-driven-development.md'],
|
|
15
|
+
['brainstorming/visual-companion.md','visual-companion.md'],['brainstorming/builder-check-prompt.md','builder-check-prompt.md'],['test-driven-development/writing-good-tests.md','writing-good-tests.md'],
|
|
16
|
+
['brainstorming/scripts/start-server.sh','scripts/start-server.sh'],['brainstorming/scripts/stop-server.sh','scripts/stop-server.sh'],['brainstorming/scripts/server.cjs','scripts/server.cjs'],['brainstorming/scripts/helper.js','scripts/helper.js'],['brainstorming/scripts/frame-template.html','scripts/frame-template.html'],
|
|
17
|
+
['LICENSE','superpowers-LICENSE'],['provenance.json','superpowers-provenance.json'],
|
|
18
|
+
].map(([source,destination])=>Object.freeze({source,destination})));
|
|
13
19
|
const hash=bytes=>createHash('sha256').update(bytes).digest('hex');
|
|
14
20
|
function failure(message){throw new Error(message);}
|
|
15
21
|
export function snapshotSkill(root,absolute,required){
|
|
@@ -111,3 +117,22 @@ export function composeArcSkillTree(skillFiles,references){
|
|
|
111
117
|
entries.set('references',{type:'directory',mode:0o700n});entries.set('references/superpowers',{type:'directory',mode:0o700n});
|
|
112
118
|
for(const[name,entry]of references.entries)entries.set('references/superpowers/'+name,{...entry});return entries;
|
|
113
119
|
}
|
|
120
|
+
export function flattenReferenceBundle(bundle){
|
|
121
|
+
validateReferenceBundle(bundle);const allowedFiles=new Set(REFERENCE_PATH_MAP.map(item=>item.source)),allowedDirectories=new Set();
|
|
122
|
+
for(const name of allowedFiles){const parts=name.split('/');for(let i=1;i<parts.length;i++)allowedDirectories.add(parts.slice(0,i).join('/'));}
|
|
123
|
+
for(const[name,entry]of bundle.entries){if(entry.type==='symlink')failure('Unsupported reference link in flat payload');if(entry.type==='file'&&!allowedFiles.has(name)||entry.type==='directory'&&!allowedDirectories.has(name))failure('Unsupported reference file in flat payload');}
|
|
124
|
+
return new Map(REFERENCE_PATH_MAP.map(({source,destination})=>{const entry=bundle.entries.get(source);if(entry?.type!=='file')failure('Required flat reference is missing or not regular');return[destination,{...entry,bytes:Buffer.from(entry.bytes)}];}));
|
|
125
|
+
}
|
|
126
|
+
export function validateFlatReferenceFiles(files,platform){
|
|
127
|
+
if(!(files instanceof Map)||!['codex','claude'].includes(platform))failure('Invalid flat reference input');
|
|
128
|
+
const prefix=platform+'/skill/references/',entries=new Map();
|
|
129
|
+
for(const name of files.keys())if(name.startsWith(prefix+'superpowers/'))failure('Unexpected nested reference payload');
|
|
130
|
+
for(const{source,destination}of REFERENCE_PATH_MAP){const bytes=files.get(prefix+destination);if(!Buffer.isBuffer(bytes))failure('Required flat reference file is missing: '+prefix+destination);const parts=source.split('/');for(let i=1;i<parts.length;i++)entries.set(parts.slice(0,i).join('/'),{type:'directory',mode:0o755n});entries.set(source,{type:'file',bytes,mode:0o644n});}
|
|
131
|
+
let provenance;try{provenance=JSON.parse(entries.get('provenance.json').bytes);}catch{failure('Malformed flat reference provenance');}
|
|
132
|
+
const bundle=validateReferenceBundle({entries,provenance});return{provenance,entries:flattenReferenceBundle(bundle)};
|
|
133
|
+
}
|
|
134
|
+
export function composeStaticArcSkillTree(skillFiles){
|
|
135
|
+
const entries=new Map();
|
|
136
|
+
for(const[name,bytes]of skillFiles){const parts=name.split('/');if(parts.some(part=>!part||part==='.'||part==='..')||name.includes('\\')||name.includes('\0')||name==='references/superpowers'||name.startsWith('references/superpowers/'))failure('Unsafe static ARC path');if(!Buffer.isBuffer(bytes))failure('Invalid static ARC bytes');for(let i=1;i<parts.length;i++)entries.set(parts.slice(0,i).join('/'),{type:'directory',mode:0o700n});entries.set(name,{type:'file',bytes:Buffer.from(bytes),mode:0o600n});}
|
|
137
|
+
return entries;
|
|
138
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {composeStaticArcSkillTree} from './superpowers.mjs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import {cleanupStage,captureCleanupEntry} from './stage-cleanup.mjs';
|
|
4
4
|
import {randomUUID,createHash} from 'node:crypto';
|
|
@@ -53,13 +53,13 @@ function writeTree(directory,entries){
|
|
|
53
53
|
}
|
|
54
54
|
function snapshotEntry(parent,name){const stat=exists(parent,name);if(!stat)return null;const type=typeOf(stat);if(type===0o100000)return readCheckedFile(parent,name,stat).metadata;if(type===0o120000)return{...metadataOf(stat),type:'symlink',link:parent.readlink(name)};if(type===0o040000){const dir=parent.openDir(name);try{if(!sameObjectIdentity(stat,dir.stat()))fail('Entry directory changed');const entries=treeFromDirectory(dir);const hash=createHash('sha256');for(const[k,v]of entries){hash.update(JSON.stringify([k,v.type,...['dev','ino','mode','size','mtimeNs','ctimeNs'].map(field=>String(v.times[field])),v.bytes?.toString('hex')??v.link??null]));}return{...metadataOf(stat),type:'directory',sha256:hash.digest('hex'),children:captureCleanupEntry(parent,name).children};}finally{dir.close();}}fail('Special target entry');}
|
|
55
55
|
function equalMoved(a,b){return a&&b&&['dev','ino','mode','size','mtimeNs','type','sha256','link'].every(k=>a[k]===b[k]);}
|
|
56
|
-
export function applyTransaction(plan,{safeFs,
|
|
56
|
+
export function applyTransaction(plan,{safeFs,signal,hooks={},specs:explicitSpecs}){
|
|
57
57
|
assertPlanSnapshot(plan,{safeFs});const actions=[],areas=[],parents=[],created=[],actionLog=[],byParent=new Map();
|
|
58
58
|
const cleanAreas=()=>{const paths=[],errors=[];for(const area of areas){const result=cleanupStage(area,{safeFs,hooks:{fault:event=>hooks.fault?.({...event,plan})}});paths.push(...result.residualPaths);if(result.cleanupError)errors.push(result.cleanupError);}return{paths,error:errors.length?Object.assign(new AggregateError(errors,errors.map(error=>error.message).join('; ')),{code:'ARC_INSTALL_CLEANUP',residualPaths:paths}):null};};
|
|
59
59
|
const event=(phase,details={})=>{actionLog.push({phase,...details});if(signal?.aborted)throw new InstallError('Install interrupted','ARC_INSTALL_CANCELLED');hooks.fault?.({phase,...details,plan});};
|
|
60
60
|
try{
|
|
61
61
|
event('before-prepare');
|
|
62
|
-
const specs=explicitSpecs??plan.uninstallSpecs??[
|
|
62
|
+
const specs=explicitSpecs??plan.uninstallSpecs??[{path:plan.target.home+'/skills/arc',tree:composeStaticArcSkillTree(plan.generated.skill)},...[...plan.generated.profiles].map(([name,bytes])=>({path:plan.target.home+'/agents/'+name,bytes})),...plan.globalChanges.map(change=>({path:change.path,bytes:change.content}))];
|
|
63
63
|
for(const spec of specs){if(!spec.remove&&!spec.tree&&!Buffer.isBuffer(spec.bytes))fail('Missing verified staged data');const parent=openParent(safeFs,spec.path,created);parents.push(parent);const name=path.basename(spec.path);event('before-stage',{path:spec.path});let area=byParent.get(path.dirname(spec.path));if(area&&!sameObjectIdentity(parent.stat(),area.parent.stat()))fail('Reused staging parent identity changed','ARC_INSTALL_DRIFT');if(!area){const stageName='.arc-stage-'+randomUUID();parent.mkdir(stageName,0o700);const stage=parent.openDir(stageName);area={parent,stage,name:stageName,path:path.dirname(spec.path)+'/'+stageName,identity:stage.stat(),expected:new Map()};areas.push(area);byParent.set(path.dirname(spec.path),area);}const stage=area.stage,preparedName='prepared-'+actions.length,previousName='previous-'+actions.length,rollbackName='rollback-installed-'+actions.length;
|
|
64
64
|
if(spec.remove){}
|
|
65
65
|
else if(spec.tree){stage.mkdir(preparedName,0o700);const dir=stage.openDir(preparedName);try{writeTree(dir,spec.tree);if(spec.rootMetadata)finishDirectory(dir,spec.rootMetadata.mode,spec.rootMetadata);else dir.sync();}finally{dir.close();}}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import os from 'node:os';
|
|
3
|
-
import path from 'node:path';
|
|
4
1
|
import {buildInstallPlan,validatePlanSet} from './plan.mjs';
|
|
5
2
|
import {assertPlanSnapshot} from './transaction.mjs';
|
|
6
3
|
import {inspectPath} from './targets.mjs';
|
|
@@ -8,7 +5,6 @@ import {renderManagedBlock,removeManagedBlock,agentsBlockBody} from './global-co
|
|
|
8
5
|
import {attachShellCompletionCleanup} from './shell-completion.mjs';
|
|
9
6
|
import {verifyPayload} from './manifest.mjs';
|
|
10
7
|
import {installTargets} from './install.mjs';
|
|
11
|
-
import {acquireExternalSkills} from './acquisition.mjs';
|
|
12
8
|
export function buildUpgradePlans({payload,state,safeFs}){
|
|
13
9
|
for(const entry of state.targets)assertPlanSnapshot(entry,{safeFs});
|
|
14
10
|
const plans=state.targets.map(entry=>{
|
|
@@ -22,10 +18,7 @@ export function buildUpgradePlans({payload,state,safeFs}){
|
|
|
22
18
|
attachShellCompletionCleanup(plans,{safeFs});
|
|
23
19
|
validatePlanSet(plans);return plans;
|
|
24
20
|
}
|
|
25
|
-
export async function upgradeInstalledTargets({packageRoot,state,safeFs,signal
|
|
21
|
+
export async function upgradeInstalledTargets({packageRoot,state,safeFs,signal}){
|
|
26
22
|
const payload=verifyPayload({packageRoot,safeFs}),version=JSON.parse(payload.files.get('package.json').toString('utf8')).version,plans=buildUpgradePlans({payload,state,safeFs});
|
|
27
|
-
|
|
28
|
-
try{acquired=await acquireExternalSkills({work,safeFs,signal});}catch(error){if(!error.residualPaths?.length)try{fs.rmdirSync(work);}catch(cleanup){throw Object.assign(new AggregateError([error,cleanup],'Cannot clean private acquisition work'),{code:'ARC_ACQUISITION_CLEANUP',residualPaths:[work]});}throw error;}
|
|
29
|
-
return{...acquired,dispose:async()=>{await acquired.dispose();fs.rmdirSync(work);}};});
|
|
30
|
-
return{version,...await installTargets(plans,{safeFs,signal,acquisition:acquire})};
|
|
23
|
+
return{version,...await installTargets(plans,{safeFs,signal})};
|
|
31
24
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
1
|
import os from 'node:os';
|
|
3
|
-
import path from 'node:path';
|
|
4
2
|
import {fileURLToPath} from 'node:url';
|
|
5
3
|
import {resolveTarget} from '../installer/targets.mjs';
|
|
6
4
|
import {buildInstallPlan,validatePlanSet} from '../installer/plan.mjs';
|
|
@@ -11,8 +9,7 @@ import {installTargets} from '../installer/install.mjs';
|
|
|
11
9
|
import {attachShellCompletionCleanup} from '../installer/shell-completion.mjs';
|
|
12
10
|
import {inspectGlobalArc} from '../npm/context.mjs';
|
|
13
11
|
import {uninstallGlobal,sameGlobalArc} from '../npm/uninstall.mjs';
|
|
14
|
-
|
|
15
|
-
/** @typedef {{packageRoot:string,userHome:string,cwd:string,env:object,safeFs:object,signal?:AbortSignal,acquisition?:Function}} ManagementContext */
|
|
12
|
+
/** @typedef {{packageRoot:string,userHome:string,cwd:string,env:object,safeFs:object,signal?:AbortSignal}} ManagementContext */
|
|
16
13
|
/** @typedef {{kind:string,plans:object[],options:object}} PreparedOperation */
|
|
17
14
|
/** @typedef {{code:number,exitSession:boolean,results:object[],interrupted:boolean}} OperationResult */
|
|
18
15
|
export async function createManagementContext(options={}){
|
|
@@ -31,11 +28,10 @@ export async function prepareOperation(context,options,{selections=[]}={}){
|
|
|
31
28
|
return{kind:options.kind,plans,options:{...options},...(globalArc?{globalArc}:{})};
|
|
32
29
|
}
|
|
33
30
|
export function operationResult(result,successStatuses=['installed']){return{...result,code:result.interrupted?130:result.results.every(item=>successStatuses.includes(item.status)&&!item.error)?0:1,exitSession:false};}
|
|
34
|
-
export function acquisitionFor(context){return context.acquisition??(async()=>{const work=fs.mkdtempSync(path.join(fs.realpathSync(os.tmpdir()),'arc-acquire-'));let acquired;try{acquired=await acquireExternalSkills({work,safeFs:context.safeFs,signal:context.signal});}catch(error){if(!error.residualPaths?.length)try{fs.rmdirSync(work);}catch(cleanup){throw Object.assign(new AggregateError([error,cleanup],'Cannot clean private acquisition work'),{code:'ARC_ACQUISITION_CLEANUP',residualPaths:[work]});}throw error;}return{...acquired,dispose:async()=>{await acquired.dispose();fs.rmdirSync(work);}};});}
|
|
35
31
|
export async function executeOperation(context,prepared){
|
|
36
32
|
if(prepared.kind==='update'){const{executeUpdate}=await import('./update.mjs');return executeUpdate(context,prepared);}
|
|
37
33
|
const options={safeFs:context.safeFs,signal:context.signal,hooks:context.hooks};
|
|
38
|
-
if(prepared.kind==='install')return operationResult(await installTargets(prepared.plans,
|
|
34
|
+
if(prepared.kind==='install')return operationResult(await installTargets(prepared.plans,options));
|
|
39
35
|
if(prepared.kind==='preset')return operationResult(await switchPresetTargets(prepared.plans,options),['updated','unchanged']);
|
|
40
36
|
if(prepared.kind==='uninstall'){
|
|
41
37
|
let result;
|
package/lib/release/artifact.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import {isDeepStrictEqual} from 'node:util';
|
|
|
7
7
|
import {spawnSync} from 'node:child_process';
|
|
8
8
|
import {fileURLToPath} from 'node:url';
|
|
9
9
|
import {openRoot} from '../safe-fs/index.mjs';
|
|
10
|
-
import {verifyPayload} from '../installer/manifest.mjs';
|
|
10
|
+
import {verifyPayload,LOCAL_UPDATER_PATH} from '../installer/manifest.mjs';
|
|
11
11
|
import {readCheckedFile,typeOf,sameIdentity} from '../installer/targets.mjs';
|
|
12
12
|
import {runNpm} from '../npm/process.mjs';
|
|
13
13
|
|
|
@@ -40,6 +40,7 @@ function inventory(root,pkg){
|
|
|
40
40
|
const files=new Map(),directory=openRoot(root);
|
|
41
41
|
function visit(parent,name,relative){
|
|
42
42
|
const stat=parent.lstat(name),type=typeOf(stat);
|
|
43
|
+
if(relative===LOCAL_UPDATER_PATH)throw new Error('Local updater wrapper is forbidden in release inventory');
|
|
43
44
|
if(type===0o040000){
|
|
44
45
|
const child=parent.openDir(name);try{if(!sameIdentity(stat,child.stat()))throw new Error('Release source directory changed');
|
|
45
46
|
const before=child.stat();for(const leaf of child.readDir())visit(child,leaf,relative+'/'+leaf);if(!sameIdentity(before,child.stat()))throw new Error('Release source directory changed while reading');
|
|
@@ -97,6 +98,7 @@ function archive(bytes){
|
|
|
97
98
|
}
|
|
98
99
|
function validateTarball(bytes,{expectedName,expectedVersion}){
|
|
99
100
|
const files=archive(bytes),pkgFile=files.get('package.json');if(!pkgFile)throw new Error('Artifact package metadata is missing');
|
|
101
|
+
if(files.has(LOCAL_UPDATER_PATH))throw new Error('Local updater wrapper is forbidden in release artifact');
|
|
100
102
|
const pkg=JSON.parse(pkgFile.bytes);metadata(pkg,undefined,{artifact:true});
|
|
101
103
|
if(pkg.name!==expectedName||pkg.version!==expectedVersion)throw new Error('Artifact package identity mismatch');
|
|
102
104
|
for(const name of ['scripts/postinstall.mjs','lib/cli/postinstall.mjs','lib/tui/app.mjs','lib/tui/terminal.mjs','lib/cli/root.mjs','lib/cli/upgrade.mjs','bin/arc-upgrade.mjs'])if(!files.has(name))throw new Error('Artifact runtime asset missing: '+name);
|
|
@@ -104,7 +106,7 @@ function validateTarball(bytes,{expectedName,expectedVersion}){
|
|
|
104
106
|
const root=fs.mkdtempSync(path.join(fs.realpathSync(os.tmpdir()),'arc-release-verify-'));
|
|
105
107
|
try{
|
|
106
108
|
for(const[name,item]of files){const filename=path.join(root,name);fs.mkdirSync(path.dirname(filename),{recursive:true,mode:0o700});fs.writeFileSync(filename,item.bytes,{mode:item.mode});}
|
|
107
|
-
verifyPayload({packageRoot:root,safeFs:{openRoot}});
|
|
109
|
+
verifyPayload({packageRoot:root,safeFs:{openRoot},payloadMode:'package'});
|
|
108
110
|
}finally{fs.rmSync(root,{recursive:true,force:true});}
|
|
109
111
|
return pkg;
|
|
110
112
|
}
|
|
@@ -121,7 +123,7 @@ export async function buildReleaseArtifact({sourceRoot,outDir,npmCli,signal,deps
|
|
|
121
123
|
if(!path.isAbsolute(sourceRoot)||fs.realpathSync(sourceRoot)!==sourceRoot)throw new Error('Source root must be an absolute real path');
|
|
122
124
|
abort(signal);const inputs=sourceMetadata(sourceRoot),pkg=JSON.parse(inputs['package.json']),lock=JSON.parse(inputs['package-lock.json']);metadata(pkg,lock);
|
|
123
125
|
const source=inventory(sourceRoot,pkg);for(const name of ['package.json','package-lock.json'])if(!inputs[name].equals(source.files.get(name).bytes))throw new Error('Release source metadata changed during validation');
|
|
124
|
-
verifyPayload({packageRoot:sourceRoot,safeFs:{openRoot}});if(inventory(sourceRoot,pkg).snapshot!==source.snapshot)throw new Error('Release source snapshot changed during validation');
|
|
126
|
+
verifyPayload({packageRoot:sourceRoot,safeFs:{openRoot},payloadMode:'source'});if(inventory(sourceRoot,pkg).snapshot!==source.snapshot)throw new Error('Release source snapshot changed during validation');
|
|
125
127
|
let output,lockIdentity,workRoot,workIdentity;const id=crypto.randomUUID(),partial='.arc-release-'+id+'.partial';let partialExists=false;
|
|
126
128
|
try{
|
|
127
129
|
output=safeOutput(sourceRoot,outDir);const lockFile=output.openFile('.arc-release.lock',{createExclusive:true,read:false});try{lockFile.writeAll(JSON.stringify({schema:1,owner:id,pid:process.pid,state:'incomplete'}));lockIdentity=lockFile.stat();lockFile.sync();}finally{lockFile.close();}
|
|
@@ -131,7 +133,7 @@ export async function buildReleaseArtifact({sourceRoot,outDir,npmCli,signal,deps
|
|
|
131
133
|
const stagedPkg={...pkg,scripts:{...pkg.scripts,postinstall:HOOK}},stagedLock=structuredClone(lock);stagedLock.packages[''].hasInstallScript=true;
|
|
132
134
|
fs.writeFileSync(path.join(stagingRoot,'package.json'),JSON.stringify(stagedPkg,null,2)+'\n');fs.writeFileSync(path.join(stagingRoot,'package-lock.json'),JSON.stringify(stagedLock,null,2)+'\n');metadata(stagedPkg,stagedLock,{artifact:true});
|
|
133
135
|
fs.writeFileSync(path.join(stagingRoot,'.arc-release-staging.json'),JSON.stringify({schema:1,owner:id,state:'incomplete',sourceSnapshot:source.snapshot}));
|
|
134
|
-
refresh(stagingRoot);verifyPayload({packageRoot:stagingRoot,safeFs:{openRoot}});await deps.onStaged?.({stagingRoot,signal});abort(signal);
|
|
136
|
+
refresh(stagingRoot);verifyPayload({packageRoot:stagingRoot,safeFs:{openRoot},payloadMode:'package'});await deps.onStaged?.({stagingRoot,signal});abort(signal);verifyPayload({packageRoot:stagingRoot,safeFs:{openRoot},payloadMode:'package'});
|
|
135
137
|
const bytes=await(deps.pack??pack)({stagingRoot,workRoot,npmCli,signal});abort(signal);validateTarball(bytes,{expectedName:pkg.name,expectedVersion:pkg.version});
|
|
136
138
|
if(inventory(sourceRoot,pkg).snapshot!==source.snapshot)throw new Error('Release source snapshot changed during generation');abort(signal);
|
|
137
139
|
const tarballPath=path.join(outDir,'arc-release.tgz'),receiptPath=path.join(outDir,'arc-release.json');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yunhozz/arc",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -27,7 +27,17 @@
|
|
|
27
27
|
"files": [
|
|
28
28
|
"bin/",
|
|
29
29
|
"lib/",
|
|
30
|
-
"scripts/",
|
|
30
|
+
"scripts/build-native.mjs",
|
|
31
|
+
"scripts/check-installer-parity.mjs",
|
|
32
|
+
"scripts/pack-release.mjs",
|
|
33
|
+
"scripts/postinstall.mjs",
|
|
34
|
+
"scripts/probe-runtime-hooks.mjs",
|
|
35
|
+
"scripts/update-manifest.mjs",
|
|
36
|
+
"scripts/update-role-policy.mjs",
|
|
37
|
+
"scripts/update-runtime-assets.mjs",
|
|
38
|
+
"scripts/update-superpowers.mjs",
|
|
39
|
+
"scripts/vendor-toml.mjs",
|
|
40
|
+
"scripts/verify-release.mjs",
|
|
31
41
|
"vendor/",
|
|
32
42
|
"prebuilds/",
|
|
33
43
|
"native/binding.c",
|
|
@@ -1,28 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {renderManifest,LOCAL_UPDATER_PATH} from '../lib/installer/manifest.mjs';
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
|
-
import crypto from 'node:crypto';
|
|
5
4
|
import { fileURLToPath } from 'node:url';
|
|
6
5
|
const i = process.argv.indexOf('--root');
|
|
7
6
|
const root = i < 0 ? fileURLToPath(new URL('../', import.meta.url)) : path.resolve(process.argv[i + 1]);
|
|
8
7
|
const mutable = new Set(['codex/skill/models.toml', 'claude/skill/models.toml']);
|
|
9
8
|
const excluded = new Set(['.DS_Store', '__pycache__', 'build']);
|
|
10
|
-
const files = new
|
|
9
|
+
const files = new Map();
|
|
11
10
|
function visit(relative) {
|
|
12
|
-
if(isDynamicReferencePath(relative)) return;
|
|
13
11
|
const filename = path.join(root, relative);
|
|
14
|
-
|
|
15
|
-
const stat = fs.lstatSync(filename);
|
|
12
|
+
let stat;try { stat = fs.lstatSync(filename); } catch (error) { if(error.code==='ENOENT')return;throw error; }
|
|
16
13
|
if (stat.isSymbolicLink()) throw new Error(`Protected payload contains symlink: ${relative}`);
|
|
14
|
+
if(relative===LOCAL_UPDATER_PATH){if(!stat.isFile())throw new Error('Local updater wrapper must be a regular file');return;}
|
|
17
15
|
if (stat.isDirectory()) {
|
|
18
16
|
for (const name of fs.readdirSync(filename).sort()) if (!excluded.has(name)) visit(`${relative}/${name}`);
|
|
19
|
-
} else if (stat.isFile() && !mutable.has(relative)) files.
|
|
17
|
+
} else if (stat.isFile() && !mutable.has(relative)) files.set(relative,fs.readFileSync(filename));
|
|
20
18
|
else if (!stat.isFile()) throw new Error(`Protected payload is not regular: ${relative}`);
|
|
21
19
|
}
|
|
22
20
|
for (const entry of ['README.md', 'install.command', 'package.json', 'bin', 'lib', 'native/binding.c', 'native/binding.gyp', 'scripts', 'vendor', 'prebuilds', 'codex/skill', 'codex/agents', 'claude/skill', 'claude/agents']) visit(entry);
|
|
23
|
-
const content =
|
|
21
|
+
const content = renderManifest(files);
|
|
24
22
|
const manifest = path.join(root, 'MANIFEST.sha256');
|
|
25
23
|
if (process.argv.includes('--check')) {
|
|
26
|
-
if (!fs.existsSync(manifest) || fs.readFileSync(manifest
|
|
24
|
+
if (!fs.existsSync(manifest) || !fs.readFileSync(manifest).equals(content)) { console.error('Protected payload manifest is stale'); process.exitCode = 1; }
|
|
27
25
|
else console.log(`Protected payload manifest verified (${files.size} files)`);
|
|
28
26
|
} else { fs.writeFileSync(manifest, content); console.log(`Updated manifest (${files.size} files)`); }
|
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
# Visual Companion Guide
|
|
2
|
-
|
|
3
|
-
Browser-based visual brainstorming companion for showing mockups, diagrams, and options.
|
|
4
|
-
|
|
5
|
-
## When to Use
|
|
6
|
-
|
|
7
|
-
Decide per-question, not per-session. The test: **would the user understand this better by seeing it than reading it?**
|
|
8
|
-
|
|
9
|
-
**Use the browser** when the content itself is visual:
|
|
10
|
-
|
|
11
|
-
- **UI mockups** — wireframes, layouts, navigation structures, component designs
|
|
12
|
-
- **Architecture diagrams** — system components, data flow, relationship maps
|
|
13
|
-
- **Side-by-side visual comparisons** — comparing two layouts, two color schemes, two design directions
|
|
14
|
-
- **Design polish** — when the question is about look and feel, spacing, visual hierarchy
|
|
15
|
-
- **Spatial relationships** — state machines, flowcharts, entity relationships rendered as diagrams
|
|
16
|
-
|
|
17
|
-
**Use the terminal** when the content is text or tabular:
|
|
18
|
-
|
|
19
|
-
- **Requirements and scope questions** — "what does X mean?", "which features are in scope?"
|
|
20
|
-
- **Conceptual A/B/C choices** — picking between approaches described in words
|
|
21
|
-
- **Tradeoff lists** — pros/cons, comparison tables
|
|
22
|
-
- **Technical decisions** — API design, data modeling, architectural approach selection
|
|
23
|
-
- **Clarifying questions** — anything where the answer is words, not a visual preference
|
|
24
|
-
|
|
25
|
-
A question *about* a UI topic is not automatically a visual question. "What kind of wizard do you want?" is conceptual — use the terminal. "Which of these wizard layouts feels right?" is visual — use the browser.
|
|
26
|
-
|
|
27
|
-
## How It Works
|
|
28
|
-
|
|
29
|
-
The server watches a directory for HTML files and serves the newest one to the browser. You write HTML content to `screen_dir`, the user sees it in their browser and can click to select options. Selections are recorded to `state_dir/events` that you read on your next turn.
|
|
30
|
-
|
|
31
|
-
**Content fragments vs full documents:** If your HTML file starts with `<!DOCTYPE` or `<html`, the server serves it as-is (just injects the helper script). Otherwise, the server automatically wraps your content in the frame template — adding the header, CSS theme, connection status, and all interactive infrastructure. **Write content fragments by default.** Only write full documents when you need complete control over the page.
|
|
32
|
-
|
|
33
|
-
## Starting a Session
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
# Start AFTER the user approves the companion. --open auto-opens their browser on
|
|
37
|
-
# the first screen; --project-dir persists mockups and enables same-port restart.
|
|
38
|
-
bash scripts/start-server.sh --project-dir /path/to/project --open
|
|
39
|
-
|
|
40
|
-
# Returns: {"type":"server-started","port":52341,
|
|
41
|
-
# "url":"http://localhost:52341/?key=ab12…",
|
|
42
|
-
# "screen_dir":"/path/to/project/.superpowers/brainstorm/12345-1706000000/content",
|
|
43
|
-
# "state_dir":"/path/to/project/.superpowers/brainstorm/12345-1706000000/state"}
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
Save `screen_dir` and `state_dir` from the response. With `--open`, the browser opens itself when you push the first screen — you don't need to ask the user to open it, but still share the URL as a fallback (headless/remote setups won't auto-open).
|
|
47
|
-
|
|
48
|
-
**The URL contains a session key (`?key=…`).** The server rejects any request
|
|
49
|
-
without it, so always give the user the **complete** URL from the `url` field —
|
|
50
|
-
never strip the query string, and never hand out a bare `http://host:port`. The
|
|
51
|
-
key gates HTTP and WebSocket access so a stray browser tab or another machine on
|
|
52
|
-
the network can't read the screens or inject events. After the first load the
|
|
53
|
-
browser remembers the key via a cookie, so reloads and `/files/*` assets work
|
|
54
|
-
without repeating it.
|
|
55
|
-
|
|
56
|
-
**Finding connection info:** The server writes its startup JSON to `$STATE_DIR/server-info`. If you launched the server in the background and didn't capture stdout, read that file to get the URL and port. When using `--project-dir`, check `<project>/.superpowers/brainstorm/` for the session directory.
|
|
57
|
-
|
|
58
|
-
**Note:** Pass the project root as `--project-dir` so mockups persist in `.superpowers/brainstorm/` and survive server restarts. Without it, files go to `/tmp` and get cleaned up. Remind the user to add `.superpowers/` to `.gitignore` if it's not already there.
|
|
59
|
-
|
|
60
|
-
**Launching the server by platform:**
|
|
61
|
-
|
|
62
|
-
**Claude Code:**
|
|
63
|
-
```bash
|
|
64
|
-
# Default mode works — the script backgrounds the server itself.
|
|
65
|
-
bash scripts/start-server.sh --project-dir /path/to/project --open
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
On Windows, the script auto-detects and switches to foreground mode (which blocks the tool call). Use `run_in_background: true` on the Bash tool call so the server survives across conversation turns, then read `$STATE_DIR/server-info` on the next turn to get the URL and port.
|
|
69
|
-
|
|
70
|
-
**Codex:**
|
|
71
|
-
```bash
|
|
72
|
-
# Codex reaps background processes. The script auto-detects CODEX_CI and
|
|
73
|
-
# switches to foreground mode. Run it normally — no extra flags needed.
|
|
74
|
-
bash scripts/start-server.sh --project-dir /path/to/project --open
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
**Gemini CLI:**
|
|
78
|
-
```bash
|
|
79
|
-
# Use --foreground and set is_background: true on your shell tool call
|
|
80
|
-
# so the process survives across turns
|
|
81
|
-
bash scripts/start-server.sh --project-dir /path/to/project --open --foreground
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
**Copilot CLI:**
|
|
85
|
-
```bash
|
|
86
|
-
# Start it with Copilot CLI's non-blocking/background shell mechanism so the
|
|
87
|
-
# server survives across turns. Keep --foreground so the harness, not the
|
|
88
|
-
# script, owns backgrounding. The launcher is a .sh, so invoke it via bash
|
|
89
|
-
# (on Windows, call Git Bash's bash.exe from the PowerShell tool).
|
|
90
|
-
bash scripts/start-server.sh --project-dir /path/to/project --open --foreground
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
**Other environments:** The server must keep running in the background across conversation turns. If your environment reaps detached processes, use `--foreground` and launch the command with your platform's background execution mechanism.
|
|
94
|
-
|
|
95
|
-
If the URL is unreachable from your browser (common in remote/containerized setups), bind a non-loopback host:
|
|
96
|
-
|
|
97
|
-
```bash
|
|
98
|
-
bash scripts/start-server.sh \
|
|
99
|
-
--project-dir /path/to/project \
|
|
100
|
-
--host 0.0.0.0 \
|
|
101
|
-
--url-host localhost
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
Use `--url-host` to control what hostname is printed in the returned URL JSON.
|
|
105
|
-
|
|
106
|
-
## The Loop
|
|
107
|
-
|
|
108
|
-
1. **Check server is alive**, then **write HTML** to a new file in `screen_dir`:
|
|
109
|
-
- **Required: confirm the server is alive before referring to the URL or pushing a screen.** Check that `$STATE_DIR/server-info` exists and `$STATE_DIR/server-stopped` does not. If it has shut down, restart it with `start-server.sh` using the **same `--project-dir`** — it reuses the same port, so the user's open tab reconnects on its own (it shows a "paused" overlay while the server is down) and you don't need to send a new URL. The server auto-exits after 4 hours idle (configurable with `--idle-timeout-minutes`).
|
|
110
|
-
- Use semantic filenames: `platform.html`, `visual-style.html`, `layout.html`
|
|
111
|
-
- **Never reuse filenames** — each screen gets a fresh file
|
|
112
|
-
- Use your file-creation tool — **never use cat/heredoc** (dumps noise into terminal)
|
|
113
|
-
- Server automatically serves the newest file
|
|
114
|
-
|
|
115
|
-
2. **Tell user what to expect and end your turn:**
|
|
116
|
-
- Remind them of the URL (every step, not just first)
|
|
117
|
-
- Give a brief text summary of what's on screen (e.g., "Showing 3 layout options for the homepage")
|
|
118
|
-
- Ask them to respond in the terminal: "Take a look and let me know what you think. Click to select an option if you'd like."
|
|
119
|
-
|
|
120
|
-
3. **On your next turn** — after the user responds in the terminal:
|
|
121
|
-
- Read `$STATE_DIR/events` if it exists — this contains the user's browser interactions (clicks, selections) as JSON lines
|
|
122
|
-
- Merge with the user's terminal text to get the full picture
|
|
123
|
-
- The terminal message is the primary feedback; `state_dir/events` provides structured interaction data
|
|
124
|
-
|
|
125
|
-
4. **Iterate or advance** — if feedback changes current screen, write a new file (e.g., `layout-v2.html`). Only move to the next question when the current step is validated.
|
|
126
|
-
|
|
127
|
-
5. **Unload when returning to terminal** — when the next step doesn't need the browser (e.g., a clarifying question, a tradeoff discussion), push a waiting screen to clear the stale content:
|
|
128
|
-
|
|
129
|
-
```html
|
|
130
|
-
<!-- filename: waiting.html (or waiting-2.html, etc.) -->
|
|
131
|
-
<div style="display:flex;align-items:center;justify-content:center;min-height:60vh">
|
|
132
|
-
<p class="subtitle">Continuing in terminal...</p>
|
|
133
|
-
</div>
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
This prevents the user from staring at a resolved choice while the conversation has moved on. When the next visual question comes up, push a new content file as usual.
|
|
137
|
-
|
|
138
|
-
6. Repeat until done.
|
|
139
|
-
|
|
140
|
-
## Writing Content Fragments
|
|
141
|
-
|
|
142
|
-
Write just the content that goes inside the page. The server wraps it in the frame template automatically (header, theme CSS, connection status, and all interactive infrastructure).
|
|
143
|
-
|
|
144
|
-
**Minimal example:**
|
|
145
|
-
|
|
146
|
-
```html
|
|
147
|
-
<h2>Which layout works better?</h2>
|
|
148
|
-
<p class="subtitle">Consider readability and visual hierarchy</p>
|
|
149
|
-
|
|
150
|
-
<div class="options">
|
|
151
|
-
<div class="option" data-choice="a" onclick="toggleSelect(this)">
|
|
152
|
-
<div class="letter">A</div>
|
|
153
|
-
<div class="content">
|
|
154
|
-
<h3>Single Column</h3>
|
|
155
|
-
<p>Clean, focused reading experience</p>
|
|
156
|
-
</div>
|
|
157
|
-
</div>
|
|
158
|
-
<div class="option" data-choice="b" onclick="toggleSelect(this)">
|
|
159
|
-
<div class="letter">B</div>
|
|
160
|
-
<div class="content">
|
|
161
|
-
<h3>Two Column</h3>
|
|
162
|
-
<p>Sidebar navigation with main content</p>
|
|
163
|
-
</div>
|
|
164
|
-
</div>
|
|
165
|
-
</div>
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
That's it. No `<html>`, no CSS, no `<script>` tags needed. The server provides all of that.
|
|
169
|
-
|
|
170
|
-
## CSS Classes Available
|
|
171
|
-
|
|
172
|
-
The frame template provides these CSS classes for your content:
|
|
173
|
-
|
|
174
|
-
### Options (A/B/C choices)
|
|
175
|
-
|
|
176
|
-
```html
|
|
177
|
-
<div class="options">
|
|
178
|
-
<div class="option" data-choice="a" onclick="toggleSelect(this)">
|
|
179
|
-
<div class="letter">A</div>
|
|
180
|
-
<div class="content">
|
|
181
|
-
<h3>Title</h3>
|
|
182
|
-
<p>Description</p>
|
|
183
|
-
</div>
|
|
184
|
-
</div>
|
|
185
|
-
</div>
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
**Multi-select:** Add `data-multiselect` to the container to let users select multiple options. Each click toggles the item's selected styling.
|
|
189
|
-
|
|
190
|
-
```html
|
|
191
|
-
<div class="options" data-multiselect>
|
|
192
|
-
<!-- same option markup — users can select/deselect multiple -->
|
|
193
|
-
</div>
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
### Cards (visual designs)
|
|
197
|
-
|
|
198
|
-
```html
|
|
199
|
-
<div class="cards">
|
|
200
|
-
<div class="card" data-choice="design1" onclick="toggleSelect(this)">
|
|
201
|
-
<div class="card-image"><!-- mockup content --></div>
|
|
202
|
-
<div class="card-body">
|
|
203
|
-
<h3>Name</h3>
|
|
204
|
-
<p>Description</p>
|
|
205
|
-
</div>
|
|
206
|
-
</div>
|
|
207
|
-
</div>
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
### Mockup container
|
|
211
|
-
|
|
212
|
-
```html
|
|
213
|
-
<div class="mockup">
|
|
214
|
-
<div class="mockup-header">Preview: Dashboard Layout</div>
|
|
215
|
-
<div class="mockup-body"><!-- your mockup HTML --></div>
|
|
216
|
-
</div>
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
### Split view (side-by-side)
|
|
220
|
-
|
|
221
|
-
```html
|
|
222
|
-
<div class="split">
|
|
223
|
-
<div class="mockup"><!-- left --></div>
|
|
224
|
-
<div class="mockup"><!-- right --></div>
|
|
225
|
-
</div>
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
### Pros/Cons
|
|
229
|
-
|
|
230
|
-
```html
|
|
231
|
-
<div class="pros-cons">
|
|
232
|
-
<div class="pros"><h4>Pros</h4><ul><li>Benefit</li></ul></div>
|
|
233
|
-
<div class="cons"><h4>Cons</h4><ul><li>Drawback</li></ul></div>
|
|
234
|
-
</div>
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
### Mock elements (wireframe building blocks)
|
|
238
|
-
|
|
239
|
-
```html
|
|
240
|
-
<div class="mock-nav">Logo | Home | About | Contact</div>
|
|
241
|
-
<div style="display: flex;">
|
|
242
|
-
<div class="mock-sidebar">Navigation</div>
|
|
243
|
-
<div class="mock-content">Main content area</div>
|
|
244
|
-
</div>
|
|
245
|
-
<button class="mock-button">Action Button</button>
|
|
246
|
-
<input class="mock-input" placeholder="Input field">
|
|
247
|
-
<div class="placeholder">Placeholder area</div>
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
### Typography and sections
|
|
251
|
-
|
|
252
|
-
- `h2` — page title
|
|
253
|
-
- `h3` — section heading
|
|
254
|
-
- `.subtitle` — secondary text below title
|
|
255
|
-
- `.section` — content block with bottom margin
|
|
256
|
-
- `.label` — small uppercase label text
|
|
257
|
-
|
|
258
|
-
## Browser Events Format
|
|
259
|
-
|
|
260
|
-
When the user clicks options in the browser, their interactions are recorded to `$STATE_DIR/events` (one JSON object per line). The file is cleared automatically when you push a new screen.
|
|
261
|
-
|
|
262
|
-
```jsonl
|
|
263
|
-
{"type":"click","choice":"a","text":"Option A - Simple Layout","timestamp":1706000101}
|
|
264
|
-
{"type":"click","choice":"c","text":"Option C - Complex Grid","timestamp":1706000108}
|
|
265
|
-
{"type":"click","choice":"b","text":"Option B - Hybrid","timestamp":1706000115}
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
The full event stream shows the user's exploration path — they may click multiple options before settling. The last `choice` event is typically the final selection, but the pattern of clicks can reveal hesitation or preferences worth asking about.
|
|
269
|
-
|
|
270
|
-
If `$STATE_DIR/events` doesn't exist, the user didn't interact with the browser — use only their terminal text.
|
|
271
|
-
|
|
272
|
-
## Design Tips
|
|
273
|
-
|
|
274
|
-
- **Scale fidelity to the question** — wireframes for layout, polish for polish questions
|
|
275
|
-
- **Explain the question on each page** — "Which layout feels more professional?" not just "Pick one"
|
|
276
|
-
- **Iterate before advancing** — if feedback changes current screen, write a new version
|
|
277
|
-
- **2-4 options max** per screen
|
|
278
|
-
- **Use real content when it matters** — for a photography portfolio, use actual images (Unsplash). Placeholder content obscures design issues.
|
|
279
|
-
- **Keep mockups simple** — focus on layout and structure, not pixel-perfect design
|
|
280
|
-
|
|
281
|
-
## File Naming
|
|
282
|
-
|
|
283
|
-
- Use semantic names: `platform.html`, `visual-style.html`, `layout.html`
|
|
284
|
-
- Never reuse filenames — each screen must be a new file
|
|
285
|
-
- For iterations: append version suffix like `layout-v2.html`, `layout-v3.html`
|
|
286
|
-
- Server serves newest file by modification time
|
|
287
|
-
|
|
288
|
-
## Cleaning Up
|
|
289
|
-
|
|
290
|
-
```bash
|
|
291
|
-
bash scripts/stop-server.sh $SESSION_DIR
|
|
292
|
-
```
|
|
293
|
-
|
|
294
|
-
If the session used `--project-dir`, mockup files persist in `.superpowers/brainstorm/` for later reference. Only `/tmp` sessions get deleted on stop.
|
|
295
|
-
|
|
296
|
-
## Reference
|
|
297
|
-
|
|
298
|
-
- Frame template (CSS reference): `scripts/frame-template.html`
|
|
299
|
-
- Helper script (client-side): `scripts/helper.js`
|