24 Commits
Author SHA1 Message Date
bartal-lsn b1dd808d1e add python support 2026-08-29 21:58:16 +01:00
bartal-lsn d247095e87 fix(drive cli)!: delete remote flag changed 2026-08-28 14:08:58 +01:00
bartal-lsn 66579d068d webm 2026-08-28 01:14:26 +01:00
bartal-lsn 4c14ef2cee webm 2026-08-28 01:10:37 +01:00
bartal-lsn 0f94e50746 webm 2026-08-28 01:07:41 +01:00
bartal-lsn c9aa028b3c webm 2026-08-28 01:01:49 +01:00
bartal-lsn bca125cb92 Update README.md 2026-08-28 00:50:13 +01:00
bartal-lsn 7d73901631 Update README.md 2026-08-28 00:49:26 +01:00
bartal-lsn 6663cb25f8 webm 2026-08-28 00:42:23 +01:00
bartal-lsn 8a28364839 Update README.md 2026-08-28 00:38:34 +01:00
bartal-lsn 894f97820e webm 2026-08-28 00:37:43 +01:00
bartal-lsn fb646a94be Update README.md 2026-08-28 00:32:49 +01:00
bartal-lsn 4bcae1358d Update README.md 2026-08-28 00:32:33 +01:00
bartal-lsn 2428a33046 Update README.md 2026-08-28 00:31:40 +01:00
bartal-lsn a48fe55d4b Update README.md 2026-08-28 00:29:47 +01:00
bartal-lsn 0df346dbf9 Update README.md 2026-08-28 00:29:18 +01:00
bartal-lsn d7f4c6826b Update README.md 2026-08-28 00:27:34 +01:00
bartal-lsn 79be211df3 test 2026-08-28 00:26:00 +01:00
bartal-lsn ba87d6184b test webm 2026-08-28 00:24:20 +01:00
bartal-lsn 180c3f0eba test webm 2026-08-28 00:19:24 +01:00
bartal-lsn be0c761cb3 fix bugs 2026-08-28 00:06:14 +01:00
bartal-lsn 4ebf3bd60f delete redundant docs 2026-08-27 23:04:07 +01:00
bartal-lsn 63547e74c2 add how to install 2026-08-27 22:44:53 +01:00
bartal-lsn 79b630b622 add how to install 2026-08-27 22:43:22 +01:00
10 changed files with 43 additions and 48 deletions
+9
View File
@@ -2,6 +2,8 @@
Generate markdown documentation from directory structure. Optimized for LLM ingestion.
<video src="./docs/videos/dirmd.webm" autoplay loop muted playsinline></video>
## Features
- Recursive directory traversal
@@ -17,6 +19,13 @@ Generate markdown documentation from directory structure. Optimized for LLM inge
- Frontend only mode (include only frontend files and `README.md`)
- Omit test files and inline test blocks (Go, Java, Rust)
## Installation
Only for linux.
Download binary from release page or install with go
```bash
go install git.flo.fo/FLO/dirmd@latest
```
## Use with Git Post Hook
combine with git post hook to sync with proton drive on each commit
-2
View File
@@ -173,8 +173,6 @@ func run(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to resolve output path: %w", err)
}
absOutput = filepath.Join(filepath.Dir(absOutput), filepath.Base(absOutput)+"_dirmd")
if !appendMode {
if _, err := os.Stat(absOutput); err == nil && !force {
return fmt.Errorf("output directory %s already exists (use -f to overwrite)", absOutput)
@@ -1,24 +0,0 @@
# Automating sending files to proton drive on commits
If you add this to any repos, and have dirmd in path and logged in on proton drive cli, then after each commit the newest code is pushed to proton drive, as vertical slices. If you do not want vertical slices of the code omit --vertical-slices. Also check out the other flags of dirmd if required.
## repos-root/.git/hooks/post-commit
create this file
```sh
#!/bin/bash
set -euo pipefail
if ! command -v dirmd &>/dev/null; then
exit 0
fi
REPO_ROOT=$(git rev-parse --show-toplevel)
REPO_NAME=$(basename "$REPO_ROOT")
dirmd -o "/tmp/${REPO_NAME}_new" "$REPO_ROOT" -f --vertical-slices --proton-drive
```
and then make it executable with something like `chmod +x .git/hooks/post-commit`
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 522 KiB

Binary file not shown.
Binary file not shown.
+4
View File
@@ -28,6 +28,9 @@ var DefaultIgnores = []string{
".idea",
".vscode",
"dependency-reduced-pom.xml",
"__pycache__",
"venv",
"env",
}
var DefaultExts = []string{
@@ -43,6 +46,7 @@ var DefaultExts = []string{
".jar",
".war",
".ear",
".pyc", ".pyo",
}
var FrontendExts = []string{
+17 -11
View File
@@ -30,7 +30,6 @@ func CheckAuth() error {
return nil
}
// EnsureRemoteParent creates the parent remote directory if it doesn't exist.
func EnsureRemoteParent(remoteDir string) error {
binary, err := Lookup()
if err != nil {
@@ -38,37 +37,45 @@ func EnsureRemoteParent(remoteDir string) error {
}
parentDir := filepath.Dir(remoteDir)
// Try create-folder on the grandparent for the parent
grandparent := filepath.Dir(parentDir)
parentName := filepath.Base(parentDir)
cmd := exec.Command(binary, "filesystem", "create-folder", grandparent, parentName)
cmd.Stdout = nil
cmd.Stderr = nil
cmd.Run() // Ignore errors — folder may already exist
cmd.Run()
return nil
}
// UploadDir uploads an entire local directory to Proton Drive.
// The local directory's basename becomes the remote directory name.
func CleanRemote(remoteDir string) {
binary, err := Lookup()
if err != nil {
return
}
cmd := exec.Command(binary, "filesystem", "delete", remoteDir)
cmd.Stdout = nil
cmd.Stderr = nil
cmd.Run()
}
func UploadDir(localDir, remoteDir string) error {
binary, err := Lookup()
if err != nil {
return fmt.Errorf("proton-drive not found in PATH: %w", err)
}
// Ensure parent of remote dir exists
if err := EnsureRemoteParent(remoteDir); err != nil {
return fmt.Errorf("cannot prepare remote directory: %w", err)
}
// Upload to parent — the local dir's basename creates the remote dir
CleanRemote(remoteDir)
remoteParent := filepath.Dir(remoteDir)
cmd := exec.Command(binary, "filesystem", "upload", localDir, remoteParent,
"--conflict-strategy", "replace")
"--folder-conflict-strategy", "replace", "--file-conflict-strategy", "replace")
var stderr strings.Builder
cmd.Stderr = &stderr
@@ -80,7 +87,6 @@ func UploadDir(localDir, remoteDir string) error {
return nil
}
// Upload uploads a single local file to a remote path on Proton Drive.
func Upload(localPath, remotePath string) error {
binary, err := Lookup()
if err != nil {
@@ -111,7 +117,7 @@ func Upload(localPath, remotePath string) error {
func runUpload(binary, localPath, remoteDir string) error {
cmd := exec.Command(binary, "filesystem", "upload", localPath, remoteDir,
"--conflict-strategy", "replace")
"--folder-conflict-strategy", "replace", "--file-conflict-strategy", "replace")
var stderr strings.Builder
cmd.Stderr = &stderr
+10
View File
@@ -99,6 +99,16 @@ func isTestFile(path, name string) bool {
}
slashPath := filepath.ToSlash(path)
return strings.Contains(slashPath, "/src/test/")
case ".py":
lower := strings.ToLower(name)
if strings.HasPrefix(lower, "test_") || strings.HasSuffix(lower, "_test.py") {
return true
}
if strings.EqualFold(name, "conftest.py") {
return true
}
slashPath := filepath.ToSlash(path)
return strings.Contains(slashPath, "/tests/")
}
return false
-8
View File
@@ -89,18 +89,10 @@ func Generate(cfg *config.Config) GenerateResult {
return result
}
if cfg.VerticalSlices {
if err := drive.UploadDir(cfg.OutputPath, remoteDir); err != nil {
result.Error = fmt.Errorf("drive upload: %w", err)
return result
}
} else {
indexPath := filepath.Join(cfg.OutputPath, "index_"+repoName+".md")
if err := drive.Upload(indexPath, remoteDir); err != nil {
result.Error = fmt.Errorf("drive upload: %w", err)
return result
}
}
result.Uploaded = true
}