@herdctl/core 0.0.1 → 0.0.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.
Files changed (275) hide show
  1. package/dist/config/__tests__/agent.test.js +31 -13
  2. package/dist/config/__tests__/agent.test.js.map +1 -1
  3. package/dist/config/__tests__/merge.test.js +9 -2
  4. package/dist/config/__tests__/merge.test.js.map +1 -1
  5. package/dist/config/__tests__/schema.test.js +350 -1
  6. package/dist/config/__tests__/schema.test.js.map +1 -1
  7. package/dist/config/index.d.ts +1 -1
  8. package/dist/config/index.d.ts.map +1 -1
  9. package/dist/config/index.js +3 -1
  10. package/dist/config/index.js.map +1 -1
  11. package/dist/config/schema.d.ts +828 -24
  12. package/dist/config/schema.d.ts.map +1 -1
  13. package/dist/config/schema.js +118 -6
  14. package/dist/config/schema.js.map +1 -1
  15. package/dist/fleet-manager/__tests__/coverage.test.js +11 -332
  16. package/dist/fleet-manager/__tests__/coverage.test.js.map +1 -1
  17. package/dist/fleet-manager/__tests__/errors.test.js +1 -49
  18. package/dist/fleet-manager/__tests__/errors.test.js.map +1 -1
  19. package/dist/fleet-manager/__tests__/integration.test.js +109 -0
  20. package/dist/fleet-manager/__tests__/integration.test.js.map +1 -1
  21. package/dist/fleet-manager/__tests__/reload.test.js +1 -1
  22. package/dist/fleet-manager/__tests__/reload.test.js.map +1 -1
  23. package/dist/fleet-manager/config-reload.d.ts +164 -0
  24. package/dist/fleet-manager/config-reload.d.ts.map +1 -0
  25. package/dist/fleet-manager/config-reload.js +445 -0
  26. package/dist/fleet-manager/config-reload.js.map +1 -0
  27. package/dist/fleet-manager/context.d.ts +76 -0
  28. package/dist/fleet-manager/context.d.ts.map +1 -0
  29. package/dist/fleet-manager/context.js +11 -0
  30. package/dist/fleet-manager/context.js.map +1 -0
  31. package/dist/fleet-manager/errors.d.ts +0 -25
  32. package/dist/fleet-manager/errors.d.ts.map +1 -1
  33. package/dist/fleet-manager/errors.js +0 -38
  34. package/dist/fleet-manager/errors.js.map +1 -1
  35. package/dist/fleet-manager/event-emitters.d.ts +123 -0
  36. package/dist/fleet-manager/event-emitters.d.ts.map +1 -0
  37. package/dist/fleet-manager/event-emitters.js +136 -0
  38. package/dist/fleet-manager/event-emitters.js.map +1 -0
  39. package/dist/fleet-manager/event-types.d.ts +0 -15
  40. package/dist/fleet-manager/event-types.d.ts.map +1 -1
  41. package/dist/fleet-manager/fleet-manager.d.ts +40 -653
  42. package/dist/fleet-manager/fleet-manager.d.ts.map +1 -1
  43. package/dist/fleet-manager/fleet-manager.js +95 -1720
  44. package/dist/fleet-manager/fleet-manager.js.map +1 -1
  45. package/dist/fleet-manager/index.d.ts +13 -2
  46. package/dist/fleet-manager/index.d.ts.map +1 -1
  47. package/dist/fleet-manager/index.js +19 -6
  48. package/dist/fleet-manager/index.js.map +1 -1
  49. package/dist/fleet-manager/job-control.d.ts +64 -0
  50. package/dist/fleet-manager/job-control.d.ts.map +1 -0
  51. package/dist/fleet-manager/job-control.js +296 -0
  52. package/dist/fleet-manager/job-control.js.map +1 -0
  53. package/dist/fleet-manager/log-streaming.d.ts +171 -0
  54. package/dist/fleet-manager/log-streaming.d.ts.map +1 -0
  55. package/dist/fleet-manager/log-streaming.js +503 -0
  56. package/dist/fleet-manager/log-streaming.js.map +1 -0
  57. package/dist/fleet-manager/schedule-executor.d.ts +63 -0
  58. package/dist/fleet-manager/schedule-executor.d.ts.map +1 -0
  59. package/dist/fleet-manager/schedule-executor.js +209 -0
  60. package/dist/fleet-manager/schedule-executor.js.map +1 -0
  61. package/dist/fleet-manager/schedule-management.d.ts +71 -0
  62. package/dist/fleet-manager/schedule-management.d.ts.map +1 -0
  63. package/dist/fleet-manager/schedule-management.js +171 -0
  64. package/dist/fleet-manager/schedule-management.js.map +1 -0
  65. package/dist/fleet-manager/status-queries.d.ts +105 -0
  66. package/dist/fleet-manager/status-queries.d.ts.map +1 -0
  67. package/dist/fleet-manager/status-queries.js +247 -0
  68. package/dist/fleet-manager/status-queries.js.map +1 -0
  69. package/dist/fleet-manager/types.d.ts +0 -39
  70. package/dist/fleet-manager/types.d.ts.map +1 -1
  71. package/dist/runner/__tests__/job-executor.test.js +206 -1
  72. package/dist/runner/__tests__/job-executor.test.js.map +1 -1
  73. package/dist/runner/job-executor.d.ts +9 -0
  74. package/dist/runner/job-executor.d.ts.map +1 -1
  75. package/dist/runner/job-executor.js +78 -4
  76. package/dist/runner/job-executor.js.map +1 -1
  77. package/dist/runner/types.d.ts +2 -0
  78. package/dist/runner/types.d.ts.map +1 -1
  79. package/dist/scheduler/__tests__/cron.test.d.ts +2 -0
  80. package/dist/scheduler/__tests__/cron.test.d.ts.map +1 -0
  81. package/dist/scheduler/__tests__/cron.test.js +867 -0
  82. package/dist/scheduler/__tests__/cron.test.js.map +1 -0
  83. package/dist/scheduler/__tests__/scheduler.test.js +164 -5
  84. package/dist/scheduler/__tests__/scheduler.test.js.map +1 -1
  85. package/dist/scheduler/cron.d.ts +126 -0
  86. package/dist/scheduler/cron.d.ts.map +1 -0
  87. package/dist/scheduler/cron.js +390 -0
  88. package/dist/scheduler/cron.js.map +1 -0
  89. package/dist/scheduler/errors.d.ts +81 -1
  90. package/dist/scheduler/errors.d.ts.map +1 -1
  91. package/dist/scheduler/errors.js +81 -6
  92. package/dist/scheduler/errors.js.map +1 -1
  93. package/dist/scheduler/index.d.ts +1 -0
  94. package/dist/scheduler/index.d.ts.map +1 -1
  95. package/dist/scheduler/index.js +2 -0
  96. package/dist/scheduler/index.js.map +1 -1
  97. package/dist/scheduler/schedule-runner.d.ts +2 -2
  98. package/dist/scheduler/schedule-runner.d.ts.map +1 -1
  99. package/dist/scheduler/schedule-runner.js +20 -8
  100. package/dist/scheduler/schedule-runner.js.map +1 -1
  101. package/dist/scheduler/scheduler.d.ts +4 -4
  102. package/dist/scheduler/scheduler.d.ts.map +1 -1
  103. package/dist/scheduler/scheduler.js +86 -20
  104. package/dist/scheduler/scheduler.js.map +1 -1
  105. package/dist/scheduler/types.d.ts +1 -1
  106. package/dist/scheduler/types.d.ts.map +1 -1
  107. package/dist/state/schemas/job-metadata.d.ts +2 -2
  108. package/package.json +33 -8
  109. package/.turbo/turbo-build.log +0 -4
  110. package/.turbo/turbo-test.log +0 -219
  111. package/.turbo/turbo-typecheck.log +0 -4
  112. package/coverage/base.css +0 -224
  113. package/coverage/block-navigation.js +0 -87
  114. package/coverage/coverage-final.json +0 -51
  115. package/coverage/favicon.png +0 -0
  116. package/coverage/index.html +0 -251
  117. package/coverage/prettify.css +0 -1
  118. package/coverage/prettify.js +0 -2
  119. package/coverage/sort-arrow-sprite.png +0 -0
  120. package/coverage/sorter.js +0 -210
  121. package/coverage/src/config/index.html +0 -191
  122. package/coverage/src/config/index.ts.html +0 -442
  123. package/coverage/src/config/interpolate.ts.html +0 -652
  124. package/coverage/src/config/loader.ts.html +0 -1501
  125. package/coverage/src/config/merge.ts.html +0 -823
  126. package/coverage/src/config/parser.ts.html +0 -1213
  127. package/coverage/src/config/schema.ts.html +0 -1123
  128. package/coverage/src/fleet-manager/errors.ts.html +0 -2326
  129. package/coverage/src/fleet-manager/event-types.ts.html +0 -1219
  130. package/coverage/src/fleet-manager/fleet-manager.ts.html +0 -7030
  131. package/coverage/src/fleet-manager/index.html +0 -206
  132. package/coverage/src/fleet-manager/index.ts.html +0 -469
  133. package/coverage/src/fleet-manager/job-manager.ts.html +0 -2074
  134. package/coverage/src/fleet-manager/job-queue.ts.html +0 -2479
  135. package/coverage/src/fleet-manager/types.ts.html +0 -2602
  136. package/coverage/src/index.html +0 -116
  137. package/coverage/src/index.ts.html +0 -181
  138. package/coverage/src/runner/errors.ts.html +0 -1006
  139. package/coverage/src/runner/index.html +0 -191
  140. package/coverage/src/runner/index.ts.html +0 -256
  141. package/coverage/src/runner/job-executor.ts.html +0 -1429
  142. package/coverage/src/runner/message-processor.ts.html +0 -1150
  143. package/coverage/src/runner/sdk-adapter.ts.html +0 -658
  144. package/coverage/src/runner/types.ts.html +0 -559
  145. package/coverage/src/scheduler/errors.ts.html +0 -388
  146. package/coverage/src/scheduler/index.html +0 -206
  147. package/coverage/src/scheduler/index.ts.html +0 -244
  148. package/coverage/src/scheduler/interval.ts.html +0 -652
  149. package/coverage/src/scheduler/schedule-runner.ts.html +0 -1411
  150. package/coverage/src/scheduler/schedule-state.ts.html +0 -718
  151. package/coverage/src/scheduler/scheduler.ts.html +0 -1795
  152. package/coverage/src/scheduler/types.ts.html +0 -733
  153. package/coverage/src/state/directory.ts.html +0 -736
  154. package/coverage/src/state/errors.ts.html +0 -376
  155. package/coverage/src/state/fleet-state.ts.html +0 -937
  156. package/coverage/src/state/index.html +0 -221
  157. package/coverage/src/state/index.ts.html +0 -322
  158. package/coverage/src/state/job-metadata.ts.html +0 -1420
  159. package/coverage/src/state/job-output.ts.html +0 -1033
  160. package/coverage/src/state/schemas/fleet-state.ts.html +0 -445
  161. package/coverage/src/state/schemas/index.html +0 -176
  162. package/coverage/src/state/schemas/index.ts.html +0 -286
  163. package/coverage/src/state/schemas/job-metadata.ts.html +0 -628
  164. package/coverage/src/state/schemas/job-output.ts.html +0 -616
  165. package/coverage/src/state/schemas/session-info.ts.html +0 -361
  166. package/coverage/src/state/session.ts.html +0 -844
  167. package/coverage/src/state/types.ts.html +0 -262
  168. package/coverage/src/state/utils/atomic.ts.html +0 -748
  169. package/coverage/src/state/utils/index.html +0 -146
  170. package/coverage/src/state/utils/index.ts.html +0 -103
  171. package/coverage/src/state/utils/reads.ts.html +0 -1621
  172. package/coverage/src/work-sources/adapters/github.ts.html +0 -3583
  173. package/coverage/src/work-sources/adapters/index.html +0 -131
  174. package/coverage/src/work-sources/adapters/index.ts.html +0 -277
  175. package/coverage/src/work-sources/errors.ts.html +0 -298
  176. package/coverage/src/work-sources/index.html +0 -176
  177. package/coverage/src/work-sources/index.ts.html +0 -529
  178. package/coverage/src/work-sources/manager.ts.html +0 -1324
  179. package/coverage/src/work-sources/registry.ts.html +0 -619
  180. package/coverage/src/work-sources/types.ts.html +0 -568
  181. package/dist/fleet-manager/__tests__/event-helpers.test.d.ts +0 -7
  182. package/dist/fleet-manager/__tests__/event-helpers.test.d.ts.map +0 -1
  183. package/dist/fleet-manager/__tests__/event-helpers.test.js +0 -368
  184. package/dist/fleet-manager/__tests__/event-helpers.test.js.map +0 -1
  185. package/src/config/__tests__/agent.test.ts +0 -864
  186. package/src/config/__tests__/interpolate.test.ts +0 -644
  187. package/src/config/__tests__/loader.test.ts +0 -784
  188. package/src/config/__tests__/merge.test.ts +0 -751
  189. package/src/config/__tests__/parser.test.ts +0 -533
  190. package/src/config/__tests__/schema.test.ts +0 -873
  191. package/src/config/index.ts +0 -119
  192. package/src/config/interpolate.ts +0 -189
  193. package/src/config/loader.ts +0 -472
  194. package/src/config/merge.ts +0 -246
  195. package/src/config/parser.ts +0 -376
  196. package/src/config/schema.ts +0 -346
  197. package/src/fleet-manager/__tests__/coverage.test.ts +0 -2869
  198. package/src/fleet-manager/__tests__/errors.test.ts +0 -660
  199. package/src/fleet-manager/__tests__/event-helpers.test.ts +0 -448
  200. package/src/fleet-manager/__tests__/integration.test.ts +0 -1209
  201. package/src/fleet-manager/__tests__/job-control.test.ts +0 -283
  202. package/src/fleet-manager/__tests__/job-manager.test.ts +0 -869
  203. package/src/fleet-manager/__tests__/job-queue.test.ts +0 -401
  204. package/src/fleet-manager/__tests__/reload.test.ts +0 -751
  205. package/src/fleet-manager/__tests__/status-queries.test.ts +0 -595
  206. package/src/fleet-manager/__tests__/trigger.test.ts +0 -601
  207. package/src/fleet-manager/errors.ts +0 -747
  208. package/src/fleet-manager/event-types.ts +0 -378
  209. package/src/fleet-manager/fleet-manager.ts +0 -2315
  210. package/src/fleet-manager/index.ts +0 -128
  211. package/src/fleet-manager/job-manager.ts +0 -663
  212. package/src/fleet-manager/job-queue.ts +0 -798
  213. package/src/fleet-manager/types.ts +0 -839
  214. package/src/index.ts +0 -32
  215. package/src/runner/__tests__/errors.test.ts +0 -382
  216. package/src/runner/__tests__/job-executor.test.ts +0 -1708
  217. package/src/runner/__tests__/message-processor.test.ts +0 -960
  218. package/src/runner/__tests__/sdk-adapter.test.ts +0 -626
  219. package/src/runner/errors.ts +0 -307
  220. package/src/runner/index.ts +0 -57
  221. package/src/runner/job-executor.ts +0 -448
  222. package/src/runner/message-processor.ts +0 -355
  223. package/src/runner/sdk-adapter.ts +0 -191
  224. package/src/runner/types.ts +0 -158
  225. package/src/scheduler/__tests__/errors.test.ts +0 -159
  226. package/src/scheduler/__tests__/interval.test.ts +0 -515
  227. package/src/scheduler/__tests__/schedule-runner.test.ts +0 -798
  228. package/src/scheduler/__tests__/schedule-state.test.ts +0 -671
  229. package/src/scheduler/__tests__/scheduler.test.ts +0 -1280
  230. package/src/scheduler/errors.ts +0 -101
  231. package/src/scheduler/index.ts +0 -53
  232. package/src/scheduler/interval.ts +0 -189
  233. package/src/scheduler/schedule-runner.ts +0 -442
  234. package/src/scheduler/schedule-state.ts +0 -211
  235. package/src/scheduler/scheduler.ts +0 -570
  236. package/src/scheduler/types.ts +0 -216
  237. package/src/state/__tests__/directory.test.ts +0 -595
  238. package/src/state/__tests__/fleet-state.test.ts +0 -868
  239. package/src/state/__tests__/job-metadata-schema.test.ts +0 -414
  240. package/src/state/__tests__/job-metadata.test.ts +0 -831
  241. package/src/state/__tests__/job-output.test.ts +0 -856
  242. package/src/state/__tests__/session-schema.test.ts +0 -378
  243. package/src/state/__tests__/session.test.ts +0 -604
  244. package/src/state/directory.ts +0 -217
  245. package/src/state/errors.ts +0 -97
  246. package/src/state/fleet-state.ts +0 -284
  247. package/src/state/index.ts +0 -79
  248. package/src/state/job-metadata.ts +0 -445
  249. package/src/state/job-output.ts +0 -316
  250. package/src/state/schemas/__tests__/job-output.test.ts +0 -338
  251. package/src/state/schemas/fleet-state.ts +0 -120
  252. package/src/state/schemas/index.ts +0 -67
  253. package/src/state/schemas/job-metadata.ts +0 -181
  254. package/src/state/schemas/job-output.ts +0 -177
  255. package/src/state/schemas/session-info.ts +0 -92
  256. package/src/state/session.ts +0 -253
  257. package/src/state/types.ts +0 -59
  258. package/src/state/utils/__tests__/atomic.test.ts +0 -723
  259. package/src/state/utils/__tests__/reads.test.ts +0 -1071
  260. package/src/state/utils/atomic.ts +0 -221
  261. package/src/state/utils/index.ts +0 -6
  262. package/src/state/utils/reads.ts +0 -512
  263. package/src/work-sources/__tests__/github.test.ts +0 -1800
  264. package/src/work-sources/__tests__/manager.test.ts +0 -529
  265. package/src/work-sources/__tests__/registry.test.ts +0 -477
  266. package/src/work-sources/__tests__/types.test.ts +0 -479
  267. package/src/work-sources/adapters/github.ts +0 -1166
  268. package/src/work-sources/adapters/index.ts +0 -64
  269. package/src/work-sources/errors.ts +0 -71
  270. package/src/work-sources/index.ts +0 -148
  271. package/src/work-sources/manager.ts +0 -413
  272. package/src/work-sources/registry.ts +0 -178
  273. package/src/work-sources/types.ts +0 -161
  274. package/tsconfig.json +0 -9
  275. package/vitest.config.ts +0 -19
@@ -1,178 +0,0 @@
1
- /**
2
- * Work Source Registry
3
- *
4
- * Provides a singleton registry for work source adapters.
5
- * Allows registration of factory functions that create adapter instances
6
- * based on configuration.
7
- */
8
-
9
- import type { WorkSourceAdapter } from "./index.js";
10
- import type { WorkSourceLabels } from "../config/schema.js";
11
- import { UnknownWorkSourceError, DuplicateWorkSourceError } from "./errors.js";
12
-
13
- // =============================================================================
14
- // Types
15
- // =============================================================================
16
-
17
- /**
18
- * Configuration for a work source adapter
19
- *
20
- * This is a flexible configuration type that allows any work source type
21
- * to be registered. For type-safe configuration of known types, use the
22
- * specific config types (e.g., GitHubWorkSourceConfig).
23
- */
24
- export interface WorkSourceConfig {
25
- /** The type identifier for this work source (e.g., 'github', 'linear') */
26
- type: string;
27
- /** Label configuration for work item states */
28
- labels?: WorkSourceLabels;
29
- /** Whether to clean up in-progress labels on startup */
30
- cleanup_in_progress?: boolean;
31
- /** Additional adapter-specific configuration */
32
- [key: string]: unknown;
33
- }
34
-
35
- /**
36
- * Factory function that creates a work source adapter instance
37
- *
38
- * @param config - The configuration for the work source
39
- * @returns A configured WorkSourceAdapter instance
40
- */
41
- export type WorkSourceFactory = (config: WorkSourceConfig) => WorkSourceAdapter;
42
-
43
- // =============================================================================
44
- // Registry State (Module-level Singleton)
45
- // =============================================================================
46
-
47
- /**
48
- * Internal registry map storing factories by type
49
- */
50
- const registry = new Map<string, WorkSourceFactory>();
51
-
52
- // =============================================================================
53
- // Registry Functions
54
- // =============================================================================
55
-
56
- /**
57
- * Register a work source adapter factory
58
- *
59
- * Registers a factory function that will be used to create adapter instances
60
- * for the specified type. The factory is called when `getWorkSource()` is
61
- * invoked with a matching type.
62
- *
63
- * @param type - The unique type identifier (e.g., 'github', 'linear')
64
- * @param factory - Factory function that creates adapter instances
65
- * @throws {DuplicateWorkSourceError} If the type is already registered
66
- *
67
- * @example
68
- * ```typescript
69
- * registerWorkSource('github', (config) => new GitHubAdapter(config));
70
- * registerWorkSource('linear', (config) => new LinearAdapter(config));
71
- * ```
72
- */
73
- export function registerWorkSource(
74
- type: string,
75
- factory: WorkSourceFactory
76
- ): void {
77
- if (registry.has(type)) {
78
- throw new DuplicateWorkSourceError(type);
79
- }
80
- registry.set(type, factory);
81
- }
82
-
83
- /**
84
- * Get a configured work source adapter instance
85
- *
86
- * Looks up the factory for the specified type and calls it with the
87
- * provided configuration to create an adapter instance.
88
- *
89
- * @param config - The work source configuration (must include `type`)
90
- * @returns A configured WorkSourceAdapter instance
91
- * @throws {UnknownWorkSourceError} If no factory is registered for the type
92
- *
93
- * @example
94
- * ```typescript
95
- * const adapter = getWorkSource({
96
- * type: 'github',
97
- * labels: { ready: 'agent-ready', in_progress: 'agent-working' }
98
- * });
99
- *
100
- * const { items } = await adapter.fetchAvailableWork();
101
- * ```
102
- */
103
- export function getWorkSource(config: WorkSourceConfig): WorkSourceAdapter {
104
- const factory = registry.get(config.type);
105
-
106
- if (!factory) {
107
- throw new UnknownWorkSourceError(config.type, getRegisteredTypes());
108
- }
109
-
110
- return factory(config);
111
- }
112
-
113
- /**
114
- * Get a list of all registered work source types
115
- *
116
- * @returns Array of registered type identifiers
117
- *
118
- * @example
119
- * ```typescript
120
- * const types = getRegisteredTypes();
121
- * // ['github', 'linear', 'jira']
122
- * ```
123
- */
124
- export function getRegisteredTypes(): string[] {
125
- return Array.from(registry.keys());
126
- }
127
-
128
- /**
129
- * Check if a work source type is registered
130
- *
131
- * @param type - The type identifier to check
132
- * @returns True if the type is registered
133
- *
134
- * @example
135
- * ```typescript
136
- * if (isWorkSourceRegistered('github')) {
137
- * const adapter = getWorkSource({ type: 'github' });
138
- * }
139
- * ```
140
- */
141
- export function isWorkSourceRegistered(type: string): boolean {
142
- return registry.has(type);
143
- }
144
-
145
- /**
146
- * Unregister a work source adapter factory
147
- *
148
- * Removes the factory for the specified type. Primarily useful for testing.
149
- *
150
- * @param type - The type identifier to unregister
151
- * @returns True if the type was registered and removed, false otherwise
152
- *
153
- * @example
154
- * ```typescript
155
- * // In tests
156
- * unregisterWorkSource('github');
157
- * registerWorkSource('github', mockFactory);
158
- * ```
159
- */
160
- export function unregisterWorkSource(type: string): boolean {
161
- return registry.delete(type);
162
- }
163
-
164
- /**
165
- * Clear all registered work source factories
166
- *
167
- * Removes all registered factories. Primarily useful for testing.
168
- * Note: This will also clear built-in adapters.
169
- *
170
- * @example
171
- * ```typescript
172
- * // In test setup/teardown
173
- * clearWorkSourceRegistry();
174
- * ```
175
- */
176
- export function clearWorkSourceRegistry(): void {
177
- registry.clear();
178
- }
@@ -1,161 +0,0 @@
1
- /**
2
- * Type definitions for work sources
3
- *
4
- * Defines common types for work items, fetch options, and operation results
5
- * that all work source adapters must implement.
6
- */
7
-
8
- // =============================================================================
9
- // Work Item Types
10
- // =============================================================================
11
-
12
- /**
13
- * Priority levels for work items
14
- */
15
- export type WorkItemPriority = "critical" | "high" | "medium" | "low";
16
-
17
- /**
18
- * A work item that can be processed by an agent
19
- *
20
- * Represents a unit of work from any source (GitHub Issues, Linear, etc.)
21
- * with normalized fields for consistent handling across sources.
22
- */
23
- export interface WorkItem {
24
- /** Unique identifier within herdctl (source-prefixed) */
25
- id: string;
26
- /** The type of source this work item came from (e.g., 'github', 'linear') */
27
- source: string;
28
- /** The original ID from the external system */
29
- externalId: string;
30
- /** Title or summary of the work item */
31
- title: string;
32
- /** Full description or body of the work item */
33
- description: string;
34
- /** Priority level of the work item */
35
- priority: WorkItemPriority;
36
- /** Labels/tags associated with the work item */
37
- labels: string[];
38
- /** Source-specific metadata (e.g., GitHub milestone, assignees) */
39
- metadata: Record<string, unknown>;
40
- /** URL to view the work item in the external system */
41
- url: string;
42
- /** When the work item was created */
43
- createdAt: Date;
44
- /** When the work item was last updated */
45
- updatedAt: Date;
46
- }
47
-
48
- // =============================================================================
49
- // Fetch Options Types
50
- // =============================================================================
51
-
52
- /**
53
- * Options for fetching available work items
54
- *
55
- * Supports filtering by labels/priority and pagination for large result sets.
56
- */
57
- export interface FetchOptions {
58
- /** Filter by labels (items must have ALL specified labels) */
59
- labels?: string[];
60
- /** Filter by priority levels (items must match ONE of the priorities) */
61
- priority?: WorkItemPriority[];
62
- /** Maximum number of items to return */
63
- limit?: number;
64
- /** Cursor for pagination (opaque string from previous response) */
65
- cursor?: string;
66
- /** Include items that are already claimed by this source */
67
- includeClaimed?: boolean;
68
- }
69
-
70
- /**
71
- * Result of fetching work items with pagination info
72
- */
73
- export interface FetchResult {
74
- /** The fetched work items */
75
- items: WorkItem[];
76
- /** Cursor for fetching the next page (undefined if no more pages) */
77
- nextCursor?: string;
78
- /** Total count of matching items (if available from source) */
79
- totalCount?: number;
80
- }
81
-
82
- // =============================================================================
83
- // Claim Result Types
84
- // =============================================================================
85
-
86
- /**
87
- * Reasons why claiming a work item might fail
88
- */
89
- export type ClaimFailureReason =
90
- | "already_claimed"
91
- | "not_found"
92
- | "permission_denied"
93
- | "source_error"
94
- | "invalid_state";
95
-
96
- /**
97
- * Result of attempting to claim a work item
98
- *
99
- * Indicates whether the claim succeeded and provides details on failure.
100
- */
101
- export interface ClaimResult {
102
- /** Whether the claim was successful */
103
- success: boolean;
104
- /** The claimed work item (if successful) */
105
- workItem?: WorkItem;
106
- /** Reason for failure (if unsuccessful) */
107
- reason?: ClaimFailureReason;
108
- /** Human-readable error message (if unsuccessful) */
109
- message?: string;
110
- }
111
-
112
- // =============================================================================
113
- // Work Result Types
114
- // =============================================================================
115
-
116
- /**
117
- * Outcome status of completing work
118
- */
119
- export type WorkOutcome = "success" | "failure" | "partial";
120
-
121
- /**
122
- * Result of completing a work item
123
- *
124
- * Captures the outcome and any artifacts or comments to post back to the source.
125
- */
126
- export interface WorkResult {
127
- /** The outcome of the work */
128
- outcome: WorkOutcome;
129
- /** Summary of what was accomplished */
130
- summary: string;
131
- /** Detailed description of changes made (for PR descriptions, etc.) */
132
- details?: string;
133
- /** Artifacts produced (e.g., file paths, URLs) */
134
- artifacts?: string[];
135
- /** Error message if outcome is failure or partial */
136
- error?: string;
137
- }
138
-
139
- // =============================================================================
140
- // Release Options Types
141
- // =============================================================================
142
-
143
- /**
144
- * Options for releasing a claimed work item
145
- */
146
- export interface ReleaseOptions {
147
- /** Reason for releasing the work item */
148
- reason?: string;
149
- /** Whether to add a comment to the work item explaining the release */
150
- addComment?: boolean;
151
- }
152
-
153
- /**
154
- * Result of releasing a work item
155
- */
156
- export interface ReleaseResult {
157
- /** Whether the release was successful */
158
- success: boolean;
159
- /** Error message if unsuccessful */
160
- message?: string;
161
- }
package/tsconfig.json DELETED
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "dist",
5
- "rootDir": "src"
6
- },
7
- "include": ["src/**/*"],
8
- "exclude": ["node_modules", "dist"]
9
- }
package/vitest.config.ts DELETED
@@ -1,19 +0,0 @@
1
- import { defineConfig } from "vitest/config";
2
-
3
- export default defineConfig({
4
- test: {
5
- include: ["src/**/__tests__/**/*.test.ts"],
6
- coverage: {
7
- provider: "v8",
8
- include: ["src/**/*.ts"],
9
- exclude: ["src/**/__tests__/**", "src/**/*.test.ts"],
10
- reporter: ["text", "json", "html"],
11
- thresholds: {
12
- lines: 85,
13
- functions: 85,
14
- branches: 65,
15
- statements: 85,
16
- },
17
- },
18
- },
19
- });