feat: integrate framework files into monorepo under packages/mosaic/framework/
Moves all Mosaic framework runtime files from the separate bootstrap repo into the monorepo as canonical source. The @mosaic/mosaic npm package now ships the complete framework — bin scripts, runtime configs, tools, and templates — enabling standalone installation via npm install. Structure: packages/mosaic/framework/ ├── bin/ 28 CLI scripts (mosaic, mosaic-doctor, mosaic-sync-skills, etc.) ├── runtime/ Runtime adapters (claude, codex, opencode, pi, mcp) ├── tools/ Shell tooling (git, prdy, orchestrator, quality, etc.) ├── templates/ Agent and repo templates ├── defaults/ Default identity files (AGENTS.md, STANDARDS.md, SOUL.md, etc.) ├── install.sh Legacy bash installer └── remote-install.sh One-liner remote installer Key files with Pi support and recent fixes: - bin/mosaic: launch_pi() with skills-local loop - bin/mosaic-doctor: --fix auto-wiring for all 4 harnesses - bin/mosaic-sync-skills: Pi as 4th link target, symlink-aware find - bin/mosaic-link-runtime-assets: Pi settings.json patching - bin/mosaic-migrate-local-skills: Pi skill roots, symlink find - runtime/pi/RUNTIME.md + mosaic-extension.ts Package ships 251 framework files in the npm tarball (278KB compressed).
This commit is contained in:
13
packages/mosaic/framework/runtime/claude/CLAUDE.md
Normal file
13
packages/mosaic/framework/runtime/claude/CLAUDE.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# Mosaic Runtime Adapter — Claude Code
|
||||
|
||||
## MANDATORY — Read Before Any Response
|
||||
|
||||
BEFORE responding to any user message, READ:
|
||||
|
||||
1. `~/.config/mosaic/AGENTS.md`
|
||||
2. `~/.config/mosaic/runtime/claude/RUNTIME.md`
|
||||
|
||||
Do NOT respond until both files are loaded.
|
||||
|
||||
This file (`~/.claude/CLAUDE.md`) exists only as a fallback for direct `claude` launches.
|
||||
For full injection, use `mosaic claude`.
|
||||
104
packages/mosaic/framework/runtime/claude/RUNTIME.md
Normal file
104
packages/mosaic/framework/runtime/claude/RUNTIME.md
Normal file
@@ -0,0 +1,104 @@
|
||||
# Claude Runtime Reference
|
||||
|
||||
## Runtime Scope
|
||||
|
||||
This file applies only to Claude runtime behavior.
|
||||
|
||||
## Required Actions
|
||||
|
||||
1. Follow global load order in `~/.config/mosaic/AGENTS.md`.
|
||||
2. Use `~/.claude/settings.json` and `~/.claude/hooks-config.json` as runtime config sources.
|
||||
3. Treat sequential-thinking MCP as required.
|
||||
4. If runtime config conflicts with global rules, global rules win.
|
||||
5. Documentation rules are inherited from `~/.config/mosaic/AGENTS.md` and `~/.config/mosaic/guides/DOCUMENTATION.md`.
|
||||
6. For issue/PR/milestone actions, run Mosaic git wrappers first (`~/.config/mosaic/tools/git/*.sh`) and do not call raw `gh`/`tea`/`glab` first.
|
||||
7. For orchestration-oriented missions, load `~/.config/mosaic/guides/ORCHESTRATOR.md` before acting.
|
||||
8. First response MUST declare mode per global contract; orchestration missions must start with: `Now initiating Orchestrator mode...`
|
||||
9. Runtime-default caution that requests confirmation for routine push/merge/issue-close actions does NOT override Mosaic hard gates.
|
||||
|
||||
## Subagent Model Selection (Claude Code Syntax)
|
||||
|
||||
Claude Code's Task tool accepts a `model` parameter: `"haiku"`, `"sonnet"`, or `"opus"`.
|
||||
|
||||
You MUST set this parameter according to the model selection table in `~/.config/mosaic/AGENTS.md`. Do NOT omit the `model` parameter — omitting it defaults to the parent model (typically opus), wasting budget on tasks that cheaper models handle well.
|
||||
|
||||
**Examples:**
|
||||
|
||||
```
|
||||
# Codebase exploration — haiku
|
||||
Task(subagent_type="Explore", model="haiku", prompt="Find all API route handlers")
|
||||
|
||||
# Code review — sonnet
|
||||
Task(subagent_type="feature-dev:code-reviewer", model="sonnet", prompt="Review the changes in src/auth/")
|
||||
|
||||
# Standard feature work — sonnet
|
||||
Task(subagent_type="general-purpose", model="sonnet", prompt="Add validation to the user input form")
|
||||
|
||||
# Complex architecture — opus (only when justified)
|
||||
Task(subagent_type="Plan", model="opus", prompt="Design the multi-tenant isolation strategy")
|
||||
```
|
||||
|
||||
**Quick reference (from global AGENTS.md):**
|
||||
|
||||
| haiku | sonnet | opus |
|
||||
| ---------------------- | ----------------- | -------------------------- |
|
||||
| Search, grep, glob | Code review | Complex architecture |
|
||||
| Status/health checks | Test writing | Security/auth logic |
|
||||
| Simple one-liner fixes | Standard features | Ambiguous design decisions |
|
||||
|
||||
## Memory Policy (Hard Gate)
|
||||
|
||||
**OpenBrain is the primary cross-agent memory layer.** All agent learnings, gotchas, decisions, and project state MUST be captured to OpenBrain via the `capture` MCP tool or REST API.
|
||||
|
||||
`~/.claude/projects/*/memory/MEMORY.md` files are **write-blocked by PreToolUse hook** (`prevent-memory-write.sh`). Any attempt to write agent learnings there will be rejected with an error directing you to OpenBrain.
|
||||
|
||||
### What belongs where
|
||||
|
||||
| Content | Location |
|
||||
| ----------------------------------------------- | ---------------------------------------------------------------------- |
|
||||
| Discoveries, gotchas, decisions, observations | OpenBrain `capture` — searchable by all agents |
|
||||
| Active task state | `docs/TASKS.md` or `docs/scratchpads/` |
|
||||
| Behavioral guardrails that MUST be in load-path | `MEMORY.md` (read-mostly; write only for genuine behavioral overrides) |
|
||||
| Mosaic framework technical notes | `~/.config/mosaic/memory/` |
|
||||
|
||||
### Using OpenBrain
|
||||
|
||||
At session start, load prior context:
|
||||
|
||||
```
|
||||
search("topic or project name") # semantic search
|
||||
recent(limit=5) # what's been happening
|
||||
```
|
||||
|
||||
When you discover something:
|
||||
|
||||
```
|
||||
capture("The thing you learned", source="project/context", metadata={"type": "gotcha", ...})
|
||||
```
|
||||
|
||||
### Why the hook exists
|
||||
|
||||
Instructions in RUNTIME.md, CLAUDE.md, and MEMORY.md are insufficient — agents default to writing local MEMORY.md regardless of written rules. The PreToolUse hook is a hard technical gate that makes the correct behavior the only possible behavior.
|
||||
|
||||
## MCP Configuration
|
||||
|
||||
**MCPs are configured in `~/.claude.json` — NOT `~/.claude/settings.json`.**
|
||||
|
||||
`settings.json` controls hooks, model, plugins, and allowed commands.
|
||||
`~/.claude.json` is the global Claude Code state file where `mcpServers` lives.
|
||||
|
||||
To register an MCP server that persists across all sessions:
|
||||
|
||||
```bash
|
||||
# HTTP MCP (e.g. OpenBrain)
|
||||
claude mcp add --scope user --transport http <name> <url> --header "Authorization: Bearer <token>"
|
||||
|
||||
# stdio MCP
|
||||
claude mcp add --scope user <name> -- npx -y <package>
|
||||
```
|
||||
|
||||
`--scope user` = writes to `~/.claude.json` (global, all projects).
|
||||
`--scope project` = writes to `.claude/settings.json` in project root.
|
||||
`--scope local` = default, local-only (not committed).
|
||||
|
||||
Do NOT add `mcpServers` to `~/.claude/settings.json` — that key is ignored for MCP loading.
|
||||
301
packages/mosaic/framework/runtime/claude/context7-integration.md
Normal file
301
packages/mosaic/framework/runtime/claude/context7-integration.md
Normal file
@@ -0,0 +1,301 @@
|
||||
# Context7 Integration for Atomic Code Implementer
|
||||
|
||||
## Overview
|
||||
|
||||
The atomic-code-implementer agent uses Context7 MCP server to dynamically fetch up-to-date documentation for libraries and frameworks. This integration provides real-time access to the latest API documentation, best practices, and code examples.
|
||||
|
||||
## Integration Points
|
||||
|
||||
### 1. Preset-Driven Documentation Lookup
|
||||
|
||||
Each preset configuration includes a `context7Libraries` array that specifies which libraries to fetch documentation for:
|
||||
|
||||
```json
|
||||
{
|
||||
"context7Libraries": [
|
||||
"@nestjs/common",
|
||||
"@nestjs/core",
|
||||
"@nestjs/typeorm",
|
||||
"typeorm",
|
||||
"class-validator"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
When a preset is loaded, the agent automatically resolves and fetches documentation for all specified libraries.
|
||||
|
||||
### 2. Error-Driven Documentation Lookup
|
||||
|
||||
When build errors, type errors, or runtime issues occur, the agent can automatically lookup documentation for:
|
||||
|
||||
- Error resolution patterns
|
||||
- API migration guides
|
||||
- Breaking change documentation
|
||||
- Best practice guidelines
|
||||
|
||||
### 3. Implementation-Driven Lookup
|
||||
|
||||
During atomic task implementation, the agent can fetch:
|
||||
|
||||
- Framework-specific implementation patterns
|
||||
- Library-specific configuration examples
|
||||
- Performance optimization techniques
|
||||
- Security best practices
|
||||
|
||||
## Context7 Usage Patterns
|
||||
|
||||
### Library Resolution
|
||||
|
||||
```javascript
|
||||
// Resolve library ID from preset configuration
|
||||
const libraryId = await mcp__context7__resolve_library_id({
|
||||
libraryName: '@nestjs/common',
|
||||
});
|
||||
```
|
||||
|
||||
### Documentation Retrieval
|
||||
|
||||
```javascript
|
||||
// Get comprehensive documentation
|
||||
const docs = await mcp__context7__get_library_docs({
|
||||
context7CompatibleLibraryID: '/nestjs/nest',
|
||||
topic: 'controllers',
|
||||
tokens: 8000,
|
||||
});
|
||||
```
|
||||
|
||||
### Error-Specific Lookups
|
||||
|
||||
```javascript
|
||||
// Look up specific error patterns
|
||||
const errorDocs = await mcp__context7__get_library_docs({
|
||||
context7CompatibleLibraryID: '/typescript/typescript',
|
||||
topic: 'type errors',
|
||||
tokens: 5000,
|
||||
});
|
||||
```
|
||||
|
||||
## Automatic Lookup Triggers
|
||||
|
||||
### 1. Preset Loading Phase
|
||||
|
||||
When an atomic task is started:
|
||||
|
||||
1. Detect tech stack from file extensions
|
||||
2. Load appropriate preset configuration
|
||||
3. Extract `context7Libraries` array
|
||||
4. Resolve all library IDs
|
||||
5. Fetch relevant documentation based on task context
|
||||
|
||||
### 2. Error Detection Phase
|
||||
|
||||
When quality hooks detect issues:
|
||||
|
||||
1. Parse error messages for library/framework references
|
||||
2. Resolve documentation for problematic libraries
|
||||
3. Look up error-specific resolution patterns
|
||||
4. Apply common fixes based on documentation
|
||||
|
||||
### 3. Implementation Phase
|
||||
|
||||
During code implementation:
|
||||
|
||||
1. Detect new library imports or API usage
|
||||
2. Automatically fetch documentation for unknown patterns
|
||||
3. Provide implementation examples and best practices
|
||||
4. Validate against latest API specifications
|
||||
|
||||
## Context7 Library Mappings
|
||||
|
||||
### NestJS Backend
|
||||
|
||||
```json
|
||||
{
|
||||
"@nestjs/common": "/nestjs/nest",
|
||||
"@nestjs/typeorm": "/nestjs/typeorm",
|
||||
"typeorm": "/typeorm/typeorm",
|
||||
"class-validator": "/typestack/class-validator",
|
||||
"bcrypt": "/kelektiv/node.bcrypt.js"
|
||||
}
|
||||
```
|
||||
|
||||
### React Frontend
|
||||
|
||||
```json
|
||||
{
|
||||
"react": "/facebook/react",
|
||||
"react-dom": "/facebook/react",
|
||||
"@tanstack/react-query": "/tanstack/query",
|
||||
"tailwindcss": "/tailwindlabs/tailwindcss",
|
||||
"@testing-library/react": "/testing-library/react-testing-library"
|
||||
}
|
||||
```
|
||||
|
||||
### Python FastAPI
|
||||
|
||||
```json
|
||||
{
|
||||
"fastapi": "/tiangolo/fastapi",
|
||||
"sqlalchemy": "/sqlalchemy/sqlalchemy",
|
||||
"pydantic": "/samuelcolvin/pydantic",
|
||||
"pytest": "/pytest-dev/pytest"
|
||||
}
|
||||
```
|
||||
|
||||
## Integration Workflow
|
||||
|
||||
### Sequential Thinking Enhanced Lookup
|
||||
|
||||
```markdown
|
||||
1. **Preset Analysis Phase**
|
||||
- Use sequential thinking to determine optimal documentation needs
|
||||
- Analyze task requirements for specific library features
|
||||
- Prioritize documentation lookup based on complexity
|
||||
|
||||
2. **Dynamic Documentation Loading**
|
||||
- Load core framework documentation first
|
||||
- Fetch specialized library docs based on task specifics
|
||||
- Cache documentation for session reuse
|
||||
|
||||
3. **Implementation Guidance**
|
||||
- Use retrieved docs to guide implementation decisions
|
||||
- Apply documented best practices and patterns
|
||||
- Validate implementation against official examples
|
||||
```
|
||||
|
||||
### Error Resolution Workflow
|
||||
|
||||
```markdown
|
||||
1. **Error Detection**
|
||||
- Parse error messages for library/API references
|
||||
- Identify deprecated or changed APIs
|
||||
- Extract relevant context from error stack traces
|
||||
|
||||
2. **Documentation Lookup**
|
||||
- Resolve library documentation for error context
|
||||
- Fetch migration guides for breaking changes
|
||||
- Look up troubleshooting and FAQ sections
|
||||
|
||||
3. **Automated Remediation**
|
||||
- Apply documented fixes and workarounds
|
||||
- Update code to use current APIs
|
||||
- Add proper error handling based on docs
|
||||
```
|
||||
|
||||
## Configuration Examples
|
||||
|
||||
### Preset Configuration with Context7
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "NestJS HIPAA Healthcare",
|
||||
"techStack": {
|
||||
"framework": "NestJS",
|
||||
"database": "TypeORM + PostgreSQL"
|
||||
},
|
||||
"context7Libraries": ["@nestjs/common", "@nestjs/typeorm", "typeorm", "bcrypt", "helmet"],
|
||||
"context7Topics": {
|
||||
"security": ["authentication", "authorization", "encryption"],
|
||||
"database": ["migrations", "relationships", "transactions"],
|
||||
"testing": ["unit tests", "integration tests", "mocking"]
|
||||
},
|
||||
"context7AutoLookup": {
|
||||
"onError": true,
|
||||
"onImport": true,
|
||||
"onDeprecation": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Agent Integration Points
|
||||
|
||||
````markdown
|
||||
## Context7 Integration in atomic-code-implementer.md
|
||||
|
||||
### Phase 1: Preset Loading
|
||||
|
||||
```javascript
|
||||
// Load preset and resolve documentation
|
||||
const preset = loadPreset(detectedTechStack, domainContext);
|
||||
const libraryDocs = await loadContext7Documentation(preset.context7Libraries);
|
||||
```
|
||||
````
|
||||
|
||||
### Phase 2: Implementation Guidance
|
||||
|
||||
```javascript
|
||||
// Get implementation examples during coding
|
||||
const implementationDocs = await mcp__context7__get_library_docs({
|
||||
context7CompatibleLibraryID: '/nestjs/nest',
|
||||
topic: 'controllers authentication',
|
||||
tokens: 6000,
|
||||
});
|
||||
```
|
||||
|
||||
### Phase 3: Error Resolution
|
||||
|
||||
```javascript
|
||||
// Look up error-specific documentation
|
||||
if (buildError.includes('TypeError: Cannot read property')) {
|
||||
const errorDocs = await mcp__context7__get_library_docs({
|
||||
context7CompatibleLibraryID: extractLibraryFromError(buildError),
|
||||
topic: 'common errors troubleshooting',
|
||||
tokens: 4000,
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
````
|
||||
|
||||
## Best Practices
|
||||
|
||||
### 1. Documentation Caching
|
||||
- Cache resolved library IDs for session duration
|
||||
- Store frequently accessed documentation locally
|
||||
- Implement intelligent cache invalidation
|
||||
|
||||
### 2. Context-Aware Lookups
|
||||
- Tailor documentation queries to specific atomic task context
|
||||
- Use targeted topics rather than generic documentation
|
||||
- Prioritize relevant sections based on implementation needs
|
||||
|
||||
### 3. Error-Driven Learning
|
||||
- Maintain error pattern → documentation mapping
|
||||
- Learn from successful error resolutions
|
||||
- Build knowledge base of common issues and solutions
|
||||
|
||||
### 4. Performance Optimization
|
||||
- Batch documentation requests when possible
|
||||
- Use appropriate token limits for different use cases
|
||||
- Implement request deduplication
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Common Issues
|
||||
|
||||
1. **Library Not Found**
|
||||
```javascript
|
||||
// Fallback to generic search
|
||||
const fallbackId = await mcp__context7__resolve_library_id({
|
||||
libraryName: `${libraryName} documentation`
|
||||
});
|
||||
````
|
||||
|
||||
2. **Documentation Too Generic**
|
||||
|
||||
```javascript
|
||||
// Use more specific topics
|
||||
const specificDocs = await mcp__context7__get_library_docs({
|
||||
context7CompatibleLibraryID: libraryId,
|
||||
topic: `${specificFeature} implementation examples`,
|
||||
tokens: 8000,
|
||||
});
|
||||
```
|
||||
|
||||
3. **Rate Limiting**
|
||||
```javascript
|
||||
// Implement exponential backoff
|
||||
const docs = await retryWithBackoff(() => mcp__context7__get_library_docs(params));
|
||||
```
|
||||
|
||||
This integration ensures the atomic code implementer always has access to the most current and relevant documentation, enabling it to produce high-quality, up-to-date implementations while following current best practices.
|
||||
286
packages/mosaic/framework/runtime/claude/hooks-config.json
Normal file
286
packages/mosaic/framework/runtime/claude/hooks-config.json
Normal file
@@ -0,0 +1,286 @@
|
||||
{
|
||||
"name": "Universal Atomic Code Implementer Hooks",
|
||||
"description": "Comprehensive hooks configuration for quality enforcement and automatic remediation",
|
||||
"version": "1.0.0",
|
||||
"hooks": {
|
||||
"PostToolUse": [
|
||||
{
|
||||
"matcher": "Write|Edit|MultiEdit",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "bash",
|
||||
"args": [
|
||||
"-c",
|
||||
"echo '[HOOK] Universal quality enforcement for $FILE_PATH'; if [[ \"$FILE_PATH\" == *.ts || \"$FILE_PATH\" == *.tsx ]]; then echo '[HOOK] TypeScript checks'; npx eslint --fix \"$FILE_PATH\" && npx prettier --write \"$FILE_PATH\" && npx tsc --noEmit || echo '[HOOK] TS completed'; elif [[ \"$FILE_PATH\" == *.js || \"$FILE_PATH\" == *.jsx ]]; then echo '[HOOK] JavaScript checks'; npx eslint --fix \"$FILE_PATH\" && npx prettier --write \"$FILE_PATH\" || echo '[HOOK] JS completed'; elif [[ \"$FILE_PATH\" == *.py ]]; then echo '[HOOK] Python checks'; black \"$FILE_PATH\" && flake8 \"$FILE_PATH\" && mypy \"$FILE_PATH\" || echo '[HOOK] Python completed'; fi"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"fileTypeHooks": {
|
||||
"*.ts": {
|
||||
"afterChange": [
|
||||
"echo '[HOOK] TypeScript file modified: ${FILE_PATH}'",
|
||||
"npx eslint --fix ${FILE_PATH}",
|
||||
"npx prettier --write ${FILE_PATH}",
|
||||
"npx tsc --noEmit --project tsconfig.json"
|
||||
],
|
||||
"beforeDelete": ["echo '[HOOK] Checking for TypeScript file dependencies before deletion'"]
|
||||
},
|
||||
"*.tsx": {
|
||||
"afterChange": [
|
||||
"echo '[HOOK] React TypeScript file modified: ${FILE_PATH}'",
|
||||
"npx eslint --fix ${FILE_PATH}",
|
||||
"npx prettier --write ${FILE_PATH}",
|
||||
"npx tsc --noEmit --project tsconfig.json",
|
||||
"if command -v npm >/dev/null 2>&1; then",
|
||||
" npm run test:component -- ${FILE_NAME} 2>/dev/null || echo '[HOOK] Component tests checked'",
|
||||
"fi"
|
||||
]
|
||||
},
|
||||
"*.js": {
|
||||
"afterChange": [
|
||||
"echo '[HOOK] JavaScript file modified: ${FILE_PATH}'",
|
||||
"npx eslint --fix ${FILE_PATH}",
|
||||
"npx prettier --write ${FILE_PATH}"
|
||||
]
|
||||
},
|
||||
"*.jsx": {
|
||||
"afterChange": [
|
||||
"echo '[HOOK] React JavaScript file modified: ${FILE_PATH}'",
|
||||
"npx eslint --fix ${FILE_PATH}",
|
||||
"npx prettier --write ${FILE_PATH}",
|
||||
"if command -v npm >/dev/null 2>&1; then",
|
||||
" npm run test:component -- ${FILE_NAME} 2>/dev/null || echo '[HOOK] Component tests checked'",
|
||||
"fi"
|
||||
]
|
||||
},
|
||||
"*.py": {
|
||||
"afterChange": [
|
||||
"echo '[HOOK] Python file modified: ${FILE_PATH}'",
|
||||
"black ${FILE_PATH}",
|
||||
"flake8 ${FILE_PATH} || echo '[HOOK] Flake8 linting completed'",
|
||||
"mypy ${FILE_PATH} || echo '[HOOK] MyPy type checking completed'",
|
||||
"if command -v pytest >/dev/null 2>&1; then",
|
||||
" pytest ${FILE_PATH%.*}_test.py 2>/dev/null || echo '[HOOK] Python tests checked'",
|
||||
"fi"
|
||||
]
|
||||
},
|
||||
"package.json": {
|
||||
"afterChange": [
|
||||
"echo '[HOOK] package.json modified, updating dependencies'",
|
||||
"npm install --no-audit --no-fund || echo '[HOOK] Dependency update completed'"
|
||||
]
|
||||
},
|
||||
"requirements.txt": {
|
||||
"afterChange": [
|
||||
"echo '[HOOK] requirements.txt modified, updating Python dependencies'",
|
||||
"pip install -r requirements.txt || echo '[HOOK] Python dependency update completed'"
|
||||
]
|
||||
},
|
||||
"*.json": {
|
||||
"afterChange": [
|
||||
"echo '[HOOK] JSON file modified: ${FILE_PATH}'",
|
||||
"if command -v jq >/dev/null 2>&1; then",
|
||||
" jq . ${FILE_PATH} > /dev/null || echo '[HOOK] JSON validation failed'",
|
||||
"fi"
|
||||
]
|
||||
},
|
||||
"*.md": {
|
||||
"afterChange": [
|
||||
"echo '[HOOK] Markdown file modified: ${FILE_PATH}'",
|
||||
"if command -v prettier >/dev/null 2>&1; then",
|
||||
" npx prettier --write ${FILE_PATH} || echo '[HOOK] Markdown formatting completed'",
|
||||
"fi"
|
||||
]
|
||||
}
|
||||
},
|
||||
"remediationActions": {
|
||||
"RETRY_OPERATION": {
|
||||
"description": "Retry the last file operation after applying fixes",
|
||||
"maxRetries": 2,
|
||||
"backoffMs": 1000
|
||||
},
|
||||
"CONTINUE_WITH_WARNING": {
|
||||
"description": "Continue execution but log warnings for manual review",
|
||||
"logLevel": "warning"
|
||||
},
|
||||
"ABORT_WITH_ERROR": {
|
||||
"description": "Stop execution and require manual intervention",
|
||||
"logLevel": "error"
|
||||
},
|
||||
"TRIGGER_QA_AGENT": {
|
||||
"description": "Escalate to QA validation agent for complex issues",
|
||||
"agent": "qa-validation-agent"
|
||||
},
|
||||
"REQUEST_CONTEXT7_HELP": {
|
||||
"description": "Look up documentation for error resolution",
|
||||
"tool": "mcp__context7__get-library-docs"
|
||||
}
|
||||
},
|
||||
"qualityGates": {
|
||||
"typescript": {
|
||||
"eslint": {
|
||||
"enabled": true,
|
||||
"config": ".eslintrc.js",
|
||||
"autoFix": true,
|
||||
"failOnError": false
|
||||
},
|
||||
"prettier": {
|
||||
"enabled": true,
|
||||
"config": ".prettierrc",
|
||||
"autoFix": true
|
||||
},
|
||||
"typeCheck": {
|
||||
"enabled": true,
|
||||
"config": "tsconfig.json",
|
||||
"failOnError": false
|
||||
},
|
||||
"testing": {
|
||||
"enabled": true,
|
||||
"runAffected": true,
|
||||
"coverage": 80
|
||||
}
|
||||
},
|
||||
"python": {
|
||||
"black": {
|
||||
"enabled": true,
|
||||
"lineLength": 88,
|
||||
"autoFix": true
|
||||
},
|
||||
"flake8": {
|
||||
"enabled": true,
|
||||
"config": ".flake8",
|
||||
"failOnError": false
|
||||
},
|
||||
"mypy": {
|
||||
"enabled": true,
|
||||
"config": "mypy.ini",
|
||||
"failOnError": false
|
||||
},
|
||||
"pytest": {
|
||||
"enabled": true,
|
||||
"coverage": 90
|
||||
}
|
||||
},
|
||||
"javascript": {
|
||||
"eslint": {
|
||||
"enabled": true,
|
||||
"autoFix": true
|
||||
},
|
||||
"prettier": {
|
||||
"enabled": true,
|
||||
"autoFix": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"performanceOptimization": {
|
||||
"parallelExecution": {
|
||||
"enabled": true,
|
||||
"maxConcurrency": 4
|
||||
},
|
||||
"caching": {
|
||||
"enabled": true,
|
||||
"eslint": true,
|
||||
"prettier": true,
|
||||
"typescript": true
|
||||
},
|
||||
"incrementalChecks": {
|
||||
"enabled": true,
|
||||
"onlyModifiedFiles": true
|
||||
}
|
||||
},
|
||||
"monitoring": {
|
||||
"metrics": {
|
||||
"hookExecutionTime": true,
|
||||
"errorRates": true,
|
||||
"remediationSuccess": true
|
||||
},
|
||||
"logging": {
|
||||
"level": "info",
|
||||
"format": "json",
|
||||
"includeStackTrace": true
|
||||
},
|
||||
"alerts": {
|
||||
"highErrorRate": {
|
||||
"threshold": 0.1,
|
||||
"action": "log"
|
||||
},
|
||||
"slowHookExecution": {
|
||||
"thresholdMs": 10000,
|
||||
"action": "log"
|
||||
}
|
||||
}
|
||||
},
|
||||
"integration": {
|
||||
"presets": {
|
||||
"loadHooksFromPresets": true,
|
||||
"overrideWithProjectConfig": true
|
||||
},
|
||||
"cicd": {
|
||||
"skipInCI": false,
|
||||
"reportToCI": true
|
||||
},
|
||||
"ide": {
|
||||
"vscode": {
|
||||
"showNotifications": true,
|
||||
"autoSave": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"customCommands": {
|
||||
"fullQualityCheck": {
|
||||
"description": "Run comprehensive quality checks",
|
||||
"commands": [
|
||||
"npm run lint",
|
||||
"npm run format",
|
||||
"npm run build",
|
||||
"npm run test",
|
||||
"npm run type-check"
|
||||
]
|
||||
},
|
||||
"securityScan": {
|
||||
"description": "Run security scanning",
|
||||
"commands": [
|
||||
"npm audit",
|
||||
"npx eslint . --ext .ts,.tsx,.js,.jsx --config .eslintrc.security.js || echo 'Security scan completed'"
|
||||
]
|
||||
},
|
||||
"performanceCheck": {
|
||||
"description": "Run performance analysis",
|
||||
"commands": [
|
||||
"npm run build:analyze || echo 'Bundle analysis completed'",
|
||||
"npm run lighthouse || echo 'Lighthouse audit completed'"
|
||||
]
|
||||
}
|
||||
},
|
||||
"documentation": {
|
||||
"usage": "This configuration provides comprehensive quality enforcement through hooks",
|
||||
"examples": [
|
||||
{
|
||||
"scenario": "TypeScript file creation",
|
||||
"flow": "Write file → ESLint auto-fix → Prettier format → TypeScript check → Tests"
|
||||
},
|
||||
{
|
||||
"scenario": "Python file modification",
|
||||
"flow": "Edit file → Black format → Flake8 lint → MyPy type check → Pytest"
|
||||
},
|
||||
{
|
||||
"scenario": "Build error",
|
||||
"flow": "Error detected → Analyze common issues → Apply fixes → Retry or continue"
|
||||
}
|
||||
],
|
||||
"troubleshooting": [
|
||||
{
|
||||
"issue": "Hooks taking too long",
|
||||
"solution": "Enable parallelExecution and incremental checks"
|
||||
},
|
||||
{
|
||||
"issue": "False positive errors",
|
||||
"solution": "Adjust quality gate thresholds or use CONTINUE_WITH_WARNING"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"_comment": "Claude runtime overlay managed by Mosaic. Merge into ~/.claude/settings.json as needed.",
|
||||
"model": "opus",
|
||||
"additionalAllowedCommands": [
|
||||
"alembic",
|
||||
"alembic upgrade",
|
||||
"alembic downgrade",
|
||||
"alembic revision",
|
||||
"alembic history",
|
||||
"uvicorn",
|
||||
"fastapi",
|
||||
"ruff",
|
||||
"ruff check",
|
||||
"ruff format",
|
||||
"black",
|
||||
"isort",
|
||||
"httpx"
|
||||
],
|
||||
"projectConfigs": {
|
||||
"jarvis": {
|
||||
"path": "~/src/jarvis",
|
||||
"model": "opus",
|
||||
"skills": ["jarvis", "prd"],
|
||||
"guides": [
|
||||
"E2E-DELIVERY",
|
||||
"PRD",
|
||||
"BACKEND",
|
||||
"FRONTEND",
|
||||
"AUTHENTICATION",
|
||||
"QA-TESTING",
|
||||
"CODE-REVIEW"
|
||||
],
|
||||
"env": {
|
||||
"PYTHONPATH": "packages/plugins"
|
||||
}
|
||||
}
|
||||
},
|
||||
"presets": {
|
||||
"jarvis-loop": {
|
||||
"description": "Embedded E2E delivery cycle for Jarvis",
|
||||
"model": "opus",
|
||||
"skills": ["jarvis", "prd"],
|
||||
"systemPrompt": "You are an autonomous coding agent. For each logical unit, execute: plan, code, test, review, remediate, review, commit, push, then run a greenfield situational test. Repeat until requirements are complete."
|
||||
},
|
||||
"jarvis-review": {
|
||||
"description": "Code review mode for Jarvis PRs",
|
||||
"model": "opus",
|
||||
"skills": ["jarvis"],
|
||||
"guides": ["CODE-REVIEW"],
|
||||
"systemPrompt": "Review code changes for quality, security, and adherence to Jarvis patterns."
|
||||
}
|
||||
}
|
||||
}
|
||||
240
packages/mosaic/framework/runtime/claude/settings.json
Normal file
240
packages/mosaic/framework/runtime/claude/settings.json
Normal file
@@ -0,0 +1,240 @@
|
||||
{
|
||||
"model": "opus",
|
||||
"hooks": {
|
||||
"PreToolUse": [
|
||||
{
|
||||
"matcher": "Write|Edit|MultiEdit",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "~/.config/mosaic/tools/qa/prevent-memory-write.sh",
|
||||
"timeout": 10
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"PostToolUse": [
|
||||
{
|
||||
"matcher": "Edit|MultiEdit|Write",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "~/.config/mosaic/tools/qa/qa-hook-stdin.sh",
|
||||
"timeout": 60
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"enabledPlugins": {
|
||||
"frontend-design@claude-plugins-official": true,
|
||||
"feature-dev@claude-plugins-official": true,
|
||||
"code-review@claude-plugins-official": true,
|
||||
"pr-review-toolkit@claude-plugins-official": true
|
||||
},
|
||||
"skipDangerousModePermissionPrompt": true,
|
||||
"allowedCommands": [
|
||||
"npm",
|
||||
"npm install",
|
||||
"npm run",
|
||||
"npm test",
|
||||
"npm build",
|
||||
"npm start",
|
||||
"npm run dev",
|
||||
"npm run build",
|
||||
"npm run lint",
|
||||
"npm run typecheck",
|
||||
"npm run test:ci",
|
||||
"npm run test:e2e",
|
||||
"npm run test:unit",
|
||||
"npm run test:integration",
|
||||
"npm run test:cov",
|
||||
"npm run test:security",
|
||||
"npm run security:scan",
|
||||
"npm run security:audit",
|
||||
"npm run performance:benchmark",
|
||||
"npm run build:dev",
|
||||
"npm run build:prod",
|
||||
"npm run test",
|
||||
"npm run test:watch",
|
||||
"npm run migrate",
|
||||
"npm run migrate:rollback",
|
||||
"npm run db:seed",
|
||||
"npm run db:reset",
|
||||
"node",
|
||||
"yarn",
|
||||
"pnpm",
|
||||
"npx",
|
||||
"npx tsc",
|
||||
"npx eslint",
|
||||
"npx prettier",
|
||||
"npx jest",
|
||||
"npx vitest",
|
||||
"git",
|
||||
"git add",
|
||||
"git commit",
|
||||
"git push",
|
||||
"git pull",
|
||||
"git status",
|
||||
"git diff",
|
||||
"git log",
|
||||
"git branch",
|
||||
"git checkout",
|
||||
"git merge",
|
||||
"git init",
|
||||
"git remote",
|
||||
"git fetch",
|
||||
"git reset",
|
||||
"git rebase",
|
||||
"git stash",
|
||||
"git tag",
|
||||
"git show",
|
||||
"git config",
|
||||
"gh",
|
||||
"gh issue",
|
||||
"gh pr",
|
||||
"gh repo",
|
||||
"gh api",
|
||||
"docker",
|
||||
"docker build",
|
||||
"docker run",
|
||||
"docker ps",
|
||||
"docker logs",
|
||||
"docker exec",
|
||||
"docker stop",
|
||||
"docker start",
|
||||
"docker pull",
|
||||
"docker push",
|
||||
"docker-compose",
|
||||
"docker-compose up",
|
||||
"docker-compose down",
|
||||
"docker-compose build",
|
||||
"docker-compose logs",
|
||||
"docker-compose ps",
|
||||
"docker-compose exec",
|
||||
"kubectl",
|
||||
"kubectl get",
|
||||
"kubectl describe",
|
||||
"kubectl logs",
|
||||
"kubectl apply",
|
||||
"kubectl delete",
|
||||
"kubectl port-forward",
|
||||
"mkdir",
|
||||
"touch",
|
||||
"chmod",
|
||||
"chown",
|
||||
"ls",
|
||||
"cd",
|
||||
"pwd",
|
||||
"cp",
|
||||
"mv",
|
||||
"rm",
|
||||
"cat",
|
||||
"echo",
|
||||
"head",
|
||||
"tail",
|
||||
"grep",
|
||||
"grep -E",
|
||||
"grep -r",
|
||||
"find",
|
||||
"find -name",
|
||||
"find -type",
|
||||
"find -path",
|
||||
"find -exec",
|
||||
"find . -type f",
|
||||
"find . -type d",
|
||||
"wc",
|
||||
"sort",
|
||||
"uniq",
|
||||
"curl",
|
||||
"wget",
|
||||
"ping",
|
||||
"netstat",
|
||||
"ss",
|
||||
"lsof",
|
||||
"psql",
|
||||
"pg_dump",
|
||||
"pg_restore",
|
||||
"sqlite3",
|
||||
"jest",
|
||||
"vitest",
|
||||
"playwright",
|
||||
"cypress",
|
||||
"artillery",
|
||||
"lighthouse",
|
||||
"tsc",
|
||||
"eslint",
|
||||
"prettier",
|
||||
"snyk",
|
||||
"semgrep",
|
||||
"tar",
|
||||
"gzip",
|
||||
"unzip",
|
||||
"zip",
|
||||
"which",
|
||||
"whoami",
|
||||
"id",
|
||||
"env",
|
||||
"export",
|
||||
"source",
|
||||
"sleep",
|
||||
"date",
|
||||
"uptime",
|
||||
"df",
|
||||
"du",
|
||||
"free",
|
||||
"top",
|
||||
"htop",
|
||||
"ps",
|
||||
"tree",
|
||||
"jq",
|
||||
"sed",
|
||||
"awk",
|
||||
"xargs",
|
||||
"tee",
|
||||
"test",
|
||||
"true",
|
||||
"false",
|
||||
"basename",
|
||||
"dirname",
|
||||
"realpath",
|
||||
"readlink",
|
||||
"stat",
|
||||
"file",
|
||||
"make",
|
||||
"cmake",
|
||||
"gcc",
|
||||
"g++",
|
||||
"clang",
|
||||
"python",
|
||||
"python3",
|
||||
"pip",
|
||||
"pip3",
|
||||
"pip install",
|
||||
"poetry",
|
||||
"pipenv",
|
||||
"go",
|
||||
"go build",
|
||||
"go test",
|
||||
"go run",
|
||||
"go mod",
|
||||
"cargo",
|
||||
"rustc",
|
||||
"ruby",
|
||||
"gem",
|
||||
"bundle",
|
||||
"rake",
|
||||
"java",
|
||||
"javac",
|
||||
"mvn",
|
||||
"gradle",
|
||||
"dotnet",
|
||||
"msbuild",
|
||||
"php",
|
||||
"composer",
|
||||
"perl",
|
||||
"cpan",
|
||||
"nohup"
|
||||
],
|
||||
"enableAllMcpTools": true
|
||||
}
|
||||
Reference in New Issue
Block a user