@agenticmail/enterprise 0.5.3 → 0.5.5

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-X6UVWFHW.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,16 +5,16 @@ var args = process.argv.slice(2);
5
5
  var command = args[0];
6
6
  switch (command) {
7
7
  case "validate":
8
- import("./cli-validate-WJBUOEGW.js").then((m) => m.runValidate(args.slice(1))).catch(fatal);
8
+ import("./cli-validate-QTV6662P.js").then((m) => m.runValidate(args.slice(1))).catch(fatal);
9
9
  break;
10
10
  case "build-skill":
11
- import("./cli-build-skill-XOYECCLE.js").then((m) => m.runBuildSkill(args.slice(1))).catch(fatal);
11
+ import("./cli-build-skill-AE7QC5C5.js").then((m) => m.runBuildSkill(args.slice(1))).catch(fatal);
12
12
  break;
13
13
  case "submit-skill":
14
- import("./cli-submit-skill-RSBLF5XN.js").then((m) => m.runSubmitSkill(args.slice(1))).catch(fatal);
14
+ import("./cli-submit-skill-LDFJGSKO.js").then((m) => m.runSubmitSkill(args.slice(1))).catch(fatal);
15
15
  break;
16
16
  case "recover":
17
- import("./cli-recover-X4MKJQVV.js").then((m) => m.runRecover(args.slice(1))).catch(fatal);
17
+ import("./cli-recover-5M74V7V4.js").then((m) => m.runRecover(args.slice(1))).catch(fatal);
18
18
  break;
19
19
  case "verify-domain":
20
20
  import("./cli-verify-YT7IADFX.js").then((m) => m.runVerifyDomain(args.slice(1))).catch(fatal);
@@ -35,20 +35,20 @@ Commands:
35
35
  verify-domain Check DNS verification for your domain
36
36
 
37
37
  Domain Registration:
38
- agenticmail-enterprise recover --domain agents.agenticmail.io --key <hex>
39
- agenticmail-enterprise verify-domain
40
- agenticmail-enterprise verify-domain --domain agents.agenticmail.io
38
+ npx @agenticmail/enterprise recover --domain agents.agenticmail.io --key <hex>
39
+ npx @agenticmail/enterprise verify-domain
40
+ npx @agenticmail/enterprise verify-domain --domain agents.agenticmail.io
41
41
 
42
42
  Skill Development:
43
- agenticmail-enterprise validate ./community-skills/github-issues/
44
- agenticmail-enterprise validate --all
45
- agenticmail-enterprise build-skill
46
- agenticmail-enterprise submit-skill ./community-skills/my-skill/
43
+ npx @agenticmail/enterprise validate ./community-skills/github-issues/
44
+ npx @agenticmail/enterprise validate --all
45
+ npx @agenticmail/enterprise build-skill
46
+ npx @agenticmail/enterprise submit-skill ./community-skills/my-skill/
47
47
  `);
48
48
  break;
49
49
  case "setup":
50
50
  default:
51
- import("./setup-5CVRQ5ES.js").then((m) => m.runSetupWizard()).catch(fatal);
51
+ import("./setup-HJ4PTUSA.js").then((m) => m.runSetupWizard()).catch(fatal);
52
52
  break;
53
53
  }
54
54
  function fatal(err) {
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@ import {
15
15
  import {
16
16
  provision,
17
17
  runSetupWizard
18
- } from "./chunk-PQADDAC2.js";
18
+ } from "./chunk-6CVIA5YL.js";
19
19
  import {
20
20
  ENGINE_TABLES,
21
21
  ENGINE_TABLES_POSTGRES,
@@ -6,7 +6,7 @@ import {
6
6
  promptRegistration,
7
7
  provision,
8
8
  runSetupWizard
9
- } from "./chunk-HAUHDCUB.js";
9
+ } from "./chunk-6CVIA5YL.js";
10
10
  import "./chunk-NTVN3JHS.js";
11
11
  import "./chunk-KFQGP6VL.js";
12
12
  export {
@@ -6,7 +6,7 @@ import {
6
6
  promptRegistration,
7
7
  provision,
8
8
  runSetupWizard
9
- } from "./chunk-PQADDAC2.js";
9
+ } from "./chunk-VRRCELRN.js";
10
10
  import "./chunk-NTVN3JHS.js";
11
11
  import "./chunk-KFQGP6VL.js";
12
12
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenticmail/enterprise",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
4
4
  "description": "AgenticMail Enterprise — cloud-hosted AI agent identity, email, auth & compliance for organizations",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli.ts CHANGED
@@ -12,12 +12,12 @@
12
12
  *
13
13
  * Usage:
14
14
  * npx @agenticmail/enterprise
15
- * agenticmail-enterprise validate ./community-skills/my-skill/
16
- * agenticmail-enterprise validate --all
17
- * agenticmail-enterprise build-skill
18
- * agenticmail-enterprise submit-skill ./community-skills/my-skill/
19
- * agenticmail-enterprise recover --domain agents.agenticmail.io
20
- * agenticmail-enterprise verify-domain
15
+ * npx @agenticmail/enterprise validate ./community-skills/my-skill/
16
+ * npx @agenticmail/enterprise validate --all
17
+ * npx @agenticmail/enterprise build-skill
18
+ * npx @agenticmail/enterprise submit-skill ./community-skills/my-skill/
19
+ * npx @agenticmail/enterprise recover --domain agents.agenticmail.io
20
+ * npx @agenticmail/enterprise verify-domain
21
21
  */
22
22
 
23
23
  const args = process.argv.slice(2);
@@ -60,15 +60,15 @@ Commands:
60
60
  verify-domain Check DNS verification for your domain
61
61
 
62
62
  Domain Registration:
63
- agenticmail-enterprise recover --domain agents.agenticmail.io --key <hex>
64
- agenticmail-enterprise verify-domain
65
- agenticmail-enterprise verify-domain --domain agents.agenticmail.io
63
+ npx @agenticmail/enterprise recover --domain agents.agenticmail.io --key <hex>
64
+ npx @agenticmail/enterprise verify-domain
65
+ npx @agenticmail/enterprise verify-domain --domain agents.agenticmail.io
66
66
 
67
67
  Skill Development:
68
- agenticmail-enterprise validate ./community-skills/github-issues/
69
- agenticmail-enterprise validate --all
70
- agenticmail-enterprise build-skill
71
- agenticmail-enterprise submit-skill ./community-skills/my-skill/
68
+ npx @agenticmail/enterprise validate ./community-skills/github-issues/
69
+ npx @agenticmail/enterprise validate --all
70
+ npx @agenticmail/enterprise build-skill
71
+ npx @agenticmail/enterprise submit-skill ./community-skills/my-skill/
72
72
  `);
73
73
  break;
74
74
 
@@ -5,9 +5,9 @@
5
5
  * Requires the original deployment key to prove ownership.
6
6
  *
7
7
  * Usage:
8
- * agenticmail-enterprise recover
9
- * agenticmail-enterprise recover --domain agents.agenticmail.io --key <hex>
10
- * agenticmail-enterprise recover --db ./data.db --db-type sqlite
8
+ * npx @agenticmail/enterprise recover
9
+ * npx @agenticmail/enterprise recover --domain agents.agenticmail.io --key <hex>
10
+ * npx @agenticmail/enterprise recover --db ./data.db --db-type sqlite
11
11
  */
12
12
 
13
13
  import { DomainLock } from './index.js';
@@ -119,6 +119,6 @@ export async function runRecover(args: string[]): Promise<void> {
119
119
  console.log(` ${chalk.bold('Type:')} ${chalk.cyan('TXT')}`);
120
120
  console.log(` ${chalk.bold('Value:')} ${chalk.cyan(result.dnsChallenge)}`);
121
121
  console.log('');
122
- console.log(chalk.dim(' Then run: agenticmail-enterprise verify-domain'));
122
+ console.log(chalk.dim(' Then run: npx @agenticmail/enterprise verify-domain'));
123
123
  console.log('');
124
124
  }
@@ -5,9 +5,9 @@
5
5
  * Asks the central registry to resolve the TXT record.
6
6
  *
7
7
  * Usage:
8
- * agenticmail-enterprise verify-domain
9
- * agenticmail-enterprise verify-domain --domain agents.agenticmail.io
10
- * agenticmail-enterprise verify-domain --db ./data.db
8
+ * npx @agenticmail/enterprise verify-domain
9
+ * npx @agenticmail/enterprise verify-domain --domain agents.agenticmail.io
10
+ * npx @agenticmail/enterprise verify-domain --db ./data.db
11
11
  */
12
12
 
13
13
  import { DomainLock } from './index.js';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * CLI: agenticmail-enterprise build-skill
2
+ * CLI: npx @agenticmail/enterprise build-skill
3
3
  *
4
4
  * Interactive AI-assisted skill scaffolding. Prompts for the target
5
5
  * application/service, generates a valid agenticmail-skill.json manifest,
@@ -162,7 +162,7 @@ export async function runBuildSkill(_args: string[]) {
162
162
  const { runSubmitSkill } = await import('./cli-submit-skill.js');
163
163
  await runSubmitSkill([outDir]);
164
164
  } else {
165
- console.log(chalk.dim('\n To submit later: agenticmail-enterprise submit-skill ' + answers.outputDir));
165
+ console.log(chalk.dim('\n To submit later: npx @agenticmail/enterprise submit-skill ' + answers.outputDir));
166
166
  }
167
167
  }
168
168
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * CLI: agenticmail-enterprise submit-skill <path>
2
+ * CLI: npx @agenticmail/enterprise submit-skill <path>
3
3
  *
4
4
  * Automates the GitHub PR submission flow for a community skill.
5
5
  * Uses the `gh` CLI to fork, branch, commit, push, and open a PR.
@@ -18,7 +18,7 @@ export async function runSubmitSkill(args: string[]) {
18
18
 
19
19
  const target = args.filter(a => !a.startsWith('--'))[0];
20
20
  if (!target) {
21
- console.log(`${chalk.bold('Usage:')} agenticmail-enterprise submit-skill <path-to-skill-dir>`);
21
+ console.log(`${chalk.bold('Usage:')} npx @agenticmail/enterprise submit-skill <path-to-skill-dir>`);
22
22
  process.exit(1);
23
23
  return;
24
24
  }
@@ -172,7 +172,7 @@ ${toolsList}
172
172
 
173
173
  ### Validation
174
174
 
175
- - [x] Manifest passes \`agenticmail-enterprise validate\`
175
+ - [x] Manifest passes \`npx @agenticmail/enterprise validate\`
176
176
  - [x] All required fields present
177
177
  - [x] No duplicate tool IDs
178
178
  ${manifest.tags ? `\n**Tags:** ${manifest.tags.join(', ')}` : ''}`;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * CLI: agenticmail-enterprise validate <path>
2
+ * CLI: npx @agenticmail/enterprise validate <path>
3
3
  *
4
4
  * Validates an agenticmail-skill.json manifest against the full spec.
5
5
  * Checks for duplicate tool IDs against the builtin catalog and
@@ -64,9 +64,9 @@ export async function runValidate(args: string[]) {
64
64
  const target = pathArgs[0];
65
65
  if (!target) {
66
66
  if (jsonMode) {
67
- console.log(JSON.stringify({ error: 'No path specified. Usage: agenticmail-enterprise validate <path> [--all] [--json]' }));
67
+ console.log(JSON.stringify({ error: 'No path specified. Usage: npx @agenticmail/enterprise validate <path> [--all] [--json]' }));
68
68
  } else {
69
- console.log(`${chalk.bold('Usage:')} agenticmail-enterprise validate <path>`);
69
+ console.log(`${chalk.bold('Usage:')} npx @agenticmail/enterprise validate <path>`);
70
70
  console.log('');
71
71
  console.log(' <path> Path to a skill directory or agenticmail-skill.json file');
72
72
  console.log(' --all Validate all skills in community-skills/');
@@ -14,6 +14,7 @@
14
14
  * → Provision (setup/provision.ts)
15
15
  */
16
16
 
17
+ import { execSync } from 'child_process';
17
18
  import { promptCompanyInfo } from './company.js';
18
19
  import { promptDatabase } from './database.js';
19
20
  import { promptDeployment } from './deployment.js';
@@ -34,6 +35,49 @@ export type { DomainSelection } from './domain.js';
34
35
  export type { RegistrationSelection } from './registration.js';
35
36
  export type { ProvisionConfig, ProvisionResult } from './provision.js';
36
37
 
38
+ // ─── DB Driver Requirements ──────────────────────
39
+
40
+ const DB_DRIVER_MAP: Record<string, string[]> = {
41
+ postgres: ['pg'],
42
+ supabase: ['pg'],
43
+ neon: ['pg'],
44
+ cockroachdb: ['pg'],
45
+ mysql: ['mysql2'],
46
+ planetscale: ['mysql2'],
47
+ mongodb: ['mongodb'],
48
+ sqlite: ['better-sqlite3'],
49
+ turso: ['@libsql/client'],
50
+ dynamodb: ['@aws-sdk/client-dynamodb', '@aws-sdk/lib-dynamodb'],
51
+ };
52
+
53
+ async function ensureDbDriver(dbType: string, ora: any, chalk: any): Promise<void> {
54
+ const packages = DB_DRIVER_MAP[dbType];
55
+ if (!packages?.length) return;
56
+
57
+ const missing: string[] = [];
58
+ for (const pkg of packages) {
59
+ try {
60
+ await import(pkg);
61
+ } catch {
62
+ missing.push(pkg);
63
+ }
64
+ }
65
+ if (!missing.length) return;
66
+
67
+ const spinner = ora(`Installing database driver: ${missing.join(', ')}...`).start();
68
+ try {
69
+ execSync(`npm install --no-save ${missing.join(' ')}`, {
70
+ stdio: 'pipe',
71
+ timeout: 120_000,
72
+ });
73
+ spinner.succeed(`Database driver installed: ${missing.join(', ')}`);
74
+ } catch (err: any) {
75
+ spinner.fail(`Failed to install ${missing.join(', ')}`);
76
+ console.error(chalk.red(`\n Run manually: npm install ${missing.join(' ')}\n`));
77
+ process.exit(1);
78
+ }
79
+ }
80
+
37
81
  /**
38
82
  * Run the full interactive setup wizard.
39
83
  * Returns when provisioning is complete (or the local server is running).
@@ -72,6 +116,9 @@ export async function runSetupWizard(): Promise<void> {
72
116
  company.adminEmail,
73
117
  );
74
118
 
119
+ // ─── Install DB driver if needed ───────────────
120
+ await ensureDbDriver(database.type, ora, chalk);
121
+
75
122
  // ─── Provision ───────────────────────────────────
76
123
  console.log('');
77
124
  console.log(chalk.dim(' ─────────────────────────────────────────'));
@@ -94,7 +94,7 @@ export async function promptRegistration(
94
94
  spinner.fail('Domain already registered');
95
95
  console.log('');
96
96
  console.log(chalk.yellow(' This domain is already registered and verified.'));
97
- console.log(chalk.dim(' If this is your domain, use: agenticmail-enterprise recover'));
97
+ console.log(chalk.dim(' If this is your domain, use: npx @agenticmail/enterprise recover'));
98
98
  console.log('');
99
99
 
100
100
  const { continueAnyway } = await inquirer.prompt([{
@@ -121,7 +121,7 @@ export async function promptRegistration(
121
121
  spinner.warn('Registry unavailable');
122
122
  console.log('');
123
123
  console.log(chalk.yellow(` Could not reach registry: ${err.message}`));
124
- console.log(chalk.dim(' You can register later with: agenticmail-enterprise verify-domain'));
124
+ console.log(chalk.dim(' You can register later with: npx @agenticmail/enterprise verify-domain'));
125
125
  console.log('');
126
126
 
127
127
  const { continueAnyway } = await inquirer.prompt([{
@@ -209,11 +209,11 @@ export async function promptRegistration(
209
209
  await new Promise(r => setTimeout(r, 10_000));
210
210
  } else {
211
211
  spinner.info('DNS record not found yet');
212
- console.log(chalk.dim(' Run later: agenticmail-enterprise verify-domain'));
212
+ console.log(chalk.dim(' Run later: npx @agenticmail/enterprise verify-domain'));
213
213
  }
214
214
  }
215
215
  } else {
216
- console.log(chalk.dim(' Run when ready: agenticmail-enterprise verify-domain'));
216
+ console.log(chalk.dim(' Run when ready: npx @agenticmail/enterprise verify-domain'));
217
217
  }
218
218
 
219
219
  console.log('');