@profoundlogic/coderflow-server 0.5.0 → 0.5.2

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 (185) hide show
  1. package/README.md +15 -163
  2. package/dist/README.md +15 -163
  3. package/dist/base-image/agent-wrapper.sh +1 -1
  4. package/dist/capture-screenshot.mjs +34 -0
  5. package/dist/coder-server.js +1 -1
  6. package/dist/config/cli-models.json +4 -3
  7. package/dist/config.js +1 -1
  8. package/dist/lib/agent-keepalive.js +1 -1
  9. package/dist/lib/agent-models.js +1 -1
  10. package/dist/lib/api-keys.js +1 -1
  11. package/dist/lib/apiKeys.js +1 -1
  12. package/dist/lib/app-server-ports.js +1 -1
  13. package/dist/lib/auto-judge.js +1 -1
  14. package/dist/lib/automation-service.js +1 -1
  15. package/dist/lib/basic-auth.js +1 -1
  16. package/dist/lib/bindings.js +1 -1
  17. package/dist/lib/build-history.js +1 -1
  18. package/dist/lib/build-output-service.js +1 -1
  19. package/dist/lib/build-scheduler.js +1 -1
  20. package/dist/lib/build-service.js +1 -1
  21. package/dist/lib/ca-certificates.js +1 -1
  22. package/dist/lib/claude-oauth-refresh.js +1 -1
  23. package/dist/lib/cli/build.js +1 -1
  24. package/dist/lib/cli/cleanup-users.js +1 -0
  25. package/dist/lib/cli/config-command.js +1 -1
  26. package/dist/lib/cli/config.js +1 -1
  27. package/dist/lib/cli/create-user.js +1 -1
  28. package/dist/lib/cli/grant-admin.js +1 -0
  29. package/dist/lib/cli/init.js +1 -1
  30. package/dist/lib/cli/jira.js +1 -1
  31. package/dist/lib/cli/license.js +1 -1
  32. package/dist/lib/cli/list-roles.js +1 -0
  33. package/dist/lib/cli/list-users.js +1 -0
  34. package/dist/lib/cli/server-manager.js +1 -1
  35. package/dist/lib/cli/set-password.js +1 -0
  36. package/dist/lib/config-migration.js +1 -1
  37. package/dist/lib/container-credential-sync.js +1 -1
  38. package/dist/lib/container-tokens.js +1 -1
  39. package/dist/lib/data-dir.js +1 -1
  40. package/dist/lib/deployment-history.js +1 -1
  41. package/dist/lib/deployment-service.js +1 -1
  42. package/dist/lib/docker-utils.js +1 -1
  43. package/dist/lib/email.js +1 -1
  44. package/dist/lib/emailTemplates.js +1 -1
  45. package/dist/lib/entitlement.js +1 -1
  46. package/dist/lib/external-connections.js +1 -1
  47. package/dist/lib/fetch-utils.js +1 -1
  48. package/dist/lib/git-commit-details-route.js +1 -1
  49. package/dist/lib/git-history-diff-guardrails.js +1 -1
  50. package/dist/lib/git-provider-service.js +1 -1
  51. package/dist/lib/git-provider-setup/github-setup-handler.js +1 -1
  52. package/dist/lib/git-provider-setup/index.js +1 -1
  53. package/dist/lib/git-provider-setup/setup-factory.js +1 -1
  54. package/dist/lib/git-provider-setup/setup-interface.js +1 -1
  55. package/dist/lib/git-providers/azure-devops-provider.js +1 -1
  56. package/dist/lib/git-providers/github-app-provider.js +1 -1
  57. package/dist/lib/git-providers/index.js +1 -1
  58. package/dist/lib/git-providers/provider-factory.js +1 -1
  59. package/dist/lib/git-providers/provider-interface.js +1 -1
  60. package/dist/lib/github-urls.js +1 -1
  61. package/dist/lib/group-objective-linking.js +1 -1
  62. package/dist/lib/ibmi-sync.js +1 -0
  63. package/dist/lib/jira-client.js +1 -1
  64. package/dist/lib/judge-blinding.js +1 -1
  65. package/dist/lib/logger.js +1 -1
  66. package/dist/lib/migration-to-scoped-rbac.js +1 -1
  67. package/dist/lib/model-fetcher.js +1 -1
  68. package/dist/lib/notifications.js +1 -1
  69. package/dist/lib/objective-context.js +1 -1
  70. package/dist/lib/oidc-auth.js +1 -1
  71. package/dist/lib/oidc-device-flow.js +1 -1
  72. package/dist/lib/passwordTokens.js +1 -1
  73. package/dist/lib/permission-resolver.js +1 -1
  74. package/dist/lib/pin-cascade.js +1 -1
  75. package/dist/lib/provider-accounts.js +1 -1
  76. package/dist/lib/provider-oauth.js +1 -1
  77. package/dist/lib/provider-profile.js +1 -1
  78. package/dist/lib/provider-token-refresh.js +1 -1
  79. package/dist/lib/rbac-user-state.js +1 -1
  80. package/dist/lib/request-url.js +1 -1
  81. package/dist/lib/rewind.js +1 -1
  82. package/dist/lib/role-definitions.js +1 -1
  83. package/dist/lib/roles.js +1 -1
  84. package/dist/lib/secrets.js +1 -1
  85. package/dist/lib/setup-repo-git-auth.js +1 -1
  86. package/dist/lib/state-capture.js +1 -1
  87. package/dist/lib/static-files.js +1 -1
  88. package/dist/lib/task-name-format.js +1 -1
  89. package/dist/lib/task-name-generator.js +1 -1
  90. package/dist/lib/task-source-metadata.js +1 -1
  91. package/dist/lib/teams.js +1 -1
  92. package/dist/lib/user-git-oauth.js +1 -1
  93. package/dist/lib/user-git-tokens.js +1 -1
  94. package/dist/lib/users.js +1 -1
  95. package/dist/middleware/requireAuth.js +1 -1
  96. package/dist/middleware/requireInit.js +1 -1
  97. package/dist/middleware/requirePermission.js +1 -1
  98. package/dist/package.json +1 -1
  99. package/dist/playwright.config.js +1 -1
  100. package/dist/routes/apiKeys.js +1 -1
  101. package/dist/routes/auth-oidc.js +1 -1
  102. package/dist/routes/auth.js +1 -1
  103. package/dist/routes/automations.js +1 -1
  104. package/dist/routes/bindings.js +1 -1
  105. package/dist/routes/build.js +1 -1
  106. package/dist/routes/containers.js +1 -1
  107. package/dist/routes/deploy-task.js +1 -1
  108. package/dist/routes/environment-management.js +1 -1
  109. package/dist/routes/environments.js +1 -1
  110. package/dist/routes/external-skills.js +1 -1
  111. package/dist/routes/git-credentials.js +1 -1
  112. package/dist/routes/git-oauth.js +1 -1
  113. package/dist/routes/git-provider-setup.js +1 -1
  114. package/dist/routes/health.js +1 -1
  115. package/dist/routes/jira.js +1 -1
  116. package/dist/routes/objective-management.js +1 -1
  117. package/dist/routes/password.js +1 -1
  118. package/dist/routes/prompt.js +1 -1
  119. package/dist/routes/provider-auth.js +1 -1
  120. package/dist/routes/qa.js +1 -1
  121. package/dist/routes/roles.js +1 -1
  122. package/dist/routes/settings.js +1 -1
  123. package/dist/routes/skill-management.js +1 -1
  124. package/dist/routes/skills.js +1 -1
  125. package/dist/routes/tasks.js +1 -1
  126. package/dist/routes/teams.js +1 -1
  127. package/dist/routes/templates.js +1 -1
  128. package/dist/routes/test-task.js +1 -1
  129. package/dist/routes/test.js +1 -1
  130. package/dist/routes/users.js +1 -1
  131. package/dist/routes/visualizations.js +1 -1
  132. package/dist/scripts/create-user.js +1 -1
  133. package/dist/scripts/migrate-config-to-data-dir.js +1 -1
  134. package/dist/scripts/sync_to_ibmi.sh +204 -0
  135. package/dist/start.js +1 -1
  136. package/dist/web-ui/public/activity-detail-modal.js +1 -1
  137. package/dist/web-ui/public/activity-feed.js +1 -1
  138. package/dist/web-ui/public/activity-formatters.js +1 -1
  139. package/dist/web-ui/public/agent-event-parser.js +1 -1
  140. package/dist/web-ui/public/app.js +1 -1
  141. package/dist/web-ui/public/approve-dialog.js +1 -1
  142. package/dist/web-ui/public/automation-links.js +1 -1
  143. package/dist/web-ui/public/automation-schedule.js +1 -1
  144. package/dist/web-ui/public/comments-widget.js +1 -1
  145. package/dist/web-ui/public/diff-utils.js +1 -1
  146. package/dist/web-ui/public/docs/admin/environments.md +1 -0
  147. package/dist/web-ui/public/docs/tasks/approval-and-deployment.md +36 -0
  148. package/dist/web-ui/public/environments.html +1 -1
  149. package/dist/web-ui/public/environments.js +1 -1
  150. package/dist/web-ui/public/feedback-widget.js +1 -1
  151. package/dist/web-ui/public/git-history-lazy-utils.js +1 -1
  152. package/dist/web-ui/public/git-history.js +1 -1
  153. package/dist/web-ui/public/git-status.js +1 -1
  154. package/dist/web-ui/public/index.html +2 -2
  155. package/dist/web-ui/public/index.js +1 -1
  156. package/dist/web-ui/public/login.js +1 -1
  157. package/dist/web-ui/public/markdown-editor.js +1 -1
  158. package/dist/web-ui/public/markdown-file-editor.js +1 -1
  159. package/dist/web-ui/public/modal-maximize.js +1 -1
  160. package/dist/web-ui/public/notifications.js +1 -1
  161. package/dist/web-ui/public/pr-dialog.js +1 -1
  162. package/dist/web-ui/public/roles.html +3 -2
  163. package/dist/web-ui/public/roles.js +1 -1
  164. package/dist/web-ui/public/server-health.js +1 -1
  165. package/dist/web-ui/public/settings.css +3 -2
  166. package/dist/web-ui/public/settings.html +0 -1
  167. package/dist/web-ui/public/settings.js +1 -1
  168. package/dist/web-ui/public/setup-password.js +1 -1
  169. package/dist/web-ui/public/skills.js +1 -1
  170. package/dist/web-ui/public/sse-client.js +1 -1
  171. package/dist/web-ui/public/sse-shared-worker.js +1 -1
  172. package/dist/web-ui/public/styles.css +39 -12
  173. package/dist/web-ui/public/task.html +56 -1
  174. package/dist/web-ui/public/task.js +1 -1
  175. package/dist/web-ui/public/teams.html +76 -81
  176. package/dist/web-ui/public/teams.js +1 -1
  177. package/dist/web-ui/public/terminal.js +1 -1
  178. package/dist/web-ui/public/theme.js +1 -1
  179. package/dist/web-ui/public/users.html +12 -11
  180. package/dist/web-ui/public/users.js +1 -1
  181. package/dist/web-ui/public/variant-grouping.js +1 -1
  182. package/package.json +1 -1
  183. package/dist/lib/cli/migrate-rbac.js +0 -1
  184. package/dist/lib/scoped-rbac-migration-runner.js +0 -1
  185. package/dist/scripts/migrate-to-scoped-rbac.js +0 -2
@@ -0,0 +1,204 @@
1
+ #!/bin/bash
2
+ # sync_to_ibmi.sh — Sync changed files to an IBM i library
3
+ #
4
+ # Usage: sync_to_ibmi.sh <connection_name> <library_name> <file_path_1> [file_path_2] ...
5
+ #
6
+ # Arguments:
7
+ # connection_name — SSH config alias for the IBM i connection (set up by the ssh feature)
8
+ # library_name — The IBM i library to sync files to
9
+ # file_path_N — Absolute paths of changed files to sync
10
+ #
11
+ # SSH connectivity:
12
+ # The ssh feature creates an SSH config entry for the connection, so
13
+ # `ssh <connection_name>` just works — no need to specify host, user, or key path.
14
+ #
15
+ # Remote command execution:
16
+ # All remote commands run through QShell: ssh <connection> /usr/bin/qsh -c '...'
17
+ # QShell is required because IBM i utilities used by this script only work in QShell.
18
+ # The -c flag passes a command string; -e can be used for early exit on error.
19
+ #
20
+ # Log format:
21
+ # Every line is prefixed with an ISO timestamp (YYYY-MM-DDTHH:MM:SS).
22
+ # Steps are announced before execution, then confirmed or reported as failed.
23
+ # Failed command output (stdout/stderr) is included in the log.
24
+ #
25
+ # This script lives on the server and is piped into the container via stdin.
26
+ # See Part B for the execution mechanism.
27
+ #
28
+ # Expected container env vars:
29
+ # TASK_ID — used in CRTLIB TEXT attribute when creating the target library
30
+
31
+ # --- Logging helper ---
32
+ log() {
33
+ echo "$(date -u +%Y-%m-%dT%H:%M:%S) $*"
34
+ }
35
+
36
+ # --- Argument parsing ---
37
+ CONNECTION="$1"
38
+ LIBRARY="$2"
39
+ shift 2
40
+
41
+ FILES=("$@")
42
+
43
+ if [ -z "${CONNECTION}" ]; then
44
+ log "ERROR: Connection name is required"
45
+ exit 1
46
+ fi
47
+
48
+ if [ -z "${LIBRARY}" ]; then
49
+ log "ERROR: Library name is required"
50
+ exit 1
51
+ fi
52
+
53
+ if [ ${#FILES[@]} -eq 0 ]; then
54
+ log "WARNING: No files to sync"
55
+ exit 0
56
+ fi
57
+
58
+ # --- SSH multiplexing setup ---
59
+ # Use a per-invocation control socket so all ssh/scp commands share one connection.
60
+ # Configured entirely via CLI args — no config file changes needed.
61
+ SSH_CTRL_DIR=$(mktemp -d)
62
+ SSH_CTRL_PATH="${SSH_CTRL_DIR}/ctrl-%r@%h:%p"
63
+ SSH_MUX_OPTS="-o ControlPath=${SSH_CTRL_PATH}"
64
+
65
+ cleanup_ssh() {
66
+ # Tear down the master connection and remove the socket dir
67
+ ssh ${SSH_MUX_OPTS} -O exit "${CONNECTION}" 2>/dev/null || true
68
+ rm -rf "${SSH_CTRL_DIR}"
69
+ }
70
+ trap cleanup_ssh EXIT
71
+
72
+ # Helper wrappers that route through the multiplexed connection.
73
+ # run_ssh executes commands on IBM i via QShell (/usr/bin/qsh -c '...').
74
+ # stdin is closed (< /dev/null) to prevent accidental consumption.
75
+ run_ssh() {
76
+ local cmd="$1"
77
+ ssh ${SSH_MUX_OPTS} "${CONNECTION}" /usr/bin/qsh -c "'${cmd}'" < /dev/null
78
+ }
79
+ # run_ssh_piped is the same but allows stdin to flow through from the caller's pipe.
80
+ run_ssh_piped() {
81
+ local cmd="$1"
82
+ ssh ${SSH_MUX_OPTS} "${CONNECTION}" /usr/bin/qsh -c "'${cmd}'"
83
+ }
84
+
85
+ log "Syncing ${#FILES[@]} file(s) to IBM i library ${LIBRARY} via connection ${CONNECTION}"
86
+
87
+ # Open the master connection
88
+ log "Opening SSH connection to ${CONNECTION} ..."
89
+ if output=$(ssh ${SSH_MUX_OPTS} -o ControlMaster=yes -o ControlPersist=yes -N -f "${CONNECTION}" 2>&1); then
90
+ log "SSH connection established"
91
+ else
92
+ log "ERROR: Failed to open SSH connection to ${CONNECTION}"
93
+ echo "$output" | while IFS= read -r line; do log " $line"; done
94
+ exit 1
95
+ fi
96
+
97
+ # --- Ensure target library exists ---
98
+ log "Checking if library ${LIBRARY} exists ..."
99
+ if run_ssh "test -e /qsys.lib/${LIBRARY}.lib" 2>/dev/null; then
100
+ log "Library ${LIBRARY} already exists"
101
+ else
102
+ log "Creating library ${LIBRARY} ..."
103
+ if output=$(run_ssh "system \"CRTLIB LIB(${LIBRARY}) TEXT('\\''CoderFlow task ${TASK_ID}'\\'')\"" 2>&1); then
104
+ log "Created library ${LIBRARY}"
105
+ else
106
+ log "ERROR: Failed to create library ${LIBRARY}"
107
+ echo "$output" | while IFS= read -r line; do log " $line"; done
108
+ exit 1
109
+ fi
110
+ fi
111
+
112
+ # --- Determine and create source physical files ---
113
+ # The source file name is derived from the parent directory of each changed file.
114
+ # e.g., 'source/qrpglesrc/mypgm.rpgle' → source file 'QRPGLESRC'
115
+ # 'src/myfile.rpgle' → source file 'SRC'
116
+ # Collect unique source file names, then check/create them all up front.
117
+
118
+ declare -A SRCPF_MAP # associative array: uppercase source file name → 1
119
+ for FILE in "${FILES[@]}"; do
120
+ PARENT_DIR=$(basename "$(dirname "${FILE}")")
121
+ SRCPF=$(echo "${PARENT_DIR}" | tr '[:lower:]' '[:upper:]')
122
+ SRCPF_MAP["${SRCPF}"]=1
123
+ done
124
+
125
+ log "Source physical files needed: ${!SRCPF_MAP[*]}"
126
+
127
+ for SRCPF in "${!SRCPF_MAP[@]}"; do
128
+ log "Checking if source file ${SRCPF} exists in ${LIBRARY} ..."
129
+ if run_ssh "test -e /qsys.lib/${LIBRARY}.lib/${SRCPF}.file" 2>/dev/null; then
130
+ log "Source file ${SRCPF} already exists"
131
+ else
132
+ log "Creating source file ${SRCPF} in ${LIBRARY} ..."
133
+ if output=$(run_ssh "system \"CRTSRCPF FILE(${LIBRARY}/${SRCPF}) RCDLEN(112)\"" 2>&1); then
134
+ log "Created source file ${SRCPF}"
135
+ else
136
+ log "ERROR: Failed to create source file ${SRCPF} in ${LIBRARY}"
137
+ echo "$output" | while IFS= read -r line; do log " $line"; done
138
+ exit 1
139
+ fi
140
+ fi
141
+ done
142
+
143
+ SUCCEEDED=0
144
+ FAILED=0
145
+
146
+ for FILE in "${FILES[@]}"; do
147
+ # Derive member name (filename without extension, uppercased) and source type (extension without dot, uppercased)
148
+ BASENAME=$(basename "${FILE}")
149
+ MEMBER=$(echo "${BASENAME%%.*}" | tr '[:lower:]' '[:upper:]')
150
+ SRCTYPE=$(echo "${BASENAME##*.}" | tr '[:lower:]' '[:upper:]')
151
+ PARENT_DIR=$(basename "$(dirname "${FILE}")")
152
+ SRCPF=$(echo "${PARENT_DIR}" | tr '[:lower:]' '[:upper:]')
153
+
154
+ log "Processing ${FILE} → ${LIBRARY}/${SRCPF}(${MEMBER}) type ${SRCTYPE}"
155
+
156
+ # --- Check/create/update member ---
157
+ MBR_PATH="/qsys.lib/${LIBRARY}.lib/${SRCPF}.file/${MEMBER}.mbr"
158
+
159
+ if run_ssh "test -e ${MBR_PATH}" 2>/dev/null; then
160
+ # Member exists — update source type in case it changed
161
+ log "Member ${MEMBER} exists, setting source type to ${SRCTYPE} ..."
162
+ if output=$(run_ssh "system \"CHGPFM FILE(${LIBRARY}/${SRCPF}) MBR(${MEMBER}) SRCTYPE(${SRCTYPE})\"" 2>&1); then
163
+ log "Updated source type for ${MEMBER}"
164
+ else
165
+ log "ERROR: Failed to update source type for ${MEMBER}"
166
+ echo "$output" | while IFS= read -r line; do log " $line"; done
167
+ FAILED=$((FAILED + 1))
168
+ continue
169
+ fi
170
+ else
171
+ # Member does not exist — create it
172
+ log "Creating member ${MEMBER} in ${SRCPF} ..."
173
+ if output=$(run_ssh "system \"ADDPFM FILE(${LIBRARY}/${SRCPF}) MBR(${MEMBER}) SRCTYPE(${SRCTYPE})\"" 2>&1); then
174
+ log "Created member ${MEMBER}"
175
+ else
176
+ log "ERROR: Failed to create member ${MEMBER}"
177
+ echo "$output" | while IFS= read -r line; do log " $line"; done
178
+ FAILED=$((FAILED + 1))
179
+ continue
180
+ fi
181
+ fi
182
+
183
+ # --- Write file content to member via Rfile ---
184
+ # Pipe the local file content through stdin to Rfile on the remote side.
185
+ # Rfile -Qw writes to the member using IBM i native naming: LIBRARY/FILE(MEMBER)
186
+ log "Writing ${FILE} to ${LIBRARY}/${SRCPF}(${MEMBER}) ..."
187
+ if output=$(cat "${FILE}" | run_ssh_piped "Rfile -Qw \"${LIBRARY}/${SRCPF}(${MEMBER})\"" 2>&1); then
188
+ log "Written ${MEMBER} successfully"
189
+ SUCCEEDED=$((SUCCEEDED + 1))
190
+ else
191
+ log "ERROR: Failed to write ${MEMBER}"
192
+ echo "$output" | while IFS= read -r line; do log " $line"; done
193
+ FAILED=$((FAILED + 1))
194
+ fi
195
+ done
196
+
197
+ # --- Summary ---
198
+ TOTAL=${#FILES[@]}
199
+ if [ ${FAILED} -eq 0 ]; then
200
+ log "Sync completed successfully (${TOTAL}/${TOTAL})"
201
+ else
202
+ log "Sync completed with errors (${SUCCEEDED}/${TOTAL} succeeded)"
203
+ exit 1
204
+ fi