@execlave/cli 1.0.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/README.md +84 -0
- package/dist/__tests__/commands/agents.test.d.ts +2 -0
- package/dist/__tests__/commands/agents.test.d.ts.map +1 -0
- package/dist/__tests__/commands/agents.test.js +141 -0
- package/dist/__tests__/commands/agents.test.js.map +1 -0
- package/dist/__tests__/commands/incidents.test.d.ts +2 -0
- package/dist/__tests__/commands/incidents.test.d.ts.map +1 -0
- package/dist/__tests__/commands/incidents.test.js +74 -0
- package/dist/__tests__/commands/incidents.test.js.map +1 -0
- package/dist/__tests__/commands/login.test.d.ts +2 -0
- package/dist/__tests__/commands/login.test.d.ts.map +1 -0
- package/dist/__tests__/commands/login.test.js +91 -0
- package/dist/__tests__/commands/login.test.js.map +1 -0
- package/dist/__tests__/commands/policies.test.d.ts +2 -0
- package/dist/__tests__/commands/policies.test.d.ts.map +1 -0
- package/dist/__tests__/commands/policies.test.js +101 -0
- package/dist/__tests__/commands/policies.test.js.map +1 -0
- package/dist/__tests__/commands/prompts.test.d.ts +2 -0
- package/dist/__tests__/commands/prompts.test.d.ts.map +1 -0
- package/dist/__tests__/commands/prompts.test.js +151 -0
- package/dist/__tests__/commands/prompts.test.js.map +1 -0
- package/dist/__tests__/commands/status.test.d.ts +2 -0
- package/dist/__tests__/commands/status.test.d.ts.map +1 -0
- package/dist/__tests__/commands/status.test.js +117 -0
- package/dist/__tests__/commands/status.test.js.map +1 -0
- package/dist/__tests__/commands/traces.test.d.ts +2 -0
- package/dist/__tests__/commands/traces.test.d.ts.map +1 -0
- package/dist/__tests__/commands/traces.test.js +122 -0
- package/dist/__tests__/commands/traces.test.js.map +1 -0
- package/dist/commands/agents.d.ts +4 -0
- package/dist/commands/agents.d.ts.map +1 -0
- package/dist/commands/agents.js +80 -0
- package/dist/commands/agents.js.map +1 -0
- package/dist/commands/bootstrap.d.ts +2 -0
- package/dist/commands/bootstrap.d.ts.map +1 -0
- package/dist/commands/bootstrap.js +185 -0
- package/dist/commands/bootstrap.js.map +1 -0
- package/dist/commands/incidents.d.ts +3 -0
- package/dist/commands/incidents.d.ts.map +1 -0
- package/dist/commands/incidents.js +96 -0
- package/dist/commands/incidents.js.map +1 -0
- package/dist/commands/login.d.ts +2 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +50 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/org.d.ts +3 -0
- package/dist/commands/org.d.ts.map +1 -0
- package/dist/commands/org.js +45 -0
- package/dist/commands/org.js.map +1 -0
- package/dist/commands/policies.d.ts +5 -0
- package/dist/commands/policies.d.ts.map +1 -0
- package/dist/commands/policies.js +227 -0
- package/dist/commands/policies.js.map +1 -0
- package/dist/commands/prompts.d.ts +5 -0
- package/dist/commands/prompts.d.ts.map +1 -0
- package/dist/commands/prompts.js +80 -0
- package/dist/commands/prompts.js.map +1 -0
- package/dist/commands/status.d.ts +2 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +72 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/traces.d.ts +3 -0
- package/dist/commands/traces.d.ts.map +1 -0
- package/dist/commands/traces.js +60 -0
- package/dist/commands/traces.js.map +1 -0
- package/dist/commands/workspace.d.ts +3 -0
- package/dist/commands/workspace.d.ts.map +1 -0
- package/dist/commands/workspace.js +68 -0
- package/dist/commands/workspace.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +148 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/api.d.ts +3 -0
- package/dist/utils/api.d.ts.map +1 -0
- package/dist/utils/api.js +15 -0
- package/dist/utils/api.js.map +1 -0
- package/dist/utils/config.d.ts +19 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +28 -0
- package/dist/utils/config.js.map +1 -0
- package/package.json +49 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import { login } from './commands/login.js';
|
|
5
|
+
import { status } from './commands/status.js';
|
|
6
|
+
import { listAgents, pauseAgent, resumeAgent } from './commands/agents.js';
|
|
7
|
+
import { listPromptVersions, deployPromptVersion, rollbackPromptVersion, approvePromptVersion } from './commands/prompts.js';
|
|
8
|
+
import { listTraces, traceStats } from './commands/traces.js';
|
|
9
|
+
import { listPolicies, policyViolations, applyPolicies, testPolicies } from './commands/policies.js';
|
|
10
|
+
import { listIncidents, exportIncidents } from './commands/incidents.js';
|
|
11
|
+
import { listOrgs, orgSettings } from './commands/org.js';
|
|
12
|
+
import { listWorkspaces, createWorkspace } from './commands/workspace.js';
|
|
13
|
+
import { bootstrap } from './commands/bootstrap.js';
|
|
14
|
+
import { setApiVersion } from './utils/config.js';
|
|
15
|
+
const program = new Command();
|
|
16
|
+
program
|
|
17
|
+
.name('execlave')
|
|
18
|
+
.description('Execlave CLI — AI Agent Governance Platform')
|
|
19
|
+
.version('1.0.0')
|
|
20
|
+
.option('--api-version <version>', 'API version to use (default: v1, use v0 for legacy)', 'v1')
|
|
21
|
+
.hook('preAction', (thisCommand) => {
|
|
22
|
+
const version = thisCommand.opts().apiVersion;
|
|
23
|
+
if (version) {
|
|
24
|
+
setApiVersion(version === 'v0' ? '' : version);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
program
|
|
28
|
+
.command('login')
|
|
29
|
+
.description('Login to Execlave (stores an API key for subsequent commands)')
|
|
30
|
+
.action(login);
|
|
31
|
+
program
|
|
32
|
+
.command('status')
|
|
33
|
+
.description('Check connection and current organization status')
|
|
34
|
+
.action(status);
|
|
35
|
+
program
|
|
36
|
+
.command('bootstrap')
|
|
37
|
+
.description('Interactive setup wizard for a new Execlave environment')
|
|
38
|
+
.action(bootstrap);
|
|
39
|
+
// ── Agents ─────────────────────────────────────────────────────────
|
|
40
|
+
const agents = program.command('agents').description('Manage AI agents');
|
|
41
|
+
agents
|
|
42
|
+
.command('list')
|
|
43
|
+
.description('List all agents in the current organization')
|
|
44
|
+
.action(listAgents);
|
|
45
|
+
agents
|
|
46
|
+
.command('pause <id>')
|
|
47
|
+
.description('Pause an agent (kill switch)')
|
|
48
|
+
.option('--reason <reason>', 'Reason for pausing')
|
|
49
|
+
.action((id, opts) => pauseAgent(id, opts.reason));
|
|
50
|
+
agents
|
|
51
|
+
.command('resume <id>')
|
|
52
|
+
.description('Resume a paused agent')
|
|
53
|
+
.action(resumeAgent);
|
|
54
|
+
// ── Organization ──────────────────────────────────────────────────
|
|
55
|
+
const org = program.command('org').description('Organization management');
|
|
56
|
+
org
|
|
57
|
+
.command('list')
|
|
58
|
+
.description('Show current organization info')
|
|
59
|
+
.action(listOrgs);
|
|
60
|
+
org
|
|
61
|
+
.command('settings')
|
|
62
|
+
.description('Show organization settings')
|
|
63
|
+
.action(orgSettings);
|
|
64
|
+
// ── Workspaces ────────────────────────────────────────────────────
|
|
65
|
+
const workspaces = program.command('workspace').description('Manage workspaces');
|
|
66
|
+
workspaces
|
|
67
|
+
.command('list')
|
|
68
|
+
.description('List all workspaces')
|
|
69
|
+
.action(listWorkspaces);
|
|
70
|
+
workspaces
|
|
71
|
+
.command('create')
|
|
72
|
+
.description('Create a new workspace (interactive)')
|
|
73
|
+
.action(createWorkspace);
|
|
74
|
+
// ── Prompt Versions ─────────────────────────────────────────────────
|
|
75
|
+
const prompts = program.command('prompts').description('Manage prompt versions');
|
|
76
|
+
prompts
|
|
77
|
+
.command('list')
|
|
78
|
+
.description('List prompt versions')
|
|
79
|
+
.option('--agent-id <id>', 'Filter by agent ID')
|
|
80
|
+
.action((opts) => listPromptVersions(opts.agentId));
|
|
81
|
+
prompts
|
|
82
|
+
.command('deploy <versionId>')
|
|
83
|
+
.description('Deploy a prompt version')
|
|
84
|
+
.option('--env <environment>', 'Target environment', 'production')
|
|
85
|
+
.action((versionId, opts) => deployPromptVersion(versionId, opts.env));
|
|
86
|
+
prompts
|
|
87
|
+
.command('rollback <versionId>')
|
|
88
|
+
.description('Rollback to a prompt version')
|
|
89
|
+
.requiredOption('--reason <reason>', 'Reason for rollback')
|
|
90
|
+
.action((versionId, opts) => rollbackPromptVersion(versionId, opts.reason));
|
|
91
|
+
prompts
|
|
92
|
+
.command('approve <versionId>')
|
|
93
|
+
.description('Approve a pending prompt version')
|
|
94
|
+
.action(approvePromptVersion);
|
|
95
|
+
// ── Traces ──────────────────────────────────────────────────────────
|
|
96
|
+
const traces = program.command('traces').description('View execution traces');
|
|
97
|
+
traces
|
|
98
|
+
.command('list')
|
|
99
|
+
.description('List recent traces')
|
|
100
|
+
.option('--agent-id <id>', 'Filter by agent ID')
|
|
101
|
+
.action((opts) => listTraces(opts.agentId));
|
|
102
|
+
traces
|
|
103
|
+
.command('stats')
|
|
104
|
+
.description('Show trace statistics for the last 24 hours')
|
|
105
|
+
.action(traceStats);
|
|
106
|
+
// ── Policies ────────────────────────────────────────────────────────
|
|
107
|
+
const policies = program.command('policies').description('Manage governance policies');
|
|
108
|
+
policies
|
|
109
|
+
.command('list')
|
|
110
|
+
.description('List all policies')
|
|
111
|
+
.action(listPolicies);
|
|
112
|
+
policies
|
|
113
|
+
.command('violations')
|
|
114
|
+
.description('Show recent policy violations')
|
|
115
|
+
.action(policyViolations);
|
|
116
|
+
policies
|
|
117
|
+
.command('apply')
|
|
118
|
+
.description('Apply policies from a YAML/JSON file')
|
|
119
|
+
.requiredOption('--file <path>', 'Path to the policy file')
|
|
120
|
+
.action((opts) => applyPolicies(opts.file));
|
|
121
|
+
policies
|
|
122
|
+
.command('test')
|
|
123
|
+
.description('Test policies against historical traces')
|
|
124
|
+
.requiredOption('--file <path>', 'Path to the policy file')
|
|
125
|
+
.option('--from <duration>', 'Time window (e.g. 7d, 24h)', '7d')
|
|
126
|
+
.action((opts) => testPolicies(opts.file, opts.from));
|
|
127
|
+
// ── Incidents ───────────────────────────────────────────────────────
|
|
128
|
+
const incidents = program.command('incidents').description('View and manage incidents');
|
|
129
|
+
incidents
|
|
130
|
+
.command('list')
|
|
131
|
+
.description('List all incidents')
|
|
132
|
+
.action(listIncidents);
|
|
133
|
+
incidents
|
|
134
|
+
.command('export')
|
|
135
|
+
.description('Export incidents to file')
|
|
136
|
+
.option('--format <format>', 'Output format (csv, json)', 'csv')
|
|
137
|
+
.option('--from <duration>', 'Time window (e.g. 30d, 24h)', '30d')
|
|
138
|
+
.action((opts) => exportIncidents(opts.format, opts.from));
|
|
139
|
+
// catch-all for unknown commands
|
|
140
|
+
program.on('command:*', () => {
|
|
141
|
+
console.error(chalk.red('Invalid command: %s\nSee --help for a list of available commands.'), program.args.join(' '));
|
|
142
|
+
process.exit(1);
|
|
143
|
+
});
|
|
144
|
+
program.parse(process.argv);
|
|
145
|
+
if (!process.argv.slice(2).length) {
|
|
146
|
+
program.outputHelp();
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7H,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACrG,OAAO,EAAE,aAAa,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CAAC,mBAAmB,EAAE,2BAA2B,EAAE,KAAK,CAAC;KAC/D,MAAM,CAAC,mBAAmB,EAAE,6BAA6B,EAAE,KAAK,CAAC;KACjE,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AAE/D,iCAAiC;AACjC,OAAO,CAAC,EAAE,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,mEAAmE,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACtH,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC;AAEH,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAE5B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAChC,OAAO,CAAC,UAAU,EAAE,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/utils/api.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,GAAG,+BAAiB,CAAC;AAc3B,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { getStoredToken, getBaseUrl } from './config.js';
|
|
3
|
+
const api = axios.create();
|
|
4
|
+
// Resolve baseURL dynamically so --api-version flag takes effect
|
|
5
|
+
api.interceptors.request.use((config) => {
|
|
6
|
+
config.baseURL = getBaseUrl();
|
|
7
|
+
const token = getStoredToken();
|
|
8
|
+
if (token) {
|
|
9
|
+
// CLI uses API Key authentication pattern
|
|
10
|
+
config.headers['X-API-Key'] = token;
|
|
11
|
+
}
|
|
12
|
+
return config;
|
|
13
|
+
});
|
|
14
|
+
export default api;
|
|
15
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/utils/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzD,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;AAE3B,iEAAiE;AACjE,GAAG,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;IACpC,MAAM,CAAC,OAAO,GAAG,UAAU,EAAE,CAAC;IAE9B,MAAM,KAAK,GAAG,cAAc,EAAE,CAAC;IAC/B,IAAI,KAAK,EAAE,CAAC;QACR,0CAA0C;QAC1C,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC;IACxC,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Conf from 'conf';
|
|
2
|
+
interface ConfigSchema {
|
|
3
|
+
token?: string;
|
|
4
|
+
baseUrl?: string;
|
|
5
|
+
organizationId?: string;
|
|
6
|
+
apiVersion?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const config: Conf<ConfigSchema>;
|
|
9
|
+
export declare const getStoredToken: () => string | undefined;
|
|
10
|
+
export declare const setStoredToken: (token: string) => void;
|
|
11
|
+
export declare const clearStoredToken: () => void;
|
|
12
|
+
export declare const getApiVersion: () => string;
|
|
13
|
+
export declare const setApiVersion: (version: string) => void;
|
|
14
|
+
export declare const getBaseUrl: () => string;
|
|
15
|
+
export declare const setBaseUrl: (url: string) => void;
|
|
16
|
+
export declare const getOrgId: () => string | undefined;
|
|
17
|
+
export declare const setOrgId: (id: string) => void;
|
|
18
|
+
export default config;
|
|
19
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,UAAU,YAAY;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,QAAA,MAAM,MAAM,oBAEV,CAAC;AAEH,eAAO,MAAM,cAAc,0BAId,CAAC;AACd,eAAO,MAAM,cAAc,GAAI,OAAO,MAAM,SAA+B,CAAC;AAC5E,eAAO,MAAM,gBAAgB,YAA+B,CAAC;AAE7D,eAAO,MAAM,aAAa,cAAyC,CAAC;AACpE,eAAO,MAAM,aAAa,GAAI,SAAS,MAAM,SAAsC,CAAC;AAEpF,eAAO,MAAM,UAAU,cAWtB,CAAC;AACF,eAAO,MAAM,UAAU,GAAI,KAAK,MAAM,SAA+B,CAAC;AAEtE,eAAO,MAAM,QAAQ,0BAAqC,CAAC;AAC3D,eAAO,MAAM,QAAQ,GAAI,IAAI,MAAM,SAAqC,CAAC;AAEzE,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import Conf from 'conf';
|
|
2
|
+
const config = new Conf({
|
|
3
|
+
projectName: 'execlave-cli',
|
|
4
|
+
});
|
|
5
|
+
export const getStoredToken = () => config.get('token') ||
|
|
6
|
+
process.env.EXECLAVE_API_KEY ||
|
|
7
|
+
process.env.AGENTGUARD_API_KEY ||
|
|
8
|
+
undefined;
|
|
9
|
+
export const setStoredToken = (token) => config.set('token', token);
|
|
10
|
+
export const clearStoredToken = () => config.delete('token');
|
|
11
|
+
export const getApiVersion = () => config.get('apiVersion') || 'v1';
|
|
12
|
+
export const setApiVersion = (version) => config.set('apiVersion', version);
|
|
13
|
+
export const getBaseUrl = () => {
|
|
14
|
+
const base = config.get('baseUrl') ||
|
|
15
|
+
process.env.EXECLAVE_BASE_URL ||
|
|
16
|
+
process.env.AGENTGUARD_BASE_URL ||
|
|
17
|
+
'http://localhost:4000';
|
|
18
|
+
const version = getApiVersion();
|
|
19
|
+
if (version && version !== 'v0') {
|
|
20
|
+
return `${base.replace(/\/+$/, '')}/api/${version}`;
|
|
21
|
+
}
|
|
22
|
+
return `${base.replace(/\/+$/, '')}/api`;
|
|
23
|
+
};
|
|
24
|
+
export const setBaseUrl = (url) => config.set('baseUrl', url);
|
|
25
|
+
export const getOrgId = () => config.get('organizationId');
|
|
26
|
+
export const setOrgId = (id) => config.set('organizationId', id);
|
|
27
|
+
export default config;
|
|
28
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AASxB,MAAM,MAAM,GAAG,IAAI,IAAI,CAAe;IAClC,WAAW,EAAE,cAAc;CAC9B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE,CAC/B,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC;IACnB,OAAO,CAAC,GAAG,CAAC,gBAAgB;IAC5B,OAAO,CAAC,GAAG,CAAC,kBAAkB;IAC9B,SAAS,CAAC;AACd,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAC5E,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAE7D,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,IAAI,CAAC;AACpE,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;AAEpF,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE;IAC3B,MAAM,IAAI,GACN,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC;QACrB,OAAO,CAAC,GAAG,CAAC,iBAAiB;QAC7B,OAAO,CAAC,GAAG,CAAC,mBAAmB;QAC/B,uBAAuB,CAAC;IAC5B,MAAM,OAAO,GAAG,aAAa,EAAE,CAAC;IAChC,IAAI,OAAO,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QAC9B,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,QAAQ,OAAO,EAAE,CAAC;IACxD,CAAC;IACD,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC;AAC7C,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;AAEtE,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;AAC3D,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;AAEzE,eAAe,MAAM,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@execlave/cli",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "CLI for the Execlave AI agent governance platform",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"execlave": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsc",
|
|
15
|
+
"dev": "ts-node src/index.ts",
|
|
16
|
+
"start": "node dist/index.js",
|
|
17
|
+
"test": "jest --config jest.config.cjs",
|
|
18
|
+
"prepublishOnly": "npm run build"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"execlave",
|
|
22
|
+
"ai",
|
|
23
|
+
"agent",
|
|
24
|
+
"governance",
|
|
25
|
+
"cli"
|
|
26
|
+
],
|
|
27
|
+
"author": "Execlave",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"axios": "^1.13.5",
|
|
31
|
+
"chalk": "^5.6.2",
|
|
32
|
+
"commander": "^14.0.3",
|
|
33
|
+
"conf": "^15.1.0",
|
|
34
|
+
"inquirer": "^13.3.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/chalk": "^0.4.31",
|
|
38
|
+
"@types/inquirer": "^9.0.9",
|
|
39
|
+
"@types/jest": "^29.5.14",
|
|
40
|
+
"@types/node": "^25.3.0",
|
|
41
|
+
"jest": "^29.7.0",
|
|
42
|
+
"ts-jest": "^29.2.0",
|
|
43
|
+
"ts-node": "^10.9.2",
|
|
44
|
+
"typescript": "^5.9.3"
|
|
45
|
+
},
|
|
46
|
+
"engines": {
|
|
47
|
+
"node": ">=18.0.0"
|
|
48
|
+
}
|
|
49
|
+
}
|