@edcalderon/versioning 1.1.2 → 1.3.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 (29) hide show
  1. package/README.md +83 -17
  2. package/dist/extensions/cleanup-repo/index.d.ts +49 -0
  3. package/dist/extensions/cleanup-repo/index.js +649 -0
  4. package/dist/extensions/lifecycle-hooks/index.d.ts +4 -0
  5. package/dist/extensions/{lifecycle-hooks.js → lifecycle-hooks/index.js} +1 -1
  6. package/dist/extensions/npm-publish/index.d.ts +4 -0
  7. package/dist/extensions/{npm-publish.js → npm-publish/index.js} +1 -1
  8. package/dist/extensions/reentry-status/config-manager.js +3 -1
  9. package/dist/extensions/reentry-status/constants.d.ts +1 -1
  10. package/dist/extensions/reentry-status/constants.js +1 -1
  11. package/dist/extensions/reentry-status/extension.d.ts +4 -0
  12. package/dist/extensions/{reentry-status-extension.js → reentry-status/extension.js} +165 -18
  13. package/dist/extensions/reentry-status/git-context.d.ts +27 -0
  14. package/dist/extensions/reentry-status/git-context.js +94 -0
  15. package/dist/extensions/reentry-status/index.d.ts +3 -0
  16. package/dist/extensions/reentry-status/index.js +6 -0
  17. package/dist/extensions/reentry-status/roadmap-renderer.d.ts +7 -0
  18. package/dist/extensions/reentry-status/roadmap-renderer.js +27 -10
  19. package/dist/extensions/sample-extension/index.d.ts +4 -0
  20. package/dist/extensions/{sample-extension.js → sample-extension/index.js} +1 -1
  21. package/dist/extensions/secrets-check/index.d.ts +16 -0
  22. package/dist/extensions/secrets-check/index.js +264 -0
  23. package/dist/extensions.js +27 -15
  24. package/dist/versioning.d.ts +1 -0
  25. package/package.json +2 -2
  26. package/dist/extensions/lifecycle-hooks.d.ts +0 -4
  27. package/dist/extensions/npm-publish.d.ts +0 -4
  28. package/dist/extensions/reentry-status-extension.d.ts +0 -4
  29. package/dist/extensions/sample-extension.d.ts +0 -4
package/README.md CHANGED
@@ -11,7 +11,9 @@ A comprehensive versioning and changelog management tool designed for monorepos
11
11
  - 📦 NPM publishable
12
12
  - 🏷️ Git tagging and committing
13
13
  - ✅ Validation of version sync
14
- - 🔌 **Extensible plugin system** for custom business logic
14
+ - 🔌 **Extensible plugin system** for subdirectory-based extensions
15
+ - 🔒 **Security Checks** with automatic Husky integration
16
+ - 🧹 **Repository Cleanup** to keep root directory organized
15
17
 
16
18
  ## Installation
17
19
 
@@ -33,7 +35,7 @@ The versioning tool supports a **composable extension system** that allows you t
33
35
  - Implement custom versioning strategies
34
36
 
35
37
  Extensions are loaded automatically from:
36
- - Built-in extensions in the `src/extensions/` directory
38
+ - Built-in extensions in subdirectories of `src/extensions/` (e.g. `src/extensions/reentry-status/index.ts`)
37
39
  - External packages listed in `versioning.config.json`
38
40
 
39
41
  ### Creating Extensions
@@ -113,7 +115,7 @@ Features:
113
115
  - Local registry support
114
116
  - Dry-run mode
115
117
 
116
- #### Re-entry Status + Roadmap Extension
118
+ ### Re-entry Status + Roadmap Extension
117
119
 
118
120
  Maintains a fast **re-entry** layer (current state + next micro-step) and a slow **roadmap/backlog** layer (long-term plan).
119
121
 
@@ -129,39 +131,103 @@ Multi-project (scoped by `--project <name>`):
129
131
  - `.versioning/projects/<project>/REENTRY.md`
130
132
  - `.versioning/projects/<project>/ROADMAP.md`
131
133
 
132
- Notes:
133
- - `--project` must match an existing workspace app/package (it can be a slug like `trader`, a scoped package name like `@ed/trader`, or a path like `apps/trader`).
134
- - The canonical project key is the last path segment (e.g. `@ed/trader` → `trader`).
134
+ **Smart Features:**
135
+ - **Auto-Update:** `versioning reentry update` infers the project phase and next step from your last git commit.
136
+ - `feat: ...` **Phase: development**
137
+ - `fix: ...` → **Phase: maintenance**
138
+ - **Git Context:** Automatically links status to the latest branch, commit, and author.
135
139
 
136
140
  Commands:
137
141
 
138
142
  ```bash
139
143
  # Fast layer
140
144
  versioning reentry init
145
+ versioning reentry update # Auto-update status from git commit
146
+ versioning reentry show # Show current status summary
141
147
  versioning reentry sync
142
148
 
143
149
  # Fast layer (scoped)
144
150
  versioning reentry init --project trader
145
- versioning reentry sync --project trader
151
+ versioning reentry update --project trader
152
+ versioning reentry show --project trader
146
153
 
147
154
  # Slow layer
148
155
  versioning roadmap init --title "My Project"
149
156
  versioning roadmap list
150
157
  versioning roadmap set-milestone --id "now-01" --title "Ship X"
151
- versioning roadmap add --section Now --id "now-02" --item "Add observability"
158
+ ```
159
+
160
+ #### Cleanup Repo Extension
161
+
162
+ Keeps your repository root clean by organizing stray files into appropriate directories (docs, scripts, config, archive).
163
+
164
+ Features:
165
+ - **Smart Scanning:** Identifies files that don't belong in the root.
166
+ - **Configurable Routes:** Map extensions to folders (e.g. `.sh` → `scripts/`).
167
+ - **Safety:** Allowlist for root files and Denylist for forced moves.
168
+ - **Husky Integration:** Auto-scan or auto-move on commit.
169
+
170
+ Commands:
171
+
172
+ ```bash
173
+ versioning cleanup scan # Dry-run scan of root
174
+ versioning cleanup move # Move files to configured destinations
175
+ versioning cleanup restore # Restore a moved file
176
+ versioning cleanup config # View/manage configuration
177
+ versioning cleanup husky # Setup git hook (scan-only by default)
178
+ ```
152
179
 
153
- # Slow layer (scoped)
154
- versioning roadmap init --project trader --title "Trader"
155
- versioning roadmap list --project trader
156
- versioning roadmap add --project trader --section Now --item "Wire user-data ORDER_* events"
180
+ Configuration (`versioning.config.json`):
157
181
 
158
- # Detect stale/mismatched scoped roadmaps
159
- versioning roadmap validate
182
+ ```json
183
+ {
184
+ "extensionConfig": {
185
+ "cleanup-repo": {
186
+ "enabled": true,
187
+ "defaultDestination": "docs",
188
+ "allowlist": ["CHANGELOG.md"],
189
+ "routes": {
190
+ ".sh": "scripts",
191
+ ".json": "config"
192
+ }
193
+ }
194
+ }
195
+ }
160
196
  ```
161
197
 
162
- Backward compatibility:
163
- - v1.0 status files load safely.
164
- - Schema migrates to v1.1 only when you actually modify status, or explicitly via `versioning reentry sync --migrate`.
198
+ #### Secrets Check Extension
199
+
200
+ Prevents sensitive data (private keys, tokens, mnemonics) from being committed to the repository.
201
+
202
+ Features:
203
+ - **Pre-defined Patterns:** Detects AWS, GitHub, NPM tokens, private keys, and EVM mnemonics.
204
+ - **Allowlist:** Ignore false positives or specific test keys.
205
+ - **Husky Integration:** Easy CLI setup to block commits containing secrets.
206
+
207
+ Commands:
208
+
209
+ ```bash
210
+ versioning check-secrets # Scan staged files for secrets
211
+ versioning check-secrets husky # Add blocking secrets check to pre-commit hook
212
+ ```
213
+
214
+ Configuration (`versioning.config.json`):
215
+
216
+ ```json
217
+ {
218
+ "extensionConfig": {
219
+ "secrets-check": {
220
+ "enabled": true,
221
+ "patterns": [
222
+ "CUSTOM_API_KEY=[0-9a-f]{32}"
223
+ ],
224
+ "allowlist": [
225
+ "ETHERSCAN_API_KEY=YOUR_KEY"
226
+ ]
227
+ }
228
+ }
229
+ }
230
+ ```
165
231
 
166
232
  ### External Extensions
167
233
 
@@ -0,0 +1,49 @@
1
+ import { VersioningExtension } from '../../extensions';
2
+ /**
3
+ * The canonical cleanup configuration schema.
4
+ * Everything the plugin needs lives here.
5
+ */
6
+ export interface CleanupRepoConfig {
7
+ /** Master switch. Default: true */
8
+ enabled: boolean;
9
+ /** Default destination for files without a specific route. Default: "docs" */
10
+ defaultDestination: string;
11
+ /**
12
+ * Files explicitly allowed to stay in root (on top of built-in essentials).
13
+ * Supports exact filenames and glob-like patterns (e.g. "*.config.js").
14
+ */
15
+ allowlist: string[];
16
+ /**
17
+ * Files that should ALWAYS be moved, even if they match the allowlist.
18
+ * Useful for forcing cleanup of specific known offenders.
19
+ */
20
+ denylist: string[];
21
+ /**
22
+ * File extensions to consider for cleanup (with leading dot).
23
+ * Default: [".md", ".sh", ".json", ".yaml", ".yml", ".txt", ".log"]
24
+ */
25
+ extensions: string[];
26
+ /**
27
+ * Mapping of file extension → destination directory.
28
+ * Overrides defaultDestination per extension.
29
+ */
30
+ routes: Record<string, string>;
31
+ /**
32
+ * Husky integration settings.
33
+ */
34
+ husky: {
35
+ enabled: boolean;
36
+ /** Which husky hook to attach to. Default: "pre-commit" */
37
+ hook: string;
38
+ /** "scan" = warning only, "enforce" = auto-move + git add. Default: "scan" */
39
+ mode: 'scan' | 'enforce';
40
+ };
41
+ }
42
+ declare const BUILTIN_ALLOWLIST: Set<string>;
43
+ declare const DEFAULT_EXTENSIONS: string[];
44
+ declare const DEFAULT_ROUTES: Record<string, string>;
45
+ declare function loadCleanupConfig(rootConfig: any): CleanupRepoConfig;
46
+ declare const extension: VersioningExtension;
47
+ export { loadCleanupConfig, BUILTIN_ALLOWLIST, DEFAULT_EXTENSIONS, DEFAULT_ROUTES };
48
+ export default extension;
49
+ //# sourceMappingURL=index.d.ts.map