agentpack-cli 0.1.26__tar.gz → 0.1.28__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.26 → agentpack_cli-0.1.28}/PKG-INFO +39 -33
  2. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/README.md +38 -32
  3. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/pyproject.toml +1 -1
  4. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/__init__.py +1 -1
  5. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/adapters/codex.py +3 -0
  6. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/commands/init.py +57 -0
  7. agentpack_cli-0.1.28/src/agentpack/installers/codex.py +106 -0
  8. agentpack_cli-0.1.26/src/agentpack/installers/codex.py +0 -55
  9. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/.gitignore +0 -0
  10. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/LICENSE +0 -0
  11. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/adapters/__init__.py +0 -0
  12. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/adapters/antigravity.py +0 -0
  13. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/adapters/base.py +0 -0
  14. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/adapters/claude.py +0 -0
  15. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/adapters/cursor.py +0 -0
  16. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/adapters/detect.py +0 -0
  17. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/adapters/generic.py +0 -0
  18. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/adapters/windsurf.py +0 -0
  19. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/analysis/__init__.py +0 -0
  20. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/analysis/dependency_graph.py +0 -0
  21. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/analysis/go_imports.py +0 -0
  22. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/analysis/java_imports.py +0 -0
  23. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/analysis/js_ts_imports.py +0 -0
  24. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/analysis/python_imports.py +0 -0
  25. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/analysis/ranking.py +0 -0
  26. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/analysis/rust_imports.py +0 -0
  27. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/analysis/symbols.py +0 -0
  28. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/analysis/tests.py +0 -0
  29. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/application/__init__.py +0 -0
  30. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/application/pack_service.py +0 -0
  31. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/cli.py +0 -0
  32. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/commands/__init__.py +0 -0
  33. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/commands/_shared.py +0 -0
  34. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/commands/benchmark.py +0 -0
  35. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/commands/claude_cmd.py +0 -0
  36. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/commands/diff.py +0 -0
  37. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/commands/doctor.py +0 -0
  38. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/commands/explain.py +0 -0
  39. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/commands/hook_cmd.py +0 -0
  40. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/commands/install.py +0 -0
  41. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/commands/mcp_cmd.py +0 -0
  42. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/commands/monitor.py +0 -0
  43. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/commands/pack.py +0 -0
  44. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/commands/quickstart.py +0 -0
  45. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/commands/scan.py +0 -0
  46. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/commands/stats.py +0 -0
  47. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/commands/status.py +0 -0
  48. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/commands/summarize.py +0 -0
  49. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/commands/watch.py +0 -0
  50. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/core/__init__.py +0 -0
  51. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/core/bootstrap.py +0 -0
  52. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/core/cache.py +0 -0
  53. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/core/config.py +0 -0
  54. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/core/context_pack.py +0 -0
  55. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/core/diff.py +0 -0
  56. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/core/git.py +0 -0
  57. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/core/git_hooks.py +0 -0
  58. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/core/global_install.py +0 -0
  59. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/core/ignore.py +0 -0
  60. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/core/merkle.py +0 -0
  61. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/core/models.py +0 -0
  62. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/core/redactor.py +0 -0
  63. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/core/scanner.py +0 -0
  64. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/core/snapshot.py +0 -0
  65. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/core/token_estimator.py +0 -0
  66. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/core/vscode_tasks.py +0 -0
  67. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/data/agentpack.md +0 -0
  68. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/installers/__init__.py +0 -0
  69. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/installers/antigravity.py +0 -0
  70. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/installers/claude.py +0 -0
  71. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/installers/cursor.py +0 -0
  72. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/installers/windsurf.py +0 -0
  73. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/integrations/__init__.py +0 -0
  74. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/integrations/git_hooks.py +0 -0
  75. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/integrations/global_install.py +0 -0
  76. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/integrations/vscode_tasks.py +0 -0
  77. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/mcp_server.py +0 -0
  78. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/renderers/__init__.py +0 -0
  79. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/renderers/compact.py +0 -0
  80. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/renderers/markdown.py +0 -0
  81. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/renderers/receipts.py +0 -0
  82. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/session/__init__.py +0 -0
  83. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/session/state.py +0 -0
  84. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/summaries/__init__.py +0 -0
  85. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/src/agentpack/summaries/base.py +0 -0
  86. {agentpack_cli-0.1.26 → agentpack_cli-0.1.28}/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.26
3
+ Version: 0.1.28
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.25).** 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.28).** 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
 
@@ -102,8 +102,7 @@ agentpack quickstart --task "fix auth token expiry"
102
102
 
103
103
  # One-time setup per project
104
104
  cd your-project
105
- agentpack init # creates config, session, task.md nothing else needed
106
- agentpack install # auto-detects your IDE (optional but recommended)
105
+ agentpack init # creates config/session/task.md + detected agent integration
107
106
 
108
107
  # Every terminal session
109
108
  agentpack watch # keeps context fresh automatically — that's it
@@ -240,7 +239,7 @@ AgentPack is not a coding assistant. It's a context preparation tool. The output
240
239
 
241
240
  These tools have native file access via tool calls. Claude reads exactly the files it needs, on demand, per turn. Pre-packing context adds overhead without much benefit on small-to-medium repos.
242
241
 
243
- AgentPack's value here is different: `agentpack install --agent <x>` configures your agent to auto-inject a ranked context pack on session start and auto-repack whenever you commit. On large repos where tool-call exploration piles up across turns, this front-loads the cost once instead of paying per-turn.
242
+ AgentPack's value here is different: `agentpack init --agent <x>` configures your agent to read or inject a ranked context pack and auto-repack when the repo changes. On large repos where tool-call exploration piles up across turns, this front-loads the cost once instead of paying per-turn.
244
243
 
245
244
  ### Where agentpack genuinely wins
246
245
 
@@ -305,8 +304,7 @@ The full workflow:
305
304
 
306
305
  ```bash
307
306
  # One-time project setup
308
- agentpack init # creates config, session, task.md
309
- agentpack install # configure your agent (optional but recommended)
307
+ agentpack init # creates config/session/task.md + detected agent integration
310
308
 
311
309
  # Every terminal session — just one command
312
310
  agentpack watch # auto-resumes session, refreshes context on file/task changes
@@ -321,11 +319,11 @@ Then open Claude Code / Cursor / Codex and write your coding task normally.
321
319
 
322
320
  | Agent | Automation level | Method |
323
321
  |---|---|---|
324
- | Claude Code (hook) | Highest | `UserPromptSubmit` hook auto-injects context |
325
- | Codex | Medium | `AGENTS.md` + `init` + `watch` |
326
- | Cursor | Medium | `.cursor/rules/agentpack.mdc` + `init` + `watch` |
327
- | Windsurf | Medium | `.windsurfrules` + `init` + `watch` |
328
- | Antigravity | Medium | `.agent/skills/agentpack/SKILL.md` + `GEMINI.md` + `init` + `watch` |
322
+ | Claude Code (hook) | Highest | `init` writes `CLAUDE.md`, `.claude/settings.json` hooks, and `.mcp.json` |
323
+ | Codex | Medium | `init` writes `AGENTS.md`, `.codex/hooks.json` + git hooks |
324
+ | Cursor | Medium | `init` writes `.cursorrules`, `.cursor/rules/agentpack.mdc`, VS Code task + git hooks |
325
+ | Windsurf | Medium | `init` writes `.windsurfrules`, VS Code task + git hooks |
326
+ | Antigravity | Medium | `init` writes `GEMINI.md`, VS Code task + git hooks |
329
327
  | Generic | Basic | `watch` mode + read `context.md` |
330
328
 
331
329
  ### Honest limitations
@@ -342,8 +340,7 @@ Then open Claude Code / Cursor / Codex and write your coding task normally.
342
340
  ```bash
343
341
  pip install agentpack-cli
344
342
  cd your-project
345
- agentpack init # one-time setup: config + session + task.md
346
- agentpack install # auto-detects your IDE (Claude Code, Cursor, Windsurf, Codex, Antigravity)
343
+ agentpack init # one-time setup: config/session/task.md + detected agent integration
347
344
  agentpack watch # in another terminal — keeps context fresh automatically
348
345
  ```
349
346
 
@@ -357,20 +354,20 @@ agentpack global-install # apply
357
354
  source ~/.zshrc
358
355
  ```
359
356
 
360
- Then opt each project in: `cd your-project && agentpack init`. After that git hooks repack on commit and the Claude Code hook injects context on every session start — no manual steps.
357
+ Then opt each project in: `cd your-project && agentpack init`. After that repo hooks or shell hooks keep context fresh, and Claude Code gets prompt-time context hints — no manual steps.
361
358
 
362
359
  ---
363
360
 
364
361
  ## Agent setup
365
362
 
366
- Run once per project. Each command is idempotent safe to re-run, never clobbers unrelated config.
363
+ `agentpack init` is the normal one-command project setup. It creates `.agentpack/` state and installs the detected agent integration. Re-run it any time; integration writes are idempotent and never clobber unrelated config.
367
364
 
368
- `agentpack install` without `--agent` auto-detects the active IDE from environment variables and project files. Pass `--agent` explicitly to override.
365
+ Use `--agent` explicitly to override detection. `agentpack install` remains available when you only want to repair or reconfigure agent files without reinitializing project state.
369
366
 
370
367
  ### Claude Code
371
368
 
372
369
  ```bash
373
- agentpack install --agent claude
370
+ agentpack init --agent claude
374
371
  ```
375
372
 
376
373
  Configures:
@@ -384,7 +381,7 @@ After this, context is injected automatically into every Claude Code session. No
384
381
  ### Cursor
385
382
 
386
383
  ```bash
387
- agentpack install --agent cursor
384
+ agentpack init --agent cursor
388
385
  ```
389
386
 
390
387
  Configures:
@@ -396,7 +393,7 @@ Configures:
396
393
  ### Windsurf
397
394
 
398
395
  ```bash
399
- agentpack install --agent windsurf
396
+ agentpack init --agent windsurf
400
397
  ```
401
398
 
402
399
  Configures:
@@ -407,32 +404,32 @@ Configures:
407
404
  ### Codex
408
405
 
409
406
  ```bash
410
- agentpack install --agent codex
407
+ agentpack init --agent codex
411
408
  ```
412
409
 
413
410
  Configures:
414
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
415
413
  - `.git/hooks/post-commit`, `post-merge`, `post-checkout` — background repack on tree change
416
414
 
417
415
  ### Antigravity
418
416
 
419
417
  ```bash
420
- agentpack install --agent antigravity
418
+ agentpack init --agent antigravity
421
419
  ```
422
420
 
423
421
  Configures:
424
- - `.agent/skills/agentpack/SKILL.md` — AgentPack context as a Skill; Antigravity activates it automatically for coding tasks
425
422
  - `GEMINI.md` — registers the agentpack skill reference and task-switch protocol
426
423
  - `.git/hooks/post-commit`, `post-merge`, `post-checkout` — background repack on tree change
427
424
  - `.vscode/tasks.json` — "AgentPack: Repack context" in Command Palette + `runOn: folderOpen`
428
425
 
429
- The Skill descriptor activates AgentPack automatically no `--task` flag required when working in Antigravity.
426
+ `agentpack pack` writes `.agent/skills/agentpack/SKILL.md`, which Antigravity can activate automatically for coding tasks.
430
427
 
431
428
  ### Auto-repack comparison
432
429
 
433
430
  | Mechanism | Claude Code | Cursor | Windsurf | Codex | Antigravity |
434
431
  |---|---|---|---|---|---|
435
- | Config file patched | `CLAUDE.md` + `.claude/settings.json` | `.cursorrules` + `.cursor/rules/*.mdc` | `.windsurfrules` | `AGENTS.md` | `.agent/skills/agentpack/SKILL.md` + `GEMINI.md` |
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 |
436
433
  | Auto-inject on startup | ✅ `UserPromptSubmit` hook | ✅ `alwaysApply` | ✅ rules file | ✅ `AGENTS.md` | ✅ Skill auto-activation |
437
434
  | Auto-repack when stale | ✅ hook (content hash via `root_hash`, ~1ms when fresh) | ✅ git hooks | ✅ git hooks | ✅ git hooks | ✅ git hooks |
438
435
  | Manual repack shortcut | ✅ `/agentpack` slash cmd | ✅ VS Code task | ✅ VS Code task | `agentpack pack` | ✅ VS Code task |
@@ -546,7 +543,7 @@ agentpack global-install --agent antigravity # Antigravity
546
543
  What it does:
547
544
  - **Git template hooks** (`~/.git-templates/hooks/`) — git copies these into every repo on `git init` / `git clone`. On `post-commit`, `post-merge`, `post-checkout`: silently repacks **only if `.agentpack/config.toml` exists** — no-op in repos that haven't opted in.
548
545
  - **Shell cd hook** (`~/.zshrc` or `~/.bashrc`) — on `cd`, repacks if stale **only in opted-in repos**. Never touches repos without `.agentpack/config.toml`. Never auto-inits.
549
- - **Agent config** — same as `agentpack install --agent <x>` for the current project.
546
+ - **Agent config** — same agent-specific files that `agentpack init --agent <x>` or `agentpack install --agent <x>` writes for the current project.
550
547
 
551
548
  All changes are idempotent, reversible, and non-destructive. Existing hooks and rc files are appended to, never overwritten. Repos you haven't explicitly run `agentpack init` in are never touched.
552
549
 
@@ -637,6 +634,7 @@ Initialize AgentPack in the current directory.
637
634
  ```bash
638
635
  agentpack init # interactive mode picker
639
636
  agentpack init --yes # non-interactive, use defaults (good for CI)
637
+ agentpack init --agent codex # force an agent integration
640
638
  agentpack init --share-cache # commit cache/ to git for team sharing
641
639
  ```
642
640
 
@@ -651,19 +649,27 @@ Creates:
651
649
  snapshots/ # file hash snapshots
652
650
  ```
653
651
 
652
+ Also installs the detected agent integration:
653
+ - Claude: `CLAUDE.md`, `.claude/settings.json` hooks, `.mcp.json`
654
+ - Cursor: `.cursorrules`, `.cursor/rules/agentpack.mdc`, git hooks, VS Code task
655
+ - Windsurf: `.windsurfrules`, git hooks, VS Code task
656
+ - Codex: `AGENTS.md`, `.codex/hooks.json`, git hooks
657
+ - Antigravity: `GEMINI.md`, git hooks, VS Code task
658
+ - Generic: no agent-specific files
659
+
654
660
  ---
655
661
 
656
662
  ### `agentpack install`
657
663
 
658
- Configure agentpack for your AI coding agent.
664
+ Repair or reconfigure agent-specific files without reinitializing project state.
659
665
 
660
666
  ```bash
661
667
  agentpack install # auto-detect IDE
662
668
  agentpack install --agent claude # CLAUDE.md + .claude/settings.json hooks
663
669
  agentpack install --agent cursor # .cursorrules + .mdc + git hooks + VS Code tasks
664
670
  agentpack install --agent windsurf # .windsurfrules + git hooks + VS Code tasks
665
- agentpack install --agent codex # AGENTS.md + git hooks
666
- agentpack install --agent antigravity # .agent/skills/agentpack/SKILL.md + GEMINI.md + git hooks + VS Code tasks
671
+ agentpack install --agent codex # AGENTS.md + .codex/hooks.json + git hooks
672
+ agentpack install --agent antigravity # GEMINI.md + git hooks + VS Code tasks
667
673
  ```
668
674
 
669
675
  All installs are idempotent — safe to re-run, merge with existing config, never duplicate.
@@ -1290,8 +1296,8 @@ src/agentpack/
1290
1296
  claude.py # ClaudeInstaller: CLAUDE.md + .claude/settings.json
1291
1297
  cursor.py # CursorInstaller: .cursorrules + .mdc + auto-repack
1292
1298
  windsurf.py # WindsurfInstaller: .windsurfrules + auto-repack
1293
- codex.py # CodexInstaller: AGENTS.md + git hooks
1294
- antigravity.py # AntigravityInstaller: GEMINI.md + .agent/skills/ + auto-repack
1299
+ codex.py # CodexInstaller: AGENTS.md + .codex/hooks.json + git hooks
1300
+ antigravity.py # AntigravityInstaller: GEMINI.md + auto-repack
1295
1301
 
1296
1302
  integrations/ # system/tool integration (not core domain)
1297
1303
  git_hooks.py # install/remove .git/hooks post-commit/merge/checkout
@@ -1396,7 +1402,7 @@ Add to `.github/workflows/agentpack-context.yml` — see the full example in [CI
1396
1402
 
1397
1403
  ```bash
1398
1404
  # One-time project setup
1399
- agentpack init # creates config, session, task.md
1405
+ agentpack init # creates config/session/task.md + detected agent integration
1400
1406
  # Edit .agentpack/task.md to set your task
1401
1407
 
1402
1408
  # Every terminal session — just one command
@@ -1499,7 +1505,7 @@ agentpack pack --task "fix bug" --budget 40000 # explicit token cap
1499
1505
  ### Watch mode for active sessions
1500
1506
 
1501
1507
  ```bash
1502
- agentpack init # one-time setup (creates session + task.md)
1508
+ agentpack init # one-time setup (creates session/task.md + detected agent integration)
1503
1509
  agentpack watch # in another terminal — auto-resumes each time
1504
1510
  ```
1505
1511
 
@@ -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.25).** 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.28).** 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
 
@@ -63,8 +63,7 @@ agentpack quickstart --task "fix auth token expiry"
63
63
 
64
64
  # One-time setup per project
65
65
  cd your-project
66
- agentpack init # creates config, session, task.md nothing else needed
67
- agentpack install # auto-detects your IDE (optional but recommended)
66
+ agentpack init # creates config/session/task.md + detected agent integration
68
67
 
69
68
  # Every terminal session
70
69
  agentpack watch # keeps context fresh automatically — that's it
@@ -201,7 +200,7 @@ AgentPack is not a coding assistant. It's a context preparation tool. The output
201
200
 
202
201
  These tools have native file access via tool calls. Claude reads exactly the files it needs, on demand, per turn. Pre-packing context adds overhead without much benefit on small-to-medium repos.
203
202
 
204
- AgentPack's value here is different: `agentpack install --agent <x>` configures your agent to auto-inject a ranked context pack on session start and auto-repack whenever you commit. On large repos where tool-call exploration piles up across turns, this front-loads the cost once instead of paying per-turn.
203
+ AgentPack's value here is different: `agentpack init --agent <x>` configures your agent to read or inject a ranked context pack and auto-repack when the repo changes. On large repos where tool-call exploration piles up across turns, this front-loads the cost once instead of paying per-turn.
205
204
 
206
205
  ### Where agentpack genuinely wins
207
206
 
@@ -266,8 +265,7 @@ The full workflow:
266
265
 
267
266
  ```bash
268
267
  # One-time project setup
269
- agentpack init # creates config, session, task.md
270
- agentpack install # configure your agent (optional but recommended)
268
+ agentpack init # creates config/session/task.md + detected agent integration
271
269
 
272
270
  # Every terminal session — just one command
273
271
  agentpack watch # auto-resumes session, refreshes context on file/task changes
@@ -282,11 +280,11 @@ Then open Claude Code / Cursor / Codex and write your coding task normally.
282
280
 
283
281
  | Agent | Automation level | Method |
284
282
  |---|---|---|
285
- | Claude Code (hook) | Highest | `UserPromptSubmit` hook auto-injects context |
286
- | Codex | Medium | `AGENTS.md` + `init` + `watch` |
287
- | Cursor | Medium | `.cursor/rules/agentpack.mdc` + `init` + `watch` |
288
- | Windsurf | Medium | `.windsurfrules` + `init` + `watch` |
289
- | Antigravity | Medium | `.agent/skills/agentpack/SKILL.md` + `GEMINI.md` + `init` + `watch` |
283
+ | Claude Code (hook) | Highest | `init` writes `CLAUDE.md`, `.claude/settings.json` hooks, and `.mcp.json` |
284
+ | Codex | Medium | `init` writes `AGENTS.md`, `.codex/hooks.json` + git hooks |
285
+ | Cursor | Medium | `init` writes `.cursorrules`, `.cursor/rules/agentpack.mdc`, VS Code task + git hooks |
286
+ | Windsurf | Medium | `init` writes `.windsurfrules`, VS Code task + git hooks |
287
+ | Antigravity | Medium | `init` writes `GEMINI.md`, VS Code task + git hooks |
290
288
  | Generic | Basic | `watch` mode + read `context.md` |
291
289
 
292
290
  ### Honest limitations
@@ -303,8 +301,7 @@ Then open Claude Code / Cursor / Codex and write your coding task normally.
303
301
  ```bash
304
302
  pip install agentpack-cli
305
303
  cd your-project
306
- agentpack init # one-time setup: config + session + task.md
307
- agentpack install # auto-detects your IDE (Claude Code, Cursor, Windsurf, Codex, Antigravity)
304
+ agentpack init # one-time setup: config/session/task.md + detected agent integration
308
305
  agentpack watch # in another terminal — keeps context fresh automatically
309
306
  ```
310
307
 
@@ -318,20 +315,20 @@ agentpack global-install # apply
318
315
  source ~/.zshrc
319
316
  ```
320
317
 
321
- Then opt each project in: `cd your-project && agentpack init`. After that git hooks repack on commit and the Claude Code hook injects context on every session start — no manual steps.
318
+ Then opt each project in: `cd your-project && agentpack init`. After that repo hooks or shell hooks keep context fresh, and Claude Code gets prompt-time context hints — no manual steps.
322
319
 
323
320
  ---
324
321
 
325
322
  ## Agent setup
326
323
 
327
- Run once per project. Each command is idempotent safe to re-run, never clobbers unrelated config.
324
+ `agentpack init` is the normal one-command project setup. It creates `.agentpack/` state and installs the detected agent integration. Re-run it any time; integration writes are idempotent and never clobber unrelated config.
328
325
 
329
- `agentpack install` without `--agent` auto-detects the active IDE from environment variables and project files. Pass `--agent` explicitly to override.
326
+ Use `--agent` explicitly to override detection. `agentpack install` remains available when you only want to repair or reconfigure agent files without reinitializing project state.
330
327
 
331
328
  ### Claude Code
332
329
 
333
330
  ```bash
334
- agentpack install --agent claude
331
+ agentpack init --agent claude
335
332
  ```
336
333
 
337
334
  Configures:
@@ -345,7 +342,7 @@ After this, context is injected automatically into every Claude Code session. No
345
342
  ### Cursor
346
343
 
347
344
  ```bash
348
- agentpack install --agent cursor
345
+ agentpack init --agent cursor
349
346
  ```
350
347
 
351
348
  Configures:
@@ -357,7 +354,7 @@ Configures:
357
354
  ### Windsurf
358
355
 
359
356
  ```bash
360
- agentpack install --agent windsurf
357
+ agentpack init --agent windsurf
361
358
  ```
362
359
 
363
360
  Configures:
@@ -368,32 +365,32 @@ Configures:
368
365
  ### Codex
369
366
 
370
367
  ```bash
371
- agentpack install --agent codex
368
+ agentpack init --agent codex
372
369
  ```
373
370
 
374
371
  Configures:
375
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
376
374
  - `.git/hooks/post-commit`, `post-merge`, `post-checkout` — background repack on tree change
377
375
 
378
376
  ### Antigravity
379
377
 
380
378
  ```bash
381
- agentpack install --agent antigravity
379
+ agentpack init --agent antigravity
382
380
  ```
383
381
 
384
382
  Configures:
385
- - `.agent/skills/agentpack/SKILL.md` — AgentPack context as a Skill; Antigravity activates it automatically for coding tasks
386
383
  - `GEMINI.md` — registers the agentpack skill reference and task-switch protocol
387
384
  - `.git/hooks/post-commit`, `post-merge`, `post-checkout` — background repack on tree change
388
385
  - `.vscode/tasks.json` — "AgentPack: Repack context" in Command Palette + `runOn: folderOpen`
389
386
 
390
- The Skill descriptor activates AgentPack automatically no `--task` flag required when working in Antigravity.
387
+ `agentpack pack` writes `.agent/skills/agentpack/SKILL.md`, which Antigravity can activate automatically for coding tasks.
391
388
 
392
389
  ### Auto-repack comparison
393
390
 
394
391
  | Mechanism | Claude Code | Cursor | Windsurf | Codex | Antigravity |
395
392
  |---|---|---|---|---|---|
396
- | Config file patched | `CLAUDE.md` + `.claude/settings.json` | `.cursorrules` + `.cursor/rules/*.mdc` | `.windsurfrules` | `AGENTS.md` | `.agent/skills/agentpack/SKILL.md` + `GEMINI.md` |
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 |
397
394
  | Auto-inject on startup | ✅ `UserPromptSubmit` hook | ✅ `alwaysApply` | ✅ rules file | ✅ `AGENTS.md` | ✅ Skill auto-activation |
398
395
  | Auto-repack when stale | ✅ hook (content hash via `root_hash`, ~1ms when fresh) | ✅ git hooks | ✅ git hooks | ✅ git hooks | ✅ git hooks |
399
396
  | Manual repack shortcut | ✅ `/agentpack` slash cmd | ✅ VS Code task | ✅ VS Code task | `agentpack pack` | ✅ VS Code task |
@@ -507,7 +504,7 @@ agentpack global-install --agent antigravity # Antigravity
507
504
  What it does:
508
505
  - **Git template hooks** (`~/.git-templates/hooks/`) — git copies these into every repo on `git init` / `git clone`. On `post-commit`, `post-merge`, `post-checkout`: silently repacks **only if `.agentpack/config.toml` exists** — no-op in repos that haven't opted in.
509
506
  - **Shell cd hook** (`~/.zshrc` or `~/.bashrc`) — on `cd`, repacks if stale **only in opted-in repos**. Never touches repos without `.agentpack/config.toml`. Never auto-inits.
510
- - **Agent config** — same as `agentpack install --agent <x>` for the current project.
507
+ - **Agent config** — same agent-specific files that `agentpack init --agent <x>` or `agentpack install --agent <x>` writes for the current project.
511
508
 
512
509
  All changes are idempotent, reversible, and non-destructive. Existing hooks and rc files are appended to, never overwritten. Repos you haven't explicitly run `agentpack init` in are never touched.
513
510
 
@@ -598,6 +595,7 @@ Initialize AgentPack in the current directory.
598
595
  ```bash
599
596
  agentpack init # interactive mode picker
600
597
  agentpack init --yes # non-interactive, use defaults (good for CI)
598
+ agentpack init --agent codex # force an agent integration
601
599
  agentpack init --share-cache # commit cache/ to git for team sharing
602
600
  ```
603
601
 
@@ -612,19 +610,27 @@ Creates:
612
610
  snapshots/ # file hash snapshots
613
611
  ```
614
612
 
613
+ Also installs the detected agent integration:
614
+ - Claude: `CLAUDE.md`, `.claude/settings.json` hooks, `.mcp.json`
615
+ - Cursor: `.cursorrules`, `.cursor/rules/agentpack.mdc`, git hooks, VS Code task
616
+ - Windsurf: `.windsurfrules`, git hooks, VS Code task
617
+ - Codex: `AGENTS.md`, `.codex/hooks.json`, git hooks
618
+ - Antigravity: `GEMINI.md`, git hooks, VS Code task
619
+ - Generic: no agent-specific files
620
+
615
621
  ---
616
622
 
617
623
  ### `agentpack install`
618
624
 
619
- Configure agentpack for your AI coding agent.
625
+ Repair or reconfigure agent-specific files without reinitializing project state.
620
626
 
621
627
  ```bash
622
628
  agentpack install # auto-detect IDE
623
629
  agentpack install --agent claude # CLAUDE.md + .claude/settings.json hooks
624
630
  agentpack install --agent cursor # .cursorrules + .mdc + git hooks + VS Code tasks
625
631
  agentpack install --agent windsurf # .windsurfrules + git hooks + VS Code tasks
626
- agentpack install --agent codex # AGENTS.md + git hooks
627
- agentpack install --agent antigravity # .agent/skills/agentpack/SKILL.md + GEMINI.md + git hooks + VS Code tasks
632
+ agentpack install --agent codex # AGENTS.md + .codex/hooks.json + git hooks
633
+ agentpack install --agent antigravity # GEMINI.md + git hooks + VS Code tasks
628
634
  ```
629
635
 
630
636
  All installs are idempotent — safe to re-run, merge with existing config, never duplicate.
@@ -1251,8 +1257,8 @@ src/agentpack/
1251
1257
  claude.py # ClaudeInstaller: CLAUDE.md + .claude/settings.json
1252
1258
  cursor.py # CursorInstaller: .cursorrules + .mdc + auto-repack
1253
1259
  windsurf.py # WindsurfInstaller: .windsurfrules + auto-repack
1254
- codex.py # CodexInstaller: AGENTS.md + git hooks
1255
- antigravity.py # AntigravityInstaller: GEMINI.md + .agent/skills/ + auto-repack
1260
+ codex.py # CodexInstaller: AGENTS.md + .codex/hooks.json + git hooks
1261
+ antigravity.py # AntigravityInstaller: GEMINI.md + auto-repack
1256
1262
 
1257
1263
  integrations/ # system/tool integration (not core domain)
1258
1264
  git_hooks.py # install/remove .git/hooks post-commit/merge/checkout
@@ -1357,7 +1363,7 @@ Add to `.github/workflows/agentpack-context.yml` — see the full example in [CI
1357
1363
 
1358
1364
  ```bash
1359
1365
  # One-time project setup
1360
- agentpack init # creates config, session, task.md
1366
+ agentpack init # creates config/session/task.md + detected agent integration
1361
1367
  # Edit .agentpack/task.md to set your task
1362
1368
 
1363
1369
  # Every terminal session — just one command
@@ -1460,7 +1466,7 @@ agentpack pack --task "fix bug" --budget 40000 # explicit token cap
1460
1466
  ### Watch mode for active sessions
1461
1467
 
1462
1468
  ```bash
1463
- agentpack init # one-time setup (creates session + task.md)
1469
+ agentpack init # one-time setup (creates session/task.md + detected agent integration)
1464
1470
  agentpack watch # in another terminal — auto-resumes each time
1465
1471
  ```
1466
1472
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "agentpack-cli"
3
- version = "0.1.26"
3
+ version = "0.1.28"
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.26"
3
+ __version__ = "0.1.28"
@@ -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)
@@ -59,6 +59,58 @@ def _patch_repo_gitignore(root, share_cache: bool = False) -> str:
59
59
  return "updated"
60
60
 
61
61
 
62
+ def _install_agent_integration(root, agent: str) -> dict[str, str]:
63
+ """Install repo-local agent integration files after `agentpack init`."""
64
+ results: dict[str, str] = {}
65
+
66
+ if agent == "claude":
67
+ from agentpack.installers.claude import ClaudeInstaller
68
+
69
+ installer = ClaudeInstaller()
70
+ results["CLAUDE.md"] = installer.patch_claude_md(root)
71
+ results[".claude/settings.json"] = installer.patch_claude_settings(root, global_install=False)
72
+ results[".mcp.json"] = installer.patch_mcp_server(root, global_install=False)
73
+ elif agent == "cursor":
74
+ from agentpack.installers.cursor import CursorInstaller
75
+
76
+ installer = CursorInstaller()
77
+ results[".cursorrules"] = installer.patch_cursor_rules(root)
78
+ results[".cursor/rules/agentpack.mdc"] = installer.patch_cursor_mdc(root)
79
+ results.update(installer.install_auto_repack(root))
80
+ elif agent == "windsurf":
81
+ from agentpack.installers.windsurf import WindsurfInstaller
82
+
83
+ installer = WindsurfInstaller()
84
+ results[".windsurfrules"] = installer.patch_windsurfrules(root)
85
+ results.update(installer.install_auto_repack(root))
86
+ elif agent == "codex":
87
+ from agentpack.installers.codex import CodexInstaller
88
+
89
+ installer = CodexInstaller()
90
+ results["AGENTS.md"] = installer.patch_agents_md(root)
91
+ results.update(installer.install_auto_repack(root))
92
+ elif agent == "antigravity":
93
+ from agentpack.installers.antigravity import AntigravityInstaller
94
+
95
+ installer = AntigravityInstaller()
96
+ results["GEMINI.md"] = installer.patch_gemini_md(root)
97
+ results.update(installer.install_auto_repack(root))
98
+
99
+ return results
100
+
101
+
102
+ def _print_agent_integration_results(results: dict[str, str]) -> None:
103
+ for key, action in results.items():
104
+ if action == "unchanged":
105
+ continue
106
+ if key.startswith("git:"):
107
+ console.print(f"[green].git/hooks/{key[4:]} {action}[/]")
108
+ elif key == "vscode:tasks":
109
+ console.print(f"[green].vscode/tasks.json {action}[/]")
110
+ else:
111
+ console.print(f"[green]{key} {action}[/]")
112
+
113
+
62
114
  def register(app: typer.Typer) -> None:
63
115
  @app.command()
64
116
  def init(
@@ -150,6 +202,7 @@ def register(app: typer.Typer) -> None:
150
202
  from agentpack.core.config import load_config
151
203
  resolved_mode = load_config(root).context.default_mode
152
204
  existing_session = load_session(root)
205
+ resolved_agent = agent
153
206
  if existing_session is None or force:
154
207
  from agentpack.adapters.detect import detect_agent
155
208
  resolved_agent = agent if agent != "auto" else detect_agent(root)
@@ -158,6 +211,10 @@ def register(app: typer.Typer) -> None:
158
211
  console.print(f"[green]Created[/] {TASK_FILE} [dim]edit to set your task[/]")
159
212
  else:
160
213
  console.print(f"[dim]Skipped[/] {SESSION_FILE} (exists)")
214
+ if agent == "auto":
215
+ resolved_agent = existing_session.agent
216
+
217
+ _print_agent_integration_results(_install_agent_integration(root, resolved_agent))
161
218
 
162
219
  console.print("\n[bold green]AgentPack initialized.[/]")
163
220
  console.print("Run [bold]agentpack watch[/] to start auto-refreshing context.")
@@ -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