@celilo/cli 0.22.0 → 0.23.0

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 (51) hide show
  1. package/CELILO_SUBSYSTEMS.md +34 -2
  2. package/drizzle/0024_module_pause.sql +20 -0
  3. package/drizzle/meta/_journal.json +8 -1
  4. package/package.json +4 -5
  5. package/src/__integration__/container-services-cli.integration.test.ts +8 -2
  6. package/src/api/remote-client.test.ts +6 -5
  7. package/src/api/serve.ts +41 -7
  8. package/src/api-clients/proxmox.ts +34 -0
  9. package/src/cli/commands/alerts-sweep.ts +2 -0
  10. package/src/cli/commands/events.ts +34 -3
  11. package/src/cli/commands/module-deploy.ts +2 -2
  12. package/src/cli/commands/module-health.ts +1 -0
  13. package/src/cli/commands/module-import.ts +3 -3
  14. package/src/cli/commands/module-list.ts +12 -1
  15. package/src/cli/commands/module-pause.ts +317 -0
  16. package/src/cli/commands/module-remove.ts +78 -40
  17. package/src/cli/commands/module-status.ts +3 -4
  18. package/src/cli/commands/module-update.test.ts +1 -1
  19. package/src/cli/commands/proxmox-template-selection.ts +1 -1
  20. package/src/cli/commands/status.ts +25 -3
  21. package/src/cli/completion.ts +4 -0
  22. package/src/cli/fuel-gauge.ts +4 -4
  23. package/src/cli/index.ts +45 -20
  24. package/src/cli/json-output.test.ts +162 -0
  25. package/src/cli/prompts.ts +53 -74
  26. package/src/cli/service-credential.ts +3 -3
  27. package/src/cli/stdout-is-undecorated.test.ts +94 -0
  28. package/src/cli/types.ts +7 -2
  29. package/src/db/schema.ts +73 -15
  30. package/src/hooks/run-named-hook.ts +28 -0
  31. package/src/services/alerting/suppression.test.ts +5 -0
  32. package/src/services/alerting/suppression.ts +18 -1
  33. package/src/services/alerting/sweep-runner.test.ts +1 -0
  34. package/src/services/alerting/sweep-runner.ts +11 -1
  35. package/src/services/bus-interview.ts +2 -2
  36. package/src/services/bus-secret-flow.test.ts +1 -1
  37. package/src/services/fleet-checks.ts +48 -0
  38. package/src/services/module-deploy.ts +1 -1
  39. package/src/services/module-pause-observability.test.ts +224 -0
  40. package/src/services/module-pause-quiescence.test.ts +163 -0
  41. package/src/services/module-pause.test.ts +573 -0
  42. package/src/services/module-pause.ts +544 -0
  43. package/src/services/remove-guard.test.ts +175 -0
  44. package/src/services/remove-guard.ts +109 -0
  45. package/src/services/terminal-responder.ts +16 -16
  46. package/src/services/update/dep-graph.test.ts +33 -4
  47. package/src/services/update/dep-graph.ts +39 -17
  48. package/src/services/zone-detector.ts +2 -39
  49. package/src/test-utils/cli.ts +15 -14
  50. package/src/test-utils/integration-guard.ts +26 -0
  51. package/src/test-utils/setup-test-db.ts +13 -23
@@ -1,30 +1,20 @@
1
1
  import { existsSync } from 'node:fs';
2
2
  import { unlink } from 'node:fs/promises';
3
- import { join } from 'node:path';
4
3
  import { migrate } from 'drizzle-orm/bun-sqlite/migrator';
5
- import { type DbClient, createDbClient } from '../db/client';
4
+ import { type DbClient, createDbClient, findMigrationsFolder } from '../db/client';
6
5
 
7
- /**
8
- * Find migrations folder relative to current working directory
9
- */
10
- function findMigrationsFolder(): string {
11
- // Try common locations
12
- const candidates = [
13
- './drizzle', // Running from backend directory
14
- './backend/drizzle', // Running from celilo directory
15
- join(process.cwd(), 'drizzle'), // Absolute from backend
16
- join(process.cwd(), 'backend', 'drizzle'), // Absolute from celilo
17
- ];
18
-
19
- for (const candidate of candidates) {
20
- const metaPath = join(candidate, 'meta', '_journal.json');
21
- if (existsSync(metaPath)) {
22
- return candidate;
23
- }
24
- }
25
-
26
- throw new Error(`Could not find drizzle migrations folder. Tried: ${candidates.join(', ')}`);
27
- }
6
+ // `findMigrationsFolder` is imported from db/client rather than redefined here.
7
+ // This file used to carry its own copy, and the copy had drifted: it listed
8
+ // only CWD-RELATIVE candidates (`./drizzle`, `process.cwd()/drizzle`, …) and was
9
+ // missing the `join(currentDir, '../../drizzle')` fallback that resolves
10
+ // relative to the source file.
11
+ //
12
+ // The effect was invisible from `apps/celilo` and total from the repo root —
13
+ // which is where CLAUDE.md says to run the gate. Every suite using
14
+ // setupTestDatabase threw here, left `db` unassigned, and then failed again in
15
+ // its own afterEach on `db.$client`, so one missing path candidate presented as
16
+ // hundreds of unrelated-looking assertion failures (celilo: 668 across the
17
+ // repo, 341 in apps/celilo/src alone).
28
18
 
29
19
  /**
30
20
  * Setup test database with real migrations