@mrtrinhvn/ag-kit 1.0.2 → 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/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(
|
|
31
|
+
.version(pkg.version);
|
|
31
32
|
|
|
32
33
|
program.command('init')
|
|
33
34
|
.description('Install .agent folder into your project')
|
package/package.json
CHANGED
|
@@ -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
|
|
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:
|
|
@@ -60,7 +60,7 @@ When modifying a feature or fixing a bug, ask yourself:
|
|
|
60
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
61
|
|
|
62
62
|
### Sub-Directory Contexts
|
|
63
|
-
When working within a specific module (e.g., `
|
|
63
|
+
When working within a specific module (e.g., `packages/core/services/` or `apps/web/components/`), you should:
|
|
64
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
|
|
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
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.
|
|
@@ -114,7 +114,7 @@ When executing long chains of tool calls (especially when searching, indexing, o
|
|
|
114
114
|
|
|
115
115
|
❌ **Random changes** - "Maybe if I change this..."
|
|
116
116
|
❌ **Ignoring evidence** - "That can't be the cause"
|
|
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
|
|
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.
|
|
118
118
|
❌ **Assuming** - "It must be X" without proof
|
|
119
119
|
❌ **Not reproducing first** - Fixing blindly
|
|
120
120
|
❌ **Stopping at symptoms** - Not finding root cause
|