0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

AIにプロジェクトを丸ごと読み込ませるMarkdownを出力するPowerShellのスクリプト

0
Last updated at Posted at 2026-03-22

はじめに

任意のフォルダのディレクトリ構造とファイル内容を、AIが読みやすいMarkdown形式にまとめてエクスポートするPowerShellのツールです。
AI にローカルのプロジェクトを丸ごと読み込まることができ、コピー&ペーストの手間をなくし、AI の理解精度を向上させることを目的にしています。

機能

  • プロジェクトのディレクトリ構造とファイルをMarkdown形式で出力
  • ディレクトリ構造を階層形式で出力
  • ファイルはコードブロックで出力(コードブロックの言語は拡張子を設定)
  • 出力対象外設定(ディレクトリ / 拡張子 / ファイル名)

使用方法

  1. スクリプトを任意の場所に保存
  2. PowerShell で実行
.\ProjectExporter.ps1

out.md が生成されます。

出力イメージ

# PROJECT STRUCTURE

```text
src/
file1.txt
file2.txt
lib/
  lib1.lib
  proj/
    proj1.txt
```

# PROJECT FILES

## FILE: file1.txt

```txt
Hello world.
```

## FILE: file2.txt

```txt
Sample text.
```

## FILE: lib\lib1.lib

```lib
LIBRARY CONTENTS
```

## FILE: lib\proj\proj1.txt

```txt
proj1
```

設定

スクリプト冒頭で対象ディレクトリや除外設定ができます。

    Set-Variable -Name TARGET_PATH  -Value "." -Option ReadOnly -Scope Script                                   # 対象ディレクトリ
    Set-Variable -Name OUTPUT_FILE  -Value "out.md" -Option ReadOnly -Scope Script                              # 出力ファイル
    Set-Variable -Name EXCLUDE_DIRS -Value @("node_modules", ".git", ".vscode") -Option ReadOnly -Scope Script  # 対象外のディレクトリ
    Set-Variable -Name EXCLUDE_FILE -Value @("FolderExporter.ps1", "out.md") -Option ReadOnly -Scope Script     # 対象外のファイル
    Set-Variable -Name EXCLUDE_EXTS -Value @("*.log") -Option ReadOnly -Scope Script                            # 対象外の拡張子
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?