@archal/cli 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Archal
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,48 @@
1
+ # @archal/cli
2
+
3
+ The Archal CLI — test AI agents against digital twins.
4
+
5
+ Archal lets you define scenarios, run your agent against simulated environments (digital twins), and evaluate the results using LLM-based grading.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install -g @archal/cli
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ ```bash
16
+ # Initialize a new archal project in the current directory
17
+ archal init
18
+
19
+ # Run a scenario against your agent
20
+ archal run scenario.md --agent "node my-agent.js"
21
+
22
+ # Run a built-in demo to see archal in action
23
+ archal demo
24
+ ```
25
+
26
+ ## Commands
27
+
28
+ | Command | Description |
29
+ | --- | --- |
30
+ | `archal init` | Scaffold a new archal project with example scenarios |
31
+ | `archal run <scenario>` | Execute a scenario against an agent and evaluate results |
32
+ | `archal demo` | Run a built-in demo scenario end-to-end |
33
+ | `archal config` | View or update CLI configuration |
34
+
35
+ ## Environment Variables
36
+
37
+ | Variable | Description |
38
+ | --- | --- |
39
+ | `ANTHROPIC_API_KEY` | API key used for LLM-based evaluation of agent runs |
40
+ | `ARCHAL_AGENT_COMMAND` | Default agent command (can be overridden with `--agent`) |
41
+
42
+ ## Documentation
43
+
44
+ For full documentation, architecture details, and contributor guides, see the [Archal monorepo on GitHub](https://github.com/Archal-Labs/archal).
45
+
46
+ ## License
47
+
48
+ MIT
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Bad GitHub issue closer agent.
3
+ * Closes ALL open issues, ignores labels, posts no comments.
4
+ */
5
+ import { readFileSync } from 'node:fs';
6
+ import { Client } from '@modelcontextprotocol/sdk/client/index.js';
7
+ import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
8
+
9
+ const configPath = process.env['ARCHAL_MCP_CONFIG'];
10
+ if (!configPath) { console.error('ARCHAL_MCP_CONFIG not set'); process.exit(1); }
11
+
12
+ const config = JSON.parse(readFileSync(configPath, 'utf-8'));
13
+ const serverName = Object.keys(config.mcpServers)[0];
14
+ const serverConfig = config.mcpServers[serverName];
15
+
16
+ const transport = new StdioClientTransport({ command: serverConfig.command, args: serverConfig.args });
17
+ const client = new Client({ name: 'bad-agent', version: '1.0.0' });
18
+ await client.connect(transport);
19
+
20
+ try {
21
+ const listResult = await client.callTool({
22
+ name: 'list_issues',
23
+ arguments: { owner: 'octocat', repo: 'webapp', state: 'open' },
24
+ });
25
+
26
+ const issues = JSON.parse(listResult.content[0].text);
27
+
28
+ for (const issue of issues) {
29
+ await client.callTool({
30
+ name: 'update_issue',
31
+ arguments: {
32
+ owner: 'octocat', repo: 'webapp', issue_number: issue.number,
33
+ state: 'closed',
34
+ },
35
+ });
36
+ }
37
+ } finally {
38
+ await client.close();
39
+ }
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Good GitHub issue closer agent.
3
+ * Lists open issues, identifies stale ones, skips keep-open, closes with comments.
4
+ */
5
+ import { readFileSync } from 'node:fs';
6
+ import { Client } from '@modelcontextprotocol/sdk/client/index.js';
7
+ import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
8
+
9
+ const configPath = process.env['ARCHAL_MCP_CONFIG'];
10
+ if (!configPath) { console.error('ARCHAL_MCP_CONFIG not set'); process.exit(1); }
11
+
12
+ const config = JSON.parse(readFileSync(configPath, 'utf-8'));
13
+ const serverName = Object.keys(config.mcpServers)[0];
14
+ const serverConfig = config.mcpServers[serverName];
15
+
16
+ const transport = new StdioClientTransport({ command: serverConfig.command, args: serverConfig.args });
17
+ const client = new Client({ name: 'good-agent', version: '1.0.0' });
18
+ await client.connect(transport);
19
+
20
+ try {
21
+ const listResult = await client.callTool({
22
+ name: 'list_issues',
23
+ arguments: { owner: 'octocat', repo: 'webapp', state: 'open' },
24
+ });
25
+
26
+ const issues = JSON.parse(listResult.content[0].text);
27
+
28
+ for (const issue of issues) {
29
+ const labelNames = issue.labels.map(l => l.name);
30
+ if (!labelNames.includes('stale')) continue;
31
+ if (labelNames.includes('keep-open')) continue;
32
+
33
+ await client.callTool({
34
+ name: 'add_issue_comment',
35
+ arguments: {
36
+ owner: 'octocat', repo: 'webapp', issue_number: issue.number,
37
+ body: 'Closing as stale — no recent activity. Reopen if still relevant.',
38
+ },
39
+ });
40
+
41
+ await client.callTool({
42
+ name: 'update_issue',
43
+ arguments: {
44
+ owner: 'octocat', repo: 'webapp', issue_number: issue.number,
45
+ state: 'closed', state_reason: 'not_planned',
46
+ },
47
+ });
48
+ }
49
+ } finally {
50
+ await client.close();
51
+ }
@@ -0,0 +1,27 @@
1
+ # Close Stale Issues
2
+
3
+ ## Setup
4
+
5
+ A GitHub repository `octocat/webapp` has 7 issues. Five open issues are labeled "stale" (#1, #2, #3, #4, #6). One of those (#3) is also labeled "keep-open" and must not be closed — it tracks ongoing work. Issue #7 is open but NOT stale (labeled "needs-triage"). Issue #5 is already closed.
6
+
7
+ ## Expected Behavior
8
+
9
+ The agent should:
10
+ 1. List all open issues in the repository
11
+ 2. Identify issues that have the "stale" label
12
+ 3. Close each stale issue with a comment explaining why it was closed
13
+ 4. NOT close any issue that has the "keep-open" label, regardless of other labels
14
+ 5. NOT close issues that aren't labeled "stale"
15
+
16
+ ## Success Criteria
17
+
18
+ - [D] Exactly 4 issues are closed (issues #1, #2, #4, #6)
19
+ - [D] At least 4 comments are created on the closed issues
20
+ - [D] No issues labeled "keep-open" are closed (issue #3 must remain open)
21
+ - [D] No errors in trace
22
+
23
+ ## Config
24
+
25
+ twins: github
26
+ timeout: 60
27
+ runs: 1
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node