auto-context-cli 1.0.1__tar.gz → 1.0.3__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.1 → auto_context_cli-1.0.3}/PKG-INFO +160 -34
  2. {auto_context_cli-1.0.1 → auto_context_cli-1.0.3}/README.md +159 -33
  3. {auto_context_cli-1.0.1 → auto_context_cli-1.0.3}/pyproject.toml +1 -1
  4. {auto_context_cli-1.0.1 → auto_context_cli-1.0.3}/src/auto_context/__init__.py +1 -1
  5. {auto_context_cli-1.0.1 → auto_context_cli-1.0.3}/src/auto_context/commands/init_cmd.py +7 -0
  6. auto_context_cli-1.0.3/src/auto_context/commands/scan_cmd.py +133 -0
  7. auto_context_cli-1.0.3/src/auto_context/commands/update_cmd.py +392 -0
  8. {auto_context_cli-1.0.1 → auto_context_cli-1.0.3}/src/auto_context/config.py +28 -0
  9. {auto_context_cli-1.0.1 → auto_context_cli-1.0.3}/src/auto_context/main.py +21 -3
  10. auto_context_cli-1.0.3/src/auto_context/scanner.py +297 -0
  11. {auto_context_cli-1.0.1 → auto_context_cli-1.0.3}/src/auto_context/templates/AGENTS.template.md +1 -0
  12. {auto_context_cli-1.0.1 → auto_context_cli-1.0.3}/src/auto_context/templates/GEMINI.template.md +1 -0
  13. auto_context_cli-1.0.3/src/auto_context/templates/context.template.md +53 -0
  14. {auto_context_cli-1.0.1 → auto_context_cli-1.0.3}/src/auto_context/templates/maintain_context.template.md +1 -0
  15. auto_context_cli-1.0.3/src/auto_context/templates/rules/hub-satellite-architecture.md +33 -0
  16. auto_context_cli-1.0.3/src/auto_context/templates/rules/readme-docs-sync.md +23 -0
  17. auto_context_cli-1.0.1/src/auto_context/templates/context.template.md +0 -94
  18. {auto_context_cli-1.0.1 → auto_context_cli-1.0.3}/.gitignore +0 -0
  19. {auto_context_cli-1.0.1 → auto_context_cli-1.0.3}/LICENSE +0 -0
  20. {auto_context_cli-1.0.1 → auto_context_cli-1.0.3}/src/auto_context/commands/__init__.py +0 -0
  21. {auto_context_cli-1.0.1 → auto_context_cli-1.0.3}/src/auto_context/commands/import_cmd.py +0 -0
  22. {auto_context_cli-1.0.1 → auto_context_cli-1.0.3}/src/auto_context/commands/mcp.py +0 -0
  23. {auto_context_cli-1.0.1 → auto_context_cli-1.0.3}/src/auto_context/commands/memory.py +0 -0
  24. {auto_context_cli-1.0.1 → auto_context_cli-1.0.3}/src/auto_context/commands/share.py +0 -0
  25. {auto_context_cli-1.0.1 → auto_context_cli-1.0.3}/src/auto_context/security.py +0 -0
  26. {auto_context_cli-1.0.1 → auto_context_cli-1.0.3}/src/auto_context/templates/context.local.template.md +0 -0
  27. {auto_context_cli-1.0.1 → auto_context_cli-1.0.3}/src/auto_context/templates/mcp_config.template.json +0 -0
  28. {auto_context_cli-1.0.1 → auto_context_cli-1.0.3}/src/auto_context/templates/profile.template.md +0 -0
  29. {auto_context_cli-1.0.1 → auto_context_cli-1.0.3}/src/auto_context/templates/rule.template.md +0 -0
  30. {auto_context_cli-1.0.1 → auto_context_cli-1.0.3}/src/auto_context/templates/rules/code-standards.md +0 -0
  31. {auto_context_cli-1.0.1 → auto_context_cli-1.0.3}/src/auto_context/templates/rules/security-boundaries.md +0 -0
  32. {auto_context_cli-1.0.1 → auto_context_cli-1.0.3}/src/auto_context/templates/skill.template.md +0 -0
  33. {auto_context_cli-1.0.1 → auto_context_cli-1.0.3}/src/auto_context/templates/skills/browser-testing/SKILL.md +0 -0
  34. {auto_context_cli-1.0.1 → auto_context_cli-1.0.3}/src/auto_context/templates/skills/docker-ops/SKILL.md +0 -0
  35. {auto_context_cli-1.0.1 → auto_context_cli-1.0.3}/src/auto_context/templates/skills/git-workflow/SKILL.md +0 -0
  36. {auto_context_cli-1.0.1 → auto_context_cli-1.0.3}/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.1
3
+ Version: 1.0.3
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.1)
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.3)
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)
@@ -75,40 +75,65 @@ cd /path/to/any-project
75
75
  init-context
76
76
  ```
77
77
 
78
- ### Options & Flags:
78
+ ### Command Reference & Syntax:
79
+
80
+ Auto-Context supports both modern subcommands (`init-context <command>`) and standard legacy flags:
81
+
82
+ | Command | Shorthand / Flag | Description |
83
+ | :--- | :--- | :--- |
84
+ | `init-context init [DIR]` | `init-context [DIR]` | Scaffolds 5-tier context in active or specified directory. |
85
+ | `init-context scan [DIR]` | `init-context --scan` | Stack-adaptive codebase scanner: generates satellites (.agents/context/). |
86
+ | `init-context rule <name>` | `init-context -r <name>` | Scaffolds a new agent rule with YAML frontmatter. |
87
+ | `init-context skill <name>` | `init-context -s <name>` | Scaffolds a new agent skill directory with triggers & runbook. |
88
+ | `init-context promote <name>` | — | Promotes local workspace rule/skill to Global Plugin & Central Memory. |
89
+ | `init-context update` | — | Modular, non-breaking update for CLI, global plugin & system rules. |
90
+ | `init-context share <name>` | — | Audits secrets and shares a rule or skill via GitHub Gist. |
91
+ | `init-context import <url>` | — | Imports a rule or skill with 3-way Collision Guard protection. |
92
+ | `init-context memory init` | — | Initializes private GitHub brain repository (`~/.auto-context/memory`). |
93
+ | `init-context memory push` | — | Auto-harvests workspace rules, audits secrets & pushes to private GitHub. |
94
+ | `init-context memory pull` | — | Pulls and restores central brain on a new machine. |
95
+ | `init-context memory status` | — | Displays central brain location, remote URL, and rules/skills count. |
96
+ | `init-context mcp add <name>`| `init-context --add-mcp` | Adds or updates an MCP tool (Node `npx` or Python `uvx`). |
97
+ | `init-context mcp list` | `init-context --list-mcp` | Lists all active MCP server configurations. |
98
+ | `init-context mcp remove <name>`| `init-context --remove-mcp` | Safely removes an MCP server configuration. |
99
+
100
+ ### Global Flags:
101
+ * `-g, --global`: Targets machine-wide scope (`~/.gemini/config/plugins/auto-context/` & `~/.auto-context/memory/`).
102
+ * `-f, --force`: Overwrites existing files (bypasses collision guards with confirmation).
103
+ * `-d, --dry-run`: Previews actions without writing files or modifying directories.
104
+ * `-v, --version`: Displays installed package version.
105
+
106
+ ---
107
+
108
+ ## 🔄 Modular Upstream Sync & Non-Breaking Updates (আপডেট ও সিঙ্ক)
109
+
110
+ When new public rules, skills, or agent capabilities are added to the official [Cyber-arghya/auto-context](https://github.com/Cyber-arghya/auto-context) repository:
111
+
112
+ ### 1️⃣ Automatic Background Notification
113
+ `auto-context` includes a lightweight, cached (24h TTL) update notifier. Whenever you or an AI agent runs `init-context`, it unobtrusively checks PyPI and GitHub. If new upstream rules or versions are available, a clean banner is displayed:
79
114
  ```text
80
- init-context [OPTIONS] [DIRECTORY]
81
-
82
- OPTIONS (CONTEXT & RULES):
83
- -r, --new-rule <NAME> Scaffold a new rule file (.agents/rules/<name>.md)
84
- -s, --new-skill <NAME> Scaffold a new skill folder (.agents/skills/<name>/SKILL.md)
85
- -g, --global Target global plugin scope (~/.gemini/config/plugins/auto-context/)
86
- -f, --force Overwrite existing context.md and standing rule files
87
- -d, --dry-run Preview generated structure without writing to disk
88
- -v, --version Display current version
89
- -h, --help Show help documentation
90
-
91
- OPTIONS (CENTRAL MEMORY & GRANULAR SHARING):
92
- memory init [REPO] Initialize private central memory repo (~/.auto-context/memory)
93
- memory push Audit secrets & push memory brain to private GitHub repo
94
- memory pull [URL] Pull & sync central memory brain from remote repo
95
- memory status Show status of central memory brain
96
- share <NAME> Audit & publish skill or rule to GitHub Gist
97
- import <URL> Audit & import skill or rule from GitHub Gist or URL
98
- --as <NAME> Custom name when importing a skill or rule
99
- --public Publish shared Gist as public (default)
100
- --secret, --private Publish shared Gist as unlisted/secret
101
-
102
- OPTIONS (MCP TOOLING):
103
- --add-mcp <NAME> Add or update an MCP server configuration
104
- --remove-mcp <NAME> Remove an MCP server from configuration
105
- --list-mcp List all active MCP server tools
106
- --preset <PRESET> Preset template (sqlite, postgres, github, filesystem, brave, fetch)
107
- --command <CMD> Executable command for stdio server (e.g. npx, uvx, python3)
108
- --args <ARGS> Arguments to pass to command
109
- --url <URL> Streamable HTTP endpoint URL for remote MCP server
110
- --env <KEY=VAL,...> Environment variables (e.g. 'GITHUB_TOKEN=xyz')
115
+ ╭─────────────────────────────────────────────────────────────────────────────╮
116
+ │ 🔔 Auto-Context Update Available: v1.0.1 → v1.0.2 │
117
+ │ New public rules, skills, and upstream capabilities are ready. │
118
+ │ Run 'init-context update' to sync modularly without breaking local context.│
119
+ ╰─────────────────────────────────────────────────────────────────────────────╯
120
+ ```
121
+
122
+ ### 2️⃣ 1-Command Safe Modular Update
123
+ Run:
124
+ ```bash
125
+ init-context update
111
126
  ```
127
+ - **Upgrades CLI Package:** Automatically updates `auto-context-cli` via `uv tool`, `pipx`, or `pip`.
128
+ - **Syncs Global Plugin:** Updates `~/.gemini/config/plugins/auto-context/` (`rules/AGENTS.md`, `skills/auto-context/SKILL.md`) with upstream instructions.
129
+ - **Syncs Workspace System Rules:** Updates system rules (`.agents/rules/maintain_context.md`, `AGENTS.md`, `GEMINI.md`).
130
+
131
+ > [!TIP]
132
+ > **Strict Non-Breaking Guarantees:**
133
+ > - **Zero Context Loss:** `context.md` is **NEVER** modified or overwritten. All project credentials, architecture diagrams, and problem history remain 100% intact.
134
+ > - **Secret Protection:** `context.local.md`, `.env`, and test logins are **NEVER** touched.
135
+ > - **Custom Rule Safety:** Your personal rules (e.g. `docker-multi-stage.md`, `my-style.md`) are **NEVER** overwritten or deleted.
136
+ > - **Automatic Backup:** If you customized `AGENTS.md`, the updater automatically creates an `AGENTS.md.bak` backup.
112
137
 
113
138
  ---
114
139
 
@@ -272,6 +297,68 @@ triggers: ["docker", "container", "compose", "dockerfile"]
272
297
 
273
298
  ---
274
299
 
300
+ ## 🚀 Rule Promotion & Auto-Harvesting (`init-context promote`)
301
+
302
+ Sometimes a rule or workflow starts as a quick experiment in one project, but proves so valuable that you want every project across your machine and team to inherit it.
303
+
304
+ ### 1️⃣ 1-Command Rule Promotion
305
+ ```bash
306
+ init-context promote docker-multi-stage
307
+ ```
308
+ * **Elevates Local to Global:** Copies `.agents/rules/docker-multi-stage.md` directly into `~/.gemini/config/plugins/auto-context/rules/` and `~/.auto-context/memory/rules/`.
309
+ * **Zero Rewriting:** Preserves all existing YAML frontmatter, guidelines, and constraints.
310
+ * **Instant Sync:** Immediately run `init-context memory push` to backup the newly promoted rule to your private Git brain.
311
+
312
+ ### 2️⃣ Auto-Harvesting in Central Memory
313
+ When you run:
314
+ ```bash
315
+ init-context memory push
316
+ ```
317
+ The CLI automatically:
318
+ 1. **Discovers Local Knowledge:** Scans the active workspace's `.agents/rules/` and `.agents/skills/`.
319
+ 2. **Harvests to Central Memory:** Copies any new rules and skills into `~/.auto-context/memory/` without overwriting existing files.
320
+ 3. **Audits Secrets:** Runs the Zero-Bypass security audit.
321
+ 4. **Pushes to Private Remote:** Backs up everything to your private GitHub repo.
322
+ Even if an agent originally codified a rule locally, running `memory push` guarantees zero knowledge loss!
323
+
324
+ ---
325
+
326
+ ## 🛰️ Hub & Satellite Modular Architecture (< 400 Token Budget)
327
+
328
+ Dumping routes, models, problem logs, credentials, and runbooks into a single monolithic `context.md` causes context file bloat (1,000–5,000 lines). Every turn burns thousands of unnecessary tokens simply reading the context file!
329
+
330
+ Auto-Context solves this with the **Hub & Satellite Architecture**:
331
+
332
+ ```
333
+ project-root/
334
+ ├── context.md <─── The Executive Hub (Capped at < 80 lines / ~400 tokens!)
335
+ └── .agents/
336
+ └── context/ <─── Stack-Adaptive Satellites (Loaded on-demand)
337
+ ├── routes.md (API Endpoints & UI Page Map — loaded only for route tasks)
338
+ ├── schema.md (Database Schemas & ORM Models — loaded only for DB tasks)
339
+ └── gotchas.md (Critical Architecture Traps & Invariants)
340
+ ```
341
+
342
+ ### 1️⃣ Codebase Scanner (`init-context scan`)
343
+ In any in-flight or 40% completed repository, run:
344
+ ```bash
345
+ init-context scan
346
+ ```
347
+ - **Zero Token Cost:** Scans project directories and manifests locally via fast filesystem heuristics (0 LLM tokens).
348
+ - **Stack-Adaptive:**
349
+ - If Next.js / Express / FastAPI: Generates `.agents/context/routes.md`.
350
+ - If Prisma / Drizzle / Django / SQLAlchemy: Generates `.agents/context/schema.md`.
351
+ - Always provisions `.agents/context/gotchas.md`.
352
+ - **Strict Idempotency Proof ($f(f(x)) = f(x)$):**
353
+ - Uses SHA-256 content hashes and anchored delimiters (`<!-- AUTO-CONTEXT:DISCOVERY:START -->`).
354
+ - Running `scan` 1 time or 100 times produces the exact same deterministic state without duplicating content.
355
+
356
+ ### 2️⃣ The Brutal Truth Filter & `gotchas.md`
357
+ - **Zero Dead Logs:** A chronological diary of 50 minor solved bug typos is a waste of disk and token budget. Git already tracks commit history!
358
+ - **Gotchas Over History:** Auto-Context replaces useless bug logs with **`gotchas.md`**: non-obvious architecture traps, port collisions, and invariants that cannot be guessed from reading code.
359
+
360
+ ---
361
+
275
362
  ## ⚡ Two-Tier Progressive Disclosure (Token-Optimized Architecture)
276
363
 
277
364
  To avoid context window bloat and burning 20k–30k tokens at session startup, Auto-Context enforces a **Two-Tier Progressive Disclosure Protocol**:
@@ -505,9 +592,34 @@ To prevent **Prompt Injection Leaks** and keep production secrets safe:
505
592
  init-context -s my-skill-name -g # সকল প্রজেক্টের জন্য গ্লোবালি
506
593
  ```
507
594
 
595
+ ### 🛰️ হাব অ্যান্ড স্যাটেলাইট আর্কিটেকচার (< ৪০০ টোকেন সিলিং):
596
+ সব রুট, ডাটাবেজ মডেল এবং হিস্ট্রি এক ফাইলে রাখলে `context.md` ১,০০০–৫,০০০ লাইন হয়ে টোকেন অপচয় করে। Auto-Context একে সমাধান করেছে **Hub & Satellite** মডেল দিয়ে:
597
+ * **The Executive Hub (`context.md`):** প্রজেক্টের রুট ফাইল সবসময় সর্বোচ্চ **< ৮০ লাইন (< ৪০০ টোকেন)**-এ সীমাবদ্ধ থাকবে।
598
+ * **স্ট্যাক-অ্যাডাপটিভ স্যাটেলাইট (`.agents/context/`):**
599
+ * `routes.md`: প্রজেক্টের এপিআই ও পেজ রুট ম্যাপ (শুধু রাউটিং কাজের সময় এআই পড়বে)।
600
+ * `schema.md`: ডাটাবেজ মডেল ও ওআরএম স্কিমা (শুধু ডাটাবেজ কাজের সময় পড়বে)।
601
+ * `gotchas.md`: বাস্তব টেকনিক্যাল ফাঁদ, পোর্ট কনফ্লিক্ট ও আর্কিটেকচারাল সীমাবদ্ধতা।
602
+
603
+ ### 🔍 কোডবেস স্ক্যানার (`init-context scan`):
604
+ যেকোনো চলমান বা ৪০% শেষ হওয়া প্রজেক্টে টার্মিনালে রান করুন:
605
+ ```bash
606
+ init-context scan
607
+ ```
608
+ * **জিরো টোকেন খরচ:** সম্পূর্ণ অফলাইনে লোকাল প্রসেসর দিয়ে মাত্র ১০০ মিলিসেকেন্ডে প্রজেক্ট স্ক্যান করে স্যাটেলাইট ফাইল তৈরি করে।
609
+ * **আইডেমপোটেন্সি প্রুফ ($f(f(x)) = f(x)$):** দিনে ১০০ বার কমান্ড চালালেও কোনো ডুপ্লিকেট কনটেন্ট হবে না বা ইউজারের নিজস্ব নোট ওভাররাইট হবে না।
610
+
508
611
  ### ⚡ টু-টায়ার প্রোগ্রেসিভ ডিসক্লোজার (টোকেন সাশ্রয়ী আর্কিটেকচার):
509
612
  শুরুতেই সব স্কিলের বড় ফাইল লোড করে চ্যাট ভারী করা হয় না। এআই শুরুতে মাত্র ১৫০–২০০ টোকেনের একটি ইনডেক্স (`context.md` Section 5) পড়ে। যখন নির্দিষ্ট টাস্কের কিওয়ার্ড মিলবে (যেমন: "docker", "rebase", "diagnostics", "ui test"), কেবল তখনই সংশ্লিষ্ট পূর্ণাঙ্গ স্কিলটি অন-ডিমান্ড মেমরিতে লোড হয়। ফলে টোকেন খরচ প্রায় ৮০% হ্রাস পায়!
510
613
 
614
+ ### 🚀 রুল প্রমোশন ও অটো-হার্ভেস্টিং (Promote & Auto-Harvest):
615
+ * **লোকাল রুলকে গ্লোবালে উন্নীত করা (`promote`):**
616
+ যদি কোনো নির্দিষ্ট প্রজেক্টে তৈরি করা রুল বা স্কিল আপনার কম্পিউটারের সকল প্রজেক্টের জন্য প্রয়োজন হয়, তবে এক কমান্ডে গ্লোবাল প্লাগইন ও সেন্ট্রাল মেমরিতে প্রমোট করতে পারবেন:
617
+ ```bash
618
+ init-context promote docker-multi-stage
619
+ ```
620
+ * **অটো-হার্ভেস্টিং (Auto-Harvesting in Memory Push):**
621
+ যখন আপনি `init-context memory push` চালাবেন, তখন বর্তমান প্রজেক্টের লোকাল রুল ও স্কিলগুলো স্বয়ংক্রিয়ভাবে সেন্ট্রাল মেমরিতে হার্ভেস্ট (সংগ্রহ) হবে এবং সিক্রেট অডিট পাস করে প্রাইভেট গিটহাবে ব্যাকআপ হয়ে যাবে।
622
+
511
623
  ### 🧠 সেন্ট্রাল মেমরি ব্রেইন ও ডটফাইলস (Disaster Recovery & Dotfiles):
512
624
  যেমনভাবে লিনাক্সে `.dotfiles` দিয়ে চোখের পলকে সব কনফিগারেশন সেটআপ করা যায়, তেমনি Auto-Context দিয়ে আপনার এআই এজেন্টের মেমরি ও স্কিল ক্লাউডে নিরাপদে সেভ থাকে:
513
625
  1. **প্রাইভেট মেমরি তৈরি (`memory init`):**
@@ -537,6 +649,20 @@ To prevent **Prompt Injection Leaks** and keep production secrets safe:
537
649
  ```
538
650
  > **কলিশন গার্ড:** যদি একই নামের কোনো স্কিল আগে থেকেই থেকে থাকে, তবে এটি না জানিয়ে কখনো ওভাররাইট করবে না। টার্মিনালে আপনাকে ৩টি অপশন দেবে: `[O]verwrite / [R]ename / [C]ancel`।
539
651
 
652
+ ### 🔄 মডুলার আপস্ট্রিম আপডেট ও স্বয়ংক্রিয় নোটিফিকেশন (Update & Sync):
653
+ অফিশিয়াল গিটহাব রিপোজিটরিতে নতুন কোনো রুলবুক, স্কিল বা এআই এজেন্ট টুল যুক্ত হলে ব্যবহারকারীরা খুব সহজে আপডেট পেতে পারেন:
654
+ 1. **স্বয়ংক্রিয় নোটিফিকেশন ব্যানার:** চব্বিশ ঘণ্টায় একবার ব্যাকগ্রাউন্ডে চেক করে নতুন রুল আসলে টার্মিনালে সুন্দর নোটিফিকেশন দেখাবে।
655
+ 2. **এক কমান্ডে নিরাপদ আপডেট (`init-context update`):**
656
+ ```bash
657
+ init-context update # ফুল মডুলার আপডেট (CLI + গ্লোবাল প্লাগইন + সিস্টেম রুলস)
658
+ init-context update --check # কোনো আপডেট আছে কিনা শুধু চেক করতে
659
+ init-context update -w # শুধুমাত্র বর্তমান প্রজেক্টের সিস্টেম রুলস আপডেট করতে
660
+ ```
661
+ > **ব্রেকিং-চেঞ্জ মুক্ত সুরক্ষা (Zero Breaking Guarantee):**
662
+ > * আপনার প্রজেক্টের `context.md`, `context.local.md` বা `.env` ফাইলে **কখনোই হাত দেওয়া হবে না**।
663
+ > * আপনার তৈরিকৃত কোনো কাস্টম রুল মুছে যাবে না।
664
+ > * কোনো ফাইলে কাস্টম পরিবর্তন থাকলে স্বয়ংক্রিয়ভাবে `.bak` ব্যাকআপ তৈরি হবে।
665
+
540
666
  ### নিরাপদ MCP টুল ম্যানেজমেন্ট (Secure Secrets via .env):
541
667
  টোকেন বা পাসওয়ার্ড কখনোই কনফিগ ফাইলে ওপেন টেক্সটে সেভ হয় না, বরং `.env` এবং `.gitignore`-এর মাধ্যমে নিরাপদ থাকে:
542
668
  * **টুল যুক্ত করতে (Node `npx` বা Python `uvx` সাপোর্ট):**
@@ -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.1)
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.3)
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)
@@ -61,40 +61,65 @@ cd /path/to/any-project
61
61
  init-context
62
62
  ```
63
63
 
64
- ### Options & Flags:
64
+ ### Command Reference & Syntax:
65
+
66
+ Auto-Context supports both modern subcommands (`init-context <command>`) and standard legacy flags:
67
+
68
+ | Command | Shorthand / Flag | Description |
69
+ | :--- | :--- | :--- |
70
+ | `init-context init [DIR]` | `init-context [DIR]` | Scaffolds 5-tier context in active or specified directory. |
71
+ | `init-context scan [DIR]` | `init-context --scan` | Stack-adaptive codebase scanner: generates satellites (.agents/context/). |
72
+ | `init-context rule <name>` | `init-context -r <name>` | Scaffolds a new agent rule with YAML frontmatter. |
73
+ | `init-context skill <name>` | `init-context -s <name>` | Scaffolds a new agent skill directory with triggers & runbook. |
74
+ | `init-context promote <name>` | — | Promotes local workspace rule/skill to Global Plugin & Central Memory. |
75
+ | `init-context update` | — | Modular, non-breaking update for CLI, global plugin & system rules. |
76
+ | `init-context share <name>` | — | Audits secrets and shares a rule or skill via GitHub Gist. |
77
+ | `init-context import <url>` | — | Imports a rule or skill with 3-way Collision Guard protection. |
78
+ | `init-context memory init` | — | Initializes private GitHub brain repository (`~/.auto-context/memory`). |
79
+ | `init-context memory push` | — | Auto-harvests workspace rules, audits secrets & pushes to private GitHub. |
80
+ | `init-context memory pull` | — | Pulls and restores central brain on a new machine. |
81
+ | `init-context memory status` | — | Displays central brain location, remote URL, and rules/skills count. |
82
+ | `init-context mcp add <name>`| `init-context --add-mcp` | Adds or updates an MCP tool (Node `npx` or Python `uvx`). |
83
+ | `init-context mcp list` | `init-context --list-mcp` | Lists all active MCP server configurations. |
84
+ | `init-context mcp remove <name>`| `init-context --remove-mcp` | Safely removes an MCP server configuration. |
85
+
86
+ ### Global Flags:
87
+ * `-g, --global`: Targets machine-wide scope (`~/.gemini/config/plugins/auto-context/` & `~/.auto-context/memory/`).
88
+ * `-f, --force`: Overwrites existing files (bypasses collision guards with confirmation).
89
+ * `-d, --dry-run`: Previews actions without writing files or modifying directories.
90
+ * `-v, --version`: Displays installed package version.
91
+
92
+ ---
93
+
94
+ ## 🔄 Modular Upstream Sync & Non-Breaking Updates (আপডেট ও সিঙ্ক)
95
+
96
+ When new public rules, skills, or agent capabilities are added to the official [Cyber-arghya/auto-context](https://github.com/Cyber-arghya/auto-context) repository:
97
+
98
+ ### 1️⃣ Automatic Background Notification
99
+ `auto-context` includes a lightweight, cached (24h TTL) update notifier. Whenever you or an AI agent runs `init-context`, it unobtrusively checks PyPI and GitHub. If new upstream rules or versions are available, a clean banner is displayed:
65
100
  ```text
66
- init-context [OPTIONS] [DIRECTORY]
67
-
68
- OPTIONS (CONTEXT & RULES):
69
- -r, --new-rule <NAME> Scaffold a new rule file (.agents/rules/<name>.md)
70
- -s, --new-skill <NAME> Scaffold a new skill folder (.agents/skills/<name>/SKILL.md)
71
- -g, --global Target global plugin scope (~/.gemini/config/plugins/auto-context/)
72
- -f, --force Overwrite existing context.md and standing rule files
73
- -d, --dry-run Preview generated structure without writing to disk
74
- -v, --version Display current version
75
- -h, --help Show help documentation
76
-
77
- OPTIONS (CENTRAL MEMORY & GRANULAR SHARING):
78
- memory init [REPO] Initialize private central memory repo (~/.auto-context/memory)
79
- memory push Audit secrets & push memory brain to private GitHub repo
80
- memory pull [URL] Pull & sync central memory brain from remote repo
81
- memory status Show status of central memory brain
82
- share <NAME> Audit & publish skill or rule to GitHub Gist
83
- import <URL> Audit & import skill or rule from GitHub Gist or URL
84
- --as <NAME> Custom name when importing a skill or rule
85
- --public Publish shared Gist as public (default)
86
- --secret, --private Publish shared Gist as unlisted/secret
87
-
88
- OPTIONS (MCP TOOLING):
89
- --add-mcp <NAME> Add or update an MCP server configuration
90
- --remove-mcp <NAME> Remove an MCP server from configuration
91
- --list-mcp List all active MCP server tools
92
- --preset <PRESET> Preset template (sqlite, postgres, github, filesystem, brave, fetch)
93
- --command <CMD> Executable command for stdio server (e.g. npx, uvx, python3)
94
- --args <ARGS> Arguments to pass to command
95
- --url <URL> Streamable HTTP endpoint URL for remote MCP server
96
- --env <KEY=VAL,...> Environment variables (e.g. 'GITHUB_TOKEN=xyz')
101
+ ╭─────────────────────────────────────────────────────────────────────────────╮
102
+ │ 🔔 Auto-Context Update Available: v1.0.1 → v1.0.2 │
103
+ │ New public rules, skills, and upstream capabilities are ready. │
104
+ │ Run 'init-context update' to sync modularly without breaking local context.│
105
+ ╰─────────────────────────────────────────────────────────────────────────────╯
106
+ ```
107
+
108
+ ### 2️⃣ 1-Command Safe Modular Update
109
+ Run:
110
+ ```bash
111
+ init-context update
97
112
  ```
113
+ - **Upgrades CLI Package:** Automatically updates `auto-context-cli` via `uv tool`, `pipx`, or `pip`.
114
+ - **Syncs Global Plugin:** Updates `~/.gemini/config/plugins/auto-context/` (`rules/AGENTS.md`, `skills/auto-context/SKILL.md`) with upstream instructions.
115
+ - **Syncs Workspace System Rules:** Updates system rules (`.agents/rules/maintain_context.md`, `AGENTS.md`, `GEMINI.md`).
116
+
117
+ > [!TIP]
118
+ > **Strict Non-Breaking Guarantees:**
119
+ > - **Zero Context Loss:** `context.md` is **NEVER** modified or overwritten. All project credentials, architecture diagrams, and problem history remain 100% intact.
120
+ > - **Secret Protection:** `context.local.md`, `.env`, and test logins are **NEVER** touched.
121
+ > - **Custom Rule Safety:** Your personal rules (e.g. `docker-multi-stage.md`, `my-style.md`) are **NEVER** overwritten or deleted.
122
+ > - **Automatic Backup:** If you customized `AGENTS.md`, the updater automatically creates an `AGENTS.md.bak` backup.
98
123
 
99
124
  ---
100
125
 
@@ -258,6 +283,68 @@ triggers: ["docker", "container", "compose", "dockerfile"]
258
283
 
259
284
  ---
260
285
 
286
+ ## 🚀 Rule Promotion & Auto-Harvesting (`init-context promote`)
287
+
288
+ Sometimes a rule or workflow starts as a quick experiment in one project, but proves so valuable that you want every project across your machine and team to inherit it.
289
+
290
+ ### 1️⃣ 1-Command Rule Promotion
291
+ ```bash
292
+ init-context promote docker-multi-stage
293
+ ```
294
+ * **Elevates Local to Global:** Copies `.agents/rules/docker-multi-stage.md` directly into `~/.gemini/config/plugins/auto-context/rules/` and `~/.auto-context/memory/rules/`.
295
+ * **Zero Rewriting:** Preserves all existing YAML frontmatter, guidelines, and constraints.
296
+ * **Instant Sync:** Immediately run `init-context memory push` to backup the newly promoted rule to your private Git brain.
297
+
298
+ ### 2️⃣ Auto-Harvesting in Central Memory
299
+ When you run:
300
+ ```bash
301
+ init-context memory push
302
+ ```
303
+ The CLI automatically:
304
+ 1. **Discovers Local Knowledge:** Scans the active workspace's `.agents/rules/` and `.agents/skills/`.
305
+ 2. **Harvests to Central Memory:** Copies any new rules and skills into `~/.auto-context/memory/` without overwriting existing files.
306
+ 3. **Audits Secrets:** Runs the Zero-Bypass security audit.
307
+ 4. **Pushes to Private Remote:** Backs up everything to your private GitHub repo.
308
+ Even if an agent originally codified a rule locally, running `memory push` guarantees zero knowledge loss!
309
+
310
+ ---
311
+
312
+ ## 🛰️ Hub & Satellite Modular Architecture (< 400 Token Budget)
313
+
314
+ Dumping routes, models, problem logs, credentials, and runbooks into a single monolithic `context.md` causes context file bloat (1,000–5,000 lines). Every turn burns thousands of unnecessary tokens simply reading the context file!
315
+
316
+ Auto-Context solves this with the **Hub & Satellite Architecture**:
317
+
318
+ ```
319
+ project-root/
320
+ ├── context.md <─── The Executive Hub (Capped at < 80 lines / ~400 tokens!)
321
+ └── .agents/
322
+ └── context/ <─── Stack-Adaptive Satellites (Loaded on-demand)
323
+ ├── routes.md (API Endpoints & UI Page Map — loaded only for route tasks)
324
+ ├── schema.md (Database Schemas & ORM Models — loaded only for DB tasks)
325
+ └── gotchas.md (Critical Architecture Traps & Invariants)
326
+ ```
327
+
328
+ ### 1️⃣ Codebase Scanner (`init-context scan`)
329
+ In any in-flight or 40% completed repository, run:
330
+ ```bash
331
+ init-context scan
332
+ ```
333
+ - **Zero Token Cost:** Scans project directories and manifests locally via fast filesystem heuristics (0 LLM tokens).
334
+ - **Stack-Adaptive:**
335
+ - If Next.js / Express / FastAPI: Generates `.agents/context/routes.md`.
336
+ - If Prisma / Drizzle / Django / SQLAlchemy: Generates `.agents/context/schema.md`.
337
+ - Always provisions `.agents/context/gotchas.md`.
338
+ - **Strict Idempotency Proof ($f(f(x)) = f(x)$):**
339
+ - Uses SHA-256 content hashes and anchored delimiters (`<!-- AUTO-CONTEXT:DISCOVERY:START -->`).
340
+ - Running `scan` 1 time or 100 times produces the exact same deterministic state without duplicating content.
341
+
342
+ ### 2️⃣ The Brutal Truth Filter & `gotchas.md`
343
+ - **Zero Dead Logs:** A chronological diary of 50 minor solved bug typos is a waste of disk and token budget. Git already tracks commit history!
344
+ - **Gotchas Over History:** Auto-Context replaces useless bug logs with **`gotchas.md`**: non-obvious architecture traps, port collisions, and invariants that cannot be guessed from reading code.
345
+
346
+ ---
347
+
261
348
  ## ⚡ Two-Tier Progressive Disclosure (Token-Optimized Architecture)
262
349
 
263
350
  To avoid context window bloat and burning 20k–30k tokens at session startup, Auto-Context enforces a **Two-Tier Progressive Disclosure Protocol**:
@@ -491,9 +578,34 @@ To prevent **Prompt Injection Leaks** and keep production secrets safe:
491
578
  init-context -s my-skill-name -g # সকল প্রজেক্টের জন্য গ্লোবালি
492
579
  ```
493
580
 
581
+ ### 🛰️ হাব অ্যান্ড স্যাটেলাইট আর্কিটেকচার (< ৪০০ টোকেন সিলিং):
582
+ সব রুট, ডাটাবেজ মডেল এবং হিস্ট্রি এক ফাইলে রাখলে `context.md` ১,০০০–৫,০০০ লাইন হয়ে টোকেন অপচয় করে। Auto-Context একে সমাধান করেছে **Hub & Satellite** মডেল দিয়ে:
583
+ * **The Executive Hub (`context.md`):** প্রজেক্টের রুট ফাইল সবসময় সর্বোচ্চ **< ৮০ লাইন (< ৪০০ টোকেন)**-এ সীমাবদ্ধ থাকবে।
584
+ * **স্ট্যাক-অ্যাডাপটিভ স্যাটেলাইট (`.agents/context/`):**
585
+ * `routes.md`: প্রজেক্টের এপিআই ও পেজ রুট ম্যাপ (শুধু রাউটিং কাজের সময় এআই পড়বে)।
586
+ * `schema.md`: ডাটাবেজ মডেল ও ওআরএম স্কিমা (শুধু ডাটাবেজ কাজের সময় পড়বে)।
587
+ * `gotchas.md`: বাস্তব টেকনিক্যাল ফাঁদ, পোর্ট কনফ্লিক্ট ও আর্কিটেকচারাল সীমাবদ্ধতা।
588
+
589
+ ### 🔍 কোডবেস স্ক্যানার (`init-context scan`):
590
+ যেকোনো চলমান বা ৪০% শেষ হওয়া প্রজেক্টে টার্মিনালে রান করুন:
591
+ ```bash
592
+ init-context scan
593
+ ```
594
+ * **জিরো টোকেন খরচ:** সম্পূর্ণ অফলাইনে লোকাল প্রসেসর দিয়ে মাত্র ১০০ মিলিসেকেন্ডে প্রজেক্ট স্ক্যান করে স্যাটেলাইট ফাইল তৈরি করে।
595
+ * **আইডেমপোটেন্সি প্রুফ ($f(f(x)) = f(x)$):** দিনে ১০০ বার কমান্ড চালালেও কোনো ডুপ্লিকেট কনটেন্ট হবে না বা ইউজারের নিজস্ব নোট ওভাররাইট হবে না।
596
+
494
597
  ### ⚡ টু-টায়ার প্রোগ্রেসিভ ডিসক্লোজার (টোকেন সাশ্রয়ী আর্কিটেকচার):
495
598
  শুরুতেই সব স্কিলের বড় ফাইল লোড করে চ্যাট ভারী করা হয় না। এআই শুরুতে মাত্র ১৫০–২০০ টোকেনের একটি ইনডেক্স (`context.md` Section 5) পড়ে। যখন নির্দিষ্ট টাস্কের কিওয়ার্ড মিলবে (যেমন: "docker", "rebase", "diagnostics", "ui test"), কেবল তখনই সংশ্লিষ্ট পূর্ণাঙ্গ স্কিলটি অন-ডিমান্ড মেমরিতে লোড হয়। ফলে টোকেন খরচ প্রায় ৮০% হ্রাস পায়!
496
599
 
600
+ ### 🚀 রুল প্রমোশন ও অটো-হার্ভেস্টিং (Promote & Auto-Harvest):
601
+ * **লোকাল রুলকে গ্লোবালে উন্নীত করা (`promote`):**
602
+ যদি কোনো নির্দিষ্ট প্রজেক্টে তৈরি করা রুল বা স্কিল আপনার কম্পিউটারের সকল প্রজেক্টের জন্য প্রয়োজন হয়, তবে এক কমান্ডে গ্লোবাল প্লাগইন ও সেন্ট্রাল মেমরিতে প্রমোট করতে পারবেন:
603
+ ```bash
604
+ init-context promote docker-multi-stage
605
+ ```
606
+ * **অটো-হার্ভেস্টিং (Auto-Harvesting in Memory Push):**
607
+ যখন আপনি `init-context memory push` চালাবেন, তখন বর্তমান প্রজেক্টের লোকাল রুল ও স্কিলগুলো স্বয়ংক্রিয়ভাবে সেন্ট্রাল মেমরিতে হার্ভেস্ট (সংগ্রহ) হবে এবং সিক্রেট অডিট পাস করে প্রাইভেট গিটহাবে ব্যাকআপ হয়ে যাবে।
608
+
497
609
  ### 🧠 সেন্ট্রাল মেমরি ব্রেইন ও ডটফাইলস (Disaster Recovery & Dotfiles):
498
610
  যেমনভাবে লিনাক্সে `.dotfiles` দিয়ে চোখের পলকে সব কনফিগারেশন সেটআপ করা যায়, তেমনি Auto-Context দিয়ে আপনার এআই এজেন্টের মেমরি ও স্কিল ক্লাউডে নিরাপদে সেভ থাকে:
499
611
  1. **প্রাইভেট মেমরি তৈরি (`memory init`):**
@@ -523,6 +635,20 @@ To prevent **Prompt Injection Leaks** and keep production secrets safe:
523
635
  ```
524
636
  > **কলিশন গার্ড:** যদি একই নামের কোনো স্কিল আগে থেকেই থেকে থাকে, তবে এটি না জানিয়ে কখনো ওভাররাইট করবে না। টার্মিনালে আপনাকে ৩টি অপশন দেবে: `[O]verwrite / [R]ename / [C]ancel`।
525
637
 
638
+ ### 🔄 মডুলার আপস্ট্রিম আপডেট ও স্বয়ংক্রিয় নোটিফিকেশন (Update & Sync):
639
+ অফিশিয়াল গিটহাব রিপোজিটরিতে নতুন কোনো রুলবুক, স্কিল বা এআই এজেন্ট টুল যুক্ত হলে ব্যবহারকারীরা খুব সহজে আপডেট পেতে পারেন:
640
+ 1. **স্বয়ংক্রিয় নোটিফিকেশন ব্যানার:** চব্বিশ ঘণ্টায় একবার ব্যাকগ্রাউন্ডে চেক করে নতুন রুল আসলে টার্মিনালে সুন্দর নোটিফিকেশন দেখাবে।
641
+ 2. **এক কমান্ডে নিরাপদ আপডেট (`init-context update`):**
642
+ ```bash
643
+ init-context update # ফুল মডুলার আপডেট (CLI + গ্লোবাল প্লাগইন + সিস্টেম রুলস)
644
+ init-context update --check # কোনো আপডেট আছে কিনা শুধু চেক করতে
645
+ init-context update -w # শুধুমাত্র বর্তমান প্রজেক্টের সিস্টেম রুলস আপডেট করতে
646
+ ```
647
+ > **ব্রেকিং-চেঞ্জ মুক্ত সুরক্ষা (Zero Breaking Guarantee):**
648
+ > * আপনার প্রজেক্টের `context.md`, `context.local.md` বা `.env` ফাইলে **কখনোই হাত দেওয়া হবে না**।
649
+ > * আপনার তৈরিকৃত কোনো কাস্টম রুল মুছে যাবে না।
650
+ > * কোনো ফাইলে কাস্টম পরিবর্তন থাকলে স্বয়ংক্রিয়ভাবে `.bak` ব্যাকআপ তৈরি হবে।
651
+
526
652
  ### নিরাপদ MCP টুল ম্যানেজমেন্ট (Secure Secrets via .env):
527
653
  টোকেন বা পাসওয়ার্ড কখনোই কনফিগ ফাইলে ওপেন টেক্সটে সেভ হয় না, বরং `.env` এবং `.gitignore`-এর মাধ্যমে নিরাপদ থাকে:
528
654
  * **টুল যুক্ত করতে (Node `npx` বা Python `uvx` সাপোর্ট):**
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "auto-context-cli"
3
- version = "1.0.1"
3
+ version = "1.0.3"
4
4
  description = "Autonomous context & instruction manager for AI coding assistants"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -1,3 +1,3 @@
1
1
  """auto-context: Autonomous context & instruction manager for AI coding assistants."""
2
2
 
3
- __version__ = "1.0.1"
3
+ __version__ = "1.0.3"
@@ -207,6 +207,13 @@ def init(
207
207
  ".env.*.local",
208
208
  ])
209
209
 
210
+ # ── Stack-Adaptive Satellites (.agents/context/) ───────────────────────
211
+ try:
212
+ from auto_context import scanner
213
+ scanner.generate_satellites(project_dir, force=force)
214
+ except Exception:
215
+ pass
216
+
210
217
  console.print(Panel(
211
218
  "[bold green]✨ Project scaffold complete![/]\n"
212
219
  "Edit [cyan]context.md[/] and [cyan]GEMINI.md[/] to customise your AI workspace.",