# our-gdrive-organizer

CLI + Claude skill for organizing OurDigital Google Drive folders.

## Purpose

Generalize the README-index-refresh pattern (originally built for
`02_SEO in Action/`) so it works on any 2nd-level subfolder of the user's
Google Drive Stream. Adds:

- Per-subfolder `README.md` meta files (with AUTO-STRUCTURE blocks)
- Proposed filename normalization (`D.intelligence` → `OurDigital`)
- Proposed file moves for cluttered roots (screenshots, temp downloads)
- Sensitive-folder skip list so client archives are never touched

## Activation

- **As a Claude Code skill**: triggered by phrases like "organize the Drive
  folder", "refresh the index", "/organize", or "/our-gdrive-organizer".
- **As a CLI tool**: run `our-gdrive-organize [TARGET]` from any terminal.

## Structure

```
our-gdrive-organizer/
├── code/
│   ├── SKILL.md          # Claude Code skill definition
│   └── organizer.py      # Main Python CLI (stdlib only)
├── desktop/
│   └── SKILL.md          # Claude Desktop skill definition
├── shared/
│   └── conventions.md    # Canonical naming convention spec
├── docs/
│   └── CHANGELOG.md
└── README.md             # ← you are here
```

## Install

The repository expects two symlinks:

```bash
# Skill discovery for Claude Code
ln -s ~/Project/our-claude-skills/custom-skills/our-gdrive-organizer/code \
      ~/.claude/skills/our-gdrive-organizer

# CLI on PATH
ln -s ~/Project/our-claude-skills/custom-skills/our-gdrive-organizer/code/organizer.py \
      ~/.local/bin/our-gdrive-organize
```

A slash-command alias lives at `~/.claude/commands/organize.md`.

## Usage

```bash
# Dry-run report (default — never modifies files except writing the README)
our-gdrive-organize ~/Library/CloudStorage/GoogleDrive-*/My\ Drive/02_SEO\ in\ Action

# Apply all proposed renames + moves
our-gdrive-organize <TARGET> --apply

# Only refresh the root README index
our-gdrive-organize <TARGET> --scope index

# Only ensure each top-level subfolder has a README with AUTO block
our-gdrive-organize <TARGET> --scope subreadmes

# Only propose renames (still requires --apply to execute)
our-gdrive-organize <TARGET> --scope rename

# Machine-readable output
our-gdrive-organize <TARGET> --json
```

## Conventions

See `shared/conventions.md` for the full naming and structure spec. The
script's rules (`RENAME_RULES`, `MOVE_RULES`, `SENSITIVE_SUBFOLDER_PATTERNS`)
in `code/organizer.py` are the source of truth for what's actually enforced;
keep them in sync with `conventions.md`.

## What it never touches

- Files inside `04_Case Studies/`, `99_Project Archive/`, any `*Archive*`
  folder, or any folder starting with `진단` (real client material).
- The manually-curated Topics / Notes sections of the root README.
- Cell content of `.gsheet` / body of `.gdoc` / slides of `.gslides` —
  filesystem renames only change the local stub filename.

## Requirements

- Python 3.9+ (uses `from __future__ import annotations`, dataclasses, pathlib)
- macOS (paths assume Google Drive Cloud Storage at
  `~/Library/CloudStorage/GoogleDrive-*/My Drive/`); easily adapted for other
  OSes by changing the target path.
