Skip to content

Commit ef35d18

Browse files
committed
Showcase greenfield BEAR baseline
1 parent ad977be commit ef35d18

17 files changed

Lines changed: 1027 additions & 111 deletions

AGENTS.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
# AGENTS.md (Project Bootstrap)
1+
# AGENTS.md (Project Bootstrap)
22

33
This project uses the BEAR agent profile.
44

55
Startup (mandatory):
6-
1. Read `.bear/agent/BEAR_AGENT.md`.
7-
2. Follow `.bear/agent/BEAR_AGENT.md` for the full session.
6+
1. Read `.bear/agent/BOOTSTRAP.md`.
7+
2. Follow `.bear/agent/BOOTSTRAP.md` for the full session.
88

99
Safety (mandatory before cleanup/delete commands):
1010
1. Read `doc/SAFETY_RULES.md`.
1111
2. Do not run ad-hoc recursive deletes.
1212
3. Use `scripts/safe-clean-temp.ps1` for temp cleanup.
13+

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ CI demo:
2020
- `scenario/02-feature-extension -> baseline/greenfield-output`
2121

2222
Product specification:
23-
- `doc/SPEC.md`
23+
- `spec/SPEC.md`
2424

2525
Branch context:
26-
- Branch role: demo main/spec-only base
27-
- Use this branch as the PR target for the greenfield baseline review.
26+
- Branch role: greenfield showcase review branch
27+
- Cut from: `main`
28+
- Use this governance base for `pr-check`: `origin/main`

bear-ir/account.bear.yaml

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
version: v1
2+
block:
3+
name: Account
4+
kind: logic
5+
operations:
6+
- name: CreateAccount
7+
contract:
8+
inputs:
9+
- name: ownerId
10+
type: string
11+
outputs:
12+
- name: accountId
13+
type: string
14+
uses:
15+
allow:
16+
- port: accountStore
17+
kind: external
18+
ops: [create]
19+
- name: Deposit
20+
contract:
21+
inputs:
22+
- name: accountId
23+
type: string
24+
- name: amountCents
25+
type: int
26+
- name: requestId
27+
type: string
28+
outputs:
29+
- name: balanceCents
30+
type: int
31+
- name: txSeq
32+
type: int
33+
uses:
34+
allow:
35+
- port: accountStore
36+
kind: external
37+
ops: [get, put]
38+
- port: transactionLog
39+
kind: block
40+
targetOps: [AppendTransaction]
41+
- port: idempotency
42+
kind: external
43+
ops: [get, put]
44+
idempotency:
45+
mode: use
46+
keyFromInputs: [accountId, requestId]
47+
invariants:
48+
- kind: non_negative
49+
field: balanceCents
50+
- kind: non_negative
51+
field: txSeq
52+
- name: Withdraw
53+
contract:
54+
inputs:
55+
- name: accountId
56+
type: string
57+
- name: amountCents
58+
type: int
59+
- name: requestId
60+
type: string
61+
outputs:
62+
- name: balanceCents
63+
type: int
64+
- name: txSeq
65+
type: int
66+
uses:
67+
allow:
68+
- port: accountStore
69+
kind: external
70+
ops: [get, put]
71+
- port: transactionLog
72+
kind: block
73+
targetOps: [AppendTransaction]
74+
- port: idempotency
75+
kind: external
76+
ops: [get, put]
77+
idempotency:
78+
mode: use
79+
keyFromInputs: [accountId, requestId]
80+
invariants:
81+
- kind: non_negative
82+
field: balanceCents
83+
- kind: non_negative
84+
field: txSeq
85+
- name: GetBalance
86+
contract:
87+
inputs:
88+
- name: accountId
89+
type: string
90+
outputs:
91+
- name: balanceCents
92+
type: int
93+
uses:
94+
allow:
95+
- port: accountStore
96+
kind: external
97+
ops: [get]
98+
invariants:
99+
- kind: non_negative
100+
field: balanceCents
101+
effects:
102+
allow:
103+
- port: accountStore
104+
kind: external
105+
ops: [create, get, put]
106+
- port: transactionLog
107+
kind: block
108+
targetBlock: transaction-log
109+
targetOps: [AppendTransaction]
110+
- port: idempotency
111+
kind: external
112+
ops: [get, put]
113+
idempotency:
114+
store:
115+
port: idempotency
116+
getOp: get
117+
putOp: put
118+
invariants:
119+
- kind: non_negative
120+
field: balanceCents
121+
- kind: non_negative
122+
field: txSeq

bear-ir/transaction-log.bear.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
version: v1
2+
block:
3+
name: TransactionLog
4+
kind: logic
5+
operations:
6+
- name: AppendTransaction
7+
contract:
8+
inputs:
9+
- name: accountId
10+
type: string
11+
- name: type
12+
type: enum
13+
- name: requestId
14+
type: string
15+
- name: amountCents
16+
type: int
17+
- name: balanceAfterCents
18+
type: int
19+
outputs:
20+
- name: txSeq
21+
type: int
22+
uses:
23+
allow:
24+
- port: transactionStore
25+
kind: external
26+
ops: [append]
27+
invariants:
28+
- kind: non_negative
29+
field: txSeq
30+
- name: GetTransactions
31+
contract:
32+
inputs:
33+
- name: accountId
34+
type: string
35+
- name: sinceSeq
36+
type: int
37+
outputs:
38+
- name: transactionsJson
39+
type: string
40+
uses:
41+
allow:
42+
- port: transactionStore
43+
kind: external
44+
ops: [list]
45+
effects:
46+
allow:
47+
- port: transactionStore
48+
kind: external
49+
ops: [append, list]
50+
invariants:
51+
- kind: non_negative
52+
field: txSeq

bear.blocks.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: v1
2+
blocks:
3+
- name: account
4+
ir: bear-ir/account.bear.yaml
5+
projectRoot: .
6+
enabled: true
7+
- name: transaction-log
8+
ir: bear-ir/transaction-log.bear.yaml
9+
projectRoot: .
10+
enabled: true

doc/SPEC.md

Lines changed: 0 additions & 101 deletions
This file was deleted.

0 commit comments

Comments
 (0)