enhance xce-build skill

This commit is contained in:
Rongsong Shen 2026-05-30 08:13:59 +08:00
parent 9bbff7b016
commit c8e0f65a39
7 changed files with 107 additions and 22 deletions

View file

@ -1,6 +1,6 @@
---
name: xce-build
description: Build the xce source code
description: "Build XCE components with tests. Usage: /xce-build [component] [build_dir]. Components: all (default), lib, controller, scheduler, worker, apiserver, xcecli"
context: fork
disable-model-invocation: true
allowed-tools: Bash(*)
@ -9,12 +9,9 @@ allowed-tools: Bash(*)
## build xce source code
```bash
BUILD_DIR="$0"
if [ -z "$BUILD_DIR" ]; then
BUILD_DIR=xce.build
fi
COMPONENT="$0"
BUILD_DIR="$1"
cd src && \
nix develop --command "rm -Rf $BUILD_DIR && meson setup $BUILD_DIR --buildtype=debug -Db_sanitize=address && meson compile -C $BUILD_DIR"
nix develop --command bash tools/xce-build.sh ${COMPONENT:+$COMPONENT} ${BUILD_DIR:+$BUILD_DIR}
```

View file

@ -8,20 +8,26 @@ This project uses OpenWolf for context management. Read and follow .wolf/OPENWOL
# XCE Cluster Management System
## Overview
XCE is an HPC cluster management system providing job scheduling, queue management, and cluster resource control. The Go-based API/CLI tier fronts C/C++ system daemons (controller, worker, scheduler).
XCE is an HPC cluster management system providing job scheduling, queue management, and cluster resource control. The Go-based API/CLI tier fronts C system daemons (controller, worker, scheduler).
## Tech Stack
- **Go 1.23.4**: REST API server (`src/frontend/apiserver`), CLI tool (`src/frontend/xcecli`)
- **C/C++**: Core daemons — controller, worker, scheduler, shared lib
- **C (gnu17)**: Core daemons — controller, worker, scheduler, shared lib
- **Build**: Meson + Nix flakes for C components; `make` for Go components
- **Go key deps**: Gin v1.10.0, JWT v4, Zap logging, Viper config, Cobra CLI
## Development Commands
```bash
# Full dev build — all components (debug + ASAN)
/xce-build # Preferred: builds everything via nix develop + meson
# Build with /xce-build skill (debug + ASAN, clean build, runs tests)
/xce-build # Build all components + run all tests
/xce-build lib # Build libxce + run lib tests
/xce-build controller # Build lib + controller + run controller tests
/xce-build scheduler # Build lib + scheduler + run scheduler tests
/xce-build worker # Build lib + worker (no unit tests registered)
/xce-build apiserver # Build lib + apiserver + xcecli + run Go unit tests
/xce-build xcecli # Build xcecli only + run xcecli Go tests
# From src/frontend/
# From src/frontend/ (manual Go dev loop)
make build-server # Build apiserver binary → /tmp/apiserver
make build-cli # Build xcecli binary → /tmp/xce_static (CGO_ENABLED=0)
make test # Unit tests (no live server required)
@ -156,7 +162,7 @@ Kiro-style Spec-Driven Development on an agentic SDLC
- `/kiro-spec-design {feature} [-y]`
- `/kiro-validate-design {feature}` (optional: design review)
- `/kiro-spec-tasks {feature} [-y]`
- Phase 2 (Implementation): `/kiro-spec-impl {feature} [tasks]`
- Phase 2 (Implementation): `/kiro-impl {feature} [tasks]`
- `/kiro-validate-impl {feature}` (optional: after implementation)
- `/kiro-verify-completion {feature}` — validate all acceptance criteria are met
- Debugging: `/kiro-debug {feature}` — systematic debugging with spec context

View file

@ -20,7 +20,7 @@ Core source files handle distinct domains:
Links against `libxce` from `src/lib/`.
## Conventions
- C standard: C99 or later
- C standard: gnu17
- Format with `clang-format`
- Component-specific headers in `include/`
- Shared types defined in `src/include/xce/` (libxce)
@ -31,4 +31,4 @@ Links against `libxce` from `src/lib/`.
## See Also
- Shared library: `src/lib/CLAUDE.md`
- Root guidelines: `/workspace/CLAUDE.md`
- Root guidelines: `CLAUDE.md` (repo root)

View file

@ -12,12 +12,12 @@ meson build && ninja -C build
## Architecture
- Produces `libxce.a` (static) and/or `libxce.so` (shared)
- Linked by all C/C++ system components: controller, worker, scheduler
- Linked by all C system components: controller, worker, scheduler
- Public headers exposed via `src/include/xce/`
- Test suite in `src/lib/testsuite/`
## Conventions
- C standard: C99 or later
- C standard: gnu17
- Format with `clang-format` (config at repo root if present)
- All public API headers go in `src/include/xce/` — not in `src/lib/`
- Implementation files stay in `src/lib/`
@ -27,4 +27,4 @@ meson build && ninja -C build
- `src/lib/testsuite/` — Library unit tests
## See Also
- Root guidelines: `/workspace/CLAUDE.md`
- Root guidelines: `CLAUDE.md` (repo root)

View file

@ -18,11 +18,11 @@ meson build && ninja -C build
Links against `libxce` from `src/lib/`.
## Conventions
- C standard: C99 or later
- C standard: gnu17
- Format with `clang-format`
- New scheduling policies → add as a plugin under `src/plugins/`, do not modify the core engine
- Shared types defined in `src/include/xce/` (libxce)
## See Also
- Shared library: `src/lib/CLAUDE.md`
- Root guidelines: `/workspace/CLAUDE.md`
- Root guidelines: `CLAUDE.md` (repo root)

82
src/tools/xce-build.sh Executable file
View file

@ -0,0 +1,82 @@
#!/usr/bin/env bash
set -euo pipefail
COMPONENT="${1:-all}"
BUILD_DIR="${2:-xce.build}"
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
SRC_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
cd "$SRC_DIR"
usage() {
echo "Usage: $0 [component] [build_dir]"
echo "Components: all (default), lib, controller, scheduler, worker, apiserver, xcecli"
exit 1
}
setup_build() {
echo "=== Clean build: $BUILD_DIR ==="
rm -rf "$BUILD_DIR"
meson setup "$BUILD_DIR" --buildtype=debug -Db_sanitize=address
}
case "$COMPONENT" in
lib)
setup_build
echo "=== Building lib + tests ==="
meson compile -C "$BUILD_DIR" xcelib_test
echo "=== Running lib tests ==="
meson test -C "$BUILD_DIR" "libxce test" --print-errorlogs
;;
controller)
setup_build
echo "=== Building lib + controller + tests ==="
meson compile -C "$BUILD_DIR" xce_controller controller_unit_test
echo "=== Running controller tests ==="
meson test -C "$BUILD_DIR" --suite controller --print-errorlogs
;;
scheduler)
setup_build
echo "=== Building lib + scheduler + tests ==="
meson compile -C "$BUILD_DIR" xce_scheduler sched_test
echo "=== Running scheduler tests ==="
"./$BUILD_DIR/scheduler/testsuite/sched_test"
;;
worker)
setup_build
echo "=== Building lib + worker ==="
meson compile -C "$BUILD_DIR" xcecd xcecd_worker xrun
echo "=== Worker built (no unit tests registered) ==="
;;
apiserver)
setup_build
echo "=== Building lib + apiserver + xcecli ==="
meson compile -C "$BUILD_DIR" apiserver xcecli
echo "=== Running frontend Go unit tests ==="
cd frontend && make test
;;
xcecli)
setup_build
echo "=== Building xcecli ==="
meson compile -C "$BUILD_DIR" xcecli
echo "=== Running xcecli Go unit tests ==="
cd frontend/xcecli && CGO_ENABLED=0 go test ./... -count=1
;;
all)
setup_build
echo "=== Building all components ==="
meson compile -C "$BUILD_DIR"
echo "=== Running all C tests ==="
meson test -C "$BUILD_DIR" --print-errorlogs
echo "=== Running scheduler test (manual) ==="
"./$BUILD_DIR/scheduler/testsuite/sched_test"
echo "=== Running frontend Go unit tests ==="
cd frontend && make test
;;
*)
usage
;;
esac
echo "=== Done: $COMPONENT ==="

View file

@ -18,11 +18,11 @@ meson build && ninja -C build
Links against `libxce` from `src/lib/`.
## Conventions
- C standard: C99 or later
- C standard: gnu17
- Format with `clang-format`
- Headers in `include/`
- Shared types defined in `src/include/xce/` (libxce)
## See Also
- Shared library: `src/lib/CLAUDE.md`
- Root guidelines: `/workspace/CLAUDE.md`
- Root guidelines: `CLAUDE.md` (repo root)