Skip to content

feat(cli): fold @lobu/sdk into @lobu/cli/config#1026

Merged
buremba merged 2 commits into
mainfrom
feat/pkg-restructure
May 24, 2026
Merged

feat(cli): fold @lobu/sdk into @lobu/cli/config#1026
buremba merged 2 commits into
mainfrom
feat/pkg-restructure

Conversation

@buremba
Copy link
Copy Markdown
Member

@buremba buremba commented May 24, 2026

What

Folds the standalone @lobu/sdk config-authoring package into a dependency-light @lobu/cli/config subpath, and deletes @lobu/sdk. Part 1 of the 9.3.0 package re-tiering (option 2): shrink the published surface, kill the @lobu/sdk naming confusion.

A project already installs @lobu/cli to run lobu apply, so the separate @lobu/sdk devDependency was redundant. This matches how the ecosystem ships config helpers from the tool package itself — vite, vitest/config, astro/config, drizzle-kit.

Changes

  • New @lobu/cli/config entry: bunsrc/config, node→dist/config. The define* builders (defineConfig, defineAgent, defineWatcher, defineConnection, defineEntityType, defineRelationshipType, defineAuthProfile, secret) move here verbatim.
  • Isolation guard (config-isolation.test.ts): static-scans src/config and fails if it imports anything beyond relative siblings, @lobu/connector-sdk, or @sinclair/typebox — so the heavy CLI graph can never leak into a user's lobu.config.ts load/typecheck.
  • Connector authoring unchanged: defineConnector/Type still re-exported (from @lobu/connector-sdk); that package is untouched.
  • @lobu/sdk deleted and removed from publish-packages.mjs, release-please-config.json extra-files, ci.yml unit build, root build:packages + test globs, lockfile.
  • Consumers updated: lobu init / init --from-org scaffold, 12 examples, landing docs + regenerated snippets, skills/, codex-skills/, scripts/sdk-e2e.sh, scripts/gen-use-case-data.ts.

Validation

  • Full root tsc --noEmit clean (pre-commit hook) + packages/cli strict typecheck clean.
  • All affected unit tests pass: config builders, isolation guard, load-config/map-config (jiti-load configs importing @lobu/cli/config → resolves via the bun condition to src), cli-ux, apply-cmd-dryrun, init-from-org.
  • Biome clean.
  • The sdk-e2e CI job exercises the full scaffold → apply → sync → watcher path against the new @lobu/cli/config import end-to-end.

Follow-up (same 9.3.0)

PR B: privatize @lobu/connectors + @lobu/embeddings + @lobu/worker (bundle/vendor into the CLI tarball like @lobu/server). @lobu/connector-worker and @lobu/core stay public.

Summary by CodeRabbit

  • Chores

    • Removed the SDK package from the monorepo and removed its build/publish steps.
    • Switched configuration authoring to use the CLI package and updated packaging/exports accordingly.
    • Updated build/test scripts and workspace tooling to reflect these changes.
  • Documentation

    • Updated examples, guides, and CLI docs to use the new configuration import source.
  • Tests

    • Added a config-isolation test to enforce dependency-light imports for the CLI config.

Review Change Stack

The define* project-authoring builders (defineConfig/defineAgent/…) move
from the standalone @lobu/sdk package into a dependency-light
`@lobu/cli/config` subpath. A project already installs @lobu/cli to run
`lobu apply`, so a separate @lobu/sdk devDependency was redundant — this
matches how Vite/Vitest/Astro/Drizzle-kit ship defineConfig from the tool
package itself.

- New `@lobu/cli/config` entry (bun→src, node→dist), guarded by an
  isolation test asserting it imports nothing heavy (only relative,
  @lobu/connector-sdk, typebox).
- Connector authoring (defineConnector/Type) stays re-exported from
  @lobu/connector-sdk; that package is unchanged.
- @lobu/sdk deleted; dropped from publish-packages.mjs, release-please
  extra-files, ci.yml unit build, root build:packages + test globs.
- Scaffold (lobu init / init --from-org), examples, docs, skills, and
  sdk-e2e updated to import from @lobu/cli/config.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 24, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: fdff85c9-9339-4862-973b-02dd1b56b933

📥 Commits

Reviewing files that changed from the base of the PR and between 1f2800a and a23a669.

📒 Files selected for processing (3)
  • Makefile
  • scripts/bump-version.mjs
  • tsconfig.json
💤 Files with no reviewable changes (2)
  • scripts/bump-version.mjs
  • tsconfig.json

📝 Walkthrough

Walkthrough

This PR migrates configuration authoring from @lobu/sdk to @lobu/cli/config, removes the SDK package, establishes a CLI config subpath with export map entries and an isolation test, updates CLI generation/loading code, updates examples/tests/docs, and adjusts build/publish scripts.

Changes

Config authoring migration from @lobu/sdk to @lobu/cli/config

Layer / File(s) Summary
CLI config module exports and isolation
packages/cli/package.json, packages/cli/src/config/__tests__/config-isolation.test.ts, packages/cli/src/config/index.ts
Adds ./config subpath export to packages/cli/package.json with types and runtime targets, includes src/config in published files, adds a config isolation test enforcing a small allowlist, and updates config/index.ts documentation.
SDK package removal and infrastructure cleanup
package.json, .github/workflows/ci.yml, scripts/publish-packages.mjs, release-please-config.json, packages/sdk/*
Removes packages/sdk/package.json and packages/sdk/tsconfig.json, updates CI/build scripts and Makefile to skip building sdk, removes packages/sdk from publish/bump scripts and release-please extra-files.
Init command project scaffolding
packages/cli/src/commands/init.ts, packages/cli/src/commands/_lib/init-from-org/bootstrap.ts
Scaffolded projects declare @lobu/cli as a devDependency and generate lobu.config.ts that imports authoring helpers from @lobu/cli/config; ImportTracker updated to emit the new import source.
Apply command config loading and mapping
packages/cli/src/commands/_lib/apply/desired-state.ts, packages/cli/src/commands/_lib/apply/map-config.ts, packages/cli/src/commands/memory/_lib/schema.ts
Load and mapping code updated to use local CLI config types (imported from ../../../config/index.js), move isSecretRef import to the local config module, and update error messages/comments to reference @lobu/cli.
Apply command test fixtures
packages/cli/src/commands/_lib/apply/__tests__/*
All apply-related test fixtures updated to import config helpers from @lobu/cli/config instead of @lobu/sdk.
CLI UX tests
packages/cli/src/__tests__/cli-ux.test.ts
Update scaffold/regression checks to assert @lobu/cli in generated devDependencies and update fixture imports and jiti resolution comments.
Example project migrations
examples/{agent-community,atlas,delivery,ecommerce,finance,leadership,legal,lobu-crm,market,office-bot,personal-finance,sales}/lobu.config.ts
All example lobu.config.ts files now import configuration helpers from @lobu/cli/config instead of @lobu/sdk.
Skill documentation
codex-skills/lobu-builder/SKILL.md, skills/lobu/SKILL.md
Update scaffolding and Core Model guidance to reference @lobu/cli/config in example snippets.
Landing docs & snippet generator
packages/landing/src/content/docs/*, packages/landing/scripts/gen-landing-snippets.ts
Update documentation examples, guides, and snippet generator to use @lobu/cli/config as the config authoring import source.
Use-case data & support scripts
scripts/gen-use-case-data.ts, scripts/publish-packages.mjs, scripts/sdk-e2e.sh, scripts/bump-version.mjs, Makefile, tsconfig.json
Scripts updated to source types/helpers from @lobu/cli/config, remove packages/sdk from publish/bump lists, update e2e scaffold heredoc, adjust Makefile build list, and update tsconfig excludes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • lobu-ai/lobu#1003: Modifies root build steps related to package build ordering/artifacts (both touch multi-package build sequencing).
  • lobu-ai/lobu#1015: Related changes to apply/load path and CLI config imports (desired-state.ts, map-config.ts) switching to CLI config entrypoint.
  • lobu-ai/lobu#945: Related landing snippet and pinned examples updates that intersect with docs/snippet generation changes.

Suggested labels

skip-size-check

Suggested reviewers

  • codex-approver

Poem

🐰 A small hop from SDK to CLI,
I carried configs, light and spry.
Subpath exports, docs aligned,
Examples, tests — all redesigned.
Hooray! A tidy import sky.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'feat(cli): fold @lobu/sdk into @lobu/cli/config' clearly and concisely summarizes the main change: moving the @lobu/sdk package's config-authoring functionality into @lobu/cli/config as a subpath.
Description check ✅ Passed The PR description is comprehensive and well-structured, covering What, Changes, Validation, and Follow-up sections with detailed information about the refactoring objectives and implementation approach.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/pkg-restructure

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...kages/cli/src/commands/_lib/apply/desired-state.ts 0.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

The @lobu/sdk fold missed three build-time references to the now-deleted
package, breaking `make build-packages` (`cd packages/sdk: No such file
or directory`) and cascading into CI's typecheck/apply/sdk-e2e jobs:

- Makefile `build-packages` loop (the target CI runs)
- root tsconfig.json exclude list
- scripts/bump-version.mjs synchronized-bump dir list

Full `make build-packages` now green locally (incl. CLI build.cjs).
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (8)
examples/lobu-crm/lobu.config.ts (1)

12-43: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

crm agent config must include guardrails.

defineAgent in this lobu.config.ts is missing the required guardrails declaration.

Suggested patch
 const crm = defineAgent({
   id: "crm",
   name: "crm",
   description:
     "Maintains Lobu's funnel CRM — leads, pilots, inbound triage, weekly digest",
+  guardrails: [],
   providers: [

As per coding guidelines, **/lobu.config.ts: Configure guardrails via defineAgent({ guardrails: [...] }) in lobu.config.ts.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/lobu-crm/lobu.config.ts` around lines 12 - 43, The crm agent defined
via defineAgent (variable crm) is missing the required guardrails property;
update the object passed to defineAgent to include a guardrails: [...] array
containing the required guardrail definitions (e.g., policy IDs or rule objects)
so the crm agent has its safety/validation rules configured; locate the
defineAgent({ id: "crm", ... }) call and add the guardrails key alongside
providers and network to satisfy the expected config shape.
examples/finance/lobu.config.ts (1)

10-32: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Missing required guardrails in defineAgent.

This lobu.config.ts agent config should explicitly set guardrails.

Suggested patch
 const finance = defineAgent({
   id: "finance",
   name: "finance",
   description:
     "Help finance teams reconcile data, explain variance, and prepare reporting runs",
+  guardrails: [],
   dir: "./agents/finance",

As per coding guidelines, **/lobu.config.ts: Configure guardrails via defineAgent({ guardrails: [...] }) in lobu.config.ts.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/finance/lobu.config.ts` around lines 10 - 32, The agent config
created by defineAgent for the finance agent is missing the required guardrails
property; update the defineAgent({ id: "finance", ... }) call to include a
guardrails field (e.g., guardrails: [ ... ]) containing the required guardrail
definitions (policy identifiers or rule objects) appropriate for this project so
the finance agent enforces the expected constraints; modify the finance
variable's defineAgent invocation to add the guardrails array with the necessary
entries.
examples/delivery/lobu.config.ts (1)

10-32: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

defineAgent needs explicit guardrails.

This config omits guardrails, which is required for lobu.config.ts.

Suggested patch
 const delivery = defineAgent({
   id: "delivery",
   name: "delivery",
   description:
     "Help delivery teams keep milestones, blockers, owners, and artifacts aligned",
+  guardrails: [],
   dir: "./agents/delivery",

As per coding guidelines, **/lobu.config.ts: Configure guardrails via defineAgent({ guardrails: [...] }) in lobu.config.ts.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/delivery/lobu.config.ts` around lines 10 - 32, The delivery agent
defined via defineAgent (identifier "delivery") is missing the required
guardrails property; update the object passed to defineAgent to include a
guardrails field (an array of guardrail definitions per project guidelines) so
the config satisfies lobu.config.ts requirements—add guardrails: [...] inside
the defineAgent call for the delivery agent and populate it with the mandated
rules/policies.
examples/leadership/lobu.config.ts (1)

10-32: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Configure guardrails on the leadership agent.

guardrails is missing in defineAgent, which is required for lobu.config.ts.

Suggested patch
 const leadership = defineAgent({
   id: "leadership",
   name: "leadership",
   description:
     "Help leadership teams turn memos, decisions, and board materials into reusable operating context",
+  guardrails: [],
   dir: "./agents/leadership",

As per coding guidelines, **/lobu.config.ts: Configure guardrails via defineAgent({ guardrails: [...] }) in lobu.config.ts.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/leadership/lobu.config.ts` around lines 10 - 32, The leadership
agent definition (defineAgent with id "leadership"/name "leadership") is missing
the required guardrails property; add a guardrails array to the defineAgent call
(e.g., guardrails: [ ... ]) with the required guard rule objects or references
per project conventions so the agent conforms to lobu.config.ts expectations;
update the defineAgent invocation near the leadership constant to include
guardrails alongside id, name, description, dir, providers, and network.
examples/legal/lobu.config.ts (1)

10-32: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add required guardrails in defineAgent.

This agent definition omits guardrails, which violates the config guideline for lobu.config.ts.

Suggested patch
 const legalReview = defineAgent({
   id: "legal-review",
   name: "legal-review",
   description:
     "Review contracts, summarize risk, and surface missing protections",
+  guardrails: [],
   dir: "./agents/legal",

As per coding guidelines, **/lobu.config.ts: Configure guardrails via defineAgent({ guardrails: [...] }) in lobu.config.ts.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/legal/lobu.config.ts` around lines 10 - 32, The agent created via
defineAgent for id/name "legal-review" is missing the required guardrails
configuration; update the defineAgent call (the legalReview object) to include a
guardrails property (e.g., guardrails: [ ... ]) that lists the policy rules or
guardrail modules per project guidelines so the agent enforces constraints
during execution; ensure the guardrails array is populated with the appropriate
rule identifiers or objects expected by the system.
examples/atlas/lobu.config.ts (1)

9-31: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Declare guardrails in defineAgent.

The agent config is missing guardrails, which violates the lobu.config.ts requirement.

Suggested patch
 const atlasCurator = defineAgent({
   id: "atlas-curator",
   name: "atlas-curator",
   description:
     "Curate Atlas reference data — countries, cities, regions, industries, technologies, universities",
+  guardrails: [],
   dir: "./agents/atlas-curator",

As per coding guidelines, **/lobu.config.ts: Configure guardrails via defineAgent({ guardrails: [...] }) in lobu.config.ts.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/atlas/lobu.config.ts` around lines 9 - 31, The agent configuration
for atlasCurator (created via defineAgent) is missing the required guardrails
property; add a guardrails array to the defineAgent({...}) call for atlasCurator
containing the required guardrail rules (e.g., strings or objects as per project
schema) so the lobu.config.ts validation passes, ensuring the symbol defineAgent
and the atlasCurator constant are updated with the new guardrails field.
examples/agent-community/lobu.config.ts (1)

10-32: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add explicit guardrails to the agent definition.

defineAgent here does not declare guardrails, so safety policy is implicit instead of configured in lobu.config.ts.

Suggested patch
 const agentCommunity = defineAgent({
   id: "agent-community",
   name: "agent-community",
   description:
     "Discover aligned members, explain why they should meet, and draft warm introductions",
+  guardrails: [],
   dir: "./agents/agent-community",

As per coding guidelines, **/lobu.config.ts: Configure guardrails via defineAgent({ guardrails: [...] }) in lobu.config.ts.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/agent-community/lobu.config.ts` around lines 10 - 32, The agent
definition for agentCommunity (created via defineAgent) is missing an explicit
guardrails property, so the safety policy is implicit; update the defineAgent
call for agentCommunity to include a guardrails array (e.g., guardrails: [ ...
]) with the desired safety rules/policies, ensuring the array items match the
expected guardrail type/interface used by defineAgent and that the property sits
at the same object level as id/name/description/dir/providers/network.
examples/ecommerce/lobu.config.ts (1)

10-32: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add guardrails to this agent config.

defineAgent currently has no guardrails field, which violates the lobu.config.ts policy requirement.

Suggested patch
 const ecommerceOps = defineAgent({
   id: "ecommerce-ops",
   name: "ecommerce-ops",
   description:
     "Manage subscriptions, process order changes, and resolve customer requests",
+  guardrails: [],
   dir: "./agents/ecommerce-ops",

As per coding guidelines, **/lobu.config.ts: Configure guardrails via defineAgent({ guardrails: [...] }) in lobu.config.ts.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/ecommerce/lobu.config.ts` around lines 10 - 32, The agent config
defined by defineAgent for ecommerceOps is missing the required guardrails
field; add a guardrails property to the object passed to defineAgent (e.g., add
guardrails: [...] inside the ecommerceOps definition) and populate it with the
required guardrail rules (strings or objects per your app policy) so the
lobu.config.ts policy is satisfied; update the ecommerceOps constant (id/name:
"ecommerce-ops") to include this new guardrails array.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/cli/src/config/__tests__/config-isolation.test.ts`:
- Around line 33-35: The test currently builds files by calling
readdirSync(configDir).filter(...) which only inspects top-level .ts files;
update the test to recursively scan src/config so nested files aren't
missed—replace the non-recursive readdirSync usage with a recursive directory
walker (or a glob) that starts at configDir and returns all .ts file paths, then
apply the same .endsWith(".ts") && !== "__tests__" filter; reference the
existing variables/functions: files, readdirSync, configDir, and the filter step
so you locate and replace the non-recursive logic with a recursive walk/glob
solution.

---

Outside diff comments:
In `@examples/agent-community/lobu.config.ts`:
- Around line 10-32: The agent definition for agentCommunity (created via
defineAgent) is missing an explicit guardrails property, so the safety policy is
implicit; update the defineAgent call for agentCommunity to include a guardrails
array (e.g., guardrails: [ ... ]) with the desired safety rules/policies,
ensuring the array items match the expected guardrail type/interface used by
defineAgent and that the property sits at the same object level as
id/name/description/dir/providers/network.

In `@examples/atlas/lobu.config.ts`:
- Around line 9-31: The agent configuration for atlasCurator (created via
defineAgent) is missing the required guardrails property; add a guardrails array
to the defineAgent({...}) call for atlasCurator containing the required
guardrail rules (e.g., strings or objects as per project schema) so the
lobu.config.ts validation passes, ensuring the symbol defineAgent and the
atlasCurator constant are updated with the new guardrails field.

In `@examples/delivery/lobu.config.ts`:
- Around line 10-32: The delivery agent defined via defineAgent (identifier
"delivery") is missing the required guardrails property; update the object
passed to defineAgent to include a guardrails field (an array of guardrail
definitions per project guidelines) so the config satisfies lobu.config.ts
requirements—add guardrails: [...] inside the defineAgent call for the delivery
agent and populate it with the mandated rules/policies.

In `@examples/ecommerce/lobu.config.ts`:
- Around line 10-32: The agent config defined by defineAgent for ecommerceOps is
missing the required guardrails field; add a guardrails property to the object
passed to defineAgent (e.g., add guardrails: [...] inside the ecommerceOps
definition) and populate it with the required guardrail rules (strings or
objects per your app policy) so the lobu.config.ts policy is satisfied; update
the ecommerceOps constant (id/name: "ecommerce-ops") to include this new
guardrails array.

In `@examples/finance/lobu.config.ts`:
- Around line 10-32: The agent config created by defineAgent for the finance
agent is missing the required guardrails property; update the defineAgent({ id:
"finance", ... }) call to include a guardrails field (e.g., guardrails: [ ... ])
containing the required guardrail definitions (policy identifiers or rule
objects) appropriate for this project so the finance agent enforces the expected
constraints; modify the finance variable's defineAgent invocation to add the
guardrails array with the necessary entries.

In `@examples/leadership/lobu.config.ts`:
- Around line 10-32: The leadership agent definition (defineAgent with id
"leadership"/name "leadership") is missing the required guardrails property; add
a guardrails array to the defineAgent call (e.g., guardrails: [ ... ]) with the
required guard rule objects or references per project conventions so the agent
conforms to lobu.config.ts expectations; update the defineAgent invocation near
the leadership constant to include guardrails alongside id, name, description,
dir, providers, and network.

In `@examples/legal/lobu.config.ts`:
- Around line 10-32: The agent created via defineAgent for id/name
"legal-review" is missing the required guardrails configuration; update the
defineAgent call (the legalReview object) to include a guardrails property
(e.g., guardrails: [ ... ]) that lists the policy rules or guardrail modules per
project guidelines so the agent enforces constraints during execution; ensure
the guardrails array is populated with the appropriate rule identifiers or
objects expected by the system.

In `@examples/lobu-crm/lobu.config.ts`:
- Around line 12-43: The crm agent defined via defineAgent (variable crm) is
missing the required guardrails property; update the object passed to
defineAgent to include a guardrails: [...] array containing the required
guardrail definitions (e.g., policy IDs or rule objects) so the crm agent has
its safety/validation rules configured; locate the defineAgent({ id: "crm", ...
}) call and add the guardrails key alongside providers and network to satisfy
the expected config shape.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5c8fe749-0050-4300-8902-65fc682b22c3

📥 Commits

Reviewing files that changed from the base of the PR and between 3e83429 and 1f2800a.

⛔ Files ignored due to path filters (2)
  • bun.lock is excluded by !**/*.lock
  • packages/landing/src/generated/landing-snippets.json is excluded by !**/generated/**
📒 Files selected for processing (50)
  • .github/workflows/ci.yml
  • codex-skills/lobu-builder/SKILL.md
  • examples/agent-community/lobu.config.ts
  • examples/atlas/lobu.config.ts
  • examples/delivery/lobu.config.ts
  • examples/ecommerce/lobu.config.ts
  • examples/finance/lobu.config.ts
  • examples/leadership/lobu.config.ts
  • examples/legal/lobu.config.ts
  • examples/lobu-crm/lobu.config.ts
  • examples/market/lobu.config.ts
  • examples/office-bot/lobu.config.ts
  • examples/personal-finance/lobu.config.ts
  • examples/sales/lobu.config.ts
  • package.json
  • packages/cli/package.json
  • packages/cli/src/__tests__/cli-ux.test.ts
  • packages/cli/src/commands/_lib/apply/__tests__/apply-cmd-dryrun.test.ts
  • packages/cli/src/commands/_lib/apply/__tests__/load-config.test.ts
  • packages/cli/src/commands/_lib/apply/__tests__/map-config.test.ts
  • packages/cli/src/commands/_lib/apply/desired-state.ts
  • packages/cli/src/commands/_lib/apply/map-config.ts
  • packages/cli/src/commands/_lib/init-from-org/__tests__/init-from-org.test.ts
  • packages/cli/src/commands/_lib/init-from-org/bootstrap.ts
  • packages/cli/src/commands/init.ts
  • packages/cli/src/commands/memory/_lib/schema.ts
  • packages/cli/src/config/__tests__/config-isolation.test.ts
  • packages/cli/src/config/__tests__/define.test.ts
  • packages/cli/src/config/define.ts
  • packages/cli/src/config/index.ts
  • packages/cli/src/config/secret.ts
  • packages/landing/scripts/gen-landing-snippets.ts
  • packages/landing/src/content/docs/getting-started/index.mdx
  • packages/landing/src/content/docs/getting-started/reaction-sdk.md
  • packages/landing/src/content/docs/guides/agent-prompts.md
  • packages/landing/src/content/docs/guides/egress-judge.md
  • packages/landing/src/content/docs/guides/guardrails.md
  • packages/landing/src/content/docs/guides/sync-from-github.md
  • packages/landing/src/content/docs/guides/tool-policy.md
  • packages/landing/src/content/docs/reference/cli.md
  • packages/landing/src/content/docs/reference/lobu-apply.md
  • packages/landing/src/content/docs/reference/lobu-config.md
  • packages/landing/src/content/docs/reference/lobu-memory.md
  • packages/sdk/package.json
  • packages/sdk/tsconfig.json
  • release-please-config.json
  • scripts/gen-use-case-data.ts
  • scripts/publish-packages.mjs
  • scripts/sdk-e2e.sh
  • skills/lobu/SKILL.md
💤 Files with no reviewable changes (5)
  • packages/sdk/tsconfig.json
  • packages/sdk/package.json
  • release-please-config.json
  • .github/workflows/ci.yml
  • scripts/publish-packages.mjs

Comment on lines +33 to +35
const files = readdirSync(configDir).filter(
(f) => f.endsWith(".ts") && f !== "__tests__"
);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Scan src/config recursively to avoid isolation blind spots.

This only checks top-level .ts files, so a nested src/config/** file can import a disallowed bare module without failing this test.

Suggested fix
 import { describe, expect, test } from "bun:test";
 import { readdirSync, readFileSync } from "node:fs";
 import { join } from "node:path";
@@
 const configDir = join(import.meta.dir, "..");
+
+function listTsFiles(dir: string): string[] {
+  const out: string[] = [];
+  for (const entry of readdirSync(dir, { withFileTypes: true })) {
+    if (entry.name === "__tests__") continue;
+    const fullPath = join(dir, entry.name);
+    if (entry.isDirectory()) {
+      out.push(...listTsFiles(fullPath));
+    } else if (entry.isFile() && entry.name.endsWith(".ts")) {
+      out.push(fullPath);
+    }
+  }
+  return out;
+}
@@
-    const files = readdirSync(configDir).filter(
-      (f) => f.endsWith(".ts") && f !== "__tests__"
-    );
+    const files = listTsFiles(configDir);
     expect(files.length).toBeGreaterThan(0);
@@
-    for (const file of files) {
-      const source = readFileSync(join(configDir, file), "utf-8");
+    for (const file of files) {
+      const source = readFileSync(file, "utf-8");
       for (const spec of importSpecifiers(source)) {
         const isRelative = spec.startsWith(".");
         if (!isRelative && !ALLOWED_BARE.has(spec)) {
-          offenders.push(`${file}: ${spec}`);
+          offenders.push(`${file}: ${spec}`);
         }
       }
     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/cli/src/config/__tests__/config-isolation.test.ts` around lines 33 -
35, The test currently builds files by calling
readdirSync(configDir).filter(...) which only inspects top-level .ts files;
update the test to recursively scan src/config so nested files aren't
missed—replace the non-recursive readdirSync usage with a recursive directory
walker (or a glob) that starts at configDir and returns all .ts file paths, then
apply the same .endsWith(".ts") && !== "__tests__" filter; reference the
existing variables/functions: files, readdirSync, configDir, and the filter step
so you locate and replace the non-recursive logic with a recursive walk/glob
solution.

@buremba
Copy link
Copy Markdown
Member Author

buremba commented May 24, 2026

bug_free 68, simplicity 72, slop 12, bugs 1, 0 blockers

Typecheck and unit passed. [env] Integration failed before exercising tests because DATABASE_URL pointed at database "postgres" and the harness refused destructive setup. Exploratory: loaded desired state for atlas, lobu-crm, and personal-finance configs with bun; shapes looked sane.

Suggested fixes

File Line Change
packages/cli/src/commands/_lib/apply/apply-cmd.ts 650 Ensure declared platform secrets are re-pushed even when the platform diff is noop with an opaque remote config, or make diffPlatform emit an update for opaque secret-bearing config so env/.env token rotations actually reach the server.
packages/server/src/lobu/agent-routes.ts 1483 Fix the new comment to say the Map key uses the NUL delimiter (${teamId}\0${channelId}), not a single space, or remove the over-specific delimiter paragraph.
Full verdict JSON
{
  "bug_free_confidence": 68,
  "bugs": 1,
  "slop": 12,
  "simplicity": 72,
  "blockers": [],
  "change_type": "feat",
  "behavior_change_risk": "high",
  "tests_adequate": false,
  "suggested_fixes": [
    {
      "file": "packages/cli/src/commands/_lib/apply/apply-cmd.ts",
      "line": 650,
      "change": "Ensure declared platform secrets are re-pushed even when the platform diff is noop with an opaque remote config, or make diffPlatform emit an update for opaque secret-bearing config so env/.env token rotations actually reach the server."
    },
    {
      "file": "packages/server/src/lobu/agent-routes.ts",
      "line": 1483,
      "change": "Fix the new comment to say the Map key uses the NUL delimiter (`${teamId}\\0${channelId}`), not a single space, or remove the over-specific delimiter paragraph."
    }
  ],
  "notes": "Typecheck and unit passed. [env] Integration failed before exercising tests because DATABASE_URL pointed at database \"postgres\" and the harness refused destructive setup. Exploratory: loaded desired state for atlas, lobu-crm, and personal-finance configs with bun; shapes looked sane.",
  "categories": {
    "src": 9635,
    "tests": 6330,
    "docs": 1492,
    "config": 8422,
    "deps": 196,
    "migrations": 20,
    "ci": 83,
    "generated": 4443
  }
}

Local review gate — branch protection can require the pi-review commit status. See docs/REVIEW_SCHEMA.md.

@buremba buremba merged commit 06f3432 into main May 24, 2026
24 checks passed
@buremba buremba deleted the feat/pkg-restructure branch May 24, 2026 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants