From 3da94aabd8d6fbc582700ca8be1f7cb252085c2f Mon Sep 17 00:00:00 2001 From: Aaron Brewbaker Date: Wed, 1 Jul 2026 13:59:09 -0400 Subject: [PATCH] refactor: adopt upstream defineCommand/defineRoutes wrappers Migrate the ported board, folder, opal, fleet, schema, worksheet, and dataset command files from direct buildCommand/buildRouteMap to the defineCommand/ defineRoutes wrappers introduced upstream in #14 (OBSERVE_CLI_EXPERIMENTAL gating). Drop-in replacements; no behavior change. Also gitignore *.bun-build bundler temp artifacts. --- .gitignore | 2 ++ src/commands/board/create.ts | 4 ++-- src/commands/board/delete.ts | 4 ++-- src/commands/board/get.ts | 4 ++-- src/commands/board/index.ts | 4 ++-- src/commands/board/list.ts | 4 ++-- src/commands/board/scaffold.ts | 4 ++-- src/commands/board/set-default.ts | 6 +++--- src/commands/board/update.ts | 4 ++-- src/commands/dataset/dry-run.ts | 4 ++-- src/commands/dataset/impact.ts | 4 ++-- src/commands/fleet/fleet.ts | 10 +++++----- src/commands/fleet/index.ts | 4 ++-- src/commands/folder/create.ts | 4 ++-- src/commands/folder/delete.ts | 4 ++-- src/commands/folder/get.ts | 4 ++-- src/commands/folder/index.ts | 4 ++-- src/commands/folder/update.ts | 4 ++-- src/commands/opal/check.ts | 4 ++-- src/commands/opal/functions.ts | 4 ++-- src/commands/opal/index.ts | 4 ++-- src/commands/opal/validate-ingest.ts | 4 ++-- src/commands/opal/verbs.ts | 4 ++-- src/commands/schema/index.ts | 4 ++-- src/commands/schema/introspect.ts | 4 ++-- src/commands/worksheet/create.ts | 4 ++-- src/commands/worksheet/delete.ts | 4 ++-- src/commands/worksheet/get.ts | 4 ++-- src/commands/worksheet/index.ts | 4 ++-- src/commands/worksheet/list.ts | 4 ++-- 30 files changed, 64 insertions(+), 62 deletions(-) diff --git a/.gitignore b/.gitignore index 11fab6c..64aaf1c 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,8 @@ jspm_packages/ *.tsbuildinfo dist dist-bin +# Bun bundler temp artifacts (created during `bun run build`) +*.bun-build generated # Keep committed snapshots of the generated GraphQL/REST artifacts so the diff --git a/src/commands/board/create.ts b/src/commands/board/create.ts index b59794a..f5b2a30 100644 --- a/src/commands/board/create.ts +++ b/src/commands/board/create.ts @@ -1,4 +1,4 @@ -import { buildCommand } from "@stricli/core"; +import { defineCommand } from "../../lib/stricli-wrappers"; import type { LocalContext } from "../../context"; import { saveBoard } from "../../gql/board/save-board"; import { GqlApiError } from "../../gql/gql-request"; @@ -33,7 +33,7 @@ async function create( } } -export const createCommand = buildCommand({ +export const createCommand = defineCommand({ loader: async () => create, parameters: { positional: { diff --git a/src/commands/board/delete.ts b/src/commands/board/delete.ts index 7b3861f..97db185 100644 --- a/src/commands/board/delete.ts +++ b/src/commands/board/delete.ts @@ -1,4 +1,4 @@ -import { buildCommand } from "@stricli/core"; +import { defineCommand } from "../../lib/stricli-wrappers"; import type { LocalContext } from "../../context"; import { deleteBoard } from "../../gql/board/delete-board"; import { GqlApiError } from "../../gql/gql-request"; @@ -36,7 +36,7 @@ async function del( } } -export const deleteCommand = buildCommand({ +export const deleteCommand = defineCommand({ loader: async () => del, parameters: { positional: { diff --git a/src/commands/board/get.ts b/src/commands/board/get.ts index 7bd5c86..bbaffb1 100644 --- a/src/commands/board/get.ts +++ b/src/commands/board/get.ts @@ -1,4 +1,4 @@ -import { buildCommand } from "@stricli/core"; +import { defineCommand } from "../../lib/stricli-wrappers"; import type { LocalContext } from "../../context"; import { getBoard } from "../../gql/board/get-board"; import { GqlApiError } from "../../gql/gql-request"; @@ -33,7 +33,7 @@ async function get( } } -export const getCommand = buildCommand({ +export const getCommand = defineCommand({ loader: async () => get, parameters: { positional: { diff --git a/src/commands/board/index.ts b/src/commands/board/index.ts index 0cc5840..80bd9cf 100644 --- a/src/commands/board/index.ts +++ b/src/commands/board/index.ts @@ -1,4 +1,4 @@ -import { buildRouteMap } from "@stricli/core"; +import { defineRoutes } from "../../lib/stricli-wrappers"; import { createCommand } from "./create"; import { updateCommand } from "./update"; import { getCommand } from "./get"; @@ -7,7 +7,7 @@ import { deleteCommand } from "./delete"; import { scaffoldCommand } from "./scaffold"; import { clearDefaultCommand, setDefaultCommand } from "./set-default"; -export const boardRoutes = buildRouteMap({ +export const boardRoutes = defineRoutes({ routes: { create: createCommand, update: updateCommand, diff --git a/src/commands/board/list.ts b/src/commands/board/list.ts index 349cc21..3f7d20a 100644 --- a/src/commands/board/list.ts +++ b/src/commands/board/list.ts @@ -1,4 +1,4 @@ -import { buildCommand } from "@stricli/core"; +import { defineCommand } from "../../lib/stricli-wrappers"; import chalk from "chalk"; import type { LocalContext } from "../../context"; import { listBoards, type BoardListEntry } from "../../gql/board/list-boards"; @@ -82,7 +82,7 @@ async function list( } } -export const listCommand = buildCommand({ +export const listCommand = defineCommand({ loader: async () => list, parameters: { positional: { diff --git a/src/commands/board/scaffold.ts b/src/commands/board/scaffold.ts index 3caec9f..e9c074f 100644 --- a/src/commands/board/scaffold.ts +++ b/src/commands/board/scaffold.ts @@ -1,4 +1,4 @@ -import { buildCommand } from "@stricli/core"; +import { defineCommand } from "../../lib/stricli-wrappers"; import type { LocalContext } from "../../context"; // Mirrors boardScaffoldTemplate in the Go fork (cmd_board.go). Prints a minimal @@ -72,7 +72,7 @@ async function scaffold( writer.write(JSON.stringify(template, null, 2)); } -export const scaffoldCommand = buildCommand({ +export const scaffoldCommand = defineCommand({ loader: async () => scaffold, parameters: { positional: { diff --git a/src/commands/board/set-default.ts b/src/commands/board/set-default.ts index 58b14e6..4b979d7 100644 --- a/src/commands/board/set-default.ts +++ b/src/commands/board/set-default.ts @@ -1,4 +1,4 @@ -import { buildCommand } from "@stricli/core"; +import { defineCommand } from "../../lib/stricli-wrappers"; import type { LocalContext } from "../../context"; import { clearDefaultDashboard, @@ -67,7 +67,7 @@ async function clearDefault( } } -export const setDefaultCommand = buildCommand({ +export const setDefaultCommand = defineCommand({ loader: async () => setDefault, parameters: { positional: { @@ -84,7 +84,7 @@ export const setDefaultCommand = buildCommand({ }, }); -export const clearDefaultCommand = buildCommand({ +export const clearDefaultCommand = defineCommand({ loader: async () => clearDefault, parameters: { positional: { diff --git a/src/commands/board/update.ts b/src/commands/board/update.ts index 89d50ba..960df58 100644 --- a/src/commands/board/update.ts +++ b/src/commands/board/update.ts @@ -1,4 +1,4 @@ -import { buildCommand } from "@stricli/core"; +import { defineCommand } from "../../lib/stricli-wrappers"; import type { LocalContext } from "../../context"; import { saveBoard } from "../../gql/board/save-board"; import { GqlApiError } from "../../gql/gql-request"; @@ -35,7 +35,7 @@ async function update( } } -export const updateCommand = buildCommand({ +export const updateCommand = defineCommand({ loader: async () => update, parameters: { positional: { diff --git a/src/commands/dataset/dry-run.ts b/src/commands/dataset/dry-run.ts index 72a4e2b..bad05aa 100644 --- a/src/commands/dataset/dry-run.ts +++ b/src/commands/dataset/dry-run.ts @@ -1,4 +1,4 @@ -import { buildCommand } from "@stricli/core"; +import { defineCommand } from "../../lib/stricli-wrappers"; import * as fs from "node:fs"; import type { LocalContext } from "../../context"; import { datasetDryRun } from "../../gql/dataset/dataset-analysis"; @@ -69,7 +69,7 @@ async function dryRun( } } -export const dryRunCommand = buildCommand({ +export const dryRunCommand = defineCommand({ loader: async () => dryRun, parameters: { positional: { diff --git a/src/commands/dataset/impact.ts b/src/commands/dataset/impact.ts index 3561b73..8b292bd 100644 --- a/src/commands/dataset/impact.ts +++ b/src/commands/dataset/impact.ts @@ -1,4 +1,4 @@ -import { buildCommand } from "@stricli/core"; +import { defineCommand } from "../../lib/stricli-wrappers"; import chalk from "chalk"; import * as fs from "node:fs"; import type { LocalContext } from "../../context"; @@ -89,7 +89,7 @@ async function impact( } } -export const impactCommand = buildCommand({ +export const impactCommand = defineCommand({ loader: async () => impact, parameters: { positional: { diff --git a/src/commands/fleet/fleet.ts b/src/commands/fleet/fleet.ts index de2a3cb..87c1cc6 100644 --- a/src/commands/fleet/fleet.ts +++ b/src/commands/fleet/fleet.ts @@ -1,4 +1,4 @@ -import { buildCommand } from "@stricli/core"; +import { defineCommand } from "../../lib/stricli-wrappers"; import type { LocalContext } from "../../context"; import { loadConfig } from "../../lib/config"; import { formatApiError } from "../../lib/format-error"; @@ -82,7 +82,7 @@ const windowFlag = { }, }; -export const statusCommand = buildCommand({ +export const statusCommand = defineCommand({ loader: async () => { return async function (this: LocalContext, flags: FleetFlags) { await runFleet.call(this, flags, OPAL_FLEET_STATUS); @@ -95,7 +95,7 @@ export const statusCommand = buildCommand({ docs: { brief: "Show current status of all observe-agent instances" }, }); -export const versionsCommand = buildCommand({ +export const versionsCommand = defineCommand({ loader: async () => { return async function (this: LocalContext, flags: FleetFlags) { await runFleet.call(this, flags, OPAL_FLEET_VERSIONS); @@ -108,7 +108,7 @@ export const versionsCommand = buildCommand({ docs: { brief: "Show observe-agent versions across the fleet" }, }); -export const authCommand = buildCommand({ +export const authCommand = defineCommand({ loader: async () => { return async function (this: LocalContext, flags: FleetFlags) { await runFleet.call(this, flags, OPAL_FLEET_AUTH); @@ -121,7 +121,7 @@ export const authCommand = buildCommand({ docs: { brief: "Show observe-agent auth-check status across the fleet" }, }); -export const hostCommand = buildCommand({ +export const hostCommand = defineCommand({ loader: async () => { return async function ( this: LocalContext, diff --git a/src/commands/fleet/index.ts b/src/commands/fleet/index.ts index 448d202..b298fda 100644 --- a/src/commands/fleet/index.ts +++ b/src/commands/fleet/index.ts @@ -1,4 +1,4 @@ -import { buildRouteMap } from "@stricli/core"; +import { defineRoutes } from "../../lib/stricli-wrappers"; import { authCommand, hostCommand, @@ -6,7 +6,7 @@ import { versionsCommand, } from "./fleet"; -export const fleetRoutes = buildRouteMap({ +export const fleetRoutes = defineRoutes({ routes: { status: statusCommand, host: hostCommand, diff --git a/src/commands/folder/create.ts b/src/commands/folder/create.ts index c6976d8..4918473 100644 --- a/src/commands/folder/create.ts +++ b/src/commands/folder/create.ts @@ -1,4 +1,4 @@ -import { buildCommand } from "@stricli/core"; +import { defineCommand } from "../../lib/stricli-wrappers"; import type { LocalContext } from "../../context"; import { createFolder, @@ -69,7 +69,7 @@ async function create( } } -export const createCommand = buildCommand({ +export const createCommand = defineCommand({ loader: async () => create, parameters: { positional: { diff --git a/src/commands/folder/delete.ts b/src/commands/folder/delete.ts index 560e09a..5e5ce57 100644 --- a/src/commands/folder/delete.ts +++ b/src/commands/folder/delete.ts @@ -1,4 +1,4 @@ -import { buildCommand } from "@stricli/core"; +import { defineCommand } from "../../lib/stricli-wrappers"; import type { LocalContext } from "../../context"; import { deleteFolder } from "../../gql/folder/folder"; import { GqlApiError } from "../../gql/gql-request"; @@ -36,7 +36,7 @@ async function del( } } -export const deleteCommand = buildCommand({ +export const deleteCommand = defineCommand({ loader: async () => del, parameters: { positional: { diff --git a/src/commands/folder/get.ts b/src/commands/folder/get.ts index 6c3af6f..6229907 100644 --- a/src/commands/folder/get.ts +++ b/src/commands/folder/get.ts @@ -1,4 +1,4 @@ -import { buildCommand } from "@stricli/core"; +import { defineCommand } from "../../lib/stricli-wrappers"; import type { LocalContext } from "../../context"; import { lookupFolderByName } from "../../gql/folder/folder"; import { GqlApiError } from "../../gql/gql-request"; @@ -43,7 +43,7 @@ async function get( } } -export const getCommand = buildCommand({ +export const getCommand = defineCommand({ loader: async () => get, parameters: { positional: { diff --git a/src/commands/folder/index.ts b/src/commands/folder/index.ts index 3af327c..c917390 100644 --- a/src/commands/folder/index.ts +++ b/src/commands/folder/index.ts @@ -1,10 +1,10 @@ -import { buildRouteMap } from "@stricli/core"; +import { defineRoutes } from "../../lib/stricli-wrappers"; import { createCommand } from "./create"; import { getCommand } from "./get"; import { updateCommand } from "./update"; import { deleteCommand } from "./delete"; -export const folderRoutes = buildRouteMap({ +export const folderRoutes = defineRoutes({ routes: { create: createCommand, get: getCommand, diff --git a/src/commands/folder/update.ts b/src/commands/folder/update.ts index e0f1263..e44a14b 100644 --- a/src/commands/folder/update.ts +++ b/src/commands/folder/update.ts @@ -1,4 +1,4 @@ -import { buildCommand } from "@stricli/core"; +import { defineCommand } from "../../lib/stricli-wrappers"; import type { LocalContext } from "../../context"; import { updateFolder, type FolderInput } from "../../gql/folder/folder"; import { GqlApiError } from "../../gql/gql-request"; @@ -47,7 +47,7 @@ async function update( } } -export const updateCommand = buildCommand({ +export const updateCommand = defineCommand({ loader: async () => update, parameters: { positional: { diff --git a/src/commands/opal/check.ts b/src/commands/opal/check.ts index 9e0cc30..b9478f6 100644 --- a/src/commands/opal/check.ts +++ b/src/commands/opal/check.ts @@ -1,4 +1,4 @@ -import { buildCommand } from "@stricli/core"; +import { defineCommand } from "../../lib/stricli-wrappers"; import * as fs from "node:fs"; import type { LocalContext } from "../../context"; import { checkQueries } from "../../gql/opal/check-queries"; @@ -83,7 +83,7 @@ async function check( } } -export const checkCommand = buildCommand({ +export const checkCommand = defineCommand({ loader: async () => check, parameters: { positional: { diff --git a/src/commands/opal/functions.ts b/src/commands/opal/functions.ts index e309e77..645c6e7 100644 --- a/src/commands/opal/functions.ts +++ b/src/commands/opal/functions.ts @@ -1,4 +1,4 @@ -import { buildCommand } from "@stricli/core"; +import { defineCommand } from "../../lib/stricli-wrappers"; import type { LocalContext } from "../../context"; import { verbsAndFunctions } from "../../gql/opal/verbs-and-functions"; import { GqlApiError } from "../../gql/gql-request"; @@ -29,7 +29,7 @@ async function functions(this: LocalContext): Promise { } } -export const functionsCommand = buildCommand({ +export const functionsCommand = defineCommand({ loader: async () => functions, parameters: { positional: { kind: "tuple", parameters: [] }, flags: {} }, docs: { diff --git a/src/commands/opal/index.ts b/src/commands/opal/index.ts index 8726ae2..2fccd32 100644 --- a/src/commands/opal/index.ts +++ b/src/commands/opal/index.ts @@ -1,10 +1,10 @@ -import { buildRouteMap } from "@stricli/core"; +import { defineRoutes } from "../../lib/stricli-wrappers"; import { checkCommand } from "./check"; import { verbsCommand } from "./verbs"; import { functionsCommand } from "./functions"; import { validateIngestCommand } from "./validate-ingest"; -export const opalRoutes = buildRouteMap({ +export const opalRoutes = defineRoutes({ routes: { check: checkCommand, verbs: verbsCommand, diff --git a/src/commands/opal/validate-ingest.ts b/src/commands/opal/validate-ingest.ts index 119dd40..41cc434 100644 --- a/src/commands/opal/validate-ingest.ts +++ b/src/commands/opal/validate-ingest.ts @@ -1,4 +1,4 @@ -import { buildCommand } from "@stricli/core"; +import { defineCommand } from "../../lib/stricli-wrappers"; import type { LocalContext } from "../../context"; import { validateIngestFilter } from "../../gql/opal/validate-ingest-filter"; import { GqlApiError } from "../../gql/gql-request"; @@ -47,7 +47,7 @@ async function validateIngest( } } -export const validateIngestCommand = buildCommand({ +export const validateIngestCommand = defineCommand({ loader: async () => validateIngest, parameters: { positional: { diff --git a/src/commands/opal/verbs.ts b/src/commands/opal/verbs.ts index baa8eca..dfe3396 100644 --- a/src/commands/opal/verbs.ts +++ b/src/commands/opal/verbs.ts @@ -1,4 +1,4 @@ -import { buildCommand } from "@stricli/core"; +import { defineCommand } from "../../lib/stricli-wrappers"; import type { LocalContext } from "../../context"; import { verbsAndFunctions } from "../../gql/opal/verbs-and-functions"; import { GqlApiError } from "../../gql/gql-request"; @@ -27,7 +27,7 @@ async function verbs(this: LocalContext): Promise { } } -export const verbsCommand = buildCommand({ +export const verbsCommand = defineCommand({ loader: async () => verbs, parameters: { positional: { kind: "tuple", parameters: [] }, flags: {} }, docs: { diff --git a/src/commands/schema/index.ts b/src/commands/schema/index.ts index 79c252b..1266c79 100644 --- a/src/commands/schema/index.ts +++ b/src/commands/schema/index.ts @@ -1,7 +1,7 @@ -import { buildRouteMap } from "@stricli/core"; +import { defineRoutes } from "../../lib/stricli-wrappers"; import { introspectCommand } from "./introspect"; -export const schemaRoutes = buildRouteMap({ +export const schemaRoutes = defineRoutes({ routes: { introspect: introspectCommand, }, diff --git a/src/commands/schema/introspect.ts b/src/commands/schema/introspect.ts index baa7560..aef5825 100644 --- a/src/commands/schema/introspect.ts +++ b/src/commands/schema/introspect.ts @@ -1,4 +1,4 @@ -import { buildCommand } from "@stricli/core"; +import { defineCommand } from "../../lib/stricli-wrappers"; import type { LocalContext } from "../../context"; import { introspectSchema } from "../../gql/schema/introspect"; import { GqlApiError } from "../../gql/gql-request"; @@ -43,7 +43,7 @@ async function introspect( } } -export const introspectCommand = buildCommand({ +export const introspectCommand = defineCommand({ loader: async () => introspect, parameters: { positional: { kind: "tuple", parameters: [] }, diff --git a/src/commands/worksheet/create.ts b/src/commands/worksheet/create.ts index cf0b76c..ce9fc0f 100644 --- a/src/commands/worksheet/create.ts +++ b/src/commands/worksheet/create.ts @@ -1,4 +1,4 @@ -import { buildCommand } from "@stricli/core"; +import { defineCommand } from "../../lib/stricli-wrappers"; import * as fs from "node:fs"; import type { LocalContext } from "../../context"; import { saveWorksheet } from "../../gql/worksheet/worksheet"; @@ -50,7 +50,7 @@ async function create( } } -export const createCommand = buildCommand({ +export const createCommand = defineCommand({ loader: async () => create, parameters: { positional: { diff --git a/src/commands/worksheet/delete.ts b/src/commands/worksheet/delete.ts index e485786..22ac426 100644 --- a/src/commands/worksheet/delete.ts +++ b/src/commands/worksheet/delete.ts @@ -1,4 +1,4 @@ -import { buildCommand } from "@stricli/core"; +import { defineCommand } from "../../lib/stricli-wrappers"; import type { LocalContext } from "../../context"; import { deleteWorksheet } from "../../gql/worksheet/worksheet"; import { GqlApiError } from "../../gql/gql-request"; @@ -37,7 +37,7 @@ async function del( } } -export const deleteCommand = buildCommand({ +export const deleteCommand = defineCommand({ loader: async () => del, parameters: { positional: { diff --git a/src/commands/worksheet/get.ts b/src/commands/worksheet/get.ts index 6a8511c..778c69c 100644 --- a/src/commands/worksheet/get.ts +++ b/src/commands/worksheet/get.ts @@ -1,4 +1,4 @@ -import { buildCommand } from "@stricli/core"; +import { defineCommand } from "../../lib/stricli-wrappers"; import type { LocalContext } from "../../context"; import { getWorksheet } from "../../gql/worksheet/worksheet"; import { GqlApiError } from "../../gql/gql-request"; @@ -33,7 +33,7 @@ async function get( } } -export const getCommand = buildCommand({ +export const getCommand = defineCommand({ loader: async () => get, parameters: { positional: { diff --git a/src/commands/worksheet/index.ts b/src/commands/worksheet/index.ts index 2a29635..94b4324 100644 --- a/src/commands/worksheet/index.ts +++ b/src/commands/worksheet/index.ts @@ -1,10 +1,10 @@ -import { buildRouteMap } from "@stricli/core"; +import { defineRoutes } from "../../lib/stricli-wrappers"; import { listCommand } from "./list"; import { getCommand } from "./get"; import { createCommand } from "./create"; import { deleteCommand } from "./delete"; -export const worksheetRoutes = buildRouteMap({ +export const worksheetRoutes = defineRoutes({ routes: { list: listCommand, get: getCommand, diff --git a/src/commands/worksheet/list.ts b/src/commands/worksheet/list.ts index e9ad327..7360882 100644 --- a/src/commands/worksheet/list.ts +++ b/src/commands/worksheet/list.ts @@ -1,4 +1,4 @@ -import { buildCommand } from "@stricli/core"; +import { defineCommand } from "../../lib/stricli-wrappers"; import chalk from "chalk"; import type { LocalContext } from "../../context"; import { @@ -90,7 +90,7 @@ async function list( } } -export const listCommand = buildCommand({ +export const listCommand = defineCommand({ loader: async () => list, parameters: { positional: { kind: "tuple", parameters: [] },