@misterhuydo/sentinel 1.5.45 → 1.5.46
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.
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "1.5.
|
|
1
|
+
__version__ = "1.5.46"
|
|
@@ -120,6 +120,7 @@ class RepoConfig:
|
|
|
120
120
|
cicd_job_url: str = ""
|
|
121
121
|
cicd_user: str = "" # Jenkins username for Basic auth (defaults to "sentinel")
|
|
122
122
|
health_url: str = "" # optional: HTTP endpoint returning {"Status": "true"}
|
|
123
|
+
service_aliases: list[str] = field(default_factory=list) # short names that route to this repo (e.g. ["STS", "SecurityTokenService"])
|
|
123
124
|
cicd_token: str = ""
|
|
124
125
|
git_ssh_user_key: str = "" # personal GitHub SSH key (contributor on org repos)
|
|
125
126
|
git_ssh_deploy_key: str = "" # repo-specific deploy key (repos you own/admin)
|
|
@@ -345,6 +346,7 @@ class ConfigLoader:
|
|
|
345
346
|
r.cicd_user = d.get("CICD_USER", "")
|
|
346
347
|
r.cicd_token = d.get("CICD_TOKEN", "")
|
|
347
348
|
r.health_url = d.get("HEALTH_URL", "")
|
|
349
|
+
r.service_aliases = _csv(d.get("SERVICE_ALIASES", ""))
|
|
348
350
|
raw_user_key = d.get("GIT_SSH_USER_KEY", "")
|
|
349
351
|
raw_deploy_key = d.get("GIT_SSH_DEPLOY_KEY", "") or d.get("GIT_SSH_KEY", "") or d.get("SSH_KEY_FILE", "")
|
|
350
352
|
r.git_ssh_user_key = os.path.expanduser(raw_user_key) if raw_user_key else default_user_key
|
|
@@ -185,8 +185,9 @@ def _infer_target_repo(text: str, repos: dict, store=None) -> str:
|
|
|
185
185
|
"""
|
|
186
186
|
Try to infer a target repo from bot message content.
|
|
187
187
|
Checks in order:
|
|
188
|
-
1.
|
|
189
|
-
2.
|
|
188
|
+
1. SERVICE_ALIASES declared in repo config files (e.g. SERVICE_ALIASES=STS,SecurityTokenService)
|
|
189
|
+
2. Saved aliases in DB (learned at runtime via Boss conversation)
|
|
190
|
+
3. Case-insensitive substring match against repo names
|
|
190
191
|
Returns the repo name on a unique match, empty string otherwise.
|
|
191
192
|
"""
|
|
192
193
|
import re as _re
|
|
@@ -195,13 +196,22 @@ def _infer_target_repo(text: str, repos: dict, store=None) -> str:
|
|
|
195
196
|
|
|
196
197
|
for hint in hints:
|
|
197
198
|
hint_clean = hint.rstrip(".,:")
|
|
198
|
-
|
|
199
|
+
hint_lower = hint_clean.lower()
|
|
200
|
+
|
|
201
|
+
# 1. Config-declared SERVICE_ALIASES (authoritative, version-controlled)
|
|
202
|
+
for repo_name, repo in repos.items():
|
|
203
|
+
declared = getattr(repo, "service_aliases", [])
|
|
204
|
+
if any(hint_lower == a.lower() for a in declared):
|
|
205
|
+
return repo_name
|
|
206
|
+
|
|
207
|
+
# 2. Runtime DB aliases (learned via Boss conversation)
|
|
199
208
|
if store:
|
|
200
209
|
alias = store.get_service_alias(hint_clean)
|
|
201
210
|
if alias and alias in repos:
|
|
202
211
|
return alias
|
|
203
|
-
|
|
204
|
-
|
|
212
|
+
|
|
213
|
+
# 3. Case-insensitive substring match against repo names
|
|
214
|
+
sub_matches = [r for r in repos if hint_lower in r.lower()]
|
|
205
215
|
if len(sub_matches) == 1:
|
|
206
216
|
return sub_matches[0]
|
|
207
217
|
|