@@ -5,10 +5,28 @@ import { monitor } from "scrapegraph-js";
55import { getApiKey } from "../lib/client.js" ;
66import * as log from "../lib/log.js" ;
77
8- const ACTIONS = [ "create" , "list" , "get" , "update" , "delete" , "pause" , "resume" ] as const ;
8+ const ACTIONS = [
9+ "create" ,
10+ "list" ,
11+ "get" ,
12+ "update" ,
13+ "delete" ,
14+ "pause" ,
15+ "resume" ,
16+ "activity" ,
17+ ] as const ;
918type Action = ( typeof ACTIONS ) [ number ] ;
1019
11- const FORMATS = [ "markdown" , "html" , "screenshot" , "branding" , "links" , "images" , "summary" , "json" ] as const ;
20+ const FORMATS = [
21+ "markdown" ,
22+ "html" ,
23+ "screenshot" ,
24+ "branding" ,
25+ "links" ,
26+ "images" ,
27+ "summary" ,
28+ "json" ,
29+ ] as const ;
1230
1331export default defineCommand ( {
1432 meta : {
@@ -52,6 +70,14 @@ export default defineCommand({
5270 description : "Fetch mode: auto (default), fast, js" ,
5371 } ,
5472 stealth : { type : "boolean" , description : "Enable stealth mode" } ,
73+ limit : {
74+ type : "string" ,
75+ description : "Ticks per page for activity (max 100)" ,
76+ } ,
77+ cursor : {
78+ type : "string" ,
79+ description : "Pagination cursor for activity" ,
80+ } ,
5581 json : { type : "boolean" , description : "Output raw JSON (pipeable)" } ,
5682 } ,
5783 run : async ( { args } ) => {
@@ -76,7 +102,8 @@ export default defineCommand({
76102 . filter ( Boolean ) ;
77103
78104 const formats = requestedFormats . map ( ( f ) => {
79- if ( f === "markdown" || f === "html" ) return { type : f as "markdown" | "html" , mode : "normal" as const } ;
105+ if ( f === "markdown" || f === "html" )
106+ return { type : f as "markdown" | "html" , mode : "normal" as const } ;
80107 return { type : f } ;
81108 } ) ;
82109
@@ -236,6 +263,27 @@ export default defineCommand({
236263 break ;
237264 }
238265
266+ case "activity" : {
267+ if ( ! args . id ) {
268+ out . error ( "--id is required for activity" ) ;
269+ return ;
270+ }
271+ const params : { limit ?: number ; cursor ?: string } = { } ;
272+ if ( args . limit ) params . limit = Number ( args . limit ) ;
273+ if ( args . cursor ) params . cursor = args . cursor ;
274+
275+ out . start ( "Fetching monitor activity" ) ;
276+ try {
277+ const result = await monitor . activity ( apiKey , args . id , params ) ;
278+ out . stop ( result . elapsedMs ) ;
279+ out . result ( result . data ) ;
280+ } catch ( err ) {
281+ out . stop ( 0 ) ;
282+ out . error ( err instanceof Error ? err . message : String ( err ) ) ;
283+ }
284+ break ;
285+ }
286+
239287 default :
240288 out . error ( `Unknown action: ${ action } . Valid: ${ ACTIONS . join ( ", " ) } ` ) ;
241289 }
0 commit comments