Skip to content

Commit b31d903

Browse files
committed
update extension docs
1 parent 17dd664 commit b31d903

File tree

2 files changed

+69
-96
lines changed

2 files changed

+69
-96
lines changed

vscode-debugger-extension/README.md

Lines changed: 68 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,42 @@ To connect to a different Server:
4141
- Edit the `Address` field
4242
- If you're using TLS (e.g. to connect to Temporal Cloud), check the box and select your client cert and key
4343

44-
### Entrypoint
44+
### Examples
4545

4646
#### TypeScript
4747

48-
By default, the extension will look for the file that calls the TypeScript replayer adapter at `src/debug-replayer.ts`. To use a different TypeScript or JavaScript file, set the `temporal.replayerEntryPoint` config:
48+
Create a small `replayer.ts` in your project that runs the Tyepscript replayer adapter in IDE mode and registers your workflow function, for example:
4949

50-
- Open or create `.vscode/settings.json`
51-
- Add the config field:
50+
1. Install the replayer first:
5251

53-
```json
54-
{
55-
"temporal.replayerEntryPoint": "test/different-file.ts"
56-
}
57-
```
52+
```
53+
npm i @phuongdnguyen/replayer-adapter-nodejs --save
54+
```
55+
56+
2. Install the debugger [tdlv](https://github.com/phuongdnguyen/temporal-workflow-debugger/releases/tag/tdlv-v0.0.2) and add it to PATH
57+
3. Verify tldv is installed in PATH
58+
59+
```
60+
tdlv --help
61+
Missing required flags: -lang
62+
63+
Tdlv (Temporal delve) is a temporal workflow debugger
64+
65+
Usage: tdlv [options]
66+
67+
-help
68+
Tdlv (Temporal delve) is a temporal workflow debugger, provide ability to focus on user workflow code in debug sessions (alias: -h)
69+
-install
70+
auto-install missing language debuggers
71+
-lang string
72+
[required] language to use for the workflow, available options: [go, python, js]
73+
-p int
74+
port for remote debugging (default 60000)
75+
-start
76+
start debugger
77+
```
5878

59-
Your entrypoint file should import the replayer adapter and your workflow:
79+
4. Your entrypoint file should import the replayer adapter and your workflow:
6080

6181
```typescript
6282
import { exampleWorkflow } from "./workflow"
@@ -67,12 +87,7 @@ async function main() {
6787
mode: ReplayMode.IDE,
6888
workerReplayOptions: {
6989
workflowsPath: require.resolve("./workflow.ts"),
70-
bundlerOptions: {
71-
ignoreModules: ["fs/promises", "@temporalio/worker", "path", "child_process"],
72-
},
73-
debugMode: true,
7490
},
75-
debuggerAddr: "http://127.0.0.1:54578",
7691
}
7792

7893
await replay(opts, exampleWorkflow)
@@ -86,11 +101,25 @@ if (require.main === module) {
86101
}
87102
```
88103

104+
5. Open or create `.vscode/settings.json` and add the config field:
105+
106+
```json
107+
{
108+
"temporal.replayerEntryPoint": "replayer.ts"
109+
}
110+
```
111+
89112
_Note that the file must be within your project directory so it can find `node_modules/`._
90113

91114
#### Go
92115

93-
Go entrypoints are started via the background process. Create a small `main.go` in your project that runs the Go replayer adapter in IDE mode and registers your workflow function, for example:
116+
1. Get the replayer code
117+
118+
```
119+
go get -u github.com/phuongdnguyen/temporal-workflow-debugger/replayer-adapter-go@latest
120+
```
121+
122+
2. Create a small `main.go` in your project that runs the Go replayer adapter in IDE mode and registers your workflow function, for example:
94123

95124
```go
96125
package main
@@ -112,22 +141,30 @@ func main() {
112141
}
113142
```
114143

115-
Configure the background process to run `tdlv` which builds and runs your entrypoint under Delve and exposes a DAP proxy on port 60000. Set `cwd` to the folder that contains your `package main` (the entrypoint):
144+
3. Configure the extension:
116145

117146
```json
118147
{
119148
"temporal.debugLanguage": "go",
120-
"temporal.debugger.backgroundProcess.command": "tdlv",
121-
"temporal.debugger.backgroundProcess.args": ["--lang=go", "--install", "--quiet"],
122-
"temporal.debugger.backgroundProcess.options": { "cwd": "./path-to-your-entrypoint-folder" }
149+
"temporal.replayerEntrypoint": "main.go"
123150
}
124151
```
125152

126-
The extension automatically attaches to the proxy. If your workspace root is the Go module, you may omit `options.cwd`.
153+
4. Run "Temporal: Open Panel"
154+
5. Enter a Workflow Id or choose a history JSON file
155+
6. Click `Load History`
156+
7. Select history events that you want the workflow to be stopped on
157+
8. Hit `Start debug session`
127158

128159
#### Python
129160

130-
Python entrypoints are also started via the background process. Create a small script (e.g. `vscode-replay.py`) that uses the Python replayer adapter in IDE mode and references your workflow:
161+
1. Make sure your Python environment has the required dependencies installed:
162+
163+
```bash
164+
pip install temporalio replayer-adapter-python
165+
```
166+
167+
2. Create a small script (e.g. `replayer.py`) that uses the Python replayer adapter in IDE mode and references your workflow:
131168

132169
```python
133170
import asyncio
@@ -155,83 +192,19 @@ if __name__ == "__main__":
155192
asyncio.run(main())
156193
```
157194

158-
Configure the background process to start `tdlv` for Python and point it at your entrypoint script (DebugPy will be launched by `tdlv` and proxied via port 60000):
195+
3. Configure the extension:
159196

160197
```json
161198
{
162199
"temporal.debugLanguage": "python",
163-
"temporal.debugger.backgroundProcess.command": "tdlv",
164-
"temporal.debugger.backgroundProcess.args": [
165-
"--lang=python",
166-
"--install",
167-
"--quiet",
168-
"--entrypoint",
169-
"${workspaceFolder}/vscode-replay.py"
170-
]
171-
}
172-
```
173-
174-
Make sure your Python environment has the required dependencies installed:
175-
176-
```bash
177-
pip install temporalio replayer-adapter-python
178-
```
179-
180-
### Languages
181-
182-
You can choose which language to debug via the `temporal.debugLanguage` setting. Supported values:
183-
184-
- `typescript` (default)
185-
- `go`
186-
- `java`
187-
- `python`
188-
189-
Set it in your workspace settings:
190-
191-
```json
192-
{
193-
"temporal.debugLanguage": "go"
200+
"temporal.replayerEntryPoint": "replayer.py"
201+
// If you want use a custom python rather the one in PATH
202+
// "temporal.python": "/Your/path/to/python"
194203
}
195204
```
196205

197-
### Background Process
198-
199-
The extension supports running a background process before starting the debug session. This process will be automatically terminated when the debug session ends.
200-
201-
Configure through VS Code settings:
202-
203-
```json
204-
{
205-
"temporal.debugger.backgroundProcess.command": "npm",
206-
"temporal.debugger.backgroundProcess.args": ["run", "start"],
207-
"temporal.debugger.backgroundProcess.options": {
208-
"cwd": "./server",
209-
"env": {
210-
"PORT": "3000"
211-
}
212-
}
213-
}
214-
```
215-
216-
Common use cases:
217-
218-
- Starting a Temporal server before debugging
219-
- Running setup scripts or initialization processes
220-
221-
The extension uses graceful termination (SIGTERM) first, then forceful termination (SIGKILL) if needed. Process output is logged to the VS Code console.
222-
223-
### Adapter integration (IDE server)
224-
225-
When a history is loaded in the panel, the extension starts a local server used by language adapters:
226-
227-
- Address: `http://127.0.0.1:54578`
228-
- Endpoints:
229-
- `GET /history` – returns the workflow history (JSON bytes)
230-
- `GET /breakpoints` – returns the enabled breakpoint event IDs
231-
- `POST /current-event` – highlight the current event in the UI
232-
233-
Adapters may honor the `WFDBG_HISTORY_PORT` environment variable to override the default port.
234-
235-
Notes:
236-
237-
- Only Workflow code executes during replay; Activity code isn’t run (effects are driven by history).
206+
4. Run "Temporal: Open Panel"
207+
5. Enter a Workflow Id or choose a history JSON file
208+
6. Click `Load History`
209+
7. Select history events that you want the workflow to be stopped on
210+
8. Hit `Start debug session`

vscode-debugger-extension/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "temporal-workflow-debugger",
33
"displayName": "Temporal workflow debugger",
4-
"version": "0.1.8",
4+
"version": "0.1.9",
55
"description": "Debug workflows by setting breakpoints in workflow history and workflow code.",
66
"categories": [
77
"Debuggers",

0 commit comments

Comments
 (0)