@xrystal/core 3.55.67 → 3.55.68
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
|
@@ -268,9 +268,22 @@ bun run dev
|
|
|
268
268
|
**Docker / Compose:** Image `CMD ["bun", "xry", "start"]` (dev: `xry dev`). Runtime skips `x/environments` when `/.dockerenv` or k8s is detected (optional override: `XRY_RUNTIME=container|docker|k8s`). Compose: `env_file:` on `x/docker/docker-compose*.yml` — not `COPY` env into the image.
|
|
269
269
|
| `xry test` | Run `x/tests` | `x/tests` çalıştır |
|
|
270
270
|
| `xry doctor` | CLI, runtime, package health | CLI, runtime, paket uyumu |
|
|
271
|
-
| `xry tag` |
|
|
272
|
-
| `bun run release:patch` | SemVer
|
|
273
|
-
| `bun run release:minor` |
|
|
271
|
+
| `xry tag` | Core → npm publish · service → `v<CalVer>` git tag | Core npm · servis GHCR tag |
|
|
272
|
+
| `bun run release:patch` | Core SemVer patch · service CalVer (+pN) | Core patch · servis CalVer patch |
|
|
273
|
+
| `bun run release:minor` | **Core only** (`-xrystal-core`) | **Sadece core** |
|
|
274
|
+
| `bun run release:major` | **Core only** | **Sadece core** |
|
|
275
|
+
|
|
276
|
+
### Release scripts (general — tek kaynak)
|
|
277
|
+
|
|
278
|
+
| Repo | `package.json` scripts | Bump |
|
|
279
|
+
|---|---|---|
|
|
280
|
+
| **`-xrystal-core`** | `release:patch`, `release:minor`, `release:major`, `tag` | SemVer |
|
|
281
|
+
| **`api-*-svc`** (deployed) | `release:patch`, `tag` | CalVer (branch → UTC + `pN`) |
|
|
282
|
+
| **`api-gpt-svc`** (template, no cluster deploy) | `release:patch`, `minor`, `major`, `tag` | SemVer **or** CalVer — `version` şekline göre CLI |
|
|
283
|
+
|
|
284
|
+
**EN:** Deployed services: patch + tag only. **`api-gpt-svc`** is the full script template (minor/major when `package.json` is SemVer; CalVer repos use patch only in practice).
|
|
285
|
+
|
|
286
|
+
**TR:** Canlı servis: `bun run release:patch` → commit → `bun run tag`. Yeni servis / örnek: `api-gpt-svc` `package.json` scripts bloğunu kopyala.
|
|
274
287
|
|
|
275
288
|
---
|
|
276
289
|
|
|
@@ -879,9 +892,9 @@ class ChatController extends Controller {
|
|
|
879
892
|
|
|
880
893
|
## Maintainer note / Geliştirici notu
|
|
881
894
|
|
|
882
|
-
**EN:**
|
|
895
|
+
**EN:** See **Release scripts (general)**. CalVer npm script örneği yalnız **`api-gpt-svc`** template’inde.
|
|
883
896
|
|
|
884
897
|
|
|
885
898
|
**npm CI (`E401` / invalid token):** GitHub → repo **Settings → Environments → NPM** → secret **`TOKEN`** = [npm Granular Access Token](https://www.npmjs.com/settings/~youruser/tokens) with **Publish** on package `@xrystal/core` (or whole `@xrystal` scope). Classic automation tokens that bypass 2FA are being restricted — prefer **Granular** + **Publish**. After rotate: re-run failed **Publish Core Library NPM** workflow or push empty commit / re-tag. Stage flow: workflow runs `npm stage publish` → approve on npmjs.com (`npm stage list` / Approve with 2FA).
|
|
886
899
|
|
|
887
|
-
**TR:**
|
|
900
|
+
**TR:** Yukarıdaki genel tablo. Serviste `release:minor|major` yok — yalnız CalVer patch.
|
package/package.json
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
} from '../helpers/telepresence-runtime.mjs'
|
|
14
14
|
import {
|
|
15
15
|
ensureServiceTelepresenceEnv,
|
|
16
|
+
resolveTelepresenceDeployFromCwd,
|
|
16
17
|
resolveTelepresenceServiceDir,
|
|
17
18
|
TELEPRESENCE_DEPLOYMENTS,
|
|
18
19
|
} from '../helpers/telepresence-layout.mjs'
|
|
@@ -32,6 +33,73 @@ function parsePort(value) {
|
|
|
32
33
|
return value && /^\d+$/.test(String(value)) ? String(value) : '3000'
|
|
33
34
|
}
|
|
34
35
|
|
|
36
|
+
function resolveInterceptTarget(deploy, port, command) {
|
|
37
|
+
let deployName = String(deploy ?? '').trim()
|
|
38
|
+
let portArg = '3000'
|
|
39
|
+
|
|
40
|
+
if (deployName && /^\d+$/.test(deployName)) {
|
|
41
|
+
portArg = deployName
|
|
42
|
+
deployName = ''
|
|
43
|
+
}
|
|
44
|
+
if (port !== undefined && port !== null && String(port).trim() !== '') {
|
|
45
|
+
if (/^\d+$/.test(String(port))) {
|
|
46
|
+
portArg = String(port)
|
|
47
|
+
} else if (!deployName) {
|
|
48
|
+
deployName = String(port).trim()
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
let serviceRootHint = null
|
|
53
|
+
if (!deployName) {
|
|
54
|
+
const resolved = resolveTelepresenceDeployFromCwd(process.cwd())
|
|
55
|
+
deployName = resolved.deploy
|
|
56
|
+
serviceRootHint = resolved.serviceRoot
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (!TELEPRESENCE_DEPLOYMENTS.includes(deployName)) {
|
|
60
|
+
console.error(chalk.red(`\n✗ Unknown deploy "${deployName}"\n`))
|
|
61
|
+
console.error(chalk.gray(` Use: ${TELEPRESENCE_DEPLOYMENTS.join(', ')}\n`))
|
|
62
|
+
process.exit(1)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return { deployName, portArg, serviceRootHint }
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function resolveLocalCmd(command) {
|
|
69
|
+
const raw = command?.args ?? []
|
|
70
|
+
let offset = 0
|
|
71
|
+
const first = raw[0] != null ? String(raw[0]).trim() : ''
|
|
72
|
+
const second = raw[1] != null ? String(raw[1]).trim() : ''
|
|
73
|
+
if (first && (TELEPRESENCE_DEPLOYMENTS.includes(first) || /^\d+$/.test(first))) offset++
|
|
74
|
+
if (second && /^\d+$/.test(second)) offset++
|
|
75
|
+
return raw.length > offset ? raw.slice(offset) : ['xry', 'dev']
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function runConnect(options, { cliName, commandLabel }) {
|
|
79
|
+
const version = readCliPackageJson().version
|
|
80
|
+
printCommandHeader({ cliName, command: commandLabel, version })
|
|
81
|
+
try {
|
|
82
|
+
const code = connectTelepresence({ ns: options.ns, cwd: process.cwd() })
|
|
83
|
+
if (code !== 0) process.exit(code)
|
|
84
|
+
} catch (err) {
|
|
85
|
+
console.error(chalk.red(`\n✗ ${err.message}\n`))
|
|
86
|
+
process.exit(1)
|
|
87
|
+
}
|
|
88
|
+
printCommandFooter({ version })
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function runQuit({ cliName, commandLabel }) {
|
|
92
|
+
const version = readCliPackageJson().version
|
|
93
|
+
printCommandHeader({ cliName, command: commandLabel, version })
|
|
94
|
+
try {
|
|
95
|
+
quitTelepresence()
|
|
96
|
+
} catch (err) {
|
|
97
|
+
console.error(chalk.red(`\n✗ ${err.message}\n`))
|
|
98
|
+
process.exit(1)
|
|
99
|
+
}
|
|
100
|
+
printCommandFooter({ version })
|
|
101
|
+
}
|
|
102
|
+
|
|
35
103
|
export function registerTelepresenceCommand(cli, { cliName = CLI_PRIMARY_NAME } = {}) {
|
|
36
104
|
const tp = cli
|
|
37
105
|
.command('telepresence')
|
|
@@ -41,48 +109,31 @@ export function registerTelepresenceCommand(cli, { cliName = CLI_PRIMARY_NAME }
|
|
|
41
109
|
'after',
|
|
42
110
|
`
|
|
43
111
|
${chalk.gray('Examples:')}
|
|
44
|
-
${cliName} tp
|
|
45
|
-
${cliName} tp intercept
|
|
46
|
-
${cliName} tp
|
|
47
|
-
${cliName}
|
|
112
|
+
${cliName} tp start --ns dev
|
|
113
|
+
${cliName} tp intercept
|
|
114
|
+
${cliName} tp intercept gateway 3000 --ns dev
|
|
115
|
+
${cliName} tp stop
|
|
48
116
|
${cliName} tp install
|
|
49
117
|
|
|
50
|
-
${chalk.gray('
|
|
118
|
+
${chalk.gray('start/stop')} = connect / quit session
|
|
119
|
+
${chalk.gray('intercept')} = omit deploy in service repo → project.name from x/tmp.yml
|
|
51
120
|
${chalk.gray('--ns')} = Kubernetes namespace (default: dev)
|
|
52
|
-
${chalk.gray('<deploy>')} = ${TELEPRESENCE_DEPLOYMENTS.join(', ')}
|
|
121
|
+
${chalk.gray('<deploy>')} = optional — ${TELEPRESENCE_DEPLOYMENTS.join(', ')}
|
|
53
122
|
${chalk.gray('kubeconfig:')} workspace tmp.yml, KUBECONFIG, data/k3s/cluster.kubeconfig
|
|
54
123
|
`,
|
|
55
124
|
)
|
|
56
125
|
|
|
57
|
-
|
|
58
|
-
.
|
|
59
|
-
|
|
60
|
-
.action((options) => {
|
|
61
|
-
const version = readCliPackageJson().version
|
|
62
|
-
printCommandHeader({ cliName, command: 'telepresence connect', version })
|
|
63
|
-
try {
|
|
64
|
-
const code = connectTelepresence({ ns: options.ns, cwd: process.cwd() })
|
|
65
|
-
if (code !== 0) process.exit(code)
|
|
66
|
-
} catch (err) {
|
|
67
|
-
console.error(chalk.red(`\n✗ ${err.message}\n`))
|
|
68
|
-
process.exit(1)
|
|
69
|
-
}
|
|
70
|
-
printCommandFooter({ version })
|
|
126
|
+
const connectOptions = (cmd) =>
|
|
127
|
+
cmd.option('--ns <namespace>', 'Kubernetes namespace', 'dev').action((options) => {
|
|
128
|
+
runConnect(options, { cliName, commandLabel: 'tp start' })
|
|
71
129
|
})
|
|
72
130
|
|
|
73
|
-
tp.command('
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
quitTelepresence()
|
|
80
|
-
} catch (err) {
|
|
81
|
-
console.error(chalk.red(`\n✗ ${err.message}\n`))
|
|
82
|
-
process.exit(1)
|
|
83
|
-
}
|
|
84
|
-
printCommandFooter({ version })
|
|
85
|
-
})
|
|
131
|
+
connectOptions(tp.command('start').description('Connect Telepresence to cluster (alias: connect)').alias('connect'))
|
|
132
|
+
|
|
133
|
+
tp.command('stop')
|
|
134
|
+
.description('Disconnect Telepresence (alias: quit)')
|
|
135
|
+
.alias('quit')
|
|
136
|
+
.action(() => runQuit({ cliName, commandLabel: 'tp stop' }))
|
|
86
137
|
|
|
87
138
|
tp.command('install')
|
|
88
139
|
.description('Install Telepresence OSS client (~2.31.x, matches cluster chart)')
|
|
@@ -96,27 +147,24 @@ export function registerTelepresenceCommand(cli, { cliName = CLI_PRIMARY_NAME }
|
|
|
96
147
|
|
|
97
148
|
tp.command('intercept')
|
|
98
149
|
.alias('dev')
|
|
99
|
-
.description('Intercept
|
|
100
|
-
.argument('
|
|
150
|
+
.description('Intercept deployment → local process (deploy optional in service repo)')
|
|
151
|
+
.argument('[deploy]', `Deployment name (default: project.name in x/tmp.yml) — ${TELEPRESENCE_DEPLOYMENTS.join(', ')}`)
|
|
101
152
|
.argument('[port]', 'Local listen port', '3000')
|
|
102
153
|
.option('--ns <namespace>', 'Kubernetes namespace', 'dev')
|
|
103
154
|
.allowUnknownOption()
|
|
104
155
|
.allowExcessArguments()
|
|
105
156
|
.action((deploy, port, options, command) => {
|
|
106
157
|
const version = readCliPackageJson().version
|
|
107
|
-
const deployName = String(deploy ?? '').trim()
|
|
108
158
|
const ns = String(options.ns ?? 'dev').trim() || 'dev'
|
|
159
|
+
const { deployName, portArg, serviceRootHint } = resolveInterceptTarget(deploy, port, command)
|
|
160
|
+
const localCmd = resolveLocalCmd(command)
|
|
109
161
|
|
|
110
|
-
|
|
111
|
-
console.error(chalk.red(`\n✗ Unknown deploy "${deployName}"\n`))
|
|
112
|
-
console.error(chalk.gray(` Use: ${TELEPRESENCE_DEPLOYMENTS.join(', ')}\n`))
|
|
113
|
-
process.exit(1)
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
printCommandHeader({ cliName, command: `telepresence intercept ${deployName}`, version })
|
|
162
|
+
printCommandHeader({ cliName, command: `tp intercept ${deployName}`, version })
|
|
117
163
|
|
|
118
164
|
const workspaceRoot = findWorkspaceRoot(process.cwd())
|
|
119
|
-
let svcDir =
|
|
165
|
+
let svcDir =
|
|
166
|
+
serviceRootHint ??
|
|
167
|
+
resolveTelepresenceServiceDir(workspaceRoot ?? process.cwd(), deployName)
|
|
120
168
|
if (!svcDir && workspaceRoot) {
|
|
121
169
|
svcDir = resolveTelepresenceServiceDir(path.dirname(workspaceRoot), deployName)
|
|
122
170
|
}
|
|
@@ -132,11 +180,6 @@ export function registerTelepresenceCommand(cli, { cliName = CLI_PRIMARY_NAME }
|
|
|
132
180
|
console.log(chalk.gray(` ns: ${ns}`))
|
|
133
181
|
console.log(chalk.gray(` service: ${svcDir}`))
|
|
134
182
|
console.log(chalk.gray(` env: ${env.envRel}${env.created ? chalk.green(' (created)') : ''}\n`))
|
|
135
|
-
|
|
136
|
-
const portArg = parsePort(port)
|
|
137
|
-
const rest = command.args.slice(/^\d+$/.test(String(port ?? '')) ? 2 : 1)
|
|
138
|
-
const localCmd = rest.length ? rest : ['xry', 'dev']
|
|
139
|
-
|
|
140
183
|
console.log(chalk.gray(` local port: ${portArg} (pod container :3000)`))
|
|
141
184
|
|
|
142
185
|
try {
|
|
@@ -51,8 +51,9 @@ function commandGroups() {
|
|
|
51
51
|
{ cmd: 'sync --all', desc: t('quick.syncAll') },
|
|
52
52
|
{ cmd: 'workspaces [list|sync]', desc: t('quick.workspaces') },
|
|
53
53
|
{ cmd: 'watch install', desc: 'OS service — survives reboot (launchd / systemd user)' },
|
|
54
|
-
{ cmd: '
|
|
55
|
-
{ cmd: '
|
|
54
|
+
{ cmd: 'tp start --ns dev', aliases: 'tp connect', desc: 'Connect Telepresence to cluster namespace' },
|
|
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 project.name)' },
|
|
56
57
|
{ cmd: 'telepresence install', aliases: 'tp install', desc: 'Install Telepresence OSS client (~2.31.x)' },
|
|
57
58
|
],
|
|
58
59
|
},
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import fs from 'node:fs'
|
|
2
2
|
import path from 'node:path'
|
|
3
3
|
|
|
4
|
+
import yaml from 'yaml'
|
|
5
|
+
|
|
4
6
|
const TELEPRESENCE_ENV_EXAMPLE = `# Telepresence intercept env — copied to x/environments/.env.telepresence per service
|
|
5
7
|
# Used by: telepresence intercept --env-file .env.telepresence
|
|
6
8
|
NS=dev
|
|
@@ -48,6 +50,48 @@ export const TELEPRESENCE_DEPLOYMENTS = Object.freeze([
|
|
|
48
50
|
'gpt',
|
|
49
51
|
])
|
|
50
52
|
|
|
53
|
+
/** Walk up from cwd to a directory containing x/tmp.yml (service repo root). */
|
|
54
|
+
export function findServiceRootFromCwd(cwd = process.cwd()) {
|
|
55
|
+
let dir = path.resolve(cwd)
|
|
56
|
+
for (let depth = 0; depth < 16; depth++) {
|
|
57
|
+
if (fs.existsSync(path.join(dir, 'x', 'tmp.yml'))) return dir
|
|
58
|
+
const parent = path.dirname(dir)
|
|
59
|
+
if (parent === dir) break
|
|
60
|
+
dir = parent
|
|
61
|
+
}
|
|
62
|
+
return null
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** project.name from inner x/tmp.yml — must match TELEPRESENCE_DEPLOYMENTS. */
|
|
66
|
+
export function readDeployNameFromServiceRoot(serviceRoot) {
|
|
67
|
+
const tmpPath = path.join(path.resolve(serviceRoot), 'x', 'tmp.yml')
|
|
68
|
+
if (!fs.existsSync(tmpPath)) return null
|
|
69
|
+
let doc
|
|
70
|
+
try {
|
|
71
|
+
doc = yaml.parse(fs.readFileSync(tmpPath, 'utf8'))
|
|
72
|
+
} catch {
|
|
73
|
+
return null
|
|
74
|
+
}
|
|
75
|
+
const name = String(doc?.project?.name ?? '').trim()
|
|
76
|
+
if (!name) return null
|
|
77
|
+
if (!TELEPRESENCE_DEPLOYMENTS.includes(name)) {
|
|
78
|
+
throw new Error(
|
|
79
|
+
`tmp project.name "${name}" is not a known deploy (${TELEPRESENCE_DEPLOYMENTS.join(', ')}).`,
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
return name
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function resolveTelepresenceDeployFromCwd(cwd = process.cwd()) {
|
|
86
|
+
const root = findServiceRootFromCwd(cwd)
|
|
87
|
+
if (!root) {
|
|
88
|
+
throw new Error(
|
|
89
|
+
'No x/tmp.yml in this tree — cd into a service repo or pass deploy: xry tp intercept <gateway|iam|…>',
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
return { deploy: readDeployNameFromServiceRoot(root), serviceRoot: root }
|
|
93
|
+
}
|
|
94
|
+
|
|
51
95
|
export function resolveTelepresenceServiceDir(workspaceRoot, deployName) {
|
|
52
96
|
const apiRoot = path.join(path.resolve(workspaceRoot), 'api')
|
|
53
97
|
const slug = String(deployName ?? '').trim()
|