Skip to content

Conversation

@wtasg
Copy link
Owner

@wtasg wtasg commented Dec 6, 2025

find.ts: createFindDirectories()

Adds createFindDirectories, a testable factory function for recursive directory discovery with dependency injection.

Core Changes:

  • New createFindDirectories(deps) factory accepting injected filesystem dependencies (readdir, stat)
  • Returns async function (root, options?) => Promise<string[]> discovering directories recursively
  • Supports configurable maxDepth (default 1), allowlist/blocklist filters (array or predicate-based)
  • Always includes root in results
  • Exported from main index alongside existing hello and pojo functions

Types:

  • FileSystemDependencies: readdir and stat method signatures for FS abstraction
  • FindDirectoriesOptions: maxDepth, followSymlinks, allowlist, blocklist configuration

Testing:

  • Four comprehensive test cases: basic traversal, symlink handling, depth=2 and depth=3 scenarios
  • Uses mocked filesystem for full testability

Supporting Changes:

  • Version bump 0.0.5 → 0.0.6
  • TypeDoc documentation generation (^0.28.15)
  • Generated docs for new API and interfaces
  • README updated with function listing

@wtasg wtasg self-assigned this Dec 6, 2025
@coderabbitai
Copy link

coderabbitai bot commented Dec 6, 2025

Warning

Rate limit exceeded

@wtasg has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 7 minutes and 18 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between c65c61b and bdcaa76.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (11)
  • docs/docs.json (9 hunks)
  • docs/functions/createFindDirectories.md (1 hunks)
  • docs/functions/hello.md (1 hunks)
  • docs/functions/pojo.md (2 hunks)
  • docs/interfaces/FileSystemDependencies.md (1 hunks)
  • docs/interfaces/FindDirectoriesOptions.md (1 hunks)
  • eslint.config.js (1 hunks)
  • package.json (2 hunks)
  • src/find.ts (1 hunks)
  • src/index.ts (1 hunks)
  • test_report (1 hunks)

Walkthrough

Adds a new factory createFindDirectories(deps) that returns an async directory finder with configurable depth, allowlist/blocklist, and optional symlink handling. Includes implementation, type declarations, tests, docs, README entry, and a package version bump to 0.0.6.

Changes

Cohort / File(s) Summary
Core Implementation
src/find.ts, src/find.js, src/find.d.ts
New factory createFindDirectories(deps) exposing a finder (root, options?) => Promise<string[]>; introduces FileSystemDependencies and FindDirectoriesOptions; recursive traversal with maxDepth, allowlist/blocklist (arrays or predicates), symlink handling.
Tests
src/find.test.ts, src/find.test.js, src/find.test.d.ts
Added test suites with mocked Dirent/stat to validate root inclusion, depth limits, symlink handling, and filter behavior across depths.
Public API Re-exports
src/index.ts, src/index.js, src/index.d.ts
Re-export createFindDirectories and export types FindDirectoriesOptions, FileSystemDependencies alongside existing hello and pojo.
Documentation (generated)
docs/docs.json, docs/functions/createFindDirectories.md, docs/interfaces/FileSystemDependencies.md, docs/interfaces/FindDirectoriesOptions.md, docs/globals.md
New docs for the finder factory and interfaces; updated symbol map to include new public surface.
Docs updates / References
docs/functions/hello.md, docs/functions/pojo.md, docs/functions/pojo.md
Updated "Defined in" commit references and minor signature formatting (pojo return type rendering).
Markdown docs
README.md, docs/README.md, DEV_CHECKLIST.md
Added createFindDirectories to Functions list; minor formatting and added npm run docs && npm run docs:json in DEV_CHECKLIST.
Package & Tooling
package.json, typedoc.json, eslint.config.js
Version bump 0.0.5 → 0.0.6; devDependency updates and additions; typedoc formatting; new ESLint config file.
pojo type tightening
src/pojo.ts, src/pojo.js, src/pojo.d.ts
Change return type from Record<string, any> to Record<string, unknown> and corresponding JSDoc/type declaration updates.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Caller
  participant Finder as createFindDirectories/deps
  participant FS as FileSystem (readdir/stat)

  Caller->>Finder: createFindDirectories({ readdir, stat })
  Caller->>Finder: invoke find(root, options)
  Finder->>FS: readdir(root, { withFileTypes: true })
  FS-->>Finder: Dirent[] (name, isDirectory)
  alt entry is directory & allowed
    Finder->>Finder: include absPath
    opt depth not exceeded
      Finder->>FS: readdir(subdir, { withFileTypes: true })
      FS-->>Finder: Dirent[] for subdir
      Finder->>Finder: recurse into subdir
    end
  else blocked or not directory
    Finder-->>Finder: skip entry
  end
  Finder-->>Caller: Promise.resolve(listOfAbsPaths)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Focus review on: src/find.ts (recursive walk, allowlist/blocklist predicate handling, maxDepth semantics).
  • Verify tests: src/find.test.ts / src/find.test.js correctness of mocks and assertions.
  • Confirm type declarations: src/find.d.ts, src/index.d.ts and alignment with runtime exports.
  • Spot-check docs and package.json version/devDependency changes.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive Title 'v0.0.6' is vague and generic. It indicates a version bump but doesn't describe the actual changes or main feature being added. Use a descriptive title that summarizes the main change, e.g., 'Add createFindDirectories factory function for directory traversal' or similar.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 10

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between de710ad and 82e4a89.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (18)
  • DEV_CHECKLIST.md (0 hunks)
  • docs/docs.json (0 hunks)
  • docs/functions/createFindDirectories.md (1 hunks)
  • docs/functions/hello.md (1 hunks)
  • docs/functions/pojo.md (1 hunks)
  • docs/globals.md (1 hunks)
  • docs/interfaces/FileSystemDependencies.md (1 hunks)
  • docs/interfaces/FindDirectoriesOptions.md (1 hunks)
  • package.json (2 hunks)
  • src/find.d.ts (1 hunks)
  • src/find.js (1 hunks)
  • src/find.test.d.ts (1 hunks)
  • src/find.test.js (1 hunks)
  • src/find.test.ts (1 hunks)
  • src/find.ts (1 hunks)
  • src/index.d.ts (1 hunks)
  • src/index.js (1 hunks)
  • src/index.ts (1 hunks)
💤 Files with no reviewable changes (2)
  • DEV_CHECKLIST.md
  • docs/docs.json
🧰 Additional context used
🧬 Code graph analysis (4)
src/find.js (1)
src/find.test.js (4)
  • deps (62-79)
  • deps (92-114)
  • findDirectories (27-27)
  • findDirectories (54-54)
src/find.test.js (1)
src/find.js (1)
  • deps (7-7)
src/find.d.ts (2)
src/find.js (2)
  • deps (7-7)
  • options (9-9)
src/find.test.js (2)
  • deps (62-79)
  • deps (92-114)
src/find.test.ts (3)
src/find.ts (2)
  • createFindDirectories (93-93)
  • FileSystemDependencies (97-97)
src/index.ts (2)
  • createFindDirectories (9-9)
  • FileSystemDependencies (14-14)
src/find.js (1)
  • deps (7-7)
🪛 markdownlint-cli2 (0.18.1)
docs/functions/createFindDirectories.md

1-1: First line in a file should be a top-level heading

(MD041, first-line-heading, first-line-h1)

docs/interfaces/FindDirectoriesOptions.md

1-1: First line in a file should be a top-level heading

(MD041, first-line-heading, first-line-h1)

docs/interfaces/FileSystemDependencies.md

1-1: First line in a file should be a top-level heading

(MD041, first-line-heading, first-line-h1)

🔇 Additional comments (13)
docs/functions/hello.md (1)

11-11: LGTM!

Documentation link updated to reflect the latest commit.

docs/functions/pojo.md (1)

11-11: LGTM!

Documentation link updated to reflect the latest commit.

src/index.ts (2)

3-4: LGTM!

Properly uses type-only imports for interfaces and regular import for the factory function.


6-15: Export structure looks good, but implementation file not provided.

The export structure follows TypeScript best practices. However, the core implementation file src/find.ts (or src/find.js) was not included in this review, so I cannot verify:

  • The actual implementation of createFindDirectories
  • The interface definitions for FindDirectoriesOptions and FileSystemDependencies
  • Whether the factory function and types work as intended

Please ensure that src/find.ts and its compiled outputs are included in the PR and have been tested.

src/index.js (1)

3-4: Export matches TypeScript source.

The compiled JavaScript correctly exports createFindDirectories alongside existing exports. Note that the implementation file src/find.js was not provided for review.

docs/globals.md (1)

7-16: LGTM!

Documentation structure properly reflects the new API surface with interfaces and the factory function.

src/find.test.d.ts (1)

1-2: Empty export is standard for test declaration files.

This serves as a module placeholder. Note that the actual test implementation (src/find.test.ts or src/find.test.js) was not provided for review, so test coverage cannot be verified.

docs/interfaces/FileSystemDependencies.md (1)

1-51: Documentation structure is clear and follows typedoc conventions.

The interface documentation properly describes the dependency injection pattern for filesystem operations. The markdownlint warning about the first line is a false positive for auto-generated typedoc markdown.

Note that the actual implementation in src/find.ts was not provided for review, so the interface definition and its usage cannot be verified.

package.json (1)

31-31: typedoc@^0.28.15 is valid and current with no known security vulnerabilities.

Version 0.28.15 is the latest release (published November 29, 2025) and has no publicly reported security issues in the Snyk vulnerability database or other sources.

docs/interfaces/FindDirectoriesOptions.md (1)

1-41: Auto-generated documentation looks correct.

The interface properties align with the source definitions in src/find.ts. The MD041 lint warning (first line should be a heading) is typical for auto-generated typedoc output and can be safely ignored if this is your standard doc format.

docs/functions/createFindDirectories.md (1)

1-38: Documentation accurately reflects the API.

Factory signature and return type are correctly documented. Links to related interfaces are properly set.

src/index.d.ts (1)

3-6: LGTM.

Proper type-only and value imports with correct re-exports.

src/find.d.ts (1)

1-25: Declarations align with implementation.

Same concerns apply: stat is required but unused, followSymlinks is declared but unimplemented. Update this file when addressing those issues in src/find.ts.

Comment on lines +6 to +9
function createFindDirectories(deps) {
const { readdir } = deps;
return async function findDirectories(root, options = {}) {
const { maxDepth = 1, allowlist, blocklist } = options;
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

stat is required but unused.

FileSystemDependencies requires stat, but only readdir is destructured and used. Either use stat or make it optional in the interface.

🤖 Prompt for AI Agents
In src/find.js around lines 6 to 9, the FileSystemDependencies interface
requires stat but the function only destructures and uses readdir; update the
function to also destructure stat from deps and use it when evaluating directory
entries (e.g., call stat on the entry path to confirm it is a directory before
including it) so the required dependency is actually used; alternatively, if
stat is optional in the design, change the interface/type to make stat optional
and handle the absence of stat by relying on readdir behavior, but do not leave
stat required and unused.

Comment on lines 1 to 123
import test from "node:test";
import assert from "node:assert/strict";
import { createFindDirectories } from "./find.js";
// Helper to build Dirent-like objects
function dir(name) {
return { name, isDirectory: () => true };
}
function file(name) {
return { name, isDirectory: () => false };
}
test("find: findDirectories success", async () => {
// Minimal mock FS: /root contains one directory "a" and one file "b"
const mockFS = {
readdir: async (path) => {
if (path === "/root") {
return [
{ name: "a", isDirectory: () => true },
{ name: "b", isDirectory: () => false },
];
}
return [];
},
stat: async (path) => ({
isDirectory: () => path === "/root" || path === "/root/a"
}),
};
const findDirectories = createFindDirectories(mockFS);
const result = await findDirectories("/root", { maxDepth: 1 });
assert.deepEqual(result, [
"/root",
"/root/a"
]);
});
test("find: findDirectories symlink is NOT treated as a directory", async () => {
const mockFS = {
readdir: async (path) => {
if (path === "/root") {
return [
{
name: "linkToA",
isDirectory: () => false
}
];
}
return [];
},
stat: async (path) => ({
isDirectory: () => path === "/root" // only root is a directory
}),
readlink: async () => {
throw new Error("readlink should not be called when symlink support is removed");
}
};
const findDirectories = createFindDirectories(mockFS);
const result = await findDirectories("/root", { maxDepth: 1 });
assert.deepEqual(result, [
"/root"
]);
});
test("find: findDirectories at depth=2", async () => {
const calls = [];
const deps = {
readdir: async (path) => {
calls.push(path);
switch (path) {
case "/root":
return [dir("a"), dir("b"), file("ignore.txt")];
case "/root/a":
return [dir("a1")];
case "/root/b":
return [dir("b1")];
default:
return [];
}
},
stat: async (_) => ({
isDirectory: () => false
})
};
const find = createFindDirectories(deps);
const result = await find("/root", { maxDepth: 2 });
assert.deepEqual(result.sort(), [
"/root",
"/root/a",
"/root/b",
"/root/a/a1",
"/root/b/b1"
].sort());
});
test("find: findDirectories at depth=3", async () => {
const calls = [];
const deps = {
readdir: async (path) => {
calls.push(path);
switch (path) {
case "/root":
return [dir("a"), dir("b")];
case "/root/a":
return [dir("a1")];
case "/root/b":
return [dir("b1")];
case "/root/a/a1":
case "/root/b/b1":
return [dir("c")];
case "/root/b/b1/c":
return [dir("d"), file("fd")];
default:
return [];
}
},
stat: async (_) => ({
isDirectory: () => false
})
};
const find = createFindDirectories(deps);
const result = await find("/root", { maxDepth: 3 });
assert.deepEqual(result.sort(), [
"/root",
"/root/a",
"/root/b",
"/root/a/a1",
"/root/a/a1/c",
"/root/b/b1",
"/root/b/b1/c",
].sort());
});
//# sourceMappingURL=find.test.js.map No newline at end of file
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Consider adding tests for allowlist/blocklist.

The implementation supports allowlist and blocklist options, but no tests exercise this filtering logic.

Would you like me to generate test cases for the filtering functionality?

Comment on lines +3 to +6
interface FileSystemDependencies {
readdir: (path: string, opts: { withFileTypes: true }) => Promise<{ name: string; isDirectory(): boolean; }[]>;
stat: (path: string) => Promise<{ isDirectory(): boolean }>;
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

stat is required but never used.

The stat function is part of FileSystemDependencies but never called. Make it optional or remove it if not needed.

 interface FileSystemDependencies {
     readdir: (path: string, opts: { withFileTypes: true }) => Promise<{ name: string; isDirectory(): boolean; }[]>;
-    stat: (path: string) => Promise<{ isDirectory(): boolean }>;
+    stat?: (path: string) => Promise<{ isDirectory(): boolean }>;
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
interface FileSystemDependencies {
readdir: (path: string, opts: { withFileTypes: true }) => Promise<{ name: string; isDirectory(): boolean; }[]>;
stat: (path: string) => Promise<{ isDirectory(): boolean }>;
}
interface FileSystemDependencies {
readdir: (path: string, opts: { withFileTypes: true }) => Promise<{ name: string; isDirectory(): boolean; }[]>;
stat?: (path: string) => Promise<{ isDirectory(): boolean }>;
}
🤖 Prompt for AI Agents
In src/find.ts around lines 3 to 6, the FileSystemDependencies interface
declares a stat method that is never used; either remove the stat property from
the interface or make it optional (stat?: ...) and update any
callers/implementations to not require providing stat; if other code expects
stat, prefer making it optional and add a runtime check before calling it,
otherwise remove it and adjust types where FileSystemDependencies is implemented
so implementations no longer need to supply stat.

Comment on lines +8 to +13
interface FindDirectoriesOptions {
maxDepth?: number;
followSymlinks?: boolean;
allowlist?: string[] | ((absPath: string, name: string) => boolean);
blocklist?: string[] | ((absPath: string, name: string) => boolean);
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

followSymlinks option is declared but not implemented.

This option appears in the interface but the implementation ignores it. Either implement symlink following or remove the option to avoid misleading consumers.

🤖 Prompt for AI Agents
In src/find.ts around lines 8 to 13 the interface declares followSymlinks but
the implementation ignores it; either remove the option from the interface or
implement symlink handling. To implement: keep followSymlinks default false, use
fs.lstat to detect symlinks and fs.stat (or fs.realpath then stat) to read the
target when followSymlinks is true, resolve and continue traversal into the
target while applying maxDepth and allowlist/blocklist semantics to the resolved
target path; also maintain a Set of visited realpaths (or inode+device) to avoid
infinite loops from cyclic symlinks and ensure the API still returns the same
path form expected by callers. Add/update unit tests for symlinked directories
and cycles, and document the behavior.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (2)
docs/interfaces/FileSystemDependencies.md (1)

1-9: Fix markdown structure: heading should be first line (MD041).

Same issue as FindDirectoriesOptions.md—adjust typedoc template to place # Interface: FileSystemDependencies as the first line before breadcrumb navigation.

docs/functions/createFindDirectories.md (1)

1-11: Fix markdown structure: heading should be first line (MD041).

Same typedoc template issue—place # Function: createFindDirectories() as line 1 before breadcrumb navigation.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 0a35c87 and 0459671.

📒 Files selected for processing (8)
  • README.md (1 hunks)
  • docs/README.md (1 hunks)
  • docs/docs.json (8 hunks)
  • docs/functions/createFindDirectories.md (1 hunks)
  • docs/functions/hello.md (1 hunks)
  • docs/functions/pojo.md (1 hunks)
  • docs/interfaces/FileSystemDependencies.md (1 hunks)
  • docs/interfaces/FindDirectoriesOptions.md (1 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
docs/interfaces/FindDirectoriesOptions.md

1-1: First line in a file should be a top-level heading

(MD041, first-line-heading, first-line-h1)

docs/functions/createFindDirectories.md

1-1: First line in a file should be a top-level heading

(MD041, first-line-heading, first-line-h1)

docs/interfaces/FileSystemDependencies.md

1-1: First line in a file should be a top-level heading

(MD041, first-line-heading, first-line-h1)

🔇 Additional comments (5)
docs/README.md (1)

16-16: Documentation addition is accurate and clear.

README.md (1)

12-12: Documentation addition is consistent and accurate.

docs/functions/pojo.md (1)

11-11: Source URL updated; no functional changes.

docs/functions/hello.md (1)

11-11: Source URL updated; no functional changes.

docs/docs.json (1)

1-1295: The docs.json metadata is accurate and fully verified against source implementation files.

All function signatures, interface definitions, type parameters, and documentation comments in docs.json correctly match their corresponding source files (src/find.ts, src/hello.ts, src/pojo.ts, src/index.ts). Symbol IDs, type references, and parameter mappings are consistent and correct. No issues found.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

♻️ Duplicate comments (4)
src/find.ts (1)

3-13: Remove or implement unused stat and followSymlinks in the public API

FileSystemDependencies.stat is never used, and FindDirectoriesOptions.followSymlinks is declared but ignored. This exposes dead/misleading surface in the public API: callers are asked to provide stat and can set followSymlinks without any observable effect.

Either:

  • Implement symlink handling using stat (and document behavior), or
  • Drop stat and followSymlinks from both the runtime types and the .d.ts declarations until you actually need them.

Right now this is a behavioral mismatch for consumers.

src/find.test.js (1)

1-123: Add allowlist/blocklist coverage to JS tests as well.

Tests exercise depth and symlink behavior but still don't cover allowlist/blocklist; consider adding at least one positive/negative case to lock in that filtering contract, mirroring whatever you add to the TS tests.

src/find.test.ts (1)

79-148: Add allowlist/blocklist tests to cover filtering semantics.

Depth and symlink behavior are well covered, but nothing asserts allowlist/blocklist behavior (array and predicate forms); adding a couple of focused cases here would lock in that part of the API.

src/find.js (1)

6-59: Align implementation with FileSystemDependencies/FindDirectoriesOptions (unused stat, ignored followSymlinks).

The traversal logic itself looks solid, but the runtime only uses readdir and ignores both the stat dependency and the followSymlinks option that are exposed in the types/docs; that makes those API surface areas effectively no-ops today. Either:

  • implement symlink/deeper directory detection using stat/followSymlinks, or
  • trim or clearly mark those fields as reserved in the types/docs so consumers don’t expect behavior that isn’t there yet.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between 5ef6c80 and c65c61b.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (25)
  • DEV_CHECKLIST.md (0 hunks)
  • README.md (1 hunks)
  • docs/README.md (1 hunks)
  • docs/docs.json (9 hunks)
  • docs/functions/createFindDirectories.md (1 hunks)
  • docs/functions/hello.md (1 hunks)
  • docs/functions/pojo.md (2 hunks)
  • docs/globals.md (1 hunks)
  • docs/interfaces/FileSystemDependencies.md (1 hunks)
  • docs/interfaces/FindDirectoriesOptions.md (1 hunks)
  • eslint.config.js (1 hunks)
  • package.json (2 hunks)
  • src/find.d.ts (1 hunks)
  • src/find.js (1 hunks)
  • src/find.test.d.ts (1 hunks)
  • src/find.test.js (1 hunks)
  • src/find.test.ts (1 hunks)
  • src/find.ts (1 hunks)
  • src/index.d.ts (1 hunks)
  • src/index.js (1 hunks)
  • src/index.ts (1 hunks)
  • src/pojo.d.ts (1 hunks)
  • src/pojo.js (1 hunks)
  • src/pojo.ts (1 hunks)
  • typedoc.json (1 hunks)
💤 Files with no reviewable changes (1)
  • DEV_CHECKLIST.md
🧰 Additional context used
🧬 Code graph analysis (6)
src/find.test.ts (5)
src/find.d.ts (2)
  • createFindDirectories (23-23)
  • FileSystemDependencies (24-24)
src/find.ts (2)
  • createFindDirectories (93-93)
  • FileSystemDependencies (97-97)
src/index.d.ts (2)
  • createFindDirectories (5-5)
  • FileSystemDependencies (6-6)
src/index.ts (2)
  • createFindDirectories (9-9)
  • FileSystemDependencies (14-14)
src/find.js (1)
  • deps (7-7)
src/find.js (1)
src/find.test.js (4)
  • deps (61-77)
  • deps (89-110)
  • findDirectories (27-27)
  • findDirectories (54-54)
src/find.test.js (5)
src/find.d.ts (1)
  • createFindDirectories (23-23)
src/find.ts (1)
  • createFindDirectories (93-93)
src/index.d.ts (1)
  • createFindDirectories (5-5)
src/index.ts (1)
  • createFindDirectories (9-9)
src/find.js (1)
  • deps (7-7)
src/find.d.ts (4)
src/find.ts (3)
  • FileSystemDependencies (97-97)
  • FindDirectoriesOptions (98-98)
  • createFindDirectories (93-93)
src/index.d.ts (3)
  • FileSystemDependencies (6-6)
  • FindDirectoriesOptions (6-6)
  • createFindDirectories (5-5)
src/find.js (2)
  • deps (7-7)
  • options (9-9)
src/find.test.js (2)
  • deps (61-77)
  • deps (89-110)
src/pojo.ts (3)
src/index.d.ts (1)
  • pojo (5-5)
src/index.ts (1)
  • pojo (8-8)
src/pojo.d.ts (1)
  • pojo (11-11)
src/find.ts (2)
src/find.js (1)
  • deps (7-7)
src/find.test.js (4)
  • deps (61-77)
  • deps (89-110)
  • findDirectories (27-27)
  • findDirectories (54-54)
🔇 Additional comments (18)
docs/functions/hello.md (1)

11-11: Doc link update is fine

The updated Defined in link just tracks the new commit; no issues.

eslint.config.js (1)

1-36: Flat ESLint config wiring looks coherent

Combining eslint + typescript-eslint presets with eslint-config-prettier, node globals, and the _ unused‑var convention is consistent and should work well with the added tooling.

src/find.d.ts (1)

1-24: Type declarations align with implementation

FileSystemDependencies, FindDirectoriesOptions, and createFindDirectories match the shapes used in src/find.ts; public surface looks consistent.

src/find.ts (1)

19-89: Traversal, depth limiting, and filters look correct

The core walker logic—root normalization, maxDepth handling, root inclusion, and the allowlist/blocklist short‑circuiting on directory entries—looks sound and matches the documented “find -type d” style behavior.

docs/README.md (1)

14-17: Docs entry for createFindDirectories is clear

The new Functions bullet accurately describes createFindDirectories and matches the implemented behavior.

typedoc.json (1)

3-12: Typedoc config reformat is no-op behaviorally

Switching entryPoints and plugin to multi-line arrays doesn’t change semantics; configuration remains valid.

README.md (1)

10-13: README now reflects the new factory API

Adding createFindDirectories to the Functions list keeps the package README aligned with the newly exposed API.

src/pojo.js (1)

8-8: LGTM! Type annotation improved.

The return type change from any to unknown aligns with TypeScript best practices and improves type safety.

docs/interfaces/FileSystemDependencies.md (1)

1-51: LGTM! Interface documentation is accurate.

The FileSystemDependencies interface is properly documented with clear method signatures for readdir and stat.

docs/globals.md (1)

7-16: LGTM! Documentation structure updated correctly.

The new Interfaces section and createFindDirectories function entry properly reflect the expanded API surface.

docs/functions/pojo.md (1)

9-33: LGTM! Documentation reflects the improved type annotation.

The pojo function documentation correctly shows the updated return type Record<string, unknown>.

src/find.test.d.ts (1)

1-2: LGTM! Standard test declaration file.

The empty export statement correctly establishes this as a module.

docs/functions/createFindDirectories.md (1)

1-38: LGTM! Factory function documentation is comprehensive.

The createFindDirectories documentation clearly explains the dependency injection pattern and provides complete type information.

src/index.js (1)

3-4: ✓ Verified: find.js exists and properly exports createFindDirectories.

The file is present at src/find.js, exports createFindDirectories on line 61, and the import/export chain in src/index.js is correctly configured. The public API expansion is valid.

src/pojo.d.ts (1)

8-10: Stricter pojo return type looks good; be aware of downstream TS impact.

Switching from Record<string, any> to Record<string, unknown> is a nice safety win and matches the JSDoc; just note this may surface new compile-time errors for consumers that assumed any.

src/pojo.ts (1)

8-18: pojo implementation and updated typing are consistent.

Function body, JSDoc, and declaration now all agree on Record<string, unknown> with unchanged runtime behavior.

src/index.ts (1)

3-15: Index wiring for createFindDirectories and types looks correct.

Re-exports are coherent, and using import type for the option/dependency types avoids runtime overhead.

src/index.d.ts (1)

3-6: Declaration surface matches the new runtime exports.

createFindDirectories and its option/dependency types are correctly re-exported alongside hello and pojo.

Comment on lines 9 to 784
{
"id": 27,
"name": "FileSystemDependencies",
"variant": "declaration",
"kind": 256,
"flags": {},
"children": [
{
"id": 28,
"name": "readdir",
"variant": "declaration",
"kind": 1024,
"flags": {},
"sources": [
{
"fileName": "find.ts",
"line": 4,
"character": 4,
"url": "https://github.com/wtasg/node-lib/blob/5ef6c801dee6a05d879c445d672ee6c2f8da4ba4/src/find.ts#L4"
}
],
"type": {
"type": "reflection",
"declaration": {
"id": 29,
"name": "__type",
"variant": "declaration",
"kind": 65536,
"flags": {},
"sources": [
{
"fileName": "find.ts",
"line": 4,
"character": 13,
"url": "https://github.com/wtasg/node-lib/blob/5ef6c801dee6a05d879c445d672ee6c2f8da4ba4/src/find.ts#L4"
}
],
"signatures": [
{
"id": 30,
"name": "__type",
"variant": "signature",
"kind": 4096,
"flags": {},
"sources": [
{
"fileName": "find.ts",
"line": 4,
"character": 13,
"url": "https://github.com/wtasg/node-lib/blob/5ef6c801dee6a05d879c445d672ee6c2f8da4ba4/src/find.ts#L4"
}
],
"parameters": [
{
"id": 31,
"name": "path",
"variant": "param",
"kind": 32768,
"flags": {},
"type": {
"type": "intrinsic",
"name": "string"
}
},
{
"id": 32,
"name": "opts",
"variant": "param",
"kind": 32768,
"flags": {},
"type": {
"type": "reflection",
"declaration": {
"id": 33,
"name": "__type",
"variant": "declaration",
"kind": 65536,
"flags": {},
"children": [
{
"id": 34,
"name": "withFileTypes",
"variant": "declaration",
"kind": 1024,
"flags": {},
"sources": [
{
"fileName": "find.ts",
"line": 4,
"character": 36,
"url": "https://github.com/wtasg/node-lib/blob/5ef6c801dee6a05d879c445d672ee6c2f8da4ba4/src/find.ts#L4"
}
],
"type": {
"type": "literal",
"value": true
}
}
],
"groups": [
{
"title": "Properties",
"children": [
34
]
}
],
"sources": [
{
"fileName": "find.ts",
"line": 4,
"character": 34,
"url": "https://github.com/wtasg/node-lib/blob/5ef6c801dee6a05d879c445d672ee6c2f8da4ba4/src/find.ts#L4"
}
]
}
}
}
],
"type": {
"type": "reference",
"target": {
"packageName": "typescript",
"packagePath": "lib/lib.es5.d.ts",
"qualifiedName": "Promise"
},
"typeArguments": [
{
"type": "array",
"elementType": {
"type": "reflection",
"declaration": {
"id": 35,
"name": "__type",
"variant": "declaration",
"kind": 65536,
"flags": {},
"children": [
{
"id": 36,
"name": "name",
"variant": "declaration",
"kind": 1024,
"flags": {},
"sources": [
{
"fileName": "find.ts",
"line": 4,
"character": 72,
"url": "https://github.com/wtasg/node-lib/blob/5ef6c801dee6a05d879c445d672ee6c2f8da4ba4/src/find.ts#L4"
}
],
"type": {
"type": "intrinsic",
"name": "string"
}
},
{
"id": 37,
"name": "isDirectory",
"variant": "declaration",
"kind": 2048,
"flags": {},
"sources": [
{
"fileName": "find.ts",
"line": 4,
"character": 86,
"url": "https://github.com/wtasg/node-lib/blob/5ef6c801dee6a05d879c445d672ee6c2f8da4ba4/src/find.ts#L4"
}
],
"signatures": [
{
"id": 38,
"name": "isDirectory",
"variant": "signature",
"kind": 4096,
"flags": {},
"sources": [
{
"fileName": "find.ts",
"line": 4,
"character": 86,
"url": "https://github.com/wtasg/node-lib/blob/5ef6c801dee6a05d879c445d672ee6c2f8da4ba4/src/find.ts#L4"
}
],
"type": {
"type": "intrinsic",
"name": "boolean"
}
}
]
}
],
"groups": [
{
"title": "Properties",
"children": [
36
]
},
{
"title": "Methods",
"children": [
37
]
}
],
"sources": [
{
"fileName": "find.ts",
"line": 4,
"character": 70,
"url": "https://github.com/wtasg/node-lib/blob/5ef6c801dee6a05d879c445d672ee6c2f8da4ba4/src/find.ts#L4"
}
]
}
}
}
],
"name": "Promise",
"package": "typescript"
}
}
]
}
}
},
{
"id": 39,
"name": "stat",
"variant": "declaration",
"kind": 1024,
"flags": {},
"sources": [
{
"fileName": "find.ts",
"line": 5,
"character": 4,
"url": "https://github.com/wtasg/node-lib/blob/5ef6c801dee6a05d879c445d672ee6c2f8da4ba4/src/find.ts#L5"
}
],
"type": {
"type": "reflection",
"declaration": {
"id": 40,
"name": "__type",
"variant": "declaration",
"kind": 65536,
"flags": {},
"sources": [
{
"fileName": "find.ts",
"line": 5,
"character": 10,
"url": "https://github.com/wtasg/node-lib/blob/5ef6c801dee6a05d879c445d672ee6c2f8da4ba4/src/find.ts#L5"
}
],
"signatures": [
{
"id": 41,
"name": "__type",
"variant": "signature",
"kind": 4096,
"flags": {},
"sources": [
{
"fileName": "find.ts",
"line": 5,
"character": 10,
"url": "https://github.com/wtasg/node-lib/blob/5ef6c801dee6a05d879c445d672ee6c2f8da4ba4/src/find.ts#L5"
}
],
"parameters": [
{
"id": 42,
"name": "path",
"variant": "param",
"kind": 32768,
"flags": {},
"type": {
"type": "intrinsic",
"name": "string"
}
}
],
"type": {
"type": "reference",
"target": {
"packageName": "typescript",
"packagePath": "lib/lib.es5.d.ts",
"qualifiedName": "Promise"
},
"typeArguments": [
{
"type": "reflection",
"declaration": {
"id": 43,
"name": "__type",
"variant": "declaration",
"kind": 65536,
"flags": {},
"children": [
{
"id": 44,
"name": "isDirectory",
"variant": "declaration",
"kind": 2048,
"flags": {},
"sources": [
{
"fileName": "find.ts",
"line": 5,
"character": 38,
"url": "https://github.com/wtasg/node-lib/blob/5ef6c801dee6a05d879c445d672ee6c2f8da4ba4/src/find.ts#L5"
}
],
"signatures": [
{
"id": 45,
"name": "isDirectory",
"variant": "signature",
"kind": 4096,
"flags": {},
"sources": [
{
"fileName": "find.ts",
"line": 5,
"character": 38,
"url": "https://github.com/wtasg/node-lib/blob/5ef6c801dee6a05d879c445d672ee6c2f8da4ba4/src/find.ts#L5"
}
],
"type": {
"type": "intrinsic",
"name": "boolean"
}
}
]
}
],
"groups": [
{
"title": "Methods",
"children": [
44
]
}
],
"sources": [
{
"fileName": "find.ts",
"line": 5,
"character": 36,
"url": "https://github.com/wtasg/node-lib/blob/5ef6c801dee6a05d879c445d672ee6c2f8da4ba4/src/find.ts#L5"
}
]
}
}
],
"name": "Promise",
"package": "typescript"
}
}
]
}
}
}
],
"groups": [
{
"title": "Properties",
"children": [
28,
39
]
}
],
"sources": [
{
"fileName": "find.ts",
"line": 3,
"character": 10,
"url": "https://github.com/wtasg/node-lib/blob/5ef6c801dee6a05d879c445d672ee6c2f8da4ba4/src/find.ts#L3"
}
]
},
{
"id": 14,
"name": "FindDirectoriesOptions",
"variant": "declaration",
"kind": 256,
"flags": {},
"children": [
{
"id": 17,
"name": "allowlist",
"variant": "declaration",
"kind": 1024,
"flags": {
"isOptional": true
},
"sources": [
{
"fileName": "find.ts",
"line": 11,
"character": 4,
"url": "https://github.com/wtasg/node-lib/blob/5ef6c801dee6a05d879c445d672ee6c2f8da4ba4/src/find.ts#L11"
}
],
"type": {
"type": "union",
"types": [
{
"type": "array",
"elementType": {
"type": "intrinsic",
"name": "string"
}
},
{
"type": "reflection",
"declaration": {
"id": 18,
"name": "__type",
"variant": "declaration",
"kind": 65536,
"flags": {},
"sources": [
{
"fileName": "find.ts",
"line": 11,
"character": 28,
"url": "https://github.com/wtasg/node-lib/blob/5ef6c801dee6a05d879c445d672ee6c2f8da4ba4/src/find.ts#L11"
}
],
"signatures": [
{
"id": 19,
"name": "__type",
"variant": "signature",
"kind": 4096,
"flags": {},
"sources": [
{
"fileName": "find.ts",
"line": 11,
"character": 28,
"url": "https://github.com/wtasg/node-lib/blob/5ef6c801dee6a05d879c445d672ee6c2f8da4ba4/src/find.ts#L11"
}
],
"parameters": [
{
"id": 20,
"name": "absPath",
"variant": "param",
"kind": 32768,
"flags": {},
"type": {
"type": "intrinsic",
"name": "string"
}
},
{
"id": 21,
"name": "name",
"variant": "param",
"kind": 32768,
"flags": {},
"type": {
"type": "intrinsic",
"name": "string"
}
}
],
"type": {
"type": "intrinsic",
"name": "boolean"
}
}
]
}
}
]
}
},
{
"id": 22,
"name": "blocklist",
"variant": "declaration",
"kind": 1024,
"flags": {
"isOptional": true
},
"sources": [
{
"fileName": "find.ts",
"line": 12,
"character": 4,
"url": "https://github.com/wtasg/node-lib/blob/5ef6c801dee6a05d879c445d672ee6c2f8da4ba4/src/find.ts#L12"
}
],
"type": {
"type": "union",
"types": [
{
"type": "array",
"elementType": {
"type": "intrinsic",
"name": "string"
}
},
{
"type": "reflection",
"declaration": {
"id": 23,
"name": "__type",
"variant": "declaration",
"kind": 65536,
"flags": {},
"sources": [
{
"fileName": "find.ts",
"line": 12,
"character": 28,
"url": "https://github.com/wtasg/node-lib/blob/5ef6c801dee6a05d879c445d672ee6c2f8da4ba4/src/find.ts#L12"
}
],
"signatures": [
{
"id": 24,
"name": "__type",
"variant": "signature",
"kind": 4096,
"flags": {},
"sources": [
{
"fileName": "find.ts",
"line": 12,
"character": 28,
"url": "https://github.com/wtasg/node-lib/blob/5ef6c801dee6a05d879c445d672ee6c2f8da4ba4/src/find.ts#L12"
}
],
"parameters": [
{
"id": 25,
"name": "absPath",
"variant": "param",
"kind": 32768,
"flags": {},
"type": {
"type": "intrinsic",
"name": "string"
}
},
{
"id": 26,
"name": "name",
"variant": "param",
"kind": 32768,
"flags": {},
"type": {
"type": "intrinsic",
"name": "string"
}
}
],
"type": {
"type": "intrinsic",
"name": "boolean"
}
}
]
}
}
]
}
},
{
"id": 16,
"name": "followSymlinks",
"variant": "declaration",
"kind": 1024,
"flags": {
"isOptional": true
},
"sources": [
{
"fileName": "find.ts",
"line": 10,
"character": 4,
"url": "https://github.com/wtasg/node-lib/blob/5ef6c801dee6a05d879c445d672ee6c2f8da4ba4/src/find.ts#L10"
}
],
"type": {
"type": "intrinsic",
"name": "boolean"
}
},
{
"id": 15,
"name": "maxDepth",
"variant": "declaration",
"kind": 1024,
"flags": {
"isOptional": true
},
"sources": [
{
"fileName": "find.ts",
"line": 9,
"character": 4,
"url": "https://github.com/wtasg/node-lib/blob/5ef6c801dee6a05d879c445d672ee6c2f8da4ba4/src/find.ts#L9"
}
],
"type": {
"type": "intrinsic",
"name": "number"
}
}
],
"groups": [
{
"title": "Properties",
"children": [
17,
22,
16,
15
]
}
],
"sources": [
{
"fileName": "find.ts",
"line": 8,
"character": 10,
"url": "https://github.com/wtasg/node-lib/blob/5ef6c801dee6a05d879c445d672ee6c2f8da4ba4/src/find.ts#L8"
}
]
},
{
"id": 7,
"name": "createFindDirectories",
"variant": "declaration",
"kind": 64,
"flags": {},
"sources": [
{
"fileName": "find.ts",
"line": 19,
"character": 9,
"url": "https://github.com/wtasg/node-lib/blob/5ef6c801dee6a05d879c445d672ee6c2f8da4ba4/src/find.ts#L19"
}
],
"signatures": [
{
"id": 8,
"name": "createFindDirectories",
"variant": "signature",
"kind": 4096,
"flags": {},
"comment": {
"summary": [
{
"kind": "text",
"text": "Factory that produces an async findDirectories function with\ninjected filesystem dependencies for full testability."
}
]
},
"sources": [
{
"fileName": "find.ts",
"line": 19,
"character": 9,
"url": "https://github.com/wtasg/node-lib/blob/5ef6c801dee6a05d879c445d672ee6c2f8da4ba4/src/find.ts#L19"
}
],
"parameters": [
{
"id": 9,
"name": "deps",
"variant": "param",
"kind": 32768,
"flags": {},
"type": {
"type": "reference",
"target": 27,
"name": "FileSystemDependencies",
"package": "@wtasnorg/node-lib"
}
}
],
"type": {
"type": "reflection",
"declaration": {
"id": 10,
"name": "__type",
"variant": "declaration",
"kind": 65536,
"flags": {},
"sources": [
{
"fileName": "find.ts",
"line": 23,
"character": 26,
"url": "https://github.com/wtasg/node-lib/blob/5ef6c801dee6a05d879c445d672ee6c2f8da4ba4/src/find.ts#L23"
}
],
"signatures": [
{
"id": 11,
"name": "__type",
"variant": "signature",
"kind": 4096,
"flags": {},
"sources": [
{
"fileName": "find.ts",
"line": 23,
"character": 26,
"url": "https://github.com/wtasg/node-lib/blob/5ef6c801dee6a05d879c445d672ee6c2f8da4ba4/src/find.ts#L23"
}
],
"parameters": [
{
"id": 12,
"name": "root",
"variant": "param",
"kind": 32768,
"flags": {},
"type": {
"type": "intrinsic",
"name": "string"
}
},
{
"id": 13,
"name": "options",
"variant": "param",
"kind": 32768,
"flags": {},
"type": {
"type": "reference",
"target": 14,
"name": "FindDirectoriesOptions",
"package": "@wtasnorg/node-lib"
},
"defaultValue": "{}"
}
],
"type": {
"type": "reference",
"target": {
"packageName": "typescript",
"packagePath": "lib/lib.es5.d.ts",
"qualifiedName": "Promise"
},
"typeArguments": [
{
"type": "array",
"elementType": {
"type": "intrinsic",
"name": "string"
}
}
],
"name": "Promise",
"package": "typescript"
}
}
]
}
}
}
]
},
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Docs describe options/deps that are currently no-ops in implementation.

FileSystemDependencies.stat and FindDirectoriesOptions.followSymlinks are documented here but are not used by createFindDirectories in src/find.js; consumers may reasonably expect them to affect behavior. Consider either:

  • updating the implementation to honor these fields, or
  • trimming/annotating them in docs as reserved so the generated docs match what the code actually does today.
🤖 Prompt for AI Agents
In docs/docs.json around lines 9 to 784 the docs advertise
FileSystemDependencies.stat and FindDirectoriesOptions.followSymlinks but the
runtime in src/find.js/createFindDirectories ignores those fields; either (A)
implement support in src/find.js: wire deps.stat into directory checks (use it
instead of fs.stat when provided), add logic to detect/resolve symlinks and
honor options.followSymlinks (skip or recurse symlinked dirs when false, follow
when true), update types/tests and docs accordingly; or (B) make the docs
truthful: remove those properties from docs/docs.json or annotate them as
reserved/unused so generated docs match current behavior. Apply one of these
fixes and update tests and changelog to reflect the chosen approach.

@wtasg wtasg merged commit 5ccb602 into main Dec 7, 2025
1 of 2 checks passed
@wtasg wtasg deleted the v0.0.6 branch December 7, 2025 08:19
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