mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-01 08:13:37 +00:00
docs: add comprehensive documentation for shared packages
- Added README.md for all 6 shared packages: - @automaker/types: Type definitions and interfaces - @automaker/utils: Utility functions (logger, error handling, images) - @automaker/platform: Platform utilities (paths, subprocess, security) - @automaker/model-resolver: Claude model resolution - @automaker/dependency-resolver: Feature dependency ordering - @automaker/git-utils: Git operations and diff generation - Removed MIT license from all package.json files (using custom dual license) - Created comprehensive LLM guide (docs/llm-shared-packages.md): - When to use each package - Import patterns and examples - Common usage patterns - Migration checklist - Do's and don'ts for LLMs Documentation helps developers and AI assistants understand package purpose, usage, and best practices. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
133
libs/model-resolver/README.md
Normal file
133
libs/model-resolver/README.md
Normal file
@@ -0,0 +1,133 @@
|
||||
# @automaker/model-resolver
|
||||
|
||||
Claude model resolution and mapping utilities.
|
||||
|
||||
## Overview
|
||||
|
||||
This package handles Claude model resolution, converting user-friendly aliases to actual Claude model identifiers and providing default model configurations.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
npm install @automaker/model-resolver
|
||||
```
|
||||
|
||||
## Exports
|
||||
|
||||
### Model Resolution
|
||||
Convert model aliases to full model identifiers.
|
||||
|
||||
```typescript
|
||||
import { resolveModelString, DEFAULT_MODELS } from '@automaker/model-resolver';
|
||||
import { CLAUDE_MODEL_MAP } from '@automaker/types';
|
||||
|
||||
// Resolve model string
|
||||
const model = resolveModelString('sonnet');
|
||||
// Returns: 'claude-sonnet-4-20250514'
|
||||
|
||||
const model2 = resolveModelString('haiku');
|
||||
// Returns: 'claude-haiku-4-5'
|
||||
|
||||
const model3 = resolveModelString('opus');
|
||||
// Returns: 'claude-opus-4-5-20251101'
|
||||
|
||||
// Use with custom default
|
||||
const model4 = resolveModelString(undefined, 'claude-sonnet-4-20250514');
|
||||
// Returns: 'claude-sonnet-4-20250514' (default)
|
||||
|
||||
// Direct model ID passthrough
|
||||
const model5 = resolveModelString('claude-opus-4-5-20251101');
|
||||
// Returns: 'claude-opus-4-5-20251101' (unchanged)
|
||||
```
|
||||
|
||||
### Get Effective Model
|
||||
Get the actual model that will be used.
|
||||
|
||||
```typescript
|
||||
import { getEffectiveModel } from '@automaker/model-resolver';
|
||||
|
||||
// Get effective model with fallback chain
|
||||
const model = getEffectiveModel({
|
||||
requestedModel: 'sonnet',
|
||||
featureModel: undefined,
|
||||
defaultModel: 'claude-sonnet-4-20250514'
|
||||
});
|
||||
```
|
||||
|
||||
### Model Constants
|
||||
Access model mappings and defaults.
|
||||
|
||||
```typescript
|
||||
import { DEFAULT_MODELS } from '@automaker/model-resolver';
|
||||
import { CLAUDE_MODEL_MAP } from '@automaker/types';
|
||||
|
||||
// Default models for different contexts
|
||||
console.log(DEFAULT_MODELS.claude); // 'claude-sonnet-4-20250514'
|
||||
console.log(DEFAULT_MODELS.autoMode); // 'claude-sonnet-4-20250514'
|
||||
console.log(DEFAULT_MODELS.chat); // 'claude-sonnet-4-20250514'
|
||||
|
||||
// Model alias mappings
|
||||
console.log(CLAUDE_MODEL_MAP.haiku); // 'claude-haiku-4-5'
|
||||
console.log(CLAUDE_MODEL_MAP.sonnet); // 'claude-sonnet-4-20250514'
|
||||
console.log(CLAUDE_MODEL_MAP.opus); // 'claude-opus-4-5-20251101'
|
||||
```
|
||||
|
||||
## Usage Example
|
||||
|
||||
```typescript
|
||||
import { resolveModelString, DEFAULT_MODELS } from '@automaker/model-resolver';
|
||||
import type { Feature } from '@automaker/types';
|
||||
|
||||
function prepareFeatureExecution(feature: Feature) {
|
||||
// Resolve model from feature or use default
|
||||
const model = resolveModelString(
|
||||
feature.model,
|
||||
DEFAULT_MODELS.autoMode
|
||||
);
|
||||
|
||||
console.log(`Executing feature with model: ${model}`);
|
||||
|
||||
return {
|
||||
featureId: feature.id,
|
||||
model,
|
||||
// ... other options
|
||||
};
|
||||
}
|
||||
|
||||
// Example usage
|
||||
const feature: Feature = {
|
||||
id: 'auth-feature',
|
||||
category: 'backend',
|
||||
description: 'Add authentication',
|
||||
model: 'opus' // User-friendly alias
|
||||
};
|
||||
|
||||
prepareFeatureExecution(feature);
|
||||
// Output: Executing feature with model: claude-opus-4-5-20251101
|
||||
```
|
||||
|
||||
## Supported Models
|
||||
|
||||
### Current Model Aliases
|
||||
- `haiku` → `claude-haiku-4-5`
|
||||
- `sonnet` → `claude-sonnet-4-20250514`
|
||||
- `opus` → `claude-opus-4-5-20251101`
|
||||
|
||||
### Model Selection Guide
|
||||
- **Haiku**: Fast responses, simple tasks, lower cost
|
||||
- **Sonnet**: Balanced performance, most tasks (recommended default)
|
||||
- **Opus**: Maximum capability, complex reasoning, highest cost
|
||||
|
||||
## Dependencies
|
||||
|
||||
- `@automaker/types` - Model type definitions and constants
|
||||
|
||||
## Used By
|
||||
|
||||
- `@automaker/server` - Feature execution, agent chat, enhancement
|
||||
|
||||
## Notes
|
||||
|
||||
- Model strings that don't match aliases are passed through unchanged
|
||||
- This allows direct use of specific model versions like `claude-sonnet-4-20250514`
|
||||
- Always falls back to a sensible default if no model is specified
|
||||
@@ -10,7 +10,6 @@
|
||||
},
|
||||
"keywords": ["automaker", "model", "resolver"],
|
||||
"author": "",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@automaker/types": "^1.0.0"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user