sheldonify 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/.claude-plugin/plugin.json +8 -0
  2. package/.clinerules +24 -0
  3. package/.cursor/rules/sheldonify.md +24 -0
  4. package/.github/copilot-instructions.md +16 -0
  5. package/.kiro/steering/sheldonify.md +24 -0
  6. package/.openclaw/skills/sheldonify +83 -0
  7. package/.windsurf/rules/sheldonify.md +24 -0
  8. package/AGENTS.md +56 -0
  9. package/LICENSE +191 -0
  10. package/README.md +388 -0
  11. package/bin/sheldonify.js +2 -0
  12. package/codex.md +32 -0
  13. package/dist/classifier.d.ts +7 -0
  14. package/dist/classifier.d.ts.map +1 -0
  15. package/dist/classifier.js +19 -0
  16. package/dist/classifier.js.map +1 -0
  17. package/dist/cli.d.ts +2 -0
  18. package/dist/cli.d.ts.map +1 -0
  19. package/dist/cli.js +158 -0
  20. package/dist/cli.js.map +1 -0
  21. package/dist/config.d.ts +10 -0
  22. package/dist/config.d.ts.map +1 -0
  23. package/dist/config.js +121 -0
  24. package/dist/config.js.map +1 -0
  25. package/dist/duplicates.d.ts +3 -0
  26. package/dist/duplicates.d.ts.map +1 -0
  27. package/dist/duplicates.js +59 -0
  28. package/dist/duplicates.js.map +1 -0
  29. package/dist/executor.d.ts +3 -0
  30. package/dist/executor.d.ts.map +1 -0
  31. package/dist/executor.js +99 -0
  32. package/dist/executor.js.map +1 -0
  33. package/dist/index-generator.d.ts +3 -0
  34. package/dist/index-generator.d.ts.map +1 -0
  35. package/dist/index-generator.js +22 -0
  36. package/dist/index-generator.js.map +1 -0
  37. package/dist/index.d.ts +12 -0
  38. package/dist/index.d.ts.map +1 -0
  39. package/dist/index.js +11 -0
  40. package/dist/index.js.map +1 -0
  41. package/dist/output.d.ts +7 -0
  42. package/dist/output.d.ts.map +1 -0
  43. package/dist/output.js +129 -0
  44. package/dist/output.js.map +1 -0
  45. package/dist/planner.d.ts +3 -0
  46. package/dist/planner.d.ts.map +1 -0
  47. package/dist/planner.js +83 -0
  48. package/dist/planner.js.map +1 -0
  49. package/dist/protected.d.ts +4 -0
  50. package/dist/protected.d.ts.map +1 -0
  51. package/dist/protected.js +74 -0
  52. package/dist/protected.js.map +1 -0
  53. package/dist/scanner.d.ts +8 -0
  54. package/dist/scanner.d.ts.map +1 -0
  55. package/dist/scanner.js +65 -0
  56. package/dist/scanner.js.map +1 -0
  57. package/dist/strategies/by-context.d.ts +9 -0
  58. package/dist/strategies/by-context.d.ts.map +1 -0
  59. package/dist/strategies/by-context.js +104 -0
  60. package/dist/strategies/by-context.js.map +1 -0
  61. package/dist/strategies/by-date.d.ts +6 -0
  62. package/dist/strategies/by-date.d.ts.map +1 -0
  63. package/dist/strategies/by-date.js +23 -0
  64. package/dist/strategies/by-date.js.map +1 -0
  65. package/dist/strategies/by-type.d.ts +6 -0
  66. package/dist/strategies/by-type.d.ts.map +1 -0
  67. package/dist/strategies/by-type.js +65 -0
  68. package/dist/strategies/by-type.js.map +1 -0
  69. package/dist/strategies/custom.d.ts +7 -0
  70. package/dist/strategies/custom.d.ts.map +1 -0
  71. package/dist/strategies/custom.js +31 -0
  72. package/dist/strategies/custom.js.map +1 -0
  73. package/dist/strategies/index.d.ts +3 -0
  74. package/dist/strategies/index.d.ts.map +1 -0
  75. package/dist/strategies/index.js +18 -0
  76. package/dist/strategies/index.js.map +1 -0
  77. package/dist/types.d.ts +125 -0
  78. package/dist/types.d.ts.map +1 -0
  79. package/dist/types.js +2 -0
  80. package/dist/types.js.map +1 -0
  81. package/dist/undo-generator.d.ts +4 -0
  82. package/dist/undo-generator.d.ts.map +1 -0
  83. package/dist/undo-generator.js +65 -0
  84. package/dist/undo-generator.js.map +1 -0
  85. package/dist/utils/fs-helpers.d.ts +6 -0
  86. package/dist/utils/fs-helpers.d.ts.map +1 -0
  87. package/dist/utils/fs-helpers.js +54 -0
  88. package/dist/utils/fs-helpers.js.map +1 -0
  89. package/dist/utils/hash.d.ts +2 -0
  90. package/dist/utils/hash.d.ts.map +1 -0
  91. package/dist/utils/hash.js +12 -0
  92. package/dist/utils/hash.js.map +1 -0
  93. package/dist/utils/media.d.ts +6 -0
  94. package/dist/utils/media.d.ts.map +1 -0
  95. package/dist/utils/media.js +63 -0
  96. package/dist/utils/media.js.map +1 -0
  97. package/dist/utils/platform.d.ts +5 -0
  98. package/dist/utils/platform.d.ts.map +1 -0
  99. package/dist/utils/platform.js +15 -0
  100. package/dist/utils/platform.js.map +1 -0
  101. package/hooks/check-install.js +32 -0
  102. package/hooks/hooks.json +17 -0
  103. package/package.json +67 -0
  104. package/skills/sheldonify/SKILL.md +110 -0
  105. package/skills/sheldonify/references/config-format.md +55 -0
  106. package/skills/sheldonify-scan/SKILL.md +87 -0
  107. package/skills/sheldonify-undo/SKILL.md +45 -0
@@ -0,0 +1,110 @@
1
+ ---
2
+ name: sheldonify
3
+ description: Use this skill when the user asks to "organize files", "sort files", "clean up a directory", "tidy up a folder", "organize my downloads", "sort my desktop", "group files by type", "find duplicate files", or discusses file/folder organization, directory cleanup, or decluttering. Also use when the user mentions "sheldonify" by name.
4
+ version: 0.1.0
5
+ ---
6
+
7
+ # Sheldonify — File & Folder Organizer
8
+
9
+ Sheldonify is a CLI tool that organizes files in a directory by type, context, date, or custom rules. It never deletes data — only moves files into organized folders and generates undo scripts.
10
+
11
+ ## Prerequisites
12
+
13
+ Sheldonify must be installed globally via npm:
14
+
15
+ ```bash
16
+ npm install -g sheldonify
17
+ ```
18
+
19
+ If not installed, offer to install it for the user before proceeding.
20
+
21
+ ## Commands
22
+
23
+ ### Organize by file type (default)
24
+
25
+ ```bash
26
+ sheldonify <directory> --strategy type
27
+ ```
28
+
29
+ Groups files into: `Images/`, `Documents/`, `Code/`, `Videos/`, `Audio/`, `Archives/`, `Fonts/`, `Executables/`, `Data/`, `Design/`, `Other/`, `Misc/`.
30
+
31
+ ### Organize by context/purpose
32
+
33
+ This is the most powerful strategy — it uses filename heuristics and your LLM capabilities together.
34
+
35
+ **Step 1:** Scan the directory to get file metadata with heuristic guesses:
36
+
37
+ ```bash
38
+ sheldonify scan <directory> --json
39
+ ```
40
+
41
+ **Step 2:** Read the JSON output. Files with `heuristicGuess: null` or low confidence need your classification. Classify them based on filename patterns, extensions, and context.
42
+
43
+ **Step 3:** Create a plan JSON file with your classifications:
44
+
45
+ ```json
46
+ {
47
+ "classifications": [
48
+ { "file": "relative/path/to/file.ext", "category": "CategoryName", "reason": "why this category" }
49
+ ]
50
+ }
51
+ ```
52
+
53
+ **Step 4:** Apply the plan:
54
+
55
+ ```bash
56
+ sheldonify apply <directory> --plan plan.json
57
+ ```
58
+
59
+ ### Organize by date
60
+
61
+ ```bash
62
+ sheldonify <directory> --strategy date
63
+ ```
64
+
65
+ Groups into `YYYY/MM-MonthName/` folders based on modification date.
66
+
67
+ ### Organize with custom rules
68
+
69
+ ```bash
70
+ sheldonify <directory> --strategy custom --config rules.json
71
+ ```
72
+
73
+ See the references directory for config file format.
74
+
75
+ ## Important Flags
76
+
77
+ | Flag | Purpose |
78
+ |------|---------|
79
+ | `--dry-run` | Preview changes without executing. **Always use this first.** |
80
+ | `--json` | Structured JSON output — use this for parsing results programmatically |
81
+ | `--depth <n>` | Recursion depth (default: 1, current directory only) |
82
+ | `--config <path>` | Path to a config file |
83
+ | `--verbose` | Detailed logging |
84
+
85
+ ## Workflow
86
+
87
+ 1. **Always start with `--dry-run`** to show the user what will change
88
+ 2. Ask the user to confirm before executing
89
+ 3. After execution, mention the undo scripts (`_sheldonify-undo.sh` / `_sheldonify-undo.ps1`) and the index file (`_sheldonify-index.json`)
90
+
91
+ ## Safety
92
+
93
+ - Sheldonify **never deletes files** — it only moves them
94
+ - Every run generates undo scripts (bash + powershell) and a JSON index
95
+ - Protected folders are automatically skipped: `.git`, `node_modules`, `.venv`, project roots with `package.json`/`Cargo.toml`/etc.
96
+ - Duplicate files are moved to `_duplicates/` with metadata, not deleted
97
+
98
+ ## Handling Uncertain Files
99
+
100
+ When using the context strategy, some files may be flagged as uncertain (confidence < 50%). Present these to the user with the candidate categories and ask which category to use. Then include the user's choice in the classification plan.
101
+
102
+ ## Exit Codes
103
+
104
+ | Code | Meaning |
105
+ |------|---------|
106
+ | 0 | Success |
107
+ | 1 | Runtime error |
108
+ | 2 | Invalid arguments/config |
109
+ | 3 | Target not found |
110
+ | 4 | Nothing to do (already organized) |
@@ -0,0 +1,55 @@
1
+ # Sheldonify Config File Format
2
+
3
+ Place a `sheldonify.config.json` in the target directory, the user's home directory, or pass via `--config`.
4
+
5
+ ## Full Schema
6
+
7
+ ```json
8
+ {
9
+ "strategy": "type",
10
+ "depth": 1,
11
+ "protected": {
12
+ "useDefaults": true,
13
+ "include": ["folder-to-skip"],
14
+ "exclude": ["folder-to-include"]
15
+ },
16
+ "typeStrategy": {
17
+ "extraMappings": { "sketch": "Design", "fig": "Design" },
18
+ "categoryRenames": { "Code": "Source" }
19
+ },
20
+ "contextStrategy": {
21
+ "extraKeywords": { "Tax-Documents": ["tax", "w2", "1099"] }
22
+ },
23
+ "dateStrategy": {
24
+ "dateSource": "modified"
25
+ },
26
+ "customRules": [
27
+ {
28
+ "name": "Tax Documents",
29
+ "match": {
30
+ "extensions": ["pdf"],
31
+ "patterns": ["*tax*", "*w2*"],
32
+ "regex": "tax-\\d{4}"
33
+ },
34
+ "priority": 10
35
+ }
36
+ ]
37
+ }
38
+ ```
39
+
40
+ ## Custom Rules
41
+
42
+ Rules are evaluated in priority order (highest first). A file matches if any condition in `match` is true:
43
+
44
+ - `extensions`: Match file extension (without dot, lowercase)
45
+ - `patterns`: Glob patterns matched against filename (case-insensitive)
46
+ - `regex`: Regular expression matched against the relative file path (case-insensitive)
47
+
48
+ Unmatched files go to `Unsorted/`.
49
+
50
+ ## Protected Folders
51
+
52
+ When `useDefaults` is true, these are automatically skipped:
53
+ `.git`, `.svn`, `.hg`, `node_modules`, `.venv`, `venv`, `__pycache__`, `.idea`, `.vscode`, `.vs`, `vendor`, `bower_components`, `.terraform`, `.serverless`, `.next`, `.nuxt`, `.svelte-kit`, `_duplicates`, all dotfolders, and any folder containing project markers (`package.json`, `Cargo.toml`, `go.mod`, etc.).
54
+
55
+ Use `include` to add more patterns to skip, `exclude` to remove patterns from the default list.
@@ -0,0 +1,87 @@
1
+ ---
2
+ name: sheldonify-scan
3
+ description: Use this skill when the user asks to "scan files", "analyze a directory for organization", "what's in this folder", or wants to preview how sheldonify would classify files before organizing. Also use when the user wants smart context-based classification that uses LLM judgment.
4
+ version: 0.1.0
5
+ ---
6
+
7
+ # Sheldonify Scan — Intelligent File Analysis
8
+
9
+ The scan command extracts rich metadata from files and provides heuristic classification guesses. Use this when you need to analyze a directory before organizing, or when the context strategy needs LLM-powered classification.
10
+
11
+ ## Usage
12
+
13
+ ```bash
14
+ sheldonify scan <directory> --json
15
+ ```
16
+
17
+ ## Output Format
18
+
19
+ The scan outputs JSON with file metadata and heuristic guesses:
20
+
21
+ ```json
22
+ {
23
+ "targetDir": "/path/to/dir",
24
+ "totalFiles": 42,
25
+ "files": [
26
+ {
27
+ "relativePath": "report.pdf",
28
+ "name": "report.pdf",
29
+ "extension": "pdf",
30
+ "size": 1048576,
31
+ "modifiedAt": "2026-06-25T10:00:00Z",
32
+ "createdAt": "2026-01-15T08:30:00Z",
33
+ "media": null,
34
+ "heuristicGuess": {
35
+ "category": "Exports",
36
+ "confidence": 0.8,
37
+ "reason": "filename contains \"report\""
38
+ }
39
+ },
40
+ {
41
+ "relativePath": "data_v2.bin",
42
+ "name": "data_v2.bin",
43
+ "extension": "bin",
44
+ "size": 524288,
45
+ "modifiedAt": "2026-03-10T14:20:00Z",
46
+ "createdAt": "2026-03-10T14:20:00Z",
47
+ "media": null,
48
+ "heuristicGuess": null
49
+ }
50
+ ],
51
+ "uncertainFiles": [
52
+ {
53
+ "file": "data_v2.bin",
54
+ "candidates": [
55
+ { "category": "Unsorted", "confidence": 0.1, "reason": "no context signals found" }
56
+ ]
57
+ }
58
+ ]
59
+ }
60
+ ```
61
+
62
+ ## Your Role as LLM
63
+
64
+ 1. Read the scan output
65
+ 2. For files with `heuristicGuess: null` or low confidence — classify them yourself based on filename, extension, size, dates, and any context the user provides
66
+ 3. For files with high-confidence guesses — accept the heuristic or override if you disagree
67
+ 4. Build a classification plan and apply it:
68
+
69
+ ```bash
70
+ sheldonify apply <directory> --plan plan.json
71
+ ```
72
+
73
+ Plan format:
74
+
75
+ ```json
76
+ {
77
+ "classifications": [
78
+ { "file": "data_v2.bin", "category": "Backups", "reason": "binary data file, likely a backup" },
79
+ { "file": "report.pdf", "category": "Reports", "reason": "report document" }
80
+ ]
81
+ }
82
+ ```
83
+
84
+ ## When to Use Scan vs Direct
85
+
86
+ - **Direct** (`sheldonify . --strategy type`): When organizing by type/date — no LLM needed
87
+ - **Scan + Apply**: When using context strategy, or when the user wants you to make smart classification decisions
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: sheldonify-undo
3
+ description: Use this skill when the user asks to "undo sheldonify", "reverse file organization", "put files back", "restore original layout", or wants to revert changes made by sheldonify.
4
+ version: 0.1.0
5
+ ---
6
+
7
+ # Sheldonify Undo — Reverse File Organization
8
+
9
+ Every sheldonify run generates undo scripts that reverse all file moves. Use this skill to help users revert changes.
10
+
11
+ ## Undo Methods
12
+
13
+ ### Bash (Linux/macOS/WSL)
14
+
15
+ ```bash
16
+ cd <organized-directory>
17
+ bash _sheldonify-undo.sh
18
+ ```
19
+
20
+ ### PowerShell (Windows)
21
+
22
+ ```powershell
23
+ cd <organized-directory>
24
+ .\_sheldonify-undo.ps1
25
+ ```
26
+
27
+ ### Programmatic (using the index)
28
+
29
+ Read `_sheldonify-index.json` and reverse the operations:
30
+
31
+ ```json
32
+ {
33
+ "undo": [
34
+ { "from": "Images/photo.jpg", "to": "photo.jpg" },
35
+ { "from": "Documents/report.pdf", "to": "report.pdf" }
36
+ ]
37
+ }
38
+ ```
39
+
40
+ ## Important Notes
41
+
42
+ - Undo scripts reverse operations in LIFO order (last move undone first)
43
+ - Empty directories created by sheldonify are removed during undo
44
+ - If the user ran sheldonify multiple times, each run has its own undo scripts — the latest run's scripts are in the target directory
45
+ - The undo scripts only reverse file moves — they don't delete the `_sheldonify-index.json` or undo scripts themselves. Clean those up manually after undoing.