claw-dashboard 2.1.1 → 2.2.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.
- package/CHANGELOG.md +29 -1
- package/docs/API.md +1 -2
- package/index.js +31 -41
- package/package.json +22 -12
- package/src/auto-save.js +11 -5
- package/src/cli/export-snapshot.js +3 -1
- package/src/cli/import-snapshot.js +3 -1
- package/src/config.js +9 -15
- package/src/errors.js +0 -9
- package/src/security.js +6 -2
- package/src/snapshot.js +73 -26
- package/src/web-server.js +7 -10
- package/.c8rc.json +0 -38
- package/.dockerignore +0 -68
- package/.github/dependabot.yml +0 -45
- package/.github/pull_request_template.md +0 -39
- package/.github/workflows/ci.yml +0 -147
- package/.github/workflows/release.yml +0 -40
- package/.github/workflows/security.yml +0 -84
- package/.husky/pre-commit +0 -1
- package/.planning/codebase/ARCHITECTURE.md +0 -206
- package/.planning/codebase/INTEGRATIONS.md +0 -150
- package/.planning/codebase/STACK.md +0 -122
- package/.planning/codebase/STRUCTURE.md +0 -201
- package/CONTRIBUTING.md +0 -378
- package/Dockerfile +0 -54
- package/FEATURES.md +0 -307
- package/TODO.md +0 -28
- package/ai.openclaw.dashboard.plist +0 -35
- package/build-cjs.js +0 -127
- package/cjs-shim.js +0 -13
- package/dist/clawdash +0 -1729
- package/dist/clawdash.meta.json +0 -2236
- package/dist/widgets.cjs +0 -6511
- package/docker-compose.yml +0 -67
- package/esbuild.config.js +0 -158
- package/eslint.config.js +0 -56
- package/examples/plugins/README.md +0 -122
- package/examples/plugins/api-status/index.js +0 -294
- package/examples/plugins/api-status/plugin.json +0 -19
- package/examples/plugins/hello-world/index.js +0 -104
- package/examples/plugins/hello-world/plugin.json +0 -15
- package/examples/plugins/system-metrics-chart/index.js +0 -339
- package/examples/plugins/system-metrics-chart/plugin.json +0 -18
- package/examples/plugins/weather-widget/index.js +0 -136
- package/examples/plugins/weather-widget/plugin.json +0 -19
- package/index.cjs +0 -23005
- package/jest.config.js +0 -11
- package/scripts/release.js +0 -595
- package/src/database.js +0 -734
- package/tests/alerts.test.js +0 -437
- package/tests/auto-save.test.js +0 -529
- package/tests/cache.test.js +0 -317
- package/tests/cli.test.js +0 -351
- package/tests/command-palette.test.js +0 -320
- package/tests/config-processor.test.js +0 -452
- package/tests/config-validator.test.js +0 -710
- package/tests/config-watcher.test.js +0 -594
- package/tests/config.test.js +0 -755
- package/tests/database.test.js +0 -438
- package/tests/errors.test.js +0 -189
- package/tests/example-plugins.test.js +0 -624
- package/tests/integration.test.js +0 -1321
- package/tests/loading-states.test.js +0 -300
- package/tests/manifest-validation-on-load.test.js +0 -671
- package/tests/performance-monitor.test.js +0 -190
- package/tests/plugin-api-rate-limit.test.js +0 -302
- package/tests/plugin-errors.test.js +0 -311
- package/tests/plugin-lifecycle-e2e.test.js +0 -1036
- package/tests/plugin-reload.test.js +0 -764
- package/tests/rate-limiter.test.js +0 -539
- package/tests/removed-dependencies.test.js +0 -74
- package/tests/retry.test.js +0 -308
- package/tests/security.test.js +0 -411
- package/tests/settings-modal.test.js +0 -226
- package/tests/theme-selector.test.js +0 -57
- package/tests/utils.js +0 -242
- package/tests/utils.test.js +0 -317
- package/tests/validate-plugin-cli.test.js +0 -359
- package/tests/validation.test.js +0 -837
- package/tests/web-server.test.js +0 -646
- package/tests/widget-arrange-mode.test.js +0 -183
- package/tests/widget-config-hot-reload.test.js +0 -465
- package/tests/widget-dependency.test.js +0 -591
- package/tests/widget-error-boundary.test.js +0 -749
- package/tests/widget-error-isolation.test.js +0 -469
- package/tests/widget-integration.test.js +0 -1147
- package/tests/widget-refresh-intervals.test.js +0 -284
- package/tests/worker-pool.test.js +0 -522
package/CONTRIBUTING.md
DELETED
|
@@ -1,378 +0,0 @@
|
|
|
1
|
-
# Contributing to Claw Dashboard
|
|
2
|
-
|
|
3
|
-
Thank you for your interest in contributing to Claw Dashboard! This document provides guidelines and instructions for contributing.
|
|
4
|
-
|
|
5
|
-
## Table of Contents
|
|
6
|
-
|
|
7
|
-
- [Code of Conduct](#code-of-conduct)
|
|
8
|
-
- [Getting Started](#getting-started)
|
|
9
|
-
- [Development Workflow](#development-workflow)
|
|
10
|
-
- [Coding Standards](#coding-standards)
|
|
11
|
-
- [Testing](#testing)
|
|
12
|
-
- [Submitting Changes](#submitting-changes)
|
|
13
|
-
- [Commit Message Guidelines](#commit-message-guidelines)
|
|
14
|
-
- [Release Process](#release-process)
|
|
15
|
-
|
|
16
|
-
## Code of Conduct
|
|
17
|
-
|
|
18
|
-
This project adheres to a code of conduct that we expect all contributors to follow:
|
|
19
|
-
|
|
20
|
-
- Be respectful and inclusive in all interactions
|
|
21
|
-
- Welcome newcomers and help them learn
|
|
22
|
-
- Focus on constructive feedback
|
|
23
|
-
- Accept constructive criticism gracefully
|
|
24
|
-
|
|
25
|
-
## Getting Started
|
|
26
|
-
|
|
27
|
-
### Prerequisites
|
|
28
|
-
|
|
29
|
-
- **Node.js** v18 or higher
|
|
30
|
-
- **npm** v9 or higher
|
|
31
|
-
- **OpenClaw** installed and configured (for full integration testing)
|
|
32
|
-
|
|
33
|
-
### Setup
|
|
34
|
-
|
|
35
|
-
1. Fork the repository on GitHub
|
|
36
|
-
2. Clone your fork locally:
|
|
37
|
-
```bash
|
|
38
|
-
git clone https://github.com/YOUR_USERNAME/claw-dashboard.git
|
|
39
|
-
cd claw-dashboard
|
|
40
|
-
```
|
|
41
|
-
3. Install dependencies:
|
|
42
|
-
```bash
|
|
43
|
-
npm install
|
|
44
|
-
```
|
|
45
|
-
4. Run the dashboard:
|
|
46
|
-
```bash
|
|
47
|
-
npm start
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
## Development Workflow
|
|
51
|
-
|
|
52
|
-
### Branch Naming
|
|
53
|
-
|
|
54
|
-
Use descriptive branch names with the following prefixes:
|
|
55
|
-
|
|
56
|
-
- `feature/` - New features
|
|
57
|
-
- `fix/` - Bug fixes
|
|
58
|
-
- `docs/` - Documentation changes
|
|
59
|
-
- `refactor/` - Code refactoring
|
|
60
|
-
- `test/` - Test additions or updates
|
|
61
|
-
|
|
62
|
-
Examples:
|
|
63
|
-
```
|
|
64
|
-
feature/add-custom-widgets
|
|
65
|
-
fix/memory-leak-on-refresh
|
|
66
|
-
docs/update-api-examples
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
### Making Changes
|
|
70
|
-
|
|
71
|
-
1. Create a new branch from `main`:
|
|
72
|
-
```bash
|
|
73
|
-
git checkout -b feature/your-feature-name
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
2. Make your changes following the [coding standards](#coding-standards)
|
|
77
|
-
|
|
78
|
-
3. Test your changes:
|
|
79
|
-
```bash
|
|
80
|
-
npm test
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
4. Update documentation if needed (README.md, API.md, CHANGELOG.md)
|
|
84
|
-
|
|
85
|
-
## Coding Standards
|
|
86
|
-
|
|
87
|
-
### JavaScript Style
|
|
88
|
-
|
|
89
|
-
- Use ES modules (`import`/`export`)
|
|
90
|
-
- Use 2 spaces for indentation
|
|
91
|
-
- Use semicolons
|
|
92
|
-
- Prefer `const` and `let` over `var`
|
|
93
|
-
- Use camelCase for variables and functions
|
|
94
|
-
- Use PascalCase for classes
|
|
95
|
-
- Use UPPER_SNAKE_CASE for constants
|
|
96
|
-
|
|
97
|
-
Example:
|
|
98
|
-
```javascript
|
|
99
|
-
// Good
|
|
100
|
-
const MAX_RETRIES = 3;
|
|
101
|
-
|
|
102
|
-
export async function fetchData() {
|
|
103
|
-
const result = await getData();
|
|
104
|
-
return result;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export class DataFetcher {
|
|
108
|
-
constructor() {
|
|
109
|
-
this.cache = new Map();
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// Bad
|
|
114
|
-
var MAX_RETRIES = 3;
|
|
115
|
-
|
|
116
|
-
function fetch_data() {
|
|
117
|
-
let result = getData();
|
|
118
|
-
return result;
|
|
119
|
-
}
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
### Code Organization
|
|
123
|
-
|
|
124
|
-
- Place all source files in `src/`
|
|
125
|
-
- Group related functionality into modules
|
|
126
|
-
- Keep functions focused and small
|
|
127
|
-
- Export only what's necessary from modules
|
|
128
|
-
|
|
129
|
-
### Configuration
|
|
130
|
-
|
|
131
|
-
All magic numbers and configurable values should be centralized in `src/config.js`:
|
|
132
|
-
|
|
133
|
-
```javascript
|
|
134
|
-
// In src/config.js
|
|
135
|
-
export const CACHE_TTL = {
|
|
136
|
-
CPU: 1000,
|
|
137
|
-
MEMORY: 1000,
|
|
138
|
-
GPU: 5000,
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
// In your module
|
|
142
|
-
import { CACHE_TTL } from './config.js';
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
### Error Handling
|
|
146
|
-
|
|
147
|
-
Use the custom error classes from `src/errors.js`:
|
|
148
|
-
|
|
149
|
-
```javascript
|
|
150
|
-
import { GatewayError, DataFetchError } from './errors.js';
|
|
151
|
-
import logger from './logger.js';
|
|
152
|
-
|
|
153
|
-
try {
|
|
154
|
-
const data = await fetchData();
|
|
155
|
-
} catch (error) {
|
|
156
|
-
logger.error('Failed to fetch:', error.message);
|
|
157
|
-
throw new GatewayError('Fetch failed', { cause: error });
|
|
158
|
-
}
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
### Logging
|
|
162
|
-
|
|
163
|
-
Use the logger module instead of `console.log`:
|
|
164
|
-
|
|
165
|
-
```javascript
|
|
166
|
-
import logger from './logger.js';
|
|
167
|
-
|
|
168
|
-
logger.debug('Debug info'); // Only shows with DEBUG=1
|
|
169
|
-
logger.info('General info');
|
|
170
|
-
logger.warn('Warning message');
|
|
171
|
-
logger.error('Error message');
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
## Testing
|
|
175
|
-
|
|
176
|
-
### Running Tests
|
|
177
|
-
|
|
178
|
-
```bash
|
|
179
|
-
# Run all tests
|
|
180
|
-
npm test
|
|
181
|
-
|
|
182
|
-
# Run tests with coverage
|
|
183
|
-
npm run test:coverage
|
|
184
|
-
|
|
185
|
-
# Run tests in watch mode
|
|
186
|
-
npm test -- --watch
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
### Writing Tests
|
|
190
|
-
|
|
191
|
-
Place test files in the `tests/` directory with the naming pattern `*.test.js`:
|
|
192
|
-
|
|
193
|
-
```javascript
|
|
194
|
-
// tests/my-feature.test.js
|
|
195
|
-
import { describe, test, expect } from '@jest/globals';
|
|
196
|
-
import { myFunction } from '../src/my-module.js';
|
|
197
|
-
|
|
198
|
-
describe('myFunction', () => {
|
|
199
|
-
test('should return expected result', () => {
|
|
200
|
-
const result = myFunction('input');
|
|
201
|
-
expect(result).toBe('expected output');
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
test('should handle errors gracefully', async () => {
|
|
205
|
-
await expect(myFunction(null)).rejects.toThrow();
|
|
206
|
-
});
|
|
207
|
-
});
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
### Test Guidelines
|
|
211
|
-
|
|
212
|
-
- Write tests for new functionality
|
|
213
|
-
- Ensure all existing tests pass before submitting
|
|
214
|
-
- Aim for meaningful coverage, not just high percentages
|
|
215
|
-
- Test edge cases and error conditions
|
|
216
|
-
- Use descriptive test names that explain the behavior
|
|
217
|
-
|
|
218
|
-
## Submitting Changes
|
|
219
|
-
|
|
220
|
-
### Pull Request Process
|
|
221
|
-
|
|
222
|
-
1. Ensure your branch is up to date with `main`:
|
|
223
|
-
```bash
|
|
224
|
-
git fetch origin
|
|
225
|
-
git rebase origin/main
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
2. Run the full test suite:
|
|
229
|
-
```bash
|
|
230
|
-
npm test
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
3. Update the CHANGELOG.md if applicable
|
|
234
|
-
|
|
235
|
-
4. Push your branch:
|
|
236
|
-
```bash
|
|
237
|
-
git push origin feature/your-feature-name
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
5. Create a Pull Request on GitHub with:
|
|
241
|
-
- Clear title describing the change
|
|
242
|
-
- Detailed description explaining what and why
|
|
243
|
-
- Reference any related issues (e.g., "Fixes #123")
|
|
244
|
-
- Screenshots/gifs for UI changes
|
|
245
|
-
|
|
246
|
-
### PR Review Process
|
|
247
|
-
|
|
248
|
-
- All PRs require at least one review
|
|
249
|
-
- Address review feedback promptly
|
|
250
|
-
- Be open to suggestions and changes
|
|
251
|
-
- Squash commits if requested
|
|
252
|
-
|
|
253
|
-
## Commit Message Guidelines
|
|
254
|
-
|
|
255
|
-
We follow the [Conventional Commits](https://www.conventionalcommits.org/) specification:
|
|
256
|
-
|
|
257
|
-
### Format
|
|
258
|
-
|
|
259
|
-
```
|
|
260
|
-
<type>: <description>
|
|
261
|
-
|
|
262
|
-
[optional body]
|
|
263
|
-
|
|
264
|
-
[optional footer(s)]
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
### Types
|
|
268
|
-
|
|
269
|
-
| Type | Description |
|
|
270
|
-
|------|-------------|
|
|
271
|
-
| `feat` | New feature |
|
|
272
|
-
| `fix` | Bug fix |
|
|
273
|
-
| `docs` | Documentation changes |
|
|
274
|
-
| `style` | Code style changes (formatting, semicolons, etc.) |
|
|
275
|
-
| `refactor` | Code refactoring |
|
|
276
|
-
| `test` | Test additions or updates |
|
|
277
|
-
| `chore` | Build process or auxiliary tool changes |
|
|
278
|
-
|
|
279
|
-
### Examples
|
|
280
|
-
|
|
281
|
-
```
|
|
282
|
-
feat: add session sorting by token usage
|
|
283
|
-
|
|
284
|
-
fix: resolve memory leak in widget refresh cycle
|
|
285
|
-
docs: update API documentation for gateway manager
|
|
286
|
-
refactor: extract cache logic into separate module
|
|
287
|
-
test: add unit tests for error classes
|
|
288
|
-
chore: update dependencies to latest versions
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
### Rules
|
|
292
|
-
|
|
293
|
-
- Use present tense ("add feature" not "added feature")
|
|
294
|
-
- Use imperative mood ("move cursor" not "moves cursor")
|
|
295
|
-
- Don't capitalize the first letter
|
|
296
|
-
- No period at the end
|
|
297
|
-
- Keep the first line under 72 characters
|
|
298
|
-
|
|
299
|
-
## Release Process
|
|
300
|
-
|
|
301
|
-
We use an automated release script that handles versioning, building, signing, and tagging.
|
|
302
|
-
|
|
303
|
-
### Prerequisites
|
|
304
|
-
|
|
305
|
-
- Node.js v18+ with npm
|
|
306
|
-
- GPG key configured (for signed releases)
|
|
307
|
-
- GitHub CLI (`gh`) installed (for GitHub releases)
|
|
308
|
-
|
|
309
|
-
### Quick Release
|
|
310
|
-
|
|
311
|
-
```bash
|
|
312
|
-
# Patch release (1.0.0 → 1.0.1)
|
|
313
|
-
npm run release
|
|
314
|
-
|
|
315
|
-
# Minor release (1.0.0 → 1.1.0)
|
|
316
|
-
npm run release minor
|
|
317
|
-
|
|
318
|
-
# Major release (1.0.0 → 2.0.0)
|
|
319
|
-
npm run release major
|
|
320
|
-
|
|
321
|
-
# With GPG signing
|
|
322
|
-
npm run release:sign
|
|
323
|
-
|
|
324
|
-
# With GitHub release creation
|
|
325
|
-
npm run release:github
|
|
326
|
-
```
|
|
327
|
-
|
|
328
|
-
### Manual Release Steps
|
|
329
|
-
|
|
330
|
-
If you prefer to release manually:
|
|
331
|
-
|
|
332
|
-
1. Update version in `package.json`
|
|
333
|
-
2. Update CHANGELOG.md with release date
|
|
334
|
-
3. Build the project: `npm run build`
|
|
335
|
-
4. Create a git tag: `git tag vX.Y.Z`
|
|
336
|
-
5. Push tags: `git push origin vX.Y.Z`
|
|
337
|
-
6. Create a GitHub release with release notes
|
|
338
|
-
|
|
339
|
-
### Release Script Features
|
|
340
|
-
|
|
341
|
-
The automated release script (`scripts/release.js`):
|
|
342
|
-
|
|
343
|
-
- **Validates** the working directory is clean
|
|
344
|
-
- **Bumps** version in package.json (patch/minor/major)
|
|
345
|
-
- **Updates** CHANGELOG.md with new release date
|
|
346
|
-
- **Builds** the project with ESBuild (creates `dist/clawdash`)
|
|
347
|
-
- **Signs** releases with GPG (optional, use `--sign`)
|
|
348
|
-
- **Creates** git commit and annotated tag
|
|
349
|
-
- **Publishes** GitHub release (optional, use `--github`)
|
|
350
|
-
|
|
351
|
-
### Build System
|
|
352
|
-
|
|
353
|
-
We use **ESBuild** for bundling:
|
|
354
|
-
|
|
355
|
-
```bash
|
|
356
|
-
# Production build (minified)
|
|
357
|
-
npm run build
|
|
358
|
-
|
|
359
|
-
# Development build (with source maps)
|
|
360
|
-
npm run build:dev
|
|
361
|
-
|
|
362
|
-
# Analyze bundle size
|
|
363
|
-
npm run build -- --analyze
|
|
364
|
-
```
|
|
365
|
-
|
|
366
|
-
The build creates:
|
|
367
|
-
- `dist/clawdash` - Bundled, minified executable
|
|
368
|
-
- `dist/clawdash.meta.json` - Bundle analysis metadata
|
|
369
|
-
|
|
370
|
-
## Questions?
|
|
371
|
-
|
|
372
|
-
If you have questions or need help:
|
|
373
|
-
|
|
374
|
-
- Open an issue on GitHub
|
|
375
|
-
- Check existing issues and discussions
|
|
376
|
-
- Review the [API documentation](docs/API.md)
|
|
377
|
-
|
|
378
|
-
Thank you for contributing!
|
package/Dockerfile
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
# Claw Dashboard - Production Docker Image
|
|
2
|
-
# Multi-stage build for optimized image size
|
|
3
|
-
|
|
4
|
-
# Stage 1: Dependencies
|
|
5
|
-
FROM node:20-alpine AS dependencies
|
|
6
|
-
|
|
7
|
-
WORKDIR /app
|
|
8
|
-
|
|
9
|
-
# Copy package files
|
|
10
|
-
COPY package.json package-lock.json ./
|
|
11
|
-
|
|
12
|
-
# Install production dependencies only
|
|
13
|
-
RUN npm ci --omit=dev && npm cache clean --force
|
|
14
|
-
|
|
15
|
-
# Stage 2: Production
|
|
16
|
-
FROM node:20-alpine AS production
|
|
17
|
-
|
|
18
|
-
# Add metadata labels
|
|
19
|
-
LABEL maintainer="Kevin Smith <kevin@example.com>"
|
|
20
|
-
LABEL org.opencontainers.image.title="Claw Dashboard"
|
|
21
|
-
LABEL org.opencontainers.image.description="A beautiful console dashboard for monitoring OpenClaw instances"
|
|
22
|
-
LABEL org.opencontainers.image.source="https://github.com/spleck/claw-dashboard"
|
|
23
|
-
LABEL org.opencontainers.image.licenses="MIT"
|
|
24
|
-
|
|
25
|
-
# Create non-root user for security
|
|
26
|
-
RUN addgroup -g 1000 -S claw && \
|
|
27
|
-
adduser -u 1000 -S claw -G claw
|
|
28
|
-
|
|
29
|
-
WORKDIR /app
|
|
30
|
-
|
|
31
|
-
# Copy production dependencies from dependencies stage
|
|
32
|
-
COPY --from=dependencies /app/node_modules ./node_modules
|
|
33
|
-
|
|
34
|
-
# Copy application files
|
|
35
|
-
COPY --chown=claw:claw index.js ./
|
|
36
|
-
COPY --chown=claw:claw src ./src
|
|
37
|
-
|
|
38
|
-
# Switch to non-root user
|
|
39
|
-
USER claw
|
|
40
|
-
|
|
41
|
-
# Expose any potential web interface port (for future use)
|
|
42
|
-
EXPOSE 18790
|
|
43
|
-
|
|
44
|
-
# Set environment variables
|
|
45
|
-
ENV NODE_ENV=production
|
|
46
|
-
ENV TERM=xterm-256color
|
|
47
|
-
|
|
48
|
-
# Health check
|
|
49
|
-
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
50
|
-
CMD node -e "console.log('healthy')" || exit 1
|
|
51
|
-
|
|
52
|
-
# Run the dashboard
|
|
53
|
-
ENTRYPOINT ["node", "index.js"]
|
|
54
|
-
CMD []
|