@agenticmail/enterprise 0.5.47 → 0.5.49

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,148 @@
1
+ import {
2
+ ALL_TOOLS,
3
+ init_tool_catalog
4
+ } from "./chunk-MINPSFLF.js";
5
+ import {
6
+ collectCommunityToolIds,
7
+ validateSkillManifest
8
+ } from "./chunk-TY7NVD4U.js";
9
+ import "./chunk-KFQGP6VL.js";
10
+
11
+ // src/engine/cli-validate.ts
12
+ init_tool_catalog();
13
+ async function runValidate(args) {
14
+ const chalk = (await import("chalk")).default;
15
+ const fs = await import("fs/promises");
16
+ const path = await import("path");
17
+ const jsonMode = args.includes("--json");
18
+ const allMode = args.includes("--all");
19
+ const pathArgs = args.filter((a) => !a.startsWith("--"));
20
+ const builtinIds = new Set(ALL_TOOLS.map((t) => t.id));
21
+ const communityDir = path.resolve(process.cwd(), "community-skills");
22
+ const reports = [];
23
+ if (allMode) {
24
+ let entries;
25
+ try {
26
+ entries = await fs.readdir(communityDir, { withFileTypes: true });
27
+ } catch {
28
+ if (jsonMode) {
29
+ console.log(JSON.stringify({ error: "community-skills/ directory not found" }));
30
+ } else {
31
+ console.error(chalk.red("Error: community-skills/ directory not found"));
32
+ }
33
+ process.exit(1);
34
+ return;
35
+ }
36
+ for (const entry of entries) {
37
+ if (!entry.isDirectory() || entry.name.startsWith("_") || entry.name.startsWith(".")) continue;
38
+ const skillDir = path.join(communityDir, entry.name);
39
+ const report = await validatePath(skillDir, builtinIds, communityDir);
40
+ reports.push(report);
41
+ }
42
+ } else {
43
+ const target = pathArgs[0];
44
+ if (!target) {
45
+ if (jsonMode) {
46
+ console.log(JSON.stringify({ error: "No path specified. Usage: npx @agenticmail/enterprise validate <path> [--all] [--json]" }));
47
+ } else {
48
+ console.log(`${chalk.bold("Usage:")} npx @agenticmail/enterprise validate <path>`);
49
+ console.log("");
50
+ console.log(" <path> Path to a skill directory or agenticmail-skill.json file");
51
+ console.log(" --all Validate all skills in community-skills/");
52
+ console.log(" --json Machine-readable JSON output");
53
+ }
54
+ process.exit(1);
55
+ return;
56
+ }
57
+ const report = await validatePath(path.resolve(target), builtinIds, communityDir);
58
+ reports.push(report);
59
+ }
60
+ if (jsonMode) {
61
+ console.log(JSON.stringify({ results: reports, totalErrors: reports.reduce((s, r) => s + r.errors.length, 0) }, null, 2));
62
+ } else {
63
+ console.log("");
64
+ for (const report of reports) {
65
+ if (report.valid) {
66
+ console.log(chalk.green(" \u2714") + " " + chalk.bold(report.skillId) + chalk.dim(` (${report.path})`));
67
+ } else {
68
+ console.log(chalk.red(" \u2718") + " " + chalk.bold(report.skillId) + chalk.dim(` (${report.path})`));
69
+ for (const err of report.errors) {
70
+ console.log(chalk.red(" \u2502 ") + err);
71
+ }
72
+ }
73
+ for (const warn of report.warnings) {
74
+ console.log(chalk.yellow(" \u26A0 ") + warn);
75
+ }
76
+ }
77
+ console.log("");
78
+ const passed = reports.filter((r) => r.valid).length;
79
+ const failed = reports.filter((r) => !r.valid).length;
80
+ if (failed > 0) {
81
+ console.log(chalk.red(` ${failed} failed`) + chalk.dim(`, ${passed} passed, ${reports.length} total`));
82
+ } else {
83
+ console.log(chalk.green(` ${passed} passed`) + chalk.dim(`, ${reports.length} total`));
84
+ }
85
+ console.log("");
86
+ }
87
+ if (reports.some((r) => !r.valid)) {
88
+ process.exit(1);
89
+ }
90
+ }
91
+ async function validatePath(targetPath, builtinIds, communityDir) {
92
+ const fs = await import("fs/promises");
93
+ const path = await import("path");
94
+ let manifestPath;
95
+ try {
96
+ const stat = await fs.stat(targetPath);
97
+ if (stat.isDirectory()) {
98
+ manifestPath = path.join(targetPath, "agenticmail-skill.json");
99
+ } else {
100
+ manifestPath = targetPath;
101
+ }
102
+ } catch {
103
+ return {
104
+ path: targetPath,
105
+ skillId: path.basename(targetPath),
106
+ valid: false,
107
+ errors: [`Path not found: ${targetPath}`],
108
+ warnings: []
109
+ };
110
+ }
111
+ let raw;
112
+ try {
113
+ raw = await fs.readFile(manifestPath, "utf-8");
114
+ } catch {
115
+ return {
116
+ path: manifestPath,
117
+ skillId: path.basename(path.dirname(manifestPath)),
118
+ valid: false,
119
+ errors: [`Cannot read: ${manifestPath}`],
120
+ warnings: []
121
+ };
122
+ }
123
+ let manifest;
124
+ try {
125
+ manifest = JSON.parse(raw);
126
+ } catch (err) {
127
+ return {
128
+ path: manifestPath,
129
+ skillId: path.basename(path.dirname(manifestPath)),
130
+ valid: false,
131
+ errors: [`Invalid JSON: ${err.message}`],
132
+ warnings: []
133
+ };
134
+ }
135
+ const communityIds = await collectCommunityToolIds(communityDir, manifest.id);
136
+ const allExistingIds = /* @__PURE__ */ new Set([...builtinIds, ...communityIds]);
137
+ const result = validateSkillManifest(manifest, { existingToolIds: allExistingIds });
138
+ return {
139
+ path: manifestPath,
140
+ skillId: manifest.id || path.basename(path.dirname(manifestPath)),
141
+ valid: result.valid,
142
+ errors: result.errors,
143
+ warnings: result.warnings
144
+ };
145
+ }
146
+ export {
147
+ runValidate
148
+ };
package/dist/cli.js CHANGED
@@ -5,7 +5,7 @@ var args = process.argv.slice(2);
5
5
  var command = args[0];
6
6
  switch (command) {
7
7
  case "validate":
8
- import("./cli-validate-QTV6662P.js").then((m) => m.runValidate(args.slice(1))).catch(fatal);
8
+ import("./cli-validate-QVUQDNGI.js").then((m) => m.runValidate(args.slice(1))).catch(fatal);
9
9
  break;
10
10
  case "build-skill":
11
11
  import("./cli-build-skill-AE7QC5C5.js").then((m) => m.runBuildSkill(args.slice(1))).catch(fatal);
@@ -48,7 +48,7 @@ Skill Development:
48
48
  break;
49
49
  case "setup":
50
50
  default:
51
- import("./setup-N3RQCS32.js").then((m) => m.runSetupWizard()).catch(fatal);
51
+ import("./setup-SIJZ4MNG.js").then((m) => m.runSetupWizard()).catch(fatal);
52
52
  break;
53
53
  }
54
54
  function fatal(err) {
package/dist/index.js CHANGED
@@ -20,7 +20,7 @@ import {
20
20
  TenantManager,
21
21
  WorkforceManager,
22
22
  init_guardrails
23
- } from "./chunk-MZ3C426R.js";
23
+ } from "./chunk-263FEFGL.js";
24
24
  import {
25
25
  AgentRuntime,
26
26
  EmailChannel,
@@ -35,7 +35,7 @@ import {
35
35
  executeTool,
36
36
  runAgentLoop,
37
37
  toolsToDefinitions
38
- } from "./chunk-TW2L3Z62.js";
38
+ } from "./chunk-6T5PE7NL.js";
39
39
  import "./chunk-TYW5XTOW.js";
40
40
  import {
41
41
  ValidationError,
@@ -50,11 +50,11 @@ import {
50
50
  requireRole,
51
51
  securityHeaders,
52
52
  validate
53
- } from "./chunk-VOMXULTW.js";
53
+ } from "./chunk-JFXH5PXO.js";
54
54
  import {
55
55
  provision,
56
56
  runSetupWizard
57
- } from "./chunk-HKBAC2CE.js";
57
+ } from "./chunk-R3JR6Z3H.js";
58
58
  import {
59
59
  ENGINE_TABLES,
60
60
  ENGINE_TABLES_POSTGRES,
@@ -92,7 +92,7 @@ import {
92
92
  BUILTIN_SKILLS,
93
93
  PRESET_PROFILES,
94
94
  PermissionEngine
95
- } from "./chunk-LKAFZ343.js";
95
+ } from "./chunk-NUG7SMVQ.js";
96
96
  import {
97
97
  DatabaseAdapter
98
98
  } from "./chunk-FLRYMSKY.js";
@@ -108,7 +108,7 @@ import {
108
108
  generateToolPolicy,
109
109
  getToolsBySkill,
110
110
  init_tool_catalog
111
- } from "./chunk-X6UVWFHW.js";
111
+ } from "./chunk-MINPSFLF.js";
112
112
  import {
113
113
  VALID_CATEGORIES,
114
114
  VALID_RISK_LEVELS,