@xrystal/core 3.52.4 → 3.52.6

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/README.md CHANGED
@@ -3,25 +3,25 @@
3
3
  > **EN** — Microservice runtime: Express or Elysia HTTP, DI loaders, live `tmp.yml`, standardized API responses.
4
4
  > **TR** — Microservice runtime: Express veya Elysia HTTP, DI loader'lar, canlı `tmp.yml`, standart API cevapları.
5
5
 
6
- **CLI:** `xry` · **Version:** `3.52.4` · [npm](https://www.npmjs.com/package/@xrystal/core)
6
+ **CLI:** `xry` · **Version:** `3.52.5` · [npm](https://www.npmjs.com/package/@xrystal/core)
7
7
 
8
8
  ---
9
9
 
10
10
  ## Platform services / Platform servisleri
11
11
 
12
- **EN:** Consumer microservices in `../services/` — pin `@xrystal/core` to the latest published minor (currently **3.52.4**).
12
+ **EN:** Consumer microservices in `../services/` — pin `@xrystal/core` to the latest published minor (currently **3.52.5**).
13
13
 
14
- **TR:** `../services/` altındaki tüketen microservice'ler — `@xrystal/core` sürümünü npm latest ile hizala (şu an **3.52.4**).
14
+ **TR:** `../services/` altındaki tüketen microservice'ler — `@xrystal/core` sürümünü npm latest ile hizala (şu an **3.52.5**).
15
15
 
16
16
  | Repo folder | `tmp.yml` name | Role | Service pkg | `@xrystal/core` |
17
17
  |-------------|----------------|------|-------------|-----------------|
18
- | `api-core-svc` | `core` | Core domain API | `1.0.24` | `3.52.4` |
19
- | `api-cron-svc` | `crons` | Scheduled jobs / Kafka queue worker | `0.1.25` | `3.52.4` |
20
- | `api-gateway-svc` | `gateway` | Edge gateway, routing, cache, Mongo config | `2.0.49` | `3.52.4` |
21
- | `api-gpt-svc` | `gpt` | GPT / AI features | `1.0.22` | `3.52.4` |
22
- | `api-iam-svc` | `iam` | Identity & access management | `0.7.26` | `3.52.4` |
23
- | `api-log-svc` | `log` | Logging service | `1.0.20` | `3.52.4` |
24
- | `api-websocket-svc` | `websocket` | WebSocket / realtime | `0.8.31` | `3.52.4` |
18
+ | `api-core-svc` | `core` | Core domain API | `1.0.24` | `3.52.5` |
19
+ | `api-cron-svc` | `crons` | Scheduled jobs / Kafka queue worker | `0.1.25` | `3.52.5` |
20
+ | `api-gateway-svc` | `gateway` | Edge gateway, routing, cache, Mongo config | `2.0.49` | `3.52.5` |
21
+ | `api-gpt-svc` | `gpt` | GPT / AI features | `1.0.22` | `3.52.5` |
22
+ | `api-iam-svc` | `iam` | Identity & access management | `0.7.26` | `3.52.5` |
23
+ | `api-log-svc` | `log` | Logging service | `1.0.20` | `3.52.5` |
24
+ | `api-websocket-svc` | `websocket` | WebSocket / realtime | `0.8.31` | `3.52.5` |
25
25
 
26
26
  **SSL / TLS helpers** (since 3.49.0): import from loader subpaths, not `@xrystal/core/utils`:
27
27
 
@@ -35,7 +35,7 @@ import { resolveMongoConnectOptions } from '@xrystal/core/loader/mongo'
35
35
 
36
36
  ```bash
37
37
  cd ../services/api-<name>-svc
38
- bun add @xrystal/core@3.52.4
38
+ bun add @xrystal/core@3.52.5
39
39
  bun run build
40
40
  ```
41
41
 
@@ -253,13 +253,19 @@ bun run dev
253
253
  | Command / Komut | EN | TR |
254
254
  |-----------------|----|----|
255
255
  | `xry create [name] [path]` | Start project from template + `tmp.yml` | Template + `tmp.yml` ile proje başlat |
256
- | `xry tmp` | Create `tmp.yml` from seed if missing | `tmp.yml` yoksa seed'den oluştur |
257
- | `xry sync` | Force-sync `tsconfig` from `tmp.yml` (auto-heals otherwise) | Force sync (normalde otomatik) |
256
+ | `xry project` | **Context**: workspace root, inner service, standalone, or core library | **Bağlam**: workspace / servis / core |
257
+ | `xry workspaces` | **Global registry** `~/.xrystal` (not tmp.yml) | Global kayıt defteri |
258
+ | `xry create <name> --workspace` | Outer `./tmp.yml` + **api/general** + admin/web | Dış tmp + api/general |
259
+ | `xry tmp` | Inner `x/tmp.yml` or outer workspace tmp; **`end.version` = schema (1)** | tmp.yml · şema sürümü |
260
+ | `xry sync` | Inner tsconfig + pin `@xrystal/core` + registry (workspace mode) | tsconfig + core pin |
261
+ | `xry tp connect` / `xry tp dev <deploy>` | Telepresence cluster connect / local intercept | Telepresence bağlan / local intercept |
262
+ | `xry workspaces` | List `~/.xrystal` workspaces + linked projects | Kayıtlı workspace listesi |
258
263
  | `xry dev` | Watch `source/index.ts` + dev env | `source/index.ts` watch + dev env |
259
264
  | `xry build` | `tsc` full tree → dist (auto default) + alias/fix post-steps | `tsc` ile tüm `source/` → dist |
260
265
  | `xry start` | Run `x/dist` + prod env | `x/dist` + prod env |
261
266
  | `xry test` | Run `x/tests` | `x/tests` çalıştır |
262
267
  | `xry doctor` | CLI, runtime, package health | CLI, runtime, paket uyumu |
268
+ | `xry tag` | Core release: tag + npm publish | Core release tag + npm |
263
269
 
264
270
  ---
265
271
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "Yusuf Yasir KAYGUSUZ",
3
3
  "name": "@xrystal/core",
4
- "version": "3.52.4",
4
+ "version": "3.52.6",
5
5
  "description": "microservice runtime library",
6
6
  "publishConfig": {
7
7
  "access": "public",
@@ -60,17 +60,26 @@ export function registerCreateCommand(cli, { cliName = CLI_PRIMARY_NAME, runtime
60
60
  try {
61
61
  const version = readCliPackageJson().version
62
62
  printCommandHeader({ cliName, command: 'create (workspace)', version })
63
- const result = scaffoldWorkspace(targetPath, name)
63
+ const result = scaffoldWorkspace(targetPath, name, {
64
+ installCommand,
65
+ cliName,
66
+ })
64
67
  console.log(chalk.green('\n✓ Workspace ready\n'))
65
68
  console.log(chalk.gray(` tmp: ${path.relative(process.cwd(), result.tmpPath) || result.tmpPath}`))
66
- console.log(chalk.gray(' folders: api/, admin/, web/'))
67
- console.log(chalk.gray(' link services into api/ (type optional) or admin|web (type: frontend)'))
69
+ console.log(chalk.gray(' outer tmp: ./tmp.yml (workspace) · inner: each api|admin|web project'))
70
+ if (result.general) {
71
+ console.log(chalk.green(' api/general: monolith scaffold (gpt template)'))
72
+ console.log(chalk.gray(` tmp: ${path.relative(process.cwd(), result.general.tmpFilePath) || result.general.tmpFilePath}`))
73
+ }
74
+ console.log(chalk.gray(' link more services into api/ or admin|web (frontend)'))
75
+ console.log(chalk.gray(' telepresence: .env.telepresence.example + x/environments/.env.telepresence'))
68
76
  console.log(chalk.cyan(`\n cd ${path.relative(process.cwd(), result.root) || result.root}`))
69
77
  try {
70
78
  syncRegistryFromPath(result.root)
71
79
  console.log(chalk.gray(' registered in ~/.xrystal'))
72
80
  } catch {}
73
81
  console.log(chalk.cyan(` ${cliName} sync`))
82
+ console.log(chalk.cyan(` ${cliName} telepresence dev general`))
74
83
  printCommandFooter({ version })
75
84
  } catch (error) {
76
85
  console.error(chalk.red(`\n✗ ${error.message}\n`))
@@ -0,0 +1,94 @@
1
+ import chalk from 'chalk'
2
+
3
+ import { printCommandFooter, printCommandHeader } from '../helpers/banner.mjs'
4
+ import { CLI_PRIMARY_NAME } from '../helpers/cli-identity.mjs'
5
+ import { packageDefaults } from '../helpers/package-defaults.mjs'
6
+ import { resolveProjectContext } from '../helpers/project-context.mjs'
7
+ import { readCliPackageJson } from '../helpers/project-root.mjs'
8
+ import { ensureTmpSchemaVersion } from '../helpers/tmp-schema-version.mjs'
9
+
10
+ function line(label, value) {
11
+ console.log(` ${label.padEnd(20)}${value}`)
12
+ }
13
+
14
+ function printTmpLayer(title, meta, schemaExpected, { heal = false } = {}) {
15
+ if (!meta?.path) return
16
+ console.log(chalk.bold.cyan(`\n ${title}`))
17
+ line('path', chalk.gray(meta.path))
18
+ if (meta.projectName) line('project.name', chalk.bold(meta.projectName))
19
+ if (meta.globalType) line('global.type', meta.globalType)
20
+ if (meta.schemaVersion != null) {
21
+ const ok = String(meta.schemaVersion) === String(schemaExpected)
22
+ line('end.version', ok ? chalk.green(`${meta.schemaVersion} (schema)`) : chalk.yellow(`${meta.schemaVersion} (expected schema ${schemaExpected})`))
23
+ }
24
+ if (heal) ensureTmpSchemaVersion(meta.path)
25
+ }
26
+
27
+ export function registerProjectInfoCommand(cli, { cliName = CLI_PRIMARY_NAME } = {}) {
28
+ cli
29
+ .command('project')
30
+ .description('Show workspace / service context for current directory')
31
+ .option('--heal-schema', 'Fix tmp.yml end.version if missing or mistaken core semver')
32
+ .action((options) => {
33
+ const version = readCliPackageJson().version
34
+ printCommandHeader({ cliName, command: 'project', version })
35
+
36
+ const ctx = resolveProjectContext()
37
+ console.log(chalk.bold.white(`\n ${ctx.label}`))
38
+ line('cwd', ctx.cwd)
39
+ line('scope', ctx.kind)
40
+ if (ctx.projectRoot !== ctx.cwd) line('project root', ctx.projectRoot)
41
+ if (ctx.workspaceRoot) line('workspace root', ctx.workspaceRoot)
42
+
43
+ if (ctx.package) {
44
+ console.log(chalk.bold.cyan('\n Package'))
45
+ line('name', chalk.bold(ctx.package.name))
46
+ line('version', ctx.package.version ?? '—')
47
+ }
48
+
49
+ console.log(chalk.bold.cyan('\n @xrystal/core (global library)'))
50
+ line('CLI (this xry)', chalk.bold(`v${ctx.core.cli}`))
51
+ if (ctx.core.declared) line('declared', ctx.core.declared)
52
+ if (ctx.core.installed) {
53
+ const match = ctx.core.installed === ctx.core.cli
54
+ line('installed', `${ctx.core.installed} ${match ? chalk.green('(matches CLI)') : chalk.yellow('(drift)')}`)
55
+ } else if (!ctx.core.isGlobalLibrary) {
56
+ line('installed', chalk.yellow('not in node_modules'))
57
+ }
58
+ if (ctx.core.isGlobalLibrary) {
59
+ line('role', chalk.green('library source — npm package for all services/workspaces'))
60
+ }
61
+
62
+ if (ctx.outerTmp) {
63
+ printTmpLayer('Outer tmp (workspace)', ctx.outerTmp, ctx.schemaVersionExpected, { heal: options.healSchema })
64
+ }
65
+ if (ctx.innerTmp) {
66
+ printTmpLayer('Inner tmp (project)', ctx.innerTmp, ctx.schemaVersionExpected, { heal: options.healSchema })
67
+ } else if (!ctx.outerTmp) {
68
+ console.log(chalk.yellow('\n No tmp.yml found — run xry tmp'))
69
+ }
70
+
71
+ if (ctx.selfEntry) {
72
+ console.log(chalk.bold.cyan('\n Workspace link'))
73
+ line('name', `${ctx.selfEntry.name} [${ctx.selfEntry.type}]`)
74
+ line('slot', ctx.selfEntry.slot)
75
+ }
76
+
77
+ if (ctx.workspaceEntries.length > 0 && ctx.kind === 'workspace-root') {
78
+ console.log(chalk.bold.cyan(`\n Linked projects (${ctx.workspaceEntries.length})`))
79
+ for (const entry of ctx.workspaceEntries) {
80
+ console.log(` • ${chalk.white(entry.name)} [${entry.type}] ${chalk.gray(entry.path)}`)
81
+ }
82
+ }
83
+
84
+ if (ctx.hints?.length) {
85
+ console.log(chalk.bold.cyan('\n Next'))
86
+ for (const hint of ctx.hints) {
87
+ console.log(` ${chalk.gray('→')} ${hint}`)
88
+ }
89
+ }
90
+
91
+ console.log(chalk.dim(`\n Registry (all workspaces): ${cliName} workspaces · inner tmp: ${cliName} tmp`))
92
+ printCommandFooter({ version })
93
+ })
94
+ }
@@ -81,7 +81,7 @@ export function registerWorkspacesCommand(cli, { cliName = CLI_PRIMARY_NAME } =
81
81
  attachRegistryCommand(
82
82
  cli
83
83
  .command('workspaces [action]')
84
- .description('List ~/.xrystal workspaces and linked projects'),
84
+ .description('Global ~/.xrystal registry — workspaces & linked projects (not repo tmp.yml)'),
85
85
  { cliName, label: 'workspaces' },
86
86
  )
87
87
  }
@@ -1,9 +1,12 @@
1
1
  import chalk from 'chalk'
2
+ import path from 'node:path'
2
3
 
3
4
  import { printCommandFooter, printCommandHeader } from '../helpers/banner.mjs'
4
5
  import { CLI_PRIMARY_NAME } from '../helpers/cli-identity.mjs'
5
6
  import { getProjectRoot, readCliPackageJson } from '../helpers/project-root.mjs'
6
7
  import { auditTsconfigAlignment, syncProjectToolchain } from '../helpers/toolchain-config.mjs'
8
+ import { ensureTmpFile } from '../helpers/tmp-layout.mjs'
9
+ import { ensureTmpSchemaVersion } from '../helpers/tmp-schema-version.mjs'
7
10
  import { findEntries, findWorkspaceRoot } from '../helpers/workspace-resolve.mjs'
8
11
  import { syncCliRuntime } from '../helpers/project-artifacts.mjs'
9
12
  import { syncCoreDependency } from '../helpers/sync-core-dependency.mjs'
@@ -23,6 +26,12 @@ export function registerSyncCommand(cli, { cliName = CLI_PRIMARY_NAME } = {}) {
23
26
  console.log(chalk.gray(` workspace: ${workspaceRoot}`))
24
27
  console.log(chalk.gray(` entries: ${entries.length}`))
25
28
 
29
+ const wsTmp = path.join(workspaceRoot, 'tmp.yml')
30
+ if (!options.dryRun) {
31
+ const wsSchema = ensureTmpSchemaVersion(wsTmp)
32
+ if (wsSchema.patched) console.log(chalk.green(` outer tmp end.version → ${wsSchema.schemaVersion} (schema)`))
33
+ }
34
+
26
35
  if (entries.length === 0) {
27
36
  console.log(chalk.yellow('\n no linked projects under api/admin/web yet'))
28
37
  printCommandFooter({ version: coreVersion })
@@ -56,9 +65,13 @@ export function registerSyncCommand(cli, { cliName = CLI_PRIMARY_NAME } = {}) {
56
65
  ? chalk.gray(` would pin ${packageDefaults.packageName}@${coreVersion}`)
57
66
  : chalk.green(` pinned ${packageDefaults.packageName}@${coreVersion}`)
58
67
  console.log(label)
59
- } else if (core.reason === 'up-to-date') {
68
+ } else if (core.reason === 'up-to-date') {
60
69
  console.log(chalk.gray(` ${packageDefaults.packageName}@${coreVersion} (ok)`))
61
70
  }
71
+ if (!options.dryRun) {
72
+ const schema = ensureTmpSchemaVersion(entry.tmp)
73
+ if (schema.patched) console.log(chalk.green(` inner tmp end.version → ${schema.schemaVersion} (schema)`))
74
+ }
62
75
  } catch (error) {
63
76
  failed += 1
64
77
  console.log(chalk.red(` failed: ${error.message}`))
@@ -103,7 +116,10 @@ export function registerSyncCommand(cli, { cliName = CLI_PRIMARY_NAME } = {}) {
103
116
  return
104
117
  }
105
118
 
119
+ const layout = ensureTmpFile(root)
106
120
  const result = syncProjectToolchain(root, { write: true })
121
+ const schema = ensureTmpSchemaVersion(layout.tmpFilePath)
122
+ if (schema.patched) console.log(chalk.green(` tmp end.version → ${schema.schemaVersion} (schema)`))
107
123
  console.log(result.created
108
124
  ? chalk.green(` created ${result.tsconfigRel}`)
109
125
  : chalk.green(` updated ${result.tsconfigRel}`))
@@ -116,7 +132,7 @@ export function registerSyncCommand(cli, { cliName = CLI_PRIMARY_NAME } = {}) {
116
132
  cli
117
133
  .command('sync')
118
134
  .alias('sync-toolchain')
119
- .description('Sync toolchain from tmp.yml — single project or entire workspace')
135
+ .description('Sync tsconfig + @xrystal/core pin (workspace: all inner tmp projects + ~/.xrystal registry)')
120
136
  .option('--dry-run', 'Preview without writing')
121
137
  .action(run)
122
138
  }
@@ -0,0 +1,134 @@
1
+ import { execSync } from 'node:child_process'
2
+ import fs from 'node:fs'
3
+ import path from 'node:path'
4
+ import chalk from 'chalk'
5
+
6
+ import { printCommandFooter, printCommandHeader } from '../helpers/banner.mjs'
7
+ import { CLI_PRIMARY_NAME } from '../helpers/cli-identity.mjs'
8
+ import { readCliPackageJson } from '../helpers/project-root.mjs'
9
+ import {
10
+ ensureServiceTelepresenceEnv,
11
+ resolveTelepresenceServiceDir,
12
+ TELEPRESENCE_DEPLOYMENTS,
13
+ } from '../helpers/telepresence-layout.mjs'
14
+ import { findWorkspaceRoot } from '../helpers/workspace-resolve.mjs'
15
+
16
+ function resolveInfraHelper(name) {
17
+ const envRoot = process.env.XRYSTAL_INFRA_DIR ?? process.env.XRYSTAL_INFRA_ROOT
18
+ const candidates = [
19
+ envRoot,
20
+ path.resolve(process.cwd(), '../-infrastructure-'),
21
+ path.resolve(process.cwd(), '../../-infrastructure-'),
22
+ ].filter(Boolean)
23
+
24
+ for (const root of candidates) {
25
+ const script = path.join(root, 'scripts', 'helpers', name)
26
+ if (fs.existsSync(script)) return script
27
+ }
28
+ return null
29
+ }
30
+
31
+ function runHelper(scriptPath, args, { cwd } = {}) {
32
+ execSync(`bash "${scriptPath}" ${args.map((a) => JSON.stringify(a)).join(' ')}`, {
33
+ cwd: cwd ?? process.cwd(),
34
+ stdio: 'inherit',
35
+ env: process.env,
36
+ })
37
+ }
38
+
39
+ export function registerTelepresenceCommand(cli, { cliName = CLI_PRIMARY_NAME } = {}) {
40
+ const tp = cli
41
+ .command('telepresence')
42
+ .alias('tp')
43
+ .description('Local Telepresence intercept against cluster (dev/test)')
44
+ .addHelpText(
45
+ 'after',
46
+ `
47
+ ${chalk.gray('Examples:')}
48
+ ${cliName} telepresence connect
49
+ ${cliName} tp dev general
50
+ ${cliName} tp dev gateway 3000
51
+ ${cliName} telepresence quit
52
+
53
+ ${chalk.gray('Deploy names:')} ${TELEPRESENCE_DEPLOYMENTS.join(', ')}
54
+ ${chalk.gray('Set')} XRYSTAL_INFRA_DIR ${chalk.gray('to point at -infrastructure- repo (optional).')}
55
+ `,
56
+ )
57
+
58
+ tp
59
+ .command('connect')
60
+ .description('Connect local machine to cluster namespace (default NS=dev)')
61
+ .option('--ns <namespace>', 'Kubernetes namespace', 'dev')
62
+ .action((options) => {
63
+ const version = readCliPackageJson().version
64
+ printCommandHeader({ cliName, command: 'telepresence connect', version })
65
+ const script = resolveInfraHelper('telepresence-connect.sh')
66
+ if (!script) {
67
+ console.error(chalk.red('\n✗ telepresence-connect.sh not found — set XRYSTAL_INFRA_DIR\n'))
68
+ process.exit(1)
69
+ }
70
+ process.env.NS = options.ns
71
+ runHelper(script, [`NS=${options.ns}`])
72
+ printCommandFooter({ version })
73
+ })
74
+
75
+ tp
76
+ .command('quit')
77
+ .description('Disconnect Telepresence')
78
+ .action(() => {
79
+ const version = readCliPackageJson().version
80
+ printCommandHeader({ cliName, command: 'telepresence quit', version })
81
+ const script = resolveInfraHelper('telepresence-quit.sh')
82
+ if (!script) {
83
+ console.error(chalk.red('\n✗ telepresence-quit.sh not found — set XRYSTAL_INFRA_DIR\n'))
84
+ process.exit(1)
85
+ }
86
+ runHelper(script, [])
87
+ printCommandFooter({ version })
88
+ })
89
+
90
+ tp
91
+ .command('dev <deploy> [port]')
92
+ .description('Intercept cluster deployment and run local dev server')
93
+ .allowUnknownOption()
94
+ .action((deploy, port, _options, command) => {
95
+ const version = readCliPackageJson().version
96
+ const deployName = String(deploy ?? '').trim()
97
+ if (!TELEPRESENCE_DEPLOYMENTS.includes(deployName)) {
98
+ console.error(chalk.red(`\n✗ Unknown deploy "${deployName}"\n`))
99
+ console.error(chalk.gray(` Use: ${TELEPRESENCE_DEPLOYMENTS.join(', ')}\n`))
100
+ process.exit(1)
101
+ }
102
+
103
+ printCommandHeader({ cliName, command: `telepresence dev ${deployName}`, version })
104
+
105
+ const workspaceRoot = findWorkspaceRoot(process.cwd())
106
+ let svcDir = resolveTelepresenceServiceDir(workspaceRoot ?? process.cwd(), deployName)
107
+ if (!svcDir && workspaceRoot) {
108
+ svcDir = resolveTelepresenceServiceDir(path.dirname(workspaceRoot), deployName)
109
+ }
110
+ if (!svcDir) {
111
+ svcDir = process.cwd()
112
+ }
113
+
114
+ ensureServiceTelepresenceEnv(svcDir)
115
+ console.log(chalk.gray(` service: ${svcDir}`))
116
+ console.log(chalk.gray(` env: x/environments/.env.telepresence\n`))
117
+
118
+ const intercept = resolveInfraHelper('telepresence-intercept.sh')
119
+ if (!intercept) {
120
+ console.error(chalk.red('\n✗ telepresence-intercept.sh not found — set XRYSTAL_INFRA_DIR\n'))
121
+ process.exit(1)
122
+ }
123
+
124
+ const portArg = port && /^\d+$/.test(String(port)) ? String(port) : '3000'
125
+ const rest = command.args.slice(port && /^\d+$/.test(String(port)) ? 2 : 1)
126
+ const localCmd = rest.length ? rest : ['bun', 'run', 'dev']
127
+ const args = [deployName, portArg, '--', ...localCmd]
128
+
129
+ process.env.NS = process.env.NS ?? 'dev'
130
+ if (workspaceRoot) process.env.XRYSTAL_WORKSPACE = workspaceRoot
131
+ runHelper(intercept, args, { cwd: svcDir })
132
+ printCommandFooter({ version })
133
+ })
134
+ }
@@ -14,11 +14,12 @@ import {
14
14
  } from '../helpers/tmp-layout.mjs'
15
15
  import { formatLoaderSummary, summarizeLoaders } from '../helpers/tmp-config.mjs'
16
16
  import { packageDefaults } from '../helpers/package-defaults.mjs'
17
+ import { ensureTmpSchemaVersion, readTmpSchemaVersion } from '../helpers/tmp-schema-version.mjs'
17
18
 
18
19
  export function registerTmpCommand(cli, { cliName = CLI_PRIMARY_NAME } = {}) {
19
20
  cli
20
21
  .command('tmp')
21
- .description(`Ensure tmp.yml exists (seed from ${packageDefaults.packageName})`)
22
+ .description(`Ensure inner/outer tmp.yml exists (seed from ${packageDefaults.packageName})`)
22
23
  .option('--dry-run', 'Show target path without writing')
23
24
  .action((options) => {
24
25
  const root = getProjectRoot()
@@ -38,10 +39,18 @@ export function registerTmpCommand(cli, { cliName = CLI_PRIMARY_NAME } = {}) {
38
39
 
39
40
  const result = ensureTmpFile(root)
40
41
  const rel = relativeFromRoot(root, result.tmpFilePath)
42
+ const schema = ensureTmpSchemaVersion(result.tmpFilePath)
41
43
 
42
44
  printCommandHeader({ cliName, command: 'tmp', version })
43
45
  console.log(chalk.gray(` root: ${root}`))
44
46
  console.log(result.created ? chalk.green(` created ${rel}`) : chalk.gray(` ok ${rel}`))
47
+ const schemaVersion = readTmpSchemaVersion(result.tmpFilePath)
48
+ if (schemaVersion) {
49
+ const schemaLabel = schema.patched
50
+ ? chalk.green(` end.version → ${schemaVersion} (schema)`)
51
+ : chalk.gray(` end.version: ${schemaVersion} (schema)`)
52
+ console.log(schemaLabel)
53
+ }
45
54
 
46
55
  try {
47
56
  const tmp = yaml.parse(fs.readFileSync(result.tmpFilePath, 'utf8'))
@@ -14,6 +14,7 @@ var defaults_default = {
14
14
  cliBinFile: "main-cli.js",
15
15
  tmpBaseName: "tmp",
16
16
  tmpExtension: ".yml",
17
+ tmpSchemaVersion: 1,
17
18
  apiServiceTemplateRel: "x/templates/api-service/tmp.yml",
18
19
  templateRepoUri: "https://github.com/xdloper/api-gpt-svc",
19
20
  publicFolderName: "public",
@@ -9,6 +9,7 @@ var defaults_default = {
9
9
  cliBinFile: "main-cli.js",
10
10
  tmpBaseName: "tmp",
11
11
  tmpExtension: ".yml",
12
+ tmpSchemaVersion: 1,
12
13
  apiServiceTemplateRel: "x/templates/api-service/tmp.yml",
13
14
  templateRepoUri: "https://github.com/xdloper/api-gpt-svc",
14
15
  publicFolderName: "public",
@@ -20,6 +20,7 @@ var defaults_default = {
20
20
  cliBinFile: "main-cli.js",
21
21
  tmpBaseName: "tmp",
22
22
  tmpExtension: ".yml",
23
+ tmpSchemaVersion: 1,
23
24
  apiServiceTemplateRel: "x/templates/api-service/tmp.yml",
24
25
  templateRepoUri: "https://github.com/xdloper/api-gpt-svc",
25
26
  publicFolderName: "public",
@@ -380,6 +381,11 @@ configs:
380
381
  api: api
381
382
  admin: admin
382
383
  web: web
384
+
385
+ kubeconfig: ~/.kube/config
386
+
387
+ end:
388
+ version: 1
383
389
  `;
384
390
  }
385
391
  export {