okf-cli 0.4.7__tar.gz → 0.4.8__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.
Files changed (44) hide show
  1. {okf_cli-0.4.7 → okf_cli-0.4.8}/.gitignore +1 -0
  2. {okf_cli-0.4.7 → okf_cli-0.4.8}/PKG-INFO +5 -5
  3. {okf_cli-0.4.7 → okf_cli-0.4.8}/README.md +4 -4
  4. {okf_cli-0.4.7 → okf_cli-0.4.8}/openwiki/architecture.md +2 -2
  5. {okf_cli-0.4.7 → okf_cli-0.4.8}/openwiki/domain-model.md +2 -2
  6. {okf_cli-0.4.7 → okf_cli-0.4.8}/openwiki/quickstart.md +2 -2
  7. {okf_cli-0.4.7 → okf_cli-0.4.8}/openwiki/testing.md +2 -2
  8. {okf_cli-0.4.7 → okf_cli-0.4.8}/openwiki/workflows.md +3 -3
  9. {okf_cli-0.4.7 → okf_cli-0.4.8}/pyproject.toml +1 -1
  10. {okf_cli-0.4.7 → okf_cli-0.4.8}/src/okf/api.py +29 -28
  11. {okf_cli-0.4.7 → okf_cli-0.4.8}/src/okf/commands/bundle.py +7 -6
  12. {okf_cli-0.4.7 → okf_cli-0.4.8}/tests/test_api.py +5 -4
  13. {okf_cli-0.4.7 → okf_cli-0.4.8}/tests/test_cli.py +3 -2
  14. {okf_cli-0.4.7 → okf_cli-0.4.8}/uv.lock +1 -1
  15. {okf_cli-0.4.7 → okf_cli-0.4.8}/.github/workflows/test.yml +0 -0
  16. {okf_cli-0.4.7 → okf_cli-0.4.8}/.last-update.json +0 -0
  17. {okf_cli-0.4.7 → okf_cli-0.4.8}/AGENTS.md +0 -0
  18. {okf_cli-0.4.7 → okf_cli-0.4.8}/LICENSE +0 -0
  19. {okf_cli-0.4.7 → okf_cli-0.4.8}/OKF_SPEC.md +0 -0
  20. {okf_cli-0.4.7 → okf_cli-0.4.8}/example/.okfignore +0 -0
  21. {okf_cli-0.4.7 → okf_cli-0.4.8}/example/README.md +0 -0
  22. {okf_cli-0.4.7 → okf_cli-0.4.8}/example/datasets/sales.md +0 -0
  23. {okf_cli-0.4.7 → okf_cli-0.4.8}/example/domain.md +0 -0
  24. {okf_cli-0.4.7 → okf_cli-0.4.8}/example/loose/deep/no-heading.md +0 -0
  25. {okf_cli-0.4.7 → okf_cli-0.4.8}/example/loose/no-desc.md +0 -0
  26. {okf_cli-0.4.7 → okf_cli-0.4.8}/example/loose/no-title.md +0 -0
  27. {okf_cli-0.4.7 → okf_cli-0.4.8}/example/playbooks/incident-response.md +0 -0
  28. {okf_cli-0.4.7 → okf_cli-0.4.8}/example/playbooks/oncall-guide.md +0 -0
  29. {okf_cli-0.4.7 → okf_cli-0.4.8}/example/smoke-ignore.md +0 -0
  30. {okf_cli-0.4.7 → okf_cli-0.4.8}/example/tables/customers.md +0 -0
  31. {okf_cli-0.4.7 → okf_cli-0.4.8}/example/tables/orders.md +0 -0
  32. {okf_cli-0.4.7 → okf_cli-0.4.8}/example/tables/partitions/2026/q1/jan/january.md +0 -0
  33. {okf_cli-0.4.7 → okf_cli-0.4.8}/example/tables/partitions/daily.md +0 -0
  34. {okf_cli-0.4.7 → okf_cli-0.4.8}/openwiki/operations.md +0 -0
  35. {okf_cli-0.4.7 → okf_cli-0.4.8}/skills/okf-cli-manual/SKILL.md +0 -0
  36. {okf_cli-0.4.7 → okf_cli-0.4.8}/skills/writing-knowledge-base/SKILL.md +0 -0
  37. {okf_cli-0.4.7 → okf_cli-0.4.8}/src/okf/__init__.py +0 -0
  38. {okf_cli-0.4.7 → okf_cli-0.4.8}/src/okf/cli.py +0 -0
  39. {okf_cli-0.4.7 → okf_cli-0.4.8}/src/okf/commands/__init__.py +0 -0
  40. {okf_cli-0.4.7 → okf_cli-0.4.8}/src/okf/commands/list.py +0 -0
  41. {okf_cli-0.4.7 → okf_cli-0.4.8}/src/okf/commands/show.py +0 -0
  42. {okf_cli-0.4.7 → okf_cli-0.4.8}/src/okf/commands/validate.py +0 -0
  43. {okf_cli-0.4.7 → okf_cli-0.4.8}/src/okf/core.py +0 -0
  44. {okf_cli-0.4.7 → okf_cli-0.4.8}/tests/test_core.py +0 -0
@@ -5,3 +5,4 @@ __pycache__/
5
5
  bundled/
6
6
  dist/
7
7
  *.egg-info/
8
+ *_knowledge_base/
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: okf-cli
3
- Version: 0.4.7
3
+ Version: 0.4.8
4
4
  Summary: Open Knowledge Format tooling
5
5
  License: MIT License
6
6
 
@@ -53,7 +53,7 @@ uv run okf --help
53
53
  ### `okf bundle` — convert plain markdown to OKF bundle
54
54
 
55
55
  ```
56
- okf bundle <input-dir> [output-dir] [--default-type <name>] [--force] [--strict-links]
56
+ okf bundle <input-dir> [output-dir] [--default-type <name>] [--force] [--strict]
57
57
  ```
58
58
 
59
59
  | Argument | Description |
@@ -62,16 +62,16 @@ okf bundle <input-dir> [output-dir] [--default-type <name>] [--force] [--strict-
62
62
  | `output-dir` | Target directory (default: `bundled`) |
63
63
  | `--default-type` | Type for root-level files (skip root files if omitted) |
64
64
  | `--force`, `-f` | Overwrite output directory if it exists |
65
- | `--strict-links` | Fail if local markdown links point outside bundle or to missing `.md` target |
65
+ | `--strict` | Enforce strict OKF spec output: fail on broken local `.md` links and skip `AGENTS.md` generation |
66
66
 
67
67
  ```bash
68
68
  okf bundle example --default-type reference # → bundled/
69
- okf bundle example --default-type reference --force --strict-links
69
+ okf bundle example --default-type reference --force --strict
70
70
  ```
71
71
 
72
72
  **`.okfignore`**: put in `input-dir` root; one bundle-relative `.md` path per line. Exact match only (no glob).
73
73
 
74
- **Link checking**: scans body links to local `.md` targets. Missing or out-of-bundle links warn by default, fail with `--strict-links`.
74
+ **Link checking**: scans body links to local `.md` targets. Missing or out-of-bundle links warn by default, fail with `--strict`.
75
75
 
76
76
  ### `okf list` — list concept IDs in a bundle
77
77
 
@@ -22,7 +22,7 @@ uv run okf --help
22
22
  ### `okf bundle` — convert plain markdown to OKF bundle
23
23
 
24
24
  ```
25
- okf bundle <input-dir> [output-dir] [--default-type <name>] [--force] [--strict-links]
25
+ okf bundle <input-dir> [output-dir] [--default-type <name>] [--force] [--strict]
26
26
  ```
27
27
 
28
28
  | Argument | Description |
@@ -31,16 +31,16 @@ okf bundle <input-dir> [output-dir] [--default-type <name>] [--force] [--strict-
31
31
  | `output-dir` | Target directory (default: `bundled`) |
32
32
  | `--default-type` | Type for root-level files (skip root files if omitted) |
33
33
  | `--force`, `-f` | Overwrite output directory if it exists |
34
- | `--strict-links` | Fail if local markdown links point outside bundle or to missing `.md` target |
34
+ | `--strict` | Enforce strict OKF spec output: fail on broken local `.md` links and skip `AGENTS.md` generation |
35
35
 
36
36
  ```bash
37
37
  okf bundle example --default-type reference # → bundled/
38
- okf bundle example --default-type reference --force --strict-links
38
+ okf bundle example --default-type reference --force --strict
39
39
  ```
40
40
 
41
41
  **`.okfignore`**: put in `input-dir` root; one bundle-relative `.md` path per line. Exact match only (no glob).
42
42
 
43
- **Link checking**: scans body links to local `.md` targets. Missing or out-of-bundle links warn by default, fail with `--strict-links`.
43
+ **Link checking**: scans body links to local `.md` targets. Missing or out-of-bundle links warn by default, fail with `--strict`.
44
44
 
45
45
  ### `okf list` — list concept IDs in a bundle
46
46
 
@@ -48,10 +48,10 @@ Each file imports from `okf.api` and calls the corresponding function, translati
48
48
  1. Read source directory + optional `.okfignore` (`_load_okfignore`).
49
49
  1. Walk `*.md`, skipping reserved names and ignored paths.
50
50
  1. Parse each markdown file via `parse_md` (strict first, lenient fallback).
51
- 1. Scan markdown body links via `_iter_links` / `_resolve_md_target` — warns on missing or out-of-bundle targets; `--strict-links` makes these fatal.
51
+ 1. Scan markdown body links via `_iter_links` / `_resolve_md_target` — warns on missing or out-of-bundle targets; `--strict` makes these fatal.
52
52
  1. Build YAML frontmatter via `build_frontmatter`.
53
53
  1. Write transformed files and generate `index.md` per directory.
54
- 1. Write `AGENTS.md` at output root with navigation guidance for the knowledge base.
54
+ 1. Write `AGENTS.md` at output root with navigation guidance for the knowledge base (skipped when `--strict` is used).
55
55
 
56
56
  ### `okf validate` (via `api.validate()`)
57
57
 
@@ -76,7 +76,7 @@ Source: `src/okf/core.py`.
76
76
  - `_resolve_md_target(current_rel, raw_target)` resolves to a bundle-relative POSIX path.
77
77
  - Ignored: external URLs (`https:`, `mailto:`), fragment-only links (`#section`), directory links, non-`.md` targets.
78
78
  - Default mode: warnings for missing targets or targets resolving outside bundle.
79
- - `--strict-links`: turns warnings into fatal exit.
79
+ - `--strict`: turns warnings into fatal exit and skips `AGENTS.md` generation.
80
80
  - Generated `index.md` files count as valid link targets.
81
81
 
82
82
  Source: `src/okf/commands/bundle.py`.
@@ -97,7 +97,7 @@ Each bundle run produces:
97
97
 
98
98
  - concept `.md` files with YAML frontmatter
99
99
  - `index.md` per directory listing contents and subdirs
100
- - `AGENTS.md` at output root: navigation guide for AI agents and humans (references `index.md`, explains frontmatter and cross-links)
100
+ - `AGENTS.md` at output root: navigation guide for AI agents and humans (references `index.md`, explains frontmatter and cross-links); omitted in `--strict` mode
101
101
 
102
102
  Source: `src/okf/commands/bundle.py`.
103
103
 
@@ -18,7 +18,7 @@ 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
20
  uv run okf show example_knowledge_base tables/customers
21
- uv run okf bundle example --default-type reference --force --strict-links
21
+ uv run okf bundle example --default-type reference --force --strict
22
22
  ```
23
23
 
24
24
  ### Python API
@@ -50,7 +50,7 @@ Why this sequence:
50
50
  1. `bundle` transforms raw markdown into OKF structure.
51
51
  1. `validate` checks OKF conformance gate used by readers.
52
52
  1. `list`/`show` operate only on conformant bundles.
53
- 1. `--strict-links` catches broken local `.md` references at bundle time.
53
+ 1. `--strict` catches broken local `.md` references at bundle time and skips `AGENTS.md` generation.
54
54
 
55
55
  ## OpenWiki map
56
56
 
@@ -14,7 +14,7 @@
14
14
  - conformance engine (`check_conformance`)
15
15
  - CLI integration tests: `tests/test_cli.py`
16
16
  - exit codes and error message formatting for all commands
17
- - Typer-specific behavior (argument parsing, `--force`, `--strict-links`)
17
+ - Typer-specific behavior (argument parsing, `--force`, `--strict`)
18
18
 
19
19
  ## Run tests
20
20
 
@@ -70,6 +70,6 @@ uv run pytest -q
70
70
  - Root `index.md` special allowance for `okf_version` only.
71
71
  - `list`/`show` hard failure on non-conformant bundles.
72
72
  - `show` path traversal guard.
73
- - Link checking: `_resolve_md_target` path resolution, `--strict-links` fatal mode, missing/out-of-bundle targets.
73
+ - Link checking: `_resolve_md_target` path resolution, `--strict` fatal mode, missing/out-of-bundle targets.
74
74
 
75
75
  Primary evidence: `tests/test_api.py`, `tests/test_core.py`, `tests/test_cli.py`.
@@ -19,7 +19,7 @@ Lenient fallback exists for imperfect files, but strict shape gives better metad
19
19
  ### 2) Bundle to OKF
20
20
 
21
21
  ```bash
22
- uv run okf bundle <input-dir> [output-dir] [--default-type <type>] [--force] [--strict-links]
22
+ uv run okf bundle <input-dir> [output-dir] [--default-type <type>] [--force] [--strict]
23
23
  # output-dir defaults to <input-dir>_knowledge_base
24
24
  # --default-type defaults to input directory name
25
25
  ```
@@ -29,8 +29,8 @@ Important behavior:
29
29
  - Root-level markdown uses input directory name as type if `--default-type` not specified.
30
30
  - Reserved filenames skipped during bundling (`index.md`, `log.md`, `README.md`).
31
31
  - `.okfignore` in input root can skip exact bundle-relative paths.
32
- - `--strict-links` fails if any local `.md` link is missing or points outside bundle.
33
- - `AGENTS.md` is generated at output root with navigation guidance.
32
+ - `--strict` enforces strict OKF spec output: fails on broken local `.md` links and skips `AGENTS.md` generation.
33
+ - `AGENTS.md` is generated at output root with navigation guidance (unless `--strict` is used).
34
34
 
35
35
  Source: `src/okf/commands/bundle.py`.
36
36
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "okf-cli"
3
- version = "0.4.7"
3
+ version = "0.4.8"
4
4
  description = "Open Knowledge Format tooling"
5
5
  readme = "README.md"
6
6
  license = { file = "LICENSE" }
@@ -264,7 +264,7 @@ def bundle(
264
264
  *,
265
265
  default_type: str | None = None,
266
266
  force: bool = False,
267
- strict_links: bool = False,
267
+ strict: bool = False,
268
268
  ) -> BundleResult:
269
269
  """Convert plain markdown into an OKF-conformant knowledge bundle.
270
270
 
@@ -273,8 +273,8 @@ def bundle(
273
273
  output_dir: Target directory. Defaults to ``<input-dir>_knowledge_base``.
274
274
  default_type: Concept type for root-level files.
275
275
  force: Overwrite output directory if it exists.
276
- strict_links: Fail when local markdown links point outside bundle
277
- or reference missing targets.
276
+ strict: Enforce strict OKF spec output: fail on broken local .md
277
+ links and skip AGENTS.md generation.
278
278
 
279
279
  Returns:
280
280
  BundleResult with counts, warnings, and errors.
@@ -362,7 +362,7 @@ def bundle(
362
362
 
363
363
  warnings.extend(link_issues)
364
364
 
365
- if strict_links and link_issues:
365
+ if strict and link_issues:
366
366
  errors.append("strict link check failed")
367
367
  return BundleResult(0, dst, warnings, errors)
368
368
 
@@ -394,30 +394,31 @@ def bundle(
394
394
 
395
395
  _generate_indexes(processed, dst)
396
396
 
397
- # Write AGENTS.md
398
- (dst / "AGENTS.md").write_text(
399
- f"# Knowledge Base: {dst.name}\n\n"
400
- f"You are in an OKF (Open Knowledge Format) knowledge base called "
401
- f"**{dst.name}**. OKF is a structured markdown format where each "
402
- f"`.md` file is a concept with YAML frontmatter (`type`, `title`, "
403
- f"`description`) and cross-links between related concepts.\n\n"
404
- "## Instructions\n\n"
405
- "- **Answer from this knowledge base only.** Use the concepts and "
406
- "links here as your source of truth.\n"
407
- "- **If the answer is not in the knowledge base, say so directly.** "
408
- "Do not fabricate, guess, or pull from external knowledge.\n\n"
409
- "## Getting Started\n\n"
410
- "Read [index.md](index.md) first — it lists all concepts "
411
- "and subdirectories.\n\n"
412
- "## Navigation\n\n"
413
- "- Follow markdown links between concepts.\n"
414
- "- Each `.md` file has YAML frontmatter with `type`, `title`, "
415
- "`description`.\n"
416
- "- Subdirectories group related concepts by topic.\n"
417
- "- Cross-links (e.g. `[Customers](/tables/customers.md)`) "
418
- "express relationships.\n",
419
- encoding="utf-8",
420
- )
397
+ # Write AGENTS.md (skipped in strict mode)
398
+ if not strict:
399
+ (dst / "AGENTS.md").write_text(
400
+ f"# Knowledge Base: {dst.name}\n\n"
401
+ f"You are in an OKF (Open Knowledge Format) knowledge base called "
402
+ f"**{dst.name}**. OKF is a structured markdown format where each "
403
+ f"`.md` file is a concept with YAML frontmatter (`type`, `title`, "
404
+ f"`description`) and cross-links between related concepts.\n\n"
405
+ "## Instructions\n\n"
406
+ "- **Answer from this knowledge base only.** Use the concepts and "
407
+ "links here as your source of truth.\n"
408
+ "- **If the answer is not in the knowledge base, say so directly.** "
409
+ "Do not fabricate, guess, or pull from external knowledge.\n\n"
410
+ "## Getting Started\n\n"
411
+ "Read [index.md](index.md) first — it lists all concepts "
412
+ "and subdirectories.\n\n"
413
+ "## Navigation\n\n"
414
+ "- Follow markdown links between concepts.\n"
415
+ "- Each `.md` file has YAML frontmatter with `type`, `title`, "
416
+ "`description`.\n"
417
+ "- Subdirectories group related concepts by topic.\n"
418
+ "- Cross-links (e.g. `[Customers](/tables/customers.md)`) "
419
+ "express relationships.\n",
420
+ encoding="utf-8",
421
+ )
421
422
 
422
423
  return BundleResult(
423
424
  files_written=len(processed),
@@ -1,7 +1,5 @@
1
1
  """okf bundle command."""
2
2
 
3
- from pathlib import Path
4
-
5
3
  import typer
6
4
 
7
5
  from okf import api
@@ -22,10 +20,13 @@ def bundle(
22
20
  force: bool = typer.Option(
23
21
  False, "--force", "-f", help="Overwrite output directory if it exists"
24
22
  ),
25
- strict_links: bool = typer.Option(
23
+ strict: bool = typer.Option(
26
24
  False,
27
- "--strict-links",
28
- help="Fail when local markdown links point outside bundle or missing targets",
25
+ "--strict",
26
+ help=(
27
+ "Enforce strict OKF spec output: fail on broken local .md links "
28
+ "and skip AGENTS.md generation"
29
+ ),
29
30
  ),
30
31
  ) -> None:
31
32
  """Convert plain markdown into an OKF-conformant knowledge bundle."""
@@ -35,7 +36,7 @@ def bundle(
35
36
  output_dir,
36
37
  default_type=default_type,
37
38
  force=force,
38
- strict_links=strict_links,
39
+ strict=strict,
39
40
  )
40
41
  except FileNotFoundError as e:
41
42
  typer.echo(f"Error: {e}", err=True)
@@ -334,7 +334,7 @@ class TestBundle:
334
334
 
335
335
  assert any("points outside bundle" in w for w in result.warnings)
336
336
 
337
- def test_strict_links_fails(self, tmp_path: Path):
337
+ def test_strict_fails(self, tmp_path: Path):
338
338
  src = tmp_path / "src"
339
339
  dst = tmp_path / "out"
340
340
  src.mkdir()
@@ -343,12 +343,12 @@ class TestBundle:
343
343
  {"tables/orders.md": "# Orders\n\n> One row.\n\nSee [C](customers.md)."},
344
344
  )
345
345
 
346
- result = bundle(src, dst, strict_links=True)
346
+ result = bundle(src, dst, strict=True)
347
347
 
348
348
  assert result.files_written == 0
349
349
  assert any("strict link check failed" in e.lower() for e in result.errors)
350
350
 
351
- def test_strict_links_passes(self, tmp_path: Path):
351
+ def test_strict_passes(self, tmp_path: Path):
352
352
  src = tmp_path / "src"
353
353
  dst = tmp_path / "out"
354
354
  src.mkdir()
@@ -362,10 +362,11 @@ class TestBundle:
362
362
  },
363
363
  )
364
364
 
365
- result = bundle(src, dst, strict_links=True)
365
+ result = bundle(src, dst, strict=True)
366
366
 
367
367
  assert result.files_written == 2
368
368
  assert result.errors == []
369
+ assert not (dst / "AGENTS.md").exists()
369
370
 
370
371
  def test_agents_md(self, tmp_path: Path):
371
372
  src = tmp_path / "src"
@@ -70,7 +70,7 @@ def test_bundle_force_shows_removed(tmp_path: Path):
70
70
  assert "Removed existing" in result.output
71
71
 
72
72
 
73
- def test_bundle_strict_links_shows_error(tmp_path: Path):
73
+ def test_bundle_strict_shows_error(tmp_path: Path):
74
74
  src = tmp_path / "src"
75
75
  dst = tmp_path / "out"
76
76
  src.mkdir()
@@ -81,9 +81,10 @@ def test_bundle_strict_links_shows_error(tmp_path: Path):
81
81
  },
82
82
  )
83
83
 
84
- result = runner.invoke(app, ["bundle", str(src), str(dst), "--strict-links"])
84
+ result = runner.invoke(app, ["bundle", str(src), str(dst), "--strict"])
85
85
  assert result.exit_code == 1
86
86
  assert "strict link check failed" in result.output
87
+ assert not (dst / "AGENTS.md").exists()
87
88
 
88
89
 
89
90
  # ---------------------------------------------------------------------------
@@ -52,7 +52,7 @@ wheels = [
52
52
 
53
53
  [[package]]
54
54
  name = "okf-cli"
55
- version = "0.4.6"
55
+ version = "0.4.8"
56
56
  source = { editable = "." }
57
57
  dependencies = [
58
58
  { name = "pyyaml" },
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