@agentteams/cli 0.1.77 → 0.1.78
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/.eslintcache +1 -1
- package/dist/api/document.d.ts +1 -1
- package/dist/api/document.d.ts.map +1 -1
- package/dist/api/document.js.map +1 -1
- package/dist/commands/agentConfig.d.ts.map +1 -1
- package/dist/commands/agentConfig.js +2 -1
- package/dist/commands/agentConfig.js.map +1 -1
- package/dist/commands/convention.d.ts.map +1 -1
- package/dist/commands/convention.js +3 -2
- package/dist/commands/convention.js.map +1 -1
- package/dist/commands/dependency.d.ts.map +1 -1
- package/dist/commands/dependency.js +2 -1
- package/dist/commands/dependency.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +2 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/mcp/resources.js +2 -2
- package/dist/mcp/resources.js.map +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +3 -2
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools.d.ts +6 -14
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +43 -161
- package/dist/mcp/tools.js.map +1 -1
- package/dist/utils/apiContext.d.ts +9 -0
- package/dist/utils/apiContext.d.ts.map +1 -1
- package/dist/utils/apiContext.js +14 -1
- package/dist/utils/apiContext.js.map +1 -1
- package/dist/utils/entityId.d.ts +12 -0
- package/dist/utils/entityId.d.ts.map +1 -1
- package/dist/utils/entityId.js +2 -4
- package/dist/utils/entityId.js.map +1 -1
- package/dist/utils/searchParams.d.ts +4 -3
- package/dist/utils/searchParams.d.ts.map +1 -1
- package/dist/utils/searchParams.js +5 -20
- package/dist/utils/searchParams.js.map +1 -1
- package/package.json +5 -1
package/dist/mcp/tools.js
CHANGED
|
@@ -1,172 +1,54 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getCoAction } from '../api/coaction.js';
|
|
1
|
+
import { getContextToolSpecs, SEARCH_TOOL_NAME, } from '@agentteams/context-tools';
|
|
2
|
+
import { getCoAction, listCoActions } from '../api/coaction.js';
|
|
3
|
+
import { getCodeReview, getCodeReviewFinding, listCodeReviews } from '../api/codeReview.js';
|
|
4
|
+
import { getComment, listComments, listFindingComments, listTaskComments } from '../api/comment.js';
|
|
3
5
|
import { getConvention, listConventions } from '../api/convention.js';
|
|
4
|
-
import { getDocument } from '../api/document.js';
|
|
5
|
-
import { getPlanRunbook } from '../api/plan.js';
|
|
6
|
-
import { getPostMortem } from '../api/postmortem.js';
|
|
7
|
-
import { getReport } from '../api/report.js';
|
|
6
|
+
import { getDocument, listDocuments } from '../api/document.js';
|
|
7
|
+
import { getPlanRunbook, listPlans } from '../api/plan.js';
|
|
8
|
+
import { getPostMortem, listPostMortems } from '../api/postmortem.js';
|
|
9
|
+
import { getReport, listReports } from '../api/report.js';
|
|
8
10
|
import { searchEntities } from '../api/search.js';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
name: SEARCH_TOOL_NAME,
|
|
20
|
-
title: 'Search AgentTeams',
|
|
21
|
-
description: SEARCH_TOOL_DESCRIPTION,
|
|
22
|
-
// 1:1 with the backend's searchQuerySchema. Defaults for limit/maxTokens
|
|
23
|
-
// stay unset so the backend remains the single source of truth.
|
|
24
|
-
inputSchema: z.object({
|
|
25
|
-
query: z.string().min(1).describe('Search query'),
|
|
26
|
-
types: z.array(z.enum(VALID_TYPES)).optional().describe('Entity types to filter by'),
|
|
27
|
-
limit: z.number().int().min(1).max(100).optional().describe('Max results (backend default: 20)'),
|
|
28
|
-
maxTokens: z.number().int().min(1).optional().describe('Token budget for the response'),
|
|
29
|
-
}),
|
|
30
|
-
// The full payload is passed through verbatim: summarizing away `meta` or
|
|
31
|
-
// `partialFailures` would let an agent read a truncated or partially failed
|
|
32
|
-
// search as "no results".
|
|
33
|
-
handler: async (args, context) => {
|
|
34
|
-
return searchEntities(context.apiUrl, context.projectId, context.headers, buildSearchParams({
|
|
35
|
-
query: args.query,
|
|
36
|
-
types: args.types,
|
|
37
|
-
limit: args.limit,
|
|
38
|
-
maxTokens: args.maxTokens,
|
|
39
|
-
}));
|
|
40
|
-
},
|
|
41
|
-
};
|
|
11
|
+
export { SEARCH_TOOL_NAME };
|
|
12
|
+
function scalarListParams(params) {
|
|
13
|
+
return params;
|
|
14
|
+
}
|
|
15
|
+
function documentListParams(params) {
|
|
16
|
+
return {
|
|
17
|
+
...params,
|
|
18
|
+
...(Array.isArray(params.tags) ? { tags: params.tags.join(',') } : {}),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
42
21
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* in search results and web-UI entity references.
|
|
22
|
+
* Bind the transport-independent context-tool contract to the CLI's existing
|
|
23
|
+
* authenticated HTTP functions. MCP envelopes remain in server.ts.
|
|
46
24
|
*/
|
|
47
|
-
function
|
|
25
|
+
export function createCliContextToolsClient(context) {
|
|
26
|
+
const { apiUrl, projectId, headers } = context;
|
|
48
27
|
return {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
28
|
+
search: (params) => searchEntities(apiUrl, projectId, headers, params),
|
|
29
|
+
listPlans: (params) => listPlans(apiUrl, projectId, headers, scalarListParams(params)),
|
|
30
|
+
getPlan: (id) => getPlanRunbook(apiUrl, projectId, headers, id),
|
|
31
|
+
listCompletionReports: (params) => listReports(apiUrl, projectId, headers, scalarListParams(params)),
|
|
32
|
+
getCompletionReport: (id) => getReport(apiUrl, projectId, headers, id),
|
|
33
|
+
listCoActions: (params) => listCoActions(apiUrl, projectId, headers, scalarListParams(params)),
|
|
34
|
+
getCoAction: (id) => getCoAction(apiUrl, projectId, headers, id),
|
|
35
|
+
listPostMortems: (params) => listPostMortems(apiUrl, projectId, headers, scalarListParams(params)),
|
|
36
|
+
getPostMortem: (id) => getPostMortem(apiUrl, projectId, headers, id),
|
|
37
|
+
listDocuments: (params) => listDocuments(apiUrl, projectId, headers, documentListParams(params)),
|
|
38
|
+
getDocument: (id) => getDocument(apiUrl, projectId, headers, id),
|
|
39
|
+
listConventions: (params) => listConventions(apiUrl, projectId, headers, scalarListParams(params)),
|
|
40
|
+
getConvention: (id) => getConvention(apiUrl, projectId, headers, id),
|
|
41
|
+
listCodeReviews: (params) => listCodeReviews(apiUrl, projectId, headers, scalarListParams(params)),
|
|
42
|
+
getCodeReview: (id) => getCodeReview(apiUrl, projectId, headers, id),
|
|
43
|
+
listComments: (planId, params) => listComments(apiUrl, projectId, headers, planId, scalarListParams(params)),
|
|
44
|
+
listFindingComments: (findingId, params) => listFindingComments(apiUrl, projectId, headers, findingId, scalarListParams(params)),
|
|
45
|
+
listTaskComments: (taskId, params) => listTaskComments(apiUrl, projectId, headers, taskId, scalarListParams(params)),
|
|
46
|
+
getComment: (id) => getComment(apiUrl, projectId, headers, id),
|
|
47
|
+
getCodeReviewFinding: (id, codeReviewId) => getCodeReviewFinding(apiUrl, projectId, headers, id, codeReviewId),
|
|
59
48
|
};
|
|
60
49
|
}
|
|
61
|
-
const planGetToolSpec = createEntityGetToolSpec({
|
|
62
|
-
name: 'agentteams_plan_get',
|
|
63
|
-
title: 'Get AgentTeams Plan',
|
|
64
|
-
description: [
|
|
65
|
-
'Fetch one plan from this project as its full execution runbook: metadata, the complete contentMarkdown body, structured V2 tasks (including dependsOnTaskIds) and progress.',
|
|
66
|
-
'The upstream payload is returned verbatim — nothing is summarized or omitted.',
|
|
67
|
-
'Responses can be large, so check contentTokenCount on the agentteams_search result before fetching the full plan.',
|
|
68
|
-
].join(' '),
|
|
69
|
-
idDescription: 'Plan id (bare uuid or agentteams_pln_-prefixed)',
|
|
70
|
-
fetch: getPlanRunbook,
|
|
71
|
-
});
|
|
72
|
-
const reportGetToolSpec = createEntityGetToolSpec({
|
|
73
|
-
name: 'agentteams_report_get',
|
|
74
|
-
title: 'Get AgentTeams Completion Report',
|
|
75
|
-
description: [
|
|
76
|
-
'Fetch one completion report from this project, including its full content and metrics.',
|
|
77
|
-
'The upstream payload is returned verbatim — nothing is summarized or omitted.',
|
|
78
|
-
'Responses can be large, so check contentTokenCount on the agentteams_search result before fetching the full report.',
|
|
79
|
-
].join(' '),
|
|
80
|
-
idDescription: 'Completion report id (bare uuid or agentteams_rpt_-prefixed)',
|
|
81
|
-
fetch: getReport,
|
|
82
|
-
});
|
|
83
|
-
const coactionGetToolSpec = createEntityGetToolSpec({
|
|
84
|
-
name: 'agentteams_coaction_get',
|
|
85
|
-
title: 'Get AgentTeams Co-Action',
|
|
86
|
-
description: [
|
|
87
|
-
'Fetch one co-action (handoff record) from this project, including its full content.',
|
|
88
|
-
'The upstream payload is returned verbatim — nothing is summarized or omitted.',
|
|
89
|
-
'Responses can be large, so check contentTokenCount on the agentteams_search result before fetching the full co-action.',
|
|
90
|
-
].join(' '),
|
|
91
|
-
idDescription: 'Co-action id (bare uuid or agentteams_act_-prefixed)',
|
|
92
|
-
fetch: getCoAction,
|
|
93
|
-
});
|
|
94
|
-
const postmortemGetToolSpec = createEntityGetToolSpec({
|
|
95
|
-
name: 'agentteams_postmortem_get',
|
|
96
|
-
title: 'Get AgentTeams Post-Mortem',
|
|
97
|
-
description: [
|
|
98
|
-
'Fetch one post-mortem from this project, including its full content.',
|
|
99
|
-
'The upstream payload is returned verbatim — nothing is summarized or omitted.',
|
|
100
|
-
'Responses can be large, so check contentTokenCount on the agentteams_search result before fetching the full post-mortem.',
|
|
101
|
-
].join(' '),
|
|
102
|
-
idDescription: 'Post-mortem id (bare uuid or agentteams_pmt_-prefixed)',
|
|
103
|
-
fetch: getPostMortem,
|
|
104
|
-
});
|
|
105
|
-
const documentGetToolSpec = createEntityGetToolSpec({
|
|
106
|
-
name: 'agentteams_document_get',
|
|
107
|
-
title: 'Get AgentTeams Document',
|
|
108
|
-
description: [
|
|
109
|
-
'Fetch one document from this project, including its full body.',
|
|
110
|
-
'The upstream payload is returned verbatim — nothing is summarized or omitted.',
|
|
111
|
-
'Responses can be large, so check contentTokenCount on the agentteams_search result before fetching the full document.',
|
|
112
|
-
].join(' '),
|
|
113
|
-
idDescription: 'Document id (bare uuid or agentteams_doc_-prefixed)',
|
|
114
|
-
fetch: getDocument,
|
|
115
|
-
});
|
|
116
|
-
const conventionListToolSpec = {
|
|
117
|
-
name: 'agentteams_convention_list',
|
|
118
|
-
title: 'List AgentTeams Conventions',
|
|
119
|
-
description: [
|
|
120
|
-
'List the conventions (coding rules, guides, skills) of this project with optional filters and pagination.',
|
|
121
|
-
'Use agentteams_search to discover relevant conventions; use this tool when you need exact filters or a paginated inventory.',
|
|
122
|
-
'The paginated data/meta envelope is returned verbatim; list items carry metadata only — fetch the full text with agentteams_convention_get.',
|
|
123
|
-
].join(' '),
|
|
124
|
-
// 1:1 with the backend's conventionQuerySchema (+ paginationQuerySchema);
|
|
125
|
-
// defaults stay unset so the backend remains the single source of truth.
|
|
126
|
-
inputSchema: z.object({
|
|
127
|
-
category: z.string().optional().describe('Filter by category (e.g. rules, skills, guides, references)'),
|
|
128
|
-
scope: z.enum(['PROJECT', 'PERSONAL']).optional().describe('Filter by convention scope'),
|
|
129
|
-
archived: z
|
|
130
|
-
.enum(['ACTIVE', 'ARCHIVED', 'ALL'])
|
|
131
|
-
.optional()
|
|
132
|
-
.describe('Filter by archive state (backend default: ACTIVE)'),
|
|
133
|
-
search: z.string().optional().describe('Keyword filter on title/content'),
|
|
134
|
-
createdByMemberId: z.string().optional().describe('Filter by creator member id'),
|
|
135
|
-
page: z.number().int().min(0).optional().describe('Page number (backend default: 1)'),
|
|
136
|
-
pageSize: z.number().int().min(0).max(100).optional().describe('Page size (backend default: 20)'),
|
|
137
|
-
}),
|
|
138
|
-
handler: async (args, context) => {
|
|
139
|
-
const params = {};
|
|
140
|
-
for (const key of ['category', 'scope', 'archived', 'search', 'createdByMemberId', 'page', 'pageSize']) {
|
|
141
|
-
const value = args[key];
|
|
142
|
-
if (typeof value === 'string' || typeof value === 'number')
|
|
143
|
-
params[key] = value;
|
|
144
|
-
}
|
|
145
|
-
return listConventions(context.apiUrl, context.projectId, context.headers, params);
|
|
146
|
-
},
|
|
147
|
-
};
|
|
148
|
-
const conventionGetToolSpec = createEntityGetToolSpec({
|
|
149
|
-
name: 'agentteams_convention_get',
|
|
150
|
-
title: 'Get AgentTeams Convention',
|
|
151
|
-
description: [
|
|
152
|
-
'Fetch one convention from this project, including its full contentMarkdown.',
|
|
153
|
-
'Pass a convention id from agentteams_search, or use agentteams_convention_list first when you need exact filters.',
|
|
154
|
-
'The upstream payload is returned verbatim — nothing is summarized or omitted.',
|
|
155
|
-
].join(' '),
|
|
156
|
-
idDescription: 'Convention id (bare uuid or agentteams_cnv_-prefixed)',
|
|
157
|
-
fetch: getConvention,
|
|
158
|
-
});
|
|
159
50
|
/** Every tool the MCP server exposes, in registration order. */
|
|
160
51
|
export function getToolSpecs() {
|
|
161
|
-
return
|
|
162
|
-
searchToolSpec,
|
|
163
|
-
planGetToolSpec,
|
|
164
|
-
reportGetToolSpec,
|
|
165
|
-
coactionGetToolSpec,
|
|
166
|
-
postmortemGetToolSpec,
|
|
167
|
-
documentGetToolSpec,
|
|
168
|
-
conventionListToolSpec,
|
|
169
|
-
conventionGetToolSpec,
|
|
170
|
-
];
|
|
52
|
+
return getContextToolSpecs();
|
|
171
53
|
}
|
|
172
54
|
//# sourceMappingURL=tools.js.map
|
package/dist/mcp/tools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/mcp/tools.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/mcp/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,gBAAgB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AY;IAC1B,OAAO,mBAAmB,EAAE,CAAC;AAC/B,CAAC"}
|
|
@@ -6,6 +6,15 @@ import type { Config } from '../types/index.js';
|
|
|
6
6
|
* `executeCommand()` but must honour the same override contract.
|
|
7
7
|
*/
|
|
8
8
|
export declare function buildConfigOverrides(options: Record<string, unknown>): Partial<Config>;
|
|
9
|
+
/**
|
|
10
|
+
* Pick the header that matches the credential kind.
|
|
11
|
+
*
|
|
12
|
+
* The server gates `X-API-Key` on the `key_` prefix and rejects anything else
|
|
13
|
+
* before it looks the credential up, so a desktop personal access token
|
|
14
|
+
* (`atp_`) sent that way always fails as "Invalid API key". Personal tokens —
|
|
15
|
+
* and any other bearer credential — authenticate through `Authorization`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function buildAuthHeaders(apiKey: string): Record<string, string>;
|
|
9
18
|
export declare function resolveApiContext(config: Config): {
|
|
10
19
|
apiUrl: string;
|
|
11
20
|
headers: Record<string, string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiContext.d.ts","sourceRoot":"","sources":["../../src/utils/apiContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAIhD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAStF;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAOrG"}
|
|
1
|
+
{"version":3,"file":"apiContext.d.ts","sourceRoot":"","sources":["../../src/utils/apiContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAIhD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAStF;AAKD;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAEvE;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAOrG"}
|
package/dist/utils/apiContext.js
CHANGED
|
@@ -15,10 +15,23 @@ export function buildConfigOverrides(options) {
|
|
|
15
15
|
}
|
|
16
16
|
return overrides;
|
|
17
17
|
}
|
|
18
|
+
/** Agent API keys are the only credential the server accepts on `X-API-Key`. */
|
|
19
|
+
const AGENT_API_KEY_PREFIX = 'key_';
|
|
20
|
+
/**
|
|
21
|
+
* Pick the header that matches the credential kind.
|
|
22
|
+
*
|
|
23
|
+
* The server gates `X-API-Key` on the `key_` prefix and rejects anything else
|
|
24
|
+
* before it looks the credential up, so a desktop personal access token
|
|
25
|
+
* (`atp_`) sent that way always fails as "Invalid API key". Personal tokens —
|
|
26
|
+
* and any other bearer credential — authenticate through `Authorization`.
|
|
27
|
+
*/
|
|
28
|
+
export function buildAuthHeaders(apiKey) {
|
|
29
|
+
return apiKey.startsWith(AGENT_API_KEY_PREFIX) ? { 'X-API-Key': apiKey } : { Authorization: `Bearer ${apiKey}` };
|
|
30
|
+
}
|
|
18
31
|
export function resolveApiContext(config) {
|
|
19
32
|
const apiUrl = config.apiUrl.endsWith('/') ? config.apiUrl.slice(0, -1) : config.apiUrl;
|
|
20
33
|
const headers = {
|
|
21
|
-
|
|
34
|
+
...buildAuthHeaders(config.apiKey),
|
|
22
35
|
'Content-Type': 'application/json',
|
|
23
36
|
};
|
|
24
37
|
return { apiUrl, headers };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apiContext.js","sourceRoot":"","sources":["../../src/utils/apiContext.ts"],"names":[],"mappings":"AAEA,MAAM,oBAAoB,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,CAAU,CAAC;AAElF;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAgC;IACnE,MAAM,SAAS,GAA2B,EAAE,CAAC;IAC7C,KAAK,MAAM,GAAG,IAAI,oBAAoB,EAAE,CAAC;QACvC,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAC3B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAClD,SAAS,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACzB,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,MAAc;IAC9C,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;IACxF,MAAM,OAAO,GAAG;QACd,
|
|
1
|
+
{"version":3,"file":"apiContext.js","sourceRoot":"","sources":["../../src/utils/apiContext.ts"],"names":[],"mappings":"AAEA,MAAM,oBAAoB,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,CAAU,CAAC;AAElF;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAgC;IACnE,MAAM,SAAS,GAA2B,EAAE,CAAC;IAC7C,KAAK,MAAM,GAAG,IAAI,oBAAoB,EAAE,CAAC;QACvC,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAC3B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAClD,SAAS,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACzB,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,gFAAgF;AAChF,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAEpC;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAC7C,OAAO,MAAM,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,UAAU,MAAM,EAAE,EAAE,CAAC;AACnH,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,MAAc;IAC9C,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;IACxF,MAAM,OAAO,GAAG;QACd,GAAG,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC;QAClC,cAAc,EAAE,kBAAkB;KACnC,CAAC;IACF,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAC7B,CAAC"}
|
package/dist/utils/entityId.d.ts
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentTeams web UI entity references embed a type prefix in the id
|
|
3
|
+
* (e.g. `agentteams_pln_<uuid>`). The CLI and API only accept the bare id,
|
|
4
|
+
* so any id pasted from an entity reference must be normalized before use.
|
|
5
|
+
*
|
|
6
|
+
* Canonical prefixes (see `.agentteams/convention.md`):
|
|
7
|
+
* agentteams_pln_ (plan) · agentteams_rpt_ (completionReport)
|
|
8
|
+
* agentteams_rev_ (codeReview) · agentteams_act_ (coAction)
|
|
9
|
+
* agentteams_cnv_ (convention) · agentteams_pmt_ (postMortem)
|
|
10
|
+
* agentteams_doc_ (document) · agentteams_rvf_ (codeReviewFinding)
|
|
11
|
+
* agentteams_tsk_ (planTask)
|
|
12
|
+
*/
|
|
1
13
|
/**
|
|
2
14
|
* Strip a known AgentTeams entity-id prefix from a value. Values without a
|
|
3
15
|
* recognized prefix (bare ids, undefined, non-strings) are returned unchanged.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entityId.d.ts","sourceRoot":"","sources":["../../src/utils/entityId.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"entityId.d.ts","sourceRoot":"","sources":["../../src/utils/entityId.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAElD;AAkBD;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAclG"}
|
package/dist/utils/entityId.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { stripContextEntityIdPrefix } from '@agentteams/context-tools';
|
|
1
2
|
/**
|
|
2
3
|
* AgentTeams web UI entity references embed a type prefix in the id
|
|
3
4
|
* (e.g. `agentteams_pln_<uuid>`). The CLI and API only accept the bare id,
|
|
@@ -10,15 +11,12 @@
|
|
|
10
11
|
* agentteams_doc_ (document) · agentteams_rvf_ (codeReviewFinding)
|
|
11
12
|
* agentteams_tsk_ (planTask)
|
|
12
13
|
*/
|
|
13
|
-
const ENTITY_ID_PREFIX = /^agentteams_(?:pln|rpt|rev|act|cnv|pmt|doc|rvf|tsk)_/;
|
|
14
14
|
/**
|
|
15
15
|
* Strip a known AgentTeams entity-id prefix from a value. Values without a
|
|
16
16
|
* recognized prefix (bare ids, undefined, non-strings) are returned unchanged.
|
|
17
17
|
*/
|
|
18
18
|
export function stripEntityIdPrefix(value) {
|
|
19
|
-
|
|
20
|
-
return value;
|
|
21
|
-
return value.replace(ENTITY_ID_PREFIX, '');
|
|
19
|
+
return stripContextEntityIdPrefix(value);
|
|
22
20
|
}
|
|
23
21
|
/**
|
|
24
22
|
* Whether a CLI option key carries an entity id and should accept prefixed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entityId.js","sourceRoot":"","sources":["../../src/utils/entityId.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"entityId.js","sourceRoot":"","sources":["../../src/utils/entityId.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAEvE;;;;;;;;;;;GAWG;AACH;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAI,KAAQ;IAC7C,OAAO,0BAA0B,CAAC,KAAK,CAAC,CAAC;AAC3C,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAS,mBAAmB,CAAC,GAAW;IACtC,OAAO,GAAG,KAAK,IAAI,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAgC;IACvE,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,MAAM,IAAI,GAA4B,EAAE,GAAG,OAAO,EAAE,CAAC;IACrD,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QACvC,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC;YAAE,SAAS;QACxC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;QACxB,IAAI,OAAO,KAAK,KAAK,QAAQ;YAAE,SAAS;QACxC,MAAM,UAAU,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;QAC9C,IAAI,UAAU,KAAK,KAAK,EAAE,CAAC;YACzB,IAAI,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC;YACvB,OAAO,GAAG,IAAI,CAAC;QACjB,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC;AAClC,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { type ContextToolSearchType } from '@agentteams/context-tools';
|
|
1
2
|
/**
|
|
2
3
|
* Entity types accepted by `GET /api/projects/:projectId/search`.
|
|
3
|
-
*
|
|
4
|
+
* Runtime catalog is owned by `@agentteams/context-tools`.
|
|
4
5
|
*/
|
|
5
|
-
export
|
|
6
|
-
export type SearchEntityType =
|
|
6
|
+
export { CONTEXT_TOOL_SEARCH_TYPES as VALID_TYPES } from '@agentteams/context-tools';
|
|
7
|
+
export type SearchEntityType = ContextToolSearchType;
|
|
7
8
|
export interface SearchParamsInput {
|
|
8
9
|
query: string;
|
|
9
10
|
types?: readonly string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"searchParams.d.ts","sourceRoot":"","sources":["../../src/utils/searchParams.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"searchParams.d.ts","sourceRoot":"","sources":["../../src/utils/searchParams.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAGlG;;;GAGG;AACH,OAAO,EAAE,yBAAyB,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAErF,MAAM,MAAM,gBAAgB,GAAG,qBAAqB,CAAC;AAErD,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,4DAA4D;AAC5D,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAOtD;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC,CAQtG"}
|
|
@@ -1,31 +1,16 @@
|
|
|
1
|
+
import { CONTEXT_TOOL_SEARCH_TYPES } from '@agentteams/context-tools';
|
|
1
2
|
import { splitCsv } from './parsers.js';
|
|
2
3
|
/**
|
|
3
4
|
* Entity types accepted by `GET /api/projects/:projectId/search`.
|
|
4
|
-
*
|
|
5
|
+
* Runtime catalog is owned by `@agentteams/context-tools`.
|
|
5
6
|
*/
|
|
6
|
-
export
|
|
7
|
-
'PLAN',
|
|
8
|
-
'CO_ACTION',
|
|
9
|
-
'COMPLETION_REPORT',
|
|
10
|
-
'POST_MORTEM',
|
|
11
|
-
'CONVENTION',
|
|
12
|
-
'COMMENT',
|
|
13
|
-
'CODE_REVIEW',
|
|
14
|
-
'DOCUMENT',
|
|
15
|
-
'GITHUB_ISSUE',
|
|
16
|
-
'GITHUB_PR',
|
|
17
|
-
'GITLAB_ISSUE',
|
|
18
|
-
'GITLAB_MERGE_REQUEST',
|
|
19
|
-
'BITBUCKET_ISSUE',
|
|
20
|
-
'BITBUCKET_PR',
|
|
21
|
-
'LINEAR_ISSUE',
|
|
22
|
-
];
|
|
7
|
+
export { CONTEXT_TOOL_SEARCH_TYPES as VALID_TYPES } from '@agentteams/context-tools';
|
|
23
8
|
/** Parse and validate a comma-separated `--types` value. */
|
|
24
9
|
export function parseSearchTypes(raw) {
|
|
25
10
|
const types = splitCsv(raw).map((type) => type.toUpperCase());
|
|
26
|
-
const invalid = types.filter((type) => !
|
|
11
|
+
const invalid = types.filter((type) => !CONTEXT_TOOL_SEARCH_TYPES.includes(type));
|
|
27
12
|
if (invalid.length > 0) {
|
|
28
|
-
throw new Error(`Invalid type(s): ${invalid.join(', ')}. Valid types: ${
|
|
13
|
+
throw new Error(`Invalid type(s): ${invalid.join(', ')}. Valid types: ${CONTEXT_TOOL_SEARCH_TYPES.join(', ')}`);
|
|
29
14
|
}
|
|
30
15
|
return types;
|
|
31
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"searchParams.js","sourceRoot":"","sources":["../../src/utils/searchParams.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"searchParams.js","sourceRoot":"","sources":["../../src/utils/searchParams.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAA8B,MAAM,2BAA2B,CAAC;AAClG,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC;;;GAGG;AACH,OAAO,EAAE,yBAAyB,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAWrF,4DAA4D;AAC5D,MAAM,UAAU,gBAAgB,CAAC,GAAW;IAC1C,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;IAC9D,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,yBAAyB,CAAC,QAAQ,CAAC,IAAwB,CAAC,CAAC,CAAC;IACtG,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,oBAAoB,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAwB;IACxD,MAAM,MAAM,GAA+C,EAAE,CAAC,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;IAE9E,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS;QAAE,MAAM,CAAC,KAAK,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;IAC/D,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS;QAAE,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IAC1D,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS;QAAE,MAAM,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;IAEtE,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentteams/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.78",
|
|
4
4
|
"description": "CLI tool for AgentTeams API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
"typecheck": "tsc --noEmit",
|
|
16
16
|
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
|
|
17
17
|
"test:watch": "node --experimental-vm-modules node_modules/jest/bin/jest.js --watch",
|
|
18
|
+
"test:file": "node --experimental-vm-modules node_modules/jest/bin/jest.js --runTestsByPath",
|
|
19
|
+
"test:related": "node --experimental-vm-modules node_modules/jest/bin/jest.js --findRelatedTests",
|
|
20
|
+
"test:changed": "node --experimental-vm-modules node_modules/jest/bin/jest.js --onlyChanged",
|
|
18
21
|
"lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\" --cache --cache-location .eslintcache --cache-strategy content",
|
|
19
22
|
"format": "prettier --write .",
|
|
20
23
|
"format:check": "prettier --check .",
|
|
@@ -39,6 +42,7 @@
|
|
|
39
42
|
"node": ">=20.12.0"
|
|
40
43
|
},
|
|
41
44
|
"dependencies": {
|
|
45
|
+
"@agentteams/context-tools": "0.1.0",
|
|
42
46
|
"@clack/prompts": "^1.4.0",
|
|
43
47
|
"@modelcontextprotocol/server": "2.0.0-beta.5",
|
|
44
48
|
"axios": "^1.16.1",
|