okf-cli 0.4.9__tar.gz → 0.5.1__tar.gz
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.
- {okf_cli-0.4.9 → okf_cli-0.5.1}/PKG-INFO +5 -5
- {okf_cli-0.4.9 → okf_cli-0.5.1}/README.md +4 -4
- {okf_cli-0.4.9 → okf_cli-0.5.1}/openwiki/architecture.md +1 -1
- {okf_cli-0.4.9 → okf_cli-0.5.1}/openwiki/operations.md +1 -1
- {okf_cli-0.4.9 → okf_cli-0.5.1}/openwiki/quickstart.md +1 -1
- {okf_cli-0.4.9 → okf_cli-0.5.1}/openwiki/workflows.md +1 -1
- {okf_cli-0.4.9 → okf_cli-0.5.1}/pyproject.toml +1 -1
- {okf_cli-0.4.9 → okf_cli-0.5.1}/src/okf/cli.py +2 -2
- okf_cli-0.4.9/src/okf/commands/show.py → okf_cli-0.5.1/src/okf/commands/read.py +6 -3
- {okf_cli-0.4.9 → okf_cli-0.5.1}/tests/test_api.py +1 -1
- {okf_cli-0.4.9 → okf_cli-0.5.1}/tests/test_cli.py +9 -9
- {okf_cli-0.4.9 → okf_cli-0.5.1}/uv.lock +1 -1
- {okf_cli-0.4.9 → okf_cli-0.5.1}/.github/workflows/test.yml +0 -0
- {okf_cli-0.4.9 → okf_cli-0.5.1}/.gitignore +0 -0
- {okf_cli-0.4.9 → okf_cli-0.5.1}/.last-update.json +0 -0
- {okf_cli-0.4.9 → okf_cli-0.5.1}/AGENTS.md +0 -0
- {okf_cli-0.4.9 → okf_cli-0.5.1}/LICENSE +0 -0
- {okf_cli-0.4.9 → okf_cli-0.5.1}/OKF_SPEC.md +0 -0
- {okf_cli-0.4.9 → okf_cli-0.5.1}/example/.okfignore +0 -0
- {okf_cli-0.4.9 → okf_cli-0.5.1}/example/README.md +0 -0
- {okf_cli-0.4.9 → okf_cli-0.5.1}/example/blank-line/no-blank.md +0 -0
- {okf_cli-0.4.9 → okf_cli-0.5.1}/example/blank-line/with-blank.md +0 -0
- {okf_cli-0.4.9 → okf_cli-0.5.1}/example/datasets/sales.md +0 -0
- {okf_cli-0.4.9 → okf_cli-0.5.1}/example/domain.md +0 -0
- {okf_cli-0.4.9 → okf_cli-0.5.1}/example/loose/deep/no-heading.md +0 -0
- {okf_cli-0.4.9 → okf_cli-0.5.1}/example/loose/no-desc.md +0 -0
- {okf_cli-0.4.9 → okf_cli-0.5.1}/example/loose/no-title.md +0 -0
- {okf_cli-0.4.9 → okf_cli-0.5.1}/example/playbooks/incident-response.md +0 -0
- {okf_cli-0.4.9 → okf_cli-0.5.1}/example/playbooks/oncall-guide.md +0 -0
- {okf_cli-0.4.9 → okf_cli-0.5.1}/example/smoke-ignore.md +0 -0
- {okf_cli-0.4.9 → okf_cli-0.5.1}/example/tables/customers.md +0 -0
- {okf_cli-0.4.9 → okf_cli-0.5.1}/example/tables/orders.md +0 -0
- {okf_cli-0.4.9 → okf_cli-0.5.1}/example/tables/partitions/2026/q1/jan/january.md +0 -0
- {okf_cli-0.4.9 → okf_cli-0.5.1}/example/tables/partitions/daily.md +0 -0
- {okf_cli-0.4.9 → okf_cli-0.5.1}/openwiki/domain-model.md +0 -0
- {okf_cli-0.4.9 → okf_cli-0.5.1}/openwiki/testing.md +0 -0
- {okf_cli-0.4.9 → okf_cli-0.5.1}/skills/okf-cli-manual/SKILL.md +0 -0
- {okf_cli-0.4.9 → okf_cli-0.5.1}/skills/writing-knowledge-base/SKILL.md +0 -0
- {okf_cli-0.4.9 → okf_cli-0.5.1}/src/okf/__init__.py +0 -0
- {okf_cli-0.4.9 → okf_cli-0.5.1}/src/okf/api.py +0 -0
- {okf_cli-0.4.9 → okf_cli-0.5.1}/src/okf/commands/__init__.py +0 -0
- {okf_cli-0.4.9 → okf_cli-0.5.1}/src/okf/commands/bundle.py +0 -0
- {okf_cli-0.4.9 → okf_cli-0.5.1}/src/okf/commands/list.py +0 -0
- {okf_cli-0.4.9 → okf_cli-0.5.1}/src/okf/commands/validate.py +0 -0
- {okf_cli-0.4.9 → okf_cli-0.5.1}/src/okf/core.py +0 -0
- {okf_cli-0.4.9 → okf_cli-0.5.1}/tests/test_core.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: okf-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.1
|
|
4
4
|
Summary: Open Knowledge Format tooling
|
|
5
5
|
License: MIT License
|
|
6
6
|
|
|
@@ -91,10 +91,10 @@ okf list example_knowledge_base/
|
|
|
91
91
|
# tables/orders
|
|
92
92
|
```
|
|
93
93
|
|
|
94
|
-
### `okf
|
|
94
|
+
### `okf read` — read a concept by ID
|
|
95
95
|
|
|
96
96
|
```
|
|
97
|
-
okf
|
|
97
|
+
okf read <directory> <concept-id>
|
|
98
98
|
```
|
|
99
99
|
|
|
100
100
|
Prints full concept contents (frontmatter + body). Concept IDs as printed by `okf list`. Guards against path traversal.
|
|
@@ -130,7 +130,7 @@ Files without strict format are bundled best-effort: title omitted if absent, de
|
|
|
130
130
|
| ----------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
|
|
131
131
|
| Folder name = concept type | `tables/orders.md` → `type: "tables"` |
|
|
132
132
|
| Only `.md` files processed | Non-`.md` files ignored |
|
|
133
|
-
| `index.md`, `log.md`, `README.md` skipped in `bundle` | Repo artifacts; not OKF concepts. `list`/`
|
|
133
|
+
| `index.md`, `log.md`, `README.md` skipped in `bundle` | Repo artifacts; not OKF concepts. `list`/`read`/`validate` only reserve `index.md` and `log.md`. |
|
|
134
134
|
| `.okfignore` entries skipped | Skip selected files without moving them. |
|
|
135
135
|
|
|
136
136
|
Root files use `--default-type`, defaulting to the input directory name. See [`example/`](example/) for sample structure.
|
|
@@ -172,7 +172,7 @@ okf-cli
|
|
|
172
172
|
│ ├── cli.py # Typer entrypoint
|
|
173
173
|
│ ├── api.py # Programmatic Python API
|
|
174
174
|
│ ├── core.py # Shared parsing/formatting
|
|
175
|
-
│ └── commands/ # bundle, list,
|
|
175
|
+
│ └── commands/ # bundle, list, read, validate
|
|
176
176
|
├── tests/ # pytest suite
|
|
177
177
|
└── example/ # Sample input markdown
|
|
178
178
|
```
|
|
@@ -59,10 +59,10 @@ okf list example_knowledge_base/
|
|
|
59
59
|
# tables/orders
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
-
### `okf
|
|
62
|
+
### `okf read` — read a concept by ID
|
|
63
63
|
|
|
64
64
|
```
|
|
65
|
-
okf
|
|
65
|
+
okf read <directory> <concept-id>
|
|
66
66
|
```
|
|
67
67
|
|
|
68
68
|
Prints full concept contents (frontmatter + body). Concept IDs as printed by `okf list`. Guards against path traversal.
|
|
@@ -98,7 +98,7 @@ Files without strict format are bundled best-effort: title omitted if absent, de
|
|
|
98
98
|
| ----------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
|
|
99
99
|
| Folder name = concept type | `tables/orders.md` → `type: "tables"` |
|
|
100
100
|
| Only `.md` files processed | Non-`.md` files ignored |
|
|
101
|
-
| `index.md`, `log.md`, `README.md` skipped in `bundle` | Repo artifacts; not OKF concepts. `list`/`
|
|
101
|
+
| `index.md`, `log.md`, `README.md` skipped in `bundle` | Repo artifacts; not OKF concepts. `list`/`read`/`validate` only reserve `index.md` and `log.md`. |
|
|
102
102
|
| `.okfignore` entries skipped | Skip selected files without moving them. |
|
|
103
103
|
|
|
104
104
|
Root files use `--default-type`, defaulting to the input directory name. See [`example/`](example/) for sample structure.
|
|
@@ -140,7 +140,7 @@ okf-cli
|
|
|
140
140
|
│ ├── cli.py # Typer entrypoint
|
|
141
141
|
│ ├── api.py # Programmatic Python API
|
|
142
142
|
│ ├── core.py # Shared parsing/formatting
|
|
143
|
-
│ └── commands/ # bundle, list,
|
|
143
|
+
│ └── commands/ # bundle, list, read, validate
|
|
144
144
|
├── tests/ # pytest suite
|
|
145
145
|
└── example/ # Sample input markdown
|
|
146
146
|
```
|
|
@@ -59,7 +59,7 @@ Each file imports from `okf.api` and calls the corresponding function, translati
|
|
|
59
59
|
1. Call `check_conformance` once.
|
|
60
60
|
1. Return `ValidateResult` with file count, errors, and warnings.
|
|
61
61
|
|
|
62
|
-
### `okf list` and `okf
|
|
62
|
+
### `okf list` and `okf read` (via `api.list_concepts()` / `api.show_concept()`)
|
|
63
63
|
|
|
64
64
|
Both functions first run `check_conformance`. If directory is non-conformant, they raise `ValueError`.
|
|
65
65
|
|
|
@@ -55,6 +55,6 @@ When changing command behavior, update sample docs/output only if behavior chang
|
|
|
55
55
|
|
|
56
56
|
## Release-facing notes
|
|
57
57
|
|
|
58
|
-
Recent history shows production hardening and feature additions were shipped via small incremental commits (validate/list/
|
|
58
|
+
Recent history shows production hardening and feature additions were shipped via small incremental commits (validate/list/read, YAML conformance gate, lenient parsing, `.okfignore`).
|
|
59
59
|
|
|
60
60
|
Operational takeaway: keep releases narrow and test-backed; avoid large unverified refactors.
|
|
@@ -17,7 +17,7 @@ uv run okf --help
|
|
|
17
17
|
uv run okf bundle example --default-type reference --force
|
|
18
18
|
uv run okf validate example_knowledge_base
|
|
19
19
|
uv run okf list example_knowledge_base
|
|
20
|
-
uv run okf
|
|
20
|
+
uv run okf read example_knowledge_base tables/customers
|
|
21
21
|
uv run okf bundle example --default-type reference --force --strict
|
|
22
22
|
```
|
|
23
23
|
|
|
@@ -48,7 +48,7 @@ Source: `src/okf/commands/validate.py`, `src/okf/core.py`.
|
|
|
48
48
|
|
|
49
49
|
```bash
|
|
50
50
|
uv run okf list <output-dir>
|
|
51
|
-
uv run okf
|
|
51
|
+
uv run okf read <output-dir> <concept-id>
|
|
52
52
|
```
|
|
53
53
|
|
|
54
54
|
`list` returns concept IDs; `show` prints full concept markdown.
|
|
@@ -6,7 +6,7 @@ import typer
|
|
|
6
6
|
|
|
7
7
|
from okf.commands.bundle import bundle
|
|
8
8
|
from okf.commands.list import cmd_list
|
|
9
|
-
from okf.commands.
|
|
9
|
+
from okf.commands.read import cmd_read
|
|
10
10
|
from okf.commands.validate import validate
|
|
11
11
|
from okf.core import console
|
|
12
12
|
|
|
@@ -38,7 +38,7 @@ def main(
|
|
|
38
38
|
|
|
39
39
|
app.command()(bundle)
|
|
40
40
|
app.command("list")(cmd_list)
|
|
41
|
-
app.command("
|
|
41
|
+
app.command("read")(cmd_read)
|
|
42
42
|
app.command("validate")(validate)
|
|
43
43
|
|
|
44
44
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""okf
|
|
1
|
+
"""okf read command."""
|
|
2
2
|
|
|
3
3
|
import typer
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ from okf import api
|
|
|
6
6
|
from okf.core import console, err_console
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
def
|
|
9
|
+
def cmd_read(
|
|
10
10
|
directory: str = typer.Argument(..., help="Directory of the OKF bundle"),
|
|
11
11
|
concept_id: str = typer.Argument(
|
|
12
12
|
..., help="Concept ID to read (e.g. tables/orders)"
|
|
@@ -26,4 +26,7 @@ def cmd_show(
|
|
|
26
26
|
err_console.print(f"Error: {e}", style="red")
|
|
27
27
|
raise typer.Exit(code=1)
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
raw = result.raw
|
|
30
|
+
if not raw.endswith("\n"):
|
|
31
|
+
raw += "\n"
|
|
32
|
+
console.print(raw, end="", markup=False, highlight=False)
|
|
@@ -895,7 +895,7 @@ class TestWorkflow:
|
|
|
895
895
|
assert "tables/orders" in cids
|
|
896
896
|
assert "tables/customers" in cids
|
|
897
897
|
|
|
898
|
-
def
|
|
898
|
+
def test_bundle_then_read(self, tmp_path: Path):
|
|
899
899
|
src = tmp_path / "src"
|
|
900
900
|
dst = tmp_path / "out"
|
|
901
901
|
src.mkdir()
|
|
@@ -153,44 +153,44 @@ def test_list_empty_shows_message(tmp_path: Path):
|
|
|
153
153
|
|
|
154
154
|
|
|
155
155
|
# ---------------------------------------------------------------------------
|
|
156
|
-
#
|
|
156
|
+
# read — exit codes & error messages
|
|
157
157
|
# ---------------------------------------------------------------------------
|
|
158
158
|
|
|
159
159
|
|
|
160
|
-
def
|
|
160
|
+
def test_read_not_found_shows_path(tmp_path: Path):
|
|
161
161
|
d = tmp_path / "bundle"
|
|
162
162
|
d.mkdir()
|
|
163
163
|
_write(d, {"tables/orders.md": "---\ntype: tables\n---\n\nBody."})
|
|
164
164
|
|
|
165
|
-
result = runner.invoke(app, ["
|
|
165
|
+
result = runner.invoke(app, ["read", str(d), "tables/customers"])
|
|
166
166
|
assert result.exit_code == 1
|
|
167
167
|
assert "not found" in result.output
|
|
168
168
|
|
|
169
169
|
|
|
170
|
-
def
|
|
170
|
+
def test_read_reserved_shows_error(tmp_path: Path):
|
|
171
171
|
d = tmp_path / "bundle"
|
|
172
172
|
d.mkdir()
|
|
173
173
|
_write(d, {"index.md": "# Contents"})
|
|
174
174
|
|
|
175
|
-
result = runner.invoke(app, ["
|
|
175
|
+
result = runner.invoke(app, ["read", str(d), "index"])
|
|
176
176
|
assert result.exit_code == 1
|
|
177
177
|
assert "reserved filename" in result.output
|
|
178
178
|
|
|
179
179
|
|
|
180
|
-
def
|
|
180
|
+
def test_read_traversal_shows_error(tmp_path: Path):
|
|
181
181
|
d = tmp_path / "bundle"
|
|
182
182
|
d.mkdir()
|
|
183
183
|
|
|
184
|
-
result = runner.invoke(app, ["
|
|
184
|
+
result = runner.invoke(app, ["read", str(d), "../../../etc/passwd"])
|
|
185
185
|
assert result.exit_code == 1
|
|
186
186
|
assert "outside the bundle directory" in result.output
|
|
187
187
|
|
|
188
188
|
|
|
189
|
-
def
|
|
189
|
+
def test_read_non_conformant_shows_message(tmp_path: Path):
|
|
190
190
|
d = tmp_path / "raw"
|
|
191
191
|
d.mkdir()
|
|
192
192
|
_write(d, {"notes.md": "# Notes\n\n> Notes.\n\nBody."})
|
|
193
193
|
|
|
194
|
-
result = runner.invoke(app, ["
|
|
194
|
+
result = runner.invoke(app, ["read", str(d), "notes"])
|
|
195
195
|
assert result.exit_code == 1
|
|
196
196
|
assert "not an OKF-conformant bundle" in result.output
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|