- Add `scripts/check-file-size.mjs` and `scripts/check-innerhtml.mjs` to `package.json` files list.
- Update `src/ops.mjs` to copy these scripts to `torch/scripts/` during `init` and `update` commands.
- Update all agent prompts in `src/prompts/` to reference `torch/scripts/` instead of `scripts/`.
- Ensure `torch/scripts/agent/` directory is created.
- Scripts are treated as "evolving" files (preserved on update unless forced).
Co-authored-by: PR0M3TH3AN <[email protected]>
- Fix multiple syntax errors in `src/lib.mjs` (redundant declarations, broken loops, missing imports).
- Fix syntax error in `src/dashboard.mjs` (invalid catch block).
- Remove redundant local function definitions in `src/lib.mjs` in favor of imports from `src/torch-config.mjs` and `src/utils.mjs`.
- Update `landing/index.html` installation command to include `npx torch-lock init` step.
- Verify `torch-lock init` works correctly.
- Ensure all tests pass and linting is clean for `src/lib.mjs`.
Co-authored-by: PR0M3TH3AN <[email protected]>
Optimized `cmdCheck` and `cmdList` in `src/lib.mjs` by replacing O(N*M) linear scans with O(N) Set lookups.
- Introduced `rosterSet` and `excludedAgentsSet` to replace `Array.includes()` calls with `Set.has()`.
- Benchmark showed ~99% performance improvement (from ~280ms to ~2ms for 10k agents and 2k locks).
- Verified with existing tests and custom benchmark.
Co-authored-by: PR0M3TH3AN <[email protected]>
Refactor src/lib.mjs to support dependency injection for cmdCheck, cmdLock, and cmdList.
This allows unit testing without heavy mocking frameworks or side effects.
Add test/lib.test.mjs covering:
- cmdCheck: happy path, paused/excluded agents, unknown agents.
- cmdLock: success, roster check, existing lock check, race check (lost), dry run.
- cmdList: listing locks, empty state.
Coverage for src/lib.mjs is now significantly improved.
Verification: Ran `npm test` and verified all tests pass.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Added KIND_APP_DATA to src/constants.mjs
- Updated src/lib.mjs, src/lock-ops.mjs, and dashboard/index.html to use the constant
- Added missing src files to package.json files list
- Updated build.mjs to copy src/constants.mjs to dist/src/
Co-authored-by: PR0M3TH3AN <[email protected]>
Refactored `loadTorchConfig` to support dependency injection for `fs`, enabling true unit tests without disk I/O. Added comprehensive unit tests in `test/torch-config-unit.test.mjs`.
- Refactored `loadTorchConfig` to accept optional `fileSystem` argument.
- Created `test/torch-config-unit.test.mjs` with mocked fs tests.
- Verified existing tests pass.
Co-authored-by: PR0M3TH3AN <[email protected]>
Converted the dashboard HTTP request handler to an async function and replaced synchronous `fs.existsSync` and `fs.statSync` calls with non-blocking `fs.promises.stat`. This improves server responsiveness and concurrency by ensuring the event loop is not blocked during file system checks.
Also added robust error handling to the asynchronous handler to prevent unhandled promise rejections and ensure consistent 500 responses on internal errors.
Co-authored-by: PR0M3TH3AN <[email protected]>
Replaced empty catch blocks in `loadCanonicalRoster` and `parseLockEvent`
with `console.debug` statements that log the error message. This
improves observability of failures while maintaining the graceful
fallback behavior.
Co-authored-by: PR0M3TH3AN <[email protected]>
Explicitly bind the dashboard server to the local loopback interface
to prevent external access. This addresses a vulnerability where
the server was binding to all network interfaces by default.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Modified `src/lib.mjs` to execute `queryLocks` for all cadences in parallel.
- Added `scripts/perf-benchmark.mjs` for measuring CLI performance.
- Added `weekly-perf-report-2026-02-14.md` with baseline and verification data.
- Added `task-logs/weekly/2026-02-14T13-14-38Z__perf-deepdive-agent__completed.md`.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Extract parseTorchConfig for better isolation in tests.
- Add _resetTorchConfigCache for deterministic unit testing.
- Implement comprehensive tests in test/torch-config.test.mjs covering:
- Path resolution with env var support.
- Normalization of cadence and status.
- Roster parsing and filtering.
- Error handling for malformed config files.
- Caching behavior.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Created src/constants.mjs
- Updated src/lib.mjs to use constants
- Added execution artifacts and completed log
Co-authored-by: PR0M3TH3AN <[email protected]>
- Rename `src/nostr-lock.mjs` to `src/lib.mjs` and export core functions.
- Create `bin/torch-lock.mjs` as the CLI entry point.
- Implement `dashboard` command in `src/lib.mjs` to serve the dashboard using Node.js.
- Update `package.json` to configure `bin`, `main`, and `files` for NPM packaging.
- Create `torch-config.example.json` as a template for consumers.
- Update tests and README.md to reflect the new structure.
- Exclude task-specific artifacts (logs, context) from the package while retaining prompts and docs.
Co-authored-by: PR0M3TH3AN <[email protected]>
- Attempted to run audit-agent.
- Failed because `scripts/check-file-size.mjs`, `scripts/check-innerhtml.mjs`, and `npm run lint` are missing.
- Created `artifacts/audit/2026-02-14/summary.md` documenting the failure.
- Created `task-logs/daily/2026-02-14T06-04-19Z__audit-agent__failed.md`.
- Added execution context in `src/context/`, `src/todo/`, `src/decisions/`, `src/test_logs/`.
Co-authored-by: PR0M3TH3AN <[email protected]>