{"id":21496953,"url":"https://github.com/financial-times/ebi","last_synced_at":"2025-07-15T19:32:55.940Z","repository":{"id":34214512,"uuid":"170686502","full_name":"Financial-Times/ebi","owner":"Financial-Times","description":"🦐 Ebi: GitHub repositories contents search","archived":false,"fork":false,"pushed_at":"2024-10-29T17:03:41.000Z","size":720,"stargazers_count":9,"open_issues_count":6,"forks_count":2,"subscribers_count":47,"default_branch":"main","last_synced_at":"2024-10-29T18:30:30.474Z","etag":null,"topics":["command-line-tool","customer-products","github","platforms-customer-products"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Financial-Times.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-14T12:17:14.000Z","updated_at":"2024-10-16T09:59:39.000Z","dependencies_parsed_at":"2023-12-26T03:24:58.568Z","dependency_job_id":"55ea8433-7739-41e9-96a3-da1c55865f7b","html_url":"https://github.com/Financial-Times/ebi","commit_stats":{"total_commits":196,"total_committers":17,"mean_commits":"11.529411764705882","dds":0.4336734693877551,"last_synced_commit":"d1177b873ff4a5f55efbb36eaddac99aaed3505c"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Financial-Times%2Febi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Financial-Times%2Febi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Financial-Times%2Febi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Financial-Times%2Febi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Financial-Times","download_url":"https://codeload.github.com/Financial-Times/ebi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226065279,"owners_count":17568183,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["command-line-tool","customer-products","github","platforms-customer-products"],"created_at":"2024-11-23T16:20:00.364Z","updated_at":"2024-11-23T16:20:01.989Z","avatar_url":"https://github.com/Financial-Times.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🦐 Ebi: GitHub repositories contents search\n\n\u003ca href=\"https://circleci.com/gh/Financial-Times/ebi/tree/main\"\u003e\n\t\u003cimg alt=\"Build Status\" src=\"https://circleci.com/gh/Financial-Times/ebi/tree/main.svg?style=svg\"\u003e\n\u003c/a\u003e\n\nSearches files within GitHub repositories. It can be used as a command line tool or a library.\n\nEbi (えび) is [Japanese for prawn/shrimp](https://translate.google.com/#view=home\u0026op=translate\u0026sl=en\u0026tl=ja\u0026text=Prawn), and intends to be a small little tool to crawl through your sea of code on GitHub, finding you nuggets of information.\n\n## Command Line Usage\n\n### Global installation (recommmended)\n\n`npm install --global ebi`\n\nWhen you run the tool, it will automatically notify you if there is a newer version of it available for you to update to.\n\n[You can disable notifications](https://www.npmjs.com/package/update-notifier#user-settings) if you'd prefer not to be notified about updates.\n\n## No installation\n\n`npx ebi`\n\nThe npx command lets you use this tool without installing it. However, each time you use npx it downloads the whole package from the npm registry, which takes a while. That's why global installation is reccommended.\n\n\u003e Note: If this tool is globally installed, npx ebi will use that globally installed version rather than downloading.\n\n## Usage\n\n1.  [Set up a GitHub personal access token](#setting-up-your-github-personal-access-token) (with all `repo` scopes) assigned to the `GITHUB_PERSONAL_ACCESS_TOKEN` environment variable\n\n2.  Pass in the list of space-separated repositories as arguments:\n\n        ebi \u003ccommand\u003e Financial-Times/ebi Financial-Times/tako\n        \n3. If ebi is silently failing you can turn on `--verbose` to see more logging\n\n### Examples\n\nShow help\n\n    ebi --help\n\nInput the repositories to the ebi command either via `stdin` or `args`.\nDetermine whether a repo has a `Procfile`\n\n```\n$ echo -e \"Financial-Times/ebi\" | ebi contents Procfile\n```\n\n```\n$ ebi contents Procfile Financial-Times/ebi\n```\n\nFind all the `node` engines and their versions in `package.json`\n\n```\n$ cat repositories.txt | ebi package:engines\n```\n\nFor more examples see [Usage Examples](https://github.com/Financial-Times/ebi/wiki/Usage-Examples).\n\n### JSON output\n\nTo output as JSON, you can use the `--json` flag eg, `ebi package:engines --json`.\n\nThe output format of the JSON is\n\n```\n{\n    type,\n    repository,\n    filepath,\n    fileContents,\n    [search],\n    [regex],\n    [error]\n}\n```\n\n| Field          | Values                           | Description                                                   |\n| -------------- | -------------------------------- | ------------------------------------------------------------- |\n| `type`         | `match`, `no-match`, `error`     | Type of result                                                |\n| `repository`   | `Financial-Times/ebi`            | The full repository path                                      |\n| `filepath`     | `package.json`                   | The filepath searched for                                     |\n| `fileContents` | `{\\n \\\"name\\\": \\\"ebi\\\",\\n ... }` | The file contents serialized as a string                      |\n| `search`       | `name`                           | [optional] The search term                                    |\n| `regex`        | `no.*`                           | [optional] The regex used for search (ie, `--regex`)          |\n| `error`        | `404 ERROR: ...`                 | [optional] The error message if the result is of type `error` |\n\n## Library Usage\n\nTo use `ebi` as a library in a NodeJS project:\n\n    npm install ebi\n\nRequire `ebi`, and run a search:\n\n```javascript\nconst {\n  contentsSearch,\n  packageSearch,\n  packageEnginesSearch\n} = require('ebi');\n\n// Get a repository list\nconst repoList = [\n  'Financial-Times/ebi'\n];\n\nconst { getResults, resultsAsync } = await contentsSearch({\n  filepath: 'package.json',\n  search,       // Optional\n  token,        // Optional\n  regex,        // Optional\n  limit         // Optional\n})(repoList);\n\n// Get results synchronously\nconst {\n    allResults,\n    searchMatches,\n    searchNoMatches,\n    searchErrors\n} = await getResults();\n\n// Get results asynchronously\nconst allAsyncResults = await Promise.all(\n    resultsAsync.map(promise =\u003e {\n        // Need to handle errors eg, if file is not found\n        return promise.catch(e =\u003e e);\n    })\n);\n```\n\nSimilarly:\n\n```javascript\nconst { getResults, resultsAsync } = await packageSearch({\n  search: 'ebi',  // Optional\n  token,          // Optional\n  regex,          // Optional\n  limit           // Optional\n})(repoList);\n```\n\n```javascript\nconst { getResults, resultsAsync } = await packageEnginesSearch({\n  search: 'node'  // Optional\n  token,          // Optional\n  regex,          // Optional\n  limit           // Optional\n})(repoList);\n```\n\nSee [JSDoc comments](./lib/ebi/ebi-results.js) for descriptions of the parameters. VS Code also has [JSDoc support in the editor](https://code.visualstudio.com/docs/languages/javascript#_jsdoc-support). To turn it on, either put `// @ts-check` on the top of a file or enable the `checkJS` compiler option.\n\nSee [examples](./examples) folder for more usage examples.\n\n## Setting up your GitHub personal access token\n\nThis tool requires a [GitHub personal access token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/) with all `repo` scopes. This is _very powerful_ as it has access to modify a repository's settings, so it is strongly recommended that you store this token securely.\n\n1. Create a [new GitHub personal access token with all `repo` scopes](https://github.com/settings/tokens/new?description=Ebi%20CLI\u0026scopes=repo)\n2. Store the token in the `GITHUB_PERSONAL_ACCESS_TOKEN` environment variable. You should avoid passing your GitHub personal access token directly to any CLI arguments as it will be visible in your shell history. There are a few options to do this:\n    1. If you work at Financial Times, you can follow the [GitHub personal access token docs](https://github.com/Financial-Times/next/wiki/How-to-store-and-access-a-GitHub-personal-access-token-securely)\n    2. Use your operating system's password management system (e.g. Keychain on macOS) to store and retrieve `GITHUB_PERSONAL_ACCESS_TOKEN` in your shell's rcfile (e.g. `~/.bashrc`), then restart your terminal\n    3. If all else fails, you can set it in your terminal with `GITHUB_PERSONAL_ACCESS_TOKEN=[github-token]`\n    4. If you want use a different token, you can pass in `--token=$GITHUB_PERSONAL_ACCESS_TOKEN` when you run the commands\n\n## Development\n\n1.  Install [nvm](https://github.com/creationix/nvm) and use the correct node version\n\n        nvm use\n\n1.  Install dependencies\n\n        npm install\n\n1.  Run with:\n\n        ./bin/ebi.js \u003ccommand\u003e\n\n### Testing\n\nTo run linting and tests\n\n    npm test\n\nTo just run linting\n\n    npm run lint\n\nTo fix linting issues\n\n    npm run lint-fix\n\nTo just run unit tests\n\n    npm run unit-test\n\nTo watch files and run unit tests\n\n    npm run unit-test:watch\n\nTo watch individual files and run unit tests\n\n    npm run unit-test:watch -- [file...]\n    # eg,\n    npm run unit-test:watch -- test/lib/get-repositories.test.js\n\n### Code formatting with Prettier\n\nThis repo uses [prettier](https://prettier.io/) for code formatting. To make the most of this when working locally:\n\n-   Install the [`prettier-vscode`](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) extension in the extension side bar\n-   Update your settings to format files on save. This will check your file meets the prettier guidelines and will fix it each time you save. You can update the setting at `Code` --\u003e `Preferences` --\u003e `Settings` --\u003e update `\"editor.formatOnSave\": true`\n\nTo make sure no `eslint` rules conflict with the prettier config, we have [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier). This can be run with:\n\n    npm run eslint-check\n\n### Publishing a release\n\nCircleCI is set up to publish a release to `npm`. To release:\n\n1. Create a [new release from GitHub](https://github.com/Financial-Times/ebi/releases/new)\n    1. Tag it with a [semver](https://semver.org/) range and a `v` prefix eg, `v1.2.3` or `v1.4.5-beta.3`\n    2. Create a title and description\n    3. Publish release\n2. Wait for CircleCI to finish building the tag release, and once done, it will be appear at [npmjs.com/package/ebi](https://www.npmjs.com/package/ebi)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffinancial-times%2Febi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffinancial-times%2Febi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffinancial-times%2Febi/lists"}