dsh-tg-bridge 1.43.0 → 1.43.1
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/core/state.mjs +16 -1
- package/docs/CHANGELOG.md +13 -0
- package/package.json +1 -1
package/core/state.mjs
CHANGED
|
@@ -47,8 +47,23 @@ export function writeAtomic(path, text) {
|
|
|
47
47
|
renameSync(tmp, path);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
/**
|
|
51
|
+
* Persist `state`. Best effort on purpose.
|
|
52
|
+
*
|
|
53
|
+
* Remembering a card's rows is a convenience: the card already reached the
|
|
54
|
+
* person, and a missing or unwritable state file must not turn a finished
|
|
55
|
+
* command into an error. Every command used to decide this for itself, so a
|
|
56
|
+
* fresh machine without `~/.dsh/tg-bridge` made `/ls` die in CI while the same
|
|
57
|
+
* code passed on a machine that had the folder.
|
|
58
|
+
*/
|
|
50
59
|
export function saveState() {
|
|
51
|
-
|
|
60
|
+
try {
|
|
61
|
+
writeAtomic(STATE, JSON.stringify(state, null, 2));
|
|
62
|
+
return true;
|
|
63
|
+
} catch (error) {
|
|
64
|
+
log(`state save failed [STATE]: ${error?.code || error?.message || 'unknown'}`);
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
52
67
|
}
|
|
53
68
|
|
|
54
69
|
export function log(line) {
|
package/docs/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# CHANGELOG — DSH Telegram bridge
|
|
2
2
|
|
|
3
|
+
## 1.43.1
|
|
4
|
+
|
|
5
|
+
- **A state file that cannot be written no longer fails the command.** 1.43.0
|
|
6
|
+
shipped `/ls` and `/view` calling `saveState()` directly, and on a machine
|
|
7
|
+
that has never run the bridge — CI's clean home, or a fresh install — the
|
|
8
|
+
atomic write throws before the card can be drawn. Remembering a card's rows is
|
|
9
|
+
a convenience: the card already reached the person, so the save now logs
|
|
10
|
+
`state save failed [STATE]` and lets the command finish. This was invisible
|
|
11
|
+
locally because the developer machine has that folder.
|
|
12
|
+
- The bug is covered by a test that points `DSH_HOME` at an empty directory, so
|
|
13
|
+
the clean-machine answer is checked instead of assumed.
|
|
14
|
+
- Nothing else changed: same commands, same behaviour on a machine that works.
|
|
15
|
+
|
|
3
16
|
## 1.43.0
|
|
4
17
|
|
|
5
18
|
- **Read the folder from the chat: `/ls` and `/view`.** Until now the only way
|