projects-plus-sdk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Projects Plus
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,228 @@
1
+ # projects-plus-sdk
2
+
3
+ Official SDK for Projects Plus API - Type-safe API client for AI-driven development workflows.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install projects-plus-sdk
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```typescript
14
+ import { ProjectsPlus } from 'projects-plus-sdk';
15
+
16
+ const pp = new ProjectsPlus({
17
+ apiKey: process.env.PROJECTS_PLUS_API_KEY,
18
+ });
19
+
20
+ // Start session
21
+ await pp.sessions.start({ ai: 'claude' });
22
+
23
+ // Get context
24
+ const context = await pp.context.get();
25
+ console.log(context.theme.name);
26
+ console.log(context.projects);
27
+
28
+ // List active tasks
29
+ const tasks = await pp.tasks.list({ status: 'active' });
30
+
31
+ // Add comment
32
+ await pp.comments.create({
33
+ projectId: 'proj-id',
34
+ taskId: 'task-id',
35
+ content: '## Done\n\nImplemented feature X',
36
+ aiName: 'Claude',
37
+ });
38
+
39
+ // Complete task
40
+ await pp.tasks.complete('task-id', { projectId: 'proj-id' });
41
+
42
+ // End session
43
+ await pp.sessions.end({ handoffNote: 'Summary...' });
44
+ ```
45
+
46
+ ## Workflow Helper
47
+
48
+ For common development patterns, use the workflow helper:
49
+
50
+ ```typescript
51
+ const workflow = pp.workflow({ ai: 'claude' });
52
+
53
+ // Start session and get context in one call
54
+ const { session, context } = await workflow.start();
55
+
56
+ // Report progress with auto-formatted markdown
57
+ await workflow.reportProgress('task-id', {
58
+ projectId: 'proj-id',
59
+ changes: ['file1.ts', 'file2.ts'],
60
+ testResults: { passed: 10, failed: 0 },
61
+ note: 'Optional notes',
62
+ });
63
+
64
+ // Complete task and refresh context
65
+ const newContext = await workflow.completeAndRefresh('task-id', {
66
+ projectId: 'proj-id',
67
+ });
68
+
69
+ // End session
70
+ await workflow.end('Summary of completed work');
71
+ ```
72
+
73
+ ## API Reference
74
+
75
+ ### Context
76
+
77
+ ```typescript
78
+ // Get theme context including all projects and tasks
79
+ const context = await pp.context.get();
80
+ ```
81
+
82
+ ### Sessions
83
+
84
+ ```typescript
85
+ // Start session
86
+ const session = await pp.sessions.start({ ai: 'claude' });
87
+
88
+ // End session
89
+ const endedSession = await pp.sessions.end({
90
+ handoffNote: 'Completed tasks X, Y, Z',
91
+ });
92
+
93
+ // Get current session
94
+ const current = await pp.sessions.current();
95
+ ```
96
+
97
+ ### Tasks
98
+
99
+ ```typescript
100
+ // List tasks
101
+ const tasks = await pp.tasks.list({ status: 'active' });
102
+ const projectTasks = await pp.tasks.list({
103
+ projectId: 'proj-id',
104
+ status: 'active',
105
+ });
106
+
107
+ // Get task
108
+ const task = await pp.tasks.get('task-id', { projectId: 'proj-id' });
109
+
110
+ // Complete task
111
+ await pp.tasks.complete('task-id', { projectId: 'proj-id' });
112
+
113
+ // Update status
114
+ await pp.tasks.updateStatus('task-id', {
115
+ projectId: 'proj-id',
116
+ status: 'paused',
117
+ });
118
+ ```
119
+
120
+ ### Projects
121
+
122
+ ```typescript
123
+ // List projects
124
+ const projects = await pp.projects.list();
125
+ const activeProjects = await pp.projects.list({ status: 'active' });
126
+
127
+ // Get project
128
+ const project = await pp.projects.get('proj-id');
129
+
130
+ // Get project tasks
131
+ const tasks = await pp.projects.getTasks('proj-id');
132
+ ```
133
+
134
+ ### Comments
135
+
136
+ ```typescript
137
+ // List comments
138
+ const comments = await pp.comments.list({
139
+ projectId: 'proj-id',
140
+ taskId: 'task-id',
141
+ });
142
+
143
+ // Create comment
144
+ await pp.comments.create({
145
+ projectId: 'proj-id',
146
+ taskId: 'task-id',
147
+ content: 'Comment content',
148
+ aiName: 'Claude',
149
+ });
150
+
151
+ // Delete comment
152
+ await pp.comments.delete('comment-id', {
153
+ projectId: 'proj-id',
154
+ taskId: 'task-id',
155
+ });
156
+ ```
157
+
158
+ ## Error Handling
159
+
160
+ ```typescript
161
+ import {
162
+ ProjectsPlus,
163
+ ApiError,
164
+ RateLimitError,
165
+ AuthenticationError,
166
+ NotFoundError,
167
+ } from 'projects-plus-sdk';
168
+
169
+ try {
170
+ await pp.tasks.complete('task-id', { projectId: 'proj-id' });
171
+ } catch (error) {
172
+ if (error instanceof RateLimitError) {
173
+ console.log(`Rate limited. Retry after ${error.retryAfter} seconds`);
174
+ } else if (error instanceof AuthenticationError) {
175
+ console.log('Invalid API key');
176
+ } else if (error instanceof NotFoundError) {
177
+ console.log('Resource not found');
178
+ } else if (error instanceof ApiError) {
179
+ console.log(`API error: ${error.status} - ${error.message}`);
180
+ }
181
+ }
182
+ ```
183
+
184
+ ## Configuration
185
+
186
+ ```typescript
187
+ const pp = new ProjectsPlus({
188
+ apiKey: 'your-api-key', // Required
189
+ baseUrl: 'https://...', // Optional: Custom API endpoint
190
+ timeout: 30000, // Optional: Request timeout (ms)
191
+ retries: 3, // Optional: Max retry attempts
192
+ retryDelay: 1000, // Optional: Initial retry delay (ms)
193
+ });
194
+ ```
195
+
196
+ ## TypeScript Support
197
+
198
+ The SDK is written in TypeScript and provides full type definitions:
199
+
200
+ ```typescript
201
+ import type {
202
+ Task,
203
+ Project,
204
+ Comment,
205
+ Session,
206
+ ThemeContext,
207
+ TaskStatus,
208
+ ProjectStatus,
209
+ } from 'projects-plus-sdk';
210
+ ```
211
+
212
+ ## Environment Variables
213
+
214
+ Recommended: Store your API key in environment variables:
215
+
216
+ ```bash
217
+ export PROJECTS_PLUS_API_KEY=pp_live_xxx_yyy
218
+ ```
219
+
220
+ ```typescript
221
+ const pp = new ProjectsPlus({
222
+ apiKey: process.env.PROJECTS_PLUS_API_KEY!,
223
+ });
224
+ ```
225
+
226
+ ## License
227
+
228
+ MIT