@mc1global/opencode-jarvis 0.8.0 → 0.9.0

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @mc1global/opencode-jarvis
2
2
 
3
- A native [OpenCode](https://opencode.ai) plugin providing multi-agent development infrastructure: session memory, kanban project management, governance guardrails, token metrics tracking, RAG semantic search, Obsidian vault management, domain map analysis, workspace registry, environment management, CI/CD pipelines, Azure DevOps sync, and structured data tools.
3
+ A native [OpenCode](https://opencode.ai) plugin providing multi-agent development infrastructure: session memory, kanban project management, governance guardrails, automatic token-per-card cost tracking with budget alerts, RAG semantic search, Obsidian vault management, domain map analysis, workspace registry, environment management, CI/CD pipelines, Azure DevOps sync, and structured data tools.
4
4
 
5
5
  Built with **Domain-Driven Design**, **SOLID principles**, and strict TypeScript.
6
6
 
@@ -188,13 +188,14 @@ mcp-server:
188
188
 
189
189
  ## Features
190
190
 
191
- ### 112 Tools across 13 categories
191
+ ### 113 Tools across 14 categories
192
192
 
193
193
  | Category | Count | Key Tools |
194
194
  |---|---|---|
195
195
  | **Context Memory** | 8 | `context-session-*`, `context-todo-*`, `context-note-*`, `context-search` |
196
196
  | **Kanban Cards** | 12 | `kanban-card-create/move/list/get/assign/estimate/criteria/delete/brief` |
197
197
  | **Kanban Board** | 15 | `kanban-sprint-*`, `kanban-epic-*`, `kanban-board-*`, `kanban-wip-check` |
198
+ | **Kanban Grooming** | 4 | `kanban-grooming-validate`, `kanban-card-scope-doc/criteria/estimate`, `kanban-card-gate` |
198
199
  | **Governance** | 2 | `governance-validate`, `governance-policies` |
199
200
  | **Token Metrics** | 7 | `metrics-record/history/agent-report/card-report/sprint-report/summary/estimate` |
200
201
  | **RAG** | 8 | `rag-search/index/snippet/update/delete/status/oracle-search/oracle-index` |
@@ -204,9 +205,9 @@ mcp-server:
204
205
  | **Domain Map** | 2 | `domain-map-analyze`, `domain-map-view` |
205
206
  | **Workspace** | 4 | `workspace-info/list/update/link` |
206
207
  | **Environment** | 6 | `env-init/create/list/status/merge/delete` |
207
- | **Pipeline** | 12 | `pipeline-init/activate/cancel/retry/run/gate/status/list/template/scaffold` |
208
+ | **Pipeline** | 10 | `pipeline-init/activate/cancel/retry/run/gate/status/list/template/scaffold` |
208
209
  | **Azure Sync** | 10 | `azure-sync-*`, `azure-pr-*` |
209
- | **Bootstrap** | 2 | `jarvis-bootstrap`, `jarvis-healthcheck` |
210
+ | **Bootstrap** | 3 | `jarvis-bootstrap`, `jarvis-healthcheck`, `jarvis-terminal-commands` |
210
211
 
211
212
  ### 5 Hooks
212
213
 
@@ -249,6 +250,11 @@ kanban:
249
250
  minTransitionIntervalSecs: 30
250
251
  gateTasks: # Per-phase gate definitions
251
252
 
253
+ # Token metrics & cost tracking
254
+ token-metrics:
255
+ sprintBudgetUsd: null # Set a USD budget per sprint (e.g. 50.0)
256
+ budgetAlertThreshold: 0.8 # Alert when utilization exceeds 80%
257
+
252
258
  # MCP server settings
253
259
  mcp-server:
254
260
  transport: "stdio"
@@ -271,7 +277,7 @@ jarvis-plugin/
271
277
  context-memory/ # Session, Todo, Note entities + services
272
278
  kanban/ # Card state machine, Sprint, Epic, Grooming
273
279
  governance/ # 13 policy rules, validation service
274
- token-metrics/ # Token usage tracking entities
280
+ token-metrics/ # Token usage tracking, cost-per-card/sprint, budget alerts
275
281
  rag/ # RAG value objects, domain services
276
282
  vault/ # Vault document, section, table entities
277
283
  domain-map/ # Bounded context detection, domain analysis
@@ -282,9 +288,9 @@ jarvis-plugin/
282
288
  config/ # Configuration value objects + defaults
283
289
  application/ # Use cases with DTOs (11 bounded contexts)
284
290
  infrastructure/ # SQLite repos, Vectra, Ollama, FS adapters
285
- tools/ # 15 tool modules (112 tools total)
291
+ tools/ # 20 tool modules (113 tools total)
286
292
  hooks/ # 5 hooks (guardrails, compacting, first-run, events, shell-env)
287
- tests/ # 2435+ tests across 80 test suites
293
+ tests/ # 2,520+ tests across 85 test suites
288
294
  obsidian-vault/ # Structured documentation
289
295
  config/ # jarvis.yaml configuration
290
296
  ```
@@ -379,7 +385,7 @@ npx tsx scripts/rag-index.ts --clear
379
385
 
380
386
  ## Test Coverage
381
387
 
382
- - **2,435+ tests** across 80 test suites
388
+ - **2,520+ tests** across 85 test suites
383
389
  - Domain, application, infrastructure, and tools layers tested
384
390
  - In-memory SQLite for fast, isolated integration tests
385
391
  - `tsc --noEmit` zero errors with all strict flags
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Re-exports the bootstrap use cases, healthcheck, types, and template generator.
5
5
  */
6
- export { BootstrapUseCases, generateAgentsMd, } from "./use-cases.js";
6
+ export { BootstrapUseCases, generateAgentsMd, processConditionalBlocks, replacePlaceholders, } from "./use-cases.js";
7
7
  export type { BootstrapConfig, BootstrapResult, } from "./use-cases.js";
8
8
  export { HealthcheckUseCases } from "./healthcheck-use-cases.js";
9
9
  export type { CheckStatus, CheckResult, HealthcheckResponse, HealthcheckDeps, } from "./healthcheck-use-cases.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/application/bootstrap/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACV,eAAe,EACf,eAAe,GAChB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,YAAY,EACV,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,eAAe,GAChB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAE5E,YAAY,EACV,eAAe,EACf,wBAAwB,EACxB,uBAAuB,EACvB,4BAA4B,GAC7B,MAAM,kCAAkC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/application/bootstrap/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACV,eAAe,EACf,eAAe,GAChB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,YAAY,EACV,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,eAAe,GAChB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAE5E,YAAY,EACV,eAAe,EACf,wBAAwB,EACxB,uBAAuB,EACvB,4BAA4B,GAC7B,MAAM,kCAAkC,CAAC"}
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Re-exports the bootstrap use cases, healthcheck, types, and template generator.
5
5
  */
6
- export { BootstrapUseCases, generateAgentsMd, } from "./use-cases.js";
6
+ export { BootstrapUseCases, generateAgentsMd, processConditionalBlocks, replacePlaceholders, } from "./use-cases.js";
7
7
  export { HealthcheckUseCases } from "./healthcheck-use-cases.js";
8
8
  export { TerminalCommandsUseCases } from "./terminal-commands-use-cases.js";
9
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/application/bootstrap/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AAOxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AASjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/application/bootstrap/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AAOxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AASjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC"}
@@ -48,8 +48,22 @@ export declare class BootstrapUseCases {
48
48
  buildConfig(azureSyncConfig?: AzureSyncConfig): BootstrapConfig;
49
49
  }
50
50
  /**
51
- * Generate config-adaptive AGENTS.md content.
52
- * Sections for Azure DevOps, Dagger, and container-use only appear when enabled.
51
+ * Process conditional blocks in a template string.
52
+ *
53
+ * Syntax: `{{#IF NAME}}...content...{{/IF NAME}}`
54
+ * If `conditions[NAME]` is truthy, the content is kept; otherwise removed.
55
+ * Supports nested conditions.
56
+ */
57
+ export declare function processConditionalBlocks(template: string, conditions: Record<string, boolean>): string;
58
+ /**
59
+ * Replace `{{PLACEHOLDER}}` tokens with values from a variables map.
60
+ */
61
+ export declare function replacePlaceholders(template: string, variables: Record<string, string>): string;
62
+ /**
63
+ * Generate config-adaptive AGENTS.md content from external template.
64
+ *
65
+ * Reads `templates/agents-md.template.md`, processes conditional blocks
66
+ * based on config flags, and replaces placeholders with config values.
53
67
  */
54
68
  export declare function generateAgentsMd(config: BootstrapConfig): string;
55
69
  //# sourceMappingURL=use-cases.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-cases.d.ts","sourceRoot":"","sources":["../../../src/application/bootstrap/use-cases.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAI5E,6DAA6D;AAC7D,MAAM,WAAW,eAAe;IAC9B,4DAA4D;IAC5D,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC,sDAAsD;IACtD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,iDAAiD;IACjD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,sDAAsD;IACtD,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAClC,wDAAwD;IACxD,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AAC,kBAAkB,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/C,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;CACjC;AA8DD;;GAEG;AACH,qBAAa,iBAAiB;IAC5B;;;;;;;OAOG;IACH,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,KAAK,UAAQ,GAAG,eAAe;IAiDrF;;OAEG;IACH,WAAW,CAAC,eAAe,CAAC,EAAE,eAAe,GAAG,eAAe;CAUhE;AAiCD;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAClC,MAAM,CAaR;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAChC,MAAM,CAKR;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAiBhE"}
@@ -8,8 +8,9 @@
8
8
  * SOLID: OCP — new sections can be added without modifying existing ones
9
9
  * SOLID: DIP — depends on ConfigService abstraction for config reading
10
10
  */
11
- import { existsSync, mkdirSync, writeFileSync } from "node:fs";
12
- import { join } from "node:path";
11
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
12
+ import { dirname, join } from "node:path";
13
+ import { fileURLToPath } from "node:url";
13
14
  // ── Vault Skeleton Folders ────────────────────────────────────────────────────
14
15
  const VAULT_SKELETON_DIRS = [
15
16
  "obsidian-vault",
@@ -133,223 +134,73 @@ export class BootstrapUseCases {
133
134
  };
134
135
  }
135
136
  }
136
- // ── AGENTS.md Template Generator ──────────────────────────────────────────────
137
+ // ── AGENTS.md Template Engine ─────────────────────────────────────────────────
137
138
  /**
138
- * Generate config-adaptive AGENTS.md content.
139
- * Sections for Azure DevOps, Dagger, and container-use only appear when enabled.
139
+ * Resolve the path to the external AGENTS.md template file.
140
+ *
141
+ * Checks three locations in order:
142
+ * 1. `templates/` relative to package root (npm published layout)
143
+ * 2. `../../templates/` relative to compiled dist/ (development via dist/)
144
+ * 3. `templates/` relative to CWD (fallback for local dev)
140
145
  */
141
- export function generateAgentsMd(config) {
142
- const sections = [];
143
- sections.push(SECTION_HEADER);
144
- sections.push(SECTION_KANBAN_LIFECYCLE);
145
- sections.push(SECTION_GUARDRAILS);
146
- sections.push(SECTION_GOVERNANCE);
147
- if (config.containerUseEnabled) {
148
- sections.push(SECTION_CONTAINER_USE);
146
+ function resolveTemplatePath() {
147
+ // Use import.meta.url to find package root relative to this compiled file.
148
+ // In dist: dist/application/bootstrap/use-cases.js → ../../.. = package root
149
+ const thisDir = dirname(fileURLToPath(import.meta.url));
150
+ const packageRoot = join(thisDir, "..", "..", "..");
151
+ const candidates = [
152
+ join(packageRoot, "templates", "agents-md.template.md"),
153
+ join(thisDir, "..", "..", "..", "templates", "agents-md.template.md"),
154
+ ];
155
+ for (const candidate of candidates) {
156
+ if (existsSync(candidate))
157
+ return candidate;
149
158
  }
150
- if (config.azureSyncEnabled) {
151
- sections.push(generateAzureSyncSection(config));
152
- }
153
- if (config.pipelineEnabled) {
154
- sections.push(SECTION_PIPELINE_DAGGER);
159
+ // Should never happen in a correctly installed package
160
+ throw new Error(`AGENTS.md template not found. Searched: ${candidates.join(", ")}`);
161
+ }
162
+ /**
163
+ * Process conditional blocks in a template string.
164
+ *
165
+ * Syntax: `{{#IF NAME}}...content...{{/IF NAME}}`
166
+ * If `conditions[NAME]` is truthy, the content is kept; otherwise removed.
167
+ * Supports nested conditions.
168
+ */
169
+ export function processConditionalBlocks(template, conditions) {
170
+ // Process from innermost to outermost by iterating until stable.
171
+ let result = template;
172
+ let previous = "";
173
+ while (result !== previous) {
174
+ previous = result;
175
+ result = result.replace(/\{\{#IF (\w+)\}\}\n?([\s\S]*?)\{\{\/IF \1\}\}\n?/g, (_match, name, content) => conditions[name] ? content : "");
155
176
  }
156
- sections.push(SECTION_VAULT);
157
- sections.push(SECTION_GIT_STRATEGY);
158
- sections.push(SECTION_CONFIG_SYSTEM);
159
- sections.push(SECTION_TOOL_QUICK_REFERENCE);
160
- sections.push(SECTION_SKILLS_AND_COMMANDS);
161
- sections.push(SECTION_RAG_ORACLE);
162
- return sections.join("\n\n") + "\n";
177
+ return result;
163
178
  }
164
- // ── Static Sections ───────────────────────────────────────────────────────────
165
- const SECTION_HEADER = `# AGENTS.md JARVIS Plugin Operational Guide
166
-
167
- This file instructs agentic coding agents operating in this repository.
168
- JARVIS is an OpenCode plugin implementing a multi-agent development framework
169
- with kanban governance, context memory, and CI/CD pipeline support.`;
170
- const SECTION_KANBAN_LIFECYCLE = `## Mandatory Workflow — Kanban Lifecycle
171
-
172
- ALL non-trivial work (>15 minutes) MUST follow the full kanban pipeline.
173
- Do NOT skip steps. Do NOT commit directly to \`main\`.
174
-
175
- \`\`\`
176
- backlog -> grooming -> ready -> doing -> review -> tested -> done
177
- \`\`\`
178
-
179
- ### Before coding anything:
180
-
181
- 1. **Create or pick a card** — \`kanban-card-create\`, assign to epic and sprint
182
- 2. **Groom it** — Write a scope doc in \`obsidian-vault/12-Scope-Docs/\`, define
183
- acceptance criteria (min 2), estimate story points (Fibonacci), assign epic
184
- 3. **Move to ready** — Card cannot leave grooming without: scope doc, AC, points, epic
185
- 4. **Assign agent + sprint** — Then move to \`doing\`
186
- 5. **Start a session** — \`context-session-start\` before any card work
187
-
188
- ### Grooming rules CRITICAL:
189
-
190
- Grooming defines **problem, value, and boundaries**. It does NOT prescribe
191
- implementation details (no class names, method signatures, field names, code
192
- snippets). The implementing agent decides those during the \`doing\` phase.
193
-
194
- ### After coding:
195
-
196
- 6. **Run tests + linter** — All must pass, zero errors
197
- 7. **Commit** — Imperative mood, reference card: \`Add X (CD-XXX)\` or \`Fix Y (CD-XXX)\`
198
- 8. **Move card** — \`doing -> review -> tested -> done\`, meet all AC and gate tasks first
199
- 9. **Update vault** — Dashboard + domain reference doc at end of every phase`;
200
- const SECTION_GUARDRAILS = `## Guardrails — Hard Rules
201
-
202
- ### NEVER:
203
- - Use fallback/mock behavior to mask errors — errors must throw with proper handling
204
- - Use a "simpler approach" to bypass the real solution
205
- - Read \`.csv\` directly — use \`data-csv-query\` tool
206
- - Read \`.yaml/.yml\` directly — use \`data-yaml-get\` tool
207
- - Read \`.env\`, \`.pem\`, \`.key\`, credentials files — blocked by governance
208
- - Run \`git push --force\` on main/master
209
- - Run \`sqlite3\` CLI — use repository methods
210
- - Create \`TODO.md\`, \`PLAN.md\`, or \`ROADMAP.md\` — use kanban tools
211
- - Bypass the kanban pipeline for trackable work
212
- - Push to git without explicit user approval
213
- - Start the app from the agent session — ask the user to do it in another terminal
214
-
215
- ### ALWAYS:
216
- - Search RAG (\`rag-search\` / \`rag-snippet\`) before creating or modifying files
217
- - Use specialized tools instead of raw file operations
218
- - Get full codebase context before making changes — ask if unclear
219
- - Validate card status transitions through the kanban domain
220
- - Track context with sessions, TODOs, and notes`;
221
- const SECTION_GOVERNANCE = `## Governance Policies (Runtime Enforced)
222
-
223
- Governance policies are evaluated by the \`tool.execute.before\` hook on every
224
- tool invocation. Violations with \`error\` severity throw and block execution.
225
- These cover: CSV/YAML/env file access, force push, direct SQLite CLI,
226
- destructive shell ops, credential file reads.
227
-
228
- Use \`governance-validate\` to pre-check if an operation is allowed.
229
- Use \`governance-policies\` to list all active policies.`;
230
- const SECTION_CONTAINER_USE = `## Container-Use Environments
231
-
232
- Container-use environments are isolated containers with their own git worktree
233
- branches. Use them for all file, code, and shell operations.
234
-
235
- Workflow:
236
- 1. \`env-init\` — Detect project stack
237
- 2. \`env-create\` — Spin up container from git ref
238
- 3. Work inside container via \`container-use_environment_*\` tools
239
- 4. \`env-merge\` — Merge branch back to main
240
- 5. \`env-delete\` — Clean up container + worktree
241
-
242
- IMPORTANT: Always inform the user how to view your work using
243
- \`container-use log <env_id>\` and \`container-use checkout <env_id>\`.
244
-
245
- Do NOT install or use the git CLI with \`environment_run_cmd\`. All environment
246
- tools handle git operations automatically.`;
247
- const SECTION_PIPELINE_DAGGER = `## CI/CD Pipelines (Dagger)
248
-
249
- Pipeline BC uses Dagger for CI/CD gate execution. Pipelines are created from
250
- stack templates (typescript-lib, python-app, etc.) and run gates in containers.
251
-
252
- Workflow:
253
- 1. \`pipeline-init\` — Create pipeline from stack template
254
- 2. \`pipeline-activate\` — Make pipeline runnable
255
- 3. \`pipeline-run\` — Execute gates via Dagger
256
- 4. \`pipeline-gate\` — Manual pass/fail/skip/retry for gates
257
- 5. \`pipeline-status\` — View pipeline state and gate results
258
-
259
- Templates available via \`pipeline-template\` tool.
260
- Scaffold Dagger modules via \`pipeline-scaffold\` tool.`;
261
- const SECTION_VAULT = `## Obsidian Vault
262
-
263
- Documentation lives in \`obsidian-vault/\`. Use structured lists, NOT markdown
264
- tables (token efficiency). Update at end of every phase:
265
-
266
- - \`09-Dashboards/\` — Project dashboards and metrics
267
- - \`11-Domain-Reference/\` — Per-context architecture docs
268
- - \`12-Scope-Docs/CD-XXX-*.md\` — Grooming scope documents
269
-
270
- Use \`vault-manage\` tool for smart vault operations (inspect, read, write, create,
271
- search, table-read, table-update).`;
272
- const SECTION_GIT_STRATEGY = `## Git Strategy
273
-
274
- - Work on feature branches (never commit directly to \`main\`)
275
- - Commit messages: imperative verb + summary + card reference
276
- - \`Add feature X (CD-001)\`
277
- - \`Fix bug Y (CD-015)\`
278
- - Merge via PR or controlled merge
279
- - Never amend pushed commits without explicit request
280
- - Never push without explicit user approval`;
281
- const SECTION_CONFIG_SYSTEM = `## Configuration System
282
-
283
- \`config/jarvis.yaml\` holds tunable settings per bounded context. The ConfigService
284
- deep-merges YAML overrides over hardcoded defaults. Access config via the
285
- appropriate getter methods — never read YAML files directly.`;
286
- const SECTION_TOOL_QUICK_REFERENCE = `## Tool Quick Reference (112 tools)
287
-
288
- JARVIS provides 112 tools across 11 bounded contexts. Key tool groups:
289
-
290
- - **Context Memory** (8): \`context-session-start\`, \`context-session-finish\`, \`context-todo-add\`, \`context-note-add\`, \`context-search\`...
291
- - **Kanban** (31): \`kanban-card-create\`, \`kanban-card-move\`, \`kanban-board-view\`, \`kanban-sprint-create\`, \`kanban-epic-create\`...
292
- - **Governance** (2): \`governance-validate\`, \`governance-policies\`
293
- - **Token Metrics** (7): \`metrics-summary\`, \`metrics-agent-report\`, \`metrics-card-report\`...
294
- - **Vault** (11): \`vault-manage\` (smart facade), \`vault-doc-create\`, \`vault-doc-search\`...
295
- - **RAG** (8): \`rag-search\`, \`rag-snippet\`, \`rag-index\`, \`rag-oracle-search\`, \`rag-oracle-index\`...
296
- - **Data** (3): \`data-yaml-get\`, \`data-json-get\`, \`data-csv-query\`
297
- - **Agent** (8): \`agent-sessions\`, \`agent-send\`, \`agent-spawn\`, \`agent-dispatch\`...
298
- - **Pipeline** (10): \`pipeline-init\`, \`pipeline-run\`, \`pipeline-status\`...
299
- - **Environment** (6): \`env-create\`, \`env-status\`, \`env-merge\`, \`env-delete\`...
300
- - **Workspace** (4): \`workspace-info\`, \`workspace-list\`, \`workspace-update\`, \`workspace-link\`
301
- - **Bootstrap** (2): \`jarvis-bootstrap\`, \`jarvis-healthcheck\`
302
-
303
- For detailed workflows, load the appropriate skill (see below).`;
304
- const SECTION_SKILLS_AND_COMMANDS = `## Available Skills
305
-
306
- Load skills via the \`skill()\` tool to get detailed workflow instructions:
307
-
308
- - **\`jarvis-kanban\`** — Full kanban lifecycle: card creation, grooming, sprint management, gate tasks
309
- - **\`jarvis-azure-sync\`** — Azure DevOps sync: push/pull/bidi-sync, PR creation, poll events
310
- - **\`jarvis-onboarding\`** — Setup, healthcheck, RAG indexing, tool group reference
311
-
312
- ### Available Commands
313
-
314
- Use these slash commands for common operations:
315
-
316
- - **\`/healthcheck\`** — Run diagnostics and get actionable fix guidance
317
- - **\`/sync-azure\`** — Execute Azure DevOps sync workflow
318
- - **\`/start-card CD-XXX\`** — Start working on a specific card (handles full lifecycle)
319
-
320
- When you encounter an unfamiliar workflow, ALWAYS load the relevant skill first.`;
321
- const SECTION_RAG_ORACLE = `## Knowledge Search — RAG & ORACLE
322
-
323
- Before creating or modifying code, ALWAYS search first:
324
-
325
- - **\`rag-search\`** / **\`rag-snippet\`** — Search the codebase semantically
326
- - **\`rag-oracle-search\`** — Search curated framework documentation (governance, workflows, patterns)
327
-
328
- When you don't know how to do something, search ORACLE:
329
- \`\`\`
330
- rag-oracle-search query="how to sync azure devops"
331
- rag-oracle-search query="kanban grooming requirements" domain="workflows"
332
- \`\`\`
333
-
334
- ORACLE domains: \`governance\`, \`workflows\`, \`patterns\`, \`quick_reference\`.`;
335
- // ── Dynamic Sections ──────────────────────────────────────────────────────────
336
- function generateAzureSyncSection(config) {
337
- return `## Azure DevOps Integration
338
-
339
- This project is connected to Azure DevOps (${config.azureOrg}/${config.azureProject}).
340
-
341
- Available tools:
342
- - \`azure-sync-discover\` — Detect project template, list work items + iterations
343
- - \`azure-sync-push\` — Push cards/epics/sprints to Azure DevOps
344
- - \`azure-sync-pull\` — Pull work items from Azure DevOps
345
- - \`azure-sync-sync\` — Bidirectional sync (push then pull)
346
- - \`azure-sync-status\` — Show sync status between local and Azure
347
- - \`azure-sync-config\` — Show configuration + test connectivity
348
- - \`azure-sync-events\` — List/acknowledge/dismiss detected change events
349
- - \`azure-pr-create\` — Create Pull Request in Azure Repos
350
- - \`azure-pr-list\` — List Pull Requests
351
-
352
- Poll service can be enabled in \`config/jarvis.yaml\` under \`azure-sync.pollEnabled\`
353
- to automatically detect changes made by team members in Azure DevOps.`;
179
+ /**
180
+ * Replace `{{PLACEHOLDER}}` tokens with values from a variables map.
181
+ */
182
+ export function replacePlaceholders(template, variables) {
183
+ return template.replace(/\{\{([A-Z_]+)\}\}/g, (_match, name) => variables[name] ?? `{{${name}}}`);
184
+ }
185
+ /**
186
+ * Generate config-adaptive AGENTS.md content from external template.
187
+ *
188
+ * Reads `templates/agents-md.template.md`, processes conditional blocks
189
+ * based on config flags, and replaces placeholders with config values.
190
+ */
191
+ export function generateAgentsMd(config) {
192
+ const templatePath = resolveTemplatePath();
193
+ const raw = readFileSync(templatePath, "utf-8");
194
+ const conditions = {
195
+ AZURE_SYNC: config.azureSyncEnabled,
196
+ PIPELINE: config.pipelineEnabled,
197
+ CONTAINER_USE: config.containerUseEnabled,
198
+ };
199
+ const variables = {
200
+ AZURE_ORG: config.azureOrg,
201
+ AZURE_PROJECT: config.azureProject,
202
+ };
203
+ const afterConditions = processConditionalBlocks(raw, conditions);
204
+ return replacePlaceholders(afterConditions, variables);
354
205
  }
355
206
  //# sourceMappingURL=use-cases.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-cases.js","sourceRoot":"","sources":["../../../src/application/bootstrap/use-cases.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AA4BjC,iFAAiF;AAEjF,MAAM,mBAAmB,GAAG;IAC1B,gBAAgB;IAChB,8BAA8B;IAC9B,oCAAoC;IACpC,8BAA8B;CACtB,CAAC;AAEX,iFAAiF;AAEjF,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6C5B,CAAC;AAEF,iFAAiF;AAEjF;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAC5B;;;;;;;OAOG;IACH,SAAS,CAAC,SAAiB,EAAE,MAAuB,EAAE,KAAK,GAAG,KAAK;QACjE,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QAClD,MAAM,WAAW,GAAa,EAAE,CAAC;QAEjC,4BAA4B;QAC5B,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAC7C,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAC3B,SAAS,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mB,CACjC,QAAgB,EAChB,SAAiC;IAEjC,OAAO,QAAQ,CAAC,OAAO,CACrB,oBAAoB,EACpB,CAAC,MAAM,EAAE,IAAY,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,IAAI,CAC3D,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAuB;IACtD,MAAM,YAAY,GAAG,mBAAmB,EAAE,CAAC;IAC3C,MAAM,GAAG,GAAG,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IAEhD,MAAM,UAAU,GAA4B;QAC1C,UAAU,EAAE,MAAM,CAAC,gBAAgB;QACnC,QAAQ,EAAE,MAAM,CAAC,eAAe;QAChC,aAAa,EAAE,MAAM,CAAC,mBAAmB;KAC1C,CAAC;IAEF,MAAM,SAAS,GAA2B;QACxC,SAAS,EAAE,MAAM,CAAC,QAAQ;QAC1B,aAAa,EAAE,MAAM,CAAC,YAAY;KACnC,CAAC;IAEF,MAAM,eAAe,GAAG,wBAAwB,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;IAClE,OAAO,mBAAmB,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;AACzD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mc1global/opencode-jarvis",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "JARVIS Framework - OpenCode native plugin for multi-agent development with DDD architecture",
5
5
  "author": "Julio Fabio de O. Chagas <julio.fabio@mc1global.com>",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -19,6 +19,7 @@
19
19
  },
20
20
  "files": [
21
21
  "dist/",
22
+ "templates/",
22
23
  "LICENSE",
23
24
  "README.md",
24
25
  "QUICK-GUIDE.md"
@@ -0,0 +1,232 @@
1
+ # AGENTS.md — JARVIS Plugin Operational Guide
2
+
3
+ This file instructs agentic coding agents operating in this repository.
4
+ JARVIS is an OpenCode plugin implementing a multi-agent development framework
5
+ with kanban governance, context memory, automatic cost tracking, and CI/CD
6
+ pipeline support.
7
+
8
+ ## Architecture Constraints — Inviolable
9
+
10
+ - **SOLID Principles** — Every class/module must strictly respect all 5 principles
11
+ - **Domain-Driven Design** — Domain layer has ZERO external dependencies. Repository
12
+ interfaces in domain, implementations in infrastructure
13
+ - **Max 500 lines per file** — No exceptions. Split by responsibility if approaching limit
14
+ - **ESM modules** — `"type": "module"` required by `@opencode-ai/plugin`
15
+ - **Strict TypeScript** — `exactOptionalPropertyTypes`, `verbatimModuleSyntax`,
16
+ `noUncheckedIndexedAccess` all enabled
17
+ - **13 bounded contexts** with strict DDD boundaries — no direct imports between contexts
18
+ - **Cross-context communication** via ports/callbacks wired at composition root
19
+
20
+ ## Mandatory Workflow — Kanban Lifecycle
21
+
22
+ ALL non-trivial work (>15 minutes) MUST follow the full kanban pipeline.
23
+ Do NOT skip steps. Do NOT commit directly to `main`.
24
+
25
+ ```
26
+ backlog -> grooming -> ready -> doing -> review -> tested -> done
27
+ ```
28
+
29
+ ### Before coding anything:
30
+
31
+ 1. **Create or pick a card** — `kanban-card-create`, assign to epic and sprint
32
+ 2. **Groom it** — Write a scope doc in `obsidian-vault/12-Scope-Docs/`, define
33
+ acceptance criteria (min 2), estimate story points (Fibonacci), assign epic
34
+ 3. **Move to ready** — Card cannot leave grooming without: scope doc, AC, points, epic
35
+ 4. **Assign agent + sprint** — Then move to `doing`
36
+ 5. **Start a session** — `context-session-start` before any card work
37
+
38
+ ### Grooming rules — CRITICAL:
39
+
40
+ Grooming defines **problem, value, and boundaries**. It does NOT prescribe
41
+ implementation details (no class names, method signatures, field names, code
42
+ snippets). The implementing agent decides those during the `doing` phase.
43
+
44
+ ### After coding:
45
+
46
+ 6. **Run tests + linter** — All must pass, zero errors
47
+ 7. **Commit** — Imperative mood, reference card: `Add X (CD-XXX)` or `Fix Y (CD-XXX)`
48
+ 8. **Move card** — `doing -> review -> tested -> done`, meet all AC and gate tasks first
49
+ 9. **Update vault** — Dashboard + domain reference doc at end of every phase
50
+
51
+ ## Guardrails — Hard Rules
52
+
53
+ ### NEVER:
54
+ - Use fallback/mock behavior to mask errors — errors must throw with proper handling
55
+ - Use a "simpler approach" to bypass the real solution
56
+ - Read `.csv` directly — use `data-csv-query` tool
57
+ - Read `.yaml/.yml` directly — use `data-yaml-get` tool
58
+ - Read `.env`, `.pem`, `.key`, credentials files — blocked by governance
59
+ - Run `git push --force` on main/master
60
+ - Run `sqlite3` CLI — use repository methods
61
+ - Create `TODO.md`, `PLAN.md`, or `ROADMAP.md` — use kanban tools
62
+ - Bypass the kanban pipeline for trackable work
63
+ - Push to git without explicit user approval
64
+ - Start the app from the agent session — ask the user to do it in another terminal
65
+ - Skip grooming requirements or gate tasks for cards
66
+ - Import directly between bounded contexts — use ports/callbacks
67
+
68
+ ### ALWAYS:
69
+ - Search RAG (`rag-search` / `rag-snippet`) before creating or modifying files
70
+ - Use specialized tools instead of raw file operations
71
+ - Get full codebase context before making changes — ask if unclear
72
+ - Validate card status transitions through the kanban domain
73
+ - Track context with sessions, TODOs, and notes
74
+ - Meet all gate tasks before moving cards through review/tested/done
75
+
76
+ ## Governance Policies (13 Runtime Enforced)
77
+
78
+ Governance policies are evaluated by the `tool.execute.before` hook on every
79
+ tool invocation. Violations with `error` severity throw and block execution.
80
+
81
+ Policy groups:
82
+ - **File access** — Block direct CSV, YAML, env file reads (use specialized tools)
83
+ - **Shell safety** — Block force push, direct SQLite CLI, warn on destructive ops
84
+ - **Security** — Block env dump, sensitive file reads, credential file access
85
+ - **Pipeline** — Warn when running pipeline without linked card
86
+ - **Kanban** — Require gate tasks before status transitions, warn on rapid transitions
87
+
88
+ Use `governance-validate` to pre-check if an operation is allowed.
89
+ Use `governance-policies` to list all active policies.
90
+
91
+ {{#IF CONTAINER_USE}}
92
+ ## Container-Use Environments
93
+
94
+ Container-use environments are isolated containers with their own git worktree
95
+ branches. Use them for all file, code, and shell operations.
96
+
97
+ Workflow:
98
+ 1. `env-init` — Detect project stack
99
+ 2. `env-create` — Spin up container from git ref
100
+ 3. Work inside container via `container-use_environment_*` tools
101
+ 4. `env-merge` — Merge branch back to main
102
+ 5. `env-delete` — Clean up container + worktree
103
+
104
+ IMPORTANT: Always inform the user how to view your work using
105
+ `container-use log <env_id>` and `container-use checkout <env_id>`.
106
+
107
+ Do NOT install or use the git CLI with `environment_run_cmd`. All environment
108
+ tools handle git operations automatically.
109
+ {{/IF CONTAINER_USE}}
110
+
111
+ {{#IF AZURE_SYNC}}
112
+ ## Azure DevOps Integration
113
+
114
+ This project is connected to Azure DevOps ({{AZURE_ORG}}/{{AZURE_PROJECT}}).
115
+
116
+ Available tools:
117
+ - `azure-sync-discover` — Detect project template, list work items + iterations
118
+ - `azure-sync-push` — Push cards/epics/sprints to Azure DevOps
119
+ - `azure-sync-pull` — Pull work items from Azure DevOps
120
+ - `azure-sync-sync` — Bidirectional sync (push then pull)
121
+ - `azure-sync-status` — Show sync status between local and Azure
122
+ - `azure-sync-config` — Show configuration + test connectivity
123
+ - `azure-sync-events` — List/acknowledge/dismiss detected change events
124
+ - `azure-sync-poll-status` — Show background poll service status
125
+ - `azure-pr-create` — Create Pull Request in Azure Repos
126
+ - `azure-pr-list` — List Pull Requests
127
+
128
+ Poll service can be enabled in `config/jarvis.yaml` under `azure-sync.pollEnabled`
129
+ to automatically detect changes made by team members in Azure DevOps.
130
+ {{/IF AZURE_SYNC}}
131
+
132
+ {{#IF PIPELINE}}
133
+ ## CI/CD Pipelines (Dagger)
134
+
135
+ Pipeline BC uses Dagger for CI/CD gate execution. Pipelines are created from
136
+ stack templates (typescript-lib, python-app, etc.) and run gates in containers.
137
+
138
+ Workflow:
139
+ 1. `pipeline-init` — Create pipeline from stack template
140
+ 2. `pipeline-activate` — Make pipeline runnable
141
+ 3. `pipeline-run` — Execute gates via Dagger
142
+ 4. `pipeline-gate` — Manual pass/fail/skip/retry for gates
143
+ 5. `pipeline-status` — View pipeline state and gate results
144
+
145
+ Templates available via `pipeline-template` tool.
146
+ Scaffold Dagger modules via `pipeline-scaffold` tool.
147
+ {{/IF PIPELINE}}
148
+
149
+ ## Obsidian Vault
150
+
151
+ Documentation lives in `obsidian-vault/`. Use structured lists, NOT markdown
152
+ tables (token efficiency). Update at end of every phase:
153
+
154
+ - `09-Dashboards/` — Project dashboards and metrics
155
+ - `11-Domain-Reference/` — Per-context architecture docs
156
+ - `12-Scope-Docs/CD-XXX-*.md` — Grooming scope documents
157
+
158
+ Use `vault-manage` tool for smart vault operations (inspect, read, write, create,
159
+ search, table-read, table-update).
160
+
161
+ ## Git Strategy
162
+
163
+ - Work on feature branches (never commit directly to `main`)
164
+ - Commit messages: imperative verb + summary + card reference
165
+ - `Add feature X (CD-001)`
166
+ - `Fix bug Y (CD-015)`
167
+ - Merge via PR or controlled merge
168
+ - Never amend pushed commits without explicit request
169
+ - Never push without explicit user approval
170
+
171
+ ## Configuration System
172
+
173
+ `config/jarvis.yaml` holds tunable settings per bounded context. The ConfigService
174
+ deep-merges YAML overrides over hardcoded defaults. Access config via the
175
+ appropriate getter methods — never read YAML files directly.
176
+
177
+ Available config sections: `rag`, `azure-sync`, `kanban`, `mcp-server`,
178
+ `pipeline`, `token-metrics` (with `sprintBudgetUsd` and `budgetAlertThreshold`).
179
+
180
+ ## Tool Quick Reference (113 tools)
181
+
182
+ JARVIS provides 113 tools across 13 bounded contexts. Key tool groups:
183
+
184
+ - **Context Memory** (8): `context-session-start`, `context-session-finish`, `context-todo-add`, `context-note-add`, `context-search`...
185
+ - **Kanban** (31): `kanban-card-create`, `kanban-card-move`, `kanban-board-view`, `kanban-sprint-create`, `kanban-epic-create`, `kanban-grooming-validate`, `kanban-card-gate`...
186
+ - **Governance** (2): `governance-validate`, `governance-policies`
187
+ - **Token Metrics** (7): `metrics-summary`, `metrics-agent-report`, `metrics-card-report`, `metrics-sprint-report`, `metrics-estimate`... (auto-tracks cost per card/sprint)
188
+ - **Vault** (11): `vault-manage` (smart facade), `vault-doc-create`, `vault-doc-search`...
189
+ - **RAG** (8): `rag-search`, `rag-snippet`, `rag-index`, `rag-oracle-search`, `rag-oracle-index`...
190
+ - **Data** (3): `data-yaml-get`, `data-json-get`, `data-csv-query`
191
+ - **Agent** (8): `agent-sessions`, `agent-send`, `agent-spawn`, `agent-dispatch`, `agent-register`, `agent-profile`...
192
+ - **Pipeline** (10): `pipeline-init`, `pipeline-run`, `pipeline-status`, `pipeline-template`, `pipeline-scaffold`...
193
+ - **Environment** (6): `env-init`, `env-create`, `env-list`, `env-status`, `env-merge`, `env-delete`
194
+ - **Workspace** (4): `workspace-info`, `workspace-list`, `workspace-update`, `workspace-link`
195
+ - **Azure Sync** (10): `azure-sync-discover`, `azure-sync-push`, `azure-sync-pull`, `azure-sync-sync`, `azure-pr-create`...
196
+ - **Bootstrap** (3): `jarvis-bootstrap`, `jarvis-healthcheck`, `jarvis-terminal-commands`
197
+ - **Domain Map** (2): `domain-map-analyze`, `domain-map-view`
198
+
199
+ For detailed workflows, load the appropriate skill (see below).
200
+
201
+ ## Available Skills
202
+
203
+ Load skills via the `skill()` tool to get detailed workflow instructions:
204
+
205
+ - **`jarvis-kanban`** — Full kanban lifecycle: card creation, grooming, sprint management, gate tasks
206
+ - **`jarvis-azure-sync`** — Azure DevOps sync: push/pull/bidi-sync, PR creation, poll events
207
+ - **`jarvis-onboarding`** — Setup, healthcheck, RAG indexing, tool group reference
208
+
209
+ ### Available Commands
210
+
211
+ Use these slash commands for common operations:
212
+
213
+ - **`/healthcheck`** — Run diagnostics and get actionable fix guidance
214
+ - **`/sync-azure`** — Execute Azure DevOps sync workflow
215
+ - **`/start-card CD-XXX`** — Start working on a specific card (handles full lifecycle)
216
+
217
+ When you encounter an unfamiliar workflow, ALWAYS load the relevant skill first.
218
+
219
+ ## Knowledge Search — RAG & ORACLE
220
+
221
+ Before creating or modifying code, ALWAYS search first:
222
+
223
+ - **`rag-search`** / **`rag-snippet`** — Search the codebase semantically
224
+ - **`rag-oracle-search`** — Search curated framework documentation (governance, workflows, patterns)
225
+
226
+ When you don't know how to do something, search ORACLE:
227
+ ```
228
+ rag-oracle-search query="how to sync azure devops"
229
+ rag-oracle-search query="kanban grooming requirements" domain="workflows"
230
+ ```
231
+
232
+ ORACLE domains: `governance`, `workflows`, `patterns`, `quick_reference`.