refactor(halcon): single-skill plugin layout → invoke as /halcon (not /halcon:halcon)
Move SKILL.md + references/ scripts/ evals/ from skills/halcon/ up to the plugin root. Per Claude Code plugins-reference, a plugin with SKILL.md at its root and no skills/ subdir is auto-loaded as a single-skill plugin (v2.1.142+), so the invocation name = frontmatter name = halcon → clean /halcon. Bump plugin.json 2.0.0 → 2.0.1 so existing installs receive the update. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Executable
+56
@@ -0,0 +1,56 @@
|
||||
"""Run a whole HDevelop program (.hdev) via HDevEngine and read control vars back.
|
||||
|
||||
Use when the logic lives in a program's main rather than a parameterized
|
||||
procedure. Outputs print as a JSON object on stdout.
|
||||
|
||||
Example:
|
||||
/mnt/c/Users/NAURA/.local/bin/uv.exe run python \
|
||||
.claude/skills/halcon/scripts/run_program.py \
|
||||
--program C:/workspace/agent-studio/halcon-001/demo_prog.hdev \
|
||||
--get Total --get Area --get Message
|
||||
|
||||
Notes:
|
||||
- The program must be self-contained and non-interactive (no draw_*, no stop()).
|
||||
- Use ABSOLUTE paths inside the program (no cwd notion under HDevEngine).
|
||||
"""
|
||||
import argparse
|
||||
import json
|
||||
import sys
|
||||
|
||||
from _common import jsonable
|
||||
|
||||
|
||||
def main() -> int:
|
||||
ap = argparse.ArgumentParser(description="Run a HALCON .hdev via HDevEngine")
|
||||
ap.add_argument("--program", required=True, help="Absolute path to the .hdev")
|
||||
ap.add_argument("--get", dest="gets", action="append", default=[],
|
||||
metavar="Name", help="Control variable to read (repeatable)")
|
||||
args = ap.parse_args()
|
||||
|
||||
try:
|
||||
from halcon.hdevengine import HDevProgram, HDevProgramCall, HDevEngineError
|
||||
except Exception as e:
|
||||
print(f"ERROR: cannot import HDevEngine ({e}). Run via the project venv "
|
||||
f"using uv.", file=sys.stderr)
|
||||
return 1
|
||||
|
||||
program = HDevProgram(args.program)
|
||||
call = HDevProgramCall(program)
|
||||
try:
|
||||
call.execute()
|
||||
except HDevEngineError as e:
|
||||
print(json.dumps({"ok": False, "error": str(e)}, ensure_ascii=False))
|
||||
return 3
|
||||
|
||||
out = {}
|
||||
for name in args.gets:
|
||||
try:
|
||||
out[name] = jsonable(call.get_control_var_by_name(name))
|
||||
except HDevEngineError as e:
|
||||
out[name] = {"error": str(e)}
|
||||
print(json.dumps({"ok": True, "vars": out}, ensure_ascii=False))
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Reference in New Issue
Block a user