github-issue-tower-defence-management 1.130.0 → 1.131.1

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 (27) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +1 -0
  3. package/bin/adapter/entry-points/cli/index.js +8 -0
  4. package/bin/adapter/entry-points/cli/index.js.map +1 -1
  5. package/bin/adapter/entry-points/cli/projectConfig.js +2 -0
  6. package/bin/adapter/entry-points/cli/projectConfig.js.map +1 -1
  7. package/bin/adapter/entry-points/handlers/HandleScheduledEventUseCaseHandler.js +6 -6
  8. package/bin/domain/usecases/HandleScheduledEventUseCase.js +1 -0
  9. package/bin/domain/usecases/HandleScheduledEventUseCase.js.map +1 -1
  10. package/bin/domain/usecases/StartPreparationUseCase.js +6 -1
  11. package/bin/domain/usecases/StartPreparationUseCase.js.map +1 -1
  12. package/lib/buffer-equal-constant-time-compat/index.js +17 -0
  13. package/lib/buffer-equal-constant-time-compat/index.test.js +54 -0
  14. package/lib/buffer-equal-constant-time-compat/package.json +5 -0
  15. package/package.json +4 -1
  16. package/src/adapter/entry-points/cli/index.test.ts +36 -0
  17. package/src/adapter/entry-points/cli/index.ts +14 -0
  18. package/src/adapter/entry-points/cli/projectConfig.ts +3 -0
  19. package/src/domain/usecases/HandleScheduledEventUseCase.ts +1 -0
  20. package/src/domain/usecases/StartPreparationUseCase.test.ts +315 -3
  21. package/src/domain/usecases/StartPreparationUseCase.ts +7 -1
  22. package/types/adapter/entry-points/cli/index.d.ts.map +1 -1
  23. package/types/adapter/entry-points/cli/projectConfig.d.ts +1 -0
  24. package/types/adapter/entry-points/cli/projectConfig.d.ts.map +1 -1
  25. package/types/domain/usecases/HandleScheduledEventUseCase.d.ts.map +1 -1
  26. package/types/domain/usecases/StartPreparationUseCase.d.ts +1 -0
  27. package/types/domain/usecases/StartPreparationUseCase.d.ts.map +1 -1
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "buffer-equal-constant-time-compat",
3
+ "version": "1.0.0",
4
+ "main": "index.js"
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "github-issue-tower-defence-management",
3
- "version": "1.130.0",
3
+ "version": "1.131.1",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "scripts": {
@@ -111,5 +111,8 @@
111
111
  "marked-emoji": "2.0.3",
112
112
  "typia": "^12.0.0",
113
113
  "yaml": "^2.6.0"
114
+ },
115
+ "overrides": {
116
+ "buffer-equal-constant-time": "file:./lib/buffer-equal-constant-time-compat"
114
117
  }
115
118
  }
@@ -103,6 +103,7 @@ describe('CLI', () => {
103
103
  projectUrl: 'https://github.com/orgs/test/projects/1',
104
104
  defaultAgentName: 'agent1',
105
105
  projectName: 'test-project',
106
+ manager: 'test-manager',
106
107
  };
107
108
 
108
109
  const writeConfig = (config: Record<string, unknown>): void => {
@@ -721,6 +722,7 @@ mysteryKey: 'value'
721
722
  maximumPreparingIssuesCount: null,
722
723
  utilizationPercentageThreshold: 90,
723
724
  allowedIssueAuthors: null,
725
+ manager: 'test-manager',
724
726
  codexHomeCandidates: null,
725
727
  labelsAsLlmAgentName: null,
726
728
  });
@@ -762,6 +764,7 @@ mysteryKey: 'value'
762
764
  maximumPreparingIssuesCount: null,
763
765
  utilizationPercentageThreshold: 90,
764
766
  allowedIssueAuthors: null,
767
+ manager: 'test-manager',
765
768
  codexHomeCandidates: null,
766
769
  labelsAsLlmAgentName: null,
767
770
  });
@@ -1017,6 +1020,39 @@ mysteryKey: 'value'
1017
1020
  processExitSpy.mockRestore();
1018
1021
  });
1019
1022
 
1023
+ it('should exit with error when manager is missing', async () => {
1024
+ const configMissing = {
1025
+ projectUrl: 'https://github.com/orgs/test/projects/1',
1026
+ defaultAgentName: 'agent1',
1027
+ };
1028
+ writeConfig(configMissing);
1029
+
1030
+ const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation();
1031
+ const processExitSpy = jest
1032
+ .spyOn(process, 'exit')
1033
+ .mockImplementation(() => {
1034
+ throw new Error('process.exit called');
1035
+ });
1036
+
1037
+ await expect(
1038
+ program.parseAsync([
1039
+ 'node',
1040
+ 'test',
1041
+ 'startDaemon',
1042
+ '--configFilePath',
1043
+ configFilePath,
1044
+ ]),
1045
+ ).rejects.toThrow('process.exit called');
1046
+
1047
+ expect(consoleErrorSpy).toHaveBeenCalledWith(
1048
+ 'manager is required. Provide via the config file so that only issues assigned to the manager are picked up.',
1049
+ );
1050
+ expect(processExitSpy).toHaveBeenCalledWith(1);
1051
+
1052
+ consoleErrorSpy.mockRestore();
1053
+ processExitSpy.mockRestore();
1054
+ });
1055
+
1020
1056
  it('should log maximumPreparingIssuesCount before calling useCase.run', async () => {
1021
1057
  const configWithValues = {
1022
1058
  ...defaultConfig,
@@ -53,6 +53,7 @@ import { InTmuxByHumanSessionTokenCountHandler } from '../handlers/InTmuxByHuman
53
53
 
54
54
  type StartDaemonOptions = {
55
55
  projectUrl?: string;
56
+ manager?: string;
56
57
  defaultAgentName?: string;
57
58
  defaultLlmModelName?: string;
58
59
  fallbackLlmModelName?: string;
@@ -175,6 +176,10 @@ program
175
176
  'Path to config file for tower defence management',
176
177
  )
177
178
  .option('--projectUrl <url>', 'GitHub project URL')
179
+ .option(
180
+ '--manager <login>',
181
+ 'GitHub login of the manager; only Awaiting Workspace issues assigned to this login are picked up',
182
+ )
178
183
  .option('--defaultAgentName <name>', 'Default agent name')
179
184
  .option('--defaultLlmModelName <name>', 'Default LLM model name')
180
185
  .option(
@@ -209,6 +214,7 @@ program
209
214
 
210
215
  const cliOverrides: ConfigFile = {
211
216
  projectUrl: options.projectUrl,
217
+ manager: options.manager,
212
218
  defaultAgentName: options.defaultAgentName,
213
219
  defaultLlmModelName: options.defaultLlmModelName,
214
220
  fallbackLlmModelName: options.fallbackLlmModelName,
@@ -242,6 +248,7 @@ program
242
248
 
243
249
  const projectUrl = config.projectUrl;
244
250
  const defaultAgentName = config.defaultAgentName;
251
+ const manager = config.manager;
245
252
 
246
253
  if (!projectUrl) {
247
254
  console.error(
@@ -255,6 +262,12 @@ program
255
262
  );
256
263
  process.exit(1);
257
264
  }
265
+ if (!manager) {
266
+ console.error(
267
+ 'manager is required. Provide via the config file so that only issues assigned to the manager are picked up.',
268
+ );
269
+ process.exit(1);
270
+ }
258
271
 
259
272
  let maximumPreparingIssuesCount: number | null = null;
260
273
  const rawMaxCount = config.maximumPreparingIssuesCount;
@@ -368,6 +381,7 @@ program
368
381
  utilizationPercentageThreshold:
369
382
  config.utilizationPercentageThreshold ?? 90,
370
383
  allowedIssueAuthors,
384
+ manager,
371
385
  codexHomeCandidates,
372
386
  labelsAsLlmAgentName: config.labelsAsLlmAgentName ?? null,
373
387
  });
@@ -4,6 +4,7 @@ import { fetchGithubGraphql } from '../../repositories/githubGraphqlClient';
4
4
 
5
5
  export type ConfigFile = {
6
6
  projectUrl?: string;
7
+ manager?: string;
7
8
  defaultAgentName?: string;
8
9
  defaultLlmModelName?: string;
9
10
  fallbackLlmModelName?: string;
@@ -109,6 +110,7 @@ export const loadConfigFile = (configFilePath: string): ConfigFile => {
109
110
  }
110
111
  return {
111
112
  projectUrl: getStringValue(parsed, 'projectUrl'),
113
+ manager: getStringValue(parsed, 'manager'),
112
114
  defaultAgentName: getStringValue(parsed, 'defaultAgentName'),
113
115
  defaultLlmModelName: getStringValue(parsed, 'defaultLlmModelName'),
114
116
  fallbackLlmModelName: getStringValue(parsed, 'fallbackLlmModelName'),
@@ -245,6 +247,7 @@ export const mergeConfigs = (
245
247
  readmeOverrides: ConfigFile,
246
248
  ): ConfigFile => ({
247
249
  projectUrl: cliOverrides.projectUrl ?? configFile.projectUrl,
250
+ manager: cliOverrides.manager ?? configFile.manager,
248
251
  defaultAgentName:
249
252
  readmeOverrides.defaultAgentName ??
250
253
  cliOverrides.defaultAgentName ??
@@ -443,6 +443,7 @@ ${JSON.stringify(e)}
443
443
  utilizationPercentageThreshold:
444
444
  input.startPreparation.utilizationPercentageThreshold ?? 90,
445
445
  allowedIssueAuthors,
446
+ manager: input.manager,
446
447
  codexHomeCandidates: input.startPreparation.codexHomeCandidates ?? null,
447
448
  labelsAsLlmAgentName,
448
449
  });