📁 Use Case 1: Discover All Files

Found 10 items

Code:
const allFiles = await discoverFiles({
  targetPath: fixtureDir,
});
Output:
  • Found 10 items:
  • • README.md
  • • docs/ARCHITECTURE.md
  • • package.json
  • • src/components/Button.tsx
  • • src/components/Card.tsx
  • • src/components/Header.tsx
  • • src/components/render-app.ts
  • • src/index.ts
  • • src/styles/global.css
  • • src/utils/helpers.ts

📝 Use Case 2: Discover TypeScript/TSX Files

Found 6 items

Code:
const tsxFiles = await discoverFiles({
  targetPath: fixtureDir,
  filter: "tsx",
});
Output:
  • Found 6 items:
  • • src/components/Button.tsx
  • • src/components/Card.tsx
  • • src/components/Header.tsx
  • • src/components/render-app.ts
  • • src/index.ts
  • • src/utils/helpers.ts

🎨 Use Case 3: Discover CSS Files

Found 1 items

Code:
const cssFiles = await discoverFiles({
  targetPath: fixtureDir,
  filter: "css",
});
Output:
  • Found 1 item:
  • • src/styles/global.css

📚 Use Case 4: Discover Markdown Files

Found 2 items

Code:
const mdFiles = await discoverFiles({
  targetPath: fixtureDir,
  filter: "md",
});
Output:
  • Found 2 items:
  • • README.md
  • • docs/ARCHITECTURE.md

⚙️ Use Case 5: Discover JSON Files

Found 1 items

Code:
const jsonFiles = await discoverFiles({
  targetPath: fixtureDir,
  filter: "json",
});
Output:
  • Found 1 item:
  • • package.json

🚫 Use Case 6: Discover with Exclusions

Found 10 items

Code:
const filesWithExclude = await discoverFiles({
  targetPath: fixtureDir,
  exclude: ["node_modules", "dist"],
});
Output:
  • Found 10 items:
  • • README.md
  • • docs/ARCHITECTURE.md
  • • package.json
  • • src/components/Button.tsx
  • • src/components/Card.tsx
  • • src/components/Header.tsx
  • • src/components/render-app.ts
  • • src/index.ts
  • • src/styles/global.css
  • • src/utils/helpers.ts

🌳 Use Case 7: Generate Folder Tree

Markdown tree output

Code:
const treeMarkdown = generateTreeSection(
  allFiles,
  fixtureDir,
);
Output:
  • ## Project Structure
  • ```
  • sample-project/
  • ├─ docs/
  • │ └─ ARCHITECTURE.md
  • ├─ src/
  • │ ├─ components/
  • │ │ ├─ Button.tsx
  • │ │ ├─ Card.tsx
  • │ │ ├─ Header.tsx
  • │ │ └─ render-app.ts
  • │ ├─ styles/
  • │ │ └─ global.css
  • │ ├─ utils/
  • │ │ └─ helpers.ts
  • │ └─ index.ts
  • ├─ package.json
  • └─ README.md
  • ```

🔍 Use Case 8: Build Tree Structure

Tree structure as JSON

Code:
const treeNode = buildFolderTree(
  allFiles,
  fixtureDir,
);
Output:
  • {
  • "name": "sample-project",
  • "path": "/home/runner/work/direxpo-core/direxpo-core/demo/fixtures/sample-project",
  • "isDir": true,
  • "children": [
  • {
  • "name": "docs",
  • "path": "docs",
  • "isDir": true,
  • "children": [
  • {
  • "name": "ARCHITECTURE.md",
  • "path": "docs/ARCHITECTURE.md",
  • "isDir": false,
  • "children": []
  • }
  • ]
  • },
  • {
  • "name": "src",
  • "path": "src",
  • "isDir": true,
  • "children": [
  • {
  • "name": "components",
  • "path": "src/components",
  • "isDir": true,
  • "children": [
  • {
  • "name": "Button.tsx",
  • "path": "src/components/Button.tsx",
  • "isDir": false,
  • "children": []
  • },
  • {
  • "name": "Card.tsx",
  • "path": "src/components/Card.tsx",
  • "isDir": false,
  • "children": []
  • },
  • {
  • "name": "Header.tsx",
  • "path": "src/components/Header.tsx",
  • "isDir": false,
  • "children": []
  • },
  • {
  • "name": "render-app.ts",
  • "path": "src/components/render-app.ts",
  • "isDir": false,
  • "children": []
  • }
  • ]
  • },
  • {
  • "name": "styles",
  • "path": "src/styles",
  • "isDir": true,
  • "children": [
  • {
  • "name": "global.css",
  • "path": "src/styles/global.css",
  • "isDir": false,
  • "children": []
  • }
  • ]
  • },
  • {
  • "name": "utils",
  • "path": "src/utils",
  • "isDir": true,
  • "children": [
  • {
  • "name": "helpers.ts",
  • "path": "src/utils/helpers.ts",
  • "isDir": false,
  • "children": []
  • }
  • ]
  • },
  • {
  • "name": "index.ts",
  • "path": "src/index.ts",
  • "isDir": false,
  • "children": []
  • }
  • ]
  • },
  • {
  • "name": "package.json",
  • "path": "package.json",
  • "isDir": false,
  • "children": []
  • },
  • {
  • "name": "README.md",
  • "path": "README.md",
  • "isDir": false,
  • "children": []
  • }
  • ]
  • }