Understand any codebase instantly. System intelligence for codebases, built for humans and AI.
TypeScript aiai-memoryclaude-codeclicode-analysiscode-mappingcode-memorycodebase-understandingcodexdeveloper-toolsllmopenclawpersistent-memoryprogram-analysissoftware-architecturesystem-intelligencesystem-mapping
feat: add --limit support to ix patches command
riley02276cc260d3b7d9
diff --git a/ix-cli/src/cli/commands/patches.ts b/ix-cli/src/cli/commands/patches.tsindex 39262e61..d8699546 100644--- a/ix-cli/src/cli/commands/patches.ts+++ b/ix-cli/src/cli/commands/patches.ts@@ -7,10 +7,11 @@ export function registerPatchesCommand(program: Command): void {program.command("patches").description("List recent patches")+ .option("--limit <n>", "Maximum patches to return", "50").option("--format <fmt>", "Output format (text|json)", "text")- .action(async (opts: { format: string }) => {+ .action(async (opts: { limit: string; format: string }) => {const client = new IxClient(getEndpoint());- const patches = await client.listPatches();+ const patches = await client.listPatches({ limit: parseInt(opts.limit, 10) });formatPatches(patches, opts.format);});}diff --git a/ix-cli/src/client/api.ts b/ix-cli/src/client/api.tsindex d0a94a0f..3a732e93 100644--- a/ix-cli/src/client/api.ts+++ b/ix-cli/src/client/api.ts@@ -92,8 +92,11 @@ export class IxClient {return this.post("/v1/truth", { statement, parentIntent });}- async listPatches(): Promise<PatchSummary[]> {- return this.get("/v1/patches");+ async listPatches(opts?: { limit?: number }): Promise<PatchSummary[]> {+ const params = new URLSearchParams();+ if (opts?.limit) params.set("limit", String(opts.limit));+ const qs = params.toString();+ return this.get(`/v1/patches${qs ? `?${qs}` : ""}`);}async getPatch(id: string): Promise<unknown> {diff --git a/memory-layer/src/main/scala/ix/memory/api/PatchRoutes.scala b/memory-layer/src/main/scala/ix/memory/api/PatchRoutes.scalaindex 60552053..b050aa46 100644--- a/memory-layer/src/main/scala/ix/memory/api/PatchRoutes.scala+++ b/memory-layer/src/main/scala/ix/memory/api/PatchRoutes.scala@@ -7,21 +7,25 @@ import io.circe.syntax._import org.http4s.HttpRoutesimport org.http4s.circe.CirceEntityCodec._import org.http4s.dsl.io._+import org.http4s.dsl.impl.OptionalQueryParamDecoderMatcherimport ix.memory.db.ArangoClient+object LimitParam extends OptionalQueryParamDecoderMatcher[Int]("limit")+class PatchRoutes(client: ArangoClient) {val routes: HttpRoutes[IO] = HttpRoutes.of[IO] {- case GET -> Root / "v1" / "patches" =>+ case GET -> Root / "v1" / "patches" :? LimitParam(limit) =>+ val maxResults = limit.getOrElse(50)(for {patches <- client.query("""FOR p IN patches| SORT p.rev DESC- | LIMIT 50+ | LIMIT @limit| RETURN { patch_id: p.patch_id, rev: p.rev, intent: p.data.intent,| source_uri: p.data.source.uri, timestamp: p.data.timestamp }""".stripMargin,- Map.empty[String, AnyRef]+ Map("limit" -> Int.box(maxResults).asInstanceOf[AnyRef]))resp <- Ok(patches.asJson)} yield resp).handleErrorWith(ErrorHandler.handle(_))