temporal-explorer 0.0.0-mvp

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024–2026 Steve Kinney
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,149 @@
1
+ # Temporal Workflow Explorer
2
+
3
+ A local-first developer tool that explains Temporal TypeScript Workflows from
4
+ two directions: static source analysis answers _what can this Workflow do?_,
5
+ and runtime Event History analysis answers _what did this specific Workflow
6
+ Execution actually do?_
7
+
8
+ ```text
9
+ Explain this Temporal Workflow execution using the source code as the map.
10
+ ```
11
+
12
+ Everything runs locally. Source code, Event Histories, and payloads never
13
+ leave your machine, and payload previews are redacted by default.
14
+
15
+ ## Quick Start
16
+
17
+ ```bash
18
+ bun add -d temporal-explorer
19
+
20
+ # Inspect a conventional Temporal TypeScript project with no configuration
21
+ bunx temporal-explorer list
22
+ bunx temporal-explorer show orderWorkflow
23
+
24
+ # Import an Event History and explain the execution against the source
25
+ bunx temporal-explorer history import --file history.json
26
+ bunx temporal-explorer trace orderWorkflow --history history
27
+ bunx temporal-explorer report --trace history
28
+
29
+ # Generate committable docs, SDK-oriented declarations, and CI diagnostics
30
+ bunx temporal-explorer docs
31
+ bunx temporal-explorer types
32
+ bunx temporal-explorer check
33
+
34
+ # Open the local artifact-driven explorer UI
35
+ bunx temporal-explorer open
36
+ ```
37
+
38
+ ## What It Does
39
+
40
+ - **Static analysis** discovers Workflows, Activities, Signals, Queries,
41
+ Updates (with validators), timers, conditions, child Workflows, external
42
+ Workflow signals, cancellation scopes, `continueAsNew`, versioning patches,
43
+ and dynamic Activity dispatch — each with source locations and an explicit
44
+ confidence level. Determinism problems (nondeterministic APIs, Node imports
45
+ in Workflow code, Query handler mutations, duplicate message names) surface
46
+ as diagnostics with stable codes.
47
+ - **Event History import** collapses raw events into semantic runtime
48
+ operations: Activity executions with true attempt counts, Signal
49
+ deliveries, timer outcomes, Update lifecycles, child Workflows, markers,
50
+ cancellations, and continue-as-new rollovers.
51
+ - **The execution overlay** joins both sides: every runtime operation maps to
52
+ a static node with recorded evidence, or is explicitly unmapped. Skipped
53
+ branches, retried Activities, canceled timers, and executed version
54
+ branches are all visible. Optional `--replay` uses the Temporal SDK replayer
55
+ to resolve dynamic dispatch with higher confidence.
56
+ - **Generated documentation** is deterministic and safe to commit: Markdown
57
+ pages, Mermaid diagrams, and real `.d.ts` declaration files that preserve
58
+ imports of your own types.
59
+ - **Live connections** (optional) list Workflow Executions and fetch Event
60
+ Histories from configured Temporal instances into the same artifact model
61
+ as file imports.
62
+ - **Aggregate analysis** summarizes many executions: retry hot spots, failure
63
+ counts, message frequencies, timer outcomes, hot paths, and rare branches.
64
+ - **The local UI** (`temporal-explorer open`) renders validated JSON
65
+ artifacts: workflow overviews, message surfaces, an interactive Svelte
66
+ Flow + ELK graph, semantic timelines, and a source-aware trace inspector.
67
+
68
+ ## Configuration (optional)
69
+
70
+ Conventional projects need no configuration. When defaults are wrong, create
71
+ `temporal-explorer.config.ts`:
72
+
73
+ ```ts
74
+ import { defineConfig } from 'temporal-explorer';
75
+
76
+ export default defineConfig({
77
+ temporal: { workflowGlobs: ['src/workflows/**/*.ts'] },
78
+ diagnostics: { TEA_DYNAMIC_ACTIVITY_CALL: 'error' },
79
+ connections: {
80
+ local: { address: 'localhost:7233', namespace: 'default' },
81
+ },
82
+ history: {
83
+ payloads: { decode: false, redact: ['password', 'token'], maxPreviewBytes: 2048 },
84
+ },
85
+ });
86
+ ```
87
+
88
+ ## Library Usage
89
+
90
+ Everything the CLI does is a typed library function first:
91
+
92
+ ```ts
93
+ import {
94
+ analyzeWorkflowFiles,
95
+ createExecutionOverlay,
96
+ importHistoryFromFile,
97
+ } from 'temporal-explorer';
98
+
99
+ const analysis = await analyzeWorkflowFiles({
100
+ projectRoot: process.cwd(),
101
+ tsconfig: 'tsconfig.json',
102
+ workflowFiles: ['src/workflows/order.workflow.ts'],
103
+ });
104
+ const trace = await importHistoryFromFile({ file: 'history.json' });
105
+ const overlay = createExecutionOverlay({
106
+ analysis: analysis.value,
107
+ trace: trace.value,
108
+ workflowName: 'orderWorkflow',
109
+ });
110
+ ```
111
+
112
+ See `examples/` for runnable direct-file, Event History, and project-level
113
+ usage.
114
+
115
+ ## Artifacts Are the Contract
116
+
117
+ Every artifact (`temporal-analysis/v1`, `temporal-trace/v1`,
118
+ `temporal-overlay/v1`) is schema-validated before it is written, and JSON
119
+ Schema documents are checked in under `packages/schemas/json-schema/` for
120
+ non-TypeScript tools. See `docs/schema-compatibility.md`.
121
+
122
+ ## Repository Layout
123
+
124
+ | Workspace | Purpose |
125
+ | -------------------- | ----------------------------------------------- |
126
+ | `apps/explorer` | SvelteKit local UI (Cinder + Svelte Flow + ELK) |
127
+ | `packages/api` | Public library surface |
128
+ | `packages/cli` | `temporal-explorer` command layer |
129
+ | `packages/schemas` | Zod artifact schemas + JSON Schema emission |
130
+ | `packages/analyzer` | ts-morph static analysis |
131
+ | `packages/history` | Event History parsing + live connections |
132
+ | `packages/mapper` | Source-to-runtime overlay + aggregate analysis |
133
+ | `packages/renderers` | Markdown, Mermaid, and `.d.ts` renderers |
134
+ | `fixtures/` | Real generated fixture projects and histories |
135
+
136
+ ## Development
137
+
138
+ ```bash
139
+ bun install
140
+ bun run validate # typecheck + lint + test + build + format
141
+ bun run fixtures:generate-histories # regenerate fixture histories (real Temporal runs)
142
+ bun run fixtures:regenerate-artifacts
143
+ bun run test:live # live-connection integration tests (starts a dev server)
144
+ bun run ui:e2e # Playwright gates for the local UI
145
+ bun run release:dry-run # build dist bundles and pack the tarball
146
+ ```
147
+
148
+ Implementation history, decisions, and verification logs live under
149
+ `docs/implementation/`.