@marcusrbrown/infra 0.13.0 → 0.13.2
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/dist/cli.js +4977 -0
- package/package.json +7 -3
- package/src/__snapshots__/cli.test.ts.snap +0 -219
- package/src/__test__/mcp-ctx-fixture.test.ts +0 -108
- package/src/__test__/mcp-ctx-fixture.ts +0 -104
- package/src/cli.test.ts +0 -66
- package/src/cli.ts +0 -43
- package/src/commands/cliproxy/config.test.ts +0 -475
- package/src/commands/cliproxy/config.ts +0 -238
- package/src/commands/cliproxy/deploy.test.ts +0 -181
- package/src/commands/cliproxy/deploy.ts +0 -157
- package/src/commands/cliproxy/host.test.ts +0 -73
- package/src/commands/cliproxy/host.ts +0 -31
- package/src/commands/cliproxy/index.ts +0 -21
- package/src/commands/cliproxy/keys.test.ts +0 -326
- package/src/commands/cliproxy/keys.ts +0 -201
- package/src/commands/cliproxy/login.test.ts +0 -415
- package/src/commands/cliproxy/login.ts +0 -131
- package/src/commands/cliproxy/models.test.ts +0 -592
- package/src/commands/cliproxy/models.ts +0 -237
- package/src/commands/cliproxy/open.test.ts +0 -132
- package/src/commands/cliproxy/open.ts +0 -78
- package/src/commands/cliproxy/setup/gh.test.ts +0 -218
- package/src/commands/cliproxy/setup/gh.ts +0 -250
- package/src/commands/cliproxy/setup/preview.test.ts +0 -159
- package/src/commands/cliproxy/setup/preview.ts +0 -41
- package/src/commands/cliproxy/setup/prompts.test.ts +0 -58
- package/src/commands/cliproxy/setup/prompts.ts +0 -99
- package/src/commands/cliproxy/setup/providers.test.ts +0 -245
- package/src/commands/cliproxy/setup/providers.ts +0 -136
- package/src/commands/cliproxy/setup/smoke-test.test.ts +0 -821
- package/src/commands/cliproxy/setup/smoke-test.ts +0 -223
- package/src/commands/cliproxy/setup/templates.test.ts +0 -357
- package/src/commands/cliproxy/setup/templates.ts +0 -145
- package/src/commands/cliproxy/setup/validation.test.ts +0 -567
- package/src/commands/cliproxy/setup/validation.ts +0 -209
- package/src/commands/cliproxy/setup/workflow-analyzer.test.ts +0 -363
- package/src/commands/cliproxy/setup/workflow-analyzer.ts +0 -136
- package/src/commands/cliproxy/setup.test.ts +0 -2366
- package/src/commands/cliproxy/setup.ts +0 -809
- package/src/commands/cliproxy/shared.test.ts +0 -118
- package/src/commands/cliproxy/shared.ts +0 -84
- package/src/commands/cliproxy/status.test.ts +0 -1157
- package/src/commands/cliproxy/status.ts +0 -597
- package/src/commands/dashboard/deploy.test.ts +0 -215
- package/src/commands/dashboard/deploy.ts +0 -135
- package/src/commands/dashboard/host.test.ts +0 -79
- package/src/commands/dashboard/host.ts +0 -33
- package/src/commands/dashboard/index.ts +0 -13
- package/src/commands/dashboard/logs.test.ts +0 -317
- package/src/commands/dashboard/logs.ts +0 -180
- package/src/commands/dashboard/status.test.ts +0 -708
- package/src/commands/dashboard/status.ts +0 -293
- package/src/commands/gateway/backup.test.ts +0 -426
- package/src/commands/gateway/backup.ts +0 -205
- package/src/commands/gateway/deploy.test.ts +0 -491
- package/src/commands/gateway/deploy.ts +0 -173
- package/src/commands/gateway/host.test.ts +0 -89
- package/src/commands/gateway/host.ts +0 -33
- package/src/commands/gateway/index.ts +0 -17
- package/src/commands/gateway/logs.test.ts +0 -263
- package/src/commands/gateway/logs.ts +0 -160
- package/src/commands/gateway/restore.test.ts +0 -650
- package/src/commands/gateway/restore.ts +0 -308
- package/src/commands/gateway/status.test.ts +0 -755
- package/src/commands/gateway/status.ts +0 -255
- package/src/commands/keeweb/deploy.test.ts +0 -177
- package/src/commands/keeweb/deploy.ts +0 -191
- package/src/commands/keeweb/index.ts +0 -11
- package/src/commands/keeweb/open.test.ts +0 -54
- package/src/commands/keeweb/open.ts +0 -30
- package/src/commands/keeweb/status.test.ts +0 -509
- package/src/commands/keeweb/status.ts +0 -359
- package/src/commands/mcp.test.ts +0 -260
- package/src/commands/mcp.ts +0 -58
- package/src/commands/status.test.ts +0 -222
- package/src/commands/status.ts +0 -161
- package/src/commands/umami/deploy.test.ts +0 -202
- package/src/commands/umami/deploy.ts +0 -132
- package/src/commands/umami/host.test.ts +0 -79
- package/src/commands/umami/host.ts +0 -33
- package/src/commands/umami/index.ts +0 -13
- package/src/commands/umami/logs.test.ts +0 -191
- package/src/commands/umami/logs.ts +0 -163
- package/src/commands/umami/status.test.ts +0 -633
- package/src/commands/umami/status.ts +0 -285
- package/src/commands/vpn/client.test.ts +0 -949
- package/src/commands/vpn/client.ts +0 -467
- package/src/commands/vpn/deploy.test.ts +0 -208
- package/src/commands/vpn/deploy.ts +0 -143
- package/src/commands/vpn/host.test.ts +0 -89
- package/src/commands/vpn/host.ts +0 -36
- package/src/commands/vpn/index.ts +0 -15
- package/src/commands/vpn/logs.test.ts +0 -234
- package/src/commands/vpn/logs.ts +0 -136
- package/src/commands/vpn/peers.test.ts +0 -478
- package/src/commands/vpn/shared.test.ts +0 -454
- package/src/commands/vpn/shared.ts +0 -170
- package/src/commands/vpn/status.test.ts +0 -142
- package/src/commands/vpn/status.ts +0 -78
- package/src/conventions.test.ts +0 -1180
- package/src/lib/action-ctx.ts +0 -25
- package/src/lib/known-hosts.test.ts +0 -192
- package/src/lib/known-hosts.ts +0 -76
- package/src/lib/redact.ts +0 -21
- package/src/lib/ssh-identity.test.ts +0 -134
- package/src/lib/ssh-identity.ts +0 -76
- /package/{src/resources/known_hosts → dist/known_hosts-tk724cp0.} +0 -0
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
/// <reference types="bun" />
|
|
2
|
-
|
|
3
|
-
import type {GenericSecretNames} from './prompts'
|
|
4
|
-
import type {ProviderId} from './providers'
|
|
5
|
-
import {z} from 'zod'
|
|
6
|
-
import {PROVIDER_DEFAULTS} from './providers'
|
|
7
|
-
|
|
8
|
-
export const harnessSchema = z.enum(['opencode', 'claude-code', 'generic'])
|
|
9
|
-
export type Harness = z.infer<typeof harnessSchema>
|
|
10
|
-
|
|
11
|
-
export interface SecretAssignment {
|
|
12
|
-
name: string
|
|
13
|
-
value: string
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface VariableAssignment {
|
|
17
|
-
name: string
|
|
18
|
-
value: string
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface HarnessTemplate {
|
|
22
|
-
secrets: SecretAssignment[]
|
|
23
|
-
variables: VariableAssignment[]
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const DEFAULT_CLIPROXY_URL = 'https://cliproxy.fro.bot'
|
|
27
|
-
|
|
28
|
-
export function stripTrailingSlash(value: string): string {
|
|
29
|
-
return value.endsWith('/') ? value.slice(0, -1) : value
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function getHarnessTemplate(
|
|
33
|
-
harness: Harness,
|
|
34
|
-
values: {
|
|
35
|
-
keyValue?: string
|
|
36
|
-
baseUrl?: string
|
|
37
|
-
genericSecretNames?: GenericSecretNames
|
|
38
|
-
providers?: ProviderId[]
|
|
39
|
-
model?: string
|
|
40
|
-
} = {},
|
|
41
|
-
): HarnessTemplate {
|
|
42
|
-
const keyValue = values.keyValue ?? 'sk-placeholder'
|
|
43
|
-
const baseUrl = stripTrailingSlash(values.baseUrl ?? DEFAULT_CLIPROXY_URL)
|
|
44
|
-
|
|
45
|
-
if (harness === 'opencode') {
|
|
46
|
-
// Normalize provider list: default to anthropic-only, always sort anthropic first
|
|
47
|
-
const rawProviders = values.providers ?? ['anthropic']
|
|
48
|
-
// Stable ordering: anthropic always before openai regardless of input order
|
|
49
|
-
const PROVIDER_ORDER: ProviderId[] = ['anthropic', 'openai']
|
|
50
|
-
const providers = PROVIDER_ORDER.filter(p => rawProviders.includes(p))
|
|
51
|
-
|
|
52
|
-
// Resolve model
|
|
53
|
-
let model: string
|
|
54
|
-
if (values.model) {
|
|
55
|
-
model = values.model
|
|
56
|
-
} else if (providers.length === 1) {
|
|
57
|
-
model = PROVIDER_DEFAULTS[providers[0] as ProviderId]
|
|
58
|
-
} else {
|
|
59
|
-
throw new Error('model required when multiple providers selected')
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// Build auth JSON object (anthropic-first insertion order)
|
|
63
|
-
const authObj: Record<string, {type: string; key: string}> = {}
|
|
64
|
-
for (const p of providers) {
|
|
65
|
-
authObj[p] = {type: 'api', key: keyValue}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Build config JSON object (anthropic-first insertion order)
|
|
69
|
-
const providerConfig: Record<string, {options: {baseURL: string}}> = {}
|
|
70
|
-
for (const p of providers) {
|
|
71
|
-
providerConfig[p] = {options: {baseURL: `${baseUrl}/v1`}}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return {
|
|
75
|
-
secrets: [
|
|
76
|
-
{
|
|
77
|
-
name: 'OPENCODE_AUTH_JSON',
|
|
78
|
-
value: JSON.stringify(authObj),
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
name: 'OPENCODE_CONFIG',
|
|
82
|
-
value: JSON.stringify({provider: providerConfig}),
|
|
83
|
-
},
|
|
84
|
-
],
|
|
85
|
-
variables: [
|
|
86
|
-
{
|
|
87
|
-
name: 'FRO_BOT_MODEL',
|
|
88
|
-
value: model,
|
|
89
|
-
},
|
|
90
|
-
],
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (harness === 'claude-code') {
|
|
95
|
-
return {
|
|
96
|
-
secrets: [
|
|
97
|
-
{
|
|
98
|
-
name: 'ANTHROPIC_API_KEY',
|
|
99
|
-
value: keyValue,
|
|
100
|
-
},
|
|
101
|
-
],
|
|
102
|
-
variables: [],
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
if (!values.genericSecretNames) {
|
|
107
|
-
throw new Error('Generic harness requires custom secret names.')
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
return {
|
|
111
|
-
secrets: [
|
|
112
|
-
{name: values.genericSecretNames.apiKeySecretName, value: keyValue},
|
|
113
|
-
{name: values.genericSecretNames.baseUrlSecretName, value: `${baseUrl}/v1`},
|
|
114
|
-
],
|
|
115
|
-
variables: [],
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export function formatTemplateSummary(template: HarnessTemplate): string {
|
|
120
|
-
const secretLines = template.secrets.map(secret => `- secret ${secret.name}`)
|
|
121
|
-
const variableLines = template.variables.map(variable => `- variable ${variable.name}`)
|
|
122
|
-
return [...secretLines, ...variableLines].join('\n')
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export function collectCollisions(
|
|
126
|
-
template: HarnessTemplate,
|
|
127
|
-
existingSecrets: string[],
|
|
128
|
-
existingVariables: string[],
|
|
129
|
-
): string[] {
|
|
130
|
-
const collisions: string[] = []
|
|
131
|
-
|
|
132
|
-
for (const secret of template.secrets) {
|
|
133
|
-
if (existingSecrets.includes(secret.name)) {
|
|
134
|
-
collisions.push(`secret ${secret.name}`)
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
for (const variable of template.variables) {
|
|
139
|
-
if (existingVariables.includes(variable.name)) {
|
|
140
|
-
collisions.push(`variable ${variable.name}`)
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
return collisions
|
|
145
|
-
}
|