Skip to content

Commit e4a1f36

Browse files
authored
feat: ✨ add graphify (#28)
2 parents ba7601b + e780497 commit e4a1f36

3 files changed

Lines changed: 64 additions & 15 deletions

File tree

Dockerfile

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ ARG CAVEMAN_VERSION=latest
8383
ARG AZURE_FOUNDRY_PROVIDER_REF=latest
8484
ARG PONYTAIL_VERSION=latest
8585
ARG ENGRAM_VERSION=latest
86+
ARG GRAPHIFY_VERSION=latest
8687
ARG OPENCODE_BUILD_DIR=/usr/local/share/opencode-build
8788

8889
ENV OPENCODE_CONFIG_DIR=/etc/opencode
@@ -267,6 +268,45 @@ grep -qF './ponytail/hooks/' "${OPENCODE_CONFIG_DIR}/plugins/ponytail.mjs" \
267268
curl -fsSL "${PONYTAIL_RAW_BASE}/skills/ponytail-help/SKILL.md" -o "${OPENCODE_CONFIG_DIR}/skills/ponytail-help/SKILL.md"
268269
} & wait || exit 1
269270

271+
###
272+
# graphify
273+
#
274+
graphify_resolved_version=$(resolve_github_latest_version "Graphify-Labs/graphify" "${GRAPHIFY_VERSION}") || exit 1
275+
echo "GRAPHIFY_RESOLVED_REF=${graphify_resolved_version}"
276+
277+
uv pip install --system graphifyy[pdf,office,svg,openai,azure,sql,postgres,terraform] || exit 1
278+
279+
# Install graphify for opencode into a temp project dir — uses install.py's
280+
# own _copy_skill_file + _install_opencode_plugin logic so the SKILL.md,
281+
# references/ sidecar, .graphify_version stamp, and graphify.js plugin are
282+
# all laid down correctly by graphify itself, not reconstructed here.
283+
TMP_GRAPHIFY=/tmp/graphify-install
284+
mkdir -p "$TMP_GRAPHIFY"
285+
( cd "$TMP_GRAPHIFY" && graphify install --project --platform opencode ) || exit 1
286+
287+
# Move installed artifacts to system opencode dir
288+
cp -r "$TMP_GRAPHIFY/.opencode/skills/graphify" "${OPENCODE_CONFIG_DIR}/skills/graphify"
289+
cp "$TMP_GRAPHIFY/.opencode/plugins/graphify.js" "${OPENCODE_CONFIG_DIR}/plugins/graphify.js"
290+
291+
rm -rf "$TMP_GRAPHIFY"
292+
293+
# Append graphify always-on section to AGENTS.md
294+
cat >> "${OPENCODE_CONFIG_DIR}/AGENTS.md" <<-'AGENTS_GRAPHIFY'
295+
296+
## graphify
297+
298+
This project has a knowledge graph at graphify-out/ with god nodes, community structure, and cross-file relationships.
299+
300+
When the user types `/graphify`, use the installed graphify skill or instructions before doing anything else.
301+
302+
Rules:
303+
- For codebase questions, first run `graphify query "<question>"` when graphify-out/graph.json exists. Use `graphify path "<A>" "<B>"` for relationships and `graphify explain "<concept>"` for focused concepts. These return a scoped subgraph, usually much smaller than GRAPH_REPORT.md or raw grep output.
304+
- Dirty graphify-out/ files are expected after hooks or incremental updates; dirty graph files are not a reason to skip graphify. Only skip graphify if the task is about stale or incorrect graph output, or the user explicitly says not to use it.
305+
- If graphify-out/wiki/index.md exists, use it for broad navigation instead of raw source browsing.
306+
- Read graphify-out/GRAPH_REPORT.md only for broad architecture review or when query/path/explain do not surface enough context.
307+
- After modifying code, run `graphify update .` to keep the graph current (AST-only, no API cost).
308+
AGENTS_GRAPHIFY
309+
270310
###
271311
# cleanup
272312
rm -rf /root/.bun
@@ -293,7 +333,8 @@ cat >"${OPENCODE_CONFIG_DIR}/opencode.json" <<-'EOF'
293333
"autoupdate": false,
294334
"plugin": [
295335
"file:///usr/local/bun/install/global/node_modules/opencode-gemini-auth",
296-
"file:///etc/opencode/plugins/caveman"
336+
"file:///etc/opencode/plugins/caveman",
337+
"file:///etc/opencode/plugins/graphify.js"
297338
],
298339
"mcp": {
299340
"engram": {
@@ -303,7 +344,7 @@ cat >"${OPENCODE_CONFIG_DIR}/opencode.json" <<-'EOF'
303344
"mcp",
304345
"--tools=agent"
305346
],
306-
"enabled": true
347+
"enabled": false
307348
},
308349
"sequential-thinking": {
309350
"type": "local",

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ build:
1717
--build-arg AZURE_FOUNDRY_PROVIDER_REF=$(AZURE_FOUNDRY_PROVIDER_REF) \
1818
$(CONTEXT)
1919

20+
run:
21+
@- docker run \
22+
--rm \
23+
-ti \
24+
--entrypoint bash \
25+
$(IMAGE_REF)
26+
2027
clean:
2128
@echo "Removing image $(IMAGE_REF) if it exists..."
2229
- docker image inspect $(IMAGE_REF) >/dev/null 2>&1 && docker rmi $(IMAGE_REF) || true

README.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -333,21 +333,22 @@ opencodec
333333

334334
The build bundles these tools and skills:
335335

336-
- `opencode-ai`
337-
- `mise`
336+
- [`opencode-ai`](https://opencode.ai/)
337+
- [`mise`](https://mise.jdx.dev/)
338338
- shell bootstrap for interactive and non-interactive command execution
339339
- default OpenCode configuration under `/etc/opencode`
340-
- `engram` for persisted memory-oriented workflows
341-
- `aleph` tooling for large-context local analysis workflows
340+
- [`engram`](https://github.com/Gentleman-Programming/engram) persisted memory-oriented workflows
341+
- [`aleph`](https://github.com/Hmbown/aleph) large-context local analysis workflows
342342
- local MCP-backed integrations available by default
343-
- `python`
344-
- `go`
345-
- `ripgrep`
346-
- `uv`
347-
- `git`
343+
- [`python`](https://python.org)
344+
- [`go`](https://go.dev)
345+
- [`ripgrep`](https://github.com/BurntSushi/ripgrep)
346+
- [`uv`](https://docs.astral.sh/uv/)
347+
- [`git`](https://git-scm.com)
348+
- [`graphify`](https://github.com/Graphify-Labs/graphify) — knowledge graph for codebase architecture
348349
- `sudo`, `curl`, `gpg`, `make`
349-
- Azure Foundry provider build output
350-
- OpenCode skills for `stop-slop`, `aleph`, and changelog automation
350+
- [Azure Foundry provider](https://github.com/ophiosdev/azure-foundry-provider) build output
351+
- OpenCode skills for [`stop-slop`](https://github.com/hardikpandya/stop-slop), `aleph`, `graphify`, and changelog automation
351352

352353
The repository also includes `git-export.ts`, a Bun helper script that exports a single directory from
353354
a GitHub repository using a treeless, sparse clone workflow.
@@ -362,7 +363,7 @@ This repo publishes container images to GitHub Container Registry from version t
362363

363364
## Repository Structure
364365

365-
- `Dockerfile`: Builds the OpenCode container image and installs providers, tools, and skills
366+
- `Dockerfile`: Builds the OpenCode container image, generates default `opencode.json` config and AGENTS.md, and installs providers, tools, and skills
366367
- `entrypoint.sh`: Loads shell environment and starts `opencode`
367368
- `git-export.ts`: Sparse GitHub directory export helper
368369
- `Makefile`: Convenience targets for local image build and cleanup
@@ -402,6 +403,6 @@ test when `Dockerfile` changes.
402403

403404
### Build and Runtime Issues
404405

405-
- Build failures fetching dependencies: verify network access to npm, GitHub, and other upstream sources used in the Docker build
406+
- Build failures fetching dependencies: verify network access to `npm`, GitHub, and other upstream sources used in the Docker build
406407
- Provider or skill changes upstream: rebuild the image to refresh fetched components
407408
- Command invocation errors: place OpenCode arguments after the image name and use `--help` to confirm supported flags

0 commit comments

Comments
 (0)