@vibesdotdev/secrets 0.0.1

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 (208) hide show
  1. package/README.md +59 -0
  2. package/SPEC.md +47 -0
  3. package/dist/cli/check/schemas/check-result.d.ts +9 -0
  4. package/dist/cli/check/schemas/check-result.d.ts.map +1 -0
  5. package/dist/cli/check/schemas/check-result.js +2 -0
  6. package/dist/cli/check/schemas/check-result.js.map +1 -0
  7. package/dist/cli/check/secrets.check.cli-command.descriptor.d.ts +4 -0
  8. package/dist/cli/check/secrets.check.cli-command.descriptor.d.ts.map +1 -0
  9. package/dist/cli/check/secrets.check.cli-command.descriptor.js +19 -0
  10. package/dist/cli/check/secrets.check.cli-command.descriptor.js.map +1 -0
  11. package/dist/cli/check/secrets.check.cli-command.impl.d.ts +5 -0
  12. package/dist/cli/check/secrets.check.cli-command.impl.d.ts.map +1 -0
  13. package/dist/cli/check/secrets.check.cli-command.impl.js +135 -0
  14. package/dist/cli/check/secrets.check.cli-command.impl.js.map +1 -0
  15. package/dist/cli/export/secrets.export.cli-command.descriptor.d.ts +4 -0
  16. package/dist/cli/export/secrets.export.cli-command.descriptor.d.ts.map +1 -0
  17. package/dist/cli/export/secrets.export.cli-command.descriptor.js +20 -0
  18. package/dist/cli/export/secrets.export.cli-command.descriptor.js.map +1 -0
  19. package/dist/cli/export/secrets.export.cli-command.impl.d.ts +5 -0
  20. package/dist/cli/export/secrets.export.cli-command.impl.d.ts.map +1 -0
  21. package/dist/cli/export/secrets.export.cli-command.impl.js +104 -0
  22. package/dist/cli/export/secrets.export.cli-command.impl.js.map +1 -0
  23. package/dist/cli/hooks/pre-commit-secrets.d.ts +2 -0
  24. package/dist/cli/hooks/pre-commit-secrets.d.ts.map +1 -0
  25. package/dist/cli/hooks/pre-commit-secrets.js +68 -0
  26. package/dist/cli/hooks/pre-commit-secrets.js.map +1 -0
  27. package/dist/cli/import/secrets.import.cli-command.descriptor.d.ts +4 -0
  28. package/dist/cli/import/secrets.import.cli-command.descriptor.d.ts.map +1 -0
  29. package/dist/cli/import/secrets.import.cli-command.descriptor.js +19 -0
  30. package/dist/cli/import/secrets.import.cli-command.descriptor.js.map +1 -0
  31. package/dist/cli/import/secrets.import.cli-command.impl.d.ts +5 -0
  32. package/dist/cli/import/secrets.import.cli-command.impl.d.ts.map +1 -0
  33. package/dist/cli/import/secrets.import.cli-command.impl.js +155 -0
  34. package/dist/cli/import/secrets.import.cli-command.impl.js.map +1 -0
  35. package/dist/cli/list/secrets.list.cli-command.descriptor.d.ts +4 -0
  36. package/dist/cli/list/secrets.list.cli-command.descriptor.d.ts.map +1 -0
  37. package/dist/cli/list/secrets.list.cli-command.descriptor.js +18 -0
  38. package/dist/cli/list/secrets.list.cli-command.descriptor.js.map +1 -0
  39. package/dist/cli/list/secrets.list.cli-command.impl.d.ts +5 -0
  40. package/dist/cli/list/secrets.list.cli-command.impl.d.ts.map +1 -0
  41. package/dist/cli/list/secrets.list.cli-command.impl.js +61 -0
  42. package/dist/cli/list/secrets.list.cli-command.impl.js.map +1 -0
  43. package/dist/cli/pre-commit/secrets.pre-commit-check.cli-command.descriptor.d.ts +4 -0
  44. package/dist/cli/pre-commit/secrets.pre-commit-check.cli-command.descriptor.d.ts.map +1 -0
  45. package/dist/cli/pre-commit/secrets.pre-commit-check.cli-command.descriptor.js +16 -0
  46. package/dist/cli/pre-commit/secrets.pre-commit-check.cli-command.descriptor.js.map +1 -0
  47. package/dist/cli/pre-commit/secrets.pre-commit-check.cli-command.impl.d.ts +5 -0
  48. package/dist/cli/pre-commit/secrets.pre-commit-check.cli-command.impl.d.ts.map +1 -0
  49. package/dist/cli/pre-commit/secrets.pre-commit-check.cli-command.impl.js +10 -0
  50. package/dist/cli/pre-commit/secrets.pre-commit-check.cli-command.impl.js.map +1 -0
  51. package/dist/cli/pull/secrets.pull.cli-command.descriptor.d.ts +4 -0
  52. package/dist/cli/pull/secrets.pull.cli-command.descriptor.d.ts.map +1 -0
  53. package/dist/cli/pull/secrets.pull.cli-command.descriptor.js +20 -0
  54. package/dist/cli/pull/secrets.pull.cli-command.descriptor.js.map +1 -0
  55. package/dist/cli/pull/secrets.pull.cli-command.impl.d.ts +5 -0
  56. package/dist/cli/pull/secrets.pull.cli-command.impl.d.ts.map +1 -0
  57. package/dist/cli/pull/secrets.pull.cli-command.impl.js +76 -0
  58. package/dist/cli/pull/secrets.pull.cli-command.impl.js.map +1 -0
  59. package/dist/cli/push/secrets.push.cli-command.descriptor.d.ts +4 -0
  60. package/dist/cli/push/secrets.push.cli-command.descriptor.d.ts.map +1 -0
  61. package/dist/cli/push/secrets.push.cli-command.descriptor.js +22 -0
  62. package/dist/cli/push/secrets.push.cli-command.descriptor.js.map +1 -0
  63. package/dist/cli/push/secrets.push.cli-command.impl.d.ts +5 -0
  64. package/dist/cli/push/secrets.push.cli-command.impl.d.ts.map +1 -0
  65. package/dist/cli/push/secrets.push.cli-command.impl.js +109 -0
  66. package/dist/cli/push/secrets.push.cli-command.impl.js.map +1 -0
  67. package/dist/cli/reveal/secrets.reveal.cli-command.descriptor.d.ts +4 -0
  68. package/dist/cli/reveal/secrets.reveal.cli-command.descriptor.d.ts.map +1 -0
  69. package/dist/cli/reveal/secrets.reveal.cli-command.descriptor.js +19 -0
  70. package/dist/cli/reveal/secrets.reveal.cli-command.descriptor.js.map +1 -0
  71. package/dist/cli/reveal/secrets.reveal.cli-command.impl.d.ts +5 -0
  72. package/dist/cli/reveal/secrets.reveal.cli-command.impl.d.ts.map +1 -0
  73. package/dist/cli/reveal/secrets.reveal.cli-command.impl.js +85 -0
  74. package/dist/cli/reveal/secrets.reveal.cli-command.impl.js.map +1 -0
  75. package/dist/cli/secrets.cli-group.descriptor.d.ts +4 -0
  76. package/dist/cli/secrets.cli-group.descriptor.d.ts.map +1 -0
  77. package/dist/cli/secrets.cli-group.descriptor.js +11 -0
  78. package/dist/cli/secrets.cli-group.descriptor.js.map +1 -0
  79. package/dist/cli/set/secrets.set.cli-command.descriptor.d.ts +4 -0
  80. package/dist/cli/set/secrets.set.cli-command.descriptor.d.ts.map +1 -0
  81. package/dist/cli/set/secrets.set.cli-command.descriptor.js +21 -0
  82. package/dist/cli/set/secrets.set.cli-command.descriptor.js.map +1 -0
  83. package/dist/cli/set/secrets.set.cli-command.impl.d.ts +5 -0
  84. package/dist/cli/set/secrets.set.cli-command.impl.d.ts.map +1 -0
  85. package/dist/cli/set/secrets.set.cli-command.impl.js +59 -0
  86. package/dist/cli/set/secrets.set.cli-command.impl.js.map +1 -0
  87. package/dist/cli/shared/resolve-environment.d.ts +14 -0
  88. package/dist/cli/shared/resolve-environment.d.ts.map +1 -0
  89. package/dist/cli/shared/resolve-environment.js +45 -0
  90. package/dist/cli/shared/resolve-environment.js.map +1 -0
  91. package/dist/cli/unset/secrets.unset.cli-command.descriptor.d.ts +4 -0
  92. package/dist/cli/unset/secrets.unset.cli-command.descriptor.d.ts.map +1 -0
  93. package/dist/cli/unset/secrets.unset.cli-command.descriptor.js +20 -0
  94. package/dist/cli/unset/secrets.unset.cli-command.descriptor.js.map +1 -0
  95. package/dist/cli/unset/secrets.unset.cli-command.impl.d.ts +5 -0
  96. package/dist/cli/unset/secrets.unset.cli-command.impl.d.ts.map +1 -0
  97. package/dist/cli/unset/secrets.unset.cli-command.impl.js +31 -0
  98. package/dist/cli/unset/secrets.unset.cli-command.impl.js.map +1 -0
  99. package/dist/docs/backends.docs.descriptor.d.ts +4 -0
  100. package/dist/docs/backends.docs.descriptor.d.ts.map +1 -0
  101. package/dist/docs/backends.docs.descriptor.js +149 -0
  102. package/dist/docs/backends.docs.descriptor.js.map +1 -0
  103. package/dist/docs/encryption.docs.descriptor.d.ts +4 -0
  104. package/dist/docs/encryption.docs.descriptor.d.ts.map +1 -0
  105. package/dist/docs/encryption.docs.descriptor.js +163 -0
  106. package/dist/docs/encryption.docs.descriptor.js.map +1 -0
  107. package/dist/docs/env-file.docs.descriptor.d.ts +4 -0
  108. package/dist/docs/env-file.docs.descriptor.d.ts.map +1 -0
  109. package/dist/docs/env-file.docs.descriptor.js +207 -0
  110. package/dist/docs/env-file.docs.descriptor.js.map +1 -0
  111. package/dist/index.d.ts +13 -0
  112. package/dist/index.d.ts.map +1 -0
  113. package/dist/index.js +13 -0
  114. package/dist/index.js.map +1 -0
  115. package/dist/kinds/index.d.ts +4 -0
  116. package/dist/kinds/index.d.ts.map +1 -0
  117. package/dist/kinds/index.js +3 -0
  118. package/dist/kinds/index.js.map +1 -0
  119. package/dist/kinds/schemas/store.schema.d.ts +49 -0
  120. package/dist/kinds/schemas/store.schema.d.ts.map +1 -0
  121. package/dist/kinds/schemas/store.schema.js +34 -0
  122. package/dist/kinds/schemas/store.schema.js.map +1 -0
  123. package/dist/kinds/schemas/store.types.d.ts +28 -0
  124. package/dist/kinds/schemas/store.types.d.ts.map +1 -0
  125. package/dist/kinds/schemas/store.types.js +2 -0
  126. package/dist/kinds/schemas/store.types.js.map +1 -0
  127. package/dist/kinds/store.interface.d.ts +2 -0
  128. package/dist/kinds/store.interface.d.ts.map +1 -0
  129. package/dist/kinds/store.interface.js +2 -0
  130. package/dist/kinds/store.interface.js.map +1 -0
  131. package/dist/kinds/store.kind.d.ts +10 -0
  132. package/dist/kinds/store.kind.d.ts.map +1 -0
  133. package/dist/kinds/store.kind.js +36 -0
  134. package/dist/kinds/store.kind.js.map +1 -0
  135. package/dist/kinds/store.schema.d.ts +2 -0
  136. package/dist/kinds/store.schema.d.ts.map +1 -0
  137. package/dist/kinds/store.schema.js +2 -0
  138. package/dist/kinds/store.schema.js.map +1 -0
  139. package/dist/manifest/canonical.d.ts +30 -0
  140. package/dist/manifest/canonical.d.ts.map +1 -0
  141. package/dist/manifest/canonical.js +313 -0
  142. package/dist/manifest/canonical.js.map +1 -0
  143. package/dist/manifest/import-manifest.schema.d.ts +77 -0
  144. package/dist/manifest/import-manifest.schema.d.ts.map +1 -0
  145. package/dist/manifest/import-manifest.schema.js +55 -0
  146. package/dist/manifest/import-manifest.schema.js.map +1 -0
  147. package/dist/manifest/index.d.ts +3 -0
  148. package/dist/manifest/index.d.ts.map +1 -0
  149. package/dist/manifest/index.js +3 -0
  150. package/dist/manifest/index.js.map +1 -0
  151. package/dist/requirements/index.d.ts +2 -0
  152. package/dist/requirements/index.d.ts.map +1 -0
  153. package/dist/requirements/index.js +2 -0
  154. package/dist/requirements/index.js.map +1 -0
  155. package/dist/requirements/resolver.d.ts +52 -0
  156. package/dist/requirements/resolver.d.ts.map +1 -0
  157. package/dist/requirements/resolver.js +196 -0
  158. package/dist/requirements/resolver.js.map +1 -0
  159. package/dist/requirements/schemas/requirements.d.ts +27 -0
  160. package/dist/requirements/schemas/requirements.d.ts.map +1 -0
  161. package/dist/requirements/schemas/requirements.js +2 -0
  162. package/dist/requirements/schemas/requirements.js.map +1 -0
  163. package/dist/secrets.plugin.d.ts +8 -0
  164. package/dist/secrets.plugin.d.ts.map +1 -0
  165. package/dist/secrets.plugin.js +59 -0
  166. package/dist/secrets.plugin.js.map +1 -0
  167. package/package.json +108 -0
  168. package/src/cli/check/schemas/check-result.ts +8 -0
  169. package/src/cli/check/secrets.check.cli-command.descriptor.ts +21 -0
  170. package/src/cli/check/secrets.check.cli-command.impl.ts +163 -0
  171. package/src/cli/export/secrets.export.cli-command.descriptor.ts +22 -0
  172. package/src/cli/export/secrets.export.cli-command.impl.ts +139 -0
  173. package/src/cli/hooks/pre-commit-secrets.ts +73 -0
  174. package/src/cli/import/secrets.import.cli-command.descriptor.ts +21 -0
  175. package/src/cli/import/secrets.import.cli-command.impl.ts +178 -0
  176. package/src/cli/list/secrets.list.cli-command.descriptor.ts +21 -0
  177. package/src/cli/list/secrets.list.cli-command.impl.ts +79 -0
  178. package/src/cli/pre-commit/secrets.pre-commit-check.cli-command.descriptor.ts +18 -0
  179. package/src/cli/pre-commit/secrets.pre-commit-check.cli-command.impl.ts +11 -0
  180. package/src/cli/pull/secrets.pull.cli-command.descriptor.ts +22 -0
  181. package/src/cli/pull/secrets.pull.cli-command.impl.ts +103 -0
  182. package/src/cli/push/secrets.push.cli-command.descriptor.ts +24 -0
  183. package/src/cli/push/secrets.push.cli-command.impl.ts +149 -0
  184. package/src/cli/reveal/secrets.reveal.cli-command.descriptor.ts +21 -0
  185. package/src/cli/reveal/secrets.reveal.cli-command.impl.ts +108 -0
  186. package/src/cli/secrets.cli-group.descriptor.ts +13 -0
  187. package/src/cli/set/secrets.set.cli-command.descriptor.ts +23 -0
  188. package/src/cli/set/secrets.set.cli-command.impl.ts +77 -0
  189. package/src/cli/shared/resolve-environment.ts +57 -0
  190. package/src/cli/unset/secrets.unset.cli-command.descriptor.ts +22 -0
  191. package/src/cli/unset/secrets.unset.cli-command.impl.ts +41 -0
  192. package/src/docs/backends.docs.descriptor.ts +151 -0
  193. package/src/docs/encryption.docs.descriptor.ts +165 -0
  194. package/src/docs/env-file.docs.descriptor.ts +209 -0
  195. package/src/index.ts +35 -0
  196. package/src/kinds/index.ts +12 -0
  197. package/src/kinds/schemas/store.schema.ts +47 -0
  198. package/src/kinds/schemas/store.types.ts +35 -0
  199. package/src/kinds/store.interface.ts +1 -0
  200. package/src/kinds/store.kind.ts +52 -0
  201. package/src/kinds/store.schema.ts +8 -0
  202. package/src/manifest/canonical.ts +324 -0
  203. package/src/manifest/import-manifest.schema.ts +63 -0
  204. package/src/manifest/index.ts +12 -0
  205. package/src/requirements/index.ts +6 -0
  206. package/src/requirements/resolver.ts +216 -0
  207. package/src/requirements/schemas/requirements.ts +29 -0
  208. package/src/secrets.plugin.ts +65 -0
@@ -0,0 +1,216 @@
1
+ /**
2
+ * Secret Requirements Resolver
3
+ *
4
+ * Resolves secret requirements from two intentional sources:
5
+ *
6
+ * 1. Runtime infra descriptors (`.infra.ts` files) — workers and infrastructure.
7
+ * Queries runtime for `infra/worker` descriptors. Workers (e.g. job-workers)
8
+ * declare secrets here because they are infrastructure resources, not web apps.
9
+ * The `infra/web-app` path is kept for completeness but no longer discovers
10
+ * vestigial descriptors (deleted 2026-05-20).
11
+ *
12
+ * 2. `deployment.config.ts` files — the canonical per-app deployment system.
13
+ * Loads each config via `@vibesdotdev/infra-deploy` and extracts `secret: true`
14
+ * env entries from the `AppDeployment.env` array. This is the authoritative
15
+ * source for web-app secrets.
16
+ *
17
+ * The two-system split is intentional, not transitional:
18
+ * - `.infra.ts` = infrastructure resources + workers (runtime-discovered assets)
19
+ * - `deployment.config.ts` = web app deployments (build + deploy orchestration)
20
+ *
21
+ * Used by `vibes secrets check` to cross-reference stored secrets against
22
+ * declared requirements.
23
+ */
24
+
25
+ import type { WebAppDescriptor, WorkerDescriptor } from '@vibesdotdev/infra-core/kinds';
26
+ import { loadDeploymentConfig } from '@vibesdotdev/infra-deploy';
27
+ import type {
28
+ RequirementInfraDescriptor,
29
+ SecretRequirement,
30
+ SecretRequirementsRuntime
31
+ } from './schemas/requirements';
32
+
33
+ export type { SecretRequirement } from './schemas/requirements';
34
+
35
+ /**
36
+ * Baked secret requirements captured at compile time by
37
+ * `apps/cli-bin/scripts/build.ts`. Compiled binaries can't re-import
38
+ * workspace `deployment.config.ts` files at runtime (their workspace
39
+ * specifiers don't resolve from the standalone executable), so we read
40
+ * pre-extracted requirements from this define-injected JSON string.
41
+ * In dev mode (source-run, tests) the symbol is undefined and we fall
42
+ * back to live discovery via `resolveFromDeploymentConfigs`.
43
+ */
44
+ declare const __VIBES_BAKED_SECRET_REQUIREMENTS__: string;
45
+ const BAKED_SECRET_REQUIREMENTS_JSON: string =
46
+ typeof __VIBES_BAKED_SECRET_REQUIREMENTS__ !== 'undefined'
47
+ ? __VIBES_BAKED_SECRET_REQUIREMENTS__
48
+ : '[]';
49
+
50
+ function readBakedRequirements(): SecretRequirement[] {
51
+ if (!BAKED_SECRET_REQUIREMENTS_JSON || BAKED_SECRET_REQUIREMENTS_JSON === '[]') {
52
+ return [];
53
+ }
54
+ try {
55
+ const parsed = JSON.parse(BAKED_SECRET_REQUIREMENTS_JSON);
56
+ return Array.isArray(parsed) ? (parsed as SecretRequirement[]) : [];
57
+ } catch {
58
+ return [];
59
+ }
60
+ }
61
+
62
+ function extractRequirements(descriptors: RequirementInfraDescriptor[]): SecretRequirement[] {
63
+ const results: SecretRequirement[] = [];
64
+ for (const desc of descriptors) {
65
+ if (!desc.env) continue;
66
+ for (const entry of desc.env) {
67
+ if (!entry.secret) continue;
68
+ results.push({
69
+ key: entry.name,
70
+ appId: desc.id,
71
+ required: entry.required ?? true,
72
+ description: entry.description
73
+ });
74
+ }
75
+ }
76
+ return results;
77
+ }
78
+
79
+ /**
80
+ * Resolve secret requirements from deployment.config.ts files.
81
+ *
82
+ * Walks the workspace for `deployment.config.ts` files (same discovery logic
83
+ * as `infra-deploy regenerate`), loads each via subprocess, and extracts
84
+ * `secret: true` env entries from the `AppDeployment.env` array.
85
+ */
86
+ async function resolveFromDeploymentConfigs(
87
+ rootDir: string
88
+ ): Promise<SecretRequirement[]> {
89
+ const { readdirSync, statSync } = await import('node:fs');
90
+ const { join } = await import('node:path');
91
+
92
+ const IGNORED = new Set([
93
+ 'node_modules', '.git', '.svelte-kit', 'dist', '.next', '.turbo', '.vite', '.wrangler'
94
+ ]);
95
+ const CONFIG_NAMES = new Set([
96
+ 'deployment.config.ts', 'deployment.config.js', 'deployment.config.mjs'
97
+ ]);
98
+
99
+ // Discover deployment.config.ts files (mirrors infra-deploy's findDeploymentConfigs)
100
+ const configs: string[] = [];
101
+ function walk(dir: string, depth: number): void {
102
+ if (depth > 4) return;
103
+ let entries: string[];
104
+ try { entries = readdirSync(dir); } catch { return; }
105
+ for (const entry of entries) {
106
+ if (CONFIG_NAMES.has(entry)) configs.push(join(dir, entry));
107
+ }
108
+ for (const entry of entries) {
109
+ if (IGNORED.has(entry) || entry.startsWith('.')) continue;
110
+ const full = join(dir, entry);
111
+ let info;
112
+ try { info = statSync(full); } catch { continue; }
113
+ if (info.isDirectory()) walk(full, depth + 1);
114
+ }
115
+ }
116
+ walk(rootDir, 0);
117
+
118
+ const requirements: SecretRequirement[] = [];
119
+ for (const configPath of configs) {
120
+ const appDir = configPath.replace(/\/deployment\.config\.(ts|js|mjs)$/, '');
121
+ try {
122
+ const loaded = await loadDeploymentConfig(appDir);
123
+ for (const entry of loaded.deployment.env) {
124
+ if (!entry.secret) continue;
125
+ requirements.push({
126
+ key: entry.name,
127
+ appId: loaded.deployment.appId,
128
+ required: entry.required ?? true,
129
+ description: entry.description
130
+ });
131
+ }
132
+ } catch {
133
+ // Config load failures are non-fatal for secret resolution.
134
+ // The regen pipeline catches these separately.
135
+ }
136
+ }
137
+ return requirements;
138
+ }
139
+
140
+ /**
141
+ * Resolve all secret requirements from infra descriptors and deployment configs.
142
+ *
143
+ * Queries two sources:
144
+ * 1. Runtime for `infra/worker` descriptors (`.infra.ts` — workers + infrastructure)
145
+ * 2. `deployment.config.ts` files via `@vibesdotdev/infra-deploy` (web apps)
146
+ *
147
+ * These two sources are mutually exclusive by app type, so there should be no
148
+ * overlap. Both are queried to cover the full surface:
149
+ * - Workers declare secrets in `.infra.ts` (job-workers, ai-workers, etc.)
150
+ * - Web apps declare secrets in `deployment.config.ts` (auth-web, ai-web, etc.)
151
+ *
152
+ * Deployment config entries are appended after descriptor entries.
153
+ * Duplicates are harmless for check reporting.
154
+ */
155
+ export async function resolveSecretRequirements(
156
+ runtime: SecretRequirementsRuntime,
157
+ options?: { deploymentConfigRoot?: string }
158
+ ): Promise<SecretRequirement[]> {
159
+ const requirements: SecretRequirement[] = [];
160
+
161
+ if (runtime.hasKind('infra/web-app')) {
162
+ const webApps = runtime.assets('infra/web-app').descriptors() as WebAppDescriptor[];
163
+ requirements.push(...extractRequirements(webApps));
164
+ }
165
+
166
+ if (runtime.hasKind('infra/worker')) {
167
+ const workers = runtime.assets('infra/worker').descriptors() as WorkerDescriptor[];
168
+ requirements.push(...extractRequirements(workers));
169
+ }
170
+
171
+ // Load web-app secrets from deployment.config.ts — the canonical source.
172
+ // Falls back to process.cwd() when no root is explicitly provided.
173
+ let liveDeployReqs: SecretRequirement[] = [];
174
+ if (options?.deploymentConfigRoot || typeof process !== 'undefined') {
175
+ const root = options?.deploymentConfigRoot ?? process.cwd();
176
+ try {
177
+ liveDeployReqs = await resolveFromDeploymentConfigs(root);
178
+ } catch {
179
+ // infra-deploy subprocess failures shouldn't block the check.
180
+ }
181
+ }
182
+
183
+ // In compiled binaries, `resolveFromDeploymentConfigs` returns [] because
184
+ // the standalone executable can't import workspace deployment.config.ts
185
+ // files at runtime. Fall back to the build-time snapshot captured by
186
+ // `apps/cli-bin/scripts/build.ts` so `--app <id>` filtering still works.
187
+ if (liveDeployReqs.length === 0) {
188
+ requirements.push(...readBakedRequirements());
189
+ } else {
190
+ requirements.push(...liveDeployReqs);
191
+ }
192
+
193
+ return requirements;
194
+ }
195
+
196
+ /**
197
+ * Group requirements by app/worker ID for per-app reporting.
198
+ */
199
+ export function groupRequirementsByApp(
200
+ requirements: SecretRequirement[]
201
+ ): Map<string, SecretRequirement[]> {
202
+ const grouped = new Map<string, SecretRequirement[]>();
203
+ for (const req of requirements) {
204
+ const existing = grouped.get(req.appId) ?? [];
205
+ existing.push(req);
206
+ grouped.set(req.appId, existing);
207
+ }
208
+ return grouped;
209
+ }
210
+
211
+ /**
212
+ * Get unique secret keys across all apps (deduped).
213
+ */
214
+ export function uniqueSecretKeys(requirements: SecretRequirement[]): string[] {
215
+ return [...new Set(requirements.map((r) => r.key))];
216
+ }
@@ -0,0 +1,29 @@
1
+ export interface SecretRequirement {
2
+ /** Secret key name (e.g., VIBES_AUTH_SECRET) */
3
+ key: string;
4
+ /** App or worker ID that requires this secret */
5
+ appId: string;
6
+ /** Whether the secret is required for the app to function */
7
+ required: boolean;
8
+ /** Human-readable description of the secret's purpose */
9
+ description: string | undefined;
10
+ }
11
+
12
+ export interface RequirementEnvEntry {
13
+ name: string;
14
+ secret?: boolean;
15
+ required?: boolean;
16
+ description?: string;
17
+ }
18
+
19
+ export interface RequirementInfraDescriptor {
20
+ id: string;
21
+ env?: RequirementEnvEntry[];
22
+ }
23
+
24
+ export interface SecretRequirementsRuntime {
25
+ hasKind(kind: string): boolean;
26
+ assets(kind: string): {
27
+ descriptors(): RequirementInfraDescriptor[];
28
+ };
29
+ }
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Secrets Runtime Plugin
3
+ *
4
+ * Registers the secrets/store kind and CLI backend loaders.
5
+ */
6
+
7
+ import { createRuntimePlugin, loader } from '@vibesdotdev/runtime';
8
+ import type { RuntimeKindDescriptorRecord } from '@vibesdotdev/runtime/schemas/kind';
9
+ import { secretsStoreKind } from './kinds/store.kind';
10
+
11
+ // CLI
12
+ import secretsGroup from './cli/secrets.cli-group.descriptor.ts';
13
+ import secretsCheck from './cli/check/secrets.check.cli-command.descriptor.ts';
14
+ import secretsImport from './cli/import/secrets.import.cli-command.descriptor.ts';
15
+ import secretsExport from './cli/export/secrets.export.cli-command.descriptor.ts';
16
+ import secretsList from './cli/list/secrets.list.cli-command.descriptor.ts';
17
+ import secretsPull from './cli/pull/secrets.pull.cli-command.descriptor.ts';
18
+ import secretsPush from './cli/push/secrets.push.cli-command.descriptor.ts';
19
+ import secretsSet from './cli/set/secrets.set.cli-command.descriptor.ts';
20
+ import secretsUnset from './cli/unset/secrets.unset.cli-command.descriptor.ts';
21
+ import secretsReveal from './cli/reveal/secrets.reveal.cli-command.descriptor.ts';
22
+ import secretsPreCommitCheck from './cli/pre-commit/secrets.pre-commit-check.cli-command.descriptor.ts';
23
+
24
+ // Docs
25
+ import secretsBackendsDescriptor from './docs/backends.docs.descriptor.ts';
26
+ import secretsEncryptionDescriptor from './docs/encryption.docs.descriptor.ts';
27
+ import secretsEnvFileDescriptor from './docs/env-file.docs.descriptor.ts';
28
+
29
+ export default createRuntimePlugin({
30
+ id: 'secrets',
31
+ name: 'Secrets Management',
32
+ description: 'Environment-aware secrets storage with multiple backends',
33
+ dependencies: ['config'],
34
+ kinds: [secretsStoreKind as RuntimeKindDescriptorRecord],
35
+
36
+ descriptors: [
37
+ secretsGroup,
38
+ secretsCheck,
39
+ secretsImport,
40
+ secretsExport,
41
+ secretsList,
42
+ secretsPull,
43
+ secretsPush,
44
+ secretsSet,
45
+ secretsUnset,
46
+ secretsReveal,
47
+ secretsPreCommitCheck,
48
+ secretsBackendsDescriptor,
49
+ secretsEncryptionDescriptor,
50
+ secretsEnvFileDescriptor
51
+ ],
52
+
53
+ loaders: [
54
+ loader('secrets.check', () => import('./cli/check/secrets.check.cli-command.impl.js')),
55
+ loader('secrets.import', () => import('./cli/import/secrets.import.cli-command.impl.js')),
56
+ loader('secrets.export', () => import('./cli/export/secrets.export.cli-command.impl.js')),
57
+ loader('secrets.list', () => import('./cli/list/secrets.list.cli-command.impl.js')),
58
+ loader('secrets.pull', () => import('./cli/pull/secrets.pull.cli-command.impl.js')),
59
+ loader('secrets.push', () => import('./cli/push/secrets.push.cli-command.impl.js')),
60
+ loader('secrets.set', () => import('./cli/set/secrets.set.cli-command.impl.js')),
61
+ loader('secrets.unset', () => import('./cli/unset/secrets.unset.cli-command.impl.js')),
62
+ loader('secrets.reveal', () => import('./cli/reveal/secrets.reveal.cli-command.impl.js')),
63
+ loader('dev.secrets.pre-commit-check', () => import('./cli/pre-commit/secrets.pre-commit-check.cli-command.impl.js'))
64
+ ]
65
+ });