shared

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2026 License: MIT Imports: 3 Imported by: 0

README

shared/ — Cross-stack data artifact

Versioned data consumed by both the Python ogham-mcp server and the Go ogham-cli client. Edit here. Do not edit consumer-side copies.

Files

File Purpose
schema.yaml Schema version + dialect lock for regex patterns.
hooks_config.yaml Signal/noise filtering rules + secret-masking regex patterns.
CHANGELOG.md Per-version change history for the shared-data tag stream.

Consumption contract

  • Python (ogham-mcp) loads via importlib.resources from the in-tree copy. The dev repo's Makefile sync target rsyncs shared/ to the public repo; the public repo's pyproject.toml packages shared/ into the wheel.
  • Go (ogham-cli) vendors a copy at internal/native/shared/ using git subtree pull --prefix=internal/native/shared <public-url> shared-data-vX.Y.Z --squash. The files are read at build time via //go:embed shared/*.

Drift prevention

Both consumers run a CI gate that computes a SHA-256 manifest of the embedded copy and compares it against the manifest pinned in the shared-data-vX.Y.Z tag the consumer last vendored from. Any mismatch fails CI with a remediation hint.

Regex dialect

All regex patterns in this directory must compile in RE2 (Go's default regex engine; Python's re accepts the same subset). RE2 forbids backreferences and variable-length lookarounds. The shared/schema.yaml regex_dialect: re2 field is the contract; both consumers' parity tests parse every pattern: value with RE2 and fail on any incompatible expression.

Cutting a new shared-data version

The shared-data version stream is independent of the Python package version (ogham-mcp 0.X.Y) and the Go CLI version (ogham-cli vX.Y.Z). It ships via its own Makefile targets:

# In the dev repo, edit shared/* and bump shared/schema.yaml + CHANGELOG.md
make sync-shared                     # mirror dev/shared/ → public/shared/
cd $(PUB_REPO) && git diff shared/   # review
cd $(PUB_REPO) && git add shared/ && git commit -m "shared-data v0.1.0"
make shared-tag VERSION=0.1.0        # tags public as shared-data-v0.1.0
cd $(PUB_REPO) && git push origin main && git push origin shared-data-v0.1.0

Consumers then bump:

# Go (ogham-cli)
git subtree pull --prefix=internal/native/shared $(PUB_REPO) shared-data-v0.1.0 --squash

# Python (ogham-mcp) — picks up shared/ in the next make sync TAG=vX.Y.Z

Why this exists

Prior to v0.9 the same patterns lived in src/ogham/hooks_config.yaml in the Python repo, with a header comment instructing maintainers to keep parallel copies in sync by hand. That convention had already failed empirically for languages/*.yaml (the two repos drifted to ~100-line differences on en.yaml alone before the v0.9 council caught it). Promoting hooks_config.yaml to a versioned artifact with a CI parity gate prevents the same failure mode for security-critical secret-detection patterns, where a missed regex on one side leaks credentials into memory.

Language YAMLs (languages/) will follow this same mechanism in a follow-up; they need a separate decision on union-vs-namespace because both consumers have legitimately divergent keys (Python's wiki_compile strings, Go's recurrence_patterns etc.).

Documentation

Overview

Package shared vendors the cross-stack data artifact that ogham-mcp publishes under the shared-data-vX.Y.Z tag stream. The YAML files in this directory are mirrored byte-for-byte from public ogham-mcp's shared/ tree via git subtree (see ../../../README.md for the subtree-pull command), and the schema lock + RE2 dialect promise is documented in shared/README.md upstream.

Do NOT edit hooks_config.yaml, schema.yaml, README.md, or CHANGELOG.md by hand: bump the upstream artifact, retag, and run git subtree pull. The CI parity gate (see TestParity in shared_test.go) will reject any local-only divergence.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RawHooksConfig

func RawHooksConfig() []byte

RawHooksConfig returns the embedded hooks_config.yaml bytes unmodified. Used by the parity hash gate.

func RawSchema

func RawSchema() []byte

RawSchema returns the embedded schema.yaml bytes unmodified. Used by the parity hash gate.

Types

type BareToken

type BareToken struct {
	Name    string `yaml:"name"`
	Pattern string `yaml:"pattern"`
}

BareToken pairs a human-readable name with a RE2-compatible regex pattern for secret detection.

type HooksConfig

type HooksConfig struct {
	Signals struct {
		Errors       []string `yaml:"errors"`
		Decisions    []string `yaml:"decisions"`
		Architecture []string `yaml:"architecture"`
		Annotations  []string `yaml:"annotations"`
	} `yaml:"signals"`
	NoiseCommands      []string `yaml:"noise_commands"`
	AlwaysSkipTools    []string `yaml:"always_skip_tools"`
	ResponseGatedTools []string `yaml:"response_gated_tools"`
	RoutineTools       []string `yaml:"routine_tools"`
	GitSignal          []string `yaml:"git_signal"`
	GitNoise           []string `yaml:"git_noise"`
	Secrets            struct {
		BareTokens []BareToken `yaml:"bare_tokens"`
		EnvKeys    []string    `yaml:"env_keys"`
	} `yaml:"secrets"`
}

HooksConfig mirrors the top-level keys of shared/hooks_config.yaml. Only the surface needed by ogham-cli's native filtering engine is modelled here; unknown YAML keys are accepted silently for forward compatibility with upstream additions.

func LoadHooksConfig

func LoadHooksConfig() (*HooksConfig, error)

LoadHooksConfig parses the embedded hooks_config.yaml.

type Schema

type Schema struct {
	Version      string `yaml:"version"`
	RegexDialect string `yaml:"regex_dialect"`
}

Schema mirrors shared/schema.yaml's version + regex_dialect fields.

func LoadSchema

func LoadSchema() (*Schema, error)

LoadSchema parses the embedded schema.yaml.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL