📝 Update script metadata and improve AI message handling logic

This commit is contained in:
2026-04-05 00:10:33 +08:00
parent 2cd8cf7150
commit f1983d35a0
3 changed files with 10 additions and 10 deletions

View File

@@ -138,11 +138,11 @@
},
"sync.rs": {
"script_name": "sync.rs",
"script_length": 2973,
"script_sha256": "a94a20258431e8dd7534e1078f9894de799a220f99b993ba9f2e56dc760804ea",
"script_length": 3026,
"script_sha256": "ed2cc2f3238ae892a2dc2bcf0c4b74485939f926242c50aa0d0e6affb8eec337",
"script_full_url": "https://git.hatter.ink/rust-scripts/scriptbase/raw/branch/main/sync-rs/src/main.rs",
"publish_time": 1737272563310,
"update_time": 1775318648698
"update_time": 1775319019530
},
"xattr.rs": {
"script_name": "xattr.rs",

View File

@@ -81,8 +81,8 @@
},
"sync-rs": {
"script_name": "sync-rs",
"script_length": 2973,
"script_sha256": "a94a20258431e8dd7534e1078f9894de799a220f99b993ba9f2e56dc760804ea"
"script_length": 3026,
"script_sha256": "ed2cc2f3238ae892a2dc2bcf0c4b74485939f926242c50aa0d0e6affb8eec337"
},
"xattr-rs": {
"script_name": "xattr-rs",

View File

@@ -32,11 +32,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.args(&["-c", r##"xh --ignore-stdin https://hatter.ink/ai/commit-summarize.json -f "Authorization:Bearer $(get-secret.ts --id ai-commit-summarize-token)" gitStatus="$(git status)" gitDiff="$(git diff)" | jq .data.summary -r"##])
.output()?;
let mut message = "auto sync".to_string();
information!("{:?}", ai_summarize_output);
if ai_summarize_output.status.success() {
if let Ok(summarized_message) = String::from_utf8(ai_summarize_output.stdout) {
success!("AI summarized message: {}", summarized_message);
message = summarized_message;
let trimmed_summarized_message = summarized_message.trim().to_string();
success!("AI summarized message: {}", trimmed_summarized_message);
message = trimmed_summarized_message;
} else {
warning!("AI summarized message is not UTF-8");
}
@@ -84,5 +84,5 @@ pub fn find_parents_exists_dir(dir: &str) -> Option<PathBuf> {
}
}
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260405T000314+08:00.MEYCIQCOflkXKihoc6wfiGml
// TObfzEuzkqKg3yEfU+swKk7aJgIhALHUGopxnHNXjSoWziiQt9U1xb8qGpamrsHdd20nrTjx
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260405T001005+08:00.MEUCIBhzMsJYPxHUITwCPoB5
// JxIUiRym6BFp4/1yvTBcxCNAAiEA1Eq79zvr+IkpnuIvgz+m5wEeEXqpCIu7moSX9qssaZY=