Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
80 changes: 80 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: CI

on:
push:
branches: [dev, main]
pull_request:
branches: [dev, main]

permissions:
contents: read

env:
GOFLAGS: -buildvcs=false
GOWORK: "off"
GOPROXY: "direct"
GOSUMDB: "off"

jobs:
test:
name: Test + Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-go@v6
with:
go-version: '1.26'
- name: Test with coverage
working-directory: go
run: go test -race -coverprofile=coverage.out -covermode=atomic -count=1 ./...
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: go/coverage.out
flags: unittests
fail_ci_if_error: false

lint:
name: golangci-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-go@v6
with:
go-version: '1.26'
- uses: golangci/golangci-lint-action@v9
with:
version: latest
working-directory: go
args: --timeout=5m --tests=false

sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-go@v6
with:
go-version: '1.26'
- name: Test for coverage
working-directory: go
run: go test -coverprofile=coverage.out -covermode=atomic -count=1 ./...
- name: SonarCloud Scan
uses: SonarSource/sonarqube-scan-action@v6
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.organization=dappcore
-Dsonar.projectKey=dappcore_go-process
-Dsonar.sources=go
-Dsonar.exclusions=**/vendor/**,**/third_party/**,**/.tmp/**,**/*_test.go
-Dsonar.tests=go
-Dsonar.test.inclusions=**/*_test.go
-Dsonar.go.coverage.reportPaths=go/coverage.out
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "external/go"]
path = external/go
url = https://github.com/dappcore/go.git
branch = dev
4 changes: 2 additions & 2 deletions .woodpecker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ steps:
GOFLAGS: -buildvcs=false
GOWORK: "off"
commands:
- golangci-lint run --timeout=5m ./...
- cd go && golangci-lint run --timeout=5m ./...

- name: go-test
image: golang:1.26-alpine
Expand All @@ -25,7 +25,7 @@ steps:
CGO_ENABLED: "1"
commands:
- apk add --no-cache git build-base
- go test -race -coverprofile=coverage.out -covermode=atomic -count=1 ./...
- cd go && go test -race -coverprofile=coverage.out -covermode=atomic -count=1 ./...
- name: sonar
image: sonarsource/sonar-scanner-cli:latest
depends_on: [go-test]
Expand Down
34 changes: 33 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,39 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co

## Project Overview

`dappco.re/go/core/process` is the process management framework for CoreGO. It handles process execution (spawn, monitor, stream, kill), daemon lifecycle (PID files, health checks, graceful shutdown, registry), and pipeline orchestration (parallel, sequential, or DAG-ordered multi-process runs). All process events broadcast via Core IPC actions.
`dappco.re/go/process` is the process management framework for CoreGO. It handles process execution (spawn, monitor, stream, kill), daemon lifecycle (PID files, health checks, graceful shutdown, registry), and pipeline orchestration (parallel, sequential, or DAG-ordered multi-process runs). All process events are broadcast via Core IPC actions.

## Repo Layout

```text
core/go-process/
├── go/ ← primary Go module root (dappco.re/go/process)
│ ├── go.mod ← kept at module root to preserve import path
│ ├── go.sum
│ ├── *.go
│ ├── exec/
│ ├── pkg/
│ ├── tests/
│ ├── README.md ← symlink to repo root README.md
│ ├── CLAUDE.md ← symlink to repo root CLAUDE.md
│ ├── AGENTS.md ← symlink to repo root AGENTS.md
│ └── docs/ ← symlink to repo root docs/
├── ui/ ← TypeScript frontend UI (not part of Go module)
├── docs/ ← shared process docs/spec references
├── specs/ ← process specs YAML (cross-language)
├── .woodpecker.yml
├── sonar-project.properties
└── other cross-language repository files
```

## Go Resolution Modes

| Mode | When | What runs |
|------|------|-----------|
| **CI module mode** | CI and scripted verification | `cd go && GOWORK=off` with pinned module cache and short mode test/vet runs. This is the reproducible dependency mode. |
| **Local contributor mode** | day-to-day development | `cd go && go test ./...` from the Go module root. No `go.work` is present in this repo. |

Prefer running module tooling from `go/` so commands resolve module paths consistently.

## Commands

Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
<!-- SPDX-License-Identifier: EUPL-1.2 -->

# go-process

> Process orchestration — daemons, runners, registry, pidfiles, IPC bus

[![CI](https://github.com/dappcore/go-process/actions/workflows/ci.yml/badge.svg?branch=dev)](https://github.com/dappcore/go-process/actions/workflows/ci.yml)
[![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=dappcore_go-process&metric=alert_status)](https://sonarcloud.io/dashboard?id=dappcore_go-process)
[![Coverage](https://codecov.io/gh/dappcore/go-process/branch/dev/graph/badge.svg)](https://codecov.io/gh/dappcore/go-process)
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=dappcore_go-process&metric=security_rating)](https://sonarcloud.io/dashboard?id=dappcore_go-process)
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=dappcore_go-process&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=dappcore_go-process)
[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=dappcore_go-process&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=dappcore_go-process)
[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=dappcore_go-process&metric=code_smells)](https://sonarcloud.io/dashboard?id=dappcore_go-process)
[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=dappcore_go-process&metric=ncloc)](https://sonarcloud.io/dashboard?id=dappcore_go-process)
[![Go Reference](https://pkg.go.dev/badge/dappco.re/go/go-process.svg)](https://pkg.go.dev/dappco.re/go/go-process)
[![License: EUPL-1.2](https://img.shields.io/badge/License-EUPL--1.2-blue.svg)](https://eupl.eu/1.2/en/)


`go-process` is the process-management service for Core applications. It wraps
external command execution, lifecycle tracking, output capture, daemon PID files,
health endpoints, and REST/WebSocket provider integration around the `dappco.re/go`
Expand Down
1 change: 1 addition & 0 deletions external/go
Submodule go added at d661b7
9 changes: 9 additions & 0 deletions go.work
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
go 1.26.2

// Workspace mode for development: pulls fresh code from external/ submodules.
// CI uses GOWORK=off to fall back to go/go.mod tags (reproducible).

use (
./go
./external/go
)
1 change: 1 addition & 0 deletions go/AGENTS.md
1 change: 1 addition & 0 deletions go/CLAUDE.md
1 change: 1 addition & 0 deletions go/README.md
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions go/docs
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
17 changes: 1 addition & 16 deletions pkg/api/provider.go → go/pkg/api/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,17 +308,7 @@ func (p *ProcessProvider) runProcess(c *gin.Context) {
return
}

result := p.service.RunWithOptions(c.Request.Context(), process.RunOptions{
Command: req.Command,
Args: req.Args,
Dir: req.Dir,
Env: req.Env,
DisableCapture: req.DisableCapture,
Detach: req.Detach,
Timeout: req.Timeout,
GracePeriod: req.GracePeriod,
KillGroup: req.KillGroup,
})
result := p.service.RunWithOptions(c.Request.Context(), process.RunOptions(req))
if !result.OK {
c.JSON(http.StatusInternalServerError, failWithDetails("run_failed", result.Error(), map[string]any{
"output": "",
Expand Down Expand Up @@ -660,11 +650,6 @@ func PIDAlive(pid int) bool {
}

// intParam parses a URL param as int, returning 0 on failure.
func intParam(c *gin.Context, name string) int {
v, _ := strconv.Atoi(c.Param(name))
return v
}

func pidFromString(value string) (int, bool) {
pid, err := strconv.Atoi(core.Trim(value))
if err != nil || pid <= 0 {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 0 additions & 6 deletions pkg/api/websocket.go → go/pkg/api/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ type messageType string
const (
// typeEvent indicates a generic event.
typeEvent messageType = "event"
// typeError indicates an error message.
typeError messageType = "error"
// typeSubscribe requests subscription to a channel.
typeSubscribe messageType = "subscribe"
// typeUnsubscribe requests unsubscription from a channel.
typeUnsubscribe messageType = "unsubscribe"
)

// hubMessage is the standard WebSocket event payload emitted by the provider.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 7 additions & 17 deletions service.go → go/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (s *Service) coreApp() *core.Core {
if s == nil || s.ServiceRuntime == nil {
return nil
}
return s.ServiceRuntime.Core()
return s.Core()
}

// Options configures the process service.
Expand Down Expand Up @@ -822,22 +822,12 @@ func (s *Service) handleTask(c *core.Core, task core.Message) core.Result {
}
proc := result.Value.(*Process)
return core.Ok(proc.Info())
case TaskProcessRun:
result := s.RunWithOptions(c.Context(), RunOptions{
Command: m.Command,
Args: m.Args,
Dir: m.Dir,
Env: m.Env,
DisableCapture: m.DisableCapture,
Detach: m.Detach,
Timeout: m.Timeout,
GracePeriod: m.GracePeriod,
KillGroup: m.KillGroup,
})
if !result.OK {
return result
}
return core.Ok(result.Value)
case TaskProcessRun:
result := s.RunWithOptions(c.Context(), RunOptions(m))
if !result.OK {
return result
}
return core.Ok(result.Value)
case TaskProcessKill:
switch {
case m.ID != "":
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading
Loading