Repository navigation
Expand file tree
/
Copy pathissue-type.agent.js
More file actions
64 lines (58 loc) · 2.05 KB
/
Copy pathissue-type.agent.js
File metadata and controls
64 lines (58 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/**
* issue-type.agent.js
* @deprecated This agent has been merged into labeling.agent.js (Dec 2024)
* @module scripts/agents/issue-type.agent.js
* @see ./labeling.agent.js for unified label and type management
*
* DEPRECATION NOTICE:
* Issue type detection is now handled by the unified labeling agent.
* This file is kept for backward compatibility only and will be removed in a future release.
* Please update any references to use labeling.agent.js instead.
*
* Migration path:
* - Old: issue-type.agent.js detectIssueType(content)
* - New: labeling.agent.js detectIssueTypeFromContent(title, body)
*/
// Re-export from unified agent for backward compatibility
// Use dynamic import or CommonJS for Jest compatibility
let detectIssueTypeFromContent;
try {
const labelingAgent = require("./labeling.agent.js");
detectIssueTypeFromContent = labelingAgent.detectIssueTypeFromContent;
} catch (e) {
// Fallback for ES module import
// This will be handled at runtime when called as an agent
}
/**
* @deprecated Use detectIssueTypeFromContent from labeling.agent.js
* @param {string} content Issue or PR body/title text.
* @returns {string|null} Canonical type label or null if none matched.
*/
function detectIssueType(content = "") {
console.warn(
"[DEPRECATED] issue-type.agent.js is deprecated. Use labeling.agent.js instead.",
);
// Split content naively for backward compatibility
return detectIssueTypeFromContent(content, "");
}
/**
* @deprecated Use runLabelingAgent from labeling.agent.js
* @param {object} context Optional execution context.
* @returns {Promise<object>} Summary payload.
*/
async function run(context = {}) {
console.warn(
"[DEPRECATED] issue-type.agent.js is deprecated. Use labeling.agent.js instead.",
);
return {
ok: true,
detected: detectIssueType(context.content || ""),
deprecated: true,
message: "This agent has been merged into labeling.agent.js",
};
}
module.exports = {
run,
detectIssueType,
};
// TODO: Remove this shim once all consumers exclusively import labeling.agent.js.