Why I built an offline C# tool to turn entire codebases into Obsidian notes and sharable docs

Why I built an offline C# tool to turn entire codebases into Obsidian notes and sharable docs

为什么我开发了一款离线 C# 工具,将整个代码库转换为 Obsidian 笔记和可共享文档

Whenever I finish a sprint, build an architectural spike, or need to hand over reference code to another engineer, I hit the exact same wall: how do I share or archive 15 related files across 4 directories without losing structure? Zipping archives is clumsy, manually creating documentation takes forever, and copy-pasting code snippets into note apps usually breaks path hierarchy. To fix this for my own projects, I built Context Packer — a lightweight, 100% offline desktop tool that aggregates multiple source files into structured, readable Markdown for Obsidian vaults and technical reference sheets.

每当我完成一个冲刺(sprint)、构建一个架构原型(architectural spike),或者需要将参考代码移交给其他工程师时,我总会遇到同一个难题:如何在不丢失结构的情况下共享或归档分布在 4 个目录中的 15 个相关文件?压缩包显得笨拙,手动创建文档耗时太长,而将代码片段复制粘贴到笔记应用中通常会破坏路径层级。为了解决我个人项目中的这些问题,我开发了 Context Packer——一款轻量级、100% 离线的桌面工具,它能将多个源文件聚合为结构化、易读的 Markdown,适用于 Obsidian 库和技术参考文档。

The Problem with Documenting & Sharing Codebases

代码库文档化与共享的痛点

  • Lost File Hierarchy: Sending a colleague five separate .cs or .cpp snippets strips away where they live relative to each other.

  • Accidental Workstation Leaks: Manually copy-pasting paths often leaks private workstation directories (C:\Users<my_user_name>…) into shared team notes.

  • Double Maintenance: Taking snippets into note apps usually requires tedious manual formatting and re-indexing.

  • 文件层级丢失: 给同事发送五个独立的 .cs 或 .cpp 代码片段,会丢失它们之间的相对位置关系。

  • 工作站信息意外泄露: 手动复制粘贴路径时,经常会将私有的工作站目录(如 C:\Users<my_user_name>…)泄露到共享的团队笔记中。

  • 重复维护: 将代码片段存入笔记应用通常需要繁琐的手动格式化和重新索引。

Built for Note-Taking, Reference Docs & Prototyping

专为笔记、参考文档与原型设计打造

Context Packer lets you drag and drop files, directories, or entire solutions straight into a staging area and exports them into clean Markdown:

Context Packer 允许你将文件、目录或整个解决方案直接拖放到暂存区,并将其导出为整洁的 Markdown:

  • Obsidian-Native Vaults: Formats code sections with double-bracket wiki links ([[#File:…]]) so your code snippets instantly hook into Obsidian’s graph view and backlinks.

  • Team Handover & Archive: Generates clean, monolithic reference files with an ASCII directory tree at the top, making it easy to send a complete, readable architectural breakdown in a single text file.

  • LLM Brainstorming (Bonus Use Case): Because the output is structured Markdown, it doubles as the ideal prompt bundle when you need to brainstorm architecture, prototype an idea, or draft initial documentation using Claude or ChatGPT.

  • Workstation Privacy Sanitization: Automatically masks your local Windows usernames to [REDACTED] in filepaths and headers before exporting, keeping your environment confidential.

  • Obsidian 原生库支持: 使用双括号 Wiki 链接([[#File:…]])格式化代码段,使你的代码片段能立即接入 Obsidian 的图谱视图和反向链接。

  • 团队移交与归档: 生成整洁、单一的参考文件,并在顶部附带 ASCII 目录树,方便通过单个文本文件发送完整且易读的架构分析。

  • LLM 头脑风暴(额外用途): 由于输出是结构化的 Markdown,当你需要使用 Claude 或 ChatGPT 进行架构头脑风暴、原型设计或起草初步文档时,它也是理想的提示词包。

  • 工作站隐私脱敏: 在导出前,自动将文件路径和标题中的本地 Windows 用户名掩码为 [REDACTED],确保你的环境保密。

Architecture & Native Performance

架构与原生性能

I didn’t want a heavy web wrapper running in the background while coding. The architecture is native C#:

我不希望在编码时后台运行沉重的 Web 封装程序。该工具采用原生 C# 架构:

  • Packer.Core (.NET 8 / .NET Standard 2.0): Recursive scanning, intelligent extension filtering (including presets for Unreal Engine, Visual Studio, C++, C#, and configs), and automatic chunking for payloads over 3 million characters.

  • Zero Telemetry & 100% Offline: The binary makes zero network calls. Your proprietary code stays strictly on your local disk.

  • Two Native Frontends: A standalone WinUI 3 desktop application for drag-and-drop from Windows File Explorer, and a Visual Studio 2022 extension docked directly beside Solution Explorer.

  • Packer.Core (.NET 8 / .NET Standard 2.0): 支持递归扫描、智能扩展名过滤(包括针对 Unreal Engine、Visual Studio、C++、C# 和配置文件的预设),并能为超过 300 万字符的负载自动分块。

  • 零遥测与 100% 离线: 二进制文件不进行任何网络调用。你的专有代码严格保留在本地磁盘上。

  • 两个原生前端: 一个用于从 Windows 文件资源管理器拖放的独立 WinUI 3 桌面应用程序,以及一个直接停靠在解决方案资源管理器旁边的 Visual Studio 2022 扩展。

Try it out & What’s Next

试用与未来规划

The precompiled binaries (WinUI App, VS Extension, and Headless DLL) are 100% free for both personal and commercial projects:

预编译的二进制文件(WinUI 应用、VS 扩展和 Headless DLL)对个人和商业项目均 100% 免费:

Next on the development roadmap is Extended Obsidian Templates (native callouts like [!note], [!warning], and YAML metadata frontmatter) and a Custom Secret Shield to catch accidental API keys. If you maintain reference notes or tech wikis for your code, I’d love to hear what formatting templates you find most useful!

开发路线图的下一步是扩展 Obsidian 模板(支持原生标注如 [!note]、[!warning] 以及 YAML 元数据前言),并加入自定义密钥防护(Secret Shield)以捕获意外泄露的 API 密钥。如果你平时会为代码维护参考笔记或技术维基,我很乐意听听你觉得哪些格式模板最有用!

AI Disclosure: The underlying codebase, architecture, and logic are 100% handcrafted and tested in C# by Kadmium. Product copy and documentation phrasing were refined with AI assistance to keep technical descriptions clear and concise.

AI 披露: 底层代码库、架构和逻辑均由 Kadmium 使用 C# 100% 手工编写和测试。产品文案和文档措辞在 AI 的辅助下进行了润色,以确保技术描述清晰简洁。