@semiont/cli 0.4.1 → 0.4.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.
- package/dist/cli.mjs +38 -13
- package/package.json +7 -7
package/dist/cli.mjs
CHANGED
|
@@ -27020,7 +27020,7 @@ var require_package = __commonJS({
|
|
|
27020
27020
|
"package.json"(exports, module) {
|
|
27021
27021
|
module.exports = {
|
|
27022
27022
|
name: "@semiont/cli",
|
|
27023
|
-
version: "0.4.
|
|
27023
|
+
version: "0.4.2",
|
|
27024
27024
|
description: "Semiont CLI - Unified environment management tool",
|
|
27025
27025
|
_comment: "AWS SDK dependencies (@aws-sdk/*) are only used by platforms/aws",
|
|
27026
27026
|
type: "module",
|
|
@@ -27084,12 +27084,12 @@ var require_package = __commonJS({
|
|
|
27084
27084
|
"@aws-sdk/client-secrets-manager": "^3.600.0",
|
|
27085
27085
|
"@aws-sdk/client-sts": "^3.859.0",
|
|
27086
27086
|
"@aws-sdk/client-wafv2": "^3.859.0",
|
|
27087
|
-
"@semiont/api-client": "^0.4.
|
|
27088
|
-
"@semiont/content": "^0.4.
|
|
27089
|
-
"@semiont/core": "^0.4.
|
|
27090
|
-
"@semiont/event-sourcing": "^0.4.
|
|
27091
|
-
"@semiont/graph": "^0.4.
|
|
27092
|
-
"@semiont/make-meaning": "^0.4.
|
|
27087
|
+
"@semiont/api-client": "^0.4.2",
|
|
27088
|
+
"@semiont/content": "^0.4.2",
|
|
27089
|
+
"@semiont/core": "^0.4.2",
|
|
27090
|
+
"@semiont/event-sourcing": "^0.4.2",
|
|
27091
|
+
"@semiont/graph": "^0.4.2",
|
|
27092
|
+
"@semiont/make-meaning": "^0.4.2",
|
|
27093
27093
|
"@vitest/ui": "4.0.18",
|
|
27094
27094
|
arg: "^5.0.2",
|
|
27095
27095
|
argon2: "^0.44.0",
|
|
@@ -28154,7 +28154,8 @@ var UseraddOptionsSchema = BaseOptionsSchema.extend({
|
|
|
28154
28154
|
admin: external_exports.boolean().default(false),
|
|
28155
28155
|
moderator: external_exports.boolean().default(false),
|
|
28156
28156
|
inactive: external_exports.boolean().default(false),
|
|
28157
|
-
update: external_exports.boolean().default(false)
|
|
28157
|
+
update: external_exports.boolean().default(false),
|
|
28158
|
+
upsert: external_exports.boolean().default(false)
|
|
28158
28159
|
});
|
|
28159
28160
|
function validateEmail(email) {
|
|
28160
28161
|
const emailRegex2 = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
@@ -28225,8 +28226,23 @@ async function useradd(options) {
|
|
|
28225
28226
|
}
|
|
28226
28227
|
let user;
|
|
28227
28228
|
if (existingUser) {
|
|
28229
|
+
if (options.upsert) {
|
|
28230
|
+
if (!options.quiet) {
|
|
28231
|
+
printSuccess(`User already exists: ${options.email}`);
|
|
28232
|
+
}
|
|
28233
|
+
await prisma.$disconnect();
|
|
28234
|
+
return {
|
|
28235
|
+
command: "useradd",
|
|
28236
|
+
environment: options.environment,
|
|
28237
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
28238
|
+
summary: { succeeded: 1, failed: 0, total: 1, warnings: 0 },
|
|
28239
|
+
executionContext: { user: process.env.USER || "unknown", workingDirectory: process.cwd(), dryRun: options.dryRun },
|
|
28240
|
+
results: [{ entity: options.email, platform: "posix", success: true, metadata: { userId: existingUser.id, email: existingUser.email, isAdmin: existingUser.isAdmin, isModerator: existingUser.isModerator, isActive: existingUser.isActive }, duration: Date.now() - startTime }],
|
|
28241
|
+
duration: Date.now() - startTime
|
|
28242
|
+
};
|
|
28243
|
+
}
|
|
28228
28244
|
if (!options.update) {
|
|
28229
|
-
throw new Error(`User ${options.email} already exists. Use --update to modify.`);
|
|
28245
|
+
throw new Error(`User ${options.email} already exists. Use --update to modify or --upsert to skip silently.`);
|
|
28230
28246
|
}
|
|
28231
28247
|
if (!options.quiet) {
|
|
28232
28248
|
printInfo(`Updating user: ${options.email}`);
|
|
@@ -28355,6 +28371,11 @@ var useraddCommand = new CommandBuilder().name("useradd").description("Create or
|
|
|
28355
28371
|
type: "boolean",
|
|
28356
28372
|
description: "Update existing user",
|
|
28357
28373
|
default: false
|
|
28374
|
+
},
|
|
28375
|
+
"--upsert": {
|
|
28376
|
+
type: "boolean",
|
|
28377
|
+
description: "Create user if absent, skip silently if already exists",
|
|
28378
|
+
default: false
|
|
28358
28379
|
}
|
|
28359
28380
|
},
|
|
28360
28381
|
aliases: {
|
|
@@ -29121,6 +29142,7 @@ Press Enter to create one in ${colors.bright}${defaultPath}${colors.reset}, or t
|
|
|
29121
29142
|
semiotRoot = answer || defaultPath;
|
|
29122
29143
|
fs49.mkdirSync(semiotRoot, { recursive: true });
|
|
29123
29144
|
process.env.SEMIONT_ROOT = semiotRoot;
|
|
29145
|
+
envVarsToAdvise.push(`export SEMIONT_ROOT=${semiotRoot}`);
|
|
29124
29146
|
console.log(`${colors.green}\u2713${colors.reset} Using ${semiotRoot}
|
|
29125
29147
|
`);
|
|
29126
29148
|
if (semiotRoot !== process.cwd()) {
|
|
@@ -29144,6 +29166,7 @@ Press Enter to create one in ${colors.bright}${defaultPath}${colors.reset}, or t
|
|
|
29144
29166
|
`);
|
|
29145
29167
|
}
|
|
29146
29168
|
const env = { ...process.env };
|
|
29169
|
+
await ensureGlobalConfig(false);
|
|
29147
29170
|
const isInitialized = fs49.existsSync(path42.join(semiotRoot, ".semiont"));
|
|
29148
29171
|
if (isInitialized) {
|
|
29149
29172
|
console.log(`${colors.green}\u2713${colors.reset} Project already initialized
|
|
@@ -29154,8 +29177,10 @@ Press Enter to create one in ${colors.bright}${defaultPath}${colors.reset}, or t
|
|
|
29154
29177
|
runSemiont(["init"], env);
|
|
29155
29178
|
console.log(`${colors.green}\u2713${colors.reset} Project initialized
|
|
29156
29179
|
`);
|
|
29157
|
-
} catch {
|
|
29180
|
+
} catch (err) {
|
|
29181
|
+
const initMsg = err instanceof Error ? err.message : String(err);
|
|
29158
29182
|
console.error(`${colors.red}\u2717 semiont init failed \u2014 cannot continue${colors.reset}`);
|
|
29183
|
+
console.error(` ${initMsg}`);
|
|
29159
29184
|
results.summary.failed = 1;
|
|
29160
29185
|
results.duration = Date.now() - startTime;
|
|
29161
29186
|
return results;
|
|
@@ -29227,11 +29252,11 @@ Press Enter to create one in ${colors.bright}${defaultPath}${colors.reset}, or t
|
|
|
29227
29252
|
const adminPassword = "password";
|
|
29228
29253
|
console.log(`${colors.cyan}\u25B6 Creating admin user...${colors.reset}`);
|
|
29229
29254
|
const useraddResult = runSemiontSafe(
|
|
29230
|
-
["useradd", "--email", adminEmail, "--password", adminPassword, "--admin"],
|
|
29255
|
+
["useradd", "--email", adminEmail, "--password", adminPassword, "--admin", "--upsert"],
|
|
29231
29256
|
env
|
|
29232
29257
|
);
|
|
29233
29258
|
if (useraddResult.success) {
|
|
29234
|
-
console.log(`${colors.green}\u2713${colors.reset} Admin user
|
|
29259
|
+
console.log(`${colors.green}\u2713${colors.reset} Admin user ready
|
|
29235
29260
|
`);
|
|
29236
29261
|
} else {
|
|
29237
29262
|
console.log(`${colors.yellow}\u26A0 useradd failed: ${useraddResult.error}${colors.reset}`);
|
|
@@ -29284,7 +29309,7 @@ var localCommand = new CommandBuilder().name("local").description("Set up and st
|
|
|
29284
29309
|
default: false
|
|
29285
29310
|
}
|
|
29286
29311
|
}, {
|
|
29287
|
-
"
|
|
29312
|
+
"-y": "--yes"
|
|
29288
29313
|
})).requiresEnvironment(false).requiresServices(false).examples(
|
|
29289
29314
|
"semiont local",
|
|
29290
29315
|
"semiont local --yes",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semiont/cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "Semiont CLI - Unified environment management tool",
|
|
5
5
|
"_comment": "AWS SDK dependencies (@aws-sdk/*) are only used by platforms/aws",
|
|
6
6
|
"type": "module",
|
|
@@ -64,12 +64,12 @@
|
|
|
64
64
|
"@aws-sdk/client-secrets-manager": "^3.600.0",
|
|
65
65
|
"@aws-sdk/client-sts": "^3.859.0",
|
|
66
66
|
"@aws-sdk/client-wafv2": "^3.859.0",
|
|
67
|
-
"@semiont/api-client": "0.4.
|
|
68
|
-
"@semiont/content": "0.4.
|
|
69
|
-
"@semiont/core": "0.4.
|
|
70
|
-
"@semiont/event-sourcing": "0.4.
|
|
71
|
-
"@semiont/graph": "0.4.
|
|
72
|
-
"@semiont/make-meaning": "0.4.
|
|
67
|
+
"@semiont/api-client": "0.4.2",
|
|
68
|
+
"@semiont/content": "0.4.2",
|
|
69
|
+
"@semiont/core": "0.4.2",
|
|
70
|
+
"@semiont/event-sourcing": "0.4.2",
|
|
71
|
+
"@semiont/graph": "0.4.2",
|
|
72
|
+
"@semiont/make-meaning": "0.4.2",
|
|
73
73
|
"@vitest/ui": "4.0.18",
|
|
74
74
|
"arg": "^5.0.2",
|
|
75
75
|
"argon2": "^0.44.0",
|