opencode-metis 0.1.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 +140 -0
- package/dist/cli.cjs +63 -0
- package/dist/mcp-server.cjs +51 -0
- package/dist/plugin.cjs +4 -0
- package/dist/worker.cjs +224 -0
- package/opencode/agent/the-analyst/feature-prioritization.md +66 -0
- package/opencode/agent/the-analyst/market-research.md +77 -0
- package/opencode/agent/the-analyst/project-coordination.md +81 -0
- package/opencode/agent/the-analyst/requirements-analysis.md +77 -0
- package/opencode/agent/the-architect/compatibility-review.md +138 -0
- package/opencode/agent/the-architect/complexity-review.md +137 -0
- package/opencode/agent/the-architect/quality-review.md +67 -0
- package/opencode/agent/the-architect/security-review.md +127 -0
- package/opencode/agent/the-architect/system-architecture.md +119 -0
- package/opencode/agent/the-architect/system-documentation.md +83 -0
- package/opencode/agent/the-architect/technology-research.md +85 -0
- package/opencode/agent/the-chief.md +79 -0
- package/opencode/agent/the-designer/accessibility-implementation.md +101 -0
- package/opencode/agent/the-designer/design-foundation.md +74 -0
- package/opencode/agent/the-designer/interaction-architecture.md +75 -0
- package/opencode/agent/the-designer/user-research.md +70 -0
- package/opencode/agent/the-meta-agent.md +155 -0
- package/opencode/agent/the-platform-engineer/ci-cd-pipelines.md +109 -0
- package/opencode/agent/the-platform-engineer/containerization.md +106 -0
- package/opencode/agent/the-platform-engineer/data-architecture.md +81 -0
- package/opencode/agent/the-platform-engineer/dependency-review.md +144 -0
- package/opencode/agent/the-platform-engineer/deployment-automation.md +81 -0
- package/opencode/agent/the-platform-engineer/infrastructure-as-code.md +107 -0
- package/opencode/agent/the-platform-engineer/performance-tuning.md +82 -0
- package/opencode/agent/the-platform-engineer/pipeline-engineering.md +81 -0
- package/opencode/agent/the-platform-engineer/production-monitoring.md +105 -0
- package/opencode/agent/the-qa-engineer/exploratory-testing.md +66 -0
- package/opencode/agent/the-qa-engineer/performance-testing.md +81 -0
- package/opencode/agent/the-qa-engineer/quality-assurance.md +77 -0
- package/opencode/agent/the-qa-engineer/test-execution.md +66 -0
- package/opencode/agent/the-software-engineer/api-development.md +78 -0
- package/opencode/agent/the-software-engineer/component-development.md +79 -0
- package/opencode/agent/the-software-engineer/concurrency-review.md +141 -0
- package/opencode/agent/the-software-engineer/domain-modeling.md +66 -0
- package/opencode/agent/the-software-engineer/performance-optimization.md +113 -0
- package/opencode/command/analyze.md +149 -0
- package/opencode/command/constitution.md +178 -0
- package/opencode/command/debug.md +194 -0
- package/opencode/command/document.md +178 -0
- package/opencode/command/implement.md +225 -0
- package/opencode/command/refactor.md +207 -0
- package/opencode/command/review.md +229 -0
- package/opencode/command/simplify.md +267 -0
- package/opencode/command/specify.md +191 -0
- package/opencode/command/validate.md +224 -0
- package/opencode/skill/accessibility-design/SKILL.md +566 -0
- package/opencode/skill/accessibility-design/checklists/wcag-checklist.md +435 -0
- package/opencode/skill/agent-coordination/SKILL.md +224 -0
- package/opencode/skill/api-contract-design/SKILL.md +550 -0
- package/opencode/skill/api-contract-design/templates/graphql-schema-template.md +818 -0
- package/opencode/skill/api-contract-design/templates/rest-api-template.md +417 -0
- package/opencode/skill/architecture-design/SKILL.md +160 -0
- package/opencode/skill/architecture-design/examples/architecture-examples.md +170 -0
- package/opencode/skill/architecture-design/template.md +749 -0
- package/opencode/skill/architecture-design/validation.md +99 -0
- package/opencode/skill/architecture-selection/SKILL.md +522 -0
- package/opencode/skill/architecture-selection/examples/adrs/001-example-adr.md +71 -0
- package/opencode/skill/architecture-selection/examples/architecture-patterns.md +239 -0
- package/opencode/skill/bug-diagnosis/SKILL.md +235 -0
- package/opencode/skill/code-quality-review/SKILL.md +337 -0
- package/opencode/skill/code-quality-review/examples/anti-patterns.md +629 -0
- package/opencode/skill/code-quality-review/reference.md +322 -0
- package/opencode/skill/code-review/SKILL.md +363 -0
- package/opencode/skill/code-review/reference.md +450 -0
- package/opencode/skill/codebase-analysis/SKILL.md +139 -0
- package/opencode/skill/codebase-navigation/SKILL.md +227 -0
- package/opencode/skill/codebase-navigation/examples/exploration-patterns.md +263 -0
- package/opencode/skill/coding-conventions/SKILL.md +178 -0
- package/opencode/skill/coding-conventions/checklists/accessibility-checklist.md +176 -0
- package/opencode/skill/coding-conventions/checklists/performance-checklist.md +154 -0
- package/opencode/skill/coding-conventions/checklists/security-checklist.md +127 -0
- package/opencode/skill/constitution-validation/SKILL.md +315 -0
- package/opencode/skill/constitution-validation/examples/CONSTITUTION.md +202 -0
- package/opencode/skill/constitution-validation/reference/rule-patterns.md +328 -0
- package/opencode/skill/constitution-validation/template.md +115 -0
- package/opencode/skill/context-preservation/SKILL.md +445 -0
- package/opencode/skill/data-modeling/SKILL.md +385 -0
- package/opencode/skill/data-modeling/templates/schema-design-template.md +268 -0
- package/opencode/skill/deployment-pipeline-design/SKILL.md +579 -0
- package/opencode/skill/deployment-pipeline-design/templates/pipeline-template.md +633 -0
- package/opencode/skill/documentation-extraction/SKILL.md +259 -0
- package/opencode/skill/documentation-sync/SKILL.md +431 -0
- package/opencode/skill/domain-driven-design/SKILL.md +509 -0
- package/opencode/skill/domain-driven-design/examples/ddd-patterns.md +688 -0
- package/opencode/skill/domain-driven-design/reference.md +465 -0
- package/opencode/skill/drift-detection/SKILL.md +383 -0
- package/opencode/skill/drift-detection/reference.md +340 -0
- package/opencode/skill/error-recovery/SKILL.md +162 -0
- package/opencode/skill/error-recovery/examples/error-patterns.md +484 -0
- package/opencode/skill/feature-prioritization/SKILL.md +419 -0
- package/opencode/skill/feature-prioritization/examples/rice-template.md +139 -0
- package/opencode/skill/feature-prioritization/reference.md +256 -0
- package/opencode/skill/git-workflow/SKILL.md +453 -0
- package/opencode/skill/implementation-planning/SKILL.md +215 -0
- package/opencode/skill/implementation-planning/examples/phase-examples.md +217 -0
- package/opencode/skill/implementation-planning/template.md +220 -0
- package/opencode/skill/implementation-planning/validation.md +88 -0
- package/opencode/skill/implementation-verification/SKILL.md +272 -0
- package/opencode/skill/knowledge-capture/SKILL.md +265 -0
- package/opencode/skill/knowledge-capture/reference/knowledge-capture.md +402 -0
- package/opencode/skill/knowledge-capture/reference.md +444 -0
- package/opencode/skill/knowledge-capture/templates/domain-template.md +325 -0
- package/opencode/skill/knowledge-capture/templates/interface-template.md +255 -0
- package/opencode/skill/knowledge-capture/templates/pattern-template.md +144 -0
- package/opencode/skill/observability-design/SKILL.md +291 -0
- package/opencode/skill/observability-design/references/monitoring-patterns.md +461 -0
- package/opencode/skill/pattern-detection/SKILL.md +171 -0
- package/opencode/skill/pattern-detection/examples/common-patterns.md +359 -0
- package/opencode/skill/performance-analysis/SKILL.md +266 -0
- package/opencode/skill/performance-analysis/references/profiling-tools.md +499 -0
- package/opencode/skill/requirements-analysis/SKILL.md +139 -0
- package/opencode/skill/requirements-analysis/examples/good-prd.md +66 -0
- package/opencode/skill/requirements-analysis/template.md +177 -0
- package/opencode/skill/requirements-analysis/validation.md +69 -0
- package/opencode/skill/requirements-elicitation/SKILL.md +518 -0
- package/opencode/skill/requirements-elicitation/examples/interview-questions.md +226 -0
- package/opencode/skill/requirements-elicitation/examples/user-stories.md +414 -0
- package/opencode/skill/safe-refactoring/SKILL.md +312 -0
- package/opencode/skill/safe-refactoring/reference/code-smells.md +347 -0
- package/opencode/skill/security-assessment/SKILL.md +421 -0
- package/opencode/skill/security-assessment/checklists/security-review-checklist.md +285 -0
- package/opencode/skill/specification-management/SKILL.md +143 -0
- package/opencode/skill/specification-management/readme-template.md +32 -0
- package/opencode/skill/specification-management/reference.md +115 -0
- package/opencode/skill/specification-management/spec.py +229 -0
- package/opencode/skill/specification-validation/SKILL.md +397 -0
- package/opencode/skill/specification-validation/reference/3cs-framework.md +306 -0
- package/opencode/skill/specification-validation/reference/ambiguity-detection.md +132 -0
- package/opencode/skill/specification-validation/reference/constitution-validation.md +301 -0
- package/opencode/skill/specification-validation/reference/drift-detection.md +383 -0
- package/opencode/skill/task-delegation/SKILL.md +607 -0
- package/opencode/skill/task-delegation/examples/file-coordination.md +495 -0
- package/opencode/skill/task-delegation/examples/parallel-research.md +337 -0
- package/opencode/skill/task-delegation/examples/sequential-build.md +504 -0
- package/opencode/skill/task-delegation/reference.md +825 -0
- package/opencode/skill/tech-stack-detection/SKILL.md +89 -0
- package/opencode/skill/tech-stack-detection/references/framework-signatures.md +598 -0
- package/opencode/skill/technical-writing/SKILL.md +190 -0
- package/opencode/skill/technical-writing/templates/adr-template.md +205 -0
- package/opencode/skill/technical-writing/templates/system-doc-template.md +380 -0
- package/opencode/skill/test-design/SKILL.md +464 -0
- package/opencode/skill/test-design/examples/test-pyramid.md +724 -0
- package/opencode/skill/testing/SKILL.md +213 -0
- package/opencode/skill/testing/examples/test-pyramid.md +724 -0
- package/opencode/skill/user-insight-synthesis/SKILL.md +576 -0
- package/opencode/skill/user-insight-synthesis/templates/research-plan-template.md +217 -0
- package/opencode/skill/user-research/SKILL.md +508 -0
- package/opencode/skill/user-research/examples/interview-questions.md +265 -0
- package/opencode/skill/user-research/examples/personas.md +267 -0
- package/opencode/skill/vibe-security/SKILL.md +654 -0
- package/package.json +45 -0
package/dist/plugin.cjs
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";var T=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var B=Object.prototype.hasOwnProperty;var G=(e,t)=>{for(var n in t)T(e,n,{get:t[n],enumerable:!0})},H=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of W(t))!B.call(e,r)&&r!==n&&T(e,r,{get:()=>t[r],enumerable:!(o=U(t,r))||o.enumerable});return e};var q=e=>H(T({},"__esModule",{value:!0}),e);var $e={};G($e,{default:()=>L});module.exports=q($e);async function I(e,t,n,o){let r=`${t}/api/context/inject?project=${encodeURIComponent(e.project.name)}`;try{let s=await fetch(r,{signal:AbortSignal.timeout(3e3)});if(!s.ok){e.client.app.log("warn","Failed to load memory context",{status:s.status});return}let i=await s.json();i.context&&(o.messages=o.messages??[],o.messages.push({role:"system",content:i.context}))}catch(s){e.client.app.log("warn","Memory context injection failed",{error:s instanceof Error?s.message:String(s)})}}async function O(e,t,n,o){J(e,t,n,o).catch(r=>{e.client.app.log("warn","Observation capture failed",{error:r instanceof Error?r.message:String(r)})})}async function J(e,t,n,o){let r={text:`Tool ${n.tool}: ${K(n,o)}`,title:`${n.tool} execution`,project:e.project.name};await fetch(`${t}/api/memory/save`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r),signal:AbortSignal.timeout(15e3)})}function K(e,t){let n=t.output??t.error??"",o=X(e.input),r=n.slice(0,200).trim();return o&&r?`${o} -> ${r}`:o||r||"(no details)"}function X(e){let t=Object.entries(e);return t.length===0?"":t.map(([n,o])=>`${n}=${String(o).slice(0,80)}`).join(", ")}var d=require("fs");var h=require("os"),c=require("path"),P=41777,b="127.0.0.1",Y=(0,c.join)((0,h.homedir)(),".config","opencode"),De=(0,c.join)(Y,"opencode.json"),m=(0,c.join)((0,h.homedir)(),".config","opencode","memory"),z="memory.db",V="settings.json",Ae=(0,c.join)(m,"worker.pid");var Ne=(0,c.join)(m,z),C=(0,c.join)(m,V),Le=(0,c.join)(m,"logs"),Ue=(0,c.join)(m,"models"),We=(0,c.join)(m,"vector-db");var E={workerPort:P,workerBind:b,chromaDbUrl:"http://localhost:8000",recencyWindowDays:90,retentionDays:365,tddEnabled:!0,fileLengthWarn:300,fileLengthCritical:500,testFilePatterns:["*.test.ts","*.spec.ts","*_test.go","test_*.py"],toolRedirectRules:[]},u=null;function g(){if(u!==null)return u;if(!(0,d.existsSync)(C))return u={...E},u;try{let e=(0,d.readFileSync)(C,"utf-8"),t=JSON.parse(e);return u={...E,...t},u}catch{return u={...E},u}}function _(){let e=g();return`http://${e.workerBind}:${e.workerPort}`}function Q(){let e=process.env.MEMORY_TOOL_REDIRECT_RULES;if(e!==void 0)try{return JSON.parse(e)}catch{return[]}return g().toolRedirectRules}function Z(e){if(typeof e!="object"||e===null)return!1;let t=e;return typeof t.tool=="string"&&(t.action==="deny"||t.action==="redirect")}function ee(e){return e.message??`Tool '${e.tool}' is blocked by project configuration.`}function te(e){let t=e.message??`Tool '${e.tool}' has been redirected.`;return e.alternative?`${t} Suggested alternative: ${e.alternative}.`:t}function ne(e,t){t.blocked=!0,t.messages=[{role:"user",content:ee(e)}]}function oe(e,t){t.messages=[{role:"user",content:te(e)}]}async function v(e,t,n,o){let r=Q();for(let s of r)try{if(!Z(s))throw new Error("Invalid rule: tool must be a string and action must be 'deny' or 'redirect'");if(s.tool!==n.tool)continue;s.action==="deny"?ne(s,o):oe(s,o);return}catch(i){e.client.app.log("warn","Tool redirect rule evaluation failed",{error:i instanceof Error?i.message:String(i),rule:JSON.stringify(s)})}}function re(e){let{context:t}=e;return t?!!(t.requested||t.investigated||t.learned||t.completed):!1}function se(e){let t=e.context??{};return["Session Summary:",`Requested: ${t.requested??"Not specified"}`,`Investigated: ${t.investigated??"Not specified"}`,`Learned: ${t.learned??"Not specified"}`,`Completed: ${t.completed??"Not specified"}`].join(`
|
|
2
|
+
`)}async function w(e,t,n,o){if(re(n))try{let r=await fetch(`${t}/api/memory/save`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"session-summary",title:`Session Summary: ${n.sessionId}`,text:se(n),project:e.project.name}),signal:AbortSignal.timeout(15e3)});r.ok||e.client.app.log("warn","Failed to save session summary",{status:r.status})}catch(r){e.client.app.log("warn","Session summary save failed",{error:r instanceof Error?r.message:String(r)})}}var y=require("fs"),f=require("path"),k=require("os"),ie=5e3;function ae(){return process.env.OPENCODE_SESSIONS_DIR??(0,f.join)((0,k.homedir)(),".config","opencode","sessions")}function ce(e){return{sessionId:e.sessionId,activePlan:e.context?.activePlan??null,currentTask:e.context?.currentTask??null,summary:e.context?.summary??null,timestamp:new Date().toISOString(),type:"compaction-state"}}async function le(e,t){try{return(await fetch(`${e}/api/memory/save`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:AbortSignal.timeout(ie)})).ok}catch{return!1}}function ue(e,t){let n=(0,f.join)(ae(),"sessions",e);(0,y.mkdirSync)(n,{recursive:!0});let o=(0,f.join)(n,"pre-compact-state.json");(0,y.writeFileSync)(o,JSON.stringify(t,null,2),"utf-8")}async function $(e,t,n,o){let r=ce(n);if(!await le(t,r))try{ue(n.sessionId,r)}catch(i){e.client.app.log("warn","Failed to write compaction fallback file",{error:i instanceof Error?i.message:String(i),sessionId:n.sessionId})}}var p=require("fs"),x=require("path"),M=require("os"),me=5e3;function pe(){return process.env.OPENCODE_SESSIONS_DIR??(0,x.join)((0,M.homedir)(),".config","opencode","sessions")}function ge(e){return(0,x.join)(pe(),"sessions",e,"pre-compact-state.json")}function de(e){let t=["[Memory Context Restored After Compaction]"];return e.activePlan&&t.push(`Active plan: ${e.activePlan}`),e.currentTask&&t.push(`Current task: ${e.currentTask}`),e.status&&t.push(`Status: ${e.status}`),e.summary&&t.push(`Recent context: ${e.summary}`),t.join(`
|
|
3
|
+
`)}async function fe(e,t){let n=`${e}/api/context/inject?project=${encodeURIComponent(t)}`,o=await fetch(n,{signal:AbortSignal.timeout(me)});return o.ok?(await o.json()).context??null:null}function ye(e){let t=ge(e);if(!(0,p.existsSync)(t))return null;try{let n=(0,p.readFileSync)(t,"utf-8"),o=JSON.parse(n);return(0,p.unlinkSync)(t),o}catch{return null}}function j(e,t){e.messages=e.messages??[],e.messages.push({role:"user",content:t})}async function F(e,t,n,o){try{let r=null;try{r=await fe(t,e.project.name)}catch(i){if(i instanceof TypeError)throw i}if(r){j(o,r);return}let s=ye(n.sessionId);if(s){let i=de(s);j(o,i)}}catch(r){e.client.app.log("warn","Compacted state restore failed",{error:r instanceof Error?r.message:String(r),sessionId:n.sessionId})}}var D=require("fs"),a=require("path");var Se=300,Te=500,he=["*.test.ts","*.spec.ts","*_test.go","test_*.py"];function Ce(e,t){let n=t.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp(`^${n}$`).test(e)}function Ee(e,t){let n=(0,a.basename)(e);return t.some(o=>Ce(n,o))}function xe(e,t){let n=(0,a.dirname)(e),o=(0,a.extname)(e),r=(0,a.basename)(e,o),s=[];for(let i of t)if(i.startsWith("*.")){let l=i.slice(1);s.push((0,a.join)(n,`${r}${l}`))}else if(i.endsWith("*")){let l=i.slice(0,-1);s.push((0,a.join)(n,`${l}${r}${o}`))}return s}function R(e,t){e.messages=e.messages??[],e.messages.push({role:"system",content:t})}function Re(e,t,n,o){if(Ee(t,n))return;let r=xe(t,n),s=e.project.root;r.some(l=>{let S=l.startsWith("/")?l:(0,a.join)(s,l);return(0,D.existsSync)(S)})||R(o,`\u26A0\uFE0F TDD Warning: No test file found for ${t}. Consider writing tests first (Red-Green-Refactor).`)}function Ie(e,t,n,o,r){if(t>o){R(r,`\u{1F6A8} File Length Critical: ${e} has ${t} lines. This file should be refactored.`);return}t>n&&R(r,`\u26A0\uFE0F File Length Warning: ${e} has ${t} lines. Consider splitting this file.`)}async function A(e,t,n,o){try{let r=g(),s=n.testFilePatterns??r.testFilePatterns??he,i=n.fileLengthWarn??r.fileLengthWarn??Se,l=n.fileLengthCritical??r.fileLengthCritical??Te;Re(e,n.filePath,s,o);let S=n.lineCount??0;Ie(n.filePath,S,i,l,o)}catch(r){e.client.app.log("warn","File edited check failed",{error:r instanceof Error?r.message:String(r),filePath:n.filePath})}}function N(e,t){return[Oe(e,t),Pe(e,t)]}function Oe(e,t){return{name:"memory_search",description:"Search memory observations by topic or keyword",parameters:{query:{type:"string",description:"The search query or topic to look up in memory",required:!0},limit:{type:"number",description:"Maximum number of results to return (default 20)"},project:{type:"string",description:"Filter results to a specific project name"}},execute:n=>be(e,t,n)}}function Pe(e,t){return{name:"memory_save",description:"Save an observation to memory for future reference",parameters:{text:{type:"string",description:"The observation text to save to memory",required:!0},title:{type:"string",description:"Optional short title summarising the observation"}},execute:n=>_e(e,t,n)}}async function be(e,t,n){try{let o=ve(t,n),r=await fetch(o,{signal:AbortSignal.timeout(1e4)});if(!r.ok)return{result:`Error: Worker returned status ${r.status}`};let s=await r.json();return{result:we(s.results??[])}}catch(o){return e.client.app.log("warn","memory_search failed",{error:o instanceof Error?o.message:String(o)}),{result:`Error: ${o instanceof Error?o.message:String(o)}`}}}async function _e(e,t,n){try{let o={text:n.text};n.title!==void 0&&(o.title=n.title);let r=await fetch(`${t}/api/memory/save`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o),signal:AbortSignal.timeout(1e4)});if(!r.ok)return{result:`Error: Worker returned status ${r.status}`};let s=await r.json();return{result:ke(s)}}catch(o){return e.client.app.log("warn","memory_save failed",{error:o instanceof Error?o.message:String(o)}),{result:`Error: ${o instanceof Error?o.message:String(o)}`}}}function ve(e,t){let n=new URLSearchParams;return n.set("query",String(t.query??"")),t.limit!==void 0&&n.set("limit",String(t.limit)),t.project!==void 0&&n.set("project",String(t.project)),`${e}/api/search?${n.toString()}`}function we(e){return e.length===0?"No results found for the given query.":e.map(t=>`[${t.id}] ${t.title} (${t.type}, ${t.project}) \u2014 ${t.summary}`).join(`
|
|
4
|
+
`)}function ke(e){let t=e.id??"unknown",n=e.title??"(untitled)";return`Saved observation #${t}: "${n}"`}async function L(e){let t=_();return N(e,t),{"session.created":(n,o)=>I(e,t,n,o),"tool.execute.after":(n,o)=>O(e,t,n,o),"tool.execute.before":(n,o)=>v(e,t,n,o),"session.idle":(n,o)=>w(e,t,n,o),"experimental.session.compacting":(n,o)=>$(e,t,n,o),"session.compacted":(n,o)=>F(e,t,n,o),"file.edited":(n,o)=>A(e,t,n,o)}}
|