Skip to content

Notice Suppression & Persistent Exclude Management#157

Merged
LadyBluenotes merged 7 commits into
mainfrom
changeset
Jun 14, 2026
Merged

Notice Suppression & Persistent Exclude Management#157
LadyBluenotes merged 7 commits into
mainfrom
changeset

Conversation

@LadyBluenotes

@LadyBluenotes LadyBluenotes commented Jun 14, 2026

Copy link
Copy Markdown
Member

Summary

Adds two user-facing capabilities to the intent CLI and removes the legacy --exclude flag in favor of a persistent command.

1. Notice suppression

Migration/risk notices (printed to stderr when intent.skills is unset) can now be silenced:

  • --no-notices flag on list and install — suppresses notices for a single run.
  • INTENT_NO_NOTICES=1 env var — suppresses notices for the whole shell session (also accepts true, yes, on).

Notices remain on stderr, separate from warnings (stdout), so load output stays machine-safe.

2. intent exclude command (replaces --exclude flag)

Excludes are now a persistent, first-class command that edits package.json#intent.exclude:

  • intent exclude list — show current patterns.
  • intent exclude add <pattern> — add a pattern (validated via compileExcludePatterns).
  • intent exclude remove <pattern> — remove a pattern.
  • --json for machine-readable output.

The old runtime --exclude flag on list/load has been removed, along with the exclude field from GlobalScanFlags and its mapping in coreOptionsFromGlobalFlags. Discovery/filtering behavior is unchanged — the change is purely how excludes are configured (persistent vs. per-invocation).

Changes

New files

  • packages/intent/src/commands/exclude.tsintent exclude command implementation.
  • docs/cli/intent-exclude.md — CLI reference for the new command.

Modified

  • packages/intent/src/cli-output.ts — added NoticeOutputOptions, notice-suppression logic (INTENT_NO_NOTICES + noNotices), gated printNotices.
  • packages/intent/src/cli-support.ts — added noNotices/notices flags and noticeOptionsFromGlobalFlags; removed exclude field and mapping.
  • packages/intent/src/cli.ts — registered exclude; added --no-notices to list/install; removed --exclude from list/load.
  • packages/intent/src/commands/list.ts, install.ts — thread notice options into printNotices.
  • docs/cli/intent-list.md, docs/cli/intent-load.md, docs/concepts/configuration.md, docs/overview.md, docs/config.json — documented suppression + intent exclude; removed --exclude references.

Breaking change

The --exclude flag on list and load is removed. Migrate to intent exclude add <pattern>, which persists the pattern in package.json#intent.exclude.

Summary by CodeRabbit

  • New Features

    • Introduced intent exclude command with list, add, and remove actions to persistently manage excluded packages and skills in your configuration.
    • Added --no-notices flag to intent list and intent install to suppress non-critical notices.
    • Added INTENT_NO_NOTICES environment variable for CI/automation workflows.
  • Documentation

    • Updated CLI documentation and configuration guides to reflect new exclude management workflow.

@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a persistent intent exclude CLI command (list/add/remove) that manages package.json#intent.exclude. Introduces --no-notices flag and INTENT_NO_NOTICES=1 env var to suppress non-critical stderr notices on list and install. Removes the one-off --exclude CLI flag from list and load. Updates docs and tests throughout.

Changes

intent exclude command, notice suppression, and exclude flag consolidation

Layer / File(s) Summary
Notice suppression contracts and helpers
packages/intent/src/cli-output.ts, packages/intent/src/cli-support.ts
NoticeOutputOptions interface and shouldSuppressNotices helper added to cli-output.ts; GlobalScanFlags gains notices/noNotices fields and noticeOptionsFromGlobalFlags is exported from cli-support.ts.
exclude command implementation
packages/intent/src/commands/exclude.ts
New module implementing action normalization, package.json read/write/validation, intent.exclude array management, pattern validation via compileExcludePatterns, and the full runExcludeCommand entry point for list/add/remove.
CLI registration: exclude command, notice flags, exclude flag removal
packages/intent/src/cli.ts, packages/intent/src/commands/list.ts, packages/intent/src/commands/install.ts
Registers the exclude command, adds --no-notices to list and install, removes --exclude from list/load surfaces, and threads noticeOptions through all affected command handlers.
CLI tests
packages/intent/tests/cli.test.ts
Adds INTENT_NO_NOTICES env-var isolation; new tests for exclude subcommands; list notice suppression tests; exclusion tests migrated from --exclude CLI flag to package.json config.
Documentation and changesets
docs/cli/intent-exclude.md, docs/config.json, docs/cli/intent-list.md, docs/cli/intent-load.md, docs/cli/intent-install.md, docs/concepts/configuration.md, .changeset/*
New intent-exclude.md reference page and nav entry; updated intent-list.md, intent-load.md, intent-install.md for flag changes; new "Suppressing notices temporarily" section in configuration.md; two changesets.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

  • Explicit skill sources (allowlist) #145 — This PR extends intent.exclude to support skill-level matching and applies consistent policy filtering across commands, directly implementing the feature described in the issue.

Possibly related PRs

  • TanStack/intent#156 — Implements the intent.skills allowlist and source-policy filtering that this PR's exclude patterns, notice surfacing, and CLI wiring complement.

Suggested reviewers

  • KevinVandy

Poem

🐇 Hippity-hop, I've tidied the flags away,
--exclude on list and load shall no longer stay.
Now intent exclude add keeps the config neat,
And --no-notices hushes the stderr beat.
A tidy warren makes for a happier day! 🌿

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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 PR title 'Notice Suppression & Persistent Exclude Management' directly and clearly summarizes the two main changes introduced in this pull request.
Description check ✅ Passed The PR description comprehensively covers all required sections: a detailed summary of changes, clear explanation of the two main features, comprehensive file-by-file modifications, and explicit breaking change notice.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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 changeset

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 14, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit ded082f

Command Status Duration Result
nx affected --targets=test:eslint,test:sherif,t... ✅ Succeeded <1s View ↗
nx run-many --targets=build --exclude=examples/** ✅ Succeeded <1s View ↗

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

@pkg-pr-new

pkg-pr-new Bot commented Jun 14, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: ded082f

@codspeed-hq

codspeed-hq Bot commented Jun 14, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 6 untouched benchmarks


Comparing changeset (ded082f) with main (0e9d30e)

Open in CodSpeed

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
packages/intent/tests/cli.test.ts (2)

883-936: ⚡ Quick win

Add install-path notice suppression tests to match the new CLI contract.

Line 883 and Line 909 cover suppression for list, but this PR also wires suppression into install. Add at least one install --map case for --no-notices and one for INTENT_NO_NOTICES to protect that path from regressions.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/intent/tests/cli.test.ts` around lines 883 - 936, The test file
currently only covers notice suppression for the list command (the two it()
blocks shown). You need to add two more test cases to cover the install command
path with notice suppression. Add a new it() test that calls main() with install
--map and --no-notices flags, verifying that stderr does not contain 'Notices:'
and 'intent.skills is not set'. Add another new it() test that sets
INTENT_NO_NOTICES=1 and calls main() with install --map (without --no-notices),
verifying the same stderr expectations. Both new tests should follow the same
setup pattern as the existing list tests: create temp directories, write an
installed intent package using writeInstalledIntentPackage, set
process.env.INTENT_GLOBAL_NODE_MODULES, and verify the exit code is 0 and
appropriate output is captured.

909-936: ⚡ Quick win

Expand env-var suppression coverage to all documented true-like values.

Line 909 currently validates only INTENT_NO_NOTICES='1'. The suppression contract also includes true, yes, and on (with normalization), so this leaves a regression gap for documented behavior.

Suggested test shape
+  it.each(['1', 'true', 'yes', 'on', ' TRUE ', 'Yes'])(
+    'suppresses notices when INTENT_NO_NOTICES=%s',
+    async (value) => {
+      const root = mkdtempSync(
+        join(realTmpdir, 'intent-cli-list-env-no-notices-matrix-'),
+      )
+      const isolatedGlobalRoot = mkdtempSync(
+        join(realTmpdir, 'intent-cli-list-env-no-notices-matrix-empty-global-'),
+      )
+      tempDirs.push(root, isolatedGlobalRoot)
+      writeInstalledIntentPackage(root, {
+        name: '`@tanstack/query`',
+        version: '5.0.0',
+        skillName: 'fetching',
+        description: 'Query data fetching patterns',
+      })
+
+      process.env.INTENT_GLOBAL_NODE_MODULES = isolatedGlobalRoot
+      process.env.INTENT_NO_NOTICES = value
+      process.chdir(root)
+
+      const exitCode = await main(['list'])
+      const stderr = errorSpy.mock.calls.flat().join('\n')
+
+      expect(exitCode).toBe(0)
+      expect(stderr).not.toContain('intent.skills is not set')
+      expect(stderr).not.toContain('Notices:')
+    },
+  )
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/intent/tests/cli.test.ts` around lines 909 - 936, The test at line
909 in packages/intent/tests/cli.test.ts only validates INTENT_NO_NOTICES
suppression for the value '1', but the documented behavior also supports 'true',
'yes', and 'on'. Expand the test coverage by parameterizing the existing test
case to run with all four documented true-like values, ensuring each value
properly suppresses notices by verifying that stderr does not contain the
notice-related output. This can be done by either creating separate test cases
for each value or using a parameterized test approach (such as test.each() if
supported by the test framework), maintaining the same test structure and
assertions for each iteration.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/intent/tests/cli.test.ts`:
- Around line 883-936: The test file currently only covers notice suppression
for the list command (the two it() blocks shown). You need to add two more test
cases to cover the install command path with notice suppression. Add a new it()
test that calls main() with install --map and --no-notices flags, verifying that
stderr does not contain 'Notices:' and 'intent.skills is not set'. Add another
new it() test that sets INTENT_NO_NOTICES=1 and calls main() with install --map
(without --no-notices), verifying the same stderr expectations. Both new tests
should follow the same setup pattern as the existing list tests: create temp
directories, write an installed intent package using
writeInstalledIntentPackage, set process.env.INTENT_GLOBAL_NODE_MODULES, and
verify the exit code is 0 and appropriate output is captured.
- Around line 909-936: The test at line 909 in packages/intent/tests/cli.test.ts
only validates INTENT_NO_NOTICES suppression for the value '1', but the
documented behavior also supports 'true', 'yes', and 'on'. Expand the test
coverage by parameterizing the existing test case to run with all four
documented true-like values, ensuring each value properly suppresses notices by
verifying that stderr does not contain the notice-related output. This can be
done by either creating separate test cases for each value or using a
parameterized test approach (such as test.each() if supported by the test
framework), maintaining the same test structure and assertions for each
iteration.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e68c9060-5dd6-4d32-8318-8e18e888322a

📥 Commits

Reviewing files that changed from the base of the PR and between 0e9d30e and ded082f.

📒 Files selected for processing (15)
  • .changeset/crisp-flies-mate.md
  • .changeset/green-dingos-refuse.md
  • docs/cli/intent-exclude.md
  • docs/cli/intent-install.md
  • docs/cli/intent-list.md
  • docs/cli/intent-load.md
  • docs/concepts/configuration.md
  • docs/config.json
  • packages/intent/src/cli-output.ts
  • packages/intent/src/cli-support.ts
  • packages/intent/src/cli.ts
  • packages/intent/src/commands/exclude.ts
  • packages/intent/src/commands/install.ts
  • packages/intent/src/commands/list.ts
  • packages/intent/tests/cli.test.ts

@LadyBluenotes LadyBluenotes merged commit 665370e into main Jun 14, 2026
13 of 16 checks passed
@LadyBluenotes LadyBluenotes deleted the changeset branch June 14, 2026 07:28
@github-actions github-actions Bot mentioned this pull request Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant