trellis 3.2.3 → 3.2.4

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 (194) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +4 -0
  3. package/dist/better-sqlite-backend-CDYOAJDF.js +209 -0
  4. package/dist/boot-middleware-LBJX4N2S.js +9 -0
  5. package/dist/boot-middleware-PATBLD52.js +9 -0
  6. package/dist/bridge-G5DPW6TY.js +2361 -0
  7. package/dist/bridge-JSSPQPRH.js +2389 -0
  8. package/dist/bridge-LNXE4HAW.js +2389 -0
  9. package/dist/bridge-OAAXJWSA.js +2389 -0
  10. package/dist/bridge-SFS63RHC.js +2367 -0
  11. package/dist/bridge-U5TOUBVM.js +2389 -0
  12. package/dist/browser/index.js +12 -12
  13. package/dist/{chunk-KSU2GW22.js → chunk-276W52FK.js} +8 -0
  14. package/dist/{chunk-KFQGP6VL.js → chunk-2ESYSVXG.js} +15 -0
  15. package/dist/{chunk-L5N5PR2S.js → chunk-2WW2X2BR.js} +313 -77
  16. package/dist/chunk-3XCOAP6G.js +48 -0
  17. package/dist/chunk-53PDCTJ3.js +1856 -0
  18. package/dist/{chunk-N6MYZT4O.js → chunk-547FZFKO.js} +1 -1
  19. package/dist/{chunk-7DUMWO5L.js → chunk-7WVOPXJV.js} +3 -3
  20. package/dist/chunk-CMSFD6OV.js +11801 -0
  21. package/dist/{chunk-RSWUFTO2.js → chunk-CPUYCCLT.js} +2 -2
  22. package/dist/{chunk-4HYPLFJD.js → chunk-FA5TFVA5.js} +1 -1
  23. package/dist/{chunk-4XIVMVHC.js → chunk-G3XIHPSQ.js} +1 -1
  24. package/dist/{chunk-JHHEXEDM.js → chunk-GCQF75T4.js} +3 -3
  25. package/dist/{chunk-FKQO5A3H.js → chunk-GHG4H3AS.js} +2 -2
  26. package/dist/{chunk-GLM4HGN4.js → chunk-GRWQPKYK.js} +1 -1
  27. package/dist/{chunk-PZ4XYZ4J.js → chunk-GXA73CNC.js} +33 -8
  28. package/dist/{chunk-6GEZ6DN5.js → chunk-H6VTC5SS.js} +3 -3
  29. package/dist/{chunk-S3XLFZ27.js → chunk-IHHSOBJS.js} +1 -1
  30. package/dist/chunk-IJNC25UD.js +2243 -0
  31. package/dist/{chunk-VDAKEOML.js → chunk-J6OUIION.js} +1 -1
  32. package/dist/chunk-JAVAYMMS.js +6 -0
  33. package/dist/{chunk-S6GBJ2ZB.js → chunk-JCQQFLO5.js} +1 -1
  34. package/dist/{chunk-FWRS4CSC.js → chunk-KQG6ZYXP.js} +3 -3
  35. package/dist/chunk-KXAISKZT.js +119 -0
  36. package/dist/chunk-N3R74ZSR.js +7949 -0
  37. package/dist/{chunk-GU374KWZ.js → chunk-NLFRRGX6.js} +3 -3
  38. package/dist/{chunk-XMQ7G77X.js → chunk-OB4CMMX6.js} +1 -1
  39. package/dist/chunk-OKNASCZY.js +182 -0
  40. package/dist/chunk-ONOPPX5E.js +394 -0
  41. package/dist/chunk-QMSU2RAH.js +98 -0
  42. package/dist/{chunk-TCKXSOBP.js → chunk-RARKFVWU.js} +8 -1
  43. package/dist/{chunk-2AACZRII.js → chunk-SJWVDS5M.js} +751 -162
  44. package/dist/{chunk-SPSPV5BC.js → chunk-SZ3VAB5P.js} +159 -2
  45. package/dist/chunk-V2ASD6RQ.js +147 -0
  46. package/dist/{chunk-KQ4A2D2P.js → chunk-V4YCJDYL.js} +58 -38
  47. package/dist/{chunk-LNUIGRDZ.js → chunk-VWKLKLYB.js} +1 -1
  48. package/dist/chunk-W5PADCDF.js +1856 -0
  49. package/dist/{chunk-MLC5BUYO.js → chunk-WMERMSWI.js} +1 -1
  50. package/dist/chunk-WXAURJUD.js +1948 -0
  51. package/dist/chunk-YC5I32PS.js +147 -0
  52. package/dist/{chunk-VBYUTRXX.js → chunk-YKVB4LUQ.js} +3 -3
  53. package/dist/{chunk-NWSW5YNS.js → chunk-YPT6XMS4.js} +20 -50
  54. package/dist/cli/deploy-cli.d.ts.map +1 -1
  55. package/dist/cli/deploy-cli.js +43 -4
  56. package/dist/cli/gateway-deploy-cli.d.ts +19 -0
  57. package/dist/cli/gateway-deploy-cli.d.ts.map +1 -0
  58. package/dist/cli/index.d.ts.map +1 -1
  59. package/dist/cli/index.js +1360 -881
  60. package/dist/cli/lane.d.ts.map +1 -1
  61. package/dist/cli/protocol.d.ts +6 -0
  62. package/dist/cli/protocol.d.ts.map +1 -0
  63. package/dist/client/index.browser.js +2 -2
  64. package/dist/client/index.js +11 -11
  65. package/dist/client/sdk.browser.js +1 -1
  66. package/dist/client/sdk.js +2 -2
  67. package/dist/cms/index.js +1 -1
  68. package/dist/config-KMY6RRK3.js +19 -0
  69. package/dist/core/index.js +13 -13
  70. package/dist/core/kernel/boot-middleware.d.ts +1 -1
  71. package/dist/core/kernel/boot-middleware.d.ts.map +1 -1
  72. package/dist/core/kernel/schema-middleware.d.ts +2 -1
  73. package/dist/core/kernel/schema-middleware.d.ts.map +1 -1
  74. package/dist/core/kernel/trellis-kernel.d.ts +10 -10
  75. package/dist/core/kernel/trellis-kernel.d.ts.map +1 -1
  76. package/dist/core/persist/factory.js +2 -2
  77. package/dist/core/persist/sqljs-backend.js +2 -2
  78. package/dist/db/index.js +30 -25
  79. package/dist/decisions/index.js +4 -4
  80. package/dist/embeddings/index.js +2 -2
  81. package/dist/engine.d.ts +24 -6
  82. package/dist/engine.d.ts.map +1 -1
  83. package/dist/gateway-deploy-cli-4TU4V3QI.js +312 -0
  84. package/dist/gateway-deploy-cli-A4ISTDHJ.js +298 -0
  85. package/dist/gateway-deploy-cli-D3XTKJQJ.js +312 -0
  86. package/dist/gateway-deploy-cli-ECV3OQCN.js +305 -0
  87. package/dist/gateway-deploy-cli-JUHKVIJE.js +296 -0
  88. package/dist/gateway-deploy-cli-NSDW2JLT.js +310 -0
  89. package/dist/gateway-serve-CM5EAZ52.js +113 -0
  90. package/dist/import-AJLYHFIA.js +10 -0
  91. package/dist/index.js +11 -11
  92. package/dist/launch-explorer-FVX6ZABW.js +95 -0
  93. package/dist/links/index.js +2 -2
  94. package/dist/mcp/bridge.d.ts +45 -0
  95. package/dist/mcp/bridge.d.ts.map +1 -0
  96. package/dist/mcp/discovery.d.ts +15 -0
  97. package/dist/mcp/discovery.d.ts.map +1 -0
  98. package/dist/mcp/gateway-config.d.ts +20 -0
  99. package/dist/mcp/gateway-config.d.ts.map +1 -0
  100. package/dist/mcp/gateway-serve.d.ts +19 -0
  101. package/dist/mcp/gateway-serve.d.ts.map +1 -0
  102. package/dist/mcp/gateway-serve.js +119 -0
  103. package/dist/mcp/graph-summary.d.ts +47 -0
  104. package/dist/mcp/graph-summary.d.ts.map +1 -0
  105. package/dist/mcp/room-audit.d.ts +14 -0
  106. package/dist/mcp/room-audit.d.ts.map +1 -0
  107. package/dist/mcp/room-helpers.d.ts +43 -0
  108. package/dist/mcp/room-helpers.d.ts.map +1 -0
  109. package/dist/mcp/room-registry.d.ts +32 -0
  110. package/dist/mcp/room-registry.d.ts.map +1 -0
  111. package/dist/mcp/room.d.ts +28 -0
  112. package/dist/mcp/room.d.ts.map +1 -0
  113. package/dist/plugins/agent-memory/index.js +1 -1
  114. package/dist/plugins/idea-garden/index.js +1 -1
  115. package/dist/plugins/plan-approval/index.js +1 -1
  116. package/dist/plugins/proactive-watcher/index.js +1 -1
  117. package/dist/protocol/envelope.d.ts +30 -0
  118. package/dist/protocol/envelope.d.ts.map +1 -0
  119. package/dist/protocol/index.d.ts +3 -0
  120. package/dist/protocol/index.d.ts.map +1 -0
  121. package/dist/protocol/whereami.d.ts +33 -0
  122. package/dist/protocol/whereami.d.ts.map +1 -0
  123. package/dist/query-KHDDIR5G.js +31 -0
  124. package/dist/react/index.js +1 -1
  125. package/dist/react/realtime.js +1 -1
  126. package/dist/react/schema-hooks.js +5 -5
  127. package/dist/realtime/index.js +3 -3
  128. package/dist/realtime/relay-server.d.ts.map +1 -1
  129. package/dist/realtime/room.d.ts.map +1 -1
  130. package/dist/realtime.bundle.js +2 -0
  131. package/dist/relay-server-BT6DCJ7F.js +12 -0
  132. package/dist/relay-server-MPQVGNQU.js +12 -0
  133. package/dist/relay-server-PAPW2EWC.js +12 -0
  134. package/dist/remote-manager-6ERQUBSL.js +224 -0
  135. package/dist/remote-manager-G665WWYY.js +224 -0
  136. package/dist/remote-manager-HJTEZ4OF.js +224 -0
  137. package/dist/remote-manager-NYP2Y5UR.js +224 -0
  138. package/dist/remote-manager-WGLCAMMC.js +224 -0
  139. package/dist/scaffold/write.d.ts.map +1 -1
  140. package/dist/schema/index.js +1 -1
  141. package/dist/server/cors.d.ts.map +1 -1
  142. package/dist/server/deploy-gateway.d.ts +27 -0
  143. package/dist/server/deploy-gateway.d.ts.map +1 -0
  144. package/dist/server/deploy.d.ts.map +1 -1
  145. package/dist/server/deploy.js +3 -2
  146. package/dist/server/discovery-mcp-gateway.d.ts +13 -0
  147. package/dist/server/discovery-mcp-gateway.d.ts.map +1 -0
  148. package/dist/server/index.js +38 -31
  149. package/dist/server/mcp-gateway.d.ts +27 -0
  150. package/dist/server/mcp-gateway.d.ts.map +1 -0
  151. package/dist/server/mcp-oauth-metadata.d.ts +31 -0
  152. package/dist/server/mcp-oauth-metadata.d.ts.map +1 -0
  153. package/dist/server/node-adapter.d.ts +7 -0
  154. package/dist/server/node-adapter.d.ts.map +1 -1
  155. package/dist/server/node-adapter.js +2 -2
  156. package/dist/server/realtime.d.ts.map +1 -1
  157. package/dist/server/server.d.ts +8 -0
  158. package/dist/server/server.d.ts.map +1 -1
  159. package/dist/server/streamable-mcp-gateway.d.ts +12 -0
  160. package/dist/server/streamable-mcp-gateway.d.ts.map +1 -0
  161. package/dist/server/usage-meter.d.ts +11 -0
  162. package/dist/server/usage-meter.d.ts.map +1 -1
  163. package/dist/server-4VEZHXXS.js +23 -0
  164. package/dist/{server-OGVWNDNK.js → server-556BMK4C.js} +1 -1
  165. package/dist/server-FQT2VYRE.js +23 -0
  166. package/dist/server-HGZE4ECC.js +23 -0
  167. package/dist/server-J4JKEAMH.js +23 -0
  168. package/dist/server-LXPM5TFR.js +23 -0
  169. package/dist/server-POB4NEUX.js +18 -0
  170. package/dist/server-VJKAPGPG.js +23 -0
  171. package/dist/server-YHS3XIIG.js +23 -0
  172. package/dist/server-ZHTPWPXS.js +23 -0
  173. package/dist/sprites-NC6D7YZS.js +27 -0
  174. package/dist/svelte/index.js +3 -3
  175. package/dist/svelte/schema-hooks.js +4 -4
  176. package/dist/sync/index.js +4 -4
  177. package/dist/tenancy-2SZTP4UD.js +16 -0
  178. package/dist/tenancy-7MTSESMJ.js +16 -0
  179. package/dist/tenancy-U4E7ZEAG.js +16 -0
  180. package/dist/vcs/decompose.d.ts.map +1 -1
  181. package/dist/vcs/index.js +5 -5
  182. package/dist/vcs/lane-disk-materialize.d.ts +11 -0
  183. package/dist/vcs/lane-disk-materialize.d.ts.map +1 -0
  184. package/dist/vcs/lane-worktree.d.ts +21 -0
  185. package/dist/vcs/lane-worktree.d.ts.map +1 -0
  186. package/dist/vcs/store.d.ts +28 -0
  187. package/dist/vcs/store.d.ts.map +1 -0
  188. package/dist/vcs/types.d.ts +5 -0
  189. package/dist/vcs/types.d.ts.map +1 -1
  190. package/dist/vm-config-YZRJ3KUB.js +21 -0
  191. package/dist/vue/index.js +3 -3
  192. package/dist/vue/schema-hooks.js +4 -4
  193. package/package.json +4 -3
  194. package/dist/chunk-GFZCJ4EH.js +0 -108
@@ -4,11 +4,11 @@ import {
4
4
  init_decisions,
5
5
  queryDecisions,
6
6
  recordDecision
7
- } from "./chunk-GU374KWZ.js";
7
+ } from "./chunk-NLFRRGX6.js";
8
8
  import {
9
9
  EAVStore,
10
10
  init_eav_store
11
- } from "./chunk-4XIVMVHC.js";
11
+ } from "./chunk-G3XIHPSQ.js";
12
12
  import {
13
13
  BlobStore,
14
14
  JsonOpLog,
@@ -66,20 +66,20 @@ import {
66
66
  unblockIssue,
67
67
  updateIssue,
68
68
  updateLaneHead
69
- } from "./chunk-VBYUTRXX.js";
69
+ } from "./chunk-YKVB4LUQ.js";
70
70
  import {
71
71
  DEFAULT_CONFIG,
72
72
  init_types
73
- } from "./chunk-N6MYZT4O.js";
73
+ } from "./chunk-547FZFKO.js";
74
74
  import {
75
75
  createVcsOp,
76
76
  init_ops,
77
77
  isVcsOpKind,
78
78
  verifyVcsOpHash
79
- } from "./chunk-GLM4HGN4.js";
79
+ } from "./chunk-GRWQPKYK.js";
80
80
  import {
81
81
  __esm
82
- } from "./chunk-KFQGP6VL.js";
82
+ } from "./chunk-2ESYSVXG.js";
83
83
 
84
84
  // src/watcher/fs-watcher.ts
85
85
  import { watch } from "fs";
@@ -698,6 +698,11 @@ function writeTrellisHooks(rootPath, ide) {
698
698
  if (!existsSync3(adaptersDir)) {
699
699
  mkdirSync2(adaptersDir, { recursive: true });
700
700
  }
701
+ writeFileSync2(
702
+ join4(trellisHarnessDir, "trellis-cli.sh"),
703
+ readHarnessTemplate("trellis-cli.sh"),
704
+ "utf-8"
705
+ );
701
706
  writeFileSync2(
702
707
  join4(trellisHarnessDir, "pre-prompt-recall.sh"),
703
708
  renderPrePromptRecallScript(),
@@ -1078,8 +1083,9 @@ function renderPrePromptRecallScript() {
1078
1083
  # Normalized contract: TRELLIS_ORIGIN, TRELLIS_DESK_ROOT, TRELLIS_HOOK_OUTPUT
1079
1084
  set -euo pipefail
1080
1085
 
1081
- # Import desk root detection
1082
- source "$(dirname "$0")/../../desk-root.sh"
1086
+ # Import desk root detection + trellis CLI helpers
1087
+ source "$(dirname "$0")/../desk-root.sh"
1088
+ source "$(dirname "$0")/trellis-cli.sh"
1083
1089
 
1084
1090
  # Environment variables from contract
1085
1091
  ORIGIN="\${TRELLIS_ORIGIN:-unknown}"
@@ -1091,24 +1097,18 @@ if ! command -v trellis >/dev/null 2>&1; then
1091
1097
  fi
1092
1098
 
1093
1099
  # Try to get Trellis context (non-blocking)
1094
- if [ -f ".trellis/config.json" ]; then
1095
- # Query recent memories and entities for context
1096
- CONTEXT_OUTPUT=$(trellis query --limit 5 --format json 2>/dev/null || echo '{"entities":[],"relations":[]}')
1097
-
1098
- # Query recent operations for context
1099
- OPS_OUTPUT=$(trellis log --limit 3 --format json 2>/dev/null || echo '{"operations":[]}')
1100
+ if [ -f ".trellis/config.json" ] || [ -f "$(trellis_harness_vcs_path)/.trellis/config.json" ]; then
1101
+ CONTEXT_OUTPUT='{"entities":[],"relations":[]}'
1102
+ OPS_COUNT=$(trellis_harness_recent_log_count 3)
1103
+ ISSUES_COUNT=$(trellis_harness_active_issue_count)
1104
+ OPS_OUTPUT="{\\"count\\":\${OPS_COUNT}}"
1105
+ ISSUES_OUTPUT="{\\"count\\":\${ISSUES_COUNT},\\"status\\":\\"in_progress\\"}"
1100
1106
 
1101
- # Query active issues
1102
- ISSUES_OUTPUT=$(trellis issue list --status active --format json 2>/dev/null || echo '{"issues":[]}')
1103
-
1104
- # Format output based on hook type
1105
1107
  case "$OUTPUT" in
1106
1108
  "agent-stop")
1107
- # For Codex/Gemini blocking hooks
1108
1109
  echo "{}"
1109
1110
  ;;
1110
1111
  "gemini")
1111
- # For Gemini CLI format
1112
1112
  cat << EOF
1113
1113
  {
1114
1114
  "decision": "allow",
@@ -1122,12 +1122,10 @@ if [ -f ".trellis/config.json" ]; then
1122
1122
  EOF
1123
1123
  ;;
1124
1124
  *)
1125
- # Default stdout for Cursor/Devin/Claude
1126
1125
  echo ""
1127
1126
  echo "\u{1F33F} Trellis Context ($ORIGIN):"
1128
- echo " Recent memories: $(echo "$CONTEXT_OUTPUT" | jq -r '.entities | length' 2>/dev/null || echo "0")"
1129
- echo " Recent ops: $(echo "$OPS_OUTPUT" | jq -r '.operations | length' 2>/dev/null || echo "0")"
1130
- echo " Active issues: $(echo "$ISSUES_OUTPUT" | jq -r '.issues | length' 2>/dev/null || echo "0")"
1127
+ echo " Recent ops: $OPS_COUNT"
1128
+ echo " Active issues: $ISSUES_COUNT"
1131
1129
  echo ""
1132
1130
  ;;
1133
1131
  esac
@@ -1180,7 +1178,8 @@ function renderPostToolMemoryCaptureScript() {
1180
1178
  set -euo pipefail
1181
1179
 
1182
1180
  # Import desk root detection
1183
- source "$(dirname "$0")/../../desk-root.sh"
1181
+ source "$(dirname "$0")/../desk-root.sh"
1182
+ source "$(dirname "$0")/trellis-cli.sh"
1184
1183
 
1185
1184
  # Environment variables from contract
1186
1185
  ORIGIN="\${TRELLIS_ORIGIN:-unknown}"
@@ -1255,8 +1254,9 @@ function renderStopTriageScript() {
1255
1254
  # Normalized contract: TRELLIS_ORIGIN, TRELLIS_DESK_ROOT, TRELLIS_HOOK_OUTPUT
1256
1255
  set -euo pipefail
1257
1256
 
1258
- # Import desk root detection
1259
- source "$(dirname "$0")/../../desk-root.sh"
1257
+ # Import desk root detection + trellis CLI helpers
1258
+ source "$(dirname "$0")/../desk-root.sh"
1259
+ source "$(dirname "$0")/trellis-cli.sh"
1260
1260
 
1261
1261
  # Environment variables from contract
1262
1262
  ORIGIN="\${TRELLIS_ORIGIN:-unknown}"
@@ -1267,10 +1267,8 @@ if ! command -v trellis >/dev/null 2>&1; then
1267
1267
  exit 0
1268
1268
  fi
1269
1269
 
1270
- if [ -f ".trellis/config.json" ]; then
1271
- # Check for active issues that need attention
1272
- ACTIVE_ISSUES=$(trellis issue list --status active --format json 2>/dev/null || echo '{"issues":[]}')
1273
- ACTIVE_COUNT=$(echo "$ACTIVE_ISSUES" | jq -r '.issues | length' 2>/dev/null || echo "0")
1270
+ if [ -f ".trellis/config.json" ] || [ -f "$(trellis_harness_vcs_path)/.trellis/config.json" ]; then
1271
+ ACTIVE_COUNT=$(trellis_harness_active_issue_count)
1274
1272
 
1275
1273
  # Check for pending memory suggestions
1276
1274
  MEMORY_DIR=".trellis/agent-suggestions"
@@ -1289,7 +1287,7 @@ if [ -f ".trellis/config.json" ]; then
1289
1287
  RECOMMENDATIONS=()
1290
1288
 
1291
1289
  if [ "$ACTIVE_COUNT" -gt 0 ]; then
1292
- RECOMMENDATIONS+=("\u{1F3AF} $ACTIVE_COUNT active issues need attention - run 'trellis issue list'")
1290
+ RECOMMENDATIONS+=("\u{1F3AF} $ACTIVE_COUNT active issues need attention - run 'trellis issue active'")
1293
1291
  fi
1294
1292
 
1295
1293
  if [ "$SUGGESTION_COUNT" -gt 0 ]; then
@@ -1909,8 +1907,9 @@ function renderBugIntakeScript() {
1909
1907
  # Creates structured issues with acceptance criteria and test requirements
1910
1908
  set -euo pipefail
1911
1909
 
1912
- # Import desk root detection
1910
+ # Import desk root detection + trellis CLI helpers
1913
1911
  source "\\$(dirname "\\$0")/../desk-root.sh"
1912
+ source "\\$(dirname "\\$0")/trellis-cli.sh"
1914
1913
 
1915
1914
  # Environment variables from contract
1916
1915
  ORIGIN="\${TRELLIS_ORIGIN:-unknown}"
@@ -2001,12 +2000,12 @@ This bug is considered **DONE** when:
2001
2000
  **Template:** bug-intake-v1.0
2002
2001
  "
2003
2002
 
2004
- # Create the Trellis issue
2005
- ISSUE_ID=$(echo "\\$ISSUE_CONTENT" | trellis issue create --title "\\$TITLE" --content-from-stdin --format json 2>/dev/null | jq -r '.id // empty' || echo "")
2003
+ # Create the Trellis issue (real CLI \u2014 no --format json)
2004
+ BUG_LABELS="bug,severity-\${SEVERITY},component-\${COMPONENT},tdd-required,needs-investigation,needs-triage"
2005
+ ISSUE_ID=$(trellis_harness_issue_create "\\$TITLE" "\\$BUG_LABELS" "Bug intake report" "" "queue" || true)
2006
2006
 
2007
2007
  if [ -n "\\$ISSUE_ID" ]; then
2008
- # Add labels to the issue
2009
- trellis issue label "\\$ISSUE_ID" add "bug" "severity-\\$SEVERITY" "component-\\$COMPONENT" "tdd-required" "needs-investigation" 2>/dev/null || true
2008
+ trellis_harness_issue_set_description "\\$ISSUE_ID" "\\$ISSUE_CONTENT" || true
2010
2009
 
2011
2010
  echo ""
2012
2011
  echo "\u{1F41B} Bug Intake Completed (\\$ORIGIN):"
@@ -2016,7 +2015,7 @@ if [ -n "\\$ISSUE_ID" ]; then
2016
2015
  echo " \u2705 TDD requirements enforced"
2017
2016
  echo ""
2018
2017
  echo "\u{1F4CB} Next Steps:"
2019
- echo " 1. Investigate the bug: trellis issue view \\$ISSUE_ID"
2018
+ echo " 1. Investigate the bug: trellis issue show \\$ISSUE_ID"
2020
2019
  echo " 2. Develop tests with TDD approach"
2021
2020
  echo " 3. Implement fix"
2022
2021
  echo ""
@@ -2032,8 +2031,9 @@ function renderBugInvestigateScript() {
2032
2031
  # Ensures thorough investigation before fix implementation
2033
2032
  set -euo pipefail
2034
2033
 
2035
- # Import desk root detection
2034
+ # Import desk root detection + trellis CLI helpers
2036
2035
  source "\\$(dirname "\\$0")/../desk-root.sh"
2036
+ source "\\$(dirname "\\$0")/trellis-cli.sh"
2037
2037
 
2038
2038
  # Environment variables from contract
2039
2039
  ORIGIN="\${TRELLIS_ORIGIN:-unknown}"
@@ -2052,8 +2052,7 @@ if [ -z "\\$ISSUE_ID" ]; then
2052
2052
  fi
2053
2053
 
2054
2054
  # Get issue details
2055
- ISSUE_DETAILS=$(trellis issue view "\\$ISSUE_ID" --format json 2>/dev/null || echo "{}")
2056
- TITLE=$(echo "\\$ISSUE_DETAILS" | jq -r '.title // "Unknown Issue"' 2>/dev/null || echo "Unknown Issue")
2055
+ TITLE=$(trellis_harness_issue_parse_title "\\$ISSUE_ID" 2>/dev/null || echo "Unknown Issue")
2057
2056
 
2058
2057
  # Create test directory structure
2059
2058
  TEST_DIR="tests/bugs/\\$ISSUE_ID"
@@ -2135,12 +2134,13 @@ echo ""
2135
2134
  }
2136
2135
  function renderMilestoneTriageScript() {
2137
2136
  return `#!/usr/bin/env bash
2138
- # Milestone and cycle triage for Trellis integration
2139
- # Integrates bugs with project milestones and development cycles
2137
+ # Milestone and sprint (label) triage for Trellis integration
2138
+ # Sprint time-boxing via sprint:* labels \u2014 no trellis cycle * CLI
2140
2139
  set -euo pipefail
2141
2140
 
2142
- # Import desk root detection
2141
+ # Import desk root detection + trellis CLI helpers
2143
2142
  source "\\$(dirname "\\$0")/../desk-root.sh"
2143
+ source "\\$(dirname "\\$0")/trellis-cli.sh"
2144
2144
 
2145
2145
  # Environment variables from contract
2146
2146
  ORIGIN="\${TRELLIS_ORIGIN:-unknown}"
@@ -2159,17 +2159,17 @@ if [ -z "\\$ISSUE_ID" ]; then
2159
2159
  fi
2160
2160
 
2161
2161
  # Get issue details and calculate priority
2162
- ISSUE_DETAILS=$(trellis issue view "\\$ISSUE_ID" --format json 2>/dev/null || echo "{}")
2163
- TITLE=$(echo "\\$ISSUE_DETAILS" | jq -r '.title // "Unknown Issue"' 2>/dev/null || echo "Unknown Issue")
2164
- LABELS=$(echo "\\$ISSUE_DETAILS" | jq -r '.labels // []' 2>/dev/null || echo "[]")
2165
- SEVERITY=$(echo "\\$LABELS" | jq -r '.[] | select(startswith("severity-")) | split("-")[1]' 2>/dev/null || echo "medium")
2166
-
2167
- # Get current milestone and cycle info
2168
- CURRENT_MILESTONE=$(trellis milestone current --format json 2>/dev/null || echo "{}")
2169
- MILESTONE_NAME=$(echo "\\$CURRENT_MILESTONE" | jq -r '.name // "current"' 2>/dev/null || echo "current")
2170
-
2171
- CURRENT_CYCLE=$(trellis cycle current --format json 2>/dev/null || echo "{}")
2172
- CYCLE_NAME=$(echo "\\$CURRENT_CYCLE" | jq -r '.name // "current"' 2>/dev/null || echo "current")
2162
+ TITLE=$(trellis_harness_issue_parse_title "\\$ISSUE_ID" 2>/dev/null || echo "Unknown Issue")
2163
+ LABELS_LINE=$(trellis_harness_issue_parse_labels "\\$ISSUE_ID" 2>/dev/null || echo "")
2164
+ SEVERITY="medium"
2165
+ case "\\$LABELS_LINE" in
2166
+ *severity-critical*) SEVERITY="critical" ;;
2167
+ *severity-high*) SEVERITY="high" ;;
2168
+ *severity-low*) SEVERITY="low" ;;
2169
+ esac
2170
+
2171
+ MILESTONE_NAME=$(trellis_harness_latest_milestone_name)
2172
+ SPRINT_LABEL=$(trellis_harness_sprint_label)
2173
2173
 
2174
2174
  # Calculate priority based on severity
2175
2175
  calculate_priority() {
@@ -2185,29 +2185,33 @@ calculate_priority() {
2185
2185
 
2186
2186
  PRIORITY=$(calculate_priority "\\$SEVERITY")
2187
2187
 
2188
- # Update issue labels and assign to milestone/cycle
2189
- trellis issue label "\\$ISSUE_ID" add "triaged" "priority-\\$PRIORITY" "milestone-\\$MILESTONE_NAME" "cycle-\\$CYCLE_NAME" 2>/dev/null || true
2190
-
2191
- # Update issue priority
2192
- trellis issue priority "\\$ISSUE_ID" set "\\$PRIORITY" 2>/dev/null || true
2188
+ MERGED_LABELS=$(trellis_harness_merge_labels "\\$LABELS_LINE" "triaged,priority-\${PRIORITY},milestone-\${MILESTONE_NAME}")
2189
+ trellis_harness_issue_update_labels "\\$ISSUE_ID" "\\$MERGED_LABELS" || true
2190
+ case "\\$PRIORITY" in
2191
+ urgent) trellis_harness_issue_update_priority "\\$ISSUE_ID" "critical" || true ;;
2192
+ high) trellis_harness_issue_update_priority "\\$ISSUE_ID" "high" || true ;;
2193
+ low) trellis_harness_issue_update_priority "\\$ISSUE_ID" "low" || true ;;
2194
+ *) trellis_harness_issue_update_priority "\\$ISSUE_ID" "medium" || true ;;
2195
+ esac
2193
2196
 
2194
2197
  echo ""
2195
- echo "\u{1F3AF} Milestone & Cycle Triage Completed (\\$ORIGIN):"
2198
+ echo "\u{1F3AF} Milestone & Sprint Triage Completed (\\$ORIGIN):"
2196
2199
  echo " \u{1F4DD} Issue: #\\$ISSUE_ID - \\$TITLE"
2197
2200
  echo " \u{1F6A6} Priority: \\$PRIORITY"
2198
2201
  echo " \u{1F3AF} Milestone: \\$MILESTONE_NAME"
2199
- echo " \u{1F504} Cycle: \\$CYCLE_NAME"
2202
+ echo " \u{1F3F7}\uFE0F Sprint (label): \\$SPRINT_LABEL"
2200
2203
  echo ""
2201
2204
  `;
2202
2205
  }
2203
2206
  function renderCyclePlanningScript() {
2204
2207
  return `#!/usr/bin/env bash
2205
- # Cycle planning and workload management for Trellis integration
2206
- # Manages development cycles, sprint planning, and resource allocation
2208
+ # Sprint planning (label convention) for Trellis integration
2209
+ # Time-boxed WIP via sprint:* issue labels \u2014 no trellis cycle * CLI
2207
2210
  set -euo pipefail
2208
2211
 
2209
- # Import desk root detection
2212
+ # Import desk root detection + trellis CLI helpers
2210
2213
  source "\\$(dirname "\\$0")/../desk-root.sh"
2214
+ source "\\$(dirname "\\$0")/trellis-cli.sh"
2211
2215
 
2212
2216
  # Environment variables from contract
2213
2217
  ORIGIN="\${TRELLIS_ORIGIN:-unknown}"
@@ -2218,17 +2222,15 @@ if ! command -v trellis >/dev/null 2>&1; then
2218
2222
  exit 0
2219
2223
  fi
2220
2224
 
2221
- # Get current cycle information
2222
- CURRENT_CYCLE=$(trellis cycle current --format json 2>/dev/null || echo "{}")
2223
- CYCLE_NAME=$(echo "\\$CURRENT_CYCLE" | jq -r '.name // "current"' 2>/dev/null || echo "current")
2224
-
2225
- # Get all issues in current cycle
2226
- CYCLE_ISSUES=$(trellis cycle issues --format json 2>/dev/null || echo "[]")
2225
+ # Sprint = label convention; plan from in_progress issues + milestones
2226
+ SPRINT_LABEL=$(trellis_harness_sprint_label)
2227
+ WORKLOAD=$(trellis_harness_active_issue_count)
2228
+ MILESTONE_NAME=$(trellis_harness_latest_milestone_name)
2227
2229
 
2228
- # Analyze cycle workload
2229
- total_issues=$(echo "\\$CYCLE_ISSUES" | jq 'length' 2>/dev/null || echo "0")
2230
- urgent_issues=$(echo "\\$CYCLE_ISSUES" | jq '[.[] | select(.labels[] | contains("priority-urgent"))] | length' 2>/dev/null || echo "0")
2231
- high_issues=$(echo "\\$CYCLE_ISSUES" | jq '[.[] | select(.labels[] | contains("priority-high"))] | length' 2>/dev/null || echo "0")
2230
+ # Analyze sprint workload
2231
+ total_issues="\\$WORKLOAD"
2232
+ urgent_issues=0
2233
+ high_issues=0
2232
2234
 
2233
2235
  # Calculate health score
2234
2236
  health_score=100
@@ -2240,8 +2242,8 @@ if [ "\\$health_score" -lt 0 ]; then
2240
2242
  fi
2241
2243
 
2242
2244
  echo ""
2243
- echo "\u{1F504} Cycle Planning Completed (\\$ORIGIN):"
2244
- echo " \u{1F4CA} Cycle: \\$CYCLE_NAME"
2245
+ echo "\u{1F504} Sprint Planning Completed (\\$ORIGIN):"
2246
+ echo " \u{1F4CA} Sprint (label): \\$SPRINT_LABEL"
2245
2247
  echo " \u{1F4C8} Health Score: \\$health_score/100"
2246
2248
  echo " \u{1F4DD} Total Issues: \\$total_issues"
2247
2249
  echo " \u{1F6A8} Urgent Issues: \\$urgent_issues"
@@ -2261,6 +2263,170 @@ var init_write = __esm({
2261
2263
  }
2262
2264
  });
2263
2265
 
2266
+ // src/vcs/store.ts
2267
+ function getEntity(ctx, entityId) {
2268
+ const facts = ctx.store.getFactsByEntity(entityId);
2269
+ if (facts.length === 0) return null;
2270
+ const typeFact = facts.find((f) => f.a === "type");
2271
+ return {
2272
+ id: entityId,
2273
+ type: typeFact?.v ?? "unknown",
2274
+ facts,
2275
+ links: ctx.store.getLinksByEntity(entityId)
2276
+ };
2277
+ }
2278
+ function listEntities(ctx, type, filters, opts) {
2279
+ let entityIds;
2280
+ if (type) {
2281
+ entityIds = new Set(
2282
+ ctx.store.getFactsByValue("type", type).map((f) => f.e)
2283
+ );
2284
+ } else {
2285
+ entityIds = new Set(ctx.store.getFactsByAttribute("type").map((f) => f.e));
2286
+ }
2287
+ if (!opts?.includeVcs) {
2288
+ for (const id of entityIds) {
2289
+ if (VCS_ENTITY_PREFIXES.some((p) => id.startsWith(p))) {
2290
+ entityIds.delete(id);
2291
+ }
2292
+ }
2293
+ }
2294
+ if (filters) {
2295
+ for (const [attr, value] of Object.entries(filters)) {
2296
+ const matching = new Set(
2297
+ ctx.store.getFactsByValue(attr, value).map((f) => f.e)
2298
+ );
2299
+ for (const id of entityIds) {
2300
+ if (!matching.has(id)) entityIds.delete(id);
2301
+ }
2302
+ }
2303
+ }
2304
+ return Array.from(entityIds).map((id) => getEntity(ctx, id)).filter(Boolean);
2305
+ }
2306
+ async function createEntity(ctx, entityId, type, attributes = {}, opts) {
2307
+ const facts = [
2308
+ { e: entityId, a: "type", v: type },
2309
+ { e: entityId, a: "createdAt", v: (/* @__PURE__ */ new Date()).toISOString() }
2310
+ ];
2311
+ for (const [attr, value] of Object.entries(attributes)) {
2312
+ facts.push({ e: entityId, a: attr, v: value });
2313
+ }
2314
+ const op = await createVcsOp("vcs:storeAssert", {
2315
+ agentId: ctx.agentId,
2316
+ previousHash: ctx.getLastOp()?.hash,
2317
+ vcs: { facts }
2318
+ });
2319
+ await ctx.applyOp(op);
2320
+ if (opts?.links?.length) {
2321
+ for (const link of opts.links) {
2322
+ await addLink(ctx, entityId, link.attribute, link.targetEntityId);
2323
+ }
2324
+ }
2325
+ return op;
2326
+ }
2327
+ async function updateEntity(ctx, entityId, updates) {
2328
+ const existing = ctx.store.getFactsByEntity(entityId);
2329
+ if (existing.length === 0) {
2330
+ throw new Error(`Entity ${entityId} not found.`);
2331
+ }
2332
+ const deleteFacts = [];
2333
+ const addFacts = [
2334
+ { e: entityId, a: "updatedAt", v: (/* @__PURE__ */ new Date()).toISOString() }
2335
+ ];
2336
+ for (const [attr, newValue] of Object.entries(updates)) {
2337
+ for (const f of existing.filter((x) => x.a === attr)) {
2338
+ deleteFacts.push(f);
2339
+ }
2340
+ addFacts.push({ e: entityId, a: attr, v: newValue });
2341
+ }
2342
+ if (deleteFacts.length > 0) {
2343
+ const retractOp = await createVcsOp("vcs:storeRetract", {
2344
+ agentId: ctx.agentId,
2345
+ previousHash: ctx.getLastOp()?.hash,
2346
+ vcs: { facts: deleteFacts }
2347
+ });
2348
+ await ctx.applyOp(retractOp);
2349
+ }
2350
+ const op = await createVcsOp("vcs:storeAssert", {
2351
+ agentId: ctx.agentId,
2352
+ previousHash: ctx.getLastOp()?.hash,
2353
+ vcs: { facts: addFacts }
2354
+ });
2355
+ await ctx.applyOp(op);
2356
+ return op;
2357
+ }
2358
+ async function deleteEntity(ctx, entityId) {
2359
+ const facts = ctx.store.getFactsByEntity(entityId);
2360
+ const links = ctx.store.getLinksByEntity(entityId);
2361
+ if (facts.length === 0 && links.length === 0) {
2362
+ throw new Error(`Entity ${entityId} not found.`);
2363
+ }
2364
+ let lastOp;
2365
+ if (facts.length > 0) {
2366
+ lastOp = await createVcsOp("vcs:storeRetract", {
2367
+ agentId: ctx.agentId,
2368
+ previousHash: ctx.getLastOp()?.hash,
2369
+ vcs: { facts }
2370
+ });
2371
+ await ctx.applyOp(lastOp);
2372
+ }
2373
+ if (links.length > 0) {
2374
+ lastOp = await createVcsOp("vcs:storeUnlink", {
2375
+ agentId: ctx.agentId,
2376
+ previousHash: ctx.getLastOp()?.hash,
2377
+ vcs: { links }
2378
+ });
2379
+ await ctx.applyOp(lastOp);
2380
+ }
2381
+ return lastOp;
2382
+ }
2383
+ async function addFact(ctx, entityId, attribute, value) {
2384
+ const op = await createVcsOp("vcs:storeAssert", {
2385
+ agentId: ctx.agentId,
2386
+ previousHash: ctx.getLastOp()?.hash,
2387
+ vcs: { facts: [{ e: entityId, a: attribute, v: value }] }
2388
+ });
2389
+ await ctx.applyOp(op);
2390
+ return op;
2391
+ }
2392
+ async function removeFact(ctx, entityId, attribute, value) {
2393
+ const op = await createVcsOp("vcs:storeRetract", {
2394
+ agentId: ctx.agentId,
2395
+ previousHash: ctx.getLastOp()?.hash,
2396
+ vcs: { facts: [{ e: entityId, a: attribute, v: value }] }
2397
+ });
2398
+ await ctx.applyOp(op);
2399
+ return op;
2400
+ }
2401
+ async function addLink(ctx, sourceId, attribute, targetId) {
2402
+ const link = { e1: sourceId, a: attribute, e2: targetId };
2403
+ const op = await createVcsOp("vcs:storeLink", {
2404
+ agentId: ctx.agentId,
2405
+ previousHash: ctx.getLastOp()?.hash,
2406
+ vcs: { links: [link] }
2407
+ });
2408
+ await ctx.applyOp(op);
2409
+ return op;
2410
+ }
2411
+ async function removeLink(ctx, sourceId, attribute, targetId) {
2412
+ const link = { e1: sourceId, a: attribute, e2: targetId };
2413
+ const op = await createVcsOp("vcs:storeUnlink", {
2414
+ agentId: ctx.agentId,
2415
+ previousHash: ctx.getLastOp()?.hash,
2416
+ vcs: { links: [link] }
2417
+ });
2418
+ await ctx.applyOp(op);
2419
+ return op;
2420
+ }
2421
+ var VCS_ENTITY_PREFIXES;
2422
+ var init_store = __esm({
2423
+ "src/vcs/store.ts"() {
2424
+ "use strict";
2425
+ init_ops();
2426
+ VCS_ENTITY_PREFIXES = ["issue:", "file:", "dir:", "branch:", "milestone:", "checkpoint:", "criterion:", "lane:", "decision:"];
2427
+ }
2428
+ });
2429
+
2264
2430
  // src/garden/cluster.ts
2265
2431
  function isFileOp(op) {
2266
2432
  return FILE_OP_KINDS.has(op.kind);
@@ -6026,6 +6192,7 @@ var init_engine = __esm({
6026
6192
  init_diff();
6027
6193
  init_merge();
6028
6194
  init_issue();
6195
+ init_store();
6029
6196
  init_decisions();
6030
6197
  init_garden2();
6031
6198
  init_semantic();
@@ -7210,6 +7377,75 @@ var init_engine = __esm({
7210
7377
  return getActiveIssues(this._ctx());
7211
7378
  }
7212
7379
  // -------------------------------------------------------------------------
7380
+ // EAV Store (delegated to src/vcs/store.ts — ADR 0008)
7381
+ // -------------------------------------------------------------------------
7382
+ async createStoreEntity(entityId, type, attributes = {}, opts) {
7383
+ const op = await createEntity(
7384
+ this._ctx(),
7385
+ entityId,
7386
+ type,
7387
+ attributes,
7388
+ opts
7389
+ );
7390
+ await this.flushAutoCheckpoint();
7391
+ return op;
7392
+ }
7393
+ async updateStoreEntity(entityId, updates) {
7394
+ const op = await updateEntity(this._ctx(), entityId, updates);
7395
+ await this.flushAutoCheckpoint();
7396
+ return op;
7397
+ }
7398
+ async deleteStoreEntity(entityId) {
7399
+ const op = await deleteEntity(this._ctx(), entityId);
7400
+ await this.flushAutoCheckpoint();
7401
+ return op;
7402
+ }
7403
+ getStoreEntity(entityId) {
7404
+ return getEntity(this._ctx(), entityId);
7405
+ }
7406
+ listStoreEntities(type, filters, opts) {
7407
+ return listEntities(this._ctx(), type, filters, opts);
7408
+ }
7409
+ /** Raw EAV store (materialized from ops.json in VCS repos). */
7410
+ getEavStore() {
7411
+ return this._ctx().store;
7412
+ }
7413
+ async addStoreFact(entityId, attribute, value) {
7414
+ const op = await addFact(this._ctx(), entityId, attribute, value);
7415
+ await this.flushAutoCheckpoint();
7416
+ return op;
7417
+ }
7418
+ async removeStoreFact(entityId, attribute, value) {
7419
+ const op = await removeFact(
7420
+ this._ctx(),
7421
+ entityId,
7422
+ attribute,
7423
+ value
7424
+ );
7425
+ await this.flushAutoCheckpoint();
7426
+ return op;
7427
+ }
7428
+ async addStoreLink(sourceId, attribute, targetId) {
7429
+ const op = await addLink(
7430
+ this._ctx(),
7431
+ sourceId,
7432
+ attribute,
7433
+ targetId
7434
+ );
7435
+ await this.flushAutoCheckpoint();
7436
+ return op;
7437
+ }
7438
+ async removeStoreLink(sourceId, attribute, targetId) {
7439
+ const op = await removeLink(
7440
+ this._ctx(),
7441
+ sourceId,
7442
+ attribute,
7443
+ targetId
7444
+ );
7445
+ await this.flushAutoCheckpoint();
7446
+ return op;
7447
+ }
7448
+ // -------------------------------------------------------------------------
7213
7449
  // Decision Traces
7214
7450
  // -------------------------------------------------------------------------
7215
7451
  async recordDecision(input) {
@@ -0,0 +1,48 @@
1
+ // src/server/deploy-meta.ts
2
+ var DEPLOY_NAME_RE = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;
3
+ var MIN_LEN = 3;
4
+ var MAX_LEN = 32;
5
+ var DeployNameError = class extends Error {
6
+ constructor(message) {
7
+ super(message);
8
+ this.name = "DeployNameError";
9
+ }
10
+ };
11
+ function normalizeDeployName(name) {
12
+ return name.trim().toLowerCase();
13
+ }
14
+ function validateDeployName(name) {
15
+ const normalized = normalizeDeployName(name);
16
+ if (!normalized) {
17
+ throw new DeployNameError("Deploy name is required.");
18
+ }
19
+ if (normalized.length < MIN_LEN || normalized.length > MAX_LEN) {
20
+ throw new DeployNameError(
21
+ `Deploy name must be ${MIN_LEN}\u2013${MAX_LEN} characters (got ${normalized.length}).`
22
+ );
23
+ }
24
+ if (normalized.includes("--")) {
25
+ throw new DeployNameError(
26
+ "Deploy name cannot contain consecutive hyphens."
27
+ );
28
+ }
29
+ if (!DEPLOY_NAME_RE.test(normalized)) {
30
+ throw new DeployNameError(
31
+ "Deploy name must start with a letter and use only lowercase letters, numbers, and single hyphens (e.g. my-app)."
32
+ );
33
+ }
34
+ return normalized;
35
+ }
36
+ function buildDeployUrl(name) {
37
+ const slug = validateDeployName(name);
38
+ return `https://${slug}.sprites.app`;
39
+ }
40
+ var SPRITE_PUBLIC_HTTP_PORT = 8080;
41
+
42
+ export {
43
+ DeployNameError,
44
+ normalizeDeployName,
45
+ validateDeployName,
46
+ buildDeployUrl,
47
+ SPRITE_PUBLIC_HTTP_PORT
48
+ };