Implement CLI commands and admin API endpoints
- Add bootstrap command with direct DB access for initial setup - Implement auth login/logout/status CLI commands - Implement user create/confirm-email CLI commands - Implement org create/list/add-site CLI commands - Add admin.orgs.* and admin.users.* API endpoints - Add password hashing utility with scrypt - Add token hashing and authentication utility - Add superuser runtime checks for admin endpoints - Wrap multi-step operations in transactions - Fix config file permissions (0o600) for security - Remove token display from status command - Add return statements to void handlers - Add reviq CLI command to devenv Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,15 +1,49 @@
|
||||
import type { LocalContext } from "../../context.js";
|
||||
import { buildCommand } from "@stricli/core";
|
||||
import { createApiClient } from "../../utils/api-client.js";
|
||||
|
||||
function addSite(this: LocalContext): void {
|
||||
console.log("Org add-site command - Not implemented");
|
||||
console.log("This command will add a site to an organization");
|
||||
interface AddSiteFlags {
|
||||
org: string;
|
||||
domain: string;
|
||||
}
|
||||
|
||||
async function addSite(this: LocalContext, flags: AddSiteFlags): Promise<void> {
|
||||
try {
|
||||
const client = await createApiClient();
|
||||
|
||||
await client.call("admin.orgs.addSite", {
|
||||
slug: flags.org,
|
||||
domain: flags.domain,
|
||||
});
|
||||
|
||||
console.log(`Added site ${flags.domain} to org ${flags.org}`);
|
||||
} catch (error) {
|
||||
console.error(
|
||||
"Error:",
|
||||
error instanceof Error ? error.message : String(error),
|
||||
);
|
||||
this.process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
export const addSiteCommand = buildCommand({
|
||||
func: addSite,
|
||||
parameters: {},
|
||||
parameters: {
|
||||
flags: {
|
||||
org: {
|
||||
kind: "parsed",
|
||||
parse: String,
|
||||
brief: "Org slug to add the site to",
|
||||
},
|
||||
domain: {
|
||||
kind: "parsed",
|
||||
parse: String,
|
||||
brief: "Domain to add (e.g. example.com)",
|
||||
},
|
||||
},
|
||||
},
|
||||
docs: {
|
||||
brief: "Add a site to an organization",
|
||||
fullDescription: "Adds a site domain to an organization via the admin API.",
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user