@task-mcp/shared 1.0.20 → 1.0.22

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 (175) hide show
  1. package/README.md +122 -0
  2. package/package.json +1 -6
  3. package/src/algorithms/critical-path.ts +31 -6
  4. package/src/algorithms/dependency-integrity.ts +5 -2
  5. package/src/algorithms/topological-sort.ts +66 -17
  6. package/src/utils/index.ts +5 -5
  7. package/src/utils/natural-language.ts +210 -83
  8. package/src/utils/projection.ts +8 -8
  9. package/src/utils/workspace.ts +16 -4
  10. package/dist/algorithms/critical-path.d.ts +0 -46
  11. package/dist/algorithms/critical-path.d.ts.map +0 -1
  12. package/dist/algorithms/critical-path.js +0 -320
  13. package/dist/algorithms/critical-path.js.map +0 -1
  14. package/dist/algorithms/critical-path.test.d.ts +0 -2
  15. package/dist/algorithms/critical-path.test.d.ts.map +0 -1
  16. package/dist/algorithms/critical-path.test.js +0 -194
  17. package/dist/algorithms/critical-path.test.js.map +0 -1
  18. package/dist/algorithms/dependency-integrity.d.ts +0 -81
  19. package/dist/algorithms/dependency-integrity.d.ts.map +0 -1
  20. package/dist/algorithms/dependency-integrity.js +0 -207
  21. package/dist/algorithms/dependency-integrity.js.map +0 -1
  22. package/dist/algorithms/dependency-integrity.test.d.ts +0 -2
  23. package/dist/algorithms/dependency-integrity.test.d.ts.map +0 -1
  24. package/dist/algorithms/dependency-integrity.test.js +0 -309
  25. package/dist/algorithms/dependency-integrity.test.js.map +0 -1
  26. package/dist/algorithms/index.d.ts +0 -5
  27. package/dist/algorithms/index.d.ts.map +0 -1
  28. package/dist/algorithms/index.js +0 -5
  29. package/dist/algorithms/index.js.map +0 -1
  30. package/dist/algorithms/tech-analysis.d.ts +0 -106
  31. package/dist/algorithms/tech-analysis.d.ts.map +0 -1
  32. package/dist/algorithms/tech-analysis.js +0 -344
  33. package/dist/algorithms/tech-analysis.js.map +0 -1
  34. package/dist/algorithms/tech-analysis.test.d.ts +0 -2
  35. package/dist/algorithms/tech-analysis.test.d.ts.map +0 -1
  36. package/dist/algorithms/tech-analysis.test.js +0 -338
  37. package/dist/algorithms/tech-analysis.test.js.map +0 -1
  38. package/dist/algorithms/topological-sort.d.ts +0 -41
  39. package/dist/algorithms/topological-sort.d.ts.map +0 -1
  40. package/dist/algorithms/topological-sort.js +0 -165
  41. package/dist/algorithms/topological-sort.js.map +0 -1
  42. package/dist/algorithms/topological-sort.test.d.ts +0 -2
  43. package/dist/algorithms/topological-sort.test.d.ts.map +0 -1
  44. package/dist/algorithms/topological-sort.test.js +0 -162
  45. package/dist/algorithms/topological-sort.test.js.map +0 -1
  46. package/dist/index.d.ts +0 -4
  47. package/dist/index.d.ts.map +0 -1
  48. package/dist/index.js +0 -7
  49. package/dist/index.js.map +0 -1
  50. package/dist/schemas/inbox.d.ts +0 -55
  51. package/dist/schemas/inbox.d.ts.map +0 -1
  52. package/dist/schemas/inbox.js +0 -25
  53. package/dist/schemas/inbox.js.map +0 -1
  54. package/dist/schemas/index.d.ts +0 -7
  55. package/dist/schemas/index.d.ts.map +0 -1
  56. package/dist/schemas/index.js +0 -17
  57. package/dist/schemas/index.js.map +0 -1
  58. package/dist/schemas/project.d.ts +0 -177
  59. package/dist/schemas/project.d.ts.map +0 -1
  60. package/dist/schemas/project.js +0 -56
  61. package/dist/schemas/project.js.map +0 -1
  62. package/dist/schemas/response-format.d.ts +0 -148
  63. package/dist/schemas/response-format.d.ts.map +0 -1
  64. package/dist/schemas/response-format.js +0 -18
  65. package/dist/schemas/response-format.js.map +0 -1
  66. package/dist/schemas/response-schema.d.ts +0 -307
  67. package/dist/schemas/response-schema.d.ts.map +0 -1
  68. package/dist/schemas/response-schema.js +0 -75
  69. package/dist/schemas/response-schema.js.map +0 -1
  70. package/dist/schemas/response-schema.test.d.ts +0 -2
  71. package/dist/schemas/response-schema.test.d.ts.map +0 -1
  72. package/dist/schemas/response-schema.test.js +0 -256
  73. package/dist/schemas/response-schema.test.js.map +0 -1
  74. package/dist/schemas/state.d.ts +0 -17
  75. package/dist/schemas/state.d.ts.map +0 -1
  76. package/dist/schemas/state.js +0 -17
  77. package/dist/schemas/state.js.map +0 -1
  78. package/dist/schemas/task.d.ts +0 -881
  79. package/dist/schemas/task.d.ts.map +0 -1
  80. package/dist/schemas/task.js +0 -189
  81. package/dist/schemas/task.js.map +0 -1
  82. package/dist/schemas/view.d.ts +0 -143
  83. package/dist/schemas/view.d.ts.map +0 -1
  84. package/dist/schemas/view.js +0 -48
  85. package/dist/schemas/view.js.map +0 -1
  86. package/dist/utils/dashboard-renderer.d.ts +0 -93
  87. package/dist/utils/dashboard-renderer.d.ts.map +0 -1
  88. package/dist/utils/dashboard-renderer.js +0 -424
  89. package/dist/utils/dashboard-renderer.js.map +0 -1
  90. package/dist/utils/dashboard-renderer.test.d.ts +0 -2
  91. package/dist/utils/dashboard-renderer.test.d.ts.map +0 -1
  92. package/dist/utils/dashboard-renderer.test.js +0 -774
  93. package/dist/utils/dashboard-renderer.test.js.map +0 -1
  94. package/dist/utils/date.d.ts +0 -94
  95. package/dist/utils/date.d.ts.map +0 -1
  96. package/dist/utils/date.js +0 -323
  97. package/dist/utils/date.js.map +0 -1
  98. package/dist/utils/date.test.d.ts +0 -2
  99. package/dist/utils/date.test.d.ts.map +0 -1
  100. package/dist/utils/date.test.js +0 -276
  101. package/dist/utils/date.test.js.map +0 -1
  102. package/dist/utils/hierarchy.d.ts +0 -102
  103. package/dist/utils/hierarchy.d.ts.map +0 -1
  104. package/dist/utils/hierarchy.js +0 -236
  105. package/dist/utils/hierarchy.js.map +0 -1
  106. package/dist/utils/hierarchy.test.d.ts +0 -2
  107. package/dist/utils/hierarchy.test.d.ts.map +0 -1
  108. package/dist/utils/hierarchy.test.js +0 -436
  109. package/dist/utils/hierarchy.test.js.map +0 -1
  110. package/dist/utils/id.d.ts +0 -60
  111. package/dist/utils/id.d.ts.map +0 -1
  112. package/dist/utils/id.js +0 -118
  113. package/dist/utils/id.js.map +0 -1
  114. package/dist/utils/id.test.d.ts +0 -2
  115. package/dist/utils/id.test.d.ts.map +0 -1
  116. package/dist/utils/id.test.js +0 -193
  117. package/dist/utils/id.test.js.map +0 -1
  118. package/dist/utils/index.d.ts +0 -12
  119. package/dist/utils/index.d.ts.map +0 -1
  120. package/dist/utils/index.js +0 -34
  121. package/dist/utils/index.js.map +0 -1
  122. package/dist/utils/natural-language.d.ts +0 -57
  123. package/dist/utils/natural-language.d.ts.map +0 -1
  124. package/dist/utils/natural-language.js +0 -211
  125. package/dist/utils/natural-language.js.map +0 -1
  126. package/dist/utils/natural-language.test.d.ts +0 -2
  127. package/dist/utils/natural-language.test.d.ts.map +0 -1
  128. package/dist/utils/natural-language.test.js +0 -197
  129. package/dist/utils/natural-language.test.js.map +0 -1
  130. package/dist/utils/priority-queue.d.ts +0 -17
  131. package/dist/utils/priority-queue.d.ts.map +0 -1
  132. package/dist/utils/priority-queue.js +0 -62
  133. package/dist/utils/priority-queue.js.map +0 -1
  134. package/dist/utils/priority-queue.test.d.ts +0 -2
  135. package/dist/utils/priority-queue.test.d.ts.map +0 -1
  136. package/dist/utils/priority-queue.test.js +0 -82
  137. package/dist/utils/priority-queue.test.js.map +0 -1
  138. package/dist/utils/projection.d.ts +0 -65
  139. package/dist/utils/projection.d.ts.map +0 -1
  140. package/dist/utils/projection.js +0 -180
  141. package/dist/utils/projection.js.map +0 -1
  142. package/dist/utils/projection.test.d.ts +0 -2
  143. package/dist/utils/projection.test.d.ts.map +0 -1
  144. package/dist/utils/projection.test.js +0 -336
  145. package/dist/utils/projection.test.js.map +0 -1
  146. package/dist/utils/terminal-ui.d.ts +0 -208
  147. package/dist/utils/terminal-ui.d.ts.map +0 -1
  148. package/dist/utils/terminal-ui.js +0 -611
  149. package/dist/utils/terminal-ui.js.map +0 -1
  150. package/dist/utils/terminal-ui.test.d.ts +0 -2
  151. package/dist/utils/terminal-ui.test.d.ts.map +0 -1
  152. package/dist/utils/terminal-ui.test.js +0 -683
  153. package/dist/utils/terminal-ui.test.js.map +0 -1
  154. package/dist/utils/workspace.d.ts +0 -100
  155. package/dist/utils/workspace.d.ts.map +0 -1
  156. package/dist/utils/workspace.js +0 -173
  157. package/dist/utils/workspace.js.map +0 -1
  158. package/dist/utils/workspace.test.d.ts +0 -2
  159. package/dist/utils/workspace.test.d.ts.map +0 -1
  160. package/dist/utils/workspace.test.js +0 -97
  161. package/dist/utils/workspace.test.js.map +0 -1
  162. package/src/algorithms/critical-path.test.ts +0 -241
  163. package/src/algorithms/dependency-integrity.test.ts +0 -348
  164. package/src/algorithms/tech-analysis.test.ts +0 -413
  165. package/src/algorithms/topological-sort.test.ts +0 -190
  166. package/src/schemas/response-schema.test.ts +0 -314
  167. package/src/utils/dashboard-renderer.test.ts +0 -983
  168. package/src/utils/date.test.ts +0 -329
  169. package/src/utils/hierarchy.test.ts +0 -505
  170. package/src/utils/id.test.ts +0 -235
  171. package/src/utils/natural-language.test.ts +0 -242
  172. package/src/utils/priority-queue.test.ts +0 -103
  173. package/src/utils/projection.test.ts +0 -425
  174. package/src/utils/terminal-ui.test.ts +0 -831
  175. package/src/utils/workspace.test.ts +0 -125
@@ -1,125 +0,0 @@
1
- import { describe, expect, test } from "bun:test";
2
- import {
3
- normalizeWorkspace,
4
- detectWorkspaceSync,
5
- detectWorkspace,
6
- getWorkspaceFromPath,
7
- getGitRepoRoot,
8
- getGitRepoRootSync,
9
- } from "./workspace";
10
-
11
- describe("normalizeWorkspace", () => {
12
- test("converts to lowercase", () => {
13
- expect(normalizeWorkspace("MyProject")).toBe("myproject");
14
- });
15
-
16
- test("replaces spaces with hyphens", () => {
17
- expect(normalizeWorkspace("my project")).toBe("my-project");
18
- });
19
-
20
- test("removes special characters", () => {
21
- expect(normalizeWorkspace("my@project!")).toBe("myproject");
22
- });
23
-
24
- test("handles empty string", () => {
25
- expect(normalizeWorkspace("")).toBe("default");
26
- });
27
-
28
- test("keeps hyphens and underscores", () => {
29
- expect(normalizeWorkspace("my-project_name")).toBe("my-project_name");
30
- });
31
-
32
- test("trims leading and trailing hyphens", () => {
33
- expect(normalizeWorkspace("--my-project--")).toBe("my-project");
34
- });
35
-
36
- test("handles multiple spaces", () => {
37
- // Multiple spaces become multiple hyphens, then cleaned by special char removal
38
- expect(normalizeWorkspace("my project")).toBe("my-project");
39
- });
40
-
41
- test("handles mixed case with special chars", () => {
42
- expect(normalizeWorkspace("My@Project#Name")).toBe("myprojectname");
43
- });
44
- });
45
-
46
- describe("getWorkspaceFromPath", () => {
47
- test("extracts workspace from path", () => {
48
- expect(getWorkspaceFromPath("/home/user/projects/my-app")).toBe("my-app");
49
- });
50
-
51
- test("handles path with .tasks suffix", () => {
52
- expect(getWorkspaceFromPath("/projects/my-app/.tasks")).toBe("my-app");
53
- });
54
-
55
- test("handles path with trailing slash", () => {
56
- expect(getWorkspaceFromPath("/projects/my-app/.tasks/")).toBe("my-app");
57
- });
58
-
59
- test("normalizes the extracted name", () => {
60
- expect(getWorkspaceFromPath("/projects/My App")).toBe("my-app");
61
- });
62
- });
63
-
64
- describe("getGitRepoRootSync", () => {
65
- test("returns string or null for current directory", () => {
66
- const result = getGitRepoRootSync();
67
- expect(result === null || typeof result === "string").toBe(true);
68
- });
69
-
70
- test("returns null for non-git directory", () => {
71
- const result = getGitRepoRootSync("/tmp");
72
- expect(result).toBeNull();
73
- });
74
- });
75
-
76
- describe("getGitRepoRoot", () => {
77
- test("returns string or null for current directory", async () => {
78
- const result = await getGitRepoRoot();
79
- expect(result === null || typeof result === "string").toBe(true);
80
- });
81
-
82
- test("returns null for non-git directory", async () => {
83
- const result = await getGitRepoRoot("/tmp");
84
- expect(result).toBeNull();
85
- });
86
- });
87
-
88
- describe("detectWorkspaceSync", () => {
89
- test("returns a workspace name", () => {
90
- const workspace = detectWorkspaceSync();
91
- expect(typeof workspace).toBe("string");
92
- expect(workspace.length).toBeGreaterThan(0);
93
- });
94
-
95
- test("uses tasksDir path when provided and no git repo", () => {
96
- // This tests the fallback to tasksDir when in a non-git directory
97
- const workspace = detectWorkspaceSync("/some/path/my-project/.tasks");
98
- expect(typeof workspace).toBe("string");
99
- });
100
-
101
- test("returns normalized workspace name", () => {
102
- const workspace = detectWorkspaceSync();
103
- // Should be lowercase with no special characters except - and _
104
- expect(workspace).toMatch(/^[a-z0-9_-]+$/);
105
- });
106
- });
107
-
108
- describe("detectWorkspace", () => {
109
- test("returns a workspace name asynchronously", async () => {
110
- const workspace = await detectWorkspace();
111
- expect(typeof workspace).toBe("string");
112
- expect(workspace.length).toBeGreaterThan(0);
113
- });
114
-
115
- test("uses tasksDir path when provided", async () => {
116
- const workspace = await detectWorkspace("/some/path/test-project/.tasks");
117
- expect(typeof workspace).toBe("string");
118
- });
119
-
120
- test("returns normalized workspace name", async () => {
121
- const workspace = await detectWorkspace();
122
- // Should be lowercase with no special characters except - and _
123
- expect(workspace).toMatch(/^[a-z0-9_-]+$/);
124
- });
125
- });