
Security News
How Enterprise Security Is Adapting to AI-Accelerated Threats
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.
@compozy/tool-list-dir
Advanced tools
A directory listing tool for Compozy workflows that provides flexible file and directory enumeration with glob pattern support.
A directory listing tool for Compozy workflows that provides flexible file and directory enumeration with glob pattern support.
**)| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
path | string | Yes | - | The directory path to list |
pattern | string | No | - | Glob pattern for filtering entries |
recursive | boolean | No | false | Enable recursive directory traversal |
includeFiles | boolean | No | true | Include files in the output |
includeDirs | boolean | No | true | Include directories in the output |
Returns an object with an entries array containing directory entry objects:
interface DirEntry {
name: string; // File or directory name
path: string; // Full absolute path
type: "file" | "dir"; // Entry type
size: number; // Size in bytes (0 for directories)
modified: string; // ISO 8601 timestamp
}
import tool from "@compozy/tool-list-dir";
// Basic directory listing
const result = await tool({
path: "./src",
});
console.log(result.entries);
// List only JavaScript files
const jsFiles = await tool({
path: "./src",
pattern: "*.js",
});
// Recursive listing with glob pattern
const allTests = await tool({
path: "./src",
pattern: "**/*.test.ts",
recursive: true,
});
// List only directories
const dirs = await tool({
path: ".",
includeFiles: false,
includeDirs: true,
});
name: list-project-files
tasks:
- id: list-source
type: tool
tool: list-dir
input:
path: ./src
pattern: "**/*.{js,ts}"
recursive: true
- id: process-files
type: basic
run: |
echo "Found {{ .tasks.list_source.result.entries | len }} source files"
{{ range .tasks.list_source.result.entries }}
echo "- {{ .name }} ({{ .size }} bytes)"
{{ end }}
The tool uses minimatch for pattern matching, supporting standard glob syntax:
*.txt - All .txt files in the directory*.{js,ts} - All .js and .ts filestest* - All files/directories starting with "test"*config* - All entries containing "config"recursive: true)**/*.js - All .js files in any subdirectorysrc/**/*.ts - All .ts files under the src directory**/test/*.spec.js - All .spec.js files in any test directory**/{src,lib}/*.js - All .js files in any src or lib directory!(*.test).js - All .js files except test files?(a|b).txt - a.txt or b.txt (optional)+(a|b).txt - One or more of a.txt or b.txt@(a|b).txt - Exactly a.txt or b.txta/**/*!(.d).ts - All .ts files under a/ except .d.ts filesThe tool is designed to fail gracefully:
{ entries: [] } rather than throwingbun install
bun test
This tool is designed to be executed directly by the Compozy runtime and doesn't require a build step.
size: 0.) are included by defaultrecursive: true with patterns, directories are traversed even if they don't match the pattern (to find matching files within)FAQs
A directory listing tool for Compozy workflows that provides flexible file and directory enumeration with glob pattern support.
We found that @compozy/tool-list-dir demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.