Skip to content

Latest commit

 

History

History
154 lines (111 loc) · 6.07 KB

CONTRIBUTING.md

File metadata and controls

154 lines (111 loc) · 6.07 KB

Contributing

Thanks for contributing to generic-agentic-workflows.

Development workflow

  1. Create a branch from the current default branch.

  2. Keep changes focused; do not mix workflow, agent, and dependency changes unless they are required together.

  3. Install UV and sync the development environment:

    uv sync --extra dev
    
  4. Run the linter and the relevant tests before opening a pull request:

    uv run ruff check scripts tests
    

uv run python -m unittest discover -s tests -v


Do not pass a shell glob such as `tests/*` to `unittest`. Python creates
`tests/__pycache__/` during test runs, and shell expansion can pass that
directory to `unittest` as though it were a test module. Use discovery so
test selection is independent of generated bytecode directories.

5. Run `git diff --check` to catch whitespace errors.
6. Describe the behavior change, the configuration bundles affected, and validation performed in the pull request.

## Editing OpenCode configuration bundles

Reusable profiles live under `.opencode/configuration/<profile>/`. A bundle normally contains:

- `bundle.json` — declares the workflow, agent, skills, prompt, and model profile.
- `agent.md` and optional additional agent files — OpenCode agent front matter and instructions.
- `skills/` and `prompts/` — the bundle's verified guidance.
- `hashes.json` — optional SHA-256 integrity hashes for every declared content
file in caller-local bundles; required for remotely resolved bundles.

When present, the resolver rejects a bundle when a declared file does not
exactly match its entry in `hashes.json`. Therefore, **every content edit must
update the corresponding hash** for hash-locked local bundles and all remotely
resolved bundles. This includes agent instructions and front matter such as
`model:`, prompt templates, skills, and additional agents.

The organization-controlled model profile mapping is in `scripts/agentic_policy.py`. When changing the model for a bundle, update both:

1. The bundle agent's `model:` front-matter value.
2. The corresponding `provider_model` in `MODEL_PROFILES`.

Do not introduce credentials, endpoints, headers, or caller-controlled model identifiers in bundle files or policies.

## Updating `hashes.json`

Remote bundles must include `hashes.json`. It is optional for caller-local
bundles; use it when an explicit integrity lock is desired. Every content edit
to a bundle with `hashes.json` must update the corresponding SHA-256 hash. Use
the bundled helper script to recompute hashes automatically for one or more
bundles:

```text
uv run scripts/update_hashes.py

Update a single profile:

uv run scripts/update_hashes.py --profile documentation-review

Preview the changes without writing (--dry-run):

uv run scripts/update_hashes.py --dry-run

The script reuses the resolver's own hashing and path-normalization helpers, so the digests it writes are byte-for-byte identical to what scripts/agentic_configuration.py validates at runtime. It only hashes files declared in bundle.json (agent_file, skill_files, additional_agent_files, and prompt_template); it never hashes bundle.json itself.

To compute a digest manually (for example, when verifying a single file), run:

sha256sum .opencode/configuration/<profile>/agent.md
sha256sum .opencode/configuration/<profile>/prompts/<prompt>.md
sha256sum .opencode/configuration/<profile>/skills/<skill>/SKILL.md

Copy each resulting 64-character digest into the matching key in that profile's hashes.json. Preserve the path spelling exactly; paths are relative to the bundle directory.

For example, after editing documentation-review/agent.md, update:

{
  "agent.md": "<sha256 of agent.md>"
}

Do not hash bundle.json into hashes.json unless the resolver is explicitly changed to require it. Do not alter an unrelated bundle's hashes merely to make a test pass—investigate the mismatch and update only when the checked-in content intentionally changed.

Validate bundle changes

Resolve each changed bundle directly before opening a pull request:

uv run python scripts/agentic_configuration.py \
  --workflow pr-documentation-review \
  --bundle-root .opencode/configuration \
  --configuration-profile documentation-review \
  --result /tmp/documentation-review.json

uv run python scripts/agentic_configuration.py \
  --workflow issue-feedback \
  --bundle-root .opencode/configuration \
  --configuration-profile issue-feedback \
  --result /tmp/issue-feedback.json

Use the appropriate workflow and profile for other bundles, such as issue-feedback and release-project-review. Then run the focused configuration and policy tests:

uv run ruff check scripts tests
uv run python -m unittest -q \
  tests.test_agentic_policy \
  tests.test_agentic_configuration \
  tests.test_revision2

Finally, confirm that obsolete model identifiers are absent from active configuration and policy files, and run:

git diff --check

Documentation accessibility checks

Review representative pages in the built preview at docs/_build or on the published site. Check that:

  • each page has one top-level heading and does not skip heading levels;
  • theme-provided banner, navigation, and main-content landmarks are present and navigable;
  • the sidebar, search, and disclosure controls work with keyboard input alone;
  • tables have header rows and a simple structure; and
  • each code block identifies its language and is introduced by surrounding text.

Automated checks of the rendered output may be evaluated later; do not migrate accessibility frameworks as part of this manual review.

Security requirements

  • Treat issue text, pull-request text, diffs, and external configuration as untrusted data.
  • Preserve the read-only boundaries of feedback agents and the policy restrictions on implementation agents.
  • Do not add secrets to tracked files, logs, prompts, or test fixtures.
  • Do not weaken pinned references, integrity validation, workflow permissions, or policy ceilings without an approved security review.