ki-manager 2.2.1__tar.gz → 2.3.0.dev2__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.
- ki_manager-2.3.0.dev2/CHANGELOG.md +130 -0
- {ki_manager-2.2.1 → ki_manager-2.3.0.dev2}/PKG-INFO +26 -1
- {ki_manager-2.2.1 → ki_manager-2.3.0.dev2}/README.md +25 -0
- {ki_manager-2.2.1 → ki_manager-2.3.0.dev2}/pyproject.toml +1 -1
- {ki_manager-2.2.1 → ki_manager-2.3.0.dev2}/src/ki_manager/__init__.py +1 -1
- {ki_manager-2.2.1 → ki_manager-2.3.0.dev2}/src/ki_manager/cli.py +19 -3
- ki_manager-2.3.0.dev2/src/ki_manager/scripts/add_ki_to_config.py +80 -0
- {ki_manager-2.2.1 → ki_manager-2.3.0.dev2}/src/ki_manager/scripts/generate_dir_index.py +1 -1
- ki_manager-2.3.0.dev2/src/ki_manager/scripts/ki_search.py +342 -0
- {ki_manager-2.2.1 → ki_manager-2.3.0.dev2}/src/ki_manager/scripts/ki_utils.py +266 -53
- {ki_manager-2.2.1 → ki_manager-2.3.0.dev2}/src/ki_manager/scripts/knowledge_engine.py +8 -3
- ki_manager-2.3.0.dev2/src/ki_manager/scripts/sync_agents_md.py +160 -0
- {ki_manager-2.2.1 → ki_manager-2.3.0.dev2}/src/ki_manager/server.py +796 -91
- ki_manager-2.3.0.dev2/src/ki_manager/tools/facade.py +401 -0
- {ki_manager-2.2.1 → ki_manager-2.3.0.dev2}/src/ki_manager/tools/scaffold.py +24 -42
- ki_manager-2.3.0.dev2/src/ki_manager/workflows/create-adr.md +76 -0
- {ki_manager-2.2.1 → ki_manager-2.3.0.dev2}/src/ki_manager/workflows/expand-knowledge.md +63 -23
- {ki_manager-2.2.1 → ki_manager-2.3.0.dev2}/src/ki_manager/workflows/scaffold-knowledge.md +90 -30
- {ki_manager-2.2.1 → ki_manager-2.3.0.dev2}/src/ki_manager/workflows/sync-knowledge.md +39 -4
- ki_manager-2.2.1/CHANGELOG.md +0 -85
- ki_manager-2.2.1/src/ki_manager/scripts/add_ki_to_config.py +0 -57
- ki_manager-2.2.1/src/ki_manager/workflows/create-adr.md +0 -64
- {ki_manager-2.2.1 → ki_manager-2.3.0.dev2}/.gitignore +0 -0
- {ki_manager-2.2.1 → ki_manager-2.3.0.dev2}/LICENSE +0 -0
- {ki_manager-2.2.1 → ki_manager-2.3.0.dev2}/src/ki_manager/scripts/analyze_module.py +0 -0
- {ki_manager-2.2.1 → ki_manager-2.3.0.dev2}/src/ki_manager/scripts/audit_coverage.py +0 -0
- {ki_manager-2.2.1 → ki_manager-2.3.0.dev2}/src/ki_manager/scripts/finalize_ki_scaffolds.py +0 -0
- {ki_manager-2.2.1 → ki_manager-2.3.0.dev2}/src/ki_manager/scripts/find_unmapped_files.py +0 -0
- {ki_manager-2.2.1 → ki_manager-2.3.0.dev2}/src/ki_manager/scripts/generate_ki_scaffolds.py +0 -0
- {ki_manager-2.2.1 → ki_manager-2.3.0.dev2}/src/ki_manager/scripts/ki_dependency_analyzer.py +0 -0
- {ki_manager-2.2.1 → ki_manager-2.3.0.dev2}/src/ki_manager/scripts/ki_graph_visualize.py +0 -0
- {ki_manager-2.2.1 → ki_manager-2.3.0.dev2}/src/ki_manager/tools/__init__.py +0 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to the `ki-manager` project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
<!-- Note: This changelog is intended for end-users and AI agents. It must always be maintained in English and focus on user-facing features, behavior changes, and bug fixes rather than internal implementation details. -->
|
|
9
|
+
|
|
10
|
+
## [Unreleased]
|
|
11
|
+
|
|
12
|
+
## [2.3.0.dev2] — 2026-10-06
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- `ki_search` output summarization & pagination: compact Markdown list formatting by default (saving up to 60% of context tokens and preventing MCP client disk dumping), reduced default result limit from 10 to 5, and added `offset` parameter for seamless result pagination.
|
|
16
|
+
- `ki_search` format option: added `format: "markdown"|"json"` allowing clients to choose between compact human/LLM-readable lists or raw JSON.
|
|
17
|
+
- `ki_read` and `read_know_file` character offset: added optional `offset` parameter enabling targeted reading from specific character positions without requiring repeated full reads.
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
- `ki_read` path resolution: resilient cascade resolving paths relative to knowledge root (`.ki-base` by default), project root, subfolder prefixes, or filename basenames across KI and ADR documents.
|
|
21
|
+
- `ki_instructions` tool schema: aligned document list with active workflows (`scaffold-knowledge`, `expand-knowledge`, `sync-knowledge`, `create-adr`), removing deprecated `update-knowledge`.
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
- Fixed `KeyError: 'know_root'` in `ki_status` tool when checking active project status.
|
|
25
|
+
|
|
26
|
+
## [2.3.0.dev1] — 2026-10-05
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
- `--tool-mode full|compact` CLI option and `KI_TOOL_MODE` environment variable: compact facade mode reducing `tools/list` from 33 schemas to 6 essential tools (`ki_instructions`, `ki_search`, `ki_read`, `ki_tools`, `ki_call`, `ki_mutate`), drastically reducing context token usage for MCP clients.
|
|
30
|
+
- `ki_search` MCP tool & search engine: BM25 ranking across Knowledge Items and ADRs without external embedding dependencies, featuring bilingual RU/EN stemming, weighted fields (Title x5, Headers x3, Path x2, Body x1), and contextual snippets.
|
|
31
|
+
- `ki_read` MCP tool: token-efficient reader for KI and ADR markdown files with section filtering and character limit truncation.
|
|
32
|
+
- `ki_tools` MCP tool: grouped catalog of all available tools and on-demand JSON schema inspector.
|
|
33
|
+
- `ki_call` and `ki_mutate` facade dispatchers: safe routing with schema validation and enforcement of `readOnlyHint` (read-only queries in `ki_call`, mutations in `ki_mutate`).
|
|
34
|
+
- Dynamic instructions & template directives: workflows and server rules dynamically adapt tool call examples and `allowed-tools` frontmatter to active `--tool-mode` (`full` vs `compact`) via HTML comment directives (`<!-- if-compact -->`), maintaining a single source of truth without content divergence.
|
|
35
|
+
- Dedicated Agent Skill `ki-manager-workflows`: guide in `.agent/skills/ki-manager-workflows/` for authoring and maintaining dual-mode workflow instructions.
|
|
36
|
+
- CLI `install-skills` mode option: `ki-manager install-skills` supports `--tool-mode full|compact` to render installed skill markdown for the intended client environment.
|
|
37
|
+
- `add_ki_to_config` MCP tool and CLI helper: safely register or update Knowledge Items in `doc_config.json` with sandbox checks and atomic file updates.
|
|
38
|
+
- `edit_doc_config` MCP tool: granular and safe modifications (`set`, `append`, `delete`) to service sections (`tracked_modules`, `artifacts`, `coverage_settings`) of `doc_config.json`.
|
|
39
|
+
- `sync_agents_md` MCP tool and script: synchronize Knowledge Items and ADR tables in `AGENTS.md` using the single source of truth from `doc_config.json` and `decisions/`.
|
|
40
|
+
- Per-project configurable agent instructions sync: `sync_agents_md` can be disabled via `"sync_agents_md": false` in `ki_config.json` to prevent context pollution in large projects.
|
|
41
|
+
- `create_adr` MCP tool: create new Architecture Decision Records (ADR) with auto-incremented sequential ID prefix (`XXX`), standardized metadata, registration in `doc_config.json`, and automatic `AGENTS.md` sync.
|
|
42
|
+
- Structured ADR table parser and enhanced `ki://adr-list.md` virtual resource displaying ID, Title, Status, Date, and File links.
|
|
43
|
+
- Automatic IDE MCP tool schema generation (`<tool>.json`) for Antigravity, Cursor, and Windsurf on startup.
|
|
44
|
+
- Comprehensive positive and negative test suite for configuration tools, ADR creation, synchronization rules, and sandbox enforcement.
|
|
45
|
+
- Flexible configuration discovery: `ki_config.json` can now reside in project root, `.config/`, `config/`, `.ki-base/`, or `.know/`.
|
|
46
|
+
- Fileless project registration: `ki_register_project` now supports registering projects directly via `workspace` and `inline_config` in `~/.ki_base/registry.json` without requiring configuration files on disk.
|
|
47
|
+
- First-class custom knowledge root support: `paths.knowledge_root` is dynamically resolved and respected across all tools, engines, and scripts without chicken-and-egg discovery issues.
|
|
48
|
+
- Configurable scaffolding: `ki_init_project` now accepts `knowledge_root` and `config_location` (`root` or `knowledge_dir`) parameters.
|
|
49
|
+
- Dynamic workflow paths: workflow instructions dynamically substitute `{{KI_DIR}}` with the active project's knowledge folder name.
|
|
50
|
+
- Unit and negative test coverage for flexible discovery, custom roots, and registry validation errors.
|
|
51
|
+
|
|
52
|
+
### Changed
|
|
53
|
+
- `scaffold.migrate_project` now preserves existing `AGENTS.md` files instead of forcibly deleting them.
|
|
54
|
+
- Neutralized MCP tool descriptions and server prompt schemas, replacing hardcoded `.ki-base/` with dynamic references.
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
### Fixed
|
|
58
|
+
- Fixed an issue where `write_know_file` could permanently delete the contents of a file (leaving 0 bytes) if an encoding error occurred during saving.
|
|
59
|
+
- Fixed server crashes and communication failures on Windows when handling text with emojis or special Unicode characters.
|
|
60
|
+
- Fixed `edit_know_file` frequently failing to find and replace text blocks on Windows due to invisible line-ending mismatches (CRLF vs LF).
|
|
61
|
+
- Fixed the `update_last_verified` tool being completely unusable due to a "missing script" error.
|
|
62
|
+
- Fixed `git_checkpoint` failing to create backups when the project contained `.gitignore`'d files.
|
|
63
|
+
- Fixed incorrect schema definitions that prevented AI agents from successfully calling parameterless tools.
|
|
64
|
+
- Fixed outdated workflow instructions that were causing AI agents to fail by using the deprecated `ki_call` syntax.
|
|
65
|
+
|
|
66
|
+
## [2.2.0] — 2026-09-24
|
|
67
|
+
|
|
68
|
+
### Added
|
|
69
|
+
- `ki_graph_visualize` MCP tool: on-the-fly Mermaid architecture diagrams visualizing dependencies and file clusters across Knowledge Items.
|
|
70
|
+
- Cross-platform CI matrix workflow testing both Ubuntu and Windows environments on Python 3.10, 3.11, and 3.12.
|
|
71
|
+
- End-to-end MCP integration test suite validating real JSON-RPC stdio subprocess communication, handshake, and tool execution.
|
|
72
|
+
- Automated pre-flight release verification gate ensuring zero broken packages before release tagging.
|
|
73
|
+
|
|
74
|
+
### Fixed
|
|
75
|
+
- Proper exit codes and help formatting for `ki-manager-skills` CLI flags (`--help`, `-h`, `--version`).
|
|
76
|
+
|
|
77
|
+
## [2.1.4] — 2026-09-22
|
|
78
|
+
|
|
79
|
+
### Added
|
|
80
|
+
- Unified file and directory exclusion engine supporting glob patterns (`*`, `?`) across configuration files (`config.json`, `doc_config.json`, `ki_config.json`).
|
|
81
|
+
- Official project changelog following the Keep a Changelog standard.
|
|
82
|
+
|
|
83
|
+
### Changed
|
|
84
|
+
- Knowledge audit tools (`audit_coverage`, `find_unmapped_files`, `generate_dir_index`, `analyze_dependencies`) now consistently respect all configured exclusion rules.
|
|
85
|
+
|
|
86
|
+
### Fixed
|
|
87
|
+
- UTF-8 encoding crashes when running MCP tool scripts in Windows environments.
|
|
88
|
+
|
|
89
|
+
## [2.1.3] — 2026-08-12
|
|
90
|
+
|
|
91
|
+
### Added
|
|
92
|
+
- `ki_finalize_scaffolds` MCP tool for bulk finalizing generated Knowledge Item drafts.
|
|
93
|
+
- Bundled `scaffold-knowledge` workflow for AI coding assistants.
|
|
94
|
+
- Installation hint for `ki-manager-skills install-skills` displayed during server startup.
|
|
95
|
+
|
|
96
|
+
### Changed
|
|
97
|
+
- Synchronized Smithery catalog manifest with updated schemas for all 25 MCP tools.
|
|
98
|
+
|
|
99
|
+
## [2.1.2] — 2026-08-11
|
|
100
|
+
|
|
101
|
+
### Fixed
|
|
102
|
+
- Test suite verification during automated package build and release.
|
|
103
|
+
|
|
104
|
+
## [2.1.1] — 2026-08-11
|
|
105
|
+
|
|
106
|
+
### Fixed
|
|
107
|
+
- Workspace path resolution compliance with the updated MCP protocol specification.
|
|
108
|
+
|
|
109
|
+
## [2.1.0] — 2026-08-11
|
|
110
|
+
|
|
111
|
+
### Added
|
|
112
|
+
- Support for `server/discover` handshake and workspace folder detection under MCP 2026-07-28 protocol.
|
|
113
|
+
- `ki-manager-skills` CLI command to easily install bundled workflows into IDE skill directories.
|
|
114
|
+
- Automated release workflow for publishing packages to PyPI and Smithery Registry.
|
|
115
|
+
|
|
116
|
+
## [2.0.0] — 2026-07-24
|
|
117
|
+
|
|
118
|
+
### Added
|
|
119
|
+
- Initial 2.0 release of the `ki-manager` MCP server for project knowledge base management.
|
|
120
|
+
|
|
121
|
+
[Unreleased]: https://github.com/Laeryid/KI-base/compare/v2.3.0.dev1...HEAD
|
|
122
|
+
[2.3.0.dev1]: https://github.com/Laeryid/KI-base/compare/v2.2.1...v2.3.0.dev1
|
|
123
|
+
[2.2.1]: https://github.com/Laeryid/KI-base/compare/v2.2.0...v2.2.1
|
|
124
|
+
[2.2.0]: https://github.com/Laeryid/KI-base/compare/v2.1.4...v2.2.0
|
|
125
|
+
[2.1.4]: https://github.com/Laeryid/KI-base/compare/v2.1.3...v2.1.4
|
|
126
|
+
[2.1.3]: https://github.com/Laeryid/KI-base/compare/v2.1.2...v2.1.3
|
|
127
|
+
[2.1.2]: https://github.com/Laeryid/KI-base/compare/v2.1.1...v2.1.2
|
|
128
|
+
[2.1.1]: https://github.com/Laeryid/KI-base/compare/v2.1.0...v2.1.1
|
|
129
|
+
[2.1.0]: https://github.com/Laeryid/KI-base/compare/v2.0.37...v2.1.0
|
|
130
|
+
[2.0.0]: https://github.com/Laeryid/KI-base/releases/tag/v2.0.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: ki-manager
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.3.0.dev2
|
|
4
4
|
Summary: Knowledge Item (KI) management MCP server for AI-assisted development
|
|
5
5
|
Project-URL: Homepage, https://github.com/Laeryid/KI-base
|
|
6
6
|
Project-URL: Repository, https://github.com/Laeryid/KI-base
|
|
@@ -43,6 +43,10 @@ Classifier: Topic :: Software Development :: Documentation
|
|
|
43
43
|
Requires-Python: >=3.8
|
|
44
44
|
Description-Content-Type: text/markdown
|
|
45
45
|
|
|
46
|
+
<p align="center">
|
|
47
|
+
<img src="https://raw.githubusercontent.com/Laeryid/KI-base/main/ki_manager_logo.png" width="150" alt="ki-manager Logo">
|
|
48
|
+
</p>
|
|
49
|
+
|
|
46
50
|
# ki-manager — Knowledge Item MCP Server
|
|
47
51
|
|
|
48
52
|
> AI-powered knowledge management for software projects.
|
|
@@ -122,6 +126,23 @@ On Windows:
|
|
|
122
126
|
}
|
|
123
127
|
```
|
|
124
128
|
|
|
129
|
+
### Compact Mode (Token Saver)
|
|
130
|
+
|
|
131
|
+
By default, `ki-manager` runs in `full` mode and exposes all tools directly. For AI clients that inject tool definitions into the context window, you can enable compact facade mode to expose only 6 essential tools (`ki_instructions`, `ki_search`, `ki_read`, `ki_tools`, `ki_call`, `ki_mutate`):
|
|
132
|
+
|
|
133
|
+
```json
|
|
134
|
+
{
|
|
135
|
+
"mcpServers": {
|
|
136
|
+
"ki-manager": {
|
|
137
|
+
"command": "ki-manager",
|
|
138
|
+
"args": ["--tool-mode", "compact"]
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Alternatively, set the environment variable `KI_TOOL_MODE=compact`.
|
|
145
|
+
|
|
125
146
|
---
|
|
126
147
|
|
|
127
148
|
## Quickstart
|
|
@@ -164,6 +185,10 @@ Use the available tools or slash commands:
|
|
|
164
185
|
| `ki_scaffold` | Create stub KI files for uncovered modules |
|
|
165
186
|
| `ki_scaffold_status` | Show pending vs enriched scaffold KIs |
|
|
166
187
|
| `ki_finalize_scaffolds` | Strip scaffold markers, update doc_config summaries |
|
|
188
|
+
| `add_ki_to_config` | Register or update Knowledge Item in `doc_config.json` |
|
|
189
|
+
| `edit_doc_config` | Safely modify `doc_config.json` (`tracked_modules`, `artifacts`, `coverage_settings`) |
|
|
190
|
+
| `sync_agents_md` | Sync Knowledge Items and ADR tables in `AGENTS.md` (can be disabled via `sync_agents_md: false` in `ki_config.json`) |
|
|
191
|
+
| `create_adr` | Create structured ADR with sequential ID, template, and auto-registration |
|
|
167
192
|
| `analyze_all_dependencies` | Update "Related KIs" links across all KIs |
|
|
168
193
|
| `git_checkpoint` | Save knowledge snapshot to git |
|
|
169
194
|
| `/scaffold-knowledge` | Bootstrap KI stubs → AI enrichment → finalize |
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/Laeryid/KI-base/main/ki_manager_logo.png" width="150" alt="ki-manager Logo">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
1
5
|
# ki-manager — Knowledge Item MCP Server
|
|
2
6
|
|
|
3
7
|
> AI-powered knowledge management for software projects.
|
|
@@ -77,6 +81,23 @@ On Windows:
|
|
|
77
81
|
}
|
|
78
82
|
```
|
|
79
83
|
|
|
84
|
+
### Compact Mode (Token Saver)
|
|
85
|
+
|
|
86
|
+
By default, `ki-manager` runs in `full` mode and exposes all tools directly. For AI clients that inject tool definitions into the context window, you can enable compact facade mode to expose only 6 essential tools (`ki_instructions`, `ki_search`, `ki_read`, `ki_tools`, `ki_call`, `ki_mutate`):
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"mcpServers": {
|
|
91
|
+
"ki-manager": {
|
|
92
|
+
"command": "ki-manager",
|
|
93
|
+
"args": ["--tool-mode", "compact"]
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Alternatively, set the environment variable `KI_TOOL_MODE=compact`.
|
|
100
|
+
|
|
80
101
|
---
|
|
81
102
|
|
|
82
103
|
## Quickstart
|
|
@@ -119,6 +140,10 @@ Use the available tools or slash commands:
|
|
|
119
140
|
| `ki_scaffold` | Create stub KI files for uncovered modules |
|
|
120
141
|
| `ki_scaffold_status` | Show pending vs enriched scaffold KIs |
|
|
121
142
|
| `ki_finalize_scaffolds` | Strip scaffold markers, update doc_config summaries |
|
|
143
|
+
| `add_ki_to_config` | Register or update Knowledge Item in `doc_config.json` |
|
|
144
|
+
| `edit_doc_config` | Safely modify `doc_config.json` (`tracked_modules`, `artifacts`, `coverage_settings`) |
|
|
145
|
+
| `sync_agents_md` | Sync Knowledge Items and ADR tables in `AGENTS.md` (can be disabled via `sync_agents_md: false` in `ki_config.json`) |
|
|
146
|
+
| `create_adr` | Create structured ADR with sequential ID, template, and auto-registration |
|
|
122
147
|
| `analyze_all_dependencies` | Update "Related KIs" links across all KIs |
|
|
123
148
|
| `git_checkpoint` | Save knowledge snapshot to git |
|
|
124
149
|
| `/scaffold-knowledge` | Bootstrap KI stubs → AI enrichment → finalize |
|
|
@@ -11,6 +11,7 @@ Usage:
|
|
|
11
11
|
"""
|
|
12
12
|
|
|
13
13
|
import sys
|
|
14
|
+
import os
|
|
14
15
|
import argparse
|
|
15
16
|
from pathlib import Path
|
|
16
17
|
|
|
@@ -61,6 +62,13 @@ def install_skills(argv=None):
|
|
|
61
62
|
default=None,
|
|
62
63
|
help="Target skills directory (default: current working directory)",
|
|
63
64
|
)
|
|
65
|
+
parser.add_argument(
|
|
66
|
+
"--tool-mode",
|
|
67
|
+
type=str,
|
|
68
|
+
choices=["full", "compact"],
|
|
69
|
+
default=None,
|
|
70
|
+
help="Format for skill instructions (default: full, or KI_TOOL_MODE env var)",
|
|
71
|
+
)
|
|
64
72
|
args = parser.parse_args(argv)
|
|
65
73
|
|
|
66
74
|
target = Path(args.path).resolve() if args.path else Path.cwd()
|
|
@@ -77,9 +85,17 @@ def install_skills(argv=None):
|
|
|
77
85
|
installed = []
|
|
78
86
|
skipped = []
|
|
79
87
|
|
|
88
|
+
# Import facade renderer
|
|
89
|
+
sys.path.insert(0, str(_PACKAGE_DIR / "tools"))
|
|
90
|
+
from facade import render_instruction
|
|
91
|
+
target_mode = (args.tool_mode or os.environ.get("KI_TOOL_MODE", "full")).lower()
|
|
92
|
+
if target_mode not in ("full", "compact"):
|
|
93
|
+
target_mode = "full"
|
|
94
|
+
|
|
80
95
|
for wf_file in workflow_files:
|
|
81
|
-
|
|
82
|
-
|
|
96
|
+
raw_content = wf_file.read_text(encoding="utf-8")
|
|
97
|
+
rendered_content = render_instruction(raw_content, tool_mode=target_mode)
|
|
98
|
+
meta, _ = _parse_frontmatter(rendered_content)
|
|
83
99
|
|
|
84
100
|
skill_name = meta.get("name") or f"ki-manager-{wf_file.stem}"
|
|
85
101
|
skill_dir = target / skill_name
|
|
@@ -90,7 +106,7 @@ def install_skills(argv=None):
|
|
|
90
106
|
continue
|
|
91
107
|
|
|
92
108
|
skill_dir.mkdir(parents=True, exist_ok=True)
|
|
93
|
-
skill_md.write_text(
|
|
109
|
+
skill_md.write_text(rendered_content, encoding="utf-8")
|
|
94
110
|
installed.append(skill_name)
|
|
95
111
|
|
|
96
112
|
print(f"Installed: {len(installed)} skill(s)")
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"""
|
|
2
|
+
add_ki_to_config.py
|
|
3
|
+
|
|
4
|
+
CLI helper and module function to register or update a Knowledge Item in doc_config.json.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import sys
|
|
8
|
+
import os
|
|
9
|
+
import json
|
|
10
|
+
import argparse
|
|
11
|
+
from typing import List, Optional
|
|
12
|
+
|
|
13
|
+
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
14
|
+
import ki_utils
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def add_ki(
|
|
18
|
+
ki_name: str,
|
|
19
|
+
description: str,
|
|
20
|
+
covers: Optional[List[str]] = None,
|
|
21
|
+
depends_on: Optional[List[str]] = None,
|
|
22
|
+
summary: Optional[str] = None
|
|
23
|
+
) -> str:
|
|
24
|
+
"""
|
|
25
|
+
Registers or updates a Knowledge Item in doc_config.json.
|
|
26
|
+
"""
|
|
27
|
+
if not ki_name:
|
|
28
|
+
raise ValueError("ki_name is required.")
|
|
29
|
+
|
|
30
|
+
covers = covers if covers is not None else []
|
|
31
|
+
depends_on = depends_on if depends_on is not None else []
|
|
32
|
+
|
|
33
|
+
config = ki_utils.get_doc_config()
|
|
34
|
+
if not config and not ki_utils.get_doc_config_path():
|
|
35
|
+
raise PermissionError("No active workspace detected or doc_config.json not found.")
|
|
36
|
+
|
|
37
|
+
if "knowledge_items" not in config:
|
|
38
|
+
config["knowledge_items"] = {}
|
|
39
|
+
|
|
40
|
+
existing = config["knowledge_items"].get(ki_name, {})
|
|
41
|
+
entry = {
|
|
42
|
+
"description": description if description else existing.get("description", ""),
|
|
43
|
+
"covers": covers,
|
|
44
|
+
"depends_on": depends_on,
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if summary:
|
|
48
|
+
entry["summary"] = summary
|
|
49
|
+
elif "summary" in existing:
|
|
50
|
+
entry["summary"] = existing["summary"]
|
|
51
|
+
elif description:
|
|
52
|
+
entry["summary"] = description
|
|
53
|
+
|
|
54
|
+
config["knowledge_items"][ki_name] = entry
|
|
55
|
+
ki_utils.save_doc_config(config)
|
|
56
|
+
return f"Knowledge Item '{ki_name}' successfully registered in doc_config.json"
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def main():
|
|
60
|
+
parser = argparse.ArgumentParser(description="Add or update a Knowledge Item in doc_config.json")
|
|
61
|
+
parser.add_argument("ki_name", type=str, help="Knowledge Item filename")
|
|
62
|
+
parser.add_argument("description", type=str, help="KI description")
|
|
63
|
+
parser.add_argument("--covers", type=str, default="[]", help="JSON array of covered modules")
|
|
64
|
+
parser.add_argument("--depends-on", type=str, default="[]", help="JSON array of dependencies")
|
|
65
|
+
parser.add_argument("--summary", type=str, default=None, help="Optional summary text")
|
|
66
|
+
|
|
67
|
+
args = parser.parse_args()
|
|
68
|
+
try:
|
|
69
|
+
covers = json.loads(args.covers)
|
|
70
|
+
depends_on = json.loads(args.depends_on)
|
|
71
|
+
except json.JSONDecodeError as e:
|
|
72
|
+
print(f"Error decoding JSON arguments: {e}")
|
|
73
|
+
sys.exit(1)
|
|
74
|
+
|
|
75
|
+
result = add_ki(args.ki_name, args.description, covers, depends_on, args.summary)
|
|
76
|
+
print(result)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
if __name__ == "__main__":
|
|
80
|
+
main()
|
|
@@ -94,7 +94,7 @@ def build_tree(root: str, knowledge_root_name: str,
|
|
|
94
94
|
def generate_dir_index(output_path: str, max_depth: int = 3) -> None:
|
|
95
95
|
project_root = get_project_root()
|
|
96
96
|
knowledge_root = get_knowledge_root()
|
|
97
|
-
knowledge_root_name = os.path.basename(knowledge_root) if knowledge_root else ".
|
|
97
|
+
knowledge_root_name = os.path.basename(knowledge_root) if knowledge_root else ".ki-base"
|
|
98
98
|
now = datetime.now(timezone.utc).strftime("%Y-%m-%d")
|
|
99
99
|
project_name = os.path.basename(os.path.abspath(project_root))
|
|
100
100
|
total_files = count_files_in_dir(project_root)
|