prizmkit 1.1.189 → 1.1.191

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.
Files changed (49) hide show
  1. package/bin/create-prizmkit.js +4 -4
  2. package/bundled/VERSION.json +3 -3
  3. package/bundled/adapters/antigravity/assets/prizmkit-hook.cjs +150 -0
  4. package/bundled/adapters/antigravity/hooks-adapter.js +195 -0
  5. package/bundled/adapters/antigravity/paths.js +14 -0
  6. package/bundled/adapters/antigravity/rules-adapter.js +54 -0
  7. package/bundled/adapters/antigravity/skill-adapter.js +29 -0
  8. package/bundled/dev-pipeline/README.md +16 -5
  9. package/bundled/dev-pipeline/prizmkit_runtime/config.py +13 -2
  10. package/bundled/dev-pipeline/prizmkit_runtime/gitops.py +12 -12
  11. package/bundled/dev-pipeline/prizmkit_runtime/platform_detection.py +13 -4
  12. package/bundled/dev-pipeline/prizmkit_runtime/runners.py +8 -2
  13. package/bundled/dev-pipeline/prizmkit_runtime/sessions.py +186 -24
  14. package/bundled/dev-pipeline/prizmkit_runtime/status.py +2 -0
  15. package/bundled/dev-pipeline/scripts/parse-stream-progress.py +305 -17
  16. package/bundled/dev-pipeline/scripts/utils.py +5 -3
  17. package/bundled/dev-pipeline/tests/live_ai_cli_log_smoke.py +1 -0
  18. package/bundled/dev-pipeline/tests/test_python_runner_parity.py +135 -0
  19. package/bundled/dev-pipeline/tests/test_unified_cli.py +363 -0
  20. package/bundled/rules/USAGE.md +1 -0
  21. package/bundled/skills/_metadata.json +1 -1
  22. package/bundled/skills/bug-planner/SKILL.md +29 -31
  23. package/bundled/skills/bug-planner/references/generated-plan-review.md +19 -23
  24. package/bundled/skills/bug-planner/scripts/validate-bug-list.py +11 -0
  25. package/bundled/skills/feature-planner/SKILL.md +22 -22
  26. package/bundled/skills/feature-planner/references/generated-plan-review.md +19 -23
  27. package/bundled/skills/feature-planner/references/incremental-feature-planning.md +7 -7
  28. package/bundled/skills/feature-planner/references/new-project-planning.md +7 -7
  29. package/bundled/skills/feature-planner/scripts/validate-and-generate.py +11 -0
  30. package/bundled/skills/prizmkit-init/SKILL.md +1 -1
  31. package/bundled/skills/prizmkit-init/references/config-schema.md +2 -2
  32. package/bundled/skills/prizmkit-prizm-docs/assets/prizm-docs-format.md +1 -1
  33. package/bundled/skills/prizmkit-prizm-docs/references/op-init.md +1 -1
  34. package/bundled/skills/refactor-planner/SKILL.md +23 -25
  35. package/bundled/skills/refactor-planner/references/fast-path.md +4 -4
  36. package/bundled/skills/refactor-planner/references/generated-plan-review.md +19 -23
  37. package/bundled/skills/refactor-planner/scripts/validate-and-generate-refactor.py +11 -0
  38. package/package.json +1 -1
  39. package/src/ai-cli-launch.js +1 -1
  40. package/src/clean.js +40 -4
  41. package/src/config.js +64 -4
  42. package/src/detect-platform.js +10 -6
  43. package/src/external-skills.js +2 -2
  44. package/src/index.js +1 -0
  45. package/src/manifest.js +1 -1
  46. package/src/platforms.js +6 -2
  47. package/src/prompts.js +11 -3
  48. package/src/scaffold.js +59 -4
  49. package/src/upgrade.js +9 -3
@@ -9,10 +9,10 @@ from collections.abc import Mapping
9
9
  from dataclasses import dataclass
10
10
  from pathlib import Path
11
11
 
12
- SUPPORTED_PLATFORMS = ("claude", "codex", "codebuddy", "pi", "cursor")
13
- PLATFORM_IDS = ("codebuddy", "claude", "codex", "pi", "cursor")
12
+ SUPPORTED_PLATFORMS = ("claude", "codex", "codebuddy", "pi", "cursor", "antigravity")
13
+ PLATFORM_IDS = ("codebuddy", "claude", "codex", "pi", "cursor", "antigravity")
14
14
  PLATFORM_INPUT_HELP = (
15
- "codebuddy, claude, codex, pi, cursor, a comma-separated list of those, or all"
15
+ "codebuddy, claude, codex, pi, cursor, antigravity, a comma-separated list of those, or all"
16
16
  )
17
17
  _CLI_BY_PLATFORM = {
18
18
  "codebuddy": "cbc",
@@ -20,6 +20,7 @@ _CLI_BY_PLATFORM = {
20
20
  "codex": "codex",
21
21
  "pi": "pi",
22
22
  "cursor": "agent",
23
+ "antigravity": "agy",
23
24
  }
24
25
 
25
26
 
@@ -58,6 +59,7 @@ _PLATFORM_MARKERS = {
58
59
  "codebuddy": (".codebuddy/skills",),
59
60
  "pi": (".pi/skills",),
60
61
  "cursor": (".cursor/skills", ".cursor/rules"),
62
+ "antigravity": (".agents/plugins/prizmkit/skills", ".agents/plugins/prizmkit/rules"),
61
63
  }
62
64
 
63
65
 
@@ -87,6 +89,11 @@ _PLATFORM_SKILL_PATTERNS = {
87
89
  ("project-agent-skill", ".agents/skills/{skill}"),
88
90
  ("home-skill", "~/.cursor/skills/{skill}"),
89
91
  ),
92
+ "antigravity": (
93
+ ("project-plugin-skill", ".agents/plugins/prizmkit/skills/{skill}"),
94
+ ("project-agent-skill", ".agents/skills/{skill}"),
95
+ ("home-skill", "~/.gemini/config/skills/{skill}"),
96
+ ),
90
97
  }
91
98
 
92
99
 
@@ -126,6 +133,8 @@ def platform_from_command(command: object) -> str:
126
133
  return "pi"
127
134
  if base == "agent":
128
135
  return "cursor"
136
+ if base in ("agy", "antigravity"):
137
+ return "antigravity"
129
138
  return ""
130
139
 
131
140
 
@@ -230,7 +239,7 @@ def resolve_platform(project_root: str | Path, env: Mapping[str, str] | None = N
230
239
  "unresolved",
231
240
  (
232
241
  "No supported platform marker found. Set PRIZMKIT_PLATFORM, configure .prizmkit/config.json, "
233
- "or install Claude/Codex/CodeBuddy/Pi/Cursor platform files.",
242
+ "or install Claude/Codex/CodeBuddy/Pi/Cursor/Antigravity platform files.",
234
243
  ),
235
244
  )
236
245
 
@@ -517,7 +517,7 @@ def _preview_item(
517
517
  config = load_runtime_config(paths)
518
518
  if not config.ai_client.command:
519
519
  raise RuntimeError("No supported AI CLI command was found")
520
- if config.ai_client.platform == "cursor" and not config.effort_validation.valid:
520
+ if config.ai_client.platform in {"cursor", "antigravity"} and not config.effort_validation.valid:
521
521
  raise RuntimeError(config.effort_validation.message)
522
522
  metadata = _with_recovery_metadata(family, item_id, initial_metadata)
523
523
  retry_count = int(metadata.get("retry_count") or 0)
@@ -558,7 +558,7 @@ def _process_item_locked(
558
558
  config = load_runtime_config(paths)
559
559
  if not config.ai_client.command:
560
560
  raise RuntimeError("No supported AI CLI command was found")
561
- if config.ai_client.platform == "cursor" and not config.effort_validation.valid:
561
+ if config.ai_client.platform in {"cursor", "antigravity"} and not config.effort_validation.valid:
562
562
  raise RuntimeError(config.effort_validation.message)
563
563
 
564
564
  repository = ensure_git_repository(paths.project_root)
@@ -809,6 +809,12 @@ def _process_item_locked(
809
809
  "Cursor Agent CLI is incompatible with PrizmKit headless execution: "
810
810
  f"{details}. Install or update Cursor Agent and verify `agent --help`."
811
811
  )
812
+ if config.ai_client.platform == "antigravity" and not stream_json:
813
+ details = "; ".join(stream_support.notes) or "required stream-json flags were not found"
814
+ raise RuntimeError(
815
+ "Antigravity CLI is incompatible with PrizmKit headless execution: "
816
+ f"{details}. Install or update Antigravity CLI (`agy`) and verify `agy --help`."
817
+ )
812
818
  base_head = run_git_command(execution_root, ("rev-parse", "HEAD")).stdout.strip()
813
819
  session_result = AISessionLauncher(
814
820
  AISessionConfig(
@@ -121,7 +121,11 @@ HelpRunner = Callable[[Sequence[str]], str]
121
121
 
122
122
  def _normalize_platform(platform: str | None) -> str:
123
123
  normalized = (platform or "").strip().lower()
124
- return normalized if normalized in {"claude", "codex", "codebuddy", "pi", "cursor", "custom"} else "codebuddy"
124
+ return (
125
+ normalized
126
+ if normalized in {"claude", "codex", "codebuddy", "pi", "cursor", "antigravity", "custom"}
127
+ else "codebuddy"
128
+ )
125
129
 
126
130
 
127
131
  def _prompt_text(path: Path) -> str:
@@ -199,6 +203,24 @@ def detect_stream_json_support(
199
203
  return StreamJsonSupport(True, "cursor-stream-json", "cursor-version-help")
200
204
  notes = tuple(f"{flag} not found" if flag.startswith("--") else flag for flag in missing)
201
205
  return StreamJsonSupport(False, "", "cursor-version-help", notes)
206
+ if normalized == "antigravity" or command_name in {"agy", "antigravity"}:
207
+ help_output = runner((cli_command, "--help"))
208
+ required = (
209
+ "--print",
210
+ "--dangerously-skip-permissions",
211
+ "--output-format",
212
+ "--input-format",
213
+ "stream-json",
214
+ )
215
+ missing = tuple(flag for flag in required if flag not in help_output)
216
+ if not missing:
217
+ return StreamJsonSupport(True, "antigravity-stream-json", "agy-help")
218
+ return StreamJsonSupport(
219
+ False,
220
+ "",
221
+ "agy-help",
222
+ tuple(f"{flag} not found" for flag in missing),
223
+ )
202
224
  if normalized == "pi" or command_name == "pi":
203
225
  help_output = runner((cli_command, "--help"))
204
226
  required = ("--mode", "--approve", "--no-session", "--tools", "--model", "--thinking")
@@ -249,6 +271,40 @@ def build_ai_session_command(config: AISessionConfig) -> AISessionCommand:
249
271
  argv.extend(config.extra_args)
250
272
  return AISessionCommand(tuple(argv), prompt, "pi", "stdin", prompt)
251
273
 
274
+ if platform == "antigravity":
275
+ if config.use_stream_json:
276
+ argv = [
277
+ config.cli_command,
278
+ "--dangerously-skip-permissions",
279
+ "--input-format",
280
+ "stream-json",
281
+ "--output-format",
282
+ "stream-json",
283
+ ]
284
+ if config.model:
285
+ argv.extend(["--model", config.model])
286
+ if config.effort:
287
+ argv.extend(["--effort", config.effort])
288
+ argv.extend(config.extra_args)
289
+ stdin_payload = json.dumps(
290
+ {"event": "user", "message": {"content": prompt}},
291
+ ensure_ascii=False,
292
+ ) + "\n"
293
+ return AISessionCommand(tuple(argv), stdin_payload, "antigravity", "stdin", prompt)
294
+
295
+ argv = [
296
+ config.cli_command,
297
+ "-p",
298
+ prompt,
299
+ "--dangerously-skip-permissions",
300
+ ]
301
+ if config.model:
302
+ argv.extend(["--model", config.model])
303
+ if config.effort:
304
+ argv.extend(["--effort", config.effort])
305
+ argv.extend(config.extra_args)
306
+ return AISessionCommand(tuple(argv), None, "antigravity", "argument", prompt)
307
+
252
308
  if platform == "cursor":
253
309
  argv = [
254
310
  config.cli_command,
@@ -394,6 +450,20 @@ def _permission_denial_text(event: object) -> str:
394
450
  return text[:500] if any(marker in lower for marker in markers) else ""
395
451
 
396
452
 
453
+ def _antigravity_conversation_id(event: Mapping[str, object]) -> str:
454
+ for key in ("conversation_id",):
455
+ value = event.get(key)
456
+ if isinstance(value, str) and value.strip():
457
+ return value.strip()
458
+ for container_key in ("init", "step_update", "result"):
459
+ container = event.get(container_key)
460
+ if isinstance(container, Mapping):
461
+ value = container.get("conversation_id")
462
+ if isinstance(value, str) and value.strip():
463
+ return value.strip()
464
+ return ""
465
+
466
+
397
467
  def parse_stream_progress_lines(
398
468
  lines: Sequence[str],
399
469
  provider_hint: str | None = None,
@@ -404,7 +474,9 @@ def parse_stream_progress_lines(
404
474
  claude_session_id = ""
405
475
  cb_session_id = ""
406
476
  cursor_session_id = ""
477
+ antigravity_session_id = ""
407
478
  cursor_stream = _normalize_platform(provider_hint) == "cursor"
479
+ antigravity_stream = _normalize_platform(provider_hint) == "antigravity"
408
480
  result_subtype = ""
409
481
  stop_reason = ""
410
482
  has_usage = False
@@ -425,29 +497,116 @@ def parse_stream_progress_lines(
425
497
  continue
426
498
  if not isinstance(event, dict):
427
499
  continue
428
- event_type = str(event.get("type") or "")
500
+ has_ag_event = isinstance(event.get("event"), str) and not event.get("type")
501
+ if has_ag_event:
502
+ antigravity_stream = True
503
+ event_type = str(event.get("type") or event.get("event") or "")
429
504
  if event_type:
430
505
  event_type_counts[event_type] += 1
431
- if isinstance(event.get("sessionId"), str) and not cb_session_id:
432
- cb_session_id = event["sessionId"].strip()
433
- if event_type == "tool_call":
434
- cursor_stream = True
435
- if not cursor_session_id and claude_session_id:
436
- cursor_session_id = claude_session_id
437
- claude_session_id = ""
438
- if cursor_stream and isinstance(event.get("session_id"), str) and not cursor_session_id:
439
- cursor_session_id = event["session_id"].strip()
440
- if event_type == "system" and event.get("subtype") == "init":
441
- session_id = event.get("session_id")
442
- if isinstance(session_id, str):
443
- if cursor_stream:
444
- cursor_session_id = cursor_session_id or session_id.strip()
445
- else:
446
- claude_session_id = session_id.strip()
506
+
507
+ if antigravity_stream:
508
+ conv_id = _antigravity_conversation_id(event)
509
+ if conv_id and not antigravity_session_id:
510
+ antigravity_session_id = conv_id
511
+
512
+ if not antigravity_stream:
513
+ if isinstance(event.get("sessionId"), str) and not cb_session_id:
514
+ cb_session_id = event["sessionId"].strip()
515
+ if event_type == "tool_call":
516
+ cursor_stream = True
517
+ if not cursor_session_id and claude_session_id:
518
+ cursor_session_id = claude_session_id
519
+ claude_session_id = ""
520
+ if cursor_stream and isinstance(event.get("session_id"), str) and not cursor_session_id:
521
+ cursor_session_id = event["session_id"].strip()
522
+ if event_type == "system" and event.get("subtype") == "init":
523
+ session_id = event.get("session_id")
524
+ if isinstance(session_id, str):
525
+ if cursor_stream:
526
+ cursor_session_id = cursor_session_id or session_id.strip()
527
+ else:
528
+ claude_session_id = session_id.strip()
529
+
530
+ if antigravity_stream and event_type == "step_update":
531
+ step_payload = event.get("step_update") if isinstance(event.get("step_update"), dict) else event
532
+ if step_payload.get("usage") not in (None, "", {}):
533
+ has_usage = True
534
+ tool_info = step_payload.get("tool_info") if isinstance(step_payload.get("tool_info"), dict) else {}
535
+ for err_candidate in (step_payload.get("error"), tool_info.get("error")):
536
+ if isinstance(err_candidate, dict):
537
+ code = err_candidate.get("code") or err_candidate.get("type")
538
+ if code and not fatal_error_code:
539
+ fatal_error_code = str(code)
540
+ message = err_candidate.get("message")
541
+ if message:
542
+ errors.append(str(message)[:500])
543
+ elif err_candidate:
544
+ errors.append(str(err_candidate)[:500])
545
+
447
546
  if event_type == "result":
448
- result_subtype = str(event.get("subtype") or event.get("result_subtype") or "")
449
- stop_reason = str(event.get("stop_reason") or "")
450
- terminal_result_text = str(event.get("result") or event.get("message") or "")[:1000]
547
+ if antigravity_stream or has_ag_event:
548
+ result_payload = event.get("result") if isinstance(event.get("result"), dict) else event
549
+ raw_status = str(
550
+ result_payload.get("status")
551
+ or event.get("status")
552
+ or result_payload.get("subtype")
553
+ or event.get("subtype")
554
+ or ""
555
+ )
556
+ error_val = result_payload.get("error") if result_payload.get("error") is not None else event.get("error")
557
+ is_error = bool(
558
+ event.get("is_error")
559
+ or result_payload.get("is_error")
560
+ or error_val
561
+ or raw_status.strip().lower() in {"error", "failed", "failure", "aborted", "cancelled", "canceled"}
562
+ )
563
+ normalized_status = raw_status.strip().lower()
564
+ if is_error:
565
+ result_subtype = "error"
566
+ elif normalized_status in {"", "success", "ok", "completed"}:
567
+ result_subtype = "success"
568
+ else:
569
+ result_subtype = normalized_status
570
+ stop_reason = str(
571
+ result_payload.get("stop_reason")
572
+ or event.get("stop_reason")
573
+ or raw_status
574
+ or ""
575
+ )
576
+ resp_val = (
577
+ result_payload.get("response")
578
+ or result_payload.get("result")
579
+ or result_payload.get("message")
580
+ or event.get("response")
581
+ or event.get("message")
582
+ or ""
583
+ )
584
+ if isinstance(resp_val, dict):
585
+ resp_val = ""
586
+ if isinstance(error_val, dict):
587
+ code = error_val.get("code") or error_val.get("type")
588
+ if code and not fatal_error_code:
589
+ fatal_error_code = str(code)
590
+ err_text = str(error_val.get("message") or "")
591
+ if err_text:
592
+ errors.append(err_text[:500])
593
+ elif error_val:
594
+ err_text = str(error_val)
595
+ errors.append(err_text[:500])
596
+ else:
597
+ err_text = ""
598
+ terminal_result_text = str(resp_val or err_text or "")[:1000]
599
+ if result_payload.get("usage") not in (None, "", {}):
600
+ has_usage = True
601
+ for key in ("fatal_error_code", "api_error_code", "error_code"):
602
+ value = result_payload.get(key)
603
+ if value and not fatal_error_code:
604
+ fatal_error_code = str(value)
605
+ break
606
+ else:
607
+ result_subtype = str(event.get("subtype") or event.get("result_subtype") or "")
608
+ stop_reason = str(event.get("stop_reason") or "")
609
+ terminal_result_text = str(event.get("result") or event.get("message") or "")[:1000]
451
610
  if event_type in {"turn.failed", "error"}:
452
611
  message = event.get("error") or event.get("message") or event
453
612
  errors.append(str(message)[:500])
@@ -475,6 +634,7 @@ def parse_stream_progress_lines(
475
634
  claude_session_id=claude_session_id,
476
635
  cb_session_id=cb_session_id,
477
636
  cursor_session_id=cursor_session_id,
637
+ antigravity_session_id=antigravity_session_id,
478
638
  result_subtype=result_subtype,
479
639
  stop_reason=stop_reason,
480
640
  has_usage=has_usage,
@@ -503,6 +663,7 @@ class _FallbackProgressTracker:
503
663
  claude_session_id=current.claude_session_id or self._summary.claude_session_id,
504
664
  cb_session_id=current.cb_session_id or self._summary.cb_session_id,
505
665
  cursor_session_id=current.cursor_session_id or self._summary.cursor_session_id,
666
+ antigravity_session_id=current.antigravity_session_id or self._summary.antigravity_session_id,
506
667
  result_subtype=current.result_subtype or self._summary.result_subtype,
507
668
  stop_reason=current.stop_reason or self._summary.stop_reason,
508
669
  has_usage=current.has_usage or self._summary.has_usage,
@@ -541,7 +702,7 @@ def _fallback_semantic_output(line: str, event: object | None) -> str:
541
702
  if not isinstance(event, dict):
542
703
  text = line.rstrip("\n")
543
704
  return f"[OUTPUT] {text}\n" if text else ""
544
- event_type = str(event.get("type") or "event")
705
+ event_type = str(event.get("type") or event.get("event") or "event")
545
706
  value = event.get("error") or event.get("result") or event.get("message")
546
707
  if isinstance(value, str) and value.strip():
547
708
  label = "[ERROR]" if event.get("error") else "[OUTPUT]"
@@ -970,14 +1131,14 @@ def _reader_thread(
970
1131
  tracker.last_text_snippet = stripped[:120]
971
1132
  tracker._detect_terminal_error(stripped, require_error_context=True)
972
1133
  except Exception as exc:
973
- tracker_failure = f"[ERROR] progress parser rejected event={str(event.get('type') or 'unknown') if isinstance(event, dict) else 'text'}: {type(exc).__name__}\n"
1134
+ tracker_failure = f"[ERROR] progress parser rejected event={str(event.get('type') or event.get('event') or 'unknown') if isinstance(event, dict) else 'text'}: {type(exc).__name__}\n"
974
1135
  try:
975
1136
  if normalizer is not None:
976
1137
  rendered = normalizer.process_event(event) if isinstance(event, dict) else normalizer.process_text(line)
977
1138
  else:
978
1139
  rendered = _fallback_semantic_output(line, event)
979
1140
  except Exception as exc:
980
- event_name = str(event.get("type") or "unknown") if isinstance(event, dict) else "text"
1141
+ event_name = str(event.get("type") or event.get("event") or "unknown") if isinstance(event, dict) else "text"
981
1142
  rendered = (
982
1143
  f"[ERROR] semantic log adapter rejected event={event_name}: {type(exc).__name__}\n"
983
1144
  + _fallback_semantic_output(line, event)
@@ -1054,6 +1215,7 @@ def _summary_from_progress_dict(data: Mapping[str, object], fallback: ProgressSu
1054
1215
  claude_session_id=str(data.get("claude_session_id") or fallback.claude_session_id),
1055
1216
  cb_session_id=str(data.get("cb_session_id") or fallback.cb_session_id),
1056
1217
  cursor_session_id=str(data.get("cursor_session_id") or fallback.cursor_session_id),
1218
+ antigravity_session_id=str(data.get("antigravity_session_id") or fallback.antigravity_session_id),
1057
1219
  result_subtype=str(data.get("result_subtype") or fallback.result_subtype),
1058
1220
  stop_reason=str(data.get("stop_reason") or fallback.stop_reason),
1059
1221
  has_usage=bool(data.get("has_usage") or fallback.has_usage),
@@ -38,6 +38,7 @@ class ProgressSummary:
38
38
  claude_session_id: str = ""
39
39
  cb_session_id: str = ""
40
40
  cursor_session_id: str = ""
41
+ antigravity_session_id: str = ""
41
42
  result_subtype: str = ""
42
43
  stop_reason: str = ""
43
44
  has_usage: bool = False
@@ -54,6 +55,7 @@ class ProgressSummary:
54
55
  "claude_session_id": self.claude_session_id,
55
56
  "cb_session_id": self.cb_session_id,
56
57
  "cursor_session_id": self.cursor_session_id,
58
+ "antigravity_session_id": self.antigravity_session_id,
57
59
  "result_subtype": self.result_subtype,
58
60
  "stop_reason": self.stop_reason,
59
61
  "has_usage": self.has_usage,