Commit Graph

24 Commits

  • test: add 3 tests for regex boundary and flag logic gaps (round 93)
    - getSessionStats: drive letter without slash (Z:nosession.tmp) treated as content
    - countInFile: case-insensitive regex with g flag auto-appended (/foo/i → /foo/ig)
    - countInFile: case-insensitive regex with g flag preserved (/foo/gi stays /foo/gi)
  • test: add Round 92 tests for object pattern, UNC path, and empty packageManager
    - Test countInFile returns 0 for object pattern type (non-string non-RegExp)
    - Test getSessionStats treats Windows UNC path as content (not file path)
    - Test detectFromPackageJson returns null for empty string packageManager field
    
    Total tests: 836
  • test: add 3 tests for replaceInFile deletion, parseSessionMetadata null fields, countInFile zero matches (Round 88)
    - replaceInFile with empty replacement string verifies text deletion works
    - parseSessionMetadata asserts date/started/lastUpdated are null when fields absent
    - countInFile with valid file but non-matching pattern returns 0
    
    Total: 824 tests
  • fix: use nullish coalescing for confidence default + add 3 tests (round 85)
    Fix confidence=0 showing 80% instead of 0% in patterns() (|| → ??).
    Test evaluate-session.js config parse error catch, getSessionIdShort
    fallback at root CWD, and precise confidence=0 assertion.
  • test: add 3 tests for TOCTOU catch paths and NaN date sort fallback (round 84)
    - getSessionById returns null for broken symlink (session-manager.js:307-310)
    - findFiles skips broken symlinks matching the pattern (utils.js:170-173)
    - listAliases sorts entries with invalid/missing dates via getTime() || 0 fallback
  • test: cover countInFile/grepFile string patterns and validate-commands warnings suffix
    Round 79 — untested conditional branches in utils.js and validate-commands.js:
    - countInFile: exercise typeof pattern === 'string' branch with valid string
    - grepFile: exercise string pattern branch (not RegExp)
    - validate-commands: verify (N warnings) suffix in output when warnCount > 0
  • test: cover findFiles unreadable subdir, session-start default PM, setPreferredPM save failure
    Round 71: Add 3 tests for untested code paths (815 → 818):
    - utils.js findFiles: recursive scan silently skips unreadable subdirectories (line 188 catch)
    - session-start.js: shows getSelectionPrompt when pm.source is 'default' (lines 69-72)
    - package-manager.js: setPreferredPackageManager wraps saveConfig errors (lines 250-254)
  • test: add 3 tests for untested code paths (Round 69, 812 total)
    - getGitModifiedFiles: all-invalid patterns skip filtering (compiled.length === 0)
    - getSessionById: returns null when sessions directory doesn't exist
    - getPackageManager: global-config success path returns source 'global-config'
  • test: add replaceInFile write failure, empty sessions dir, and corrupted global config tests (Round 61)
    - utils.test.js: replaceInFile returns false on read-only file (catch block)
    - session-manager.test.js: getAllSessions returns empty when sessions dir missing
    - package-manager.test.js: getPackageManager falls through corrupted global config to npm default
    
    788 tests total, all passing.
  • test: add 10 tests for birthtime fallback, stdin error, alias rollback (Round 33)
    Cover createdTime/birthtime fallback in session-manager, readStdinJson
    error event settled-flag guard in utils, renameAlias rollback on naming
    conflict in session-aliases, and saveAliases backup preservation on
    serialization failure. Total: 713 tests.
  • fix: reject flags passed as package manager names in setup-package-manager CLI
    When --global or --project was followed by another flag (e.g., --global --project),
    the flag was treated as a package manager name. Added pmName.startsWith('-') check
    to both handlers. Added 20 tests across 4 test files covering argument validation,
    ensureDir error propagation, runCommand stderr handling, and saveAliases failure paths.
  • test: add 22 tests for readStdinJson, evaluate-session config, and suggest-compact hook
    - utils.test.js: 5 tests for readStdinJson maxSize truncation, whitespace-only stdin, trailing whitespace, and BOM prefix handling
    - evaluate-session.test.js: 4 tests for config file parsing, assistant-only transcripts, malformed JSON lines, and empty stdin
    - suggest-compact.test.js: 13 new tests covering counter file creation/increment, threshold suggestion, interval suggestion, env var handling, corrupted/empty counter files, and session isolation
  • fix: box alignment in test runner, update metadata counts, add 18 tests
    - Fix run-all.js box alignment (hardcoded spaces 1 char short, now using dynamic padEnd)
    - Update .opencode/index.ts metadata (12→13 agents, 24→31 commands, 16→37 skills)
    - Add commandExists edge case tests (empty, spaces, path separators, metacharacters)
    - Add findFiles edge case tests (? wildcard, mtime sorting, maxAge filtering)
    - Add ensureDir race condition and return value tests
    - Add runCommand output trimming and failure tests
    - Add pre-compact session annotation and compaction log timestamp tests
    - Add check-console-log invalid JSON handling test
    - Add replaceInFile capture group test
    - Add readStdinJson Promise type check
  • fix: grepFile global regex lastIndex bug, add 12 tests
    Fix grepFile() silently skipping matches when called with /g flag regex.
    The global flag makes .test() stateful, causing alternating match/miss
    on consecutive matching lines. Strip g flag since per-line testing
    doesn't need global state.
    
    Add first-ever tests for evaluate-session.js (5 tests: short session,
    long session, missing transcript, malformed stdin, env var fallback)
    and suggest-compact.js (5 tests: counter increment, threshold trigger,
    periodic suggestions, below-threshold silence, invalid threshold).
  • fix: add input validation, date range checks, and security hardening
    - validate-agents.js: reject invalid model names in agent frontmatter
    - package-manager.js: validate script/binary names against shell injection
    - session-manager.js: reject impossible month/day values in filenames
    - utils.js: support options.all for replaceInFile string patterns
    - strategic-compact/SKILL.md: fix hook matcher syntax and script reference
    - install.sh: warn when overwriting existing rule customizations
    - Add 24 new tests covering all validation and edge cases
  • fix: use execFileSync with input option for Windows-compatible stdin tests
    Windows cmd.exe treats single quotes literally, so `echo '...' | node -e '...'`
    fails. Switched to execFileSync with the `input` option to pipe stdin data
    directly without shell quoting issues.
  • fix: box() off-by-one alignment, add 5 tests for readStdinJson and box alignment
    - skill-create-output.js: fix top border being 1 char narrower than
      middle/bottom lines (width - title - 5 → width - title - 4)
    - Add box alignment regression test verifying all lines have equal width
    - Add 4 readStdinJson tests via subprocess (valid JSON, invalid JSON,
      empty stdin, nested objects) — last untested exported utility function
    - All 338 tests passing
  • fix: capture stderr in typecheck hook, add 13 tests for session-end and utils
    - post-edit-typecheck.js: capture both stdout and stderr from tsc
    - hooks.test.js: 7 extractSessionSummary tests (JSONL parsing, array content,
      malformed lines, empty transcript, long message truncation, env var fallback)
    - utils.test.js: 6 tests (replaceInFile g-flag behavior, string replace,
      capture groups, writeFile overwrite, unicode content)
    
    Total test count: 294 → 307
  • fix: broken cross-references, version sync, and enhanced command validator
    - Fix /build-and-fix → /build-fix in tdd.md, plan.md (+ cursor, zh-CN)
    - Fix non-existent explorer agent → planner in orchestrate.md (+ cursor, zh-CN, zh-TW)
    - Fix /python-test → /tdd in python-review.md (+ cursor, zh-CN)
    - Sync package.json version from 1.0.0 to 1.4.1 to match plugin.json
    - Enhance validate-commands.js with cross-reference checking:
      command refs, agent path refs, skill dir refs, workflow diagrams
    - Strip fenced code blocks before scanning to avoid false positives
    - Skip hypothetical "Creates:" lines in evolve.md examples
    - Add 46 new tests (suggest-compact, session-manager, utils, hooks)
  • feat: add 3 new skills, JS syntax validation in hooks CI, and edge case tests
    - New skills: api-design, database-migrations, deployment-patterns
    - validate-hooks.js: validate inline JS syntax in node -e hook commands
    - utils.test.js: edge case tests for findFiles with null/undefined inputs
    - README: update skill count to 35, add new skills to directory tree
  • fix: resolve ESLint errors and update tests for project-name fallback
    - Fix 16 ESLint no-unused-vars errors across hook scripts and tests
    - Add eslint-disable comment for intentional control-regex in ANSI stripper
    - Update session file test to use getSessionIdShort() instead of hardcoded 'default'
      (reflects PR #110's project-name fallback behavior)
    - Add marketing/ to .gitignore (local drafts)
    - Add skill-create-output.js (terminal output formatter)
    
    All 69 tests now pass. CI should be green.
  • feat: use project name as session filename fallback
    Fixes #99. Falls back to git repo name or directory name when CLAUDE_SESSION_ID is unavailable.
  • feat: v1.1.0 release - session ID tracking, async hooks, new skills
    - Add session ID to session filenames (Issue #62)
    - Add getSessionIdShort() helper for unique per-session tracking
    - Add async hooks documentation with example
    - Create iterative-retrieval skill for progressive context refinement
    - Add continuous-learning-v2 skill with instinct-based learning
    - Add ecc.tools ecosystem section to README
    - Update skills list in README
    
    All 67 tests passing.
  • feat: cross-platform support with Node.js scripts
    - Rewrite all bash hooks to Node.js for Windows/macOS/Linux compatibility
    - Add package manager auto-detection (npm, pnpm, yarn, bun)
    - Add scripts/lib/ with cross-platform utilities
    - Add /setup-pm command for package manager configuration
    - Add comprehensive test suite (62 tests)
    
    Co-authored-by: zerx-lab