stillmade-sdk 0.1.27 → 0.1.28

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/AGENTS.md CHANGED
@@ -4,7 +4,7 @@ This folder is the StillMade Block SDK. Read this file before writing code; it i
4
4
 
5
5
  ## Readiness gate
6
6
 
7
- Do not tell the user a Block is ready, done or working until `node packages/block-cli/cli.js gate .` passes after your last edit, and report the exact status it prints. In this folder Claude Code (`.claude/settings.json`) and Cursor (`.cursor/hooks.json`) run the gate when you finish a turn and send any failures back to you, but only in a session started in this folder: if you downloaded the SDK during the current session, run the gate yourself. Other agents must also run it themselves. If you cannot fix a failure, say plainly that the Block is not ready and list the failing checks.
7
+ Do not tell the user a Block is ready, done or working until `node packages/block-cli/cli.js gate .` passes after your last edit, and report the exact status it prints. In this folder Claude Code (`.claude/settings.json`) and Cursor (`.cursor/hooks.json`) run the gate when you finish a turn and send any failures back to you, but only in a session started in this folder: if you downloaded the SDK during the current session, run the gate yourself. Other agents must also run it themselves. A module Block runs code, so the gate a hook starts does not run it and says so: run `gate` or `ready` on it yourself. If you cannot fix a failure, say plainly that the Block is not ready and list the failing checks.
8
8
 
9
9
  Contract `stillmade.block-builder@1.6.1`. Humans, coding agents, imported source, GitHub repositories and generated code all adapt to the Block platform; anything that becomes a StillMade Block obeys this contract.
10
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stillmade-sdk",
3
- "version": "0.1.27",
3
+ "version": "0.1.28",
4
4
  "description": "StillMade Block SDK, CLI and examples",
5
5
  "license": "PolyForm-Shield-1.0.0",
6
6
  "type": "module",
@@ -82,11 +82,16 @@ export async function sdkBaselineForFiles(files){
82
82
  async function readJson(path,fallback){try{return JSON.parse(await readFile(path,'utf8'));}catch{return fallback;}}
83
83
  const summarize=readiness=>(readiness?.items||[]).filter(item=>['failed','blocked'].includes(item.state)).slice(0,6).map(item=>`${item.id} ${item.title}: ${String(item.reason||'').slice(0,300)}`);
84
84
 
85
- async function judge(path,main){
85
+ // A module Block's code runs in a Node worker, which is no isolation boundary, so only a gate the
86
+ // person or agent started themselves runs it (`gate`, `ready`); the gate a hook starts at the end
87
+ // of a turn does not, and says so (October 20, 2026).
88
+ export const RUN_READY_YOURSELF='RUN READY YOURSELF';
89
+ async function judge(path,main,{executeModules=true}={}){
86
90
  try{
87
- const readiness=await main(['ready',path]);
88
91
  // Every new or edited Block carries its feature map (builder-contract); search, matching and its listing read it.
89
92
  const manifest=(await main(['inspect',path]).catch(()=>null))?.manifest;
93
+ if(!executeModules&&manifest?.runtime==='module')return {ok:false,status:RUN_READY_YOURSELF,failures:['This Block runs code, so the gate a hook starts does not run it. Run `stillmade-block gate .` (`npx stillmade-block gate .` in an npm project) yourself and report the status it prints.'],limitations:0};
94
+ const readiness=await main(['ready',path]);
90
95
  // The starting map create writes (one entry copied from the description) does not count until it is rewritten.
91
96
  const placeholder=features=>features.length===1&&features[0].id==='main'&&features[0].asks?.length===1&&features[0].asks[0]===features[0].does;
92
97
  if(PASSING.has(readiness.status)&&manifest&&!(Array.isArray(manifest.features)&&manifest.features.length&&!placeholder(manifest.features)))
@@ -104,7 +109,7 @@ async function judge(path,main){
104
109
  }
105
110
 
106
111
  /** Judge every changed package. Never throws for a failing Block; returns a verdict. */
107
- export async function runReadyGate({root=process.cwd(),main}={}){
112
+ export async function runReadyGate({root=process.cwd(),main,executeModules=true}={}){
108
113
  root=resolve(root);
109
114
  main??=(await import('./cli.js')).main;
110
115
  const baseline=(await readJson(join(root,SDK_BASELINE_FILE),{packages:{}})).packages||{};
@@ -116,8 +121,10 @@ export async function runReadyGate({root=process.cwd(),main}={}){
116
121
  const cached=cache.entries[name];
117
122
  // A verdict is reused only for the same package under the same contract: a newer SDK judges again
118
123
  // (October 20, 2026: a FAILED verdict from the SDK that could not run module Blocks outlived the fix).
119
- const verdict=cached?.digest===digest&&cached?.contract===BUILDER_CONTRACT_STAMP?cached:{digest,contract:BUILDER_CONTRACT_STAMP,...await judge(path,main),checkedAt:new Date().toISOString()};
120
- cache.entries[name]=verdict;
124
+ const verdict=cached?.digest===digest&&cached?.contract===BUILDER_CONTRACT_STAMP?cached:{digest,contract:BUILDER_CONTRACT_STAMP,...await judge(path,main,{executeModules}),checkedAt:new Date().toISOString()};
125
+ // A verdict the hook could not reach (a module Block it did not run) is not kept: the person's own
126
+ // gate run judges it, and that verdict then answers the hook too.
127
+ if(verdict.status!==RUN_READY_YOURSELF)cache.entries[name]=verdict;
121
128
  results.push({package:name,...verdict});
122
129
  }
123
130
  await mkdir(join(root,READY_GATE_STATE),{recursive:true});
@@ -134,7 +141,7 @@ export function gateMessage(verdict){
134
141
  /** Hook entry. `agent` is claude, cursor or plain. Returns {exitCode, stdout}. */
135
142
  export async function readyGateHook({agent='plain',input={},root,main}={}){
136
143
  root=resolve(root||(agent==='cursor'?process.env.CURSOR_PROJECT_DIR||input.workspace_roots?.[0]:process.env.CLAUDE_PROJECT_DIR||input.cwd)||process.cwd());
137
- const verdict=await runReadyGate({root,main});
144
+ const verdict=await runReadyGate({root,main,executeModules:false});
138
145
  const statePath=join(root,READY_GATE_STATE,'gate-state.json'),state=await readJson(statePath,{});
139
146
  if(verdict.passed){
140
147
  await writeFile(statePath,'{}\n');
@@ -152,5 +152,5 @@ export function renderBuilderContract(form='compact',{scope='all'}={}){
152
152
  `## Platform gap classes\n\n${Object.entries(GAP_CLASSES).map(([key,label])=>`- ${key}: ${label}`).join('\n')}`,
153
153
  ].join('\n\n');
154
154
  if(form==='full')return `# StillMade Block builder contract\n\n${body}`;
155
- return `# Building StillMade Blocks in this folder\n\nThis folder is the StillMade Block SDK. Read this file before writing code; it is the same contract StillMade's own AI and importers follow. Commands below use the downloaded SDK folder form \`node packages/block-cli/cli.js\`; when the SDK came from \`npm install --save-dev stillmade-sdk\`, type \`npx stillmade-block\` in its place. Scaffold with \`node packages/block-cli/cli.js create my-block javascript\`, then iterate with \`validate my-block\` and \`test my-block\`, check admission with \`pack my-block /tmp/my-block.stillmade-block --original\`, and finish with \`ready my-block\`, the same readiness check StillMade runs before an install or a release. \`SDK.md\` is the complete reference and \`PASTE_TO_LLM.md\` the detailed authoring guide.\n\n## Readiness gate\n\nDo not tell the user a Block is ready, done or working until \`node packages/block-cli/cli.js gate .\` passes after your last edit, and report the exact status it prints. In this folder Claude Code (\`.claude/settings.json\`) and Cursor (\`.cursor/hooks.json\`) run the gate when you finish a turn and send any failures back to you, but only in a session started in this folder: if you downloaded the SDK during the current session, run the gate yourself. Other agents must also run it themselves. If you cannot fix a failure, say plainly that the Block is not ready and list the failing checks.\n\n${body}`;
155
+ return `# Building StillMade Blocks in this folder\n\nThis folder is the StillMade Block SDK. Read this file before writing code; it is the same contract StillMade's own AI and importers follow. Commands below use the downloaded SDK folder form \`node packages/block-cli/cli.js\`; when the SDK came from \`npm install --save-dev stillmade-sdk\`, type \`npx stillmade-block\` in its place. Scaffold with \`node packages/block-cli/cli.js create my-block javascript\`, then iterate with \`validate my-block\` and \`test my-block\`, check admission with \`pack my-block /tmp/my-block.stillmade-block --original\`, and finish with \`ready my-block\`, the same readiness check StillMade runs before an install or a release. \`SDK.md\` is the complete reference and \`PASTE_TO_LLM.md\` the detailed authoring guide.\n\n## Readiness gate\n\nDo not tell the user a Block is ready, done or working until \`node packages/block-cli/cli.js gate .\` passes after your last edit, and report the exact status it prints. In this folder Claude Code (\`.claude/settings.json\`) and Cursor (\`.cursor/hooks.json\`) run the gate when you finish a turn and send any failures back to you, but only in a session started in this folder: if you downloaded the SDK during the current session, run the gate yourself. Other agents must also run it themselves. A module Block runs code, so the gate a hook starts does not run it and says so: run \`gate\` or \`ready\` on it yourself. If you cannot fix a failure, say plainly that the Block is not ready and list the failing checks.\n\n${body}`;
156
156
  }