Skip to content

Commit b7920e9

Browse files
chore: lint cleanup and notice-suppressibility fix (#185)
* chore: add eslint test script to package.json * chore: update file paths and imports in various modules for consistency * chore: refactor async functions to synchronous in command execution and tests * chore: add warnings for allow-all mode and update tests accordingly * chore: update ALLOW_ALL_NOTICE handling to ensure visibility in notices and adjust related tests * chore: ensure allow-all risk warning is always displayed in intent list
1 parent 79902ee commit b7920e9

14 files changed

Lines changed: 143 additions & 86 deletions

File tree

.changeset/forty-heads-fly.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@tanstack/intent': patch
3+
---
4+
5+
Fix `intent list` suppressing the allow-all risk warning.
6+
7+
When `intent.skills` is set to allow-all (`"*"`), `intent list --no-notices` and `INTENT_NO_NOTICES=1` no longer hide the warning that all skill sources are permitted. This banner is a security-relevant signal, not a migration tip, so it's now excluded from suppression while other notices remain suppressible as before.

eslint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const config = [
4949
{
5050
name: 'intent/static-discovery',
5151
files: [
52-
'packages/intent/src/scanner.ts',
52+
'packages/intent/src/discovery/scanner.ts',
5353
'packages/intent/src/lockfile.ts',
5454
'packages/intent/src/manifest.ts',
5555
'packages/intent/src/mcp/**/*.ts',

packages/intent/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"test:smoke": "pnpm run build && node dist/cli.mjs --help > /dev/null && node dist/cli.mjs load --help > /dev/null",
4444
"test:lib": "vitest run --exclude 'tests/integration/**'",
4545
"test:integration": "vitest run tests/integration/",
46-
"test:types": "tsc --noEmit"
46+
"test:types": "tsc --noEmit",
47+
"test:eslint": "eslint ."
4748
}
4849
}

packages/intent/src/commands/exclude.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,11 @@ function printExcludes(excludes: Array<string>, json?: boolean): void {
126126
}
127127
}
128128

129-
export async function runExcludeCommand(
129+
export function runExcludeCommand(
130130
actionArg: string | undefined,
131131
patternArg: string | undefined,
132132
options: ExcludeCommandOptions,
133-
): Promise<void> {
133+
): void {
134134
const action = normalizeAction(actionArg)
135135
const cwd = process.cwd()
136136
const pkg = readPackageJson(cwd)

packages/intent/src/commands/list.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1+
import { detectIntentAudience } from '../shared/environment.js'
2+
import { formatIntentCommand } from '../shared/command-runner.js'
3+
import { listIntentSkills } from '../core/index.js'
14
import {
25
coreOptionsFromGlobalFlags,
36
noticeOptionsFromGlobalFlags,
47
printDebugInfo,
58
printNotices,
69
printWarnings,
710
} from './support.js'
8-
import { detectIntentAudience } from '../shared/environment.js'
9-
import { formatIntentCommand } from '../shared/command-runner.js'
10-
import { listIntentSkills } from '../core/index.js'
1111
import type { GlobalScanFlags } from './support.js'
1212
import type {
1313
IntentPackageSummary,

packages/intent/src/commands/load.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ function printLoadDebug(loaded: LoadedIntentSkill | ResolvedIntentSkill): void {
3232
])
3333
}
3434

35-
export async function runLoadCommand(
35+
export function runLoadCommand(
3636
use: string | undefined,
3737
options: LoadCommandOptions,
38-
): Promise<void> {
38+
): void {
3939
if (!use) {
4040
fail('Missing skill use. Expected: intent load <package>#<skill>')
4141
}

packages/intent/src/core/source-policy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { scanForIntents } from '../discovery/scanner.js'
22
import { detectIntentAudience } from '../shared/environment.js'
3+
import { ALLOW_ALL_NOTICE } from '../shared/cli-output.js'
34
import {
45
compileExcludePatterns,
56
getConfigDirs,
@@ -22,8 +23,7 @@ import type {
2223
IntentHiddenSourceSummary,
2324
} from './types.js'
2425

25-
export const ALLOW_ALL_NOTICE =
26-
'All skill sources allowed (intent.skills: ["*"]) — unvetted skills may be surfaced into agent guidance.'
26+
export { ALLOW_ALL_NOTICE }
2727

2828
export const MIGRATION_NOTICE =
2929
'intent.skills is not set — all discovered skill sources are surfaced. A future version will require an explicit intent.skills allowlist; add one to opt in to specific sources.'

packages/intent/src/hooks/install.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ function isIntentHook(value: unknown): boolean {
548548
}
549549

550550
function isIntentGateScriptReference(value: string): boolean {
551-
return /(?:^|[\s"'\/])(?:old-)?intent-(claude|codex|copilot)-gate\.mjs(?:$|[?#\s"'])/i.test(
551+
return /(?:^|[\s"'/])(?:old-)?intent-(claude|codex|copilot)-gate\.mjs(?:$|[?#\s"'])/i.test(
552552
value,
553553
)
554554
}

packages/intent/src/shared/cli-output.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
// Lives here (not core/source-policy.ts) so printNotices can enforce
2+
// non-suppressibility by identity without core importing this module.
3+
export const ALLOW_ALL_NOTICE =
4+
'All skill sources allowed (intent.skills: ["*"]) — unvetted skills may be surfaced into agent guidance.'
5+
16
export function printWarnings(warnings: Array<string>): void {
27
if (warnings.length === 0) return
38

@@ -27,10 +32,17 @@ export function printNotices(
2732
options: NoticeOutputOptions = {},
2833
): void {
2934
if (notices.length === 0) return
30-
if (shouldSuppressNotices(options)) return
35+
36+
// ALLOW_ALL_NOTICE stays visible even when suppressed: agent hooks read
37+
// warnings/conflicts but never notices, so keeping it here (rather than in
38+
// warnings) also keeps it out of agent-injected context automatically.
39+
const visible = shouldSuppressNotices(options)
40+
? notices.filter((notice) => notice === ALLOW_ALL_NOTICE)
41+
: notices
42+
if (visible.length === 0) return
3143

3244
console.error('Notices:')
33-
for (const notice of notices) {
45+
for (const notice of visible) {
3446
console.error(` ℹ ${notice}`)
3547
}
3648
}

packages/intent/src/staleness/check.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { existsSync, readFileSync } from 'node:fs'
22
import { isAbsolute, join, relative, resolve } from 'node:path'
33
import semver from 'semver'
4-
import { readIntentArtifacts } from './artifact-coverage.js'
54
import {
65
findSkillFiles,
76
parseFrontmatter,
87
readScalarField,
98
toPosixPath,
109
} from '../shared/utils.js'
10+
import { readIntentArtifacts } from './artifact-coverage.js'
1111
import type {
1212
IntentArtifactSet,
1313
IntentArtifactSkill,

0 commit comments

Comments
 (0)