{"id":22832746,"url":"https://github.com/ietf-tools/idnits","last_synced_at":"2026-02-18T11:11:03.026Z","repository":{"id":39717377,"uuid":"419513386","full_name":"ietf-tools/idnits","owner":"ietf-tools","description":"Library / CLI to inspect Internet-Draft documents for a variety of conditions to conform with IETF policies.","archived":false,"fork":false,"pushed_at":"2025-04-10T00:32:01.000Z","size":664,"stargazers_count":13,"open_issues_count":32,"forks_count":20,"subscribers_count":5,"default_branch":"v3","last_synced_at":"2025-04-10T01:30:34.606Z","etag":null,"topics":["ietf","internet-drafts","nits"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ietf-tools.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-20T22:57:13.000Z","updated_at":"2025-04-10T00:32:04.000Z","dependencies_parsed_at":"2022-08-09T15:25:00.138Z","dependency_job_id":"aceba222-8bf8-473f-81fd-9bb18cdf41a1","html_url":"https://github.com/ietf-tools/idnits","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ietf-tools%2Fidnits","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ietf-tools%2Fidnits/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ietf-tools%2Fidnits/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ietf-tools%2Fidnits/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ietf-tools","download_url":"https://codeload.github.com/ietf-tools/idnits/tar.gz/refs/heads/v3","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250515995,"owners_count":21443528,"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":["ietf","internet-drafts","nits"],"created_at":"2024-12-12T21:09:04.869Z","updated_at":"2026-02-18T11:11:03.021Z","avatar_url":"https://github.com/ietf-tools.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n    \n\u003cimg src=\"https://raw.githubusercontent.com/ietf-tools/common/main/assets/logos/idnits.svg\" alt=\"IDNITS\" height=\"125\" /\u003e\n    \n[![npm](https://img.shields.io/npm/v/@ietf-tools/idnits)](https://www.npmjs.com/package/@ietf-tools/idnits)\n[![node-current](https://img.shields.io/node/v/@ietf-tools/idnits)](https://github.com/ietf-tools/idnits)\n[![License](https://img.shields.io/github/license/ietf-tools/idnits)](https://github.com/ietf-tools/idnits/blob/v3/LICENSE)\n    \n##### CLI / Library to inspect Internet-Draft documents for a variety of conditions to conform with IETF policies.\n    \n\u003c/div\u003e\n\n\u003e ⚠️ *This branch is for the new JS-based idnits3. For the older shell-based idnits2, [view the v2 branch](https://github.com/ietf-tools/idnits/tree/v2) instead.*\n\n- [Installation](#installation)\n- [CLI Usage](#cli-usage)\n- [Library Usage](#library-usage)\n- [Tests](#tests)\n- [Development](#development)\n- [Contributing](https://github.com/ietf-tools/.github/blob/main/CONTRIBUTING.md)\n\n---\n\n### Installation\n\n1. Install [Node.js 20.x or later](https://nodejs.org/)\n2. Install **idnits** using one of the methods:\n\n#### Globally *(recommended)*\n\n```sh\nnpm install -g @ietf-tools/idnits\n```\n\n#### In an existing npm project\n\n```sh\nnpm install @ietf-tools/idnits\n```\n\n#### Without Installation\n\n```sh\nnpx @ietf-tools/idnits \u003cargs\u003e\n```\n\n\u003e [!TIP]\n\u003e This is only useful for quickly running the command once without installing. If you plan on using this tool regularly, you should install it globally instead.\n\n### CLI Usage\n\n```sh\nidnits [args] \u003cfile path|url\u003e\n```\n\n| Arguments | Alias | Description | Default |\n|---|---|---|---|\n| `--filter` | `-f` | Filter output to only certain severity types. Can be declared multiple times to filter multiple severity types.\u003cbr\u003eAccepted values: `errors`, `warnings`, `comments` |  |\n| `--mode` | `-m` | Validation mode, must be either `normal`, `forgive-checklist` or `submission`\u003cbr\u003eAccepted shorthands: `norm`, `n`, `f-c`, `fc`, `f`, `sub`, `s` | `normal` |\n| `--no-color` |  | Disable colors in `pretty` output.\u003cbr\u003eNo effect in other output formats. |  |\n| `--no-progress` |  | Disable progress messages / animations in `pretty` output.\u003cbr\u003eNo effect in other output formats. |  |\n| `--offline` |  | Disable validations that require an internet connection. |  |\n| `--output` | `-o` | Output format, must be either `pretty`, `simple`, `json` or `count` | `pretty` |\n| `--solarized` |  | Use alternate colors for a solarized light theme terminal.\u003cbr\u003eOnly used with the `pretty` output format. |  |\n| `--year` | `-y` | Expect the given year in the boilerplate |  |\n| `--help` | `-h` | Print the help text and exit |  |\n| `--version` |  | Print the version and exit |  |\n\n### Library Usage\n\n\u003e [!NOTE]\n\u003e The library documentation is a work in progress.\n\nEnsure you installed the library locally to your project (`npm install @ietf-tools/idnits`).\n\n#### Simple Validation Run\n\nUse the `checkNits()` method to quickly run all the validation checks and return a results array.\n\n```js\nimport { checkNits } from '@ietf-tools/idnits'\n\nconst documentRawBuffer = ...\nconst documentFileName = 'draft-ietf-abcd-efgh-01.xml'\n\nconst results = await checkNits(documentRawBuffer, documentFileName)\n```\n\n#### Task Runner\n\nYou can implement your own task runner to have full control over how the validations are executed. The `getAllValidations()` method returns a list of all validations that should be run.\n\n```js\nimport { getAllValidations } from '@ietf-tools/idnits'\n\nconst ext = filename.endsWith('.xml') ? 'xml' : 'txt'\nconst result = []\nconst ctx = {\n  raw,\n  filename,\n  options: {\n    allowedDomains,\n    mode,\n    offline,\n    year\n  }\n}\n\nconst validations = getAllValidations(ext)\n\nfor (const valGroup of validations) {\n  // Skip validation group if condition is not met\n  if (valGroup.condition \u0026\u0026 !valGroup.condition(ctx)) {\n    continue\n  }\n\n  // Run validations in parallel when possible\n  if (valGroup.concurrent) {\n    const valGroupResult = await Promise.all(valGroup.tasks.map(valTask =\u003e valTask.task(ctx)))\n    for (const taskResult of valGroupResult) {\n      if (Array.isArray(taskResult)) {\n        result.push(...taskResult)\n      }\n    }\n  } else {\n    // Run validations sequentially otherwise\n    for (const valTask of valGroup.tasks) {\n      const taskResult = await valTask.task(ctx)\n      if (!valTask.isVoid \u0026\u0026 Array.isArray(taskResult)) {\n        result.push(...taskResult)\n      }\n    }\n  }\n}\n\nreturn result\n```\n\n### Tests\n\nTests are made using the [Vitest](https://vitest.dev/) library and are located under the `tests` directory.\n\nYou can run the suite of tests using:\n```sh\n# Make sure you installed dependencies first:\nnpm install\n\n# Run the tests\nnpm test\n```\n\nCode coverage is expected to reach 100%. Ensure this is still the case when making edits / adding new functionality.\n\n### Development\n\n1. Clone the project\n2. Run `npm install`\n3. Run the CLI: *(replacing `\u003cargs\u003e` and `\u003cfile path|url\u003e` with the desired flags + file path)*\n    ```\n    node cli.js \u003cargs\u003e \u003cfile path|url\u003e\n    ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fietf-tools%2Fidnits","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fietf-tools%2Fidnits","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fietf-tools%2Fidnits/lists"}