@diff-review-system/drs 3.3.1 ā 4.0.0-rc.4
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/.pi/agents/task/agents-md-updater.md +24 -0
- package/.pi/agents/task/changelog-updater.md +29 -0
- package/.pi/agents/task/review-issue-fixer.md +25 -0
- package/.pi/workflows/github-pr-describe-post.yaml +24 -0
- package/.pi/workflows/github-pr-describe.yaml +23 -0
- package/.pi/workflows/github-pr-post-comment.yaml +19 -0
- package/.pi/workflows/github-pr-review-post.yaml +32 -0
- package/.pi/workflows/github-pr-review.yaml +23 -0
- package/.pi/workflows/github-pr-show-changes.yaml +25 -0
- package/.pi/workflows/gitlab-mr-describe-post.yaml +22 -0
- package/.pi/workflows/gitlab-mr-describe.yaml +21 -0
- package/.pi/workflows/gitlab-mr-post-comment.yaml +17 -0
- package/.pi/workflows/gitlab-mr-review-code-quality.yaml +31 -0
- package/.pi/workflows/gitlab-mr-review-post-code-quality.yaml +40 -0
- package/.pi/workflows/gitlab-mr-review-post.yaml +30 -0
- package/.pi/workflows/gitlab-mr-review.yaml +21 -0
- package/.pi/workflows/gitlab-mr-show-changes.yaml +23 -0
- package/.pi/workflows/local-changelog-update.yaml +23 -0
- package/.pi/workflows/local-fix-review-issues.yaml +42 -0
- package/.pi/workflows/local-review.yaml +17 -0
- package/.pi/workflows/local-staged-review.yaml +17 -0
- package/.pi/workflows/local-update-agents-md.yaml +24 -0
- package/.pi/workflows/tag-changelog-update.yaml +26 -0
- package/README.md +214 -101
- package/dist/ci/runner.d.ts.map +1 -1
- package/dist/ci/runner.js +7 -8
- package/dist/ci/runner.js.map +1 -1
- package/dist/cli/index.js +69 -341
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +25 -23
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/run-agent.d.ts +24 -0
- package/dist/cli/run-agent.d.ts.map +1 -0
- package/dist/cli/run-agent.js +139 -0
- package/dist/cli/run-agent.js.map +1 -0
- package/dist/cli/run-agent.test.d.ts +2 -0
- package/dist/cli/run-agent.test.d.ts.map +1 -0
- package/dist/cli/run-agent.test.js +204 -0
- package/dist/cli/run-agent.test.js.map +1 -0
- package/dist/cli/workflow.d.ts +51 -0
- package/dist/cli/workflow.d.ts.map +1 -0
- package/dist/cli/workflow.js +1229 -0
- package/dist/cli/workflow.js.map +1 -0
- package/dist/cli/workflow.test.d.ts +2 -0
- package/dist/cli/workflow.test.d.ts.map +1 -0
- package/dist/cli/workflow.test.js +1410 -0
- package/dist/cli/workflow.test.js.map +1 -0
- package/dist/lib/agent-id.d.ts +9 -0
- package/dist/lib/agent-id.d.ts.map +1 -0
- package/dist/lib/agent-id.js +32 -0
- package/dist/lib/agent-id.js.map +1 -0
- package/dist/lib/comment-formatter.d.ts +7 -1
- package/dist/lib/comment-formatter.d.ts.map +1 -1
- package/dist/lib/comment-formatter.js +42 -1
- package/dist/lib/comment-formatter.js.map +1 -1
- package/dist/lib/comment-formatter.test.js +33 -0
- package/dist/lib/comment-formatter.test.js.map +1 -1
- package/dist/lib/comment-manager.d.ts +4 -0
- package/dist/lib/comment-manager.d.ts.map +1 -1
- package/dist/lib/comment-manager.js +7 -1
- package/dist/lib/comment-manager.js.map +1 -1
- package/dist/lib/comment-poster.d.ts +2 -2
- package/dist/lib/comment-poster.d.ts.map +1 -1
- package/dist/lib/comment-poster.js +3 -3
- package/dist/lib/comment-poster.js.map +1 -1
- package/dist/lib/comment-poster.test.js +13 -3
- package/dist/lib/comment-poster.test.js.map +1 -1
- package/dist/lib/config-model-overrides.test.d.ts +0 -10
- package/dist/lib/config-model-overrides.test.d.ts.map +1 -1
- package/dist/lib/config-model-overrides.test.js +174 -210
- package/dist/lib/config-model-overrides.test.js.map +1 -1
- package/dist/lib/config.d.ts +111 -34
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +322 -83
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/config.test.js +282 -2
- package/dist/lib/config.test.js.map +1 -1
- package/dist/lib/context-loader.d.ts +4 -4
- package/dist/lib/context-loader.d.ts.map +1 -1
- package/dist/lib/context-loader.js +10 -7
- package/dist/lib/context-loader.js.map +1 -1
- package/dist/lib/context-loader.test.js +31 -26
- package/dist/lib/context-loader.test.js.map +1 -1
- package/dist/lib/description-executor.js +1 -1
- package/dist/lib/description-executor.js.map +1 -1
- package/dist/lib/description-executor.test.js +10 -3
- package/dist/lib/description-executor.test.js.map +1 -1
- package/dist/lib/diff-lines.d.ts +9 -0
- package/dist/lib/diff-lines.d.ts.map +1 -0
- package/dist/lib/diff-lines.js +32 -0
- package/dist/lib/diff-lines.js.map +1 -0
- package/dist/lib/diff-lines.test.d.ts +2 -0
- package/dist/lib/diff-lines.test.d.ts.map +1 -0
- package/dist/lib/diff-lines.test.js +13 -0
- package/dist/lib/diff-lines.test.js.map +1 -0
- package/dist/lib/logger.d.ts +1 -1
- package/dist/lib/logger.d.ts.map +1 -1
- package/dist/lib/review-core.d.ts.map +1 -1
- package/dist/lib/review-core.js +22 -27
- package/dist/lib/review-core.js.map +1 -1
- package/dist/lib/review-core.test.js +37 -23
- package/dist/lib/review-core.test.js.map +1 -1
- package/dist/lib/review-orchestrator.d.ts.map +1 -1
- package/dist/lib/review-orchestrator.js +11 -8
- package/dist/lib/review-orchestrator.js.map +1 -1
- package/dist/lib/review-orchestrator.test.js +27 -6
- package/dist/lib/review-orchestrator.test.js.map +1 -1
- package/dist/lib/unified-review-executor.d.ts +0 -2
- package/dist/lib/unified-review-executor.d.ts.map +1 -1
- package/dist/lib/unified-review-executor.js +7 -13
- package/dist/lib/unified-review-executor.js.map +1 -1
- package/dist/lib/unified-review-executor.test.js +2 -2
- package/dist/lib/unified-review-executor.test.js.map +1 -1
- package/dist/pi/sdk.d.ts.map +1 -1
- package/dist/pi/sdk.js +36 -11
- package/dist/pi/sdk.js.map +1 -1
- package/dist/pi/sdk.test.js +48 -9
- package/dist/pi/sdk.test.js.map +1 -1
- package/dist/runtime/agent-loader.d.ts +10 -6
- package/dist/runtime/agent-loader.d.ts.map +1 -1
- package/dist/runtime/agent-loader.js +53 -27
- package/dist/runtime/agent-loader.js.map +1 -1
- package/dist/runtime/agent-loader.test.js +116 -119
- package/dist/runtime/agent-loader.test.js.map +1 -1
- package/dist/runtime/built-in-paths.d.ts +1 -0
- package/dist/runtime/built-in-paths.d.ts.map +1 -1
- package/dist/runtime/built-in-paths.js +7 -0
- package/dist/runtime/built-in-paths.js.map +1 -1
- package/dist/runtime/client.d.ts +12 -0
- package/dist/runtime/client.d.ts.map +1 -1
- package/dist/runtime/client.js +83 -58
- package/dist/runtime/client.js.map +1 -1
- package/dist/runtime/client.test.js +264 -15
- package/dist/runtime/client.test.js.map +1 -1
- package/dist/runtime/path-config.d.ts +2 -2
- package/dist/runtime/path-config.d.ts.map +1 -1
- package/dist/runtime/path-config.js +8 -8
- package/dist/runtime/path-config.js.map +1 -1
- package/dist/runtime/path-config.test.js +14 -14
- package/dist/runtime/path-config.test.js.map +1 -1
- package/package.json +3 -3
- package/.pi/agents/review/documentation.md +0 -56
- package/.pi/agents/review/performance.md +0 -53
- package/.pi/agents/review/quality.md +0 -59
- package/.pi/agents/review/security.md +0 -53
- package/.pi/agents/review/style.md +0 -132
- package/dist/cli/describe-mr.d.ts +0 -11
- package/dist/cli/describe-mr.d.ts.map +0 -1
- package/dist/cli/describe-mr.js +0 -134
- package/dist/cli/describe-mr.js.map +0 -1
- package/dist/cli/describe-pr.d.ts +0 -12
- package/dist/cli/describe-pr.d.ts.map +0 -1
- package/dist/cli/describe-pr.js +0 -135
- package/dist/cli/describe-pr.js.map +0 -1
- package/dist/cli/post-comments.d.ts +0 -20
- package/dist/cli/post-comments.d.ts.map +0 -1
- package/dist/cli/post-comments.js +0 -225
- package/dist/cli/post-comments.js.map +0 -1
- package/dist/cli/review-local.d.ts +0 -13
- package/dist/cli/review-local.d.ts.map +0 -1
- package/dist/cli/review-local.integration.test.d.ts +0 -2
- package/dist/cli/review-local.integration.test.d.ts.map +0 -1
- package/dist/cli/review-local.integration.test.js +0 -343
- package/dist/cli/review-local.integration.test.js.map +0 -1
- package/dist/cli/review-local.js +0 -90
- package/dist/cli/review-local.js.map +0 -1
- package/dist/cli/review-local.live.e2e.test.d.ts +0 -2
- package/dist/cli/review-local.live.e2e.test.d.ts.map +0 -1
- package/dist/cli/review-local.live.e2e.test.js +0 -153
- package/dist/cli/review-local.live.e2e.test.js.map +0 -1
- package/dist/cli/review-local.test.d.ts +0 -2
- package/dist/cli/review-local.test.d.ts.map +0 -1
- package/dist/cli/review-local.test.js +0 -164
- package/dist/cli/review-local.test.js.map +0 -1
- package/dist/cli/review-mr.d.ts +0 -22
- package/dist/cli/review-mr.d.ts.map +0 -1
- package/dist/cli/review-mr.js +0 -181
- package/dist/cli/review-mr.js.map +0 -1
- package/dist/cli/review-mr.test.d.ts +0 -2
- package/dist/cli/review-mr.test.d.ts.map +0 -1
- package/dist/cli/review-mr.test.js +0 -142
- package/dist/cli/review-mr.test.js.map +0 -1
- package/dist/cli/review-pr.d.ts +0 -22
- package/dist/cli/review-pr.d.ts.map +0 -1
- package/dist/cli/review-pr.js +0 -181
- package/dist/cli/review-pr.js.map +0 -1
- package/dist/cli/review-pr.test.d.ts +0 -2
- package/dist/cli/review-pr.test.d.ts.map +0 -1
- package/dist/cli/review-pr.test.js +0 -137
- package/dist/cli/review-pr.test.js.map +0 -1
- package/dist/cli/review-url.d.ts +0 -35
- package/dist/cli/review-url.d.ts.map +0 -1
- package/dist/cli/review-url.js +0 -110
- package/dist/cli/review-url.js.map +0 -1
- package/dist/cli/review-url.test.d.ts +0 -2
- package/dist/cli/review-url.test.d.ts.map +0 -1
- package/dist/cli/review-url.test.js +0 -132
- package/dist/cli/review-url.test.js.map +0 -1
- package/dist/cli/show-changes.d.ts +0 -15
- package/dist/cli/show-changes.d.ts.map +0 -1
- package/dist/cli/show-changes.js +0 -184
- package/dist/cli/show-changes.js.map +0 -1
|
@@ -2,10 +2,10 @@ import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from 'fs';
|
|
|
2
2
|
import { tmpdir } from 'os';
|
|
3
3
|
import { join, resolve } from 'path';
|
|
4
4
|
import { afterEach, describe, expect, it } from 'vitest';
|
|
5
|
-
import {
|
|
5
|
+
import { resolveAgentPaths } from './path-config.js';
|
|
6
6
|
function createConfig(paths) {
|
|
7
7
|
return {
|
|
8
|
-
|
|
8
|
+
agents: {
|
|
9
9
|
paths: {
|
|
10
10
|
agents: paths.agents,
|
|
11
11
|
skills: paths.skills,
|
|
@@ -13,7 +13,7 @@ function createConfig(paths) {
|
|
|
13
13
|
},
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
-
describe('
|
|
16
|
+
describe('resolveAgentPaths', () => {
|
|
17
17
|
const tempDirs = [];
|
|
18
18
|
function createTempDir(prefix) {
|
|
19
19
|
const dir = mkdtempSync(join(tmpdir(), prefix));
|
|
@@ -27,8 +27,8 @@ describe('resolveReviewPaths', () => {
|
|
|
27
27
|
});
|
|
28
28
|
it('resolves default paths from project root deterministically', () => {
|
|
29
29
|
const projectRoot = createTempDir('drs-path-default-');
|
|
30
|
-
const canonical =
|
|
31
|
-
const nonCanonical =
|
|
30
|
+
const canonical = resolveAgentPaths(projectRoot);
|
|
31
|
+
const nonCanonical = resolveAgentPaths(join(projectRoot, 'nested', '..'));
|
|
32
32
|
expect(canonical.agentsPath).toBe(resolve(projectRoot, '.drs/agents'));
|
|
33
33
|
expect(canonical.skillsPath).toBe(resolve(projectRoot, '.drs/skills'));
|
|
34
34
|
expect(canonical.skillSearchPaths).toEqual([resolve(projectRoot, '.drs/skills')]);
|
|
@@ -39,7 +39,7 @@ describe('resolveReviewPaths', () => {
|
|
|
39
39
|
mkdirSync(join(projectRoot, '.drs', 'skills'), { recursive: true });
|
|
40
40
|
mkdirSync(join(projectRoot, '.agents', 'skills'), { recursive: true });
|
|
41
41
|
mkdirSync(join(projectRoot, '.pi', 'skills'), { recursive: true });
|
|
42
|
-
const result =
|
|
42
|
+
const result = resolveAgentPaths(projectRoot);
|
|
43
43
|
expect(result.skillSearchPaths).toEqual([
|
|
44
44
|
resolve(projectRoot, '.drs/skills'),
|
|
45
45
|
resolve(projectRoot, '.agents/skills'),
|
|
@@ -50,14 +50,14 @@ describe('resolveReviewPaths', () => {
|
|
|
50
50
|
it('uses .agents/skills when .drs/skills is missing', () => {
|
|
51
51
|
const projectRoot = createTempDir('drs-path-agents-skills-');
|
|
52
52
|
mkdirSync(join(projectRoot, '.agents', 'skills'), { recursive: true });
|
|
53
|
-
const result =
|
|
53
|
+
const result = resolveAgentPaths(projectRoot);
|
|
54
54
|
expect(result.skillSearchPaths).toEqual([resolve(projectRoot, '.agents/skills')]);
|
|
55
55
|
expect(result.skillsPath).toBe(resolve(projectRoot, '.agents/skills'));
|
|
56
56
|
});
|
|
57
57
|
it('uses .pi/skills when .drs/skills and .agents/skills are missing', () => {
|
|
58
58
|
const projectRoot = createTempDir('drs-path-pi-skills-');
|
|
59
59
|
mkdirSync(join(projectRoot, '.pi', 'skills'), { recursive: true });
|
|
60
|
-
const result =
|
|
60
|
+
const result = resolveAgentPaths(projectRoot);
|
|
61
61
|
expect(result.skillSearchPaths).toEqual([resolve(projectRoot, '.pi/skills')]);
|
|
62
62
|
expect(result.skillsPath).toBe(resolve(projectRoot, '.pi/skills'));
|
|
63
63
|
});
|
|
@@ -65,7 +65,7 @@ describe('resolveReviewPaths', () => {
|
|
|
65
65
|
const projectRoot = createTempDir('drs-path-relative-');
|
|
66
66
|
mkdirSync(join(projectRoot, 'config', 'agents'), { recursive: true });
|
|
67
67
|
mkdirSync(join(projectRoot, 'config', 'skills'), { recursive: true });
|
|
68
|
-
const result =
|
|
68
|
+
const result = resolveAgentPaths(projectRoot, createConfig({
|
|
69
69
|
agents: 'config/agents',
|
|
70
70
|
skills: 'config/skills',
|
|
71
71
|
}));
|
|
@@ -80,7 +80,7 @@ describe('resolveReviewPaths', () => {
|
|
|
80
80
|
const skillsPath = join(absoluteRoot, 'skills');
|
|
81
81
|
mkdirSync(agentsPath, { recursive: true });
|
|
82
82
|
mkdirSync(skillsPath, { recursive: true });
|
|
83
|
-
const result =
|
|
83
|
+
const result = resolveAgentPaths(projectRoot, createConfig({
|
|
84
84
|
agents: agentsPath,
|
|
85
85
|
skills: skillsPath,
|
|
86
86
|
}));
|
|
@@ -90,21 +90,21 @@ describe('resolveReviewPaths', () => {
|
|
|
90
90
|
});
|
|
91
91
|
it('throws actionable error when repo-relative path escapes project root', () => {
|
|
92
92
|
const projectRoot = createTempDir('drs-path-escape-');
|
|
93
|
-
expect(() =>
|
|
93
|
+
expect(() => resolveAgentPaths(projectRoot, createConfig({ agents: '../shared-agents' }))).toThrow('resolves outside repository root');
|
|
94
94
|
});
|
|
95
95
|
it('throws actionable error when configured path does not exist', () => {
|
|
96
96
|
const projectRoot = createTempDir('drs-path-missing-');
|
|
97
|
-
expect(() =>
|
|
97
|
+
expect(() => resolveAgentPaths(projectRoot, createConfig({ skills: 'missing/skills' }))).toThrow('directory does not exist');
|
|
98
98
|
});
|
|
99
99
|
it('throws actionable error when configured path is not a directory', () => {
|
|
100
100
|
const projectRoot = createTempDir('drs-path-file-');
|
|
101
101
|
const filePath = join(projectRoot, 'agents-file.md');
|
|
102
102
|
writeFileSync(filePath, '# not a directory\n');
|
|
103
|
-
expect(() =>
|
|
103
|
+
expect(() => resolveAgentPaths(projectRoot, createConfig({ agents: filePath }))).toThrow('not a directory');
|
|
104
104
|
});
|
|
105
105
|
it('throws actionable error when configured path is not a string', () => {
|
|
106
106
|
const projectRoot = createTempDir('drs-path-invalid-type-');
|
|
107
|
-
expect(() =>
|
|
107
|
+
expect(() => resolveAgentPaths(projectRoot, createConfig({
|
|
108
108
|
skills: 123,
|
|
109
109
|
}))).toThrow('expected a string path');
|
|
110
110
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path-config.test.js","sourceRoot":"","sources":["../../src/runtime/path-config.test.ts"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M,WAAW,GAAG,aAAa,CAAC,mBAAmB,CAAC,CAAC;QAEvD,MAAM,CAAC,GAAG,EAAE,CACV,iBAAiB,CAAC,WAAW,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAC3E,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iEAAiE,EAAE,GAAG,EAAE;QACzE,MAAM,WAAW,GAAG,aAAa,CAAC,gBAAgB,CAAC,CAAC;QACpD,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;QACrD,aAAa,CAAC,QAAQ,EAAE,qBAAqB,CAAC,CAAC;QAE/C,MAAM,CAAC,GAAG,EAAE,CAAC,iBAAiB,CAAC,WAAW,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CACtF,iBAAiB,CAClB,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8DAA8D,EAAE,GAAG,EAAE;QACtE,MAAM,WAAW,GAAG,aAAa,CAAC,wBAAwB,CAAC,CAAC;QAE5D,MAAM,CAAC,GAAG,EAAE,CACV,iBAAiB,CACf,WAAW,EACX,YAAY,CAAC;YACX,MAAM,EAAE,GAAG;SACZ,CAAC,CACH,CACF,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@diff-review-system/drs",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "4.0.0-rc.4",
|
|
4
|
+
"description": "Workflow-first AI code maintenance for reviews, changelogs, docs, and repository upkeep.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"bin": {
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"license": "Apache-2.0",
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@gitbeaker/node": "^35.8.1",
|
|
54
|
-
"@mariozechner/pi-coding-agent": "0.
|
|
54
|
+
"@mariozechner/pi-coding-agent": "^0.73.1",
|
|
55
55
|
"@octokit/rest": "^21.0.0",
|
|
56
56
|
"ajv": "^8.17.1",
|
|
57
57
|
"chalk": "^5.3.0",
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Documentation accuracy and completeness reviewer
|
|
3
|
-
color: "#4A5568"
|
|
4
|
-
hidden: false
|
|
5
|
-
tools:
|
|
6
|
-
Read: true
|
|
7
|
-
Glob: true
|
|
8
|
-
Grep: true
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
You are an expert technical documentation reviewer with deep expertise in code documentation standards, API documentation best practices, and technical writing. Your primary responsibility is to ensure that documentation accurately reflects implementation details and provides clear, useful information to developers.
|
|
12
|
-
|
|
13
|
-
## Code Documentation Analysis
|
|
14
|
-
|
|
15
|
-
- Verify that all public functions, methods, and classes have appropriate documentation comments
|
|
16
|
-
- Check that parameter descriptions match actual parameter types and purposes
|
|
17
|
-
- Ensure return value documentation accurately describes what the code returns
|
|
18
|
-
- Validate that examples in documentation actually work with the current implementation
|
|
19
|
-
- Confirm that edge cases and error conditions are properly documented
|
|
20
|
-
- Check for outdated comments that reference removed or modified functionality
|
|
21
|
-
|
|
22
|
-
## README Verification
|
|
23
|
-
|
|
24
|
-
- Cross-reference README content with actual implemented features
|
|
25
|
-
- Verify installation instructions are current and complete
|
|
26
|
-
- Check that usage examples reflect the current API
|
|
27
|
-
- Ensure feature lists accurately represent available functionality
|
|
28
|
-
- Validate that configuration options documented in README match actual code
|
|
29
|
-
- Identify any new features missing from README documentation
|
|
30
|
-
|
|
31
|
-
## API Documentation Review
|
|
32
|
-
|
|
33
|
-
- Verify endpoint descriptions match actual implementation
|
|
34
|
-
- Check request/response examples for accuracy
|
|
35
|
-
- Ensure authentication requirements are correctly documented
|
|
36
|
-
- Validate parameter types, constraints, and default values
|
|
37
|
-
- Confirm error response documentation matches actual error handling
|
|
38
|
-
- Check that deprecated endpoints are properly marked
|
|
39
|
-
|
|
40
|
-
## Quality Standards
|
|
41
|
-
|
|
42
|
-
- Flag documentation that is vague, ambiguous, or misleading
|
|
43
|
-
- Identify missing documentation for public interfaces
|
|
44
|
-
- Note inconsistencies between documentation and implementation
|
|
45
|
-
- Suggest improvements for clarity and completeness
|
|
46
|
-
- Ensure documentation follows project-specific standards
|
|
47
|
-
|
|
48
|
-
## Review Structure Guidance
|
|
49
|
-
|
|
50
|
-
- Start with a summary of overall documentation quality
|
|
51
|
-
- List specific issues found, categorized by type (code comments, README, API docs)
|
|
52
|
-
- For each issue, provide: file/location, current state, recommended fix
|
|
53
|
-
- Prioritize issues by severity (critical inaccuracies vs. minor improvements)
|
|
54
|
-
- End with actionable recommendations
|
|
55
|
-
|
|
56
|
-
Be thorough but focused, identifying genuine documentation issues rather than stylistic preferences. When documentation is accurate and complete, acknowledge this clearly.
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Performance and optimization expert
|
|
3
|
-
color: "#DD6B20"
|
|
4
|
-
hidden: false
|
|
5
|
-
tools:
|
|
6
|
-
Read: true
|
|
7
|
-
Glob: true
|
|
8
|
-
Grep: true
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
You are an elite performance optimization specialist with deep expertise in identifying and resolving performance bottlenecks across all layers of software systems. Your mission is to conduct thorough performance reviews that uncover inefficiencies and provide actionable optimization recommendations.
|
|
12
|
-
|
|
13
|
-
## Performance Bottleneck Analysis
|
|
14
|
-
|
|
15
|
-
- Examine algorithmic complexity and identify O(n²) or worse operations that could be optimized
|
|
16
|
-
- Detect unnecessary computations, redundant operations, or repeated work
|
|
17
|
-
- Identify blocking operations that could benefit from asynchronous execution
|
|
18
|
-
- Review loop structures for inefficient iterations or nested loops that could be flattened
|
|
19
|
-
- Check for premature optimization vs. legitimate performance concerns
|
|
20
|
-
|
|
21
|
-
## Network Query Efficiency
|
|
22
|
-
|
|
23
|
-
- Analyze database queries for N+1 problems and missing indexes
|
|
24
|
-
- Review API calls for batching opportunities and unnecessary round trips
|
|
25
|
-
- Check for proper use of pagination, filtering, and projection in data fetching
|
|
26
|
-
- Identify opportunities for caching, memoization, or request deduplication
|
|
27
|
-
- Examine connection pooling and resource reuse patterns
|
|
28
|
-
- Verify proper error handling that doesn't cause retry storms
|
|
29
|
-
|
|
30
|
-
## Memory and Resource Management
|
|
31
|
-
|
|
32
|
-
- Detect potential memory leaks from unclosed connections, event listeners, or circular references
|
|
33
|
-
- Review object lifecycle management and garbage collection implications
|
|
34
|
-
- Identify excessive memory allocation or large object creation in loops
|
|
35
|
-
- Check for proper cleanup in cleanup functions, destructors, or finally blocks
|
|
36
|
-
- Analyze data structure choices for memory efficiency
|
|
37
|
-
- Review file handles, database connections, and other resource cleanup
|
|
38
|
-
|
|
39
|
-
## Review Structure Guidance
|
|
40
|
-
|
|
41
|
-
1. **Critical Issues**: Immediate performance problems requiring attention
|
|
42
|
-
2. **Optimization Opportunities**: Improvements that would yield measurable benefits
|
|
43
|
-
3. **Best Practice Recommendations**: Preventive measures for future performance
|
|
44
|
-
4. **Code Examples**: Specific before/after snippets demonstrating improvements
|
|
45
|
-
|
|
46
|
-
For each issue identified:
|
|
47
|
-
|
|
48
|
-
- Specify the exact location (file, function, line numbers)
|
|
49
|
-
- Explain the performance impact with estimated complexity or resource usage
|
|
50
|
-
- Provide concrete, implementable solutions
|
|
51
|
-
- Prioritize recommendations by impact vs. effort
|
|
52
|
-
|
|
53
|
-
If code appears performant, confirm this explicitly and note any particularly well-optimized sections.
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Code quality, patterns, and maintainability expert
|
|
3
|
-
color: "#3182CE"
|
|
4
|
-
hidden: false
|
|
5
|
-
tools:
|
|
6
|
-
Read: true
|
|
7
|
-
Glob: true
|
|
8
|
-
Grep: true
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
You are an expert code quality reviewer with deep expertise in software engineering best practices, clean code principles, and maintainable architecture. Your role is to provide thorough, constructive code reviews focused on quality, readability, and long-term maintainability.
|
|
12
|
-
|
|
13
|
-
## Clean Code Analysis
|
|
14
|
-
|
|
15
|
-
- Evaluate naming conventions for clarity and descriptiveness
|
|
16
|
-
- Assess function and method sizes for single responsibility adherence
|
|
17
|
-
- Check for code duplication and suggest DRY improvements
|
|
18
|
-
- Identify overly complex logic that could be simplified
|
|
19
|
-
- Verify proper separation of concerns
|
|
20
|
-
|
|
21
|
-
## Error Handling & Edge Cases
|
|
22
|
-
|
|
23
|
-
- Identify missing error handling for potential failure points
|
|
24
|
-
- Evaluate the robustness of input validation
|
|
25
|
-
- Check for proper handling of null/undefined values
|
|
26
|
-
- Assess edge case coverage (empty arrays, boundary conditions, etc.)
|
|
27
|
-
- Verify appropriate use of try/catch blocks and error propagation
|
|
28
|
-
|
|
29
|
-
## Readability & Maintainability
|
|
30
|
-
|
|
31
|
-
- Evaluate code structure and organization
|
|
32
|
-
- Check for appropriate use of comments (avoid over-commenting obvious code)
|
|
33
|
-
- Assess the clarity of control flow
|
|
34
|
-
- Identify magic numbers or strings that should be constants
|
|
35
|
-
- Verify consistent code style and formatting
|
|
36
|
-
|
|
37
|
-
## TypeScript-Specific Considerations (when applicable)
|
|
38
|
-
|
|
39
|
-
- Prefer `type` over `interface` as per project standards
|
|
40
|
-
- Avoid unnecessary use of underscores for unused variables
|
|
41
|
-
- Ensure proper type safety and avoid `any` types when possible
|
|
42
|
-
|
|
43
|
-
## Best Practices
|
|
44
|
-
|
|
45
|
-
- Evaluate adherence to SOLID principles
|
|
46
|
-
- Check for proper use of design patterns where appropriate
|
|
47
|
-
- Assess performance implications of implementation choices
|
|
48
|
-
- Verify security considerations (input sanitization, sensitive data handling)
|
|
49
|
-
|
|
50
|
-
## Review Structure Guidance
|
|
51
|
-
|
|
52
|
-
- Start with a brief summary of overall code quality
|
|
53
|
-
- Organize findings by severity (critical, important, minor)
|
|
54
|
-
- Provide specific examples with line references when possible
|
|
55
|
-
- Suggest concrete improvements with code examples
|
|
56
|
-
- Highlight positive aspects and good practices observed
|
|
57
|
-
- End with actionable recommendations prioritized by impact
|
|
58
|
-
|
|
59
|
-
Be constructive and educational. If the code is well-written, acknowledge this and provide suggestions for potential enhancements rather than forcing criticism.
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Security vulnerability and OWASP Top 10 specialist
|
|
3
|
-
color: "#E53E3E"
|
|
4
|
-
hidden: false
|
|
5
|
-
tools:
|
|
6
|
-
Read: true
|
|
7
|
-
Glob: true
|
|
8
|
-
Grep: true
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
You are an elite security code reviewer with deep expertise in application security, threat modeling, and secure coding practices. Your mission is to identify and prevent security vulnerabilities before they reach production.
|
|
12
|
-
|
|
13
|
-
## Security Vulnerability Assessment
|
|
14
|
-
|
|
15
|
-
- Systematically scan for OWASP Top 10 vulnerabilities (injection flaws, broken authentication, sensitive data exposure, XXE, broken access control, security misconfiguration, XSS, insecure deserialization, using components with known vulnerabilities, insufficient logging)
|
|
16
|
-
- Identify potential SQL injection, NoSQL injection, and command injection vulnerabilities
|
|
17
|
-
- Check for cross-site scripting (XSS) vulnerabilities in any user-facing output
|
|
18
|
-
- Look for cross-site request forgery (CSRF) protection gaps
|
|
19
|
-
- Examine cryptographic implementations for weak algorithms or improper key management
|
|
20
|
-
- Identify potential race conditions and time-of-check-time-of-use (TOCTOU) vulnerabilities
|
|
21
|
-
|
|
22
|
-
## Input Validation and Sanitization
|
|
23
|
-
|
|
24
|
-
- Verify all user inputs are properly validated against expected formats and ranges
|
|
25
|
-
- Ensure input sanitization occurs at appropriate boundaries (client-side validation is supplementary, never primary)
|
|
26
|
-
- Check for proper encoding when outputting user data
|
|
27
|
-
- Validate that file uploads have proper type checking, size limits, and content validation
|
|
28
|
-
- Ensure API parameters are validated for type, format, and business logic constraints
|
|
29
|
-
- Look for potential path traversal vulnerabilities in file operations
|
|
30
|
-
|
|
31
|
-
## Authentication and Authorization Review
|
|
32
|
-
|
|
33
|
-
- Verify authentication mechanisms use secure, industry-standard approaches
|
|
34
|
-
- Check for proper session management (secure cookies, appropriate timeouts, session invalidation)
|
|
35
|
-
- Ensure passwords are properly hashed using modern algorithms (bcrypt, Argon2, PBKDF2)
|
|
36
|
-
- Validate that authorization checks occur at every protected resource access
|
|
37
|
-
- Look for privilege escalation opportunities
|
|
38
|
-
- Check for insecure direct object references (IDOR)
|
|
39
|
-
- Verify proper implementation of role-based or attribute-based access control
|
|
40
|
-
|
|
41
|
-
## Analysis Methodology
|
|
42
|
-
|
|
43
|
-
1. Identify the security context and attack surface of the code
|
|
44
|
-
2. Map data flows from untrusted sources to sensitive operations
|
|
45
|
-
3. Examine each security-critical operation for proper controls
|
|
46
|
-
4. Consider both common vulnerabilities and context-specific threats
|
|
47
|
-
5. Evaluate defense-in-depth measures
|
|
48
|
-
|
|
49
|
-
## Review Structure Guidance
|
|
50
|
-
|
|
51
|
-
Provide findings in order of severity (Critical, High, Medium, Low, Informational). If no security issues are found, provide a brief summary confirming the review was completed and highlighting any positive security practices observed.
|
|
52
|
-
|
|
53
|
-
Always consider the principle of least privilege, defense in depth, and fail securely. When uncertain about a potential vulnerability, err on the side of caution and flag it for further investigation.
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Code style, formatting, and documentation specialist
|
|
3
|
-
color: "#805AD5"
|
|
4
|
-
hidden: false
|
|
5
|
-
tools:
|
|
6
|
-
Read: true
|
|
7
|
-
Glob: true
|
|
8
|
-
Grep: true
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
You are a code style reviewer ensuring consistency and documentation quality.
|
|
12
|
-
|
|
13
|
-
## Focus Areas
|
|
14
|
-
|
|
15
|
-
### 1. Naming Conventions
|
|
16
|
-
- camelCase vs snake_case vs PascalCase
|
|
17
|
-
- Descriptive variable names
|
|
18
|
-
- Avoid abbreviations
|
|
19
|
-
- Boolean names (is/has/should)
|
|
20
|
-
|
|
21
|
-
### 2. Code Formatting
|
|
22
|
-
- Indentation consistency
|
|
23
|
-
- Line length (< 100 chars recommended)
|
|
24
|
-
- Spacing and alignment
|
|
25
|
-
- Import organization
|
|
26
|
-
|
|
27
|
-
### 3. Documentation
|
|
28
|
-
- Missing function/class documentation
|
|
29
|
-
- Outdated comments
|
|
30
|
-
- JSDoc/TSDoc completeness
|
|
31
|
-
- README updates needed
|
|
32
|
-
- New CLI flags or config options documented in README
|
|
33
|
-
- Command examples formatted consistently and kept up-to-date
|
|
34
|
-
- Markdown formatting issues (headings, code fences, lists, links)
|
|
35
|
-
- Consistent terminology for key concepts and feature names
|
|
36
|
-
|
|
37
|
-
### 4. Type Safety (TypeScript)
|
|
38
|
-
- Missing type annotations
|
|
39
|
-
- Using `any` unnecessarily
|
|
40
|
-
- Proper generic usage
|
|
41
|
-
- Interface vs type alias
|
|
42
|
-
|
|
43
|
-
### 5. Best Practices
|
|
44
|
-
- Unused imports/variables
|
|
45
|
-
- Console.log statements
|
|
46
|
-
- TODO/FIXME comments
|
|
47
|
-
- File organization
|
|
48
|
-
|
|
49
|
-
## Review Format
|
|
50
|
-
|
|
51
|
-
**IMPORTANT**: You MUST output your findings in structured JSON format for automated processing.
|
|
52
|
-
|
|
53
|
-
After your analysis, provide a JSON code block with all issues found:
|
|
54
|
-
|
|
55
|
-
```json
|
|
56
|
-
{
|
|
57
|
-
"issues": [
|
|
58
|
-
{
|
|
59
|
-
"category": "STYLE",
|
|
60
|
-
"severity": "CRITICAL" | "HIGH" | "MEDIUM" | "LOW",
|
|
61
|
-
"title": "Brief title of the style issue",
|
|
62
|
-
"file": "path/to/file.ts",
|
|
63
|
-
"line": 42,
|
|
64
|
-
"problem": "Description of the style violation",
|
|
65
|
-
"solution": "Corrected version or suggestion",
|
|
66
|
-
"references": ["https://style-guide-url/..."],
|
|
67
|
-
"agent": "style"
|
|
68
|
-
}
|
|
69
|
-
]
|
|
70
|
-
}
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
**Required fields**: category, severity, title, file, problem, solution
|
|
74
|
-
**Optional fields**: line (line number), references (array of URLs)
|
|
75
|
-
|
|
76
|
-
## Examples
|
|
77
|
-
|
|
78
|
-
### Naming
|
|
79
|
-
|
|
80
|
-
```typescript
|
|
81
|
-
// ā POOR NAMING
|
|
82
|
-
const d = new Date()
|
|
83
|
-
const usr = getUser()
|
|
84
|
-
const f = (x) => x * 2
|
|
85
|
-
|
|
86
|
-
// ā
CLEAR NAMING
|
|
87
|
-
const currentDate = new Date()
|
|
88
|
-
const currentUser = getUser()
|
|
89
|
-
const double = (value: number) => value * 2
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### Documentation
|
|
93
|
-
|
|
94
|
-
```typescript
|
|
95
|
-
// ā MISSING DOCS
|
|
96
|
-
function calculateDiscount(price: number, code: string) {
|
|
97
|
-
// implementation
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// ā
DOCUMENTED
|
|
101
|
-
/**
|
|
102
|
-
* Calculates the discounted price based on promo code
|
|
103
|
-
* @param price - Original price in cents
|
|
104
|
-
* @param code - Promotional discount code
|
|
105
|
-
* @returns Discounted price in cents
|
|
106
|
-
* @throws {Error} If promo code is invalid
|
|
107
|
-
*/
|
|
108
|
-
function calculateDiscount(price: number, code: string): number {
|
|
109
|
-
// implementation
|
|
110
|
-
}
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
### Type Safety
|
|
114
|
-
|
|
115
|
-
```typescript
|
|
116
|
-
// ā ANY TYPES
|
|
117
|
-
function processData(data: any): any {
|
|
118
|
-
return data.map((item: any) => item.value)
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// ā
PROPER TYPES
|
|
122
|
-
interface DataItem {
|
|
123
|
-
value: string
|
|
124
|
-
id: number
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
function processData(data: DataItem[]): string[] {
|
|
128
|
-
return data.map(item => item.value)
|
|
129
|
-
}
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
Focus on consistency with the existing codebase. Check for project-specific style guides.
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { type DRSConfig } from '../lib/config.js';
|
|
2
|
-
export interface DescribeMROptions {
|
|
3
|
-
projectId: string;
|
|
4
|
-
mrIid: number;
|
|
5
|
-
postDescription?: boolean;
|
|
6
|
-
outputPath?: string;
|
|
7
|
-
jsonOutput?: boolean;
|
|
8
|
-
debug?: boolean;
|
|
9
|
-
}
|
|
10
|
-
export declare function describeMR(config: DRSConfig, options: DescribeMROptions): Promise<void>;
|
|
11
|
-
//# sourceMappingURL=describe-mr.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"describe-mr.d.ts","sourceRoot":"","sources":["../../src/cli/describe-mr.ts"],"names":[],"mappings":"AACA,OAAO,EAA+C,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAyB/F,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,wBAAsB,UAAU,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,iBAAiB,iBAsK7E"}
|
package/dist/cli/describe-mr.js
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import { getDescriberModelOverride, getRuntimeConfig } from '../lib/config.js';
|
|
3
|
-
import { createGitLabClient } from '../gitlab/client.js';
|
|
4
|
-
import { GitLabPlatformAdapter } from '../gitlab/platform-adapter.js';
|
|
5
|
-
import { createRuntimeClientInstance } from '../runtime/client.js';
|
|
6
|
-
import { buildDescribeInstructions } from '../lib/describe-core.js';
|
|
7
|
-
import { loadGlobalContext } from '../lib/context-loader.js';
|
|
8
|
-
import { displayDescription, normalizeDescription, postDescription, } from '../lib/description-formatter.js';
|
|
9
|
-
import { prepareDiffsForAgent, formatCompressionSummary, resolveCompressionBudget, } from '../lib/context-compression.js';
|
|
10
|
-
import { parseDescribeOutput } from '../lib/describe-parser.js';
|
|
11
|
-
import { aggregateAgentUsage, applyUsageMessage, createAgentUsageSummary, } from '../lib/review-usage.js';
|
|
12
|
-
import { estimatePromptBudget, formatPromptBudgetEstimate } from '../lib/prompt-budget.js';
|
|
13
|
-
export async function describeMR(config, options) {
|
|
14
|
-
console.log(chalk.bold.blue('\nš Generating MR Description\n'));
|
|
15
|
-
// Initialize GitLab client
|
|
16
|
-
const gitlabClient = createGitLabClient();
|
|
17
|
-
const platformAdapter = new GitLabPlatformAdapter(gitlabClient);
|
|
18
|
-
// Fetch MR files
|
|
19
|
-
console.log(chalk.dim(`Fetching MR !${options.mrIid} from project ${options.projectId}...`));
|
|
20
|
-
const files = await platformAdapter.getChangedFiles(options.projectId, options.mrIid);
|
|
21
|
-
console.log(chalk.dim(`Found ${files.length} changed files\n`));
|
|
22
|
-
// Build context for the describer agent
|
|
23
|
-
const label = `MR !${options.mrIid}`;
|
|
24
|
-
const filesWithDiffs = files.map((file) => ({
|
|
25
|
-
filename: file.filename,
|
|
26
|
-
patch: file.patch,
|
|
27
|
-
}));
|
|
28
|
-
// Initialize Pi runtime client with model overrides
|
|
29
|
-
const modelOverrides = getDescriberModelOverride(config);
|
|
30
|
-
const describeModelId = modelOverrides['describe/pr-describer'];
|
|
31
|
-
const runtimeConfig = getRuntimeConfig(config);
|
|
32
|
-
const runtimeClient = await createRuntimeClientInstance({
|
|
33
|
-
directory: process.cwd(),
|
|
34
|
-
modelOverrides,
|
|
35
|
-
provider: runtimeConfig.provider,
|
|
36
|
-
config,
|
|
37
|
-
debug: options.debug,
|
|
38
|
-
});
|
|
39
|
-
const describeModelIds = [...new Set(Object.values(modelOverrides))].filter((id) => !!id);
|
|
40
|
-
const contextWindow = runtimeClient.getMinContextWindow(describeModelIds);
|
|
41
|
-
const compressionOptions = resolveCompressionBudget(contextWindow, config.contextCompression);
|
|
42
|
-
const compression = prepareDiffsForAgent(filesWithDiffs, compressionOptions);
|
|
43
|
-
const compressionSummary = formatCompressionSummary(compression);
|
|
44
|
-
if (compressionSummary) {
|
|
45
|
-
console.log(chalk.yellow('ā Diff content trimmed to fit token budget.\n'));
|
|
46
|
-
}
|
|
47
|
-
const includeProjectContext = config.describe?.includeProjectContext ?? true;
|
|
48
|
-
const projectContext = includeProjectContext ? loadGlobalContext() : null;
|
|
49
|
-
const instructions = buildDescribeInstructions(label, compression.files, compressionSummary, projectContext ?? undefined);
|
|
50
|
-
const promptContextWindow = describeModelId
|
|
51
|
-
? runtimeClient.getModelContextWindow?.(describeModelId)
|
|
52
|
-
: contextWindow;
|
|
53
|
-
const promptEstimate = estimatePromptBudget(instructions, {
|
|
54
|
-
tokenEstimateDivisor: config.contextCompression?.tokenEstimateDivisor,
|
|
55
|
-
contextWindow: promptContextWindow,
|
|
56
|
-
});
|
|
57
|
-
const modelText = describeModelId ? ` | model: ${describeModelId}` : '';
|
|
58
|
-
console.log(chalk.gray(`${formatPromptBudgetEstimate('describe/pr-describer', promptEstimate)}${modelText}\n`));
|
|
59
|
-
if (options.debug) {
|
|
60
|
-
console.log(chalk.yellow('\n=== Agent Instructions ==='));
|
|
61
|
-
console.log(instructions);
|
|
62
|
-
console.log(chalk.yellow('=== End Instructions ===\n'));
|
|
63
|
-
}
|
|
64
|
-
try {
|
|
65
|
-
console.log(chalk.dim('Running MR describer agent...\n'));
|
|
66
|
-
// Run the describer agent
|
|
67
|
-
const agentType = 'describe/pr-describer';
|
|
68
|
-
const session = await runtimeClient.createSession({
|
|
69
|
-
agent: agentType,
|
|
70
|
-
message: instructions,
|
|
71
|
-
});
|
|
72
|
-
// Collect all assistant messages from the session
|
|
73
|
-
let usageByAgent = createAgentUsageSummary(agentType);
|
|
74
|
-
let fullResponse = '';
|
|
75
|
-
for await (const message of runtimeClient.streamMessages(session.id)) {
|
|
76
|
-
if (message.role === 'assistant') {
|
|
77
|
-
usageByAgent = applyUsageMessage(usageByAgent, message);
|
|
78
|
-
fullResponse += message.content;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
// Parse the JSON output from the agent
|
|
82
|
-
let description;
|
|
83
|
-
try {
|
|
84
|
-
description = await parseDescribeOutput(process.cwd(), options.debug, fullResponse);
|
|
85
|
-
}
|
|
86
|
-
catch (parseError) {
|
|
87
|
-
console.error(chalk.red('Failed to parse agent output as JSON'));
|
|
88
|
-
console.log(chalk.dim('Agent output:'), fullResponse);
|
|
89
|
-
const reason = parseError instanceof Error ? `: ${parseError.message}` : '';
|
|
90
|
-
throw new Error(`Agent did not return valid JSON output${reason}`);
|
|
91
|
-
}
|
|
92
|
-
let normalizedDescription;
|
|
93
|
-
try {
|
|
94
|
-
normalizedDescription = normalizeDescription(description);
|
|
95
|
-
}
|
|
96
|
-
catch (validationError) {
|
|
97
|
-
console.error(chalk.red('Agent output did not match expected description schema'));
|
|
98
|
-
console.log(chalk.dim('Agent output:'), fullResponse);
|
|
99
|
-
throw validationError;
|
|
100
|
-
}
|
|
101
|
-
const usageSummary = aggregateAgentUsage([
|
|
102
|
-
{
|
|
103
|
-
...usageByAgent,
|
|
104
|
-
success: true,
|
|
105
|
-
},
|
|
106
|
-
]);
|
|
107
|
-
// Display the description unless we're posting it to avoid noisy CI logs
|
|
108
|
-
if (options.postDescription) {
|
|
109
|
-
console.log(chalk.gray('Description generated (suppressed in logs because --post-description is enabled).'));
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
displayDescription(normalizedDescription, 'MR', usageSummary);
|
|
113
|
-
}
|
|
114
|
-
// Save to JSON file if requested
|
|
115
|
-
if (options.outputPath) {
|
|
116
|
-
const fs = await import('fs/promises');
|
|
117
|
-
await fs.writeFile(options.outputPath, JSON.stringify(normalizedDescription, null, 2), 'utf-8');
|
|
118
|
-
console.log(chalk.green(`\nā Description saved to ${options.outputPath}`));
|
|
119
|
-
}
|
|
120
|
-
// Output JSON if requested
|
|
121
|
-
if (options.jsonOutput) {
|
|
122
|
-
console.log('\n' + JSON.stringify(normalizedDescription, null, 2));
|
|
123
|
-
}
|
|
124
|
-
// Post description to MR if requested
|
|
125
|
-
if (options.postDescription) {
|
|
126
|
-
await postDescription(platformAdapter, options.projectId, options.mrIid, normalizedDescription, 'MR', usageSummary);
|
|
127
|
-
}
|
|
128
|
-
console.log(chalk.green('\nā MR description generated successfully\n'));
|
|
129
|
-
}
|
|
130
|
-
finally {
|
|
131
|
-
await runtimeClient.shutdown();
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
//# sourceMappingURL=describe-mr.js.map
|