@tenonhq/dovetail-core 0.0.85

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.
Files changed (78) hide show
  1. package/README.md +6 -0
  2. package/dist/FileLogger.js +207 -0
  3. package/dist/FileUtils.js +387 -0
  4. package/dist/Logger.js +88 -0
  5. package/dist/MultiScopeWatcher.js +615 -0
  6. package/dist/PluginManager.js +125 -0
  7. package/dist/_defaultOptionsOLD.js +44 -0
  8. package/dist/allScopesCommands.js +418 -0
  9. package/dist/appUtils.js +929 -0
  10. package/dist/benchmark.js +104 -0
  11. package/dist/bootstrap.js +62 -0
  12. package/dist/claudeCommand.js +60 -0
  13. package/dist/clickupCommands.js +472 -0
  14. package/dist/clickupPushHelper.js +33 -0
  15. package/dist/commander.js +466 -0
  16. package/dist/commands.js +378 -0
  17. package/dist/config.js +697 -0
  18. package/dist/constants.js +15 -0
  19. package/dist/createRecordCommand.js +314 -0
  20. package/dist/dashboardCommand.js +38 -0
  21. package/dist/defaultOptions.js +14 -0
  22. package/dist/deleteRecordCommand.js +282 -0
  23. package/dist/flowDesigner/values.js +55 -0
  24. package/dist/genericUtils.js +189 -0
  25. package/dist/gitUtils.js +99 -0
  26. package/dist/index.js +35 -0
  27. package/dist/initSystem/corePlugin.js +344 -0
  28. package/dist/initSystem/discovery.js +107 -0
  29. package/dist/initSystem/orchestrator.js +408 -0
  30. package/dist/logMessages.js +82 -0
  31. package/dist/loginCommand.js +20 -0
  32. package/dist/migrateCommand.js +123 -0
  33. package/dist/projectFiles.js +32 -0
  34. package/dist/recentEdits.js +66 -0
  35. package/dist/schemaCommand.js +85 -0
  36. package/dist/snClient.js +519 -0
  37. package/dist/tests/benchmarkRefresh.test.js +265 -0
  38. package/dist/tests/clickupCommands.test.js +384 -0
  39. package/dist/tests/clickupPushHelper.test.js +124 -0
  40. package/dist/tests/configFallback.test.js +68 -0
  41. package/dist/tests/cred.test.js +59 -0
  42. package/dist/tests/discovery.test.js +67 -0
  43. package/dist/tests/ensureUpdateSetWarnings.test.js +218 -0
  44. package/dist/tests/errorLogLevels.test.js +273 -0
  45. package/dist/tests/example.test.js +6 -0
  46. package/dist/tests/fileContextSkipReason.test.js +116 -0
  47. package/dist/tests/globalDebounce.test.js +308 -0
  48. package/dist/tests/migrateCommand.test.js +113 -0
  49. package/dist/tests/multi-scope-watcher.test.js +558 -0
  50. package/dist/tests/orchestrator.test.js +23 -0
  51. package/dist/tests/pushFiles.test.js +248 -0
  52. package/dist/tests/rateLimitCoordination.test.js +271 -0
  53. package/dist/tests/resolveConfigReadOnly.test.js +67 -0
  54. package/dist/tests/retryOnHttpErr.test.js +154 -0
  55. package/dist/tests/scopeCaching.test.js +115 -0
  56. package/dist/tests/serializeUpdateSetConfig.test.js +325 -0
  57. package/dist/tests/snClient.fallback.test.js +120 -0
  58. package/dist/tests/syncManifestRefresh.test.js +287 -0
  59. package/dist/tests/syncManifestWhitelist.test.js +192 -0
  60. package/dist/tests/taskClear.test.js +170 -0
  61. package/dist/tests/taskStaleness.test.js +220 -0
  62. package/dist/tests/unwrapSNResponseError.test.js +145 -0
  63. package/dist/tests/v2Values.test.js +79 -0
  64. package/dist/tests/validateTaskId.test.js +304 -0
  65. package/dist/tests/verifyUpdateSetSwitch.test.js +277 -0
  66. package/dist/tests/writeEnvVar.test.js +119 -0
  67. package/dist/updateSetCommands.js +702 -0
  68. package/dist/wizard.js +40 -0
  69. package/package.json +69 -0
  70. package/skills/dove-configure-pipeline.md +158 -0
  71. package/skills/dove-create-plugin.md +174 -0
  72. package/skills/dove-create-record.md +135 -0
  73. package/skills/dove-debug-build.md +117 -0
  74. package/skills/dove-delete-record.md +104 -0
  75. package/skills/dove-manage-tables.md +174 -0
  76. package/skills/dove-manage-update-sets.md +88 -0
  77. package/skills/dove-setup-project.md +154 -0
  78. package/skills/dove-troubleshoot-sync.md +113 -0
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const fs_1 = __importDefault(require("fs"));
7
+ const path_1 = __importDefault(require("path"));
8
+ const os_1 = __importDefault(require("os"));
9
+ const FileUtils_1 = require("../FileUtils");
10
+ describe("writeEnvVar", function () {
11
+ let tmpDir;
12
+ let envPath;
13
+ beforeEach(function () {
14
+ tmpDir = fs_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), "sinc-test-"));
15
+ envPath = path_1.default.join(tmpDir, ".env");
16
+ });
17
+ afterEach(function () {
18
+ try {
19
+ fs_1.default.rmSync(tmpDir, { recursive: true });
20
+ }
21
+ catch (e) {
22
+ // cleanup best-effort
23
+ }
24
+ });
25
+ it("creates a new .env file from scratch", function () {
26
+ (0, FileUtils_1.writeEnvVar)({ key: "FOO", value: "bar", envPath });
27
+ const content = fs_1.default.readFileSync(envPath, "utf8");
28
+ expect(content).toBe("FOO=bar\n");
29
+ });
30
+ it("replaces an existing key", function () {
31
+ fs_1.default.writeFileSync(envPath, "FOO=old\nBAR=keep\n", "utf8");
32
+ (0, FileUtils_1.writeEnvVar)({ key: "FOO", value: "new", envPath });
33
+ const content = fs_1.default.readFileSync(envPath, "utf8");
34
+ expect(content).toContain("FOO=new");
35
+ expect(content).toContain("BAR=keep");
36
+ expect(content).not.toContain("FOO=old");
37
+ });
38
+ it("appends a new key without clobbering existing ones", function () {
39
+ fs_1.default.writeFileSync(envPath, "EXISTING=value\n", "utf8");
40
+ (0, FileUtils_1.writeEnvVar)({ key: "NEW_KEY", value: "new_value", envPath });
41
+ const content = fs_1.default.readFileSync(envPath, "utf8");
42
+ expect(content).toContain("EXISTING=value");
43
+ expect(content).toContain("NEW_KEY=new_value");
44
+ });
45
+ it("handles file with no trailing newline", function () {
46
+ fs_1.default.writeFileSync(envPath, "A=1", "utf8");
47
+ (0, FileUtils_1.writeEnvVar)({ key: "B", value: "2", envPath });
48
+ const content = fs_1.default.readFileSync(envPath, "utf8");
49
+ expect(content).toContain("A=1");
50
+ expect(content).toContain("B=2");
51
+ // Should not produce "A=1B=2" on one line
52
+ const lines = content.trim().split("\n");
53
+ expect(lines.length).toBe(2);
54
+ });
55
+ it("handles keys with regex metacharacters", function () {
56
+ fs_1.default.writeFileSync(envPath, "MY.KEY[0]=old\n", "utf8");
57
+ (0, FileUtils_1.writeEnvVar)({ key: "MY.KEY[0]", value: "new", envPath });
58
+ const content = fs_1.default.readFileSync(envPath, "utf8");
59
+ expect(content).toContain("MY.KEY[0]=new");
60
+ expect(content).not.toContain("MY.KEY[0]=old");
61
+ // Should not have duplicates
62
+ const matches = content.match(/MY\.KEY\[0\]/g);
63
+ expect(matches).toHaveLength(1);
64
+ });
65
+ });
66
+ describe("writeEnvVars", function () {
67
+ let tmpDir;
68
+ let envPath;
69
+ beforeEach(function () {
70
+ tmpDir = fs_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), "sinc-test-"));
71
+ envPath = path_1.default.join(tmpDir, ".env");
72
+ });
73
+ afterEach(function () {
74
+ try {
75
+ fs_1.default.rmSync(tmpDir, { recursive: true });
76
+ }
77
+ catch (e) {
78
+ // cleanup best-effort
79
+ }
80
+ });
81
+ it("writes multiple vars in a single call", function () {
82
+ (0, FileUtils_1.writeEnvVars)({
83
+ vars: [
84
+ { key: "A", value: "1" },
85
+ { key: "B", value: "2" },
86
+ { key: "C", value: "3" },
87
+ ],
88
+ envPath,
89
+ });
90
+ const content = fs_1.default.readFileSync(envPath, "utf8");
91
+ expect(content).toContain("A=1");
92
+ expect(content).toContain("B=2");
93
+ expect(content).toContain("C=3");
94
+ });
95
+ it("merges into existing file preserving unrelated keys", function () {
96
+ fs_1.default.writeFileSync(envPath, "KEEP=yes\nUPDATE=old\n", "utf8");
97
+ (0, FileUtils_1.writeEnvVars)({
98
+ vars: [
99
+ { key: "UPDATE", value: "new" },
100
+ { key: "ADDED", value: "fresh" },
101
+ ],
102
+ envPath,
103
+ });
104
+ const content = fs_1.default.readFileSync(envPath, "utf8");
105
+ expect(content).toContain("KEEP=yes");
106
+ expect(content).toContain("UPDATE=new");
107
+ expect(content).toContain("ADDED=fresh");
108
+ expect(content).not.toContain("UPDATE=old");
109
+ });
110
+ it("handles empty file", function () {
111
+ fs_1.default.writeFileSync(envPath, "", "utf8");
112
+ (0, FileUtils_1.writeEnvVars)({
113
+ vars: [{ key: "X", value: "y" }],
114
+ envPath,
115
+ });
116
+ const content = fs_1.default.readFileSync(envPath, "utf8");
117
+ expect(content).toBe("X=y\n");
118
+ });
119
+ });