@disusered/okf-cli 0.0.0-bootstrap → 1.0.0-rc.3

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/LICENSE ADDED
@@ -0,0 +1,203 @@
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.
203
+
package/README.md CHANGED
@@ -1,7 +1,51 @@
1
1
  # @disusered/okf-cli
2
2
 
3
- This package version exists only to establish npm Trusted Publishing for
4
- [OKF Toolkit](https://github.com/disusered/okf-toolkit).
3
+ `@disusered/okf-cli` installs the `okf` binary. The CLI writes deterministic
4
+ JSON by default and accepts `--json` so calling programs can state the contract
5
+ explicitly. Every command operates on exactly one bundle.
5
6
 
6
- Use a release from the `next` or `latest` tag. This version contains no runtime
7
- code.
7
+ ```sh
8
+ okf inspect docs --json
9
+ okf validate docs --strict
10
+ okf search docs "box office"
11
+ okf read docs concepts/settlement.md
12
+ okf visualize docs --out .okf/viz.html
13
+ okf watch docs --out .okf/viz.html
14
+ ```
15
+
16
+ When a target is a repository rather than a bundle root, discovery uses only
17
+ `.agents/okf.yaml`. Use `--bundle NAME` when the manifest declares more than one
18
+ bundle.
19
+
20
+ ## Change operations
21
+
22
+ Changes are JSON on standard input by default, or from `--input FILE`. Preview
23
+ the exact file, review its diff and diagnostics, then pass its `preview_id` to
24
+ apply:
25
+
26
+ ```sh
27
+ okf change preview docs --input change.json
28
+ okf change apply docs --input change.json --preview-id sha256:REVIEWED_ID
29
+ ```
30
+
31
+ The accepted operations are `create`, `update`, `delete`, and `move`. Updates,
32
+ deletes, and moves require `expected_revision`. Apply rejects a missing or
33
+ mismatched preview ID before mutation. It then validates the proposed bundle,
34
+ rechecks live filesystem state, writes the change to disk, and validates the
35
+ result. Repeating an accepted request returns `unchanged` if the requested state
36
+ already exists.
37
+
38
+ ## Consumer profiles
39
+
40
+ The base CLI has no named profile registry and rejects `--profile NAME`.
41
+ Trusted local wrappers can explicitly pass `--profile-module FILE`, where the
42
+ built JavaScript module exports a `profile` object compatible with
43
+ `okf-core`'s `ValidationProfile`. Hosted consumers compose profiles directly in
44
+ code. The CLI never executes validation command arrays from a manifest.
45
+
46
+ ## Exit status
47
+
48
+ - `0`: command completed, validation passed, or a change was applied/unchanged.
49
+ - `1`: validation failed or a change preview/apply was rejected.
50
+ - `2`: arguments, I/O, configuration, or input were invalid. The error is JSON
51
+ on standard error.
@@ -0,0 +1,19 @@
1
+ export interface CliArguments {
2
+ readonly command: string;
3
+ readonly subcommand: string | null;
4
+ readonly positionals: readonly string[];
5
+ readonly bundle?: string;
6
+ readonly profile?: string;
7
+ readonly profileModule?: string;
8
+ readonly previewId?: string;
9
+ readonly out?: string;
10
+ readonly input?: string;
11
+ readonly limit?: number;
12
+ readonly debounce?: number;
13
+ /** Deterministic YYYY-MM-DD used for staleness. Never defaulted from the system clock. */
14
+ readonly today?: string;
15
+ readonly strict: boolean;
16
+ readonly help: boolean;
17
+ }
18
+ export declare function parseArguments(argv: readonly string[]): CliArguments;
19
+ //# sourceMappingURL=arguments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arguments.d.ts","sourceRoot":"","sources":["../src/arguments.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,0FAA0F;IAC1F,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB;AAcD,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,YAAY,CAmFpE"}
@@ -0,0 +1,91 @@
1
+ const VALUE_OPTIONS = new Set([
2
+ "--bundle",
3
+ "--profile",
4
+ "--profile-module",
5
+ "--preview-id",
6
+ "--out",
7
+ "--input",
8
+ "--limit",
9
+ "--debounce",
10
+ "--today",
11
+ ]);
12
+ export function parseArguments(argv) {
13
+ if (argv.length === 0) {
14
+ return { command: "help", subcommand: null, positionals: [], strict: false, help: true };
15
+ }
16
+ let command = argv[0];
17
+ let subcommand = null;
18
+ let cursor = 1;
19
+ if (command === "change") {
20
+ subcommand = argv[cursor] ?? null;
21
+ cursor += 1;
22
+ }
23
+ const positionals = [];
24
+ const options = {};
25
+ let help = command === "help";
26
+ let strict = false;
27
+ while (cursor < argv.length) {
28
+ const argument = argv[cursor];
29
+ cursor += 1;
30
+ if (argument === "--json") {
31
+ continue;
32
+ }
33
+ if (argument === "--strict") {
34
+ strict = true;
35
+ continue;
36
+ }
37
+ if (argument === "--help" || argument === "-h") {
38
+ help = true;
39
+ continue;
40
+ }
41
+ if (VALUE_OPTIONS.has(argument)) {
42
+ const value = argv[cursor];
43
+ if (value === undefined || value.startsWith("--")) {
44
+ throw new Error(`${argument} requires a value`);
45
+ }
46
+ options[argument] = value;
47
+ cursor += 1;
48
+ continue;
49
+ }
50
+ if (argument.startsWith("-")) {
51
+ throw new Error(`unknown option: ${argument}`);
52
+ }
53
+ positionals.push(argument);
54
+ }
55
+ const integerOption = (name) => {
56
+ const value = options[name];
57
+ if (value === undefined) {
58
+ return undefined;
59
+ }
60
+ const parsed = Number(value);
61
+ if (!Number.isSafeInteger(parsed) || parsed < 1) {
62
+ throw new Error(`${name} must be a positive integer`);
63
+ }
64
+ return parsed;
65
+ };
66
+ const limit = integerOption("--limit");
67
+ const debounce = integerOption("--debounce");
68
+ // Fail here rather than relying on core's guidance warning: at a terminal a mistyped date
69
+ // should stop the command, not quietly leave every page unjudged.
70
+ const today = options["--today"];
71
+ if (today !== undefined && !/^\d{4}-\d{2}-\d{2}$/.test(today)) {
72
+ throw new Error("--today must be a YYYY-MM-DD date");
73
+ }
74
+ return {
75
+ command,
76
+ subcommand,
77
+ positionals,
78
+ ...(options["--bundle"] === undefined ? {} : { bundle: options["--bundle"] }),
79
+ ...(options["--profile"] === undefined ? {} : { profile: options["--profile"] }),
80
+ ...(options["--profile-module"] === undefined ? {} : { profileModule: options["--profile-module"] }),
81
+ ...(options["--preview-id"] === undefined ? {} : { previewId: options["--preview-id"] }),
82
+ ...(options["--out"] === undefined ? {} : { out: options["--out"] }),
83
+ ...(options["--input"] === undefined ? {} : { input: options["--input"] }),
84
+ ...(limit === undefined ? {} : { limit }),
85
+ ...(debounce === undefined ? {} : { debounce }),
86
+ ...(today === undefined ? {} : { today }),
87
+ strict,
88
+ help,
89
+ };
90
+ }
91
+ //# sourceMappingURL=arguments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arguments.js","sourceRoot":"","sources":["../src/arguments.ts"],"names":[],"mappings":"AAkBA,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC;IAC5B,UAAU;IACV,WAAW;IACX,kBAAkB;IAClB,cAAc;IACd,OAAO;IACP,SAAS;IACT,SAAS;IACT,YAAY;IACZ,SAAS;CACV,CAAC,CAAC;AAEH,MAAM,UAAU,cAAc,CAAC,IAAuB;IACpD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,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r/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=bin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":""}
package/dist/bin.js ADDED
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env node
2
+ import { runCli } from "./index.js";
3
+ async function readStdin() {
4
+ const chunks = [];
5
+ for await (const chunk of process.stdin) {
6
+ chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
7
+ }
8
+ return Buffer.concat(chunks).toString("utf8");
9
+ }
10
+ const controller = new AbortController();
11
+ process.once("SIGINT", () => controller.abort());
12
+ process.once("SIGTERM", () => controller.abort());
13
+ process.exitCode = await runCli(process.argv.slice(2), {
14
+ cwd: process.cwd(),
15
+ readStdin,
16
+ stdout: (value) => process.stdout.write(value),
17
+ stderr: (value) => process.stderr.write(value),
18
+ signal: controller.signal,
19
+ });
20
+ //# sourceMappingURL=bin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,KAAK,UAAU,SAAS;IACtB,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QACxC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACnE,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;AACzC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC;AACjD,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC;AAElD,OAAO,CAAC,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;IACrD,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;IAClB,SAAS;IACT,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;IAC9C,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;IAC9C,MAAM,EAAE,UAAU,CAAC,MAAM;CAC1B,CAAC,CAAC"}
package/dist/help.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export declare const HELP = "Usage: okf <command> [target] [options]\n\nEvery command operates on exactly one OKF bundle. The CLI writes JSON by\ndefault. Use --json to state that contract explicitly.\n\nCommands:\n context [target] Read manifest-scoped instructions\n list [target] List analyzed Markdown documents\n search [target] <query...> Search one bundle\n read [target] <path> Read one analyzed document\n links [target] [path] List resolved links\n validate [target] Emit grouped diagnostics\n inspect [target] Emit the okf.inspect.v1 snapshot\n visualize [target] --out FILE Generate a self-contained HTML viewer\n watch [target] --out FILE Rebuild the viewer when Markdown changes\n change preview [target] --input FILE|-\n change apply [target] --preview-id ID --input FILE|-\n\nOptions:\n --bundle NAME Select one bundle from .agents/okf.yaml\n --profile-module FILE\n Load a consumer-owned module exporting profile\n --preview-id ID Apply the exact canonical change reviewed by preview\n --strict Make OKF guidance warnings fail validation\n --today DATE Evaluate stale_after against YYYY-MM-DD; omit to stay reproducible\n --limit NUMBER Limit search results\n --out FILE Visualization output path\n --input FILE|- JSON change request (default: stdin)\n --debounce MS Watch debounce in milliseconds\n --json Explicitly request the default JSON output\n\nThe CLI does not support named --profile values. Profiles are consumer-owned;\nhosted consumers compose them in code, and local wrappers can pass\n--profile-module.\n";
2
+ //# sourceMappingURL=help.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,gqDAkChB,CAAC"}
package/dist/help.js ADDED
@@ -0,0 +1,36 @@
1
+ export const HELP = `Usage: okf <command> [target] [options]
2
+
3
+ Every command operates on exactly one OKF bundle. The CLI writes JSON by
4
+ default. Use --json to state that contract explicitly.
5
+
6
+ Commands:
7
+ context [target] Read manifest-scoped instructions
8
+ list [target] List analyzed Markdown documents
9
+ search [target] <query...> Search one bundle
10
+ read [target] <path> Read one analyzed document
11
+ links [target] [path] List resolved links
12
+ validate [target] Emit grouped diagnostics
13
+ inspect [target] Emit the okf.inspect.v1 snapshot
14
+ visualize [target] --out FILE Generate a self-contained HTML viewer
15
+ watch [target] --out FILE Rebuild the viewer when Markdown changes
16
+ change preview [target] --input FILE|-
17
+ change apply [target] --preview-id ID --input FILE|-
18
+
19
+ Options:
20
+ --bundle NAME Select one bundle from .agents/okf.yaml
21
+ --profile-module FILE
22
+ Load a consumer-owned module exporting profile
23
+ --preview-id ID Apply the exact canonical change reviewed by preview
24
+ --strict Make OKF guidance warnings fail validation
25
+ --today DATE Evaluate stale_after against YYYY-MM-DD; omit to stay reproducible
26
+ --limit NUMBER Limit search results
27
+ --out FILE Visualization output path
28
+ --input FILE|- JSON change request (default: stdin)
29
+ --debounce MS Watch debounce in milliseconds
30
+ --json Explicitly request the default JSON output
31
+
32
+ The CLI does not support named --profile values. Profiles are consumer-owned;
33
+ hosted consumers compose them in code, and local wrappers can pass
34
+ --profile-module.
35
+ `;
36
+ //# sourceMappingURL=help.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"help.js","sourceRoot":"","sources":["../src/help.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCnB,CAAC"}
@@ -0,0 +1,11 @@
1
+ export interface CliIo {
2
+ readonly cwd: string;
3
+ readonly readStdin: () => Promise<string>;
4
+ readonly stdout: (value: string) => void;
5
+ readonly stderr: (value: string) => void;
6
+ readonly signal?: AbortSignal;
7
+ }
8
+ export declare function runCli(argv: readonly string[], io: CliIo): Promise<number>;
9
+ export { parseArguments } from "./arguments.js";
10
+ export { stableJson } from "./json.js";
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAmBA,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,SAAS,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1C,QAAQ,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;AA2PD,wBAAsB,MAAM,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CA8BhF;AAED,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,274 @@
1
+ import { mkdir, readFile, writeFile } from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { searchBundle } from "okf-core";
4
+ import { applyChange, loadValidationProfile, parseChange, previewChange, readBundleContext, resolveBundleTarget, watchBundle, } from "okf-node";
5
+ import { generateVisualization } from "okf-viz";
6
+ import { parseArguments } from "./arguments.js";
7
+ import { HELP } from "./help.js";
8
+ import { stableJson } from "./json.js";
9
+ function errorMessage(error) {
10
+ return error instanceof Error ? error.message : String(error);
11
+ }
12
+ function targetAndRest(arguments_, minimumRest = 0) {
13
+ const values = [...arguments_.positionals];
14
+ if (values.length <= minimumRest) {
15
+ return { target: ".", rest: values };
16
+ }
17
+ return { target: values.shift(), rest: values };
18
+ }
19
+ async function analyzeOptions(arguments_, io) {
20
+ if (arguments_.profile !== undefined) {
21
+ throw new Error("The CLI does not support named --profile values; use --profile-module with a trusted consumer module");
22
+ }
23
+ const today = arguments_.today === undefined ? {} : { today: arguments_.today };
24
+ if (arguments_.profileModule === undefined) {
25
+ return today;
26
+ }
27
+ return { ...today, profile: await loadValidationProfile(io.cwd, arguments_.profileModule) };
28
+ }
29
+ async function resolve(arguments_, io, minimumRest = 0) {
30
+ const values = targetAndRest(arguments_, minimumRest);
31
+ return {
32
+ target: await resolveBundleTarget(path.resolve(io.cwd, values.target), arguments_.bundle),
33
+ rest: values.rest,
34
+ };
35
+ }
36
+ async function readChangeInput(arguments_, io) {
37
+ const input = arguments_.input ?? "-";
38
+ const text = input === "-" ? await io.readStdin() : await readFile(path.resolve(io.cwd, input), "utf8");
39
+ try {
40
+ return JSON.parse(text);
41
+ }
42
+ catch (error) {
43
+ throw new Error(`change input is not valid JSON: ${errorMessage(error)}`);
44
+ }
45
+ }
46
+ async function runContext(arguments_, io) {
47
+ const { target, rest } = await resolve(arguments_, io);
48
+ if (rest.length > 0) {
49
+ throw new Error("context accepts at most one target");
50
+ }
51
+ io.stdout(stableJson({
52
+ schema: "okf.context.v1",
53
+ bundle: { name: target.name },
54
+ documents: await readBundleContext(target),
55
+ }));
56
+ return 0;
57
+ }
58
+ async function runList(arguments_, io) {
59
+ const { target, rest } = await resolve(arguments_, io);
60
+ if (rest.length > 0) {
61
+ throw new Error("list accepts at most one target");
62
+ }
63
+ const analysis = await target.bundle.analyze(await analyzeOptions(arguments_, io));
64
+ io.stdout(stableJson({
65
+ schema: "okf.list.v1",
66
+ documents: analysis.documents.map((document) => ({
67
+ path: document.path,
68
+ id: document.id,
69
+ kind: document.kind,
70
+ revision: document.revision,
71
+ title: document.derived.title,
72
+ type: document.derived.type,
73
+ description: document.derived.description,
74
+ status: document.derived.status,
75
+ trustTier: document.derived.trustTier,
76
+ })),
77
+ }));
78
+ return 0;
79
+ }
80
+ async function runSearch(arguments_, io) {
81
+ const { target, rest } = await resolve(arguments_, io, 1);
82
+ if (rest.length === 0) {
83
+ throw new Error("search requires a query");
84
+ }
85
+ const analysis = await target.bundle.analyze(await analyzeOptions(arguments_, io));
86
+ io.stdout(stableJson({
87
+ schema: "okf.search.v1",
88
+ ...searchBundle(analysis, rest.join(" "), arguments_.limit),
89
+ }));
90
+ return 0;
91
+ }
92
+ async function runRead(arguments_, io) {
93
+ const { target, rest } = await resolve(arguments_, io, 1);
94
+ if (rest.length !== 1) {
95
+ throw new Error("read requires exactly one bundle-relative document path");
96
+ }
97
+ const analysis = await target.bundle.analyze(await analyzeOptions(arguments_, io));
98
+ const document = analysis.documents.find((candidate) => candidate.path === rest[0]);
99
+ if (document === undefined) {
100
+ throw new Error(`document not found: ${rest[0]}`);
101
+ }
102
+ io.stdout(stableJson({ schema: "okf.read.v1", document }));
103
+ return 0;
104
+ }
105
+ async function runLinks(arguments_, io) {
106
+ const { target, rest } = await resolve(arguments_, io);
107
+ if (rest.length > 1) {
108
+ throw new Error("links accepts at most one document path after the target");
109
+ }
110
+ const analysis = await target.bundle.analyze(await analyzeOptions(arguments_, io));
111
+ const documents = rest.length === 0
112
+ ? analysis.documents
113
+ : analysis.documents.filter((document) => document.path === rest[0]);
114
+ if (rest.length === 1 && documents.length === 0) {
115
+ throw new Error(`document not found: ${rest[0]}`);
116
+ }
117
+ io.stdout(stableJson({
118
+ schema: "okf.links.v1",
119
+ links: documents.flatMap((document) => document.links.map((link) => ({ source: document.path, ...link }))),
120
+ }));
121
+ return 0;
122
+ }
123
+ async function runValidate(arguments_, io) {
124
+ const { target, rest } = await resolve(arguments_, io);
125
+ if (rest.length > 0) {
126
+ throw new Error("validate accepts at most one target");
127
+ }
128
+ const analysis = await target.bundle.analyze(await analyzeOptions(arguments_, io));
129
+ const strictFailure = arguments_.strict
130
+ && analysis.diagnostics.guidance.some((diagnostic) => diagnostic.severity === "warning");
131
+ io.stdout(stableJson({
132
+ schema: "okf.validate.v1",
133
+ passed: analysis.summary.errors === 0 && !strictFailure,
134
+ strict: arguments_.strict,
135
+ summary: analysis.summary,
136
+ diagnostics: analysis.diagnostics,
137
+ }));
138
+ return analysis.summary.errors === 0 && !strictFailure ? 0 : 1;
139
+ }
140
+ async function runInspect(arguments_, io) {
141
+ const { target, rest } = await resolve(arguments_, io);
142
+ if (rest.length > 0) {
143
+ throw new Error("inspect accepts at most one target");
144
+ }
145
+ io.stdout(stableJson(await target.bundle.analyze(await analyzeOptions(arguments_, io))));
146
+ return 0;
147
+ }
148
+ async function writeVisualization(arguments_, io) {
149
+ if (arguments_.out === undefined) {
150
+ throw new Error("visualize and watch require --out FILE");
151
+ }
152
+ const { target, rest } = await resolve(arguments_, io);
153
+ if (rest.length > 0) {
154
+ throw new Error("visualize and watch accept at most one target");
155
+ }
156
+ const analysis = await target.bundle.analyze(await analyzeOptions(arguments_, io));
157
+ const output = path.resolve(io.cwd, arguments_.out);
158
+ await mkdir(path.dirname(output), { recursive: true });
159
+ await writeFile(output, generateVisualization({
160
+ bundle: target.name ?? path.basename(target.bundle.root),
161
+ analysis,
162
+ // Explicit only. Never default to the system clock, or `okf visualize` stops being
163
+ // reproducible for every consumer that does not pass the flag.
164
+ evaluatedAt: arguments_.today ?? null,
165
+ }), "utf8");
166
+ return { output, analysis, target };
167
+ }
168
+ async function runVisualize(arguments_, io) {
169
+ const result = await writeVisualization(arguments_, io);
170
+ io.stdout(stableJson({
171
+ schema: "okf.visualize.v1",
172
+ output: path.relative(io.cwd, result.output) || path.basename(result.output),
173
+ summary: result.analysis.summary,
174
+ }));
175
+ return 0;
176
+ }
177
+ async function runWatch(arguments_, io) {
178
+ const initial = await writeVisualization(arguments_, io);
179
+ io.stdout(stableJson({
180
+ schema: "okf.watch.v1",
181
+ changed: [],
182
+ output: path.relative(io.cwd, initial.output) || path.basename(initial.output),
183
+ summary: initial.analysis.summary,
184
+ }));
185
+ watchBundle(initial.target.bundle, async (event) => {
186
+ await writeFile(initial.output, generateVisualization({
187
+ bundle: initial.target.name ?? path.basename(initial.target.bundle.root),
188
+ analysis: event.analysis,
189
+ evaluatedAt: arguments_.today ?? null,
190
+ }), "utf8");
191
+ io.stdout(stableJson({
192
+ schema: event.schema,
193
+ changed: event.changed,
194
+ output: path.relative(io.cwd, initial.output) || path.basename(initial.output),
195
+ summary: event.analysis.summary,
196
+ }));
197
+ }, {
198
+ debounceMs: arguments_.debounce,
199
+ analyze: await analyzeOptions(arguments_, io),
200
+ signal: io.signal,
201
+ });
202
+ await new Promise((resolvePromise) => {
203
+ if (io.signal?.aborted === true) {
204
+ resolvePromise();
205
+ }
206
+ else {
207
+ io.signal?.addEventListener("abort", () => resolvePromise(), { once: true });
208
+ }
209
+ });
210
+ return 0;
211
+ }
212
+ async function runChange(arguments_, io) {
213
+ if (arguments_.subcommand !== "preview" && arguments_.subcommand !== "apply") {
214
+ throw new Error("change requires a preview or apply subcommand");
215
+ }
216
+ const { target, rest } = await resolve(arguments_, io);
217
+ if (rest.length > 0) {
218
+ throw new Error("change accepts at most one target");
219
+ }
220
+ const change = parseChange(await readChangeInput(arguments_, io));
221
+ const options = await analyzeOptions(arguments_, io);
222
+ if (arguments_.subcommand === "preview") {
223
+ if (arguments_.previewId !== undefined) {
224
+ throw new Error("Use --preview-id only with change apply");
225
+ }
226
+ const preview = await previewChange(target.bundle, change, options);
227
+ io.stdout(stableJson(preview));
228
+ return preview.passed ? 0 : 1;
229
+ }
230
+ if (arguments_.previewId === undefined) {
231
+ throw new Error("change apply requires --preview-id from change preview");
232
+ }
233
+ const result = await applyChange(target.bundle, {
234
+ change,
235
+ preview_id: arguments_.previewId,
236
+ }, options);
237
+ io.stdout(stableJson(result));
238
+ return result.outcome === "rejected" ? 1 : 0;
239
+ }
240
+ export async function runCli(argv, io) {
241
+ try {
242
+ const arguments_ = parseArguments(argv);
243
+ if (arguments_.help) {
244
+ io.stdout(HELP);
245
+ return 0;
246
+ }
247
+ switch (arguments_.command) {
248
+ case "context": return await runContext(arguments_, io);
249
+ case "list": return await runList(arguments_, io);
250
+ case "search": return await runSearch(arguments_, io);
251
+ case "read": return await runRead(arguments_, io);
252
+ case "links": return await runLinks(arguments_, io);
253
+ case "validate": return await runValidate(arguments_, io);
254
+ case "inspect": return await runInspect(arguments_, io);
255
+ case "visualize": return await runVisualize(arguments_, io);
256
+ case "watch": return await runWatch(arguments_, io);
257
+ case "change": return await runChange(arguments_, io);
258
+ default: throw new Error(`unknown command: ${arguments_.command}`);
259
+ }
260
+ }
261
+ catch (error) {
262
+ io.stderr(stableJson({
263
+ schema: "okf.error.v1",
264
+ error: {
265
+ code: typeof error === "object" && error !== null && "code" in error ? String(error.code) : "OKF_CLI_ERROR",
266
+ message: error instanceof Error ? error.message : String(error),
267
+ },
268
+ }));
269
+ return 2;
270
+ }
271
+ }
272
+ export { parseArguments } from "./arguments.js";
273
+ export { stableJson } from "./json.js";
274
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,YAAY,EAA6B,MAAM,UAAU,CAAC;AACnE,OAAO,EACL,WAAW,EACX,qBAAqB,EACrB,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,WAAW,GAEZ,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,E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UAAU,CAAC;YACnB,MAAM,EAAE,cAAc;YACtB,KAAK,EAAE;gBACL,IAAI,EAAE,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,eAAe;gBAC3G,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;aAChE;SACF,CAAC,CAAC,CAAC;QACJ,OAAO,CAAC,CAAC;IACX,CAAC;AACH,CAAC;AAED,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC"}
package/dist/json.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export declare function stableJson(value: unknown): string;
2
+ //# sourceMappingURL=json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../src/json.ts"],"names":[],"mappings":"AAqBA,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEjD"}
package/dist/json.js ADDED
@@ -0,0 +1,20 @@
1
+ import { byCodePoint } from "okf-core";
2
+ function mapping(value) {
3
+ return typeof value === "object" && value !== null && !Array.isArray(value);
4
+ }
5
+ function canonicalize(value) {
6
+ if (Array.isArray(value)) {
7
+ return value.map(canonicalize);
8
+ }
9
+ if (mapping(value)) {
10
+ return Object.fromEntries(Object.keys(value)
11
+ .sort(byCodePoint)
12
+ .filter((key) => value[key] !== undefined)
13
+ .map((key) => [key, canonicalize(value[key])]));
14
+ }
15
+ return value;
16
+ }
17
+ export function stableJson(value) {
18
+ return `${JSON.stringify(canonicalize(value), null, 2)}\n`;
19
+ }
20
+ //# sourceMappingURL=json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.js","sourceRoot":"","sources":["../src/json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,SAAS,OAAO,CAAC,KAAc;IAC7B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,YAAY,CAAC,KAAc;IAClC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IACjC,CAAC;IACD,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACnB,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;aACf,IAAI,CAAC,WAAW,CAAC;aACjB,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC;aACzC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CACjD,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;AAC7D,CAAC"}
package/package.json CHANGED
@@ -1,15 +1,49 @@
1
1
  {
2
2
  "name": "@disusered/okf-cli",
3
- "version": "0.0.0-bootstrap",
4
- "description": "Bootstrap package for OKF Toolkit trusted publishing.",
5
- "license": "Apache-2.0",
3
+ "version": "1.0.0-rc.3",
4
+ "description": "Deterministic JSON command-line interface for one OKF bundle at a time",
5
+ "type": "module",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/disusered/okf-toolkit.git",
9
9
  "directory": "packages/cli"
10
10
  },
11
+ "homepage": "https://github.com/disusered/okf-toolkit#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/disusered/okf-toolkit/issues"
14
+ },
11
15
  "publishConfig": {
12
16
  "access": "public"
13
17
  },
14
- "files": ["README.md"]
15
- }
18
+ "engines": {
19
+ "node": ">=24 <25"
20
+ },
21
+ "bin": {
22
+ "okf": "./dist/bin.js"
23
+ },
24
+ "exports": {
25
+ ".": {
26
+ "types": "./dist/index.d.ts",
27
+ "import": "./dist/index.js"
28
+ }
29
+ },
30
+ "files": [
31
+ "dist"
32
+ ],
33
+ "dependencies": {
34
+ "okf-contracts": "1.0.0-rc.3",
35
+ "okf-core": "1.0.0-rc.3",
36
+ "okf-viz": "1.0.0-rc.3",
37
+ "okf-node": "1.0.0-rc.3"
38
+ },
39
+ "devDependencies": {
40
+ "@types/node": "24.13.3",
41
+ "typescript": "7.0.2"
42
+ },
43
+ "license": "Apache-2.0",
44
+ "scripts": {
45
+ "build": "tsc -p tsconfig.json",
46
+ "typecheck": "tsc --noEmit -p tsconfig.json",
47
+ "test": "tsc -p tsconfig.test.json && node --test .test-dist/test/*.test.js"
48
+ }
49
+ }