agentpack-cli 0.1.0__py3-none-any.whl

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 (80) hide show
  1. agentpack/__init__.py +3 -0
  2. agentpack/adapters/__init__.py +0 -0
  3. agentpack/adapters/base.py +22 -0
  4. agentpack/adapters/claude.py +32 -0
  5. agentpack/adapters/codex.py +26 -0
  6. agentpack/adapters/cursor.py +29 -0
  7. agentpack/adapters/generic.py +18 -0
  8. agentpack/adapters/windsurf.py +26 -0
  9. agentpack/analysis/__init__.py +0 -0
  10. agentpack/analysis/dependency_graph.py +80 -0
  11. agentpack/analysis/go_imports.py +32 -0
  12. agentpack/analysis/java_imports.py +19 -0
  13. agentpack/analysis/js_ts_imports.py +53 -0
  14. agentpack/analysis/python_imports.py +45 -0
  15. agentpack/analysis/ranking.py +400 -0
  16. agentpack/analysis/rust_imports.py +32 -0
  17. agentpack/analysis/symbols.py +154 -0
  18. agentpack/analysis/tests.py +30 -0
  19. agentpack/application/__init__.py +0 -0
  20. agentpack/application/pack_service.py +352 -0
  21. agentpack/cli.py +33 -0
  22. agentpack/commands/__init__.py +0 -0
  23. agentpack/commands/_shared.py +13 -0
  24. agentpack/commands/benchmark.py +302 -0
  25. agentpack/commands/claude_cmd.py +55 -0
  26. agentpack/commands/diff.py +46 -0
  27. agentpack/commands/doctor.py +185 -0
  28. agentpack/commands/explain.py +238 -0
  29. agentpack/commands/init.py +79 -0
  30. agentpack/commands/install.py +252 -0
  31. agentpack/commands/monitor.py +105 -0
  32. agentpack/commands/pack.py +188 -0
  33. agentpack/commands/scan.py +51 -0
  34. agentpack/commands/session.py +204 -0
  35. agentpack/commands/stats.py +138 -0
  36. agentpack/commands/status.py +37 -0
  37. agentpack/commands/summarize.py +64 -0
  38. agentpack/commands/watch.py +185 -0
  39. agentpack/core/__init__.py +0 -0
  40. agentpack/core/bootstrap.py +46 -0
  41. agentpack/core/cache.py +41 -0
  42. agentpack/core/config.py +101 -0
  43. agentpack/core/context_pack.py +222 -0
  44. agentpack/core/diff.py +40 -0
  45. agentpack/core/git.py +145 -0
  46. agentpack/core/git_hooks.py +8 -0
  47. agentpack/core/global_install.py +14 -0
  48. agentpack/core/ignore.py +66 -0
  49. agentpack/core/merkle.py +8 -0
  50. agentpack/core/models.py +115 -0
  51. agentpack/core/redactor.py +99 -0
  52. agentpack/core/scanner.py +150 -0
  53. agentpack/core/snapshot.py +60 -0
  54. agentpack/core/token_estimator.py +26 -0
  55. agentpack/core/vscode_tasks.py +5 -0
  56. agentpack/data/agentpack.md +160 -0
  57. agentpack/installers/__init__.py +0 -0
  58. agentpack/installers/claude.py +160 -0
  59. agentpack/installers/codex.py +54 -0
  60. agentpack/installers/cursor.py +76 -0
  61. agentpack/installers/windsurf.py +50 -0
  62. agentpack/integrations/__init__.py +0 -0
  63. agentpack/integrations/git_hooks.py +109 -0
  64. agentpack/integrations/global_install.py +221 -0
  65. agentpack/integrations/vscode_tasks.py +85 -0
  66. agentpack/renderers/__init__.py +3 -0
  67. agentpack/renderers/compact.py +75 -0
  68. agentpack/renderers/markdown.py +144 -0
  69. agentpack/renderers/receipts.py +10 -0
  70. agentpack/session/__init__.py +33 -0
  71. agentpack/session/state.py +105 -0
  72. agentpack/summaries/__init__.py +0 -0
  73. agentpack/summaries/base.py +42 -0
  74. agentpack/summaries/llm.py +100 -0
  75. agentpack/summaries/offline.py +97 -0
  76. agentpack_cli-0.1.0.dist-info/METADATA +1391 -0
  77. agentpack_cli-0.1.0.dist-info/RECORD +80 -0
  78. agentpack_cli-0.1.0.dist-info/WHEEL +4 -0
  79. agentpack_cli-0.1.0.dist-info/entry_points.txt +2 -0
  80. agentpack_cli-0.1.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,97 @@
1
+ from __future__ import annotations
2
+
3
+ import ast
4
+ import re
5
+ from pathlib import Path
6
+
7
+ from agentpack.core.models import FileSummary, Symbol
8
+ from agentpack.analysis.symbols import extract_python_symbols, extract_js_symbols
9
+ from agentpack.analysis.python_imports import extract_imports as py_imports
10
+ from agentpack.analysis.js_ts_imports import extract_imports as js_imports
11
+
12
+
13
+ def summarize(path: str, abs_path: Path, language: str | None, file_hash: str) -> FileSummary:
14
+ if language == "python":
15
+ return _python_summary(path, abs_path, file_hash)
16
+ if language in ("javascript", "typescript"):
17
+ return _js_summary(path, abs_path, language, file_hash)
18
+ return _generic_summary(path, abs_path, language, file_hash)
19
+
20
+
21
+ def _python_summary(path: str, abs_path: Path, file_hash: str) -> FileSummary:
22
+ imports = py_imports(abs_path)
23
+ symbols = extract_python_symbols(abs_path)
24
+
25
+ top_level_imports = [i for i in imports if not i.startswith(".")][:8]
26
+ exposed = [s.name for s in symbols if s.kind in ("class", "function")][:8]
27
+
28
+ parts = [f"Language: Python"]
29
+ if exposed:
30
+ parts.append(f"Exposes: {', '.join(exposed)}")
31
+ if top_level_imports:
32
+ parts.append(f"Imports: {', '.join(top_level_imports)}")
33
+ parts.append(f"Likely responsibility: {_infer_responsibility(path, exposed)}")
34
+
35
+ return FileSummary(
36
+ path=path,
37
+ hash=file_hash,
38
+ language="python",
39
+ provider="offline",
40
+ schema_version=1,
41
+ summary="\n- ".join([""] + parts).lstrip("\n- ") if parts else "",
42
+ imports=imports[:20],
43
+ symbols=symbols,
44
+ )
45
+
46
+
47
+ def _js_summary(path: str, abs_path: Path, language: str, file_hash: str) -> FileSummary:
48
+ imports = js_imports(abs_path)
49
+ symbols = extract_js_symbols(abs_path)
50
+
51
+ rel_imports = [i for i in imports if not i.startswith(".")][:8]
52
+ exposed = [s.name for s in symbols][:8]
53
+
54
+ parts = [f"Language: {language.capitalize()}"]
55
+ if exposed:
56
+ parts.append(f"Exposes: {', '.join(exposed)}")
57
+ if rel_imports:
58
+ parts.append(f"Imports: {', '.join(rel_imports)}")
59
+ parts.append(f"Likely responsibility: {_infer_responsibility(path, exposed)}")
60
+
61
+ return FileSummary(
62
+ path=path,
63
+ hash=file_hash,
64
+ language=language,
65
+ provider="offline",
66
+ schema_version=1,
67
+ summary="\n- ".join([""] + parts).lstrip("\n- ") if parts else "",
68
+ imports=imports[:20],
69
+ symbols=symbols,
70
+ )
71
+
72
+
73
+ def _generic_summary(path: str, abs_path: Path, language: str | None, file_hash: str) -> FileSummary:
74
+ try:
75
+ lines = abs_path.read_text(errors="replace").splitlines()[:30]
76
+ snippet = "\n".join(lines)
77
+ except OSError:
78
+ snippet = ""
79
+
80
+ return FileSummary(
81
+ path=path,
82
+ hash=file_hash,
83
+ language=language,
84
+ provider="offline",
85
+ schema_version=1,
86
+ summary=f"Language: {language or 'unknown'}\nFirst lines:\n{snippet[:300]}",
87
+ imports=[],
88
+ symbols=[],
89
+ )
90
+
91
+
92
+ def _infer_responsibility(path: str, symbols: list[str]) -> str:
93
+ path_lower = path.lower()
94
+ hint = Path(path).stem.replace("_", " ")
95
+ if symbols:
96
+ return f"{hint} based on path and symbols ({', '.join(symbols[:3])})"
97
+ return f"{hint} based on path"