@fabrika/installation-init 0.9.0-dev.2 → 0.9.0-dev.20

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabrika/installation-init",
3
- "version": "0.9.0-dev.2",
3
+ "version": "0.9.0-dev.20",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,13 +23,15 @@
23
23
  }
24
24
  },
25
25
  "scripts": {
26
- "typecheck": "tsc --noEmit",
26
+ "typecheck": "tsrs --build tsconfig.test.json",
27
27
  "test": "bun test"
28
28
  },
29
29
  "dependencies": {
30
30
  "zod": "^3.25.76",
31
- "@fabrika/app": "0.9.0-dev.2",
32
- "@fabrika/email": "0.9.0-dev.2",
33
- "@fabrika/iam-contract": "0.9.0-dev.2"
31
+ "@fabrika/app": "0.9.0-dev.20",
32
+ "@fabrika/auth-core": "0.9.0-dev.20",
33
+ "@fabrika/email": "0.9.0-dev.20",
34
+ "@fabrika/iam-contract": "0.9.0-dev.20",
35
+ "@fabrika/proxy-core": "0.9.0-dev.20"
34
36
  }
35
37
  }
package/src/admin.ts CHANGED
@@ -17,7 +17,7 @@
17
17
  */
18
18
 
19
19
  import { createRpcClient, type InferRpcClient, RpcError, type RpcFetch } from '@fabrika/app'
20
- import type { GrantDto, IamAdminRpcContract, PrincipalListItem } from '@fabrika/iam-contract'
20
+ import type { GrantDto, IamAdminRpcContract, PrincipalDetail, PrincipalListItem } from '@fabrika/iam-contract'
21
21
 
22
22
  /** The built-in cross-app role. It is the one role that carries `iam.admin`, which the Access plane checks. */
23
23
  export const ADMIN_ROLE_KEY = 'admin'
@@ -77,12 +77,16 @@ export interface FirstAdministratorRequest {
77
77
  readonly reissueEnrollment?: boolean
78
78
  }
79
79
 
80
- /** What happened to the password enrollment. Only `issued` carries a URL, and only once. */
80
+ /**
81
+ * What happened to the password enrollment. Only `issued` carries a URL, and only once. `single-sign-on`: the
82
+ * installation offers no password, so none was issued, and the administrator signs in through the identity provider.
83
+ */
81
84
  export type EnrollmentOutcome =
82
85
  | { readonly state: 'issued'; readonly url: string; readonly expiresAt: number }
83
86
  | { readonly state: 'emailed'; readonly email: string; readonly expiresAt: number }
84
87
  | { readonly state: 'outstanding' }
85
88
  | { readonly state: 'already-set' }
89
+ | { readonly state: 'single-sign-on' }
86
90
 
87
91
  export interface FirstAdministratorResult {
88
92
  readonly principalId: string
@@ -256,29 +260,34 @@ export const ensureFirstAdministrator = async (
256
260
  email,
257
261
  principal: admitted.state,
258
262
  grant: granted ? 'present' : 'created',
259
- enrollment: await ensureEnrollment(client, principal.id, detail.authentication.password.state, request.reissueEnrollment === true),
263
+ enrollment: await ensureEnrollment(client, principal.id, detail.authentication, request.reissueEnrollment === true),
260
264
  }
261
265
  }
262
266
 
263
267
  /**
264
268
  * Issue the password enrollment EXACTLY ONCE.
265
269
  *
266
- * `enabled` means a password is already set — IAM answers 409 and there is nothing to admit. `pending`
270
+ * `enabled` means a password is already set: IAM answers 409 and there is nothing to admit. `pending`
267
271
  * means an enrollment was already issued and never completed; a second URL is not issued for it,
268
272
  * because "print the URL once" is the property a re-run has to keep, and `reissue` is the explicit way
269
273
  * out when the first one expired unopened. `unavailable` means the installation offers no password
270
- * method at all, which no URL can fix, so it fails rather than reporting a half-admitted administrator.
274
+ * method: with single sign-on on, the principal and its grant are all an administrator needs, since an invited
275
+ * address signs in through the identity provider; with neither method IAM would not be serving, so that fails.
271
276
  */
272
277
  const ensureEnrollment = async (
273
278
  client: FirstAdministratorApi,
274
279
  principalId: string,
275
- state: 'unavailable' | 'disabled' | 'pending' | 'enabled',
280
+ authentication: PrincipalDetail['authentication'],
276
281
  reissue: boolean,
277
282
  ): Promise<EnrollmentOutcome> => {
283
+ const state = authentication.password.state
278
284
  if (state === 'unavailable') {
285
+ if (authentication.oidc.state !== 'unavailable') {
286
+ return { state: 'single-sign-on' }
287
+ }
279
288
  throw new Error(
280
- 'this installation offers no password authentication, so no enrollment can be issued — the principal and its '
281
- + 'cross-app admin grant are in place; enable the password method and run this again',
289
+ 'this installation offers neither password nor single sign-on, so the administrator has no way to sign in. The '
290
+ + "principal and its cross-app admin grant are in place; fix IAM's FABRIKA_IAM_OIDC_ENABLED and FABRIKA_IAM_PASSWORD_ENABLED",
282
291
  )
283
292
  }
284
293
  if (state === 'enabled') {
@@ -0,0 +1,90 @@
1
+ // IAM's human authentication methods as both installers take them: `--auth-methods`, or the pair of switches beside
2
+ // it, and the OIDC client's coordinates. What a provider writes for them, and what it defaults to when the operator
3
+ // names none, is the provider's own.
4
+
5
+ import { type CommandEnv, readEnv, readFlag } from './options'
6
+
7
+ export const AUTH_METHODS_FLAG = '--auth-methods'
8
+ export const OIDC_ISSUER_FLAG = '--oidc-issuer'
9
+ export const OIDC_CLIENT_ID_FLAG = '--oidc-client-id'
10
+
11
+ /** The installer's input names. IAM's own names differ per runtime; the provider maps them. */
12
+ export const OIDC_ISSUER_INPUT = 'FABRIKA_IAM_OIDC_ISSUER'
13
+ export const OIDC_CLIENT_ID_INPUT = 'FABRIKA_IAM_OIDC_CLIENT_ID'
14
+ /** A credential: environment only, and no flag. */
15
+ export const OIDC_CLIENT_SECRET_INPUT = 'FABRIKA_IAM_OIDC_CLIENT_SECRET'
16
+
17
+ const OIDC_ENABLED_VARIABLE = 'FABRIKA_IAM_OIDC_ENABLED'
18
+ const PASSWORD_ENABLED_VARIABLE = 'FABRIKA_IAM_PASSWORD_ENABLED'
19
+
20
+ const AUTH_METHODS = ['oidc', 'password'] as const
21
+
22
+ /** At least one method: IAM refuses to boot with neither, so neither is not a value. */
23
+ export type AuthMethods =
24
+ | { readonly oidcEnabled: true; readonly passwordEnabled: boolean }
25
+ | { readonly oidcEnabled: false; readonly passwordEnabled: true }
26
+
27
+ /** The OIDC client IAM signs people in with. */
28
+ export interface OidcClient {
29
+ readonly issuer: string
30
+ readonly clientId: string
31
+ /** Never logged, never printed. */
32
+ readonly clientSecret: string
33
+ }
34
+
35
+ const authMethods = (oidcEnabled: boolean, passwordEnabled: boolean): AuthMethods => {
36
+ if (oidcEnabled) return { oidcEnabled: true, passwordEnabled }
37
+ if (passwordEnabled) return { oidcEnabled: false, passwordEnabled: true }
38
+ throw new Error('At least one IAM authentication method must be enabled')
39
+ }
40
+
41
+ const parseBoolean = (value: string, name: string): boolean => {
42
+ if (value === 'true') return true
43
+ if (value === 'false') return false
44
+ throw new Error(`${name} must be true or false`)
45
+ }
46
+
47
+ /**
48
+ * `--auth-methods`, or the pair of switches the environment carries.
49
+ *
50
+ * With neither, `fallback` when the provider has one, and an error naming both ways in when it has none.
51
+ */
52
+ export const readAuthMethods = (argv: readonly string[], env: CommandEnv, fallback?: AuthMethods): AuthMethods => {
53
+ const flag = readFlag(argv, AUTH_METHODS_FLAG)
54
+ if (flag !== undefined) {
55
+ const methods = flag.split(',').map((item) => item.trim())
56
+ const unknown = methods.find((method) => !AUTH_METHODS.some((known) => known === method))
57
+ if (unknown !== undefined || methods.length > AUTH_METHODS.length) {
58
+ throw new Error(`${AUTH_METHODS_FLAG} takes oidc, password, or oidc,password, not \`${flag}\``)
59
+ }
60
+ return authMethods(methods.includes('oidc'), methods.includes('password'))
61
+ }
62
+ const oidc = readEnv(env, OIDC_ENABLED_VARIABLE)
63
+ const password = readEnv(env, PASSWORD_ENABLED_VARIABLE)
64
+ if (oidc === undefined && password === undefined) {
65
+ if (fallback !== undefined) return fallback
66
+ throw new Error(
67
+ `${AUTH_METHODS_FLAG}=<oidc|password|oidc,password> or ${OIDC_ENABLED_VARIABLE} + ${PASSWORD_ENABLED_VARIABLE} is required`,
68
+ )
69
+ }
70
+ if (oidc === undefined || password === undefined) {
71
+ throw new Error(`${OIDC_ENABLED_VARIABLE} and ${PASSWORD_ENABLED_VARIABLE} must be configured together`)
72
+ }
73
+ return authMethods(parseBoolean(oidc, OIDC_ENABLED_VARIABLE), parseBoolean(password, PASSWORD_ENABLED_VARIABLE))
74
+ }
75
+
76
+ /** An issuer IAM can discover `/.well-known/openid-configuration` under. The value is a public URL, so it is quoted. */
77
+ export const checkedOidcIssuer = (issuer: string): string => {
78
+ if (!URL.canParse(issuer)) {
79
+ throw new Error(`${OIDC_ISSUER_FLAG} / ${OIDC_ISSUER_INPUT} is not a URL: \`${issuer}\``)
80
+ }
81
+ return issuer
82
+ }
83
+
84
+ /** A flag that only means something under a selection the run did not make is refused, not ignored. */
85
+ export const refuseFlags = (argv: readonly string[], flags: readonly string[], why: string): void => {
86
+ const given = flags.find((flag) => readFlag(argv, flag) !== undefined)
87
+ if (given !== undefined) {
88
+ throw new Error(`${given} was given, but ${why}`)
89
+ }
90
+ }
@@ -59,6 +59,12 @@ export async function configureEnvironment(
59
59
  const protection = await createEnvironment(repo, environment, effects.attempt)
60
60
  config.onProtection?.(protection)
61
61
 
62
+ // Variables first, in the caller's order: a workflow run that starts before init finishes, or a run of init that
63
+ // stops halfway, never sees an Environment whose credentials are set and whose configuration is not.
64
+ for (const [name, value] of Object.entries(vars)) {
65
+ await effects.run({ command: 'gh', args: ['variable', 'set', name, '--repo', repo, '--env', environment, '--body', value], cwd: ANCHOR })
66
+ ok(`variable ${name} set`)
67
+ }
62
68
  for (const [name, value] of Object.entries(secrets)) {
63
69
  if (value === '') {
64
70
  warn(`Skipping secret ${name} — no value (the workflow will fail without it; set it manually).`)
@@ -67,13 +73,35 @@ export async function configureEnvironment(
67
73
  await effects.run({ command: 'gh', args: ['secret', 'set', name, '--repo', repo, '--env', environment], cwd: ANCHOR, stdin: value })
68
74
  ok(`secret ${name} set`)
69
75
  }
70
- for (const [name, value] of Object.entries(vars)) {
71
- await effects.run({ command: 'gh', args: ['variable', 'set', name, '--repo', repo, '--env', environment, '--body', value], cwd: ANCHOR })
72
- ok(`variable ${name} set`)
73
- }
74
76
  detail(`Recommended hardening — require your own approval before a deploy: ${environmentReviewerCommand(repo, environment)}`)
75
77
  }
76
78
 
79
+ const variableLineSchema = z.object({ name: z.string(), value: z.string() })
80
+
81
+ /**
82
+ * The variables an Environment already holds, or null when the repository or the Environment does not exist. Any other
83
+ * failure throws: a caller decides from the answer whether an installation already exists, and must not guess.
84
+ */
85
+ export async function environmentVariables(
86
+ repo: string,
87
+ environment: string,
88
+ gh: GhAttempt = attempt,
89
+ ): Promise<Readonly<Record<string, string>> | null> {
90
+ const path = `repos/${repo}/environments/${environment}/variables`
91
+ const result = await gh({ command: 'gh', args: ['api', '--paginate', path, '--jq', '.variables[] | {name, value}'], cwd: ANCHOR })
92
+ if (result.exitCode !== 0) {
93
+ if (ghHttpStatus(result) === 404) return null
94
+ throw new Error(`\`gh api ${path}\` failed (${unavailableReason(result)}).`)
95
+ }
96
+ const variables: Record<string, string> = {}
97
+ for (const line of result.stdout.split('\n')) {
98
+ if (line.trim() === '') continue
99
+ const variable = variableLineSchema.parse(JSON.parse(line))
100
+ variables[variable.name] = variable.value
101
+ }
102
+ return variables
103
+ }
104
+
77
105
  /**
78
106
  * Idempotent create, carrying the deployment-branch policy MERGED over whatever protection rules the
79
107
  * environment already has — a PUT replaces the whole object, so a reviewer or wait timer the operator
package/src/index.ts CHANGED
@@ -9,6 +9,19 @@ export {
9
9
  type IamAdminClient,
10
10
  type IamAdminConnection,
11
11
  } from './admin'
12
+ export {
13
+ AUTH_METHODS_FLAG,
14
+ type AuthMethods,
15
+ checkedOidcIssuer,
16
+ OIDC_CLIENT_ID_FLAG,
17
+ OIDC_CLIENT_ID_INPUT,
18
+ OIDC_CLIENT_SECRET_INPUT,
19
+ OIDC_ISSUER_FLAG,
20
+ OIDC_ISSUER_INPUT,
21
+ type OidcClient,
22
+ readAuthMethods,
23
+ refuseFlags,
24
+ } from './auth-methods'
12
25
  export { CHECKOUT_FLAG, sidecarCheckoutDir } from './checkout'
13
26
  export { type Confirmations, confirmations, UNATTENDED_FLAG } from './confirmations'
14
27
  export { EMAIL_FLAGS, type InstallationEmail, readInstallationEmail } from './email'
@@ -16,13 +29,16 @@ export {
16
29
  configureEnvironment,
17
30
  type EnvironmentConfig,
18
31
  type EnvironmentEffects,
32
+ environmentVariables,
19
33
  type ExistingEnvironmentProtection,
20
34
  existingEnvironmentProtection,
21
35
  triggerPlatformWorkflow,
22
36
  } from './environment'
23
37
  export { ghRepoExists, hasGhCli } from './gh'
24
38
  export { action, detail, fail, info, ok, step, url, warn } from './log'
39
+ export { type IamOAuthConfig, type McpClient, parseMcpClientsJson, platformIamOAuthConfig } from './mcp'
25
40
  export { type CommandEnv, describeArgument, readEnv, readFlag, requiredSetting, setting, shellWord } from './options'
41
+ export { assertPinnedTag } from './pin'
26
42
  export { confirm } from './prompt'
27
43
  export {
28
44
  branchProtectionCommand,
@@ -36,6 +52,21 @@ export {
36
52
  type ProtectionOutcome,
37
53
  protectSidecarBranch,
38
54
  } from './protection'
55
+ export {
56
+ type PlatformHosts,
57
+ type PlatformOAuthResourceTemplate,
58
+ type PlatformOAuthScopeGrant,
59
+ platformOrigin,
60
+ type PlatformProxyApp,
61
+ platformProxyAppFor,
62
+ type PlatformProxyComposition,
63
+ type PlatformProxyManifest,
64
+ type PlatformProxyManifestTemplate,
65
+ type PlatformProxyPlacement,
66
+ type PlatformProxyService,
67
+ platformServiceTableDigest,
68
+ resolvePlatformProxyManifest,
69
+ } from './proxy-manifest'
39
70
  export {
40
71
  INITIAL_SCAFFOLD_COMMIT_MESSAGE,
41
72
  REFRESH_SCAFFOLD_COMMIT_MESSAGE,
@@ -44,4 +75,22 @@ export {
44
75
  type SidecarScaffoldInput,
45
76
  type SidecarScaffoldResult,
46
77
  } from './scaffold'
78
+ export { generateInstallationSecrets, generateSigningKeys, generateVaultKey, type InstallationSecrets, randomPxKey, randomSecret } from './secrets'
79
+ export { checkedSecretsFilePath, renderSecretsFile, SECRETS_FILE_FLAG, SECRETS_FILE_VARIABLE, writeSecretsFile } from './secrets-file'
80
+ export {
81
+ deployedServiceEnvironment,
82
+ type DeployedServiceInput,
83
+ deriveIamProxySecret,
84
+ IAM_OAUTH_CONFIG_VARIABLE,
85
+ IAM_OIDC_CLIENT_SECRET_VARIABLE,
86
+ INSTALLATION_SECRET_VARIABLES,
87
+ type InstallationAuthentication,
88
+ installationServiceEnvironment,
89
+ type InstallationServiceInput,
90
+ type PlatformData,
91
+ type PlatformPlacementInput,
92
+ type PlatformService,
93
+ type PlatformServiceEnvironment,
94
+ type PlatformStorage,
95
+ } from './service-environment'
47
96
  export { attempt, capture, probe, run, type ShellAttempt, type ShellStep } from './shell'
package/src/log.ts CHANGED
@@ -76,6 +76,6 @@ export function url(value: string): string {
76
76
 
77
77
  /** Strip ANSI escape codes so box-drawing can measure the VISIBLE width of a line. */
78
78
  function stripAnsi(value: string): string {
79
- // biome-ignore lint/suspicious/noControlCharactersInRegex: matching ANSI escape sequences by design.
79
+ // oxlint-disable-next-line no-control-regex -- matching ANSI escape sequences by design.
80
80
  return value.replace(/\x1b\[[0-9;]*m/g, '')
81
81
  }
package/src/mcp.ts ADDED
@@ -0,0 +1,102 @@
1
+ // MCP authoring, opt-in per installation (ADR-0049).
2
+ //
3
+ // The operator names the MCP clients it trusts; everything else is derived. One input turns on BOTH
4
+ // halves, so they cannot disagree: the console's `oauth` row with its registered resource in the proxy
5
+ // manifest, and IAM's `FABRIKA_IAM_OAUTH_CONFIG`, which issues tokens for exactly that resource.
6
+
7
+ import { type OAuthManagedClient, type OAuthResourceDto, parseOAuthManagedClient } from '@fabrika/iam-contract'
8
+ import { platformOAuthResourceUris, type PlatformProxyComposition, type PlatformProxyManifestTemplate } from './proxy-manifest'
9
+
10
+ /** One operator-registered MCP client: its CIMD identity, plus where IAM fetches it when that differs. */
11
+ export interface McpClient extends OAuthManagedClient {
12
+ readonly metadataUrl?: string
13
+ }
14
+
15
+ /** The document IAM parses from `FABRIKA_IAM_OAUTH_CONFIG`. */
16
+ export interface IamOAuthConfig {
17
+ readonly clients: readonly McpClient[]
18
+ readonly resources: readonly OAuthResourceDto[]
19
+ }
20
+
21
+ const CLIENT_KEYS = ['provider', 'clientId', 'redirectUris', 'metadataUrl']
22
+ /** IAM's own ceiling: it refuses to boot with more. */
23
+ const MAX_CLIENTS = 16
24
+
25
+ const isObject = (value: unknown): value is Record<string, unknown> => typeof value === 'object' && value !== null && !Array.isArray(value)
26
+
27
+ const isHttpsUrl = (value: string): boolean => {
28
+ try {
29
+ const url = new URL(value)
30
+ return url.protocol === 'https:' && url.username === '' && url.password === '' && url.hash === ''
31
+ } catch {
32
+ return false
33
+ }
34
+ }
35
+
36
+ const parseClient = (value: unknown, index: number): McpClient => {
37
+ const client = parseOAuthManagedClient(value)
38
+ if (client === null || !isObject(value) || !Object.keys(value).every((key) => CLIENT_KEYS.includes(key))) {
39
+ throw new Error(`MCP client ${index} must be { provider: 'claude' | 'chatgpt', clientId: <https URL>, redirectUris: [...], metadataUrl? }`)
40
+ }
41
+ const metadataUrl = value['metadataUrl']
42
+ if (metadataUrl === undefined) {
43
+ return client
44
+ }
45
+ if (typeof metadataUrl !== 'string' || !isHttpsUrl(metadataUrl)) {
46
+ throw new Error(`MCP client ${index}: metadataUrl must be an https URL`)
47
+ }
48
+ return { ...client, metadataUrl }
49
+ }
50
+
51
+ /**
52
+ * Parse the operator's MCP client list — a JSON array. Anything malformed, an empty list or a repeated
53
+ * client id is refused here, before a deploy writes a value IAM would refuse to boot with.
54
+ */
55
+ export const parseMcpClientsJson = (raw: string): readonly McpClient[] => {
56
+ let value: unknown
57
+ try {
58
+ value = JSON.parse(raw)
59
+ } catch {
60
+ throw new Error('the MCP client list is not valid JSON')
61
+ }
62
+ if (!Array.isArray(value) || value.length === 0) {
63
+ throw new Error('the MCP client list must be a non-empty JSON array')
64
+ }
65
+ if (value.length > MAX_CLIENTS) {
66
+ throw new Error(`the MCP client list names more than ${MAX_CLIENTS} clients, which IAM refuses`)
67
+ }
68
+ const clients = value.map(parseClient)
69
+ const ids = new Set(clients.map((client) => client.clientId))
70
+ if (ids.size !== clients.length) {
71
+ throw new Error('the MCP client list names one client id twice')
72
+ }
73
+ return clients
74
+ }
75
+
76
+ /** IAM's OAuth configuration for one placed installation: the clients, and one resource per app that serves one. */
77
+ export const platformIamOAuthConfig = (
78
+ template: PlatformProxyManifestTemplate,
79
+ composition: PlatformProxyComposition,
80
+ clients: readonly McpClient[],
81
+ ): IamOAuthConfig => {
82
+ const resources: OAuthResourceDto[] = []
83
+ for (const app of template.apps) {
84
+ if (app.oauthResource === undefined) {
85
+ continue
86
+ }
87
+ const { resource } = platformOAuthResourceUris(composition, composition.placement[app.service].hosts, app.oauthResource)
88
+ resources.push({
89
+ app: app.id,
90
+ resource,
91
+ defaultScopes: [...app.oauthResource.scopes],
92
+ scopeGrants: app.oauthResource.scopeGrants.map((grant) => ({
93
+ scope: grant.scope,
94
+ permissions: grant.actions.map((action) => ({ action })),
95
+ })),
96
+ })
97
+ }
98
+ if (resources.length === 0) {
99
+ throw new Error('the platform proxy manifest template declares no OAuth resource for MCP clients to reach')
100
+ }
101
+ return { clients, resources }
102
+ }
package/src/pin.ts ADDED
@@ -0,0 +1,26 @@
1
+ // The one rule about a sidecar's pin: it names a published TAG of `contember/fabrika-platform`, never a
2
+ // branch. A namespace proxy and an installation both build from tags, so a moving ref would make "which
3
+ // version is this installation running" unanswerable (ADR-0025).
4
+
5
+ /**
6
+ * A published release tag: `v` and a semantic version.
7
+ *
8
+ * The same shape `scripts/release.ts` accepts, restated rather than imported — that script is not a
9
+ * package and this check has to hold in a published tarball.
10
+ */
11
+ const TAG_PATTERN = /^v(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/
12
+
13
+ /** The pinned ref, or an error naming what was found. A branch is refused, deliberately and loudly. */
14
+ export const assertPinnedTag = (ref: string): string => {
15
+ const trimmed = ref.trim()
16
+ if (trimmed === '') {
17
+ throw new Error('a published fabrika tag is required, for example v0.1.0')
18
+ }
19
+ if (!TAG_PATTERN.test(trimmed)) {
20
+ throw new Error(
21
+ `\`${trimmed}\` is not a published tag. A sidecar repository pins a TAG such as v0.1.0 and never a branch: `
22
+ + 'an installation that tracked a moving ref could not say which version it runs (ADR-0025)',
23
+ )
24
+ }
25
+ return trimmed
26
+ }
package/src/prompt.ts CHANGED
@@ -35,16 +35,16 @@ function stripTerminalCruft(value: string): string {
35
35
  return (
36
36
  value
37
37
  // Full OSC sequences: ESC ] … (BEL or ST). e.g. an OSC 10/11 dynamic-color response.
38
- // biome-ignore lint/suspicious/noControlCharactersInRegex: matching terminal escape bytes by design.
38
+ // oxlint-disable-next-line no-control-regex -- matching terminal escape bytes by design.
39
39
  .replace(/\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)/g, '')
40
40
  // Bare OSC 10/11 color responses whose ESC introducer readline's keypress parser ate
41
41
  // (`1X;rgb:RRRR/GGGG/BBBB`, optional leading `]`). Never appears in a real entered value.
42
42
  .replace(/\]?1[0-9];rgb:[0-9a-fA-F]{1,4}(?:\/[0-9a-fA-F]{1,4}){2}/g, '')
43
43
  // CSI sequences (bracketed-paste markers, cursor-position responses ESC[N;MR, SGR, …).
44
- // biome-ignore lint/suspicious/noControlCharactersInRegex: matching terminal escape bytes by design.
44
+ // oxlint-disable-next-line no-control-regex -- matching terminal escape bytes by design.
45
45
  .replace(/\x1b\[[0-9;?]*[ -/]*[@-~]/g, '')
46
46
  // Any stray C0/C1 control char + DEL.
47
- // biome-ignore lint/suspicious/noControlCharactersInRegex: matching terminal control bytes by design.
47
+ // oxlint-disable-next-line no-control-regex -- matching terminal control bytes by design.
48
48
  .replace(/[\x00-\x1f\x7f]/g, '')
49
49
  )
50
50
  }