@dxos/deus 0.0.0-stage → 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +105 -0
- package/README.md +24 -2
- package/bin/deus.ts +42 -0
- package/dist/lib/chunk-blocks.mjs +151 -0
- package/dist/lib/chunk-blocks.mjs.map +1 -0
- package/dist/lib/chunk-check.mjs +452 -0
- package/dist/lib/chunk-check.mjs.map +1 -0
- package/dist/lib/chunk-completion.mjs +112 -0
- package/dist/lib/chunk-completion.mjs.map +1 -0
- package/dist/lib/chunk-extension.mjs +396 -0
- package/dist/lib/chunk-extension.mjs.map +1 -0
- package/dist/lib/chunk-parse.mjs +21 -0
- package/dist/lib/chunk-parse.mjs.map +1 -0
- package/dist/lib/cli.mjs +946 -0
- package/dist/lib/cli.mjs.map +1 -0
- package/dist/lib/extension.mjs +4 -0
- package/dist/lib/index.mjs +6 -0
- package/dist/lib/parse.mjs +4 -0
- package/dist/lib/review.mjs +260 -0
- package/dist/lib/review.mjs.map +1 -0
- package/dist/lib/spec-index.mjs +28 -0
- package/dist/lib/spec-index.mjs.map +1 -0
- package/dist/types/bin/deus.d.ts +3 -0
- package/dist/types/bin/deus.d.ts.map +1 -0
- package/dist/types/src/cli/__fixtures__/review/plugin-deps/dx.config.d.ts +8 -0
- package/dist/types/src/cli/__fixtures__/review/plugin-deps/dx.config.d.ts.map +1 -0
- package/dist/types/src/cli/__fixtures__/review/plugin-deps-diverged/dx.config.d.ts +8 -0
- package/dist/types/src/cli/__fixtures__/review/plugin-deps-diverged/dx.config.d.ts.map +1 -0
- package/dist/types/src/cli/__fixtures__/review/plugin-deps-empty/dx.config.d.ts +7 -0
- package/dist/types/src/cli/__fixtures__/review/plugin-deps-empty/dx.config.d.ts.map +1 -0
- package/dist/types/src/cli/__fixtures__/review/plugin-deps-mismatch/dx.config.d.ts +8 -0
- package/dist/types/src/cli/__fixtures__/review/plugin-deps-mismatch/dx.config.d.ts.map +1 -0
- package/dist/types/src/cli/__fixtures__/review/plugin-deps-noplugin/dx.config.d.ts +5 -0
- package/dist/types/src/cli/__fixtures__/review/plugin-deps-noplugin/dx.config.d.ts.map +1 -0
- package/dist/types/src/cli/changelog.d.ts +25 -0
- package/dist/types/src/cli/changelog.d.ts.map +1 -0
- package/dist/types/src/cli/cli.test.d.ts +2 -0
- package/dist/types/src/cli/cli.test.d.ts.map +1 -0
- package/dist/types/src/cli/errors.d.ts +183 -0
- package/dist/types/src/cli/errors.d.ts.map +1 -0
- package/dist/types/src/cli/features.d.ts +58 -0
- package/dist/types/src/cli/features.d.ts.map +1 -0
- package/dist/types/src/cli/git.d.ts +8 -0
- package/dist/types/src/cli/git.d.ts.map +1 -0
- package/dist/types/src/cli/index.d.ts +12 -0
- package/dist/types/src/cli/index.d.ts.map +1 -0
- package/dist/types/src/cli/lint.d.ts +17 -0
- package/dist/types/src/cli/lint.d.ts.map +1 -0
- package/dist/types/src/cli/qa-lint.d.ts +40 -0
- package/dist/types/src/cli/qa-lint.d.ts.map +1 -0
- package/dist/types/src/cli/qa.d.ts +86 -0
- package/dist/types/src/cli/qa.d.ts.map +1 -0
- package/dist/types/src/cli/review.d.ts +38 -0
- package/dist/types/src/cli/review.d.ts.map +1 -0
- package/dist/types/src/cli/spec-index.d.ts +17 -0
- package/dist/types/src/cli/spec-index.d.ts.map +1 -0
- package/dist/types/src/extension/blocks.d.ts +65 -0
- package/dist/types/src/extension/blocks.d.ts.map +1 -0
- package/dist/types/src/extension/check.d.ts +99 -0
- package/dist/types/src/extension/check.d.ts.map +1 -0
- package/dist/types/src/extension/check.test.d.ts +2 -0
- package/dist/types/src/extension/check.test.d.ts.map +1 -0
- package/dist/types/src/extension/code.d.ts +7 -0
- package/dist/types/src/extension/code.d.ts.map +1 -0
- package/dist/types/src/extension/complete.d.ts +6 -0
- package/dist/types/src/extension/complete.d.ts.map +1 -0
- package/dist/types/src/extension/completion.d.ts +10 -0
- package/dist/types/src/extension/completion.d.ts.map +1 -0
- package/dist/types/src/extension/constants.d.ts +6 -0
- package/dist/types/src/extension/constants.d.ts.map +1 -0
- package/dist/types/src/extension/fences.d.ts +10 -0
- package/dist/types/src/extension/fences.d.ts.map +1 -0
- package/dist/types/src/extension/gen/mdl.d.ts +3 -0
- package/dist/types/src/extension/gen/mdl.d.ts.map +1 -0
- package/dist/types/src/extension/gen/mdl.terms.d.ts +2 -0
- package/dist/types/src/extension/gen/mdl.terms.d.ts.map +1 -0
- package/dist/types/src/extension/index.d.ts +8 -0
- package/dist/types/src/extension/index.d.ts.map +1 -0
- package/dist/types/src/extension/language.d.ts +20 -0
- package/dist/types/src/extension/language.d.ts.map +1 -0
- package/dist/types/src/extension/lint.d.ts +8 -0
- package/dist/types/src/extension/lint.d.ts.map +1 -0
- package/dist/types/src/extension/parse.d.ts +6 -0
- package/dist/types/src/extension/parse.d.ts.map +1 -0
- package/dist/types/src/extension/parser.test.d.ts +2 -0
- package/dist/types/src/extension/parser.test.d.ts.map +1 -0
- package/dist/types/src/extension/refs.d.ts +32 -0
- package/dist/types/src/extension/refs.d.ts.map +1 -0
- package/dist/types/src/extension/refs.test.d.ts +2 -0
- package/dist/types/src/extension/refs.test.d.ts.map +1 -0
- package/dist/types/src/extension/syntax.d.ts +12 -0
- package/dist/types/src/extension/syntax.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +3 -0
- package/dist/types/src/index.d.ts.map +1 -0
- package/dist/types/src/review/fields.d.ts +9 -0
- package/dist/types/src/review/fields.d.ts.map +1 -0
- package/dist/types/src/review/index.d.ts +5 -0
- package/dist/types/src/review/index.d.ts.map +1 -0
- package/dist/types/src/review/review.d.ts +70 -0
- package/dist/types/src/review/review.d.ts.map +1 -0
- package/dist/types/src/review/review.test.d.ts +2 -0
- package/dist/types/src/review/review.test.d.ts.map +1 -0
- package/dist/types/src/review/source-key.d.ts +35 -0
- package/dist/types/src/review/source-key.d.ts.map +1 -0
- package/dist/types/src/review/symbol.d.ts +17 -0
- package/dist/types/src/review/symbol.d.ts.map +1 -0
- package/dist/types/src/review/symbol.test.d.ts +2 -0
- package/dist/types/src/review/symbol.test.d.ts.map +1 -0
- package/dist/types/src/spec-index/index.d.ts +3 -0
- package/dist/types/src/spec-index/index.d.ts.map +1 -0
- package/dist/types/src/spec-index/parse.d.ts +11 -0
- package/dist/types/src/spec-index/parse.d.ts.map +1 -0
- package/dist/types/src/spec-index/spec-index.d.ts +21 -0
- package/dist/types/src/spec-index/spec-index.d.ts.map +1 -0
- package/dist/types/src/spec-index/spec-index.test.d.ts +2 -0
- package/dist/types/src/spec-index/spec-index.test.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/docs/DESIGN.md +561 -0
- package/docs/IDIOMS.md +265 -0
- package/lang/PLUGIN-.template.mdl +115 -0
- package/lang/app.mdl +200 -0
- package/lang/changelog.mdl +184 -0
- package/lang/core.mdl +203 -0
- package/lang/examples/chess-1.mdl +149 -0
- package/lang/examples/chess-2.mdl +203 -0
- package/lang/examples/chess-3.mdl +231 -0
- package/lang/features.mdl +92 -0
- package/lang/plugin.mdl +59 -0
- package/lang/qa.mdl +383 -0
- package/lang/review.mdl +103 -0
- package/lang/sql.mdl +72 -0
- package/package.json +74 -3
- package/src/cli/__fixtures__/bad-decision.mdl +13 -0
- package/src/cli/__fixtures__/features/CYCLE.mdl +25 -0
- package/src/cli/__fixtures__/features/FEATURES.mdl +47 -0
- package/src/cli/__fixtures__/features/SPEC.mdl +22 -0
- package/src/cli/__fixtures__/features/SPEC.review.mdl +32 -0
- package/src/cli/__fixtures__/features/TASKS.md +5 -0
- package/src/cli/__fixtures__/lint-refs/SPEC.mdl +7 -0
- package/src/cli/__fixtures__/lint-refs/SPEC.review.mdl +7 -0
- package/src/cli/__fixtures__/qa-lint/packages/plugins/plugin-risky/PLUGIN.mdl +29 -0
- package/src/cli/__fixtures__/qa-list/plugin-sample/spec/PLUGIN.mdl +51 -0
- package/src/cli/__fixtures__/review/SPEC.mdl +23 -0
- package/src/cli/__fixtures__/review/SPEC.review.mdl +26 -0
- package/src/cli/__fixtures__/review/plugin-deps/PLUGIN.mdl +9 -0
- package/src/cli/__fixtures__/review/plugin-deps/PLUGIN.review.mdl +13 -0
- package/src/cli/__fixtures__/review/plugin-deps/dx.config.ts +10 -0
- package/src/cli/__fixtures__/review/plugin-deps-diverged/PLUGIN.mdl +9 -0
- package/src/cli/__fixtures__/review/plugin-deps-diverged/PLUGIN.review.mdl +14 -0
- package/src/cli/__fixtures__/review/plugin-deps-diverged/dx.config.ts +10 -0
- package/src/cli/__fixtures__/review/plugin-deps-empty/PLUGIN.mdl +9 -0
- package/src/cli/__fixtures__/review/plugin-deps-empty/PLUGIN.review.mdl +13 -0
- package/src/cli/__fixtures__/review/plugin-deps-empty/dx.config.ts +9 -0
- package/src/cli/__fixtures__/review/plugin-deps-mismatch/PLUGIN.mdl +9 -0
- package/src/cli/__fixtures__/review/plugin-deps-mismatch/PLUGIN.review.mdl +13 -0
- package/src/cli/__fixtures__/review/plugin-deps-mismatch/dx.config.ts +10 -0
- package/src/cli/__fixtures__/review/plugin-deps-noplugin/PLUGIN.mdl +9 -0
- package/src/cli/__fixtures__/review/plugin-deps-noplugin/PLUGIN.review.mdl +13 -0
- package/src/cli/__fixtures__/review/plugin-deps-noplugin/dx.config.ts +7 -0
- package/src/cli/changelog.ts +122 -0
- package/src/cli/cli.test.ts +359 -0
- package/src/cli/errors.ts +23 -0
- package/src/cli/features.ts +320 -0
- package/src/cli/git.ts +35 -0
- package/src/cli/index.ts +27 -0
- package/src/cli/lint.ts +75 -0
- package/src/cli/qa-lint.ts +206 -0
- package/src/cli/qa.ts +300 -0
- package/src/cli/review.ts +359 -0
- package/src/cli/spec-index.ts +54 -0
- package/src/extension/blocks.ts +169 -0
- package/src/extension/check.test.ts +629 -0
- package/src/extension/check.ts +552 -0
- package/src/extension/code.ts +99 -0
- package/src/extension/complete.ts +34 -0
- package/src/extension/completion.ts +64 -0
- package/src/extension/constants.ts +28 -0
- package/src/extension/fences.ts +270 -0
- package/src/extension/gen/mdl.terms.ts +16 -0
- package/src/extension/gen/mdl.ts +16 -0
- package/src/extension/index.ts +25 -0
- package/src/extension/language.ts +33 -0
- package/src/extension/lint.ts +19 -0
- package/src/extension/mdl.grammar +60 -0
- package/src/extension/parse.ts +31 -0
- package/src/extension/parser.test.ts +248 -0
- package/src/extension/refs.test.ts +95 -0
- package/src/extension/refs.ts +94 -0
- package/src/extension/syntax.ts +25 -0
- package/src/index.ts +6 -0
- package/src/review/fields.ts +31 -0
- package/src/review/index.ts +8 -0
- package/src/review/review.test.ts +111 -0
- package/src/review/review.ts +184 -0
- package/src/review/source-key.ts +63 -0
- package/src/review/symbol.test.ts +47 -0
- package/src/review/symbol.ts +96 -0
- package/src/spec-index/index.ts +6 -0
- package/src/spec-index/parse.ts +22 -0
- package/src/spec-index/spec-index.test.ts +56 -0
- package/src/spec-index/spec-index.ts +49 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: org.dxos.plugin.chess
|
|
3
|
+
name: ChessPlugin
|
|
4
|
+
version: 0.2.0
|
|
5
|
+
extends: [dxos.plugin.chess@0.1.0]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Extends chess-1 to introduce UI components: the game Lobby and the Gameboard.
|
|
9
|
+
|
|
10
|
+
## Extensions
|
|
11
|
+
|
|
12
|
+
| Term | URI |
|
|
13
|
+
|-------------|--------------------------------|
|
|
14
|
+
| `type` | `org.dxos.mdl.type@1.0` |
|
|
15
|
+
| `feat` | `org.dxos.mdl.feat@1.0` |
|
|
16
|
+
| `scenario` | `org.dxos.mdl.scenario@1.0` |
|
|
17
|
+
| `component` | `org.dxos.mdl.component@1.0` |
|
|
18
|
+
|
|
19
|
+
## Types
|
|
20
|
+
|
|
21
|
+
New types introduced in this version.
|
|
22
|
+
|
|
23
|
+
```mdl
|
|
24
|
+
type Player
|
|
25
|
+
fields:
|
|
26
|
+
id: string
|
|
27
|
+
name: string
|
|
28
|
+
color: Color
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```mdl
|
|
32
|
+
type GameStatus
|
|
33
|
+
literals: waiting | active | finished
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
```mdl
|
|
37
|
+
type Game
|
|
38
|
+
fields:
|
|
39
|
+
id: string
|
|
40
|
+
players: Player[2]
|
|
41
|
+
board: Board
|
|
42
|
+
status: GameStatus
|
|
43
|
+
winner?: Player
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Components
|
|
47
|
+
|
|
48
|
+
```mdl
|
|
49
|
+
component Lobby
|
|
50
|
+
desc: Entry point where players create or join a game.
|
|
51
|
+
props:
|
|
52
|
+
playerId: string
|
|
53
|
+
state:
|
|
54
|
+
games: Game[] # list of open/active games
|
|
55
|
+
selected?: Game
|
|
56
|
+
slots:
|
|
57
|
+
header?: ReactNode
|
|
58
|
+
empty?: ReactNode # shown when games list is empty
|
|
59
|
+
actions:
|
|
60
|
+
createGame() → Game
|
|
61
|
+
joinGame(game: Game) → Game
|
|
62
|
+
spectate(game: Game)
|
|
63
|
+
emits:
|
|
64
|
+
onJoin(game: Game)
|
|
65
|
+
layout: |
|
|
66
|
+
┌─────────────────────────┐
|
|
67
|
+
│ [header slot] │
|
|
68
|
+
├─────────────────────────┤
|
|
69
|
+
│ Game list │
|
|
70
|
+
│ ┌───────────────────┐ │
|
|
71
|
+
│ │ game row │ │
|
|
72
|
+
│ └───────────────────┘ │
|
|
73
|
+
│ [empty slot] │
|
|
74
|
+
├─────────────────────────┤
|
|
75
|
+
│ [Create Game] │
|
|
76
|
+
└─────────────────────────┘
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
```mdl
|
|
80
|
+
component Gameboard
|
|
81
|
+
desc: Interactive chess board for an active game.
|
|
82
|
+
props:
|
|
83
|
+
game: Game
|
|
84
|
+
playerId: string # identifies which side the viewer plays
|
|
85
|
+
state:
|
|
86
|
+
selected?: Square # currently selected square
|
|
87
|
+
highlights: Square[] # legal move targets for selected piece
|
|
88
|
+
perspective: Color # which side is at the bottom (default: player's color)
|
|
89
|
+
slots:
|
|
90
|
+
toolbar?: ReactNode
|
|
91
|
+
sidebar?: ReactNode
|
|
92
|
+
overlay?: ReactNode # e.g. checkmate / promotion dialogs
|
|
93
|
+
actions:
|
|
94
|
+
selectSquare(square: Square)
|
|
95
|
+
submitMove(move: Move)
|
|
96
|
+
flipBoard()
|
|
97
|
+
emits:
|
|
98
|
+
onMove(move: Move)
|
|
99
|
+
onResign()
|
|
100
|
+
layout: |
|
|
101
|
+
┌─────────────────────────┐
|
|
102
|
+
│ [toolbar slot] │
|
|
103
|
+
├──────────┬──────────────┤
|
|
104
|
+
│ │ [sidebar] │
|
|
105
|
+
│ 8×8 │ │
|
|
106
|
+
│ board │ move history │
|
|
107
|
+
│ │ │
|
|
108
|
+
├──────────┴──────────────┤
|
|
109
|
+
│ [overlay slot] │
|
|
110
|
+
└─────────────────────────┘
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Features
|
|
114
|
+
|
|
115
|
+
```mdl
|
|
116
|
+
feat F-3: Lobby
|
|
117
|
+
|
|
118
|
+
req F-3.1: Player sees list of open games on entering the Lobby.
|
|
119
|
+
req F-3.2:
|
|
120
|
+
when: player creates a game
|
|
121
|
+
then: new Game created with status waiting; player assigned white
|
|
122
|
+
|
|
123
|
+
req F-3.3:
|
|
124
|
+
when: second player joins an open game
|
|
125
|
+
then: Game.status transitions to active; joining player assigned black
|
|
126
|
+
|
|
127
|
+
req F-3.4:
|
|
128
|
+
when: Game.status becomes active
|
|
129
|
+
then: both players navigated to Gameboard
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
```mdl
|
|
133
|
+
feat F-4: Gameboard
|
|
134
|
+
|
|
135
|
+
req F-4.1:
|
|
136
|
+
when: player selects a square containing their piece
|
|
137
|
+
then: legal move targets highlighted on board
|
|
138
|
+
|
|
139
|
+
req F-4.2:
|
|
140
|
+
when: player selects a highlighted target square
|
|
141
|
+
then: Move submitted via submitMove(); board updated on success
|
|
142
|
+
|
|
143
|
+
req F-4.3:
|
|
144
|
+
when: pawn reaches the back rank
|
|
145
|
+
then: promotion dialog shown via overlay slot; player selects piece kind
|
|
146
|
+
|
|
147
|
+
req F-4.4:
|
|
148
|
+
when: Game.status is finished
|
|
149
|
+
then: result overlay shown (winner or draw); further moves disabled
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Acceptance
|
|
153
|
+
|
|
154
|
+
```mdl
|
|
155
|
+
scenario T-3: Create and join game
|
|
156
|
+
given: two players are in the Lobby
|
|
157
|
+
when: player A creates a game, player B joins it
|
|
158
|
+
then:
|
|
159
|
+
- Game.status === active
|
|
160
|
+
- Game.players[0].color === white # creator
|
|
161
|
+
- Game.players[1].color === black # joiner
|
|
162
|
+
- both players see the Gameboard
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
```mdl
|
|
166
|
+
scenario T-4: Legal move highlight
|
|
167
|
+
given: Gameboard is shown, it is white's turn
|
|
168
|
+
when: white selects the e2 pawn
|
|
169
|
+
then:
|
|
170
|
+
- squares e3 and e4 are highlighted
|
|
171
|
+
- no other squares are highlighted
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
```mdl
|
|
175
|
+
scenario T-5: Pawn promotion
|
|
176
|
+
given: white pawn is on e7, it is white's turn
|
|
177
|
+
when: white moves pawn to e8
|
|
178
|
+
then:
|
|
179
|
+
- promotion overlay appears
|
|
180
|
+
- after player selects queen, Move recorded with promotion: queen
|
|
181
|
+
- board shows white queen on e8
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Appendix: Extension Definitions
|
|
187
|
+
|
|
188
|
+
Definitions for extensions introduced in this version.
|
|
189
|
+
Extensions inherited from chess-1 (type, feat, test) are not repeated.
|
|
190
|
+
|
|
191
|
+
```mdl
|
|
192
|
+
ext component
|
|
193
|
+
uri: org.dxos.mdl.component@1.0
|
|
194
|
+
desc: A UI component with props, internal state, slots, actions, and events.
|
|
195
|
+
fields:
|
|
196
|
+
desc?: Prose
|
|
197
|
+
props?: FieldMap # external inputs (immutable inside component)
|
|
198
|
+
state?: FieldMap # internal reactive state
|
|
199
|
+
slots?: FieldMap # named ReactNode injection points
|
|
200
|
+
actions?: ActionMap # methods the component exposes or handles
|
|
201
|
+
emits?: EventMap # events the component raises to its parent
|
|
202
|
+
layout?: CodeBlock # ASCII sketch of visual structure (non-normative)
|
|
203
|
+
```
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: org.dxos.plugin.chess
|
|
3
|
+
name: ChessPlugin
|
|
4
|
+
version: 0.3.0
|
|
5
|
+
extends: [dxos.plugin.chess@0.2.0]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Extends chess-2 to introduce operations and services: move validation,
|
|
9
|
+
game state transitions, and the chess engine service dependency.
|
|
10
|
+
|
|
11
|
+
## Extensions
|
|
12
|
+
|
|
13
|
+
| Term | URI |
|
|
14
|
+
|-------------|--------------------------------|
|
|
15
|
+
| `type` | `org.dxos.mdl.type@1.0` |
|
|
16
|
+
| `feat` | `org.dxos.mdl.feat@1.0` |
|
|
17
|
+
| `scenario` | `org.dxos.mdl.scenario@1.0` |
|
|
18
|
+
| `component` | `org.dxos.mdl.component@1.0` |
|
|
19
|
+
| `op` | `org.dxos.mdl.op@1.0` |
|
|
20
|
+
| `service` | `org.dxos.mdl.service@1.0` |
|
|
21
|
+
|
|
22
|
+
## Services
|
|
23
|
+
|
|
24
|
+
```mdl
|
|
25
|
+
service ChessEngine
|
|
26
|
+
desc: Validates moves and computes game state. May be local (WASM) or remote.
|
|
27
|
+
loading: lazy
|
|
28
|
+
ops:
|
|
29
|
+
validate(board: Board, move: Move) → Move
|
|
30
|
+
legalMoves(board: Board, square: Square) → Square[]
|
|
31
|
+
applyMove(board: Board, move: Move) → Board
|
|
32
|
+
errors:
|
|
33
|
+
EngineNotReady: engine has not finished loading
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
```mdl
|
|
37
|
+
service GameStore
|
|
38
|
+
desc: Persists and replicates Game state via ECHO.
|
|
39
|
+
ops:
|
|
40
|
+
create(white: Player, black: Player) → Game
|
|
41
|
+
load(id: string) → Game
|
|
42
|
+
save(game: Game) → Game
|
|
43
|
+
list() → Game[]
|
|
44
|
+
effects: [echo:write, echo:read]
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Operations
|
|
48
|
+
|
|
49
|
+
Pure operations (no effects, no service dependencies) — safe to call anywhere.
|
|
50
|
+
|
|
51
|
+
```mdl
|
|
52
|
+
op getLegalMoves
|
|
53
|
+
desc: Returns legal target squares for the piece on the given square.
|
|
54
|
+
input:
|
|
55
|
+
board: Board
|
|
56
|
+
square: Square
|
|
57
|
+
output: Square[]
|
|
58
|
+
errors:
|
|
59
|
+
EmptySquare: no piece on square
|
|
60
|
+
WrongSide: piece does not belong to the active side
|
|
61
|
+
requires: [ChessEngine]
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
```mdl
|
|
65
|
+
op validateMove
|
|
66
|
+
desc: Checks a move against chess rules without mutating state.
|
|
67
|
+
input:
|
|
68
|
+
board: Board
|
|
69
|
+
move: Move
|
|
70
|
+
output: Move
|
|
71
|
+
errors:
|
|
72
|
+
IllegalMove: move violates chess rules
|
|
73
|
+
WrongTurn: piece does not belong to the active side
|
|
74
|
+
GameOver: game has already ended
|
|
75
|
+
requires: [ChessEngine]
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
```mdl
|
|
79
|
+
op applyMove
|
|
80
|
+
desc: Applies a validated move and returns the next board state.
|
|
81
|
+
input:
|
|
82
|
+
board: Board
|
|
83
|
+
move: Move # must be pre-validated
|
|
84
|
+
output: Board
|
|
85
|
+
requires: [ChessEngine]
|
|
86
|
+
note: does not persist; use submitMove for the full transactional flow
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Effectful operations — mutate persistent state.
|
|
90
|
+
|
|
91
|
+
```mdl
|
|
92
|
+
op startGame
|
|
93
|
+
desc: Creates a new Game with two players and an initial Board.
|
|
94
|
+
input:
|
|
95
|
+
white: Player
|
|
96
|
+
black: Player
|
|
97
|
+
output: Game
|
|
98
|
+
effects: [echo:write]
|
|
99
|
+
requires: [GameStore]
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
```mdl
|
|
103
|
+
op submitMove
|
|
104
|
+
desc: Validates and applies a move, then persists the updated Game.
|
|
105
|
+
input:
|
|
106
|
+
game: Game
|
|
107
|
+
player: Player
|
|
108
|
+
move: Move
|
|
109
|
+
output: Game
|
|
110
|
+
errors:
|
|
111
|
+
WrongTurn: player is not the active side
|
|
112
|
+
IllegalMove: move violates chess rules
|
|
113
|
+
GameOver: game has already ended
|
|
114
|
+
effects: [echo:write]
|
|
115
|
+
requires: [ChessEngine, GameStore]
|
|
116
|
+
note: |
|
|
117
|
+
Composes validateMove → applyMove → GameStore.save.
|
|
118
|
+
Atomic: Game is not persisted if validation fails.
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
```mdl
|
|
122
|
+
op resignGame
|
|
123
|
+
desc: Player forfeits; opponent wins.
|
|
124
|
+
input:
|
|
125
|
+
game: Game
|
|
126
|
+
player: Player
|
|
127
|
+
output: Game # Game.status === finished, Game.winner set
|
|
128
|
+
errors:
|
|
129
|
+
GameOver: game has already ended
|
|
130
|
+
effects: [echo:write]
|
|
131
|
+
requires: [GameStore]
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Features
|
|
135
|
+
|
|
136
|
+
```mdl
|
|
137
|
+
feat F-5: Move Validation
|
|
138
|
+
|
|
139
|
+
req F-5.1:
|
|
140
|
+
when: Gameboard calls submitMove
|
|
141
|
+
then: op:validateMove runs before any state change
|
|
142
|
+
|
|
143
|
+
req F-5.2:
|
|
144
|
+
when: validation fails
|
|
145
|
+
then: error returned to caller; Game state unchanged
|
|
146
|
+
|
|
147
|
+
req F-5.3:
|
|
148
|
+
when: square is selected on Gameboard
|
|
149
|
+
then: op:getLegalMoves called; results drive component:Gameboard.highlights
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
```mdl
|
|
153
|
+
feat F-6: Game Persistence
|
|
154
|
+
|
|
155
|
+
req F-6.1:
|
|
156
|
+
when: op:startGame completes
|
|
157
|
+
then: Game written to ECHO and visible in component:Lobby game list
|
|
158
|
+
|
|
159
|
+
req F-6.2:
|
|
160
|
+
when: op:submitMove completes
|
|
161
|
+
then: updated Game replicated to all peers via ECHO
|
|
162
|
+
|
|
163
|
+
req F-6.3:
|
|
164
|
+
when: peer receives a Game update
|
|
165
|
+
then: component:Gameboard re-renders with new Board state
|
|
166
|
+
tags: [collaborative]
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Acceptance
|
|
170
|
+
|
|
171
|
+
```mdl
|
|
172
|
+
scenario T-6: Submit valid move
|
|
173
|
+
given: active game, white's turn, white player logged in
|
|
174
|
+
when: white submits pawn e2→e4
|
|
175
|
+
then:
|
|
176
|
+
- op:validateMove returns move without error
|
|
177
|
+
- Board updated: e4 occupied by white pawn, e2 empty
|
|
178
|
+
- Game.board.turn === black
|
|
179
|
+
- Game persisted to ECHO
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
```mdl
|
|
183
|
+
scenario T-7: Submit invalid move rejected atomically
|
|
184
|
+
given: active game, white's turn
|
|
185
|
+
when: white submits an illegal move (e2→e5)
|
|
186
|
+
then:
|
|
187
|
+
- IllegalMove error returned
|
|
188
|
+
- Game.board unchanged
|
|
189
|
+
- no ECHO write occurs
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
```mdl
|
|
193
|
+
scenario T-8: Legal moves highlighted
|
|
194
|
+
given: new game, white's turn, Gameboard shown
|
|
195
|
+
when: player selects e2
|
|
196
|
+
then:
|
|
197
|
+
- op:getLegalMoves returns [e3, e4]
|
|
198
|
+
- Gameboard.highlights === [e3, e4]
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## Appendix: Extension Definitions
|
|
204
|
+
|
|
205
|
+
```mdl
|
|
206
|
+
ext op
|
|
207
|
+
uri: org.dxos.mdl.op@1.0
|
|
208
|
+
desc: |
|
|
209
|
+
A named operation with typed inputs, outputs, and declared errors.
|
|
210
|
+
Pure ops have no effects or requires. Effectful ops declare both.
|
|
211
|
+
fields:
|
|
212
|
+
desc?: Prose
|
|
213
|
+
input?: FieldMap # named input parameters
|
|
214
|
+
output?: TypeExpr # return type
|
|
215
|
+
errors?: ErrorMap # name: Prose (when this error occurs)
|
|
216
|
+
effects?: EffectList # echo:read | echo:write | http | fs | ...
|
|
217
|
+
requires?: ServiceList # injected service dependencies
|
|
218
|
+
note?: Prose # implementation guidance (non-normative)
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
```mdl
|
|
222
|
+
ext service
|
|
223
|
+
uri: org.dxos.mdl.service@1.0
|
|
224
|
+
desc: An external or system-level dependency providing named operations.
|
|
225
|
+
fields:
|
|
226
|
+
desc?: Prose
|
|
227
|
+
loading?: eager | lazy
|
|
228
|
+
ops?: OpMap # name(params) → ReturnType
|
|
229
|
+
errors?: ErrorMap
|
|
230
|
+
note?: Prose
|
|
231
|
+
```
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: org.dxos.spec.features
|
|
3
|
+
name: DSL.Features
|
|
4
|
+
version: 1.0
|
|
5
|
+
extends:
|
|
6
|
+
- org.dxos.spec.core
|
|
7
|
+
- org.dxos.spec.changelog
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
The feature map dialect. A feature map is the top of the chain that turns intent into working code:
|
|
11
|
+
|
|
12
|
+
| Layer | Artifact | Who writes it | What it says |
|
|
13
|
+
| ----------- | --------------------------------- | ------------------------ | ------------------------------------ |
|
|
14
|
+
| Feature map | `FEATURES.mdl`, `feature` blocks | a person, or an agent | what the product should do, and why |
|
|
15
|
+
| Spec | `PLUGIN.mdl`, `SPEC.mdl` | agent, reviewed in a PR | how one package meets the feature |
|
|
16
|
+
| Review | `<SPEC>.review.mdl`, `verdict`s | agent (spec-review) | how far the code meets each spec item |
|
|
17
|
+
| Tasks | `TASKS.md` beside the spec | agent | the work that closes each gap |
|
|
18
|
+
| Code | sources and tests | agent | the behaviour |
|
|
19
|
+
| Result | the re-run review, the feature's status | agent | that the feature now holds |
|
|
20
|
+
|
|
21
|
+
A feature is a goal state ("Feeds drop entries older than their retention"); it names the spec items
|
|
22
|
+
that state it and does not restate them. Its status is authored, and `deus features check` derives a
|
|
23
|
+
second status from the reviews of the items it cites, so a claim the code does not support shows up
|
|
24
|
+
as a warning. The shape matches plugin-projects' `Feature` (`org.dxos.type.feature`), so a map can be
|
|
25
|
+
loaded into a project's feature board.
|
|
26
|
+
|
|
27
|
+
A feature map is a spec: every change adds a decision to its `## Changelog`, so the map records who
|
|
28
|
+
asked for each feature and who moved its status.
|
|
29
|
+
|
|
30
|
+
## Extensions
|
|
31
|
+
|
|
32
|
+
| Term | URI |
|
|
33
|
+
| --------- | -------------------------- |
|
|
34
|
+
| `feature` | `org.dxos.mdl.feature@1.0` |
|
|
35
|
+
|
|
36
|
+
## Statuses
|
|
37
|
+
|
|
38
|
+
| Status | Meaning | Derived from the reviews when |
|
|
39
|
+
| ------------- | ---------------------------------------------------- | ---------------------------------- |
|
|
40
|
+
| `planned` | Wanted; no work started. | every cited item is `missing` |
|
|
41
|
+
| `in-progress` | Partly built: some of what it cites works, some not. | any mix that is not one of these |
|
|
42
|
+
| `prototype` | It works but is not relied on: nothing tests it. | every item is `done` or `untested` |
|
|
43
|
+
| `operational` | It works and tests hold it. | every item is `done` |
|
|
44
|
+
| `failing` | It was operational and does not work now. | never; a person or a QA run sets it |
|
|
45
|
+
|
|
46
|
+
An item with no verdict makes the derived status `unreviewed`, and the check compares nothing.
|
|
47
|
+
|
|
48
|
+
## Spec references
|
|
49
|
+
|
|
50
|
+
`specs:` lists repo-relative paths. A path alone cites every reviewable item of the spec; `#<id>`
|
|
51
|
+
cites one block, and a `feat` with `req` items stands for its requirements.
|
|
52
|
+
|
|
53
|
+
```text
|
|
54
|
+
packages/core/echo/feed/SPEC.mdl # the whole spec
|
|
55
|
+
packages/core/echo/feed/SPEC.mdl#F-1 # feat F-1, judged through F-1.1, F-1.2, ...
|
|
56
|
+
packages/core/echo/feed/SPEC.mdl#F-2.3 # one requirement
|
|
57
|
+
packages/core/echo/feed/SPEC.mdl#trim # an op, type or component
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Checks
|
|
61
|
+
|
|
62
|
+
`deus features check` reports, per feature, `<id> <status> <derived> <done>/<items> done`, then:
|
|
63
|
+
|
|
64
|
+
- **errors** — an unknown status, a feature that cites no spec, a spec or item that does not exist,
|
|
65
|
+
a `depends` on a feature not on the map, and a dependency cycle;
|
|
66
|
+
- **warnings** — a status the reviews do not support, a spec with no review or one that changed after
|
|
67
|
+
its review's commit, a feature `blocked` by a planned or failing dependency, one `operational`
|
|
68
|
+
ahead of a dependency, and an `in-progress` feature with no `## <feature id>` section in a
|
|
69
|
+
`TASKS.md` beside its spec ("no work planned": a gap nobody has planned to close).
|
|
70
|
+
|
|
71
|
+
`deus features tasks <id>` prints the open items of one feature, each with its verdict and the first
|
|
72
|
+
sentence of the verdict's note, as the start of that `TASKS.md` section.
|
|
73
|
+
|
|
74
|
+
## Definitions
|
|
75
|
+
|
|
76
|
+
```mdl
|
|
77
|
+
ext feature
|
|
78
|
+
uri: org.dxos.mdl.feature@1.0
|
|
79
|
+
desc: |
|
|
80
|
+
A goal state of the product. The identifier is a stable kebab-case id, dotted by area
|
|
81
|
+
(`echo.feed-retention`); the inline prose is the feature's name.
|
|
82
|
+
fields:
|
|
83
|
+
status: planned | in-progress | prototype | operational | failing
|
|
84
|
+
specs: RefList # repo-relative spec paths, each optionally #<item id>
|
|
85
|
+
depends?: RefList # ids of features this one needs first; the graph has no cycles
|
|
86
|
+
note?: Prose # why the feature matters, or what is left
|
|
87
|
+
syntax: |
|
|
88
|
+
feature echo.feed-retention: Feeds drop old entries
|
|
89
|
+
status: planned
|
|
90
|
+
specs: [packages/core/echo/feed/SPEC.mdl#F-1, packages/core/echo/feed/SPEC.mdl#F-2]
|
|
91
|
+
depends: [echo.feed-store]
|
|
92
|
+
```
|
package/lang/plugin.mdl
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: org.dxos.spec.plugin
|
|
3
|
+
name: DSL.Plugin
|
|
4
|
+
version: 1.1
|
|
5
|
+
extends:
|
|
6
|
+
- org.dxos.spec.core
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
The plugin dialect: one `plugin` block that names a Composer plugin, says what it is for, and lists
|
|
10
|
+
the modules it contributes. Before this dialect a plugin was implied by its document (`PLUGIN.mdl`)
|
|
11
|
+
and its frontmatter `id`; the block makes the plugin an item the spec can describe, review and link
|
|
12
|
+
to like any other.
|
|
13
|
+
|
|
14
|
+
It is deliberately small. A module is listed by name with one line of prose; the capabilities it
|
|
15
|
+
provides, when it activates and what it requires are left to the code and to later versions of the
|
|
16
|
+
dialect. Use the app dialect (`app.mdl`) for the plugin's UI: graph nodes, surfaces and menus.
|
|
17
|
+
|
|
18
|
+
## Extensions
|
|
19
|
+
|
|
20
|
+
| Term | URI |
|
|
21
|
+
| -------- | -------------------------- |
|
|
22
|
+
| `plugin` | `org.dxos.mdl.plugin@1.1` |
|
|
23
|
+
|
|
24
|
+
## Model
|
|
25
|
+
|
|
26
|
+
- A plugin spec opens with its `plugin` block, directly after the frontmatter and before any
|
|
27
|
+
prose, so the first thing a reader sees is what the plugin is and what it adds. A document
|
|
28
|
+
declares at most one, and its identifier is the plugin's class name (`CodePlugin`). `id:`
|
|
29
|
+
repeats the frontmatter `id`, so the block can be quoted on its own.
|
|
30
|
+
- `dependsOn:` is optional and lists the plugin ids this plugin needs at runtime, exactly as
|
|
31
|
+
`dx.config.ts` declares them. Each is also the `id` in that plugin's `PLUGIN.mdl` frontmatter.
|
|
32
|
+
It is written inline (`dependsOn: [a, b]`) or as a block list (`dependsOn:` then indented
|
|
33
|
+
`- id` lines, as `modules:`). Specs it only builds on or refers to go under `uses` instead.
|
|
34
|
+
- `modules:` lists every module the plugin adds (`Plugin.addModule` in its `plugin.ts`). Each
|
|
35
|
+
item is the module's export name, a colon, and one line on what it contributes.
|
|
36
|
+
- A module named here is a spec item: a review can judge it (`verdict ReactSurface`), and a
|
|
37
|
+
`github:` key may point at it (`…/src/capabilities/index.ts#ReactSurface`).
|
|
38
|
+
|
|
39
|
+
## Definitions
|
|
40
|
+
|
|
41
|
+
```mdl
|
|
42
|
+
ext plugin
|
|
43
|
+
uri: org.dxos.mdl.plugin@1.1
|
|
44
|
+
desc: |
|
|
45
|
+
A Composer plugin: what it is for and the modules it adds. The identifier is the plugin's
|
|
46
|
+
class name; the inline prose is its purpose in one line.
|
|
47
|
+
fields:
|
|
48
|
+
id: URI # the plugin id, as in the document's frontmatter
|
|
49
|
+
desc?: Prose # what the plugin is for, and what it leaves to other plugins
|
|
50
|
+
dependsOn?: URI[] # runtime plugin dependencies, as in dx.config.ts
|
|
51
|
+
modules: ProseList # `- Name: what it contributes`, one per Plugin.addModule
|
|
52
|
+
syntax: |
|
|
53
|
+
plugin CodePlugin: Authors and reviews DEUS specs.
|
|
54
|
+
id: org.dxos.plugin.code
|
|
55
|
+
dependsOn: [org.dxos.plugin.illustrator]
|
|
56
|
+
modules:
|
|
57
|
+
- ReactSurface: the spec article and section surfaces
|
|
58
|
+
- SpecSync: two-way sync of specs with files on disk
|
|
59
|
+
```
|