@xrystal/core 3.52.5 → 3.52.7

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.
Files changed (40) hide show
  1. package/README.md +8 -2
  2. package/package.json +1 -1
  3. package/x/bin/commands/create.mjs +2 -4
  4. package/x/bin/commands/project-info.mjs +94 -0
  5. package/x/bin/commands/projects.mjs +1 -1
  6. package/x/bin/commands/sync.mjs +67 -101
  7. package/x/bin/commands/tmp.mjs +12 -9
  8. package/x/bin/helpers/.generated/seed-from-tmp.mjs +1 -0
  9. package/x/bin/helpers/.generated/tmp-schema.mjs +1 -0
  10. package/x/bin/helpers/.generated/workspace.mjs +3 -2
  11. package/x/bin/helpers/.generated/xrystal-home-registry.mjs +192 -44
  12. package/x/bin/helpers/cli-help.mjs +43 -13
  13. package/x/bin/helpers/project-context.mjs +147 -0
  14. package/x/bin/helpers/scaffold-service.mjs +2 -3
  15. package/x/bin/helpers/sync-project.mjs +76 -0
  16. package/x/bin/helpers/sync-scope.mjs +71 -0
  17. package/x/bin/helpers/tmp-config.mjs +25 -0
  18. package/x/bin/helpers/tmp-layout.mjs +2 -3
  19. package/x/bin/helpers/tmp-schema-version.mjs +46 -0
  20. package/x/bin/helpers/workspace-scaffold.mjs +4 -9
  21. package/x/bin/main-cli.js +10 -1
  22. package/x/dist/loader/kafka/index.js +7 -2
  23. package/x/dist/loader/logger/index.js +8 -6
  24. package/x/dist/loader/mongo/index.js +9 -0
  25. package/x/dist/loader/redis/index.js +9 -0
  26. package/x/dist/project/index.d.ts +1 -0
  27. package/x/dist/project/index.js +21 -14
  28. package/x/dist/utils/constants/defaults.json +1 -0
  29. package/x/dist/utils/helpers/loader-options/index.d.ts +5 -0
  30. package/x/dist/utils/helpers/loader-options/index.js +16 -0
  31. package/x/dist/utils/helpers/tmp/index.d.ts +1 -0
  32. package/x/dist/utils/helpers/tmp/index.js +1 -0
  33. package/x/dist/utils/helpers/tmp/loader-boot-plan.d.ts +10 -0
  34. package/x/dist/utils/helpers/tmp/loader-boot-plan.js +36 -0
  35. package/x/dist/utils/helpers/workspace/index.d.ts +1 -1
  36. package/x/dist/utils/helpers/workspace/index.js +2 -2
  37. package/x/templates/api-service/tmp.yml +7 -1
  38. package/x/templates/frontend/tmp.yml +61 -0
  39. package/x/tmp.yml +1 -1
  40. package/x/bin/helpers/tmp-end-version.mjs +0 -35
package/README.md CHANGED
@@ -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.5",
4
+ "version": "3.52.7",
5
5
  "description": "microservice runtime library",
6
6
  "publishConfig": {
7
7
  "access": "public",
@@ -61,14 +61,12 @@ export function registerCreateCommand(cli, { cliName = CLI_PRIMARY_NAME, runtime
61
61
  const version = readCliPackageJson().version
62
62
  printCommandHeader({ cliName, command: 'create (workspace)', version })
63
63
  const result = scaffoldWorkspace(targetPath, name, {
64
- coreVersion: version,
65
64
  installCommand,
66
65
  cliName,
67
66
  })
68
67
  console.log(chalk.green('\n✓ Workspace ready\n'))
69
68
  console.log(chalk.gray(` tmp: ${path.relative(process.cwd(), result.tmpPath) || result.tmpPath}`))
70
- console.log(chalk.gray(` end.version: ${version}`))
71
- console.log(chalk.gray(' folders: api/, admin/, web/'))
69
+ console.log(chalk.gray(' outer tmp: ./tmp.yml (workspace) · inner: each api|admin|web project'))
72
70
  if (result.general) {
73
71
  console.log(chalk.green(' api/general: monolith scaffold (gpt template)'))
74
72
  console.log(chalk.gray(` tmp: ${path.relative(process.cwd(), result.general.tmpFilePath) || result.general.tmpFilePath}`))
@@ -80,7 +78,7 @@ export function registerCreateCommand(cli, { cliName = CLI_PRIMARY_NAME, runtime
80
78
  syncRegistryFromPath(result.root)
81
79
  console.log(chalk.gray(' registered in ~/.xrystal'))
82
80
  } catch {}
83
- console.log(chalk.cyan(` ${cliName} sync`))
81
+ console.log(chalk.cyan(` ${cliName} sync --all`))
84
82
  console.log(chalk.cyan(` ${cliName} telepresence dev general`))
85
83
  printCommandFooter({ version })
86
84
  } catch (error) {
@@ -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
  }
@@ -3,137 +3,103 @@ import path from 'node:path'
3
3
 
4
4
  import { printCommandFooter, printCommandHeader } from '../helpers/banner.mjs'
5
5
  import { CLI_PRIMARY_NAME } from '../helpers/cli-identity.mjs'
6
- import { getProjectRoot, readCliPackageJson } from '../helpers/project-root.mjs'
7
- import { auditTsconfigAlignment, syncProjectToolchain } from '../helpers/toolchain-config.mjs'
6
+ import { readCliPackageJson } from '../helpers/project-root.mjs'
8
7
  import { ensureTmpFile } from '../helpers/tmp-layout.mjs'
9
- import { patchTmpEndVersion } from '../helpers/tmp-end-version.mjs'
10
- import { findEntries, findWorkspaceRoot } from '../helpers/workspace-resolve.mjs'
11
- import { syncCliRuntime } from '../helpers/project-artifacts.mjs'
12
- import { syncCoreDependency } from '../helpers/sync-core-dependency.mjs'
13
- import { packageDefaults } from '../helpers/package-defaults.mjs'
8
+ import { ensureTmpSchemaVersion } from '../helpers/tmp-schema-version.mjs'
14
9
  import { syncRegistryFromPath } from '../helpers/xrystal-registry.mjs'
10
+ import { resolveSyncScope } from '../helpers/sync-scope.mjs'
11
+ import { printSyncProjectResult, syncOneProject } from '../helpers/sync-project.mjs'
12
+ import { formatSyncHelp } from '../helpers/cli-help.mjs'
15
13
 
16
- /** Sync tsconfig include/outDir/@/* from project tmp.yml. */
14
+ /** Sync tsconfig + @xrystal/core pin from tmp.yml layout. */
17
15
  export function registerSyncCommand(cli, { cliName = CLI_PRIMARY_NAME } = {}) {
18
16
  const run = (options) => {
19
- const cwd = process.cwd()
20
- const workspaceRoot = findWorkspaceRoot(cwd)
21
17
  const coreVersion = readCliPackageJson().version
22
18
 
23
- if (workspaceRoot) {
24
- const entries = findEntries(workspaceRoot)
25
- printCommandHeader({ cliName, command: 'sync', version: coreVersion })
26
- console.log(chalk.gray(` workspace: ${workspaceRoot}`))
27
- console.log(chalk.gray(` entries: ${entries.length}`))
19
+ let scope
20
+ try {
21
+ scope = resolveSyncScope(process.cwd(), { ...options, cliName })
22
+ } catch (error) {
23
+ console.error(chalk.red(`\n✗ ${error.message}\n`))
24
+ process.exit(1)
25
+ }
26
+
27
+ printCommandHeader({ cliName, command: 'sync', version: coreVersion })
28
+ console.log(chalk.gray(` scope: ${scope.label} (${scope.mode})`))
29
+ if (scope.workspaceRoot) {
30
+ console.log(chalk.gray(` workspace: ${scope.workspaceRoot}`))
31
+ }
32
+ console.log(chalk.gray(` projects: ${scope.entries.length}`))
28
33
 
29
- const wsTmp = path.join(workspaceRoot, 'tmp.yml')
34
+ if (scope.mode === 'workspace-all' && scope.workspaceRoot) {
35
+ const wsTmp = path.join(scope.workspaceRoot, 'tmp.yml')
30
36
  if (!options.dryRun) {
31
- const wsEnd = patchTmpEndVersion(wsTmp, coreVersion)
32
- if (wsEnd.patched) console.log(chalk.green(` workspace end.version → ${coreVersion}`))
37
+ const wsSchema = ensureTmpSchemaVersion(wsTmp)
38
+ if (wsSchema.patched) {
39
+ console.log(chalk.green(` outer tmp end.version → ${wsSchema.schemaVersion} (schema)`))
40
+ }
33
41
  }
42
+ }
34
43
 
35
- if (entries.length === 0) {
36
- console.log(chalk.yellow('\n no linked projects under api/admin/web yet'))
37
- printCommandFooter({ version: coreVersion })
38
- return
44
+ if (scope.entries.length === 0) {
45
+ console.log(chalk.yellow('\n no projects to sync'))
46
+ if (scope.mode === 'workspace-all') {
47
+ console.log(chalk.gray(' link services under api/ admin/ web/ then re-run'))
39
48
  }
49
+ printCommandFooter({ version: coreVersion })
50
+ return
51
+ }
40
52
 
41
- let failed = 0
42
- for (const entry of entries) {
43
- console.log(chalk.cyan(`\n→ ${entry.name} (${entry.type})`))
44
- console.log(chalk.gray(` path: ${entry.path}`))
45
- if (options.dryRun) {
46
- const preview = syncProjectToolchain(entry.path, { write: false })
47
- console.log(chalk.gray(` would update ${preview.tsconfigRel ?? 'tsconfig.json'}`))
48
- const core = syncCoreDependency(entry.path, coreVersion, { dryRun: true })
49
- if (core.synced) {
50
- console.log(chalk.gray(` would pin ${packageDefaults.packageName}@${coreVersion} (from ${core.current ?? core.declared})`))
51
- } else if (core.reason === 'up-to-date') {
52
- console.log(chalk.gray(` ${packageDefaults.packageName}@${coreVersion} (ok)`))
53
- }
54
- continue
55
- }
56
- try {
57
- syncCliRuntime(entry.path, { force: false })
58
- const result = syncProjectToolchain(entry.path, { write: true })
59
- console.log(result.created
60
- ? chalk.green(` created ${result.tsconfigRel}`)
61
- : chalk.green(` updated ${result.tsconfigRel}`))
62
- const core = syncCoreDependency(entry.path, coreVersion, { dryRun: options.dryRun })
63
- if (core.synced) {
64
- const label = options.dryRun
65
- ? chalk.gray(` would pin ${packageDefaults.packageName}@${coreVersion}`)
66
- : chalk.green(` pinned ${packageDefaults.packageName}@${coreVersion}`)
67
- console.log(label)
68
- } else if (core.reason === 'up-to-date') {
69
- console.log(chalk.gray(` ${packageDefaults.packageName}@${coreVersion} (ok)`))
70
- }
71
- if (!options.dryRun) {
72
- const end = patchTmpEndVersion(entry.tmp, coreVersion)
73
- if (end.patched) console.log(chalk.green(` end.version → ${coreVersion}`))
74
- }
75
- } catch (error) {
76
- failed += 1
77
- console.log(chalk.red(` failed: ${error.message}`))
78
- }
53
+ let failed = 0
54
+ for (const entry of scope.entries) {
55
+ if (options.dryRun) {
56
+ const preview = syncOneProject(entry, coreVersion, { dryRun: true, tmpPath: entry.tmp ?? null })
57
+ printSyncProjectResult(preview)
58
+ continue
59
+ }
60
+
61
+ let tmpPath = entry.tmp ?? null
62
+ if (!tmpPath && scope.mode === 'standalone') {
63
+ tmpPath = ensureTmpFile(entry.path).tmpFilePath
79
64
  }
65
+
66
+ const result = syncOneProject(entry, coreVersion, { dryRun: false, tmpPath })
67
+ printSyncProjectResult(result)
68
+ if (result.failed) failed += 1
69
+ }
70
+
71
+ if (scope.mode === 'workspace-all' && scope.workspaceRoot && !options.dryRun) {
80
72
  try {
81
- syncRegistryFromPath(workspaceRoot)
82
- console.log(chalk.gray(' registry updated (~/.xrystal)'))
73
+ syncRegistryFromPath(scope.workspaceRoot)
74
+ console.log(chalk.gray('\n registry updated (~/.xrystal)'))
83
75
  } catch (error) {
84
- console.log(chalk.yellow(` registry skipped: ${error.message}`))
85
- }
86
- if (failed) {
87
- console.log(chalk.red(`\n sync finished with ${failed} error(s)`))
88
- printCommandFooter({ version: coreVersion })
89
- process.exit(1)
76
+ console.log(chalk.yellow(`\n registry skipped: ${error.message}`))
90
77
  }
91
- console.log(chalk.green('\n workspace sync done'))
92
- printCommandFooter({ version: coreVersion })
93
- return
94
78
  }
95
79
 
96
- const root = getProjectRoot()
97
- const auditBefore = auditTsconfigAlignment(root)
98
-
99
- printCommandHeader({ cliName, command: 'sync', version: coreVersion })
100
- console.log(chalk.gray(` root: ${root}`))
101
-
102
- const lo = auditBefore.layoutOptions ?? {}
103
- console.log(chalk.gray(' from tmp.yml:'))
104
- console.log(chalk.gray(` paths.root: ${lo.rootFolderPath ?? '—'}`))
105
- console.log(chalk.gray(` paths.source: ${lo.mainFolderPath ?? '—'}`))
106
- console.log(chalk.gray(` paths.special.dist: ${lo.pathsDist ?? '—'}`))
80
+ if (scope.hintAll) {
81
+ console.log(chalk.dim(`\n tip: ${scope.hintAll}`))
82
+ }
107
83
 
108
- if (options.dryRun) {
109
- const preview = syncProjectToolchain(root, { write: false })
110
- console.log(chalk.gray('\n would write tsconfig.json:'))
111
- console.log(chalk.gray(` include: ${JSON.stringify(preview.merged.include)}`))
112
- console.log(chalk.gray(` outDir: ${preview.merged.compilerOptions.outDir}`))
113
- console.log(chalk.gray(` paths: ${JSON.stringify(preview.merged.compilerOptions.paths)}`))
114
- console.log(chalk.gray(`\n bunfig → ${preview.paths.bunfigAliasLine}`))
84
+ if (failed) {
85
+ console.log(chalk.red(`\n sync finished with ${failed} error(s)`))
115
86
  printCommandFooter({ version: coreVersion })
116
- return
87
+ process.exit(1)
117
88
  }
118
89
 
119
- const result = syncProjectToolchain(root, { write: true })
120
- const layout = ensureTmpFile(root)
121
- const end = patchTmpEndVersion(layout.tmpFilePath, coreVersion)
122
- if (end.patched) console.log(chalk.green(` end.version → ${coreVersion}`))
123
- console.log(result.created
124
- ? chalk.green(` created ${result.tsconfigRel}`)
125
- : chalk.green(` updated ${result.tsconfigRel}`))
126
- console.log(chalk.gray(` include → ${JSON.stringify(result.merged.include)}`))
127
- console.log(chalk.gray(` outDir → ${result.merged.compilerOptions.outDir}`))
128
- console.log(chalk.yellow(`\n bunfig.toml [resolve.alias]: ${result.paths.bunfigAliasLine}`))
90
+ console.log(chalk.green('\n sync done'))
129
91
  printCommandFooter({ version: coreVersion })
130
92
  }
131
93
 
132
94
  cli
133
95
  .command('sync')
134
96
  .alias('sync-toolchain')
135
- .description('Sync toolchain from tmp.yml — single project or entire workspace')
97
+ .description('Sync tsconfig + @xrystal/core for current project (use --all inside a workspace for every link)')
136
98
  .option('--dry-run', 'Preview without writing')
99
+ .option('--self', 'Inside a workspace: sync only the current linked project')
100
+ .option('--all', 'Inside a workspace: sync all api/admin/web linked projects + registry')
101
+ .option('--workspace', 'Alias for --all')
102
+ .addHelpText('after', () => formatSyncHelp({ cliName }))
137
103
  .action(run)
138
104
  }
139
105
 
@@ -14,12 +14,13 @@ 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 { patchTmpEndVersion, readTmpEndVersion } from '../helpers/tmp-end-version.mjs'
17
+ import { ensureTmpSchemaVersion, readTmpSchemaVersion } from '../helpers/tmp-schema-version.mjs'
18
+ import { resolveProjectContext } from '../helpers/project-context.mjs'
18
19
 
19
20
  export function registerTmpCommand(cli, { cliName = CLI_PRIMARY_NAME } = {}) {
20
21
  cli
21
22
  .command('tmp')
22
- .description(`Ensure tmp.yml exists (seed from ${packageDefaults.packageName})`)
23
+ .description(`Ensure inner/outer tmp.yml exists (seed from ${packageDefaults.packageName})`)
23
24
  .option('--dry-run', 'Show target path without writing')
24
25
  .action((options) => {
25
26
  const root = getProjectRoot()
@@ -39,17 +40,19 @@ export function registerTmpCommand(cli, { cliName = CLI_PRIMARY_NAME } = {}) {
39
40
 
40
41
  const result = ensureTmpFile(root)
41
42
  const rel = relativeFromRoot(root, result.tmpFilePath)
42
- const endPatch = patchTmpEndVersion(result.tmpFilePath, version)
43
+ const schema = ensureTmpSchemaVersion(result.tmpFilePath)
43
44
 
45
+ const ctx = resolveProjectContext()
44
46
  printCommandHeader({ cliName, command: 'tmp', version })
47
+ console.log(chalk.gray(` scope: ${ctx.label}`))
45
48
  console.log(chalk.gray(` root: ${root}`))
46
49
  console.log(result.created ? chalk.green(` created ${rel}`) : chalk.gray(` ok ${rel}`))
47
- const endVersion = readTmpEndVersion(result.tmpFilePath)
48
- if (endVersion) {
49
- const endLabel = endPatch.patched
50
- ? chalk.green(` end.version → ${endVersion}`)
51
- : chalk.gray(` end.version: ${endVersion}`)
52
- console.log(endLabel)
50
+ const schemaVersion = readTmpSchemaVersion(result.tmpFilePath)
51
+ if (schemaVersion) {
52
+ const schemaLabel = schema.patched
53
+ ? chalk.green(` end.version → ${schemaVersion} (schema)`)
54
+ : chalk.gray(` end.version: ${schemaVersion} (schema)`)
55
+ console.log(schemaLabel)
53
56
  }
54
57
 
55
58
  try {
@@ -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",
@@ -362,7 +363,7 @@ function readWorkspaceGlobalTmp(workspaceRoot) {
362
363
  return match ? { fileWatchIntervalMs: Number(match[1]) } : {};
363
364
  }
364
365
  var readWorkspaceCoreTmp = readWorkspaceGlobalTmp;
365
- function workspaceTmpTemplate(projectName, coreVersion = "0.0.0") {
366
+ function workspaceTmpTemplate(projectName) {
366
367
  return `project:
367
368
  name: ${projectName}
368
369
 
@@ -384,7 +385,7 @@ configs:
384
385
  kubeconfig: ~/.kube/config
385
386
 
386
387
  end:
387
- version: ${coreVersion}
388
+ version: 1
388
389
  `;
389
390
  }
390
391
  export {