auto-context-cli 1.0.5__tar.gz → 1.0.6__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 (36) hide show
  1. {auto_context_cli-1.0.5 → auto_context_cli-1.0.6}/PKG-INFO +2 -2
  2. {auto_context_cli-1.0.5 → auto_context_cli-1.0.6}/README.md +1 -1
  3. {auto_context_cli-1.0.5 → auto_context_cli-1.0.6}/pyproject.toml +1 -1
  4. auto_context_cli-1.0.6/src/auto_context/__init__.py +16 -0
  5. {auto_context_cli-1.0.5 → auto_context_cli-1.0.6}/src/auto_context/commands/init_cmd.py +3 -3
  6. {auto_context_cli-1.0.5 → auto_context_cli-1.0.6}/src/auto_context/commands/mcp.py +7 -2
  7. {auto_context_cli-1.0.5 → auto_context_cli-1.0.6}/src/auto_context/commands/memory.py +12 -1
  8. {auto_context_cli-1.0.5 → auto_context_cli-1.0.6}/src/auto_context/config.py +11 -12
  9. {auto_context_cli-1.0.5 → auto_context_cli-1.0.6}/src/auto_context/main.py +1 -1
  10. {auto_context_cli-1.0.5 → auto_context_cli-1.0.6}/src/auto_context/scanner.py +4 -3
  11. {auto_context_cli-1.0.5 → auto_context_cli-1.0.6}/src/auto_context/security.py +10 -5
  12. auto_context_cli-1.0.5/src/auto_context/__init__.py +0 -3
  13. {auto_context_cli-1.0.5 → auto_context_cli-1.0.6}/.gitignore +0 -0
  14. {auto_context_cli-1.0.5 → auto_context_cli-1.0.6}/LICENSE +0 -0
  15. {auto_context_cli-1.0.5 → auto_context_cli-1.0.6}/src/auto_context/commands/__init__.py +0 -0
  16. {auto_context_cli-1.0.5 → auto_context_cli-1.0.6}/src/auto_context/commands/import_cmd.py +0 -0
  17. {auto_context_cli-1.0.5 → auto_context_cli-1.0.6}/src/auto_context/commands/scan_cmd.py +0 -0
  18. {auto_context_cli-1.0.5 → auto_context_cli-1.0.6}/src/auto_context/commands/share.py +0 -0
  19. {auto_context_cli-1.0.5 → auto_context_cli-1.0.6}/src/auto_context/commands/update_cmd.py +0 -0
  20. {auto_context_cli-1.0.5 → auto_context_cli-1.0.6}/src/auto_context/templates/AGENTS.template.md +0 -0
  21. {auto_context_cli-1.0.5 → auto_context_cli-1.0.6}/src/auto_context/templates/GEMINI.template.md +0 -0
  22. {auto_context_cli-1.0.5 → auto_context_cli-1.0.6}/src/auto_context/templates/context.local.template.md +0 -0
  23. {auto_context_cli-1.0.5 → auto_context_cli-1.0.6}/src/auto_context/templates/context.template.md +0 -0
  24. {auto_context_cli-1.0.5 → auto_context_cli-1.0.6}/src/auto_context/templates/maintain_context.template.md +0 -0
  25. {auto_context_cli-1.0.5 → auto_context_cli-1.0.6}/src/auto_context/templates/mcp_config.template.json +0 -0
  26. {auto_context_cli-1.0.5 → auto_context_cli-1.0.6}/src/auto_context/templates/profile.template.md +0 -0
  27. {auto_context_cli-1.0.5 → auto_context_cli-1.0.6}/src/auto_context/templates/rule.template.md +0 -0
  28. {auto_context_cli-1.0.5 → auto_context_cli-1.0.6}/src/auto_context/templates/rules/code-standards.md +0 -0
  29. {auto_context_cli-1.0.5 → auto_context_cli-1.0.6}/src/auto_context/templates/rules/hub-satellite-architecture.md +0 -0
  30. {auto_context_cli-1.0.5 → auto_context_cli-1.0.6}/src/auto_context/templates/rules/readme-docs-sync.md +0 -0
  31. {auto_context_cli-1.0.5 → auto_context_cli-1.0.6}/src/auto_context/templates/rules/security-boundaries.md +0 -0
  32. {auto_context_cli-1.0.5 → auto_context_cli-1.0.6}/src/auto_context/templates/skill.template.md +0 -0
  33. {auto_context_cli-1.0.5 → auto_context_cli-1.0.6}/src/auto_context/templates/skills/browser-testing/SKILL.md +0 -0
  34. {auto_context_cli-1.0.5 → auto_context_cli-1.0.6}/src/auto_context/templates/skills/docker-ops/SKILL.md +0 -0
  35. {auto_context_cli-1.0.5 → auto_context_cli-1.0.6}/src/auto_context/templates/skills/git-workflow/SKILL.md +0 -0
  36. {auto_context_cli-1.0.5 → auto_context_cli-1.0.6}/src/auto_context/templates/skills/server-diagnostics/SKILL.md +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: auto-context-cli
3
- Version: 1.0.5
3
+ Version: 1.0.6
4
4
  Summary: Autonomous context & instruction manager for AI coding assistants
5
5
  Author: Arghya Biswas
6
6
  License: MIT
@@ -20,7 +20,7 @@ Description-Content-Type: text/markdown
20
20
 
21
21
  [![PyPI - Version](https://img.shields.io/pypi/v/auto-context-cli.svg?color=blue)](https://pypi.org/project/auto-context-cli/)
22
22
  [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/auto-context-cli.svg)](https://pypi.org/project/auto-context-cli/)
23
- [![GitHub Release](https://img.shields.io/github/v/release/Cyber-arghya/auto-context?color=green)](https://github.com/Cyber-arghya/auto-context/releases/tag/v1.0.5)
23
+ [![GitHub Release](https://img.shields.io/github/v/release/Cyber-arghya/auto-context?color=green)](https://github.com/Cyber-arghya/auto-context/releases/tag/v1.0.6)
24
24
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
25
25
  [![Platform](https://img.shields.io/badge/Platform-Windows%20%7C%20macOS%20%7C%20Linux%20WSL2-success.svg)](#-quick-one-line-install)
26
26
  [![AI Supported](https://img.shields.io/badge/AI%20Supported-Antigravity%20%7C%20Cursor%20%7C%20Claude%20Code%20%7C%20Copilot%20%7C%20Windsurf-orange.svg)](#-supported-ai-assistants)
@@ -6,7 +6,7 @@
6
6
 
7
7
  [![PyPI - Version](https://img.shields.io/pypi/v/auto-context-cli.svg?color=blue)](https://pypi.org/project/auto-context-cli/)
8
8
  [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/auto-context-cli.svg)](https://pypi.org/project/auto-context-cli/)
9
- [![GitHub Release](https://img.shields.io/github/v/release/Cyber-arghya/auto-context?color=green)](https://github.com/Cyber-arghya/auto-context/releases/tag/v1.0.5)
9
+ [![GitHub Release](https://img.shields.io/github/v/release/Cyber-arghya/auto-context?color=green)](https://github.com/Cyber-arghya/auto-context/releases/tag/v1.0.6)
10
10
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
11
11
  [![Platform](https://img.shields.io/badge/Platform-Windows%20%7C%20macOS%20%7C%20Linux%20WSL2-success.svg)](#-quick-one-line-install)
12
12
  [![AI Supported](https://img.shields.io/badge/AI%20Supported-Antigravity%20%7C%20Cursor%20%7C%20Claude%20Code%20%7C%20Copilot%20%7C%20Windsurf-orange.svg)](#-supported-ai-assistants)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "auto-context-cli"
3
- version = "1.0.5"
3
+ version = "1.0.6"
4
4
  description = "Autonomous context & instruction manager for AI coding assistants"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -0,0 +1,16 @@
1
+ """auto-context: Autonomous context & instruction manager for AI coding assistants."""
2
+ import sys
3
+
4
+ # Ensure UTF-8 stream handling across all operating systems (guards Windows cp1252 charmap crashes)
5
+ if hasattr(sys.stdout, "reconfigure"):
6
+ try:
7
+ sys.stdout.reconfigure(encoding="utf-8", errors="replace")
8
+ except Exception:
9
+ pass
10
+ if hasattr(sys.stderr, "reconfigure"):
11
+ try:
12
+ sys.stderr.reconfigure(encoding="utf-8", errors="replace")
13
+ except Exception:
14
+ pass
15
+
16
+ __version__ = "1.0.6"
@@ -218,10 +218,10 @@ def init(
218
218
  ".env.*.local",
219
219
  ])
220
220
 
221
- # ── Stack-Adaptive Satellites (.agents/context/) ───────────────────────
221
+ # ── Stack-Adaptive Satellites & Executive Hub Sync ────────────────────
222
222
  try:
223
- from auto_context import scanner
224
- scanner.generate_satellites(project_dir, force=force)
223
+ from auto_context.commands import scan_cmd
224
+ scan_cmd.scan(target=project_dir, force=force)
225
225
  except Exception:
226
226
  pass
227
227
 
@@ -10,8 +10,10 @@ from __future__ import annotations
10
10
 
11
11
  import json
12
12
  import os
13
- import stat
14
13
  from pathlib import Path
14
+ import shlex
15
+ import stat
16
+ import sys
15
17
  from typing import Annotated, Optional
16
18
 
17
19
  import typer
@@ -199,7 +201,10 @@ def add_mcp(
199
201
  elif command:
200
202
  server_cfg = {"command": command}
201
203
  if args:
202
- server_cfg["args"] = args.split()
204
+ try:
205
+ server_cfg["args"] = shlex.split(args, posix=(sys.platform != "win32"))
206
+ except Exception:
207
+ server_cfg["args"] = args.split()
203
208
  if env_var:
204
209
  server_cfg.setdefault("env", {})[env_var] = f"${{{env_var}}}"
205
210
  if not global_:
@@ -146,6 +146,14 @@ def _write_profile(repo_name: str) -> None:
146
146
 
147
147
  # ── local harvester ─────────────────────────────────────────────────────────
148
148
 
149
+ LOCAL_SYSTEM_RULES: frozenset[str] = frozenset({
150
+ "maintain_context.md",
151
+ "AGENTS.md",
152
+ "GEMINI.md",
153
+ "context.local.md",
154
+ })
155
+
156
+
149
157
  def _sync_local_to_memory(project_dir: Path) -> int:
150
158
  """Harvest newly created local project rules & skills into central memory."""
151
159
  harvested = 0
@@ -154,7 +162,10 @@ def _sync_local_to_memory(project_dir: Path) -> int:
154
162
  if local_rules.exists():
155
163
  (MEMORY_DIR / "rules").mkdir(parents=True, exist_ok=True)
156
164
  for rfile in local_rules.glob("*.md"):
157
- # Skip standard default boilerplates from polluting memory if already synced
165
+ # Exclude project-specific local instructions from polluting central memory
166
+ if rfile.name in LOCAL_SYSTEM_RULES or rfile.name.endswith(".local.md"):
167
+ continue
168
+
158
169
  dest = MEMORY_DIR / "rules" / rfile.name
159
170
  if not dest.exists():
160
171
  shutil.copy2(rfile, dest)
@@ -10,22 +10,21 @@ from pathlib import Path
10
10
 
11
11
  def get_templates_dir() -> Path:
12
12
  """
13
- Return the templates directory in a way that works both during development
14
- (uv run / editable install) and after a wheel install (uv tool install .).
15
-
16
- importlib.resources.files() is the PEP 451-compliant way to locate data
17
- files that are bundled inside a Python package, regardless of whether the
18
- package is installed as a wheel, a zip, or an editable source tree.
13
+ Return the templates directory in a crash-proof, persistent way
14
+ that works during development, wheel installs, and virtual environments.
19
15
  """
16
+ pkg_tmpl = Path(__file__).parent / "templates"
17
+ if pkg_tmpl.is_dir():
18
+ return pkg_tmpl
19
+
20
20
  try:
21
- # Python 3.9+ path — works in wheel and editable installs
22
21
  ref = _pkg_resources.files("auto_context").joinpath("templates")
23
- # Materialise to a real Path so callers can use glob(), iterdir(), etc.
24
- with _pkg_resources.as_file(ref) as p:
25
- return p
22
+ if isinstance(ref, Path) and ref.is_dir():
23
+ return ref
26
24
  except Exception:
27
- # Hard fallback: source-tree layout (should never be reached in practice)
28
- return Path(__file__).parent / "templates"
25
+ pass
26
+
27
+ return pkg_tmpl
29
28
 
30
29
 
31
30
  # ── User home-relative roots ───────────────────────────────────────────────────
@@ -69,7 +69,7 @@ def root(
69
69
  try:
70
70
  v = pkg_version("auto-context")
71
71
  except Exception:
72
- v = "1.0.5"
72
+ v = "1.0.6"
73
73
  console.print(f"init-context v{v}")
74
74
  raise typer.Exit()
75
75
 
@@ -404,9 +404,9 @@ def generate_satellites(project_dir: Path, force: bool = False) -> dict[str, Pat
404
404
  write_idempotent(schema_path, schema_content, "Schema Satellite")
405
405
  generated["schema"] = schema_path
406
406
 
407
- # 3. gotchas.md (Critical Traps & Anti-Patterns — Replaces useless bug diaries)
407
+ # 3. gotchas.md (Critical Traps & Anti-Patterns — Preserved even with --force to prevent knowledge loss)
408
408
  gotchas_path = satellites_dir / "gotchas.md"
409
- if not gotchas_path.exists() or force:
409
+ if not gotchas_path.exists():
410
410
  gotchas_content = (
411
411
  "# Critical Gotchas, Anti-Patterns & Architecture Invariants\n\n"
412
412
  "> Institutional knowledge and non-obvious traps that cannot be guessed from reading code.\n\n"
@@ -414,8 +414,9 @@ def generate_satellites(project_dir: Path, force: bool = False) -> dict[str, Pat
414
414
  "1. **Port Invariants:** Inspect discovered ports before binding local services.\n"
415
415
  "2. **Secret Isolation:** Production secrets belong in `.env`; dummy dev accounts belong in `context.local.md`.\n"
416
416
  "3. **State Boundaries:** Verify migrations before initiating build or release cycles.\n"
417
+ "4. **Verified Executable Runbooks:** Never accept or generate slash-separated placeholder commands (`cmd1 / cmd2`). Runbooks must only contain 100% executable commands parsed from manifests or verified CLI tools.\n"
417
418
  )
418
419
  write_idempotent(gotchas_path, gotchas_content, "Gotchas Satellite")
419
- generated["gotchas"] = gotchas_path
420
+ generated["gotchas"] = gotchas_path
420
421
 
421
422
  return generated
@@ -33,20 +33,25 @@ PROHIBITED_EXTENSIONS: frozenset[str] = frozenset({
33
33
  ".pem", ".key", ".pkcs12", ".p12", ".pfx", ".kdbx",
34
34
  })
35
35
 
36
+ IGNORE_AUDIT_DIRS: frozenset[str] = frozenset({
37
+ ".git", "node_modules", ".venv", "venv", "__pycache__",
38
+ "dist", "build", ".next", ".turbo", ".nuxt", ".cache", ".idea", ".vscode"
39
+ })
40
+
36
41
  # ── Secret patterns (name → compiled regex) ──────────────────────────────────
37
42
  _RAW_PATTERNS: list[tuple[str, str]] = [
38
43
  ("GitHub Token", r"(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9_]{36,}"),
39
44
  ("GitHub Fine-grained PAT", r"github_pat_[A-Za-z0-9_]{50,}"),
40
45
  ("Stripe Live Key", r"sk_live_[0-9a-zA-Z]{24,}"),
41
- ("OpenAI API Key", r"sk-[a-zA-Z0-9_\-]{32,}"),
42
- ("Anthropic API Key", r"sk-ant-[a-zA-Z0-9_\-]{32,}"),
43
46
  ("OpenAI Project Key", r"sk-proj-[a-zA-Z0-9_\-]{40,}"),
47
+ ("Anthropic API Key", r"sk-ant-[a-zA-Z0-9_\-]{32,}"),
48
+ ("OpenAI API Key", r"sk-[a-zA-Z0-9_\-]{32,}"),
44
49
  ("Google API Key", r"AIza[0-9A-Za-z\-_]{35}"),
45
50
  ("AWS Access Key ID", r"AKIA[0-9A-Z]{16}"),
46
51
  ("Private Key Block", r"-----BEGIN (?:RSA |EC |DSA |OPENSSH )?PRIVATE KEY-----"),
47
52
  ("Hardcoded Secret/Password",
48
53
  r'(?i)(?:password|secret|api[_-]?key|access[_-]?token)\s*[:=]\s*[\'"]'
49
- r'(?!(?:YOUR_|REPLACE_|MOCK_|TEST_|DUMMY_|\{\{|<))'
54
+ r'(?!(?:YOUR_|REPLACE_|MOCK_|TEST_|DUMMY_|\{\{|\<|\$\{))'
50
55
  r'[A-Za-z0-9_\-\.\$\!\@\#\%\^\&\*\(\)\+]{8,}[\'"]'),
51
56
  ]
52
57
 
@@ -120,8 +125,8 @@ def audit_path(path: Path, *, single_file: bool = False) -> list[Violation]:
120
125
  violations.extend(_scan_file(path))
121
126
  else:
122
127
  for child in path.rglob("*"):
123
- # Skip .git internals
124
- if ".git" in child.parts:
128
+ # Skip VCS and bulky dependency directories
129
+ if any(part in IGNORE_AUDIT_DIRS for part in child.parts):
125
130
  continue
126
131
  if child.is_file():
127
132
  violations.extend(_scan_file(child))
@@ -1,3 +0,0 @@
1
- """auto-context: Autonomous context & instruction manager for AI coding assistants."""
2
-
3
- __version__ = "1.0.5"