Skip to content

Instantly share code, notes, and snippets.

@JaosnHsieh
Last active May 16, 2023 04:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JaosnHsieh/c4467f51f94d0e9148481f22ea2c45e8 to your computer and use it in GitHub Desktop.
Save JaosnHsieh/c4467f51f94d0e9148481f22ea2c45e8 to your computer and use it in GitHub Desktop.
save all *.ts and *.tsx code to one file for claude-instant-100k bot to analyze the code

claude-instant-100k

poe.com added a bot that can consume 75,000 words, that can read the code or papers and give suggestions based on it. It's amazing.

print.sh for typescript projects

Code was generated by GPT-4

Save it to print.sh and make it executable chmod +x ./print.sh

$ ./print.sh > all-code would save all *.ts and *.tsxto theall-code` file

print.sh

#!/bin/bash

# Print the tree for .ts and .tsx files using the tree command, excluding .d.ts files and the node_modules directory
tree -I '*.d.ts|node_modules' -P '*.ts' -P '*.tsx' ./

# Print the content of each .ts and .tsx file with the file path, excluding .d.ts files and the node_modules directory
find ./ -type d -name 'node_modules' -prune -o \( -name "*.ts" -o -name "*.tsx" \) ! -name "*.d.ts" -print | while read -r file; do
    echo
    echo "$file"
    echo
    echo "\`\`\`"
    cat "$file"
    echo "\`\`\`"
done

Some prompts I used on for asking the proejct

  1. summarize
summarize the following software code

xxx
  1. how to add a new feature?
based on the previous context, if I would like to add a new feature that "xxxxxx", what files would I have to modify, what functions would be involoed, how can I add this feature?`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment