agentpack-cli 0.1.27__tar.gz → 0.1.29__tar.gz

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 (86) hide show
  1. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/PKG-INFO +8 -7
  2. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/README.md +7 -6
  3. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/pyproject.toml +1 -1
  4. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/__init__.py +1 -1
  5. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/adapters/codex.py +3 -0
  6. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/commands/install.py +8 -1
  7. agentpack_cli-0.1.29/src/agentpack/installers/codex.py +106 -0
  8. agentpack_cli-0.1.27/src/agentpack/installers/codex.py +0 -55
  9. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/.gitignore +0 -0
  10. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/LICENSE +0 -0
  11. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/adapters/__init__.py +0 -0
  12. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/adapters/antigravity.py +0 -0
  13. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/adapters/base.py +0 -0
  14. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/adapters/claude.py +0 -0
  15. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/adapters/cursor.py +0 -0
  16. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/adapters/detect.py +0 -0
  17. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/adapters/generic.py +0 -0
  18. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/adapters/windsurf.py +0 -0
  19. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/analysis/__init__.py +0 -0
  20. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/analysis/dependency_graph.py +0 -0
  21. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/analysis/go_imports.py +0 -0
  22. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/analysis/java_imports.py +0 -0
  23. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/analysis/js_ts_imports.py +0 -0
  24. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/analysis/python_imports.py +0 -0
  25. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/analysis/ranking.py +0 -0
  26. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/analysis/rust_imports.py +0 -0
  27. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/analysis/symbols.py +0 -0
  28. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/analysis/tests.py +0 -0
  29. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/application/__init__.py +0 -0
  30. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/application/pack_service.py +0 -0
  31. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/cli.py +0 -0
  32. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/commands/__init__.py +0 -0
  33. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/commands/_shared.py +0 -0
  34. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/commands/benchmark.py +0 -0
  35. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/commands/claude_cmd.py +0 -0
  36. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/commands/diff.py +0 -0
  37. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/commands/doctor.py +0 -0
  38. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/commands/explain.py +0 -0
  39. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/commands/hook_cmd.py +0 -0
  40. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/commands/init.py +0 -0
  41. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/commands/mcp_cmd.py +0 -0
  42. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/commands/monitor.py +0 -0
  43. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/commands/pack.py +0 -0
  44. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/commands/quickstart.py +0 -0
  45. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/commands/scan.py +0 -0
  46. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/commands/stats.py +0 -0
  47. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/commands/status.py +0 -0
  48. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/commands/summarize.py +0 -0
  49. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/commands/watch.py +0 -0
  50. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/core/__init__.py +0 -0
  51. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/core/bootstrap.py +0 -0
  52. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/core/cache.py +0 -0
  53. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/core/config.py +0 -0
  54. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/core/context_pack.py +0 -0
  55. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/core/diff.py +0 -0
  56. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/core/git.py +0 -0
  57. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/core/git_hooks.py +0 -0
  58. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/core/global_install.py +0 -0
  59. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/core/ignore.py +0 -0
  60. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/core/merkle.py +0 -0
  61. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/core/models.py +0 -0
  62. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/core/redactor.py +0 -0
  63. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/core/scanner.py +0 -0
  64. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/core/snapshot.py +0 -0
  65. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/core/token_estimator.py +0 -0
  66. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/core/vscode_tasks.py +0 -0
  67. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/data/agentpack.md +0 -0
  68. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/installers/__init__.py +0 -0
  69. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/installers/antigravity.py +0 -0
  70. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/installers/claude.py +0 -0
  71. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/installers/cursor.py +0 -0
  72. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/installers/windsurf.py +0 -0
  73. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/integrations/__init__.py +0 -0
  74. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/integrations/git_hooks.py +0 -0
  75. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/integrations/global_install.py +0 -0
  76. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/integrations/vscode_tasks.py +0 -0
  77. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/mcp_server.py +0 -0
  78. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/renderers/__init__.py +0 -0
  79. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/renderers/compact.py +0 -0
  80. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/renderers/markdown.py +0 -0
  81. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/renderers/receipts.py +0 -0
  82. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/session/__init__.py +0 -0
  83. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/session/state.py +0 -0
  84. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/summaries/__init__.py +0 -0
  85. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/summaries/base.py +0 -0
  86. {agentpack_cli-0.1.27 → agentpack_cli-0.1.29}/src/agentpack/summaries/offline.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agentpack-cli
3
- Version: 0.1.27
3
+ Version: 0.1.29
4
4
  Summary: Task-aware context packing for AI coding agents — Claude, Cursor, Windsurf, Codex, and Antigravity
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -44,7 +44,7 @@ Description-Content-Type: text/markdown
44
44
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
45
45
  [![CI](https://github.com/vishal2612200/agentpack/actions/workflows/ci.yml/badge.svg)](https://github.com/vishal2612200/agentpack/actions/workflows/ci.yml)
46
46
 
47
- > **Status: alpha (v0.1.27).** Works, tested, used in real sessions. Python and JavaScript/TypeScript are the best-supported languages. Not yet validated across a wide range of repos. API may change before 1.0.
47
+ > **Status: alpha (v0.1.29).** Works, tested, used in real sessions. Python and JavaScript/TypeScript are the best-supported languages. Not yet validated across a wide range of repos. API may change before 1.0.
48
48
  >
49
49
  > **Platform note:** macOS and Linux are fully supported. Windows support is not yet implemented (git hooks use POSIX shell; the Claude Code session hooks use `python3`/`rm -f`). Contributions welcome.
50
50
 
@@ -320,7 +320,7 @@ Then open Claude Code / Cursor / Codex and write your coding task normally.
320
320
  | Agent | Automation level | Method |
321
321
  |---|---|---|
322
322
  | Claude Code (hook) | Highest | `init` writes `CLAUDE.md`, `.claude/settings.json` hooks, and `.mcp.json` |
323
- | Codex | Medium | `init` writes `AGENTS.md` + git hooks |
323
+ | Codex | Medium | `init` writes `AGENTS.md`, `.codex/hooks.json` + git hooks |
324
324
  | Cursor | Medium | `init` writes `.cursorrules`, `.cursor/rules/agentpack.mdc`, VS Code task + git hooks |
325
325
  | Windsurf | Medium | `init` writes `.windsurfrules`, VS Code task + git hooks |
326
326
  | Antigravity | Medium | `init` writes `GEMINI.md`, VS Code task + git hooks |
@@ -409,6 +409,7 @@ agentpack init --agent codex
409
409
 
410
410
  Configures:
411
411
  - `AGENTS.md` — tells Codex to write current task, repack, and read the context pack before each task
412
+ - `.codex/hooks.json` — Codex app lifecycle hooks for prompt-time AgentPack refresh hints
412
413
  - `.git/hooks/post-commit`, `post-merge`, `post-checkout` — background repack on tree change
413
414
 
414
415
  ### Antigravity
@@ -428,7 +429,7 @@ Configures:
428
429
 
429
430
  | Mechanism | Claude Code | Cursor | Windsurf | Codex | Antigravity |
430
431
  |---|---|---|---|---|---|
431
- | Config file patched | `CLAUDE.md` + `.claude/settings.json` | `.cursorrules` + `.cursor/rules/*.mdc` | `.windsurfrules` | `AGENTS.md` | `GEMINI.md` + generated `.agent/skills/agentpack/SKILL.md` after pack |
432
+ | Config file patched | `CLAUDE.md` + `.claude/settings.json` | `.cursorrules` + `.cursor/rules/*.mdc` | `.windsurfrules` | `AGENTS.md` + `.codex/hooks.json` | `GEMINI.md` + generated `.agent/skills/agentpack/SKILL.md` after pack |
432
433
  | Auto-inject on startup | ✅ `UserPromptSubmit` hook | ✅ `alwaysApply` | ✅ rules file | ✅ `AGENTS.md` | ✅ Skill auto-activation |
433
434
  | Auto-repack when stale | ✅ hook (content hash via `root_hash`, ~1ms when fresh) | ✅ git hooks | ✅ git hooks | ✅ git hooks | ✅ git hooks |
434
435
  | Manual repack shortcut | ✅ `/agentpack` slash cmd | ✅ VS Code task | ✅ VS Code task | `agentpack pack` | ✅ VS Code task |
@@ -652,7 +653,7 @@ Also installs the detected agent integration:
652
653
  - Claude: `CLAUDE.md`, `.claude/settings.json` hooks, `.mcp.json`
653
654
  - Cursor: `.cursorrules`, `.cursor/rules/agentpack.mdc`, git hooks, VS Code task
654
655
  - Windsurf: `.windsurfrules`, git hooks, VS Code task
655
- - Codex: `AGENTS.md`, git hooks
656
+ - Codex: `AGENTS.md`, `.codex/hooks.json`, git hooks
656
657
  - Antigravity: `GEMINI.md`, git hooks, VS Code task
657
658
  - Generic: no agent-specific files
658
659
 
@@ -667,7 +668,7 @@ agentpack install # auto-detect IDE
667
668
  agentpack install --agent claude # CLAUDE.md + .claude/settings.json hooks
668
669
  agentpack install --agent cursor # .cursorrules + .mdc + git hooks + VS Code tasks
669
670
  agentpack install --agent windsurf # .windsurfrules + git hooks + VS Code tasks
670
- agentpack install --agent codex # AGENTS.md + git hooks
671
+ agentpack install --agent codex # AGENTS.md + .codex/hooks.json + git hooks
671
672
  agentpack install --agent antigravity # GEMINI.md + git hooks + VS Code tasks
672
673
  ```
673
674
 
@@ -1295,7 +1296,7 @@ src/agentpack/
1295
1296
  claude.py # ClaudeInstaller: CLAUDE.md + .claude/settings.json
1296
1297
  cursor.py # CursorInstaller: .cursorrules + .mdc + auto-repack
1297
1298
  windsurf.py # WindsurfInstaller: .windsurfrules + auto-repack
1298
- codex.py # CodexInstaller: AGENTS.md + git hooks
1299
+ codex.py # CodexInstaller: AGENTS.md + .codex/hooks.json + git hooks
1299
1300
  antigravity.py # AntigravityInstaller: GEMINI.md + auto-repack
1300
1301
 
1301
1302
  integrations/ # system/tool integration (not core domain)
@@ -5,7 +5,7 @@
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
6
  [![CI](https://github.com/vishal2612200/agentpack/actions/workflows/ci.yml/badge.svg)](https://github.com/vishal2612200/agentpack/actions/workflows/ci.yml)
7
7
 
8
- > **Status: alpha (v0.1.27).** Works, tested, used in real sessions. Python and JavaScript/TypeScript are the best-supported languages. Not yet validated across a wide range of repos. API may change before 1.0.
8
+ > **Status: alpha (v0.1.29).** Works, tested, used in real sessions. Python and JavaScript/TypeScript are the best-supported languages. Not yet validated across a wide range of repos. API may change before 1.0.
9
9
  >
10
10
  > **Platform note:** macOS and Linux are fully supported. Windows support is not yet implemented (git hooks use POSIX shell; the Claude Code session hooks use `python3`/`rm -f`). Contributions welcome.
11
11
 
@@ -281,7 +281,7 @@ Then open Claude Code / Cursor / Codex and write your coding task normally.
281
281
  | Agent | Automation level | Method |
282
282
  |---|---|---|
283
283
  | Claude Code (hook) | Highest | `init` writes `CLAUDE.md`, `.claude/settings.json` hooks, and `.mcp.json` |
284
- | Codex | Medium | `init` writes `AGENTS.md` + git hooks |
284
+ | Codex | Medium | `init` writes `AGENTS.md`, `.codex/hooks.json` + git hooks |
285
285
  | Cursor | Medium | `init` writes `.cursorrules`, `.cursor/rules/agentpack.mdc`, VS Code task + git hooks |
286
286
  | Windsurf | Medium | `init` writes `.windsurfrules`, VS Code task + git hooks |
287
287
  | Antigravity | Medium | `init` writes `GEMINI.md`, VS Code task + git hooks |
@@ -370,6 +370,7 @@ agentpack init --agent codex
370
370
 
371
371
  Configures:
372
372
  - `AGENTS.md` — tells Codex to write current task, repack, and read the context pack before each task
373
+ - `.codex/hooks.json` — Codex app lifecycle hooks for prompt-time AgentPack refresh hints
373
374
  - `.git/hooks/post-commit`, `post-merge`, `post-checkout` — background repack on tree change
374
375
 
375
376
  ### Antigravity
@@ -389,7 +390,7 @@ Configures:
389
390
 
390
391
  | Mechanism | Claude Code | Cursor | Windsurf | Codex | Antigravity |
391
392
  |---|---|---|---|---|---|
392
- | Config file patched | `CLAUDE.md` + `.claude/settings.json` | `.cursorrules` + `.cursor/rules/*.mdc` | `.windsurfrules` | `AGENTS.md` | `GEMINI.md` + generated `.agent/skills/agentpack/SKILL.md` after pack |
393
+ | Config file patched | `CLAUDE.md` + `.claude/settings.json` | `.cursorrules` + `.cursor/rules/*.mdc` | `.windsurfrules` | `AGENTS.md` + `.codex/hooks.json` | `GEMINI.md` + generated `.agent/skills/agentpack/SKILL.md` after pack |
393
394
  | Auto-inject on startup | ✅ `UserPromptSubmit` hook | ✅ `alwaysApply` | ✅ rules file | ✅ `AGENTS.md` | ✅ Skill auto-activation |
394
395
  | Auto-repack when stale | ✅ hook (content hash via `root_hash`, ~1ms when fresh) | ✅ git hooks | ✅ git hooks | ✅ git hooks | ✅ git hooks |
395
396
  | Manual repack shortcut | ✅ `/agentpack` slash cmd | ✅ VS Code task | ✅ VS Code task | `agentpack pack` | ✅ VS Code task |
@@ -613,7 +614,7 @@ Also installs the detected agent integration:
613
614
  - Claude: `CLAUDE.md`, `.claude/settings.json` hooks, `.mcp.json`
614
615
  - Cursor: `.cursorrules`, `.cursor/rules/agentpack.mdc`, git hooks, VS Code task
615
616
  - Windsurf: `.windsurfrules`, git hooks, VS Code task
616
- - Codex: `AGENTS.md`, git hooks
617
+ - Codex: `AGENTS.md`, `.codex/hooks.json`, git hooks
617
618
  - Antigravity: `GEMINI.md`, git hooks, VS Code task
618
619
  - Generic: no agent-specific files
619
620
 
@@ -628,7 +629,7 @@ agentpack install # auto-detect IDE
628
629
  agentpack install --agent claude # CLAUDE.md + .claude/settings.json hooks
629
630
  agentpack install --agent cursor # .cursorrules + .mdc + git hooks + VS Code tasks
630
631
  agentpack install --agent windsurf # .windsurfrules + git hooks + VS Code tasks
631
- agentpack install --agent codex # AGENTS.md + git hooks
632
+ agentpack install --agent codex # AGENTS.md + .codex/hooks.json + git hooks
632
633
  agentpack install --agent antigravity # GEMINI.md + git hooks + VS Code tasks
633
634
  ```
634
635
 
@@ -1256,7 +1257,7 @@ src/agentpack/
1256
1257
  claude.py # ClaudeInstaller: CLAUDE.md + .claude/settings.json
1257
1258
  cursor.py # CursorInstaller: .cursorrules + .mdc + auto-repack
1258
1259
  windsurf.py # WindsurfInstaller: .windsurfrules + auto-repack
1259
- codex.py # CodexInstaller: AGENTS.md + git hooks
1260
+ codex.py # CodexInstaller: AGENTS.md + .codex/hooks.json + git hooks
1260
1261
  antigravity.py # AntigravityInstaller: GEMINI.md + auto-repack
1261
1262
 
1262
1263
  integrations/ # system/tool integration (not core domain)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "agentpack-cli"
3
- version = "0.1.27"
3
+ version = "0.1.29"
4
4
  description = "Task-aware context packing for AI coding agents — Claude, Cursor, Windsurf, Codex, and Antigravity"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -1,3 +1,3 @@
1
1
  """AgentPack — task-aware context packing for AI coding agents."""
2
2
 
3
- __version__ = "0.1.27"
3
+ __version__ = "0.1.29"
@@ -22,5 +22,8 @@ class CodexAdapter(BaseAdapter):
22
22
  def patch_agents_md(self, root: Path) -> str:
23
23
  return CodexInstaller().patch_agents_md(root)
24
24
 
25
+ def patch_codex_hooks(self, root: Path) -> str:
26
+ return CodexInstaller().patch_codex_hooks(root)
27
+
25
28
  def install_auto_repack(self, root: Path) -> dict[str, str]:
26
29
  return CodexInstaller().install_auto_repack(root)
@@ -19,7 +19,7 @@ from agentpack.integrations.global_install import (
19
19
  )
20
20
  from agentpack.commands._shared import console, _root
21
21
 
22
- _SUPPORTED_AGENTS = ("auto", "claude", "cursor", "windsurf", "codex", "antigravity")
22
+ _SUPPORTED_AGENTS = ("auto", "claude", "cursor", "windsurf", "codex", "antigravity", "generic")
23
23
 
24
24
 
25
25
  def _resolve_install_agent(agent: str, root: "Path") -> str:
@@ -89,6 +89,10 @@ def register(app: typer.Typer) -> None:
89
89
  _print_auto_repack_results(installer.install_auto_repack(root))
90
90
  console.print(" AgentPack Skill will activate automatically in Antigravity for coding tasks.")
91
91
 
92
+ elif agent == "generic":
93
+ console.print("[green]Generic agent selected.[/] No agent-specific hooks are required.")
94
+ console.print(" Run [bold]agentpack pack --agent generic --task \"<task>\"[/] to generate context.")
95
+
92
96
  else:
93
97
  console.print(f"[yellow]Unknown agent: {agent}. Supported: {', '.join(_SUPPORTED_AGENTS)}[/]")
94
98
  raise typer.Exit(1)
@@ -210,6 +214,9 @@ def register(app: typer.Typer) -> None:
210
214
  else:
211
215
  console.print("\n[dim]Would patch: GEMINI.md, .agent/skills/agentpack/SKILL.md[/]")
212
216
 
217
+ elif agent == "generic":
218
+ console.print("\n[green]Generic agent selected.[/] No agent-specific global config is required.")
219
+
213
220
  else:
214
221
  console.print(f"[yellow]Unknown agent: {agent}. Supported: {', '.join(_SUPPORTED_AGENTS)}[/]")
215
222
  raise typer.Exit(1)
@@ -0,0 +1,106 @@
1
+ from __future__ import annotations
2
+
3
+ import json
4
+ import re
5
+ from pathlib import Path
6
+
7
+ from agentpack.integrations.git_hooks import install_git_hooks
8
+
9
+ _AGENTPACK_BLOCK = """\
10
+ <!-- agentpack:start -->
11
+ ## AgentPack Context
12
+
13
+ At the start of every coding task:
14
+
15
+ 1. Write a one-line task summary to `.agentpack/task.md` (overwrite the whole file).
16
+ 2. Run `agentpack pack --task auto` to refresh context.
17
+ 3. Read `.agentpack/context.md` — it lists the files most relevant to your task.
18
+ 4. Use those files as starting points, but verify with actual code before editing.
19
+
20
+ When the user switches to a different coding task, repeat steps 1-3 before editing.
21
+ <!-- agentpack:end -->"""
22
+
23
+ _BLOCK_RE = re.compile(
24
+ r"<!-- agentpack:start -->.*?<!-- agentpack:end -->",
25
+ re.DOTALL,
26
+ )
27
+
28
+ _SESSION_START_HOOK = {
29
+ "type": "command",
30
+ "command": "agentpack hook --event SessionStart",
31
+ }
32
+
33
+ _USER_PROMPT_SUBMIT_HOOK = {
34
+ "type": "command",
35
+ "command": "agentpack hook --event UserPromptSubmit",
36
+ "timeout": 5,
37
+ "statusMessage": "Checking agentpack index...",
38
+ }
39
+
40
+
41
+ class CodexInstaller:
42
+ """Configures Codex/OpenAI-specific repo files and auto-repack hooks."""
43
+
44
+ def patch_agents_md(self, root: Path) -> str:
45
+ """Insert/update AgentPack block in AGENTS.md. Returns action taken."""
46
+ agents_md = root / "AGENTS.md"
47
+
48
+ if not agents_md.exists():
49
+ agents_md.write_text(f"{_AGENTPACK_BLOCK}\n")
50
+ return "created"
51
+
52
+ content = agents_md.read_text()
53
+ if _BLOCK_RE.search(content):
54
+ new_content = _BLOCK_RE.sub(_AGENTPACK_BLOCK, content)
55
+ if new_content != content:
56
+ agents_md.write_text(new_content)
57
+ return "updated"
58
+ return "unchanged"
59
+
60
+ agents_md.write_text(content.rstrip() + "\n\n" + _AGENTPACK_BLOCK + "\n")
61
+ return "appended"
62
+
63
+ def patch_codex_hooks(self, root: Path) -> str:
64
+ """Merge AgentPack lifecycle hooks into .codex/hooks.json."""
65
+ hooks_path = root / ".codex" / "hooks.json"
66
+ hooks_path.parent.mkdir(parents=True, exist_ok=True)
67
+ existed = hooks_path.exists()
68
+
69
+ existing: dict = {}
70
+ if existed:
71
+ try:
72
+ existing = json.loads(hooks_path.read_text(encoding="utf-8"))
73
+ except json.JSONDecodeError:
74
+ existing = {}
75
+
76
+ hooks = existing.setdefault("hooks", {})
77
+ changed = False
78
+ changed |= self._ensure_hook(hooks, "SessionStart", _SESSION_START_HOOK)
79
+ changed |= self._ensure_hook(hooks, "UserPromptSubmit", _USER_PROMPT_SUBMIT_HOOK)
80
+
81
+ new_content = json.dumps(existing, indent=2) + "\n"
82
+ if hooks_path.exists() and hooks_path.read_text(encoding="utf-8") == new_content:
83
+ return "unchanged"
84
+ hooks_path.write_text(new_content, encoding="utf-8")
85
+ return "updated" if existed else "created"
86
+
87
+ def _ensure_hook(self, hooks: dict, event: str, hook: dict) -> bool:
88
+ entries = hooks.setdefault(event, [])
89
+ for entry in entries:
90
+ for existing_hook in entry.get("hooks", []):
91
+ if existing_hook.get("type") == hook["type"] and existing_hook.get("command") == hook["command"]:
92
+ if existing_hook == hook:
93
+ return False
94
+ existing_hook.clear()
95
+ existing_hook.update(dict(hook))
96
+ return True
97
+ entries.append({"hooks": [dict(hook)]})
98
+ return True
99
+
100
+ def install_auto_repack(self, root: Path) -> dict[str, str]:
101
+ """Install git hooks for auto-repack. Returns results dict."""
102
+ results: dict[str, str] = {}
103
+ results[".codex/hooks.json"] = self.patch_codex_hooks(root)
104
+ hook_results = install_git_hooks(root, agent="auto")
105
+ results.update({f"git:{k}": v for k, v in hook_results.items()})
106
+ return results
@@ -1,55 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import re
4
- from pathlib import Path
5
-
6
- from agentpack.integrations.git_hooks import install_git_hooks
7
-
8
- _AGENTPACK_BLOCK = """\
9
- <!-- agentpack:start -->
10
- ## AgentPack Context
11
-
12
- At the start of every coding task:
13
-
14
- 1. Write a one-line task summary to `.agentpack/task.md` (overwrite the whole file).
15
- 2. Run `agentpack pack --task auto` to refresh context.
16
- 3. Read `.agentpack/context.md` — it lists the files most relevant to your task.
17
- 4. Use those files as starting points, but verify with actual code before editing.
18
-
19
- When the user switches to a different coding task, repeat steps 1-3 before editing.
20
- <!-- agentpack:end -->"""
21
-
22
- _BLOCK_RE = re.compile(
23
- r"<!-- agentpack:start -->.*?<!-- agentpack:end -->",
24
- re.DOTALL,
25
- )
26
-
27
-
28
- class CodexInstaller:
29
- """Configures Codex/OpenAI-specific repo files and auto-repack hooks."""
30
-
31
- def patch_agents_md(self, root: Path) -> str:
32
- """Insert/update AgentPack block in AGENTS.md. Returns action taken."""
33
- agents_md = root / "AGENTS.md"
34
-
35
- if not agents_md.exists():
36
- agents_md.write_text(f"{_AGENTPACK_BLOCK}\n")
37
- return "created"
38
-
39
- content = agents_md.read_text()
40
- if _BLOCK_RE.search(content):
41
- new_content = _BLOCK_RE.sub(_AGENTPACK_BLOCK, content)
42
- if new_content != content:
43
- agents_md.write_text(new_content)
44
- return "updated"
45
- return "unchanged"
46
-
47
- agents_md.write_text(content.rstrip() + "\n\n" + _AGENTPACK_BLOCK + "\n")
48
- return "appended"
49
-
50
- def install_auto_repack(self, root: Path) -> dict[str, str]:
51
- """Install git hooks for auto-repack. Returns results dict."""
52
- results: dict[str, str] = {}
53
- hook_results = install_git_hooks(root, agent="auto")
54
- results.update({f"git:{k}": v for k, v in hook_results.items()})
55
- return results
File without changes