@ngockhoale/ukit 3.4.76 → 3.4.78

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.
@@ -47,6 +47,18 @@ const GIT_MUTATION = /^git\s+(?:push|commit|clean|reset|merge|rebase|stash|tag|c
47
47
  const GIT_VERB = /^git\s+(push|commit|clean|reset|merge|rebase|stash|tag|checkout|restore|pull|cherry-pick|branch)\b/;
48
48
  const GIT_STATE = /^git\s+(?:fsck\b|diff\s+(?:--check|--exit-code|--quiet)\b|status\s+(?:--porcelain|-s|--short)\b)/;
49
49
  const SERVICE_MUTATION = /^(?:docker(?:\s+compose)?|docker-compose)\s+(?:restart|up|down|stop|start|build)\b|^(?:sudo\s+)?systemctl\s+(?:restart|start|stop|reload)\b|^pm2\s+(?:restart|reload|start)\b|^kubectl\s+(?:rollout|apply)\b|^launchctl\s+kickstart\b|^(?:\.\/)?(?:scripts\/)?deploy[\w.-]*(?:\s|$)|^(?:npm|yarn|pnpm)\s+(?:run\s+)?deploy\b/;
50
+ // A native deploy script named by the owner prompt (e.g. `bash sync_server.sh`). The name is validated as a
51
+ // bare script file name and regex-escaped; only `[bash|sh] [./][dir/]<name>` followed by args counts.
52
+ const DEPLOY_SCRIPT_NAME = /^[\w.-]+\.sh$/;
53
+ function invokesDeployScript(segment, deployCommand) {
54
+ if (typeof deployCommand !== 'string' || !DEPLOY_SCRIPT_NAME.test(deployCommand) || deployCommand.length > 64) return false;
55
+ const escaped = deployCommand.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
56
+ const match = new RegExp(`^(?:(?:bash|sh)\\s+)?(?:\\./)?(?:[\\w.-]+/)*${escaped}(?:\\s+([\\s\\S]*))?$`).exec(segment.trim());
57
+ if (!match) return false;
58
+ // Informational invocations (--help/-h/--status/--version/--dry-run only) change nothing.
59
+ const args = (match[1] || '').trim().split(/\s+/).filter(Boolean);
60
+ return !(args.length > 0 && args.every((a) => /^(?:--help|-h|--status|--version|--dry-run)$/.test(a)));
61
+ }
50
62
  // Remote authority, not stale tracking refs: gate binds sha to clean live HEAD/tracking
51
63
  // remote. Native mutation success remains a separate requirement.
52
64
  const GIT_LS_REMOTE = /^git\s+ls-remote\s+(\S+)\s+(refs\/heads\/\S+)\s*$/;
@@ -157,7 +169,7 @@ export function bashOperationReceipt(rawCommand, response, transportSuccess, goa
157
169
  role = 'mutation';
158
170
  target = seg.match(GIT_VERB)[1];
159
171
  }
160
- } else if (SERVICE_MUTATION.test(seg) && role !== 'state') {
172
+ } else if ((SERVICE_MUTATION.test(seg) || invokesDeployScript(seg, goal.deployCommand)) && role !== 'state') {
161
173
  role = 'mutation';
162
174
  target = requiredTargetOf(seg, required);
163
175
  } else if (CURL.test(seg)) {