kaven-cli 0.4.0 → 0.4.1-alpha.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/dist/EnvManager-GQMEZ6NV.js +158 -0
- package/dist/MarketplaceClient-IJGRQRC4.js +7 -0
- package/dist/chunk-3RG5ZIWI.js +10 -0
- package/dist/chunk-GHZX5OAA.js +455 -0
- package/dist/commands/aiox/index.js +20 -0
- package/dist/commands/config/features.js +110 -975
- package/dist/commands/init/aiox-bootstrap.js +83 -0
- package/dist/commands/init/index.js +16 -3
- package/dist/commands/module/activate.js +84 -45
- package/dist/commands/module/list.js +51 -0
- package/dist/core/ProjectInitializer.js +17 -0
- package/dist/core/SchemaActivator.js +8 -0
- package/dist/index.js +20 -4
- package/dist/infrastructure/MarketplaceClient.js +26 -0
- package/dist/lib/capabilities-catalog.js +73 -0
- package/dist/lib/module-registry.js +47 -0
- package/dist/lib/schema-modifier.js +40 -0
- package/dist/tier-table-LAL6PAVW.js +52 -0
- package/package.json +2 -1
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TIER_DEFAULTS = exports.ALL_CAPABILITIES = void 0;
|
|
4
|
+
exports.ALL_CAPABILITIES = [
|
|
5
|
+
// --- AUTH ---
|
|
6
|
+
{ key: "FEATURE_EMAIL_VERIFICATION", type: "boolean", description: "Email verification on signup", category: "Auth", defaultValue: "true" },
|
|
7
|
+
{ key: "FEATURE_2FA_TOTP", type: "boolean", description: "Two-factor authentication via TOTP", category: "Auth", defaultValue: "false" },
|
|
8
|
+
{ key: "FEATURE_SSO_SAML", type: "boolean", description: "Single Sign-On via SAML/OIDC", category: "Auth", defaultValue: "false" },
|
|
9
|
+
{ key: "FEATURE_SOCIAL_LOGIN", type: "boolean", description: "Login via Google, GitHub, etc.", category: "Auth", defaultValue: "true" },
|
|
10
|
+
{ key: "FEATURE_MAGIC_LINK", type: "boolean", description: "Passwordless login via email", category: "Auth", defaultValue: "false" },
|
|
11
|
+
// --- TENANCY ---
|
|
12
|
+
{ key: "FEATURE_CUSTOM_DOMAIN", type: "boolean", description: "Custom domain per tenant", category: "Tenancy", defaultValue: "false" },
|
|
13
|
+
{ key: "FEATURE_WHITE_LABEL", type: "boolean", description: "Remove Kaven branding", category: "Tenancy", defaultValue: "false" },
|
|
14
|
+
{ key: "FEATURE_MULTI_BUSINESS", type: "boolean", description: "Multiple businesses per user", category: "Tenancy", defaultValue: "false" },
|
|
15
|
+
{ key: "FEATURE_AGENCY_HUB", type: "boolean", description: "Agency management dashboard", category: "Tenancy", defaultValue: "false" },
|
|
16
|
+
{ key: "FEATURE_TENANT_THEMES", type: "boolean", description: "Custom themes for tenants", category: "Tenancy", defaultValue: "true" },
|
|
17
|
+
// --- BILLING ---
|
|
18
|
+
{ key: "FEATURE_SUBSCRIPTIONS", type: "boolean", description: "Subscription management", category: "Billing", defaultValue: "true" },
|
|
19
|
+
{ key: "FEATURE_INVOICING", type: "boolean", description: "Automatic invoicing", category: "Billing", defaultValue: "true" },
|
|
20
|
+
{ key: "FEATURE_USAGE_BILLING", type: "boolean", description: "Metered usage billing", category: "Billing", defaultValue: "false" },
|
|
21
|
+
{ key: "FEATURE_PADDLE_CHECKOUT", type: "boolean", description: "Paddle payment integration", category: "Billing", defaultValue: "true" },
|
|
22
|
+
{ key: "FEATURE_PAGUBIT_PIX", type: "boolean", description: "Pix payment support", category: "Billing", defaultValue: "false" },
|
|
23
|
+
// --- API ---
|
|
24
|
+
{ key: "FEATURE_API_ACCESS", type: "boolean", description: "External API access", category: "API", defaultValue: "false" },
|
|
25
|
+
{ key: "FEATURE_WEBHOOKS", type: "boolean", description: "Outgoing webhooks", category: "API", defaultValue: "false" },
|
|
26
|
+
{ key: "FEATURE_MARKETPLACE_ACCESS", type: "boolean", description: "Kaven Marketplace access", category: "API", defaultValue: "true" },
|
|
27
|
+
{ key: "MAX_API_CALLS_MONTH", type: "numeric", description: "Maximum API calls per month", category: "API", defaultValue: "10000" },
|
|
28
|
+
{ key: "MAX_AGENT_API_CALLS_HOUR", type: "numeric", description: "Maximum agent calls per hour", category: "API", defaultValue: "100" },
|
|
29
|
+
// --- LIMITS ---
|
|
30
|
+
{ key: "MAX_TEAM_MEMBERS", type: "numeric", description: "Maximum team members per tenant", category: "Limits", defaultValue: "5" },
|
|
31
|
+
{ key: "MAX_PROJECTS", type: "numeric", description: "Maximum projects per tenant", category: "Limits", defaultValue: "3" },
|
|
32
|
+
{ key: "MAX_STORAGE_GB", type: "numeric", description: "Maximum storage in GB", category: "Limits", defaultValue: "1" },
|
|
33
|
+
{ key: "MAX_TENANTS", type: "numeric", description: "Maximum sub-tenants", category: "Limits", defaultValue: "1" },
|
|
34
|
+
// --- SUPPORT ---
|
|
35
|
+
{ key: "FEATURE_PRIORITY_SUPPORT", type: "boolean", description: "Priority support queue", category: "Support", defaultValue: "false" },
|
|
36
|
+
{ key: "FEATURE_AUDIT_COMPLIANCE", type: "boolean", description: "Audit logs and compliance", category: "Support", defaultValue: "false" },
|
|
37
|
+
{ key: "FEATURE_DATA_EXPORT", type: "boolean", description: "Customer data export", category: "Support", defaultValue: "true" },
|
|
38
|
+
];
|
|
39
|
+
exports.TIER_DEFAULTS = {
|
|
40
|
+
starter: {
|
|
41
|
+
FEATURE_EMAIL_VERIFICATION: true,
|
|
42
|
+
FEATURE_SOCIAL_LOGIN: true,
|
|
43
|
+
FEATURE_MARKETPLACE_ACCESS: true,
|
|
44
|
+
MAX_TEAM_MEMBERS: "5",
|
|
45
|
+
MAX_PROJECTS: "3",
|
|
46
|
+
MAX_API_CALLS_MONTH: "10000",
|
|
47
|
+
MAX_AGENT_API_CALLS_HOUR: "100",
|
|
48
|
+
},
|
|
49
|
+
complete: {
|
|
50
|
+
FEATURE_EMAIL_VERIFICATION: true,
|
|
51
|
+
FEATURE_SOCIAL_LOGIN: true,
|
|
52
|
+
FEATURE_CUSTOM_DOMAIN: true,
|
|
53
|
+
FEATURE_API_ACCESS: true,
|
|
54
|
+
FEATURE_MARKETPLACE_ACCESS: true,
|
|
55
|
+
MAX_TEAM_MEMBERS: "25",
|
|
56
|
+
MAX_PROJECTS: "20",
|
|
57
|
+
MAX_API_CALLS_MONTH: "100000",
|
|
58
|
+
MAX_AGENT_API_CALLS_HOUR: "500",
|
|
59
|
+
},
|
|
60
|
+
pro: {
|
|
61
|
+
FEATURE_EMAIL_VERIFICATION: true,
|
|
62
|
+
FEATURE_SOCIAL_LOGIN: true,
|
|
63
|
+
FEATURE_CUSTOM_DOMAIN: true,
|
|
64
|
+
FEATURE_WHITE_LABEL: true,
|
|
65
|
+
FEATURE_API_ACCESS: true,
|
|
66
|
+
FEATURE_MARKETPLACE_ACCESS: true,
|
|
67
|
+
MAX_TEAM_MEMBERS: "100",
|
|
68
|
+
MAX_PROJECTS: "100",
|
|
69
|
+
MAX_API_CALLS_MONTH: "1000000",
|
|
70
|
+
MAX_AGENT_API_CALLS_HOUR: "2000",
|
|
71
|
+
},
|
|
72
|
+
enterprise: {}
|
|
73
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MODULE_REGISTRY = void 0;
|
|
4
|
+
exports.MODULE_REGISTRY = [
|
|
5
|
+
{
|
|
6
|
+
id: "core",
|
|
7
|
+
name: "Core",
|
|
8
|
+
description: "Base models — always active, cannot be deactivated",
|
|
9
|
+
models: ["Tenant", "User", "Role", "Capability", "AuthSession", "AuditLog", "RefreshToken", "EmailVerification"],
|
|
10
|
+
dependsOn: [],
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
id: "billing",
|
|
14
|
+
name: "Billing",
|
|
15
|
+
description: "Subscriptions, invoices, orders, payments",
|
|
16
|
+
models: ["Invoice", "Order", "Subscription", "Plan", "Payment", "Product"],
|
|
17
|
+
dependsOn: ["core"],
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: "projects",
|
|
21
|
+
name: "Projects",
|
|
22
|
+
description: "Spaces, projects, tasks — project management features",
|
|
23
|
+
models: ["Space", "Project", "Task"],
|
|
24
|
+
dependsOn: ["core"],
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: "notifications",
|
|
28
|
+
name: "Notifications",
|
|
29
|
+
description: "In-app notifications and user preferences",
|
|
30
|
+
models: ["Notification", "UserPreference"],
|
|
31
|
+
dependsOn: ["core"],
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: "service-tokens",
|
|
35
|
+
name: "Service Tokens",
|
|
36
|
+
description: "Agent authentication tokens for AIOX integration",
|
|
37
|
+
models: ["ServiceToken"],
|
|
38
|
+
dependsOn: ["core"],
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: "marketing-tracking",
|
|
42
|
+
name: "Marketing Tracking",
|
|
43
|
+
description: "Ad tracking, GTM, GA4 and Meta CAPI observability",
|
|
44
|
+
models: ["TrackingEvent"],
|
|
45
|
+
dependsOn: ["core"],
|
|
46
|
+
},
|
|
47
|
+
];
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deactivateModels = deactivateModels;
|
|
4
|
+
exports.activateModels = activateModels;
|
|
5
|
+
exports.isModuleActive = isModuleActive;
|
|
6
|
+
/**
|
|
7
|
+
* Deactivates models by commenting them out in the Prisma schema
|
|
8
|
+
*/
|
|
9
|
+
function deactivateModels(schemaContent, models) {
|
|
10
|
+
let updatedSchema = schemaContent;
|
|
11
|
+
for (const modelName of models) {
|
|
12
|
+
const modelRegex = new RegExp(`^model ${modelName} \\{[^}]*\\}`, "gm");
|
|
13
|
+
updatedSchema = updatedSchema.replace(modelRegex, (match) => match.split("\n").map(line => `// ${line}`).join("\n"));
|
|
14
|
+
}
|
|
15
|
+
return updatedSchema;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Activates models by uncommenting them in the Prisma schema
|
|
19
|
+
*/
|
|
20
|
+
function activateModels(schemaContent, models) {
|
|
21
|
+
let updatedSchema = schemaContent;
|
|
22
|
+
for (const modelName of models) {
|
|
23
|
+
// Regex matches multiple lines starting with // until the closing brace of the model
|
|
24
|
+
const regex = new RegExp(`// model ${modelName} \\{[^}]*// \\}`, "gs");
|
|
25
|
+
updatedSchema = updatedSchema.replace(regex, (match) => {
|
|
26
|
+
return match.split("\n").map(line => line.replace(/^\/\/ /, "")).join("\n");
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return updatedSchema;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Checks if a module is currently active in the schema
|
|
33
|
+
*/
|
|
34
|
+
function isModuleActive(schemaContent, models) {
|
|
35
|
+
if (models.length === 0)
|
|
36
|
+
return true;
|
|
37
|
+
const firstModel = models[0];
|
|
38
|
+
const activeRegex = new RegExp(`^model ${firstModel} \\{`, "m");
|
|
39
|
+
return activeRegex.test(schemaContent);
|
|
40
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import "./chunk-3RG5ZIWI.js";
|
|
2
|
+
|
|
3
|
+
// src/commands/license/tier-table.ts
|
|
4
|
+
import Table from "cli-table3";
|
|
5
|
+
import chalk from "chalk";
|
|
6
|
+
var TIERS = [
|
|
7
|
+
{ name: "STARTER", price: "$149", projects: "1", tenants: "10", marketplace: false },
|
|
8
|
+
{ name: "COMPLETE", price: "$399", projects: "1", tenants: "Unlimited", marketplace: false },
|
|
9
|
+
{ name: "PRO", price: "$799", projects: "5", tenants: "Unlimited", marketplace: true },
|
|
10
|
+
{ name: "ENTERPRISE", price: "Custom", projects: "Unlimited", tenants: "Unlimited", marketplace: true }
|
|
11
|
+
];
|
|
12
|
+
function colorTier(tier) {
|
|
13
|
+
switch (tier.toUpperCase()) {
|
|
14
|
+
case "STARTER":
|
|
15
|
+
return chalk.green(tier);
|
|
16
|
+
case "COMPLETE":
|
|
17
|
+
return chalk.yellow(tier);
|
|
18
|
+
case "PRO":
|
|
19
|
+
return chalk.magenta(tier);
|
|
20
|
+
case "ENTERPRISE":
|
|
21
|
+
return chalk.cyan(tier);
|
|
22
|
+
default:
|
|
23
|
+
return tier;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function printTierComparisonTable(userTier, requiredTier) {
|
|
27
|
+
console.log(chalk.red("\n\u2717 License tier insufficient\n"));
|
|
28
|
+
console.log(` Your tier: ${colorTier(userTier)}`);
|
|
29
|
+
console.log(` Required tier: ${colorTier(requiredTier)}
|
|
30
|
+
`);
|
|
31
|
+
const table = new Table({
|
|
32
|
+
head: ["Tier", "Price", "Projects", "Tenants", "Marketplace"],
|
|
33
|
+
style: { head: ["cyan"] }
|
|
34
|
+
});
|
|
35
|
+
for (const t of TIERS) {
|
|
36
|
+
const isUser = t.name === userTier.toUpperCase();
|
|
37
|
+
const isRequired = t.name === requiredTier.toUpperCase();
|
|
38
|
+
const marker = isRequired ? chalk.yellow(" \u2190 required") : isUser ? chalk.dim(" \u2190 you") : "";
|
|
39
|
+
table.push([
|
|
40
|
+
colorTier(t.name) + marker,
|
|
41
|
+
t.price,
|
|
42
|
+
t.projects,
|
|
43
|
+
t.tenants,
|
|
44
|
+
t.marketplace ? chalk.green("\u2713") : chalk.dim("\u2717")
|
|
45
|
+
]);
|
|
46
|
+
}
|
|
47
|
+
console.log(table.toString());
|
|
48
|
+
console.log(chalk.dim("\n Upgrade at: https://kaven.dev/pricing\n"));
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
printTierComparisonTable
|
|
52
|
+
};
|