@mrtrinhvn/ag-kit 1.0.0 → 1.0.4

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.
package/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # Antigravity Kit Core (`@mrtrinhvn/ag-kit`) 🚀
2
+
3
+ A generic, institutional-grade AI programming framework for automating scaffolding, architecture, and coding directly inside your software projects. Inspired by the principles of `.agent` systems, carefully stripped of domain-specific constraints to adapt to any software development lifecycle.
4
+
5
+ ## 📦 Quick Install
6
+
7
+ The best way to initialize the AG-Kit in a new project is using `npx`:
8
+
9
+ ```bash
10
+ npx @mrtrinhvn/ag-kit init
11
+ ```
12
+
13
+ ## 🛠 Global Usage & Commands
14
+
15
+ You can also install it globally if you frequently create new projects:
16
+
17
+ ```bash
18
+ npm install -g @mrtrinhvn/ag-kit
19
+ ```
20
+
21
+ Then use the provided CLI anywhere:
22
+
23
+ | Command | Description |
24
+ |---|---|
25
+ | `ag-kit init` | Scaffolds the `.agent` framework (Agents, Skills, Workflows) into your current directory. |
26
+ | `ag-kit update` | Pulls the latest rules and templates and safely overwrites the core `.agent` folders without breaking your custom `knowledge/` base. |
27
+ | `ag-kit status` | Checks exactly which version of the AG-Kit is active in your current working directory. |
28
+
29
+ ## 🧠 What's Inside the Brain?
30
+
31
+ Running `ag-kit init` injects the following core architecture into your project:
32
+
33
+ - **`GEMINI.md`**: The supreme constitution (Tier 0 Rules) ensuring the Agent always thinks systematically, acts safely, and never hallucinates code.
34
+ - **`agents/`**: Core personas taking specialized roles (e.g., `orchestrator`, `frontend-specialist`, `backend-specialist`, `debugger`).
35
+ - **`skills/`**: Tactical operational algorithms spanning from `clean-code` and `tdd-workflow` to `python-patterns` and `nextjs-react-expert`.
36
+ - **`workflows/`**: Pre-defined step-by-step instructions (slash commands) like `/create`, `/plan`, `/brainstorm`, and `/debug`.
37
+ - **`scripts/`**: CI/CD automation checkers like `lint_runner.py` and `security_scan.py`.
38
+
39
+ ## ⚙️ How It Works
40
+ The AG-Kit is designed to be injected into an AI IDE or a custom Agent workspace.
41
+ 1. The AI reads `GEMINI.md` first.
42
+ 2. It assumes the persona of the relevant specialist in `agents/`.
43
+ 3. It selectively loads specific techniques from `skills/` based on context.
44
+ 4. It continuously documents important technical learnings in `knowledge/`.
45
+
46
+ ---
47
+ *Built with ❤️ to enforce Institutional-Grade Software Standards.*
package/bin/cli.js CHANGED
@@ -24,10 +24,11 @@ function copyRecursiveSync(src, dest) {
24
24
  }
25
25
  }
26
26
 
27
+ const pkg = require('../package.json');
27
28
  program
28
29
  .name('ag-kit')
29
30
  .description('Trí khôn Lập trình Phổ quát - AI Agent Initialization Framework')
30
- .version('1.0.0');
31
+ .version(pkg.version);
31
32
 
32
33
  program.command('init')
33
34
  .description('Install .agent folder into your project')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrtrinhvn/ag-kit",
3
- "version": "1.0.0",
3
+ "version": "1.0.4",
4
4
  "description": "Antigravity Kit Base Framework - Generic Agentic AI Programming Core",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: cli-generator
3
+ description: Meta-skill enabling the Agent to automatically convert local software, repositories, or APIs into structured CLI tools using HKUDS/CLI-Anything.
4
+ ---
5
+
6
+ # CLI-Generator (Meta-Skill)
7
+
8
+ > 🔴 **CRITICAL**: This is a Meta-Skill. It gives you (the AI Agent) the ability to forge your own tools to solve complex constraints.
9
+
10
+ ## When to Use
11
+
12
+ Use this skill when:
13
+ - The user asks you to interact with a complex local GUI software (e.g., GIMP, OBS).
14
+ - You are working with a messy, undocumented local API or scripting repository that is too brittle to run manually via ad-hoc scripts.
15
+ - You need a dedicated CLI tool to perform repetitive tasks reliably, but none exists.
16
+
17
+ ## The Forging Process
18
+
19
+ When you decide you need a new CLI tool for a given `TARGET_DIR` (the source code of the application), follow exactly these steps:
20
+
21
+ ### 1. Install CLI-Anything (If not already installed)
22
+ Check if `cli-anything` is available in your PATH. If not, install it globally:
23
+ ```bash
24
+ pip install cli-anything
25
+ ```
26
+ *(If the package is not on PyPI, clone `https://github.com/HKUDS/CLI-Anything` and run `pip install -e .`)*
27
+
28
+ ### 2. Run the Generator Pipeline
29
+ Navigate to a neutral workspace or the target, and run the automated generation pipeline:
30
+ ```bash
31
+ cli-anything --source /absolute/path/to/TARGET_DIR
32
+ ```
33
+ *Note: This process analyzes the source code and generates the harness. It may take several minutes and uses the underlying LLM's API tokens.*
34
+
35
+ ### 3. Integrate the Forged Skill into `ag-kit`
36
+ The pipeline will generate a new Python package (e.g., `cli-anything-targetname`) and automatically produce a `SKILL.md` file within its package directory (usually `cli_anything/<software>/skills/SKILL.md`).
37
+ You MUST locate this generated `SKILL.md` and copy it into the user's `ag-kit` workspace:
38
+ ```bash
39
+ mkdir -p .agent/skills/<targetname-cli>
40
+ cp /path/to/generated/SKILL.md .agent/skills/<targetname-cli>/SKILL.md
41
+ ```
42
+
43
+ ### 4. Self-Update
44
+ Once the new `SKILL.md` is in place, you (or any other agent using this repository like GravityClaw / Openclaw) will instantly possess the knowledge to use the newly forged CLI tool. Proceed to solve the user's original objective using the new tool natively.
45
+
46
+ ## Anti-Patterns
47
+ - ❌ **Manual wrappers**: Do NOT try to manually write a CLI harness or wrappers if `cli-anything` can automate it perfectly.
48
+ - ❌ **Token waste**: Do NOT run the generator repeatedly on the same source code. Generate the CLI once, store the `SKILL.md`, and reuse the tool.
@@ -16,7 +16,7 @@ allowed-tools: Read, Write, Glob, Grep
16
16
 
17
17
  ### Mandatory Read Before Action
18
18
  Before interacting with any third-party API, database schema, or core system component, you **MUST** search the `.agent/knowledge/` directory for existing documentation.
19
- *Example: Before coding a DNSE WebSocket feature, read `.agent/knowledge/integrations/dnse_api.md` to get the exact channels and payload structures.*
19
+ *Example: Before coding a payment integration feature, read `.agent/knowledge/integrations/stripe_api.md` to get the exact webhooks and payload structures.*
20
20
 
21
21
  ### Mandatory Proactive Updates (Zero Prompting Rule)
22
22
  When you successfully:
@@ -52,3 +52,15 @@ When modifying a feature or fixing a bug, ask yourself:
52
52
  2. What UI component relies on this data?
53
53
  3. **Does this change make the current Knowledge Base outdated?**
54
54
  - If YES, you **MUST** pause and update the relevant `.md` files in `.agent/knowledge/` right then and there. A working codebase with an outdated AI brain is a broken project.
55
+
56
+ ---
57
+
58
+ ## 3. 🗺️ HIERARCHICAL CONTEXT ROUTING (Local Memory)
59
+
60
+ **PRINCIPLE:** Context should be scoped locally to reduce token bloat and prevent the AI from hallucinating across unrelated domains. Do not stuff all documentation into a monolithic global file.
61
+
62
+ ### Sub-Directory Contexts
63
+ When working within a specific module (e.g., `packages/core/services/` or `apps/web/components/`), you should:
64
+ 1. **Check for Local Context:** Look for a `CONTEXT.md` or `README.md` file *within that specific directory* before starting work.
65
+ 2. **Context Routing:** Leave pointers in central documentation (like `.agent/knowledge/architecture.md`) that route the AI to these deep local files. (e.g., `-> For payment processing logic, see packages/core/billing/CONTEXT.md`).
66
+ 3. **Local Updates:** When making fundamental changes to a localized component, create or update its local `CONTEXT.md` instead of polluting the global knowledge base. Keep local context files under 100 lines.
@@ -100,11 +100,21 @@ grep -r "errorPattern" --include="*.ts"
100
100
  pm2 logs app-name --err --lines 100
101
101
  ```
102
102
 
103
+ ## 🛡️ Tool Use Guardian (Execution Protection)
104
+
105
+ When executing long chains of tool calls (especially when searching, indexing, or scraping), you MUST act as a Guardian of the execution:
106
+ 1. **Pre-Call Validation:** Validate file paths and parameters before executing. Don't guess or hallucinate paths.
107
+ 2. **Failure Recovery:** If a tool fails (Timeout, Rate Limit, Truncated JSON), **DO NOT panic and restart from scratch**.
108
+ - *Truncated:* Use `view_file` with line ranges to fetch the rest.
109
+ - *Timeout:* Simplify the bash command or narrow the `grep_search` scope.
110
+ - *Error-as-200:* Always check tool output for disguised `{"error": ...}` messages before assuming success.
111
+ 3. **Checkpoints:** Maintain logical mental checkpoints. If Step 5 of a 10-step process fails, resume exactly at Step 5.
112
+
103
113
  ## Anti-Patterns
104
114
 
105
115
  ❌ **Random changes** - "Maybe if I change this..."
106
116
  ❌ **Ignoring evidence** - "That can't be the cause"
107
- ❌ **Assuming Data/API is dead** - Concluding an API endpoint is removed or data is unavailable just because a simple test failed (e.g., testing outside trading hours). ALWAYS check official documentation or sample SDK code before declaring an API dead.
117
+ ❌ **Assuming Data/API is dead** - Concluding an API endpoint is removed or data is unavailable just because a simple test failed (e.g., testing outside of service hours or without proper auth). ALWAYS check official documentation or sample SDK code before declaring an API dead.
108
118
  ❌ **Assuming** - "It must be X" without proof
109
119
  ❌ **Not reproducing first** - Fixing blindly
110
120
  ❌ **Stopping at symptoms** - Not finding root cause