Dashboard › craft › Distillation
35330d94-8e3d-48a6-af4d-eeac09b7d0dc["lore_tm_v1_fK38kVTbJz5TIbeZPK15ziX-sNvkxD7w1Mjy_Czt31g","lore_tm_v1_6Y7xKby5Ut6dbMRql7hHx_jLJuXpzHSgF_YCVSrUf4w","lore_tm_v1_yAot1cdNaf5N0hi1KbulPlkaT0rxUImAleM1tvrev9Q","lore_tm_v1_hVb2ingEWH1j890TV96HRXOGExal81OzwXyruHGteEI","lore_tm_v1_ODvB1cT5OCq8Ko9Cw-YJtB8QiiE8E4R2q6mFV4f5D3Q","lore_tm_v1_e81r72mjrcLjpyU_lUVloelZ_qy34mf9l-lEQp3rGYc","lore_tm_v1_wGyAcU_forBylvWuqR1cMsZmzTINBJRHC0jGBmp5COA"]
Date: Sep 8, 2026
WalkEntry yielded by walkFiles is always a regular file; directories are traversed but never yielded, and symlinks are skipped unless followSymlinks: true.WalkEntry.isBinary uses TEXT_EXTENSIONS as an always-text extension fast path; other extensions are classified by reading the first 8 KB and detecting a NUL byte. UTF-16 text is a known false-positive binary classification case.WalkEntry.mtime is always 0 when recordMtimes: false (default), which is suitable for grep/search consumers; DSN cache-invalidation callers use recordMtimes: true.packages/cli/src/lib/scan/types.ts:16-48: WalkEntry contains native-separator absolutePath, POSIX-normalized relativePath relative to WalkOptions.cwd without leading ./ or trailing /, byte size, millisecond-epoch mtime, boolean isBinary, and depth; root files are depth 0, while cwd/src/foo.ts is depth 1. Core walker remains policy-free; monorepo callers must implement their own depth-reset counter.types.ts:54-207: WalkOptions.cwd must be absolute. Its filters include lowercase path.extname extensions allowlist (skips non-allowlisted files without binary sniffing), basename-anywhere alwaysSkipDirs defaulting to DEFAULT_SKIP_DIRS, hidden default true, respectGitignore default true, and cumulative nestedGitignore default true. Size/depth controls are maxFileSize default MAX_FILE_SIZE (256 * 1024), minDepth default 0 (DSN callers use 3), maxDepth default Infinity, and cheap-per-descent descentHook defaulting to linear depth + 1.types.ts:126-207: WalkOptions.followSymlinks defaults false; when enabled, resolved symlink targets are cycle-protected by a visited dev:ino set. An aborted signal causes the next yield to throw DOMException named "AbortError". timeBudgetMs defaults Infinity; beyond minDepth, candidate descent stops when clock() - startedAt > timeBudgetMs, but already-queued directories drain. clock defaults performance.now. onDirectoryVisit(absDir, flooredStatMtimeMs) is opt-in and costs one extra directory stat().types.ts:233-388: grepFiles emits one GrepMatch per matching line and does not support multi-line patterns. A match includes cwd-relative POSIX path, absolutePath, 1-based lineNum, and a line truncated at default maxLineLength: 2000 with …; CRLF trailing \r remains verbatim. Optional mtime is omitted—not zero—unless GrepOptions.recordMtimes is true. GrepOptions requires absolute cwd plus pattern: string | RegExp; string patterns support (?i), (?im), and (?i:...), while supplied RegExp values are used verbatim.types.ts:277-388: Grep supports picomatch include/exclude, an unvalidated path subdirectory (adapter boundaries must use safePath), walker options, default case-sensitive matching, default multiline: true so ^/$ work per line like rg, default includeBinary: false, unlimited total/per-file results unless capped, stopOnFirst, default maxLineLength: 2000, default per-file processing concurrency: CONCURRENCY_LIMIT, signal, and walker timeBudgetMs. collectGrep returns matches sorted by [path, lineNum] plus stats: filesConsidered, filesRead, filesSkippedBinary, matchesEmitted, and truncated.types.ts:395-426: GlobOptions requires cwd and OR-semantics picomatch patterns, accepts suppressing exclude, optional path, walker pass-through options, maxResults, signal, and timeBudgetMs; GlobResult returns cwd-relative POSIX sorted files and truncated.packages/cli/src/lib/scan/path-utils.ts:21-74: CompiledMatcher caches test(input) and pathMode. compileMatcher() uses picomatch(pattern, { dot: true }); slash-containing patterns are tested against cwd-relative paths, while slashless patterns are tested against basenames, matching init-wizard fs-fallback and ripgrep --glob semantics. compileMatchers(undefined) returns []; matchesAny() short-circuits on the first accepting matcher.joinPosix(a, b) trims one trailing slash from a and one leading slash from b so it never produces an internal //.path-utils.ts:76-115: basenameOf(rel) extracts the segment after the final /. walkerRoot(cwd, sub) returns cwd when sub is absent, otherwise path.resolve(cwd, sub); sandboxing is explicitly the caller’s responsibility, and init-wizard adapter boundaries must pre-validate untrusted paths with src/lib/init/tools/shared.ts::safePath.packages/cli/src/lib/scan/index.ts:1-73: Public barrel exports binary utilities classifyByExtension, isLikelyBinary, readHeadAndSniff; concurrent APIs mapFilesConcurrent, mapFilesConcurrentStream and their types; constants including BINARY_SNIFF_BYTES, CONCURRENCY_LIMIT, DEFAULT_SKIP_DIRS, DSN_ADDITIONAL_SKIP_DIRS, MAX_FILE_SIZE, MONOREPO_ROOTS, TEXT_EXTENSIONS, normalizePath, and isMonorepoPackageDir; glob APIs collectGlob/globFiles; grep APIs collectGrep/grepFiles; IgnoreStack; regex APIs compilePattern, ensureGlobalFlag, extractInlineFlags; scan types; and bulkConcurrency/walkFiles. The module is described as pure-TypeScript ripgrep-compatible scanning; PR 3 is planned to migrate the DSN scanner.packages/cli/src/lib/scan/constants.ts:27-79: TEXT_EXTENSIONS contains 51 extensions: JS/TS .ts, .tsx, .js, .jsx, .mjs, .cjs, .astro, .vue, .svelte; Python .py; Go .go; Ruby .rb, .erb; PHP .php; JVM .java, .kt, .kts, .scala, .groovy; .NET .cs, .fs, .vb; Rust .rs; Swift/Objective-C .swift, .m, .mm; Dart .dart; Elixir/Erlang .ex, .exs, .erl; Lua .lua; config/data .json, .yaml, .yml, .toml, .xml, .properties, .config. The set was lifted verbatim from src/lib/dsn/code-scanner.ts to preserve PR 3 migration behavior.constants.ts:88-153: DEFAULT_SKIP_DIRS has 44 VCS/build/cache basenames—.git, .hg, .svn, node_modules, bower_components, .pnpm-store, .parcel-cache, __pycache__, venv, .venv, .pytest_cache, .mypy_cache, .ruff_cache, .tox, .nox, dist, build, out, target, .next, .nuxt, .output, .svelte-kit, .angular, .serverless, .dart_tool, .build, DerivedData, obj, CMakeFiles, cmake-build-debug, cmake-build-release, vendor, .gradle, .bundle, coverage, htmlcov, .cache, .turbo—and deliberately excludes test, fixture, and IDE directories. DSN_ADDITIONAL_SKIP_DIRS adds .idea, .vscode, .cursor, test, tests, __mocks__, fixtures, and __fixtures__ to avoid fixture DSNs.≥2 is sufficient and approximately 4–8 is empirically best. Higher values add scheduling overhead without useful work.constants.ts:162-217: MAX_FILE_SIZE = 256 * 1024; BINARY_SNIFF_BYTES = 8192; CONCURRENCY_LIMIT = Math.min(16, Math.max(2, availableParallelism())). Decision history: inherited hardcoded 50 was rejected as unmeasured and wasteful; a first availableParallelism() attempt was directionally correct but conflated walker bottlenecks with I/O limits; cores × 4, capped 32 with floor 8, was microbenchmark-optimal but rejected after regressing scanCodeForDsns about 15% because its benchmark excluded the walker. Chosen 2/16-clamped availableParallelism() is best for actual walker-fed workloads and loses only approximately 1–2% on pure I/O; pure per-file I/O callers can override via WalkOptions.concurrency or GrepOptions.concurrency.constants.ts:231-258: normalizePath is a POSIX no-op and replaces native separators with / on Windows for ignore, monorepo detection, and stable WalkEntry.relativePath. isMonorepoPackageDir(relativePath) is true only for exactly two path segments whose first segment belongs to MONOREPO_ROOTS, e.g. "packages/frontend" or "apps/server".packages/cli/package.json:2-143: Package is sentry version 0.44.0-dev.0, ESM ("type": "module"), requires Node >=20.0 with development runtime Node >=22.15, and uses pnpm@10.11.0. Unit tests run pnpm run generate:docs && pnpm run generate:sdk && vitest run test/lib test/commands test/types test/script --coverage; test:e2e runs vitest run test/e2e; lint uses Biome. Relevant scan dependencies include picomatch@^4.0.4, ignore@^7.0.5, p-limit@^7.3.0, TypeScript ^5.9.3, and Vitest ^4.1.9.src/lib/dsn/parser.ts:222 (fingerprint uniquely identifies projects detected in a workspace), src/lib/dsn/env-file.ts:216 (pnpm/Yarn workspaces can symlink packages), and src/lib/detect-agent.ts:135 (workspaces beyond AI-agent-driven CLI use).