ハンドルバーテンプレートを使用して、コードからLLMプロンプトを作成するためのコマンドライン(およびTUI)ツール。
これは錆をブラッシュアップするプロジェクトであり、Code2Promptに基づいて、私が便利だと感じたいくつかの追加の機能を備えています。
コードとコードスニペットをLLMSに手動でコピーして貼り付けて、いくつかの問題があります。
LLMSを最大限に活用するには、プロンプトが明確で包括的で、一貫性がなければなりません。コードがこれらの問題を修正する方法:

このプロジェクトには、さまざまなフラグをオーバーライドし、実行する前にコマンドの構造を確認するための構成ファイルを提供できるオプションのTUIラッパーも含まれています。
CodePromptsコマンドラインツールをダウンロードして使用するには、2つのオプションがあります。リリースバイナリをダウンロードするか、ソースからコンパイルできます。タブの完了の設定など、より詳細な手順については、セットアップガイドを参照してください。
リリースバイナリをダウンロードするには、リリースに移動して、OSのバイナリをダウンロードします。
注:TUIバイナリを使用するには、CLIバイナリをパスに追加する必要があります。
codepromptに変更しますソースから構築するには、git、錆、貨物(錆びた状態で設置されます)が設置される必要があります。
最初にリポジトリをクローンします:
git clone [email protected]:seankim658/codeprompts.gitそして、リリースバイナリをコンパイルします:
cd codeprompts/
cargo build --releaseより詳細な使用ガイドはここにあります。
オプションに関するより広範なドキュメントは、こちらをご覧ください。コードプロンプトコマンドラインツールには、次の引数があります。
Create standardized LLM prompts from your code
Usage: codeprompt [OPTIONS] [PATH] [COMMAND]
Commands:
completion Generate shell completion scripts.
help Print this message or the help of the given subcommand(s)
Arguments:
[PATH] Path to project directory
Options:
--include <INCLUDE> Glob patterns to include
--exclude <EXCLUDE> Glob patterns to exclude
--exclude-priority Change pattern priority in case of conflict to prioritize the exclusion pattern
--exclude-from-tree Eclude files/folders from the source tree based on exclude patterns
--gitignore Don't respect .gitignore file
-d, --diff-staged Capture the git diff for staged changes only (equivalent to running `git diff --cached` or `git diff --staged`
-u, --diff-unstaged Capture the git diff for unstaged changes only (equivalent to running `git diff`)
--no-tokens Don't display approximate token count of the genrated prompt
-c, --encoding <ENCODING> Tokenizer to use for token count [default: cl100k]
-o, --output <OUTPUT> Redirect output to file
-l, --no-line-numbers Turn off line numbers in source code blocks
--no-codeblock Disable wrapping code inside markdown code blocks
--relative-paths Use relative paths instead of absolute paths, including parent directory
--no-clipboard Disable copying to clipboard
-t, --template <TEMPLATE> Optional path to Handlebars template
--no-spinner Whether to render the spinner
--json Whether to print the output as JSON. Defaults to False
--issue <ISSUE> Fetch a specific Github issue for the repository
--verbose Run in verbose mode to investigate glob pattern matching
-h, --help Print help (see more with '--help')
-V, --version Print versionテンプレートは、ハンドルバーと呼ばれる単純なテンプレート言語を使用します。
事前に定義されたテンプレートは、プロジェクトリリースからダウンロードできます。 templates.zipをダウンロードします。
現在、含まれている事前定義されたテンプレートは次のとおりです。
| テンプレート名 | 説明 |
|---|---|
default_template.hbs | これは、プロジェクトパス、ソースツリー、およびコードブロックを構成する単純なデフォルトテンプレートです。 |
documentation_template.hbs | ドキュメントテンプレートは、コードをドキュメントするプロンプトを作成します。ドキュメントガイドラインは、Hive Labのガイドラインおよびドキュメント要件と一致しています。 |
git_commit.hbs | 簡潔で正確なgitコミットメッセージを作成するためのテンプレート。 diff-stagedとdiff-unstagedオプションの両方で使用できます。 |
git_issues.hbs | GitHubの問題に基づいて変更を実装するためのテンプレート。 |
code_optimization.hbs | 時間と空間の複雑さでコードを最適化するためのテンプレート。 |