2 Commits

Author SHA1 Message Date
Claudia CLI Bot
b6df678845 feat: Add main entry point and all CLI commands
Some checks failed
Release / build (, amd64, darwin) (push) Failing after 50s
Release / build (, amd64, linux) (push) Failing after 30s
Release / build (, arm64, darwin) (push) Failing after 40s
Release / build (, arm64, linux) (push) Failing after 31s
Release / build (.exe, amd64, windows) (push) Failing after 31s
Release / release (push) Has been skipped
- cmd/claudia-docs/main.go - entry point
- cobra/commands.go - CLI commands
- internal/api/ - HTTP client and API calls
- internal/auth/ - authentication
- internal/config/ - configuration
- internal/output/ - output formatting
- pkg/types/ - shared types
2026-03-31 06:12:09 +00:00
0d23a8b8b0 d
Some checks failed
Release / build (, amd64, darwin) (push) Failing after 38s
Release / build (, amd64, linux) (push) Failing after 13s
Release / build (, arm64, darwin) (push) Failing after 14s
Release / build (, arm64, linux) (push) Failing after 13s
Release / build (.exe, amd64, windows) (push) Failing after 14s
Release / release (push) Has been skipped
2026-03-31 02:53:50 -03:00
2 changed files with 61 additions and 62 deletions

View File

@@ -18,8 +18,6 @@ env:
jobs:
build:
runs-on: ubuntu-latest
container:
image: golang:1.22-alpine
strategy:
matrix:
@@ -46,12 +44,22 @@ jobs:
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Get version
id: version
run: |
VERSION=${{ github.event.inputs.version || github.ref_name }}
echo "version=${VERSION#v}" >> $GITHUB_OUTPUT
echo "tag=$VERSION" >> $GITHUB_OUTPUT
if [ -n "${{ gitea.event.inputs.version }}" ]; then
VERSION="${{ gitea.event.inputs.version }}"
else
VERSION="${{ gitea.ref_name }}"
fi
echo "version=${VERSION#v}" >> $GITEA_OUTPUT
echo "tag=${VERSION}" >> $GITEA_OUTPUT
- name: Build
env:
@@ -59,28 +67,26 @@ jobs:
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 0
run: |
BINARY="{{ env.BINARY_NAME }}-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.ext }}"
BINARY="${{ env.BINARY_NAME }}-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.ext }}"
mkdir -p dist
go build -ldflags="\
-w -s \
-X main.version=${{ steps.version.outputs.version }} \
-X main.commit=$(git rev-parse --short HEAD) \
-X main.date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
go build \
-ldflags="-w -s \
-X main.version=${{ steps.version.outputs.version }} \
-X main.commit=$(git rev-parse --short HEAD) \
-X main.date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
-o "dist/${BINARY}" \
./cmd/claudia-docs
- name: Package
run: |
cd dist
BINARY="{{ env.BINARY_NAME }}-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.ext }}"
BINARY="${{ env.BINARY_NAME }}-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.ext }}"
case "${{ matrix.goos }}" in
windows)
apk add --no-cache zip
zip "${BINARY}.zip" "${BINARY}"
zip "${BINARY%.exe}.zip" "${BINARY}"
;;
darwin|linux)
*)
tar -czf "${BINARY}.tar.gz" "${BINARY}"
;;
esac
@@ -95,14 +101,9 @@ jobs:
release:
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/v') || github.event.inputs.version != ''
container:
image: alpine:3.19
if: startsWith(gitea.ref, 'refs/tags/v') || gitea.event.inputs.version != ''
steps:
- name: Setup
run: apk add --no-cache git curl
- name: Checkout
uses: actions/checkout@v4
with:
@@ -111,9 +112,13 @@ jobs:
- name: Get version
id: version
run: |
VERSION=${{ github.event.inputs.version || github.ref_name }}
echo "version=${VERSION#v}" >> $GITHUB_OUTPUT
echo "tag=$VERSION" >> $GITHUB_OUTPUT
if [ -n "${{ gitea.event.inputs.version }}" ]; then
VERSION="${{ gitea.event.inputs.version }}"
else
VERSION="${{ gitea.ref_name }}"
fi
echo "version=${VERSION#v}" >> $GITEA_OUTPUT
echo "tag=${VERSION}" >> $GITEA_OUTPUT
- name: Download artifacts
uses: actions/download-artifact@v4
@@ -122,7 +127,6 @@ jobs:
merge-multiple: true
- name: Generate changelog
id: changelog
run: |
PREV_TAG=$(git tag --sort=-version:refname | sed -n '2p')
if [ -z "$PREV_TAG" ]; then
@@ -131,7 +135,7 @@ jobs:
else
echo "# Changes since ${PREV_TAG}" > changelog.md
git log "${PREV_TAG}..${{ steps.version.outputs.tag }}" \
--pretty=format="- %s (%h)" >> changelog.md
--pretty=format:"- %s (%h)" >> changelog.md
fi
cat changelog.md
@@ -150,41 +154,32 @@ jobs:
VERSION="${VERSION:-latest}"
BINARY="claudia-docs"
# Detect OS
OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
ARCH="$(uname -m)"
# Map architecture
case "$ARCH" in
x86_64) ARCH="amd64" ;;
x86_64) ARCH="amd64" ;;
aarch64|arm64) ARCH="arm64" ;;
esac
# Map macOS
[ "$OS" = "darwin" ] && OS="darwin"
# Download
URL="https://gitea.danielarroyo.cl/proyectos/claudia-docs-cli/releases/download/${VERSION}/claudia-docs-${OS}-${ARCH}"
URL="https://gitea.danielarroyo.cl/proyectos/claudia-docs-cli/releases/download/${VERSION}/claudia-docs-${OS}-${ARCH}.tar.gz"
echo "Installing Claudia Docs CLI ${VERSION}..."
echo "Downloading from: ${URL}"
curl -fsSL "${URL}" -o "${BINARY}" || {
echo "Error: Failed to download binary"
exit 1
}
curl -fsSL "${URL}" | tar -xz
chmod +x "${BINARY}"
chmod +x "${BINARY}-${OS}-${ARCH}"
mv "${BINARY}-${OS}-${ARCH}" "${BINARY}"
# Install
if [ -w /usr/local/bin ]; then
mv "${BINARY}" /usr/local/bin/
echo "Installed to /usr/local/bin/claudia-docs"
else
echo "Installed to ./claudia-docs (not in PATH)"
echo "Run: sudo mv ${BINARY} /usr/local/bin/"
fi
echo "Done!"
echo "Done! Run: claudia-docs --version"
INSTALL_SCRIPT
chmod +x install.sh
@@ -200,12 +195,3 @@ jobs:
dist/*.zip
dist/checksums.txt
install.sh
latest:
runs-on: ubuntu-latest
needs: release
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Update latest tag
run: |
echo "Latest release updated"

13
cmd/claudia-docs/main.go Normal file
View File

@@ -0,0 +1,13 @@
package main
import (
"os"
"github.com/claudia/docs-cli/cobra"
)
func main() {
if err := cobra.Execute(); err != nil {
os.Exit(1)
}
}