relay-flow 0.2.1-alpha → 0.2.2-alpha

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.
Files changed (72) hide show
  1. package/README.md +155 -22
  2. package/cmd/relay-flow/beads_composition_test.go +451 -0
  3. package/cmd/relay-flow/commands_test.go +74 -0
  4. package/cmd/relay-flow/main.go +25 -0
  5. package/cmd/relay-flow/scenario_test.go +48 -12
  6. package/cmd/relay-flow/serve.go +4 -2
  7. package/examples/beads-workflow.yaml +74 -0
  8. package/examples/default-story-workflow.yaml +6 -6
  9. package/go.mod +2 -1
  10. package/go.sum +2 -0
  11. package/internal/config/config.go +13 -2
  12. package/internal/config/merge_test.go +18 -0
  13. package/internal/execution/goworkflows/activities.go +105 -56
  14. package/internal/execution/goworkflows/end_feedback_test.go +124 -0
  15. package/internal/execution/goworkflows/engine_test.go +33 -15
  16. package/internal/execution/goworkflows/fakes_test.go +50 -4
  17. package/internal/execution/goworkflows/interpreter.go +36 -29
  18. package/internal/execution/goworkflows/mailbox_test.go +85 -0
  19. package/internal/execution/goworkflows/node_runtime_test.go +30 -5
  20. package/internal/execution/goworkflows/recovery_test.go +2 -2
  21. package/internal/execution/goworkflows/report_contract_fixture_test.go +31 -0
  22. package/internal/harness/contract_test.go +10 -0
  23. package/internal/harness/factory.go +25 -3
  24. package/internal/harness/harness.go +30 -4
  25. package/internal/harness/opencode/opencode.go +125 -10
  26. package/internal/harness/opencode/opencode_test.go +183 -0
  27. package/internal/harness/opencode/repo_setup.go +361 -0
  28. package/internal/harness/plugin_selection_test.go +5 -5
  29. package/internal/recover/recover.go +11 -6
  30. package/internal/repo/service.go +10 -0
  31. package/internal/repo/service_test.go +51 -2
  32. package/internal/run/run.go +6 -4
  33. package/internal/task/beads/bdcli/bdcli.go +323 -0
  34. package/internal/task/beads/bdcli/bdcli_test.go +297 -0
  35. package/internal/task/beads/bdcli/testdata/array.json +1 -0
  36. package/internal/task/beads/bdcli/testdata/children.json +1 -0
  37. package/internal/task/beads/bdcli/testdata/claimed.json +1 -0
  38. package/internal/task/beads/bdcli/testdata/commented.json +1 -0
  39. package/internal/task/beads/bdcli/testdata/comments.json +1 -0
  40. package/internal/task/beads/bdcli/testdata/created.json +1 -0
  41. package/internal/task/beads/bdcli/testdata/empty.json +1 -0
  42. package/internal/task/beads/bdcli/testdata/object.json +1 -0
  43. package/internal/task/beads/bdcli/testdata/ready.json +1 -0
  44. package/internal/task/beads/bdcli/testdata/show.json +1 -0
  45. package/internal/task/beads/bdcli/testdata/strict-bd.sh +149 -0
  46. package/internal/task/beads/bdcli/testdata/updated.json +1 -0
  47. package/internal/task/beads/beads.go +840 -0
  48. package/internal/task/beads/beads_test.go +609 -0
  49. package/internal/task/beads/comments_test.go +242 -0
  50. package/internal/task/beads/config_compatibility_test.go +163 -0
  51. package/internal/task/beads/lifecycle_inheritance_test.go +168 -0
  52. package/internal/task/beads/repo_composition_test.go +232 -0
  53. package/internal/task/beads/runtime_config_test.go +81 -0
  54. package/internal/task/beads/status_compatibility_test.go +233 -0
  55. package/internal/task/beads/status_test.go +257 -0
  56. package/internal/task/beads/testdata/strict-bd-repo.sh +27 -0
  57. package/internal/task/beads/validation_test.go +110 -0
  58. package/internal/task/contract_test.go +10 -0
  59. package/internal/task/factory.go +37 -4
  60. package/internal/task/jira/auth.go +27 -1
  61. package/internal/task/jira/auth_test.go +54 -1
  62. package/internal/task/jira/filters_test.go +60 -0
  63. package/internal/task/jira/jira.go +171 -29
  64. package/internal/task/jira/lifecycle_inheritance_test.go +172 -0
  65. package/internal/task/jira/rest/adf.go +119 -82
  66. package/internal/task/jira/rest/adf_test.go +60 -0
  67. package/internal/task/jira/rest/client_test.go +1 -1
  68. package/internal/task/jira/templates_test.go +118 -0
  69. package/internal/task/jira/transition_defaults_test.go +4 -2
  70. package/internal/task/task.go +32 -0
  71. package/internal/workflow/report_test.go +45 -0
  72. package/package.json +1 -1
@@ -0,0 +1,149 @@
1
+ #!/bin/sh
2
+ set -eu
3
+
4
+ fail() {
5
+ printf 'unsupported or malformed bd invocation: %s\n' "$*" >&2
6
+ exit 64
7
+ }
8
+
9
+ [ "$PWD" = "$BD_EXPECT_CWD" ] || fail "wrong cwd: $PWD"
10
+ [ "${BEADS_DIR-}" = "$BD_EXPECT_BEADS_DIR" ] || fail "wrong BEADS_DIR: ${BEADS_DIR-}"
11
+ [ "${BEADS_DB+x}" != x ] || fail "ambient BEADS_DB leaked"
12
+ [ "${BD_DB+x}" != x ] || fail "ambient BD_DB leaked"
13
+
14
+ fixture=
15
+ case "$#:$1" in
16
+ 2:array)
17
+ [ "$2" = --json ] || fail "$@"
18
+ fixture=array.json
19
+ ;;
20
+ 3:object)
21
+ [ "$2" = demo-1 ] && [ "$3" = --json ] || fail "$@"
22
+ fixture=object.json
23
+ ;;
24
+ 2:empty)
25
+ [ "$2" = --json ] || fail "$@"
26
+ fixture=empty.json
27
+ ;;
28
+ 2:stdin)
29
+ [ "$2" = --json ] || fail "$@"
30
+ expected=$(mktemp)
31
+ actual=$(mktemp)
32
+ trap 'rm -f "$expected" "$actual"' EXIT
33
+ printf 'first line\nsecond line\n\nfinal line\n' > "$expected"
34
+ cat > "$actual"
35
+ cmp -s "$expected" "$actual" || fail "stdin did not round-trip"
36
+ printf '{"stdin":"accepted"}\n'
37
+ exit 0
38
+ ;;
39
+ 1:fail)
40
+ printf 'partial stdout\n'
41
+ printf 'failure detail\n' >&2
42
+ exit 23
43
+ ;;
44
+ 2:malformed)
45
+ [ "$2" = --json ] || fail "$@"
46
+ printf 'not JSON at all\n'
47
+ exit 0
48
+ ;;
49
+ 2:stderr)
50
+ [ "$2" = --json ] || fail "$@"
51
+ printf 'informational warning\n' >&2
52
+ fixture=object.json
53
+ ;;
54
+ 2:info)
55
+ [ "$2" = --json ] || fail "$@"
56
+ printf 'informational output\n'
57
+ fixture=object.json
58
+ ;;
59
+ 6:list)
60
+ if [ "$2" = --ready ] && [ "$3" = --limit ] && [ "$4" = 1 ] && [ "$5" = --no-parent ] && [ "$6" = --json ]; then
61
+ fixture=empty.json
62
+ elif [ "$2" = --ready ] && [ "$3" = --no-parent ] && [ "$4" = --limit ] && [ "$5" = 0 ] && [ "$6" = --json ]; then
63
+ fixture=ready.json
64
+ else
65
+ fail "$@"
66
+ fi
67
+ ;;
68
+ 9:list)
69
+ [ "$2" = --no-parent ] && [ "$3" = --status ] && [ "$4" = open,in_progress,blocked,deferred ] && \
70
+ [ "$5" = --label-pattern ] && [ "$6" = 'wf:*' ] && [ "$7" = --limit ] && [ "$8" = 0 ] && [ "$9" = --json ] || fail "$@"
71
+ fixture=claimed.json
72
+ ;;
73
+ 7:list)
74
+ [ "$2" = --parent ] && [ "$3" = demo-parent ] && [ "$4" = --all ] && [ "$5" = --limit ] && [ "$6" = 0 ] && [ "$7" = --json ] || fail "$@"
75
+ fixture=children.json
76
+ ;;
77
+ 3:show)
78
+ [ "$2" = demo-parent ] && [ "$3" = --json ] || fail "$@"
79
+ fixture=show.json
80
+ ;;
81
+ 3:comments)
82
+ [ "$2" = demo-parent ] && [ "$3" = --json ] || fail "$@"
83
+ fixture=comments.json
84
+ ;;
85
+ 11:create)
86
+ [ "$2" = demo-parent:implement ] && [ "$3" = --type ] && [ "$4" = task ] && \
87
+ [ "$5" = --parent ] && [ "$6" = demo-parent ] && [ "$7" = --no-inherit-labels ] && \
88
+ [ "$8" = --labels ] && [ "$9" = wf:implementation ] && [ "${10}" = --stdin ] && [ "${11}" = --json ] || fail "$@"
89
+ expected=$(mktemp)
90
+ actual=$(mktemp)
91
+ trap 'rm -f "$expected" "$actual"' EXIT
92
+ printf 'mailbox description\nsecond line\n' > "$expected"
93
+ cat > "$actual"
94
+ cmp -s "$expected" "$actual" || fail "create stdin did not round-trip"
95
+ fixture=created.json
96
+ ;;
97
+ 5:update)
98
+ if [ "$2" = demo-parent.1 ] && [ "$3" = --add-label ] && [ "$4" = wf:implementation ] && [ "$5" = --json ]; then
99
+ fixture=updated.json
100
+ elif [ "$2" = demo-parent.1 ] && [ "$3" = --status ] && [ "$4" = in_progress ] && [ "$5" = --json ]; then
101
+ fixture=updated.json
102
+ elif [ "$2" = demo-parent.1 ] && [ "$3" = --status ] && [ "$4" = closed ] && [ "$5" = --json ]; then
103
+ fixture=updated.json
104
+ elif [ "$2" = demo-parent.1 ] && [ "$3" = --assignee ] && [ "$4" = dev@example.com ] && [ "$5" = --json ]; then
105
+ fixture=updated.json
106
+ elif [ "$2" = demo-parent ] && [ "$3" = --add-label ] && [ "$4" = wf:implementation ] && [ "$5" = --json ]; then
107
+ fixture=updated.json
108
+ else
109
+ fail "$@"
110
+ fi
111
+ ;;
112
+ 6:update)
113
+ if [ "$2" = demo-parent.1 ] && [ "$3" = --description=- ] && [ "$4" = --add-label ] && [ "$5" = wf:implementation ] && [ "$6" = --json ]; then
114
+ expected=$(mktemp)
115
+ actual=$(mktemp)
116
+ trap 'rm -f "$expected" "$actual"' EXIT
117
+ printf 'reconciled description\nwith two lines\n' > "$expected"
118
+ cat > "$actual"
119
+ cmp -s "$expected" "$actual" || fail "description stdin did not round-trip"
120
+ fixture=updated.json
121
+ else
122
+ fail "$@"
123
+ fi
124
+ ;;
125
+ 7:update)
126
+ if { [ "$2" = demo-parent ] || [ "$2" = demo-parent.1 ]; } && [ "$3" = --status ] && [ "$4" = open ] && [ "$5" = --defer ] && [ -z "$6" ] && [ "$7" = --json ]; then
127
+ fixture=updated.json
128
+ elif [ "$2" = demo-parent.1 ] && [ "$3" = --status ] && [ "$4" = in_progress ] && [ "$5" = --assignee ] && [ "$6" = dev@example.com ] && [ "$7" = --json ]; then
129
+ fixture=updated.json
130
+ else
131
+ fail "$@"
132
+ fi
133
+ ;;
134
+ 4:comment)
135
+ [ "$2" = demo-parent.1 ] && [ "$3" = --stdin ] && [ "$4" = --json ] || fail "$@"
136
+ expected=$(mktemp)
137
+ actual=$(mktemp)
138
+ trap 'rm -f "$expected" "$actual"' EXIT
139
+ printf 'summary line\n\nsecond line\n' > "$expected"
140
+ cat > "$actual"
141
+ cmp -s "$expected" "$actual" || fail "comment stdin did not round-trip"
142
+ fixture=commented.json
143
+ ;;
144
+ *)
145
+ fail "$@"
146
+ ;;
147
+ esac
148
+
149
+ cat "$BD_FIXTURE_DIR/$fixture"