Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.claude
.DS_Store
echo/docker-compose.coolify.yml
echo/.devcontainer/neo4j_data/*
Expand Down
1 change: 1 addition & 0 deletions echo/directus/directus-sync.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ module.exports = {
// OR needs to be run in the same container as the directus server
dumpPath: './sync',
preserveIds: ['roles', 'policies', 'dashboards', 'panels'],
specs: false,
};
14 changes: 10 additions & 4 deletions echo/directus/sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,24 @@ url=""
username=""
password=""
action=""
force="false"

# Function to show usage
show_usage() {
echo "Usage: $0 [-u URL] [-e USERNAME] [-p PASSWORD] ACTION"
echo "Usage: $0 [-u URL] [-e USERNAME] [-p PASSWORD] [-f] ACTION"
echo "Actions: push, pull, diff"
echo ""
echo "Flags: -f, --force"
echo "If parameters are not provided, you will be prompted for them."
Comment on lines +17 to 20
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add real support for the --force long flag.

Usage text advertises --force but getopts only recognises -f; the long flag is silently ignored.
Recommend catching --force before getopts, or switch to getopt -o ... --long force.

-while getopts "u:e:p:fv:h" opt; do
+PARSED=$(getopt -o "u:e:p:fv:h" -l "force" -- "$@") || exit 1
+eval set -- "$PARSED"
+while true; do
+  case "$1" in
+    -f|--force) force="true"; shift ;;
+    ...
+  esac
+done

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In echo/directus/sync.sh around lines 17 to 20, the usage text mentions the
--force long flag, but the script only supports the short -f flag via getopts,
causing --force to be ignored. To fix this, modify the script to parse the
--force long flag properly by either checking for --force explicitly before the
getopts loop or switch to using getopt with the --long force option to handle
both short and long flags consistently.

exit 1
}

# Parse command line arguments
while getopts "u:e:p:h" opt; do
while getopts "u:e:p:fv:h" opt; do
case $opt in
u) url="$OPTARG" ;;
e) username="$OPTARG" ;;
p) password="$OPTARG" ;;
f) force="true" ;;
h) show_usage ;;
?) show_usage ;;
esac
Expand Down Expand Up @@ -71,4 +73,8 @@ if [ -z "$password" ]; then
fi

# Execute directus-sync command
npx -y directus-sync -u "$url" -e "$username" -p "$password" "$action" -d
if [ "$force" = "true" ]; then
npx -y directus-sync -u "$url" -e "$username" -p "$password" "$action" -d -f
else
npx -y directus-sync -u "$url" -e "$username" -p "$password" "$action" -d
fi
4 changes: 2 additions & 2 deletions echo/directus/sync/collections/flows.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"trigger": "operation",
"accountability": "all",
"options": {},
"operation": "5bea9e07-e6f0-41c6-821d-b426dec3427c",
"operation": "11fdc301-7101-40f3-bc82-af3b472fd914",
"_syncId": "17703446-fef0-49e9-bdc4-385db1311137"
Comment on lines +11 to 12
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Verify operation UUID exists in operations.json

Looks good, but we’ve swapped out the operation ID – let’s make sure the referenced node actually exists after the rename to avoid a runtime “operation not found” error.


🏁 Script executed:

#!/bin/bash
# Confirm the new UUID is declared in the operations snapshot
rg -n '"id":\s*"11fdc301-7101-40f3-bc82-af3b472fd914"' echo/directus/sync/collections/operations.json

Length of output: 103


Launching a full-spectrum scan for the new operation UUID…


🏁 Script executed:

#!/bin/bash
# Search the entire repository for the operation ID
rg -n '11fdc301-7101-40f3-bc82-af3b472fd914'

Length of output: 250


Swap IDs in operations.json to match the updated flow reference

The new operation UUID lives in flows.json, but in operations.json it’s only set as _syncId—the "id" field still holds the old UUID. Let’s flip them to avoid a “operation not found” at runtime.

• File: echo/directus/sync/collections/operations.json
– Swap the values of id and _syncId so they align with the new flow entry.

Suggested diff:

-  "id": "17703446-fef0-49e9-bdc4-385db1311137",
-  "_syncId": "11fdc301-7101-40f3-bc82-af3b472fd914"
+  "id": "11fdc301-7101-40f3-bc82-af3b472fd914",
+  "_syncId": "17703446-fef0-49e9-bdc4-385db1311137"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"operation": "11fdc301-7101-40f3-bc82-af3b472fd914",
"_syncId": "17703446-fef0-49e9-bdc4-385db1311137"
// File: echo/directus/sync/collections/operations.json
"id": "11fdc301-7101-40f3-bc82-af3b472fd914",
"_syncId": "17703446-fef0-49e9-bdc4-385db1311137"
🤖 Prompt for AI Agents
In echo/directus/sync/collections/operations.json around the lines where the
operation IDs are defined, the "id" and "_syncId" fields have mismatched UUIDs
compared to flows.json. Swap the values of "id" and "_syncId" so that "id" holds
the new operation UUID from flows.json and "_syncId" holds the old UUID. This
alignment will prevent runtime errors related to missing operations.

},
{
Expand Down Expand Up @@ -50,7 +50,7 @@
"project_report"
]
},
"operation": "239c6fea-242d-4b7d-b854-c99d2fe43cf3",
"operation": "cb0759e3-a837-4f4b-9f61-276f17958f2b",
"_syncId": "ec4e7ea5-72de-4365-b66f-d8f11b549495"
Comment on lines +53 to 54
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

❓ Verification inconclusive

Same consistency check for the Report flow

Second flow, same story. We’ll sleep better if we assert the new ID is present.


🏁 Script executed:

#!/bin/bash
rg -n '"id":\s*"cb0759e3-a837-4f4b-9f61-276f17958f2b"' echo/directus/sync/collections/operations.json

Length of output: 103


Missing Report flow operation definition in operations.json
The Report flow in echo/directus/sync/collections/flows.json (lines 53–54) references operation ID cb0759e3-a837-4f4b-9f61-276f17958f2b, but there’s no matching entry in echo/directus/sync/collections/operations.json.

• Add an operation record to echo/directus/sync/collections/operations.json with:

{
  "id": "cb0759e3-a837-4f4b-9f61-276f17958f2b",
  // …other required operation fields…
}

Sync will only succeed once the Report flow’s operation is defined. LGTM after this is in place.

🤖 Prompt for AI Agents
In echo/directus/sync/collections/flows.json at lines 53-54, the Report flow
references an operation ID "cb0759e3-a837-4f4b-9f61-276f17958f2b" that is
missing in echo/directus/sync/collections/operations.json. To fix this, add a
new operation entry in operations.json with the specified ID and include all
other required fields for an operation record. This will ensure the Report
flow's operation is properly defined and allow the sync to succeed.

}
]
54 changes: 27 additions & 27 deletions echo/directus/sync/collections/operations.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
}
}
},
"resolve": "3dbf2ea1-17f8-4bde-aa89-43278fe9a00f",
"reject": "eaeb2c39-32e0-428d-ad03-ff0e6052adcc",
"resolve": "5f9aad15-ff17-4cb5-8ab8-e9ef169470fd",
"reject": "435e2a60-3c92-4225-91aa-45156884ac2b",
"flow": "17703446-fef0-49e9-bdc4-385db1311137",
"_syncId": "5bea9e07-e6f0-41c6-821d-b426dec3427c"
"_syncId": "11fdc301-7101-40f3-bc82-af3b472fd914"
},
{
"name": "Check Report Language",
Expand All @@ -40,10 +40,10 @@
},
"collection": "project_report"
},
"resolve": "efb3982e-5703-4c07-8982-a6e1b5218e4a",
"resolve": "6fba7361-0b76-40b0-b4ae-ef094d896bb6",
"reject": null,
"flow": "ec4e7ea5-72de-4365-b66f-d8f11b549495",
"_syncId": "d154ee34-0931-43f3-aaca-9168f88fa04b"
"_syncId": "7be4966b-477b-4961-a341-26c663f9d27a"
},
{
"name": "Dutch",
Expand All @@ -60,10 +60,10 @@
}
}
},
"resolve": "34fb6ee5-2813-484a-a1cc-f97de097509b",
"reject": "8d8d787a-dbc4-44f9-9ab4-28e3f3d5f31c",
"resolve": "21b8e36a-a71d-4912-b428-9ee67c1df1ba",
"reject": "13856746-f10a-402a-bf4b-68a4213b6c21",
"flow": "17703446-fef0-49e9-bdc4-385db1311137",
"_syncId": "eaeb2c39-32e0-428d-ad03-ff0e6052adcc"
"_syncId": "435e2a60-3c92-4225-91aa-45156884ac2b"
},
{
"name": "Email Send Operation Failed",
Expand All @@ -77,7 +77,7 @@
"resolve": null,
"reject": null,
"flow": "17703446-fef0-49e9-bdc4-385db1311137",
"_syncId": "920bd181-b2a2-4f0d-94dc-3b1a08c3f4ef"
"_syncId": "16319ea2-0cdf-4e50-9e83-d62cd9f29d71"
},
{
"name": "Email Send Operation Failed Dutch",
Expand All @@ -91,7 +91,7 @@
"resolve": null,
"reject": null,
"flow": "17703446-fef0-49e9-bdc4-385db1311137",
"_syncId": "84c38ea6-5d15-429f-8c24-9485d54ba7be"
"_syncId": "97bc1561-dd12-4fbf-9ebd-4b44c06d4fb9"
},
{
"name": "failed",
Expand All @@ -105,7 +105,7 @@
"resolve": null,
"reject": null,
"flow": "17703446-fef0-49e9-bdc4-385db1311137",
"_syncId": "8d8d787a-dbc4-44f9-9ab4-28e3f3d5f31c"
"_syncId": "13856746-f10a-402a-bf4b-68a4213b6c21"
},
{
"name": "Filter Emails",
Expand All @@ -116,10 +116,10 @@
"options": {
"code": "module.exports = async function(data) {\n\n const submissions = data.get_all_participants;\n \n // Filter submissions to only include those where email_opt_in is true\n const filteredSubmissions = submissions.filter(sub => sub.email_opt_in === true);\n\n // Create an array with email, project_id and an email_opt_out token for each submission\n const result = filteredSubmissions.map(sub => ({\n project_name: data.project_data[0].name || '',\n\t\tdefault_conversation_title: data.project_data[0].default_conversation_title || '',\n\t\tconversation_name: sub.conversation_id.participant_name || '',\n email: sub.email,\n project_id: sub.project_id || '',\n token: sub.email_opt_out_token,\n language: data.check_report_language[0].language || 'empty',\n ADMIN_BASE_URL: \"{{ $env.ADMIN_BASE_URL }}\" || \"http://localhost:5173\",\n PARTICIPANT_BASE_URL: \"{{ $env.PARTICIPANT_BASE_URL }}\" || \"http://localhost:5174\", \n }));\n \n return result;\n};"
},
"resolve": "e101f00d-2fb8-4f40-9e0e-4d24da5bb1e9",
"resolve": "b10f5a01-3355-4884-8e37-308caf3c56d7",
"reject": null,
"flow": "ec4e7ea5-72de-4365-b66f-d8f11b549495",
"_syncId": "efb3982e-5703-4c07-8982-a6e1b5218e4a"
"_syncId": "6fba7361-0b76-40b0-b4ae-ef094d896bb6"
},
{
"name": "Get All Participants",
Expand All @@ -143,10 +143,10 @@
},
"collection": "project_report_notification_participants"
},
"resolve": "d154ee34-0931-43f3-aaca-9168f88fa04b",
"resolve": "7be4966b-477b-4961-a341-26c663f9d27a",
"reject": null,
"flow": "ec4e7ea5-72de-4365-b66f-d8f11b549495",
"_syncId": "107ebc18-7d2d-4299-9d98-b7d1e7322b7c"
"_syncId": "dad81699-20ef-435d-a3e3-a7c09ed97c42"
},
{
"name": "log environment vars",
Expand All @@ -160,7 +160,7 @@
"resolve": null,
"reject": null,
"flow": "ec4e7ea5-72de-4365-b66f-d8f11b549495",
"_syncId": "da5f4cce-eff0-426d-a207-d61366899d1f"
"_syncId": "9c98061e-46a1-4947-804d-0cddfdf05b69"
},
{
"name": "PROCEED_ONLY_IF \"published\" in payload",
Expand All @@ -179,10 +179,10 @@
}
}
},
"resolve": "ea051ae4-776f-490b-8b02-eaf4099243ef",
"reject": "84852456-3f3a-4906-be94-8b750159883b",
"resolve": "57fb6535-6c26-413d-858d-9ccf89846205",
"reject": "60af30e5-dd72-422c-b51c-8bff6d5bc614",
"flow": "ec4e7ea5-72de-4365-b66f-d8f11b549495",
"_syncId": "239c6fea-242d-4b7d-b854-c99d2fe43cf3"
"_syncId": "cb0759e3-a837-4f4b-9f61-276f17958f2b"
},
{
"name": "Project Data",
Expand All @@ -202,10 +202,10 @@
}
}
},
"resolve": "107ebc18-7d2d-4299-9d98-b7d1e7322b7c",
"resolve": "dad81699-20ef-435d-a3e3-a7c09ed97c42",
"reject": null,
"flow": "ec4e7ea5-72de-4365-b66f-d8f11b549495",
"_syncId": "ea051ae4-776f-490b-8b02-eaf4099243ef"
"_syncId": "57fb6535-6c26-413d-858d-9ccf89846205"
},
{
"name": "Report Not Published",
Expand All @@ -219,7 +219,7 @@
"resolve": null,
"reject": null,
"flow": "ec4e7ea5-72de-4365-b66f-d8f11b549495",
"_syncId": "84852456-3f3a-4906-be94-8b750159883b"
"_syncId": "60af30e5-dd72-422c-b51c-8bff6d5bc614"
},
{
"name": "Send Email Dutch",
Expand Down Expand Up @@ -248,9 +248,9 @@
]
},
"resolve": null,
"reject": "84c38ea6-5d15-429f-8c24-9485d54ba7be",
"reject": "97bc1561-dd12-4fbf-9ebd-4b44c06d4fb9",
"flow": "17703446-fef0-49e9-bdc4-385db1311137",
"_syncId": "34fb6ee5-2813-484a-a1cc-f97de097509b"
"_syncId": "21b8e36a-a71d-4912-b428-9ee67c1df1ba"
},
{
"name": "Send Email English",
Expand Down Expand Up @@ -279,9 +279,9 @@
]
},
"resolve": null,
"reject": "920bd181-b2a2-4f0d-94dc-3b1a08c3f4ef",
"reject": "16319ea2-0cdf-4e50-9e83-d62cd9f29d71",
"flow": "17703446-fef0-49e9-bdc4-385db1311137",
"_syncId": "3dbf2ea1-17f8-4bde-aa89-43278fe9a00f"
"_syncId": "5f9aad15-ff17-4cb5-8ab8-e9ef169470fd"
},
{
"name": "Trigger Email Flow",
Expand All @@ -297,6 +297,6 @@
"resolve": null,
"reject": null,
"flow": "ec4e7ea5-72de-4365-b66f-d8f11b549495",
"_syncId": "e101f00d-2fb8-4f40-9e0e-4d24da5bb1e9"
"_syncId": "b10f5a01-3355-4884-8e37-308caf3c56d7"
}
]
Loading