ecoportal-api-graphql 1.3.13 → 1.3.16

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 (275) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +87 -0
  3. data/lib/ecoportal/api/common/graphql/client.rb +0 -2
  4. data/lib/ecoportal/api/common/graphql/http_client.rb +6 -0
  5. data/lib/ecoportal/api/graphql/base/ai_summary_version.rb +17 -17
  6. data/lib/ecoportal/api/graphql/base/file_container.rb +14 -14
  7. data/lib/ecoportal/api/graphql/base/location_classification_type.rb +15 -15
  8. data/lib/ecoportal/api/graphql/base/location_structure.rb +27 -27
  9. data/lib/ecoportal/api/graphql/base/organization.rb +15 -15
  10. data/lib/ecoportal/api/graphql/base/page/task.rb +24 -0
  11. data/lib/ecoportal/api/graphql/base/page.rb +17 -16
  12. data/lib/ecoportal/api/graphql/base/template.rb +35 -0
  13. data/lib/ecoportal/api/graphql/base.rb +37 -35
  14. data/lib/ecoportal/api/graphql/builder/contractor_entity.rb +41 -41
  15. data/lib/ecoportal/api/graphql/compat/response.rb +35 -35
  16. data/lib/ecoportal/api/graphql/connection/action.rb +11 -11
  17. data/lib/ecoportal/api/graphql/connection/action_category.rb +11 -11
  18. data/lib/ecoportal/api/graphql/connection/contractor_entity.rb +11 -11
  19. data/lib/ecoportal/api/graphql/connection/page.rb +11 -11
  20. data/lib/ecoportal/api/graphql/connection/person_member.rb +11 -11
  21. data/lib/ecoportal/api/graphql/connection/preview_page.rb +11 -11
  22. data/lib/ecoportal/api/graphql/connection.rb +17 -17
  23. data/lib/ecoportal/api/graphql/file_upload/client.rb +21 -10
  24. data/lib/ecoportal/api/graphql/fragment/field_configuration.rb +38 -0
  25. data/lib/ecoportal/api/graphql/fragment/force.rb +14 -10
  26. data/lib/ecoportal/api/graphql/fragment/location_node.rb +26 -26
  27. data/lib/ecoportal/api/graphql/fragment/page_task.rb +39 -0
  28. data/lib/ecoportal/api/graphql/fragment/template.rb +51 -0
  29. data/lib/ecoportal/api/graphql/fragment.rb +3 -0
  30. data/lib/ecoportal/api/graphql/input/contractor_entity.rb +14 -14
  31. data/lib/ecoportal/api/graphql/input/preset_view/update.rb +16 -16
  32. data/lib/ecoportal/api/graphql/input/workflow_command/add_stage.rb +18 -18
  33. data/lib/ecoportal/api/graphql/input/workflow_command/edit_field_configuration.rb +21 -21
  34. data/lib/ecoportal/api/graphql/input/workflow_command/edit_page.rb +28 -28
  35. data/lib/ecoportal/api/graphql/input/workflow_command/edit_page_creator_permissions.rb +18 -18
  36. data/lib/ecoportal/api/graphql/input/workflow_command/field_config/cross_reference.rb +23 -23
  37. data/lib/ecoportal/api/graphql/input/workflow_command/field_config/date.rb +20 -20
  38. data/lib/ecoportal/api/graphql/input/workflow_command/field_config/image_gallery.rb +20 -20
  39. data/lib/ecoportal/api/graphql/input/workflow_command/field_config/people.rb +24 -24
  40. data/lib/ecoportal/api/graphql/input/workflow_command/field_config/plain_text.rb +20 -20
  41. data/lib/ecoportal/api/graphql/input/workflow_command/field_config/rich_text.rb +20 -20
  42. data/lib/ecoportal/api/graphql/input/workflow_command/field_config/select.rb +20 -20
  43. data/lib/ecoportal/api/graphql/input/workflow_command/move_field.rb +18 -18
  44. data/lib/ecoportal/api/graphql/input/workflow_command/reorder_forces.rb +18 -18
  45. data/lib/ecoportal/api/graphql/input/workflow_command/reorder_section.rb +18 -18
  46. data/lib/ecoportal/api/graphql/input/workflow_command.rb +251 -251
  47. data/lib/ecoportal/api/graphql/input.rb +24 -24
  48. data/lib/ecoportal/api/graphql/logic/connection.rb +34 -34
  49. data/lib/ecoportal/api/graphql/model/page/task.rb +16 -0
  50. data/lib/ecoportal/api/graphql/model/page.rb +16 -15
  51. data/lib/ecoportal/api/graphql/model/person_member.rb +15 -15
  52. data/lib/ecoportal/api/graphql/model/template.rb +15 -0
  53. data/lib/ecoportal/api/graphql/model.rb +32 -30
  54. data/lib/ecoportal/api/graphql/mutation/ai_summary/generate.rb +45 -45
  55. data/lib/ecoportal/api/graphql/mutation/ai_summary/submit_feedback.rb +40 -40
  56. data/lib/ecoportal/api/graphql/mutation/contractor_entity.rb +14 -14
  57. data/lib/ecoportal/api/graphql/mutation/page/approve_review_task.rb +40 -40
  58. data/lib/ecoportal/api/graphql/mutation/page/batch_update_review_task.rb +38 -40
  59. data/lib/ecoportal/api/graphql/mutation/page/create_draft.rb +38 -40
  60. data/lib/ecoportal/api/graphql/mutation/page/delete_draft.rb +38 -40
  61. data/lib/ecoportal/api/graphql/mutation/page/execute_force_commands.rb +7 -7
  62. data/lib/ecoportal/api/graphql/mutation/page/execute_workflow_commands.rb +8 -7
  63. data/lib/ecoportal/api/graphql/mutation/page/publish_draft.rb +38 -40
  64. data/lib/ecoportal/api/graphql/mutation/page/reject_review_task.rb +40 -40
  65. data/lib/ecoportal/api/graphql/mutation/page/restart_review_task.rb +40 -40
  66. data/lib/ecoportal/api/graphql/mutation/page/undo_review_task.rb +40 -40
  67. data/lib/ecoportal/api/graphql/mutation/preset_view/destroy.rb +34 -35
  68. data/lib/ecoportal/api/graphql/mutation/register/destroy.rb +35 -35
  69. data/lib/ecoportal/api/graphql/mutation/smart_fill/generate.rb +36 -36
  70. data/lib/ecoportal/api/graphql/mutation/smart_fill/submit_feedback.rb +40 -40
  71. data/lib/ecoportal/api/graphql/mutation/smart_fill.rb +13 -13
  72. data/lib/ecoportal/api/graphql/mutation/template/create_related_page.rb +46 -46
  73. data/lib/ecoportal/api/graphql/mutation/template/destroy_related_page.rb +1 -1
  74. data/lib/ecoportal/api/graphql/mutation/template/update_information.rb +1 -1
  75. data/lib/ecoportal/api/graphql/mutation.rb +20 -20
  76. data/lib/ecoportal/api/graphql/payload/contractor_entity.rb +14 -14
  77. data/lib/ecoportal/api/graphql/payload/ok_payload.rb +36 -21
  78. data/lib/ecoportal/api/graphql/payload/page/draft.rb +26 -13
  79. data/lib/ecoportal/api/graphql/payload/page/review_task.rb +13 -13
  80. data/lib/ecoportal/api/graphql/payload/page/review_task_batch.rb +23 -0
  81. data/lib/ecoportal/api/graphql/payload/page.rb +20 -19
  82. data/lib/ecoportal/api/graphql/payload/preset_view.rb +15 -11
  83. data/lib/ecoportal/api/graphql/payload/register.rb +15 -11
  84. data/lib/ecoportal/api/graphql/payload/template/create_related_page.rb +1 -1
  85. data/lib/ecoportal/api/graphql/payload/template/destroy_related_page.rb +1 -1
  86. data/lib/ecoportal/api/graphql/payload/template/update_information.rb +1 -1
  87. data/lib/ecoportal/api/graphql/payload.rb +23 -23
  88. data/lib/ecoportal/api/graphql/query/location_structures.rb +57 -57
  89. data/lib/ecoportal/api/graphql/query/page.rb +45 -45
  90. data/lib/ecoportal/api/graphql/query/page_with_forces.rb +9 -3
  91. data/lib/ecoportal/api/graphql/query/pages_workflow_commands.rb +9 -3
  92. data/lib/ecoportal/api/graphql/query/register_preset_views.rb +78 -78
  93. data/lib/ecoportal/api/graphql/query.rb +27 -27
  94. data/lib/ecoportal/api/graphql.rb +9 -5
  95. data/lib/ecoportal/api/graphql_version.rb +1 -1
  96. metadata +9 -180
  97. data/.ai-assistance/bridge/CLAUDE.md +0 -338
  98. data/.ai-assistance/bridge/archive/.gitkeep +0 -0
  99. data/.ai-assistance/bridge/archive/oscar-a1b2c3d-gitlab-mcp-doc-update.inbox.md +0 -29
  100. data/.ai-assistance/bridge/archive/oscar-a1b2c3d-gitlab-mcp-doc-update.outbox.md +0 -18
  101. data/.ai-assistance/bridge/archive/oscar-c912c25-gemini-design-review.inbox.md +0 -42
  102. data/.ai-assistance/bridge/archive/oscar-c912c25-gemini-design-review.outbox.md +0 -115
  103. data/.ai-assistance/bridge/context/gemini-review-prompt.txt +0 -48
  104. data/.ai-assistance/bridge/context/gemini-review-response.md +0 -104
  105. data/.ai-assistance/bridge/context/project.md +0 -42
  106. data/.ai-assistance/bridge/inbox/.gitkeep +0 -0
  107. data/.ai-assistance/bridge/outbox/.gitkeep +0 -0
  108. data/.ai-assistance/bridge/outbox/request-for-standards-discovery.md +0 -48
  109. data/.ai-assistance/bridge/queue/.gitkeep +0 -1
  110. data/.ai-assistance/capabilities/CLAUDE.md +0 -27
  111. data/.ai-assistance/capabilities/assumptions-log.md +0 -80
  112. data/.ai-assistance/capabilities/code.md +0 -47
  113. data/.ai-assistance/capabilities/connectors.md +0 -37
  114. data/.ai-assistance/capabilities/cowork.md +0 -55
  115. data/.ai-assistance/code/OVERVIEW.md +0 -155
  116. data/.ai-assistance/code/data_fields.md +0 -242
  117. data/.ai-assistance/code/dependencies.md +0 -151
  118. data/.ai-assistance/code/diff_as_input.md +0 -234
  119. data/.ai-assistance/code/diff_pairing_engine.md +0 -243
  120. data/.ai-assistance/code/diff_service_deep_dive.md +0 -192
  121. data/.ai-assistance/code/ecoPortal_architecture/00_overview_and_index.md +0 -55
  122. data/.ai-assistance/code/ecoPortal_architecture/01_terminology_dictionary.md +0 -181
  123. data/.ai-assistance/code/ecoPortal_architecture/02_data_model.md +0 -192
  124. data/.ai-assistance/code/ecoPortal_architecture/03_api_layers.md +0 -147
  125. data/.ai-assistance/code/ecoPortal_architecture/04_graphql_queries_mutations.md +0 -277
  126. data/.ai-assistance/code/ecoPortal_architecture/05_page_workflows.md +0 -200
  127. data/.ai-assistance/code/ecoPortal_architecture/06_search_and_filters.md +0 -228
  128. data/.ai-assistance/code/ecoPortal_architecture/07_data_fields.md +0 -197
  129. data/.ai-assistance/code/ecoPortal_architecture/08_stages_sections.md +0 -243
  130. data/.ai-assistance/code/ecoPortal_architecture/09_people_contractors_locations.md +0 -196
  131. data/.ai-assistance/code/ecoPortal_architecture/10_forces_workflow_builder.md +0 -132
  132. data/.ai-assistance/code/ecoPortal_architecture/11_integration_gems.md +0 -187
  133. data/.ai-assistance/code/ecoPortal_architecture/12_ai_documentation_sources_gaps.md +0 -236
  134. data/.ai-assistance/code/ecoPortal_architecture/13_ai_infrastructure.md +0 -183
  135. data/.ai-assistance/code/ecoportal_schema_reference.md +0 -240
  136. data/.ai-assistance/code/filter_contract_matrix.md +0 -177
  137. data/.ai-assistance/code/graphql_domain_knowledge.md +0 -240
  138. data/.ai-assistance/code/refactoring/datafield-readwrite-shape-asymmetry.md +0 -71
  139. data/.ai-assistance/code/refactoring/opportunities.md +0 -251
  140. data/.ai-assistance/code/schema_analysis.md +0 -321
  141. data/.ai-assistance/code/search_filters.md +0 -868
  142. data/.ai-assistance/code/spec_coverage.md +0 -73
  143. data/.ai-assistance/code/template_diff_pairing_domain.md +0 -175
  144. data/.ai-assistance/code/workflow-command-guide.md +0 -466
  145. data/.ai-assistance/code/workflow-space.md +0 -353
  146. data/.ai-assistance/conventions/CLAUDE.md +0 -30
  147. data/.ai-assistance/conventions/code-working-tree-protocol.md +0 -199
  148. data/.ai-assistance/conventions/gitignore-rules.md +0 -42
  149. data/.ai-assistance/conventions/permission-guidance.md +0 -120
  150. data/.ai-assistance/integrations/README.md +0 -70
  151. data/.ai-assistance/integrations/gitkraken-mcp.md +0 -107
  152. data/.ai-assistance/integrations/gitlab-mcp.md +0 -123
  153. data/.ai-assistance/integrations/local-git.md +0 -60
  154. data/.ai-assistance/local_paths.example.md +0 -17
  155. data/.ai-assistance/projects/TODO.md +0 -118
  156. data/.ai-assistance/projects/api-v2-to-graphql-migration/DECISIONS.md +0 -168
  157. data/.ai-assistance/projects/api-v2-to-graphql-migration/INTENT.md +0 -60
  158. data/.ai-assistance/projects/api-v2-to-graphql-migration/TODO.md +0 -267
  159. data/.ai-assistance/projects/api-v2-to-graphql-migration/UPSTREAM.md +0 -53
  160. data/.ai-assistance/projects/api-v2-to-graphql-migration/notes/csv-template-pipeline-design.md +0 -102
  161. data/.ai-assistance/projects/api-v2-to-graphql-migration/notes/cutover-usecase-gap-audit.md +0 -139
  162. data/.ai-assistance/projects/compat-layer-audit/COMPAT_AUDIT.md +0 -244
  163. data/.ai-assistance/projects/dynamic-model-generation/INTENT.md +0 -93
  164. data/.ai-assistance/projects/eco-helpers-compat/INTENT.md +0 -244
  165. data/.ai-assistance/projects/eco-helpers-compat/MIGRATION_GUIDE.md +0 -266
  166. data/.ai-assistance/projects/eco-helpers-compat/TODO.md +0 -86
  167. data/.ai-assistance/projects/ecoportal-api-v2-doublemodel-review/INTENT.md +0 -101
  168. data/.ai-assistance/projects/graphql-agent/GAP_ANALYSIS.md +0 -177
  169. data/.ai-assistance/projects/ooze-graphql-native-migration/DECISIONS.md +0 -161
  170. data/.ai-assistance/projects/ooze-graphql-native-migration/INTENT.md +0 -125
  171. data/.ai-assistance/projects/ooze-graphql-native-migration/INVENTORY.md +0 -136
  172. data/.ai-assistance/projects/ooze-graphql-native-migration/RISKS.md +0 -126
  173. data/.ai-assistance/projects/ooze-graphql-native-migration/TODO.md +0 -261
  174. data/.ai-assistance/projects/ooze-graphql-native-migration/analysis/2026-06-30-cutover-workflow-deep-review.md +0 -122
  175. data/.ai-assistance/projects/ooze-graphql-native-migration/analysis/2026-07-01-forces-via-workflow-commands-miss-rca.md +0 -148
  176. data/.ai-assistance/projects/page-model/DECISIONS.md +0 -245
  177. data/.ai-assistance/projects/page-model/TODO.md +0 -190
  178. data/.ai-assistance/projects/qa-services-delivery/DECISIONS.md +0 -93
  179. data/.ai-assistance/projects/qa-services-delivery/INTENT.md +0 -76
  180. data/.ai-assistance/projects/qa-services-delivery/PHASE3-SCOPE.md +0 -115
  181. data/.ai-assistance/projects/qa-services-delivery/ROADMAP.md +0 -99
  182. data/.ai-assistance/projects/qa-services-delivery/TODO.md +0 -81
  183. data/.ai-assistance/projects/search-filter-builder/INTENT.md +0 -107
  184. data/.ai-assistance/projects/search-filter-builder/TODO.md +0 -131
  185. data/.ai-assistance/projects/template-automatic-build-maintenance/INTENT.md +0 -87
  186. data/.ai-assistance/projects/template-automatic-build-maintenance/TODO.md +0 -108
  187. data/.ai-assistance/projects/template-diff-deploy/INTENT.md +0 -12
  188. data/.ai-assistance/projects/template-diff-deploy/TODO.md +0 -9
  189. data/.ai-assistance/projects/template-maintenance/DESIGN.md +0 -134
  190. data/.ai-assistance/projects/template-maintenance/PHASE0-FINDINGS.md +0 -93
  191. data/.ai-assistance/projects/template-maintenance/README.md +0 -14
  192. data/.ai-assistance/projects/template-model-logic/CATEGORY_CATALOG.md +0 -236
  193. data/.ai-assistance/projects/template-model-logic/CLASSIFICATION_SPIKE.md +0 -243
  194. data/.ai-assistance/projects/template-model-logic/DESIGN_NOTE.md +0 -154
  195. data/.ai-assistance/projects/workflow-space/TODO.md +0 -213
  196. data/.ai-assistance/reinstall-claude-desktop-windows.md +0 -136
  197. data/.ai-assistance/scripts/CLAUDE.md +0 -150
  198. data/.ai-assistance/scripts/bridge-inbox-check.sh +0 -75
  199. data/.ai-assistance/scripts/bridge-init.sh +0 -86
  200. data/.ai-assistance/scripts/bridge-status.sh +0 -44
  201. data/.ai-assistance/scripts/capabilities-check.ts +0 -104
  202. data/.ai-assistance/scripts/check-outbox.sh +0 -43
  203. data/.ai-assistance/scripts/dep_graph.rb +0 -91
  204. data/.ai-assistance/scripts/lock-acquire.sh +0 -103
  205. data/.ai-assistance/scripts/lock-multi.sh +0 -124
  206. data/.ai-assistance/scripts/lock-queue.sh +0 -94
  207. data/.ai-assistance/scripts/setup-mcps.test.ts +0 -188
  208. data/.ai-assistance/scripts/setup-mcps.ts +0 -234
  209. data/.ai-assistance/scripts/task-complete.ts +0 -74
  210. data/.ai-assistance/scripts/task-create.ts +0 -75
  211. data/.ai-assistance/scripts/task-read.ts +0 -125
  212. data/.ai-assistance/scripts/token-logger.js +0 -220
  213. data/.ai-assistance/scripts/token-report.ts +0 -158
  214. data/.ai-assistance/scripts/token-session-start.js +0 -66
  215. data/.ai-assistance/skills/ai-instructions/SKILL.md +0 -48
  216. data/.ai-assistance/skills/code-specs/SKILL.md +0 -69
  217. data/.ai-assistance/skills/corporate-policies/SKILL.md +0 -201
  218. data/.ai-assistance/skills/dep-graph/SKILL.md +0 -139
  219. data/.ai-assistance/skills/ep-ai-manager/SKILL.md +0 -417
  220. data/.ai-assistance/skills/gemini-assist/SKILL.md +0 -63
  221. data/.ai-assistance/skills/gemini-assist/gemini-mcp-server.js +0 -205
  222. data/.ai-assistance/skills/gemini-assist/gemini_ask.py +0 -1
  223. data/.ai-assistance/skills/gemini-assist/gemini_ask.rb +0 -240
  224. data/.ai-assistance/skills/gemini-assist/prompts/cycle_end_review.txt +0 -25
  225. data/.ai-assistance/skills/graphql-schema-analysis/SKILL.md +0 -261
  226. data/.ai-assistance/skills/procedural-memory/SKILL.md +0 -319
  227. data/.ai-assistance/skills/project-cycle/SKILL.md +0 -177
  228. data/.ai-assistance/skills/project-self-docs/SKILL.md +0 -181
  229. data/.ai-assistance/skills/project-self-docs/scripts/self_docs_scan.py +0 -378
  230. data/.ai-assistance/skills/refactor/SKILL.md +0 -62
  231. data/.ai-assistance/skills/rubocop/SKILL.md +0 -93
  232. data/.ai-assistance/skills/ruby-scripting/SKILL.md +0 -215
  233. data/.ai-assistance/skills/spec-generation/SKILL.md +0 -72
  234. data/.ai-assistance/standards-version.json +0 -22
  235. data/.ai-assistance/token-budget.json +0 -32
  236. data/.ai-assistance/version.json +0 -39
  237. data/.claude/settings.json +0 -150
  238. data/.env.example +0 -18
  239. data/.gitattributes +0 -15
  240. data/.gitignore +0 -37
  241. data/.gitlab-ci.yml +0 -45
  242. data/.markdownlint.json +0 -4
  243. data/.rspec +0 -3
  244. data/.rubocop.yml +0 -121
  245. data/.ruby-version +0 -1
  246. data/.yardopts +0 -10
  247. data/CLAUDE.md +0 -243
  248. data/Gemfile +0 -30
  249. data/Rakefile +0 -90
  250. data/bin/console +0 -14
  251. data/bin/setup +0 -8
  252. data/bin/setup.ps1 +0 -6
  253. data/docs/self-docs/ARCHITECTURE.md +0 -88
  254. data/docs/self-docs/CHANGES.jsonl +0 -12
  255. data/docs/self-docs/COMPLIANCE.md +0 -79
  256. data/docs/self-docs/CONVENTIONS.md +0 -74
  257. data/docs/self-docs/INTEGRATIONS.md +0 -65
  258. data/docs/self-docs/OPERATIONS.md +0 -76
  259. data/docs/self-docs/OVERVIEW.md +0 -64
  260. data/docs/self-docs/STATUS.md +0 -73
  261. data/docs/self-docs/self-docs-index.json +0 -51
  262. data/docs/worklog.md +0 -977
  263. data/ecoportal-api-graphql.gemspec +0 -40
  264. data/scripts/auto-worker-scheduler.sh +0 -386
  265. data/tests/actions_get.rb +0 -7
  266. data/tests/contractor_entities_get.rb +0 -20
  267. data/tests/contractor_entity_create.rb +0 -19
  268. data/tests/contractor_entity_udpate.rb +0 -20
  269. data/tests/dump_page_model.rb +0 -74
  270. data/tests/dump_template_model.rb +0 -90
  271. data/tests/loc_structure_get.rb +0 -10
  272. data/tests/loc_structure_update.rb +0 -51
  273. data/tests/loc_structures_get.rb +0 -15
  274. data/tests/local_libs.rb +0 -20
  275. data/tests/validate_queries.rb +0 -127
@@ -1,213 +0,0 @@
1
- # TODOs — Workflow Space Project
2
-
3
- > Created 2026-06-11 from live schema introspection `20260605T101224_live_ep_graphql_schema.graphql.json`.
4
- > Phases W1-W5 implemented on branch `pages`. All completed 2026-06-11.
5
-
6
- ---
7
-
8
- ## Phase W1 — Read Model (PagesWorkflow)
9
-
10
- - [x] **W1.1** `Base::PagesWorkflow` — `autoPageCreationEnabled`, `stages` (passarray),
11
- `fields` (embeds_many RegisterField), `commands` connection reference.
12
- *Done 2026-06-11 — `lib/ecoportal/api/graphql/base/pages_workflow.rb`*
13
-
14
- - [x] **W1.2** `Base::PagesWorkflow::RegisterField` — `key`, `name`, `type`, `total`,
15
- `missing`, `enableCrossRegisterReporting`.
16
- *Done 2026-06-11 — `base/pages_workflow/register_field.rb`*
17
-
18
- - [x] **W1.3** `Base::PagesWorkflow::CallbackType` — `id`, `triggerCondition`, `operations`
19
- (dispatched via OperationInterface), `triggers` (dispatched via TriggerInterface).
20
- *Done 2026-06-11 — `base/pages_workflow/callback_type.rb`*
21
-
22
- - [x] **W1.4** `Base::PagesWorkflow::OperationInterface` + three concrete classes:
23
- `Operations::AssignTo` (targetTaskType, escalationLevels),
24
- `Operations::CreatePage` (templateId, crossReferenceFieldId),
25
- `Operations::SendNotification` (recurring, emailConfig, inSystemConfig, recipientConfig).
26
- `from_doc` dispatches on `__typename`.
27
- *Done 2026-06-11 — `base/pages_workflow/operation_interface.rb` + `operations/`*
28
-
29
- - [x] **W1.5** `Base::PagesWorkflow::TriggerInterface` + concrete class:
30
- `Triggers::ConditionalLogic` (filters: [StoredEsFilter!]).
31
- `from_doc` dispatches on `__typename`.
32
- *Done 2026-06-11 — `base/pages_workflow/trigger_interface.rb` + `triggers/`*
33
-
34
- - [x] **W1.6** Supporting value objects: `TimeDelayConfig`, `EscalationLevel`,
35
- `RecipientConfig`, `EmailConfig`, `InSystemConfig`, `UserSelection`,
36
- `PeopleFieldSelection`, `TaskConfigSelection`, `ActionTypeSelection`, `MailboxFieldSelection`.
37
- *Done 2026-06-11*
38
-
39
- - [x] **W1.7** `Base::PagesWorkflow::CommandInterface` + three concrete classes:
40
- `CommandChange` (changes: [Change!]), `CommandChangeMessage` (changeMessages: [String!]),
41
- `CommandEsChange` (changes: [StoredEsFilterChange!]).
42
- *Done 2026-06-11 — `base/pages_workflow/command_interface.rb`*
43
-
44
- - [x] **W1.8** `Model::PagesWorkflow < Base::PagesWorkflow` — `class_resolver` wiring
45
- for `command_connection_class`, `operation_class`, `trigger_class`.
46
- *Done 2026-06-11 — `lib/ecoportal/api/graphql/model/pages_workflow.rb`*
47
-
48
- - [x] **W1.9** `Connection::PagesWorkflowCommand` — paginated connection for command log.
49
- *Done 2026-06-11 — `lib/ecoportal/api/graphql/connection/pages_workflow_command.rb`*
50
-
51
- - [x] **W1.10** Three fragments in `fragment/pages_workflow.rb`:
52
- `PagesWorkflowFields`, `PagesWorkflowCallbackFields`, `PagesWorkflowCommandFields`.
53
- *Done 2026-06-11*
54
-
55
- ---
56
-
57
- ## Phase W2 — Mutation: ExecuteWorkflowCommands
58
-
59
- - [x] **W2.1** `Mutation::Page::ExecuteWorkflowCommands` — `field_name :executeWorkflowCommands`,
60
- `query(id:, patch_ver:, commands:)` method, `default_payload_block` (patchVer + item +
61
- errors). `payload_class` → `Payload::ExecuteWorkflowCommands`.
62
- *Done 2026-06-11 — `mutation/page/execute_workflow_commands.rb`*
63
-
64
- - [x] **W2.2** `Payload::ExecuteWorkflowCommands` — `patchVer`, `item` (Model::PagesWorkflow),
65
- `success?`, `error?`, `body`.
66
- *Done 2026-06-11 — `payload/execute_workflow_commands.rb`*
67
-
68
- ---
69
-
70
- ## Phase W3 — Input: WorkflowCommand dispatcher
71
-
72
- - [x] **W3.1** `Input::WorkflowCommand` — `SCHEMA_VERSION`, `COMMAND_MAP` (all 90 schema
73
- keys mapped to Ruby module constant strings), `.build(key, **kwargs)`, `.valid_key?`,
74
- `.build_commands`.
75
- *Done 2026-06-11 — `lib/ecoportal/api/graphql/input/workflow_command.rb`*
76
-
77
- ---
78
-
79
- ## Phase W4 — Sub-input modules (~83 commands)
80
-
81
- All sub-input modules follow the pattern:
82
- `module CommandName; SCHEMA_VERSION; VALID_KEYS; def self.build(**kwargs); end`
83
-
84
- - [x] **W4.1** Page-level: `EditPage`, `EditPageCreatorPermissions`.
85
- *Done 2026-06-11*
86
-
87
- - [x] **W4.2** Stage structural: `AddStage`, `RemoveStage`, `EditStage`, `MoveStage`.
88
- *Done 2026-06-11*
89
-
90
- - [x] **W4.3** Stage permissions: `EditCreatorPermissions`, `EditRestrictCommentTagging`,
91
- `AddCommentTaggingUserGroup`, `RemoveCommentTaggingUserGroup`,
92
- `EditRestrictTaskAssignment`, `AddTaskAssignmentUserGroup`,
93
- `RemoveTaskAssignmentUserGroup`, `AddStageTag`, `RemoveStageTag`.
94
- *Done 2026-06-11*
95
-
96
- - [x] **W4.4** Section: `AddSection`, `RemoveSection`, `AddStageSection`,
97
- `RemoveStageSection`, `EditSectionHeader`, `CollapseSection`, `ExpandSection`,
98
- `ReorderSection`.
99
- *Done 2026-06-11*
100
-
101
- - [x] **W4.5** Task: `AddTask`, `RemoveTask`, `EditTaskDue`, `RemoveTaskDue`,
102
- `RemoveTaskPriorityLevel`, `EditRequiredSignOffs`, `EditReminder`.
103
- *Done 2026-06-11*
104
-
105
- - [x] **W4.6** Strategy: `AddDefaultStrategy`, `EditDefaultStrategy`,
106
- `RemoveDefaultStrategy`, `AddDefaultDirectStrategyUser`,
107
- `RemoveDefaultDirectStrategyUser`, `AddStrategy`, `EditStrategy`,
108
- `RemoveStrategy`, `AddDirectStrategyUser`, `RemoveDirectStrategyUser`,
109
- `AddOperationStrategy`, `EditOperationStrategy`, `RemoveOperationStrategy`,
110
- `AddOperationDirectStrategyUser`, `RemoveOperationDirectStrategyUser`.
111
- *Done 2026-06-11*
112
-
113
- - [x] **W4.7** Callback + Operation: `AddWorkflowCallback`, `RemoveCallback`,
114
- `EditTrigger`, `AddOperation`, `EditOperation`, `RemoveOperation`.
115
- *Done 2026-06-11*
116
-
117
- - [x] **W4.8** Recipients (10 variants): `AddRecipientUser`, `RemoveRecipientUser`,
118
- `AddRecipientPeopleField`, `RemoveRecipientPeopleField`, `AddRecipientTaskConfig`,
119
- `RemoveRecipientTaskConfig`, `AddRecipientActionType`, `RemoveRecipientActionType`,
120
- `AddRecipientFilter`, `RemoveRecipientFilter`.
121
- *Done 2026-06-11*
122
-
123
- - [x] **W4.9** Scheduled: `AddScheduledCallback`, `EditScheduledCallback`,
124
- `RemoveScheduledCallback`, `AddScheduledCallbackAction`, `AddActionTag`,
125
- `RemoveActionTag`.
126
- *Done 2026-06-11*
127
-
128
- - [x] **W4.10** Field structural: `AddField`, `MoveField`, `RemoveField`.
129
- *Done 2026-06-11*
130
-
131
- - [x] **W4.11** Field configuration: `EditFieldConfiguration` (base) + 12 byType
132
- sub-modules in `field_config/`: `PlainText`, `RichText`, `Date`, `Gauge`, `Select`,
133
- `People`, `CrossReference`, `ImageGallery`, `LocationField`, `ContractorEntities`,
134
- `Signature`, `Table`.
135
- *Done 2026-06-11*
136
-
137
- - [x] **W4.12** Select options: `AddSelectFieldOption`, `EditSelectFieldOption`,
138
- `RemoveSelectFieldOption`.
139
- *Done 2026-06-11*
140
-
141
- - [x] **W4.13** Gauge stops: `AddGaugeFieldStop`, `EditGaugeFieldStop`,
142
- `RemoveGaugeFieldStop`.
143
- *Done 2026-06-11*
144
-
145
- - [x] **W4.14** Linked fields: `AddLinkedFieldConfig`, `EditLinkedFieldConfig`,
146
- `RemoveLinkedFieldConfig`.
147
- *Done 2026-06-11*
148
-
149
- - [x] **W4.15** Forces / bindings: `AddForce`, `RemoveForce`, `EditForce`,
150
- `ReorderForces`, `AddBinding`, `EditBinding`, `RemoveBinding`,
151
- `AddLinkedHelper`, `EditLinkedHelper`, `RemoveLinkedHelper`.
152
- *Done 2026-06-11*
153
-
154
- ---
155
-
156
- ## Phase W5 — Concerns and Cross-cutting
157
-
158
- - [x] **W5.1** `Concerns::Deprecation` — `SCHEMA_VERSION`, `WARNED` (Set), `warn_once(key, msg)`.
159
- Process-level warning deduplicator used across this area and others.
160
- *Done 2026-06-11 — `lib/ecoportal/api/graphql/concerns/deprecation.rb`*
161
-
162
- - [x] **W5.2** Code-spec docs:
163
- - `.ai-assistance/code/workflow-space.md` — read model + command bus spec.
164
- - `.ai-assistance/code/workflow-command-guide.md` — full command mapping + usage examples.
165
- *Done 2026-06-11*
166
-
167
- ---
168
-
169
- ## Notes on Implementation Approach
170
-
171
- ### SCHEMA_VERSION tracking
172
-
173
- Every file in the workflow space carries `SCHEMA_VERSION = '20260605'.freeze`. This
174
- matches the introspection snapshot date. When engineering changes the Workflow Builder
175
- schema, re-run introspection, update the constant across all affected files, and diff
176
- `WorkflowCommandInput` against the new schema to catch added or removed command keys.
177
-
178
- ### Concerns::Deprecation
179
-
180
- The `warn_once` pattern guards against repeated warnings from hot code paths (e.g.
181
- schema version mismatches, deprecated method calls). It holds its warned-key `Set`
182
- at the module level — process-global, not per-instance. This is intentional.
183
-
184
- ---
185
-
186
- ## Phase F — Deferred Items
187
-
188
- These items were identified during W1-W5 but deferred due to complexity or low
189
- immediate priority.
190
-
191
- - [x] **F.1** Kickstand mutations — `startKickstandWorkflow`, `stopKickstandWorkflow`,
192
- `failKickstandWorkflow`, `bulkUpdateKickstandWorkflows`.
193
- `Base::Kickstand::Workflow`, `Payload::Kickstand::{Workflow,BulkUpdateWorkflows}`,
194
- `Mutation::Kickstand::{Start,Stop,Fail}Workflow + BulkUpdateWorkflows`,
195
- `Builder::Kickstand` wired as `api.kickstand`.
196
- *Done 2026-06-12*
197
-
198
- - [x] **F.2** `PagesWorkflow.commands` connection — `Query::PagesWorkflowCommands`
199
- navigates `currentOrganization.page.workflow.commands`; uses `PagesWorkflowCommandFields`.
200
- *Done 2026-06-12*
201
-
202
- - [x] **F.3** Full Stage fragment with `workflowCallbacks` — `Fragment::StageWithCallbacksFields`
203
- on `Stage` spreads `PagesWorkflowCallbackFields` into `workflowCallbacks`.
204
- Stage model already had `workflow_callbacks` accessor; now it can be populated.
205
- *Done 2026-06-12*
206
-
207
- - [x] **F.4** `Builder::Page#execute_workflow_commands` — already shipped with W1-W5
208
- (`builder/page.rb:68`).
209
-
210
- - [x] **F.5** Rake task `schema_drift` — compares `WorkflowCommandInput` schema keys vs
211
- `COMMAND_MAP`, and audits `SCHEMA_VERSION` currency across all workflow-space files.
212
- Run: `bundle exec rake schema_drift`.
213
- *Done 2026-06-12*
@@ -1,136 +0,0 @@
1
- # Reinstall Claude Desktop App on Windows (MSIX → Standard)
2
-
3
- **Why:** The default Claude Desktop installer uses MSIX packaging, which silently redirects
4
- AppData writes into a sandboxed container. This breaks MCP config paths, plugin loading,
5
- and adds an extra layer of isolation on top of CoWork's sandbox.
6
- This guide switches to a standard (non-sandboxed) installation.
7
-
8
- **Does this affect Claude Code CLI?** No. The CLI is an independent npm/winget package.
9
- This procedure does not touch it.
10
-
11
- ---
12
-
13
- ## Before you start
14
-
15
- ### 1. Back up your session data
16
-
17
- Copy this entire folder somewhere safe (e.g. `C:\claude\backup\`):
18
-
19
- ```
20
- C:\Users\<username>\AppData\Local\Packages\Claude_pzs8sxrjxfjjc\LocalCache\Roaming\Claude\
21
- ```
22
-
23
- This contains your sessions, config, and plugins. Everything else (repos, projects) is
24
- unaffected — it lives on your filesystem independently of the app.
25
-
26
- ### 2. Note your MCP config location
27
-
28
- Your current working config is at:
29
- ```
30
- C:\Users\<username>\AppData\Local\Packages\Claude_pzs8sxrjxfjjc\LocalCache\Roaming\Claude\claude_desktop_config.json
31
- ```
32
- Copy this file separately so you can reference it after reinstall.
33
-
34
- ---
35
-
36
- ## Step 1 — Kill Claude processes
37
-
38
- Open **PowerShell as Administrator** and run:
39
-
40
- ```powershell
41
- Get-Process *claude*,*chrome-native-host*,*cowork* -ErrorAction SilentlyContinue | Stop-Process -Force
42
- ```
43
-
44
- ---
45
-
46
- ## Step 2 — Remove the MSIX package
47
-
48
- In the same Admin PowerShell:
49
-
50
- ```powershell
51
- Get-AppxPackage -Name "Claude*" -AllUsers | Remove-AppxPackage -AllUsers -ErrorAction SilentlyContinue
52
- ```
53
-
54
- ---
55
-
56
- ## Step 3 — Delete the sandboxed package folder
57
-
58
- In File Explorer, navigate to:
59
- ```
60
- %LOCALAPPDATA%\Packages\
61
- ```
62
- Delete the folder named `Claude_pzs8sxrjxfjjc` (or similar).
63
-
64
- ---
65
-
66
- ## Step 4 — Allow apps from any source (one-time Windows setting)
67
-
68
- To prevent Windows from silently re-packaging the installer as MSIX:
69
-
70
- `Settings → Apps → Advanced app settings → Choose where to get apps → set to Anywhere`
71
-
72
- ---
73
-
74
- ## Step 5 — Install via winget (standard path)
75
-
76
- Open a **standard (non-admin) PowerShell** and run:
77
-
78
- ```powershell
79
- winget install Anthropic.Claude
80
- ```
81
-
82
- If winget doesn't find it, download the standalone `.exe` directly from
83
- **https://claude.com/download** and run it. Do not use the Microsoft Store.
84
-
85
- ---
86
-
87
- ## Step 6 — Launch Claude and confirm paths
88
-
89
- After first launch, verify the config now lives at the standard location:
90
- ```
91
- C:\Users\<username>\AppData\Roaming\Claude\claude_desktop_config.json
92
- ```
93
- If that file exists, the sandboxing is gone.
94
-
95
- ---
96
-
97
- ## Step 7 — Restore your session data
98
-
99
- Copy your backup into the new location:
100
- ```
101
- From: C:\claude\backup\Claude\
102
- To: C:\Users\<username>\AppData\Roaming\Claude\
103
- ```
104
-
105
- **Merge carefully** — if the reinstall already created files there, prioritise your backup
106
- for `local-agent-mode-sessions\` and `claude_desktop_config.json`.
107
- Do not blindly overwrite the whole folder.
108
-
109
- ---
110
-
111
- ## Step 8 — Restore MCP config
112
-
113
- If your `claude_desktop_config.json` did not carry over from the backup, copy your saved
114
- copy from Step 0 into `AppData\Roaming\Claude\claude_desktop_config.json`.
115
-
116
- Restart Claude Desktop. Check Settings → Developer to confirm MCPs are loading.
117
-
118
- ---
119
-
120
- ## After reinstall
121
-
122
- - CoWork sessions should resume from where you left off
123
- - MCP "Edit Config" button will now open the correct file
124
- - Plugin skills will load from the correct paths
125
- - The CoWork sandbox will no longer be inside an MSIX container layer
126
-
127
- ---
128
-
129
- ## What is NOT affected by this reinstall
130
-
131
- | Thing | Safe? | Notes |
132
- |-------|-------|-------|
133
- | Claude Code CLI | ✓ | Separate npm/winget install, untouched |
134
- | Git repos (e.g. ecoportal-api-graphql) | ✓ | Live on filesystem, nothing to do with the app |
135
- | `.claude/` folder in repos | ✓ | Part of the repo, git-tracked |
136
- | `local_paths.md` | ✓ | Git-ignored but stays on your disk |
@@ -1,150 +0,0 @@
1
- # Scripts
2
-
3
- These scripts move token-expensive work (file scanning, UUID gen, archiving) to CPU.
4
- Agents call scripts and read their output — they do not replicate this logic in prose.
5
-
6
- ## Script index
7
-
8
- | Script | Language | Called by | Purpose |
9
- |--------|----------|-----------|---------|
10
- | `setup-mcps.ts` | TypeScript | Human (once per machine) | Write GitKraken + GitLab MCP entries to Claude Desktop config |
11
- | `setup-mcps.test.ts` | TypeScript | CI / on-demand | Unit tests for setup-mcps.ts logic |
12
- | `bridge-init.sh` | Bash | Code (startup) | Detect env, scan inbox+stale tasks, return JSON summary |
13
- | `lock-acquire.sh` | Bash | Either | Atomically acquire bridge LOCK; detects stale locks by mtime |
14
- | `task-create.ts` | TypeScript | CoWork or Code | Create a new inbox task file |
15
- | `task-read.ts` | TypeScript | Either | Parse a task file → structured JSON (reduces read token cost) |
16
- | `task-complete.ts` | TypeScript | Code (after finishing) | Write outbox, archive pair |
17
- | `check-outbox.sh` | Bash | CoWork | Check if Code has responded to a task |
18
- | `bridge-status.sh` | Bash | Either | Quick dashboard: counts, last activity |
19
- | `capabilities-check.ts` | TypeScript | Scheduled / on-demand | Verify capabilities, update assumptions-log |
20
-
21
- ## Usage
22
-
23
- ### setup-mcps.ts
24
- Run once per machine when onboarding. Writes GitKraken + GitLab MCP entries into
25
- Claude Desktop's global config. Safe to re-run — merges, never overwrites unrelated entries.
26
- ```bash
27
- npx ts-node .ai-assistance/scripts/setup-mcps.ts
28
- # prompts for GitLab PAT (defaults from .env), then writes claude_desktop_config.json
29
- # backs up existing config to claude_desktop_config.json.backup first
30
- ```
31
-
32
- ### setup-mcps.test.ts
33
- ```bash
34
- npx ts-node .ai-assistance/scripts/setup-mcps.test.ts
35
- # runs unit tests for parseEnvFile, buildMcpEntries, mergeConfig, getConfigPath
36
- # exits 0 on all pass, 1 if any fail
37
- ```
38
-
39
- ### bridge-init.sh
40
- ```bash
41
- bash .ai-assistance/scripts/bridge-init.sh
42
- # outputs: {"env":"code","user":"oscar","pending":2,"tasks":[...],"stale":1,"stale_tasks":["oscar-abc-old-task.md"]}
43
- # also writes output to .ai-assistance/bridge/STATUS (read by Code on startup)
44
- # stale_tasks: IN_PROGRESS files older than 1 hour — likely crashed sessions
45
- ```
46
-
47
- ### lock-acquire.sh
48
- ```bash
49
- result=$(bash .ai-assistance/scripts/lock-acquire.sh \
50
- --agent code \
51
- --user oscar \
52
- --intent "Implementing Phase D mutations" \
53
- [--expiry-minutes 60] # default: 60
54
- [--lock-file /custom/path] # default: .ai-assistance/bridge/LOCK
55
- )
56
- # success: {"acquired":true,"lock_file":"...","expires":"2026-06-08T12:00:00Z"}
57
- # failure: {"acquired":false,"reason":"locked","held_by":"code/oscar","intent":"...","age_seconds":42}
58
- # stale lock (expired by mtime): auto-detected and overwritten
59
-
60
- # Release when done:
61
- rm .ai-assistance/bridge/LOCK
62
- ```
63
-
64
- Uses temp-file + hard-link for atomicity (POSIX + NTFS). Falls back to bash `noclobber`
65
- if hard links unavailable. Always check `"acquired":true` before proceeding.
66
-
67
- **Hook notes (hard-won):**
68
- - Correct Claude Code hook event name is `SessionStart` (not `PostSessionStart`)
69
- - Use `bash script.sh` in hook commands — `source` is not available in hook context
70
- - Hook stdout is NOT injected into Code's context — Code never sees it as a message
71
- - Solution: write output to `bridge/STATUS`; Code reads that file when asked
72
- - Code is passive and will not act on hook output unprompted — ask "any pending tasks?"
73
- at session start; Code reads STATUS and reports immediately
74
-
75
- ```bash
76
- ```
77
-
78
- ### task-create.ts
79
- ```bash
80
- npx ts-node .ai-assistance/scripts/task-create.ts \
81
- --title "List open MRs" \
82
- --request "Run: git branch --show-current in ecoportal-api-graphql, then list all open MRs via GitLab plugin" \
83
- --expected "Current branch name + MR table (ID, title, source branch, author, date)" \
84
- --from cowork \
85
- --to code \
86
- --user oscar
87
- # outputs: created oscar-[uuid]-list-open-mrs.md
88
- ```
89
-
90
- ### task-read.ts
91
- ```bash
92
- # Read from inbox (default)
93
- npx ts-node .ai-assistance/scripts/task-read.ts --task oscar-a3f2b1c-list-open-mrs.md
94
-
95
- # Explicitly target outbox or archive
96
- npx ts-node .ai-assistance/scripts/task-read.ts --task oscar-a3f2b1c-list-open-mrs.md --dir outbox
97
-
98
- # Read by absolute path
99
- npx ts-node .ai-assistance/scripts/task-read.ts --file /abs/path/to/task.md
100
-
101
- # Output: structured JSON with title, status, created, from, to,
102
- # context, request, expected, result, notes, raw_path
103
- # Uses this instead of reading raw Markdown — saves ~200 tokens per task read.
104
- ```
105
-
106
- ### task-complete.ts
107
- ```bash
108
- npx ts-node .ai-assistance/scripts/task-complete.ts \
109
- --task oscar-a3f2b1c-list-open-mrs.md \
110
- --status done \
111
- --result "Branch: feature/auth. MRs: ..." \
112
- --notes "GitLab plugin authenticated successfully"
113
- # outputs: wrote outbox file, archived pair
114
- ```
115
-
116
- ### check-outbox.sh
117
- ```bash
118
- bash .ai-assistance/scripts/check-outbox.sh oscar-a3f2b1c-list-open-mrs.md
119
- # outputs: DONE | "Branch: feature/auth. Open MRs: 3"
120
- # or: PENDING | no response yet
121
- # or: FAILED | "GitLab credentials not configured"
122
- ```
123
-
124
- ### bridge-status.sh
125
- ```bash
126
- bash .ai-assistance/scripts/bridge-status.sh
127
- # outputs: pending:2 done:5 failed:0 archived:12 last_activity:2026-06-03T14:32Z
128
- ```
129
-
130
- ### capabilities-check.ts
131
- ```bash
132
- npx ts-node .ai-assistance/scripts/capabilities-check.ts
133
- # checks connector endpoints, flags stale assumptions, updates assumptions-log.md
134
- # uses Haiku model for any inference (cheap, fast)
135
- ```
136
-
137
- ## Dependencies
138
-
139
- ```bash
140
- # TypeScript scripts require:
141
- npm install -g ts-node typescript
142
-
143
- # Node type definitions (required for ts-node to resolve assert, process, etc.):
144
- npm install --save-dev @types/node
145
-
146
- # tsconfig.json must include "types": ["node"] in compilerOptions
147
-
148
- # capabilities-check.ts additionally requires:
149
- npm install @anthropic-ai/sdk
150
- ```
@@ -1,75 +0,0 @@
1
- #!/usr/bin/env bash
2
- # bridge-inbox-check.sh -- session-start actuator for the bridge inbox.
3
- #
4
- # Closes an actuation-coverage gap: unread cross-project bridge messages used to be
5
- # visible only if someone manually ran a command. This is the trigger/clock that
6
- # surfaces them automatically at session start, mirroring the standards-inbox report
7
- # line (see CLAUDE.md and standards/governance/standards-request-protocol.md).
8
- #
9
- # DETERMINISTIC and zero-LLM: it just scans .ai-assistance/bridge/inbox/ for unread
10
- # messages (STATUS: PENDING) and prints one summary line plus one line per message:
11
- #
12
- # [bridge] N unread message(s)
13
- # - {title} from {FROM}
14
- #
15
- # Contract (mirrors the other hook scripts):
16
- # - Silent (no output) and exit 0 when the inbox is empty or has no unread messages.
17
- # - NEVER fails fatally -- always exits 0, even on a malformed file or missing dir.
18
- # - No side effects: read-only, does not touch or move any message.
19
- #
20
- # Wired as a SessionStart hook in .claude/settings.json:
21
- # bash scripts/bridge-inbox-check.sh 2>/dev/null || true
22
- #
23
- # Manual run (same output): bash scripts/bridge-inbox-check.sh
24
- set -u
25
-
26
- # Resolve the bridge inbox from this script's location so it works from any cwd.
27
- # This script is deployed at .ai-assistance/scripts/, so the inbox is a sibling
28
- # of the scripts dir: ../bridge/inbox (mirrors bridge-init.sh in this repo).
29
- SCRIPT_DIR="$(cd "$(dirname "$0")" 2>/dev/null && pwd)" || exit 0
30
- INBOX="$SCRIPT_DIR/../bridge/inbox"
31
-
32
- # No inbox -> nothing to report.
33
- [ -d "$INBOX" ] || exit 0
34
-
35
- # An "unread" message is a *.md file whose header carries STATUS: PENDING.
36
- # (PENDING = not yet picked up by the receiving agent; IN_PROGRESS/DONE/FAILED are read.)
37
- unread=""
38
- count=0
39
-
40
- for f in "$INBOX"/*.md; do
41
- # Guard against the literal glob when the folder is empty.
42
- [ -e "$f" ] || continue
43
-
44
- # Only inspect the header block (first ~15 lines) -- cheap and format-stable.
45
- header="$(head -n 15 "$f" 2>/dev/null || true)"
46
-
47
- # Unread == STATUS: PENDING (case-insensitive, tolerant of surrounding whitespace).
48
- printf '%s\n' "$header" | grep -Eiq '^[[:space:]]*STATUS:[[:space:]]*PENDING[[:space:]]*$' || continue
49
-
50
- # Title: the text after "# TASK:" on line 1; fall back to the filename.
51
- title="$(printf '%s\n' "$header" \
52
- | grep -Ei '^#[[:space:]]*TASK:' \
53
- | head -n 1 \
54
- | sed -E 's/^#[[:space:]]*TASK:[[:space:]]*//' 2>/dev/null || true)"
55
- [ -n "$title" ] || title="$(basename "$f" .md)"
56
-
57
- # Sender: the text after "FROM:"; fall back to "unknown".
58
- from="$(printf '%s\n' "$header" \
59
- | grep -Ei '^[[:space:]]*FROM:' \
60
- | head -n 1 \
61
- | sed -E 's/^[[:space:]]*FROM:[[:space:]]*//I' 2>/dev/null || true)"
62
- [ -n "$from" ] || from="unknown"
63
-
64
- count=$((count + 1))
65
- unread="${unread}- ${title} from ${from}
66
- "
67
- done
68
-
69
- # Silent when there is nothing unread.
70
- [ "$count" -gt 0 ] || exit 0
71
-
72
- printf '[bridge] %d unread message(s)\n' "$count"
73
- printf '%s' "$unread"
74
-
75
- exit 0
@@ -1,86 +0,0 @@
1
- #!/bin/bash
2
- # bridge-init.sh
3
- # Detects environment, scans bridge/inbox for pending tasks belonging to current user.
4
- # Output: single JSON line for the agent to consume.
5
- # Usage: source .ai-assistance/scripts/bridge-init.sh
6
-
7
- set -euo pipefail
8
-
9
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
10
- BRIDGE_DIR="$SCRIPT_DIR/../bridge"
11
- INBOX_DIR="$BRIDGE_DIR/inbox"
12
-
13
- # --- Environment detection ---
14
- # Prefer explicit env var; fall back to "code" (this script is most useful in Code)
15
- ENV="${CLAUDE_ENV:-code}"
16
-
17
- # --- Username detection ---
18
- # Prefer explicit env var; fall back to git config
19
- if [ -n "${BRIDGE_USER:-}" ]; then
20
- USER_SLUG="$BRIDGE_USER"
21
- else
22
- GIT_USER=$(git config user.name 2>/dev/null || echo "unknown")
23
- USER_SLUG=$(echo "$GIT_USER" | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | tr -cd '[:alnum:]-')
24
- fi
25
-
26
- # --- Stale threshold (seconds) ---
27
- # IN_PROGRESS tasks older than this are flagged as stale (likely a crashed session).
28
- STALE_THRESHOLD_SECONDS=3600 # 1 hour
29
-
30
- # --- Scan inbox ---
31
- pending_tasks=()
32
- stale_tasks=()
33
-
34
- if [ -d "$INBOX_DIR" ]; then
35
- while IFS= read -r -d '' file; do
36
- filename=$(basename "$file")
37
- # Only files prefixed with this user's slug
38
- if [[ "$filename" == ${USER_SLUG}-* ]]; then
39
- if grep -q "^STATUS: PENDING" "$file" 2>/dev/null; then
40
- pending_tasks+=("$filename")
41
- elif grep -q "^STATUS: IN_PROGRESS" "$file" 2>/dev/null; then
42
- # Check how old the file is
43
- if command -v stat &>/dev/null; then
44
- # GNU stat (Linux/Git-Bash): -c %Y gives mtime as epoch seconds
45
- # macOS stat uses -f %m — try GNU first, fall back gracefully
46
- mtime=$(stat -c %Y "$file" 2>/dev/null || stat -f %m "$file" 2>/dev/null || echo 0)
47
- now=$(date +%s)
48
- age=$(( now - mtime ))
49
- if [ "$age" -ge "$STALE_THRESHOLD_SECONDS" ]; then
50
- stale_tasks+=("$filename")
51
- fi
52
- fi
53
- # If stat is unavailable we silently skip stale detection for this file
54
- fi
55
- fi
56
- done < <(find "$INBOX_DIR" -maxdepth 1 -name "*.md" \
57
- -not -name "*.draft.md" \
58
- -not -name "*.local.md" \
59
- -not -name ".gitkeep" \
60
- -print0 2>/dev/null)
61
- fi
62
-
63
- # --- Build JSON output ---
64
- count=${#pending_tasks[@]}
65
- stale_count=${#stale_tasks[@]}
66
-
67
- tasks_json="["
68
- for i in "${!pending_tasks[@]}"; do
69
- tasks_json+="\"${pending_tasks[$i]}\""
70
- [ $i -lt $((count - 1)) ] && tasks_json+=","
71
- done
72
- tasks_json+="]"
73
-
74
- stale_json="["
75
- for i in "${!stale_tasks[@]}"; do
76
- stale_json+="\"${stale_tasks[$i]}\""
77
- [ $i -lt $((stale_count - 1)) ] && stale_json+=","
78
- done
79
- stale_json+="]"
80
-
81
- output="{\"env\":\"$ENV\",\"user\":\"$USER_SLUG\",\"pending\":$count,\"tasks\":$tasks_json,\"stale\":$stale_count,\"stale_tasks\":$stale_json}"
82
-
83
- # Write to status file so Code can read it on startup (hook stdout is not injected into context)
84
- echo "$output" > "$BRIDGE_DIR/STATUS"
85
-
86
- echo "$output"