@marcusrbrown/infra 0.13.1 → 0.13.3

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 (108) hide show
  1. package/dist/cli.js +11965 -0
  2. package/package.json +7 -3
  3. package/src/__snapshots__/cli.test.ts.snap +0 -219
  4. package/src/__test__/mcp-ctx-fixture.test.ts +0 -108
  5. package/src/__test__/mcp-ctx-fixture.ts +0 -104
  6. package/src/cli.test.ts +0 -66
  7. package/src/cli.ts +0 -43
  8. package/src/commands/cliproxy/config.test.ts +0 -475
  9. package/src/commands/cliproxy/config.ts +0 -238
  10. package/src/commands/cliproxy/deploy.test.ts +0 -181
  11. package/src/commands/cliproxy/deploy.ts +0 -157
  12. package/src/commands/cliproxy/host.test.ts +0 -73
  13. package/src/commands/cliproxy/host.ts +0 -31
  14. package/src/commands/cliproxy/index.ts +0 -21
  15. package/src/commands/cliproxy/keys.test.ts +0 -326
  16. package/src/commands/cliproxy/keys.ts +0 -201
  17. package/src/commands/cliproxy/login.test.ts +0 -415
  18. package/src/commands/cliproxy/login.ts +0 -131
  19. package/src/commands/cliproxy/models.test.ts +0 -592
  20. package/src/commands/cliproxy/models.ts +0 -237
  21. package/src/commands/cliproxy/open.test.ts +0 -132
  22. package/src/commands/cliproxy/open.ts +0 -78
  23. package/src/commands/cliproxy/setup/gh.test.ts +0 -218
  24. package/src/commands/cliproxy/setup/gh.ts +0 -250
  25. package/src/commands/cliproxy/setup/preview.test.ts +0 -159
  26. package/src/commands/cliproxy/setup/preview.ts +0 -41
  27. package/src/commands/cliproxy/setup/prompts.test.ts +0 -58
  28. package/src/commands/cliproxy/setup/prompts.ts +0 -99
  29. package/src/commands/cliproxy/setup/providers.test.ts +0 -245
  30. package/src/commands/cliproxy/setup/providers.ts +0 -136
  31. package/src/commands/cliproxy/setup/smoke-test.test.ts +0 -821
  32. package/src/commands/cliproxy/setup/smoke-test.ts +0 -223
  33. package/src/commands/cliproxy/setup/templates.test.ts +0 -357
  34. package/src/commands/cliproxy/setup/templates.ts +0 -145
  35. package/src/commands/cliproxy/setup/validation.test.ts +0 -567
  36. package/src/commands/cliproxy/setup/validation.ts +0 -209
  37. package/src/commands/cliproxy/setup/workflow-analyzer.test.ts +0 -363
  38. package/src/commands/cliproxy/setup/workflow-analyzer.ts +0 -136
  39. package/src/commands/cliproxy/setup.test.ts +0 -2366
  40. package/src/commands/cliproxy/setup.ts +0 -809
  41. package/src/commands/cliproxy/shared.test.ts +0 -118
  42. package/src/commands/cliproxy/shared.ts +0 -84
  43. package/src/commands/cliproxy/status.test.ts +0 -1157
  44. package/src/commands/cliproxy/status.ts +0 -597
  45. package/src/commands/dashboard/deploy.test.ts +0 -215
  46. package/src/commands/dashboard/deploy.ts +0 -135
  47. package/src/commands/dashboard/host.test.ts +0 -79
  48. package/src/commands/dashboard/host.ts +0 -33
  49. package/src/commands/dashboard/index.ts +0 -13
  50. package/src/commands/dashboard/logs.test.ts +0 -317
  51. package/src/commands/dashboard/logs.ts +0 -180
  52. package/src/commands/dashboard/status.test.ts +0 -708
  53. package/src/commands/dashboard/status.ts +0 -293
  54. package/src/commands/gateway/backup.test.ts +0 -426
  55. package/src/commands/gateway/backup.ts +0 -205
  56. package/src/commands/gateway/deploy.test.ts +0 -491
  57. package/src/commands/gateway/deploy.ts +0 -173
  58. package/src/commands/gateway/host.test.ts +0 -89
  59. package/src/commands/gateway/host.ts +0 -33
  60. package/src/commands/gateway/index.ts +0 -17
  61. package/src/commands/gateway/logs.test.ts +0 -263
  62. package/src/commands/gateway/logs.ts +0 -160
  63. package/src/commands/gateway/restore.test.ts +0 -650
  64. package/src/commands/gateway/restore.ts +0 -308
  65. package/src/commands/gateway/status.test.ts +0 -755
  66. package/src/commands/gateway/status.ts +0 -255
  67. package/src/commands/keeweb/deploy.test.ts +0 -177
  68. package/src/commands/keeweb/deploy.ts +0 -191
  69. package/src/commands/keeweb/index.ts +0 -11
  70. package/src/commands/keeweb/open.test.ts +0 -54
  71. package/src/commands/keeweb/open.ts +0 -30
  72. package/src/commands/keeweb/status.test.ts +0 -509
  73. package/src/commands/keeweb/status.ts +0 -359
  74. package/src/commands/mcp.test.ts +0 -260
  75. package/src/commands/mcp.ts +0 -58
  76. package/src/commands/status.test.ts +0 -222
  77. package/src/commands/status.ts +0 -161
  78. package/src/commands/umami/deploy.test.ts +0 -202
  79. package/src/commands/umami/deploy.ts +0 -132
  80. package/src/commands/umami/host.test.ts +0 -79
  81. package/src/commands/umami/host.ts +0 -33
  82. package/src/commands/umami/index.ts +0 -13
  83. package/src/commands/umami/logs.test.ts +0 -191
  84. package/src/commands/umami/logs.ts +0 -163
  85. package/src/commands/umami/status.test.ts +0 -633
  86. package/src/commands/umami/status.ts +0 -285
  87. package/src/commands/vpn/client.test.ts +0 -949
  88. package/src/commands/vpn/client.ts +0 -467
  89. package/src/commands/vpn/deploy.test.ts +0 -208
  90. package/src/commands/vpn/deploy.ts +0 -143
  91. package/src/commands/vpn/host.test.ts +0 -89
  92. package/src/commands/vpn/host.ts +0 -36
  93. package/src/commands/vpn/index.ts +0 -15
  94. package/src/commands/vpn/logs.test.ts +0 -234
  95. package/src/commands/vpn/logs.ts +0 -136
  96. package/src/commands/vpn/peers.test.ts +0 -478
  97. package/src/commands/vpn/shared.test.ts +0 -454
  98. package/src/commands/vpn/shared.ts +0 -170
  99. package/src/commands/vpn/status.test.ts +0 -142
  100. package/src/commands/vpn/status.ts +0 -78
  101. package/src/conventions.test.ts +0 -1180
  102. package/src/lib/action-ctx.ts +0 -25
  103. package/src/lib/known-hosts.test.ts +0 -192
  104. package/src/lib/known-hosts.ts +0 -76
  105. package/src/lib/redact.ts +0 -21
  106. package/src/lib/ssh-identity.test.ts +0 -134
  107. package/src/lib/ssh-identity.ts +0 -76
  108. /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
- }