Files
seal-use/AGENTS.md
T
2026-08-25 16:06:09 +08:00

4.1 KiB

Repository Guidelines

Project Structure & Module Organization

This is a Bun + TypeScript toolkit for the seal-home CLI and optional MCP server. Entry points are src/cli.ts, src/server.ts, and src/probe.ts. Shared config, auth, token, and HTTP code is under src/core/. Seal-specific API and tool logic is under src/domains/seal/.

The repository doubles as a ZCode plugin: .zcode-plugin/plugin.json declares the plugin manifest, .mcp.json declares the optional MCP server (disabled by default), and the agent skill lives under skills/seal-home/. .agents/skills/seal-home is a symlink to skills/seal-home so workspace and Codex skill loading keep working.

Tests are colocated as *.test.ts files in src/. OpenAPI source YAML lives in openapi/; bundled output is dist/openapi.json. Example enterprise configs are in enterprises/example.*.json; real configs must stay untracked.

Build, Test, and Development Commands

  • bun install: install dependencies.
  • bun run dev: run src/server.ts with watch mode.
  • bun run start: run the MCP server once.
  • bun run cli -- <args>: execute CLI commands, such as bun run cli version.
  • bun run probe -- <corpId>: run the local connectivity/config probe.
  • bun run check: type-check with tsc --noEmit.
  • bun test: run all colocated Bun tests.
  • bun run bump <version | patch | minor>: bump version across all manifest/skill/openapi files and bundle.
  • bun run openapi:bundle: rebuild dist/openapi.json.
  • bun run build:binary: compile the standalone seal-home binary to dist/bin/seal-home (gitignored).
  • bun run build:plugin: bundle the MCP server to dist/mcp/server.js (tracked, used by .mcp.json).

Coding Style & Naming Conventions

Use TypeScript ES modules with explicit .js import extensions for local files. Validate external data with Zod or narrow types before use. Follow existing style: two-space indentation, double quotes, omitted trailing semicolons, camelCase variables/functions, PascalCase classes/types, and lowercase hyphenated filenames such as token-store.ts.

Prefer small domain functions over broad utility modules. Keep CLI output JSON on stdout and diagnostics/errors on stderr.

Testing Guidelines

Use bun:test with describe, test, and expect. Place tests next to covered code using name.test.ts, for example src/core/config/loader.test.ts. Tests that change environment variables or working directories must restore them in afterEach.

Commit & Pull Request Guidelines

Recent commits use concise imperative subjects, often Add ... or Refine ..., such as Add compact approval rule listing. Keep subjects under roughly 72 characters.

Release & Publishing Guidelines

  1. Version Bump Checklist:
    • Run bun run bump <new-version | patch | minor> (automatically updates package.json, .zcode-plugin/plugin.json, skills/seal-home/SKILL.md, openapi/openapi.yaml, and bundles dist/).
    • Update CHANGELOG.md with new features and fixes.
    • Run bun test && bun run check.
  2. Tag & Release:
    • Create an annotated Git tag with a descriptive release summary:
      git commit -am "Release vX.Y.Z: ..."
      git tag -a vX.Y.Z -m "🚀 Release summary text describing key changes"
      git push origin master --tags && git push home master --tags
      
    • GitHub Actions will automatically extract the tag message, append commit notes via --generate-notes, cross-compile all 5 target binaries in ~50s, and publish the GitHub Release.

Security & Configuration Tips

Never commit real enterprise credentials, Seal tokens, service logs, or local generated state. Use enterprises/example.hose.json or enterprises/example.direct.json as templates, then place real configs in enterprises/local.json or ~/.config/seal-home/enterprises. For auth or tenant changes, verify with bun run probe or seal-home auth diagnose.

Agent-Specific Instructions

Do not create .codex/skills; Codex is compatible with .agents/skills, and this project treats .agents/ as authoritative. At project scope, prefer AGENT.md instructions when present.