Ð޸´ȫÏîĿÉó²éÎÊÌⲢ·¢²¼ v1.1.9

¸ÄÓñ¾»ú¶ÀÁ¢ CA£¬»ָ´ CLI TLS УÑ飬±£»¤ƾ¾ÝÓëÅäÖò¢·¢±£´档
Ð޸´ Cursor Êý¾ݡ¢»Ự·¾¶¡¢´úÀíÉúÃüÖÜÆڡ¢ģÐÍÇëÇóÓë Skills Îļþ²Ù×÷¡£
Ϊ¶ÀÁ¢ Tab ·þÎñÔö¼ӿͻ§¶˼øȨ£¬Éý¼¶ÒÀÀµÓ빤¾ßÁ´£¬ÍêÉƷ¢²¼ԪÐÅϢͬ²½¡£

Ñé֤£ºÁ½¸ö Go ģ¿éµIJâÊÔ/vet¡¢¹ؼüģ¿é race¡¢ǰ¶˲âÊÔ/Éú²ú¹¹½¨/Éó¼ơ¢
Go ¿ɴï©¶´ɨÃèÓë macOS/Linux ¿ÉÐÐģ¿齻²æ±àÒë¾ùͨ¹ý¡£
Windows ¸ôÀëÆô¶¯ͨ¹ý£»δÍê³ɵĵã»÷ðÑ̺ÍԭÉúƽ̨Ñé֤¼ûÉó²鱨¸档
This commit is contained in:
FuDie0915
2026-11-10 09:59:34 +08:00
parent db73cf5a39
commit 188225fae6
98 changed files with 3324 additions and 930 deletions

View File

@@ -14,6 +14,7 @@ import (
"time"
"cursor/internal/appdata"
"cursor/internal/securefile"
"github.com/lmittmann/tint"
"github.com/mattn/go-colorable"
@@ -50,7 +51,7 @@ func Init() {
if len(handlers) > 1 {
handler = &multiHandler{handlers: handlers}
}
slog.SetDefault(slog.New(handler))
slog.SetDefault(slog.New(redactingHandler{handler}))
stdlog.SetFlags(0)
if logFilePath != "" {
slog.Info("应用日志已写入文件", "path", logFilePath, "pid", os.Getpid())
@@ -180,10 +181,14 @@ func (writer *lineWindowFileWriter) Write(payload []byte) (int, error) {
}
func (writer *lineWindowFileWriter) openLocked() error {
file, err := os.OpenFile(writer.path, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0o644)
file, err := os.OpenFile(writer.path, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0o600)
if err != nil {
return err
}
if err := securefile.Protect(writer.path); err != nil {
file.Close()
return err
}
writer.file = file
logFile = file
return nil
@@ -204,7 +209,7 @@ func (writer *lineWindowFileWriter) trimToLastLinesLocked(targetLines int) error
return err
}
trimmed, lineCount := lastLinesBytes(payload, targetLines)
if err := os.WriteFile(writer.path, trimmed, 0o644); err != nil {
if err := os.WriteFile(writer.path, trimmed, 0o600); err != nil {
if reopenErr := writer.openLocked(); reopenErr != nil {
return errors.Join(err, reopenErr)
}