- Update `torch-lock check` to scan `task-logs/<cadence>` for completed tasks.
- Add `--log-dir` and `--ignore-logs` flags to `check` command.
- Implement `getIsoWeekStr` utility for robust weekly cadence checking.
- Ensure completed agents are added to the `excluded` list, enabling the scheduler to skip them.
- Add comprehensive tests for log checking and date utilities.
Co-authored-by: PR0M3TH3AN <[email protected]>
- 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]>