@useshifu/coding-harness 0.3.1 → 0.3.2
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/bin/shifu-harness.js +4 -3
- package/package.json +1 -1
package/bin/shifu-harness.js
CHANGED
|
@@ -42,6 +42,7 @@ const MAX_INTERVAL_HOURS = 720;
|
|
|
42
42
|
const SCHEDULER_TICK_MINUTES = 15;
|
|
43
43
|
const MAX_RETRIES = 4;
|
|
44
44
|
const MAX_WORK_FILE_BYTES = 5 * 1024 * 1024;
|
|
45
|
+
const WORK_FILE_SYNC_VERSION = 2;
|
|
45
46
|
const WORK_FILE_EXTENSIONS = new Set([".txt", ".md", ".rtf", ".docx"]);
|
|
46
47
|
const INPUT_FOLDER_README_NAME = "README.md";
|
|
47
48
|
const INPUT_FOLDER_README = `# Shifu sync folder
|
|
@@ -1048,7 +1049,7 @@ async function syncWorkFiles(harness, config = readConfig(harness)) {
|
|
|
1048
1049
|
if (typeof config.inputFolder !== "string") throw new Error("No input folder is configured. Run connect again to enable file sync.");
|
|
1049
1050
|
const folder = validateInputFolder(configuredInputFolder(config));
|
|
1050
1051
|
const state = readState(harness);
|
|
1051
|
-
const prior = state.workFiles?.folder === folder ? state.workFiles.files || {} : {};
|
|
1052
|
+
const prior = state.workFiles?.folder === folder && state.workFiles.version === WORK_FILE_SYNC_VERSION ? state.workFiles.files || {} : {};
|
|
1052
1053
|
let synced = 0;
|
|
1053
1054
|
let failures = 0;
|
|
1054
1055
|
for (const file of workFiles(folder)) {
|
|
@@ -1058,8 +1059,8 @@ async function syncWorkFiles(harness, config = readConfig(harness)) {
|
|
|
1058
1059
|
if (prior[name] === contents.sha256) continue;
|
|
1059
1060
|
const receipt = await postWorkFile(config, file, contents);
|
|
1060
1061
|
const latest = readState(harness);
|
|
1061
|
-
const files = latest.workFiles?.folder === folder ? latest.workFiles.files || {} : {};
|
|
1062
|
-
latest.workFiles = { folder, files: { ...files, [name]: contents.sha256 } };
|
|
1062
|
+
const files = latest.workFiles?.folder === folder && latest.workFiles.version === WORK_FILE_SYNC_VERSION ? latest.workFiles.files || {} : {};
|
|
1063
|
+
latest.workFiles = { folder, version: WORK_FILE_SYNC_VERSION, files: { ...files, [name]: contents.sha256 } };
|
|
1063
1064
|
saveState(harness, latest);
|
|
1064
1065
|
prior[name] = contents.sha256;
|
|
1065
1066
|
synced += 1;
|