@hazeljs/cli 2.0.0 → 2.0.2

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.
@@ -0,0 +1,170 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.registerGatekeeperCommand = registerGatekeeperCommand;
37
+ const fs = __importStar(require("fs"));
38
+ const path = __importStar(require("path"));
39
+ /**
40
+ * `hazel gatekeeper validate --config agent-gatekeeper.yaml`
41
+ * `hazel gatekeeper simulate --agent refund-agent --tool stripe.refund --input input.json`
42
+ * `hazel gatekeeper explain --invocation invocation.json`
43
+ */
44
+ function registerGatekeeperCommand(program) {
45
+ const gatekeeper = program
46
+ .command('gatekeeper')
47
+ .description('Agent Gatekeeper — validate, simulate, and explain tool authorization policies');
48
+ gatekeeper
49
+ .command('validate')
50
+ .description('Validate an agent-gatekeeper.yaml policy file')
51
+ .option('--config <file>', 'Policy config file', 'agent-gatekeeper.yaml')
52
+ .option('--json', 'Print raw JSON result')
53
+ .action(async (opts) => {
54
+ try {
55
+ const { loadPoliciesFromFileSync, validatePolicies } = await Promise.resolve().then(() => __importStar(require('@hazeljs/agent-gatekeeper')));
56
+ const abs = path.resolve(process.cwd(), opts.config ?? 'agent-gatekeeper.yaml');
57
+ const loaded = loadPoliciesFromFileSync(fs, abs);
58
+ validatePolicies(loaded.policies);
59
+ const result = {
60
+ valid: true,
61
+ config: abs,
62
+ policyCount: loaded.policies.length,
63
+ mode: loaded.mode,
64
+ defaultDecision: loaded.defaultDecision,
65
+ policies: loaded.policies.map((p) => ({
66
+ id: p.id,
67
+ version: p.version,
68
+ priority: p.priority,
69
+ })),
70
+ };
71
+ // eslint-disable-next-line no-console
72
+ console.log(opts.json ? JSON.stringify(result, null, 2) : JSON.stringify(result, null, 2));
73
+ }
74
+ catch (e) {
75
+ // eslint-disable-next-line no-console
76
+ console.error(e);
77
+ process.exitCode = 1;
78
+ }
79
+ });
80
+ gatekeeper
81
+ .command('simulate')
82
+ .description('Simulate gatekeeper decision for an invocation (never executes tools)')
83
+ .requiredOption('--agent <id>', 'Agent id')
84
+ .requiredOption('--tool <name>', 'Tool name')
85
+ .option('--input <file>', 'JSON input file')
86
+ .option('--environment <env>', 'Environment', 'development')
87
+ .option('--tenant <id>', 'Tenant id')
88
+ .option('--config <file>', 'Optional policy YAML file')
89
+ .option('--json', 'Print raw JSON')
90
+ .action(async (opts) => {
91
+ try {
92
+ const { AgentGatekeeper, loadPoliciesFromFileSync, defaultClock, defaultIdGenerator } = await Promise.resolve().then(() => __importStar(require('@hazeljs/agent-gatekeeper')));
93
+ let policies = [];
94
+ let mode = 'enforce';
95
+ let defaultDecision = 'deny';
96
+ if (opts.config) {
97
+ const abs = path.resolve(process.cwd(), opts.config);
98
+ const loaded = loadPoliciesFromFileSync(fs, abs);
99
+ policies = loaded.policies;
100
+ mode = loaded.mode ?? mode;
101
+ defaultDecision = loaded.defaultDecision ?? defaultDecision;
102
+ }
103
+ let input = {};
104
+ if (opts.input) {
105
+ const raw = fs.readFileSync(path.resolve(process.cwd(), opts.input), 'utf8');
106
+ input = JSON.parse(raw);
107
+ }
108
+ const gk = new AgentGatekeeper({
109
+ mode,
110
+ defaultDecision,
111
+ policies,
112
+ auditSink: { emit: () => undefined },
113
+ });
114
+ const context = {
115
+ invocationId: defaultIdGenerator()(),
116
+ runId: 'simulate-run',
117
+ agentId: opts.agent,
118
+ tenantId: opts.tenant,
119
+ toolName: opts.tool,
120
+ input,
121
+ environment: opts.environment ?? 'development',
122
+ timestamp: defaultClock().now(),
123
+ };
124
+ const simulation = await gk.simulate(context);
125
+ // eslint-disable-next-line no-console
126
+ console.log(JSON.stringify(simulation, null, 2));
127
+ }
128
+ catch (e) {
129
+ // eslint-disable-next-line no-console
130
+ console.error(e);
131
+ process.exitCode = 1;
132
+ }
133
+ });
134
+ gatekeeper
135
+ .command('explain')
136
+ .description('Explain gatekeeper decision from a saved invocation JSON file')
137
+ .argument('<file>', 'Invocation context JSON file')
138
+ .option('--config <file>', 'Optional policy YAML file')
139
+ .option('--json', 'Print raw JSON')
140
+ .action(async (file, opts) => {
141
+ try {
142
+ const { AgentGatekeeper, loadPoliciesFromFileSync, defaultClock } = await Promise.resolve().then(() => __importStar(require('@hazeljs/agent-gatekeeper')));
143
+ let policies = [];
144
+ if (opts.config) {
145
+ const abs = path.resolve(process.cwd(), opts.config);
146
+ policies = loadPoliciesFromFileSync(fs, abs).policies;
147
+ }
148
+ const raw = fs.readFileSync(path.resolve(process.cwd(), file), 'utf8');
149
+ const parsed = JSON.parse(raw);
150
+ const context = {
151
+ ...parsed,
152
+ timestamp: parsed.timestamp ? new Date(String(parsed.timestamp)) : defaultClock().now(),
153
+ };
154
+ const gk = new AgentGatekeeper({
155
+ mode: 'enforce',
156
+ defaultDecision: 'deny',
157
+ policies,
158
+ auditSink: { emit: () => undefined },
159
+ });
160
+ const simulation = await gk.simulate(context);
161
+ // eslint-disable-next-line no-console
162
+ console.log(JSON.stringify(simulation, null, 2));
163
+ }
164
+ catch (e) {
165
+ // eslint-disable-next-line no-console
166
+ console.error(e);
167
+ process.exitCode = 1;
168
+ }
169
+ });
170
+ }
@@ -0,0 +1,7 @@
1
+ import { Command } from 'commander';
2
+ /**
3
+ * `hazel store publish|install|list|remove|doctor` — local or hosted Agent OS package registry.
4
+ * Hosted (Cloud Team SKU): `--remote <url> --token <token>` or HAZEL_REGISTRY_URL / HAZEL_REGISTRY_TOKEN.
5
+ * `hazel install` aliases `hazel store install`.
6
+ */
7
+ export declare function registerStoreCommand(program: Command): void;
@@ -0,0 +1,203 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.registerStoreCommand = registerStoreCommand;
37
+ const fs = __importStar(require("fs"));
38
+ const path = __importStar(require("path"));
39
+ async function resolveRegistry(opts) {
40
+ const { createAgentPackageRegistry } = await Promise.resolve().then(() => __importStar(require('@hazeljs/agent')));
41
+ return createAgentPackageRegistry({
42
+ remote: opts.remote,
43
+ token: opts.token,
44
+ registryRoot: opts.registry,
45
+ });
46
+ }
47
+ function registryOptions(cmd) {
48
+ return cmd
49
+ .option('--registry <dir>', 'Local registry root (default: ~/.hazel/registry)')
50
+ .option('--remote <url>', 'Hosted registry base URL (Cloud Team SKU; env HAZEL_REGISTRY_URL)')
51
+ .option('--token <token>', 'Bearer token for hosted registry (env HAZEL_REGISTRY_TOKEN)');
52
+ }
53
+ async function publishAction(file, opts) {
54
+ const { loadMarketplacePackage } = await Promise.resolve().then(() => __importStar(require('@hazeljs/agent')));
55
+ const pkg = loadMarketplacePackage(path.resolve(process.cwd(), file));
56
+ const registry = await resolveRegistry(opts);
57
+ await registry.publish(pkg);
58
+ // eslint-disable-next-line no-console
59
+ console.log(JSON.stringify({
60
+ ok: true,
61
+ action: 'publish',
62
+ package: pkg.name,
63
+ version: pkg.version,
64
+ registry: registry.location,
65
+ kind: registry.kind,
66
+ }, null, 2));
67
+ }
68
+ async function installAction(spec, opts) {
69
+ const { loadMarketplacePackage, materializeAgentPackage, parsePackageSpec } = await Promise.resolve().then(() => __importStar(require('@hazeljs/agent')));
70
+ const projectRoot = path.resolve(process.cwd(), opts.cwd);
71
+ const resolvedPath = path.resolve(process.cwd(), spec);
72
+ const looksLikeFile = spec.includes(path.sep) ||
73
+ spec.includes('/') ||
74
+ spec.endsWith('.json') ||
75
+ fs.existsSync(resolvedPath);
76
+ let pkg;
77
+ if (looksLikeFile && fs.existsSync(resolvedPath) && fs.statSync(resolvedPath).isFile()) {
78
+ pkg = loadMarketplacePackage(resolvedPath);
79
+ }
80
+ else {
81
+ const { name, version } = parsePackageSpec(spec);
82
+ const registry = await resolveRegistry(opts);
83
+ pkg = await registry.get(name, version);
84
+ }
85
+ const result = materializeAgentPackage(pkg, projectRoot);
86
+ // eslint-disable-next-line no-console
87
+ console.log(JSON.stringify({
88
+ ok: true,
89
+ action: 'install',
90
+ package: result.packageName,
91
+ version: result.version,
92
+ path: result.packagePath,
93
+ lock: result.lockPath,
94
+ note: 'Use hazel agent run with the materialized package DNA, or runtime.installAgentPackage for hot-reload',
95
+ }, null, 2));
96
+ }
97
+ /**
98
+ * `hazel store publish|install|list|remove|doctor` — local or hosted Agent OS package registry.
99
+ * Hosted (Cloud Team SKU): `--remote <url> --token <token>` or HAZEL_REGISTRY_URL / HAZEL_REGISTRY_TOKEN.
100
+ * `hazel install` aliases `hazel store install`.
101
+ */
102
+ function registerStoreCommand(program) {
103
+ const store = program
104
+ .command('store')
105
+ .description('Agent OS package registry — local filesystem or hosted (--remote) Cloud Team registry');
106
+ registryOptions(store
107
+ .command('publish')
108
+ .description('Publish a marketplace / DNA JSON package to the registry')
109
+ .argument('<file>', 'Path to .dna.json or marketplace package JSON')).action(async (file, opts) => {
110
+ try {
111
+ await publishAction(file, opts);
112
+ }
113
+ catch (e) {
114
+ // eslint-disable-next-line no-console
115
+ console.error(e instanceof Error ? e.message : e);
116
+ process.exitCode = 1;
117
+ }
118
+ });
119
+ registryOptions(store
120
+ .command('install')
121
+ .description('Install a package into the project (.hazel/agents). Spec: path, name, or name@version')
122
+ .argument('<spec>', 'File path or package name[@version]')
123
+ .option('--cwd <dir>', 'Project root', '.')).action(async (spec, opts) => {
124
+ try {
125
+ await installAction(spec, opts);
126
+ }
127
+ catch (e) {
128
+ // eslint-disable-next-line no-console
129
+ console.error(e instanceof Error ? e.message : e);
130
+ process.exitCode = 1;
131
+ }
132
+ });
133
+ registryOptions(store
134
+ .command('list')
135
+ .description('List packages in the registry')
136
+ .argument('[query]', 'Optional name/description filter')).action(async (query, opts) => {
137
+ try {
138
+ const registry = await resolveRegistry(opts);
139
+ const packages = await registry.list(query);
140
+ // eslint-disable-next-line no-console
141
+ console.log(JSON.stringify({ ok: true, kind: registry.kind, registry: registry.location, packages }, null, 2));
142
+ }
143
+ catch (e) {
144
+ // eslint-disable-next-line no-console
145
+ console.error(e instanceof Error ? e.message : e);
146
+ process.exitCode = 1;
147
+ }
148
+ });
149
+ registryOptions(store
150
+ .command('remove')
151
+ .description('Remove a package (or one version) from the registry')
152
+ .argument('<spec>', 'name or name@version')).action(async (spec, opts) => {
153
+ try {
154
+ const { parsePackageSpec } = await Promise.resolve().then(() => __importStar(require('@hazeljs/agent')));
155
+ const { name, version } = parsePackageSpec(spec);
156
+ const registry = await resolveRegistry(opts);
157
+ await registry.remove(name, version);
158
+ // eslint-disable-next-line no-console
159
+ console.log(JSON.stringify({
160
+ ok: true,
161
+ action: 'remove',
162
+ name,
163
+ version: version ?? '*',
164
+ kind: registry.kind,
165
+ registry: registry.location,
166
+ }, null, 2));
167
+ }
168
+ catch (e) {
169
+ // eslint-disable-next-line no-console
170
+ console.error(e instanceof Error ? e.message : e);
171
+ process.exitCode = 1;
172
+ }
173
+ });
174
+ registryOptions(store.command('doctor').description('Check registry health (local or remote)')).action(async (opts) => {
175
+ try {
176
+ const registry = await resolveRegistry(opts);
177
+ const report = await registry.doctor();
178
+ // eslint-disable-next-line no-console
179
+ console.log(JSON.stringify({ ...report, kind: registry.kind, registry: registry.location }, null, 2));
180
+ if (!report.ok)
181
+ process.exitCode = 1;
182
+ }
183
+ catch (e) {
184
+ // eslint-disable-next-line no-console
185
+ console.error(e instanceof Error ? e.message : e);
186
+ process.exitCode = 1;
187
+ }
188
+ });
189
+ registryOptions(program
190
+ .command('install')
191
+ .description('Alias for hazel store install')
192
+ .argument('<spec>', 'File path or package name[@version]')
193
+ .option('--cwd <dir>', 'Project root', '.')).action(async (spec, opts) => {
194
+ try {
195
+ await installAction(spec, opts);
196
+ }
197
+ catch (e) {
198
+ // eslint-disable-next-line no-console
199
+ console.error(e instanceof Error ? e.message : e);
200
+ process.exitCode = 1;
201
+ }
202
+ });
203
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ const commander_1 = require("commander");
37
+ const fs = __importStar(require("fs"));
38
+ const os = __importStar(require("os"));
39
+ const path = __importStar(require("path"));
40
+ const store_1 = require("./store");
41
+ describe('registerStoreCommand (G2 Package+Store)', () => {
42
+ it('registers store subcommands and install alias', () => {
43
+ const program = new commander_1.Command();
44
+ (0, store_1.registerStoreCommand)(program);
45
+ const store = program.commands.find((c) => c.name() === 'store');
46
+ expect(store).toBeDefined();
47
+ const names = store.commands.map((c) => c.name());
48
+ expect(names).toEqual(expect.arrayContaining(['publish', 'install', 'list', 'remove', 'doctor']));
49
+ expect(program.commands.some((c) => c.name() === 'install')).toBe(true);
50
+ });
51
+ it('publish then install materializes support-desk style package', async () => {
52
+ const { exportAgentDna, toMarketplacePackage, saveMarketplacePackage } = await Promise.resolve().then(() => __importStar(require('@hazeljs/agent')));
53
+ const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'hazel-store-cli-'));
54
+ const registryDir = path.join(tmp, 'registry');
55
+ const projectDir = path.join(tmp, 'project');
56
+ fs.mkdirSync(projectDir);
57
+ const dna = exportAgentDna({
58
+ name: 'support-desk',
59
+ version: '1.0.0',
60
+ tools: [{ name: 'lookupOrder' }],
61
+ });
62
+ const pkg = toMarketplacePackage(dna);
63
+ pkg.name = '@hazeljs/support-desk-agent';
64
+ const pkgFile = path.join(tmp, 'support-desk.marketplace.json');
65
+ saveMarketplacePackage(pkg, pkgFile);
66
+ const program = new commander_1.Command();
67
+ (0, store_1.registerStoreCommand)(program);
68
+ await program.parseAsync(['store', 'publish', pkgFile, '--registry', registryDir], {
69
+ from: 'user',
70
+ });
71
+ expect(process.exitCode ?? 0).toBe(0);
72
+ await program.parseAsync([
73
+ 'store',
74
+ 'install',
75
+ '@hazeljs/support-desk-agent@1.0.0',
76
+ '--cwd',
77
+ projectDir,
78
+ '--registry',
79
+ registryDir,
80
+ ], { from: 'user' });
81
+ expect(process.exitCode ?? 0).toBe(0);
82
+ const lockPath = path.join(projectDir, '.hazel', 'agents', 'lock.json');
83
+ expect(fs.existsSync(lockPath)).toBe(true);
84
+ const lock = JSON.parse(fs.readFileSync(lockPath, 'utf8'));
85
+ expect(lock['@hazeljs/support-desk-agent']?.version).toBe('1.0.0');
86
+ fs.rmSync(tmp, { recursive: true, force: true });
87
+ });
88
+ it('publishes and installs real starter support-desk.marketplace.json', async () => {
89
+ // Fixture is vendored in-package so CI (hazeljs repo only) does not need sibling starters.
90
+ const pkgFile = path.resolve(__dirname, '../../fixtures/support-desk.marketplace.json');
91
+ expect(fs.existsSync(pkgFile)).toBe(true);
92
+ const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'hazel-store-starter-'));
93
+ const registryDir = path.join(tmp, 'registry');
94
+ const projectDir = path.join(tmp, 'project');
95
+ fs.mkdirSync(projectDir);
96
+ const program = new commander_1.Command();
97
+ (0, store_1.registerStoreCommand)(program);
98
+ process.exitCode = 0;
99
+ await program.parseAsync(['store', 'publish', pkgFile, '--registry', registryDir], {
100
+ from: 'user',
101
+ });
102
+ expect(process.exitCode ?? 0).toBe(0);
103
+ await program.parseAsync([
104
+ 'store',
105
+ 'install',
106
+ '@hazeljs/support-desk-agent',
107
+ '--cwd',
108
+ projectDir,
109
+ '--registry',
110
+ registryDir,
111
+ ], { from: 'user' });
112
+ expect(process.exitCode ?? 0).toBe(0);
113
+ const packageJson = path.join(projectDir, '.hazel', 'agents', 'hazeljs__support-desk-agent', 'package.json');
114
+ expect(fs.existsSync(packageJson)).toBe(true);
115
+ const loaded = JSON.parse(fs.readFileSync(packageJson, 'utf8'));
116
+ expect(loaded.name).toBe('@hazeljs/support-desk-agent');
117
+ expect(loaded.dna.name).toBe('support-desk');
118
+ fs.rmSync(tmp, { recursive: true, force: true });
119
+ });
120
+ });
package/dist/index.js CHANGED
@@ -57,6 +57,8 @@ const eval_1 = require("./commands/eval");
57
57
  const benchmark_1 = require("./commands/benchmark");
58
58
  const agent_1 = require("./commands/agent");
59
59
  const skillgate_1 = require("./commands/skillgate");
60
+ const gatekeeper_1 = require("./commands/gatekeeper");
61
+ const store_1 = require("./commands/store");
60
62
  // Read version from package.json to ensure consistency
61
63
  const packageJson = JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(__dirname, '../package.json'), 'utf8'));
62
64
  const program = new commander_1.Command();
@@ -73,6 +75,8 @@ program
73
75
  (0, benchmark_1.registerBenchmarkCommand)(program);
74
76
  (0, agent_1.registerAgentCommand)(program);
75
77
  (0, skillgate_1.registerSkillgateCommand)(program);
78
+ (0, gatekeeper_1.registerGatekeeperCommand)(program);
79
+ (0, store_1.registerStoreCommand)(program);
76
80
  // Generate command group (unified: hazel g <type> <name> [--path] [--dry-run] [--json], or hazel g --list)
77
81
  const generateCommand = program
78
82
  .command('generate')
@@ -252,7 +252,23 @@ const gate = Skillgate.fromOpenApi(openApiSpec, {
252
252
  invoke: { baseUrl: process.env.API_BASE_URL || 'http://127.0.0.1:3000' },
253
253
  });
254
254
  const registry = new ToolRegistry();
255
- gate.register(registry, 'api-concierge');
255
+ gate.register(registry, 'api-concierge');
256
+ `,
257
+ },
258
+ {
259
+ shortName: 'agent-gatekeeper',
260
+ npm: '@hazeljs/agent-gatekeeper',
261
+ label: 'Agent Gatekeeper - tool authorization (@hazeljs/agent-gatekeeper)',
262
+ hint: 'import { AgentGatekeeper } from "@hazeljs/agent-gatekeeper";\n // new AgentGatekeeper({ mode: "enforce", defaultDecision: "deny", policies })',
263
+ moduleImport: null,
264
+ moduleExpression: null,
265
+ setupTemplate: `import { AgentGatekeeper } from '@hazeljs/agent-gatekeeper';
266
+
267
+ export const gatekeeper = new AgentGatekeeper({
268
+ mode: 'enforce',
269
+ defaultDecision: 'deny',
270
+ policies: [],
271
+ });
256
272
  `,
257
273
  },
258
274
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hazeljs/cli",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "Command-line interface for scaffolding and generating HazelJS applications and components",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -31,10 +31,11 @@
31
31
  "mustache": "^4.2.0"
32
32
  },
33
33
  "peerDependencies": {
34
- "@hazeljs/eval": "^2.0.0",
35
- "@hazeljs/benchmark": "^2.0.0",
36
- "@hazeljs/agent": "^2.0.0",
37
- "@hazeljs/skillgate": "^2.0.0"
34
+ "@hazeljs/eval": "^2.0.2",
35
+ "@hazeljs/benchmark": "^2.0.2",
36
+ "@hazeljs/agent": "^2.0.2",
37
+ "@hazeljs/skillgate": "^2.0.2",
38
+ "@hazeljs/agent-gatekeeper": "^2.0.2"
38
39
  },
39
40
  "peerDependenciesMeta": {
40
41
  "@hazeljs/eval": {
@@ -48,23 +49,19 @@
48
49
  },
49
50
  "@hazeljs/skillgate": {
50
51
  "optional": true
52
+ },
53
+ "@hazeljs/agent-gatekeeper": {
54
+ "optional": true
51
55
  }
52
56
  },
53
57
  "devDependencies": {
54
- "@hazeljs/eval": "^2.0.0",
55
- "@hazeljs/benchmark": "^2.0.0",
56
- "@hazeljs/agent": "^2.0.0",
57
- "@hazeljs/skillgate": "^2.0.0",
58
- "@types/inquirer": "^8.2.12",
59
- "@types/jest": "^29.5.14",
60
- "@types/mustache": "^4.2.6",
61
- "@types/node": "^20.19.39",
62
- "@typescript-eslint/eslint-plugin": "^8.58.0",
63
- "@typescript-eslint/parser": "^8.58.0",
64
- "eslint": "^8.57.1",
65
- "jest": "^29.7.0",
66
- "prettier": "^3.8.1",
67
- "ts-jest": "^29.4.9",
58
+ "@hazeljs/eval": "^2.0.2",
59
+ "@hazeljs/benchmark": "^2.0.2",
60
+ "@hazeljs/agent": "^2.0.2",
61
+ "@hazeljs/skillgate": "^2.0.2",
62
+ "@hazeljs/agent-gatekeeper": "^2.0.2",
63
+ "@types/inquirer": "^8.2.10",
64
+ "@types/mustache": "^4.2.5",
68
65
  "typescript": "^5.9.3"
69
66
  },
70
67
  "engines": {