Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
a72ccf3
feat(auth): add personal access token core
hgaol Sep 13, 2026
71a83f3
feat(auth): expose scoped PAT authentication
hgaol Sep 13, 2026
3494bf3
feat(ui): manage personal access tokens
hgaol Sep 13, 2026
5678abe
feat(cli): add Answer command-line client
hgaol Sep 13, 2026
cfb0acc
feat(skill): add Answer agent workflows
hgaol Sep 13, 2026
a90bd89
docs(auth): document personal access token APIs
hgaol Sep 13, 2026
389ff20
build(agent): package and validate agent tooling
hgaol Sep 13, 2026
93b4977
fix(agent): make wiring and checks reproducible
hgaol Sep 13, 2026
d0f8207
fix(agent): complete reauthentication and validation
hgaol Sep 14, 2026
c6fe2de
test(auth): cover PAT security interactions
hgaol Sep 14, 2026
0a8d301
fix(test): use utf8mb4 for MySQL repository tests
hgaol Sep 14, 2026
49e3b83
feat(cli): add redacted config inspection
hgaol Sep 14, 2026
032403b
feat(ui): group PAT scopes by topic
hgaol Sep 14, 2026
06c6254
feat(cli): report build revision in version
hgaol Sep 14, 2026
e9f0637
Merge origin/dev into agentic-exp
hgaol Nov 23, 2026
a837ee4
fix(i18n): avoid reserved message keys in PAT settings
hgaol Nov 23, 2026
7c20cc9
feat(auth): add scoped personal access tokens for existing users
hgaol Nov 23, 2026
f6c7496
docs(auth): remove standalone personal access token guide
hgaol Nov 23, 2026
499af20
feat(mcp): add user-bound write tools and previews
hgaol Nov 23, 2026
3766e58
Merge branch 'feat/mcp-user-write-tools' into agentic-exp
hgaol Nov 25, 2026
965ac7b
refactor(auth): share PAT permissions across REST and MCP
hgaol Nov 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,26 @@ builds:
- windows
goarch:
- amd64



- id: build-cli
main: ./cmd/answer-cli/.
binary: answer-cli
ldflags: -s -w -X main.version={{.RawVersion}} -X main.revision={{.ShortCommit}} -X main.buildTime={{.Date}}
flags: -v
goos:
- linux
- darwin
goarch:
- amd64
- arm64
- id: build-cli-windows
main: ./cmd/answer-cli/.
binary: answer-cli
ldflags: -s -w -X main.version={{.RawVersion}} -X main.revision={{.ShortCommit}} -X main.buildTime={{.Date}}
flags: -v
goos:
- windows
goarch:
- amd64

archives:
- name_template: >-
Expand Down
14 changes: 10 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
.PHONY: build clean ui check-ui check-ui-assets check-ui-locales check-ui-plugin-i18n
.PHONY: build build-cli clean ui check-ui check-ui-assets check-ui-locales check-ui-plugin-i18n

VERSION=2.0.3
BIN=answer
DIR_SRC=./cmd/answer
CLI_BIN=answer-cli
CLI_DIR_SRC=./cmd/answer-cli
DOCKER_CMD=docker

GO_ENV=CGO_ENABLED=0 GO111MODULE=on
Revision=$(shell git rev-parse --short HEAD 2>/dev/null || echo "")
GO_FLAGS=-ldflags="-X github.com/apache/answer/cmd.Version=$(VERSION) -X 'github.com/apache/answer/cmd.Revision=$(Revision)' -X 'github.com/apache/answer/cmd.Time=`date +%s`' -extldflags -static"
CLI_GO_FLAGS=-ldflags="-X main.version=$(VERSION) -X main.revision=$(Revision) -X main.buildTime=$(shell date -u +%Y-%m-%dT%H:%M:%SZ)"
GO=$(GO_ENV) "$(shell which go)"

GOLANGCI_VERSION ?= v2.6.2
Expand All @@ -22,6 +25,9 @@ $(GOLANGCI):
build: generate
@$(GO) build $(GO_FLAGS) -o $(BIN) $(DIR_SRC)

build-cli:
@$(GO) build $(CLI_GO_FLAGS) -o $(CLI_BIN) $(CLI_DIR_SRC)

# https://dev.to/thewraven/universal-macos-binaries-with-go-1-16-3mm3
universal: generate
@GOOS=darwin GOARCH=amd64 $(GO_ENV) $(GO) build $(GO_FLAGS) -o ${BIN}_amd64 $(DIR_SRC)
Expand All @@ -31,10 +37,10 @@ universal: generate

generate:
@$(GO) get github.com/swaggo/swag/cmd/swag@v1.16.3
@$(GO) get github.com/google/wire/cmd/wire@v0.5.0
@$(GO) get github.com/google/wire/cmd/wire@v0.7.0
@$(GO) get go.uber.org/mock/mockgen@v0.6.0
@$(GO) install github.com/swaggo/swag/cmd/swag@v1.16.3
@$(GO) install github.com/google/wire/cmd/wire@v0.5.0
@$(GO) install github.com/google/wire/cmd/wire@v0.7.0
@$(GO) install go.uber.org/mock/mockgen@v0.6.0
@$(GO) generate ./...
@$(GO) mod tidy
Expand Down Expand Up @@ -66,7 +72,7 @@ check-ui-plugin-i18n:
# clean all build result
clean:
@$(GO) clean ./...
@rm -f $(BIN)
@rm -f $(BIN) $(CLI_BIN)

install-ui-packages:
@corepack enable
Expand Down
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,31 @@ We value your feedback and suggestions to improve our documentation. If you have

You can also check out the [plugins here](https://answer.apache.org/plugins).

### Agent access

An administrator can enable **Personal access tokens** under **Admin → Security**. Users can then create scoped, expiring tokens from **Settings → Personal access tokens** for use with `answer-cli` or another HTTP client.

Install the CLI from source:

```bash
go install github.com/apache/answer/cmd/answer-cli@latest
answer-cli auth login --server https://answer.example.com --with-token
```

Install the portable Answer Agent Skill for supported coding agents:

```bash
npx skills add apache/answer
```

The Skill uses `answer-cli` to search Answer and, with explicit user approval, create questions, post answers, and vote.

### MCP participation

MCP clients can use user-owned PATs for questions, answers, comments, votes, reactions, and own-content edits. Administrators enable MCP under **Admin → MCP**. PAT scopes authorize the corresponding operations through both REST and MCP.

See [MCP write tools](docs/mcp-write-tools.md) for scopes, configuration, previews, and results.

## Building from Source

### Prerequisites
Expand All @@ -55,6 +80,8 @@ $ make generate
$ make ui
# Install backend dependencies and build
$ make build
# Build the remote API client
$ make build-cli
```

## Contributing
Expand Down
68 changes: 68 additions & 0 deletions cmd/answer-cli/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package main

import (
"os"
"runtime/debug"

"github.com/apache/answer/internal/answercli"
)

var (
version = "dev"
revision string
buildTime string
)

func main() {
resolvedRevision, resolvedBuildTime, modified := buildMetadata()
command := answercli.NewRootCommand(answercli.Options{
Stdin: os.Stdin, Stdout: os.Stdout, Stderr: os.Stderr,
Version: version, Revision: resolvedRevision, BuildTime: resolvedBuildTime, Modified: modified,
})
if err := command.Execute(); err != nil {
os.Exit(answercli.ExitCode(err))
}
}

func buildMetadata() (resolvedRevision, resolvedBuildTime string, modified bool) {
resolvedRevision = revision
resolvedBuildTime = buildTime
info, ok := debug.ReadBuildInfo()
if !ok {
return resolvedRevision, resolvedBuildTime, false
}
for _, setting := range info.Settings {
switch setting.Key {
case "vcs.revision":
if resolvedRevision == "" {
resolvedRevision = setting.Value
}
case "vcs.time":
if resolvedBuildTime == "" {
resolvedBuildTime = setting.Value
}
case "vcs.modified":
modified = setting.Value == "true"
}
}
return resolvedRevision, resolvedBuildTime, modified
}
Loading