@amaster.ai/pi-teamwork 0.1.2-beta.10
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/LICENSE +201 -0
- package/README.md +61 -0
- package/dist/adapters/multica.d.ts +19 -0
- package/dist/adapters/multica.d.ts.map +1 -0
- package/dist/adapters/multica.js +183 -0
- package/dist/adapters/multica.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +219 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +74 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +70 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# @amaster.ai/pi-teamwork
|
|
2
|
+
|
|
3
|
+
Pi extension for team collaboration and project management. Provides LLM-callable tools to interact with issue trackers and project management systems.
|
|
4
|
+
|
|
5
|
+
## Supported Providers
|
|
6
|
+
|
|
7
|
+
- **Multica** — CLI-based adapter via [multica](https://github.com/multica-ai/multica)
|
|
8
|
+
|
|
9
|
+
## Configuration
|
|
10
|
+
|
|
11
|
+
Add to `.pi/settings.json`:
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"pi-teamwork": {
|
|
16
|
+
"enabled": true,
|
|
17
|
+
"provider": "multica",
|
|
18
|
+
"multica": {
|
|
19
|
+
"binary": "multica",
|
|
20
|
+
"workspace": "",
|
|
21
|
+
"token": ""
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
| Field | Description |
|
|
28
|
+
|-------|-------------|
|
|
29
|
+
| `enabled` | Enable/disable the extension |
|
|
30
|
+
| `provider` | Provider name (currently only `multica`) |
|
|
31
|
+
| `multica.binary` | Path to multica binary (default: `multica`) |
|
|
32
|
+
| `multica.workspace` | Workspace ID override |
|
|
33
|
+
| `multica.token` | Auth token for headless login |
|
|
34
|
+
|
|
35
|
+
## Tools
|
|
36
|
+
|
|
37
|
+
| Tool | Description |
|
|
38
|
+
|------|-------------|
|
|
39
|
+
| `issue_list` | List issues with optional filters (status, assignee, project, limit) |
|
|
40
|
+
| `issue_get` | Get detailed info about a specific issue |
|
|
41
|
+
| `issue_create` | Create a new issue |
|
|
42
|
+
| `issue_update` | Update an existing issue (title, description, status, priority, assignee) |
|
|
43
|
+
| `issue_comment` | Add a comment to an issue |
|
|
44
|
+
| `project_list` | List all projects in the workspace |
|
|
45
|
+
| `teamwork_status` | Check provider/daemon status |
|
|
46
|
+
|
|
47
|
+
## Commands
|
|
48
|
+
|
|
49
|
+
- `/teamwork-status` — Show current provider status
|
|
50
|
+
|
|
51
|
+
## Architecture
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
src/
|
|
55
|
+
├── index.ts # Generic tool layer (provider-agnostic)
|
|
56
|
+
├── types.ts # TeamworkProvider interface + shared types
|
|
57
|
+
└── adapters/
|
|
58
|
+
└── multica.ts # Multica CLI adapter + initialization
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The extension uses a provider pattern — `index.ts` registers tools that delegate to a `TeamworkProvider` interface. Adding a new provider (Linear, Jira, etc.) only requires implementing the interface and adding a factory branch in `session_start`.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Comment, ExecFn, Issue, IssueCreateInput, IssueListFilter, IssueUpdateInput, MulticaAdapterConfig, Project, TeamworkProvider } from '../types.js';
|
|
2
|
+
export declare function initMulticaProvider(config: MulticaAdapterConfig, exec: ExecFn): Promise<MulticaAdapter>;
|
|
3
|
+
export declare class MulticaAdapter implements TeamworkProvider {
|
|
4
|
+
private readonly exec;
|
|
5
|
+
readonly name = "multica";
|
|
6
|
+
private readonly binary;
|
|
7
|
+
private readonly workspaceArgs;
|
|
8
|
+
constructor(config: MulticaAdapterConfig, exec: ExecFn);
|
|
9
|
+
listIssues(filter?: IssueListFilter): Promise<Issue[]>;
|
|
10
|
+
getIssue(id: string): Promise<Issue | undefined>;
|
|
11
|
+
createIssue(input: IssueCreateInput): Promise<Issue>;
|
|
12
|
+
updateIssue(id: string, input: IssueUpdateInput): Promise<Issue | undefined>;
|
|
13
|
+
addComment(issueId: string, content: string, parentId?: string): Promise<Comment>;
|
|
14
|
+
listComments(issueId: string): Promise<Comment[]>;
|
|
15
|
+
listProjects(): Promise<Project[]>;
|
|
16
|
+
status(): Promise<Record<string, unknown>>;
|
|
17
|
+
private run;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=multica.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multica.d.ts","sourceRoot":"","sources":["../../src/adapters/multica.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,MAAM,EACN,KAAK,EACL,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,OAAO,EACP,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAErB,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,oBAAoB,EAC5B,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,cAAc,CAAC,CAkBzB;AAED,qBAAa,cAAe,YAAW,gBAAgB;IAOnD,OAAO,CAAC,QAAQ,CAAC,IAAI;IANvB,QAAQ,CAAC,IAAI,aAAa;IAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAW;gBAGvC,MAAM,EAAE,oBAAoB,EACX,IAAI,EAAE,MAAM;IAQzB,UAAU,CAAC,MAAM,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAYtD,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC;IAOhD,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,KAAK,CAAC;IAYpD,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC;IAe5E,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAkBjF,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAsBjD,YAAY,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAalC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YASlC,GAAG;CAQlB"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
export async function initMulticaProvider(config, exec) {
|
|
2
|
+
const binary = config.binary?.trim() || 'multica';
|
|
3
|
+
if (config.token) {
|
|
4
|
+
try {
|
|
5
|
+
await exec(binary, ['login', '--token', config.token]);
|
|
6
|
+
}
|
|
7
|
+
catch {
|
|
8
|
+
// Login may already be done
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
try {
|
|
12
|
+
await exec(binary, ['daemon', 'start']);
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
// Daemon may already be running
|
|
16
|
+
}
|
|
17
|
+
return new MulticaAdapter(config, exec);
|
|
18
|
+
}
|
|
19
|
+
export class MulticaAdapter {
|
|
20
|
+
exec;
|
|
21
|
+
name = 'multica';
|
|
22
|
+
binary;
|
|
23
|
+
workspaceArgs;
|
|
24
|
+
constructor(config, exec) {
|
|
25
|
+
this.exec = exec;
|
|
26
|
+
this.binary = config.binary?.trim() || 'multica';
|
|
27
|
+
this.workspaceArgs = config.workspace?.trim()
|
|
28
|
+
? ['--workspace-id', config.workspace.trim()]
|
|
29
|
+
: [];
|
|
30
|
+
}
|
|
31
|
+
async listIssues(filter) {
|
|
32
|
+
const args = ['issue', 'list', '--output', 'json', ...this.workspaceArgs];
|
|
33
|
+
if (filter?.status)
|
|
34
|
+
args.push('--status', filter.status);
|
|
35
|
+
if (filter?.assignee)
|
|
36
|
+
args.push('--assignee', filter.assignee);
|
|
37
|
+
if (filter?.project)
|
|
38
|
+
args.push('--project', filter.project);
|
|
39
|
+
if (filter?.limit)
|
|
40
|
+
args.push('--limit', String(filter.limit));
|
|
41
|
+
const result = await this.run(args);
|
|
42
|
+
const data = parseJson(result);
|
|
43
|
+
if (!Array.isArray(data))
|
|
44
|
+
return [];
|
|
45
|
+
return data.map(mapIssue);
|
|
46
|
+
}
|
|
47
|
+
async getIssue(id) {
|
|
48
|
+
const result = await this.run(['issue', 'get', id, '--output', 'json', ...this.workspaceArgs]);
|
|
49
|
+
const data = parseJson(result);
|
|
50
|
+
if (!data || typeof data !== 'object')
|
|
51
|
+
return undefined;
|
|
52
|
+
return mapIssue(data);
|
|
53
|
+
}
|
|
54
|
+
async createIssue(input) {
|
|
55
|
+
const args = ['issue', 'create', '--title', input.title, ...this.workspaceArgs];
|
|
56
|
+
if (input.description)
|
|
57
|
+
args.push('--description', input.description);
|
|
58
|
+
if (input.priority)
|
|
59
|
+
args.push('--priority', input.priority);
|
|
60
|
+
if (input.assignee)
|
|
61
|
+
args.push('--assignee', input.assignee);
|
|
62
|
+
if (input.project)
|
|
63
|
+
args.push('--project', input.project);
|
|
64
|
+
const result = await this.run(args);
|
|
65
|
+
const data = parseJson(result);
|
|
66
|
+
if (data && typeof data === 'object')
|
|
67
|
+
return mapIssue(data);
|
|
68
|
+
return { id: 'unknown', title: input.title, status: 'todo' };
|
|
69
|
+
}
|
|
70
|
+
async updateIssue(id, input) {
|
|
71
|
+
if (input.status) {
|
|
72
|
+
await this.run(['issue', 'status', id, input.status, ...this.workspaceArgs]);
|
|
73
|
+
}
|
|
74
|
+
const updateArgs = [];
|
|
75
|
+
if (input.title)
|
|
76
|
+
updateArgs.push('--title', input.title);
|
|
77
|
+
if (input.description)
|
|
78
|
+
updateArgs.push('--description', input.description);
|
|
79
|
+
if (input.priority)
|
|
80
|
+
updateArgs.push('--priority', input.priority);
|
|
81
|
+
if (input.assignee)
|
|
82
|
+
updateArgs.push('--assignee', input.assignee);
|
|
83
|
+
if (updateArgs.length > 0) {
|
|
84
|
+
await this.run(['issue', 'update', id, ...updateArgs, ...this.workspaceArgs]);
|
|
85
|
+
}
|
|
86
|
+
return this.getIssue(id);
|
|
87
|
+
}
|
|
88
|
+
async addComment(issueId, content, parentId) {
|
|
89
|
+
const args = ['issue', 'comment', 'add', issueId, '--content', content, ...this.workspaceArgs];
|
|
90
|
+
if (parentId)
|
|
91
|
+
args.push('--parent', parentId);
|
|
92
|
+
const result = await this.run(args);
|
|
93
|
+
const data = parseJson(result);
|
|
94
|
+
if (data && typeof data === 'object') {
|
|
95
|
+
return {
|
|
96
|
+
id: String(data.id ?? 'unknown'),
|
|
97
|
+
issueId,
|
|
98
|
+
content,
|
|
99
|
+
author: String(data.author ?? ''),
|
|
100
|
+
createdAt: String(data.created_at ?? ''),
|
|
101
|
+
...(parentId ? { parentId } : {}),
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
return { id: 'unknown', issueId, content };
|
|
105
|
+
}
|
|
106
|
+
async listComments(issueId) {
|
|
107
|
+
const result = await this.run([
|
|
108
|
+
'issue',
|
|
109
|
+
'comment',
|
|
110
|
+
'list',
|
|
111
|
+
issueId,
|
|
112
|
+
'--output',
|
|
113
|
+
'json',
|
|
114
|
+
...this.workspaceArgs,
|
|
115
|
+
]);
|
|
116
|
+
const data = parseJson(result);
|
|
117
|
+
if (!Array.isArray(data))
|
|
118
|
+
return [];
|
|
119
|
+
return data.map((item) => ({
|
|
120
|
+
id: String(item.id ?? ''),
|
|
121
|
+
issueId,
|
|
122
|
+
content: String(item.content ?? item.body ?? ''),
|
|
123
|
+
author: String(item.author ?? item.user ?? ''),
|
|
124
|
+
createdAt: String(item.created_at ?? ''),
|
|
125
|
+
...(item.parent_id ? { parentId: String(item.parent_id) } : {}),
|
|
126
|
+
}));
|
|
127
|
+
}
|
|
128
|
+
async listProjects() {
|
|
129
|
+
const result = await this.run(['project', 'list', '--output', 'json', ...this.workspaceArgs]);
|
|
130
|
+
const data = parseJson(result);
|
|
131
|
+
if (!Array.isArray(data))
|
|
132
|
+
return [];
|
|
133
|
+
return data.map((item) => ({
|
|
134
|
+
id: String(item.id ?? ''),
|
|
135
|
+
title: String(item.title ?? item.name ?? ''),
|
|
136
|
+
...(item.description ? { description: String(item.description) } : {}),
|
|
137
|
+
...(item.status ? { status: String(item.status) } : {}),
|
|
138
|
+
...(item.lead ? { lead: String(item.lead) } : {}),
|
|
139
|
+
}));
|
|
140
|
+
}
|
|
141
|
+
async status() {
|
|
142
|
+
const result = await this.run(['daemon', 'status', '--output', 'json']);
|
|
143
|
+
const data = parseJson(result);
|
|
144
|
+
if (data && typeof data === 'object' && !Array.isArray(data)) {
|
|
145
|
+
return data;
|
|
146
|
+
}
|
|
147
|
+
return { raw: result };
|
|
148
|
+
}
|
|
149
|
+
async run(args) {
|
|
150
|
+
const { stdout, stderr, code } = await this.exec(this.binary, args);
|
|
151
|
+
if (code !== 0) {
|
|
152
|
+
const message = stderr.trim() || stdout.trim() || `Exit code ${code}`;
|
|
153
|
+
throw new Error(`multica ${args[0]} failed: ${message}`);
|
|
154
|
+
}
|
|
155
|
+
return stdout;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function parseJson(text) {
|
|
159
|
+
try {
|
|
160
|
+
return JSON.parse(text.trim());
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
return undefined;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function mapIssue(raw) {
|
|
167
|
+
const item = raw;
|
|
168
|
+
return {
|
|
169
|
+
id: String(item.id ?? ''),
|
|
170
|
+
title: String(item.title ?? ''),
|
|
171
|
+
status: String(item.status ?? 'unknown'),
|
|
172
|
+
...(item.description ? { description: String(item.description) } : {}),
|
|
173
|
+
...(item.priority ? { priority: String(item.priority) } : {}),
|
|
174
|
+
...(item.assignee ? { assignee: String(item.assignee) } : {}),
|
|
175
|
+
...(item.project ? { project: String(item.project) } : {}),
|
|
176
|
+
...(item.created_at ? { createdAt: String(item.created_at) } : {}),
|
|
177
|
+
...(item.updated_at ? { updatedAt: String(item.updated_at) } : {}),
|
|
178
|
+
...(item.metadata && typeof item.metadata === 'object'
|
|
179
|
+
? { metadata: item.metadata }
|
|
180
|
+
: {}),
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=multica.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multica.js","sourceRoot":"","sources":["../../src/adapters/multica.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,MAA4B,EAC5B,IAAY;IAEZ,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,SAAS,CAAC;IAElD,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACzD,CAAC;QAAC,MAAM,CAAC;YACP,4BAA4B;QAC9B,CAAC;IACH,CAAC;IAED,IAAI,CAAC;QACH,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;IAC1C,CAAC;IAAC,MAAM,CAAC;QACP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AC,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAClE,GAAG,CAAC,IAAI,CAAC,QAAQ,IAAI,OAAO,IAAI,CAAC,QAAQ,KAAK,QAAQ;YACpD,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAmC,EAAE;YACxD,CAAC,CAAC,EAAE,CAAC;KACR,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAQpE,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,CAyMlE"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { loadPiSettings, resolveAgentDir } from '@amaster.ai/pi-shared/settings';
|
|
2
|
+
import { Type } from 'typebox';
|
|
3
|
+
import { initMulticaProvider } from './adapters/multica.js';
|
|
4
|
+
const SETTINGS_KEY = 'pi-teamwork';
|
|
5
|
+
const STATUS_KEY = 'pi-teamwork';
|
|
6
|
+
export default function piTeamworkExtension(pi) {
|
|
7
|
+
let provider;
|
|
8
|
+
const exec = async (command, args) => {
|
|
9
|
+
const result = await pi.exec(command, args);
|
|
10
|
+
return { stdout: result.stdout, stderr: result.stderr, code: result.code };
|
|
11
|
+
};
|
|
12
|
+
pi.on('session_start', async (_event, ctx) => {
|
|
13
|
+
const config = loadConfig(ctx.cwd);
|
|
14
|
+
if (config.enabled === false) {
|
|
15
|
+
ctx.ui.setStatus(STATUS_KEY, 'teamwork: disabled');
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const providerName = config.provider ?? 'multica';
|
|
19
|
+
if (providerName === 'multica') {
|
|
20
|
+
provider = await initMulticaProvider(config.multica ?? {}, exec);
|
|
21
|
+
ctx.ui.setStatus(STATUS_KEY, 'teamwork: multica');
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
ctx.ui.setStatus(STATUS_KEY, `teamwork: unknown provider "${providerName}"`);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
pi.on('session_shutdown', async () => {
|
|
28
|
+
provider = undefined;
|
|
29
|
+
});
|
|
30
|
+
pi.registerCommand('teamwork-status', {
|
|
31
|
+
description: 'Show teamwork provider status.',
|
|
32
|
+
handler: async (_args, ctx) => {
|
|
33
|
+
if (!provider) {
|
|
34
|
+
ctx.ui.notify('Teamwork provider is not initialized.', 'warning');
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
try {
|
|
38
|
+
const s = await provider.status();
|
|
39
|
+
ctx.ui.notify(JSON.stringify(s, null, 2), 'info');
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
ctx.ui.notify(`Error: ${error instanceof Error ? error.message : String(error)}`, 'error');
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
// --- LLM-callable tools ---
|
|
47
|
+
pi.registerTool({
|
|
48
|
+
name: 'issue_list',
|
|
49
|
+
label: 'Teamwork',
|
|
50
|
+
description: 'List issues from the project management system. Supports filtering by status, assignee, and project.',
|
|
51
|
+
promptSnippet: 'List issues from the team project tracker with optional filters.',
|
|
52
|
+
parameters: Type.Object({
|
|
53
|
+
status: Type.Optional(Type.String({ description: 'Filter by status (e.g. todo, in_progress, done, blocked).' })),
|
|
54
|
+
assignee: Type.Optional(Type.String({ description: 'Filter by assignee name.' })),
|
|
55
|
+
project: Type.Optional(Type.String({ description: 'Filter by project ID.' })),
|
|
56
|
+
limit: Type.Optional(Type.Number({ description: 'Max number of results.' })),
|
|
57
|
+
}),
|
|
58
|
+
async execute(_toolCallId, params) {
|
|
59
|
+
if (!provider)
|
|
60
|
+
return textResult('Teamwork provider is not initialized.');
|
|
61
|
+
try {
|
|
62
|
+
const issues = await provider.listIssues(params);
|
|
63
|
+
if (issues.length === 0)
|
|
64
|
+
return textResult('No issues found.');
|
|
65
|
+
return textResult(JSON.stringify(issues, null, 2));
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
return textResult(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
pi.registerTool({
|
|
73
|
+
name: 'issue_get',
|
|
74
|
+
label: 'Teamwork',
|
|
75
|
+
description: 'Get detailed information about a specific issue.',
|
|
76
|
+
parameters: Type.Object({
|
|
77
|
+
id: Type.String({ description: 'The issue ID.' }),
|
|
78
|
+
}),
|
|
79
|
+
async execute(_toolCallId, params) {
|
|
80
|
+
if (!provider)
|
|
81
|
+
return textResult('Teamwork provider is not initialized.');
|
|
82
|
+
try {
|
|
83
|
+
const issue = await provider.getIssue(params.id);
|
|
84
|
+
if (!issue)
|
|
85
|
+
return textResult(`Issue not found: ${params.id}`);
|
|
86
|
+
return textResult(JSON.stringify(issue, null, 2));
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
return textResult(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
pi.registerTool({
|
|
94
|
+
name: 'issue_create',
|
|
95
|
+
label: 'Teamwork',
|
|
96
|
+
description: 'Create a new issue in the project management system.',
|
|
97
|
+
promptSnippet: 'Create issues in the team project tracker.',
|
|
98
|
+
parameters: Type.Object({
|
|
99
|
+
title: Type.String({ description: 'Issue title.' }),
|
|
100
|
+
description: Type.Optional(Type.String({ description: 'Issue description.' })),
|
|
101
|
+
priority: Type.Optional(Type.String({ description: 'Priority (e.g. low, medium, high, urgent).' })),
|
|
102
|
+
assignee: Type.Optional(Type.String({ description: 'Assignee name.' })),
|
|
103
|
+
project: Type.Optional(Type.String({ description: 'Project ID to associate with.' })),
|
|
104
|
+
}),
|
|
105
|
+
async execute(_toolCallId, params) {
|
|
106
|
+
if (!provider)
|
|
107
|
+
return textResult('Teamwork provider is not initialized.');
|
|
108
|
+
try {
|
|
109
|
+
const issue = await provider.createIssue(params);
|
|
110
|
+
return textResult(JSON.stringify(issue, null, 2));
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
return textResult(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
pi.registerTool({
|
|
118
|
+
name: 'issue_update',
|
|
119
|
+
label: 'Teamwork',
|
|
120
|
+
description: 'Update an existing issue. Can change title, description, status, priority, or assignee.',
|
|
121
|
+
parameters: Type.Object({
|
|
122
|
+
id: Type.String({ description: 'The issue ID to update.' }),
|
|
123
|
+
title: Type.Optional(Type.String({ description: 'New title.' })),
|
|
124
|
+
description: Type.Optional(Type.String({ description: 'New description.' })),
|
|
125
|
+
status: Type.Optional(Type.String({
|
|
126
|
+
description: 'New status (e.g. todo, in_progress, in_review, done, blocked, cancelled).',
|
|
127
|
+
})),
|
|
128
|
+
priority: Type.Optional(Type.String({ description: 'New priority.' })),
|
|
129
|
+
assignee: Type.Optional(Type.String({ description: 'New assignee name.' })),
|
|
130
|
+
}),
|
|
131
|
+
async execute(_toolCallId, params) {
|
|
132
|
+
if (!provider)
|
|
133
|
+
return textResult('Teamwork provider is not initialized.');
|
|
134
|
+
const { id, ...input } = params;
|
|
135
|
+
try {
|
|
136
|
+
const issue = await provider.updateIssue(id, input);
|
|
137
|
+
if (!issue)
|
|
138
|
+
return textResult(`Issue not found: ${id}`);
|
|
139
|
+
return textResult(JSON.stringify(issue, null, 2));
|
|
140
|
+
}
|
|
141
|
+
catch (error) {
|
|
142
|
+
return textResult(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
});
|
|
146
|
+
pi.registerTool({
|
|
147
|
+
name: 'issue_comment',
|
|
148
|
+
label: 'Teamwork',
|
|
149
|
+
description: 'Add a comment to an issue. Use for progress updates, questions, or blockers.',
|
|
150
|
+
parameters: Type.Object({
|
|
151
|
+
issueId: Type.String({ description: 'The issue ID to comment on.' }),
|
|
152
|
+
content: Type.String({ description: 'Comment content.' }),
|
|
153
|
+
parentId: Type.Optional(Type.String({ description: 'Parent comment ID for threaded replies.' })),
|
|
154
|
+
}),
|
|
155
|
+
async execute(_toolCallId, params) {
|
|
156
|
+
if (!provider)
|
|
157
|
+
return textResult('Teamwork provider is not initialized.');
|
|
158
|
+
try {
|
|
159
|
+
const comment = await provider.addComment(params.issueId, params.content, params.parentId);
|
|
160
|
+
return textResult(JSON.stringify(comment, null, 2));
|
|
161
|
+
}
|
|
162
|
+
catch (error) {
|
|
163
|
+
return textResult(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
});
|
|
167
|
+
pi.registerTool({
|
|
168
|
+
name: 'project_list',
|
|
169
|
+
label: 'Teamwork',
|
|
170
|
+
description: 'List all projects in the workspace.',
|
|
171
|
+
parameters: Type.Object({}),
|
|
172
|
+
async execute() {
|
|
173
|
+
if (!provider)
|
|
174
|
+
return textResult('Teamwork provider is not initialized.');
|
|
175
|
+
try {
|
|
176
|
+
const projects = await provider.listProjects();
|
|
177
|
+
if (projects.length === 0)
|
|
178
|
+
return textResult('No projects found.');
|
|
179
|
+
return textResult(JSON.stringify(projects, null, 2));
|
|
180
|
+
}
|
|
181
|
+
catch (error) {
|
|
182
|
+
return textResult(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
});
|
|
186
|
+
pi.registerTool({
|
|
187
|
+
name: 'teamwork_status',
|
|
188
|
+
label: 'Teamwork',
|
|
189
|
+
description: 'Check the status of the teamwork provider (daemon status, connected agents, etc.).',
|
|
190
|
+
parameters: Type.Object({}),
|
|
191
|
+
async execute() {
|
|
192
|
+
if (!provider)
|
|
193
|
+
return textResult('Teamwork provider is not initialized.');
|
|
194
|
+
try {
|
|
195
|
+
const s = await provider.status();
|
|
196
|
+
return textResult(JSON.stringify(s, null, 2));
|
|
197
|
+
}
|
|
198
|
+
catch (error) {
|
|
199
|
+
return textResult(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
function textResult(text) {
|
|
205
|
+
return { content: [{ type: 'text', text }], details: undefined };
|
|
206
|
+
}
|
|
207
|
+
function loadConfig(cwd) {
|
|
208
|
+
try {
|
|
209
|
+
const config = loadPiSettings(SETTINGS_KEY, {
|
|
210
|
+
cwd,
|
|
211
|
+
agentDir: resolveAgentDir(),
|
|
212
|
+
});
|
|
213
|
+
return Object.keys(config).length > 0 ? config : {};
|
|
214
|
+
}
|
|
215
|
+
catch {
|
|
216
|
+
return {};
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjF,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,MAAM,YAAY,GAAG,aAAa,CAAC;AACnC,MAAM,UAAU,GAAG,aAAa,CAAC;AAEjC,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,EAAgB;IAC1D,IAAI,QAAsC,CAAC;IAE3C,MAAM,IAAI,GAAW,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QAC3C,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC5C,OAAO,EAAE,MAAM,EA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C,CAAC;YAC1E,IAAI,CAAC;gBACH,MAAM,CAAC,GAAG,MAAM,QAAQ,CAAC,MAAM,EAAE,CAAC;gBAClC,OAAO,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;YAChD,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,UAAU,CAAC,UAAU,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YACxF,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAED,SAAS,UAAU,CAAC,IAAY;IAC9B,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;AAC5E,CAAC;AAED,SAAS,UAAU,CAAC,GAAW;IAC7B,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,cAAc,CAA0B,YAAY,EAAE;YACnE,GAAG;YACH,QAAQ,EAAE,eAAe,EAAE;SAC5B,CAAC,CAAC;QACH,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAE,MAAyB,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export type Issue = {
|
|
2
|
+
id: string;
|
|
3
|
+
title: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
status: string;
|
|
6
|
+
priority?: string;
|
|
7
|
+
assignee?: string;
|
|
8
|
+
project?: string;
|
|
9
|
+
createdAt?: string;
|
|
10
|
+
updatedAt?: string;
|
|
11
|
+
metadata?: Record<string, unknown>;
|
|
12
|
+
};
|
|
13
|
+
export type IssueCreateInput = {
|
|
14
|
+
title: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
priority?: string;
|
|
17
|
+
assignee?: string;
|
|
18
|
+
project?: string;
|
|
19
|
+
};
|
|
20
|
+
export type IssueUpdateInput = {
|
|
21
|
+
title?: string;
|
|
22
|
+
description?: string;
|
|
23
|
+
status?: string;
|
|
24
|
+
priority?: string;
|
|
25
|
+
assignee?: string;
|
|
26
|
+
};
|
|
27
|
+
export type IssueListFilter = {
|
|
28
|
+
status?: string;
|
|
29
|
+
assignee?: string;
|
|
30
|
+
project?: string;
|
|
31
|
+
limit?: number;
|
|
32
|
+
};
|
|
33
|
+
export type Comment = {
|
|
34
|
+
id: string;
|
|
35
|
+
issueId: string;
|
|
36
|
+
content: string;
|
|
37
|
+
author?: string;
|
|
38
|
+
createdAt?: string;
|
|
39
|
+
parentId?: string;
|
|
40
|
+
};
|
|
41
|
+
export type Project = {
|
|
42
|
+
id: string;
|
|
43
|
+
title: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
status?: string;
|
|
46
|
+
lead?: string;
|
|
47
|
+
};
|
|
48
|
+
export interface TeamworkProvider {
|
|
49
|
+
name: string;
|
|
50
|
+
listIssues(filter?: IssueListFilter): Promise<Issue[]>;
|
|
51
|
+
getIssue(id: string): Promise<Issue | undefined>;
|
|
52
|
+
createIssue(input: IssueCreateInput): Promise<Issue>;
|
|
53
|
+
updateIssue(id: string, input: IssueUpdateInput): Promise<Issue | undefined>;
|
|
54
|
+
addComment(issueId: string, content: string, parentId?: string): Promise<Comment>;
|
|
55
|
+
listComments(issueId: string): Promise<Comment[]>;
|
|
56
|
+
listProjects(): Promise<Project[]>;
|
|
57
|
+
status(): Promise<Record<string, unknown>>;
|
|
58
|
+
}
|
|
59
|
+
export type ExecFn = (command: string, args: string[]) => Promise<{
|
|
60
|
+
stdout: string;
|
|
61
|
+
stderr: string;
|
|
62
|
+
code: number;
|
|
63
|
+
}>;
|
|
64
|
+
export type MulticaAdapterConfig = {
|
|
65
|
+
binary?: string;
|
|
66
|
+
workspace?: string;
|
|
67
|
+
token?: string;
|
|
68
|
+
};
|
|
69
|
+
export type TeamworkConfig = {
|
|
70
|
+
enabled?: boolean;
|
|
71
|
+
provider?: string;
|
|
72
|
+
multica?: MulticaAdapterConfig;
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAA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,CAAC;IAClD,YAAY,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IACnC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CAC5C;AAED,MAAM,MAAM,MAAM,GAAG,CACnB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,KACX,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE/D,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,oBAAoB,CAAC;CAChC,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@amaster.ai/pi-teamwork",
|
|
3
|
+
"version": "0.1.2-beta.10",
|
|
4
|
+
"description": "Pi extension for team collaboration and issue management via Multica",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"pi-package",
|
|
7
|
+
"pi",
|
|
8
|
+
"extension",
|
|
9
|
+
"teamwork",
|
|
10
|
+
"issues",
|
|
11
|
+
"project-management",
|
|
12
|
+
"multica"
|
|
13
|
+
],
|
|
14
|
+
"license": "Apache-2.0",
|
|
15
|
+
"type": "module",
|
|
16
|
+
"sideEffects": false,
|
|
17
|
+
"main": "./dist/index.js",
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"default": "./dist/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./package.json": {
|
|
25
|
+
"default": "./package.json"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"pi": {
|
|
29
|
+
"extensions": [
|
|
30
|
+
"./dist/index.js"
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"dist",
|
|
35
|
+
"README.md"
|
|
36
|
+
],
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public"
|
|
39
|
+
},
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git",
|
|
42
|
+
"url": "https://github.com/TGYD-helige/pi.git",
|
|
43
|
+
"directory": "packages/pi-teamwork"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@amaster.ai/pi-shared": "0.1.2-beta.10"
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"@earendil-works/pi-coding-agent": ">=0.74.0",
|
|
50
|
+
"typebox": "*"
|
|
51
|
+
},
|
|
52
|
+
"peerDependenciesMeta": {
|
|
53
|
+
"@earendil-works/pi-coding-agent": {
|
|
54
|
+
"optional": true
|
|
55
|
+
},
|
|
56
|
+
"typebox": {
|
|
57
|
+
"optional": true
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"devDependencies": {
|
|
61
|
+
"@earendil-works/pi-coding-agent": "0.74.0",
|
|
62
|
+
"typebox": "*",
|
|
63
|
+
"vitest": "^4.0.0"
|
|
64
|
+
},
|
|
65
|
+
"scripts": {
|
|
66
|
+
"build": "tsc -b",
|
|
67
|
+
"typecheck": "tsc -b --pretty false",
|
|
68
|
+
"test": "vitest run"
|
|
69
|
+
}
|
|
70
|
+
}
|