@exaudeus/workrail 0.6.1-beta.0 โ 0.6.1-beta.10
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/README.md +227 -11
- package/dist/cli.js +28 -0
- package/dist/infrastructure/session/HttpServer.d.ts +36 -0
- package/dist/infrastructure/session/HttpServer.js +606 -0
- package/dist/infrastructure/session/SessionDataNormalizer.d.ts +57 -0
- package/dist/infrastructure/session/SessionDataNormalizer.js +211 -0
- package/dist/infrastructure/session/SessionDataValidator.d.ts +27 -0
- package/dist/infrastructure/session/SessionDataValidator.js +271 -0
- package/dist/infrastructure/session/SessionManager.d.ts +56 -0
- package/dist/infrastructure/session/SessionManager.js +419 -0
- package/dist/infrastructure/session/index.d.ts +2 -0
- package/dist/infrastructure/session/index.js +7 -0
- package/dist/infrastructure/storage/enhanced-multi-source-workflow-storage.d.ts +48 -0
- package/dist/infrastructure/storage/enhanced-multi-source-workflow-storage.js +362 -0
- package/dist/infrastructure/storage/git-workflow-storage.d.ts +4 -1
- package/dist/infrastructure/storage/git-workflow-storage.js +118 -16
- package/dist/infrastructure/storage/schema-validating-workflow-storage.js +4 -2
- package/dist/infrastructure/storage/storage.js +2 -1
- package/dist/mcp-server.js +20 -1
- package/dist/tools/session-tools.d.ts +5 -0
- package/dist/tools/session-tools.js +270 -0
- package/dist/utils/DashboardWriter.d.ts +85 -0
- package/dist/utils/DashboardWriter.js +210 -0
- package/dist/utils/config.d.ts +8 -8
- package/dist/utils/logger.d.ts +36 -0
- package/dist/utils/logger.js +148 -0
- package/package.json +27 -4
- package/spec/workflow.schema.json +1 -1
- package/web/ADAPTIVE_BACKGROUND_SYSTEM.md +523 -0
- package/web/BACKGROUND_ENHANCEMENTS.md +419 -0
- package/web/COMPONENT_LIBRARY.md +755 -0
- package/web/COMPONENT_MIGRATION_GUIDE.md +537 -0
- package/web/DESIGN_SYSTEM_INTEGRATION.md +305 -0
- package/web/assets/animations.css +701 -0
- package/web/assets/background-effects.css +2661 -0
- package/web/assets/background-interaction.js +585 -0
- package/web/assets/components/Badge.js +172 -0
- package/web/assets/components/Button.js +180 -0
- package/web/assets/components/Card.js +207 -0
- package/web/assets/components/DashboardLayout.js +165 -0
- package/web/assets/components/Grid.js +72 -0
- package/web/assets/components/ProgressRing.js +162 -0
- package/web/assets/components/Stack.js +67 -0
- package/web/assets/components/StatCard.js +210 -0
- package/web/assets/components/base.js +160 -0
- package/web/assets/components/index.js +40 -0
- package/web/assets/components.css +1140 -0
- package/web/assets/components.js +1099 -0
- package/web/assets/contrast-checker.js +234 -0
- package/web/assets/design-system.css +826 -0
- package/web/assets/fix-legacy-scripts.sh +23 -0
- package/web/assets/fix_vite_compat.py +47 -0
- package/web/assets/generic-dashboard.css +1131 -0
- package/web/assets/home.css +680 -0
- package/web/assets/images/favicon-16.png +0 -0
- package/web/assets/images/favicon-32.png +0 -0
- package/web/assets/images/favicon-amber-16.png +0 -0
- package/web/assets/images/favicon-amber-32.png +0 -0
- package/web/assets/images/favicon-white-16-clean.png +0 -0
- package/web/assets/images/favicon-white-32-clean.png +0 -0
- package/web/assets/images/favicon.ico +0 -0
- package/web/assets/images/icon-192.png +0 -0
- package/web/assets/images/icon-512.png +0 -0
- package/web/assets/images/icon-amber-192.png +0 -0
- package/web/assets/images/icon-amber-512.png +0 -0
- package/web/assets/images/icon-amber.svg +27 -0
- package/web/assets/images/icon-white-192-clean.png +0 -0
- package/web/assets/images/icon-white-512-clean.png +0 -0
- package/web/assets/images/icon-white.svg +27 -0
- package/web/assets/images/icon.svg +27 -0
- package/web/assets/orbs-svg.html +247 -0
- package/web/assets/particle-generator.js +499 -0
- package/web/assets/scaffolds/dashboard.js +1303 -0
- package/web/assets/scaffolds/generic-dashboard.js +541 -0
- package/web/assets/scaffolds/home.js +511 -0
- package/web/assets/scaffolds/index.js +14 -0
- package/web/assets/scroll-parallax.js +417 -0
- package/web/assets/sections/SessionList.js +327 -0
- package/web/assets/sections/index.js +14 -0
- package/web/assets/sections/session-list.css +260 -0
- package/web/assets/services/__tests__/session-data.test.js +168 -0
- package/web/assets/services/api.js +0 -0
- package/web/assets/services/chart-builder.js +535 -0
- package/web/assets/services/dashboard-inspector.js +424 -0
- package/web/assets/services/data-normalizer.js +519 -0
- package/web/assets/services/generic-renderer.js +1374 -0
- package/web/assets/services/intent-analyzer.js +340 -0
- package/web/assets/services/pattern-recognizer.js +715 -0
- package/web/assets/services/polling.js +347 -0
- package/web/assets/services/schema-registry.js +567 -0
- package/web/assets/services/search-engine.js +505 -0
- package/web/assets/services/session-data.js +350 -0
- package/web/assets/services/template-registry.js +504 -0
- package/web/assets/styles/accessibility.css +446 -0
- package/web/assets/styles/charts.css +202 -0
- package/web/assets/styles/search.css +336 -0
- package/web/assets/styles/tokens.css +515 -0
- package/web/assets/styles.css +350 -0
- package/web/assets/theme-manager.js +226 -0
- package/web/assets/theme-toggle.css +267 -0
- package/web/assets/theme-toggle.js +120 -0
- package/web/assets/time-of-day-theme.js +139 -0
- package/web/assets/utils/__tests__/formatters.test.js +100 -0
- package/web/assets/utils/accessibility.js +435 -0
- package/web/assets/utils/formatters.js +310 -0
- package/web/assets/utils/performance.js +494 -0
- package/web/assets/workrail-ui.css +3685 -0
- package/web/assets/workrail-ui.js +2129 -0
- package/web/build-ui-system.js +655 -0
- package/web/component-demo.html +297 -0
- package/web/dashboard.html +321 -0
- package/web/debug-background.html +315 -0
- package/web/debug-rails-simple.html +168 -0
- package/web/examples/BEFORE_AFTER.md +691 -0
- package/web/index.html +114 -0
- package/web/index.html.backup +1277 -0
- package/web/manifest.json +24 -0
- package/web/modern-demo.html +369 -0
- package/web/scaffold-demo.html +62 -0
- package/web/test-debug.html +247 -0
- package/web/test-design-system.html +766 -0
- package/web/test-formatters.html +187 -0
- package/web/test-generic-dashboard.html +299 -0
- package/web/test-orbs-debug.html +110 -0
- package/web/test-services.html +438 -0
- package/web/test-session-list.html +355 -0
- package/web/test-setup.js +21 -0
- package/web/test-theme-check.html +239 -0
- package/web/test-unified-system.html +210 -0
- package/web/workflows/bug-investigation/dashboard-v2.html +175 -0
- package/web/workflows/bug-investigation/dashboard-v2.js +968 -0
- package/web/workflows/bug-investigation/dashboard-v3-debug.html +243 -0
- package/web/workflows/bug-investigation/dashboard-v3.html +209 -0
- package/web/workflows/bug-investigation/dashboard.html +153 -0
- package/web/workflows/bug-investigation/dashboard.js +475 -0
- package/web/workflows/bug-investigation/styles-v2.css +948 -0
- package/web/workflows/bug-investigation/styles.css +431 -0
- package/workflows/CHANGELOG-bug-investigation.md +325 -0
- package/workflows/dashboard-template-workflow.json +337 -0
- package/workflows/deep-documentation-workflow.json +0 -475
- package/workflows/systematic-bug-investigation-with-loops.json +693 -0
- package/workflows/systemic-bug-investigation-with-loops.json +151 -61
package/README.md
CHANGED
|
@@ -1,9 +1,35 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="./assets/logo.svg" alt="WorkRail Logo" width="200" />
|
|
3
|
+
<h1>WorkRail: Guided Workflow Orchestration for AI Agents</h1>
|
|
4
|
+
<p><strong>Transform chaotic AI interactions into structured, reliable workflows</strong></p>
|
|
5
|
+
|
|
6
|
+
[](https://modelcontextprotocol.org)
|
|
7
|
+
[](https://www.npmjs.com/package/@exaudeus/workrail)
|
|
8
|
+
[](LICENSE)
|
|
9
|
+
</div>
|
|
2
10
|
|
|
3
|
-
|
|
11
|
+
---
|
|
4
12
|
|
|
5
|
-
|
|
6
|
-
|
|
13
|
+
## ๐ Table of Contents
|
|
14
|
+
|
|
15
|
+
- [The Problem](#-the-problem)
|
|
16
|
+
- [The Solution](#-the-solution)
|
|
17
|
+
- [MCP Tools](#๏ธ-mcp-tools)
|
|
18
|
+
- [Installation](#๏ธ-installation)
|
|
19
|
+
- [External Workflows](#-external-workflows-load-from-git-repositories)
|
|
20
|
+
- [Local Workflows](#-using-local-workflows)
|
|
21
|
+
- [Available Workflows](#-available-workflows)
|
|
22
|
+
- [Loop Support](#-loop-support)
|
|
23
|
+
- [Quick Example](#-quick-example)
|
|
24
|
+
- [Why Choose WorkRail](#-why-choose-workrail)
|
|
25
|
+
- [Environment Variables](#-environment-variables-reference)
|
|
26
|
+
- [Workflow Sources](#workflow-sources)
|
|
27
|
+
- [External Git Repositories](#external-git-repositories)
|
|
28
|
+
- [Cache & Performance](#cache--performance)
|
|
29
|
+
- [Debugging & Logging](#debugging--logging)
|
|
30
|
+
- [Getting Started](#-getting-started)
|
|
31
|
+
- [Planned Features](#-planned-features)
|
|
32
|
+
- [Learn More](#-learn-more)
|
|
7
33
|
|
|
8
34
|
---
|
|
9
35
|
|
|
@@ -86,7 +112,98 @@ Add to your agent's `config.json`:
|
|
|
86
112
|
|
|
87
113
|
---
|
|
88
114
|
|
|
89
|
-
##
|
|
115
|
+
## ๐ External Workflows: Load from Git Repositories
|
|
116
|
+
|
|
117
|
+
**NEW in v0.6+**: Load workflows from GitHub, GitLab, Bitbucket, or any Git repository!
|
|
118
|
+
|
|
119
|
+
Perfect for:
|
|
120
|
+
- **Team sharing** - Company-wide workflow repositories
|
|
121
|
+
- **Community workflows** - Shared across organizations
|
|
122
|
+
- **Version control** - Track workflow changes in Git
|
|
123
|
+
- **Multi-source** - Combine workflows from multiple repos
|
|
124
|
+
|
|
125
|
+
### Quick Start
|
|
126
|
+
|
|
127
|
+
Add to your agent config:
|
|
128
|
+
|
|
129
|
+
```json
|
|
130
|
+
{
|
|
131
|
+
"mcpServers": {
|
|
132
|
+
"workrail": {
|
|
133
|
+
"command": "npx",
|
|
134
|
+
"args": ["-y", "@exaudeus/workrail"],
|
|
135
|
+
"env": {
|
|
136
|
+
"WORKFLOW_GIT_REPOS": "https://github.com/your-org/workflows.git",
|
|
137
|
+
"GITHUB_TOKEN": "your-github-token"
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Multiple Repositories
|
|
145
|
+
|
|
146
|
+
Load workflows from multiple sources (later repos override earlier ones):
|
|
147
|
+
|
|
148
|
+
```json
|
|
149
|
+
"env": {
|
|
150
|
+
"WORKFLOW_GIT_REPOS": "https://github.com/company/workflows.git,https://gitlab.com/team/workflows.git",
|
|
151
|
+
"GITHUB_TOKEN": "ghp_xxx",
|
|
152
|
+
"GITLAB_TOKEN": "glpat_xxx"
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Authentication Options
|
|
157
|
+
|
|
158
|
+
**Service-Specific Tokens** (Recommended):
|
|
159
|
+
```bash
|
|
160
|
+
GITHUB_TOKEN=ghp_xxxx # For github.com
|
|
161
|
+
GITLAB_TOKEN=glpat_xxxx # For gitlab.com
|
|
162
|
+
BITBUCKET_TOKEN=xxx # For bitbucket.org
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
**Self-Hosted Git** (hostname-based):
|
|
166
|
+
```bash
|
|
167
|
+
GIT_COMPANY_COM_TOKEN=xxx # For git.company.com
|
|
168
|
+
GIT_INTERNAL_GITLAB_IO_TOKEN=xxx # For internal.gitlab.io
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**SSH Keys** (no token needed):
|
|
172
|
+
```bash
|
|
173
|
+
WORKFLOW_GIT_REPOS="git@github.com:company/workflows.git"
|
|
174
|
+
# Uses your ~/.ssh/ keys automatically
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
**Generic Fallback**:
|
|
178
|
+
```bash
|
|
179
|
+
GIT_TOKEN=xxx # Used if no specific token found
|
|
180
|
+
WORKFLOW_GIT_AUTH_TOKEN=xxx # Alternative generic token
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Repository Structure
|
|
184
|
+
|
|
185
|
+
Your Git repository should have a `/workflows` directory:
|
|
186
|
+
|
|
187
|
+
```
|
|
188
|
+
your-repo/
|
|
189
|
+
โโโ workflows/
|
|
190
|
+
โ โโโ custom-workflow.json
|
|
191
|
+
โ โโโ team-process.json
|
|
192
|
+
โ โโโ company-standard.json
|
|
193
|
+
โโโ README.md (optional)
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Features
|
|
197
|
+
|
|
198
|
+
- โ
**Auto-sync** - Workflows update automatically (configurable interval)
|
|
199
|
+
- โ
**Caching** - Works offline after initial clone
|
|
200
|
+
- โ
**Security** - Path traversal prevention, file size limits, command injection protection
|
|
201
|
+
- โ
**Priority system** - Later repos override earlier ones
|
|
202
|
+
- โ
**Branch support** - Specify branch in repo config
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## ๐พ Using Local Workflows
|
|
90
207
|
|
|
91
208
|
WorkRail will auto-discover workflows even when added to your agent via JSON config. It searches, in priority order:
|
|
92
209
|
|
|
@@ -111,13 +228,33 @@ Example agent config passing env and `cwd` so your local workflows are picked up
|
|
|
111
228
|
}
|
|
112
229
|
```
|
|
113
230
|
|
|
114
|
-
|
|
231
|
+
WorkRail searches for workflows in this priority order:
|
|
232
|
+
|
|
233
|
+
1. **Bundled** - Built-in workflows (always available)
|
|
234
|
+
2. **User** - `~/.workrail/workflows` (recommended for personal workflows)
|
|
235
|
+
3. **Custom** - Directories in `WORKFLOW_STORAGE_PATH` (team/shared workflows)
|
|
236
|
+
4. **Git Repositories** - External repos via `WORKFLOW_GIT_REPOS` ([see above](#-external-workflows-load-from-git-repositories))
|
|
237
|
+
5. **Project** - `./workflows` relative to process `cwd` (project-specific)
|
|
238
|
+
|
|
239
|
+
Later sources override earlier ones when workflow IDs conflict.
|
|
115
240
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
241
|
+
### Quick Tips
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
# Initialize your user directory
|
|
245
|
+
workrail init
|
|
246
|
+
|
|
247
|
+
# Validate a workflow file
|
|
248
|
+
workrail validate /path/to/workflow.json
|
|
249
|
+
|
|
250
|
+
# List all discovered workflows
|
|
251
|
+
workrail list
|
|
252
|
+
|
|
253
|
+
# Get workflow JSON schema
|
|
254
|
+
workrail schema
|
|
255
|
+
```
|
|
119
256
|
|
|
120
|
-
See
|
|
257
|
+
See `docs/workflow-management.md` for more details.
|
|
121
258
|
|
|
122
259
|
---
|
|
123
260
|
|
|
@@ -228,6 +365,84 @@ WorkRail reduces these variables:
|
|
|
228
365
|
|
|
229
366
|
---
|
|
230
367
|
|
|
368
|
+
## ๐ Environment Variables Reference
|
|
369
|
+
|
|
370
|
+
Customize WorkRail's behavior with these environment variables:
|
|
371
|
+
|
|
372
|
+
### Workflow Sources
|
|
373
|
+
```bash
|
|
374
|
+
WORKFLOW_INCLUDE_BUNDLED=true # Include built-in workflows (default: true)
|
|
375
|
+
WORKFLOW_INCLUDE_USER=true # Include ~/.workrail/workflows (default: true)
|
|
376
|
+
WORKFLOW_INCLUDE_PROJECT=true # Include ./workflows from cwd (default: true)
|
|
377
|
+
WORKFLOW_STORAGE_PATH=/path1:/path2 # Additional directories (colon-separated)
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
### External Git Repositories
|
|
381
|
+
```bash
|
|
382
|
+
# Single or multiple repos (comma-separated)
|
|
383
|
+
WORKFLOW_GIT_REPOS=https://github.com/org/repo.git
|
|
384
|
+
WORKFLOW_GIT_REPOS=repo1.git,repo2.git,repo3.git
|
|
385
|
+
|
|
386
|
+
# Authentication
|
|
387
|
+
GITHUB_TOKEN=ghp_xxx # GitHub
|
|
388
|
+
GITLAB_TOKEN=glpat_xxx # GitLab
|
|
389
|
+
BITBUCKET_TOKEN=xxx # Bitbucket
|
|
390
|
+
GIT_HOSTNAME_TOKEN=xxx # Self-hosted (replace dots with underscores)
|
|
391
|
+
GIT_TOKEN=xxx # Generic fallback
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
### Cache & Performance
|
|
395
|
+
```bash
|
|
396
|
+
WORKRAIL_CACHE_DIR=/path/to/cache # Cache location (default: ~/.workrail/cache)
|
|
397
|
+
CACHE_TTL=300000 # Cache TTL in ms (default: 5 minutes)
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
### Debugging & Logging
|
|
401
|
+
```bash
|
|
402
|
+
# Log levels: DEBUG, INFO, WARN, ERROR, SILENT (default: SILENT)
|
|
403
|
+
WORKRAIL_LOG_LEVEL=INFO
|
|
404
|
+
|
|
405
|
+
# Log format: 'human' (default) or 'json'
|
|
406
|
+
WORKRAIL_LOG_FORMAT=json
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
**Log Levels:**
|
|
410
|
+
- `DEBUG` - Verbose logging (cloning, pulling, file operations)
|
|
411
|
+
- `INFO` - Key operations (initialization, workflows loaded)
|
|
412
|
+
- `WARN` - Warnings (branch fallbacks, pull failures)
|
|
413
|
+
- `ERROR` - Errors only
|
|
414
|
+
- `SILENT` - No logging (default in production)
|
|
415
|
+
|
|
416
|
+
**Example MCP Configuration with Logging:**
|
|
417
|
+
```json
|
|
418
|
+
{
|
|
419
|
+
"mcpServers": {
|
|
420
|
+
"workrail": {
|
|
421
|
+
"command": "npx",
|
|
422
|
+
"args": ["-y", "@exaudeus/workrail@beta"],
|
|
423
|
+
"env": {
|
|
424
|
+
"WORKRAIL_LOG_LEVEL": "INFO",
|
|
425
|
+
"WORKFLOW_GIT_REPOS": "https://github.com/org/workflows.git"
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
Logs are written to **stderr** (stdout is reserved for MCP protocol), so they appear in your MCP client's logs (e.g., Firebender, Claude Desktop).
|
|
433
|
+
|
|
434
|
+
### Priority Order
|
|
435
|
+
|
|
436
|
+
Workflows are loaded with this priority (later sources override earlier):
|
|
437
|
+
1. Bundled (built-in workflows)
|
|
438
|
+
2. Plugins (npm packages)
|
|
439
|
+
3. User directory (`~/.workrail/workflows`)
|
|
440
|
+
4. Custom paths (`WORKFLOW_STORAGE_PATH`)
|
|
441
|
+
5. Git repositories (`WORKFLOW_GIT_REPOS`)
|
|
442
|
+
6. Project directory (`./workflows`)
|
|
443
|
+
|
|
444
|
+
---
|
|
445
|
+
|
|
231
446
|
## ๐ Planned Features
|
|
232
447
|
|
|
233
448
|
WorkRail is actively evolving. Here are key enhancements on the roadmap:
|
|
@@ -246,10 +461,11 @@ Workflows could recommend optimal models for specific steps:
|
|
|
246
461
|
*Note: WorkRail provides text recommendations to users, not automatic model switching*
|
|
247
462
|
|
|
248
463
|
### **Enhanced Workflow Management**
|
|
249
|
-
-
|
|
464
|
+
- โ
~~**Dynamic Workflow Loading**~~ - **IMPLEMENTED in v0.6+** (Git repositories)
|
|
250
465
|
- **Workflow Categories** - Organize workflows by domain (debugging, planning, review, etc.)
|
|
251
466
|
- **Reusable Components** - Plugin system for common workflow patterns (codebase analysis, document creation, etc.)
|
|
252
467
|
- **Schema Versioning** - Backwards-compatible workflow schema evolution
|
|
468
|
+
- **Workflow Templates** - Create workflows from templates via CLI
|
|
253
469
|
|
|
254
470
|
### **Advanced Validation & Quality**
|
|
255
471
|
- **Custom Validation Functions** - Domain-specific output validation beyond basic schema checks
|
package/dist/cli.js
CHANGED
|
@@ -14,6 +14,7 @@ const workflow_service_1 = require("./application/services/workflow-service");
|
|
|
14
14
|
const validation_engine_1 = require("./application/services/validation-engine");
|
|
15
15
|
const multi_directory_workflow_storage_1 = require("./infrastructure/storage/multi-directory-workflow-storage");
|
|
16
16
|
const migrate_workflow_1 = require("./cli/migrate-workflow");
|
|
17
|
+
const index_js_1 = require("./infrastructure/session/index.js");
|
|
17
18
|
const program = new commander_1.Command();
|
|
18
19
|
program
|
|
19
20
|
.name('workrail')
|
|
@@ -251,4 +252,31 @@ program
|
|
|
251
252
|
process.exit(1);
|
|
252
253
|
}
|
|
253
254
|
});
|
|
255
|
+
program
|
|
256
|
+
.command('cleanup')
|
|
257
|
+
.description('Clean up orphaned workrail processes and free up ports')
|
|
258
|
+
.option('-f, --force', 'Force cleanup without confirmation')
|
|
259
|
+
.action(async (options) => {
|
|
260
|
+
try {
|
|
261
|
+
console.log(chalk_1.default.blue('๐งน Cleaning up orphaned workrail processes...'));
|
|
262
|
+
if (!options.force) {
|
|
263
|
+
console.log(chalk_1.default.yellow('โ ๏ธ This will terminate all workrail dashboard processes'));
|
|
264
|
+
console.log(chalk_1.default.yellow(' Press Ctrl+C to cancel, or wait 3 seconds to continue...'));
|
|
265
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
266
|
+
}
|
|
267
|
+
const sessionManager = new index_js_1.SessionManager();
|
|
268
|
+
const httpServer = new index_js_1.HttpServer(sessionManager);
|
|
269
|
+
const count = await httpServer.fullCleanup();
|
|
270
|
+
if (count > 0) {
|
|
271
|
+
console.log(chalk_1.default.green(`โ
Cleaned up ${count} orphaned process(es)`));
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
console.log(chalk_1.default.green('โ
No orphaned processes found'));
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
catch (error) {
|
|
278
|
+
console.error(chalk_1.default.red('โ Cleanup failed:'), error.message);
|
|
279
|
+
process.exit(1);
|
|
280
|
+
}
|
|
281
|
+
});
|
|
254
282
|
program.parse();
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { SessionManager } from './SessionManager.js';
|
|
2
|
+
export interface ServerConfig {
|
|
3
|
+
port?: number;
|
|
4
|
+
autoOpen?: boolean;
|
|
5
|
+
disableUnifiedDashboard?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare class HttpServer {
|
|
8
|
+
private sessionManager;
|
|
9
|
+
private config;
|
|
10
|
+
private app;
|
|
11
|
+
private server;
|
|
12
|
+
private port;
|
|
13
|
+
private baseUrl;
|
|
14
|
+
private isPrimary;
|
|
15
|
+
private lockFile;
|
|
16
|
+
private heartbeatInterval;
|
|
17
|
+
constructor(sessionManager: SessionManager, config?: ServerConfig);
|
|
18
|
+
private setupMiddleware;
|
|
19
|
+
private setupRoutes;
|
|
20
|
+
start(): Promise<string | null>;
|
|
21
|
+
private tryBecomePrimary;
|
|
22
|
+
private reclaimStaleLock;
|
|
23
|
+
private checkHealth;
|
|
24
|
+
private setupPrimaryCleanup;
|
|
25
|
+
private startAsPrimary;
|
|
26
|
+
private startLegacyMode;
|
|
27
|
+
private printBanner;
|
|
28
|
+
openDashboard(sessionId?: string): Promise<string>;
|
|
29
|
+
stop(): Promise<void>;
|
|
30
|
+
getBaseUrl(): string;
|
|
31
|
+
getPort(): number;
|
|
32
|
+
private startHeartbeat;
|
|
33
|
+
private quickCleanup;
|
|
34
|
+
private getWorkrailPorts;
|
|
35
|
+
fullCleanup(): Promise<number>;
|
|
36
|
+
}
|