A shared Go library providing language detection and ecosystem abstractions for multiple programming languages. Includes version reading/writing, dependency management, and build validation. Used by autobump and autoupdate.
- Language Detection: Automatically detect project languages via manifest files and file extensions
- Version Management: Read and write semantic versions across all supported ecosystems
- Dependency Management: Read dependency manifests and run native update commands (go get, npm update, pip, etc.)
- Build Validation: Run ecosystem-specific lint and build commands to verify project health
- Remote-Compatible Detection: Pluggable
FileCheckerabstraction enables detection via GitHub/GitLab APIs without local filesystem access - Registry Pattern:
LanguageRegistrywith auto-detection and provider lookup for polyglot projects - File Classification: Extension-based file classifier for fast, deterministic language identification
| Ecosystem | Detection Files | Version File |
|---|---|---|
| Go | go.mod |
go.mod |
| Node/TypeScript | package.json, yarn.lock, pnpm-lock.yaml |
package.json |
| Python | pyproject.toml, setup.py, requirements.txt |
pyproject.toml |
| Java (Gradle) | build.gradle, build.gradle.kts |
build.gradle |
| Java (Maven) | pom.xml |
pom.xml |
| C# | .csproj, .sln |
.csproj |
| Terraform | .tf, .hcl |
*.tf |
go get github.com/rios0rios0/langforgeimport (
"github.com/rios0rios0/langforge/pkg/infrastructure/registry"
)
// Create registry with all built-in providers
reg := registry.NewDefaultRegistry()
// Auto-detect language from a local project directory
provider, err := reg.Detect("/path/to/repo")
// Or detect using a custom file checker (e.g., GitHub API)
provider, err := reg.DetectWithChecker(myRemoteFileChecker)
// Detect all languages in a polyglot project
providers, err := reg.DetectAllWithChecker(myRemoteFileChecker)
// Read version, dependencies, update, validate
version, err := provider.ReadVersion("/path/to/repo")
deps, err := provider.ReadDependencies("/path/to/repo")langforge/
├── pkg/
│ ├── domain/
│ │ ├── entities/ # Language, Version, Dependency, FileChecker, Classifier
│ │ └── repositories/ # LanguageProvider, LanguageDetector, VersionReader/Writer,
│ │ # DependencyReader, DependencyUpdater, BuildValidator
│ ├── infrastructure/
│ │ ├── languages/ # Go, Node, Python, Java (Gradle/Maven), C#, Terraform
│ │ └── registry/ # LanguageRegistry with auto-detection and default setup
│ └── support/
│ ├── cmdexec/ # Shell command execution wrapper
│ └── fileutil/ # File I/O helpers, LocalFileChecker
└── test/
├── builders/ # Test data builders (Version, Dependency, Provider)
└── doubles/ # Test doubles (stubs)
The library uses Go interface composition through the LanguageProvider contract:
LanguageDetector: Detects if a language is present in a directoryVersionReader/VersionWriter: Read and write semantic versions in ecosystem-specific filesDependencyReader: Parse dependency manifests and return structured dependency listsDependencyUpdater: Run native ecosystem update commandsBuildValidator: Validate project builds and linting
Each language provider composes these interfaces into a single Provider struct, enabling independent testing and reuse.
Contributions are welcome. See CONTRIBUTING.md for guidelines.
See LICENSE file for details.