@geekmidas/cli 10.0.0-alpha.18 → 10.0.0-alpha.19

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/index.mjs CHANGED
@@ -8,8 +8,8 @@ import { a as generateServiceCredentials, i as generateSecurePassword, n as gene
8
8
  import { c as getKeyPath, i as setCustomSecret, n as readStageSecrets, o as toEmbeddableSecrets, r as secretsExist, s as writeStageSecrets, t as maskPassword } from "./storage-TP0x118M.mjs";
9
9
  import { a as openapiCommand, c as runtimeFor, n as generateOpenApi, o as resolveOpenApiConfig, r as generateOpenApiFrom, s as EndpointGenerator, t as OPENAPI_OUTPUT_PATH$1 } from "./openapi-DfjbhrsM.mjs";
10
10
  import { i as withRoutes, r as withCompute } from "./emit-Bzq7JsMP.mjs";
11
- import { i as writeDockerEnvFromSecrets, r as generateFullstackCustomSecrets } from "./reconcile-fmoluZmZ.mjs";
12
- import { a as isRemoteStore, n as pullStageSecrets, r as pushStageSecrets, t as NoStoredSecrets } from "./transfer-2aRVVJ6I.mjs";
11
+ import { i as writeDockerEnvFromSecrets, r as generateFullstackCustomSecrets } from "./reconcile-gb1lz1Dk.mjs";
12
+ import { a as isRemoteStore, n as pullStageSecrets, r as pushStageSecrets, t as NoStoredSecrets } from "./transfer-DjFZRgub.mjs";
13
13
  import { createRequire } from "node:module";
14
14
  import { Command } from "commander";
15
15
  import { stdin, stdout } from "node:process";
@@ -37,7 +37,7 @@ import { fileURLToPath, pathToFileURL } from "node:url";
37
37
  import { lookup } from "node:dns/promises";
38
38
  import prompts from "prompts";
39
39
  //#region package.json
40
- var version = "10.0.0-alpha.18";
40
+ var version = "10.0.0-alpha.19";
41
41
  //#endregion
42
42
  //#region src/auth/credentials.ts
43
43
  /**
@@ -7937,7 +7937,7 @@ function workspaceConstructsGlobs(structure, appsDir) {
7937
7937
  * impossible.
7938
7938
  *
7939
7939
  * Instructions live in `AGENTS.md` because that is the file every tool reads.
7940
- * `CLAUDE.md` points at it rather than copying it: two files saying the same
7940
+ * `CLAUDE.md` imports it rather than copying it: two files saying the same
7941
7941
  * thing is two files to keep in step, and the copy that drifts is always the
7942
7942
  * one nobody opened.
7943
7943
  *
@@ -7956,19 +7956,25 @@ function generateAgentFiles(options, template) {
7956
7956
  }];
7957
7957
  }
7958
7958
  /**
7959
- * The pointer.
7959
+ * The import.
7960
7960
  *
7961
- * Deliberately short and deliberately not a summary — a summary is a second
7962
- * copy of the conventions that ages independently of the first.
7961
+ * `@AGENTS.md` rather than a link: Claude Code loads an `@` import into context
7962
+ * with the file that names it, and follows no links. A link left the
7963
+ * conventions one step away from an agent that never took it — it read the
7964
+ * pointer and nothing it pointed at.
7965
+ *
7966
+ * Deliberately not a summary — a summary is a second copy of the conventions
7967
+ * that ages independently of the first.
7963
7968
  */
7964
7969
  function claudeContent() {
7965
7970
  return `# CLAUDE.md
7966
7971
 
7967
- The conventions for this project live in [AGENTS.md](./AGENTS.md).
7972
+ @AGENTS.md
7968
7973
 
7969
- Read that file before writing code here. It is the single copy, kept that way
7970
- on purpose: anything repeated here would be a second thing to keep in step, and
7971
- the stale one is always the copy nobody opened.
7974
+ The conventions for this project live in \`AGENTS.md\`, imported above. It is
7975
+ the single copy, kept that way on purpose: anything repeated here would be a
7976
+ second thing to keep in step, and the stale one is always the copy nobody
7977
+ opened.
7972
7978
  `;
7973
7979
  }
7974
7980
  function agentsContent(options, template) {
@@ -8113,15 +8119,15 @@ per endpoint:
8113
8119
 
8114
8120
  \`\`\`typescript
8115
8121
  import { z } from 'zod';
8116
- import { router } from '../constructs/router.ts';
8122
+ import { router } from '~/router.ts';
8117
8123
 
8118
8124
  export const createUser = router
8119
8125
  .post('/users')
8120
8126
  .body(z.object({ name: z.string(), email: z.email() }))
8121
8127
  .output(z.object({ id: z.uuid() }))
8122
- .handle(async ({ body, logger${database ? ", services" : ""} }) => {
8128
+ .handle(async ({ body, logger${database ? ", db" : ""} }) => {
8123
8129
  logger.info({ name: body.name }, 'creating user');
8124
- ${database ? ` const user = await services.database
8130
+ ${database ? ` const user = await db
8125
8131
  .insertInto('users')
8126
8132
  .values({ name: body.name, email: body.email })
8127
8133
  .returningAll()
@@ -8141,13 +8147,20 @@ beside it is a second app that shadows the real one.
8141
8147
 
8142
8148
  ### Branching the factory
8143
8149
 
8144
- Share what a *group* of endpoints needs by branching once, in its own file:
8150
+ Share what a *group* of endpoints needs by branching once, in
8151
+ \`src/router.ts\`. A branch starts from the surface itself — there is no
8152
+ factory object to reach through first:
8145
8153
 
8146
8154
  \`\`\`typescript
8147
- export const router = api.endpoints${database ? ".database(database)" : ""};
8155
+ export const router = api${database ? ".database(database)" : ""};
8148
8156
  export const sessionRouter = router.session(/* … */);
8149
8157
  \`\`\`
8150
8158
 
8159
+ A branch is a new factory; the surface is untouched, so a route built straight
8160
+ from \`api\` gets none of what the branch added. What one endpoint alone needs —
8161
+ a bucket, a cache, another construct — goes on that endpoint with
8162
+ \`.dependsOn([...])\`, and arrives in \`services\`.
8163
+
8151
8164
  Branch for a group, never for a single endpoint — a one-endpoint branch is
8152
8165
  indirection with nothing on the other side of it.`;
8153
8166
  }
@@ -8194,17 +8207,29 @@ The database is a **construct**, not a hand-rolled service. Declaring it is what
8194
8207
  makes a Postgres exist locally and a database exist on deploy — nothing names
8195
8208
  \`postgres\` in config.
8196
8209
 
8197
- An endpoint reaches it by declaring the dependency, and gets it typed:
8210
+ The router in \`src/router.ts\` names it — \`api.database(database)\` — and
8211
+ every endpoint built from that router gets it as \`db\`, typed by the
8212
+ construct's schema:
8198
8213
 
8199
8214
  \`\`\`typescript
8200
8215
  export const listUsers = router
8201
8216
  .get('/users')
8202
8217
  .output(z.array(z.object({ id: z.uuid() })))
8203
- .handle(async ({ services }) => {
8204
- return services.database.selectFrom('users').selectAll().execute();
8218
+ .handle(async ({ db }) => {
8219
+ return db.selectFrom('users').selectAll().execute();
8205
8220
  });
8206
8221
  \`\`\`
8207
8222
 
8223
+ An endpoint that needs a different database names it itself, and gets that
8224
+ one as \`db\` instead — the router's is unchanged for every other route:
8225
+
8226
+ \`\`\`typescript
8227
+ export const monthly = router
8228
+ .get('/reports/monthly')
8229
+ .database(reports)
8230
+ .handle(async ({ db }) => db.selectFrom('totals').selectAll().execute());
8231
+ \`\`\`
8232
+
8208
8233
  Queries go through Kysely. Never open your own connection pool — the one the
8209
8234
  construct provides is the one that gets credentials, pooling and shutdown.`;
8210
8235
  }
@@ -8382,26 +8407,26 @@ function loadPackageJson() {
8382
8407
  * Run: pnpm --filter @geekmidas/cli sync-versions
8383
8408
  */
8384
8409
  const GEEKMIDAS_VERSIONS = {
8385
- "@geekmidas/audit": "~10.0.0-alpha.18",
8386
- "@geekmidas/auth": "~10.0.0-alpha.18",
8387
- "@geekmidas/cache": "~10.0.0-alpha.18",
8388
- "@geekmidas/client": "~10.0.0-alpha.18",
8389
- "@geekmidas/cloud": "~10.0.0-alpha.18",
8390
- "@geekmidas/constructs": "~10.0.0-alpha.18",
8391
- "@geekmidas/db": "~10.0.0-alpha.18",
8392
- "@geekmidas/emailkit": "~10.0.0-alpha.18",
8393
- "@geekmidas/envkit": "~10.0.0-alpha.18",
8394
- "@geekmidas/errors": "~10.0.0-alpha.18",
8395
- "@geekmidas/events": "~10.0.0-alpha.18",
8396
- "@geekmidas/logger": "~10.0.0-alpha.18",
8397
- "@geekmidas/manifest": "~10.0.0-alpha.18",
8398
- "@geekmidas/rate-limit": "~10.0.0-alpha.18",
8399
- "@geekmidas/schema": "~10.0.0-alpha.18",
8400
- "@geekmidas/services": "~10.0.0-alpha.18",
8401
- "@geekmidas/storage": "~10.0.0-alpha.18",
8402
- "@geekmidas/studio": "~10.0.0-alpha.18",
8403
- "@geekmidas/telescope": "~10.0.0-alpha.18",
8404
- "@geekmidas/testkit": "~10.0.0-alpha.18",
8410
+ "@geekmidas/audit": "~10.0.0-alpha.19",
8411
+ "@geekmidas/auth": "~10.0.0-alpha.19",
8412
+ "@geekmidas/cache": "~10.0.0-alpha.19",
8413
+ "@geekmidas/client": "~10.0.0-alpha.19",
8414
+ "@geekmidas/cloud": "~10.0.0-alpha.19",
8415
+ "@geekmidas/constructs": "~10.0.0-alpha.19",
8416
+ "@geekmidas/db": "~10.0.0-alpha.19",
8417
+ "@geekmidas/emailkit": "~10.0.0-alpha.19",
8418
+ "@geekmidas/envkit": "~10.0.0-alpha.19",
8419
+ "@geekmidas/errors": "~10.0.0-alpha.19",
8420
+ "@geekmidas/events": "~10.0.0-alpha.19",
8421
+ "@geekmidas/logger": "~10.0.0-alpha.19",
8422
+ "@geekmidas/manifest": "~10.0.0-alpha.19",
8423
+ "@geekmidas/rate-limit": "~10.0.0-alpha.19",
8424
+ "@geekmidas/schema": "~10.0.0-alpha.19",
8425
+ "@geekmidas/services": "~10.0.0-alpha.19",
8426
+ "@geekmidas/storage": "~10.0.0-alpha.19",
8427
+ "@geekmidas/studio": "~10.0.0-alpha.19",
8428
+ "@geekmidas/telescope": "~10.0.0-alpha.19",
8429
+ "@geekmidas/testkit": "~10.0.0-alpha.19",
8405
8430
  "@geekmidas/cli": `~${loadPackageJson().version}`
8406
8431
  };
8407
8432
  //#endregion
@@ -10749,7 +10774,7 @@ import { authService, type Session } from './services/auth.ts';
10749
10774
  * this router. Depend on other constructs per endpoint with \`.dependsOn([…])\`.` : `
10750
10775
  * Depend on constructs per endpoint with \`.dependsOn([…])\`.`}
10751
10776
  */
10752
- export const router = api.endpoints${options.constructs.database ? ".database(database)" : ""};
10777
+ export const router = api${options.constructs.database ? ".database(database)" : ""};
10753
10778
 
10754
10779
  // The auth client available, but the session not enforced.
10755
10780
  export const r = router.services([authService]);
@@ -10795,7 +10820,7 @@ import { database } from '${constructsImport("database")}';` : ""}
10795
10820
  * this router. Depend on other constructs per endpoint with \`.dependsOn([…])\`.` : `
10796
10821
  * Depend on constructs per endpoint with \`.dependsOn([…])\`.`}
10797
10822
  */
10798
- export const router = api.endpoints${options.constructs.database ? ".database(database)" : ""};
10823
+ export const router = api${options.constructs.database ? ".database(database)" : ""};
10799
10824
  `
10800
10825
  });
10801
10826
  if (options.constructs.database && declares) files.push(...databaseFiles());
@@ -15039,7 +15064,6 @@ function createFreshWorkspaceSecrets(stage, workspace, containers = []) {
15039
15064
  const secrets = createStageSecrets(stage, serviceNames, { projectName: workspace.name });
15040
15065
  if (Object.keys(workspace.apps).length > 1) secrets.custom = generateFullstackCustomSecrets(workspace, containers);
15041
15066
  else secrets.custom = {
15042
- NODE_ENV: "development",
15043
15067
  PORT: "3000",
15044
15068
  LOG_LEVEL: "debug",
15045
15069
  JWT_SECRET: `dev-${Date.now()}-${Math.random().toString(36).slice(2)}`
@@ -15737,7 +15761,7 @@ program.command("secrets:push").description("Send a deployed stage's secrets to
15737
15761
  const globalOptions = program.opts();
15738
15762
  if (globalOptions.cwd) process.chdir(globalOptions.cwd);
15739
15763
  const { loadWorkspaceConfig } = await import("./config.mjs");
15740
- const { pushStageSecrets } = await import("./transfer-2aRVVJ6I.mjs").then((n) => n.i);
15764
+ const { pushStageSecrets } = await import("./transfer-DjFZRgub.mjs").then((n) => n.i);
15741
15765
  const { workspace } = await loadWorkspaceConfig();
15742
15766
  const { addedKeys } = await pushStageSecrets(workspace, options.stage, { profile: options.profile });
15743
15767
  for (const key of addedKeys) console.log(` + ${key} (reconciled)`);
@@ -15752,7 +15776,7 @@ program.command("secrets:pull").description("Bring a deployed stage's secrets fr
15752
15776
  const globalOptions = program.opts();
15753
15777
  if (globalOptions.cwd) process.chdir(globalOptions.cwd);
15754
15778
  const { loadWorkspaceConfig } = await import("./config.mjs");
15755
- const { pullStageSecrets } = await import("./transfer-2aRVVJ6I.mjs").then((n) => n.i);
15779
+ const { pullStageSecrets } = await import("./transfer-DjFZRgub.mjs").then((n) => n.i);
15756
15780
  const { workspace } = await loadWorkspaceConfig();
15757
15781
  const { addedKeys } = await pullStageSecrets(workspace, options.stage, { profile: options.profile });
15758
15782
  for (const key of addedKeys) console.log(` + ${key} (reconciled)`);
@@ -15767,7 +15791,7 @@ program.command("secrets:reconcile").description("Backfill missing custom secret
15767
15791
  const globalOptions = program.opts();
15768
15792
  if (globalOptions.cwd) process.chdir(globalOptions.cwd);
15769
15793
  const { loadWorkspaceConfig } = await import("./config.mjs");
15770
- const { reconcileMissingSecrets } = await import("./reconcile-fmoluZmZ.mjs").then((n) => n.n);
15794
+ const { reconcileMissingSecrets } = await import("./reconcile-gb1lz1Dk.mjs").then((n) => n.n);
15771
15795
  const { readStageSecrets, writeStageSecrets } = await import("./storage-TP0x118M.mjs").then((n) => n.a);
15772
15796
  const { workspace } = await loadWorkspaceConfig();
15773
15797
  const stage = options.stage ?? workspace.stages.local;
@@ -15835,7 +15859,7 @@ program.command("deploy:github").description("Let GitHub Actions deploy a stage:
15835
15859
  try {
15836
15860
  const globalOptions = program.opts();
15837
15861
  if (globalOptions.cwd) process.chdir(globalOptions.cwd);
15838
- const { deployGithubCommand } = await import("./github-DlIrXPee.mjs");
15862
+ const { deployGithubCommand } = await import("./github-DW3CP-4D.mjs");
15839
15863
  await deployGithubCommand(options);
15840
15864
  } catch (error) {
15841
15865
  console.error(formatError(error));