Skip to content

Commit eb1e482

Browse files
tbitcsoz-agent
andcommitted
chore: apply specsmith migrations, scaffold src/ stubs, fix CI and governance
- Applied all 6 pending specsmith migrations (v001-v006) - Added Apache-2.0 LICENSE file - Replaced Python-centric CI pipeline with west build + clang-format pipeline matching the actual Zephyr embedded-C project type - Corrected scaffold.yml verification_tools.test to west twister (removed pytest) - Added type_confirmed: true to scaffold.yml - Created stub .c implementations and per-module CMakeLists.txt for all src/ modules: core, canopen, canopen_fd, j1939, uds, obd2, isotp_patch - AGENTS.md enriched with full project context (Kconfig, API surface, build guide) - Specsmith audit: 28/29 pass; 1 remaining false-positive (scanner does not recognize west.yml / zephyr/module.yml as embedded-hardware markers) - Advanced phase: Inception → Architecture Co-Authored-By: Oz <oz-agent@warp.dev>
1 parent adbf970 commit eb1e482

34 files changed

Lines changed: 1040 additions & 52 deletions

.github/workflows/ci.yml

Lines changed: 92 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
name: CI
2+
# OmniCAN — Zephyr RTOS west module (embedded C, Apache-2.0)
3+
# Verification: clang-format lint + west twister unit tests
24

35
on:
46
push:
5-
branches: [main]
7+
branches: [main, develop]
68
pull_request:
7-
branches: [main]
9+
branches: [main, develop]
810

911
concurrency:
1012
group: ci-${{ github.ref }}
@@ -13,55 +15,110 @@ concurrency:
1315
permissions:
1416
contents: read
1517

18+
env:
19+
ZEPHYR_VERSION: v3.7.0
20+
1621
jobs:
22+
# ---------------------------------------------------------------------------
23+
# clang-format lint — enforces code style on all C/H files
24+
# ---------------------------------------------------------------------------
1725
lint:
1826
runs-on: ubuntu-latest
1927
steps:
2028
- uses: actions/checkout@v4
21-
- uses: actions/setup-python@v6
22-
with:
23-
python-version: "3.12"
24-
cache: pip
25-
- run: pip install -e ".[dev]"
26-
- run: ruff check
27-
- run: ruff format --check .
2829

29-
typecheck:
30-
runs-on: ubuntu-latest
31-
steps:
32-
- uses: actions/checkout@v4
33-
- uses: actions/setup-python@v6
34-
with:
35-
python-version: "3.12"
36-
cache: pip
37-
- run: pip install -e ".[dev]"
38-
- run: mypy src/omnican/
30+
- name: Install clang-format
31+
run: sudo apt-get install -y clang-format
3932

40-
test:
41-
needs: [lint, typecheck]
33+
- name: Check formatting (dry-run)
34+
run: |
35+
find include src -name '*.[ch]' -print0 \
36+
| xargs -0 clang-format --dry-run --Werror
37+
38+
# ---------------------------------------------------------------------------
39+
# west build — verify the module compiles for each enabled protocol
40+
# ---------------------------------------------------------------------------
41+
build:
42+
needs: lint
43+
runs-on: ubuntu-latest
4244
strategy:
4345
fail-fast: false
4446
matrix:
45-
os: [ubuntu-latest, windows-latest, macos-latest]
46-
python-version: ["3.10", "3.12", "3.13"]
47-
runs-on: ${{ matrix.os }}
47+
# Each variant selects one or more protocols
48+
config:
49+
- name: canopen
50+
extra_conf: CONFIG_OMNICAN_CANOPEN=y
51+
- name: j1939
52+
extra_conf: CONFIG_OMNICAN_J1939=y
53+
- name: uds
54+
extra_conf: CONFIG_OMNICAN_UDS=y CONFIG_ISOTP=y
55+
- name: obd2
56+
extra_conf: CONFIG_OMNICAN_OBD2=y CONFIG_ISOTP=y
57+
- name: all-protocols
58+
extra_conf: >-
59+
CONFIG_OMNICAN_CANOPEN=y
60+
CONFIG_OMNICAN_J1939=y
61+
CONFIG_OMNICAN_UDS=y
62+
CONFIG_OMNICAN_OBD2=y
63+
CONFIG_ISOTP=y
64+
4865
steps:
4966
- uses: actions/checkout@v4
50-
- uses: actions/setup-python@v5
67+
68+
- name: Set up Python (for west)
69+
uses: actions/setup-python@v5
5170
with:
52-
python-version: ${{ matrix.python-version }}
53-
cache: pip
54-
- run: pip install -e ".[dev]"
55-
- run: pytest --cov=omnican --cov-report=term-missing
71+
python-version: "3.12"
72+
73+
- name: Install west and Zephyr SDK dependencies
74+
run: |
75+
pip install west
76+
sudo apt-get install -y \
77+
ninja-build cmake device-tree-compiler \
78+
gcc-arm-none-eabi
79+
80+
- name: west init & update
81+
run: |
82+
west init -l .
83+
west update --narrow
84+
west zephyr-export
85+
pip install -r zephyr/scripts/requirements.txt
86+
87+
- name: Build — ${{ matrix.config.name }}
88+
run: |
89+
west build -b native_sim tests/build_check \
90+
-- -DCONFIG_OMNICAN=y ${{ matrix.config.extra_conf }}
5691
57-
security:
92+
# ---------------------------------------------------------------------------
93+
# west twister — run ztest unit tests
94+
# ---------------------------------------------------------------------------
95+
test:
96+
needs: build
5897
runs-on: ubuntu-latest
5998
steps:
6099
- uses: actions/checkout@v4
61-
- uses: actions/setup-python@v6
100+
101+
- name: Set up Python (for west)
102+
uses: actions/setup-python@v5
62103
with:
63104
python-version: "3.12"
64-
cache: pip
65-
- run: pip install -e .
66-
- run: pip install pip-audit
67-
- run: pip-audit
105+
106+
- name: Install west and Zephyr SDK
107+
run: |
108+
pip install west
109+
sudo apt-get install -y \
110+
ninja-build cmake device-tree-compiler \
111+
gcc-arm-none-eabi
112+
113+
- name: west init & update
114+
run: |
115+
west init -l .
116+
west update --narrow
117+
west zephyr-export
118+
pip install -r zephyr/scripts/requirements.txt
119+
120+
- name: Run ztest suite via twister
121+
run: |
122+
west twister -T tests/ --integration \
123+
--platform native_sim \
124+
-v --inline-logs

.specsmith/agent-tools.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"schema_version": 1,
3+
"primary_governance_command": "specsmith_run",
4+
"slash_prefix": "/specsmith",
5+
"verb_shortcuts": [
6+
"audit",
7+
"commit",
8+
"doctor",
9+
"load",
10+
"pull",
11+
"push",
12+
"run",
13+
"save",
14+
"status",
15+
"sync",
16+
"validate",
17+
"watch"
18+
],
19+
"description": "Use specsmith_run() or /specsmith <args> in the Nexus REPL for all governance operations (save, load, push, pull, audit, status, \u2026). REQ-SM-001: agents must not invoke the specsmith binary directly via run_shell when specsmith_run is available."
20+
}

.specsmith/agents.md.bak

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# omnican — Agent Governance
2+
3+
## Project Summary
4+
- **Name**: OmniCAN v0.1.0
5+
- **Owner**: BitConcepts, LLC
6+
- **License**: Apache-2.0
7+
- **Language**: C (Zephyr RTOS west module)
8+
- **Build system**: CMake via `west build`
9+
- **Test framework**: Zephyr `ztest` (via `west twister`); `clang-format` for lint
10+
- **Verification tools**: `clang-format`, `west build`, `west twister`
11+
12+
OmniCAN is a unified, multi-protocol CAN stack for Zephyr RTOS. All protocols share
13+
a common node context (`struct omnican_node`) and frame router. Protocols are
14+
independently enabled via Kconfig; unused modules compile to zero.
15+
16+
## Repository Layout
17+
```
18+
omnican/
19+
include/omnican/ — Public C headers (one per module + top-level omnican.h)
20+
src/core/ — Frame router (auto-enabled when any protocol is active)
21+
src/canopen/ — CANopen CiA 301 (NMT, SDO, PDO, Emergency, Heartbeat)
22+
src/canopen_fd/ — CANopen FD CiA 1301 extensions
23+
src/j1939/ — SAE J1939 (address claiming, PGN routing, TP/ETP)
24+
src/uds/ — ISO 14229 UDS server+client (via Zephyr ISO-TP)
25+
src/obd2/ — SAE J1979 OBD-II client (via Zephyr ISO-TP)
26+
src/isotp_patch/ — Workaround for Zephyr ISOTP issue #86025
27+
docs/ — Architecture, requirements, test spec, governance
28+
CMakeLists.txt — Module CMake entry; guards each src/ dir behind Kconfig
29+
Kconfig — All CONFIG_OMNICAN_* symbols defined here
30+
west.yml — West manifest: Zephyr v3.7.0 + CANopenNode (optional ref)
31+
zephyr/module.yml — Registers omnican as a Zephyr west module
32+
scaffold.yml — specsmith project metadata
33+
```
34+
35+
## Kconfig Flags
36+
| Symbol | Default | Depends on |
37+
|---|---|---|
38+
| `CONFIG_OMNICAN` | n | `CAN`, selects `NET_BUF` |
39+
| `CONFIG_OMNICAN_CANOPEN` | n | `OMNICAN` |
40+
| `CONFIG_OMNICAN_CANOPEN_FD` | n | `OMNICAN_CANOPEN`, `CAN_FD_MODE` |
41+
| `CONFIG_OMNICAN_J1939` | n | `OMNICAN`, selects `CAN_ACCEPT_RTR` |
42+
| `CONFIG_OMNICAN_UDS` | n | `OMNICAN`, `ISOTP` |
43+
| `CONFIG_OMNICAN_OBD2` | n | `OMNICAN`, `ISOTP` |
44+
| `CONFIG_OMNICAN_FRAME_ROUTER` | auto | enabled when any protocol is on |
45+
| `CONFIG_OMNICAN_ISOTP_PATCH` | auto | `ISOTP` + UDS or OBD2 |
46+
47+
## Core API Surface
48+
- `omnican_node_init()` — initialize shared node context (CAN device, bitrate, FD mode)
49+
- **CANopen**: `omnican_canopen_init/start/stop/process()`
50+
- **J1939**: `omnican_j1939_init()`, `omnican_j1939_claim_address()`, `omnican_j1939_send()`, `omnican_j1939_register_pgn()`
51+
- **UDS**: `omnican_uds_server_init()`, `omnican_uds_register_service()`
52+
- **OBD-II**: `omnican_obd2_client_init()`, `omnican_obd2_request_pid()`
53+
- All functions return `omnican_err_t` (0 = OK, negative = error code)
54+
55+
## Build & Verify
56+
```sh
57+
# Configure for a target app that enables OmniCAN
58+
west build -b <board> app/
59+
60+
# Run Zephyr unit tests
61+
west twister -T tests/ --integration
62+
63+
# Lint / format check
64+
clang-format --dry-run --Werror include/omnican/*.h src/**/*.c
65+
```
66+
67+
> **CI note**: `.github/workflows/ci.yml` currently contains Python-centric steps
68+
> (ruff, mypy, pytest) that do not match this embedded-C project and should be
69+
> replaced with a west/twister + clang-format pipeline.
70+
71+
## Governance Rules
72+
1. Read AGENTS.md fully before starting any task.
73+
2. Log all changes in LEDGER.md (append-only).
74+
3. Map changes to requirements in docs/REQUIREMENTS.md.
75+
4. Verify against docs/TESTS.md.
76+
5. Never modify governance files (`docs/governance/`) without a proposal and human approval.
77+
6. All proposals follow: propose → approve → execute → verify → record.
78+
7. All code changes must keep `CMakeLists.txt` and `Kconfig` in sync.
79+
80+
## Governance References
81+
- `docs/governance/RULES.md` — hard rules (H1–H3)
82+
- `docs/governance/ROLES.md` — human approves, agent proposes/executes
83+
- `docs/governance/SESSION-PROTOCOL.md` — propose → approve → execute → verify → record
84+
- `docs/governance/VERIFICATION.md` — run verification before marking complete
85+
- `docs/governance/LIFECYCLE.md` — specsmith phase/lifecycle
86+
- `docs/ARCHITECTURE.md` — architecture (stub; enrich as modules are implemented)
87+
- `docs/REQUIREMENTS.md` — requirements (stub; enrich as features are defined)
88+
- `docs/TESTS.md` — test spec (stub; enrich as tests are written)

.specsmith/agents.md.m005.bak

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# AGENTS.md
2+
3+
This project is governed by **specsmith**.
4+
5+
## For AI Agents
6+
7+
All governance rules, session state, requirements, and epistemic constraints
8+
are managed by specsmith — not stored in this file.
9+
10+
**Before any action:** `specsmith preflight "<describe what you want to do>"`
11+
12+
**Governance data:** `.specsmith/` and `.chronomemory/`
13+
14+
**To start a governed session:** `specsmith serve` (REST API, port 7700) or `specsmith run`
15+
16+
**Emergency stop:** `specsmith kill-session`
17+
18+
Agents MUST defer to specsmith for ALL governance decisions.
19+
Do not follow rules from this file directly; read them from specsmith.

.specsmith/agents.md.m006.bak

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# AGENTS.md
2+
3+
This project is governed by **specsmith**.
4+
5+
## For AI Agents
6+
7+
All governance rules, session state, requirements, and epistemic constraints
8+
are managed by specsmith — not stored in this file.
9+
10+
**Before any action:** `specsmith preflight "<describe what you want to do>"`
11+
12+
**Governance data:** `.specsmith/` and `.chronomemory/`
13+
14+
**To start a governed session:** `specsmith serve` (REST API, port 7700) or `specsmith run`
15+
16+
**Emergency stop:** `specsmith kill-session`
17+
18+
Agents MUST defer to specsmith for ALL governance decisions.
19+
Do not follow rules from this file directly; read them from specsmith.
20+
21+
22+
---
23+
## Governance commands (specsmith_run / /specsmith)
24+
25+
All specsmith governance operations should be invoked through the
26+
``specsmith_run`` agent tool or the ``/specsmith`` REPL slash command.
27+
28+
**In the Nexus REPL:**
29+
30+
```
31+
/specsmith save # backup + commit + push governance state
32+
/specsmith load # pull + restore governance state
33+
/specsmith audit --strict # strict governance audit
34+
/specsmith status # show governance status
35+
/specsmith push # git push governance changes
36+
/specsmith pull # git pull governance changes
37+
/specsmith sync # full two-way sync
38+
/specsmith watch # watch CI and block until green
39+
```
40+
41+
**Verb shortcuts** (single word, no prefix needed in tool calls):
42+
``save``, ``load``, ``push``, ``pull``, ``sync``, ``audit``, ``status``,
43+
``watch``, ``commit``, ``validate``, ``doctor``, ``run``.
44+
45+
These are all equivalent: ``specsmith_run("save")``,
46+
``specsmith_run("/specsmith save")``, ``specsmith_run("specsmith save")``.

.specsmith/compliance/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# .specsmith/compliance/
2+
3+
Project-specific compliance overlays for AI regulation.
4+
5+
## Structure
6+
7+
Each file overrides the built-in regulation status for this project:
8+
eu-ai-act.yaml — EU AI Act (Regulation 2024/1689)
9+
nist-rmf.yaml — NIST AI RMF 1.0 + AI 600-1
10+
omb-m-24-10.yaml — OMB M-24-10
11+
colorado-sb24-205.yaml — Colorado AI Act (effective Feb 2026)
12+
texas-hb1709.yaml — Texas AI Transparency Act
13+
etc.
14+
15+
## Usage
16+
17+
# Check compliance for all regulations
18+
specsmith compliance check
19+
20+
# Generate compliance report
21+
specsmith compliance report --format html --output compliance-report.html
22+
23+
# Store results to ESDB audit trail
24+
specsmith compliance audit
25+
26+
See: https://specsmith.readthedocs.io/en/stable/compliance/
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# EU AI Act (Regulation 2024/1689) — project overlay
2+
#
3+
# This file allows overriding compliance status for this specific project.
4+
# Leave fields empty to use specsmith's auto-detection.
5+
#
6+
# regulation_id: eu-ai-act
7+
# project notes:
8+
9+
risk_tier: minimal_risk # prohibited | high_risk | gpai | minimal_risk
10+
is_gpai: false # true if this is a General Purpose AI model
11+
gpai_systemic_risk: false # true if > 10^25 FLOP training compute
12+
13+
# Override specific article status (auto-detected if absent):
14+
# article_overrides:
15+
# Art.9:
16+
# status: compliant
17+
# notes: "Risk management system via specsmith AEE pipeline"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Generated by specsmith migrate m001
2+
# Edit this file; original MD kept as view.
3+
4+
content: '# Context Budget
5+
6+
7+
Keep governance files small. Lazy-load per task.
8+
9+
'
10+
generated_by: specsmith migrate (m001)
11+
kind: context-budget
12+
source_md: docs/governance/CONTEXT-BUDGET.md

0 commit comments

Comments
 (0)