Skip to content

Commit ab39729

Browse files
tercelclaude
andcommitted
docs: fix spec contradictions, stale references, and import path inconsistencies
- ai-enhancement.md: clarify metadata.ai_guidance vs metadata["display"]["guidance"] relationship; document Enhancer sync (Python) vs async (TypeScript) as deliberate - convention-scanning.md: document ConventionScanner extends BaseScanner, Python-only - getting-started.md: replace --ai-enhance CLI flag with programmatic AIEnhancer usage; fix dead CHANGELOG.md link - openapi.md: unify TypeScript import path to "apcore-toolkit" - overview.md: add schema enrichment to Formatting description Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 2727385 commit ab39729

File tree

5 files changed

+34
-6
lines changed

5 files changed

+34
-6
lines changed

docs/ai-enhancement.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This document specifies how `apcore-toolkit` fills metadata gaps that static ana
77
The toolkit's primary mission is to make existing code "AI-Perceivable". While static analysis (regex, AST, type hints) is efficient, it often fails to:
88

99
- Generate meaningful `description` and `documentation` for legacy code with no docstrings.
10-
- Create effective guidance (stored in `metadata.ai_guidance`) for complex error handling paths.
10+
- Create effective guidance for complex error handling paths. (The scanner stores raw guidance in `metadata.ai_guidance`; `DisplayResolver` later resolves it into `metadata["display"]["guidance"]` for surface-specific consumption — see [Display Overlay](features/display-overlay.md).)
1111
- Infer `input_schema` for functions using `*args` or `**kwargs`.
1212
- Determine behavioral `annotations` (e.g., is this function destructive?) from code logic.
1313

@@ -67,6 +67,9 @@ The toolkit exports a generic `Enhancer` protocol that any enhancement implement
6767
}
6868
```
6969

70+
!!! note "Sync vs Async"
71+
The Python `Enhancer` protocol is synchronous (`list[ScannedModule]`) while the TypeScript interface is asynchronous (`Promise<ScannedModule[]>`). This is a deliberate language-convention choice: TypeScript enhancement calls (HTTP to SLM endpoints) are inherently async. Python implementations may use either sync or async internally; the protocol defines the sync signature for broader compatibility.
72+
7073
### Contract
7174

7275
- The enhancer receives modules **after** static scanning is complete.

docs/features/convention-scanning.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ This is the lowest-friction path to creating apcore modules: drop a `.py` file i
1515
**Class**: `apcore_toolkit.convention_scanner.ConventionScanner`
1616
**Module**: `apcore_toolkit/convention_scanner.py`
1717

18+
!!! note "Relationship to BaseScanner"
19+
`ConventionScanner` **extends** `BaseScanner` and inherits its shared utilities (`filter_modules`, `deduplicate_ids`, `infer_annotations_from_method`, `extract_docstring`). Its `scan()` method accepts a positional `commands_dir` parameter (plus keyword-only `include`/`exclude`) rather than the generic `**kwargs` of the abstract base — this is valid because `BaseScanner.scan()` declares `**kwargs` to allow subclass-specific signatures. Convention scanning is currently **Python-only** because it relies on Python's `importlib` to dynamically load `.py` files.
20+
1821
### Method Signature
1922

2023
```python

docs/features/openapi.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ This produces the flat `input_schema` required by the `ScannedModule`.
5151
=== "TypeScript"
5252

5353
```typescript
54-
import { extractInputSchema, extractOutputSchema } from "apcore-toolkit/openapi";
55-
import { ScannedModule } from "apcore-toolkit";
54+
import { extractInputSchema, extractOutputSchema, ScannedModule } from "apcore-toolkit";
5655

5756
// Load an OpenAPI spec
5857
const openapiSpec = { ... };

docs/features/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
| **[OpenAPI Integration](openapi.md)** | Extract JSON Schemas directly from OpenAPI operation objects. |
1111
| **[Schema Utilities](pydantic.md)** | Flatten complex models (Pydantic / Zod) for easier AI interaction. |
1212
| **[Output Writers](output-writers.md)** | Export metadata to YAML bindings, source code wrappers, or direct Registry registration — with optional output verification. |
13-
| **[Formatting](formatting.md)** | Convert data structures into beautiful, human-readable Markdown. |
13+
| **[Formatting](formatting.md)** | Convert data structures into Markdown and enrich JSON Schema descriptions from docstrings. |
1414
| **[AI Enhancement](../ai-enhancement.md)** | Pluggable `Enhancer` protocol with built-in `AIEnhancer` for local SLMs; [apcore-refinery](https://github.com/aiperceivable/apcore-refinery) recommended for production. |
1515
| **[Display Overlay](display-overlay.md)** | Sparse `binding.yaml` overlay that resolves surface-facing alias, description, guidance, and tags into `metadata["display"]` for CLI, MCP, and A2A surfaces (§5.13). |
1616
| **[Convention Scanning](convention-scanning.md)** | Scan a `commands/` directory of plain Python files for public functions, inferring schemas from type annotations -- zero decorators, zero imports (§5.14). |

docs/getting-started.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,30 @@ The toolkit includes a built-in `AIEnhancer` that calls any OpenAI-compatible lo
262262
```bash
263263
export APCORE_AI_ENABLED=true
264264
```
265-
3. **Run your scanner** with `--ai-enhance`: Missing descriptions, annotations, and schemas will be inferred automatically.
265+
3. **Use AIEnhancer programmatically** after scanning:
266+
267+
=== "Python"
268+
269+
```python
270+
from apcore_toolkit import AIEnhancer
271+
272+
if AIEnhancer.is_enabled():
273+
enhancer = AIEnhancer()
274+
modules = enhancer.enhance(modules)
275+
```
276+
277+
=== "TypeScript"
278+
279+
```typescript
280+
import { AIEnhancer } from "apcore-toolkit";
281+
282+
if (AIEnhancer.isEnabled()) {
283+
const enhancer = new AIEnhancer();
284+
modules = await enhancer.enhance(modules);
285+
}
286+
```
287+
288+
Missing descriptions, annotations, and schemas will be inferred automatically.
266289

267290
For production use, we recommend **[apcore-refinery](https://github.com/aiperceivable/apcore-refinery)** which provides better prompts, model flexibility, and CI integration:
268291

@@ -278,5 +301,5 @@ See the [AI Enhancement Guide](ai-enhancement.md) for the full `Enhancer` protoc
278301

279302
- **[Features Overview](features/overview.md)** — Deep dive into all toolkit capabilities.
280303
- **[AI Enhancement Guide](ai-enhancement.md)** — Enhancer protocol, built-in AIEnhancer, and apcore-refinery.
281-
- **[Changelog](../CHANGELOG.md)** — See what's new in the latest release.
304+
- **[Changelog](https://github.com/aiperceivable/apcore-toolkit/releases)** — See what's new in the latest release.
282305
- **[apcore Documentation](https://aiperceivable.github.io/apcore/)** — Learn more about the core framework.

0 commit comments

Comments
 (0)