Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --no-input argument #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

frogermcs
Copy link

Short summary

Add the --no-input argument so the app can be run with all input prompts surpassed, e.g., to prevent Github actions from crashing.

Screenshot 2024-10-28 at 12 54 32

More context

I want to use codebase-digest as part of my Github Actions pipelines.
I want it export digest as txt file, and it almost works. :)

The problematic part are your input() prompts, which currently cannot be disabled via arguments, so I added one.

I also added a basic unit testing framework to make it easier to modularize and test code in the future.

Example Github Action

Once this PR is merged and released to production, I plan to create another one with example Github Action.

If you want to try it on your own, here's the example code:

name: Consolidate Repository to Single Prompt

on:
  push:
    branches:
      - main
  workflow_dispatch:

jobs:
  consolidate:
    runs-on: ubuntu-latest

    steps:
      - name: Check out the code
        uses: actions/checkout@v3

      - name: Set up Python
        uses: actions/setup-python@v4
        with:
          python-version: '3.x'
        
      - name: Install Codebase Digest
        run: pip install codebase-digest

      - name: Generate Single Prompt File
        run: cdigest . -f consolidated_project_prompt.txt --copy-to-clipboard=false	

      - name: Upload Prompt File as Artifact
        uses: actions/upload-artifact@v3
        with:
          name: consolidated_project_prompt
          path: consolidated_project_prompt.txt

Chores

This PR also creates very (very!) basic setup for unit testing. I assume this project will grow, so it would be nice to bring at least baseline for maintainability.

To run unit tests

  1. Go to /codebase-digest directory
  2. Run python -m unittest discover -s tests

This required adding one more dependency in requirements-dev.txt: unittest

Add --no-input argument so the app can be run with all input prompts surpassed, e.g. to not crash github actions.

Also added basic unit testing framework so it's easier to modularize and test code in the future.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants