@utilarium/dreadcabinet 0.0.16-dev.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.
- package/.nvmrc +2 -0
- package/LICENSE +190 -0
- package/README.md +95 -0
- package/dist/configure.d.ts +5 -0
- package/dist/configure.js +44 -0
- package/dist/configure.js.map +1 -0
- package/dist/constants.d.ts +36 -0
- package/dist/constants.js +53 -0
- package/dist/constants.js.map +1 -0
- package/dist/defaults.d.ts +2 -0
- package/dist/defaults.js +32 -0
- package/dist/defaults.js.map +1 -0
- package/dist/dreadcabinet.cjs +1793 -0
- package/dist/dreadcabinet.cjs.map +1 -0
- package/dist/dreadcabinet.d.ts +131 -0
- package/dist/dreadcabinet.js +111 -0
- package/dist/dreadcabinet.js.map +1 -0
- package/dist/error/ArgumentError.d.ts +5 -0
- package/dist/error/ArgumentError.js +26 -0
- package/dist/error/ArgumentError.js.map +1 -0
- package/dist/input/input.d.ts +7 -0
- package/dist/input/input.js +13 -0
- package/dist/input/input.js.map +1 -0
- package/dist/input/process.d.ts +5 -0
- package/dist/input/process.js +36 -0
- package/dist/input/process.js.map +1 -0
- package/dist/input/structured.d.ts +15 -0
- package/dist/input/structured.js +324 -0
- package/dist/input/structured.js.map +1 -0
- package/dist/input/unstructured.d.ts +2 -0
- package/dist/input/unstructured.js +45 -0
- package/dist/input/unstructured.js.map +1 -0
- package/dist/logger.d.ts +2 -0
- package/dist/logger.js +19 -0
- package/dist/logger.js.map +1 -0
- package/dist/operate.d.ts +2 -0
- package/dist/operate.js +27 -0
- package/dist/operate.js.map +1 -0
- package/dist/output.d.ts +7 -0
- package/dist/output.js +99 -0
- package/dist/output.js.map +1 -0
- package/dist/read.d.ts +4 -0
- package/dist/read.js +30 -0
- package/dist/read.js.map +1 -0
- package/dist/util/dates.d.ts +60 -0
- package/dist/util/dates.js +699 -0
- package/dist/util/dates.js.map +1 -0
- package/dist/util/storage.d.ts +33 -0
- package/dist/util/storage.js +140 -0
- package/dist/util/storage.js.map +1 -0
- package/dist/validate.d.ts +4 -0
- package/dist/validate.js +134 -0
- package/dist/validate.js.map +1 -0
- package/guide/architecture.md +60 -0
- package/guide/configuration.md +132 -0
- package/guide/development.md +110 -0
- package/guide/index.md +62 -0
- package/guide/usage.md +166 -0
- package/output/kodrdriv/250703-0645-commit-message.md +21 -0
- package/output/kodrdriv/250703-0653-commit-message.md +1 -0
- package/output/kodrdriv/250703-0654-commit-message.md +1 -0
- package/output/kodrdriv/250703-0655-release-notes.md +51 -0
- package/output/kodrdriv/250703-0700-commit-message.md +1 -0
- package/output/kodrdriv/250703-0700-release-notes.md +8 -0
- package/output/kodrdriv/250703-0706-commit-message.md +1 -0
- package/output/kodrdriv/250703-0706-release-notes.md +11 -0
- package/output/kodrdriv/250703-0717-commit-message.md +1 -0
- package/output/kodrdriv/250703-0719-commit-message.md +1 -0
- package/output/kodrdriv/250703-0719-release-notes.md +17 -0
- package/output/kodrdriv/250703-0730-commit-message.md +1 -0
- package/output/kodrdriv/250703-0730-release-notes.md +11 -0
- package/output/kodrdriv/250703-1510-commit-message.md +1 -0
- package/output/kodrdriv/250710-0805-commit-message.md +3 -0
- package/output/kodrdriv/250710-0815-commit-message.md +1 -0
- package/output/kodrdriv/250710-0815-release-notes.md +39 -0
- package/output/kodrdriv/260107-2021-commit-message.md +37 -0
- package/output/kodrdriv/260108-0432-commit-message.md +6 -0
- package/output/kodrdriv/260108-0435-commit-message.md +3 -0
- package/output/kodrdriv/260108-0436-commit-message.md +4 -0
- package/output/kodrdriv/260108-0439-release-notes.md +63 -0
- package/output/kodrdriv/260108-0543-commit-message.md +19 -0
- package/output/kodrdriv/260108-0550-commit-message.md +3 -0
- package/output/kodrdriv/260108-0550-release-notes.md +19 -0
- package/output/kodrdriv/260108-0600-commit-message.md +3 -0
- package/output/kodrdriv/260110-0717-commit-message.md +4 -0
- package/output/kodrdriv/260110-1152-commit-message.md +1 -0
- package/output/kodrdriv/260110-1850-commit-message.md +1 -0
- package/output/kodrdriv/260110-1852-release-notes.md +33 -0
- package/output/kodrdriv/260112-2257-commit-message.md +5 -0
- package/output/kodrdriv/260112-2317-commit-message.md +1 -0
- package/output/kodrdriv/260112-2318-release-notes.md +42 -0
- package/output/kodrdriv/260113-0053-commit-message.md +1 -0
- package/output/kodrdriv/260113-0054-commit-message.md +1 -0
- package/output/kodrdriv/260113-0054-release-notes.md +49 -0
- package/output/kodrdriv/260130-1132-commit-message.md +1 -0
- package/output/kodrdriv/260130-1135-commit-message.md +1 -0
- package/output/kodrdriv/260130-1335-commit-message.md +10 -0
- package/output/kodrdriv/RELEASE_NOTES.md +47 -0
- package/output/kodrdriv/RELEASE_TITLE.md +1 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-08T04-21-54-623Z.md +372 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-08T12-32-36-513Z.md +55 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-08T12-35-58-580Z.md +105 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-08T12-36-05-658Z.md +53 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-08T13-43-55-498Z.md +178 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-08T13-50-10-230Z.md +53 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-08T13-50-35-136Z.md +52 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-08T14-00-30-772Z.md +52 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-10T15-17-43-324Z.md +53 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-10T19-52-47-424Z.md +97 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-11T02-50-23-123Z.md +138 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-11T02-50-45-038Z.md +114 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-11T02-50-49-467Z.md +114 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-13T06-57-00-384Z.md +169 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-13T07-17-29-292Z.md +114 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-13T07-17-47-579Z.md +114 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-13T08-48-55-599Z.md +144 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-13T08-53-53-725Z.md +114 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-13T08-54-11-600Z.md +97 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-30T19-32-17-053Z.md +174 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-30T19-35-00-887Z.md +152 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-30T21-02-16-553Z.md +236 -0
- package/output/kodrdriv/agentic-reflection-commit-2026-01-30T21-17-22-227Z.md +347 -0
- package/output/kodrdriv/agentic-reflection-release-2026-01-08T12-39-08-279Z.md +507 -0
- package/output/kodrdriv/agentic-reflection-release-2026-01-08T13-50-57-683Z.md +183 -0
- package/output/kodrdriv/agentic-reflection-release-2026-01-11T02-52-39-082Z.md +347 -0
- package/output/kodrdriv/agentic-reflection-release-2026-01-13T07-18-21-218Z.md +315 -0
- package/output/kodrdriv/agentic-reflection-release-2026-01-13T08-54-59-340Z.md +354 -0
- package/package.json +80 -0
package/.nvmrc
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2025 Tim O'Brien
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# DreadCabinet
|
|
2
|
+
|
|
3
|
+
> A powerful tool that brings order to your digital chaos, one file at a time!
|
|
4
|
+
> Organize, rename, and transform your notes or files based on date, subject, and other metadata—all within your own CLI applications.
|
|
5
|
+
|
|
6
|
+
## Features
|
|
7
|
+
|
|
8
|
+
- **Date-based organization** – Place files into folders by year, month, or day (or no structure at all).
|
|
9
|
+
- **Flexible filename generation** – Include date, time, and a subject in filenames.
|
|
10
|
+
- **Recursion** – Process all subdirectories (or just the top level) as you prefer.
|
|
11
|
+
- **Timezone support** – Convert file timestamps or metadata to a specific timezone for naming.
|
|
12
|
+
- **Extension filtering** – Restrict processing to certain file types.
|
|
13
|
+
- **No destructive operations** – Original files remain untouched; DreadCabinet only creates copies in a new directory structure.
|
|
14
|
+
- **Concurrent processing** – Process multiple files in parallel for improved performance.
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```console
|
|
19
|
+
npm install @utilarium/dreadcabinet
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
*Or with other package managers:*
|
|
23
|
+
|
|
24
|
+
```console
|
|
25
|
+
# yarn
|
|
26
|
+
yarn add @utilarium/dreadcabinet
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Quick Start
|
|
30
|
+
|
|
31
|
+
DreadCabinet is a library designed to be integrated into your own CLI tools. Here's a basic example:
|
|
32
|
+
|
|
33
|
+
```javascript
|
|
34
|
+
import { Command } from 'commander';
|
|
35
|
+
import * as DreadCabinet from '@utilarium/dreadcabinet';
|
|
36
|
+
|
|
37
|
+
// Create a new instance with options
|
|
38
|
+
const instance = DreadCabinet.create({
|
|
39
|
+
defaults: {
|
|
40
|
+
timezone: 'America/New_York',
|
|
41
|
+
extensions: ['md', 'txt'],
|
|
42
|
+
outputStructure: 'month',
|
|
43
|
+
outputDirectory: './dist',
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// Configure your command
|
|
48
|
+
const program = new Command();
|
|
49
|
+
await instance.configure(program);
|
|
50
|
+
|
|
51
|
+
// Parse arguments and process
|
|
52
|
+
program.parse(process.argv);
|
|
53
|
+
const cliArgs = program.opts();
|
|
54
|
+
const config = await instance.read(cliArgs);
|
|
55
|
+
const finalConfig = instance.applyDefaults(config);
|
|
56
|
+
await instance.validate(finalConfig);
|
|
57
|
+
|
|
58
|
+
// Use the operator to process files
|
|
59
|
+
const operator = await instance.operate(finalConfig);
|
|
60
|
+
await operator.process(async (file) => {
|
|
61
|
+
// Your file processing logic here
|
|
62
|
+
});
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Once integrated, users can process files with commands like:
|
|
66
|
+
|
|
67
|
+
```console
|
|
68
|
+
my-app \
|
|
69
|
+
--input-directory . \
|
|
70
|
+
--output-directory ./organized \
|
|
71
|
+
--output-structure month \
|
|
72
|
+
--extensions md
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Documentation
|
|
76
|
+
|
|
77
|
+
For complete documentation, including detailed configuration options, advanced usage examples, and integration guides, visit:
|
|
78
|
+
|
|
79
|
+
**[📖 DreadCabinet Documentation](https://utilarium.github.io/dreadcabinet/)**
|
|
80
|
+
|
|
81
|
+
### Quick Links
|
|
82
|
+
|
|
83
|
+
- [Getting Started Guide](https://utilarium.github.io/dreadcabinet/#getting-started)
|
|
84
|
+
- [CLI Options Reference](https://utilarium.github.io/dreadcabinet/#cli-options)
|
|
85
|
+
- [Configuration Files](https://utilarium.github.io/dreadcabinet/#configuration-files)
|
|
86
|
+
- [Advanced Usage](https://utilarium.github.io/dreadcabinet/#advanced-usage)
|
|
87
|
+
- [API Reference](https://utilarium.github.io/dreadcabinet/#api-reference)
|
|
88
|
+
|
|
89
|
+
## Contributing
|
|
90
|
+
|
|
91
|
+
We welcome contributions! Please see our [Contributing Guide](https://utilarium.github.io/dreadcabinet/#contributing) for details.
|
|
92
|
+
|
|
93
|
+
## License
|
|
94
|
+
|
|
95
|
+
[Apache-2.0](./LICENSE) © 2025 Tim O'Brien TEST
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { DefaultOptions, Feature } from './dreadcabinet';
|
|
3
|
+
import { ArgumentError } from './error/ArgumentError';
|
|
4
|
+
export { ArgumentError };
|
|
5
|
+
export declare const configure: (command: Command, defaults: DefaultOptions, addDefaults: boolean, features: Feature[]) => Promise<void>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { DEFAULT_TIMEZONE, DEFAULT_RECURSIVE, DEFAULT_INPUT_DIRECTORY, DEFAULT_OUTPUT_DIRECTORY, DEFAULT_OUTPUT_STRUCTURE, DEFAULT_OUTPUT_FILENAME_OPTIONS, DEFAULT_EXTENSIONS, DEFAULT_INPUT_STRUCTURE, DEFAULT_INPUT_FILENAME_OPTIONS, DATE_FORMAT_YEAR_MONTH_DAY } from './constants.js';
|
|
2
|
+
|
|
3
|
+
const addOption = (command, option, description, addDefaults, defaultValue)=>{
|
|
4
|
+
if (addDefaults) {
|
|
5
|
+
command.option(option, description, defaultValue);
|
|
6
|
+
} else {
|
|
7
|
+
const defaultDesc = defaultValue === undefined ? 'undefined' : Array.isArray(defaultValue) ? defaultValue.join(',') : defaultValue;
|
|
8
|
+
const descriptionWithDefaults = `${description} (default: ${defaultDesc})`;
|
|
9
|
+
command.option(option, descriptionWithDefaults);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
const configure = async (command, defaults, addDefaults, features)=>{
|
|
13
|
+
const tzDefault = (defaults === null || defaults === void 0 ? void 0 : defaults.timezone) || DEFAULT_TIMEZONE;
|
|
14
|
+
if (addDefaults) {
|
|
15
|
+
command.option('--timezone <timezone>', 'timezone for date calculations', tzDefault);
|
|
16
|
+
} else {
|
|
17
|
+
command.option('--timezone <timezone>', `timezone for date calculations (default: ${tzDefault})`);
|
|
18
|
+
}
|
|
19
|
+
if (features.includes('input')) {
|
|
20
|
+
addOption(command, '-r, --recursive', 'recursive mode, process all files in the input directory', addDefaults, (defaults === null || defaults === void 0 ? void 0 : defaults.recursive) !== undefined ? defaults.recursive : DEFAULT_RECURSIVE);
|
|
21
|
+
addOption(command, '-i, --input-directory <inputDirectory>', 'input directory', addDefaults, (defaults === null || defaults === void 0 ? void 0 : defaults.inputDirectory) || DEFAULT_INPUT_DIRECTORY);
|
|
22
|
+
addOption(command, '--limit <limit>', 'limit the number of files to process', addDefaults, (defaults === null || defaults === void 0 ? void 0 : defaults.limit) ? defaults === null || defaults === void 0 ? void 0 : defaults.limit.toString() : undefined);
|
|
23
|
+
addOption(command, '--concurrency <concurrency>', 'concurrency level for processing files', addDefaults, (defaults === null || defaults === void 0 ? void 0 : defaults.concurrency) ? defaults === null || defaults === void 0 ? void 0 : defaults.concurrency.toString() : undefined);
|
|
24
|
+
}
|
|
25
|
+
if (features.includes('output')) {
|
|
26
|
+
addOption(command, '-o, --output-directory <outputDirectory>', 'output directory', addDefaults, (defaults === null || defaults === void 0 ? void 0 : defaults.outputDirectory) || DEFAULT_OUTPUT_DIRECTORY);
|
|
27
|
+
}
|
|
28
|
+
if (features.includes('structured-output')) {
|
|
29
|
+
addOption(command, '--output-structure <type>', 'output directory structure (none/year/month/day)', addDefaults, (defaults === null || defaults === void 0 ? void 0 : defaults.outputStructure) || DEFAULT_OUTPUT_STRUCTURE);
|
|
30
|
+
addOption(command, '--output-filename-options [outputFilenameOptions...]', 'filename format options (space-separated list of: date,time,subject) example \'date subject\'', addDefaults, (defaults === null || defaults === void 0 ? void 0 : defaults.outputFilenameOptions) || DEFAULT_OUTPUT_FILENAME_OPTIONS);
|
|
31
|
+
}
|
|
32
|
+
if (features.includes('extensions')) {
|
|
33
|
+
addOption(command, '--extensions [extensions...]', 'file extensions to process (space-separated list of: mp3,mp4,mpeg,mpga,m4a,wav,webm)', addDefaults, (defaults === null || defaults === void 0 ? void 0 : defaults.extensions) || DEFAULT_EXTENSIONS);
|
|
34
|
+
}
|
|
35
|
+
if (features.includes('structured-input')) {
|
|
36
|
+
addOption(command, '--input-structure <type>', 'input directory structure (none/year/month/day)', addDefaults, (defaults === null || defaults === void 0 ? void 0 : defaults.inputStructure) || DEFAULT_INPUT_STRUCTURE);
|
|
37
|
+
addOption(command, '--input-filename-options [options...]', 'filename format options (space-separated list of: date,time,subject)', addDefaults, (defaults === null || defaults === void 0 ? void 0 : defaults.inputFilenameOptions) || DEFAULT_INPUT_FILENAME_OPTIONS);
|
|
38
|
+
addOption(command, '--start <date>', `start date filter (${DATE_FORMAT_YEAR_MONTH_DAY})`, addDefaults, undefined);
|
|
39
|
+
addOption(command, '--end <date>', `end date filter (${DATE_FORMAT_YEAR_MONTH_DAY}), defaults to today`, addDefaults, undefined);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export { configure };
|
|
44
|
+
//# sourceMappingURL=configure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configure.js","sources":["../src/configure.ts"],"sourcesContent":["import { Command } from \"commander\";\nimport {\n DATE_FORMAT_YEAR_MONTH_DAY,\n DEFAULT_EXTENSIONS,\n DEFAULT_INPUT_DIRECTORY,\n DEFAULT_INPUT_FILENAME_OPTIONS,\n DEFAULT_INPUT_STRUCTURE,\n DEFAULT_OUTPUT_DIRECTORY,\n DEFAULT_OUTPUT_FILENAME_OPTIONS,\n DEFAULT_OUTPUT_STRUCTURE,\n DEFAULT_RECURSIVE,\n DEFAULT_TIMEZONE\n} from \"./constants\";\nimport { DefaultOptions, Feature } from \"./dreadcabinet\";\nimport { ArgumentError } from \"./error/ArgumentError\";\n\nexport { ArgumentError };\n\nconst addOption = (command: Command, option: string, description: string, addDefaults: boolean, defaultValue: boolean | string[] | string | undefined) => {\n if (addDefaults) {\n command.option(option, description, defaultValue)\n } else {\n const defaultDesc = defaultValue === undefined ? 'undefined' : Array.isArray(defaultValue) ? defaultValue.join(',') : defaultValue;\n const descriptionWithDefaults = `${description} (default: ${defaultDesc})`\n command.option(option, descriptionWithDefaults)\n }\n}\n\nexport const configure = async (command: Command, defaults: DefaultOptions, addDefaults: boolean, features: Feature[]): Promise<void> => {\n const tzDefault = defaults?.timezone || DEFAULT_TIMEZONE;\n if (addDefaults) {\n command.option('--timezone <timezone>', 'timezone for date calculations', tzDefault)\n } else {\n command.option('--timezone <timezone>', `timezone for date calculations (default: ${tzDefault})`)\n }\n\n if (features.includes('input')) {\n addOption(command, '-r, --recursive', 'recursive mode, process all files in the input directory', addDefaults, defaults?.recursive !== undefined ? defaults.recursive : DEFAULT_RECURSIVE)\n addOption(command, '-i, --input-directory <inputDirectory>', 'input directory', addDefaults, defaults?.inputDirectory || DEFAULT_INPUT_DIRECTORY)\n addOption(command, '--limit <limit>', 'limit the number of files to process', addDefaults, defaults?.limit ? defaults?.limit.toString() : undefined)\n addOption(command, '--concurrency <concurrency>', 'concurrency level for processing files', addDefaults, defaults?.concurrency ? defaults?.concurrency.toString() : undefined)\n }\n if (features.includes('output')) {\n addOption(command, '-o, --output-directory <outputDirectory>', 'output directory', addDefaults, defaults?.outputDirectory || DEFAULT_OUTPUT_DIRECTORY)\n }\n if (features.includes('structured-output')) {\n addOption(command, '--output-structure <type>', 'output directory structure (none/year/month/day)', addDefaults, defaults?.outputStructure || DEFAULT_OUTPUT_STRUCTURE)\n addOption(command, '--output-filename-options [outputFilenameOptions...]', 'filename format options (space-separated list of: date,time,subject) example \\'date subject\\'', addDefaults, defaults?.outputFilenameOptions || DEFAULT_OUTPUT_FILENAME_OPTIONS)\n }\n if (features.includes('extensions')) {\n addOption(command, '--extensions [extensions...]', 'file extensions to process (space-separated list of: mp3,mp4,mpeg,mpga,m4a,wav,webm)', addDefaults, defaults?.extensions || DEFAULT_EXTENSIONS)\n }\n\n if (features.includes('structured-input')) {\n addOption(command, '--input-structure <type>', 'input directory structure (none/year/month/day)', addDefaults, defaults?.inputStructure || DEFAULT_INPUT_STRUCTURE)\n addOption(command, '--input-filename-options [options...]', 'filename format options (space-separated list of: date,time,subject)', addDefaults, defaults?.inputFilenameOptions || DEFAULT_INPUT_FILENAME_OPTIONS)\n addOption(command, '--start <date>', `start date filter (${DATE_FORMAT_YEAR_MONTH_DAY})`, addDefaults, undefined)\n addOption(command, '--end <date>', `end date filter (${DATE_FORMAT_YEAR_MONTH_DAY}), defaults to today`, addDefaults, undefined)\n }\n}"],"names":["addOption","command","option","description","addDefaults","defaultValue","defaultDesc","undefined","Array","isArray","join","descriptionWithDefaults","configure","defaults","features","tzDefault","timezone","DEFAULT_TIMEZONE","includes","recursive","DEFAULT_RECURSIVE","inputDirectory","DEFAULT_INPUT_DIRECTORY","limit","toString","concurrency","outputDirectory","DEFAULT_OUTPUT_DIRECTORY","outputStructure","DEFAULT_OUTPUT_STRUCTURE","outputFilenameOptions","DEFAULT_OUTPUT_FILENAME_OPTIONS","extensions","DEFAULT_EXTENSIONS","inputStructure","DEFAULT_INPUT_STRUCTURE","inputFilenameOptions","DEFAULT_INPUT_FILENAME_OPTIONS","DATE_FORMAT_YEAR_MONTH_DAY"],"mappings":";;AAkBA,MAAMA,SAAAA,GAAY,CAACC,OAAAA,EAAkBC,MAAAA,EAAgBC,aAAqBC,WAAAA,EAAsBC,YAAAA,GAAAA;AAC5F,IAAA,IAAID,WAAAA,EAAa;QACbH,OAAAA,CAAQC,MAAM,CAACA,MAAAA,EAAQC,WAAAA,EAAaE,YAAAA,CAAAA;IACxC,CAAA,MAAO;QACH,MAAMC,WAAAA,GAAcD,YAAAA,KAAiBE,SAAAA,GAAY,WAAA,GAAcC,KAAAA,CAAMC,OAAO,CAACJ,YAAAA,CAAAA,GAAgBA,YAAAA,CAAaK,IAAI,CAAC,GAAA,CAAA,GAAOL,YAAAA;AACtH,QAAA,MAAMM,0BAA0B,CAAA,EAAGR,WAAAA,CAAY,WAAW,EAAEG,WAAAA,CAAY,CAAC,CAAC;QAC1EL,OAAAA,CAAQC,MAAM,CAACA,MAAAA,EAAQS,uBAAAA,CAAAA;AAC3B,IAAA;AACJ,CAAA;AAEO,MAAMC,SAAAA,GAAY,OAAOX,OAAAA,EAAkBY,UAA0BT,WAAAA,EAAsBU,QAAAA,GAAAA;AAC9F,IAAA,MAAMC,YAAYF,CAAAA,QAAAA,KAAAA,IAAAA,IAAAA,QAAAA,KAAAA,MAAAA,GAAAA,MAAAA,GAAAA,QAAAA,CAAUG,QAAQ,KAAIC,gBAAAA;AACxC,IAAA,IAAIb,WAAAA,EAAa;QACbH,OAAAA,CAAQC,MAAM,CAAC,uBAAA,EAAyB,gCAAA,EAAkCa,SAAAA,CAAAA;IAC9E,CAAA,MAAO;QACHd,OAAAA,CAAQC,MAAM,CAAC,uBAAA,EAAyB,CAAC,yCAAyC,EAAEa,SA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AAA,QAAAA,KAAAA,IAAAA,IAAAA,QAAAA,KAAAA,MAAAA,GAAAA,MAAAA,GAAAA,QAAAA,CAAUuB,oBAAoB,KAAIC,8BAAAA,CAAAA;QACnLrC,SAAAA,CAAUC,OAAAA,EAAS,kBAAkB,CAAC,mBAAmB,EAAEqC,0BAAAA,CAA2B,CAAC,CAAC,EAAElC,WAAAA,EAAaG,SAAAA,CAAAA;QACvGP,SAAAA,CAAUC,OAAAA,EAAS,gBAAgB,CAAC,iBAAiB,EAAEqC,0BAAAA,CAA2B,oBAAoB,CAAC,EAAElC,WAAAA,EAAaG,SAAAA,CAAAA;AAC1H,IAAA;AACJ;;;;"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { FilenameOption, FilesystemStructure } from './dreadcabinet';
|
|
2
|
+
export declare const VERSION = "__VERSION__ (__GIT_BRANCH__/__GIT_COMMIT__ __GIT_TAGS__ __GIT_COMMIT_DATE__) __SYSTEM_INFO__";
|
|
3
|
+
export declare const PROGRAM_NAME = "dreadcabinet";
|
|
4
|
+
export declare const DEFAULT_CHARACTER_ENCODING = "utf-8";
|
|
5
|
+
export declare const DEFAULT_BINARY_TO_TEXT_ENCODING = "base64";
|
|
6
|
+
export declare const DEFAULT_DIFF = true;
|
|
7
|
+
export declare const DEFAULT_LOG = false;
|
|
8
|
+
export declare const DEFAULT_TIMEZONE = "Etc/UTC";
|
|
9
|
+
export declare const DATE_FORMAT_MONTH_DAY = "M-D";
|
|
10
|
+
export declare const DATE_FORMAT_YEAR = "YYYY";
|
|
11
|
+
export declare const DATE_FORMAT_YEAR_MONTH = "YYYY-M";
|
|
12
|
+
export declare const DATE_FORMAT_YEAR_MONTH_DAY = "YYYY-M-D";
|
|
13
|
+
export declare const DATE_FORMAT_YEAR_MONTH_DAY_SLASH = "YYYY/M/D";
|
|
14
|
+
export declare const DATE_FORMAT_YEAR_MONTH_DAY_HOURS_MINUTES = "YYYY-M-D-HHmm";
|
|
15
|
+
export declare const DATE_FORMAT_YEAR_MONTH_DAY_HOURS_MINUTES_SECONDS = "YYYY-M-D-HHmmss";
|
|
16
|
+
export declare const DATE_FORMAT_YEAR_MONTH_DAY_HOURS_MINUTES_SECONDS_MILLISECONDS = "YYYY-M-D-HHmmss.SSS";
|
|
17
|
+
export declare const DATE_FORMAT_MONTH = "M";
|
|
18
|
+
export declare const DATE_FORMAT_DAY = "D";
|
|
19
|
+
export declare const DATE_FORMAT_HOURS = "HHmm";
|
|
20
|
+
export declare const DATE_FORMAT_MINUTES = "mm";
|
|
21
|
+
export declare const DATE_FORMAT_SECONDS = "ss";
|
|
22
|
+
export declare const DATE_FORMAT_MILLISECONDS = "SSS";
|
|
23
|
+
export declare const DEFAULT_RECURSIVE = false;
|
|
24
|
+
export declare const DEFAULT_INPUT_DIRECTORY = "./";
|
|
25
|
+
export declare const DEFAULT_OUTPUT_DIRECTORY = "./";
|
|
26
|
+
export declare const DEFAULT_CONCURRENCY = 1;
|
|
27
|
+
export declare const DEFAULT_OUTPUT_STRUCTURE: FilesystemStructure;
|
|
28
|
+
export declare const DEFAULT_OUTPUT_FILENAME_OPTIONS: FilenameOption[];
|
|
29
|
+
export declare const DEFAULT_INPUT_STRUCTURE: FilesystemStructure;
|
|
30
|
+
export declare const DEFAULT_INPUT_FILENAME_OPTIONS: FilenameOption[];
|
|
31
|
+
export declare const DEFAULT_EXTENSIONS: string[];
|
|
32
|
+
export declare const ALLOWED_INPUT_STRUCTURES: FilesystemStructure[];
|
|
33
|
+
export declare const ALLOWED_INPUT_FILENAME_OPTIONS: FilenameOption[];
|
|
34
|
+
export declare const ALLOWED_OUTPUT_STRUCTURES: FilesystemStructure[];
|
|
35
|
+
export declare const ALLOWED_OUTPUT_FILENAME_OPTIONS: FilenameOption[];
|
|
36
|
+
export declare const ALLOWED_EXTENSIONS: string[];
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const PROGRAM_NAME = 'dreadcabinet';
|
|
2
|
+
const DEFAULT_TIMEZONE = 'Etc/UTC';
|
|
3
|
+
const DATE_FORMAT_MONTH_DAY = 'M-D';
|
|
4
|
+
const DATE_FORMAT_YEAR = 'YYYY';
|
|
5
|
+
const DATE_FORMAT_YEAR_MONTH_DAY = 'YYYY-M-D';
|
|
6
|
+
const DATE_FORMAT_MONTH = 'M';
|
|
7
|
+
const DATE_FORMAT_DAY = 'D';
|
|
8
|
+
const DEFAULT_RECURSIVE = false;
|
|
9
|
+
const DEFAULT_INPUT_DIRECTORY = './';
|
|
10
|
+
const DEFAULT_OUTPUT_DIRECTORY = './';
|
|
11
|
+
const DEFAULT_CONCURRENCY = 1;
|
|
12
|
+
const DEFAULT_OUTPUT_STRUCTURE = 'month';
|
|
13
|
+
const DEFAULT_OUTPUT_FILENAME_OPTIONS = [
|
|
14
|
+
'date',
|
|
15
|
+
'subject'
|
|
16
|
+
];
|
|
17
|
+
const DEFAULT_INPUT_STRUCTURE = 'month';
|
|
18
|
+
const DEFAULT_INPUT_FILENAME_OPTIONS = [
|
|
19
|
+
'date',
|
|
20
|
+
'subject'
|
|
21
|
+
];
|
|
22
|
+
const DEFAULT_EXTENSIONS = [
|
|
23
|
+
'md'
|
|
24
|
+
];
|
|
25
|
+
const ALLOWED_INPUT_STRUCTURES = [
|
|
26
|
+
'none',
|
|
27
|
+
'year',
|
|
28
|
+
'month',
|
|
29
|
+
'day'
|
|
30
|
+
];
|
|
31
|
+
const ALLOWED_INPUT_FILENAME_OPTIONS = [
|
|
32
|
+
'date',
|
|
33
|
+
'time',
|
|
34
|
+
'subject'
|
|
35
|
+
];
|
|
36
|
+
const ALLOWED_OUTPUT_STRUCTURES = [
|
|
37
|
+
'none',
|
|
38
|
+
'year',
|
|
39
|
+
'month',
|
|
40
|
+
'day'
|
|
41
|
+
];
|
|
42
|
+
const ALLOWED_OUTPUT_FILENAME_OPTIONS = [
|
|
43
|
+
'date',
|
|
44
|
+
'time',
|
|
45
|
+
'subject'
|
|
46
|
+
];
|
|
47
|
+
const ALLOWED_EXTENSIONS = [
|
|
48
|
+
'md',
|
|
49
|
+
'txt'
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
export { ALLOWED_EXTENSIONS, ALLOWED_INPUT_FILENAME_OPTIONS, ALLOWED_INPUT_STRUCTURES, ALLOWED_OUTPUT_FILENAME_OPTIONS, ALLOWED_OUTPUT_STRUCTURES, DATE_FORMAT_DAY, DATE_FORMAT_MONTH, DATE_FORMAT_MONTH_DAY, DATE_FORMAT_YEAR, DATE_FORMAT_YEAR_MONTH_DAY, DEFAULT_CONCURRENCY, DEFAULT_EXTENSIONS, DEFAULT_INPUT_DIRECTORY, DEFAULT_INPUT_FILENAME_OPTIONS, DEFAULT_INPUT_STRUCTURE, DEFAULT_OUTPUT_DIRECTORY, DEFAULT_OUTPUT_FILENAME_OPTIONS, DEFAULT_OUTPUT_STRUCTURE, DEFAULT_RECURSIVE, DEFAULT_TIMEZONE, PROGRAM_NAME };
|
|
53
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../src/constants.ts"],"sourcesContent":["import { FilenameOption, FilesystemStructure } from './dreadcabinet';\n\nexport const VERSION = '__VERSION__ (__GIT_BRANCH__/__GIT_COMMIT__ __GIT_TAGS__ __GIT_COMMIT_DATE__) __SYSTEM_INFO__';\nexport const PROGRAM_NAME = 'dreadcabinet';\nexport const DEFAULT_CHARACTER_ENCODING = 'utf-8';\nexport const DEFAULT_BINARY_TO_TEXT_ENCODING = 'base64';\nexport const DEFAULT_DIFF = true;\nexport const DEFAULT_LOG = false;\nexport const DEFAULT_TIMEZONE = 'Etc/UTC';\nexport const DATE_FORMAT_MONTH_DAY = 'M-D';\nexport const DATE_FORMAT_YEAR = 'YYYY';\nexport const DATE_FORMAT_YEAR_MONTH = 'YYYY-M';\nexport const DATE_FORMAT_YEAR_MONTH_DAY = 'YYYY-M-D';\nexport const DATE_FORMAT_YEAR_MONTH_DAY_SLASH = 'YYYY/M/D';\nexport const DATE_FORMAT_YEAR_MONTH_DAY_HOURS_MINUTES = 'YYYY-M-D-HHmm';\nexport const DATE_FORMAT_YEAR_MONTH_DAY_HOURS_MINUTES_SECONDS = 'YYYY-M-D-HHmmss';\nexport const DATE_FORMAT_YEAR_MONTH_DAY_HOURS_MINUTES_SECONDS_MILLISECONDS = 'YYYY-M-D-HHmmss.SSS';\nexport const DATE_FORMAT_MONTH = 'M';\nexport const DATE_FORMAT_DAY = 'D';\nexport const DATE_FORMAT_HOURS = 'HHmm';\nexport const DATE_FORMAT_MINUTES = 'mm';\nexport const DATE_FORMAT_SECONDS = 'ss';\nexport const DATE_FORMAT_MILLISECONDS = 'SSS';\n\nexport const DEFAULT_RECURSIVE = false;\nexport const DEFAULT_INPUT_DIRECTORY = './';\nexport const DEFAULT_OUTPUT_DIRECTORY = './';\nexport const DEFAULT_CONCURRENCY = 1;\n\nexport const DEFAULT_OUTPUT_STRUCTURE = 'month' as FilesystemStructure;\nexport const DEFAULT_OUTPUT_FILENAME_OPTIONS = ['date', 'subject'] as FilenameOption[];\nexport const DEFAULT_INPUT_STRUCTURE = 'month' as FilesystemStructure;\nexport const DEFAULT_INPUT_FILENAME_OPTIONS = ['date', 'subject'] as FilenameOption[];\nexport const DEFAULT_EXTENSIONS = ['md'] as string[];\n\nexport const ALLOWED_INPUT_STRUCTURES = ['none', 'year', 'month', 'day'] as FilesystemStructure[];\nexport const ALLOWED_INPUT_FILENAME_OPTIONS = ['date', 'time', 'subject'] as FilenameOption[];\nexport const ALLOWED_OUTPUT_STRUCTURES = ['none', 'year', 'month', 'day'] as FilesystemStructure[];\nexport const ALLOWED_OUTPUT_FILENAME_OPTIONS = ['date', 'time', 'subject'] as FilenameOption[];\n\nexport const ALLOWED_EXTENSIONS = ['md', 'txt'] as string[];"],"names":["PROGRAM_NAME","DEFAULT_TIMEZONE","DATE_FORMAT_MONTH_DAY","DATE_FORMAT_YEAR","DATE_FORMAT_YEAR_MONTH_DAY","DATE_FORMAT_MONTH","DATE_FORMAT_DAY","DEFAULT_RECURSIVE","DEFAULT_INPUT_DIRECTORY","DEFAULT_OUTPUT_DIRECTORY","DEFAULT_CONCURRENCY","DEFAULT_OUTPUT_STRUCTURE","DEFAULT_OUTPUT_FILENAME_OPTIONS","DEFAULT_INPUT_STRUCTURE","DEFAULT_INPUT_FILENAME_OPTIONS","DEFAULT_EXTENSIONS","ALLOWED_INPUT_STRUCTURES","ALLOWED_INPUT_FILENAME_OPTIONS","ALLOWED_OUTPUT_STRUCTURES","ALLOWED_OUTPUT_FILENAME_OPTIONS","ALLOWED_EXTENSIONS"],"mappings":"AAGO,MAAMA,eAAe;AAKrB,MAAMC,mBAAmB;AACzB,MAAMC,wBAAwB;AAC9B,MAAMC,mBAAmB;AAEzB,MAAMC,6BAA6B;AAKnC,MAAMC,oBAAoB;AAC1B,MAAMC,kBAAkB;AAMxB,MAAMC,oBAAoB;AAC1B,MAAMC,0BAA0B;AAChC,MAAMC,2BAA2B;AACjC,MAAMC,sBAAsB;AAE5B,MAAMC,2BAA2B;MAC3BC,+BAAAA,GAAkC;AAAC,IAAA,MAAA;AAAQ,IAAA;;AACjD,MAAMC,0BAA0B;MAC1BC,8BAAAA,GAAiC;AAAC,IAAA,MAAA;AAAQ,IAAA;;MAC1CC,kBAAAA,GAAqB;AAAC,IAAA;;MAEtBC,wBAAAA,GAA2B;AAAC,IAAA,MAAA;AAAQ,IAAA,MAAA;AAAQ,IAAA,OAAA;AAAS,IAAA;;MACrDC,8BAAAA,GAAiC;AAAC,IAAA,MAAA;AAAQ,IAAA,MAAA;AAAQ,IAAA;;MAClDC,yBAAAA,GAA4B;AAAC,IAAA,MAAA;AAAQ,IAAA,MAAA;AAAQ,IAAA,OAAA;AAAS,IAAA;;MACtDC,+BAAAA,GAAkC;AAAC,IAAA,MAAA;AAAQ,IAAA,MAAA;AAAQ,IAAA;;MAEnDC,kBAAAA,GAAqB;AAAC,IAAA,IAAA;AAAM,IAAA;;;;;"}
|
package/dist/defaults.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { DEFAULT_TIMEZONE, DEFAULT_RECURSIVE, DEFAULT_INPUT_DIRECTORY, DEFAULT_CONCURRENCY, DEFAULT_OUTPUT_DIRECTORY, DEFAULT_OUTPUT_STRUCTURE, DEFAULT_OUTPUT_FILENAME_OPTIONS, DEFAULT_EXTENSIONS, DEFAULT_INPUT_STRUCTURE, DEFAULT_INPUT_FILENAME_OPTIONS } from './constants.js';
|
|
2
|
+
|
|
3
|
+
const applyDefaults = (config, features, defaults)=>{
|
|
4
|
+
const configWithDefaults = {
|
|
5
|
+
...config
|
|
6
|
+
};
|
|
7
|
+
configWithDefaults.timezone = config.timezone || (defaults === null || defaults === void 0 ? void 0 : defaults.timezone) || DEFAULT_TIMEZONE;
|
|
8
|
+
if (features.includes('input')) {
|
|
9
|
+
var _ref;
|
|
10
|
+
configWithDefaults.recursive = config.recursive === undefined ? (_ref = defaults === null || defaults === void 0 ? void 0 : defaults.recursive) !== null && _ref !== void 0 ? _ref : DEFAULT_RECURSIVE : config.recursive;
|
|
11
|
+
configWithDefaults.inputDirectory = config.inputDirectory || (defaults === null || defaults === void 0 ? void 0 : defaults.inputDirectory) || DEFAULT_INPUT_DIRECTORY;
|
|
12
|
+
configWithDefaults.concurrency = config.concurrency || (defaults === null || defaults === void 0 ? void 0 : defaults.concurrency) || DEFAULT_CONCURRENCY;
|
|
13
|
+
}
|
|
14
|
+
if (features.includes('output')) {
|
|
15
|
+
configWithDefaults.outputDirectory = config.outputDirectory || (defaults === null || defaults === void 0 ? void 0 : defaults.outputDirectory) || DEFAULT_OUTPUT_DIRECTORY;
|
|
16
|
+
}
|
|
17
|
+
if (features.includes('structured-output')) {
|
|
18
|
+
configWithDefaults.outputStructure = config.outputStructure || (defaults === null || defaults === void 0 ? void 0 : defaults.outputStructure) || DEFAULT_OUTPUT_STRUCTURE;
|
|
19
|
+
configWithDefaults.outputFilenameOptions = config.outputFilenameOptions || (defaults === null || defaults === void 0 ? void 0 : defaults.outputFilenameOptions) || DEFAULT_OUTPUT_FILENAME_OPTIONS;
|
|
20
|
+
}
|
|
21
|
+
if (features.includes('extensions')) {
|
|
22
|
+
configWithDefaults.extensions = config.extensions || (defaults === null || defaults === void 0 ? void 0 : defaults.extensions) || DEFAULT_EXTENSIONS;
|
|
23
|
+
}
|
|
24
|
+
if (features.includes('structured-input')) {
|
|
25
|
+
configWithDefaults.inputStructure = config.inputStructure || (defaults === null || defaults === void 0 ? void 0 : defaults.inputStructure) || DEFAULT_INPUT_STRUCTURE;
|
|
26
|
+
configWithDefaults.inputFilenameOptions = config.inputFilenameOptions || (defaults === null || defaults === void 0 ? void 0 : defaults.inputFilenameOptions) || DEFAULT_INPUT_FILENAME_OPTIONS;
|
|
27
|
+
}
|
|
28
|
+
return configWithDefaults;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export { applyDefaults };
|
|
32
|
+
//# sourceMappingURL=defaults.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.js","sources":["../src/defaults.ts"],"sourcesContent":["import { Config } from './dreadcabinet';\nimport { DEFAULT_CONCURRENCY, DEFAULT_EXTENSIONS, DEFAULT_INPUT_DIRECTORY, DEFAULT_INPUT_FILENAME_OPTIONS, DEFAULT_INPUT_STRUCTURE, DEFAULT_OUTPUT_DIRECTORY, DEFAULT_OUTPUT_FILENAME_OPTIONS, DEFAULT_OUTPUT_STRUCTURE, DEFAULT_RECURSIVE, DEFAULT_TIMEZONE } from './constants';\nimport { DefaultOptions, Feature } from './dreadcabinet';\n\nexport const applyDefaults = (config: Partial<Config>, features: Feature[], defaults: DefaultOptions): Config => {\n const configWithDefaults = {\n ...config,\n }\n\n configWithDefaults.timezone = config.timezone || (defaults?.timezone || DEFAULT_TIMEZONE);\n if (features.includes('input')) {\n configWithDefaults.recursive = config.recursive === undefined ? (defaults?.recursive ?? DEFAULT_RECURSIVE) : config.recursive;\n configWithDefaults.inputDirectory = config.inputDirectory || (defaults?.inputDirectory || DEFAULT_INPUT_DIRECTORY);\n configWithDefaults.concurrency = config.concurrency || (defaults?.concurrency || DEFAULT_CONCURRENCY);\n }\n if (features.includes('output')) {\n configWithDefaults.outputDirectory = config.outputDirectory || (defaults?.outputDirectory || DEFAULT_OUTPUT_DIRECTORY);\n }\n if (features.includes('structured-output')) {\n configWithDefaults.outputStructure = config.outputStructure || (defaults?.outputStructure || DEFAULT_OUTPUT_STRUCTURE);\n configWithDefaults.outputFilenameOptions = config.outputFilenameOptions || (defaults?.outputFilenameOptions || DEFAULT_OUTPUT_FILENAME_OPTIONS);\n }\n if (features.includes('extensions')) {\n configWithDefaults.extensions = config.extensions || (defaults?.extensions || DEFAULT_EXTENSIONS);\n }\n\n if (features.includes('structured-input')) {\n configWithDefaults.inputStructure = config.inputStructure || (defaults?.inputStructure || DEFAULT_INPUT_STRUCTURE);\n configWithDefaults.inputFilenameOptions = config.inputFilenameOptions || (defaults?.inputFilenameOptions || DEFAULT_INPUT_FILENAME_OPTIONS);\n }\n\n return configWithDefaults as Config;\n}\n\n"],"names":["applyDefaults","config","features","defaults","configWithDefaults","timezone","DEFAULT_TIMEZONE","includes","recursive","undefined","DEFAULT_RECURSIVE","inputDirectory","DEFAULT_INPUT_DIRECTORY","concurrency","DEFAULT_CONCURRENCY","outputDirectory","DEFAULT_OUTPUT_DIRECTORY","outputStructure","DEFAULT_OUTPUT_STRUCTURE","outputFilenameOptions","DEFAULT_OUTPUT_FILENAME_OPTIONS","extensions","DEFAULT_EXTENSIONS","inputStructure","DEFAULT_INPUT_STRUCTURE","inputFilenameOptions","DEFAULT_INPUT_FILENAME_OPTIONS"],"mappings":";;AAIO,MAAMA,aAAAA,GAAgB,CAACC,MAAAA,EAAyBC,QAAAA,EAAqBC,QAAAA,GAAAA;AACxE,IAAA,MAAMC,kBAAAA,GAAqB;AACvB,QAAA,GAAGH;AACP,KAAA;IAEAG,kBAAAA,CAAmBC,QAAQ,GAAGJ,MAAAA,CAAOI,QAAQ,KAAKF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