Skip to content

Make your repo into a single file to pass to an AI prompt

Notifications You must be signed in to change notification settings

cluesurf/make-code-text.js

Repository files navigation








@cluesurf/make-code-text

JSON Model Specification Tool




Installation

pnpm add -D @cluesurf/make-code-text
yarn add -D @cluesurf/make-code-text
npm i -D @cluesurf/make-code-text

Usage

// scripts/make-prompt.ts
import makeCodeText from '@cluesurf/make-code-text'

makeCodeText({
  patterns: ['**/*'],
  ignoredPatterns: [
    'node_modules/**/*',
    '.dockerfile',
    '.env',
    'test.ts',
    '.gitignore',
    '.prettierignore',
    '*.md',
    'eslint.config.ts',
    'package.json',
    'pnpm-lock.yaml',
    'tsconfig.json',
    'scripts/**/*.ts',
    '**/*/.terraform/',
    '**/*/*.tfstate',
    '**/*/*.tfstate.backup',
    '**/*/terraform.tfvars',
    '**/*/*.tfvars',
    '**/*/crash.log',
    '**/*/*.tfplan',
    '**/*/override.tf',
    '**/*/override.tf.json',
    '**/*/*_override.tf',
    '**/*/*_override.tf.json',
    '**/*/.terraform.lock.hcl',
  ],
  outputFile: 'prompt.md',
})

Then:

pnpm tsx scripts/make-prompt

And there will be a prompt.md file. Change the file path/name to whatever in the code sample above.

Then copy/paste the file into ChatGPT or whatever, telling about your codebase.

Probably won't work for large repos, but for repos with a few dozen files, should work.

You can also add this to your package.json:

{
  "scripts": {
    "make:prompt": "pnpm tsx scripts/make-prompt"
  }
}

Then:

pnpm make:prompt

License

MIT

ClueSurf

This is being developed by the folks at ClueSurf, a California-based project for helping humanity master information and computation. Find us on Twitter, LinkedIn, and Facebook. Check out our other GitHub projects as well!

About

Make your repo into a single file to pass to an AI prompt

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published