@sjunepark/fs 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 (56) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +73 -0
  3. package/assets/guide/authoring.md +125 -0
  4. package/dist/application.js +34 -0
  5. package/dist/application.js.map +1 -0
  6. package/dist/assets.js +20 -0
  7. package/dist/assets.js.map +1 -0
  8. package/dist/bin.js +9 -0
  9. package/dist/bin.js.map +1 -0
  10. package/dist/cli.js +150 -0
  11. package/dist/cli.js.map +1 -0
  12. package/dist/content.js +47 -0
  13. package/dist/content.js.map +1 -0
  14. package/dist/io.js +76 -0
  15. package/dist/io.js.map +1 -0
  16. package/dist/json.js +291 -0
  17. package/dist/json.js.map +1 -0
  18. package/dist/limits.js +15 -0
  19. package/dist/limits.js.map +1 -0
  20. package/dist/logger.js +26 -0
  21. package/dist/logger.js.map +1 -0
  22. package/dist/node-services.js +9 -0
  23. package/dist/node-services.js.map +1 -0
  24. package/dist/pathless.js +72 -0
  25. package/dist/pathless.js.map +1 -0
  26. package/dist/process.js +317 -0
  27. package/dist/process.js.map +1 -0
  28. package/dist/record-validation.js +44 -0
  29. package/dist/record-validation.js.map +1 -0
  30. package/dist/render.js +250 -0
  31. package/dist/render.js.map +1 -0
  32. package/dist/validation/calculate.js +102 -0
  33. package/dist/validation/calculate.js.map +1 -0
  34. package/dist/validation/decimal.js +63 -0
  35. package/dist/validation/decimal.js.map +1 -0
  36. package/dist/validation/identity.js +4 -0
  37. package/dist/validation/identity.js.map +1 -0
  38. package/dist/validation/model.js +10 -0
  39. package/dist/validation/model.js.map +1 -0
  40. package/dist/validation/schema.js +106 -0
  41. package/dist/validation/schema.js.map +1 -0
  42. package/dist/validation/semantic.js +179 -0
  43. package/dist/validation/semantic.js.map +1 -0
  44. package/dist/validation/snapshot.js +74 -0
  45. package/dist/validation/snapshot.js.map +1 -0
  46. package/dist/validation/validate.js +154 -0
  47. package/dist/validation/validate.js.map +1 -0
  48. package/dist/writer.js +107 -0
  49. package/dist/writer.js.map +1 -0
  50. package/examples/README.md +37 -0
  51. package/examples/manufacturing-group.json +439 -0
  52. package/examples/minimal.json +45 -0
  53. package/package.json +80 -0
  54. package/schema/fs-document.schema.json +335 -0
  55. package/schema/snapshot-diff.schema.json +96 -0
  56. package/schema/validation-result.schema.json +165 -0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,73 @@
1
+ # `@sjunepark/fs`
2
+
3
+ `@sjunepark/fs` is the reference CLI for FS, a versioned JSON format for clean,
4
+ structured financial statements. FS gives people and agents one predictable
5
+ artifact to produce after financial data has been extracted or authored.
6
+
7
+ FS is not an extraction system, accounting taxonomy, source-mapping service,
8
+ or financial-policy engine. Authors remain responsible for those decisions.
9
+
10
+ ## Requirements
11
+
12
+ - Node.js `22.17.0` or later in the Node.js 22 line, or Node.js `24.15.0` or
13
+ later in the Node.js 24 line.
14
+
15
+ ## Package command forms
16
+
17
+ The pinned V0 package interface uses the following commands. This command
18
+ reference does not attest to current npm publication availability.
19
+
20
+ Run without a global installation:
21
+
22
+ ```sh
23
+ npx -y @sjunepark/fs@0.1.0 --help
24
+ ```
25
+
26
+ Or install the `fs` executable globally:
27
+
28
+ ```sh
29
+ npm install --global @sjunepark/fs@0.1.0
30
+ fs --help
31
+ ```
32
+
33
+ Common workflows:
34
+
35
+ ```sh
36
+ # Read the bundled authoring guide.
37
+ npx -y @sjunepark/fs@0.1.0 guide authoring
38
+
39
+ # Write the document schema or a bundled example to stdout.
40
+ npx -y @sjunepark/fs@0.1.0 schema document
41
+ npx -y @sjunepark/fs@0.1.0 example minimal
42
+
43
+ # Validate a document and calculate its results.
44
+ npx -y @sjunepark/fs@0.1.0 validate statement.fs.json
45
+
46
+ # Render a deterministic standalone HTML table.
47
+ npx -y @sjunepark/fs@0.1.0 render --output statement.html statement.fs.json
48
+ ```
49
+
50
+ The package bundles its schemas, guide, and examples. Validation does not
51
+ depend on network access.
52
+
53
+ ## Develop from source
54
+
55
+ In a source checkout, `docs/development.md` owns repository setup, local CLI
56
+ execution, validation, generated content, and package checks. That
57
+ repository-only guide is not part of the npm package.
58
+
59
+ ## Format contract
60
+
61
+ V0 documents use `formatVersion: "0.1"`. The normative
62
+ [FS V0 semantic specification](https://cpaikr.github.io/fs/spec/0.1/) and
63
+ [versioned document schema](https://cpaikr.github.io/fs/schema/0.1/fs-document.schema.json)
64
+ define the public contract.
65
+
66
+ ## Support
67
+
68
+ Report package or specification problems through the
69
+ [public issue tracker](https://github.com/cpaikr/cpaikr.github.io/issues).
70
+
71
+ ## License
72
+
73
+ Licensed under the [Apache License 2.0](LICENSE).
@@ -0,0 +1,125 @@
1
+ # Authoring FS Documents
2
+
3
+ Encode only an author-resolved financial model. One FS document covers one
4
+ entity and reporting scope.
5
+
6
+ ## Resolve Inputs
7
+
8
+ For a new document, confirm all of these inputs before encoding:
9
+
10
+ - entity `name` and optional `id`, scope `label` and optional `id`, and any
11
+ optional `documentId`;
12
+ - units with `id`, `label`, `measure`, `scale`, and optional canonical,
13
+ nonnegative `defaultTolerance`; omission means exact zero, and the parent
14
+ item's unit controls each rollup tolerance;
15
+ - periods with `id`, `kind`, and either `date` for an instant or inclusive
16
+ `start` and `end` for a duration;
17
+ - statements with `id`, `label`, ordered period identifiers, and ordered
18
+ items; each item has `id`, `label`, `unit`, `values`, and `groupings`, plus
19
+ any optional `description` or `rollupTo`;
20
+ - grouping-column identifiers and, for every item, a nonempty string or JSON
21
+ `null` assignment for each column;
22
+ - one deliberate value state for every item-period: an exact decimal, zero,
23
+ missing, or unavailable; and
24
+ - confirmed rollups whose child and parent are in the same statement, use the
25
+ same unit, add with coefficient one and stored signs unchanged, and form an
26
+ acyclic graph.
27
+
28
+ For a repair, treat the candidate's financial meanings, values, units,
29
+ periods, groupings, and rollups as authoritative. Repair syntax, shape, and
30
+ reference encoding. Ask for author input only when a diagnostic exposes a
31
+ missing or contradictory financial decision.
32
+
33
+ Proceed when every required choice is present and internally consistent.
34
+ Otherwise request the exact unresolved input.
35
+
36
+ ## Workflow
37
+
38
+ ### 1. Load the Exact Contract
39
+
40
+ ```sh
41
+ fs schema document
42
+ fs example
43
+ fs example minimal
44
+ ```
45
+
46
+ Continue only when all three commands succeed and their artifacts are
47
+ available. The [FS V0 semantic specification](https://cpaikr.github.io/fs/spec/0.1/)
48
+ defines meaning beyond JSON shape. Consult it when an invariant or repair is
49
+ uncertain.
50
+
51
+ Contract discovery is complete when the schema, example catalog, and minimal
52
+ example are available from the exact command version.
53
+
54
+ ### 2. Prepare the Candidate
55
+
56
+ Choose one branch:
57
+
58
+ - **Create:** encode the complete author-resolved model with the rules below.
59
+ - **Repair:** preserve the supplied candidate unchanged through its first
60
+ validation in Step 3. Use the rules below as repair constraints after the
61
+ validator establishes the baseline diagnostics.
62
+
63
+ For either branch, apply these encoding constraints:
64
+
65
+ - Set `"formatVersion": "0.1"`. The only allowed optional discovery pointer
66
+ is `"$schema": "https://cpaikr.github.io/fs/schema/0.1/fs-document.schema.json"`.
67
+ - Define entity, scope, units, periods, and any grouping columns before
68
+ statements reference them. Keep objects closed and every identifier and
69
+ reference exact.
70
+ - Give each statement an ordered, nonempty period list and ordered, nonempty
71
+ item list. Each item's `values` keys exactly match its statement periods;
72
+ its `groupings` keys exactly match the document's `groupingColumns`.
73
+ - Encode values as canonical decimal strings: no exponent or leading `+`, no
74
+ unnecessary leading integer zeros or trailing fractional zeros, and no
75
+ negative zero. Use `"0"` for zero, JSON `null` for missing, and
76
+ `{ "unavailable": true }` for explicit unavailability.
77
+ - Use a nonempty string for a grouping assignment and JSON `null` for no
78
+ assignment. With no grouping columns, every item's `groupings` is `{}`.
79
+ - Set `rollupTo` only on a confirmed child. Every relationship is
80
+ same-statement, same-unit, coefficient-one, stored-sign, and acyclic. The
81
+ parent remains explicit; validation compares direct children and never
82
+ derives a subtotal.
83
+
84
+ Create preparation is complete when every required member, selected-period
85
+ cell, grouping assignment, identifier, reference, and confirmed rollup is
86
+ present without inventing a financial choice. Repair preparation is complete
87
+ when the original candidate is staged unchanged and its author-resolved
88
+ financial choices are fixed as invariants.
89
+
90
+ ### 3. Validate and Repair to Conformance
91
+
92
+ ```sh
93
+ fs validate candidate.json
94
+ ```
95
+
96
+ For a repair, run this command on the unchanged candidate first. When
97
+ it returns `error.code: "invalid-json"`, repair syntax, trailing content, or
98
+ duplicate members only when one correction preserves the supplied financial
99
+ choice; otherwise request that choice. Re-run until the command returns a
100
+ structured validation result. When
101
+ `validation.conformance.status` is `"nonconforming"`, repair each
102
+ structural diagnostic by its stable `code` and JSON Pointer `path`, then
103
+ validate the complete candidate again. Change only encoding. If repair needs a
104
+ financial decision, stop and request that decision. Repeat until
105
+ `validation.conformance.status` is `"conforming"`.
106
+
107
+ Structural conformance, `calculations`, and `snapshotDiff` are separate
108
+ results. A conforming document may have inconsistent rollups; preserve the
109
+ reported values and do not force calculation consistency.
110
+
111
+ Validation is complete only with a conforming status and the unabridged
112
+ structured output retained.
113
+
114
+ ### 4. Create and Deliver
115
+
116
+ ```sh
117
+ fs create --output statement.fs.json candidate.json
118
+ ```
119
+
120
+ Use a new output path whose parent directory already exists. `create` copies
121
+ the candidate's exact bytes atomically and never overwrites a path.
122
+
123
+ Finish only when `output.status` is `"created"`. Deliver the created FS JSON
124
+ and the complete structured validation output, including `validation` and
125
+ `snapshotDiff`.
@@ -0,0 +1,34 @@
1
+ import { Context, Effect, Layer, Stdio } from "effect";
2
+ export const internalError = (request) => ({
3
+ stdout: Buffer.from(`${JSON.stringify({
4
+ error: {
5
+ operation: request.command,
6
+ code: "internal-error",
7
+ message: "The requested operation could not be completed."
8
+ },
9
+ help: []
10
+ })}\n`, "utf8"),
11
+ stderr: Buffer.alloc(0),
12
+ exitCode: 1
13
+ });
14
+ const execute = (request) => {
15
+ const loaded = request.command === "schema" || request.command === "example"
16
+ ? Effect.tryPromise({
17
+ try: () => import("./content.js"),
18
+ catch: () => undefined
19
+ }).pipe(Effect.flatMap(({ executeContent }) => executeContent(request)))
20
+ : request.command === "validate" ||
21
+ request.command === "create" ||
22
+ request.command === "record-validation" ||
23
+ request.command === "render"
24
+ ? Effect.tryPromise({
25
+ try: () => import("./process.js"),
26
+ catch: () => undefined
27
+ }).pipe(Effect.flatMap(({ execute: executeDocument }) => executeDocument(request)))
28
+ : Effect.die("Pathless request escaped the CLI edge");
29
+ return loaded.pipe(Effect.catchEager(() => Effect.succeed(internalError(request))));
30
+ };
31
+ export class ApplicationExecutor extends Context.Service()("@sjunepark/fs/ApplicationExecutor") {
32
+ static live = Layer.succeed(ApplicationExecutor, { execute });
33
+ }
34
+ //# sourceMappingURL=application.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application.js","sourceRoot":"","sources":["../src/application.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAgDtD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAA2B,EAAiB,EAAE,CAAC,CAAC;IAC5E,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC;QACpC,KAAK,EAAE;YACL,SAAS,EAAE,OAAO,CAAC,OAAO;YAC1B,IAAI,EAAE,gBAAgB;YACtB,OAAO,EAAE,iDAAiD;SAC3D;QACD,IAAI,EAAE,EAAE;KACT,CAAC,IAAI,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACvB,QAAQ,EAAE,CAAC;CACZ,CAAC,CAAA;AAEF,MAAM,OAAO,GAAG,CAAC,OAA2B,EAAoD,EAAE;IAChG,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS;QAC1E,CAAC,CAAC,MAAM,CAA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const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
5
+ const readAsset = (relativePath) => readFileSync(resolve(packageRoot, relativePath));
6
+ export const authoringGuide = () => readAsset("assets/guide/authoring.md");
7
+ const schemaPaths = {
8
+ document: "schema/fs-document.schema.json",
9
+ "validation-result": "schema/validation-result.schema.json",
10
+ "snapshot-diff": "schema/snapshot-diff.schema.json"
11
+ };
12
+ export const schemaNames = Object.keys(schemaPaths);
13
+ export const schemaAsset = (name) => readAsset(schemaPaths[name]);
14
+ const examplePaths = {
15
+ minimal: "examples/minimal.json",
16
+ "manufacturing-group": "examples/manufacturing-group.json"
17
+ };
18
+ export const exampleNames = Object.keys(examplePaths);
19
+ export const exampleAsset = (name) => readAsset(examplePaths[name]);
20
+ //# sourceMappingURL=assets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assets.js","sourceRoot":"","sources":["../src/assets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAA;AAE1E,MAAM,SAAS,GAAG,CAAC,YAAoB,EAAU,EAAE,CACjD,YAAY,CAAC,OAAO,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC,CAAA;AAElD,MAAM,CAAC,MAAM,cAAc,GAAG,GAAW,EAAE,CAAC,SAAS,CAAC,2BAA2B,CAAC,CAAA;AAElF,MAAM,WAAW,GAAG;IAClB,QAAQ,EAAE,gCAAgC;IAC1C,mBAAmB,EAAE,sCAAsC;IAC3D,eAAe,EAAE,kCAAkC;CAC3C,CAAA;AAIV,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAA8B,CAAA;AAEhF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAgB,EAAU,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAA;AAErF,MAAM,YAAY,GAAG;IACnB,OAAO,EAAE,uBAAuB;IAChC,qBAAqB,EAAE,mCAAmC;CAClD,CAAA;AAIV,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAA+B,CAAA;AAEnF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAiB,EAAU,EAAE,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAA"}
package/dist/bin.js ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ import { runMain } from "@effect/platform-node-shared/NodeRuntime";
3
+ import { Effect, Layer } from "effect";
4
+ import { ApplicationExecutor } from "./application.js";
5
+ import { noColorOutput, program } from "./cli.js";
6
+ import { nodeServices } from "./node-services.js";
7
+ const mainLayer = nodeServices.pipe(Layer.merge(noColorOutput), Layer.merge(ApplicationExecutor.live));
8
+ runMain(program.pipe(Effect.provide(mainLayer)), { disableErrorReporting: true });
9
+ //# sourceMappingURL=bin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,0CAA0C,CAAA;AAClE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAEtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CACjC,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,EAC1B,KAAK,CAAC,KAAK,CAAC,mBAAmB,CAAC,IAAI,CAAC,CACtC,CAAA;AAED,OAAO,CACL,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EACvC,EAAE,qBAAqB,EAAE,IAAI,EAAE,CAChC,CAAA"}
package/dist/cli.js ADDED
@@ -0,0 +1,150 @@
1
+ import { Console, Data, Effect, Option, Runtime, Stdio, Stream } from "effect";
2
+ import { Argument, CliError, CliOutput, Command, Flag, GlobalFlag } from "effect/unstable/cli";
3
+ import packageMetadata from "../package.json" with { type: "json" };
4
+ import { exampleNames, schemaNames } from "./assets.js";
5
+ import { ApplicationExecutor, internalError } from "./application.js";
6
+ import {} from "./logger.js";
7
+ import { runPathless } from "./pathless.js";
8
+ class ReportedExit extends Data.TaggedError("ReportedExit") {
9
+ [Runtime.errorReported] = false;
10
+ get [Runtime.errorExitCode]() {
11
+ return this.exitCode;
12
+ }
13
+ }
14
+ const failWithUsage = (commandPath, error) => Effect.fail(new CliError.ShowHelp({ commandPath, errors: [error] }));
15
+ const writeResult = (result) => Effect.gen(function* () {
16
+ const stdio = yield* Stdio.Stdio;
17
+ yield* Stream.make(result.stdout).pipe(Stream.run(stdio.stdout({ endOnDone: false })), Effect.mapError(() => new ReportedExit({ exitCode: 1 })));
18
+ yield* Stream.make(result.stderr).pipe(Stream.run(stdio.stderr({ endOnDone: false })), Effect.mapError(() => new ReportedExit({ exitCode: 1 })));
19
+ if (result.exitCode === 1)
20
+ return yield* new ReportedExit({ exitCode: 1 });
21
+ });
22
+ const dispatch = (request) => Effect.gen(function* () {
23
+ const immediate = yield* Effect.try({
24
+ try: () => runPathless(request),
25
+ catch: () => internalError(request)
26
+ }).pipe(Effect.catch((result) => Effect.succeed(result)));
27
+ const result = immediate ?? (yield* ApplicationExecutor.pipe(Effect.flatMap((executor) => executor.execute(request))));
28
+ yield* writeResult(result);
29
+ });
30
+ const currentLogLevel = Effect.gen(function* () {
31
+ const selected = yield* GlobalFlag.LogLevel;
32
+ return Option.match(selected, {
33
+ onNone: () => "none",
34
+ onSome: (level) => {
35
+ switch (level) {
36
+ case "All":
37
+ return "trace";
38
+ case "Trace":
39
+ return "trace";
40
+ case "Debug":
41
+ return "debug";
42
+ case "Info":
43
+ return "info";
44
+ case "Warn":
45
+ return "warn";
46
+ case "Error":
47
+ return "error";
48
+ case "Fatal":
49
+ return "fatal";
50
+ case "None":
51
+ return "none";
52
+ }
53
+ }
54
+ });
55
+ });
56
+ const outputFlag = (description) => Flag.string("output").pipe(Flag.filter((path) => path.length > 0, () => "Expected a non-empty output path"), Flag.withDescription(description), Flag.atMost(1));
57
+ const firstOutput = (outputs) => outputs[0];
58
+ const exactSchemaName = Argument.choice("name", schemaNames).pipe(Argument.withDescription("Exactly one bundled schema name: document, validation-result, or snapshot-diff."), Argument.variadic(), Argument.filter((names) => names.length === 1, (names) => `Exactly one schema name is required; received ${names.join(", ") || "none"}`), Argument.map((names) => names[0]));
59
+ const schema = Command.make("schema", {
60
+ output: outputFlag("Create the exact schema bytes at this new path."),
61
+ name: exactSchemaName
62
+ }, ({ name, output }) => {
63
+ const path = firstOutput(output);
64
+ return dispatch({ command: "schema", name, ...(path === undefined ? {} : { output: path }) });
65
+ }).pipe(Command.withDescription("Read or copy an exact bundled FS JSON Schema."));
66
+ const exampleName = Argument.choice("name", exampleNames).pipe(Argument.withDescription("Zero or one bundled example name: minimal or manufacturing-group."), Argument.variadic(), Argument.filter((names) => names.length <= 1, (names) => `At most one example name is accepted; received ${names.join(", ")}`));
67
+ const example = Command.make("example", {
68
+ output: outputFlag("Create the exact named example bytes at this new path."),
69
+ name: exampleName
70
+ }, ({ name, output }) => Effect.gen(function* () {
71
+ const path = firstOutput(output);
72
+ const selected = name[0];
73
+ if (selected === undefined && path !== undefined) {
74
+ return yield* failWithUsage(["fs", "example"], new CliError.MissingArgument({ argument: "name" }));
75
+ }
76
+ yield* selected === undefined
77
+ ? dispatch({ command: "example", name: null })
78
+ : dispatch({
79
+ command: "example",
80
+ name: selected,
81
+ ...(path === undefined ? {} : { output: path })
82
+ });
83
+ })).pipe(Command.withDescription("List, read, or copy exact bundled FS examples."));
84
+ const exactDocument = Argument.string("document").pipe(Argument.filter((path) => path.length > 0, () => "Expected a document path or - for standard input"), Argument.withDescription("Exactly one document path or - for standard input."), Argument.variadic(), Argument.filter((paths) => paths.length === 1, (paths) => `Exactly one document is required; received ${paths.join(", ") || "none"}`), Argument.map((paths) => paths[0]));
85
+ const validate = Command.make("validate", { document: exactDocument }, ({ document }) => Effect.gen(function* () {
86
+ const logLevel = yield* currentLogLevel;
87
+ yield* dispatch({ command: "validate", input: document, logLevel });
88
+ })).pipe(Command.withDescription("Validate one complete FS document without modifying it."));
89
+ const exactCandidate = Argument.string("candidate").pipe(Argument.filter((path) => path.length > 0, () => "Expected a candidate path or - for standard input"), Argument.withDescription("Exactly one candidate path or - for standard input."), Argument.variadic(), Argument.filter((paths) => paths.length === 1, (paths) => `Exactly one candidate is required; received ${paths.join(", ") || "none"}`), Argument.map((paths) => paths[0]));
90
+ const create = Command.make("create", {
91
+ output: outputFlag("Create the validated candidate bytes at this new path."),
92
+ candidate: exactCandidate
93
+ }, ({ output, candidate }) => Effect.gen(function* () {
94
+ const path = firstOutput(output);
95
+ if (path === undefined) {
96
+ return yield* failWithUsage(["fs", "create"], new CliError.MissingOption({ option: "output" }));
97
+ }
98
+ yield* dispatch({ command: "create", input: candidate, output: path });
99
+ })).pipe(Command.withDescription("Validate and atomically copy exact candidate bytes to a new path."));
100
+ const recordValidation = Command.make("record-validation", {
101
+ output: outputFlag("Create the document with its current validation snapshot at this new path."),
102
+ document: exactDocument
103
+ }, ({ output, document }) => Effect.gen(function* () {
104
+ const path = firstOutput(output);
105
+ if (path === undefined) {
106
+ return yield* failWithUsage(["fs", "record-validation"], new CliError.MissingOption({ option: "output" }));
107
+ }
108
+ const logLevel = yield* currentLogLevel;
109
+ yield* dispatch({
110
+ command: "record-validation",
111
+ input: document,
112
+ output: path,
113
+ logLevel
114
+ });
115
+ })).pipe(Command.withDescription("Validate and atomically create a document containing its current validation snapshot."));
116
+ const render = Command.make("render", {
117
+ output: outputFlag("Create the standalone HTML presentation at this new path."),
118
+ document: exactDocument
119
+ }, ({ output, document }) => Effect.gen(function* () {
120
+ const path = firstOutput(output);
121
+ if (path === undefined) {
122
+ return yield* failWithUsage(["fs", "render"], new CliError.MissingOption({ option: "output" }));
123
+ }
124
+ const logLevel = yield* currentLogLevel;
125
+ yield* dispatch({
126
+ command: "render",
127
+ input: document,
128
+ output: path,
129
+ logLevel
130
+ });
131
+ })).pipe(Command.withDescription("Validate and atomically create a standalone HTML presentation."));
132
+ const noOperands = Argument.string("operand").pipe(Argument.withDescription("No operands are accepted."), Argument.variadic(), Argument.filter((operands) => operands.length === 0, (operands) => `No operands are accepted; received ${operands.join(", ")}`));
133
+ const authoring = Command.make("authoring", { operands: noOperands }, () => dispatch({ command: "guide" })).pipe(Command.withDescription("Show the standalone authoring workflow for an author-resolved financial model."));
134
+ const guide = Command.make("guide", {}, () => failWithUsage(["fs", "guide"], new CliError.MissingArgument({ argument: "topic" }))).pipe(Command.withDescription("Read focused standalone FS guidance."), Command.withSubcommands([authoring]));
135
+ const root = Command.make("fs", {}, () => dispatch({ command: "fs" })).pipe(Command.withDescription("Inspect, validate, snapshot, render, and safely create FS documents. Diagnostic logging defaults to none."), Command.withSubcommands([guide, schema, example, validate, create, recordValidation, render]));
136
+ export const noColorOutput = CliOutput.layer(CliOutput.defaultFormatter({ colors: false }));
137
+ const runCommand = Command.runWith(root, { version: packageMetadata.version });
138
+ export const program = Effect.gen(function* () {
139
+ const stdio = yield* Stdio.Stdio;
140
+ const args = yield* stdio.args;
141
+ yield* runCommand(args).pipe(Effect.catchIf((error) => CliError.isCliError(error), (error) => error._tag === "ShowHelp"
142
+ ? Effect.fail(new ReportedExit({ exitCode: 2 }))
143
+ : Effect.gen(function* () {
144
+ yield* runCommand([...args, "--help"]).pipe(Effect.ignore);
145
+ const formatter = yield* CliOutput.Formatter;
146
+ yield* Console.error(formatter.formatError(error));
147
+ return yield* new ReportedExit({ exitCode: 2 });
148
+ })));
149
+ });
150
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC9E,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,OAAO,EACP,IAAI,EACJ,UAAU,EACX,MAAM,qBAAqB,CAAA;AAE5B,OAAO,eAAe,MAAM,iBAAiB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AACnE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAqC,MAAM,aAAa,CAAA;AAC1F,OAAO,EACL,mBAAmB,EACnB,aAAa,EAGd,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAiB,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,MAAM,YAAa,SAAQ,IAAI,CAAC,WAAW,CAAC,cAAc,CAExD;IACkB,CAAC,OAAO,CAAC,aAAa,CAAC,GAAG,KAAK,CAAA;IACjD,IAAa,CAAC,OAAO,CAAC,aAAa,CAAC;QAClC,OAAO,IAAI,CAAC,QAAQ,CAAA;IACtB,CAAC;CACF;AAED,MAAM,aAAa,GAAG,CACpB,WAAkC,EAClC,KAAiC,EACQ,EAAE,CAC3C,MAAM,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAA;AAEtE,MAAM,WAAW,GAAG,CAAC,MAAqB,EAAkD,EAAE,CAC5F,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;I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