Skip to content

Remove abandoned intent-library bin, harden integration tests, fix lint - #148

Merged
LadyBluenotes merged 4 commits into
mainfrom
pnp-and-cleanup
Jun 7, 2026
Merged

Remove abandoned intent-library bin, harden integration tests, fix lint#148
LadyBluenotes merged 4 commits into
mainfrom
pnp-and-cleanup

Conversation

@LadyBluenotes

@LadyBluenotes LadyBluenotes commented Jun 7, 2026

Copy link
Copy Markdown
Member

Summary

Cleanup branch covering three related changes:

  1. Remove the abandoned intent-library bin and scanner (closes Remove the abandoned intent-library bin #143)
  2. Harden integration tests for cross-platform runs and wire them into CI
  3. Resolve all ESLint errors surfaced after the cleanup

1. Remove abandoned intent-library bin (#143)

The old library-bin discovery model was replaced by the keyword-based model and
was dead code. This removes:

  • src/intent-library.ts and src/library-scanner.ts
  • tests/library-scanner.test.ts
  • The intent-library bin and ./intent-library export from
    packages/intent/package.json
  • The two source files from the tsdown build entries and knip.json entry list

Breaking: anything invoking intent-library directly must move to the normal
intent discovery flow. No compatibility shim is provided.

2. Harden integration tests

  • Add a dedicated test:integration target to nx.json (cached, depends on build)
  • Run test:integration as part of both test:ci and test:pr pipelines
  • Make scaffold/load/scanner integration tests and cli.test.ts robust across
    platforms

3. Resolve ESLint errors

  • cli.ts: extract a testable isMainModule() helper, replacing the top-level
    mutable isMain + empty catch
  • Replace while (true) directory-walk loops with bounded while (dir !== prev)
    conditions in excludes.ts, load-resolution.ts, project-context.ts,
    scanner.ts, utils.ts, and workspace-patterns.ts
  • Split type-only imports into import type across affected files
  • Drop an unnecessary non-null assertion in staleness.ts and redundant optional
    chaining in workflow-review.ts

Summary by CodeRabbit

Release Notes

  • Breaking Changes

    • Removed the deprecated intent-library binary and ./intent-library export from the package.
    • Legacy intent-library bin discovery has been replaced with a keyword-based discovery model; users must migrate to standard intent discovery flow.
  • Improvements

    • Enhanced integration test infrastructure with better environment availability checks.
@LadyBluenotes
LadyBluenotes requested a review from a team as a code owner June 7, 2026 17:20
@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR removes the abandoned intent-library CLI binary and its supporting modules, refactors internal directory-traversal loops to use safer convergence-based patterns, extracts CLI entry-point logic into a reusable helper, and improves integration test infrastructure with dynamic port allocation and conditional environment detection.

Changes

Intent Library Removal and Internal Refactoring

Layer / File(s) Summary
Package exports and entry point removal
.changeset/fruity-toys-win.md, packages/intent/package.json, knip.json
Removes ./intent-library export, intent-library CLI binary, and compiled module entries from package metadata and build configuration.
CLI isMainModule helper extraction and tests
packages/intent/src/cli.ts, packages/intent/tests/cli.test.ts
Extracts the main-module detection logic into a reusable isMainModule(metaUrl, argvPath, realpath?) helper with safe error handling; adds test suite covering missing paths, symlink resolution, and error cases.
Refactor unbounded loops to use prev-based convergence
packages/intent/src/core/project-context.ts, packages/intent/src/core/load-resolution.ts, packages/intent/src/scanner.ts, packages/intent/src/utils.ts, packages/intent/src/workspace-patterns.ts
Replaces while (true) + explicit termination checks with while (dir !== prev) loops across findOwningPackageRoot, findVisibleDependencyDir, findPnpFile, resolveDepDir, and findWorkspaceRoot, removing redundant logic while preserving traversal behavior.
Separate type-only imports throughout codebase
packages/intent/src/commands/list.ts, packages/intent/src/commands/validate.ts, packages/intent/src/core.ts, packages/intent/src/core/excludes.ts, packages/intent/src/core/load-resolution.ts, packages/intent/src/workspace-patterns.ts
Pulls type-only imports (ProjectContext, GlobalScanFlags, IntentFsCache, etc.) into dedicated import type statements for improved build-time tree-shaking without runtime changes.
Core function logic refinements
packages/intent/src/core/excludes.ts, packages/intent/src/staleness.ts, packages/intent/src/workflow-review.ts
Updates warningMentionsPackage loop mechanics to use index-based iteration; removes optional-chaining fallbacks in collectStaleReviewItems; removes unnecessary non-null assertion in parseSyncState.
Integration test infrastructure and environment detection
packages/intent/tests/integration/scaffold.ts
Adds getFreePort() for dynamic TCP port allocation, Windows-aware Verdaccio spawning, isolated npm cache per call, and new exports: isPackageManagerAvailable(), canSymlink(), isYarnClassic() for environment gating.
Update integration tests with conditional gating
packages/intent/tests/integration/load-integration.test.ts, packages/intent/tests/integration/scanner-integration.test.ts
Uses new environment helpers to conditionally skip package-manager and symlink tests; refactors assertions with shared expectLeafCoreSkill() helper; updates registry type to Registry | undefined with non-null assertions.
Remove library-scanner tests and minor test updates
packages/intent/tests/library-scanner.test.ts, packages/intent/tests/skill-use.test.ts, packages/intent/tests/stale-command.test.ts
Deletes entire library-scanner.test.ts suite; reorders imports in unrelated test files for consistency.
CI and build configuration updates
nx.json, package.json
Adds test:integration target defaults with caching and build dependencies; updates root test:ci script to include test:integration in the nx run-many target list.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes


Possibly related issues

  • #143: "Remove the abandoned intent-library bin" — this PR fully resolves the objective by deleting intent-library.ts, library-scanner.ts, the ./intent-library export, and all associated tests and build configuration.

Possibly related PRs

  • TanStack/intent#93: Both PRs refactor findOwningPackageRoot and directory-traversal loop patterns in core package/workspace resolution logic.
  • TanStack/intent#85: Both PRs modify the CLI entrypoint in src/cli.ts with changes to main-module detection and command dispatch logic.
  • TanStack/intent#124: Both PRs touch overlapping core modules (src/core/excludes.ts, src/core/load-resolution.ts) with related refactoring of resolution and exclusion logic.

Suggested reviewers

  • KyleAMathews

Poem

🐰 Off with the old intent-library bin,
The loops now dance with elegant prev checks within,
Type imports sorted, integration tests gated tight,
A cleaner codebase emerging into the light! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 7.69% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the three main changes: removing intent-library bin, hardening integration tests, and fixing lint issues—all present in the changeset.
Description check ✅ Passed The PR description covers all required sections: a clear summary of changes, a detailed breakdown of the three objectives, and explicit acknowledgment of the breaking change. It follows the repository template structure.
Linked Issues check ✅ Passed The PR successfully addresses issue #143 by removing intent-library bin, sources (intent-library.ts, library-scanner.ts), tests, exports, and build entries with no broken references.
Out of Scope Changes check ✅ Passed All changes are within scope: removing abandoned code per issue #143, hardening integration tests for CI, and resolving ESLint errors introduced by the cleanup. No unrelated modifications present.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch pnp-and-cleanup

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud

nx-cloud Bot commented Jun 7, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 5797311

Command Status Duration Result
nx run-many --targets=build --exclude=examples/** ✅ Succeeded <1s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-06-07 17:21:31 UTC

@pkg-pr-new

pkg-pr-new Bot commented Jun 7, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@tanstack/intent@148

commit: 5797311

@LadyBluenotes
LadyBluenotes merged commit a8e0ea1 into main Jun 7, 2026
8 of 9 checks passed
@LadyBluenotes
LadyBluenotes deleted the pnp-and-cleanup branch June 7, 2026 17:28
@github-actions github-actions Bot mentioned this pull request Jun 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants