annotask 0.0.4 → 0.0.6

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/dist/cli.js CHANGED
@@ -46,6 +46,12 @@ if (command === "watch") {
46
46
  checkStatus();
47
47
  } else if (command === "init-skills") {
48
48
  initSkills();
49
+ } else if (command === "screenshot") {
50
+ fetchScreenshot();
51
+ } else if (command === "tasks") {
52
+ fetchTasks();
53
+ } else if (command === "update-task") {
54
+ updateTask();
49
55
  } else if (command === "help" || command === "--help") {
50
56
  printHelp();
51
57
  } else {
@@ -150,6 +156,82 @@ async function checkStatus() {
150
156
  process.exit(1);
151
157
  }
152
158
  }
159
+ async function fetchScreenshot() {
160
+ const taskId = args[1];
161
+ if (!taskId) {
162
+ console.error("\x1B[31m[Annotask]\x1B[0m Usage: annotask screenshot <task-id> [--output=path.png]");
163
+ process.exit(1);
164
+ }
165
+ try {
166
+ const tasksRes = await fetch(`${apiUrl}/tasks`);
167
+ const tasksData = await tasksRes.json();
168
+ const task = tasksData.tasks.find((t) => t.id === taskId);
169
+ if (!task) {
170
+ console.error(`\x1B[31m[Annotask]\x1B[0m Task not found: ${taskId}`);
171
+ process.exit(1);
172
+ }
173
+ if (!task.screenshot) {
174
+ console.error(`\x1B[31m[Annotask]\x1B[0m Task has no screenshot`);
175
+ process.exit(1);
176
+ }
177
+ const screenshotUrl = `${baseUrl}/__annotask/screenshots/${task.screenshot}`;
178
+ const res = await fetch(screenshotUrl);
179
+ if (!res.ok) {
180
+ console.error(`\x1B[31m[Annotask]\x1B[0m Screenshot not found: ${task.screenshot}`);
181
+ process.exit(1);
182
+ }
183
+ const buffer = Buffer.from(await res.arrayBuffer());
184
+ const outputArg = args.find((a) => a.startsWith("--output="));
185
+ const outputPath = outputArg ? outputArg.split("=")[1] : resolve(".annotask", "screenshots", task.screenshot);
186
+ const dir = dirname(outputPath);
187
+ if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
188
+ const { writeFileSync } = await import("fs");
189
+ writeFileSync(outputPath, buffer);
190
+ console.log(`\x1B[32m[Annotask]\x1B[0m Screenshot saved to ${outputPath}`);
191
+ } catch (err) {
192
+ console.error(`\x1B[31m[Annotask]\x1B[0m Failed to fetch screenshot: ${err.message}`);
193
+ process.exit(1);
194
+ }
195
+ }
196
+ async function fetchTasks() {
197
+ try {
198
+ const tasksUrl = mfeFilter ? `${apiUrl}/tasks?mfe=${encodeURIComponent(mfeFilter)}` : `${apiUrl}/tasks`;
199
+ const res = await fetch(tasksUrl);
200
+ const data = await res.json();
201
+ console.log(JSON.stringify(data, null, 2));
202
+ } catch (err) {
203
+ console.error(`\x1B[31m[Annotask]\x1B[0m Failed to fetch tasks: ${err.message}`);
204
+ process.exit(1);
205
+ }
206
+ }
207
+ async function updateTask() {
208
+ const taskId = args[1];
209
+ const statusArg = args.find((a) => a.startsWith("--status="))?.split("=")[1];
210
+ const feedbackArg = args.find((a) => a.startsWith("--feedback="))?.split("=")[1];
211
+ if (!taskId || !statusArg) {
212
+ console.error("\x1B[31m[Annotask]\x1B[0m Usage: annotask update-task <task-id> --status=<status> [--feedback=<text>]");
213
+ console.error(" Valid statuses: pending, applied, review, accepted, denied");
214
+ process.exit(1);
215
+ }
216
+ try {
217
+ const body = { status: statusArg };
218
+ if (feedbackArg) body.feedback = feedbackArg;
219
+ const res = await fetch(`${apiUrl}/tasks/${taskId}`, {
220
+ method: "PATCH",
221
+ headers: { "Content-Type": "application/json" },
222
+ body: JSON.stringify(body)
223
+ });
224
+ const data = await res.json();
225
+ if (data.error) {
226
+ console.error(`\x1B[31m[Annotask]\x1B[0m ${data.error}`);
227
+ process.exit(1);
228
+ }
229
+ console.log(JSON.stringify(data, null, 2));
230
+ } catch (err) {
231
+ console.error(`\x1B[31m[Annotask]\x1B[0m Failed to update task: ${err.message}`);
232
+ process.exit(1);
233
+ }
234
+ }
153
235
  function initSkills() {
154
236
  const __dirname = dirname(fileURLToPath(import.meta.url));
155
237
  const srcSkills = resolve(__dirname, "..", "skills");
package/dist/index.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  bridgeClientScript
3
- } from "./chunk-O73PGHAA.js";
3
+ } from "./chunk-YZ7UIZNB.js";
4
4
  import {
5
5
  writeMfeServerInfo,
6
6
  writeServerInfo
7
7
  } from "./chunk-XLNGAH3S.js";
8
8
  import {
9
9
  createAnnotaskServer
10
- } from "./chunk-JLOSPIJ4.js";
10
+ } from "./chunk-KB74TUGE.js";
11
11
  import {
12
12
  transformFile,
13
13
  transformHTML
package/dist/server.d.ts CHANGED
@@ -24,6 +24,7 @@ interface AnnotaskWSServer {
24
24
  declare function createWSServer(): AnnotaskWSServer;
25
25
 
26
26
  interface APIOptions {
27
+ projectRoot: string;
27
28
  getReport: () => unknown;
28
29
  getConfig: () => unknown;
29
30
  getDesignSpec: () => unknown;
package/dist/server.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  createProjectState,
5
5
  createShellMiddleware,
6
6
  createWSServer
7
- } from "./chunk-JLOSPIJ4.js";
7
+ } from "./chunk-KB74TUGE.js";
8
8
  export {
9
9
  createAPIMiddleware,
10
10
  createAnnotaskServer,