From cccd671fddb3ddc05d8966ce6d837dc3e932e95f Mon Sep 17 00:00:00 2001 From: khulnasoft-bot <43526132+khulnasoft-bot@users.noreply.github.com> Date: Tue, 21 Jan 2025 22:53:56 +0600 Subject: [PATCH 1/2] cli add --- .DS_Store | Bin 12292 -> 12292 bytes codetypo.config.yaml | 2 +- package.json | 2 +- packages/.DS_Store | Bin 12292 -> 14340 bytes packages/cli/.editorconfig | 25 ++ packages/cli/.github/FUNDING.yml | 15 + .../actions/github-app-token/action.yaml | 24 ++ packages/cli/.github/actions/pr/action.yaml | 68 ++++ .../cli/.github/actions/setup/action.yaml | 19 + packages/cli/.github/dependabot.yml | 56 +++ packages/cli/.github/release.yml | 23 ++ .../cli/.github/workflows/codeql-analysis.yml | 34 ++ .../cli/.github/workflows/cspell-action.yml | 18 + .../workflows/publish-docker-image.yml | 76 ++++ .../cli/.github/workflows/release-please.yml | 54 +++ packages/cli/.github/workflows/test.yml | 72 ++++ .../cli/.github/workflows/update-cspell.yml | 139 +++++++ .../.github/workflows/update-dependabot.yml | 59 +++ .../.github/workflows/update-dependencies.yml | 87 ++++ packages/cli/.gitignore | 104 +++++ packages/cli/.pre-commit-hooks.yaml | 16 + packages/cli/.prettierignore | 1 + packages/cli/.release-please-manifest.json | 3 + packages/cli/Dockerfile | 10 + packages/cli/LICENSE | 21 + packages/cli/README.md | 372 ++++++++++++++++++ packages/cli/SECURITY.md | 17 + packages/cli/codetypo.json | 11 + packages/cli/docker/german/Dockerfile | 8 + packages/cli/docker/german/README.md | 79 ++++ .../cli/docker/german/codetypo.config.yaml | 3 + packages/cli/index.js | 3 + packages/cli/package.json | 56 +++ packages/cli/release-please-config.json | 68 ++++ packages/cli/static/help-check.txt | 15 + packages/cli/static/help-link.txt | 14 + packages/cli/static/help-lint.txt | 106 +++++ packages/cli/static/help-suggestions.txt | 33 ++ packages/cli/static/help-trace.txt | 26 ++ packages/cli/static/help.txt | 19 + 40 files changed, 1756 insertions(+), 2 deletions(-) create mode 100644 packages/cli/.editorconfig create mode 100644 packages/cli/.github/FUNDING.yml create mode 100644 packages/cli/.github/actions/github-app-token/action.yaml create mode 100644 packages/cli/.github/actions/pr/action.yaml create mode 100644 packages/cli/.github/actions/setup/action.yaml create mode 100644 packages/cli/.github/dependabot.yml create mode 100644 packages/cli/.github/release.yml create mode 100644 packages/cli/.github/workflows/codeql-analysis.yml create mode 100644 packages/cli/.github/workflows/cspell-action.yml create mode 100644 packages/cli/.github/workflows/publish-docker-image.yml create mode 100644 packages/cli/.github/workflows/release-please.yml create mode 100644 packages/cli/.github/workflows/test.yml create mode 100644 packages/cli/.github/workflows/update-cspell.yml create mode 100644 packages/cli/.github/workflows/update-dependabot.yml create mode 100644 packages/cli/.github/workflows/update-dependencies.yml create mode 100644 packages/cli/.gitignore create mode 100644 packages/cli/.pre-commit-hooks.yaml create mode 100644 packages/cli/.prettierignore create mode 100644 packages/cli/.release-please-manifest.json create mode 100644 packages/cli/Dockerfile create mode 100644 packages/cli/LICENSE create mode 100644 packages/cli/README.md create mode 100644 packages/cli/SECURITY.md create mode 100644 packages/cli/codetypo.json create mode 100644 packages/cli/docker/german/Dockerfile create mode 100644 packages/cli/docker/german/README.md create mode 100644 packages/cli/docker/german/codetypo.config.yaml create mode 100755 packages/cli/index.js create mode 100644 packages/cli/package.json create mode 100644 packages/cli/release-please-config.json create mode 100644 packages/cli/static/help-check.txt create mode 100644 packages/cli/static/help-link.txt create mode 100644 packages/cli/static/help-lint.txt create mode 100644 packages/cli/static/help-suggestions.txt create mode 100644 packages/cli/static/help-trace.txt create mode 100644 packages/cli/static/help.txt diff --git a/.DS_Store b/.DS_Store index d5ccb499e2c8249581a38e8593ac7ac7fe727833..41bfe931c1107f24572ff8469b349923dcbc892e 100644 GIT binary patch delta 207 zcmZokXi1pxK>1@fOEmL>V~z|A3@i+K4CxG+3?&5_hQZ1CxdlKm2JUW$&4Lmv?3>v+ zyttSjs4kyuAS5!mM~sJ~V8ijVAe~@=2|{QBAH;Z=nRNv=9~X+_jf-J2L^eM+-^C>< cCqD@&#&N;VGalXk-24={JTdNTR%ql00HO9d%>V!Z delta 207 zcmZokXi1pxK>6A^BNL_t#~c|L7+4te7}6Os8A=K=41<&Na|?iC4BTA@HVaCyuy1DP z@Zw^=@9Z<#KuBbAj~EX}^Mk75-}8?-f(0fBp$U8t<6&mjny~q}P#kYu^g|V7^KOa|?hX zKyWJ>NI+$B^Icq$a`KaaA{@os+f-Q=9CJjLO@YgPHh%M-8AY}r1IbjT2B0>evy&O} z8B!Qh8A>MGDX?u;P^f0#yjuJZyCf?}8t5l(AmNJauZ> $GITHUB_ENV || echo "git_status=dirty" >> $GITHUB_ENV + git --no-pager diff --compact-summary + - name: Gen Body + shell: bash + env: + BODY: ${{ inputs.body }} + run: | + echo 'git_body<> $GITHUB_ENV + echo "$BODY" >> $GITHUB_ENV + git --no-pager diff --compact-summary >> $GITHUB_ENV + echo 'DIFF' >> $GITHUB_ENV + - name: Echo git_status + shell: bash + run: echo "${{ env.git_status }}" + + - name: Body + shell: bash + run: | + echo "$git_body" + + - uses: ./.github/actions/github-app-token + if: env.git_status == 'dirty' + id: generate-token + with: + app_id: ${{ inputs.app_id }} + app_private_key: ${{ inputs.app_private_key }} + + - name: Create Pull Request + if: env.git_status == 'dirty' + uses: peter-evans/create-pull-request@67ccf781d68cd99b580ae25a5c18a1cc84ffff1f # v4 + with: + commit-message: ${{ inputs.commit-message }} + branch: ${{ inputs.branch }} + base: ${{ inputs.base }} + title: ${{ inputs.title || inputs.commit-message }} + token: ${{ steps.generate-token.outputs.token }} + body: ${{ env.git_body }} + delete-branch: true diff --git a/packages/cli/.github/actions/setup/action.yaml b/packages/cli/.github/actions/setup/action.yaml new file mode 100644 index 00000000..a9f61cc2 --- /dev/null +++ b/packages/cli/.github/actions/setup/action.yaml @@ -0,0 +1,19 @@ +name: setup_node +description: Setup Node, and install Npm +inputs: + node-version: + required: false + description: The version of Node to use. + default: "18.x" +runs: + using: "composite" + steps: + - name: Use Node.js ${{ inputs.node-version }} + uses: actions/setup-node@v4 + with: + registry-url: "https://registry.npmjs.org" + node-version: ${{ inputs.node-version }} + cache: "npm" + - name: NPM Version + run: npm -v; + shell: bash diff --git a/packages/cli/.github/dependabot.yml b/packages/cli/.github/dependabot.yml new file mode 100644 index 00000000..0b2d9896 --- /dev/null +++ b/packages/cli/.github/dependabot.yml @@ -0,0 +1,56 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "npm" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "weekly" + + - package-ecosystem: "github-actions" + # Workflow files stored in the + # default location of `.github/workflows` + directory: "/" + schedule: + interval: "daily" + + - package-ecosystem: "npm" # See documentation for possible values + directory: "/" # Location of package manifests + target-branch: "codetypo4" + schedule: + interval: "weekly" + + - package-ecosystem: "github-actions" + # Workflow files stored in the + # default location of `.github/workflows` + directory: "/" + target-branch: "codetypo4" + schedule: + interval: "daily" + + # Automatically added by khulnasoft/public/update-dependabot-github-actions + - package-ecosystem: github-actions + directory: /.github/actions/setup + schedule: + interval: daily + commit-message: + prefix: ci + + # Automatically added by khulnasoft/public/update-dependabot-github-actions + - package-ecosystem: github-actions + directory: /.github/actions/pr + schedule: + interval: daily + commit-message: + prefix: ci + + # Automatically added by khulnasoft/public/update-dependabot-github-actions + - package-ecosystem: github-actions + directory: /.github/actions/github-app-token + schedule: + interval: daily + commit-message: + prefix: ci diff --git a/packages/cli/.github/release.yml b/packages/cli/.github/release.yml new file mode 100644 index 00000000..4d58f8e1 --- /dev/null +++ b/packages/cli/.github/release.yml @@ -0,0 +1,23 @@ +# .github/release.yml + +changelog: + exclude: + categories: + - title: Breaking Changes + labels: + - Semver-Major + - breaking + - title: Features + labels: + - Semver-Minor + - feature + - title: Fixes + labels: + - fix + - dev + - title: Other Changes + labels: + - "*" + - title: Maintenance + labels: + - chore diff --git a/packages/cli/.github/workflows/codeql-analysis.yml b/packages/cli/.github/workflows/codeql-analysis.yml new file mode 100644 index 00000000..a66fcf49 --- /dev/null +++ b/packages/cli/.github/workflows/codeql-analysis.yml @@ -0,0 +1,34 @@ +name: "CodeQL" + +on: + push: + branches: + - main + - codetypo4 + pull_request: + branches: + - main + - codetypo4 + workflow_dispatch: + schedule: + - cron: "0 23 * * 0" + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + # Make sure it goes back far enough to find where the branch split from main + fetch-depth: 20 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: "javascript" + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 diff --git a/packages/cli/.github/workflows/cspell-action.yml b/packages/cli/.github/workflows/cspell-action.yml new file mode 100644 index 00000000..ff4119d9 --- /dev/null +++ b/packages/cli/.github/workflows/cspell-action.yml @@ -0,0 +1,18 @@ +name: codetypo-action +on: + pull_request: + push: + branches: + - main + workflow_dispatch: + +jobs: + codetypo: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: khulnasoft/codetypo-action@v6 + with: + files: "." + incremental_files_only: false + check_dot_files: true diff --git a/packages/cli/.github/workflows/publish-docker-image.yml b/packages/cli/.github/workflows/publish-docker-image.yml new file mode 100644 index 00000000..ef004623 --- /dev/null +++ b/packages/cli/.github/workflows/publish-docker-image.yml @@ -0,0 +1,76 @@ +# GitHub recommends pinning actions to a commit SHA. +# To get a newer version, you will need to update the SHA. +# You can also reference a tag or branch, but the action may change without warning. + +name: " 📦 Publish Docker Images" + +on: + workflow_dispatch: + inputs: + dryRun: + description: "Dry Run" + type: choice + options: + - "yes" + - "no" + default: "no" + required: false + workflow_call: + +env: + REGISTRY: ghcr.io + IMAGE_NAME: "khulnasoft/codetypo" + +permissions: + contents: read + packages: write + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + + env: + DEBUG: ${{ github.event.inputs.dryRun == 'yes'}} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: CodeTypo Version + run: | + export CODETYPO_VERSION=$(jq -r ".dependencies.codetypo | sub(\"[_^]\"; \"\")" package.json) + echo CODETYPO_VERSION=$CODETYPO_VERSION >> $GITHUB_ENV + + - name: Log in to the Container registry + uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=semver,pattern={{version}},value=${{ env.CODETYPO_VERSION }} + labels: | + org.opencontainers.image.title=codetypo + org.opencontainers.image.description=CodeTypo command line spell checker for code and other documents. + org.opencontainers.image.vendor=Street Side Software + + - name: Log Docker metadata + env: + META: $${{ toJSON(steps.meta.outputs) }} + run: echo "$META" + + - name: Build and push Docker image + uses: docker/build-push-action@67a2d409c0a876cbe6b11854e3e25193efe4e62d + if: ${{ env.DEBUG != 'true' }} + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} +# codetypo:ignore opencontainers diff --git a/packages/cli/.github/workflows/release-please.yml b/packages/cli/.github/workflows/release-please.yml new file mode 100644 index 00000000..0e4981f2 --- /dev/null +++ b/packages/cli/.github/workflows/release-please.yml @@ -0,0 +1,54 @@ +name: " 🚀 release-please" + +on: + push: + branches: + - main + workflow_dispatch: + +permissions: + contents: write + pull-requests: write + id-token: write + +jobs: + release-please: + runs-on: ubuntu-latest + outputs: + release_created: ${{ steps.release.outputs.release_created }} + steps: + - uses: googleapis/release-please-action@v4 + id: release + with: + config-file: release-please-config.json + manifest-file: .release-please-manifest.json + + # codetypo:ignore noreply googleapis + + publish: + runs-on: ubuntu-latest + needs: + - release-please + if: ${{ needs.release-please.outputs.release_created }} + steps: + # The logic below handles the npm publication: + - uses: actions/checkout@v4 + - name: Setup + uses: ./.github/actions/setup + with: + node-version: ${{ matrix.node-version }} + + - run: npm ci + + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.PUBLISH_NPM}} + + publish-docker: + permissions: + contents: write + packages: write + needs: + - release-please + uses: ./.github/workflows/publish-docker-image.yml + if: ${{ needs.release-please.outputs.release_created }} diff --git a/packages/cli/.github/workflows/test.yml b/packages/cli/.github/workflows/test.yml new file mode 100644 index 00000000..d4a60389 --- /dev/null +++ b/packages/cli/.github/workflows/test.yml @@ -0,0 +1,72 @@ +name: " 🧪 Test" +on: + pull_request: + push: + branches: + - main + workflow_dispatch: + +jobs: + test-node-versions: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + node-version: + # List of supported node versions (latest is tested in `test-os`) + - 18.x + - 20.x + - 22.x + + os: + - ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup + uses: ./.github/actions/setup + with: + node-version: ${{ matrix.node-version }} + + - run: npm -v + - run: npm ci --omit=dev + - run: npm test + + # Ensure the repository is clean after build & test + - run: git --no-pager diff --compact-summary --exit-code + + test-os: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + node-version: + # Test the latest node version here, move older versions to `test-old-node-versions` + - 18.x + + os: + - windows-latest + - macos-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup + uses: ./.github/actions/setup + with: + node-version: ${{ matrix.node-version }} + + - run: npm ci --omit=dev + - run: npm test + + # Ensure the repository is clean after build & test + - run: git --no-pager diff --compact-summary --exit-code + + test-docker: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - run: docker build -t codetypo . + - run: docker run -v $(pwd):/workdir codetypo diff --git a/packages/cli/.github/workflows/update-cspell.yml b/packages/cli/.github/workflows/update-cspell.yml new file mode 100644 index 00000000..66aa71aa --- /dev/null +++ b/packages/cli/.github/workflows/update-cspell.yml @@ -0,0 +1,139 @@ +name: " 📚 Update CodeTypo" + +on: + workflow_dispatch: + inputs: + base: + description: The Base Ref to apply the diff + required: false + default: "main" + + push: + branches: + - main + paths: + - "**/package.json" + - "**/package-lock.json" + + schedule: + - cron: "0 7 * * *" + +jobs: + update-codetypo: + if: github.repository_owner == 'khulnasoft' + runs-on: ubuntu-latest + env: + NEW_BRANCH: update-codetypo-${{ inputs.base || 'main' }} + REF_BRANCH: ${{ inputs.base || 'main' }} + steps: + - name: Start + env: + EVENT_INPUTS: ${{ toJson(github.event.inputs) }} + run: | + echo "$EVENT_INPUTS" + + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ env.REF_BRANCH }} + + - name: Setup + uses: ./.github/actions/setup + with: + node-version: 18.x + + - name: Install + run: | + npm i + + - name: CodeTypo Old Version + run: echo CODETYPO_VERSION_OLD=$(npx codetypo -V) >> $GITHUB_ENV + + - name: Update CodeTypo to latest + run: | + npm i codetypo@latest + + - name: CodeTypo Version + run: echo CODETYPO_VERSION=$(npx codetypo -V) >> $GITHUB_ENV + + - name: Minor Versions + run: | + echo CODETYPO_MINOR_OLD=$(echo '"${{ env.CODETYPO_VERSION_OLD }}"' | jq 'sub("\\.[0-9]+$";"")') >> $GITHUB_ENV + echo CODETYPO_MINOR_NEW=$(echo '"${{ env.CODETYPO_VERSION }}"' | jq 'sub("\\.[0-9]+$";"")') >> $GITHUB_ENV + + - name: Determine Update type + env: + type: ${{ (env.CODETYPO_MINOR_OLD == env.CODETYPO_MINOR_NEW && 'fix') || 'feat' }} + run: | + echo PR_TYPE=$type >> $GITHUB_ENV + + - name: Install + run: npm install + + - name: Update Readme + run: | + npm run build:readme + npm run lint:fix + + - name: Git Status + id: git-status + uses: khulnasoft/actions/public/dirty@v1 + + - name: Echo git_status + env: + REPORT: | + Dirty: ${{ steps.git-status.outputs.isDirty && 'yes' || 'no' }} + CodeTypo Version: ${{ env.CODETYPO_VERSION }} + Old Version: ${{ env.CODETYPO_VERSION_OLD }} + run: | + echo "$REPORT" + + - name: CodeTypo Version Msg + id: codetypo_version_msg + uses: khulnasoft/actions/public/output@v1 + with: + value: CodeTypo version (${{ env.CODETYPO_VERSION }}) + + - name: Commit Message + id: commit_message + uses: khulnasoft/actions/public/output@v1 + with: + value: >- + Update ${{ steps.codetypo_version_msg.outputs.value }} + + - name: Gen PR Body + id: body + uses: khulnasoft/actions/public/pr-body@v1 + with: + title: ${{ steps.commit_message.outputs.value }} + message: | + **CodeTypo Version:** ${{ env.CODETYPO_VERSION_OLD }} -> ${{ env.CODETYPO_VERSION }} + **Type:** ${{ env.PR_TYPE }} + path: >- + package.json + + - name: Show Summary + uses: khulnasoft/actions/public/summary@v1 + with: + text: | + ${{ steps.body.outputs.body }} + + **Status:** ${{ steps.git-status.outputs.isDirty && 'dirty' || 'clean' }} + + ## Changes: + + ``` + ${{ steps.git-status.outputs.status }} + ``` + + - name: PR + if: steps.git-status.outputs.isDirty + uses: khulnasoft/actions/.github/actions/pr@v1 + with: + commit-message: "${{ env.PR_TYPE }}: ${{ steps.commit_message.outputs.value }}" + branch: ${{ env.NEW_BRANCH }} + base: ${{ env.REF_BRANCH }} + title: "${{ env.PR_TYPE }}: ${{ steps.commit_message.outputs.value }}" + body: ${{ steps.body.outputs.body }} + app_id: ${{ secrets.AUTOMATION_APP_ID }} + app_private_key: ${{ secrets.AUTOMATION_PRIVATE_KEY }} diff --git a/packages/cli/.github/workflows/update-dependabot.yml b/packages/cli/.github/workflows/update-dependabot.yml new file mode 100644 index 00000000..81c9ed19 --- /dev/null +++ b/packages/cli/.github/workflows/update-dependabot.yml @@ -0,0 +1,59 @@ +name: " 🤖 Update Dependabot" + +on: + workflow_dispatch: + inputs: + base: + description: The Base Ref to apply the diff + required: false + default: "main" + + schedule: + - cron: "0 12 * * *" + +permissions: + contents: read + +jobs: + update-dependabot: + runs-on: ubuntu-latest + env: + NEW_BRANCH: update-dependabot-${{ inputs.base || 'main' }} + REF_BRANCH: ${{ inputs.base || 'main' }} + PR_TYPE: ci + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ env.REF_BRANCH }} + + - name: Setup + uses: ./.github/actions/setup + + - name: Run Action + id: dependabot + uses: khulnasoft/actions/public/update-dependabot-github-actions@v1 + with: + prefix: ci + + - name: Echo Result + env: + SUMMARY: ${{ steps.dependabot.outputs.summary }} + run: | + echo "$SUMMARY" + + - name: Prettier + run: | + npm i + npx prettier .github/dependabot.yml --write + + - name: PR + uses: khulnasoft/actions/.github/actions/pr@v1 + with: + commit-message: "${{ env.PR_TYPE }}: Workflow Bot -- Update dependabot.yml" + branch: ${{ env.NEW_BRANCH }} + base: ${{ env.REF_BRANCH }} + title: "${{ env.PR_TYPE }}: Workflow Bot -- Update dependabot.yml (${{ env.REF_BRANCH }})" + body: ${{ steps.dependabot.outputs.summary }} + app_id: ${{ secrets.AUTOMATION_APP_ID }} + app_private_key: ${{ secrets.AUTOMATION_PRIVATE_KEY }} diff --git a/packages/cli/.github/workflows/update-dependencies.yml b/packages/cli/.github/workflows/update-dependencies.yml new file mode 100644 index 00000000..f71a3860 --- /dev/null +++ b/packages/cli/.github/workflows/update-dependencies.yml @@ -0,0 +1,87 @@ +name: " 🔗 Update Dependencies Main" + +on: + workflow_dispatch: + inputs: + base: + description: The Base Ref to apply the diff + required: false + default: "main" + + push: + branches: + - main + paths: + - "**/package.json" + - "**/package-lock.json" + + schedule: + - cron: "0 12 * * 0" + +jobs: + update-dependencies: + if: github.repository_owner == 'khulnasoft' + runs-on: ubuntu-latest + env: + NEW_BRANCH: update-dependencies-${{ inputs.base || 'main' }} + REF_BRANCH: ${{ inputs.base || 'main' }} + steps: + - name: Start + env: + EVENT_INPUTS: ${{ toJson(github.event.inputs) }} + run: | + echo "$EVENT_INPUTS" + + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ env.REF_BRANCH }} + + - name: Setup + uses: ./.github/actions/setup + with: + node-version: 18.x + + - name: Update Root + run: | + npm i + npx npm-check-updates -t semver -u + rm -rf node_modules package-lock.json + + - name: Install + run: npm install + + - name: Lint Fix + run: | + npm run lint:fix + + - name: Git Status + id: git-status + uses: khulnasoft/actions/public/dirty@v1 + + - name: Gen PR Body + id: body + uses: khulnasoft/actions/public/pr-body@v1 + with: + title: Update Dependencies + path: >- + package.json + + - name: Show Summary + uses: khulnasoft/actions/public/summary@v1 + with: + text: | + ${{ steps.body.outputs.body }} + + **Status:** ${{ steps.git-status.outputs.isDirty && 'dirty' || 'clean' }} + + - name: PR + uses: khulnasoft/actions/.github/actions/pr@v1 + with: + commit-message: "chore: Workflow Bot -- Update ALL Dependencies" + branch: ${{ env.NEW_BRANCH }} + base: ${{ env.REF_BRANCH }} + title: "chore: Workflow Bot -- Update ALL Dependencies (${{ env.REF_BRANCH }})" + body: ${{ steps.body.outputs.body }} + app_id: ${{ secrets.AUTOMATION_APP_ID }} + app_private_key: ${{ secrets.AUTOMATION_PRIVATE_KEY }} diff --git a/packages/cli/.gitignore b/packages/cli/.gitignore new file mode 100644 index 00000000..67045665 --- /dev/null +++ b/packages/cli/.gitignore @@ -0,0 +1,104 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# TypeScript v1 declaration files +typings/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test + +# parcel-bundler cache (https://parceljs.org/) +.cache + +# Next.js build output +.next + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and *not* Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port diff --git a/packages/cli/.pre-commit-hooks.yaml b/packages/cli/.pre-commit-hooks.yaml new file mode 100644 index 00000000..215f5859 --- /dev/null +++ b/packages/cli/.pre-commit-hooks.yaml @@ -0,0 +1,16 @@ +--- +# For use with pre-commit. +# See usage instructions at http://pre-commit.com + +- id: codetypo + name: codetypo + description: This hook runs CodeTypo spellchecker + entry: codetypo-cli + language: node + types: [text] + args: + - --no-must-find-files + - --no-progress + - --no-summary + - --gitignore + - --files # this needs to be the last argument so that the paths are passed correctly. diff --git a/packages/cli/.prettierignore b/packages/cli/.prettierignore new file mode 100644 index 00000000..1b763b1b --- /dev/null +++ b/packages/cli/.prettierignore @@ -0,0 +1 @@ +CHANGELOG.md diff --git a/packages/cli/.release-please-manifest.json b/packages/cli/.release-please-manifest.json new file mode 100644 index 00000000..7bb57f8a --- /dev/null +++ b/packages/cli/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "8.17.1" +} diff --git a/packages/cli/Dockerfile b/packages/cli/Dockerfile new file mode 100644 index 00000000..9ab9726c --- /dev/null +++ b/packages/cli/Dockerfile @@ -0,0 +1,10 @@ +FROM node:18-alpine + +WORKDIR /app +ENV HOME=/home +COPY package-lock.json package.json index.js ./ +RUN npm ci --omit=dev +RUN npm install --location=global + +WORKDIR /workdir +ENTRYPOINT [ "codetypo-cli" ] diff --git a/packages/cli/LICENSE b/packages/cli/LICENSE new file mode 100644 index 00000000..408bb684 --- /dev/null +++ b/packages/cli/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Street Side Software + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/cli/README.md b/packages/cli/README.md new file mode 100644 index 00000000..a90efd59 --- /dev/null +++ b/packages/cli/README.md @@ -0,0 +1,372 @@ +# codetypo-cli + +## Usage + +To check all files under the current directory, run: + +``` +npx codetypo-cli --gitignore . +``` + +## Setup [pre-commit](https://pre-commit.com) Hook + +This repository enables using [codetypo](https://github.com/khulnasoft/codetypo) as a [pre-commit](https://pre-commit.com) hook. + + + +```yaml +# .pre-commit-config.yaml +repos: + - repo: https://github.com/khulnasoft/codetypo-cli + rev: v8.17.1 + hooks: + - id: codetypo # Spell check changed files + - id: codetypo # Spell check the commit message + name: check commit message spelling + args: + - --no-must-find-files + - --no-progress + - --no-summary + - --files + - .git/COMMIT_EDITMSG + stages: [commit-msg] + always_run: true # This might not be necessary. +``` + + + +## Setup Custom Dictionary + +To use a custom dictionary with the `pre-commit` hook, create either a `codetypo.config.yaml` or `codetypo.json` file in your project's root directory. + +`codetypo.config.yaml` + +```yaml +dictionaryDefinitions: + - name: myWords + path: ./path/to/codeTypo_dict.txt + addWords: true +dictionaries: + - myWords +``` + +`codeTypo.json` + +```json +{ + "dictionaryDefinitions": [ + { + "name": "myWords", + "path": "./path/to/codeTypo_dict.txt", + "addWords": true + } + ], + "dictionaries": ["myWords"] +} +``` + +If you installed the [Code Spell Checker extension](https://marketplace.visualstudio.com/items?itemName=khulnasoft.code-spell-checker) for VS Code, this can be done automatically from the command palette by running "Spell: Create a CodeTypo configuration file". + +## Install from GitHub + +This repo also allows installing the `codetypo-cli` directly from GitHub: + +``` +npm install -g git+https://github.com/khulnasoft/codetypo-cli +``` + +## Docker + +[Package codetypo](https://github.com/khulnasoft/codetypo-cli/pkgs/container/codetypo) + +```sh +docker run -v $PWD:/workdir ghcr.io/khulnasoft/codetypo:latest "**" +``` + +See [Extending the Docker Container to include German](https://github.com/khulnasoft/codetypo-cli/tree/main/docker/german/README.md) + +## Usage + +`codetypo --help`: + + + +``` +Usage: codetypo [options] [command] + +Spelling Checker for Code + +Options: + -V, --version output the version number + -h, --help display help for command + +Commands: + lint [options] [globs...] Check spelling + trace [options] [words...] Trace words -- Search for words in the + configuration and dictionaries. + check [options] Spell check file(s) and display the + result. The full file is displayed in + color. + suggestions|sug [options] [words...] Spelling Suggestions for words. + link Link dictionaries and other settings to + the codetypo global config. + help [command] display help for command +``` + + + +### Lint + +`lint` is the default command. + +`codetypo lint --help`: + + + +``` +Usage: codetypo lint [options] [globs...] [file:// ...] [stdin[://]] + +Patterns: + - [globs...] Glob Patterns + - [stdin] Read from "stdin" assume text file. + - [stdin://] Read from "stdin", use for file type and config. + - [file://] Check the file at + +Examples: + codetypo . Recursively check all files. + codetypo lint . The same as "codetypo ." + codetypo "*.js" Check all .js files in the current directory + codetypo "**/*.js" Check all .js files recursively + codetypo "src/**/*.js" Only check .js under src + codetypo "**/*.txt" "**/*.js" Check both .js and .txt files. + codetypo "**/*.{txt,js,md}" Check .txt, .js, and .md files. + cat LICENSE | codetypo stdin Check stdin + codetypo stdin://docs/doc.md Check stdin as if it was "./docs/doc.md" + +Check spelling + +Options: + -c, --config Configuration file to use. By default codetypo + looks for codetypo.json in the current directory. + -v, --verbose Display more information about the files being + checked and the configuration. + --locale Set language locales. i.e. "en,fr" for English + and French, or "en-GB" for British English. + --language-id Force programming language for unknown + extensions. i.e. "php" or "scala" + --words-only Only output the words not found in the + dictionaries. + -u, --unique Only output the first instance of a word not + found in the dictionaries. + -e, --exclude Exclude files matching the glob pattern. This + option can be used multiple times to add multiple + globs. + --file-list Specify a list of files to be spell checked. The + list is filtered against the glob file patterns. + Note: the format is 1 file path per line. + --file [file...] Specify files to spell check. They are filtered + by the [globs...]. + --no-issues Do not show the spelling errors. + --no-progress Turn off progress messages + --no-summary Turn off summary message in console. + -s, --silent Silent mode, suppress error messages. + --no-exit-code Do not return an exit code if issues are found. + --quiet Only show spelling issues or errors. + --fail-fast Exit after first file with an issue or error. + -r, --root Root directory, defaults to current directory. + --no-relative Issues are displayed with absolute path instead + of relative to the root. + --show-context Show the surrounding text around an issue. + --show-suggestions Show spelling suggestions. + --no-show-suggestions Do not show spelling suggestions or fixes. + --no-must-find-files Do not error if no files are found. + --cache Use cache to only check changed files. + --no-cache Do not use cache. + --cache-reset Reset the cache file. + --cache-strategy Strategy to use for detecting changed files. + (choices: "content", "metadata", default: + "content") + --cache-location Path to the cache file or directory. (default: + ".codetypocache") + --dot Include files and directories starting with `.` + (period) when matching globs. + --gitignore Ignore files matching glob patterns found in + .gitignore files. + --no-gitignore Do NOT use .gitignore files. + --gitignore-root Prevent searching for .gitignore files past root. + --validate-directives Validate in-document CodeTypo directives. + --color Force color. + --no-color Turn off color. + --no-default-configuration Do not load the default configuration and + dictionaries. + --debug Output information useful for debugging + codetypo.json files. + --reporter Specify one or more reporters to use. + --issue-template [template] Use a custom issue template. See --help + --issue-template for details. + -h, --help display help for command + +More Examples: + + codetypo "**/*.js" --reporter @codetypo/codetypo-json-reporter + This will spell check all ".js" files recursively and use + "@codetypo/codetypo-json-reporter". + + codetypo . --reporter default + This will force the default reporter to be used overriding + any reporters defined in the configuration. + + codetypo . --reporter .//reporter.cjs + Use a custom reporter. See API for details. + + codetypo "*.md" --exclude CHANGELOG.md --files README.md CHANGELOG.md + Spell check only check "README.md" but NOT "CHANGELOG.md". + + codetypo "/*.md" --no-must-find-files --files $FILES + Only spell check the "/*.md" files in $FILES, + where $FILES is a shell variable that contains the list of files. + +References: + https://codetypo.org + https://github.com/khulnasoft/codetypo +``` + + + +### Trace + +`codetypo trace --help`: + + + +``` +Usage: codetypo trace [options] [words...] + +Trace words -- Search for words in the configuration and dictionaries. + +Options: + -c, --config Configuration file to use. By default codetypo + looks for codetypo.json in the current directory. + --locale Set language locales. i.e. "en,fr" for English and + French, or "en-GB" for British English. + --language-id Use programming language. i.e. "php" or "scala". + --allow-compound-words Turn on allowCompoundWords + --no-allow-compound-words Turn off allowCompoundWords + --ignore-case Ignore case and accents when searching for words. + --no-ignore-case Do not ignore case and accents when searching for + words. + --dictionary-path Configure how to display the dictionary path. + (choices: "hide", "short", "long", "full", + default: Display most of the path.) + --stdin Read words from stdin. + --all Show all dictionaries. + --only-found Show only dictionaries that have the words. + --color Force color. + --no-color Turn off color. + --no-default-configuration Do not load the default configuration and + dictionaries. + -h, --help display help for command +``` + + + +### Check + +`codetypo check --help`: + + + +``` +Usage: codetypo check [options] + +Spell check file(s) and display the result. The full file is displayed in color. + +Options: + -c, --config Configuration file to use. By default codetypo + looks for codetypo.json in the current directory. + --validate-directives Validate in-document CodeTypo directives. + --no-validate-directives Do not validate in-document CodeTypo directives. + --no-color Turn off color. + --color Force color + --no-exit-code Do not return an exit code if issues are found. + --no-default-configuration Do not load the default configuration and + dictionaries. + -h, --help display help for command +``` + + + +### Suggestions + +`codetypo suggestions --help`: + + + +``` +Usage: codetypo suggestions|sug [options] [words...] + +Spelling Suggestions for words. + +Options: + -c, --config Configuration file to use. By default + codetypo looks for codetypo.json in the + current directory. + --locale Set language locales. i.e. "en,fr" for + English and French, or "en-GB" for + British English. + --language-id Use programming language. i.e. "php" or + "scala". + -s, --no-strict Ignore case and accents when searching + for words. + --ignore-case Alias of --no-strict. + --num-changes Number of changes allowed to a word + (default: 4) + --num-suggestions Number of suggestions (default: 8) + --no-include-ties Force the number of suggested to be + limited, by not including suggestions + that have the same edit cost. + --stdin Use stdin for input. + --repl REPL interface for looking up + suggestions. + -v, --verbose Show detailed output. + -d, --dictionary Use the dictionary specified. Only + dictionaries specified will be used. + --dictionaries Use the dictionaries specified. Only + dictionaries specified will be used. + --no-color Turn off color. + --color Force color + -h, --help display help for command +``` + + + +### Link + +`codetypo link --help`: + + + +``` +Usage: codetypo link [options] [command] + +Link dictionaries and other settings to the codetypo global config. + +Options: + -h, --help display help for command + +Commands: + list|ls List currently linked configurations. + add|a Add dictionaries any other settings to the codetypo + global config. + remove|r Remove matching paths / packages from the global + config. + help [command] display help for command +``` + + + +## Versioning + +The major version of `codetypo-cli` tries to match the major version of `codetypo`. + +`minor` and `patch` versioning goes up independently from `codetypo`. Where possible, the `minor` version should match `codetypo`. diff --git a/packages/cli/SECURITY.md b/packages/cli/SECURITY.md new file mode 100644 index 00000000..5c8636a3 --- /dev/null +++ b/packages/cli/SECURITY.md @@ -0,0 +1,17 @@ +# Security Policy + +## Supported Versions + +| Version | Supported | +| ------- | ------------------ | +| 8.x | :white_check_mark: | + +## Reporting a Vulnerability + +## Security contact information + +To report a security vulnerability, please use the +[Tidelift security contact](https://tidelift.com/security). +Tidelift will coordinate the fix and disclosure. + +or send an email to [security@khulnasoft.com](mailto:security@khulnasoft.com) diff --git a/packages/cli/codetypo.json b/packages/cli/codetypo.json new file mode 100644 index 00000000..eff479b4 --- /dev/null +++ b/packages/cli/codetypo.json @@ -0,0 +1,11 @@ +{ + "files": ["**", ".*/**"], + "ignorePaths": [ + ".git", + ".gitignore", + "CHANGELOG.md", + "node_modules", + "package-lock.json" + ], + "words": ["codeql", "khulnasoft", "workdir", "COMMIT_EDITMSG"] +} diff --git a/packages/cli/docker/german/Dockerfile b/packages/cli/docker/german/Dockerfile new file mode 100644 index 00000000..7598f21b --- /dev/null +++ b/packages/cli/docker/german/Dockerfile @@ -0,0 +1,8 @@ +FROM ghcr.io/khulnasoft/codetypo:8.4.1 + +WORKDIR /app +ENV HOME=/home +RUN npm install @codetypo/dict-de-de@3.2.0 +RUN codetypo-cli link add @codetypo/dict-de-de + +WORKDIR /workdir diff --git a/packages/cli/docker/german/README.md b/packages/cli/docker/german/README.md new file mode 100644 index 00000000..e6dc2ed0 --- /dev/null +++ b/packages/cli/docker/german/README.md @@ -0,0 +1,79 @@ +# Extending the Docker Container to include German + +The CodeTypo container has all the default dictionaries installed, but to include other dictionaries, +it is necessary to extend the container. + +**`Dockerfile`** + +```dockerfile +FROM ghcr.io/khulnasoft/codetypo:8.4.1 + +WORKDIR /app +# Setting HOME is necessary to set the location of CodeTypo's global config. +ENV HOME=/home +# Install the dictionaries we want +RUN npm install @codetypo/dict-de-de@3.2.0 +# Link the dictionaries so that CodeTypo is aware of them by default. +RUN codetypo-cli link add @codetypo/dict-de-de + +# Restore the working directory to the virtual directory. +WORKDIR /workdir +``` + +## Building + +```sh +docker build -t codetypo-german:latest . +``` + +## Running + +Example of `codetypo trace` command: + +```sh +docker run -v $PWD:/workdir \ + codetypo-german:latest \ + trace Strasse \ + --locale=de --dictionary-path=short +``` + +**Result:** + +``` +Word F Dictionary Dictionary Location +Strasse - [flagWords]* From Settings `flagWords` +Strasse - [ignoreWords]* From Settings `ignoreWords` +Strasse - [suggestWords]* From Settings `suggestWords` +Strasse - [words]* From Settings `words` +Strasse - aws* [node_modules]/aws.txt +Strasse - companies* [node_modules]/companies.txt +Strasse - computing-acronyms* [node_modules]/computing-acronyms.txt +Strasse - cryptocurrencies* [node_modules]/cryptocurrencies.txt +Straße * de-de* [node_modules]/de_DE.trie.gz +Strasse - filetypes* [node_modules]/filetypes.txt.gz +Strasse - public-licenses* [node_modules]/public-licenses.txt.gz +Strasse - softwareTerms* [node_modules]/softwareTerms.txt +Strasse - web-services* [node_modules]/webServices.txt +``` + +## CodeTypo Configuration + +It is necessary to enable the locale for the dictionary to be used. On the command line, it is `--locale=`, i.e. `--locale=de,en` for German and English. + +In a CodeTypo Configuration file: + +**`codetypo.config.yaml`** + +```yaml +language: de,en +``` + +**`codetypo.json`** + +```json +{ + "language": "de,en" +} +``` + + diff --git a/packages/cli/docker/german/codetypo.config.yaml b/packages/cli/docker/german/codetypo.config.yaml new file mode 100644 index 00000000..fb162f5e --- /dev/null +++ b/packages/cli/docker/german/codetypo.config.yaml @@ -0,0 +1,3 @@ +language: en,de +words: + - workdir diff --git a/packages/cli/index.js b/packages/cli/index.js new file mode 100755 index 00000000..57c3d5da --- /dev/null +++ b/packages/cli/index.js @@ -0,0 +1,3 @@ +#!/usr/bin/env node + +import "codetypo/bin"; diff --git a/packages/cli/package.json b/packages/cli/package.json new file mode 100644 index 00000000..772ffa35 --- /dev/null +++ b/packages/cli/package.json @@ -0,0 +1,56 @@ +{ + "name": "codetypo-cli", + "publishConfig": { + "access": "public", + "provenance": true + }, + "version": "8.17.1", + "description": "CLI for codetypo; A Spelling Checker for Code!", + "type": "module", + "module": "index.js", + "bin": { + "codetypo-cli": "index.js" + }, + "scripts": { + "version-prerelease": "npx version-release -p", + "version-release-minor": "npx standard-version -r minor", + "version-release-patch": "npx standard-version -r patch", + "version-release": "npx standard-version", + "lint:fix": "prettier -w .", + "build:readme": "npm run build:help && npm run build:help-lint && npm run build:help-trace && npm run build:help-check && npm run build:help-suggestions && npm run build:help-link && inject-markdown README.md", + "build:help": "node index.js --help > static/help.txt", + "build:help-lint": "node index.js lint --help > static/help-lint.txt", + "build:help-trace": "node index.js trace --help > static/help-trace.txt", + "build:help-check": "node index.js check --help > static/help-check.txt", + "build:help-suggestions": "node index.js suggestions --help > static/help-suggestions.txt", + "build:help-link": "node index.js link --help > static/help-link.txt", + "test": "node ./index.js ." + }, + "repository": { + "type": "git", + "url": "git+https://github.com/khulnasoft/codetypo-cli.git" + }, + "keywords": [ + "codetypo" + ], + "author": "Jason Dent", + "license": "MIT", + "bugs": { + "url": "https://github.com/khulnasoft/codetypo-cli/issues" + }, + "homepage": "https://github.com/khulnasoft/codetypo-cli#readme", + "files": [ + ".pre-commit-hooks.yaml", + "index.js" + ], + "engines": { + "node": ">=18" + }, + "dependencies": { + "codetypo": "workspace:*" + }, + "devDependencies": { + "inject-markdown": "^3.1.4", + "prettier": "^3.4.2" + } +} diff --git a/packages/cli/release-please-config.json b/packages/cli/release-please-config.json new file mode 100644 index 00000000..3adffb7a --- /dev/null +++ b/packages/cli/release-please-config.json @@ -0,0 +1,68 @@ +{ + "bootstrap-sha": "02f37846182a6805645dd5bad41f9a880b00d5be", + "include-component-in-tag": false, + "include-v-in-tag": true, + "changelog-sections": [ + { + "type": "feat", + "section": "Features" + }, + { + "type": "feature", + "section": "Features" + }, + { + "type": "fix", + "section": "Trivial updates and changes." + }, + { + "type": "perf", + "section": "Performance Improvements" + }, + { + "type": "revert", + "section": "Reverts" + }, + { + "type": "docs", + "section": "Documentation", + "hidden": true + }, + { + "type": "style", + "section": "Styles", + "hidden": true + }, + { + "type": "chore", + "section": "Miscellaneous Chores", + "hidden": true + }, + { + "type": "refactor", + "section": "Code Refactoring", + "hidden": true + }, + { + "type": "test", + "section": "Tests", + "hidden": true + }, + { + "type": "build", + "section": "Build System", + "hidden": true + }, + { + "type": "ci", + "section": "Continuous Integration", + "hidden": true + } + ], + "packages": { + ".": { + "releaseType": "node", + "extra-files": ["README.md"] + } + } +} diff --git a/packages/cli/static/help-check.txt b/packages/cli/static/help-check.txt new file mode 100644 index 00000000..c82c9c53 --- /dev/null +++ b/packages/cli/static/help-check.txt @@ -0,0 +1,15 @@ +Usage: codetypo check [options] + +Spell check file(s) and display the result. The full file is displayed in color. + +Options: + -c, --config Configuration file to use. By default codetypo + looks for codetypo.json in the current directory. + --validate-directives Validate in-document CodeTypo directives. + --no-validate-directives Do not validate in-document CodeTypo directives. + --no-color Turn off color. + --color Force color + --no-exit-code Do not return an exit code if issues are found. + --no-default-configuration Do not load the default configuration and + dictionaries. + -h, --help display help for command diff --git a/packages/cli/static/help-link.txt b/packages/cli/static/help-link.txt new file mode 100644 index 00000000..74050efa --- /dev/null +++ b/packages/cli/static/help-link.txt @@ -0,0 +1,14 @@ +Usage: codetypo link [options] [command] + +Link dictionaries and other settings to the codetypo global config. + +Options: + -h, --help display help for command + +Commands: + list|ls List currently linked configurations. + add|a Add dictionaries any other settings to the codetypo + global config. + remove|r Remove matching paths / packages from the global + config. + help [command] display help for command diff --git a/packages/cli/static/help-lint.txt b/packages/cli/static/help-lint.txt new file mode 100644 index 00000000..7d4902e9 --- /dev/null +++ b/packages/cli/static/help-lint.txt @@ -0,0 +1,106 @@ +Usage: codetypo lint [options] [globs...] [file:// ...] [stdin[://]] + +Patterns: + - [globs...] Glob Patterns + - [stdin] Read from "stdin" assume text file. + - [stdin://] Read from "stdin", use for file type and config. + - [file://] Check the file at + +Examples: + codetypo . Recursively check all files. + codetypo lint . The same as "codetypo ." + codetypo "*.js" Check all .js files in the current directory + codetypo "**/*.js" Check all .js files recursively + codetypo "src/**/*.js" Only check .js under src + codetypo "**/*.txt" "**/*.js" Check both .js and .txt files. + codetypo "**/*.{txt,js,md}" Check .txt, .js, and .md files. + cat LICENSE | codetypo stdin Check stdin + codetypo stdin://docs/doc.md Check stdin as if it was "./docs/doc.md" + +Check spelling + +Options: + -c, --config Configuration file to use. By default codetypo + looks for codetypo.json in the current directory. + -v, --verbose Display more information about the files being + checked and the configuration. + --locale Set language locales. i.e. "en,fr" for English + and French, or "en-GB" for British English. + --language-id Force programming language for unknown + extensions. i.e. "php" or "scala" + --words-only Only output the words not found in the + dictionaries. + -u, --unique Only output the first instance of a word not + found in the dictionaries. + -e, --exclude Exclude files matching the glob pattern. This + option can be used multiple times to add multiple + globs. + --file-list Specify a list of files to be spell checked. The + list is filtered against the glob file patterns. + Note: the format is 1 file path per line. + --file [file...] Specify files to spell check. They are filtered + by the [globs...]. + --no-issues Do not show the spelling errors. + --no-progress Turn off progress messages + --no-summary Turn off summary message in console. + -s, --silent Silent mode, suppress error messages. + --no-exit-code Do not return an exit code if issues are found. + --quiet Only show spelling issues or errors. + --fail-fast Exit after first file with an issue or error. + -r, --root Root directory, defaults to current directory. + --no-relative Issues are displayed with absolute path instead + of relative to the root. + --show-context Show the surrounding text around an issue. + --show-suggestions Show spelling suggestions. + --no-show-suggestions Do not show spelling suggestions or fixes. + --no-must-find-files Do not error if no files are found. + --cache Use cache to only check changed files. + --no-cache Do not use cache. + --cache-reset Reset the cache file. + --cache-strategy Strategy to use for detecting changed files. + (choices: "content", "metadata", default: + "content") + --cache-location Path to the cache file or directory. (default: + ".codetypocache") + --dot Include files and directories starting with `.` + (period) when matching globs. + --gitignore Ignore files matching glob patterns found in + .gitignore files. + --no-gitignore Do NOT use .gitignore files. + --gitignore-root Prevent searching for .gitignore files past root. + --validate-directives Validate in-document CodeTypo directives. + --color Force color. + --no-color Turn off color. + --no-default-configuration Do not load the default configuration and + dictionaries. + --debug Output information useful for debugging + codetypo.json files. + --reporter Specify one or more reporters to use. + --issue-template [template] Use a custom issue template. See --help + --issue-template for details. + -h, --help display help for command + +More Examples: + + codetypo "**/*.js" --reporter @codetypo/codetypo-json-reporter + This will spell check all ".js" files recursively and use + "@codetypo/codetypo-json-reporter". + + codetypo . --reporter default + This will force the default reporter to be used overriding + any reporters defined in the configuration. + + codetypo . --reporter .//reporter.cjs + Use a custom reporter. See API for details. + + codetypo "*.md" --exclude CHANGELOG.md --files README.md CHANGELOG.md + Spell check only check "README.md" but NOT "CHANGELOG.md". + + codetypo "/*.md" --no-must-find-files --files $FILES + Only spell check the "/*.md" files in $FILES, + where $FILES is a shell variable that contains the list of files. + +References: + https://codetypo.org + https://github.com/khulnasoft/codetypo + diff --git a/packages/cli/static/help-suggestions.txt b/packages/cli/static/help-suggestions.txt new file mode 100644 index 00000000..2ad7f54b --- /dev/null +++ b/packages/cli/static/help-suggestions.txt @@ -0,0 +1,33 @@ +Usage: codetypo suggestions|sug [options] [words...] + +Spelling Suggestions for words. + +Options: + -c, --config Configuration file to use. By default + codetypo looks for codetypo.json in the + current directory. + --locale Set language locales. i.e. "en,fr" for + English and French, or "en-GB" for + British English. + --language-id Use programming language. i.e. "php" or + "scala". + -s, --no-strict Ignore case and accents when searching + for words. + --ignore-case Alias of --no-strict. + --num-changes Number of changes allowed to a word + (default: 4) + --num-suggestions Number of suggestions (default: 8) + --no-include-ties Force the number of suggested to be + limited, by not including suggestions + that have the same edit cost. + --stdin Use stdin for input. + --repl REPL interface for looking up + suggestions. + -v, --verbose Show detailed output. + -d, --dictionary Use the dictionary specified. Only + dictionaries specified will be used. + --dictionaries Use the dictionaries specified. Only + dictionaries specified will be used. + --no-color Turn off color. + --color Force color + -h, --help display help for command diff --git a/packages/cli/static/help-trace.txt b/packages/cli/static/help-trace.txt new file mode 100644 index 00000000..15887aac --- /dev/null +++ b/packages/cli/static/help-trace.txt @@ -0,0 +1,26 @@ +Usage: codetypo trace [options] [words...] + +Trace words -- Search for words in the configuration and dictionaries. + +Options: + -c, --config Configuration file to use. By default codetypo + looks for codetypo.json in the current directory. + --locale Set language locales. i.e. "en,fr" for English and + French, or "en-GB" for British English. + --language-id Use programming language. i.e. "php" or "scala". + --allow-compound-words Turn on allowCompoundWords + --no-allow-compound-words Turn off allowCompoundWords + --ignore-case Ignore case and accents when searching for words. + --no-ignore-case Do not ignore case and accents when searching for + words. + --dictionary-path Configure how to display the dictionary path. + (choices: "hide", "short", "long", "full", + default: Display most of the path.) + --stdin Read words from stdin. + --all Show all dictionaries. + --only-found Show only dictionaries that have the words. + --color Force color. + --no-color Turn off color. + --no-default-configuration Do not load the default configuration and + dictionaries. + -h, --help display help for command diff --git a/packages/cli/static/help.txt b/packages/cli/static/help.txt new file mode 100644 index 00000000..9d34f9a0 --- /dev/null +++ b/packages/cli/static/help.txt @@ -0,0 +1,19 @@ +Usage: codetypo [options] [command] + +Spelling Checker for Code + +Options: + -V, --version output the version number + -h, --help display help for command + +Commands: + lint [options] [globs...] Check spelling + trace [options] [words...] Trace words -- Search for words in the + configuration and dictionaries. + check [options] Spell check file(s) and display the + result. The full file is displayed in + color. + suggestions|sug [options] [words...] Spelling Suggestions for words. + link Link dictionaries and other settings to + the codetypo global config. + help [command] display help for command From b5fce51738986443cbe50429c98f8cab89925a28 Mon Sep 17 00:00:00 2001 From: khulnasoft-bot <43526132+khulnasoft-bot@users.noreply.github.com> Date: Tue, 21 Jan 2025 22:57:42 +0600 Subject: [PATCH 2/2] cli add --- .DS_Store | Bin 12292 -> 12292 bytes README.md | 4 ++-- docs/.DS_Store | Bin 8196 -> 8196 bytes docs/_includes/generated-docs/README.md | 4 ++-- packages/.DS_Store | Bin 14340 -> 14340 bytes packages/cli/README.md | 8 ++++---- packages/cli/package.json | 7 ++++--- packages/codetypo/README.md | 2 +- test-packages/.DS_Store | Bin 10244 -> 10244 bytes .../codetypo/test-codetypo-cli/package.json | 6 +++--- .../test-codetypo-esm-reporter/package.json | 6 +++--- website/src/pages/index.md | 4 ++-- 12 files changed, 21 insertions(+), 20 deletions(-) diff --git a/.DS_Store b/.DS_Store index 41bfe931c1107f24572ff8469b349923dcbc892e..fad4d7c2827576815bedc8bc7f4c541616adb2c2 100644 GIT binary patch delta 199 zcmZokXi1pxKv{LNP!P+4V~z|A3@i+K4CxG+3?&5_hQZ1CxdlKm2JXHIn*}9U*f+Ct z_;4|sg0l}C3;vw{p8qx0qkYX8~6R0<;i{IxXQ delta 199 zcmZokXi1pxK>1@fOEmL>V~z|A3@i+K4CxG+3?&5_hQZ1CxdlKm2JUW$&4Lmv?3>v+ ze7G2wPc{$|ncO4Bv$;g*2Q!l{!{h~G3Y+`Hgc%ttH!l)z;fQ52L^dfm-^C>d3Mt|MP*ewQ diff --git a/packages/cli/README.md b/packages/cli/README.md index a90efd59..c14cb76a 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -17,7 +17,7 @@ This repository enables using [codetypo](https://github.com/khulnasoft/codetypo) ```yaml # .pre-commit-config.yaml repos: - - repo: https://github.com/khulnasoft/codetypo-cli + - repo: https://github.com/khulnasoft/codetypo rev: v8.17.1 hooks: - id: codetypo # Spell check changed files @@ -72,18 +72,18 @@ If you installed the [Code Spell Checker extension](https://marketplace.visualst This repo also allows installing the `codetypo-cli` directly from GitHub: ``` -npm install -g git+https://github.com/khulnasoft/codetypo-cli +npm install -g git+https://github.com/khulnasoft/codetypo ``` ## Docker -[Package codetypo](https://github.com/khulnasoft/codetypo-cli/pkgs/container/codetypo) +[Package codetypo](https://github.com/khulnasoft/codetypo/pkgs/container/codetypo) ```sh docker run -v $PWD:/workdir ghcr.io/khulnasoft/codetypo:latest "**" ``` -See [Extending the Docker Container to include German](https://github.com/khulnasoft/codetypo-cli/tree/main/docker/german/README.md) +See [Extending the Docker Container to include German](https://github.com/khulnasoft/codetypo/tree/main/docker/german/README.md) ## Usage diff --git a/packages/cli/package.json b/packages/cli/package.json index 772ffa35..bbffb9f3 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -28,7 +28,8 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/khulnasoft/codetypo-cli.git" + "url": "git+https://github.com/khulnasoft/codetypo.git", + "directory": "packages/cli" }, "keywords": [ "codetypo" @@ -36,9 +37,9 @@ "author": "Jason Dent", "license": "MIT", "bugs": { - "url": "https://github.com/khulnasoft/codetypo-cli/issues" + "url": "https://github.com/khulnasoft/codetypo/issues" }, - "homepage": "https://github.com/khulnasoft/codetypo-cli#readme", + "homepage": "https://github.com/khulnasoft/codetypo#readme", "files": [ ".pre-commit-hooks.yaml", "index.js" diff --git a/packages/codetypo/README.md b/packages/codetypo/README.md index 6867d521..092e9c55 100644 --- a/packages/codetypo/README.md +++ b/packages/codetypo/README.md @@ -51,7 +51,7 @@ npm install -g codetypo ### Docker -There is a docker image at [Packages for codetypo](https://github.com/khulnasoft/codetypo-cli/pkgs/container/codetypo). +There is a docker image at [Packages for codetypo](https://github.com/khulnasoft/codetypo/pkgs/container/codetypo). `codetypo` commands below can be run by replacing diff --git a/test-packages/.DS_Store b/test-packages/.DS_Store index 57a7b1ef10a988a8a690ddecb368bceaff78418b..589ee676cafb79cf830b91c5cb3975db7e46fac3 100644 GIT binary patch delta 15 WcmZn(XbIS$C&1+Wd9#7Q6>$JAhy}F( delta 15 WcmZn(XbIS$C&1*xz1cwEiZ}o%9|X<- diff --git a/test-packages/codetypo/test-codetypo-cli/package.json b/test-packages/codetypo/test-codetypo-cli/package.json index 1d9b2955..3232f4b8 100644 --- a/test-packages/codetypo/test-codetypo-cli/package.json +++ b/test-packages/codetypo/test-codetypo-cli/package.json @@ -13,7 +13,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/khulnasoft/codetypo-cli.git" + "url": "git+https://github.com/khulnasoft/codetypo.git" }, "keywords": [ "codetypo" @@ -21,9 +21,9 @@ "author": "Md Sulaiman", "license": "MIT", "bugs": { - "url": "https://github.com/khulnasoft/codetypo-cli/issues" + "url": "https://github.com/khulnasoft/codetypo/issues" }, - "homepage": "https://github.com/khulnasoft/codetypo-cli#readme", + "homepage": "https://github.com/khulnasoft/codetypo#readme", "dependencies": { "codetypo": "workspace:*" } diff --git a/test-packages/codetypo/test-codetypo-esm-reporter/package.json b/test-packages/codetypo/test-codetypo-esm-reporter/package.json index 937d4c61..ad03d5da 100644 --- a/test-packages/codetypo/test-codetypo-esm-reporter/package.json +++ b/test-packages/codetypo/test-codetypo-esm-reporter/package.json @@ -14,7 +14,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/khulnasoft/codetypo-cli.git" + "url": "git+https://github.com/khulnasoft/codetypo.git" }, "keywords": [ "codetypo" @@ -22,9 +22,9 @@ "author": "Md Sulaiman", "license": "MIT", "bugs": { - "url": "https://github.com/khulnasoft/codetypo-cli/issues" + "url": "https://github.com/khulnasoft/codetypo/issues" }, - "homepage": "https://github.com/khulnasoft/codetypo-cli#readme", + "homepage": "https://github.com/khulnasoft/codetypo#readme", "dependencies": { "@codetypo/codetypo-types": "workspace:^", "codetypo": "workspace:*" diff --git a/website/src/pages/index.md b/website/src/pages/index.md index 962b7dee..c6a0fedb 100644 --- a/website/src/pages/index.md +++ b/website/src/pages/index.md @@ -58,9 +58,9 @@ Some videos related to CodeTypo and the [Code Spell Checker](https://marketplace ## Related Packages -- [codetypo-cli](https://github.com/khulnasoft/codetypo-cli) -- `codetypo-cli` is useful for including `codetypo` directly from GitHub. +- [codetypo-cli](https://github.com/khulnasoft/codetypo) -- `codetypo-cli` is useful for including `codetypo` directly from GitHub. - Example install: `npm install -g git+https://github.com/khulnasoft/codetypo-cli`. + Example install: `npm install -g git+https://github.com/khulnasoft/codetypo`. This will add the `codetypo-cli` command, which is an alias of the `codetypo` command.