Skip to content

to_wiki() is exported and tested but never called from skill orchestration #354

Description

@johnp3004

Summary

graphify.wiki.to_wiki() is defined, re-exported via __init__.py, and unit-tested in tests/test_wiki.py. It generates the agent-crawlable wiki (index.md + one article per community + god-node articles) that is referenced in the README and CHANGELOG.

Despite this, no user-facing entry point in the package calls to_wiki(). The CLI (__main__.py) has no --wiki flag handling, and the skill orchestration (skills/graphify/skill.md, also bundled as graphify/skill.md) has no Step that calls it.

Evidence

Repo-wide code search for to_wiki:

$ gh api -X GET search/code -f q='to_wiki repo:safishamsi/graphify'
graphify/wiki.py        # definition
graphify/__init__.py    # re-export
tests/test_wiki.py      # unit test
CHANGELOG.md            # feature mention

Zero occurrences in __main__.py, skill.md, or any skill-*.md variant.

Observed inconsistency between v0.4.13 and main

  • v0.4.13 packaged skill.md line 29 documents --wiki as a valid skill argument:
    /graphify <path> --wiki    # build agent-crawlable wiki (index.md + one article per community)
    
    But there is no Step 6b/etc. in the same file that responds to --wiki by calling to_wiki(). The flag is silently accepted and ignored.
  • main HEAD (9c04b05) has removed even the documentation line, but the function definition and unit test remain. So on main, the function is exported and tested but completely undocumented in the skill.

Repro

pip install graphifyy==0.4.13
graphify install --platform claude
grep -i 'to_wiki' ~/.claude/skills/graphify/SKILL.md
# (no output)

The function itself works correctly when called directly — verified on a 189-node markdown corpus, generating 12 community articles + 10 god-node articles + index.md (~92 KB total) in well under a second.

Suggested fix

Add a Step 6b to skills/graphify/skill.md (and graphify/skill.md) parallel to the existing Step 6 obsidian block:

```markdown

Step 6b - Generate wiki (only if --wiki flag)

If `--wiki` was given:

` ` `bash
$(cat graphify-out/.graphify_python) -c "
import json
from graphify.build import build_from_json
from graphify.wiki import to_wiki
from pathlib import Path

extraction = json.loads(Path('graphify-out/.graphify_extract.json').read_text())
analysis = json.loads(Path('graphify-out/.graphify_analysis.json').read_text())
labels_raw = json.loads(Path('graphify-out/.graphify_labels.json').read_text()) if Path('graphify-out/.graphify_labels.json').exists() else {}

G = build_from_json(extraction)
communities = {int(k): v for k, v in analysis['communities'].items()}
cohesion = {int(k): v for k, v in analysis['cohesion'].items()}
labels = {int(k): v for k, v in labels_raw.items()}

n = to_wiki(G, communities, 'graphify-out/wiki', community_labels=labels or None, cohesion=cohesion, god_nodes_data=analysis['gods'])
print(f'Wiki: {n} articles in graphify-out/wiki/')
"
` ` `
```

…and re-add the v0.4.13 documentation line on line 29 if removing it was unintentional.

Workaround for users who need the wiki today

Call to_wiki() directly via the public API, reconstructing communities from node['community'] attributes in graph.json and parsing community_labels out of GRAPH_REPORT.md's ### Community N - "label" headers. ~30 lines of Python, no LLM calls, no skill dependency.

Happy to send a PR if useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions