agent-wiki-cli 0.5.0__tar.gz → 0.5.2__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 (114) hide show
  1. {agent_wiki_cli-0.5.0/src/agent_wiki_cli.egg-info → agent_wiki_cli-0.5.2}/PKG-INFO +102 -3
  2. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/README.md +101 -2
  3. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/pyproject.toml +1 -1
  4. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2/src/agent_wiki_cli.egg-info}/PKG-INFO +102 -3
  5. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/agent_wiki_cli.egg-info/SOURCES.txt +3 -0
  6. agent_wiki_cli-0.5.2/src/llm_wiki_cli/api.py +130 -0
  7. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/cli.py +18 -0
  8. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/commands/bootstrap_cmd.py +116 -43
  9. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/commands/context_cmd.py +36 -8
  10. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/commands/extract_cmd.py +160 -37
  11. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/commands/generate_prompt_cmd.py +21 -4
  12. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/config.py +53 -0
  13. agent_wiki_cli-0.5.2/src/llm_wiki_cli/services/contracts.py +6 -0
  14. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/services/io.py +16 -0
  15. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/services/schema.py +21 -4
  16. agent_wiki_cli-0.5.2/tests/test_api.py +32 -0
  17. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_bootstrap.py +58 -0
  18. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_config.py +27 -0
  19. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_context.py +43 -0
  20. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_extract.py +48 -0
  21. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_generate_prompt.py +11 -0
  22. agent_wiki_cli-0.5.2/tests/test_io.py +21 -0
  23. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_schema.py +6 -0
  24. agent_wiki_cli-0.5.0/tests/test_io.py +0 -11
  25. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/LICENSE +0 -0
  26. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/setup.cfg +0 -0
  27. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/agent_wiki_cli.egg-info/dependency_links.txt +0 -0
  28. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/agent_wiki_cli.egg-info/entry_points.txt +0 -0
  29. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/agent_wiki_cli.egg-info/requires.txt +0 -0
  30. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/agent_wiki_cli.egg-info/top_level.txt +0 -0
  31. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/__init__.py +0 -0
  32. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/commands/__init__.py +0 -0
  33. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/commands/bump_cmd.py +0 -0
  34. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/commands/ci_check_cmd.py +0 -0
  35. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/commands/hook_cmd.py +0 -0
  36. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/commands/init_cmd.py +0 -0
  37. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/commands/install_cmd.py +0 -0
  38. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/commands/lint_cmd.py +0 -0
  39. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/commands/mcp_cmd.py +0 -0
  40. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/commands/metrics_cmd.py +0 -0
  41. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/commands/migrate_cmd.py +0 -0
  42. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/commands/obsidian_cmd.py +0 -0
  43. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/commands/plugins_cmd.py +0 -0
  44. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/commands/prepare_extractors_cmd.py +0 -0
  45. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/commands/release_cmd.py +0 -0
  46. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/commands/review_cmd.py +0 -0
  47. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/commands/status_cmd.py +0 -0
  48. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/commands/sync_cmd.py +0 -0
  49. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/commands/team_cmd.py +0 -0
  50. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/commands/trigger_cmd.py +0 -0
  51. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/commands/uninstall_cmd.py +0 -0
  52. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/commands/upgrade_cmd.py +0 -0
  53. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/extractors/__init__.py +0 -0
  54. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/extractors/common.py +0 -0
  55. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/extractors/go_extractor.py +0 -0
  56. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/extractors/go_scripts/go.mod +0 -0
  57. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/extractors/go_scripts/main.go +0 -0
  58. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/extractors/python_extractor.py +0 -0
  59. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/extractors/rust_extractor.py +0 -0
  60. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/extractors/rust_scripts/Cargo.lock +0 -0
  61. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/extractors/rust_scripts/Cargo.toml +0 -0
  62. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/extractors/rust_scripts/src/main.rs +0 -0
  63. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/extractors/ts_extractor.py +0 -0
  64. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/extractors/ts_scripts/extract.js +0 -0
  65. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/extractors/ts_scripts/package.json +0 -0
  66. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/services/__init__.py +0 -0
  67. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/services/circuit_breaker.py +0 -0
  68. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/services/extractor_helpers.py +0 -0
  69. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/services/imports.py +0 -0
  70. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/services/inventory_cache.py +0 -0
  71. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/services/lockfile.py +0 -0
  72. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/services/mcp_server.py +0 -0
  73. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/services/metrics.py +0 -0
  74. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/services/obsidian.py +0 -0
  75. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/services/packages.py +0 -0
  76. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/services/paths.py +0 -0
  77. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/services/plugins.py +0 -0
  78. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/services/secure_file.py +0 -0
  79. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/services/source_snapshot.py +0 -0
  80. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/services/team.py +0 -0
  81. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/src/llm_wiki_cli/services/versioning.py +0 -0
  82. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_bump.py +0 -0
  83. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_ci_check.py +0 -0
  84. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_circuit_breaker.py +0 -0
  85. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_docker_bootstrap.py +0 -0
  86. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_docker_extract.py +0 -0
  87. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_docker_lint.py +0 -0
  88. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_e2e.py +0 -0
  89. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_extractor_helpers.py +0 -0
  90. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_go_extract.py +0 -0
  91. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_hook.py +0 -0
  92. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_imports.py +0 -0
  93. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_init.py +0 -0
  94. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_inventory_cache.py +0 -0
  95. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_lint.py +0 -0
  96. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_lockfile.py +0 -0
  97. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_mcp.py +0 -0
  98. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_migrate.py +0 -0
  99. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_multilanguage_wiki.py +0 -0
  100. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_obsidian.py +0 -0
  101. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_package_metadata.py +0 -0
  102. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_phase4_quality.py +0 -0
  103. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_plugins.py +0 -0
  104. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_release.py +0 -0
  105. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_rust_extract.py +0 -0
  106. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_source_snapshot.py +0 -0
  107. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_status.py +0 -0
  108. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_sync.py +0 -0
  109. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_team.py +0 -0
  110. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_trigger.py +0 -0
  111. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_ts_extract.py +0 -0
  112. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_uninstall.py +0 -0
  113. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_upgrade.py +0 -0
  114. {agent_wiki_cli-0.5.0 → agent_wiki_cli-0.5.2}/tests/test_versioning.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agent-wiki-cli
3
- Version: 0.5.0
3
+ Version: 0.5.2
4
4
  Summary: CLI tool to maintain hybrid LLM Wikis for multi-language projects.
5
5
  Author-email: Denis Sivagin <denissvgn@gmail.com>
6
6
  License: MIT
@@ -219,12 +219,16 @@ llm-wiki bootstrap --src-dir . --wiki-dir docs/llm_wiki
219
219
  llm-wiki bootstrap --overwrite
220
220
  llm-wiki bootstrap --depth shallow
221
221
  llm-wiki bootstrap --skip-workflows
222
+ llm-wiki bootstrap --format json --source-adapter
222
223
  ```
223
224
 
224
225
  `bootstrap` writes entity, module, workflow, infrastructure, index, log, and
225
226
  manifest files. `--depth full` is the default and includes docstrings, imports,
226
227
  attributes, method signatures, and relationship data where extractors provide
227
- it.
228
+ it. Use `--source-adapter` when callers need bootstrap to write only under
229
+ `--wiki-dir`; this skips agent constraint-file updates outside the generated
230
+ wiki directory. Use `--format json` to emit a machine-readable summary with
231
+ created, updated, and skipped files plus source counts and the manifest path.
228
232
 
229
233
  ### `sync`
230
234
 
@@ -246,6 +250,12 @@ parallel built-in language extraction. Sync repairs manifests with invalid
246
250
  source hashes without touching pages, and stops unusually broad diffs unless
247
251
  `--force` is used.
248
252
 
253
+ `sync` is deterministic: it updates AST/docstring-based page skeletons and does
254
+ not call an LLM. In agent workflows, treat sync as the first step, then inspect
255
+ created or updated pages and replace generic `_Auto-generated from ..._`,
256
+ copied-docstring-only, or knowable `—` placeholders with project-specific
257
+ semantic explanations.
258
+
249
259
  ### `extract`
250
260
 
251
261
  Print source inventory as JSON. All registered extractors run; missing optional
@@ -259,8 +269,15 @@ llm-wiki extract --src-dir . --deep
259
269
  llm-wiki extract --src-dir . --paths src/foo.py src/bar.ts
260
270
  llm-wiki extract --src-dir . --package llm_wiki_cli
261
271
  llm-wiki extract --src-dir . --include-empty
272
+ llm-wiki extract --src-dir . --summary --output sources/code.json --read-only
273
+ llm-wiki extract --src-dir /path/to/repo --allow-external-src --summary
262
274
  ```
263
275
 
276
+ The JSON output includes `schema_version: "llm-wiki-extract/v1"` plus
277
+ `inventory` and optional `docker` objects. Inventory keys are POSIX paths
278
+ relative to `--src-dir`, never absolute paths. The v1 contract permits additive
279
+ fields; incompatible shape changes require a new schema version.
280
+
264
281
  ### `prepare-extractors`
265
282
 
266
283
  Prepare TypeScript dependencies and cached Go/Rust helper binaries outside the
@@ -330,6 +347,7 @@ llm-wiki context --budget 8000 --src-dir . --format json
330
347
  llm-wiki context --budget 8000 --src-dir . --format markdown
331
348
  llm-wiki context --budget 8000 --focus changed
332
349
  llm-wiki context --budget 8000 --focus all
350
+ llm-wiki context --budget 12000 --format json --focus all --output context.json --read-only
333
351
  ```
334
352
 
335
353
  `--focus changed` is the default. Changed files get full detail, one-hop import
@@ -356,6 +374,85 @@ Example request:
356
374
  }
357
375
  ```
358
376
 
377
+ `--output PATH` writes the generated JSON or Markdown directly instead of
378
+ printing it to stdout. `--read-only` documents source-adapter intent: the command
379
+ does not write wiki files, hooks, manifests, local config, or helper/cache state,
380
+ except for an explicit `--output` artifact.
381
+
382
+ ### Codebase source integration
383
+
384
+ For research or indexing systems that need codebase evidence without adopting
385
+ the maintained wiki format, prefer the read-only source-adapter commands:
386
+
387
+ ```bash
388
+ llm-wiki extract --src-dir <repo> --summary --read-only
389
+ llm-wiki context --src-dir <repo> --budget 12000 --format json --focus all --read-only
390
+ llm-wiki bootstrap --src-dir <repo> --wiki-dir sources/code_wikis/<source_id> --format json --source-adapter
391
+ ```
392
+
393
+ By default, `--src-dir` must resolve inside the current working directory. For a
394
+ trusted source tree outside cwd, pass `--allow-external-src`; explicit
395
+ `--paths` are still constrained to the chosen source root. Explicit output paths
396
+ such as `--output` may be absolute or outside the project root because they are
397
+ caller-selected artifacts.
398
+
399
+ Example `extract --summary` payload:
400
+
401
+ ```json
402
+ {
403
+ "schema_version": "llm-wiki-extract/v1",
404
+ "inventory": {
405
+ "models.py": {
406
+ "language": "python",
407
+ "package": "sample",
408
+ "classes": ["User"],
409
+ "functions": ["load_user"]
410
+ }
411
+ }
412
+ }
413
+ ```
414
+
415
+ Example `context --format json` payload:
416
+
417
+ ```json
418
+ {
419
+ "budget": 12000,
420
+ "used": 320,
421
+ "truncated": false,
422
+ "omitted_files": [],
423
+ "downgraded_files": {},
424
+ "files": {
425
+ "models.py": {
426
+ "priority": "high",
427
+ "detail": "deep",
428
+ "classes": [{"name": "User"}],
429
+ "functions": []
430
+ }
431
+ }
432
+ }
433
+ ```
434
+
435
+ Example `bootstrap --format json --source-adapter` summary:
436
+
437
+ ```json
438
+ {
439
+ "schema_version": "llm-wiki-bootstrap-summary/v1",
440
+ "src_dir": "/path/to/repo",
441
+ "generated_wiki_path": "sources/code_wikis/repo",
442
+ "depth": "full",
443
+ "source_files": 12,
444
+ "classes": 8,
445
+ "functions": 31,
446
+ "docker_files": 1,
447
+ "workflows": 2,
448
+ "cross_references": 14,
449
+ "created_files": ["sources/code_wikis/repo/index.md"],
450
+ "updated_files": [],
451
+ "skipped_files": [],
452
+ "manifest_path": "sources/code_wikis/repo/.llm-wiki-manifest.json"
453
+ }
454
+ ```
455
+
359
456
  ### `generate-prompt`
360
457
 
361
458
  Build a sync prompt for IDE agents or for manual review.
@@ -368,7 +465,9 @@ llm-wiki generate-prompt --template compact
368
465
  ```
369
466
 
370
467
  The generated prompt includes change-type guidance. Installed prompt templates
371
- can override the default prompt body.
468
+ can override the default prompt body. The default prompt asks agents to run
469
+ `sync` first, then perform a semantic pass on affected pages before accepting a
470
+ lint-clean wiki as complete.
372
471
 
373
472
  ### `mcp`
374
473
 
@@ -189,12 +189,16 @@ llm-wiki bootstrap --src-dir . --wiki-dir docs/llm_wiki
189
189
  llm-wiki bootstrap --overwrite
190
190
  llm-wiki bootstrap --depth shallow
191
191
  llm-wiki bootstrap --skip-workflows
192
+ llm-wiki bootstrap --format json --source-adapter
192
193
  ```
193
194
 
194
195
  `bootstrap` writes entity, module, workflow, infrastructure, index, log, and
195
196
  manifest files. `--depth full` is the default and includes docstrings, imports,
196
197
  attributes, method signatures, and relationship data where extractors provide
197
- it.
198
+ it. Use `--source-adapter` when callers need bootstrap to write only under
199
+ `--wiki-dir`; this skips agent constraint-file updates outside the generated
200
+ wiki directory. Use `--format json` to emit a machine-readable summary with
201
+ created, updated, and skipped files plus source counts and the manifest path.
198
202
 
199
203
  ### `sync`
200
204
 
@@ -216,6 +220,12 @@ parallel built-in language extraction. Sync repairs manifests with invalid
216
220
  source hashes without touching pages, and stops unusually broad diffs unless
217
221
  `--force` is used.
218
222
 
223
+ `sync` is deterministic: it updates AST/docstring-based page skeletons and does
224
+ not call an LLM. In agent workflows, treat sync as the first step, then inspect
225
+ created or updated pages and replace generic `_Auto-generated from ..._`,
226
+ copied-docstring-only, or knowable `—` placeholders with project-specific
227
+ semantic explanations.
228
+
219
229
  ### `extract`
220
230
 
221
231
  Print source inventory as JSON. All registered extractors run; missing optional
@@ -229,8 +239,15 @@ llm-wiki extract --src-dir . --deep
229
239
  llm-wiki extract --src-dir . --paths src/foo.py src/bar.ts
230
240
  llm-wiki extract --src-dir . --package llm_wiki_cli
231
241
  llm-wiki extract --src-dir . --include-empty
242
+ llm-wiki extract --src-dir . --summary --output sources/code.json --read-only
243
+ llm-wiki extract --src-dir /path/to/repo --allow-external-src --summary
232
244
  ```
233
245
 
246
+ The JSON output includes `schema_version: "llm-wiki-extract/v1"` plus
247
+ `inventory` and optional `docker` objects. Inventory keys are POSIX paths
248
+ relative to `--src-dir`, never absolute paths. The v1 contract permits additive
249
+ fields; incompatible shape changes require a new schema version.
250
+
234
251
  ### `prepare-extractors`
235
252
 
236
253
  Prepare TypeScript dependencies and cached Go/Rust helper binaries outside the
@@ -300,6 +317,7 @@ llm-wiki context --budget 8000 --src-dir . --format json
300
317
  llm-wiki context --budget 8000 --src-dir . --format markdown
301
318
  llm-wiki context --budget 8000 --focus changed
302
319
  llm-wiki context --budget 8000 --focus all
320
+ llm-wiki context --budget 12000 --format json --focus all --output context.json --read-only
303
321
  ```
304
322
 
305
323
  `--focus changed` is the default. Changed files get full detail, one-hop import
@@ -326,6 +344,85 @@ Example request:
326
344
  }
327
345
  ```
328
346
 
347
+ `--output PATH` writes the generated JSON or Markdown directly instead of
348
+ printing it to stdout. `--read-only` documents source-adapter intent: the command
349
+ does not write wiki files, hooks, manifests, local config, or helper/cache state,
350
+ except for an explicit `--output` artifact.
351
+
352
+ ### Codebase source integration
353
+
354
+ For research or indexing systems that need codebase evidence without adopting
355
+ the maintained wiki format, prefer the read-only source-adapter commands:
356
+
357
+ ```bash
358
+ llm-wiki extract --src-dir <repo> --summary --read-only
359
+ llm-wiki context --src-dir <repo> --budget 12000 --format json --focus all --read-only
360
+ llm-wiki bootstrap --src-dir <repo> --wiki-dir sources/code_wikis/<source_id> --format json --source-adapter
361
+ ```
362
+
363
+ By default, `--src-dir` must resolve inside the current working directory. For a
364
+ trusted source tree outside cwd, pass `--allow-external-src`; explicit
365
+ `--paths` are still constrained to the chosen source root. Explicit output paths
366
+ such as `--output` may be absolute or outside the project root because they are
367
+ caller-selected artifacts.
368
+
369
+ Example `extract --summary` payload:
370
+
371
+ ```json
372
+ {
373
+ "schema_version": "llm-wiki-extract/v1",
374
+ "inventory": {
375
+ "models.py": {
376
+ "language": "python",
377
+ "package": "sample",
378
+ "classes": ["User"],
379
+ "functions": ["load_user"]
380
+ }
381
+ }
382
+ }
383
+ ```
384
+
385
+ Example `context --format json` payload:
386
+
387
+ ```json
388
+ {
389
+ "budget": 12000,
390
+ "used": 320,
391
+ "truncated": false,
392
+ "omitted_files": [],
393
+ "downgraded_files": {},
394
+ "files": {
395
+ "models.py": {
396
+ "priority": "high",
397
+ "detail": "deep",
398
+ "classes": [{"name": "User"}],
399
+ "functions": []
400
+ }
401
+ }
402
+ }
403
+ ```
404
+
405
+ Example `bootstrap --format json --source-adapter` summary:
406
+
407
+ ```json
408
+ {
409
+ "schema_version": "llm-wiki-bootstrap-summary/v1",
410
+ "src_dir": "/path/to/repo",
411
+ "generated_wiki_path": "sources/code_wikis/repo",
412
+ "depth": "full",
413
+ "source_files": 12,
414
+ "classes": 8,
415
+ "functions": 31,
416
+ "docker_files": 1,
417
+ "workflows": 2,
418
+ "cross_references": 14,
419
+ "created_files": ["sources/code_wikis/repo/index.md"],
420
+ "updated_files": [],
421
+ "skipped_files": [],
422
+ "manifest_path": "sources/code_wikis/repo/.llm-wiki-manifest.json"
423
+ }
424
+ ```
425
+
329
426
  ### `generate-prompt`
330
427
 
331
428
  Build a sync prompt for IDE agents or for manual review.
@@ -338,7 +435,9 @@ llm-wiki generate-prompt --template compact
338
435
  ```
339
436
 
340
437
  The generated prompt includes change-type guidance. Installed prompt templates
341
- can override the default prompt body.
438
+ can override the default prompt body. The default prompt asks agents to run
439
+ `sync` first, then perform a semantic pass on affected pages before accepting a
440
+ lint-clean wiki as complete.
342
441
 
343
442
  ### `mcp`
344
443
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "agent-wiki-cli"
7
- version = "0.5.0"
7
+ version = "0.5.2"
8
8
  description = "CLI tool to maintain hybrid LLM Wikis for multi-language projects."
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agent-wiki-cli
3
- Version: 0.5.0
3
+ Version: 0.5.2
4
4
  Summary: CLI tool to maintain hybrid LLM Wikis for multi-language projects.
5
5
  Author-email: Denis Sivagin <denissvgn@gmail.com>
6
6
  License: MIT
@@ -219,12 +219,16 @@ llm-wiki bootstrap --src-dir . --wiki-dir docs/llm_wiki
219
219
  llm-wiki bootstrap --overwrite
220
220
  llm-wiki bootstrap --depth shallow
221
221
  llm-wiki bootstrap --skip-workflows
222
+ llm-wiki bootstrap --format json --source-adapter
222
223
  ```
223
224
 
224
225
  `bootstrap` writes entity, module, workflow, infrastructure, index, log, and
225
226
  manifest files. `--depth full` is the default and includes docstrings, imports,
226
227
  attributes, method signatures, and relationship data where extractors provide
227
- it.
228
+ it. Use `--source-adapter` when callers need bootstrap to write only under
229
+ `--wiki-dir`; this skips agent constraint-file updates outside the generated
230
+ wiki directory. Use `--format json` to emit a machine-readable summary with
231
+ created, updated, and skipped files plus source counts and the manifest path.
228
232
 
229
233
  ### `sync`
230
234
 
@@ -246,6 +250,12 @@ parallel built-in language extraction. Sync repairs manifests with invalid
246
250
  source hashes without touching pages, and stops unusually broad diffs unless
247
251
  `--force` is used.
248
252
 
253
+ `sync` is deterministic: it updates AST/docstring-based page skeletons and does
254
+ not call an LLM. In agent workflows, treat sync as the first step, then inspect
255
+ created or updated pages and replace generic `_Auto-generated from ..._`,
256
+ copied-docstring-only, or knowable `—` placeholders with project-specific
257
+ semantic explanations.
258
+
249
259
  ### `extract`
250
260
 
251
261
  Print source inventory as JSON. All registered extractors run; missing optional
@@ -259,8 +269,15 @@ llm-wiki extract --src-dir . --deep
259
269
  llm-wiki extract --src-dir . --paths src/foo.py src/bar.ts
260
270
  llm-wiki extract --src-dir . --package llm_wiki_cli
261
271
  llm-wiki extract --src-dir . --include-empty
272
+ llm-wiki extract --src-dir . --summary --output sources/code.json --read-only
273
+ llm-wiki extract --src-dir /path/to/repo --allow-external-src --summary
262
274
  ```
263
275
 
276
+ The JSON output includes `schema_version: "llm-wiki-extract/v1"` plus
277
+ `inventory` and optional `docker` objects. Inventory keys are POSIX paths
278
+ relative to `--src-dir`, never absolute paths. The v1 contract permits additive
279
+ fields; incompatible shape changes require a new schema version.
280
+
264
281
  ### `prepare-extractors`
265
282
 
266
283
  Prepare TypeScript dependencies and cached Go/Rust helper binaries outside the
@@ -330,6 +347,7 @@ llm-wiki context --budget 8000 --src-dir . --format json
330
347
  llm-wiki context --budget 8000 --src-dir . --format markdown
331
348
  llm-wiki context --budget 8000 --focus changed
332
349
  llm-wiki context --budget 8000 --focus all
350
+ llm-wiki context --budget 12000 --format json --focus all --output context.json --read-only
333
351
  ```
334
352
 
335
353
  `--focus changed` is the default. Changed files get full detail, one-hop import
@@ -356,6 +374,85 @@ Example request:
356
374
  }
357
375
  ```
358
376
 
377
+ `--output PATH` writes the generated JSON or Markdown directly instead of
378
+ printing it to stdout. `--read-only` documents source-adapter intent: the command
379
+ does not write wiki files, hooks, manifests, local config, or helper/cache state,
380
+ except for an explicit `--output` artifact.
381
+
382
+ ### Codebase source integration
383
+
384
+ For research or indexing systems that need codebase evidence without adopting
385
+ the maintained wiki format, prefer the read-only source-adapter commands:
386
+
387
+ ```bash
388
+ llm-wiki extract --src-dir <repo> --summary --read-only
389
+ llm-wiki context --src-dir <repo> --budget 12000 --format json --focus all --read-only
390
+ llm-wiki bootstrap --src-dir <repo> --wiki-dir sources/code_wikis/<source_id> --format json --source-adapter
391
+ ```
392
+
393
+ By default, `--src-dir` must resolve inside the current working directory. For a
394
+ trusted source tree outside cwd, pass `--allow-external-src`; explicit
395
+ `--paths` are still constrained to the chosen source root. Explicit output paths
396
+ such as `--output` may be absolute or outside the project root because they are
397
+ caller-selected artifacts.
398
+
399
+ Example `extract --summary` payload:
400
+
401
+ ```json
402
+ {
403
+ "schema_version": "llm-wiki-extract/v1",
404
+ "inventory": {
405
+ "models.py": {
406
+ "language": "python",
407
+ "package": "sample",
408
+ "classes": ["User"],
409
+ "functions": ["load_user"]
410
+ }
411
+ }
412
+ }
413
+ ```
414
+
415
+ Example `context --format json` payload:
416
+
417
+ ```json
418
+ {
419
+ "budget": 12000,
420
+ "used": 320,
421
+ "truncated": false,
422
+ "omitted_files": [],
423
+ "downgraded_files": {},
424
+ "files": {
425
+ "models.py": {
426
+ "priority": "high",
427
+ "detail": "deep",
428
+ "classes": [{"name": "User"}],
429
+ "functions": []
430
+ }
431
+ }
432
+ }
433
+ ```
434
+
435
+ Example `bootstrap --format json --source-adapter` summary:
436
+
437
+ ```json
438
+ {
439
+ "schema_version": "llm-wiki-bootstrap-summary/v1",
440
+ "src_dir": "/path/to/repo",
441
+ "generated_wiki_path": "sources/code_wikis/repo",
442
+ "depth": "full",
443
+ "source_files": 12,
444
+ "classes": 8,
445
+ "functions": 31,
446
+ "docker_files": 1,
447
+ "workflows": 2,
448
+ "cross_references": 14,
449
+ "created_files": ["sources/code_wikis/repo/index.md"],
450
+ "updated_files": [],
451
+ "skipped_files": [],
452
+ "manifest_path": "sources/code_wikis/repo/.llm-wiki-manifest.json"
453
+ }
454
+ ```
455
+
359
456
  ### `generate-prompt`
360
457
 
361
458
  Build a sync prompt for IDE agents or for manual review.
@@ -368,7 +465,9 @@ llm-wiki generate-prompt --template compact
368
465
  ```
369
466
 
370
467
  The generated prompt includes change-type guidance. Installed prompt templates
371
- can override the default prompt body.
468
+ can override the default prompt body. The default prompt asks agents to run
469
+ `sync` first, then perform a semantic pass on affected pages before accepting a
470
+ lint-clean wiki as complete.
372
471
 
373
472
  ### `mcp`
374
473
 
@@ -8,6 +8,7 @@ src/agent_wiki_cli.egg-info/entry_points.txt
8
8
  src/agent_wiki_cli.egg-info/requires.txt
9
9
  src/agent_wiki_cli.egg-info/top_level.txt
10
10
  src/llm_wiki_cli/__init__.py
11
+ src/llm_wiki_cli/api.py
11
12
  src/llm_wiki_cli/cli.py
12
13
  src/llm_wiki_cli/config.py
13
14
  src/llm_wiki_cli/commands/__init__.py
@@ -50,6 +51,7 @@ src/llm_wiki_cli/extractors/ts_scripts/extract.js
50
51
  src/llm_wiki_cli/extractors/ts_scripts/package.json
51
52
  src/llm_wiki_cli/services/__init__.py
52
53
  src/llm_wiki_cli/services/circuit_breaker.py
54
+ src/llm_wiki_cli/services/contracts.py
53
55
  src/llm_wiki_cli/services/extractor_helpers.py
54
56
  src/llm_wiki_cli/services/imports.py
55
57
  src/llm_wiki_cli/services/inventory_cache.py
@@ -66,6 +68,7 @@ src/llm_wiki_cli/services/secure_file.py
66
68
  src/llm_wiki_cli/services/source_snapshot.py
67
69
  src/llm_wiki_cli/services/team.py
68
70
  src/llm_wiki_cli/services/versioning.py
71
+ tests/test_api.py
69
72
  tests/test_bootstrap.py
70
73
  tests/test_bump.py
71
74
  tests/test_ci_check.py
@@ -0,0 +1,130 @@
1
+ """Supported Python API for source-adapter extraction and context payloads."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any
6
+
7
+ from .commands import context_cmd, extract_cmd
8
+ from .config import PathValidationError
9
+ from .services.contracts import (
10
+ BOOTSTRAP_SUMMARY_SCHEMA_VERSION,
11
+ EXTRACT_SCHEMA_VERSION,
12
+ )
13
+
14
+
15
+ class LlmWikiApiError(RuntimeError):
16
+ """Base exception raised by the supported Python API."""
17
+
18
+
19
+ class PathPolicyError(LlmWikiApiError):
20
+ """Raised when a source path violates the configured path policy."""
21
+
22
+
23
+ class ExtractionError(LlmWikiApiError):
24
+ """Raised when source extraction fails."""
25
+
26
+
27
+ def extract_source(
28
+ src_dir: str = ".",
29
+ *,
30
+ changed: bool = False,
31
+ summary: bool = False,
32
+ deep: bool = False,
33
+ paths: list[str] | None = None,
34
+ package: str | None = None,
35
+ include_empty: bool = False,
36
+ allow_external_src: bool = False,
37
+ read_only: bool = True,
38
+ ) -> dict[str, Any]:
39
+ """Return the stable ``llm-wiki extract`` JSON payload as a dict."""
40
+ try:
41
+ result = extract_cmd.build_extract_payload(
42
+ src_dir,
43
+ changed=changed,
44
+ summary=summary,
45
+ deep=deep,
46
+ paths=paths,
47
+ package_filter=package,
48
+ include_empty=include_empty,
49
+ allow_external_src=allow_external_src,
50
+ read_only=read_only,
51
+ )
52
+ except PathValidationError as exc:
53
+ raise PathPolicyError(str(exc)) from exc
54
+ except extract_cmd.ExtractorFailureError as exc:
55
+ raise ExtractionError(str(exc)) from exc
56
+ except ValueError as exc:
57
+ raise LlmWikiApiError(str(exc)) from exc
58
+ return result.payload
59
+
60
+
61
+ def build_context(
62
+ src_dir: str = ".",
63
+ *,
64
+ budget: int = 32000,
65
+ format: str = "json",
66
+ focus: str | list[str] = "changed",
67
+ filters: dict | None = None,
68
+ allow_external_src: bool = False,
69
+ read_only: bool = True,
70
+ ) -> dict[str, Any]:
71
+ """Return a supported context payload without depending on CLI internals."""
72
+ focus_values = _normalise_focus(focus)
73
+ request = {
74
+ "protocol": context_cmd.PROTOCOL_VERSION,
75
+ "budget_tokens": budget,
76
+ "focus": focus_values,
77
+ "format": format,
78
+ "filters": filters or {},
79
+ }
80
+ try:
81
+ validated = context_cmd._validate_protocol_request(request)
82
+ payload, warnings = context_cmd._build_context(
83
+ src_dir,
84
+ validated["budget_tokens"],
85
+ validated["format"],
86
+ validated["focus"],
87
+ validated["filters"],
88
+ emit_warnings=False,
89
+ allow_external_src=allow_external_src,
90
+ read_only=read_only,
91
+ )
92
+ except PathValidationError as exc:
93
+ raise PathPolicyError(str(exc)) from exc
94
+ except context_cmd.ProtocolRequestError as exc:
95
+ if exc.field == "src_dir":
96
+ raise ExtractionError(str(exc)) from exc
97
+ raise LlmWikiApiError(str(exc)) from exc
98
+
99
+ if validated["format"] == "markdown":
100
+ return {
101
+ "content": context_cmd._render_markdown(payload),
102
+ "payload": payload,
103
+ "warnings": warnings,
104
+ }
105
+
106
+ result = dict(payload)
107
+ if warnings:
108
+ result["warnings"] = warnings
109
+ return result
110
+
111
+
112
+ def _normalise_focus(focus: str | list[str]) -> list[str]:
113
+ if isinstance(focus, str):
114
+ if focus == "all":
115
+ return ["all"]
116
+ if focus == "changed":
117
+ return ["changed", "neighbors"]
118
+ return [focus]
119
+ return list(focus)
120
+
121
+
122
+ __all__ = [
123
+ "BOOTSTRAP_SUMMARY_SCHEMA_VERSION",
124
+ "EXTRACT_SCHEMA_VERSION",
125
+ "ExtractionError",
126
+ "LlmWikiApiError",
127
+ "PathPolicyError",
128
+ "build_context",
129
+ "extract_source",
130
+ ]
@@ -78,6 +78,12 @@ def main():
78
78
  help="Only include files belonging to the named package")
79
79
  extract_parser.add_argument("--include-empty", action="store_true",
80
80
  help="Include all .py files even if they have no extractable components")
81
+ extract_parser.add_argument("--output", metavar="PATH",
82
+ help="Write JSON output to a file instead of stdout")
83
+ extract_parser.add_argument("--read-only", action="store_true",
84
+ help="Guarantee source-adapter mode writes no llm-wiki files except explicit --output")
85
+ extract_parser.add_argument("--allow-external-src", action="store_true",
86
+ help="Allow --src-dir to point outside the current working directory")
81
87
 
82
88
  # lint command
83
89
  lint_parser = subparsers.add_parser("lint", help="Lint LLM Wiki for broken links, orphans, and AST drift")
@@ -203,6 +209,12 @@ def main():
203
209
  help="shallow=names only, full=docstrings/attrs/methods/imports/relationships (default: full)")
204
210
  bootstrap_parser.add_argument("--skip-workflows", action="store_true",
205
211
  help="Skip automatic workflow page generation from call graph")
212
+ bootstrap_parser.add_argument("--format", choices=["text", "json"], default="text",
213
+ help="Console output format (default: text)")
214
+ bootstrap_parser.add_argument("--source-adapter", action="store_true",
215
+ help="Write only under --wiki-dir and skip agent constraint updates")
216
+ bootstrap_parser.add_argument("--allow-external-src", action="store_true",
217
+ help="Allow --src-dir to point outside the current working directory")
206
218
 
207
219
  # bump command
208
220
  bump_parser = subparsers.add_parser("bump", help="Bump project version (patch or minor)")
@@ -393,6 +405,12 @@ def main():
393
405
  help="changed=prioritise git diff files, all=treat every file as high priority (default: changed)")
394
406
  context_parser.add_argument("--request", metavar="FILE|-",
395
407
  help="Read a Wiki-as-Context protocol JSON request from a file or stdin")
408
+ context_parser.add_argument("--output", metavar="PATH",
409
+ help="Write generated context to a file instead of stdout")
410
+ context_parser.add_argument("--read-only", action="store_true",
411
+ help="Guarantee source-adapter mode writes no llm-wiki files except explicit --output")
412
+ context_parser.add_argument("--allow-external-src", action="store_true",
413
+ help="Allow --src-dir to point outside the current working directory")
396
414
 
397
415
  args = parser.parse_args()
398
416