Skip to content

chore(examples): add package.json + tsconfig so examples are self-contained#1034

Merged
buremba merged 2 commits into
mainfrom
feat/examples-packaging
May 24, 2026
Merged

chore(examples): add package.json + tsconfig so examples are self-contained#1034
buremba merged 2 commits into
mainfrom
feat/examples-packaging

Conversation

@buremba
Copy link
Copy Markdown
Member

@buremba buremba commented May 24, 2026

What

Every example carried only lobu.config.ts and relied on the monorepo workspace to resolve @lobu/cli/config and @lobu/connector-sdk. So they:

  • didn't match what lobu init scaffoldsscaffoldProjectPackaging (packages/cli/src/commands/init.ts:167) writes a package.json (with @lobu/cli + @lobu/connector-sdk devDeps) and a tsconfig.json for exactly this reason: "so lobu apply (jiti) and the editor can resolve the SDK imports outside this monorepo."
  • couldn't be copied out and typechecked standalone — the imports only resolved because the examples sit inside the workspace.
  • were inconsistent: only personal-finance had a package.json, and even it lacked the SDK devDeps + had no tsconfig.

The gap, fixed

Give every example the init-style package.json (@lobu/cli + @lobu/connector-sdk at ^9.2.0, matching scaffoldProjectPackaging) and a tsconfig.json whose include covers the dirs actually present (agents/connectors/reactions/models — the examples put reactions under models/, which the stock init globs wouldn't catch).

Adding the tsconfigs surfaced pre-existing type errors in example code that nothing had ever typechecked (8 of 12 examples failed). Fixed against the shipped SDK contract:

  • 4 OAuth connectors missing requiredScopes — salesforce, quickbooks, linear, docusign (ConnectorAuthOAuth.requiredScopes is required).
  • 3 connectors using a stale env auth shape — type: "env" + { name } fields → type: "env_keys" + { key } (discourse, shopify, exa).
  • all 7 connectors missing the required EventEnvelope.payload_text.
  • 2 invalid direct casts — finance reaction (Record<string,unknown>ReconciliationData) and office-bot deliveroo skill (cookie array); both now as unknown as.

Validation

bunx tsc -p examples/<name>/tsconfig.json --noEmit is green for all 12 examples. biome check clean. No example *.config.ts semantics changed — only packaging added + type errors fixed.

Examples stay standalone (not added to the root workspace), matching the existing personal-finance convention.

Summary by CodeRabbit

  • New Features

    • Emitted events now include human-readable payload text across several integrations (orders, transactions, issues, envelopes, cycles, opportunities, news, and posts)
  • Bug Fixes

    • Sensitive API keys and tokens are now treated as secrets for improved security
    • OAuth integrations now declare required scopes for several providers
  • Chores

    • Added example project manifests and TypeScript configs for multiple templates

Review Change Stack

Examples carried only lobu.config.ts and relied on the monorepo workspace to
resolve @lobu/cli/config and @lobu/connector-sdk, so they didn't match what
`lobu init` scaffolds (scaffoldProjectPackaging writes package.json +
tsconfig.json) and couldn't be copied out and typechecked standalone. Only
personal-finance had a package.json (and it lacked the SDK devDeps + tsconfig).

Give every example the init-style package.json (@lobu/cli + @lobu/connector-sdk
at ^9.2.0) and a tsconfig whose include covers the dirs actually present
(agents/connectors/reactions/models). Adding tsconfig surfaced pre-existing type
errors in code nothing had ever typechecked:
- 4 OAuth connectors missing requiredScopes (salesforce, quickbooks, linear, docusign)
- 3 connectors using a stale env auth shape (type:"env"/{name} -> env_keys/{key})
- all 7 connectors missing the required EventEnvelope.payload_text
- 2 invalid direct casts (finance reaction, office-bot deliveroo skill)

All 12 examples now typecheck clean against the shipped SDK.
@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: d873d1da-95a2-4d67-89a8-d338a45c4be2

📥 Commits

Reviewing files that changed from the base of the PR and between 3e981f1 and 6bca9a2.

📒 Files selected for processing (12)
  • examples/agent-community/package.json
  • examples/atlas/package.json
  • examples/delivery/package.json
  • examples/ecommerce/package.json
  • examples/finance/package.json
  • examples/leadership/package.json
  • examples/legal/package.json
  • examples/lobu-crm/package.json
  • examples/market/package.json
  • examples/office-bot/package.json
  • examples/personal-finance/package.json
  • examples/sales/package.json
✅ Files skipped from review due to trivial changes (3)
  • examples/ecommerce/package.json
  • examples/personal-finance/package.json
  • examples/delivery/package.json

📝 Walkthrough

Walkthrough

This PR standardizes package and TypeScript configs across examples, modernizes connector authentication schemas to use environment keys and explicit OAuth scopes, and enriches connector events with new payload_text fields selecting prioritized text content.

Changes

Example Workspace Setup and Connector Updates

Layer / File(s) Summary
Example workspace configuration
examples/*/package.json, examples/*/tsconfig.json
Adds or updates package manifests and TypeScript configs for example workspaces (agent-community, atlas, delivery, ecommerce, finance, leadership, legal, lobu-crm, market, office-bot, personal-finance, sales). Each package.json declares devDependencies on @lobu/cli and @lobu/connector-sdk at ^9.3.0; each tsconfig.json sets ES2022 target, module: "Preserve", moduleResolution: "bundler", strict: true, skipLibCheck: true, and noEmit: true with scoped include globs.
Connector authentication schema modernization
examples/*/connectors/*.connector.ts
Switches some connectors from env to env_keys and marks credential fields as secret; adds OAuth requiredScopes entries for Intuit (QuickBooks), Linear, DocuSign, and Salesforce providers.
Connector event payload enrichment
examples/*/connectors/*.connector.ts
Connectors now emit payload_text with prioritized/fallback text (e.g., discourse uses p.rawp.cooked → default; market feed prefers texttitleurl; others include human-readable summaries of status, amounts, or stage changes).
Minor fixes and adjustments
examples/finance/models/reactions/reconciliation-monitor.reaction.ts, examples/office-bot/agents/.../deliveroo.ts
Small local variable placement change in a reaction handler and a TypeScript cast adjustment when adding cookies for Playwright.

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

skip-size-check

Poem

🐰 Examples now align with care,
TypeScript files and packages everywhere,
Secrets tucked in env_keys tight,
Events speak plainly, payloads write,
A tiny rabbit hops — code ready to share!

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The PR description comprehensively covers the 'What' and 'The gap, fixed' sections but omits the structured template sections (Summary bullets, Test plan checklist, Notes). Include the template structure with Test plan checklist (mark which validation steps were run) and any Notes section for breaking changes or linked issues.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly and concisely describes the main change: adding package.json and tsconfig files to make examples self-contained.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/examples-packaging

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

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@lobu/cli 9.2.0 was never published (versions jump 9.1.1 -> 9.3.0); ^9.2.0 only
resolved by floating up to 9.3.0. Pin the actual published latest so the pins
are honest and match what `lobu init` stamps today.

Verified standalone (outside the monorepo, against published 9.3.0):
bun install + tsc --noEmit + `lobu validate` all green for 11/12 examples.
personal-finance can't install standalone due to its pre-existing
file:../../packages/promptfoo-provider dep, but typechecks inside the monorepo.
@buremba buremba merged commit a91baed into main May 24, 2026
19 checks passed
@buremba buremba deleted the feat/examples-packaging branch May 24, 2026 20:16
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