@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,33 @@
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
+ exports.resolveClickUpForPush = resolveClickUpForPush;
7
+ const dovetail_clickup_1 = require("@tenonhq/dovetail-clickup");
8
+ const clickupCommands_1 = require("./clickupCommands");
9
+ const Logger_1 = require("./Logger");
10
+ const chalk_1 = __importDefault(require("chalk"));
11
+ /**
12
+ * @description Resolves a ClickUp task identifier into an update set name for the push command.
13
+ * @param clickupIdentifier - A ClickUp task ID or URL.
14
+ * @returns The resolved update set name.
15
+ */
16
+ async function resolveClickUpForPush(clickupIdentifier) {
17
+ var token = process.env.CLICKUP_API_TOKEN;
18
+ if (!token || token === "") {
19
+ throw new Error("CLICKUP_API_TOKEN not set. Run 'dove clickup setup' or add it to your .env file.");
20
+ }
21
+ var parsed = (0, dovetail_clickup_1.parseClickUpIdentifier)(clickupIdentifier);
22
+ Logger_1.logger.info("Fetching ClickUp task: " + parsed.taskId + "...");
23
+ var api = (0, dovetail_clickup_1.createClickUpApi)({ token: token });
24
+ var task = await api.getTask({ taskId: parsed.taskId });
25
+ Logger_1.logger.success(chalk_1.default.green('✓ Found: "' + task.name + '"'));
26
+ var name = (0, clickupCommands_1.refineUpdateSetName)({
27
+ taskName: task.name,
28
+ taskId: task.id,
29
+ taskDescription: task.description || "",
30
+ });
31
+ Logger_1.logger.success(chalk_1.default.green('✓ Update set name: "' + name + '"'));
32
+ return name;
33
+ }
@@ -0,0 +1,466 @@
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
+ exports.initCommands = initCommands;
7
+ const commands_1 = require("./commands");
8
+ const allScopesCommands_1 = require("./allScopesCommands");
9
+ const updateSetCommands_1 = require("./updateSetCommands");
10
+ const dashboardCommand_1 = require("./dashboardCommand");
11
+ const schemaCommand_1 = require("./schemaCommand");
12
+ const claudeCommand_1 = require("./claudeCommand");
13
+ const createRecordCommand_1 = require("./createRecordCommand");
14
+ const deleteRecordCommand_1 = require("./deleteRecordCommand");
15
+ const migrateCommand_1 = require("./migrateCommand");
16
+ const clickupCommands_1 = require("./clickupCommands");
17
+ const loginCommand_1 = require("./loginCommand");
18
+ const yargs_1 = __importDefault(require("yargs"));
19
+ async function initCommands() {
20
+ const sharedOptions = {
21
+ logLevel: {
22
+ default: "info",
23
+ },
24
+ };
25
+ yargs_1.default
26
+ .command(["watch", "w", "watchAllScopes"], "Watch all scopes for file changes and sync to ServiceNow", (cmdArgs) => {
27
+ cmdArgs.options({
28
+ ...sharedOptions,
29
+ noDashboard: {
30
+ type: "boolean",
31
+ default: false,
32
+ describe: "Skip launching the dashboard web UI",
33
+ },
34
+ port: {
35
+ alias: "p",
36
+ type: "number",
37
+ describe: "Dashboard port (default: DASHBOARD_PORT env or 3456)",
38
+ },
39
+ monitorInterval: {
40
+ type: "number",
41
+ default: 120,
42
+ describe: "Update set monitoring interval in seconds (default: 120)",
43
+ },
44
+ noMonitoring: {
45
+ type: "boolean",
46
+ default: false,
47
+ describe: "Disable background update set monitoring",
48
+ },
49
+ });
50
+ return cmdArgs;
51
+ }, async (args) => {
52
+ await (0, allScopesCommands_1.watchAllScopesCommand)(args);
53
+ })
54
+ .command(["refresh", "r"], "Pull latest manifest and file contents from the ServiceNow instance", (cmdArgs) => {
55
+ cmdArgs.options({
56
+ ...sharedOptions,
57
+ force: {
58
+ alias: "f",
59
+ type: "boolean",
60
+ default: false,
61
+ describe: "Overwrite local files even when content matches the instance",
62
+ },
63
+ scope: {
64
+ alias: "s",
65
+ type: "string",
66
+ describe: "Refresh a single scope (default: all declared scopes)",
67
+ },
68
+ benchmark: {
69
+ alias: "b",
70
+ type: "boolean",
71
+ default: false,
72
+ describe: "Log per-scope and aggregate HTTP latency, bytes, and file counts",
73
+ },
74
+ });
75
+ return cmdArgs;
76
+ }, async (args) => {
77
+ await (0, commands_1.refreshCommand)(args);
78
+ })
79
+ .command(["push [target]"], "[DESTRUCTIVE] Push all files from current local files to ServiceNow instance.", (cmdArgs) => {
80
+ cmdArgs.options({
81
+ ...sharedOptions,
82
+ diff: {
83
+ alias: "d",
84
+ type: "string",
85
+ default: "",
86
+ describe: "Specify branch to do git diff against",
87
+ },
88
+ updateSet: {
89
+ alias: "us",
90
+ type: "string",
91
+ default: "",
92
+ describe: "Will create a new update set with the provided anme to store all changes into",
93
+ },
94
+ clickup: {
95
+ alias: "cu",
96
+ type: "string",
97
+ describe: "ClickUp task ID or URL — creates update set from ClickUp task data",
98
+ },
99
+ ci: {
100
+ type: "boolean",
101
+ default: false,
102
+ describe: "Will skip confirmation prompts during the push process",
103
+ },
104
+ });
105
+ return cmdArgs;
106
+ }, async (args) => {
107
+ await (0, commands_1.pushCommand)(args);
108
+ })
109
+ .command("download <scope>", "Downloads a scoped application's files from ServiceNow. Must specify a scope prefix for a scoped app.", sharedOptions, async (args) => {
110
+ await (0, commands_1.downloadCommand)(args);
111
+ })
112
+ .command("init", "Set up Dovetail — discovers installed packages, authenticates, and configures your project", sharedOptions, commands_1.initCommand)
113
+ .command("login [plugin]", "Authenticate with ServiceNow and other integrations", function (cmdArgs) {
114
+ cmdArgs.positional("plugin", {
115
+ describe: "Plugin name to login (e.g., clickup). Omit for ServiceNow only.",
116
+ type: "string",
117
+ });
118
+ cmdArgs.options({
119
+ ...sharedOptions,
120
+ all: {
121
+ type: "boolean",
122
+ default: false,
123
+ describe: "Login to all detected integrations",
124
+ },
125
+ instance: {
126
+ type: "string",
127
+ describe: "ServiceNow instance URL (non-interactive)",
128
+ },
129
+ user: {
130
+ type: "string",
131
+ describe: "ServiceNow username (non-interactive)",
132
+ },
133
+ password: {
134
+ type: "string",
135
+ describe: "ServiceNow password (non-interactive)",
136
+ },
137
+ });
138
+ return cmdArgs;
139
+ }, loginCommand_1.loginCommand)
140
+ .command("initScopes", "Provisions an initial project for the scopes defined in the config", {
141
+ ...sharedOptions,
142
+ delay: {
143
+ alias: "d",
144
+ type: "number",
145
+ default: 0,
146
+ describe: "Delay in milliseconds between API calls (to prevent server overload)",
147
+ },
148
+ }, allScopesCommands_1.initScopesCommand)
149
+ .command("build", "Build application files locally", (cmdArgs) => {
150
+ cmdArgs.options({
151
+ ...sharedOptions,
152
+ diff: {
153
+ alias: "d",
154
+ type: "string",
155
+ default: "",
156
+ describe: "Specify branch to do git diff against",
157
+ },
158
+ });
159
+ return cmdArgs;
160
+ }, async (args) => {
161
+ await (0, commands_1.buildCommand)(args);
162
+ })
163
+ .command("deploy", "Deploy local build files to the scoped application", sharedOptions, commands_1.deployCommand)
164
+ .command("create <table>", "Create a new record on the ServiceNow instance", (cmdArgs) => {
165
+ cmdArgs.positional("table", {
166
+ describe: "ServiceNow table name (e.g., sys_script_include)",
167
+ type: "string",
168
+ });
169
+ cmdArgs.options({
170
+ ...sharedOptions,
171
+ name: {
172
+ alias: "n",
173
+ type: "string",
174
+ describe: "Record name",
175
+ },
176
+ scope: {
177
+ alias: "s",
178
+ type: "string",
179
+ describe: "Target scope (e.g., x_cadso_core)",
180
+ },
181
+ from: {
182
+ alias: "f",
183
+ type: "string",
184
+ describe: "Path to JSON file with field values",
185
+ },
186
+ field: {
187
+ type: "array",
188
+ describe: "Field values as key=value pairs (e.g., --field active=true)",
189
+ },
190
+ ci: {
191
+ type: "boolean",
192
+ default: false,
193
+ describe: "Skip interactive prompts",
194
+ },
195
+ });
196
+ return cmdArgs;
197
+ }, createRecordCommand_1.createRecordCommand)
198
+ .command("delete <table> [name]", "Delete a record from the ServiceNow instance", (cmdArgs) => {
199
+ cmdArgs.positional("table", {
200
+ describe: "ServiceNow table name (e.g., sys_script_include)",
201
+ type: "string",
202
+ });
203
+ cmdArgs.positional("name", {
204
+ describe: "Record name to delete",
205
+ type: "string",
206
+ });
207
+ cmdArgs.options({
208
+ ...sharedOptions,
209
+ scope: {
210
+ alias: "s",
211
+ type: "string",
212
+ describe: "Target scope (e.g., x_cadso_core)",
213
+ },
214
+ sysid: {
215
+ type: "string",
216
+ describe: "Delete by sys_id directly (skip manifest lookup)",
217
+ },
218
+ ci: {
219
+ type: "boolean",
220
+ default: false,
221
+ describe: "Skip confirmation prompt",
222
+ },
223
+ keepLocal: {
224
+ type: "boolean",
225
+ default: false,
226
+ describe: "Keep local files after deleting from instance",
227
+ },
228
+ });
229
+ return cmdArgs;
230
+ }, deleteRecordCommand_1.deleteRecordCommand)
231
+ .command("status", "Get information about the connected instance", sharedOptions, commands_1.statusCommand)
232
+ .command("createUpdateSet", "Create a new update set and switch to it", (cmdArgs) => {
233
+ cmdArgs.options({
234
+ ...sharedOptions,
235
+ name: {
236
+ alias: "n",
237
+ type: "string",
238
+ describe: "Name of the update set to create",
239
+ },
240
+ description: {
241
+ alias: "d",
242
+ type: "string",
243
+ describe: "Description of the update set",
244
+ },
245
+ scope: {
246
+ alias: "s",
247
+ type: "string",
248
+ describe: "Scope for the update set (e.g., x_company_app)",
249
+ },
250
+ skipDescription: {
251
+ type: "boolean",
252
+ default: false,
253
+ describe: "Skip prompting for description",
254
+ },
255
+ skipScope: {
256
+ type: "boolean",
257
+ default: false,
258
+ describe: "Skip prompting for scope",
259
+ },
260
+ clickup: {
261
+ alias: "cu",
262
+ type: "string",
263
+ describe: "ClickUp task ID or URL to generate update set name and description from",
264
+ },
265
+ });
266
+ return cmdArgs;
267
+ }, updateSetCommands_1.createUpdateSetCommand)
268
+ .command("switchUpdateSet", "Switch to an existing update set", (cmdArgs) => {
269
+ cmdArgs.options({
270
+ ...sharedOptions,
271
+ name: {
272
+ alias: "n",
273
+ type: "string",
274
+ describe: "Name or partial name of the update set to switch to",
275
+ },
276
+ scope: {
277
+ alias: "s",
278
+ type: "string",
279
+ describe: "Filter update sets by scope",
280
+ },
281
+ });
282
+ return cmdArgs;
283
+ }, updateSetCommands_1.switchUpdateSetCommand)
284
+ .command("listUpdateSets", "List all in-progress update sets", (cmdArgs) => {
285
+ cmdArgs.options({
286
+ ...sharedOptions,
287
+ scope: {
288
+ alias: "s",
289
+ type: "string",
290
+ describe: "Filter update sets by scope",
291
+ },
292
+ });
293
+ return cmdArgs;
294
+ }, updateSetCommands_1.listUpdateSetsCommand)
295
+ .command("currentUpdateSet", "Show the current active update set", (cmdArgs) => {
296
+ cmdArgs.options({
297
+ ...sharedOptions,
298
+ scope: {
299
+ alias: "s",
300
+ type: "string",
301
+ describe: "Scope to check update set for",
302
+ },
303
+ });
304
+ return cmdArgs;
305
+ }, updateSetCommands_1.showCurrentUpdateSetCommand)
306
+ .command("changeScope", "Change to a different scope", (cmdArgs) => {
307
+ cmdArgs.options({
308
+ ...sharedOptions,
309
+ scope: {
310
+ alias: "s",
311
+ type: "string",
312
+ describe: "Scope to switch to (e.g., x_cadso_core)",
313
+ },
314
+ });
315
+ return cmdArgs;
316
+ }, updateSetCommands_1.changeScopeCommand)
317
+ .command("currentScope", "Show the current active scope", (cmdArgs) => {
318
+ cmdArgs.options({
319
+ ...sharedOptions,
320
+ });
321
+ return cmdArgs;
322
+ }, updateSetCommands_1.showCurrentScopeCommand)
323
+ .command("dashboard", "Launch the Update Set Dashboard web UI", (cmdArgs) => {
324
+ cmdArgs.options({
325
+ ...sharedOptions,
326
+ port: {
327
+ alias: "p",
328
+ type: "number",
329
+ describe: "Dashboard port (default: DASHBOARD_PORT env or 3456)",
330
+ },
331
+ });
332
+ return cmdArgs;
333
+ }, async (args) => {
334
+ await (0, dashboardCommand_1.dashboardCommand)(args);
335
+ })
336
+ .command("schema <subcommand>", "Manage ServiceNow table schemas (subcommands: pull)", (cmdArgs) => {
337
+ cmdArgs.positional("subcommand", {
338
+ describe: "Schema subcommand to run",
339
+ choices: ["pull"],
340
+ });
341
+ cmdArgs.options({
342
+ ...sharedOptions,
343
+ output: {
344
+ alias: "o",
345
+ type: "string",
346
+ describe: "Output directory for schema files (default: schema/)",
347
+ },
348
+ scope: {
349
+ alias: "s",
350
+ type: "string",
351
+ describe: "Pull schema for a single scope (default: all scopes from dove.config.js)",
352
+ },
353
+ });
354
+ return cmdArgs;
355
+ }, async (args) => {
356
+ if (args.subcommand === "pull") {
357
+ await (0, schemaCommand_1.schemaPullCommand)(args);
358
+ }
359
+ })
360
+ .command("init-claude", "Install Dovetail Claude Code skills to .claude/commands/", (cmdArgs) => {
361
+ cmdArgs.options({
362
+ ...sharedOptions,
363
+ force: {
364
+ alias: "f",
365
+ type: "boolean",
366
+ default: false,
367
+ describe: "Overwrite existing skill files",
368
+ },
369
+ });
370
+ return cmdArgs;
371
+ }, async (args) => {
372
+ await (0, claudeCommand_1.initClaudeCommand)(args);
373
+ })
374
+ .command("clickup", "ClickUp task management commands", function (cmdArgs) {
375
+ return cmdArgs
376
+ .command("tasks", "List my tasks grouped by status", function (sub) {
377
+ sub.options({
378
+ ...sharedOptions,
379
+ team: {
380
+ type: "string",
381
+ describe: "ClickUp team/workspace ID",
382
+ },
383
+ status: {
384
+ type: "array",
385
+ describe: "Filter by status(es)",
386
+ },
387
+ });
388
+ return sub;
389
+ }, clickupCommands_1.clickupTasksCommand)
390
+ .command("task <id>", "Get task details", function (sub) {
391
+ sub.positional("id", {
392
+ describe: "ClickUp task ID or URL",
393
+ type: "string",
394
+ });
395
+ sub.options(sharedOptions);
396
+ return sub;
397
+ }, clickupCommands_1.clickupTaskCommand)
398
+ .command("create <list-id>", "Create a task (interactive)", function (sub) {
399
+ sub.positional("listId", {
400
+ describe: "ClickUp list ID to create the task in",
401
+ type: "string",
402
+ });
403
+ sub.options(sharedOptions);
404
+ return sub;
405
+ }, clickupCommands_1.clickupCreateCommand)
406
+ .command("update <task-id>", "Update a task (interactive)", function (sub) {
407
+ sub.positional("taskId", {
408
+ describe: "ClickUp task ID or URL",
409
+ type: "string",
410
+ });
411
+ sub.options(sharedOptions);
412
+ return sub;
413
+ }, clickupCommands_1.clickupUpdateCommand)
414
+ .command("comment <task-id> <msg>", "Add comment to task", function (sub) {
415
+ sub.positional("taskId", {
416
+ describe: "ClickUp task ID or URL",
417
+ type: "string",
418
+ });
419
+ sub.positional("msg", {
420
+ describe: "Comment message",
421
+ type: "string",
422
+ });
423
+ sub.options(sharedOptions);
424
+ return sub;
425
+ }, clickupCommands_1.clickupCommentCommand)
426
+ .command("teams", "List workspaces/teams your token belongs to", sharedOptions, clickupCommands_1.clickupTeamsCommand)
427
+ .command("setup", "Configure ClickUp API token and default workspace", sharedOptions, clickupCommands_1.clickupSetupCommand)
428
+ .command("spaces", "List available spaces in a workspace", function (sub) {
429
+ sub.options({
430
+ ...sharedOptions,
431
+ team: {
432
+ type: "string",
433
+ describe: "ClickUp team/workspace ID",
434
+ },
435
+ });
436
+ return sub;
437
+ }, clickupCommands_1.clickupSpacesCommand)
438
+ .command("lists <space-or-folder>", "List available lists in a folder or space", function (sub) {
439
+ sub.positional("spaceOrFolder", {
440
+ describe: "Space ID or folder ID",
441
+ type: "string",
442
+ });
443
+ sub.options(sharedOptions);
444
+ return sub;
445
+ }, clickupCommands_1.clickupListsCommand)
446
+ .demandCommand(1, "Please specify a clickup subcommand");
447
+ }, function () {
448
+ /* subcommands handle execution */
449
+ })
450
+ .command("migrate", "Migrate a project from Sincronia to Dovetail (renames sinc.* artifacts, updates package.json deps and scripts)", {
451
+ ...sharedOptions,
452
+ apply: {
453
+ type: "boolean",
454
+ default: false,
455
+ describe: "Actually perform the migration. Without this flag, only the plan is printed.",
456
+ },
457
+ }, migrateCommand_1.migrateCommand)
458
+ .command("task", "Manage the active ClickUp task for update set routing", function (cmdArgs) {
459
+ return cmdArgs
460
+ .command("clear", "Clear the active task (removes .dove-active-task.json)", sharedOptions, commands_1.taskClearCommand)
461
+ .demandCommand(1, "Please specify a task subcommand (e.g., clear)");
462
+ }, function () {
463
+ /* subcommands handle execution */
464
+ })
465
+ .help().argv;
466
+ }