@misterhuydo/sentinel 1.0.24 → 1.0.26
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/.cairn/.hint-lock +1 -1
- package/.cairn/session.json +2 -2
- package/lib/generate.js +8 -4
- package/package.json +1 -1
- package/python/sentinel/__pycache__/fix_engine.cpython-313.pyc +0 -0
- package/python/sentinel/__pycache__/main.cpython-313.pyc +0 -0
- package/python/sentinel/fix_engine.py +13 -23
- package/python/sentinel/main.py +1 -1
package/.cairn/.hint-lock
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2026-03-21T19:
|
|
1
|
+
2026-03-21T19:49:49.891Z
|
package/.cairn/session.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"message": "Auto-checkpoint at 2026-03-
|
|
3
|
-
"checkpoint_at": "2026-03-
|
|
2
|
+
"message": "Auto-checkpoint at 2026-03-21T20:00:24.443Z",
|
|
3
|
+
"checkpoint_at": "2026-03-21T20:00:24.444Z",
|
|
4
4
|
"active_files": [],
|
|
5
5
|
"notes": [],
|
|
6
6
|
"mtime_snapshot": {}
|
package/lib/generate.js
CHANGED
|
@@ -107,10 +107,14 @@ function generateWorkspaceScripts(workspace, smtpConfig = {}, slackConfig = {})
|
|
|
107
107
|
// Always upsert Slack tokens so re-runs persist them
|
|
108
108
|
if (slackConfig.botToken || slackConfig.appToken) {
|
|
109
109
|
let props = fs.readFileSync(workspaceProps, 'utf8');
|
|
110
|
-
if (slackConfig.botToken)
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
if (slackConfig.botToken) {
|
|
111
|
+
const replaced = props.replace(/^#?\s*SLACK_BOT_TOKEN=.*/m, 'SLACK_BOT_TOKEN=' + slackConfig.botToken);
|
|
112
|
+
props = replaced !== props ? replaced : props.trimEnd() + '\nSLACK_BOT_TOKEN=' + slackConfig.botToken + '\n';
|
|
113
|
+
}
|
|
114
|
+
if (slackConfig.appToken) {
|
|
115
|
+
const replaced = props.replace(/^#?\s*SLACK_APP_TOKEN=.*/m, 'SLACK_APP_TOKEN=' + slackConfig.appToken);
|
|
116
|
+
props = replaced !== props ? replaced : props.trimEnd() + '\nSLACK_APP_TOKEN=' + slackConfig.appToken + '\n';
|
|
117
|
+
}
|
|
114
118
|
fs.writeFileSync(workspaceProps, props);
|
|
115
119
|
}
|
|
116
120
|
// startAll.sh
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
@@ -29,46 +29,37 @@ _DIFF_HEADER = re.compile(r"^diff --git|^---\s+\S+|^\+\+\+\s+\S+", re.MULTILINE)
|
|
|
29
29
|
def _build_prompt(event, repo: RepoConfig, log_file, marker: str, stale_markers: list[str] = None) -> str:
|
|
30
30
|
if log_file and log_file.exists():
|
|
31
31
|
ctx = (
|
|
32
|
-
"LOG FILE: " + str(log_file) + "
|
|
33
|
-
"
|
|
32
|
+
"LOG FILE: " + str(log_file) + "\n"
|
|
34
33
|
"Read this file first -- it contains the last 48h of logs from "
|
|
35
|
-
+ event.source + "
|
|
36
|
-
"
|
|
34
|
+
+ event.source + ".\n"
|
|
37
35
|
"Use it to understand frequency, context, and preceding warnings."
|
|
38
36
|
)
|
|
39
37
|
step1 = "Read the log file above to understand what led up to this error."
|
|
40
38
|
else:
|
|
41
39
|
ctx = (
|
|
42
|
-
"SOURCE: " + event.source + "
|
|
43
|
-
"
|
|
40
|
+
"SOURCE: " + event.source + "\n"
|
|
44
41
|
"No rolling log file available. The full issue description is below."
|
|
45
42
|
)
|
|
46
43
|
step1 = "Use the issue description above as your primary context."
|
|
47
44
|
|
|
48
45
|
marker_label = marker + " sentinel-auto-fix [safe to remove after verification]"
|
|
49
|
-
marker_instruction = "
|
|
50
|
-
".join([
|
|
46
|
+
marker_instruction = "\n".join([
|
|
51
47
|
"For EVERY method and constructor you modify, add this as the FIRST executable line:",
|
|
52
|
-
f
|
|
53
|
-
f
|
|
54
|
-
f
|
|
48
|
+
f' Java/Kotlin : log.info("{marker_label}");',
|
|
49
|
+
f' Python : logger.info("{marker_label}")',
|
|
50
|
+
f' Node.js : logger.info("{marker_label}")',
|
|
55
51
|
"Use the logger already present in the file. Do not add new imports.",
|
|
56
52
|
"This applies to ALL modified methods and constructors without exception.",
|
|
57
53
|
])
|
|
58
54
|
|
|
59
55
|
cleanup = ""
|
|
60
56
|
if stale_markers:
|
|
61
|
-
marker_list = "
|
|
62
|
-
".join(f" - {m}" for m in stale_markers)
|
|
57
|
+
marker_list = "\n".join(f" - {m}" for m in stale_markers)
|
|
63
58
|
cleanup = (
|
|
64
|
-
"CLEANUP (do this first, before the fix)
|
|
65
|
-
"
|
|
66
|
-
|
|
67
|
-
"
|
|
68
|
-
+ marker_list + "
|
|
69
|
-
"
|
|
70
|
-
"Commit the cleanup separately with message: 'chore(sentinel): remove stale markers'
|
|
71
|
-
"
|
|
59
|
+
"CLEANUP (do this first, before the fix):\n"
|
|
60
|
+
"Remove any log lines containing these stale Sentinel markers from the codebase:\n"
|
|
61
|
+
+ marker_list + "\n"
|
|
62
|
+
"Commit the cleanup separately with message: 'chore(sentinel): remove stale markers'\n"
|
|
72
63
|
)
|
|
73
64
|
|
|
74
65
|
lines_out = [
|
|
@@ -92,8 +83,7 @@ def _build_prompt(event, repo: RepoConfig, log_file, marker: str, stale_markers:
|
|
|
92
83
|
"5. Do not explain. Output only the patch.",
|
|
93
84
|
"6. If you cannot determine a safe fix, output: SKIP: <reason>",
|
|
94
85
|
]
|
|
95
|
-
return "
|
|
96
|
-
".join(lines_out)
|
|
86
|
+
return "\n".join(lines_out)
|
|
97
87
|
|
|
98
88
|
def _validate_patch(patch: str) -> tuple[bool, str]:
|
|
99
89
|
files_changed = len(re.findall(r"^diff --git", patch, re.MULTILINE))
|
package/python/sentinel/main.py
CHANGED
|
@@ -19,7 +19,7 @@ from datetime import datetime, timezone
|
|
|
19
19
|
from pathlib import Path
|
|
20
20
|
|
|
21
21
|
from .cairn_client import ensure_installed as cairn_installed, index_repo
|
|
22
|
-
from .config_loader import ConfigLoader
|
|
22
|
+
from .config_loader import ConfigLoader, SentinelConfig
|
|
23
23
|
from .fix_engine import generate_fix
|
|
24
24
|
from .git_manager import apply_and_commit, publish
|
|
25
25
|
from .cicd_trigger import trigger as cicd_trigger
|