cmd() — astro Function Reference
Architecture documentation for the cmd() function in index.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 77e7ebcb_4d49_8ed3_8fc9_1a79362c7914["cmd()"] d7f21d8e_8654_15c7_404c_a3504df3849c["index.ts"] 77e7ebcb_4d49_8ed3_8fc9_1a79362c7914 -->|defined in| d7f21d8e_8654_15c7_404c_a3504df3849c style 77e7ebcb_4d49_8ed3_8fc9_1a79362c7914 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/db/src/core/cli/commands/shell/index.ts lines 12–41
export async function cmd({
flags,
astroConfig,
}: {
dbConfig: DBConfigInput;
astroConfig: AstroConfig;
flags: Arguments;
}) {
const query = flags.query;
if (!query) {
console.error(SHELL_QUERY_MISSING_ERROR);
process.exit(1);
}
const dbInfo = getRemoteDatabaseInfo();
if (flags.remote) {
const appToken = resolveDbAppToken(flags, dbInfo.token);
const db = createRemoteDatabaseClient({ ...dbInfo, token: appToken });
const result = await db.run(sql.raw(query));
console.log(result);
} else {
const { ASTRO_DATABASE_FILE } = getAstroEnv();
const dbUrl = normalizeDatabaseUrl(
ASTRO_DATABASE_FILE,
new URL(DB_PATH, astroConfig.root).href,
);
const db = createLocalDatabaseClient({ url: dbUrl });
const result = await db.run(sql.raw(query));
console.log(result);
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does cmd() do?
cmd() is a function in the astro codebase, defined in packages/db/src/core/cli/commands/shell/index.ts.
Where is cmd() defined?
cmd() is defined in packages/db/src/core/cli/commands/shell/index.ts at line 12.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free