Skip to content

Commit 7914c7f

Browse files
Merge branch 'main' into dependabot/go_modules/golang.org/x/sys-0.42.0
2 parents d76bcd4 + 3e717e6 commit 7914c7f

79 files changed

Lines changed: 6221 additions & 658 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.githooks/pre-commit

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
# Pre-commit hook: fast gate (build + unit tests + race detection).
3+
# Full CI (integration, e2e, coverage thresholds) runs in CI pipeline.
4+
# Per DORA research: pre-commit should be <10s for fast feedback loops.
5+
6+
set -euo pipefail
7+
8+
echo "==> Pre-commit: build check"
9+
go build -o /dev/null ./cmd/
10+
11+
echo "==> Pre-commit: unit tests with race detection"
12+
go test -race ./pkg/chatarchive/... ./internal/chatarchivecmd/...
13+
14+
echo "Pre-commit checks passed."

.github/hooks/pre-commit

100644100755
File mode changed.
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Chat Archive Quality
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'pkg/chatarchive/**'
7+
- 'internal/chatarchivecmd/**'
8+
- 'cmd/create/chat_archive.go'
9+
- 'cmd/backup/chats.go'
10+
- 'test/e2e/**'
11+
- 'scripts/chatarchive-ci.sh'
12+
- 'package.json'
13+
- '.github/hooks/pre-commit'
14+
- '.github/hooks/setup-hooks.sh'
15+
- 'scripts/install-git-hooks.sh'
16+
- '.github/workflows/chatarchive-quality.yml'
17+
push:
18+
branches:
19+
- main
20+
- develop
21+
paths:
22+
- 'pkg/chatarchive/**'
23+
- 'internal/chatarchivecmd/**'
24+
- 'cmd/create/chat_archive.go'
25+
- 'cmd/backup/chats.go'
26+
- 'test/e2e/**'
27+
- 'scripts/chatarchive-ci.sh'
28+
- 'package.json'
29+
- '.github/hooks/pre-commit'
30+
- '.github/hooks/setup-hooks.sh'
31+
- 'scripts/install-git-hooks.sh'
32+
- '.github/workflows/chatarchive-quality.yml'
33+
34+
jobs:
35+
chatarchive-ci:
36+
name: Chat Archive CI (${{ matrix.os }})
37+
runs-on: ${{ matrix.os }}
38+
strategy:
39+
fail-fast: false
40+
matrix:
41+
os: [ubuntu-latest, macos-latest, windows-latest]
42+
43+
steps:
44+
- name: Checkout
45+
uses: actions/checkout@v4
46+
47+
- name: Set up Go
48+
uses: actions/setup-go@v5
49+
with:
50+
go-version-file: 'go.mod'
51+
52+
- name: Set up Node
53+
uses: actions/setup-node@v4
54+
with:
55+
node-version: '20'
56+
57+
- name: Download Go modules
58+
run: go mod download
59+
shell: bash
60+
61+
- name: Run chat archive CI
62+
run: npm run ci
63+
shell: bash
64+
65+
- name: Upload verification summary
66+
if: always()
67+
uses: actions/upload-artifact@v4
68+
with:
69+
name: chatarchive-summary-${{ matrix.os }}
70+
path: outputs/chatarchive-ci/
71+
72+
- name: Publish job summary
73+
if: always()
74+
shell: bash
75+
run: |
76+
if [[ -f outputs/chatarchive-ci/summary.txt ]]; then
77+
cat outputs/chatarchive-ci/summary.txt >> "$GITHUB_STEP_SUMMARY"
78+
fi

.github/workflows/ci.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ PY
161161
run: scripts/ci/preflight.sh
162162

163163
- name: Install golangci-lint
164-
run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.0.0
164+
run: bash scripts/ci/install-golangci-lint.sh
165165

166166
- name: Run lint lane
167167
env:
@@ -245,6 +245,10 @@ PY
245245
run: |
246246
test -f outputs/ci/unit/report.json && cat outputs/ci/unit/report.json || true
247247
248+
- name: Alert on unit lane report
249+
if: always()
250+
run: python3 scripts/ci/report-alert.py ci-unit outputs/ci/unit/report.json
251+
248252
ci-deps-unit:
249253
name: ci-deps-unit
250254
runs-on: ubuntu-latest
@@ -295,6 +299,10 @@ PY
295299
run: |
296300
test -f outputs/ci/deps-unit/report.json && cat outputs/ci/deps-unit/report.json || true
297301
302+
- name: Alert on dependency-focused unit lane report
303+
if: always()
304+
run: python3 scripts/ci/report-alert.py ci-deps-unit outputs/ci/deps-unit/report.json
305+
298306
ci-integration:
299307
name: ci-integration
300308
runs-on: ubuntu-latest
@@ -344,6 +352,10 @@ PY
344352
run: |
345353
test -f outputs/ci/integration/report.json && cat outputs/ci/integration/report.json || true
346354
355+
- name: Alert on integration lane report
356+
if: always()
357+
run: python3 scripts/ci/report-alert.py ci-integration outputs/ci/integration/report.json
358+
347359
ci-e2e-smoke:
348360
name: ci-e2e-smoke
349361
runs-on: ubuntu-latest
@@ -391,6 +403,10 @@ PY
391403
run: |
392404
test -f outputs/ci/e2e-smoke/report.json && cat outputs/ci/e2e-smoke/report.json || true
393405
406+
- name: Alert on e2e smoke lane report
407+
if: always()
408+
run: python3 scripts/ci/report-alert.py ci-e2e-smoke outputs/ci/e2e-smoke/report.json
409+
394410
ci-fuzz:
395411
name: ci-fuzz
396412
runs-on: ubuntu-latest
@@ -438,6 +454,10 @@ PY
438454
run: |
439455
test -f outputs/ci/fuzz/report.json && cat outputs/ci/fuzz/report.json || true
440456
457+
- name: Alert on fuzz lane report
458+
if: always()
459+
run: python3 scripts/ci/report-alert.py ci-fuzz outputs/ci/fuzz/report.json
460+
441461
ci-e2e-full:
442462
name: ci-e2e-full
443463
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
@@ -485,3 +505,7 @@ PY
485505
if: always()
486506
run: |
487507
test -f outputs/ci/e2e-full/report.json && cat outputs/ci/e2e-full/report.json || true
508+
509+
- name: Alert on e2e full lane report
510+
if: always()
511+
run: python3 scripts/ci/report-alert.py ci-e2e-full outputs/ci/e2e-full/report.json

.pre-commit-config.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ repos:
4747
# Local hooks for custom checks
4848
- repo: local
4949
hooks:
50-
# Enforce local/CI parity lane via mage-compatible entrypoint
50+
# Enforce local/CI parity lane via npm wrapper
5151
- id: ci-debug-parity
52-
name: CI debug parity gate (magew ci:debug)
53-
entry: ./magew ci:debug
52+
name: CI debug parity gate (npm run ci:debug)
53+
entry: npm run ci:debug --silent
5454
language: system
5555
pass_filenames: false
5656
require_serial: true
@@ -80,13 +80,13 @@ repos:
8080
pass_filenames: false
8181
description: Ensures code compiles successfully
8282

83-
# Verify E2E tests have build tags
84-
- id: verify-e2e-build-tags
85-
name: Verify E2E build tags
86-
entry: bash -c 'for f in test/e2e/*_test.go; do head -1 "$f" | grep -q "//go:build e2e" || { echo "ERROR: $f missing //go:build e2e tag"; exit 1; }; done'
83+
# Verify environment-dependent tests are build-tagged
84+
- id: verify-test-build-tags
85+
name: Verify test build tags
86+
entry: bash scripts/ci/check-test-tags.sh
8787
language: system
8888
pass_filenames: false
89-
description: Ensures all E2E tests have proper build tags
89+
description: Ensures environment-dependent tests keep their explicit build tags
9090

9191
# Check for deprecated benchmark pattern
9292
- id: check-benchmark-pattern

cmd/create/chat_archive.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// cmd/create/chat_archive.go
2+
//
3+
// Thin orchestration layer for chat-archive. Business logic lives in
4+
// pkg/chatarchive/ per the cmd/ vs pkg/ enforcement rule.
5+
6+
package create
7+
8+
import (
9+
"github.com/CodeMonkeyCybersecurity/eos/internal/chatarchivecmd"
10+
eos "github.com/CodeMonkeyCybersecurity/eos/pkg/eos_cli"
11+
"github.com/CodeMonkeyCybersecurity/eos/pkg/eos_io"
12+
"github.com/spf13/cobra"
13+
)
14+
15+
// CreateChatArchiveCmd copies and deduplicates chat transcripts.
16+
var CreateChatArchiveCmd = &cobra.Command{
17+
Use: "chat-archive",
18+
Short: "Copy and deduplicate chat transcripts into a local archive",
19+
Long: `Find transcript-like files (jsonl/json/html), copy unique files into one archive,
20+
and write an index manifest with duplicate mappings.
21+
22+
Examples:
23+
eos create chat-archive
24+
eos create chat-archive --source ~/.claude --source ~/dev
25+
eos create chat-archive --exclude conversation-api --exclude .cache
26+
eos create chat-archive --dry-run`,
27+
RunE: eos.Wrap(runCreateChatArchive),
28+
}
29+
30+
func init() {
31+
CreateCmd.AddCommand(CreateChatArchiveCmd)
32+
chatarchivecmd.BindFlags(CreateChatArchiveCmd)
33+
}
34+
35+
func runCreateChatArchive(rc *eos_io.RuntimeContext, cmd *cobra.Command, _ []string) error {
36+
return chatarchivecmd.Run(rc, cmd)
37+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
*Last Updated: 2026-03-21*
2+
3+
# pkg/inspect Follow-Up Issues
4+
5+
Issues discovered during adversarial review of `pkg/inspect/docker.go`.
6+
7+
## Issue 1: output.go / terraform_modular.go — 37 staticcheck warnings (P2)
8+
9+
**Problem**: `WriteString(fmt.Sprintf(...))` should be `fmt.Fprintf(...)` throughout output.go and terraform_modular.go.
10+
**Impact**: Performance (unnecessary string allocation) and lint noise.
11+
**Fix**: Replace all `tf.WriteString(fmt.Sprintf(...))` with `fmt.Fprintf(tf, ...)`.
12+
**Files**: `pkg/inspect/output.go`, `pkg/inspect/terraform_modular.go`
13+
**Effort**: ~30 min mechanical refactor
14+
15+
## Issue 2: services.go — unchecked filepath.Glob error (P2)
16+
17+
**Problem**: `pkg/inspect/services.go:381` ignores `filepath.Glob` error.
18+
**Impact**: Silent failure when glob patterns are invalid.
19+
**Fix**: Check and log the error.
20+
**Effort**: 5 min
21+
22+
## Issue 3: kvm.go — goconst violations (P3)
23+
24+
**Problem**: String constants `"active"`, `"UUID"` repeated without named constants.
25+
**Impact**: Violates P0 Rule #12 (no hardcoded values).
26+
**Fix**: Extract to constants in `kvm.go` or a `constants.go` file.
27+
**Effort**: 15 min
28+
29+
## Issue 4: Pre-existing lint issues across 30+ files on this branch (P1)
30+
31+
**Problem**: `npm run ci` fails due to 165 lint issues across the branch.
32+
**Impact**: Cannot merge until resolved.
33+
**Root cause**: Accumulated tech debt from many feature PRs merged without lint cleanup.
34+
**Fix**: Dedicated lint cleanup pass before PR merge.
35+
**Effort**: 2-4 hours
36+
37+
## Issue 5: Inspector lacks Docker SDK integration (P3)
38+
39+
**Problem**: All Docker operations use shell commands instead of the Docker SDK.
40+
**Impact**: Fragile parsing, no type safety, extra process spawns.
41+
**Fix**: Migrate to `github.com/docker/docker/client` SDK for container/image/network/volume operations.
42+
**Rationale**: CLAUDE.md P1 states "ALWAYS use Docker SDK" for container operations.
43+
**Effort**: 1-2 days
44+
45+
## Issue 6: Compose file search does not guard against TOCTOU (P3)
46+
47+
**Problem**: Between `os.Stat` size check and `os.ReadFile`, the file could be replaced.
48+
**Impact**: Theoretical DoS via race condition on symlink swap.
49+
**Fix**: Read file first, then check size of bytes read (simpler and race-free).
50+
**Effort**: 15 min

go.mod

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ require (
3737
github.com/hetznercloud/hcloud-go/v2 v2.29.0
3838
github.com/joho/godotenv v1.5.1
3939
github.com/lib/pq v1.11.2
40-
github.com/olekukonko/tablewriter v1.1.3
40+
github.com/olekukonko/tablewriter v1.1.4
4141
github.com/open-policy-agent/opa v1.14.0
4242
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2
4343
github.com/redis/go-redis/v9 v9.18.0
@@ -105,9 +105,8 @@ require (
105105
github.com/charmbracelet/x/cellbuf v0.0.15 // indirect
106106
github.com/charmbracelet/x/exp/golden v0.0.0-20251023181713-f594ac034d6b // indirect
107107
github.com/charmbracelet/x/term v0.2.2 // indirect
108-
github.com/clipperhouse/displaywidth v0.9.0 // indirect
109-
github.com/clipperhouse/stringish v0.1.1 // indirect
110-
github.com/clipperhouse/uax29/v2 v2.5.0 // indirect
108+
github.com/clipperhouse/displaywidth v0.10.0 // indirect
109+
github.com/clipperhouse/uax29/v2 v2.6.0 // indirect
111110
github.com/cloudflare/circl v1.6.1 // indirect
112111
github.com/cockroachdb/apd/v3 v3.2.1 // indirect
113112
github.com/cockroachdb/logtags v0.0.0-20241215232642-bb51bb14a506 // indirect
@@ -199,8 +198,8 @@ require (
199198
github.com/muesli/termenv v0.16.0 // indirect
200199
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
201200
github.com/olekukonko/cat v0.0.0-20250911104152-50322a0618f6 // indirect
202-
github.com/olekukonko/errors v1.1.0 // indirect
203-
github.com/olekukonko/ll v0.1.4-0.20260115111900-9e59c2286df0 // indirect
201+
github.com/olekukonko/errors v1.2.0 // indirect
202+
github.com/olekukonko/ll v0.1.6 // indirect
204203
github.com/opencontainers/go-digest v1.0.0 // indirect
205204
github.com/opencontainers/image-spec v1.1.1 // indirect
206205
github.com/pelletier/go-toml/v2 v2.2.4 // indirect

go.sum

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,10 @@ github.com/charmbracelet/x/term v0.2.2 h1:xVRT/S2ZcKdhhOuSP4t5cLi5o+JxklsoEObBSg
9191
github.com/charmbracelet/x/term v0.2.2/go.mod h1:kF8CY5RddLWrsgVwpw4kAa6TESp6EB5y3uxGLeCqzAI=
9292
github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag=
9393
github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I=
94-
github.com/clipperhouse/displaywidth v0.9.0 h1:Qb4KOhYwRiN3viMv1v/3cTBlz3AcAZX3+y9OLhMtAtA=
95-
github.com/clipperhouse/displaywidth v0.9.0/go.mod h1:aCAAqTlh4GIVkhQnJpbL0T/WfcrJXHcj8C0yjYcjOZA=
96-
github.com/clipperhouse/stringish v0.1.1 h1:+NSqMOr3GR6k1FdRhhnXrLfztGzuG+VuFDfatpWHKCs=
97-
github.com/clipperhouse/stringish v0.1.1/go.mod h1:v/WhFtE1q0ovMta2+m+UbpZ+2/HEXNWYXQgCt4hdOzA=
98-
github.com/clipperhouse/uax29/v2 v2.5.0 h1:x7T0T4eTHDONxFJsL94uKNKPHrclyFI0lm7+w94cO8U=
99-
github.com/clipperhouse/uax29/v2 v2.5.0/go.mod h1:Wn1g7MK6OoeDT0vL+Q0SQLDz/KpfsVRgg6W7ihQeh4g=
94+
github.com/clipperhouse/displaywidth v0.10.0 h1:GhBG8WuerxjFQQYeuZAeVTuyxuX+UraiZGD4HJQ3Y8g=
95+
github.com/clipperhouse/displaywidth v0.10.0/go.mod h1:XqJajYsaiEwkxOj4bowCTMcT1SgvHo9flfF3jQasdbs=
96+
github.com/clipperhouse/uax29/v2 v2.6.0 h1:z0cDbUV+aPASdFb2/ndFnS9ts/WNXgTNNGFoKXuhpos=
97+
github.com/clipperhouse/uax29/v2 v2.6.0/go.mod h1:Wn1g7MK6OoeDT0vL+Q0SQLDz/KpfsVRgg6W7ihQeh4g=
10098
github.com/cloudflare/circl v1.6.1 h1:zqIqSPIndyBh1bjLVVDHMPpVKqp8Su/V+6MeDzzQBQ0=
10199
github.com/cloudflare/circl v1.6.1/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs=
102100
github.com/cockroachdb/apd/v3 v3.2.1 h1:U+8j7t0axsIgvQUqthuNm82HIrYXodOV2iWLWtEaIwg=
@@ -462,12 +460,12 @@ github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRW
462460
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
463461
github.com/olekukonko/cat v0.0.0-20250911104152-50322a0618f6 h1:zrbMGy9YXpIeTnGj4EljqMiZsIcE09mmF8XsD5AYOJc=
464462
github.com/olekukonko/cat v0.0.0-20250911104152-50322a0618f6/go.mod h1:rEKTHC9roVVicUIfZK7DYrdIoM0EOr8mK1Hj5s3JjH0=
465-
github.com/olekukonko/errors v1.1.0 h1:RNuGIh15QdDenh+hNvKrJkmxxjV4hcS50Db478Ou5sM=
466-
github.com/olekukonko/errors v1.1.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y=
467-
github.com/olekukonko/ll v0.1.4-0.20260115111900-9e59c2286df0 h1:jrYnow5+hy3WRDCBypUFvVKNSPPCdqgSXIE9eJDD8LM=
468-
github.com/olekukonko/ll v0.1.4-0.20260115111900-9e59c2286df0/go.mod h1:b52bVQRRPObe+yyBl0TxNfhesL0nedD4Cht0/zx55Ew=
469-
github.com/olekukonko/tablewriter v1.1.3 h1:VSHhghXxrP0JHl+0NnKid7WoEmd9/urKRJLysb70nnA=
470-
github.com/olekukonko/tablewriter v1.1.3/go.mod h1:9VU0knjhmMkXjnMKrZ3+L2JhhtsQ/L38BbL3CRNE8tM=
463+
github.com/olekukonko/errors v1.2.0 h1:10Zcn4GeV59t/EGqJc8fUjtFT/FuUh5bTMzZ1XwmCRo=
464+
github.com/olekukonko/errors v1.2.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y=
465+
github.com/olekukonko/ll v0.1.6 h1:lGVTHO+Qc4Qm+fce/2h2m5y9LvqaW+DCN7xW9hsU3uA=
466+
github.com/olekukonko/ll v0.1.6/go.mod h1:NVUmjBb/aCtUpjKk75BhWrOlARz3dqsM+OtszpY4o88=
467+
github.com/olekukonko/tablewriter v1.1.4 h1:ORUMI3dXbMnRlRggJX3+q7OzQFDdvgbN9nVWj1drm6I=
468+
github.com/olekukonko/tablewriter v1.1.4/go.mod h1:+kedxuyTtgoZLwif3P1Em4hARJs+mVnzKxmsCL/C5RY=
471469
github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k=
472470
github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY=
473471
github.com/open-policy-agent/opa v1.14.0 h1:sdG94h9GrZQQcTaH70fJhOuU+/C2FAeeAo8mSPssV/U=

0 commit comments

Comments
 (0)