specbox 6.38.1 → 6.40.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.
@@ -194,12 +194,45 @@ function pre() {
194
194
  process.stdout.write(JSON.stringify({ hookSpecificOutput: { hookEventName: 'PreToolUse', updatedInput } }));
195
195
  }
196
196
 
197
+ /**
198
+ * start_uc (UC-12301): a block it records (`event_line`) and a skip it spends (`policy_content`)
199
+ * go where the policy tools write them. Returns the note for the agent, or null.
200
+ */
201
+ function saveStartUcEnforcement(response) {
202
+ if (parsed.tool !== 'start_uc') return null;
203
+ const saved = [];
204
+ try {
205
+ const lines = (extractField(response, 'event_line') || '').split('\n').filter((l) => l.trim());
206
+ if (lines.length) {
207
+ for (const line of lines) JSON.parse(line);
208
+ mkdirSync(dirname(eventsPath), { recursive: true });
209
+ appendFileSync(eventsPath, lines.map((l) => `${l}\n`).join(''), 'utf-8');
210
+ saved.push(`el registro en ${eventsPath.replace(`${root}/`, '')}`);
211
+ }
212
+ const policy = extractField(response, 'policy_content');
213
+ if (policy != null) {
214
+ JSON.parse(policy);
215
+ writeAtomic(policyPath, policy.endsWith('\n') ? policy : `${policy}\n`);
216
+ saved.unshift(`la política en ${policyPath.replace(`${root}/`, '')}`);
217
+ }
218
+ } catch (err) {
219
+ process.stderr.write(
220
+ `SpecBox freeform-fragment: no se pudo guardar lo que devolvió start_uc (${err.message}). ` +
221
+ 'Repite la llamada antes de seguir.\n',
222
+ );
223
+ process.exit(2);
224
+ }
225
+ return saved.length ? `SpecBox: guardado ${saved.join(' y ')}. No lo escribas a mano.` : null;
226
+ }
227
+
197
228
  function post() {
198
229
  if (!existsSync(pending)) return;
199
230
  const response = payload.tool_response;
231
+ const startNote = saveStartUcEnforcement(response);
200
232
  const content = extractItemsContent(response);
201
233
  if (content == null) {
202
234
  unlinkSync(pending); // a read, or an error: nothing to merge
235
+ if (startNote) writeHidden(response, startNote); // a start_uc that a measure stopped
203
236
  return;
204
237
  }
205
238
  try {
@@ -224,7 +257,8 @@ function post() {
224
257
  `SpecBox: el tablero ya está guardado en ${itemsPath.replace(`${root}/`, '')}` +
225
258
  (changes ? ` (${changes > 0 ? '+' : ''}${changes} elementos)` : '') +
226
259
  (policySaved ? `, con su política en ${policyPath.replace(`${root}/`, '')}` : '') +
227
- '. No lo escribas a mano.',
260
+ '. No lo escribas a mano.' +
261
+ (startNote ? ` ${startNote}` : ''),
228
262
  },
229
263
  }),
230
264
  );
@@ -177,7 +177,8 @@
177
177
  "freeform-fragment.mjs": [
178
178
  "fcb1fc9a1494c1c63870bdec08368bf3c815b1372e220a6311535b0431c86061",
179
179
  "c8c507e2bd1bfa11f681a70b0f236bbc0d23447140ee4424a25533669beb17b4",
180
- "c212b004d384feba728e0ee7e955bfb09fafe39112cad7c530620a1e932d169a"
180
+ "c212b004d384feba728e0ee7e955bfb09fafe39112cad7c530620a1e932d169a",
181
+ "9ab7d65162056498f7c403eff0eb571b914b9d5c70b9bfdcd52b885c7bd20fef"
181
182
  ],
182
183
  "lib/freeform-fragment.mjs": [
183
184
  "d30a15b495cf18cad571e8582b4ce943a75aa4ad8efc5fa11e22420b505dad12",
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "6.38.1",
2
+ "version": "6.40.0",
3
3
  "files": {
4
4
  "app-docs-fragment.mjs": "4efae124b02c12f87513e48ca6d4f2e96065c05ca6d8c74352592a8edb21695a",
5
5
  "app-docs-sync-guard.mjs": "71f09545b57c143b013c2e532366bfdd1e1a2ae49c7644c9e12e2ab5324d03d3",
@@ -12,7 +12,7 @@
12
12
  "design-system-gate.mjs": "419018cadb3e0a4fe0def1c423fed7013b76b2f121312acadbc99fc8e30b8ff5",
13
13
  "e2e-gate.mjs": "02e239816cb429f76034088a5370f63a08facce01b4ffd52b338a66acf13028d",
14
14
  "file-ownership-guard.mjs": "d8a84370766966cce70b76811de9dd150d170a79c4cb7b9e6b120cfad86a6932",
15
- "freeform-fragment.mjs": "c212b004d384feba728e0ee7e955bfb09fafe39112cad7c530620a1e932d169a",
15
+ "freeform-fragment.mjs": "9ab7d65162056498f7c403eff0eb571b914b9d5c70b9bfdcd52b885c7bd20fef",
16
16
  "freeform-path-guard.mjs": "9ded19e96b0738de5aaf43a97eaa1d88ecd3b341efd432c0b32eb312c4bf5e0a",
17
17
  "healing-budget-guard.mjs": "c49c6c34f99545e4009ad88ed9f7eef737e35ce39c11a05d41ad8f976ffae09f",
18
18
  "implement-checkpoint.mjs": "f3f219779a1ac4108bc3aabcc7311e9135d9c7795c126a2b5d659e743f5a5a64",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specbox",
3
- "version": "6.38.1",
3
+ "version": "6.40.0",
4
4
  "description": "Conecta este ordenador a SpecBox sin copiar tokens (specbox login, status y logout) y actualiza los hooks del proyecto sin pisar los tuyos (specbox hooks).",
5
5
  "type": "module",
6
6
  "bin": {