auto-context-cli 1.0.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.
- auto_context/__init__.py +3 -0
- auto_context/commands/__init__.py +2 -0
- auto_context/commands/import_cmd.py +144 -0
- auto_context/commands/init_cmd.py +309 -0
- auto_context/commands/mcp.py +304 -0
- auto_context/commands/memory.py +236 -0
- auto_context/commands/share.py +122 -0
- auto_context/config.py +65 -0
- auto_context/main.py +121 -0
- auto_context/security.py +162 -0
- auto_context/templates/AGENTS.template.md +49 -0
- auto_context/templates/GEMINI.template.md +49 -0
- auto_context/templates/context.local.template.md +52 -0
- auto_context/templates/context.template.md +94 -0
- auto_context/templates/maintain_context.template.md +36 -0
- auto_context/templates/mcp_config.template.json +13 -0
- auto_context/templates/profile.template.md +20 -0
- auto_context/templates/rule.template.md +19 -0
- auto_context/templates/rules/code-standards.md +24 -0
- auto_context/templates/rules/security-boundaries.md +21 -0
- auto_context/templates/skill.template.md +39 -0
- auto_context/templates/skills/browser-testing/SKILL.md +59 -0
- auto_context/templates/skills/docker-ops/SKILL.md +79 -0
- auto_context/templates/skills/git-workflow/SKILL.md +59 -0
- auto_context/templates/skills/server-diagnostics/SKILL.md +55 -0
- auto_context_cli-1.0.0.dist-info/METADATA +577 -0
- auto_context_cli-1.0.0.dist-info/RECORD +30 -0
- auto_context_cli-1.0.0.dist-info/WHEEL +4 -0
- auto_context_cli-1.0.0.dist-info/entry_points.txt +2 -0
- auto_context_cli-1.0.0.dist-info/licenses/LICENSE +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Agent Memory & Developer Profile
|
|
2
|
+
|
|
3
|
+
> **Owner:** {{USERNAME}}
|
|
4
|
+
> **Initialized:** {{DATE_NOW}}
|
|
5
|
+
> **Repository:** {{REPO_NAME}}
|
|
6
|
+
> **Visibility:** Private Central Agent Brain
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 1. Developer Preferences & Communication Style
|
|
11
|
+
- **Language & Tone:** Provide friendly, structured explanations in clear Bengali alongside English technical terms and bash/PowerShell snippets.
|
|
12
|
+
- **Code Architecture:** Adhere to clean code, Single Responsibility Principle (SRP), early return guard clauses, and strict type safety.
|
|
13
|
+
- **Git Hygiene:** Use atomic conventional commits (`feat:`, `fix:`, `docs:`, `refactor:`, `chore:`).
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 2. Central Knowledge Base Index
|
|
18
|
+
- **Global Rules:** Defined in `rules/` (automatically synchronized across all local projects).
|
|
19
|
+
- **Reusable Skills:** Stored in `skills/` (available on-demand via Two-Tier Progressive Disclosure).
|
|
20
|
+
- **MCP Server Presets:** Cataloged in `mcp/` (referenced securely via environment variables).
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: {{RULE_NAME}}
|
|
3
|
+
description: Custom rule for {{RULE_NAME}}. Explain when and how the agent should apply this rule.
|
|
4
|
+
trigger: always_on
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Rule: {{RULE_TITLE}}
|
|
8
|
+
|
|
9
|
+
## Objective
|
|
10
|
+
Define the goal and purpose of this rule.
|
|
11
|
+
|
|
12
|
+
## Guidelines & Constraints
|
|
13
|
+
- **Constraint 1:** Describe specific coding standards, naming conventions, or prohibited patterns.
|
|
14
|
+
- **Constraint 2:** Security protocols, credential management, or access boundaries.
|
|
15
|
+
- **Constraint 3:** Testing or documentation requirements.
|
|
16
|
+
|
|
17
|
+
## Enforcement
|
|
18
|
+
AI coding agents (Antigravity, Cursor, Claude Code, Copilot) operating in this workspace must adhere strictly to these instructions.
|
|
19
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-standards
|
|
3
|
+
description: Enforces clean code principles, DRY architecture, early return patterns, and defensive error handling.
|
|
4
|
+
trigger: always_on
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Rule: Code Quality & Architecture Standards
|
|
8
|
+
|
|
9
|
+
## Objective
|
|
10
|
+
Maintain readable, maintainable, modular, and type-safe codebases with clear error handling.
|
|
11
|
+
|
|
12
|
+
## Guidelines & Constraints
|
|
13
|
+
1. **Defensive Coding & Early Return:**
|
|
14
|
+
- Prefer guard clauses and early returns to reduce nested indentation.
|
|
15
|
+
- Always validate inputs and handle edge cases at the beginning of functions.
|
|
16
|
+
2. **Clean Code & Self-Documenting Logic:**
|
|
17
|
+
- Keep functions focused on a single responsibility (SRP).
|
|
18
|
+
- Write descriptive variable and function names; avoid cryptic abbreviations.
|
|
19
|
+
- Preserve existing comments and docstrings.
|
|
20
|
+
3. **Structured Error Handling:**
|
|
21
|
+
- Never suppress exceptions with empty `catch` or `except` blocks.
|
|
22
|
+
- Log actionable error messages that include relevant context (e.g. invalid inputs, resource identifiers).
|
|
23
|
+
4. **Conventional Git Commits:**
|
|
24
|
+
- Write semantic commit messages (`feat:`, `fix:`, `docs:`, `refactor:`, `chore:`).
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security-boundaries
|
|
3
|
+
description: Enforces zero plaintext secrets in Git, strict .env protection, and isolated mock data in context.local.md.
|
|
4
|
+
trigger: always_on
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Rule: Security Boundaries & Secret Safety
|
|
8
|
+
|
|
9
|
+
## Objective
|
|
10
|
+
Prevent credential leakage, indirect prompt injection, and unauthorized network exposure across all code, configuration files, and git commits.
|
|
11
|
+
|
|
12
|
+
## Guidelines & Constraints
|
|
13
|
+
1. **Zero Hardcoded Secrets:**
|
|
14
|
+
- API keys, tokens, database passwords, and private keys must NEVER be hardcoded into source code, committed configs, or git history.
|
|
15
|
+
- All runtime secrets must be loaded via `.env` or system environment variables.
|
|
16
|
+
2. **Local Sandbox Test Data Isolation (`context.local.md`):**
|
|
17
|
+
- Only dummy/mock credentials (e.g. `admin@test.local`) belong in `context.local.md`.
|
|
18
|
+
- Real production credentials or live payment keys are strictly prohibited in markdown files.
|
|
19
|
+
- `context.local.md` must remain strictly git-ignored (`chmod 600`).
|
|
20
|
+
3. **Public Exposure Boundaries:**
|
|
21
|
+
- Raw database and internal service ports must bind to `127.0.0.1` unless encapsulated by secure tunneling.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: {{SKILL_NAME}}
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
description: Describe what this skill accomplishes and the specific keywords or conditions under which the agent should activate it.
|
|
5
|
+
triggers: ["{{SKILL_NAME}}", "keyword1", "keyword2"]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Skill: {{SKILL_TITLE}}
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
Briefly summarize the procedure, workflows, or runbooks taught by this skill.
|
|
12
|
+
|
|
13
|
+
## When to Activate
|
|
14
|
+
- When the user asks to perform task X.
|
|
15
|
+
- When working on subsystem Y or diagnosing error Z.
|
|
16
|
+
|
|
17
|
+
## Workflow & Step-by-Step Instructions
|
|
18
|
+
|
|
19
|
+
### Step 1: Pre-flight & Checks
|
|
20
|
+
* Validate prerequisites, environment variables, or dependencies:
|
|
21
|
+
```bash
|
|
22
|
+
# Check command
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Step 2: Core Execution
|
|
26
|
+
* Follow this exact procedure:
|
|
27
|
+
```bash
|
|
28
|
+
# Execution command
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Step 3: Verification
|
|
32
|
+
* Verify the expected outcome:
|
|
33
|
+
```bash
|
|
34
|
+
# Verification command
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Reference & Troubleshooting
|
|
38
|
+
* Common pitfalls and their solutions.
|
|
39
|
+
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: browser-testing
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
description: Automated web UI verification, Playwright/Puppeteer automation, and dev endpoint testing using context.local.md.
|
|
5
|
+
triggers: ["browser", "playwright", "puppeteer", "ui-test", "login-test", "headless", "screenshot"]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Skill: Browser Testing & Local UI Verification
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
Automated procedures for conducting headful or headless browser testing, verifying web UI flows, performing login checks using mock fixtures from `context.local.md`, and preventing credential amnesia.
|
|
12
|
+
|
|
13
|
+
## When to Activate
|
|
14
|
+
- When verifying frontend web pages, UI components, forms, or authentication flows.
|
|
15
|
+
- When running Playwright, Puppeteer, or Chrome DevTools automated actions.
|
|
16
|
+
- When capturing screenshots or checking console errors on local dev servers.
|
|
17
|
+
|
|
18
|
+
## Workflows & Procedures
|
|
19
|
+
|
|
20
|
+
### 1. Pre-Flight Credential Resolution (The Mock Vault Rule)
|
|
21
|
+
* **Rule:** Before launching any browser test or asking the user for test logins, **ALWAYS read `context.local.md`**.
|
|
22
|
+
* Locate the seed user or admin account under Section 2:
|
|
23
|
+
```markdown
|
|
24
|
+
| Role | Username / Email | Mock Password |
|
|
25
|
+
| Admin | admin@test.local | adminpass123 |
|
|
26
|
+
```
|
|
27
|
+
* NEVER hardcode real passwords or live user accounts into test scripts.
|
|
28
|
+
|
|
29
|
+
### 2. Playwright Quick Verification Script Pattern
|
|
30
|
+
```javascript
|
|
31
|
+
import { test, expect } from '@playwright/test';
|
|
32
|
+
|
|
33
|
+
test('Verify dev portal and mock login', async ({ page }) => {
|
|
34
|
+
// Navigate to local frontend URL defined in context.local.md
|
|
35
|
+
await page.goto('http://localhost:3000');
|
|
36
|
+
|
|
37
|
+
// Verify page title
|
|
38
|
+
await expect(page).toHaveTitle(/Dev/);
|
|
39
|
+
|
|
40
|
+
// Fill credentials from context.local.md
|
|
41
|
+
await page.fill('input[name="email"]', 'admin@test.local');
|
|
42
|
+
await page.fill('input[name="password"]', 'adminpass123');
|
|
43
|
+
await page.click('button[type="submit"]');
|
|
44
|
+
|
|
45
|
+
// Assert dashboard entry
|
|
46
|
+
await expect(page.locator('text=Dashboard')).toBeVisible();
|
|
47
|
+
});
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### 3. Capturing Visual Evidence & Debugging
|
|
51
|
+
* Always save screenshots of failed assertions in a local temporary directory:
|
|
52
|
+
```javascript
|
|
53
|
+
await page.screenshot({ path: 'scratch/error-state.png', fullPage: true });
|
|
54
|
+
```
|
|
55
|
+
* Review browser console errors:
|
|
56
|
+
```javascript
|
|
57
|
+
page.on('console', msg => console.log('BROWSER LOG:', msg.text()));
|
|
58
|
+
page.on('pageerror', err => console.log('PAGE ERROR:', err.message));
|
|
59
|
+
```
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: docker-ops
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
description: Production multi-stage Dockerfile and Compose setup, container diagnostics, cleanup, and logging.
|
|
5
|
+
triggers: ["docker", "container", "compose", "dockerfile", "entrypoint"]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Skill: Docker Operations & Container Management
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
Standard operating procedures for containerizing applications, writing secure multi-stage Dockerfiles, managing docker-compose stacks, and diagnosing container failures.
|
|
12
|
+
|
|
13
|
+
## When to Activate
|
|
14
|
+
- When creating or modifying `Dockerfile` or `docker-compose.yml`.
|
|
15
|
+
- When diagnosing crashed, restarting, or unhealthy containers.
|
|
16
|
+
- When cleaning up dangling images, unused volumes, or container build cache.
|
|
17
|
+
|
|
18
|
+
## Workflows & Procedures
|
|
19
|
+
|
|
20
|
+
### 1. Multi-Stage Dockerfile Best Practices
|
|
21
|
+
* **Principle:** Keep production images minimal by separating build tools from runtime.
|
|
22
|
+
* **Non-Root Execution:** Always create and switch to a non-privileged user (e.g. `USER appuser`).
|
|
23
|
+
* **Layer Caching:** Copy dependency manifests (`package.json`, `requirements.txt`, `go.mod`) and install dependencies BEFORE copying the application source code.
|
|
24
|
+
* **Example (Node/Python pattern):**
|
|
25
|
+
```dockerfile
|
|
26
|
+
# Build Stage
|
|
27
|
+
FROM node:20-alpine AS builder
|
|
28
|
+
WORKDIR /app
|
|
29
|
+
COPY package*.json ./
|
|
30
|
+
RUN npm ci
|
|
31
|
+
COPY . .
|
|
32
|
+
RUN npm run build
|
|
33
|
+
|
|
34
|
+
# Runner Stage
|
|
35
|
+
FROM node:20-alpine AS runner
|
|
36
|
+
WORKDIR /app
|
|
37
|
+
ENV NODE_ENV=production
|
|
38
|
+
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
|
|
39
|
+
COPY --from=builder /app/package*.json ./
|
|
40
|
+
COPY --from=builder /app/dist ./dist
|
|
41
|
+
RUN npm ci --omit=dev
|
|
42
|
+
USER appuser
|
|
43
|
+
EXPOSE 3000
|
|
44
|
+
CMD ["node", "dist/index.js"]
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 2. Stack Orchestration (`docker-compose.yml`)
|
|
48
|
+
* Keep environment variables decoupled using `.env` referencing (`${VAR_NAME}`).
|
|
49
|
+
* Define explicit health checks and resource limits:
|
|
50
|
+
```yaml
|
|
51
|
+
services:
|
|
52
|
+
web:
|
|
53
|
+
build: .
|
|
54
|
+
ports:
|
|
55
|
+
- "3000:3000"
|
|
56
|
+
env_file: .env
|
|
57
|
+
deploy:
|
|
58
|
+
resources:
|
|
59
|
+
limits:
|
|
60
|
+
cpus: '1.0'
|
|
61
|
+
memory: 512M
|
|
62
|
+
healthcheck:
|
|
63
|
+
test: ["CMD", "wget", "-qO-", "http://localhost:3000/health"]
|
|
64
|
+
interval: 30s
|
|
65
|
+
timeout: 5s
|
|
66
|
+
retries: 3
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### 3. Diagnostics & Troubleshooting Commands
|
|
70
|
+
* **Inspect logs:** `docker compose logs -f --tail=100 <service>`
|
|
71
|
+
* **Inspect container resource consumption:** `docker stats --no-stream`
|
|
72
|
+
* **Shell into container:** `docker exec -it <container_name> /bin/sh`
|
|
73
|
+
* **Safe Clean-up (reclaim disk space):**
|
|
74
|
+
```bash
|
|
75
|
+
# Remove stopped containers and dangling images
|
|
76
|
+
docker system prune -f
|
|
77
|
+
# Remove unused build cache
|
|
78
|
+
docker builder prune -f
|
|
79
|
+
```
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: git-workflow
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
description: Conventional commit standards, branch management, safe rebasing, and merge conflict resolution.
|
|
5
|
+
triggers: ["git", "commit", "branch", "pr", "pull-request", "merge", "conflict", "rebase"]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Skill: Git Workflow & Release Management
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
Standard procedures for feature branching, atomic conventional commits, interactive rebasing, merge conflict resolution, and safe remote synchronization.
|
|
12
|
+
|
|
13
|
+
## When to Activate
|
|
14
|
+
- When staging, committing, or pushing code changes to remote repositories.
|
|
15
|
+
- When creating pull requests, managing feature branches, or tagging releases.
|
|
16
|
+
- When resolving git merge or rebase conflicts.
|
|
17
|
+
|
|
18
|
+
## Workflows & Procedures
|
|
19
|
+
|
|
20
|
+
### 1. Conventional Commit Specification
|
|
21
|
+
Always format commit messages using structured semantic prefixes:
|
|
22
|
+
* `feat:` A new user-facing feature or CLI command.
|
|
23
|
+
* `fix:` A bug fix or error correction.
|
|
24
|
+
* `docs:` Documentation changes only (e.g. `README.md`, `context.md`).
|
|
25
|
+
* `refactor:` Code restructuring that neither fixes a bug nor adds a feature.
|
|
26
|
+
* `chore:` Build process, tooling, or dependency updates.
|
|
27
|
+
* `test:` Adding or updating automated tests.
|
|
28
|
+
|
|
29
|
+
**Format:**
|
|
30
|
+
```
|
|
31
|
+
<type>(<optional scope>): <short summary in imperative mood>
|
|
32
|
+
|
|
33
|
+
[optional body explaining motivation and technical approach]
|
|
34
|
+
|
|
35
|
+
[optional footer(s), e.g. Closes #123]
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### 2. Branching & PR Hygiene
|
|
39
|
+
* Keep `main` / `master` production-ready and protected.
|
|
40
|
+
* Create short-lived feature branches: `git checkout -b feat/feature-name`
|
|
41
|
+
* Before opening a PR or pushing:
|
|
42
|
+
```bash
|
|
43
|
+
git fetch origin
|
|
44
|
+
git rebase origin/main
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 3. Safe Merge Conflict Resolution Runbook
|
|
48
|
+
1. **Identify conflicted files:** `git status` (look for `both modified:`)
|
|
49
|
+
2. **Inspect conflicts:** Look for conflict markers `<<<<<<< HEAD`, `=======`, `>>>>>>>`
|
|
50
|
+
3. **Decide resolution strategy:**
|
|
51
|
+
- If keeping current branch's changes: `git checkout --ours <file>`
|
|
52
|
+
- If adopting incoming commit's changes: `git checkout --theirs <file>`
|
|
53
|
+
- If merging manually: edit file to remove conflict markers and test.
|
|
54
|
+
4. **Complete rebase:**
|
|
55
|
+
```bash
|
|
56
|
+
git add <resolved-files>
|
|
57
|
+
GIT_EDITOR=true git rebase --continue
|
|
58
|
+
```
|
|
59
|
+
5. **Never force-push without lease:** Use `git push --force-with-lease` instead of raw `--force`.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: server-diagnostics
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
description: Real-time system health checks, RAM/swap usage, CPU load, open ports, and network connectivity diagnostics.
|
|
5
|
+
triggers: ["health", "ram", "cpu", "swap", "diagnostics", "server", "port", "disk", "uptime"]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Skill: Server Diagnostics & Resource Health
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
Comprehensive runbook for assessing server stability, inspecting hardware memory buffers, verifying swap allocation, auditing listening network ports, and monitoring active background processes.
|
|
12
|
+
|
|
13
|
+
## When to Activate
|
|
14
|
+
- When experiencing system slowdowns, high latency, or OOM (Out-Of-Memory) kill events.
|
|
15
|
+
- When checking server resource headroom before running heavy builds or containers.
|
|
16
|
+
- When verifying open ports, firewall status, or Cloudflare tunnel connectivity.
|
|
17
|
+
|
|
18
|
+
## Workflows & Procedures
|
|
19
|
+
|
|
20
|
+
### 1. Memory & Buffer Diagnostics
|
|
21
|
+
```bash
|
|
22
|
+
# Check physical RAM and swap file availability
|
|
23
|
+
free -h
|
|
24
|
+
|
|
25
|
+
# Check top 5 memory-consuming processes
|
|
26
|
+
ps aux --sort=-%mem | head -n 6
|
|
27
|
+
```
|
|
28
|
+
* **Critical Threshold:** Available memory below 200MB warrants immediate cache cleanup or swap expansion.
|
|
29
|
+
|
|
30
|
+
### 2. CPU Load & Process Monitoring
|
|
31
|
+
```bash
|
|
32
|
+
# Check system uptime and 1m, 5m, 15m load averages
|
|
33
|
+
uptime
|
|
34
|
+
|
|
35
|
+
# Check top 5 CPU-consuming processes
|
|
36
|
+
ps aux --sort=-%cpu | head -n 6
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 3. Disk Storage & Inode Health
|
|
40
|
+
```bash
|
|
41
|
+
# Inspect filesystem disk usage
|
|
42
|
+
df -h /
|
|
43
|
+
|
|
44
|
+
# Inspect inode utilization (detects micro-file exhaustion)
|
|
45
|
+
df -i /
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 4. Network Ports & Connectivity Audit
|
|
49
|
+
```bash
|
|
50
|
+
# Check all active TCP/UDP listening sockets with process names
|
|
51
|
+
sudo ss -tulpn
|
|
52
|
+
|
|
53
|
+
# Verify internet DNS resolution
|
|
54
|
+
nslookup cloudflare.com 1.1.1.1
|
|
55
|
+
```
|