Compare commits
14 Commits
f4bc5ad2e6
...
v0.1.10
| Author | SHA1 | Date | |
|---|---|---|---|
| 88a659fb03 | |||
| b31d08c35d | |||
| 65293d0961 | |||
| f9464c9def | |||
|
|
b6df678845 | ||
| 0d23a8b8b0 | |||
|
|
17c9393b98 | ||
| 4eb68008b3 | |||
| 4258feab81 | |||
| fa6c44fcf1 | |||
| 3a50eac98e | |||
| edddc538f9 | |||
| 258b1b0a0b | |||
|
|
4dd56b82c6 |
207
.gitea/workflows/release.yml
Normal file
207
.gitea/workflows/release.yml
Normal file
@@ -0,0 +1,207 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: 'Version tag (e.g., v1.0.0)'
|
||||
required: false
|
||||
type: string
|
||||
|
||||
env:
|
||||
BINARY_NAME: claudia-docs
|
||||
GO_VERSION: '1.22'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- goos: linux
|
||||
goarch: amd64
|
||||
ext: ''
|
||||
- goos: linux
|
||||
goarch: arm64
|
||||
ext: ''
|
||||
- goos: darwin
|
||||
goarch: amd64
|
||||
ext: ''
|
||||
- goos: darwin
|
||||
goarch: arm64
|
||||
ext: ''
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
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: |
|
||||
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:
|
||||
GOOS: ${{ matrix.goos }}
|
||||
GOARCH: ${{ matrix.goarch }}
|
||||
CGO_ENABLED: 0
|
||||
run: |
|
||||
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)" \
|
||||
-o "dist/${BINARY}" \
|
||||
./cmd/claudia-docs
|
||||
|
||||
- name: Package
|
||||
run: |
|
||||
cd dist
|
||||
BINARY="${{ env.BINARY_NAME }}-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.ext }}"
|
||||
case "${{ matrix.goos }}" in
|
||||
windows)
|
||||
zip "${BINARY%.exe}.zip" "${BINARY}"
|
||||
;;
|
||||
*)
|
||||
tar -czf "${BINARY}.tar.gz" "${BINARY}"
|
||||
;;
|
||||
esac
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.goos }}-${{ matrix.goarch }}
|
||||
path: dist/*
|
||||
retention-days: 5
|
||||
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: startsWith(gitea.ref, 'refs/tags/v') || gitea.event.inputs.version != ''
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get version
|
||||
id: version
|
||||
run: |
|
||||
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@v3
|
||||
with:
|
||||
path: dist/
|
||||
# ← sin merge-multiple, quedan en subdirectorios:
|
||||
# dist/linux-amd64/claudia-docs-linux-amd64.tar.gz
|
||||
# dist/windows-amd64/claudia-docs-windows-amd64.zip
|
||||
# etc.
|
||||
|
||||
- name: Mover artefactos a dist/
|
||||
run: |
|
||||
# Mover todos los archivos de subdirectorios a dist/
|
||||
find dist/ -mindepth 2 -type f -exec mv {} dist/ \;
|
||||
# Borrar subdirectorios con rm -rf en vez de find -delete
|
||||
for dir in dist/*/; do
|
||||
rm -rf "$dir"
|
||||
done
|
||||
ls -lh dist/
|
||||
|
||||
- name: Generate changelog
|
||||
run: |
|
||||
PREV_TAG=$(git tag --sort=-version:refname | sed -n '2p')
|
||||
if [ -z "$PREV_TAG" ]; then
|
||||
echo "# Changes (full history)" > changelog.md
|
||||
git log --pretty=format:"- %s (%h)" -20 >> changelog.md
|
||||
else
|
||||
echo "# Changes since ${PREV_TAG}" > changelog.md
|
||||
git log "${PREV_TAG}..${{ steps.version.outputs.tag }}" \
|
||||
--pretty=format:"- %s (%h)" >> changelog.md
|
||||
fi
|
||||
cat changelog.md
|
||||
|
||||
- name: Generate checksums
|
||||
run: |
|
||||
cd dist
|
||||
sha256sum *.tar.gz *.zip > checksums.txt
|
||||
cat checksums.txt
|
||||
|
||||
- name: Generate install script
|
||||
run: |
|
||||
cat > install.sh << 'INSTALL_SCRIPT'
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
VERSION="${VERSION:-latest}"
|
||||
BINARY="claudia-docs"
|
||||
|
||||
OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
|
||||
ARCH="$(uname -m)"
|
||||
|
||||
case "$ARCH" in
|
||||
x86_64) ARCH="amd64" ;;
|
||||
aarch64|arm64) ARCH="arm64" ;;
|
||||
esac
|
||||
|
||||
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}" | tar -xz
|
||||
|
||||
chmod +x "${BINARY}-${OS}-${ARCH}"
|
||||
mv "${BINARY}-${OS}-${ARCH}" "${BINARY}"
|
||||
|
||||
if [ -w /usr/local/bin ]; then
|
||||
mv "${BINARY}" /usr/local/bin/
|
||||
echo "Installed to /usr/local/bin/claudia-docs"
|
||||
else
|
||||
echo "Run: sudo mv ${BINARY} /usr/local/bin/"
|
||||
fi
|
||||
|
||||
echo "Done! Run: claudia-docs --version"
|
||||
INSTALL_SCRIPT
|
||||
chmod +x install.sh
|
||||
|
||||
- name: Create Release
|
||||
uses: https://gitea.com/actions/gitea-release-action@v1
|
||||
with:
|
||||
token: ${{ secrets.RELEASE_TOKEN }}
|
||||
tag_name: ${{ steps.version.outputs.tag }}
|
||||
name: "Claudia Docs CLI ${{ steps.version.outputs.tag }}"
|
||||
body_path: changelog.md
|
||||
files: |
|
||||
dist/*.tar.gz
|
||||
dist/*.zip
|
||||
dist/checksums.txt
|
||||
install.sh
|
||||
275
README.md
275
README.md
@@ -1,2 +1,277 @@
|
||||
# claudia-docs-cli
|
||||
|
||||
CLI tool for interacting with Claudia Docs from agents and scripts.
|
||||
|
||||
## Installation
|
||||
|
||||
### Download Binary
|
||||
```bash
|
||||
# Linux/macOS
|
||||
curl -fsSL https://gitea.danielarroyo.cl/proyectos/claudia-docs-cli/releases/latest/claudia-docs -o /usr/local/bin/claudia-docs
|
||||
chmod +x /usr/local/bin/claudia-docs
|
||||
```
|
||||
|
||||
### Build from Source
|
||||
```bash
|
||||
git clone https://gitea.danielarroyo.cl/proyectos/claudia-docs-cli.git
|
||||
cd claudia-docs-cli
|
||||
go build -o claudia-docs ./cmd/claudia-docs
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
```bash
|
||||
# Login
|
||||
./claudia-docs auth login -u admin -p your_password --save
|
||||
|
||||
# List projects
|
||||
./claudia-docs project list
|
||||
|
||||
# Create document
|
||||
./claudia-docs doc create -t "My Document" -c "# Hello" -p <project-id>
|
||||
|
||||
# List documents
|
||||
./claudia-docs doc list --project-id <project-id>
|
||||
```
|
||||
|
||||
## Global Options
|
||||
|
||||
| Flag | Description | Default |
|
||||
|------|-------------|---------|
|
||||
| `--server` | API server URL | `http://localhost:8000` |
|
||||
| `--token` | JWT token | From config or `CLAUDIA_TOKEN` env |
|
||||
| `--output` | Output format: `json`, `text` | `json` |
|
||||
| `--quiet` | Suppress stdout, only JSON | `false` |
|
||||
| `--config` | Config file path | `~/.claudia-docs.yaml` |
|
||||
| `--verbose` | Verbose debug output | `false` |
|
||||
|
||||
## Environment Variables
|
||||
|
||||
| Variable | Description |
|
||||
|----------|-------------|
|
||||
| `CLAUDIA_SERVER` | API server URL |
|
||||
| `CLAUDIA_TOKEN` | JWT token |
|
||||
| `CLAUDIA_OUTPUT` | Output format |
|
||||
|
||||
## Commands
|
||||
|
||||
### Auth
|
||||
|
||||
```bash
|
||||
# Login and save token
|
||||
./claudia-docs auth login -u <username> -p <password> --save
|
||||
|
||||
# Check status
|
||||
./claudia-docs auth status
|
||||
|
||||
# Logout
|
||||
./claudia-docs auth logout
|
||||
```
|
||||
|
||||
### Projects
|
||||
|
||||
```bash
|
||||
# List all projects
|
||||
./claudia-docs project list
|
||||
|
||||
# Get project details
|
||||
./claudia-docs project get <project-id>
|
||||
```
|
||||
|
||||
### Documents
|
||||
|
||||
```bash
|
||||
# Create document
|
||||
./claudia-docs doc create -t "Title" -c "# Content" -p <project-id> [-f <folder-id>]
|
||||
|
||||
# List documents in project
|
||||
./claudia-docs doc list --project-id <project-id> [--limit 20] [--offset 0]
|
||||
|
||||
# Get document
|
||||
./claudia-docs doc get <document-id> [--include-reasoning]
|
||||
|
||||
# Update document
|
||||
./claudia-docs doc update <document-id> [-t "New Title"] [-c "New Content"]
|
||||
|
||||
# Delete document
|
||||
./claudia-docs doc delete <document-id> [--force]
|
||||
```
|
||||
|
||||
### Folders
|
||||
|
||||
```bash
|
||||
# List folders in project
|
||||
./claudia-docs folder list --project-id <project-id> [--parent-id <folder-id>]
|
||||
|
||||
# Create folder
|
||||
./claudia-docs folder create --project-id <project-id> -n "Folder Name" [--parent-id <folder-id>]
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
||||
```bash
|
||||
# List all tags
|
||||
./claudia-docs tag list
|
||||
|
||||
# Create tag
|
||||
./claudia-docs tag create -n <name> [--color <hex-color>]
|
||||
|
||||
# Add tag to document
|
||||
./claudia-docs tag add --doc-id <document-id> --tag-id <tag-id>
|
||||
```
|
||||
|
||||
### Search
|
||||
|
||||
```bash
|
||||
# Full-text search
|
||||
./claudia-docs search -q "query" [--project-id <project-id>] [--tags <tag1,tag2>]
|
||||
```
|
||||
|
||||
### Reasoning
|
||||
|
||||
```bash
|
||||
# Save reasoning metadata
|
||||
./claudia-docs reasoning save -d <document-id> -t <type> -s '<json-steps>' [--confidence 0.85] [--model <model-name>]
|
||||
|
||||
# Types: research, planning, analysis, synthesis
|
||||
# Steps JSON: '[{"step_id":"1","thought":"...","conclusion":"..."}]'
|
||||
```
|
||||
|
||||
## Output Format
|
||||
|
||||
### JSON (default)
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": {...},
|
||||
"error": null,
|
||||
"meta": {
|
||||
"command": "doc create",
|
||||
"duration_ms": 45,
|
||||
"server": "http://localhost:8000"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Text
|
||||
```bash
|
||||
./claudia-docs --output text project list
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
Config file: `~/.claudia-docs.yaml`
|
||||
|
||||
```yaml
|
||||
server: http://localhost:8000
|
||||
token: ""
|
||||
timeout: 30s
|
||||
output: json
|
||||
|
||||
agents:
|
||||
default:
|
||||
token: ""
|
||||
default_project: ""
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### Full Workflow
|
||||
|
||||
```bash
|
||||
# 1. Login
|
||||
./claudia-docs auth login -u researcher -p secret --save
|
||||
|
||||
# 2. List projects
|
||||
./claudia-docs project list
|
||||
|
||||
# 3. Create document with content
|
||||
./claudia-docs doc create \
|
||||
--title "Research: AI Trends 2026" \
|
||||
--content "# AI Trends\n\n..." \
|
||||
--project-id "uuid-project"
|
||||
|
||||
# 4. Search
|
||||
./claudia-docs search -q "AI trends"
|
||||
|
||||
# 5. Get and update
|
||||
./claudia-docs doc get <doc-id>
|
||||
./claudia-docs doc update <doc-id> -t "Updated Title"
|
||||
```
|
||||
|
||||
### Script Integration
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
export CLAUDIA_SERVER=http://localhost:8000
|
||||
export CLAUDIA_TOKEN=$(./claudia-docs auth login -u agent -p pass --output json | jq -r '.data.token')
|
||||
|
||||
# Create document
|
||||
DOC_ID=$(./claudia-docs doc create -t "Report" -c "# Content" -p $PROJECT_ID --output json | jq -r '.data.id')
|
||||
|
||||
# Save reasoning
|
||||
./claudia-docs reasoning save -d $DOC_ID -t research -s '[{"step_id":"1","thought":"Analysis...","conclusion":"Result"}]'
|
||||
```
|
||||
|
||||
## Help
|
||||
|
||||
```bash
|
||||
./claudia-docs --help
|
||||
./claudia-docs auth --help
|
||||
./claudia-docs doc --help
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
|
||||
# En tu máquina local
|
||||
git tag v1.0.0
|
||||
git push origin v1.0.0
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Secret necesario
|
||||
|
||||
En **Settings → Secrets → Actions** de tu repo:
|
||||
|
||||
| Secret | Cómo obtenerlo |
|
||||
|---|---|
|
||||
| `RELEASE_TOKEN` | Gitea → Settings → Applications → Generate Token (con permiso `write:repository`) |
|
||||
|
||||
---
|
||||
|
||||
### Estructura esperada del proyecto
|
||||
```
|
||||
mi-proyecto/
|
||||
├── cmd/
|
||||
│ └── main.go ← entrypoint
|
||||
├── go.mod
|
||||
├── go.sum
|
||||
└── .gitea/
|
||||
└── workflows/
|
||||
└── release.yml
|
||||
|
||||
# Si main.go está en la raíz
|
||||
-o "dist/${BINARY_NAME}" .
|
||||
|
||||
# Si está en otro lugar
|
||||
-o "dist/${BINARY_NAME}" ./internal/cmd/server.go
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Resultado en Gitea
|
||||
|
||||
Una vez que hagas push del tag, en **Releases** del repo verás:
|
||||
```
|
||||
Release v1.0.0
|
||||
├── app-linux-amd64.tar.gz
|
||||
├── app-linux-arm64.tar.gz
|
||||
├── app-darwin-amd64.tar.gz
|
||||
├── app-darwin-arm64.tar.gz
|
||||
├── app-windows-amd64.zip
|
||||
└── checksums.txt
|
||||
13
cmd/claudia-docs/main.go
Normal file
13
cmd/claudia-docs/main.go
Normal 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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user