Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/actionlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# actionlint #648: built-in metadata for create-github-app-token@v3 is stale
# (app-id required, client-id missing). Upstream uses client-id.
paths:
.github/workflows/**/*.{yaml,yml}:
ignore:
- 'missing input "app-id" which is required by action "actions/create-github-app-token@v3"'
- 'input "client-id" is not defined in action "actions/create-github-app-token@v3"'
11 changes: 6 additions & 5 deletions .mise.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[tools]
hadolint = "latest"
prek = "latest"
actionlint = "latest"
typos = "latest"
shellcheck = "latest"
bun = { version = "latest", lazy = true }
hadolint = { version = "latest", lazy = true }
prek = { version = "latest", lazy = true }
actionlint = { version = "latest", lazy = true }
typos = { version = "latest", lazy = true }
shellcheck = { version = "latest", lazy = true }
19 changes: 15 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,38 @@ repos:
- id: mixed-line-ending
- id: check-merge-conflict

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.39.0
hooks:
- id: check-jsonschema
name: validate skills.yaml against schema
files: ^skills\.yaml$
args: [--schemafile, skills.schema.json]
- id: check-metaschema
name: validate skills schema
files: ^skills\.schema\.json$

- repo: https://github.com/adrienverge/yamllint
rev: v1.38.0
hooks:
- id: yamllint

- repo: https://github.com/hadolint/hadolint
rev: v2.14.0
rev: v2.15.1
hooks:
- id: hadolint

- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.21.0
rev: v0.24.2
hooks:
- id: markdownlint-cli2

- repo: https://github.com/rhysd/actionlint
rev: v1.7.11
rev: v1.7.12
hooks:
- id: actionlint

- repo: https://github.com/crate-ci/typos
rev: v1.44.0
rev: v1.52.2
hooks:
- id: typos
66 changes: 12 additions & 54 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ ARG MOLI_VERSION=latest
ARG ANYDOC_VERSION=latest
ARG OPENCODE_VERSION=latest
ARG CAVEMAN_VERSION=latest
ARG AZURE_FOUNDRY_PROVIDER_REF=latest
ARG AZURE_FOUNDRY_PROVIDER_VERSION=latest
ARG PONYTAIL_VERSION=latest
ARG ENGRAM_VERSION=latest
ARG GRAPHIFY_VERSION=latest
Expand Down Expand Up @@ -151,11 +151,11 @@ bun install -g --trust "@opencode/cli@${OPENCODE_VERSION}" || exit 1
###
# providers
#
# AZURE_FOUNDRY_PROVIDER_REF: if starts with 'v' → version tag, else → branch name
# AZURE_FOUNDRY_PROVIDER_VERSION: if starts with 'v' → version tag, else → branch name
#
(
azure_foundry_provider_resolved_version=$(resolve_github_latest_version "ophiosdev/azure-foundry-provider" "${AZURE_FOUNDRY_PROVIDER_REF}") || exit 1
echo "AZURE_FOUNDRY_PROVIDER_REF=${azure_foundry_provider_resolved_version}"
azure_foundry_provider_resolved_version=$(resolve_github_latest_version "ophiosdev/azure-foundry-provider" "${AZURE_FOUNDRY_PROVIDER_VERSION}") || exit 1
echo "AZURE_FOUNDRY_PROVIDER_VERSION=${azure_foundry_provider_resolved_version}"
pushd /tmp \
&& bun install "github:ophiosdev/azure-foundry-provider#${azure_foundry_provider_resolved_version}" \
&& cd node_modules/azure-foundry-provider \
Expand Down Expand Up @@ -213,24 +213,27 @@ bun install -g --trust skills@latest
#
caveman_resolved_version=$(resolve_github_latest_version "JuliusBrussee/caveman" "${CAVEMAN_VERSION}") || exit 1
echo "CAVEMAN_RESOLVED_REF=${caveman_resolved_version}"
echo "${caveman_resolved_version}" > /tmp/caveman_version

mkdir -p "${OPENCODE_CONFIG_DIR}/plugins/caveman" "${OPENCODE_CONFIG_DIR}/commands" "${OPENCODE_CONFIG_DIR}/agents"

CAVEMAN_RAW_BASE="https://raw.githubusercontent.com/JuliusBrussee/caveman/refs/tags/${caveman_resolved_version}"

# AGENTS.md — always-on caveman ruleset (auto-discovered by opencode)
curl -fsSL "${CAVEMAN_RAW_BASE}/src/rules/caveman-activate.md" -o "${OPENCODE_CONFIG_DIR}/AGENTS.md" || exit 1
curl -fsSL "${CAVEMAN_RAW_BASE}/src/rules/caveman-activate.md" >> "${OPENCODE_CONFIG_DIR}/AGENTS.md" || exit 1

{
curl -fsSL "${CAVEMAN_RAW_BASE}/src/plugins/opencode/package.json" -o "${OPENCODE_CONFIG_DIR}/plugins/caveman/package.json"
curl -fsSL "${CAVEMAN_RAW_BASE}/src/plugins/opencode/plugin.js" -o "${OPENCODE_CONFIG_DIR}/plugins/caveman/plugin.js"
curl -fsSL "${CAVEMAN_RAW_BASE}/src/plugins/opencode/server.js" -o "${OPENCODE_CONFIG_DIR}/plugins/caveman/server.js"
curl -fsSL "${CAVEMAN_RAW_BASE}/src/hooks/caveman-config.js" -o "${OPENCODE_CONFIG_DIR}/plugins/caveman/caveman-config.cjs"
curl -fsSL "${CAVEMAN_RAW_BASE}/src/hooks/caveman-parse.js" -o "${OPENCODE_CONFIG_DIR}/plugins/caveman/caveman-parse.cjs"
curl -fsSL "${CAVEMAN_RAW_BASE}/src/plugins/opencode/commands/caveman.md" -o "${OPENCODE_CONFIG_DIR}/commands/caveman.md"
curl -fsSL "${CAVEMAN_RAW_BASE}/src/plugins/opencode/commands/caveman-commit.md" -o "${OPENCODE_CONFIG_DIR}/commands/caveman-commit.md"
curl -fsSL "${CAVEMAN_RAW_BASE}/src/plugins/opencode/commands/caveman-review.md" -o "${OPENCODE_CONFIG_DIR}/commands/caveman-review.md"
curl -fsSL "${CAVEMAN_RAW_BASE}/src/plugins/opencode/commands/caveman-stats.md" -o "${OPENCODE_CONFIG_DIR}/commands/caveman-stats.md"
curl -fsSL "${CAVEMAN_RAW_BASE}/src/plugins/opencode/commands/caveman-help.md" -o "${OPENCODE_CONFIG_DIR}/commands/caveman-help.md"
curl -fsSL "${CAVEMAN_RAW_BASE}/src/plugins/opencode/commands/ultracave.md" -o "${OPENCODE_CONFIG_DIR}/commands/ultracave.md"
curl -fsSL "${CAVEMAN_RAW_BASE}/src/plugins/opencode/commands/megacave.md" -o "${OPENCODE_CONFIG_DIR}/commands/megacave.md"
# cavecrew subagents — strip `tools:` frontmatter (opencode rejects YAML array form)
curl -fsSL "${CAVEMAN_RAW_BASE}/agents/cavecrew-investigator.md" | sed '/^tools:/,/^[^ ]/ { /^tools:/d; /^ /d; }' > "${OPENCODE_CONFIG_DIR}/agents/cavecrew-investigator.md"
curl -fsSL "${CAVEMAN_RAW_BASE}/agents/cavecrew-builder.md" | sed '/^tools:/,/^[^ ]/ { /^tools:/d; /^ /d; }' > "${OPENCODE_CONFIG_DIR}/agents/cavecrew-builder.md"
Expand Down Expand Up @@ -312,14 +315,6 @@ curl -fsSL "${moli_url}" | tar -xz -C /usr/local/bin --strip-components=1 --wild
chmod +x /usr/local/bin/moli || exit 1
moli --version || exit 1

# Append moli always-on section to AGENTS.md
cat >> "${OPENCODE_CONFIG_DIR}/AGENTS.md" <<-'AGENTS_MOLI'

## moli

For live websites or web research, use the installed moli skills: `moli-webfetch` for fetching/capturing JS-rendered pages, `moli-websearch` for keyword/image search. Prefer `moli fetch` over raw curl for JS-rendered content.
AGENTS_MOLI

###
# anydoc
#
Expand All @@ -328,14 +323,6 @@ anydoc_version="${anydoc_resolved_version#v}"
bun install -g --trust "@firecrawl/anydoc@${anydoc_version}" || exit 1
anydoc --help > /dev/null || exit 1

# Append anydoc always-on section to AGENTS.md
cat >> "${OPENCODE_CONFIG_DIR}/AGENTS.md" <<-'AGENTS_ANYDOC'

## anydoc

For office documents, spreadsheets, presentations, ebooks, or PDFs you cannot read directly, use the installed `convert-documents-to-markdown` skill and the `anydoc` CLI to convert to Markdown. For large documents write to a file with `-o` and read the parts you need.
AGENTS_ANYDOC

###
# graphify
#
Expand All @@ -344,36 +331,6 @@ echo "GRAPHIFY_RESOLVED_REF=${graphify_resolved_version}"

uv pip install --system graphifyy[pdf,office,svg,openai,azure,sql,postgres,terraform] || exit 1

# Install graphify for opencode into a temp project dir — uses install.py's
# own _copy_skill_file + _install_opencode_plugin logic so the SKILL.md,
# references/ sidecar, .graphify_version stamp, and graphify.js plugin are
# all laid down correctly by graphify itself, not reconstructed here.
TMP_GRAPHIFY=/tmp/graphify-install
mkdir -p "$TMP_GRAPHIFY"
( cd "$TMP_GRAPHIFY" && graphify install --project --platform opencode ) || exit 1

# Move installed artifacts to system opencode dir
cp -r "$TMP_GRAPHIFY/.opencode/skills/graphify" "${OPENCODE_CONFIG_DIR}/skills/graphify"
cp "$TMP_GRAPHIFY/.opencode/plugins/graphify.js" "${OPENCODE_CONFIG_DIR}/plugins/graphify.js"

rm -rf "$TMP_GRAPHIFY"

# Append graphify always-on section to AGENTS.md
cat >> "${OPENCODE_CONFIG_DIR}/AGENTS.md" <<-'AGENTS_GRAPHIFY'

## graphify

This project has a knowledge graph at graphify-out/ with god nodes, community structure, and cross-file relationships.

When the user types `/graphify`, use the installed graphify skill or instructions before doing anything else.

Rules:
- 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.
- 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.
- If graphify-out/wiki/index.md exists, use it for broad navigation instead of raw source browsing.
- Read graphify-out/GRAPH_REPORT.md only for broad architecture review or when query/path/explain do not surface enough context.
- After modifying code, run `graphify update .` to keep the graph current (AST-only, no API cost).
AGENTS_GRAPHIFY

###
# cleanup
Expand All @@ -396,14 +353,15 @@ bun "${OPENCODE_BUILD_DIR}/scripts/install-skills.ts" || exit 1

rm -rf "${OPENCODE_BUILD_DIR}"


cat >"${OPENCODE_CONFIG_DIR}/opencode.json" <<-EOF
{
"\$schema": "https://opencode.ai/config.json",
"update": "disable",
"instructions": [
"/etc/opencode/AGENTS.md"
],
"plugins": [
"file:///usr/local/bun/install/global/node_modules/opencode-gemini-auth",
"file:///etc/opencode/plugins/caveman",
"-opencode.plan"
],
"mcp": {
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DOCKERFILE ?= Dockerfile
CONTEXT ?= .
DOCKER_BUILD_ARGS ?=
OPENCODE_VERSION ?= latest
AZURE_FOUNDRY_PROVIDER_REF ?= latest
AZURE_FOUNDRY_PROVIDER_VERSION ?= latest

.PHONY: build clean

Expand All @@ -15,7 +15,7 @@ build:
-t $(IMAGE_REF) \
-f $(DOCKERFILE) \
--build-arg OPENCODE_VERSION=$(OPENCODE_VERSION) \
--build-arg AZURE_FOUNDRY_PROVIDER_REF=$(AZURE_FOUNDRY_PROVIDER_REF) \
--build-arg AZURE_FOUNDRY_PROVIDER_VERSION=$(AZURE_FOUNDRY_PROVIDER_VERSION) \
$(DOCKER_BUILD_ARGS) \
$(CONTEXT)

Expand Down
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,45 @@ The build bundles these tools and skills:
The repository also includes `git-export.ts`, a Bun helper script that exports a single directory from
a GitHub repository using a treeless, sparse clone workflow.

### Skills manifest (`skills.yaml`)

Skills are installed by `scripts/install-skills.ts` from the `skills.yaml` manifest. Beyond
`download`, `git-export`, and `uv-pip` steps, a skill may declare ordered file-edit steps that run
against its staged files before publishing:

- `replace`: literal (non-regex) replacement of `from` with `to` in `file`, applied to every
non-overlapping occurrence. `expected` is optional: when present it requires exactly that many
occurrences, otherwise at least one is required. Counts fail loudly instead of shipping a
half-patched skill.
- `assert-absent`: fails the install when the JavaScript regular expression `pattern` matches `file`.
- `shell`: runs `commands` with `bash -c` (staging dir as cwd). Exposes `OPENCODE_CONFIG_DIR`,
`SKILL_NAME`, and `SKILL_STAGING_DIR`. Use only when the tool must install itself (graphify);
prefer declarative steps otherwise. A skill with a shell step merges staged files over the
skill dir instead of replacing it, so direct installs survive. Non-zero exit fails the build.

Match counts are exact on purpose: if upstream skill text changes, the install fails instead of
silently shipping a half-patched skill. Update the manifest after inspecting the upstream change.

Each skill carries its own guidance: a skill may declare `agents_md` for the tool it installs
(`moli-webfetch`, `convert-documents-to-markdown`, and `graphify` do). Skills may be grouped with
`- group: <name>` holding `skills: [...]` plus one shared `agents_md` for the group; install order
and guidance order follow manifest order, with a group's `agents_md` landing where the group sits
(before its skills' own `agents_md`). After all skills install,
the per-skill additions are concatenated in manifest skill order and written once to
`${OPENCODE_CONFIG_DIR}/AGENTS.md`. A top-level `agents_md` remains available for genuinely shared
guidance and, when present, comes first. The managed
content lives in one block between `<!-- install-skills:agents-md:start -->` and
`<!-- install-skills:agents-md:end -->`; base Caveman rules and anything outside the block are
preserved byte-for-byte, and reruns are idempotent. Omitting both forms leaves `AGENTS.md` untouched.

The `graphify` skill self-installs via `graphify install --project --platform opencode` in a
temp dir (upstream's layout isn't a plain exportable skill tree), then moves its skill dir and
opencode plugin into place — including the `.graphify_version` stamp. The Dockerfile installs
only the graphify binary; the skill directory itself is manifest-owned.

During image builds, `scripts/install-skills.test.ts` runs before installation, so a broken patch or
manifest fails the build.

## Release Model

This repo publishes container images to GitHub Container Registry from version tags.
Expand All @@ -378,6 +417,8 @@ Configured checks include:

- General file hygiene checks from `pre-commit-hooks`
- YAML linting with `yamllint`
- `skills.yaml` schema validation with `check-jsonschema`
- TypeScript linting of `scripts/` with `eslint` (`bun run lint` needs `bun install --cwd scripts` once)
- Dockerfile linting with `hadolint`
- Markdown linting with `markdownlint-cli2`
- GitHub Actions validation with `actionlint`
Expand Down
6 changes: 6 additions & 0 deletions plugins/project-plan/bunfig.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
telemetry = false

[test]
coverage = true
coverageThreshold = { lines = 0.9, functions = 0.9 }
coverageSkipTestFiles = true
Loading