@enactprotocol/cli 2.0.9 → 2.0.11
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/dist/commands/init/index.d.ts.map +1 -1
- package/dist/commands/init/index.js +75 -60
- package/dist/commands/init/index.js.map +1 -1
- package/dist/commands/init/templates/agent-agents.md +47 -0
- package/dist/commands/init/templates/claude.md +65 -0
- package/dist/commands/init/templates/tool-agents.md +56 -0
- package/dist/commands/init/templates/tool-enact.md +44 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
- package/src/commands/init/index.ts +86 -61
- package/src/commands/init/templates/agent-agents.md +47 -0
- package/src/commands/init/templates/claude.md +65 -0
- package/src/commands/init/templates/tool-agents.md +56 -0
- package/src/commands/init/templates/tool-enact.md +44 -0
- package/src/index.ts +1 -1
- package/tests/commands/init.test.ts +387 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/init/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/init/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAyNzC;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAyB3D"}
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Create a basic tool template in the current directory.
|
|
5
5
|
*/
|
|
6
|
-
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
7
|
-
import { join } from "node:path";
|
|
6
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
7
|
+
import { dirname, join } from "node:path";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
8
9
|
import { getSecret } from "@enactprotocol/secrets";
|
|
9
10
|
import { error, formatError, info, success, warning } from "../../utils";
|
|
10
11
|
/** Namespace for stored auth tokens */
|
|
@@ -15,6 +16,22 @@ const AUTH_METHOD_KEY = "auth_method";
|
|
|
15
16
|
const SUPABASE_URL = process.env.SUPABASE_URL || "https://siikwkfgsmouioodghho.supabase.co";
|
|
16
17
|
const SUPABASE_ANON_KEY = process.env.SUPABASE_ANON_KEY ??
|
|
17
18
|
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InNpaWt3a2Znc21vdWlvb2RnaGhvIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjQ2MTkzMzksImV4cCI6MjA4MDE5NTMzOX0.kxnx6-IPFhmGx6rzNx36vbyhFMFZKP_jFqaDbKnJ_E0";
|
|
19
|
+
/** Get the templates directory path */
|
|
20
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
21
|
+
const __dirname = dirname(__filename);
|
|
22
|
+
const TEMPLATES_DIR = join(__dirname, "templates");
|
|
23
|
+
/**
|
|
24
|
+
* Load a template file and replace placeholders
|
|
25
|
+
*/
|
|
26
|
+
function loadTemplate(templateName, replacements = {}) {
|
|
27
|
+
const templatePath = join(TEMPLATES_DIR, templateName);
|
|
28
|
+
let content = readFileSync(templatePath, "utf-8");
|
|
29
|
+
// Replace all {{PLACEHOLDER}} patterns
|
|
30
|
+
for (const [key, value] of Object.entries(replacements)) {
|
|
31
|
+
content = content.replaceAll(`{{${key}}}`, value);
|
|
32
|
+
}
|
|
33
|
+
return content;
|
|
34
|
+
}
|
|
18
35
|
/**
|
|
19
36
|
* Get the current logged-in username
|
|
20
37
|
*/
|
|
@@ -73,63 +90,47 @@ async function getCurrentUsername() {
|
|
|
73
90
|
return null;
|
|
74
91
|
}
|
|
75
92
|
}
|
|
76
|
-
/**
|
|
77
|
-
* Generate the tool template content
|
|
78
|
-
*/
|
|
79
|
-
function generateToolTemplate(toolName) {
|
|
80
|
-
return `---
|
|
81
|
-
name: ${toolName}
|
|
82
|
-
description: A simple tool that echoes a greeting
|
|
83
|
-
version: 0.1.0
|
|
84
|
-
enact: "2.0"
|
|
85
|
-
|
|
86
|
-
from: alpine:latest
|
|
87
|
-
|
|
88
|
-
inputSchema:
|
|
89
|
-
type: object
|
|
90
|
-
properties:
|
|
91
|
-
name:
|
|
92
|
-
type: string
|
|
93
|
-
description: Name to greet
|
|
94
|
-
default: World
|
|
95
|
-
required: []
|
|
96
|
-
|
|
97
|
-
command: |
|
|
98
|
-
echo "Hello, \${name}!"
|
|
99
|
-
---
|
|
100
|
-
|
|
101
|
-
# ${toolName}
|
|
102
|
-
|
|
103
|
-
A simple greeting tool created with \`enact init\`.
|
|
104
|
-
|
|
105
|
-
## Usage
|
|
106
|
-
|
|
107
|
-
\`\`\`bash
|
|
108
|
-
enact run ./ --args '{"name": "Alice"}'
|
|
109
|
-
\`\`\`
|
|
110
|
-
|
|
111
|
-
## Customization
|
|
112
|
-
|
|
113
|
-
Edit this file to create your own tool:
|
|
114
|
-
|
|
115
|
-
1. Update the \`name\` and \`description\` in the frontmatter
|
|
116
|
-
2. Modify the \`inputSchema\` to define your tool's inputs
|
|
117
|
-
3. Change the \`command\` to run your desired shell commands
|
|
118
|
-
4. Update this documentation section
|
|
119
|
-
|
|
120
|
-
## Learn More
|
|
121
|
-
|
|
122
|
-
- [Enact Documentation](https://enact.dev/docs)
|
|
123
|
-
- [Tool Manifest Reference](https://enact.dev/docs/manifest)
|
|
124
|
-
`;
|
|
125
|
-
}
|
|
126
93
|
/**
|
|
127
94
|
* Init command handler
|
|
128
95
|
*/
|
|
129
96
|
async function initHandler(options, ctx) {
|
|
130
97
|
const targetDir = ctx.cwd;
|
|
98
|
+
// Determine mode: --agent, --claude, or --tool (default)
|
|
99
|
+
const isAgentMode = options.agent;
|
|
100
|
+
const isClaudeMode = options.claude;
|
|
101
|
+
// Default to tool mode if no flag specified
|
|
102
|
+
// Handle --agent mode: create AGENTS.md for projects using Enact tools
|
|
103
|
+
if (isAgentMode) {
|
|
104
|
+
const agentsPath = join(targetDir, "AGENTS.md");
|
|
105
|
+
if (existsSync(agentsPath) && !options.force) {
|
|
106
|
+
warning(`AGENTS.md already exists at: ${agentsPath}`);
|
|
107
|
+
info("Use --force to overwrite");
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
writeFileSync(agentsPath, loadTemplate("agent-agents.md"), "utf-8");
|
|
111
|
+
success(`Created AGENTS.md: ${agentsPath}`);
|
|
112
|
+
info("");
|
|
113
|
+
info("This file helps AI agents understand how to use Enact tools in your project.");
|
|
114
|
+
info("Run 'enact search <query>' to find tools, 'enact install <tool>' to add them.");
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
// Handle --claude mode: create CLAUDE.md
|
|
118
|
+
if (isClaudeMode) {
|
|
119
|
+
const claudePath = join(targetDir, "CLAUDE.md");
|
|
120
|
+
if (existsSync(claudePath) && !options.force) {
|
|
121
|
+
warning(`CLAUDE.md already exists at: ${claudePath}`);
|
|
122
|
+
info("Use --force to overwrite");
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
writeFileSync(claudePath, loadTemplate("claude.md"), "utf-8");
|
|
126
|
+
success(`Created CLAUDE.md: ${claudePath}`);
|
|
127
|
+
info("");
|
|
128
|
+
info("This file helps Claude understand how to use Enact tools in your project.");
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
// Handle --tool mode (default): create enact.md + AGENTS.md for tool development
|
|
131
132
|
const manifestPath = join(targetDir, "enact.md");
|
|
132
|
-
|
|
133
|
+
const agentsPath = join(targetDir, "AGENTS.md");
|
|
133
134
|
if (existsSync(manifestPath) && !options.force) {
|
|
134
135
|
warning(`Tool manifest already exists at: ${manifestPath}`);
|
|
135
136
|
info("Use --force to overwrite");
|
|
@@ -149,14 +150,25 @@ async function initHandler(options, ctx) {
|
|
|
149
150
|
info("Run 'enact auth login' to use your username in tool names");
|
|
150
151
|
}
|
|
151
152
|
}
|
|
152
|
-
//
|
|
153
|
-
const
|
|
153
|
+
// Load templates with placeholder replacement
|
|
154
|
+
const replacements = { TOOL_NAME: toolName };
|
|
155
|
+
const manifestContent = loadTemplate("tool-enact.md", replacements);
|
|
156
|
+
const agentsContent = loadTemplate("tool-agents.md", replacements);
|
|
154
157
|
// Ensure directory exists
|
|
155
158
|
if (!existsSync(targetDir)) {
|
|
156
159
|
mkdirSync(targetDir, { recursive: true });
|
|
157
160
|
}
|
|
158
|
-
|
|
159
|
-
|
|
161
|
+
// Write enact.md
|
|
162
|
+
writeFileSync(manifestPath, manifestContent, "utf-8");
|
|
163
|
+
success(`Created tool manifest: ${manifestPath}`);
|
|
164
|
+
// Write AGENTS.md (only if it doesn't exist or --force is used)
|
|
165
|
+
if (!existsSync(agentsPath) || options.force) {
|
|
166
|
+
writeFileSync(agentsPath, agentsContent, "utf-8");
|
|
167
|
+
success(`Created AGENTS.md: ${agentsPath}`);
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
info("AGENTS.md already exists, skipping (use --force to overwrite)");
|
|
171
|
+
}
|
|
160
172
|
info("");
|
|
161
173
|
info("Next steps:");
|
|
162
174
|
info(" 1. Edit enact.md to customize your tool");
|
|
@@ -169,9 +181,12 @@ async function initHandler(options, ctx) {
|
|
|
169
181
|
export function configureInitCommand(program) {
|
|
170
182
|
program
|
|
171
183
|
.command("init")
|
|
172
|
-
.description("
|
|
173
|
-
.option("-n, --name <name>", "Tool name (default: username/my-tool
|
|
174
|
-
.option("-f, --force", "Overwrite existing
|
|
184
|
+
.description("Initialize Enact in the current directory")
|
|
185
|
+
.option("-n, --name <name>", "Tool name (default: username/my-tool)")
|
|
186
|
+
.option("-f, --force", "Overwrite existing files")
|
|
187
|
+
.option("--tool", "Create a new Enact tool (default)")
|
|
188
|
+
.option("--agent", "Create AGENTS.md for projects that use Enact tools")
|
|
189
|
+
.option("--claude", "Create CLAUDE.md with Claude-specific instructions")
|
|
175
190
|
.option("-v, --verbose", "Show detailed output")
|
|
176
191
|
.action(async (options) => {
|
|
177
192
|
const ctx = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/init/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/init/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGnD,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEzE,uCAAuC;AACvC,MAAM,cAAc,GAAG,YAAY,CAAC;AACpC,MAAM,gBAAgB,GAAG,cAAc,CAAC;AACxC,MAAM,eAAe,GAAG,aAAa,CAAC;AAEtC,6BAA6B;AAC7B,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,0CAA0C,CAAC;AAC5F,MAAM,iBAAiB,GACrB,OAAO,CAAC,GAAG,CAAC,iBAAiB;IAC7B,kNAAkN,CAAC;AAErN,uCAAuC;AACvC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACtC,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,EAAE,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KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;YACxB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
This project uses Enact tools — containerized, cryptographically-signed executables.
|
|
4
|
+
|
|
5
|
+
## Running Tools
|
|
6
|
+
```bash
|
|
7
|
+
enact run <tool-name> --args '{"key": "value"}' # Run installed tool
|
|
8
|
+
enact run ./path/to/tool --args '{}' # Run local tool
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Finding & Installing Tools
|
|
12
|
+
```bash
|
|
13
|
+
enact search "pdf extraction" # Search registry
|
|
14
|
+
enact get author/category/tool # View tool info
|
|
15
|
+
enact install author/category/tool # Add to project (.enact/tools.json)
|
|
16
|
+
enact install author/category/tool --global # Add globally
|
|
17
|
+
enact list # List project tools
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Tool Output
|
|
21
|
+
Tools output JSON to stdout. Parse with jq or your language's JSON parser:
|
|
22
|
+
```bash
|
|
23
|
+
enact run tool --args '{}' | jq '.result'
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Creating Local Tools
|
|
27
|
+
Create `tools/<name>/enact.md` with:
|
|
28
|
+
```yaml
|
|
29
|
+
---
|
|
30
|
+
name: my-tool
|
|
31
|
+
description: What it does
|
|
32
|
+
command: echo "Hello ${name}"
|
|
33
|
+
inputSchema:
|
|
34
|
+
type: object
|
|
35
|
+
properties:
|
|
36
|
+
name: { type: string }
|
|
37
|
+
---
|
|
38
|
+
# My Tool
|
|
39
|
+
Documentation here.
|
|
40
|
+
```
|
|
41
|
+
Run with: `enact run ./tools/<name> --args '{"name": "World"}'`
|
|
42
|
+
|
|
43
|
+
## Environment & Secrets
|
|
44
|
+
```bash
|
|
45
|
+
enact env set API_KEY --secret --namespace author/tool # Set secret
|
|
46
|
+
enact env list # List env vars
|
|
47
|
+
```
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This project uses Enact tools — containerized, signed executables you can run via CLI.
|
|
4
|
+
|
|
5
|
+
## Quick Reference
|
|
6
|
+
```bash
|
|
7
|
+
enact run <tool> --args '{"key": "value"}' # Run a tool
|
|
8
|
+
enact search "keyword" # Find tools
|
|
9
|
+
enact install author/tool # Install tool
|
|
10
|
+
enact list # List installed tools
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Running Tools
|
|
14
|
+
Tools take JSON input and return JSON output:
|
|
15
|
+
```bash
|
|
16
|
+
# Run and capture output
|
|
17
|
+
result=$(enact run author/utils/formatter --args '{"code": "const x=1"}')
|
|
18
|
+
|
|
19
|
+
# Parse with jq
|
|
20
|
+
enact run tool --args '{}' | jq '.data'
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Creating Tools
|
|
24
|
+
Create `enact.md` in a directory:
|
|
25
|
+
```yaml
|
|
26
|
+
---
|
|
27
|
+
name: namespace/category/tool
|
|
28
|
+
description: Clear description for search
|
|
29
|
+
version: 1.0.0
|
|
30
|
+
from: python:3.12-slim # Docker image
|
|
31
|
+
build: pip install requests # Install dependencies (cached)
|
|
32
|
+
command: python /work/main.py ${input}
|
|
33
|
+
inputSchema:
|
|
34
|
+
type: object
|
|
35
|
+
properties:
|
|
36
|
+
input: { type: string, description: "The input to process" }
|
|
37
|
+
required: [input]
|
|
38
|
+
---
|
|
39
|
+
# Tool Name
|
|
40
|
+
Usage documentation here.
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Key points:
|
|
44
|
+
- `${param}` is auto-quoted — never add manual quotes
|
|
45
|
+
- `from:` pin image versions (not `:latest`)
|
|
46
|
+
- `build:` steps are cached by Dagger
|
|
47
|
+
- Output JSON to stdout, errors to stderr
|
|
48
|
+
- Non-zero exit = failure
|
|
49
|
+
|
|
50
|
+
## Tool Development Workflow
|
|
51
|
+
```bash
|
|
52
|
+
enact run ./ --args '{"input": "test"}' # Test locally
|
|
53
|
+
enact run ./ --args '{}' --dry-run # Preview command
|
|
54
|
+
enact sign ./ && enact publish ./ # Publish
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Secrets
|
|
58
|
+
Declare in enact.md, set via CLI:
|
|
59
|
+
```yaml
|
|
60
|
+
env:
|
|
61
|
+
API_KEY: # Declared but not set
|
|
62
|
+
```
|
|
63
|
+
```bash
|
|
64
|
+
enact env set API_KEY --secret --namespace author/tool
|
|
65
|
+
```
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
Enact tool: containerized, signed executable. Manifest: `enact.md` (YAML frontmatter + Markdown docs).
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
```bash
|
|
7
|
+
enact run ./ --args '{"name": "Test"}' # Run locally
|
|
8
|
+
enact run ./ --args '{}' --dry-run # Preview execution
|
|
9
|
+
enact sign ./ && enact publish ./ # Sign and publish
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## enact.md Structure
|
|
13
|
+
```yaml
|
|
14
|
+
---
|
|
15
|
+
name: {{TOOL_NAME}} # org/category/tool format
|
|
16
|
+
description: What it does
|
|
17
|
+
version: 1.0.0 # semver
|
|
18
|
+
from: python:3.12-slim # pin versions, not :latest
|
|
19
|
+
build: pip install requests # cached by Dagger
|
|
20
|
+
command: python /work/main.py ${input}
|
|
21
|
+
timeout: 30s
|
|
22
|
+
inputSchema:
|
|
23
|
+
type: object
|
|
24
|
+
properties:
|
|
25
|
+
input: { type: string }
|
|
26
|
+
required: [input]
|
|
27
|
+
env:
|
|
28
|
+
API_KEY: # declare secrets (set via: enact env set API_KEY --secret)
|
|
29
|
+
---
|
|
30
|
+
# Tool Name
|
|
31
|
+
Documentation here (usage examples, etc.)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Parameter Substitution
|
|
35
|
+
- `${param}` — auto-quoted (handles spaces, JSON, special chars)
|
|
36
|
+
- `${param:raw}` — unquoted (use carefully)
|
|
37
|
+
- **Never manually quote**: `"${param}"` causes double-quoting
|
|
38
|
+
|
|
39
|
+
## Output
|
|
40
|
+
Always output valid JSON when `outputSchema` is defined:
|
|
41
|
+
```python
|
|
42
|
+
import json, sys
|
|
43
|
+
print(json.dumps({"result": data})) # stdout = tool output
|
|
44
|
+
sys.exit(1) # non-zero = error
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## File Access
|
|
48
|
+
Tool runs in container with `/work` as working directory. Source files copied there.
|
|
49
|
+
|
|
50
|
+
## Adding Dependencies
|
|
51
|
+
- Python: `build: pip install package1 package2`
|
|
52
|
+
- Node: `build: ["npm install", "npm run build"]`
|
|
53
|
+
- System: `build: apt-get update && apt-get install -y libfoo`
|
|
54
|
+
- Compiled: `build: rustc /work/main.rs -o /work/tool`
|
|
55
|
+
|
|
56
|
+
Build steps are cached — first run slow, subsequent runs instant.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: {{TOOL_NAME}}
|
|
3
|
+
description: A simple tool that echoes a greeting
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
enact: "2.0"
|
|
6
|
+
|
|
7
|
+
from: alpine:latest
|
|
8
|
+
|
|
9
|
+
inputSchema:
|
|
10
|
+
type: object
|
|
11
|
+
properties:
|
|
12
|
+
name:
|
|
13
|
+
type: string
|
|
14
|
+
description: Name to greet
|
|
15
|
+
default: World
|
|
16
|
+
required: []
|
|
17
|
+
|
|
18
|
+
command: |
|
|
19
|
+
echo "Hello, ${name}!"
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
# {{TOOL_NAME}}
|
|
23
|
+
|
|
24
|
+
A simple greeting tool created with `enact init`.
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
enact run ./ --args '{"name": "Alice"}'
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Customization
|
|
33
|
+
|
|
34
|
+
Edit this file to create your own tool:
|
|
35
|
+
|
|
36
|
+
1. Update the `name` and `description` in the frontmatter
|
|
37
|
+
2. Modify the `inputSchema` to define your tool's inputs
|
|
38
|
+
3. Change the `command` to run your desired shell commands
|
|
39
|
+
4. Update this documentation section
|
|
40
|
+
|
|
41
|
+
## Learn More
|
|
42
|
+
|
|
43
|
+
- [Enact Documentation](https://enact.dev/docs)
|
|
44
|
+
- [Tool Manifest Reference](https://enact.dev/docs/manifest)
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
* Command-line interface for Enact.
|
|
6
6
|
* User-facing commands for tool execution, discovery, and management.
|
|
7
7
|
*/
|
|
8
|
-
export declare const version = "2.0.
|
|
8
|
+
export declare const version = "2.0.11";
|
|
9
9
|
export type { GlobalOptions, CommandContext } from "./types";
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;GAKG;AA2BH,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;GAKG;AA2BH,eAAO,MAAM,OAAO,WAAW,CAAC;AAGhC,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { ensureGlobalSetup } from "@enactprotocol/shared";
|
|
|
9
9
|
import { Command } from "commander";
|
|
10
10
|
import { configureAuthCommand, configureCacheCommand, configureConfigCommand, configureEnvCommand, configureExecCommand, configureGetCommand, configureInitCommand, configureInspectCommand, configureInstallCommand, configureListCommand, configurePublishCommand, configureReportCommand, configureRunCommand, configureSearchCommand, configureSetupCommand, configureSignCommand, configureTrustCommand, configureUnyankCommand, configureYankCommand, } from "./commands";
|
|
11
11
|
import { error, formatError } from "./utils";
|
|
12
|
-
export const version = "2.0.
|
|
12
|
+
export const version = "2.0.11";
|
|
13
13
|
// Main CLI entry point
|
|
14
14
|
async function main() {
|
|
15
15
|
// Ensure global setup is complete on first run
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;GAKG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,uBAAuB,EACvB,oBAAoB,EACpB,uBAAuB,EACvB,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE7C,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;GAKG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,uBAAuB,EACvB,oBAAoB,EACpB,uBAAuB,EACvB,sBAAsB,EACtB,mBAAmB,EACnB,sB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@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enactprotocol/cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.11",
|
|
4
4
|
"description": "Command-line interface for Enact - the npm for AI tools",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"directory": "packages/cli"
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
|
-
"build": "tsc --build",
|
|
26
|
+
"build": "tsc --build && cp -r src/commands/init/templates dist/commands/init/",
|
|
27
27
|
"clean": "rm -rf dist",
|
|
28
28
|
"test": "bun test",
|
|
29
29
|
"typecheck": "tsc --noEmit",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@clack/prompts": "^0.11.0",
|
|
37
|
-
"@enactprotocol/api": "2.0.
|
|
38
|
-
"@enactprotocol/execution": "2.0.
|
|
39
|
-
"@enactprotocol/secrets": "2.0.
|
|
40
|
-
"@enactprotocol/shared": "2.0.
|
|
37
|
+
"@enactprotocol/api": "2.0.11",
|
|
38
|
+
"@enactprotocol/execution": "2.0.11",
|
|
39
|
+
"@enactprotocol/secrets": "2.0.11",
|
|
40
|
+
"@enactprotocol/shared": "2.0.11",
|
|
41
41
|
"commander": "^12.1.0",
|
|
42
42
|
"picocolors": "^1.1.1"
|
|
43
43
|
},
|