npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@trendyol-js/ingest

v1.0.3

Published

CLI tool for traversing files with glob patterns

Downloads

9

Readme

Ingest Pipeline

A Node.js CLI tool for traversing files recursively based on glob patterns and sending file contents to a knowledge base API. This tool is designed to be integrated into CI/CD pipelines for automating file ingestion processes.

Features

  • Traverses files recursively based on glob patterns
  • Respects .gitignore rules automatically to avoid processing unwanted files
  • Securely authenticates with API token
  • Provides detailed logging of the ingestion process
  • Optimized for CI/CD pipeline integration

Installation

# Install globally
npm install -g @trendyol-js/ingest

# Or use directly with npx (recommended for CI/CD pipelines)
npx @trendyol-js/ingest [options]

Usage

Basic Usage

npx @trendyol-js/ingest --matcher "**/*.js" --identifier "your-identifier" --api-token "your-api-token" --host "https://your-api-host.com"

With Shorthand Options

npx @trendyol-js/ingest -m "**/*.js" -i "your-identifier" -t "your-api-token" -h "https://your-api-host.com"

Options Reference

| Option | Shorthand | Description | Default | Required | | ----------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | -------- | | --matcher <pattern> | -m | Glob pattern(s) for matching files to process. Supports standard glob patterns like **/*.js or src/**/*.{js,ts}. | - | Yes | | --identifier <string> | -i | Unique identifier for your knowledge base. This is used to route the files to the correct destination in the API. | - | Yes | | --api-token <token> | -t | Authentication token for the API. Keep this secure and use CI/CD secrets when possible. | - | Yes | | --host <url> | -h | Host URL for the API endpoint. Change this if you're using a custom endpoint or environment. | - | Yes | | --agent <name> | -a | Agent name that will be passed in the x-tyai-agent header. Useful for tracking or filtering API requests. If not provided, defaults to "project-{CI_PROJECT_ID}" in CI environments or "project-local" otherwise. | Auto-detected | No |

CI/CD Integration Examples

GitHub Actions

jobs:
  ingest:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: Set up Node.js
        uses: actions/setup-node@v3
        with:
          node-version: "18"

      - name: Run Ingest Pipeline
        run: npx @trendyol-js/ingest -m "**/*.{js,ts}" -i "${{ secrets.KB_IDENTIFIER }}" -t "${{ secrets.API_TOKEN }}" -h "${{ secrets.API_HOST }}"

GitLab CI

ingest-job:
  image: node:18-alpine
  script:
    - npx @trendyol-js/ingest --matcher "**/*.{js,ts}" --identifier "$KB_IDENTIFIER" --api-token "$API_TOKEN" --host "$API_HOST"
  variables:
    KB_IDENTIFIER: $KB_IDENTIFIER
    API_TOKEN: $API_TOKEN
    API_HOST: $API_HOST

Jenkins Pipeline

pipeline {
    agent {
        docker {
            image 'node:18-alpine'
        }
    }

    stages {
        stage('Ingest') {
            steps {
                sh 'npx @trendyol-js/ingest -m "**/*.{js,ts}" -i "${KB_IDENTIFIER}" -t "${API_TOKEN}" -h "${API_HOST}"'
            }
        }
    }
}

Advanced Usage

Multiple File Types

To process multiple file types, use glob pattern sets:

npx @trendyol-js/ingest -m "**/*.{js,ts,jsx,tsx}" -i "your-identifier" -t "your-api-token" -h "https://your-api-host.com"

Custom Host

For targeting a specific environment:

npx @trendyol-js/ingest -m "**/*.js" -i "your-identifier" -t "your-api-token" -h "https://your-custom-api-host.com"

Troubleshooting

  • If you encounter authentication errors, verify that your API token is correct and not expired
  • For file access issues, ensure your CI/CD runner has the necessary permissions to read the files
  • To debug which files are being processed, examine the console output for the list of matched files
  • Check for potential .gitignore conflicts if expected files are not being processed

Development

# Clone the repository
git clone https://github.com/Trendyol/ingest-pipeline.git
cd ingest-pipeline

# Install dependencies
npm install

# Link the package locally for testing
npm link

# Run the application
npm start -- --matcher "**/*.js" --identifier "test" --api-token "token" --host "https://your-api-host.com"

License

ISC