npm-cli-gh-issue-preparator 1.0.0
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.
- package/.env.example +0 -0
- package/.eslintrc.cjs +65 -0
- package/.github/CODEOWNERS +2 -0
- package/.github/workflows/commit-lint.yml +52 -0
- package/.github/workflows/configs/commitlint.config.js +27 -0
- package/.github/workflows/create-pr.yml +66 -0
- package/.github/workflows/empty-format-test-job.yml +28 -0
- package/.github/workflows/format.yml +25 -0
- package/.github/workflows/publish.yml +47 -0
- package/.github/workflows/test.yml +38 -0
- package/.github/workflows/umino-project.yml +191 -0
- package/.prettierignore +22 -0
- package/.prettierrc +5 -0
- package/CHANGELOG.md +27 -0
- package/CONTRIBUTING.md +107 -0
- package/README.md +49 -0
- package/bin/adapter/entry-points/cli/index.js +72 -0
- package/bin/adapter/entry-points/cli/index.js.map +1 -0
- package/bin/adapter/repositories/GitHubIssueRepository.js +340 -0
- package/bin/adapter/repositories/GitHubIssueRepository.js.map +1 -0
- package/bin/adapter/repositories/GitHubProjectRepository.js +123 -0
- package/bin/adapter/repositories/GitHubProjectRepository.js.map +1 -0
- package/bin/adapter/repositories/NodeLocalCommandRunner.js +34 -0
- package/bin/adapter/repositories/NodeLocalCommandRunner.js.map +1 -0
- package/bin/domain/entities/Issue.js +3 -0
- package/bin/domain/entities/Issue.js.map +1 -0
- package/bin/domain/entities/Project.js +3 -0
- package/bin/domain/entities/Project.js.map +1 -0
- package/bin/domain/usecases/NotifyFinishedIssuePreparationUseCase.js +37 -0
- package/bin/domain/usecases/NotifyFinishedIssuePreparationUseCase.js.map +1 -0
- package/bin/domain/usecases/StartPreparationUseCase.js +31 -0
- package/bin/domain/usecases/StartPreparationUseCase.js.map +1 -0
- package/bin/domain/usecases/adapter-interfaces/IssueRepository.js +3 -0
- package/bin/domain/usecases/adapter-interfaces/IssueRepository.js.map +1 -0
- package/bin/domain/usecases/adapter-interfaces/LocalCommandRunner.js +3 -0
- package/bin/domain/usecases/adapter-interfaces/LocalCommandRunner.js.map +1 -0
- package/bin/domain/usecases/adapter-interfaces/ProjectRepository.js +3 -0
- package/bin/domain/usecases/adapter-interfaces/ProjectRepository.js.map +1 -0
- package/bin/index.js +6 -0
- package/bin/index.js.map +1 -0
- package/commitlint.config.js +6 -0
- package/jest.config.js +33 -0
- package/package.json +75 -0
- package/renovate.json +37 -0
- package/src/adapter/entry-points/cli/index.integration.test.ts +143 -0
- package/src/adapter/entry-points/cli/index.test.ts +165 -0
- package/src/adapter/entry-points/cli/index.ts +110 -0
- package/src/adapter/repositories/GitHubIssueRepository.integration.test.ts +50 -0
- package/src/adapter/repositories/GitHubIssueRepository.test.ts +996 -0
- package/src/adapter/repositories/GitHubIssueRepository.ts +470 -0
- package/src/adapter/repositories/GitHubProjectRepository.test.ts +252 -0
- package/src/adapter/repositories/GitHubProjectRepository.ts +162 -0
- package/src/adapter/repositories/NodeLocalCommandRunner.test.ts +80 -0
- package/src/adapter/repositories/NodeLocalCommandRunner.ts +37 -0
- package/src/domain/entities/Issue.ts +7 -0
- package/src/domain/entities/Project.ts +7 -0
- package/src/domain/usecases/NotifyFinishedIssuePreparationUseCase.test.ts +109 -0
- package/src/domain/usecases/NotifyFinishedIssuePreparationUseCase.ts +48 -0
- package/src/domain/usecases/StartPreparationUseCase.test.ts +150 -0
- package/src/domain/usecases/StartPreparationUseCase.ts +48 -0
- package/src/domain/usecases/adapter-interfaces/IssueRepository.ts +8 -0
- package/src/domain/usecases/adapter-interfaces/LocalCommandRunner.ts +7 -0
- package/src/domain/usecases/adapter-interfaces/ProjectRepository.ts +5 -0
- package/src/index.test.ts +7 -0
- package/src/index.ts +3 -0
- package/tsconfig.build.json +11 -0
- package/tsconfig.json +16 -0
- package/types/adapter/entry-points/cli/index.d.ts +5 -0
- package/types/adapter/entry-points/cli/index.d.ts.map +1 -0
- package/types/adapter/repositories/GitHubIssueRepository.d.ts +14 -0
- package/types/adapter/repositories/GitHubIssueRepository.d.ts.map +1 -0
- package/types/adapter/repositories/GitHubProjectRepository.d.ts +9 -0
- package/types/adapter/repositories/GitHubProjectRepository.d.ts.map +1 -0
- package/types/adapter/repositories/NodeLocalCommandRunner.d.ts +9 -0
- package/types/adapter/repositories/NodeLocalCommandRunner.d.ts.map +1 -0
- package/types/domain/entities/Issue.d.ts +8 -0
- package/types/domain/entities/Issue.d.ts.map +1 -0
- package/types/domain/entities/Project.d.ts +8 -0
- package/types/domain/entities/Project.d.ts.map +1 -0
- package/types/domain/usecases/NotifyFinishedIssuePreparationUseCase.d.ts +20 -0
- package/types/domain/usecases/NotifyFinishedIssuePreparationUseCase.d.ts.map +1 -0
- package/types/domain/usecases/StartPreparationUseCase.d.ts +17 -0
- package/types/domain/usecases/StartPreparationUseCase.d.ts.map +1 -0
- package/types/domain/usecases/adapter-interfaces/IssueRepository.d.ts +8 -0
- package/types/domain/usecases/adapter-interfaces/IssueRepository.d.ts.map +1 -0
- package/types/domain/usecases/adapter-interfaces/LocalCommandRunner.d.ts +8 -0
- package/types/domain/usecases/adapter-interfaces/LocalCommandRunner.d.ts.map +1 -0
- package/types/domain/usecases/adapter-interfaces/ProjectRepository.d.ts +5 -0
- package/types/domain/usecases/adapter-interfaces/ProjectRepository.d.ts.map +1 -0
- package/types/index.d.ts +3 -0
- package/types/index.d.ts.map +1 -0
package/tsconfig.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2020",
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"moduleResolution": "Node",
|
|
6
|
+
"esModuleInterop": true,
|
|
7
|
+
"outDir": "./dist",
|
|
8
|
+
"sourceMap": true,
|
|
9
|
+
"strict": true,
|
|
10
|
+
"forceConsistentCasingInFileNames": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"noFallthroughCasesInSwitch": true
|
|
13
|
+
},
|
|
14
|
+
"include": ["src"],
|
|
15
|
+
"exclude": ["node_modules", "**/__tests__/*"]
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/adapter/entry-points/cli/index.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAqBpC,QAAA,MAAM,OAAO,SAAgB,CAAC;AAoF9B,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IssueRepository } from '../../domain/usecases/adapter-interfaces/IssueRepository';
|
|
2
|
+
import { Issue } from '../../domain/entities/Issue';
|
|
3
|
+
import { Project } from '../../domain/entities/Project';
|
|
4
|
+
export declare class GitHubIssueRepository implements IssueRepository {
|
|
5
|
+
private readonly token;
|
|
6
|
+
constructor(token: string);
|
|
7
|
+
private parseProjectInfo;
|
|
8
|
+
private buildProjectItemsQuery;
|
|
9
|
+
private getStatusOptionId;
|
|
10
|
+
getAllOpened(project: Project): Promise<Issue[]>;
|
|
11
|
+
update(issue: Issue, project: Project): Promise<void>;
|
|
12
|
+
get(issueUrl: string, project: Project): Promise<Issue | null>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=GitHubIssueRepository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitHubIssueRepository.d.ts","sourceRoot":"","sources":["../../../src/adapter/repositories/GitHubIssueRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0DAA0D,CAAC;AAC3F,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAgGxD,qBAAa,qBAAsB,YAAW,eAAe;IAC/C,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAAL,KAAK,EAAE,MAAM;IAE1C,OAAO,CAAC,gBAAgB;IAgBxB,OAAO,CAAC,sBAAsB;YA2FhB,iBAAiB;IAyFzB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAyDhD,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IA2DrD,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;CAwDrE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ProjectRepository } from '../../domain/usecases/adapter-interfaces/ProjectRepository';
|
|
2
|
+
import { Project } from '../../domain/entities/Project';
|
|
3
|
+
export declare class GitHubProjectRepository implements ProjectRepository {
|
|
4
|
+
private readonly token;
|
|
5
|
+
constructor(token: string);
|
|
6
|
+
private parseGitHubProjectUrl;
|
|
7
|
+
getByUrl(url: string): Promise<Project>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=GitHubProjectRepository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitHubProjectRepository.d.ts","sourceRoot":"","sources":["../../../src/adapter/repositories/GitHubProjectRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4DAA4D,CAAC;AAC/F,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAgCxD,qBAAa,uBAAwB,YAAW,iBAAiB;IACnD,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAAL,KAAK,EAAE,MAAM;IAE1C,OAAO,CAAC,qBAAqB;IAiCvB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CA4F9C"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { LocalCommandRunner } from '../../domain/usecases/adapter-interfaces/LocalCommandRunner';
|
|
2
|
+
export declare class NodeLocalCommandRunner implements LocalCommandRunner {
|
|
3
|
+
runCommand(command: string): Promise<{
|
|
4
|
+
stdout: string;
|
|
5
|
+
stderr: string;
|
|
6
|
+
exitCode: number;
|
|
7
|
+
}>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=NodeLocalCommandRunner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NodeLocalCommandRunner.d.ts","sourceRoot":"","sources":["../../../src/adapter/repositories/NodeLocalCommandRunner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6DAA6D,CAAC;AAMjG,qBAAa,sBAAuB,YAAW,kBAAkB;IACzD,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;QACzC,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CAyBH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Issue.d.ts","sourceRoot":"","sources":["../../../src/domain/entities/Issue.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Project.d.ts","sourceRoot":"","sources":["../../../src/domain/entities/Project.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IssueRepository } from './adapter-interfaces/IssueRepository';
|
|
2
|
+
import { ProjectRepository } from './adapter-interfaces/ProjectRepository';
|
|
3
|
+
export declare class IssueNotFoundError extends Error {
|
|
4
|
+
constructor(issueUrl: string);
|
|
5
|
+
}
|
|
6
|
+
export declare class IllegalIssueStatusError extends Error {
|
|
7
|
+
constructor(issueUrl: string, currentStatus: string, expectedStatus: string);
|
|
8
|
+
}
|
|
9
|
+
export declare class NotifyFinishedIssuePreparationUseCase {
|
|
10
|
+
private readonly projectRepository;
|
|
11
|
+
private readonly issueRepository;
|
|
12
|
+
constructor(projectRepository: ProjectRepository, issueRepository: IssueRepository);
|
|
13
|
+
run: (params: {
|
|
14
|
+
projectUrl: string;
|
|
15
|
+
issueUrl: string;
|
|
16
|
+
preparationStatus: string;
|
|
17
|
+
awaitingQualityCheckStatus: string;
|
|
18
|
+
}) => Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=NotifyFinishedIssuePreparationUseCase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotifyFinishedIssuePreparationUseCase.d.ts","sourceRoot":"","sources":["../../../src/domain/usecases/NotifyFinishedIssuePreparationUseCase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAE3E,qBAAa,kBAAmB,SAAQ,KAAK;gBAC/B,QAAQ,EAAE,MAAM;CAI7B;AACD,qBAAa,uBAAwB,SAAQ,KAAK;gBACpC,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM;CAM5E;AAED,qBAAa,qCAAqC;IAE9C,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,eAAe;gBADf,iBAAiB,EAAE,iBAAiB,EACpC,eAAe,EAAE,eAAe;IAGnD,GAAG,GAAU,QAAQ;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,0BAA0B,EAAE,MAAM,CAAC;KACpC,KAAG,OAAO,CAAC,IAAI,CAAC,CAiBf;CACH"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IssueRepository } from './adapter-interfaces/IssueRepository';
|
|
2
|
+
import { ProjectRepository } from './adapter-interfaces/ProjectRepository';
|
|
3
|
+
import { LocalCommandRunner } from './adapter-interfaces/LocalCommandRunner';
|
|
4
|
+
export declare class StartPreparationUseCase {
|
|
5
|
+
private readonly projectRepository;
|
|
6
|
+
private readonly issueRepository;
|
|
7
|
+
private readonly localCommandRunner;
|
|
8
|
+
maximumPreparingIssuesCount: number;
|
|
9
|
+
constructor(projectRepository: ProjectRepository, issueRepository: IssueRepository, localCommandRunner: LocalCommandRunner);
|
|
10
|
+
run: (params: {
|
|
11
|
+
projectUrl: string;
|
|
12
|
+
awaitingWorkspaceStatus: string;
|
|
13
|
+
preparationStatus: string;
|
|
14
|
+
defaultAgentName: string;
|
|
15
|
+
}) => Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=StartPreparationUseCase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StartPreparationUseCase.d.ts","sourceRoot":"","sources":["../../../src/domain/usecases/StartPreparationUseCase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAE7E,qBAAa,uBAAuB;IAGhC,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IAJrC,2BAA2B,SAAK;gBAEb,iBAAiB,EAAE,iBAAiB,EACpC,eAAe,EAAE,eAAe,EAChC,kBAAkB,EAAE,kBAAkB;IAGzD,GAAG,GAAU,QAAQ;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,uBAAuB,EAAE,MAAM,CAAC;QAChC,iBAAiB,EAAE,MAAM,CAAC;QAC1B,gBAAgB,EAAE,MAAM,CAAC;KAC1B,KAAG,OAAO,CAAC,IAAI,CAAC,CA6Bf;CACH"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Issue } from '../../entities/Issue';
|
|
2
|
+
import { Project } from '../../entities/Project';
|
|
3
|
+
export interface IssueRepository {
|
|
4
|
+
getAllOpened(project: Project): Promise<Issue[]>;
|
|
5
|
+
get(issueUrl: string, project: Project): Promise<Issue | null>;
|
|
6
|
+
update(issue: Issue, project: Project): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=IssueRepository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IssueRepository.d.ts","sourceRoot":"","sources":["../../../../src/domain/usecases/adapter-interfaces/IssueRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,MAAM,WAAW,eAAe;IAC9B,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;IACjD,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;IAC/D,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACvD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocalCommandRunner.d.ts","sourceRoot":"","sources":["../../../../src/domain/usecases/adapter-interfaces/LocalCommandRunner.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;QACnC,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;CACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectRepository.d.ts","sourceRoot":"","sources":["../../../../src/domain/usecases/adapter-interfaces/ProjectRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACzC"}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAE3D,OAAO,EAAE,OAAO,EAAE,CAAC"}
|