feat(cli): implement modular command architecture with build config
Publish to Gitea Registry / publish (push) Failing after 19m9s

- Refactor CLI entry point to use modular command structure
- Add list command with placeholder implementation
- Set up type definitions for command interface
- Configure TypeScript build and package files for distribution
- Add dist output to .gitignore
This commit is contained in:
yangzhaohan
2026-06-22 16:23:22 +08:00
parent c6f4311360
commit a258407fae
9 changed files with 338 additions and 4 deletions
+30
View File
@@ -0,0 +1,30 @@
import type { BrickConfig } from "../types/index.js";
const DEFAULT_SOURCE =
"https://gitea.synoth.com/synoth/brick-index/raw/branch/master/blocks.yaml";
function parseSourceFromArgs(args: string[]): string | undefined {
const idx = args.indexOf("--source");
if (idx !== -1 && idx + 1 < args.length) {
return args[idx + 1];
}
return undefined;
}
function isRemoteSource(source: string): boolean {
return source.startsWith("http://") || source.startsWith("https://");
}
export function resolveConfig(args: string[]): BrickConfig {
const cliSource = parseSourceFromArgs(args);
if (cliSource) {
return { source: cliSource, isRemote: isRemoteSource(cliSource) };
}
const envSource = process.env.BRICK_SOURCE;
if (envSource) {
return { source: envSource, isRemote: isRemoteSource(envSource) };
}
return { source: DEFAULT_SOURCE, isRemote: true };
}