Address two review threads on PR #1518 that flagged tests whose titles
overstated what was being verified.
- fileProcess: the longBase64 string is one continuous line, so the
truncateBase64 → removeEmptyLines ordering was never actually under
test (truncateBase64Content's regex does not span newlines). Rename
to describe the combined behavior the test really pins.
- skillTechStack: rename the per-directory case to reflect that root
and subpackage land in separate buckets keyed by getDirPath, and
add a second case with two package.json entries at the same path
to genuinely exercise the parsed.packageManager && !result.packageManager
guard at skillTechStack.ts:541.
Targeted regression tests for the high-risk areas identified in the
v1.13.1..main audit, focusing on silent-correctness bugs and parallel
error handling — places that wouldn't surface in CI but would in the
field.
- core/metrics/calculateMetrics: pin numeric equivalence between the
fast path (Σ file tokens + wrapper tokens) and the slow path (full
output tokenization). Cover wrapper-extraction fallback, split-output
fallback, and worker pool cleanup when fileMetrics rejects.
- core/file/fileProcess: pin transform ordering invariants —
removeComments → removeEmptyLines (blank lines from comment removal
must be cleaned up; preserved when removeEmptyLines is off);
truncateBase64 → removeEmptyLines (multi-line base64 squashed first);
trim → showLineNumbers (no leading/trailing blanks numbered).
Plus worker/lightweight path parity for inputs that don't need
worker processing.
- core/packager: pin metrics worker pool cleanup on parallel branch
failures (validateFileSafety, produceOutput, calculateMetrics, warmup
rejection). Verify prefetchSortData failure is isolated and does not
block sortOutputFiles.
- core/skill/skillTechStack: cover untested fix-commit invariants —
root entry sorts first in monorepo output; configFiles deduplicated
within a directory; first-seen packageManager wins per directory.
Aligns with files.md pattern (## File: <path>). Each package is now
a ## section under a single # Tech Stacks heading, with ### subsections
for Languages, Frameworks, Dependencies, etc.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Instead of merging all dependency files into a single flat list,
detectTechStack now returns a TechStackInfo[] grouped by package
directory. Each directory containing a dependency file produces its
own entry with path, languages, frameworks, dependencies, etc.
generateTechStackMd renders each package as a separate section with
`path: (root)` or `path: packages/xxx`, separated by `---`. This
gives AI consumers clearer per-package context and makes line-based
retrieval easier.
Removes deduplicateDependencies as dependencies are now scoped
per-package and don't need cross-package deduplication. configFiles
stores filenames only (not full paths) since the package path
provides the directory context.
Closes#1182
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Use first-wins for packageManager to match other dedup strategies
- Deduplicate dependencies by name:version to preserve version skew
- Normalize Node.js version v prefix before runtime version dedup
- Fix stale comment referencing root-level-only detection
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Deduplicate runtimeVersions by runtime:version pair to prevent
duplicate entries when multiple version files exist across
subdirectories in monorepos.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Previously, detectTechStack() only checked root-level dependency files,
causing tech-stack.md to be empty for monorepo setups using --include
to target a specific package.
Now all dependency files in processedFiles are checked regardless of
directory depth. Since processedFiles is already filtered by
--include/--ignore, this naturally scopes detection to the user's
target. Also adds dependency deduplication for cases where multiple
package.json files define the same package, and stores config file
full paths to distinguish files across subdirectories.
Closes#1182
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Reorganize skill generation code for better domain separation:
- Move files from core/output/skill/ to core/skill/ (5 files)
- Move writeSkillOutput.ts from core/packager/ to core/skill/
- Create packSkill.ts to encapsulate skill generation logic
- Simplify packager.ts by delegating skill generation to packSkill()
- Add re-exports in outputGenerate.ts for backward compatibility
This change improves code organization by:
- Separating skill domain from output domain
- Reducing packager.ts complexity
- Centralizing all skill-related code in one location