@xrystal/core 3.55.68 → 3.55.69
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/package.json
CHANGED
|
@@ -116,7 +116,7 @@ export function registerTelepresenceCommand(cli, { cliName = CLI_PRIMARY_NAME }
|
|
|
116
116
|
${cliName} tp install
|
|
117
117
|
|
|
118
118
|
${chalk.gray('start/stop')} = connect / quit session
|
|
119
|
-
${chalk.gray('intercept')} = omit deploy in service repo →
|
|
119
|
+
${chalk.gray('intercept')} = omit deploy in service repo → configs.service.name from x/tmp.yml
|
|
120
120
|
${chalk.gray('--ns')} = Kubernetes namespace (default: dev)
|
|
121
121
|
${chalk.gray('<deploy>')} = optional — ${TELEPRESENCE_DEPLOYMENTS.join(', ')}
|
|
122
122
|
${chalk.gray('kubeconfig:')} workspace tmp.yml, KUBECONFIG, data/k3s/cluster.kubeconfig
|
|
@@ -148,7 +148,7 @@ export function registerTelepresenceCommand(cli, { cliName = CLI_PRIMARY_NAME }
|
|
|
148
148
|
tp.command('intercept')
|
|
149
149
|
.alias('dev')
|
|
150
150
|
.description('Intercept deployment → local process (deploy optional in service repo)')
|
|
151
|
-
.argument('[deploy]', `Deployment name (default:
|
|
151
|
+
.argument('[deploy]', `Deployment name (default: configs.service.name in x/tmp.yml) — ${TELEPRESENCE_DEPLOYMENTS.join(', ')}`)
|
|
152
152
|
.argument('[port]', 'Local listen port', '3000')
|
|
153
153
|
.option('--ns <namespace>', 'Kubernetes namespace', 'dev')
|
|
154
154
|
.allowUnknownOption()
|
|
@@ -369,7 +369,7 @@ function assertNoLegacyTmpKeys(configs) {
|
|
|
369
369
|
throw new Error(`${defaults_default.packageName}: configs.depends.loaders.build removed — use configs.global.build`);
|
|
370
370
|
}
|
|
371
371
|
if (isRecord2(configs?.cluster)) {
|
|
372
|
-
throw new Error(`${defaults_default.packageName}: configs.cluster removed — deployment name is
|
|
372
|
+
throw new Error(`${defaults_default.packageName}: configs.cluster removed — deployment name is configs.service.name (CLI --deployment overrides)`);
|
|
373
373
|
}
|
|
374
374
|
const global = isRecord2(configs?.global) ? configs.global : {};
|
|
375
375
|
if ("fileWatchIntervalMs" in global && global.fileWatchIntervalMs !== undefined && global.fileWatchIntervalMs !== null) {
|
|
@@ -400,6 +400,11 @@ function resolveTmpLoaders(configs) {
|
|
|
400
400
|
}
|
|
401
401
|
function resolveTmpDeploymentName(tmp) {
|
|
402
402
|
assertNoLegacyTmpKeys(isRecord2(tmp?.configs) ? tmp.configs : undefined);
|
|
403
|
+
const configs = isRecord2(tmp?.configs) ? tmp.configs : {};
|
|
404
|
+
const service = isRecord2(configs.service) ? configs.service : {};
|
|
405
|
+
const serviceName = typeof service.name === "string" ? service.name.trim() : undefined;
|
|
406
|
+
if (serviceName)
|
|
407
|
+
return serviceName;
|
|
403
408
|
const project = isRecord2(tmp?.project) ? tmp.project : {};
|
|
404
409
|
const projectName = typeof project.name === "string" ? project.name.trim() : undefined;
|
|
405
410
|
return projectName || undefined;
|
|
@@ -53,7 +53,7 @@ function commandGroups() {
|
|
|
53
53
|
{ cmd: 'watch install', desc: 'OS service — survives reboot (launchd / systemd user)' },
|
|
54
54
|
{ cmd: 'tp start --ns dev', aliases: 'tp connect', desc: 'Connect Telepresence to cluster namespace' },
|
|
55
55
|
{ cmd: 'tp stop', aliases: 'tp quit', desc: 'Disconnect Telepresence' },
|
|
56
|
-
{ cmd: 'tp intercept [deploy] --ns dev', aliases: 'tp dev', desc: 'Intercept — omit deploy in service repo (uses x/tmp.yml
|
|
56
|
+
{ cmd: 'tp intercept [deploy] --ns dev', aliases: 'tp dev', desc: 'Intercept — omit deploy in service repo (uses x/tmp.yml configs.service.name)' },
|
|
57
57
|
{ cmd: 'telepresence install', aliases: 'tp install', desc: 'Install Telepresence OSS client (~2.31.x)' },
|
|
58
58
|
],
|
|
59
59
|
},
|
|
@@ -3,6 +3,8 @@ import path from 'node:path'
|
|
|
3
3
|
|
|
4
4
|
import yaml from 'yaml'
|
|
5
5
|
|
|
6
|
+
import { resolveTmpDeploymentName } from './tmp-schema.mjs'
|
|
7
|
+
|
|
6
8
|
const TELEPRESENCE_ENV_EXAMPLE = `# Telepresence intercept env — copied to x/environments/.env.telepresence per service
|
|
7
9
|
# Used by: telepresence intercept --env-file .env.telepresence
|
|
8
10
|
NS=dev
|
|
@@ -38,7 +40,7 @@ export function ensureServiceTelepresenceEnv(serviceRoot) {
|
|
|
38
40
|
return { envPath, envRel: SERVICE_TELEPRESENCE_ENV_REL, created }
|
|
39
41
|
}
|
|
40
42
|
|
|
41
|
-
/** Deploy name (
|
|
43
|
+
/** Deploy name (configs.service.name) → workspace api folder name */
|
|
42
44
|
export const TELEPRESENCE_DEPLOYMENTS = Object.freeze([
|
|
43
45
|
'general',
|
|
44
46
|
'gateway',
|
|
@@ -62,7 +64,7 @@ export function findServiceRootFromCwd(cwd = process.cwd()) {
|
|
|
62
64
|
return null
|
|
63
65
|
}
|
|
64
66
|
|
|
65
|
-
/**
|
|
67
|
+
/** configs.service.name from inner x/tmp.yml — must match TELEPRESENCE_DEPLOYMENTS. */
|
|
66
68
|
export function readDeployNameFromServiceRoot(serviceRoot) {
|
|
67
69
|
const tmpPath = path.join(path.resolve(serviceRoot), 'x', 'tmp.yml')
|
|
68
70
|
if (!fs.existsSync(tmpPath)) return null
|
|
@@ -72,11 +74,11 @@ export function readDeployNameFromServiceRoot(serviceRoot) {
|
|
|
72
74
|
} catch {
|
|
73
75
|
return null
|
|
74
76
|
}
|
|
75
|
-
const name =
|
|
77
|
+
const name = resolveTmpDeploymentName(doc)
|
|
76
78
|
if (!name) return null
|
|
77
79
|
if (!TELEPRESENCE_DEPLOYMENTS.includes(name)) {
|
|
78
80
|
throw new Error(
|
|
79
|
-
`tmp
|
|
81
|
+
`tmp configs.service.name "${name}" is not a known deploy (${TELEPRESENCE_DEPLOYMENTS.join(', ')}).`,
|
|
80
82
|
)
|
|
81
83
|
}
|
|
82
84
|
return name
|
|
@@ -178,7 +178,7 @@ export function assertNoLegacyTmpKeys(configs) {
|
|
|
178
178
|
throw new Error(`${defaults.packageName}: configs.depends.loaders.build removed — use configs.global.build`);
|
|
179
179
|
}
|
|
180
180
|
if (isRecord(configs?.cluster)) {
|
|
181
|
-
throw new Error(`${defaults.packageName}: configs.cluster removed — deployment name is
|
|
181
|
+
throw new Error(`${defaults.packageName}: configs.cluster removed — deployment name is configs.service.name (CLI --deployment overrides)`);
|
|
182
182
|
}
|
|
183
183
|
const global = isRecord(configs?.global) ? configs.global : {};
|
|
184
184
|
if ('fileWatchIntervalMs' in global && global.fileWatchIntervalMs !== undefined && global.fileWatchIntervalMs !== null) {
|
|
@@ -210,6 +210,11 @@ export function resolveTmpLoaders(configs) {
|
|
|
210
210
|
}
|
|
211
211
|
export function resolveTmpDeploymentName(tmp) {
|
|
212
212
|
assertNoLegacyTmpKeys(isRecord(tmp?.configs) ? tmp.configs : undefined);
|
|
213
|
+
const configs = isRecord(tmp?.configs) ? tmp.configs : {};
|
|
214
|
+
const service = isRecord(configs.service) ? configs.service : {};
|
|
215
|
+
const serviceName = typeof service.name === 'string' ? service.name.trim() : undefined;
|
|
216
|
+
if (serviceName)
|
|
217
|
+
return serviceName;
|
|
213
218
|
const project = isRecord(tmp?.project) ? tmp.project : {};
|
|
214
219
|
const projectName = typeof project.name === 'string' ? project.name.trim() : undefined;
|
|
215
220
|
return projectName || undefined;
|