opencode-plugin-team-agreements 0.1.4 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.1](https://github.com/jwilger/opencode-plugin-team-agreements/compare/opencode-plugin-team-agreements-v0.2.0...opencode-plugin-team-agreements-v0.2.1) (2026-01-23)
4
+
5
+
6
+ ### Features
7
+
8
+ * Add comprehensive team agreements with project analysis and split document approach ([#16](https://github.com/jwilger/opencode-plugin-team-agreements/issues/16)) ([084edaa](https://github.com/jwilger/opencode-plugin-team-agreements/commit/084edaad210c23d6f25eaa64b09e730ba474d970))
9
+
10
+ ## [0.2.0](https://github.com/jwilger/opencode-plugin-team-agreements/compare/opencode-plugin-team-agreements-v0.1.4...opencode-plugin-team-agreements-v0.2.0) (2026-01-23)
11
+
12
+
13
+ ### ⚠ BREAKING CHANGES
14
+
15
+ * Team agreements are now stored in AGENTS.md (or CLAUDE.md as fallback) in the project root instead of docs/TEAM_AGREEMENTS.md
16
+
17
+ ### Features
18
+
19
+ * Use AGENTS.md for team agreements instead of docs/TEAM_AGREEMENTS.md ([#15](https://github.com/jwilger/opencode-plugin-team-agreements/issues/15)) ([00365ab](https://github.com/jwilger/opencode-plugin-team-agreements/commit/00365ab4d17f0cd4e22c2731f12fd6875d5b01e1))
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * Only export plugin function to prevent OpenCode crash ([#13](https://github.com/jwilger/opencode-plugin-team-agreements/issues/13)) ([d4f5930](https://github.com/jwilger/opencode-plugin-team-agreements/commit/d4f5930e0620d490b3fae635275130309f1fcfc0))
25
+
3
26
  ## [0.1.4](https://github.com/jwilger/opencode-plugin-team-agreements/compare/opencode-plugin-team-agreements-v0.1.3...opencode-plugin-team-agreements-v0.1.4) (2026-01-23)
4
27
 
5
28
 
package/README.md CHANGED
@@ -4,18 +4,57 @@ An [OpenCode](https://opencode.ai) plugin that helps teams of humans and LLM age
4
4
 
5
5
  ## Features
6
6
 
7
- - **Interactive facilitation** - Guides teams through establishing agreements one topic at a time
8
- - **Core topics covered**:
9
- - Storage location for agreements
10
- - Programming languages and their purposes
11
- - Code quality standards
12
- - Commit message conventions
13
- - Integration workflow (branching, PRs, CI)
14
- - Testing requirements
15
- - Amendment process for updating agreements
16
- - **Extensible** - Add custom topics beyond the core set
17
- - **Context injection** - Automatically injects agreements into LLM context at session start and after compaction
18
- - **Topic suggestions** - Users can suggest new standard topics via GitHub issues (using `gh` CLI)
7
+ - **Comprehensive interview** - Covers 7 categories with ~22 topics for thorough team alignment
8
+ - **Smart project analysis** - Detects languages, frameworks, CI, testing, AI tools to tailor questions
9
+ - **Split document approach**:
10
+ - `docs/TEAM_AGREEMENTS.md` - Full reference documentation for humans
11
+ - `AGENTS.md` - Concise rules that LLMs need in context constantly
12
+ - **Interactive facilitation** - Guides teams through one question at a time, allowing skips and pauses
13
+ - **Enforcement setup** - Detects existing tooling and offers to set up automatic enforcement
14
+ - **Context injection** - Automatically injects LLM-relevant rules after compaction
15
+ - **Topic suggestions** - Suggest new standard topics via GitHub issues
16
+
17
+ ## Topics Covered
18
+
19
+ ### 1. Code & Quality
20
+ - Programming Languages & Tech Stack
21
+ - Code Quality Standards
22
+ - Code Review Process
23
+ - Testing Requirements
24
+
25
+ ### 2. Integration & Delivery
26
+ - Version Control & Branching
27
+ - Continuous Integration
28
+ - Deployment & Release
29
+ - Database & Schema Changes
30
+
31
+ ### 3. Operations & QA
32
+ - Security Practices
33
+ - Monitoring & Observability
34
+ - Performance Standards
35
+ - Accessibility & Internationalization
36
+
37
+ ### 4. Documentation & Knowledge
38
+ - Documentation Standards
39
+ - Architecture Decision Records (ADRs)
40
+ - Dependency Management
41
+
42
+ ### 5. AI/LLM Collaboration
43
+ - AI Tools & Policies
44
+ - Autonomy Boundaries
45
+ - AI Code Generation Standards
46
+ - Context & Session Management
47
+ - Human Oversight & Escalation
48
+ - Learning & Improvement
49
+
50
+ ### 6. Team Process
51
+ - Development Methodology
52
+ - Planning & Work Breakdown
53
+ - Communication & Collaboration
54
+
55
+ ### 7. Governance
56
+ - Amendment Process
57
+ - Open-Ended Topics
19
58
 
20
59
  ## Installation
21
60
 
@@ -36,26 +75,56 @@ Run the `/team-agreements` command in OpenCode:
36
75
  /team-agreements
37
76
  ```
38
77
 
39
- The plugin will guide you through establishing agreements for your project. You can also provide context:
78
+ The plugin will first analyze your project and then guide you through establishing agreements. You can also provide context:
40
79
 
41
80
  ```
42
- /team-agreements I want to update our commit message conventions
81
+ /team-agreements I want to update our AI collaboration policies
43
82
  ```
44
83
 
45
84
  ### Options when agreements exist
46
85
 
47
86
  If `docs/TEAM_AGREEMENTS.md` already exists, you'll be presented with options to:
48
87
  - **Review** - Display current agreements
49
- - **Amend** - Modify a specific section
50
- - **Start Over** - Begin fresh (with confirmation)
88
+ - **Amend** - Modify specific sections
89
+ - **Regenerate AGENTS.md** - Re-extract LLM-relevant rules
90
+
91
+ ### The split document approach
92
+
93
+ This plugin creates two files with different purposes:
94
+
95
+ **`docs/TEAM_AGREEMENTS.md`** - Comprehensive documentation including:
96
+ - Complete code standards with examples
97
+ - Full deployment and release procedures
98
+ - On-call and incident processes
99
+ - Meeting cadences and team ceremonies
100
+ - Everything humans need for reference
101
+
102
+ **`AGENTS.md`** - Only rules that affect day-to-day coding:
103
+ - Code quality standards and patterns
104
+ - Testing requirements
105
+ - Commit message format
106
+ - AI autonomy boundaries
107
+ - Escalation triggers
108
+
109
+ This split ensures LLM context isn't bloated with procedures they don't need constantly (deployment steps, post-mortem templates, etc.) while still giving humans complete documentation.
51
110
 
52
111
  ## How it works
53
112
 
54
- 1. **Command registration** - The plugin registers the `/team-agreements` command via OpenCode's config hook
55
- 2. **Interactive conversation** - An LLM guides you through each topic, asking one question at a time
56
- 3. **Document generation** - Creates `docs/TEAM_AGREEMENTS.md` with your agreements
57
- 4. **Auto-injection** - Adds agreements to the `instructions` config so all agents see them
58
- 5. **Compaction handling** - Re-injects agreements after context compaction in long sessions
113
+ 1. **Project analysis** - Detects your tech stack, frameworks, CI/CD, and AI tools
114
+ 2. **Tailored interview** - Highlights relevant topics and suggests skippable ones
115
+ 3. **Interactive conversation** - One question at a time with trade-off discussions
116
+ 4. **Document generation** - Creates both `docs/TEAM_AGREEMENTS.md` and `AGENTS.md`
117
+ 5. **Enforcement detection** - Identifies existing tooling (ESLint, Prettier, Husky, etc.)
118
+ 6. **Enforcement setup** - Offers to configure automatic enforcement where possible
119
+ 7. **Compaction handling** - Re-injects AGENTS.md after context compaction
120
+
121
+ ## Tools provided
122
+
123
+ The plugin registers these tools for LLM use:
124
+
125
+ - `analyze_project` - Detects languages, frameworks, CI, testing, AI tools, and project characteristics
126
+ - `detect_enforcement_mechanisms` - Finds existing linters, formatters, and CI workflows
127
+ - `suggest_team_agreement_topic` - Files GitHub issues for new topic suggestions
59
128
 
60
129
  ## Suggesting new topics
61
130
 
@@ -78,6 +147,9 @@ npm install
78
147
  # Build
79
148
  npm run build
80
149
 
150
+ # Run tests
151
+ npm test
152
+
81
153
  # Watch mode for development
82
154
  npm run dev
83
155
  ```
package/dist/index.d.ts CHANGED
@@ -1,54 +1,23 @@
1
- import { type Plugin } from "@opencode-ai/plugin";
2
- declare const PLUGIN_REPO = "jwilger/opencode-plugin-team-agreements";
3
- declare const COMMAND_TEMPLATE = "You are helping establish or review team agreements for this project. Team agreements define how humans and LLM agents collaborate on the codebase.\n\nUser's request: $ARGUMENTS\n\n## Instructions\n\n1. First, check if team agreements already exist at `docs/TEAM_AGREEMENTS.md`\n\n2. If agreements exist, present the user with options:\n - **Review**: Display the current agreements\n - **Amend**: Modify a specific section \n - **Start Over**: Begin fresh (with confirmation)\n\n3. If no agreements exist (or starting over), guide the user through establishing agreements one topic at a time. Start with these core topics:\n\n### Core Topics\n\n#### a. Storage Location\nAsk where team agreements should be stored. Suggest defaults:\n- Main file: `docs/TEAM_AGREEMENTS.md`\n- Supporting details: `docs/team_agreements/*.md`\n\n#### b. Programming Languages\n- What programming language(s) will be used in this project?\n- What is each language used for? (e.g., TypeScript for frontend, Rust for backend)\n- Are there specific versions or language-specific style guides to follow?\n\n#### c. Code Quality Standards\n- What does \"great code\" look like for this team?\n- How should we prioritize: readability vs. performance vs. simplicity?\n- Are there required patterns or anti-patterns to follow/avoid?\n- What about error handling conventions?\n- Naming conventions for files, functions, variables, types?\n\n#### d. Commit Message Conventions\n- What format should commit messages follow? (Conventional Commits, custom, freeform)\n- Are there required elements? (ticket numbers, scope, breaking change indicators)\n- Any rules on length, tense, capitalization?\n- Should commits be atomic (one logical change per commit)?\n\n#### e. Integration Workflow\n- Trunk-based development or feature branches?\n- Pull request requirements? (reviews, approvals, CI checks)\n- Who can merge to main/trunk?\n- What CI checks must pass before integration?\n- Any branch naming conventions?\n\n#### f. Testing Requirements\n- What testing is required before code is considered \"done\"?\n- Are there coverage thresholds?\n- What types of tests? (unit, integration, e2e, property-based)\n- When should tests be written? (TDD, after implementation, etc.)\n\n#### g. Amendment Process\n- How can these agreements be changed?\n- Who has authority to propose/approve changes?\n- What's the review/approval process for amendments?\n- How should changes be communicated to the team?\n\n4. For each topic:\n - Ask ONE question at a time\n - Discuss trade-offs when relevant\n - Confirm understanding before moving on\n - Record the team's decision clearly\n\n5. **After the core topics**, ask:\n \"Are there any additional topics you'd like to establish agreements for?\"\n \n Suggest potential additional topics if helpful:\n - **Architecture decisions** - How to document and track ADRs\n - **Dependency management** - How to evaluate and approve new dependencies\n - **Documentation standards** - What must be documented, where, in what format\n - **LLM autonomy boundaries** - What can LLMs do without asking? What requires human approval?\n - **Session handoff protocols** - How to summarize work for the next session/agent\n - **Code review process** - What reviewers should look for, turnaround expectations\n - **Planning and work breakdown** - How to break down work into tasks\n - **Information sharing** - How to share context across sessions and team members\n \n Continue asking about each additional topic the user wants to cover.\n \n After discussing additional topics, ask: \"Would you like to suggest any of these additional topics\n (or others you thought of) to be included as standard topics in the team-agreements plugin?\n I can file a GitHub issue for you if you'd like.\"\n \n If the user wants to suggest a topic, use the `suggest_team_agreement_topic` tool to file an issue.\n\n6. After ALL topics (core + additional) are covered:\n - Generate `docs/TEAM_AGREEMENTS.md` with all agreements organized by topic\n - If any topic needs detailed documentation, create supporting files in `docs/team_agreements/`\n - Update `opencode.json` to include `docs/TEAM_AGREEMENTS.md` in the `instructions` array\n - Summarize what was established\n\n7. **After generating the agreements**, use the `detect_enforcement_mechanisms` tool to check what enforcement is already in place, then offer to set up automatic enforcement for agreements that can be enforced programmatically.\n\n For each agreement that CAN be automatically enforced, ask the user if they'd like help setting it up. Here are the enforcement mechanisms to consider:\n\n ### Enforcement Mechanisms\n\n #### OpenCode Plugin Hooks\n Ideal for: LLM behavior guidance, context injection, custom commands\n - Can add validation in `tool.execute.before` hooks\n - Can transform messages via `experimental.chat.messages.transform`\n - Can inject reminders in `experimental.session.compacting`\n\n #### Pre-commit Hooks (husky, lefthook, pre-commit)\n Ideal for: Commit message validation, code formatting, linting, test execution\n - **Commit messages**: Use commitlint with husky for Conventional Commits or custom formats\n - **Code formatting**: Run prettier/eslint/biome on staged files\n - **Tests**: Run affected tests before allowing commits\n - **File restrictions**: Prevent commits to certain paths\n\n #### CI Workflows (GitHub Actions, etc.)\n Ideal for: Test coverage, build verification, security scanning, PR checks\n - **Testing requirements**: Enforce coverage thresholds, run full test suites\n - **Code quality**: Run linters, type checking, security audits\n - **Build verification**: Ensure the project builds successfully\n - **PR requirements**: Block merging until checks pass\n\n #### GitHub Rulesets / Branch Protection\n Ideal for: PR requirements, review policies, merge restrictions\n - **Required reviews**: Set minimum approvals before merge\n - **Required checks**: Specify which CI checks must pass\n - **Branch restrictions**: Control who can push to main/protected branches\n - **Commit signing**: Require verified commits\n\n #### Linting Rules (.eslintrc, biome.json, etc.)\n Ideal for: Code style, naming conventions, import organization, complexity limits\n - **Naming conventions**: Enforce variable/function/file naming patterns\n - **Code patterns**: Require/forbid certain coding patterns\n - **Import organization**: Enforce import ordering and restrictions\n\n ### Mapping Agreements to Enforcement\n\n | Agreement Topic | Possible Enforcement |\n |-----------------|---------------------|\n | Commit message conventions | commitlint + husky, GitHub Actions check |\n | Code quality standards | ESLint/Biome rules, pre-commit hooks, CI checks |\n | Testing requirements | CI workflow with coverage thresholds, pre-commit test runs |\n | Integration workflow | GitHub rulesets, required status checks, PR templates |\n | Programming language standards | Language-specific linters, compiler flags |\n\n ### When Offering Enforcement\n\n - Only offer enforcement for agreements that can actually be automated\n - Explain what the enforcement will do and how it works\n - Get explicit confirmation before making changes\n - If enforcement tooling already exists (detected by the tool), offer to update/extend it rather than replace it\n - Document what enforcement was set up in the TEAM_AGREEMENTS.md file\n\n## Output Format\n\nWhen generating the TEAM_AGREEMENTS.md file, use this structure:\n\n```markdown\n# Team Agreements\n\nThis document defines how our team (humans and LLM agents) collaborates on this codebase.\n\n## Table of Contents\n[Generate based on topics covered]\n\n## 1. Storage Location\n[Agreements about where documentation lives]\n\n## 2. Programming Languages\n[Agreements about languages and their usage]\n\n## 3. Code Quality Standards\n[Agreements about what makes good code]\n\n## 4. Commit Message Conventions\n[Agreements about commit message format]\n\n## 5. Integration Workflow\n[Agreements about how code gets integrated]\n\n## 6. Testing Requirements\n[Agreements about testing]\n\n## 7. Amendment Process\n[Agreements about changing these agreements]\n\n## Additional Topics\n[Any additional topics the team added]\n\n---\n*Last updated: [date]*\n*To amend these agreements, [process from amendment section]*\n```\n\n## Important\n\n- Be conversational and collaborative\n- ONE question at a time - don't overwhelm\n- Respect the user's expertise and preferences\n- If the user provides a specific request in their message, address that first\n- The core topics are a starting point, not an exhaustive list\n- Capture the \"why\" behind decisions, not just the \"what\"";
4
- /**
5
- * Check if a file exists at the given path.
6
- */
7
- export declare function fileExists(path: string): Promise<boolean>;
8
- /**
9
- * Check if the gh CLI is installed and authenticated.
10
- */
11
- export declare function isGhAvailable(): Promise<boolean>;
12
- /**
13
- * Load team agreements from the project directory.
14
- * Returns the content if found, null otherwise.
15
- */
16
- export declare function loadTeamAgreements(directory: string): Promise<string | null>;
17
- /**
18
- * Format suggested questions as a markdown list.
19
- */
20
- export declare function formatQuestionsAsMarkdown(questions: string[]): string;
21
- /**
22
- * Build the issue body for a topic suggestion.
23
- */
24
- export declare function buildTopicIssueBody(args: {
25
- topic_name: string;
26
- description: string;
27
- suggested_questions: string[];
28
- example_agreement?: string;
29
- }): string;
30
- /**
31
- * Enforcement mechanism detection result.
32
- */
33
- export interface EnforcementMechanism {
34
- type: string;
35
- name: string;
36
- detected: boolean;
37
- configFile?: string;
38
- notes?: string;
39
- }
40
- /**
41
- * Detect existing enforcement mechanisms in the project.
42
- */
43
- export declare function detectEnforcementMechanisms(directory: string): Promise<EnforcementMechanism[]>;
44
1
  /**
45
- * Format enforcement detection results as markdown.
2
+ * OpenCode Team Agreements Plugin
3
+ *
4
+ * Helps teams establish and maintain shared agreements for human-LLM collaboration.
5
+ *
6
+ * IMPORTANT: Only the plugin function should be exported from this module.
7
+ * OpenCode's plugin loader iterates through all exports and tries to call each
8
+ * one as a plugin function. Exporting non-function values (like strings or objects)
9
+ * will cause a crash.
10
+ *
11
+ * @packageDocumentation
46
12
  */
47
- export declare function formatEnforcementResults(mechanisms: EnforcementMechanism[]): string;
48
- export { COMMAND_TEMPLATE, PLUGIN_REPO };
13
+ import { type Plugin } from "@opencode-ai/plugin";
49
14
  /**
50
15
  * TeamAgreementsPlugin - Helps teams establish and maintain shared agreements
51
16
  * for human-LLM collaboration on a codebase.
17
+ *
18
+ * Team agreements are stored in AGENTS.md (or CLAUDE.md as fallback) in the
19
+ * project root. These files are automatically loaded by OpenCode and Claude Code,
20
+ * so no config injection is needed.
52
21
  */
53
22
  export declare const TeamAgreementsPlugin: Plugin;
54
23
  export default TeamAgreementsPlugin;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAQ,MAAM,qBAAqB,CAAA;AAQvD,QAAA,MAAM,W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