gencow 0.1.127 → 0.1.129

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/bin/gencow.mjs CHANGED
@@ -727,6 +727,21 @@ const commands = {
727
727
 
728
728
  // ── init ─────────────────────────────────────────────
729
729
  async init(...initArgs) {
730
+ // --help handler
731
+ if (initArgs.includes("--help") || initArgs.includes("-h")) {
732
+ log(`\n${BOLD}${CYAN}gencow init${RESET} — Create a new Gencow project\n`);
733
+ log(` ${BOLD}Usage:${RESET} gencow init [name] [options]\n`);
734
+ log(` ${BOLD}Arguments:${RESET}`);
735
+ log(` ${CYAN}name${RESET} Project name (creates directory) or "." for current dir\n`);
736
+ log(` ${BOLD}Options:${RESET}`);
737
+ log(` ${DIM}--template, -t${RESET} Select template (default, task-app, fullstack, ai-chat)`);
738
+ log(` ${DIM}--force, -f${RESET} Initialize in non-empty directory\n`);
739
+ log(` ${BOLD}Examples:${RESET}`);
740
+ log(` gencow init my-app`);
741
+ log(` gencow init . --force`);
742
+ log(` gencow init my-app --template fullstack\n`);
743
+ return;
744
+ }
730
745
  // Parse --template / -t flag, --force / -f flag, and project name from args
731
746
  let name = null;
732
747
  let templateId = null;
@@ -1166,6 +1181,16 @@ ${hasPrompt ? `
1166
1181
  // seed.ts 실행 (TRUNCATE 없이). 서버가 실행 중이어야 함.
1167
1182
  // Cloud-first: 기본=Cloud, --local=로컬
1168
1183
  async "db:seed"(...args) {
1184
+ // --help handler
1185
+ if (args.includes("--help") || args.includes("-h")) {
1186
+ log(`\n${BOLD}${CYAN}gencow db:seed${RESET} — Run seed.ts on cloud app\n`);
1187
+ log(` ${BOLD}Usage:${RESET} gencow db:seed [options]\n`);
1188
+ log(` ${BOLD}Options:${RESET}`);
1189
+ log(` ${DIM}--prod${RESET} Seed production app`);
1190
+ log(` ${DIM}--local${RESET} Seed local dev server`);
1191
+ log(` ${DIM}--app, -a${RESET} Target specific app\n`);
1192
+ return;
1193
+ }
1169
1194
  const config = loadConfig();
1170
1195
  const isLocal = isLocalDbTarget(args);
1171
1196
 
@@ -1562,6 +1587,16 @@ ${hasPrompt ? `
1562
1587
  // ── db:push ──────────────────────────────────────────
1563
1588
  // Cloud-first: 기본=Cloud, --local=로컬
1564
1589
  async "db:push"(...args) {
1590
+ // --help handler
1591
+ if (args.includes("--help") || args.includes("-h")) {
1592
+ log(`\n${BOLD}${CYAN}gencow db:push${RESET} — Sync schema.ts → database\n`);
1593
+ log(` ${BOLD}Usage:${RESET} gencow db:push [options]\n`);
1594
+ log(` ${BOLD}Options:${RESET}`);
1595
+ log(` ${DIM}--prod${RESET} Push to production DB (confirmation required)`);
1596
+ log(` ${DIM}--local${RESET} Push to local dev DB`);
1597
+ log(` ${DIM}--app, -a${RESET} Target specific app\n`);
1598
+ return;
1599
+ }
1565
1600
  const config = loadConfig();
1566
1601
  const isLocal = isLocalDbTarget(args);
1567
1602
 
@@ -1708,7 +1743,14 @@ ${hasPrompt ? `
1708
1743
  },
1709
1744
 
1710
1745
  // ── db:generate ──────────────────────────────────────
1711
- async "db:generate"() {
1746
+ async "db:generate"(...args) {
1747
+ // --help handler
1748
+ if (args?.includes?.("--help") || args?.includes?.("-h")) {
1749
+ log(`\n${BOLD}${CYAN}gencow db:generate${RESET} — Generate SQL migration files\n`);
1750
+ log(` ${BOLD}Usage:${RESET} gencow db:generate\n`);
1751
+ log(` Generates migration files from schema.ts using drizzle-kit.\n`);
1752
+ return;
1753
+ }
1712
1754
  const config = loadConfig();
1713
1755
  log(`\n${BOLD}${CYAN}Gencow DB Generate${RESET}\n`);
1714
1756
  info("Generating migration files from schema.ts...");
@@ -1967,6 +2009,23 @@ ${BOLD}Examples:${RESET}
1967
2009
 
1968
2010
  // ── static — 정적 파일 배포 (dev 기본, --prod 로 프로덕션) ──
1969
2011
  async static(...staticArgs) {
2012
+ // --help handler
2013
+ if (staticArgs.includes("--help") || staticArgs.includes("-h")) {
2014
+ log(`\n${BOLD}${CYAN}gencow static${RESET} — Deploy static files\n`);
2015
+ log(` ${BOLD}Usage:${RESET} gencow static [dir] [options]\n`);
2016
+ log(` ${BOLD}Arguments:${RESET}`);
2017
+ log(` ${CYAN}dir${RESET} Static directory (auto-detects dist/, out/, build/)\n`);
2018
+ log(` ${BOLD}Options:${RESET}`);
2019
+ log(` ${DIM}--prod${RESET} Deploy to production app`);
2020
+ log(` ${DIM}--no-backend${RESET} Skip backend deployment`);
2021
+ log(` ${DIM}--force, -f${RESET} Skip dependency audit`);
2022
+ log(` ${DIM}--app, -a${RESET} Target specific app\n`);
2023
+ log(` ${BOLD}Examples:${RESET}`);
2024
+ log(` gencow static dist/`);
2025
+ log(` gencow static --prod dist/`);
2026
+ log(` gencow static --no-backend dist/\n`);
2027
+ return;
2028
+ }
1970
2029
  const creds = requireCreds();
1971
2030
 
1972
2031
  let staticDir = null;
@@ -2020,6 +2079,21 @@ ${BOLD}Examples:${RESET}
2020
2079
 
2021
2080
  // ── deploy — 클라우드 배포 (dev 기본, --prod로 프로덕션) ──
2022
2081
  async deploy(...deployArgs) {
2082
+ // --help handler
2083
+ if (deployArgs.includes("--help") || deployArgs.includes("-h")) {
2084
+ log(`\n${BOLD}${CYAN}gencow deploy${RESET} — Deploy backend to cloud\n`);
2085
+ log(` ${BOLD}Usage:${RESET} gencow deploy [options]\n`);
2086
+ log(` ${BOLD}Options:${RESET}`);
2087
+ log(` ${DIM}--prod${RESET} Deploy to production (Pro+ only)`);
2088
+ log(` ${DIM}--rollback${RESET} Rollback to previous deployment`);
2089
+ log(` ${DIM}--force, -f${RESET} Skip dependency audit`);
2090
+ log(` ${DIM}--app, -a${RESET} Target specific app\n`);
2091
+ log(` ${BOLD}Examples:${RESET}`);
2092
+ log(` gencow deploy`);
2093
+ log(` gencow deploy --prod`);
2094
+ log(` gencow deploy --rollback\n`);
2095
+ return;
2096
+ }
2023
2097
  const creds = requireCreds();
2024
2098
 
2025
2099
  // gencow.json에서 앱 ID 확인 (자동 생성된 유니크 ID)
@@ -3080,6 +3154,20 @@ ${BOLD}Examples:${RESET}
3080
3154
 
3081
3155
  // ── env ───────────────────────────────────────────────
3082
3156
  async env(...envArgs) {
3157
+ // --help handler
3158
+ if (envArgs.includes("--help") || envArgs.includes("-h")) {
3159
+ log(`\n${BOLD}${CYAN}gencow env${RESET} — Environment variable management\n`);
3160
+ log(` ${BOLD}Usage:${RESET} gencow env <command> [options]\n`);
3161
+ log(` ${BOLD}Commands:${RESET}`);
3162
+ log(` ${CYAN}list${RESET} List cloud env vars`);
3163
+ log(` ${CYAN}set${RESET} KEY=VALUE Set cloud env var (hot-reload)`);
3164
+ log(` ${CYAN}unset${RESET} KEY Remove cloud env var`);
3165
+ log(` ${CYAN}push${RESET} Push .env to cloud\n`);
3166
+ log(` ${BOLD}Options:${RESET}`);
3167
+ log(` ${DIM}--prod${RESET} Target production app`);
3168
+ log(` ${DIM}--app, -a${RESET} Target specific app\n`);
3169
+ return;
3170
+ }
3083
3171
  const creds = requireCreds();
3084
3172
  const subCmd = envArgs[0] || "list";
3085
3173
  const restArgs = envArgs.slice(1);
@@ -3247,6 +3335,19 @@ ${BOLD}Examples:${RESET}
3247
3335
 
3248
3336
  // ── config ────────────────────────────────────────────
3249
3337
  async config(...configArgs) {
3338
+ // --help handler
3339
+ if (configArgs.includes("--help") || configArgs.includes("-h")) {
3340
+ log(`\n${BOLD}${CYAN}gencow config${RESET} — App configuration\n`);
3341
+ log(` ${BOLD}Usage:${RESET} gencow config <command> [options]\n`);
3342
+ log(` ${BOLD}Commands:${RESET}`);
3343
+ log(` ${CYAN}set${RESET} <key> <value> Set config (e.g. image.maxWidth 1920)`);
3344
+ log(` ${CYAN}get${RESET} Show current config`);
3345
+ log(` ${CYAN}reset${RESET} Reset to tier defaults\n`);
3346
+ log(` ${BOLD}Options:${RESET}`);
3347
+ log(` ${DIM}--prod${RESET} Target production app`);
3348
+ log(` ${DIM}--app, -a${RESET} Target specific app\n`);
3349
+ return;
3350
+ }
3250
3351
  const creds = requireCreds();
3251
3352
  const subCmd = configArgs[0] || "help";
3252
3353
  const restArgs = configArgs.slice(1);
@@ -3859,6 +3960,18 @@ ${BOLD}Examples:${RESET}
3859
3960
 
3860
3961
  // ── domain ─────────────────────────────────────────────
3861
3962
  async domain(...domainArgs) {
3963
+ // --help handler
3964
+ if (domainArgs.includes("--help") || domainArgs.includes("-h")) {
3965
+ log(`\n${BOLD}${CYAN}gencow domain${RESET} — Custom domain management\n`);
3966
+ log(` ${BOLD}Usage:${RESET} gencow domain <command> [options]\n`);
3967
+ log(` ${BOLD}Commands:${RESET}`);
3968
+ log(` ${CYAN}set${RESET} <domain> Connect custom domain (e.g. myapp.com)`);
3969
+ log(` ${CYAN}status${RESET} Check domain DNS/TLS status`);
3970
+ log(` ${CYAN}remove${RESET} Disconnect custom domain\n`);
3971
+ log(` ${BOLD}Options:${RESET}`);
3972
+ log(` ${DIM}--app, -a${RESET} Target specific app\n`);
3973
+ return;
3974
+ }
3862
3975
  const creds = requireCreds();
3863
3976
  const subCmd = domainArgs[0] || "status";
3864
3977
  const restArgs = domainArgs.slice(1);
@@ -3997,6 +4110,15 @@ ${BOLD}Examples:${RESET}
3997
4110
 
3998
4111
  // ── codegen — 프론트엔드 전용 api.ts 생성 ─────────
3999
4112
  async codegen(...codegenArgs) {
4113
+ // --help handler
4114
+ if (codegenArgs.includes("--help") || codegenArgs.includes("-h")) {
4115
+ log(`\n${BOLD}${CYAN}gencow codegen${RESET} — Generate frontend api.ts from schema\n`);
4116
+ log(` ${BOLD}Usage:${RESET} gencow codegen [options]\n`);
4117
+ log(` ${BOLD}Options:${RESET}`);
4118
+ log(` ${DIM}--outdir, -o${RESET} Output directory (default: src/gencow/)\n`);
4119
+ log(` Generates api.ts from gencow/ folder for frontend use.\n`);
4120
+ return;
4121
+ }
4000
4122
  const config = loadConfig();
4001
4123
  const absoluteFunctions = resolve(process.cwd(), config.functionsDir);
4002
4124
 
@@ -4121,6 +4243,17 @@ process.exit(0);
4121
4243
 
4122
4244
  // ── app (subcommands: create, list, delete) ────────
4123
4245
  async app(subcmd, ...rest) {
4246
+ // --help handler
4247
+ if (subcmd === "--help" || subcmd === "-h" || rest.includes("--help") || rest.includes("-h")) {
4248
+ log(`\n${BOLD}${CYAN}gencow app${RESET} — App management\n`);
4249
+ log(` ${BOLD}Usage:${RESET} gencow app <command>\n`);
4250
+ log(` ${BOLD}Commands:${RESET}`);
4251
+ log(` ${CYAN}list${RESET} List your apps`);
4252
+ log(` ${CYAN}create${RESET} Create a new app`);
4253
+ log(` ${CYAN}delete${RESET} Delete an app (confirmation required)`);
4254
+ log(` ${CYAN}status${RESET} Show app status\n`);
4255
+ return;
4256
+ }
4124
4257
  const creds = requireCreds();
4125
4258
 
4126
4259
  if (!subcmd || subcmd === "list") {
package/core/index.js CHANGED
@@ -1524,6 +1524,11 @@ function buildRealtimeCtx(options) {
1524
1524
  continue;
1525
1525
  }
1526
1526
  try {
1527
+ if (!options?.buildCtxForRefresh) {
1528
+ console.warn(
1529
+ `[gencow] \u26A0\uFE0F refresh("${key}"): buildCtxForRefresh not provided. Query handler will receive an empty ctx \u2014 ctx.db will be undefined. This is a framework configuration error. \u{1F4A1} Ensure buildRealtimeCtx() receives a buildCtxForRefresh callback.`
1530
+ );
1531
+ }
1527
1532
  const refreshCtx = options?.buildCtxForRefresh?.() ?? {};
1528
1533
  const result = await queryDef.handler(refreshCtx, {});
1529
1534
  if (options?.httpCallback) {