rhachet-roles-bhuild 0.1.0 → 0.1.1

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.
@@ -0,0 +1,311 @@
1
+ #!/usr/bin/env bash
2
+ ######################################################################
3
+ # .what = initialize a .behavior directory for bhuild thoughtroute
4
+ #
5
+ # .why = standardize the behavior-driven development thoughtroute
6
+ # by scaffolding a structured directory with:
7
+ # - wish definition
8
+ # - vision statement
9
+ # - acceptance criteria
10
+ # - research prompts
11
+ # - distillation prompts
12
+ # - blueprint prompts
13
+ # - roadmap prompts
14
+ # - execution prompts
15
+ # - feedback template
16
+ #
17
+ # .how = creates .behavior/v${isodate}.${behaviorname}/ with
18
+ # all necessary scaffold files for the bhuild thoughtroute
19
+ #
20
+ # usage:
21
+ # init.bhuild.sh --name <behaviorname> [--dir <directory>]
22
+ #
23
+ # guarantee:
24
+ # - creates .behavior/ if missing
25
+ # - creates versioned behavior directory
26
+ # - findserts all thoughtroute files (creates if missing, skips if exists)
27
+ # - idempotent: safe to rerun
28
+ # - fail-fast on errors
29
+ ######################################################################
30
+
31
+ set -euo pipefail
32
+
33
+ # fail loud: print what failed
34
+ trap 'echo "❌ init.bhuild.sh failed at line $LINENO" >&2' ERR
35
+
36
+ # parse arguments
37
+ BEHAVIOR_NAME=""
38
+ TARGET_DIR="$PWD"
39
+ while [[ $# -gt 0 ]]; do
40
+ case $1 in
41
+ --name)
42
+ BEHAVIOR_NAME="$2"
43
+ shift 2
44
+ ;;
45
+ --dir)
46
+ TARGET_DIR="$2"
47
+ shift 2
48
+ ;;
49
+ *)
50
+ echo "error: unknown argument '$1'"
51
+ echo "usage: init.bhuild.sh --name <behaviorname> [--dir <directory>]"
52
+ exit 1
53
+ ;;
54
+ esac
55
+ done
56
+
57
+ # validate required arguments
58
+ if [[ -z "$BEHAVIOR_NAME" ]]; then
59
+ echo "error: --name is required"
60
+ echo "usage: init.bhuild.sh --name <behaviorname> [--dir <directory>]"
61
+ exit 1
62
+ fi
63
+
64
+ # generate isodate in format YYYY_MM_DD
65
+ ISO_DATE=$(date +%Y_%m_%d)
66
+
67
+ # trim trailing .behavior from TARGET_DIR if present
68
+ TARGET_DIR="${TARGET_DIR%/.behavior}"
69
+ TARGET_DIR="${TARGET_DIR%.behavior}"
70
+
71
+ # construct behavior directory path (absolute)
72
+ BEHAVIOR_DIR="$TARGET_DIR/.behavior/v${ISO_DATE}.${BEHAVIOR_NAME}"
73
+
74
+ # compute relative path from caller's $PWD for file contents
75
+ BEHAVIOR_DIR_REL="$(realpath --relative-to="$PWD" "$TARGET_DIR")/.behavior/v${ISO_DATE}.${BEHAVIOR_NAME}"
76
+ # normalize: remove leading ./ if present
77
+ BEHAVIOR_DIR_REL="${BEHAVIOR_DIR_REL#./}"
78
+
79
+ # create behavior directory (idempotent)
80
+ mkdir -p "$BEHAVIOR_DIR"
81
+
82
+ # helper: findsert file (create if missing, skip if exists)
83
+ findsert() {
84
+ local filepath="$1"
85
+ if [[ -f "$filepath" ]]; then
86
+ echo " [KEEP] $(basename "$filepath")"
87
+ return 0
88
+ fi
89
+ cat > "$filepath"
90
+ echo " [CREATE] $(basename "$filepath")"
91
+ }
92
+
93
+ # findsert 0.wish.md
94
+ findsert "$BEHAVIOR_DIR/0.wish.md" << 'EOF'
95
+ wish =
96
+
97
+ EOF
98
+
99
+ # findsert 1.vision.md
100
+ findsert "$BEHAVIOR_DIR/1.vision.md" << 'EOF'
101
+
102
+ EOF
103
+
104
+ # findsert 2.criteria.md
105
+ findsert "$BEHAVIOR_DIR/2.criteria.md" << 'EOF'
106
+ # usecase.1 = ...
107
+ given()
108
+ when()
109
+ then()
110
+ sothat()
111
+ then()
112
+ then()
113
+ sothat()
114
+ when()
115
+ then()
116
+
117
+ given()
118
+ ...
119
+
120
+ # usecase.2 = ...
121
+ ...
122
+ EOF
123
+
124
+ # findsert 2.criteria.src
125
+ findsert "$BEHAVIOR_DIR/2.criteria.src" << EOF
126
+ declare the behavioral criteria required in order to fulfill
127
+ - this wish $BEHAVIOR_DIR_REL/0.wish.md
128
+ - this vision $BEHAVIOR_DIR_REL/1.vision.md (if declared)
129
+
130
+ via bdd declarations, per your briefs
131
+
132
+ via the template in $BEHAVIOR_DIR_REL/2.criteria.md
133
+
134
+ emit into $BEHAVIOR_DIR_REL/2.criteria.md
135
+
136
+ ---
137
+
138
+ focus on the behavioral requirements
139
+ - critical paths
140
+ - boundary paths
141
+
142
+ ignore infra or technical details
143
+
144
+ focus on behaviors
145
+
146
+ ensure to cover all of the criteria required to fulfill the full set of behaviors declared in the wish and vision
147
+ EOF
148
+
149
+ # findsert 3.1.research.domain._.v1.src
150
+ findsert "$BEHAVIOR_DIR/3.1.research.domain._.v1.src" << EOF
151
+ research the domain available in order to fulfill
152
+ - this wish $BEHAVIOR_DIR_REL/0.wish.md
153
+ - this vision $BEHAVIOR_DIR_REL/1.vision.md (if declared)
154
+ - this criteria $BEHAVIOR_DIR_REL/2.criteria.md (if declared)
155
+
156
+ specifically
157
+ - what are the domain objects that are involved with this wish
158
+ - entities
159
+ - events
160
+ - literals
161
+ - what are the domain operations
162
+ - getOne
163
+ - getAll
164
+ - setCreate
165
+ - setUpdate
166
+ - setDelete
167
+ - what are the relationships between the domain objects?
168
+ - is there a treestruct of decoration?
169
+ - is there a treestruct of common subdomains?
170
+ - are there dependencies?
171
+ - how do the domain objects and operations compose to support wish?
172
+
173
+ ---
174
+
175
+ use web search to discover and research
176
+ - cite every claim
177
+ - number each citation
178
+ - clone exact quotes from each citation
179
+
180
+ focus on these sdk's for reference, if provided
181
+ -
182
+
183
+ ---
184
+
185
+ emit into $BEHAVIOR_DIR_REL/3.1.research.domain._.v1.i1.md
186
+ EOF
187
+
188
+ # findsert 3.2.distill.domain._.v1.src
189
+ findsert "$BEHAVIOR_DIR/3.2.distill.domain._.v1.src" << EOF
190
+ distill the declastruct domain.objects and domain.operations that would
191
+ - enable fulfillment of
192
+ - this wish $BEHAVIOR_DIR_REL/0.wish.md
193
+ - this vision $BEHAVIOR_DIR_REL/1.vision.md (if declared)
194
+ - this criteria $BEHAVIOR_DIR_REL/2.criteria.md (if declared)
195
+ - given the research declared here
196
+ - $BEHAVIOR_DIR_REL/3.1.research.domain._.v1.i1.md (if declared)
197
+
198
+ procedure
199
+ 1. declare the usecases and envision the contract that would be used to fulfill the usecases
200
+ 2. declare the domain.objects, domain.operations, and access.daos that would fulfill this, via the declastruct pattern in this repo
201
+
202
+ emit into
203
+ - $BEHAVIOR_DIR_REL/3.2.distill.domain._.v1.i1.md
204
+ EOF
205
+
206
+ # findsert 3.3.blueprint.v1.src
207
+ findsert "$BEHAVIOR_DIR/3.3.blueprint.v1.src" << EOF
208
+ propose a blueprint for how we can implement the wish described
209
+ - in $BEHAVIOR_DIR_REL/0.wish.md
210
+
211
+ with the domain distillation declared
212
+ - in $BEHAVIOR_DIR_REL/3.2.distill.domain._.v1.i1.md (if declared)
213
+
214
+ follow the patterns already present in this repo
215
+
216
+ ---
217
+
218
+ reference the below for full context
219
+ - $BEHAVIOR_DIR_REL/0.wish.md
220
+ - $BEHAVIOR_DIR_REL/1.vision.md (if declared)
221
+ - $BEHAVIOR_DIR_REL/2.criteria.md (if declared)
222
+ - $BEHAVIOR_DIR_REL/3.1.research.domain._.v1.i1.md (if declared)
223
+ - $BEHAVIOR_DIR_REL/3.2.distill.domain._.v1.i1.md (if declared)
224
+
225
+ ---
226
+
227
+ emit to $BEHAVIOR_DIR_REL/3.3.blueprint.v1.i1.md
228
+ EOF
229
+
230
+ # findsert 4.1.roadmap.v1.src
231
+ findsert "$BEHAVIOR_DIR/4.1.roadmap.v1.src" << EOF
232
+ declare a roadmap,
233
+
234
+ - checklist style
235
+ - with ordered dependencies
236
+ - with behavioral acceptance criteria
237
+ - with behavioral acceptance verification at each step
238
+
239
+ for how to execute the blueprint specified in $BEHAVIOR_DIR_REL/3.3.blueprint.v1.i1.md
240
+
241
+ ref:
242
+ - $BEHAVIOR_DIR_REL/0.wish.md
243
+ - $BEHAVIOR_DIR_REL/1.vision.md (if declared)
244
+ - $BEHAVIOR_DIR_REL/2.criteria.md (if declared)
245
+ - $BEHAVIOR_DIR_REL/3.2.distill.domain._.v1.i1.md (if declared)
246
+ - $BEHAVIOR_DIR_REL/3.3.blueprint.v1.i1.md
247
+
248
+ ---
249
+
250
+ emit into $BEHAVIOR_DIR_REL/4.1.roadmap.v1.i1.md
251
+ EOF
252
+
253
+ # findsert 5.1.execution.phase0_to_phaseN.v1.src
254
+ findsert "$BEHAVIOR_DIR/5.1.execution.phase0_to_phaseN.v1.src" << EOF
255
+ bootup your mechanic's role via \`npx rhachet roles boot --repo ehmpathy --role mechanic\`
256
+
257
+ then, start or continue to execute
258
+ - phase0 to phaseN
259
+ of roadmap
260
+ - $BEHAVIOR_DIR_REL/4.1.roadmap.v1.i1.md
261
+
262
+ ref:
263
+ - $BEHAVIOR_DIR_REL/0.wish.md
264
+ - $BEHAVIOR_DIR_REL/1.vision.md (if declared)
265
+ - $BEHAVIOR_DIR_REL/2.criteria.md (if declared)
266
+ - $BEHAVIOR_DIR_REL/3.2.distill.domain._.v1.i1.md (if declared)
267
+ - $BEHAVIOR_DIR_REL/3.3.blueprint.v1.i1.md
268
+
269
+
270
+ ---
271
+
272
+ track your progress
273
+
274
+ emit todos and check them off into
275
+ - $BEHAVIOR_DIR_REL/5.1.execution.phase0_to_phaseN.v1.i1.md
276
+ EOF
277
+
278
+ # findsert .ref.[feedback].v1.[given].by_human.md
279
+ findsert "$BEHAVIOR_DIR/.ref.[feedback].v1.[given].by_human.md" << EOF
280
+ emit your response to the feedback into
281
+ - $BEHAVIOR_DIR_REL/.ref.[feedback].v1.[taken].by_robot.md
282
+
283
+ 1. emit your response checklist
284
+ 2. exec your response plan
285
+ 3. emit your response checkoffs into the checklist
286
+
287
+ ---
288
+
289
+ first, bootup your mechanics briefs again
290
+
291
+ npx rhachet roles boot --repo ehmpathy --role mechanic
292
+
293
+ ---
294
+ ---
295
+ ---
296
+
297
+
298
+ # blocker.1
299
+
300
+ ---
301
+
302
+ # nitpick.2
303
+
304
+ ---
305
+
306
+ # blocker.3
307
+ EOF
308
+
309
+ echo ""
310
+ echo "behavior thoughtroute initialized!"
311
+ echo " $BEHAVIOR_DIR"
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "rhachet-roles-bhuild",
3
3
  "author": "ehmpathy",
4
4
  "description": "reliable thought concept navigation roles, briefs, and skills, via rhachet",
5
- "version": "0.1.0",
5
+ "version": "0.1.1",
6
6
  "repository": "ehmpathy/rhachet-roles-bhuild",
7
7
  "homepage": "https://github.com/ehmpathy/rhachet-roles-bhuild",
8
8
  "keywords": [
@@ -18,6 +18,39 @@
18
18
  "files": [
19
19
  "/dist"
20
20
  ],
21
+ "scripts": {
22
+ "build:ts": "tsc -p ./tsconfig.build.json",
23
+ "commit:with-cli": "npx cz",
24
+ "fix:format:biome": "biome check --write",
25
+ "fix:format": "npm run fix:format:biome",
26
+ "fix:lint": "biome check --write",
27
+ "fix": "npm run fix:format && npm run fix:lint",
28
+ "build:clean": "rm dist/ -rf",
29
+ "build:compile": "tsc -p ./tsconfig.build.json && tsc-alias -p ./tsconfig.build.json",
30
+ "build:complete": "rsync -a --prune-empty-dirs --include='*/' --exclude='**/.route/**' --exclude='**/.scratch/**' --exclude='**/.behavior/**' --exclude='**/*.test.sh' --include='**/*.template.md' --include='**/briefs/**/*.md' --include='**/briefs/*.md' --include='**/skills/**/*.sh' --include='**/skills/*.sh' --include='**/skills/**/*.jsonc' --include='**/skills/*.jsonc' --exclude='*' src/ dist/",
31
+ "build": "npm run build:clean && npm run build:compile && npm run build:complete --if-present",
32
+ "test:commits": "LAST_TAG=$(git describe --tags --abbrev=0 @^ 2> /dev/null || git rev-list --max-parents=0 HEAD) && npx commitlint --from $LAST_TAG --to HEAD --verbose",
33
+ "test:types": "tsc -p ./tsconfig.json --noEmit",
34
+ "test:format": "npm run test:format:biome",
35
+ "test:lint:deps": "npx depcheck -c ./.depcheckrc.yml",
36
+ "test:integration:hold": "jest -c ./jest.integration.config.ts --forceExit --verbose --passWithNoTests $([ -z $THOROUGH ] && echo '--changedSince=main')",
37
+ "test:lint:biome": "biome check --diagnostic-level=error",
38
+ "test:lint:biome:all": "biome check",
39
+ "test:lint": "npm run test:lint:biome && npm run test:lint:deps",
40
+ "test:unit": "jest -c ./jest.unit.config.ts --forceExit --verbose --passWithNoTests $([ -z $THOROUGH ] && echo '--changedSince=main') $([ -n $RESNAP ] && echo '--updateSnapshot')",
41
+ "test:integration": "echo 'todo: release'",
42
+ "test:acceptance:locally": "npm run build && LOCALLY=true jest -c ./jest.acceptance.config.ts --forceExit --verbose --runInBand --passWithNoTests $([ -n $RESNAP ] && echo '--updateSnapshot')",
43
+ "test": "npm run test:commits && npm run test:types && npm run test:format && npm run test:lint && npm run test:unit && npm run test:integration && npm run test:acceptance:locally",
44
+ "test:acceptance": "npm run build && jest -c ./jest.acceptance.config.ts --forceExit --verbose --runInBand --passWithNoTests $([ -n $RESNAP ] && echo '--updateSnapshot')",
45
+ "prepush": "npm run test && npm run build",
46
+ "prepublish": "npm run build",
47
+ "preversion": "npm run prepush",
48
+ "postversion": "git push origin HEAD --tags --no-verify",
49
+ "prepare:husky": "husky install && chmod ug+x .husky/*",
50
+ "prepare": "if [ -e .git ] && [ -z $CI ]; then npm run prepare:husky && npm run prepare:rhachet; fi",
51
+ "test:format:biome": "biome format",
52
+ "prepare:rhachet": "rhachet init && rhachet roles link --role mechanic && .agent/repo=ehmpathy/role=mechanic/skills/.skills/init.claude.sh"
53
+ },
21
54
  "dependencies": {
22
55
  "domain-objects": "0.31.7",
23
56
  "helpful-errors": "1.5.3",
@@ -54,36 +87,5 @@
54
87
  "path": "./node_modules/cz-conventional-changelog"
55
88
  }
56
89
  },
57
- "scripts": {
58
- "build:ts": "tsc -p ./tsconfig.build.json",
59
- "commit:with-cli": "npx cz",
60
- "fix:format:biome": "biome check --write",
61
- "fix:format": "npm run fix:format:biome",
62
- "fix:lint": "biome check --write",
63
- "fix": "npm run fix:format && npm run fix:lint",
64
- "build:clean": "rm dist/ -rf",
65
- "build:compile": "tsc -p ./tsconfig.build.json && tsc-alias -p ./tsconfig.build.json",
66
- "build:complete": "rsync -a --prune-empty-dirs --include='*/' --exclude='**/.route/**' --exclude='**/.scratch/**' --exclude='**/.behavior/**' --exclude='**/*.test.sh' --include='**/*.template.md' --include='**/briefs/**/*.md' --include='**/briefs/*.md' --include='**/skills/**/*.sh' --include='**/skills/*.sh' --include='**/skills/**/*.jsonc' --include='**/skills/*.jsonc' --exclude='*' src/ dist/",
67
- "build": "npm run build:clean && npm run build:compile && npm run build:complete --if-present",
68
- "test:commits": "LAST_TAG=$(git describe --tags --abbrev=0 @^ 2> /dev/null || git rev-list --max-parents=0 HEAD) && npx commitlint --from $LAST_TAG --to HEAD --verbose",
69
- "test:types": "tsc -p ./tsconfig.json --noEmit",
70
- "test:format": "npm run test:format:biome",
71
- "test:lint:deps": "npx depcheck -c ./.depcheckrc.yml",
72
- "test:integration:hold": "jest -c ./jest.integration.config.ts --forceExit --verbose --passWithNoTests $([ -z $THOROUGH ] && echo '--changedSince=main')",
73
- "test:lint:biome": "biome check --diagnostic-level=error",
74
- "test:lint:biome:all": "biome check",
75
- "test:lint": "npm run test:lint:biome && npm run test:lint:deps",
76
- "test:unit": "jest -c ./jest.unit.config.ts --forceExit --verbose --passWithNoTests $([ -z $THOROUGH ] && echo '--changedSince=main') $([ -n $RESNAP ] && echo '--updateSnapshot')",
77
- "test:integration": "echo 'todo: release'",
78
- "test:acceptance:locally": "npm run build && LOCALLY=true jest -c ./jest.acceptance.config.ts --forceExit --verbose --runInBand --passWithNoTests $([ -n $RESNAP ] && echo '--updateSnapshot')",
79
- "test": "npm run test:commits && npm run test:types && npm run test:format && npm run test:lint && npm run test:unit && npm run test:integration && npm run test:acceptance:locally",
80
- "test:acceptance": "npm run build && jest -c ./jest.acceptance.config.ts --forceExit --verbose --runInBand --passWithNoTests $([ -n $RESNAP ] && echo '--updateSnapshot')",
81
- "prepush": "npm run test && npm run build",
82
- "prepublish": "npm run build",
83
- "preversion": "npm run prepush",
84
- "postversion": "git push origin HEAD --tags --no-verify",
85
- "prepare:husky": "husky install && chmod ug+x .husky/*",
86
- "test:format:biome": "biome format",
87
- "prepare:rhachet": "rhachet init && rhachet roles link --role mechanic && .agent/repo=ehmpathy/role=mechanic/skills/skills/init.claude.sh"
88
- }
89
- }
90
+ "packageManager": "pnpm@10.24.0"
91
+ }