---
name: compare_versions
kind: function
lang: go
domain: core
version: "1.0.0"
purity: pure
signature: "func CompareVersions(a, b string) int"
description: "Compara dos strings de version semantica (semver). Soporta formato con o sin prefijo 'v'. Retorna -1, 0 o 1."
tags: [core, version, semver, compare, parse, pendiente-usar]
uses_functions: []
uses_types: []
returns: []
returns_optional: false
error_type: ""
imports: [strconv, strings]
params:
  - name: a
    desc: "primera version (ej: 'v1.4.0' o '1.4.0')"
  - name: b
    desc: "segunda version"
output: "-1 si a < b, 0 si iguales, 1 si a > b"
tested: false
tests: []
test_file_path: ""
file_path: "functions/core/compare_versions.go"
source_repo: "https://gitea-dgg044oo04woo4ggcsws4gk0.organic-machine.com/egutierrez/DevLauncher.git"
source_license: "MIT"
source_file: "installer/core/version.go"
---

## Ejemplo

```go
core.CompareVersions("v1.4.0", "v1.3.9")  // 1
core.CompareVersions("1.0.0", "1.0.0")    // 0
core.CompareVersions("v0.9.0", "v1.0.0")  // -1
```

## Notas

Compara major.minor.patch como enteros. Ignora pre-release tags y metadata (solo los 3 numeros). Partes faltantes se tratan como 0.
