@yasaswy.nagavolu/agents 0.17.3 → 0.18.1
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/README.md +42 -0
- package/bin/cli.js +30 -1
- package/content/global/CLAUDE.md +9 -2
- package/content/manifest.json +74 -0
- package/content/manifest.schema.json +17 -1
- package/content/proxy/agent_model_guard.py +58 -12
- package/content/proxy/artifact_mocker_gate.py +9 -1
- package/content/proxy/bg_process_registry.py +12 -4
- package/content/proxy/code_is_law_lint_hook.py +9 -1
- package/content/proxy/edit_videos_intent_hook.py +97 -0
- package/content/proxy/execution_worker_review_gate.py +41 -10
- package/content/proxy/headless_process.py +48 -0
- package/content/proxy/headless_spawn_guard.py +164 -0
- package/content/proxy/memory_first_hook.py +9 -1
- package/content/proxy/model_id_leak_guard.py +9 -1
- package/content/proxy/no_openrouter_guard.py +9 -1
- package/content/proxy/portal/aggregator.py +8 -1
- package/content/proxy/prd_closing_gate.py +9 -1
- package/content/proxy/project_resolver.py +10 -1
- package/content/proxy/resolve_policy_guard.py +106 -0
- package/content/proxy/route_lock.py +11 -3
- package/content/proxy/shared_worktree_revert_guard.py +7 -1
- package/content/proxy/worktree_targets.py +20 -0
- package/content/skills/edit-videos/SKILL.md +72 -0
- package/content/skills/edit-videos/engine/__init__.py +0 -0
- package/content/skills/edit-videos/engine/__main__.py +4 -0
- package/content/skills/edit-videos/engine/blur.py +160 -0
- package/content/skills/edit-videos/engine/cache.py +43 -0
- package/content/skills/edit-videos/engine/captions.py +389 -0
- package/content/skills/edit-videos/engine/cli.py +491 -0
- package/content/skills/edit-videos/engine/contact_sheet.py +63 -0
- package/content/skills/edit-videos/engine/detect_idle.py +101 -0
- package/content/skills/edit-videos/engine/export_plan.py +93 -0
- package/content/skills/edit-videos/engine/fcpxml_writer.py +139 -0
- package/content/skills/edit-videos/engine/ffmpeg_io.py +106 -0
- package/content/skills/edit-videos/engine/filter_chain.py +19 -0
- package/content/skills/edit-videos/engine/map_time.py +72 -0
- package/content/skills/edit-videos/engine/naming.py +25 -0
- package/content/skills/edit-videos/engine/otio_writer.py +65 -0
- package/content/skills/edit-videos/engine/probe.py +64 -0
- package/content/skills/edit-videos/engine/render.py +219 -0
- package/content/skills/edit-videos/engine/resolve_export.py +32 -0
- package/content/skills/edit-videos/engine/schema.py +268 -0
- package/content/skills/edit-videos/engine/timeline.py +222 -0
- package/content/skills/edit-videos/engine/timeline_math.py +161 -0
- package/content/skills/edit-videos/engine/zoom.py +51 -0
- package/content/skills/edit-videos/pyproject.toml +34 -0
- package/content/skills/edit-videos/resolve_ui/__init__.py +0 -0
- package/content/skills/edit-videos/resolve_ui/__main__.py +4 -0
- package/content/skills/edit-videos/resolve_ui/act.py +461 -0
- package/content/skills/edit-videos/resolve_ui/assets/master_bin_row.png +0 -0
- package/content/skills/edit-videos/resolve_ui/assets/master_breadcrumb.png +0 -0
- package/content/skills/edit-videos/resolve_ui/assets/st1_badge.png +0 -0
- package/content/skills/edit-videos/resolve_ui/banner.py +243 -0
- package/content/skills/edit-videos/resolve_ui/cli.py +318 -0
- package/content/skills/edit-videos/resolve_ui/flows.py +485 -0
- package/content/skills/edit-videos/resolve_ui/gc.py +144 -0
- package/content/skills/edit-videos/resolve_ui/guards.py +813 -0
- package/content/skills/edit-videos/resolve_ui/job_registry.py +33 -0
- package/content/skills/edit-videos/resolve_ui/locate.py +269 -0
- package/content/skills/edit-videos/resolve_ui/poll.py +29 -0
- package/content/skills/edit-videos/resolve_ui/virtual_desktop.py +59 -0
- package/content/skills/edit-videos/tests/conftest.py +244 -0
- package/content/skills/edit-videos/tests/fixtures/dr25/master_nested_bad.png +0 -0
- package/content/skills/edit-videos/tests/fixtures/dr25/master_selected_good.png +0 -0
- package/content/skills/edit-videos/tests/fixtures/dr29/st1_absent.png +0 -0
- package/content/skills/edit-videos/tests/fixtures/dr29/st1_present.png +0 -0
- package/content/skills/edit-videos/tests/test_blur.py +75 -0
- package/content/skills/edit-videos/tests/test_cache.py +54 -0
- package/content/skills/edit-videos/tests/test_captions.py +321 -0
- package/content/skills/edit-videos/tests/test_cli.py +556 -0
- package/content/skills/edit-videos/tests/test_cli_job_gc.py +108 -0
- package/content/skills/edit-videos/tests/test_contact_sheet.py +72 -0
- package/content/skills/edit-videos/tests/test_detect_idle.py +107 -0
- package/content/skills/edit-videos/tests/test_dr26_vfr_time_alignment.py +121 -0
- package/content/skills/edit-videos/tests/test_dr31_duration_drift.py +101 -0
- package/content/skills/edit-videos/tests/test_dr32_last_frame_overlay.py +113 -0
- package/content/skills/edit-videos/tests/test_engine_refactor_goldens.py +156 -0
- package/content/skills/edit-videos/tests/test_map_time.py +76 -0
- package/content/skills/edit-videos/tests/test_naming.py +33 -0
- package/content/skills/edit-videos/tests/test_probe.py +34 -0
- package/content/skills/edit-videos/tests/test_render.py +75 -0
- package/content/skills/edit-videos/tests/test_resolve_export.py +324 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_act_coord_clicks.py +206 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_act_cursor_free.py +155 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_act_input_primitives.py +83 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_act_menu.py +14 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_act_menu_interrupt.py +80 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_act_menu_retry.py +55 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_act_pages.py +55 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_banner_frame_geometry.py +46 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_cli.py +156 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_cli_ack.py +88 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_cli_ack_grace.py +113 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_cli_gc.py +107 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_cli_lock_order.py +70 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_cli_operator_interrupt.py +157 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_flows_importing_dialog_titles.py +39 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_flows_jobs_bin_guard.py +26 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_flows_jobs_naming.py +22 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_flows_jobs_subtitle.py +100 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_flows_project_guard.py +57 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_flows_select_timeline.py +270 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_gc.py +203 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_guards_ack.py +172 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_guards_ack_grace.py +51 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_guards_denylist.py +37 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_guards_desktop_move.py +209 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_guards_dialog_allowlist.py +114 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_guards_focus.py +76 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_guards_interrupt.py +162 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_guards_menu_ready.py +48 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_guards_proc_lock.py +49 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_guards_takeover.py +274 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_guards_target_window.py +53 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_job_registry.py +33 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_live.py +67 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_locate_image.py +52 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_locate_search_edit.py +67 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_no_scripting.py +15 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_poll.py +82 -0
- package/content/skills/edit-videos/tests/test_resolve_ui_virtual_desktop.py +54 -0
- package/content/skills/edit-videos/tests/test_schema.py +111 -0
- package/content/skills/edit-videos/tests/test_stdout_json_contract.py +77 -0
- package/content/skills/edit-videos/tests/test_time_mapping.py +59 -0
- package/content/skills/edit-videos/tests/test_timeline.py +227 -0
- package/content/skills/edit-videos/tests/test_timeline_math.py +33 -0
- package/content/skills/edit-videos/tests/test_timeline_math_boundary.py +16 -0
- package/content/skills/edit-videos/tests/test_workspace.py +122 -0
- package/content/skills/edit-videos/tests/test_workspace_gc.py +222 -0
- package/content/skills/edit-videos/tests/test_workspace_guard.py +34 -0
- package/content/skills/edit-videos/tests/test_zoom.py +163 -0
- package/content/skills/edit-videos/uv.lock +593 -0
- package/content/skills/edit-videos/workspace.py +402 -0
- package/lib/agentsEnv.js +4 -0
- package/lib/claims.js +2 -3
- package/lib/doctor.js +6 -2
- package/lib/fsutil.js +79 -1
- package/lib/install.js +11 -5
- package/lib/menu.js +2 -3
- package/lib/pyenv.js +122 -0
- package/lib/uninstall.js +9 -1
- package/lib/update.js +27 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -273,6 +273,40 @@ output tells you the exact command to remove it yourself if you want to.
|
|
|
273
273
|
Uninstalling one of *several* dep-bundles while another is still installed
|
|
274
274
|
leaves the component alone entirely.
|
|
275
275
|
|
|
276
|
+
## Python environments (`python`-kind item field)
|
|
277
|
+
|
|
278
|
+
A `kind:"skill"` item whose deployed directory needs its own locked Python
|
|
279
|
+
dependencies (not just Claude-facing markdown/scripts) declares:
|
|
280
|
+
|
|
281
|
+
```json
|
|
282
|
+
{ "path": "skills/edit-videos", "kind": "skill", "python": { "manager": "uv", "locked": true } }
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
`manager` is currently only `"uv"`; `locked` must be `true` — the CLI never
|
|
286
|
+
resolves a fresh lockfile, only `<manager> sync --locked`. The item's folder
|
|
287
|
+
must ship its own `pyproject.toml` and `uv.lock` (tracked files, same as any
|
|
288
|
+
other content under `path`).
|
|
289
|
+
|
|
290
|
+
1. **After the item's files are copied**, the CLI runs
|
|
291
|
+
`uv sync --locked --no-dev` with `cwd` set to the deployed directory
|
|
292
|
+
(`<target-dir>/<path or targetPath>`), creating `.venv` there —
|
|
293
|
+
see `packages/cli/lib/pyenv.js`. This is install-time only: no network
|
|
294
|
+
access happens when the skill actually runs later.
|
|
295
|
+
2. **Idempotent.** Re-running install/update against an unchanged lockfile
|
|
296
|
+
is a fast no-op — `uv` itself decides that, the CLI always invokes it.
|
|
297
|
+
3. **`.venv`/`__pycache__` are never copied** from the source repo
|
|
298
|
+
(`fsutil.js`'s `walk()` already skips dot-directories and caches) and are
|
|
299
|
+
**never treated as orphaned** by `update` — the CLI never ledger-tracks
|
|
300
|
+
`.venv`, so upstream-removed-file detection can't touch it.
|
|
301
|
+
4. **`uv` missing.** The item's own files still install; the CLI reports
|
|
302
|
+
that one item as `missing-uv` with the exact install command
|
|
303
|
+
(`irm https://astral.sh/uv/install.ps1 | iex`) instead of leaving a
|
|
304
|
+
partial `.venv` — nothing else in the bundle is affected. A `missing-uv`
|
|
305
|
+
or `failed` sync is surfaced again at the very end of the install/update
|
|
306
|
+
run (a "Python environments needing attention" block), not just among
|
|
307
|
+
the per-bundle bullets — easy to miss otherwise.
|
|
308
|
+
5. **Uninstall** removes the item's deployed `.venv` along with its files.
|
|
309
|
+
|
|
276
310
|
## Secrets
|
|
277
311
|
|
|
278
312
|
Some bundles declare `secrets` in `manifest.json` (e.g. `GITLAB_TOKEN` for
|
|
@@ -371,6 +405,14 @@ same way `uninstall` would, and dropped from the ledger.
|
|
|
371
405
|
`install`/`uninstall`.
|
|
372
406
|
- `--json` prints a machine-readable summary (`{ targetBase, bundles, unresolvedConflicts, exitCode }`) instead of prose.
|
|
373
407
|
|
|
408
|
+
**0.18.0:** line-ending-insensitive content hashes; existing ledgers migrate
|
|
409
|
+
automatically. A text file's hash now normalizes CRLF to LF first (binary
|
|
410
|
+
files are unaffected), so a Windows checkout no longer produces a false
|
|
411
|
+
conflict against an LF-deployed copy of the same content. A ledger entry
|
|
412
|
+
written before 0.18.0 still recognizes an unchanged file (via its old
|
|
413
|
+
raw-byte hash) and silently re-baselines to the new hash on the next
|
|
414
|
+
`update` — no action needed, and a real edit is never masked by this.
|
|
415
|
+
|
|
374
416
|
## Uninstall
|
|
375
417
|
|
|
376
418
|
```bash
|
package/bin/cli.js
CHANGED
|
@@ -331,6 +331,13 @@ function installOneBundle({ bundleKey, bundleTitle, targetDir, targetConfig, ite
|
|
|
331
331
|
console.log(` ${mark('ok')} component "${component.key}": wrote ${component.filesWritten.join(', ')} to ${result.targetBase}`);
|
|
332
332
|
}
|
|
333
333
|
}
|
|
334
|
+
for (const py of result.pythonSync || []) {
|
|
335
|
+
if (py.status === 'synced') {
|
|
336
|
+
console.log(` ${mark('ok')} "${py.item}": locked Python env synced (uv sync --locked --no-dev)`);
|
|
337
|
+
}
|
|
338
|
+
// missing-uv/failed are surfaced once more at the very end (see
|
|
339
|
+
// printPythonSyncIssues), not just here among the per-bundle bullets.
|
|
340
|
+
}
|
|
334
341
|
return result;
|
|
335
342
|
}
|
|
336
343
|
|
|
@@ -355,12 +362,28 @@ function printFinalSummary({ installed, skipped, targetBase }) {
|
|
|
355
362
|
for (const label of skipped) {
|
|
356
363
|
console.log(` ${mark('skip')} ${label}`);
|
|
357
364
|
}
|
|
365
|
+
printPythonSyncIssues(installed.map(({ result }) => result));
|
|
358
366
|
console.log(
|
|
359
367
|
`\nInstalled to ${ansi.bold(targetBase)}. Next: ${ansi.dim('agents-cli secrets')} to fill in any skipped ` +
|
|
360
368
|
`secrets, ${ansi.dim('agents-cli update --yes')} to refresh later.`
|
|
361
369
|
);
|
|
362
370
|
}
|
|
363
371
|
|
|
372
|
+
/**
|
|
373
|
+
* A python item's missing-uv/failed status is easy to miss among per-bundle
|
|
374
|
+
* component/hook bullets — surface it again as the last thing printed before
|
|
375
|
+
* any trailing "Next:" hint, across every result passed in (one bundle's
|
|
376
|
+
* `result` from installOneBundle, or the several in printFinalSummary).
|
|
377
|
+
*/
|
|
378
|
+
function printPythonSyncIssues(results) {
|
|
379
|
+
const issues = results.flatMap((r) => (r.pythonSync || []).filter((p) => p.status !== 'synced'));
|
|
380
|
+
if (issues.length === 0) return;
|
|
381
|
+
console.log(`\n${ansi.bold('Python environments needing attention')}`);
|
|
382
|
+
for (const p of issues) {
|
|
383
|
+
console.log(` ${mark('fail')} "${p.item}": ${p.message}`);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
364
387
|
|
|
365
388
|
/**
|
|
366
389
|
* cliVersion recorded by the last install, or null if this machine has none.
|
|
@@ -536,7 +559,7 @@ async function runInstall(argv) {
|
|
|
536
559
|
try {
|
|
537
560
|
const { manifest } = loadManifest(PACKAGE_ROOT);
|
|
538
561
|
const bundle = findBundle(manifest, args.bundle);
|
|
539
|
-
installOneBundle({
|
|
562
|
+
const result = installOneBundle({
|
|
540
563
|
bundleKey: args.bundle,
|
|
541
564
|
bundleTitle: bundle ? bundle.title : args.bundle,
|
|
542
565
|
targetDir: args.targetDir,
|
|
@@ -549,6 +572,7 @@ async function runInstall(argv) {
|
|
|
549
572
|
manifest,
|
|
550
573
|
});
|
|
551
574
|
runSelfProfileStepsIfNeeded({ profile: args.profile, targetDir: args.targetDir });
|
|
575
|
+
printPythonSyncIssues([result]);
|
|
552
576
|
return 0;
|
|
553
577
|
} catch (err) {
|
|
554
578
|
if (err instanceof InstallError || err instanceof ManifestError || err instanceof LedgerError || err instanceof WiringError) {
|
|
@@ -647,6 +671,9 @@ async function runUninstall(argv) {
|
|
|
647
671
|
);
|
|
648
672
|
}
|
|
649
673
|
}
|
|
674
|
+
if (result.pythonEnvsRemoved && result.pythonEnvsRemoved.length > 0) {
|
|
675
|
+
console.log(` Removed locked Python env(s) (.venv) for: ${result.pythonEnvsRemoved.join(', ')}`);
|
|
676
|
+
}
|
|
650
677
|
|
|
651
678
|
// Secrets are shared across bundles (e.g. LITELLM_MASTER_KEY) and kept
|
|
652
679
|
// by default rather than deleted on uninstall — report which of this
|
|
@@ -956,6 +983,8 @@ async function runUpdate(argv) {
|
|
|
956
983
|
}
|
|
957
984
|
}
|
|
958
985
|
|
|
986
|
+
printPythonSyncIssues(result.bundles);
|
|
987
|
+
|
|
959
988
|
if (result.exitCode !== 0) {
|
|
960
989
|
console.error(
|
|
961
990
|
`\n${result.unresolvedConflicts.length} file(s) have unresolved conflicts (edited locally AND changed ` +
|
package/content/global/CLAUDE.md
CHANGED
|
@@ -9,12 +9,19 @@ When planning or modifying work, start a wayfinder map for anything too big for
|
|
|
9
9
|
Never `taskkill /F` or force-stop a shared daemon or another session's process — it can be serving other concurrent chats too (confirmed incident: killing the shared router mid-session broke every other active chat); restart it gracefully via its own scheduled task instead.
|
|
10
10
|
Grill the operator once per new goal to lock scope and shared understanding; once scope is locked, execute autonomously end-to-end without re-confirming each step — grilling gates scope, not execution.
|
|
11
11
|
A new finding or one-off issue surfaced mid-task gets its own PRD/issue tracked separately — do not solve it inline in the same session; nudge the operator to open a new ticket instead.
|
|
12
|
+
Never open a git issue by yourself you need to explain the issue with complete context concisely in terms of customer facing functionality so user can take a decision if this is really an issue. User also want you to find out with thorough investigation if this is really an issue as the pending git issues spam is a real problem.
|
|
12
13
|
Default to plain, simple technical English (ASD-STE100 style) and concise bullets/tables/ASCII diagrams over prose paragraphs.
|
|
13
14
|
In any report to the user, state each result once — never repeat an item already covered earlier in the same response or session.
|
|
15
|
+
When a code bug/defect is mentioned or identified always update the description of the main PRD git issue of that chat session, with the entry in the TODO task list and the status of the fixes in the comments of the PRD git issue.
|
|
16
|
+
Always open a worktree from the latest code of the default branch into your own folder so the work does not clash with ongoing work and it is easy to maintain and push to the default branches. Before committing again make sure you pull the latest from default branch as well.
|
|
17
|
+
Keep code lean: no narrative comments in source (no dates, rulings, ticket refs, doc citations, history, rationale essays) — traceability lives in the GitLab issue/PRD and one-brain only; a comment is at most one line stating a contract or a non-obvious WHY, and removed code leaves no tombstone.
|
|
18
|
+
Always clean up the idle agents after the agent reports or teammate finished and goes to idle state. Keep the TODO task list updated in the chat and PRD git issue.
|
|
19
|
+
The founder uses PowerShell (pwsh), not Git Bash. When giving the founder commands to run themselves, always write pwsh syntax and use the .ps1. This is the last resort if you can't execute and need help.
|
|
20
|
+
Always ship every code after test to the default branch and message other parallel chats in that repository to pull the latest this way code management is organized do not leave uncommitted files as you go along.
|
|
14
21
|
|
|
15
22
|
## Model Routing (HARD RULE)
|
|
16
23
|
|
|
17
|
-
The main-loop model (Fable/Opus) is a scarce planning resource; burn Sonnet, not Fable.
|
|
24
|
+
The main-loop model (Fable/Opus) is a scarce orchestration and planning resource; burn Sonnet, not Fable/Opus as subagents.
|
|
18
25
|
|
|
19
26
|
| Work | Who does it |
|
|
20
27
|
|---|---|
|
|
@@ -34,7 +41,7 @@ At the start of every session, before substantive work, call `mcp__claude_ai_one
|
|
|
34
41
|
|
|
35
42
|
**Save without asking.** When a session produces an architecture decision, bug fix, new convention, or structural/config change — especially to shared or global harness config, hooks, or any cross-project infrastructure — call `remember()` immediately in the same turn, without asking the user for permission first. Never ask "want me to save this to memory?" as a question; just do it. The only time it's appropriate to ask is genuine scope ambiguity — e.g. uncertainty about whether something is project-specific (`project=` param) or should be global (omit `project=`) — and even then, default to a reasonable guess and only ask if genuinely unclear, don't block on it.
|
|
36
43
|
|
|
37
|
-
**Surprise logging.**
|
|
44
|
+
**Surprise logging.** After investigating and due diligence if it is a revelation — log it to one-brain as BOTH `log_episode` and `remember` and also update the relevant PRDs and docs with the information fanning out. Applies whether the underlying task succeeds or fails.
|
|
38
45
|
|
|
39
46
|
## Codify Over Instruct
|
|
40
47
|
|
package/content/manifest.json
CHANGED
|
@@ -187,6 +187,11 @@
|
|
|
187
187
|
"type": "command",
|
|
188
188
|
"command": "python ~/.claude/proxy/code_is_law_lint_hook.py"
|
|
189
189
|
}
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"path": "proxy/headless_process.py",
|
|
193
|
+
"kind": "hook",
|
|
194
|
+
"note": "Shared no-visible-window subprocess wrapper (headless_run/headless_popen) imported by code_is_law_lint_hook.py — not wired to an event itself."
|
|
190
195
|
}
|
|
191
196
|
],
|
|
192
197
|
"deps": [],
|
|
@@ -319,6 +324,11 @@
|
|
|
319
324
|
"command": "python ~/.claude/proxy/artifact_mocker_gate.py"
|
|
320
325
|
}
|
|
321
326
|
},
|
|
327
|
+
{
|
|
328
|
+
"path": "proxy/headless_process.py",
|
|
329
|
+
"kind": "hook",
|
|
330
|
+
"note": "Shared no-visible-window subprocess wrapper (headless_run/headless_popen) imported by artifact_mocker_gate.py — not wired to an event itself."
|
|
331
|
+
},
|
|
322
332
|
{
|
|
323
333
|
"path": "proxy/html_mocker_prompt_nudge.py",
|
|
324
334
|
"kind": "hook",
|
|
@@ -511,6 +521,11 @@
|
|
|
511
521
|
"advancedOnly": true,
|
|
512
522
|
"note": "Shared route-classification library imported by triage_gate_hook.py and (self-profile) agent_model_guard.py — not wired to an event itself."
|
|
513
523
|
},
|
|
524
|
+
{
|
|
525
|
+
"path": "proxy/headless_process.py",
|
|
526
|
+
"kind": "hook",
|
|
527
|
+
"note": "Shared no-visible-window subprocess wrapper (headless_run/headless_popen) imported by bg_process_registry.py, execution_worker_review_gate.py, and route_lock.py in this bundle, plus hooks in other bundles — not wired to an event itself."
|
|
528
|
+
},
|
|
514
529
|
{
|
|
515
530
|
"path": "proxy/agents_env.py",
|
|
516
531
|
"kind": "hook",
|
|
@@ -760,6 +775,16 @@
|
|
|
760
775
|
"kind": "infra",
|
|
761
776
|
"note": "Registered PreToolUse Bash hook in settings.json, unscoped like publish_guard.py — blocks credential mutation/exposure for main session and every subagent."
|
|
762
777
|
},
|
|
778
|
+
{
|
|
779
|
+
"path": "proxy/headless_spawn_guard.py",
|
|
780
|
+
"kind": "infra",
|
|
781
|
+
"note": "Registered PreToolUse Bash|PowerShell hook in settings.json, unscoped like publish_guard.py — denies visible-window spawns (start/Start-Process without -WindowStyle Hidden/-NoNewWindow)."
|
|
782
|
+
},
|
|
783
|
+
{
|
|
784
|
+
"path": "proxy/headless_process.py",
|
|
785
|
+
"kind": "infra",
|
|
786
|
+
"note": "Shared no-visible-window subprocess wrapper (headless_run/headless_popen) imported by headless_spawn_guard.py and every other self-infra hook that shells out — not wired to an event itself."
|
|
787
|
+
},
|
|
763
788
|
{
|
|
764
789
|
"path": "proxy/gitlab_mutation_guard.py",
|
|
765
790
|
"kind": "infra",
|
|
@@ -770,6 +795,11 @@
|
|
|
770
795
|
"kind": "infra",
|
|
771
796
|
"note": "Registered PreToolUse Agent hook in settings.json."
|
|
772
797
|
},
|
|
798
|
+
{
|
|
799
|
+
"path": "proxy/worktree_targets.py",
|
|
800
|
+
"kind": "infra",
|
|
801
|
+
"note": "Shared `worktree:` dispatch-prompt parser imported by agent_model_guard.py — byte-identical to social-manager/scripts/worktree_targets.py, not wired to an event itself."
|
|
802
|
+
},
|
|
773
803
|
{
|
|
774
804
|
"path": "proxy/validate_dispatch_tiers.py",
|
|
775
805
|
"kind": "infra",
|
|
@@ -1228,6 +1258,50 @@
|
|
|
1228
1258
|
],
|
|
1229
1259
|
"deps": [],
|
|
1230
1260
|
"secrets": []
|
|
1261
|
+
},
|
|
1262
|
+
{
|
|
1263
|
+
"key": "video-editing",
|
|
1264
|
+
"title": "Video Editing (DaVinci Resolve)",
|
|
1265
|
+
"summary": "Edit video through a local ffmpeg/OpenCV engine (cut/trim/blur/caption/export) and hand off timelines to DaVinci Resolve's UI, with a prompt-intent nudge and a guard against Resolve Fusion Scripts-folder writes",
|
|
1266
|
+
"profile": "public",
|
|
1267
|
+
"advanced": false,
|
|
1268
|
+
"items": [
|
|
1269
|
+
{
|
|
1270
|
+
"path": "skills/edit-videos",
|
|
1271
|
+
"kind": "skill",
|
|
1272
|
+
"python": {
|
|
1273
|
+
"manager": "uv",
|
|
1274
|
+
"locked": true
|
|
1275
|
+
},
|
|
1276
|
+
"exclude": ["tests/"]
|
|
1277
|
+
},
|
|
1278
|
+
{
|
|
1279
|
+
"path": "proxy/edit_videos_intent_hook.py",
|
|
1280
|
+
"kind": "hook",
|
|
1281
|
+
"wiring": {
|
|
1282
|
+
"event": "UserPromptSubmit",
|
|
1283
|
+
"type": "command",
|
|
1284
|
+
"command": "python ~/.claude/proxy/edit_videos_intent_hook.py"
|
|
1285
|
+
}
|
|
1286
|
+
},
|
|
1287
|
+
{
|
|
1288
|
+
"path": "proxy/resolve_policy_guard.py",
|
|
1289
|
+
"kind": "hook",
|
|
1290
|
+
"wiring": {
|
|
1291
|
+
"event": "PreToolUse",
|
|
1292
|
+
"matcher": "Write|Edit|NotebookEdit|Bash|PowerShell",
|
|
1293
|
+
"type": "command",
|
|
1294
|
+
"command": "python ~/.claude/proxy/resolve_policy_guard.py"
|
|
1295
|
+
}
|
|
1296
|
+
},
|
|
1297
|
+
{
|
|
1298
|
+
"path": "proxy/git_shell_parse.py",
|
|
1299
|
+
"kind": "hook",
|
|
1300
|
+
"note": "Shared, project-agnostic shell-command parsing helpers (quote/heredoc/substitution-aware segment split) used by resolve_policy_guard.py to split Bash/PowerShell commands before scanning them — not wired to an event itself. Also claimed by agent-orchestration and self-infra; safe to double-claim."
|
|
1301
|
+
}
|
|
1302
|
+
],
|
|
1303
|
+
"deps": [],
|
|
1304
|
+
"secrets": []
|
|
1231
1305
|
}
|
|
1232
1306
|
],
|
|
1233
1307
|
"internal": [
|
|
@@ -117,12 +117,28 @@
|
|
|
117
117
|
},
|
|
118
118
|
"exclude": {
|
|
119
119
|
"type": "array",
|
|
120
|
-
"description": "Repo-relative-to-item-root
|
|
120
|
+
"description": "Repo-relative-to-item-root paths (POSIX separators) to skip when installing this item's folder. An entry ending in \"/\" excludes every file under that folder prefix (e.g. \"tests/\"); any other entry is an exact file match. Honored by fsutil.js's isExcluded() (install.js, claims.js, menu.js, update.js); excluded files still count as claimed (do not also list them in internal[]).",
|
|
121
121
|
"items": { "type": "string", "minLength": 1 }
|
|
122
122
|
},
|
|
123
123
|
"note": {
|
|
124
124
|
"type": "string",
|
|
125
125
|
"description": "Optional clarifying text for non-obvious items (e.g. an mcp item whose path points at a shared multi-server file)."
|
|
126
|
+
},
|
|
127
|
+
"python": {
|
|
128
|
+
"description": "Marks a kind:\"skill\" item's deployed directory as having a locked Python env (pyproject.toml + a lockfile matching `manager`, both shipped inside `path`/`targetPath`). After the item's files are copied, the CLI runs `<manager> sync --locked --no-dev` in the deployed directory (install-time only, no network at skill runtime), creating `.venv` there — see packages/cli/lib/pyenv.js. Idempotent: a re-run against an unchanged lockfile is a fast no-op. `.venv` and `__pycache__` are never copied (fsutil.js's walk() skips dot-directories/caches) and never treated as orphaned (the CLI never ledger-tracks them, so update's upstream-removed detection can't touch them). Uninstalling the item removes its `.venv` with the rest.",
|
|
129
|
+
"$ref": "#/$defs/pythonEnv"
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"pythonEnv": {
|
|
134
|
+
"type": "object",
|
|
135
|
+
"additionalProperties": false,
|
|
136
|
+
"required": ["manager", "locked"],
|
|
137
|
+
"properties": {
|
|
138
|
+
"manager": { "type": "string", "enum": ["uv"] },
|
|
139
|
+
"locked": {
|
|
140
|
+
"type": "boolean",
|
|
141
|
+
"description": "Must be true — the only supported mode is `<manager> sync --locked`, never resolving a fresh lockfile at install time."
|
|
126
142
|
}
|
|
127
143
|
}
|
|
128
144
|
},
|
|
@@ -58,13 +58,13 @@ Original checks, retained semantics (first correction wins where relevant):
|
|
|
58
58
|
per-agent `dispatch_tier:` frontmatter declaration (see route_lock.py's
|
|
59
59
|
agent_dispatch_tier/list_agents_by_tier — never a hardcoded roster, so
|
|
60
60
|
it stays correct for any farm-style project): `dispatch_tier:
|
|
61
|
-
mandatory-review`
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
mandatory-review` bypasses the route lock the same way `dispatch_tier:
|
|
62
|
+
safe` does, but marks a pending-review flag that execution_worker_review_gate.py
|
|
63
|
+
checks before allowing `git commit`. A target that has adopted
|
|
64
|
+
scripts/review_pass.py clears that flag only via a verified stamp, never
|
|
65
|
+
by a dispatch; a target without it keeps the older behavior, where
|
|
65
66
|
dispatching an agent whose frontmatter declares `clears_review: true`
|
|
66
|
-
|
|
67
|
-
(route_lock.clear_pending_review).
|
|
67
|
+
clears the flag directly (route_lock.clear_pending_review).
|
|
68
68
|
|
|
69
69
|
Fails OPEN (prints nothing, exit 0) on any unexpected exception, missing
|
|
70
70
|
registry file, or malformed stdin — mirrors agent_dispatch_guard.py.
|
|
@@ -87,9 +87,11 @@ import json
|
|
|
87
87
|
import re
|
|
88
88
|
import secrets
|
|
89
89
|
import socket
|
|
90
|
+
import time
|
|
90
91
|
|
|
91
92
|
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
92
93
|
import route_lock
|
|
94
|
+
import worktree_targets
|
|
93
95
|
|
|
94
96
|
PROXY_HOST = "127.0.0.1"
|
|
95
97
|
PROXY_PORT = 3456
|
|
@@ -251,6 +253,49 @@ DEFAULT_WORKER_MODEL = "sonnet" # must be one of sonnet/opus/haiku/fable; the A
|
|
|
251
253
|
# dispatch with a schema validation error, confirmed in production 2026-07-05.
|
|
252
254
|
|
|
253
255
|
|
|
256
|
+
def _parse_worktree_targets(prompt: str) -> list[str]:
|
|
257
|
+
return worktree_targets.parse_worktree_targets(prompt)
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
def _mark_pending_review_per_target(cwd: str, prompt: str) -> None:
|
|
261
|
+
"""Marks each `worktree:`-named target's OWN pending flag when it
|
|
262
|
+
has adopted scripts/review_pass.py (per-target design) — bypassing
|
|
263
|
+
route_lock's shared git-common-dir root so a worktree's flag never
|
|
264
|
+
collapses onto its main checkout. A target without scripts/review_pass.py,
|
|
265
|
+
or no `worktree:` line at all, keeps the exact old cwd-keyed behavior."""
|
|
266
|
+
targets = _parse_worktree_targets(prompt)
|
|
267
|
+
if not targets:
|
|
268
|
+
route_lock.mark_pending_review(cwd)
|
|
269
|
+
return
|
|
270
|
+
for target in targets:
|
|
271
|
+
if os.path.isfile(os.path.join(target, "scripts", "review_pass.py")):
|
|
272
|
+
marker = os.path.join(target, ".claude", ".pending_review.json")
|
|
273
|
+
try:
|
|
274
|
+
os.makedirs(os.path.dirname(marker), exist_ok=True)
|
|
275
|
+
with open(marker, "w", encoding="utf-8") as fh:
|
|
276
|
+
json.dump({"pending_review": True, "ts": time.time()}, fh)
|
|
277
|
+
except Exception:
|
|
278
|
+
pass
|
|
279
|
+
else:
|
|
280
|
+
route_lock.mark_pending_review(target)
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
def _clear_pending_review_per_target(cwd: str, prompt: str) -> None:
|
|
284
|
+
"""Mirrors _mark_pending_review_per_target: clears each `worktree:`-named
|
|
285
|
+
target's OWN pending flag on a `clears_review: true` dispatch — but only
|
|
286
|
+
for a target that has NOT adopted scripts/review_pass.py. A target with
|
|
287
|
+
review_pass.py clears its flag exclusively via a verified stamp
|
|
288
|
+
(commit_repo.py's _check_review_stamp), never by a mere dispatch."""
|
|
289
|
+
targets = _parse_worktree_targets(prompt)
|
|
290
|
+
if not targets:
|
|
291
|
+
if not os.path.isfile(os.path.join(cwd, "scripts", "review_pass.py")):
|
|
292
|
+
route_lock.clear_pending_review(cwd)
|
|
293
|
+
return
|
|
294
|
+
for target in targets:
|
|
295
|
+
if not os.path.isfile(os.path.join(target, "scripts", "review_pass.py")):
|
|
296
|
+
route_lock.clear_pending_review(target)
|
|
297
|
+
|
|
298
|
+
|
|
254
299
|
def _deny(reason: str) -> None:
|
|
255
300
|
print(json.dumps({
|
|
256
301
|
"hookSpecificOutput": {
|
|
@@ -402,13 +447,14 @@ def _safe_main() -> None:
|
|
|
402
447
|
# frontmatter (route_lock.agent_dispatch_tier), never a hardcoded roster,
|
|
403
448
|
# so this stays correct for any farm-style project.
|
|
404
449
|
dispatch_tier = route_lock.agent_dispatch_tier(subagent_type, cwd) if subagent_type else None
|
|
405
|
-
if dispatch_tier == "
|
|
406
|
-
if route_lock.agent_clears_review(subagent_type, cwd) and route_lock.is_farm_style_project(cwd):
|
|
407
|
-
route_lock.clear_pending_review(cwd)
|
|
408
|
-
pass
|
|
409
|
-
elif dispatch_tier == "mandatory-review":
|
|
450
|
+
if dispatch_tier == "mandatory-review":
|
|
410
451
|
if route_lock.is_farm_style_project(cwd):
|
|
411
|
-
|
|
452
|
+
_mark_pending_review_per_target(cwd, prompt)
|
|
453
|
+
elif dispatch_tier == "safe":
|
|
454
|
+
# A target that has adopted scripts/review_pass.py clears its flag
|
|
455
|
+
# only via a verified stamp, never here — see _clear_pending_review_per_target.
|
|
456
|
+
if route_lock.agent_clears_review(subagent_type, cwd) and route_lock.is_farm_style_project(cwd):
|
|
457
|
+
_clear_pending_review_per_target(cwd, prompt)
|
|
412
458
|
elif subagent_type and _find_agent_file(subagent_type, cwd) and route_lock.is_farm_style_project(cwd):
|
|
413
459
|
lock = route_lock.read_lock(cwd)
|
|
414
460
|
if lock:
|
|
@@ -38,6 +38,14 @@ import json
|
|
|
38
38
|
import subprocess
|
|
39
39
|
import time
|
|
40
40
|
from pathlib import Path
|
|
41
|
+
from typing import Any
|
|
42
|
+
|
|
43
|
+
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
44
|
+
try:
|
|
45
|
+
from headless_process import headless_run # noqa: E402
|
|
46
|
+
except Exception: # pragma: no cover - defensive, fail open (no window suppression)
|
|
47
|
+
def headless_run(*args: Any, **kw: Any) -> subprocess.CompletedProcess:
|
|
48
|
+
return subprocess.run(*args, **kw)
|
|
41
49
|
|
|
42
50
|
MOCKER = Path.home() / ".claude" / "skills" / "html-mocker" / "mocker.py"
|
|
43
51
|
LOG = Path.home() / ".claude" / "logs" / "artifact_mocker_gate.log"
|
|
@@ -130,7 +138,7 @@ def _safe_main() -> None:
|
|
|
130
138
|
return # html-mocker not deployed on this machine -> allow
|
|
131
139
|
|
|
132
140
|
try:
|
|
133
|
-
proc =
|
|
141
|
+
proc = headless_run(
|
|
134
142
|
[sys.executable, str(MOCKER), file_path, "--json"],
|
|
135
143
|
capture_output=True,
|
|
136
144
|
text=True,
|
|
@@ -35,6 +35,14 @@ import subprocess
|
|
|
35
35
|
import sys
|
|
36
36
|
import time
|
|
37
37
|
import uuid
|
|
38
|
+
from typing import Any
|
|
39
|
+
|
|
40
|
+
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
41
|
+
try:
|
|
42
|
+
from headless_process import headless_run # noqa: E402
|
|
43
|
+
except Exception: # pragma: no cover - defensive, fail open (no window suppression)
|
|
44
|
+
def headless_run(*args: Any, **kw: Any) -> subprocess.CompletedProcess:
|
|
45
|
+
return subprocess.run(*args, **kw)
|
|
38
46
|
|
|
39
47
|
HOME = os.path.expanduser("~")
|
|
40
48
|
STATE_DIR = os.environ.get("BG_PROCESS_STATE_DIR_OVERRIDE") or os.path.join(HOME, ".claude", "logs")
|
|
@@ -256,7 +264,7 @@ def _find_matching_pids(entry: dict) -> list[int]:
|
|
|
256
264
|
env["BG_REAPER_FRAGMENT"] = fragment
|
|
257
265
|
env["BG_REAPER_MIN_DATE"] = launch_dt
|
|
258
266
|
try:
|
|
259
|
-
result =
|
|
267
|
+
result = headless_run(
|
|
260
268
|
["powershell", "-NoProfile", "-Command", _PS_MATCH_SCRIPT],
|
|
261
269
|
capture_output=True, text=True, timeout=20, env=env,
|
|
262
270
|
)
|
|
@@ -274,7 +282,7 @@ def _find_matching_pids(entry: dict) -> list[int]:
|
|
|
274
282
|
|
|
275
283
|
def kill_pid_tree(pid: int) -> bool:
|
|
276
284
|
try:
|
|
277
|
-
result =
|
|
285
|
+
result = headless_run(
|
|
278
286
|
["taskkill", "/PID", str(pid), "/T", "/F"],
|
|
279
287
|
capture_output=True, text=True, timeout=20,
|
|
280
288
|
)
|
|
@@ -317,7 +325,7 @@ def is_spine_claimed(pid: int, cwd: str | None) -> bool:
|
|
|
317
325
|
if script is None:
|
|
318
326
|
return False
|
|
319
327
|
try:
|
|
320
|
-
result =
|
|
328
|
+
result = headless_run(
|
|
321
329
|
[sys.executable, script, "check-claimed-by-pid", "--pid", str(pid)],
|
|
322
330
|
capture_output=True, text=True, timeout=15,
|
|
323
331
|
)
|
|
@@ -352,7 +360,7 @@ def sweep_spine_dead_locks(cwd: str | None) -> None:
|
|
|
352
360
|
if script is None:
|
|
353
361
|
return
|
|
354
362
|
try:
|
|
355
|
-
|
|
363
|
+
headless_run(
|
|
356
364
|
[sys.executable, script, "reap-sweep"],
|
|
357
365
|
capture_output=True, text=True, timeout=15,
|
|
358
366
|
)
|
|
@@ -15,6 +15,14 @@ if os.environ.get("CLAUDE_HOOK_CHILD"):
|
|
|
15
15
|
import json
|
|
16
16
|
import subprocess
|
|
17
17
|
from pathlib import Path
|
|
18
|
+
from typing import Any
|
|
19
|
+
|
|
20
|
+
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
21
|
+
try:
|
|
22
|
+
from headless_process import headless_run # noqa: E402
|
|
23
|
+
except Exception: # pragma: no cover - defensive, fail open (no window suppression)
|
|
24
|
+
def headless_run(*args: Any, **kw: Any) -> subprocess.CompletedProcess:
|
|
25
|
+
return subprocess.run(*args, **kw)
|
|
18
26
|
|
|
19
27
|
LINT = Path.home() / ".claude" / "skills" / "code-is-law" / "lint_skill.py"
|
|
20
28
|
|
|
@@ -35,7 +43,7 @@ def main() -> int:
|
|
|
35
43
|
if not file_path or not is_target(file_path) or not LINT.is_file():
|
|
36
44
|
return 0
|
|
37
45
|
|
|
38
|
-
result =
|
|
46
|
+
result = headless_run([sys.executable, str(LINT), file_path],
|
|
39
47
|
capture_output=True, text=True)
|
|
40
48
|
if result.returncode == 0:
|
|
41
49
|
return 0
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""edit_videos_intent_hook.py — UserPromptSubmit nudge for the edit-videos skill."""
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
# CLAUDE_HOOK_CHILD guard: hook-spawned child claude processes set this so
|
|
6
|
+
# this hook never re-fires recursively. Must run before any other I/O.
|
|
7
|
+
import os, sys
|
|
8
|
+
if os.environ.get("CLAUDE_HOOK_CHILD"):
|
|
9
|
+
sys.exit(0)
|
|
10
|
+
|
|
11
|
+
import json
|
|
12
|
+
import re
|
|
13
|
+
|
|
14
|
+
_NUDGE = (
|
|
15
|
+
"EDIT-VIDEOS INTENT MATCH: this message matches the edit-videos skill's "
|
|
16
|
+
"own documented trigger conditions. Invoke the edit-videos skill (via the "
|
|
17
|
+
"Skill tool) instead of ad-hoc ffmpeg calls or manual DaVinci Resolve "
|
|
18
|
+
"clicking — it edits video through a local engine (edit-spec driven "
|
|
19
|
+
"cut/trim/blur/caption/export) and can drive Resolve's normal UI for "
|
|
20
|
+
"timeline import/handoff. See ~/.claude/skills/edit-videos/SKILL.md for "
|
|
21
|
+
"the full command table."
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
# Unambiguous: fire regardless of any negative match.
|
|
25
|
+
STRONG_PATTERNS = [
|
|
26
|
+
r"\bedit(?:ing)?\s+(?:this |my |the |a )?(?:video|videos)\b(?!\s*games?)",
|
|
27
|
+
r"\bedit(?:ing)?\s+(?:this |my |the |a )?(?:recording|footage|clip)\b",
|
|
28
|
+
r"\b(?:cut|trim|blur|caption|crop|mute)\s+(?:this |my |the |a )?(?:video|recording|footage|clip|timeline)\b(?!\s*games?)",
|
|
29
|
+
r"\bblur\s+(?:out\s+)?(?:my |the |a )?(?:face|screen|background)\s+in\s+(?:this |my |the )?(?:video|recording|footage|clip)\b",
|
|
30
|
+
r"\badd\s+captions?\s+to\s+(?:this |my |the |a )?(?:video|recording|footage|clip)\b",
|
|
31
|
+
r"\bdavinci\s*resolve\b",
|
|
32
|
+
r"\bexport\s+(?:it\s+|this\s+)?under\s+\d+\s*mb\b",
|
|
33
|
+
r"\bmake\s+a\s+(?:tiktok|reel|short|shorts)\s+(?:from|out\s+of|of)\s+(?:this |my |the )?(?:recording|video|footage|clip)\b",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
# Ambiguous "resolve" mentions: fire only if no NEGATIVE_PATTERNS match.
|
|
37
|
+
WEAK_PATTERNS = [
|
|
38
|
+
r"\bresolve\s+timeline\b",
|
|
39
|
+
r"\b(?:in|into|to|from|inside|open)\s+resolve\b",
|
|
40
|
+
r"\bresolve'?s\s+(?:timeline|edit\s+page|deliver|media\s+pool)\b",
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
NEGATIVE_PATTERNS = [
|
|
44
|
+
r"\bresolve\s+(?:this|the|my|that)?\s*(?:merge\s+)?conflicts?\b",
|
|
45
|
+
r"\bresolve\s+(?:this|the|my|that)?\s*(?:issue|bug|ticket|error|exception|pr\b|pull\s+request)\b",
|
|
46
|
+
r"\bconflict\s+resolution\b",
|
|
47
|
+
r"\bvideo\s+(?:call|chat|conferenc\w*|game)\b",
|
|
48
|
+
r"\bresolve\s+(?:this|the)?\s*(?:name|dns|dependency|dependencies|import|reference|path)s?\b",
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
_SKILL_MENTION_RE = re.compile(r"(?<![\w-])/?edit-videos(?![\w-])", re.IGNORECASE)
|
|
52
|
+
_STRONG_RE = [re.compile(p, re.IGNORECASE) for p in STRONG_PATTERNS]
|
|
53
|
+
_WEAK_RE = [re.compile(p, re.IGNORECASE) for p in WEAK_PATTERNS]
|
|
54
|
+
_NEGATIVE_RE = [re.compile(p, re.IGNORECASE) for p in NEGATIVE_PATTERNS]
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _emit() -> None:
|
|
58
|
+
print(json.dumps({
|
|
59
|
+
"hookSpecificOutput": {
|
|
60
|
+
"hookEventName": "UserPromptSubmit",
|
|
61
|
+
"additionalContext": _NUDGE,
|
|
62
|
+
}
|
|
63
|
+
}))
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def _safe_main() -> None:
|
|
67
|
+
try:
|
|
68
|
+
# sys.stdin.read() decodes via the console/locale codepage (cp1252 on
|
|
69
|
+
# Windows) and mangles non-ASCII prompt bytes; decode raw UTF-8 instead.
|
|
70
|
+
raw = sys.stdin.buffer.read().decode("utf-8")
|
|
71
|
+
data = json.loads(raw or "{}")
|
|
72
|
+
except Exception:
|
|
73
|
+
return
|
|
74
|
+
if data.get("hook_event_name") != "UserPromptSubmit":
|
|
75
|
+
return
|
|
76
|
+
prompt = (data.get("prompt") or "").strip()
|
|
77
|
+
if not prompt:
|
|
78
|
+
return
|
|
79
|
+
|
|
80
|
+
if _SKILL_MENTION_RE.search(prompt):
|
|
81
|
+
_emit()
|
|
82
|
+
return
|
|
83
|
+
if any(rx.search(prompt) for rx in _STRONG_RE):
|
|
84
|
+
_emit()
|
|
85
|
+
return
|
|
86
|
+
if any(rx.search(prompt) for rx in _NEGATIVE_RE):
|
|
87
|
+
return
|
|
88
|
+
if any(rx.search(prompt) for rx in _WEAK_RE):
|
|
89
|
+
_emit()
|
|
90
|
+
return
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
if __name__ == "__main__":
|
|
94
|
+
try:
|
|
95
|
+
_safe_main()
|
|
96
|
+
except Exception:
|
|
97
|
+
pass # never wedge Claude Code
|