opencastle 0.27.2 → 0.28.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 (71) hide show
  1. package/bin/cli.mjs +13 -5
  2. package/dist/cli/convoy/engine.js +2 -2
  3. package/dist/cli/convoy/engine.js.map +1 -1
  4. package/dist/cli/convoy/engine.test.js +1 -1
  5. package/dist/cli/convoy/engine.test.js.map +1 -1
  6. package/dist/cli/convoy/issues.js +3 -3
  7. package/dist/cli/convoy/issues.js.map +1 -1
  8. package/dist/cli/convoy/issues.test.js +4 -3
  9. package/dist/cli/convoy/issues.test.js.map +1 -1
  10. package/dist/cli/pipeline.d.ts +3 -0
  11. package/dist/cli/pipeline.d.ts.map +1 -0
  12. package/dist/cli/pipeline.js +305 -0
  13. package/dist/cli/pipeline.js.map +1 -0
  14. package/dist/cli/plan.d.ts +37 -0
  15. package/dist/cli/plan.d.ts.map +1 -1
  16. package/dist/cli/plan.js +321 -161
  17. package/dist/cli/plan.js.map +1 -1
  18. package/dist/cli/run.d.ts.map +1 -1
  19. package/dist/cli/run.js +37 -1
  20. package/dist/cli/run.js.map +1 -1
  21. package/dist/cli/validate.d.ts +3 -0
  22. package/dist/cli/validate.d.ts.map +1 -0
  23. package/dist/cli/validate.js +60 -0
  24. package/dist/cli/validate.js.map +1 -0
  25. package/package.json +5 -3
  26. package/src/cli/convoy/engine.test.ts +1 -1
  27. package/src/cli/convoy/engine.ts +2 -2
  28. package/src/cli/convoy/issues.test.ts +3 -2
  29. package/src/cli/convoy/issues.ts +3 -3
  30. package/src/cli/pipeline.ts +343 -0
  31. package/src/cli/plan.ts +357 -153
  32. package/src/cli/run.ts +37 -1
  33. package/src/cli/validate.ts +65 -0
  34. package/src/dashboard/dist/data/convoy-list.json +65 -1
  35. package/src/dashboard/dist/data/convoys/demo-api-v2.json +177 -0
  36. package/src/dashboard/dist/data/convoys/demo-auth-revamp.json +239 -0
  37. package/src/dashboard/dist/data/convoys/demo-convoy-1.json +111 -0
  38. package/src/dashboard/dist/data/convoys/demo-convoy-2.json +72 -0
  39. package/src/dashboard/dist/data/convoys/demo-dashboard-ui.json +328 -0
  40. package/src/dashboard/dist/data/convoys/demo-data-pipeline.json +187 -0
  41. package/src/dashboard/dist/data/convoys/demo-deploy-ci.json +153 -0
  42. package/src/dashboard/dist/data/convoys/demo-docs-update.json +154 -0
  43. package/src/dashboard/dist/data/convoys/demo-perf-opt.json +227 -0
  44. package/src/dashboard/dist/data/events.ndjson +115 -0
  45. package/src/dashboard/dist/data/overall-stats.json +67 -12
  46. package/src/dashboard/dist/data/pipelines.ndjson +5285 -0
  47. package/src/dashboard/dist/index.html +39 -16
  48. package/src/dashboard/node_modules/.vite/deps/_metadata.json +6 -6
  49. package/src/dashboard/public/data/convoy-list.json +65 -1
  50. package/src/dashboard/public/data/convoys/demo-api-v2.json +177 -0
  51. package/src/dashboard/public/data/convoys/demo-auth-revamp.json +239 -0
  52. package/src/dashboard/public/data/convoys/demo-convoy-1.json +111 -0
  53. package/src/dashboard/public/data/convoys/demo-convoy-2.json +72 -0
  54. package/src/dashboard/public/data/convoys/demo-dashboard-ui.json +328 -0
  55. package/src/dashboard/public/data/convoys/demo-data-pipeline.json +187 -0
  56. package/src/dashboard/public/data/convoys/demo-deploy-ci.json +153 -0
  57. package/src/dashboard/public/data/convoys/demo-docs-update.json +154 -0
  58. package/src/dashboard/public/data/convoys/demo-perf-opt.json +227 -0
  59. package/src/dashboard/public/data/events.ndjson +115 -0
  60. package/src/dashboard/public/data/overall-stats.json +67 -12
  61. package/src/dashboard/public/data/pipelines.ndjson +5285 -0
  62. package/src/dashboard/scripts/etl.ts +38 -4
  63. package/src/dashboard/scripts/generate-demo-db.test.ts +30 -0
  64. package/src/dashboard/scripts/generate-demo-db.ts +507 -0
  65. package/src/dashboard/scripts/verify-demo-data.sh +51 -0
  66. package/src/dashboard/src/pages/index.astro +46 -23
  67. package/src/orchestrator/prompts/fix-convoy.prompt.md +79 -0
  68. package/src/orchestrator/prompts/generate-convoy.prompt.md +53 -58
  69. package/src/orchestrator/prompts/generate-prd.prompt.md +120 -0
  70. package/src/orchestrator/prompts/validate-convoy.prompt.md +89 -0
  71. package/src/orchestrator/prompts/validate-prd.prompt.md +83 -0
@@ -1,4 +1,4 @@
1
- import { existsSync, mkdirSync, writeFileSync } from 'node:fs'
1
+ import { existsSync, mkdirSync, writeFileSync, copyFileSync } from 'node:fs'
2
2
  import { resolve, dirname } from 'node:path'
3
3
  import { fileURLToPath } from 'node:url'
4
4
 
@@ -8,6 +8,7 @@ const __dirname = dirname(__filename)
8
8
  export interface EtlOptions {
9
9
  dbPath: string
10
10
  outputDir: string
11
+ eventsPath?: string
11
12
  }
12
13
 
13
14
  export interface EtlResult {
@@ -89,19 +90,52 @@ export async function runEtl(options: EtlOptions): Promise<EtlResult> {
89
90
  }
90
91
 
91
92
  console.log(`ETL complete: ${allConvoys.length} convoys exported, ${totalTasks} tasks.`)
93
+
94
+ // Copy observability event logs for the live dashboard charts
95
+ const eventsSource = options.eventsPath
96
+ ? resolve(process.cwd(), options.eventsPath)
97
+ : resolve(process.cwd(), '.opencastle', 'logs', 'events.ndjson')
98
+ if (existsSync(eventsSource)) {
99
+ copyFileSync(eventsSource, resolve(outputDir, 'events.ndjson'))
100
+ } else {
101
+ writeFileSync(resolve(outputDir, 'events.ndjson'), '', 'utf8')
102
+ }
103
+
104
+ // Copy pipelines log (optional, write empty if absent)
105
+ const pipelinesSource = resolve(process.cwd(), '.opencastle', 'logs', 'pipelines.ndjson')
106
+ if (existsSync(pipelinesSource)) {
107
+ copyFileSync(pipelinesSource, resolve(outputDir, 'pipelines.ndjson'))
108
+ } else {
109
+ writeFileSync(resolve(outputDir, 'pipelines.ndjson'), '', 'utf8')
110
+ }
111
+
92
112
  return { convoyCount: allConvoys.length, taskCount: totalTasks }
93
113
  } finally {
94
114
  store.close()
95
115
  }
96
116
  }
97
117
 
118
+ function parseArgs(): { db?: string; out?: string; events?: string } {
119
+ const args = process.argv.slice(2)
120
+ const result: Record<string, string> = {}
121
+ for (let i = 0; i < args.length; i++) {
122
+ const a = args[i]
123
+ if (a === '--db' && args[i+1]) { result.db = args[++i] }
124
+ else if (a === '--out' && args[i+1]) { result.out = args[++i] }
125
+ else if (a === '--events' && args[i+1]) { result.events = args[++i] }
126
+ }
127
+ return result
128
+ }
129
+
98
130
  const isMain =
99
131
  process.argv[1] != null &&
100
132
  fileURLToPath(import.meta.url) === resolve(process.argv[1])
133
+
101
134
  if (isMain) {
102
- const dbPath = resolve(process.cwd(), '.opencastle', 'convoy.db')
103
- const outputDir = resolve(__dirname, '..', 'public', 'data')
104
- runEtl({ dbPath, outputDir }).catch((err: unknown) => {
135
+ const parsed = parseArgs()
136
+ const dbPath = parsed.db != null ? resolve(process.cwd(), parsed.db) : resolve(process.cwd(), '.opencastle', 'convoy.db')
137
+ const outputDir = parsed.out != null ? resolve(process.cwd(), parsed.out) : resolve(__dirname, '..', 'public', 'data')
138
+ runEtl({ dbPath, outputDir, eventsPath: parsed.events }).catch((err: unknown) => {
105
139
  console.error('ETL failed:', (err as Error).message)
106
140
  process.exit(1)
107
141
  })
@@ -0,0 +1,30 @@
1
+ import { mkdtempSync, rmSync, readFileSync } from 'node:fs'
2
+ import { tmpdir } from 'node:os'
3
+ import { join } from 'node:path'
4
+ import { describe, it, expect, beforeEach, afterEach } from 'vitest'
5
+ import { createDemoDb } from './generate-demo-db.js'
6
+ import { runEtl } from './etl.js'
7
+
8
+ function makeTmp(): string {
9
+ return mkdtempSync(join(tmpdir(), 'demo-db-test-'))
10
+ }
11
+
12
+ let tmp: string
13
+ beforeEach(() => { tmp = makeTmp() })
14
+ afterEach(() => { try { rmSync(tmp, { recursive: true, force: true }) } catch {} })
15
+
16
+ describe('generate-demo-db + etl', () => {
17
+ it('creates a demo DB and produces ETL JSON', async () => {
18
+ const dbPath = join(tmp, 'convoy-demo.db')
19
+ await createDemoDb(dbPath)
20
+
21
+ const outDir = join(tmp, 'out')
22
+ const res = await runEtl({ dbPath, outputDir: outDir })
23
+
24
+ expect(res.convoyCount).toBeGreaterThanOrEqual(1)
25
+ const overall = JSON.parse(readFileSync(join(outDir, 'overall-stats.json'), 'utf8'))
26
+ const list = JSON.parse(readFileSync(join(outDir, 'convoy-list.json'), 'utf8'))
27
+ expect(Array.isArray(list)).toBe(true)
28
+ expect(overall).toHaveProperty('convoyCounts')
29
+ })
30
+ })