Skip to content

docs: add multi-langs sdk framework - #666

Merged
jwfing merged 50 commits into
mainfrom
docs/multi-lang-sdk
Jan 20, 2026
Merged

jwfing merged 50 commits into
mainfrom
docs/multi-lang-sdk

Conversation

@jwfing

@jwfing jwfing commented Dec 30, 2025 •

Copy link
Copy Markdown
Member

Summary

I changed the doc hierarchy for multi-lang SDKs (first stage: TypeScript, Swift, Kotlin, Rest API).
Now the sdk documents are filled with placeholder code snippets, just for reviewing the document framework.

How did you test this change?

截屏2026-01-12 12 14 55

Summary by CodeRabbit

  • New Features

    • Added AI credits endpoint and docs retrieval by SDK feature + language.
    • PKCE OAuth, token refresh and logout flows for improved auth UX.
  • Documentation

    • Major SDK docs added for TypeScript, Swift, Kotlin, Flutter, REST; navigation restructured to "SDK & Samples".
    • Many SDK overview/reference pages, snippets, and installation guides.
  • API Changes

    • Email path renamed to /api/email/send-raw (now requires user auth).
    • Storage: bucket delete and object search added.
    • Functions expanded with additional HTTP methods; table schema and endpoints reorganized.
  • Chore

    • Package version bumped to 1.5.1

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Dec 30, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

Adds MDX snippet inlining and SDK-aware docs routing to the backend, new SDK feature/language schemas, many new SDK MDX docs and navigation restructuring, and multiple OpenAPI spec updates; serves processed MDX content via new and updated /api/docs endpoints.

Changes

Cohort / File(s) Summary
Backend docs API
backend/src/api/routes/docs/index.routes.ts, shared-schemas/src/docs.schema.ts
Added internal processSnippets(content, docsRoot) to inline/resolve MDX snippet imports with path traversal protection; introduced LEGACY_DOCS_MAP and SDK_DOCS_MAP; added route GET /api/docs/:docFeature/:docLanguage; extended GET /api/docs/:docType to validate and process snippets; added sdkFeatureSchema & sdkLanguageSchema.
Docs navigation & manifest
docs/docs.json, docs/insforge-instructions-sdk.md
Reorganized navigation into language-centric SDK groups (TypeScript, Swift, Kotlin, REST), renamed Examples → "SDK & Samples", added Community Showcase, and updated fetch-docs / fetch-sdk-docs guidance.
Core concept pages
docs/core-concepts/*/architecture.mdx
Inserted "SDK References" CardGroup sections across multiple core-concepts architecture pages (AI, auth, database, email, functions, realtime, storage); some duplicates present.
Snippets & small docs
docs/snippets/*, docs/snippets/sdk-installation.mdx, docs/snippets/swift-sdk-installation.mdx, docs/snippets/kotlin-sdk-installation.mdx
Added/updated SDK installation snippets and normalized example base URL.
SDK docs — TypeScript
docs/sdks/typescript/*
Added comprehensive TypeScript SDK reference pages (overview, ai, auth, database, storage, functions, realtime, UI components) with examples and API references.
SDK docs — Swift
docs/sdks/swift/*
Added Swift SDK reference pages (overview, ai, auth, database, storage, functions, realtime) including SwiftUI examples and type definitions.
SDK docs — Kotlin
docs/sdks/kotlin/*
Added Kotlin SDK reference pages (overview, ai, auth, database, storage, functions, realtime) with Compose/Android guidance.
SDK docs — Flutter
docs/sdks/flutter/*
Added Flutter SDK pages (overview, ai, auth, database, storage, realtime) with widget and state-management examples (some marked preview).
SDK docs — REST
docs/sdks/rest/*
Added REST API reference pages (overview, ai, auth, database, storage, functions, realtime) with endpoints, schemas, and examples.
OpenAPI updates
openapi/*.yaml (ai.yaml, auth.yaml, email.yaml, functions.yaml, storage.yaml, tables.yaml)
Added /api/ai/credits + CreditsResponse; auth refresh/logout and PKCE/token enhancements; renamed email send path and auth requirement changes; functions path expanded (GET/PUT/PATCH/DELETE); storage bucket delete/search changes; tables schema and rlsEnabled/schema path adjustments.
Package bump
package.json
Bumped package version from 1.4.8 → 1.5.1.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Possibly related PRs

  • Bring back auth sdk doc #661: Modifies docs routing and schema validation — directly related to SDK doc routes and schema additions.
  • [Infra] Schema rework #640: Updates docs mapping/enum entries used by backend docs route — overlaps with expanded doc-type mappings.
  • Feat/nextjs doc #642: Changes docs routing/mappings in backend routes — overlaps on DOCS_MAP and route handling logic.

Suggested reviewers

  • Leo-rq-yu
  • tonychang04

Poem

🐰 I hopped through folders, pages bright,

Snippets stitched and routes set right,
TypeScript, Swift, Kotlin in a row,
Docs that sparkle, ready to show —
A carrot note: the guides now glow.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'docs: add multi-langs sdk framework' accurately summarizes the main change—introducing multi-language SDK documentation structure across TypeScript, Swift, Kotlin, and REST API.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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


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

@jwfing jwfing changed the title docs: add multi-langs sdk framework [DONT MERGE] docs: add multi-langs sdk framework Dec 30, 2025

@Fermionic-Lyu Fermionic-Lyu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shall we add a new type 'supportedLanguages' and make it a parameter to the doc endpoint? And keep doc names the same for every language. This way we can reduce the maintainence burden, I think writing all of them line by line is not the best maintainable way.

For the mintlify part, I think the structure for human readers looks good to me.

@jwfing

jwfing commented Jan 2, 2026

Copy link
Copy Markdown
Member Author

Shall we add a new type 'supportedLanguages' and make it a parameter to the doc endpoint? And keep doc names the same for every language. This way we can reduce the maintainence burden, I think writing all of them line by line is not the best maintainable way.

I agree that a supportedLanguages parameter will significantly reduce maintenance. Since docType currently describes platforms/frameworks (React, Next.js, auth-component-react/auth-component-nextjs) rather than the programming language itself, we should decouple them.
Introducing a dedicated language parameter (for Swift, Kotlin, etc.) alongside the framework-based docType will make the endpoint much more intuitive and allow us to keep docName identical across all language variants.
@Fermionic-Lyu

@tonychang04

Copy link
Copy Markdown
Member

just thinking ahead and worth testing.. if we publish shared schema, mcp will use new shared schema and older proj oss will use old schema right?

I think if we can find a way to force mcp to have the same shared schema as oss(curl the version and download etc), that will be a huge gain, for us updating any docs.

Comment thread shared-schemas/src/docs.schema.ts Outdated
// General
'instructions',

// TypeScript SDK

@tonychang04 tonychang04 Jan 3, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

just a test :)

@CodeRabbit
what do you think? listing out all documentation not scalable and may hurt agent's performance in the long run...
we thought of adding a seperate language parameter...
but there are two docs that's only for typescript like auth-components-react and auth-componets nextjs...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@tonychang04 Great question! I agree that the current approach isn't scalable. Let me break down the tradeoffs and suggest a better architecture:

Current Issues

  • Maintenance burden: Adding a new language requires ~9 new enum entries
  • Schema size: Already at 40+ values, will only grow
  • Agent performance: Large enums can impact token usage and decision-making

Recommended Approach: Separate Parameters with Validation

I'd suggest splitting into separate docType and language schemas with conditional validation:

import { z } from 'zod';

export const languageSchema = z.enum([
  'typescript',
  'swift',
  'kotlin',
  'flutter',
]).describe('SDK language/platform');

export const docTypeSchema = z.enum([
  'instructions',
  'db-sdk',
  'storage-sdk',
  'functions-sdk',
  'ai-sdk',
  'auth-sdk',
  'realtime-sdk',
  'auth-components-react',      // TypeScript-only
  'auth-components-nextjs',     // TypeScript-only
]).describe('Documentation category');

// Combined schema with validation
export const docRequestSchema = z.object({
  docType: docTypeSchema,
  language: languageSchema.optional(),
}).refine((data) => {
  // Special cases: these docs require TypeScript
  const typescriptOnlyDocs = ['auth-components-react', 'auth-components-nextjs'];
  if (typescriptOnlyDocs.includes(data.docType)) {
    return !data.language || data.language === 'typescript';
  }
  
  // 'instructions' doesn't need a language
  if (data.docType === 'instructions') {
    return !data.language;
  }
  
  // All SDK docs require a language
  return !!data.language;
}, {
  message: 'Invalid docType and language combination',
});

export type DocRequestSchema = z.infer<typeof docRequestSchema>;

Benefits

✅ Scalable: Add new languages without touching doc types
✅ Maintainable: ~13 enum values instead of 40+
✅ Flexible: Can handle special cases with .refine()
✅ Better DX: Clear separation of concerns
✅ Agent-friendly: Smaller enums = clearer context

Migration Path

If you need backward compatibility, you could accept both formats:

export const docIdentifierSchema = z.union([
  // New format
  docRequestSchema,
  // Legacy format (old enum values)
  z.object({ legacyDocType: z.string() })
]);

Would this approach work for your use case? Happy to refine based on how agents/clients consume this schema.


🧠 Learnings used
Learnt from: CR
Repo: InsForge/InsForge PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-01T06:28:41.515Z
Learning: Applies to {backend/src/**/*.{ts,js},shared-schemas/**/*.{ts,js}} : Use Zod schemas for request/response validation in backend

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

and how do we maintain the backward compatibility for it?

right now our mcp server and open source both use shared schema.. but ppl may install mcp with newest shared schema version.. that diffs from our existing open source legacy version of shared schema,.. managing it is slightly messy

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@coderabbitai
and how do we maintain the backward compatibility for it?

right now our mcp server and open source both use shared schema.. but ppl may install mcp with newest shared schema version.. that diffs from our existing open source legacy version of shared schema,.. managing it is slightly messy
this question is for you

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@tonychang04 Great question about backward compatibility! This is a classic versioning challenge with shared dependencies. Here's a comprehensive strategy:

Recommended Approach: Dual-Format Support with Auto-Detection

Keep both formats in the same schema and let consumers use either. The schema handles normalization internally:

import { z } from 'zod';

// New format schemas
export const languageSchema = z.enum([
  'typescript',
  'swift',
  'kotlin',
  'flutter',
]);

export const baseDocTypeSchema = z.enum([
  'instructions',
  'db-sdk',
  'storage-sdk',
  'functions-sdk',
  'ai-sdk',
  'auth-sdk',
  'realtime-sdk',
  'auth-components-react',
  'auth-components-nextjs',
]);

// Legacy flat enum (current format)
export const legacyDocTypeSchema = z.enum([
  'instructions',
  'db-sdk-typescript',
  'storage-sdk-typescript',
  // ... all 40+ values
]);

// Normalized internal format
const normalizedDocSchema = z.object({
  docType: baseDocTypeSchema,
  language: languageSchema.optional(),
});

// Accept BOTH formats
export const docRequestSchema = z.union([
  // New format: { docType: "db-sdk", language: "typescript" }
  normalizedDocSchema,
  
  // Legacy format: { docType: "db-sdk-typescript" }
  z.object({
    docType: legacyDocTypeSchema,
  }),
]).transform((data) => {
  // If already in new format, return as-is
  if ('language' in data || data.docType === 'instructions') {
    return data;
  }
  
  // Convert legacy format to new format
  const legacyValue = data.docType;
  
  // Parse language suffix
  const suffixMap: Record<string, string> = {
    '-typescript': 'typescript',
    '-swift': 'swift',
    '-kotlin': 'kotlin',
    '-flutter': 'flutter',
  };
  
  for (const [suffix, lang] of Object.entries(suffixMap)) {
    if (legacyValue.endsWith(suffix)) {
      const baseType = legacyValue.slice(0, -suffix.length);
      return {
        docType: baseType as z.infer<typeof baseDocTypeSchema>,
        language: lang as z.infer<typeof languageSchema>,
      };
    }
  }
  
  // Handle legacy aliases
  const legacyAliases: Record<string, string> = {
    'ai-integration-sdk': 'ai-sdk',
    'real-time': 'realtime-sdk',
  };
  
  const normalized = legacyAliases[legacyValue] || legacyValue;
  return { docType: normalized as z.infer<typeof baseDocTypeSchema> };
});

export type DocRequestSchema = z.infer<typeof docRequestSchema>;

// Helper to generate legacy format (for backward compat)
export function toLegacyFormat(doc: DocRequestSchema): string {
  if (!doc.language || doc.docType === 'instructions') {
    return doc.docType;
  }
  
  // TypeScript-only docs keep their full names
  if (['auth-components-react', 'auth-components-nextjs'].includes(doc.docType)) {
    return doc.docType;
  }
  
  return `${doc.docType}-${doc.language}`;
}

Package Versioning Strategy

Use semantic versioning to manage the transition:

// package.json
{
  "name": "@insforge/shared-schemas",
  "version": "2.0.0",  // Major bump for breaking change
  "exports": {
    ".": {
      "import": "./dist/index.js",
      "types": "./dist/index.d.ts"
    },
    "./legacy": {
      "import": "./dist/legacy.js",
      "types": "./dist/legacy.d.ts"
    }
  }
}

Version Strategy:

  • v1.x: Old flat enum only (existing open source)
  • v2.0.0: Dual support (accepts both, normalizes to new format)
  • v3.0.0 (future): Remove legacy support entirely

Deployment Timeline

Phase 1: Deploy v2.0.0 (backward compatible)

# MCP server uses v2 immediately
npm install @insforge/shared-schemas@^2.0.0

# Open source can stay on v1 OR upgrade to v2
# Both work because v2 accepts legacy format

Phase 2: Migration period (3-6 months)

  • MCP server migrates to new format internally
  • Open source can upgrade at their own pace
  • Add deprecation warnings:
export const docRequestSchema = z.union([
  normalizedDocSchema,
  z.object({ docType: legacyDocTypeSchema }).transform((data) => {
    console.warn(
      `[DEPRECATED] Legacy doc format "${data.docType}" will be removed in v3.0.0. ` +
      `Use { docType: "...", language: "..." } instead.`
    );
    // ... conversion logic
  }),
]);

Phase 3: Remove legacy (v3.0.0)

  • Only accept new format
  • Users have had time to migrate

Client Code Examples

Old clients (still works):

const result = docRequestSchema.parse({
  docType: 'db-sdk-typescript'  // Legacy format
});
// Internally normalized to: { docType: 'db-sdk', language: 'typescript' }

New clients:

const result = docRequestSchema.parse({
  docType: 'db-sdk',
  language: 'typescript'
});

Benefits of This Approach

✅ Zero breaking changes: Old code continues working
✅ Single package version: No need to maintain parallel v1/v2 branches
✅ Gradual migration: Teams upgrade on their own timeline
✅ Type safety: TypeScript consumers get proper types for both formats
✅ Clear deprecation path: Warnings guide migration

Alternative: If You Need Strict Separation

If MCP and open source truly need different versions:

// shared-schemas/src/v1.ts (legacy)
export const docTypeSchemaV1 = z.enum([...]);

// shared-schemas/src/v2.ts (new)
export const docRequestSchemaV2 = z.object({...});

// shared-schemas/src/index.ts (default: backward compat)
export * from './v2';
export { docTypeSchemaV1 as legacyDocTypeSchema } from './v1';

Then consumers explicitly choose:

// Open source (stays on legacy)
import { legacyDocTypeSchema } from '@insforge/shared-schemas';

// MCP server (uses new)
import { docRequestSchema } from '@insforge/shared-schemas';

Does this address your concerns? The key insight is: make v2 accept both formats so there's no coordination nightmare during rollout.


🧠 Learnings used
Learnt from: CR
Repo: InsForge/InsForge PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-01T06:28:41.515Z
Learning: Applies to {backend/src/**/*.{ts,js},shared-schemas/**/*.{ts,js}} : Use Zod schemas for request/response validation in backend

@jwfing jwfing changed the title [DONT MERGE] docs: add multi-langs sdk framework docs: add multi-langs sdk framework Jan 9, 2026
@jwfing
jwfing marked this pull request as ready for review January 9, 2026 22:01

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 20

Caution

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

⚠️ Outside diff range comments (1)
backend/src/api/routes/docs/index.routes.ts (1)

156-201: Create openapi/docs.yaml to document all docs API endpoints.

The docs module (including the new GET /api/docs/:docFeature/:docLanguage route) lacks OpenAPI specification. No openapi/docs.yaml file exists, and all three endpoints in the docs route (GET /api/docs, GET /api/docs/:docType, GET /api/docs/:docFeature/:docLanguage) are undocumented. This violates the guideline requiring all API endpoints under {backend/src/api,openapi}/**/*.{ts,yaml,yml,json} to be documented with clear descriptions, limiting API discoverability for consumers.

🤖 Fix all issues with AI agents
In @backend/src/api/routes/docs/index.routes.ts:
- Around line 15-66: processSnippets currently accepts arbitrary import paths
and strips all import lines, enabling path traversal and removing non-snippet
imports; restrict processing to only imports whose importPath starts with
"/snippets/", only remove those import lines (leave other imports intact),
resolve the snippetPath with path.resolve(docsRoot, importPath.replace(/^\//,
'')) and verify the resolved path startsWith(path.resolve(docsRoot)) to block
../ escapes, and when a snippet file is missing log the importPath (not the
absolute path) in the catch; update references: importRegex/imports handling to
filter for "/snippets/" imports, snippetPath resolution/guard, and
processedContent replacement so non-snippet imports are preserved.

In @docs/sdks/flutter/auth.mdx:
- Around line 45-65: The section title "signIn()" does not match the actual
method used in the example (signInWithPassword); update the heading to
"signInWithPassword()" (or change the example to call signIn() if that is the
intended API) so the section title and the sample code use the same method name;
ensure the title references the exact method symbol signInWithPassword to
improve accuracy and discoverability.

In @docs/sdks/flutter/database.mdx:
- Around line 244-290: The section title is misleading because RealtimePostList
only calls _loadPosts() in initState and never subscribes to realtime updates;
either rename the heading to indicate a simple StatefulWidget example or add a
realtime subscription inside _RealtimePostListState.initState that uses
insforge.realtime.channel('posts') and onPostgresChanges (or the equivalent
realtime API) to call _loadPosts() (and subscribe/unsubscribe appropriately),
ensuring you reference RealtimePostList, _RealtimePostListState, and _loadPosts
when updating the sample.

In @docs/sdks/flutter/realtime.mdx:
- Around line 275-290: The example's _sendMessage method references
currentUser.name which is undefined; fix by either documenting/defining the user
source used in the snippet (e.g., add a short comment above the method
explaining that currentUser should be provided by the surrounding widget/state
or auth layer) or by changing the reference to an explicitly provided variable
(for example use widget.currentUser or a local final currentUser declared
earlier). Ensure the instruction mentions the exact symbol currentUser.name and
the function _sendMessage so readers can locate and either add the missing
variable or a clarifying comment about where currentUser is coming from.

In @docs/sdks/kotlin/auth.mdx:
- Around line 139-175: Remove any logging that prints the access token
(sensitive credentials) from the Kotlin SDK docs (remove the token log at the
noted location) and in AuthCallbackActivity replace the inconsistent
InsforgeManager.client usage with the plain client used elsewhere: update the
call in handleIntent from
InsforgeManager.client.auth.handleAuthCallback(uri.toString()) to
client.auth.handleAuthCallback(uri.toString()), keeping the rest of the
lifecycleScope try/catch and navigation logic unchanged.

In @docs/sdks/kotlin/functions.mdx:
- Around line 14-101: The Kotlin examples in functions.mdx use
@Serializable/@SerialName without imports and the "Admin Functions" note lacks
guidance about auth; add the necessary imports (import
kotlinx.serialization.Serializable and import kotlinx.serialization.SerialName)
to the top of the first example block containing HelloResponse (and mention they
apply to other examples like GreetingRequest/GreetingResponse), and update the
Admin Functions section to state that those methods require the client to be
initialized with a service/admin JWT (service role) rather than an anon key so
callers know to pass a server-side/admin token when creating the client.

In @docs/sdks/kotlin/realtime.mdx:
- Around line 29-41: Verify that the Kotlin realtime SDK symbols in the docs
match the actual shipped API: confirm types like Realtime.ConnectionState (and
its variants Connected/Disconnected/Connecting/Error), Realtime.EventCallback,
and event name constants such as "INSERT" and "message"; if the real SDK uses
different names or enums, update the snippets to the correct identifiers or add
a clear note that these are placeholders. Also mark undeclared variables
(userId, todoId, currentUser) as “pre-existing variables” or add a minimal setup
preface showing they must be defined before use, and apply the same
verification/placeholder labeling to the other referenced ranges (137-224,
286-299, 303-447, 686-748).

In @docs/sdks/rest/realtime.mdx:
- Around line 22-26: Replace the incorrect capitalization in the Authorization
header example: change the placeholder string "Bearer
admin-jwt-token-Or-API-Key" to "Bearer admin-jwt-token-or-api-key" so the "Or"
is lowercase and matches standard placeholder formatting in the docs.

In @docs/sdks/rest/storage.mdx:
- Around line 439-459: The Delete Bucket endpoint is documented with the wrong
path; update the path string from DELETE
/api/storage/buckets/{bucketName}/objects to DELETE
/api/storage/buckets/{bucketName} in both the "Delete Bucket" documentation
block (the `Delete Bucket` heading/example) and the OpenAPI spec entry that
currently lists the operation under /api/storage/buckets/{bucketName}/objects so
the documented path matches the backend implementation.

In @docs/sdks/swift/ai.mdx:
- Around line 280-296: The chat bubble alignment is inverted: in the body View
swap which role gets the leading/trailing Spacer so user messages appear on the
right and assistant messages on the left; specifically, change the top
conditional to if message.role == .user { Spacer() } and the bottom conditional
to if message.role == .assistant { Spacer() } (leave the existing
background/foreground conditional using message.role == .user as-is).

In @docs/sdks/swift/auth.mdx:
- Around line 144-145: The documentation uses two different method names:
signInWithDefaultView() in the section heading and signInWithDefaultPage() in
the auth flow and examples; verify the actual API method name in the Swift SDK
(signInWithDefaultPage vs signInWithDefaultView) and make them consistent by
updating the heading or all examples to the correct symbol (replace occurrences
of signInWithDefaultView() or signInWithDefaultPage() so every reference matches
the verified method name in the SDK and update any inline descriptions to the
chosen name).

In @docs/sdks/swift/database.mdx:
- Around line 250-258: The List usage List(posts) { post in ... } requires Post
to be Identifiable; update the Post model (the struct named Post) to conform to
Identifiable and include a stable id property (e.g., id: UUID or Int) so SwiftUI
can diff items, or alternatively change the List call to List(posts, id:
\\.<uniqueProperty>) { post in ... } to supply an explicit identifier; modify
either the Post type (add Identifiable conformance and id field) or the List
invocation (add id: parameter referencing an existing unique property) to
resolve the error.

In @docs/sdks/swift/functions.mdx:
- Around line 294-312: The state update to processedResult (and the final
isProcessing = false) in processData() occurs off the MainActor; wrap the
assignment of processedResult and the final isProcessing = false inside await
MainActor.run { ... } to match other examples — i.e., after awaiting
insforge.functions.invoke(...), call await MainActor.run to set processedResult
and ensure the final isProcessing reset also happens on the main actor (also
handle the catch branch by setting isProcessing = false on the main actor
there).

In @docs/sdks/swift/overview.mdx:
- Around line 16-18: The documentation references a non-existent repo URL
`https://github.com/insforge/insforge-swift.git`; replace that URL with the
correct official InsForge Swift SDK repository (likely
`https://github.com/insforge/insforge-sdk-swift.git`), verify the target
repository exists and points to the official SDK, and update the Xcode "Enter:"
line in overview.mdx to use the verified URL.

In @docs/sdks/typescript/ai.mdx:
- Around line 78-124: The example's request payload (the messages array asking
"What do you see in this image?" with an image_url) does not match the shown
JSON response (which answers "The capital of France is Paris."); update the
documentation so the output corresponds to the input by either changing the JSON
"choices[0].message.content" to an image description that matches the image
question, or alter the request message to a text question about France's capital
to match the current output; locate the example around the "completion" variable
and the messages object to make the correction.

In @docs/sdks/typescript/functions.mdx:
- Around line 158-204: The leading comment uses the wrong token name
"functionToken"; update that comment to match the actual parameter used when
creating the client (edgeFunctionToken) so terminology is consistent with
createClient({ edgeFunctionToken }). Locate the comment above the example and
replace "functionToken" with "edgeFunctionToken" and ensure any explanatory text
refers to "edgeFunctionToken" and authenticated user's token extraction via
Authorization header.

In @docs/sdks/typescript/ui-components/react.mdx:
- Around line 34-48: The docs reference an imported symbol insforge from
./lib/insforge which doesn't exist, causing an import error; add a client
initialization module that exports insforge by calling createClient (from
@insforge/react) with the proper config (e.g., baseUrl and anonKey pulled from
env vars) so InsforgeProvider in main.tsx can receive the instantiated client;
implement and export const insforge = createClient({...}) in a new module named
insforge (e.g., src/lib/insforge.ts) and ensure main.tsx imports that symbol.
- Around line 17-21: The heading "Create New React Project (Required)" is
misleading because the step only shows installing a package; change that heading
to something accurate like "Install Package" or "Install Dependencies" (replace
the exact string "Create New React Project (Required)" with "Install Package" or
"Install Dependencies") and ensure the code block remains the npm install line
so the title and content match.

In @docs/snippets/kotlin-sdk-installation.mdx:
- Around line 53-75: Replace the token-like placeholder in the gradle.properties
example (gpr.token=ghp_xxxxxxxxxxxx) with a non-secret-looking placeholder such
as YOUR_GITHUB_TOKEN to avoid triggering secret scanners, and update the
createInsforgeClient call to use the correct parameter name baseUrl (lowercase)
instead of baseURL so it matches the canonical example and the client API.
🧹 Nitpick comments (17)
docs/sdks/flutter/ai.mdx (2)

10-19: Missing pubspec.yaml dependency.

The installation section shows only the Dart import but omits the pubspec.yaml dependency entry. For consistency with other Flutter docs (e.g., database.mdx), consider adding:

Suggested addition
 ## Installation

+```yaml
+dependencies:
+  insforge: ^1.0.0
+```
+
 ```dart
 import 'package:insforge/insforge.dart';

236-264: ChatBubble may not handle multimodal content correctly.

The ChatBubble widget calls message.content.toString() (line 256), but earlier examples show content can be a list of ContentPart objects for multimodal messages. This would render as a raw list string rather than formatted content.

Since this is preview documentation, consider adding a note or handling both cases:

Suggested improvement
child: Text(
  message.content is String 
      ? message.content as String
      : (message.content as List).whereType<ContentPart>()
          .where((p) => p is TextPart)
          .map((p) => (p as TextPart).text)
          .join(),
  // ...
),
docs/sdks/flutter/database.mdx (1)

187-195: Redundant pagination modifiers.

Using both .range(0, 9) and .limit(10) together is redundant and potentially confusing. The .range(0, 9) already limits results to 10 rows (indices 0-9). Choose one approach:

Suggested fix
 // Pagination with sorting
 final response = await insforge.database
     .from('posts')
     .select()
     .order('created_at', ascending: false)
-    .range(0, 9)
-    .limit(10);
+    .range(0, 9);  // Returns rows 0-9 (10 total)
docs/sdks/rest/auth.mdx (1)

18-22: Inconsistent casing in placeholder value.

The admin header example uses admin-jwt-token-Or-API-Key with inconsistent casing. Consider standardizing to admin-jwt-token-or-api-key or YOUR_ADMIN_TOKEN for consistency with documentation conventions.

Suggested fix
 For admin endpoints:
 ```bash
-Authorization: Bearer admin-jwt-token-Or-API-Key
+Authorization: Bearer your-admin-jwt-token
 Content-Type: application/json
docs/sdks/swift/functions.mdx (1)

362-369: Consider adding a cross-reference to the Storage SDK.

This example uses insforge.storage.from("temp-uploads").upload(...) without prior introduction. Readers unfamiliar with the Storage SDK might find this confusing.

Consider adding a note or link to the Storage SDK documentation:

         do {
-            // First upload the image
+            // First upload the image (see Storage SDK docs for details)
             let uploadResult = try await insforge.storage
                 .from("temp-uploads")
                 .upload(
docs/sdks/swift/auth.mdx (2)

400-415: Consider documenting CSRF token validation.

The callback parameters table lists csrf_token as an optional security parameter, but there's no guidance on:

  • When it's included
  • How to validate it
  • What security protection it provides

Consider adding a note explaining the CSRF token's purpose and validation requirements to help developers implement proper security measures.


492-498: Example uses undocumented API method.

The example calls authState.signInWithApple(result:) on line 496, but this method is not documented in the API reference sections above. Developers may be confused about how to implement this functionality.

Consider either:

  1. Adding an API reference section for signInWithApple() earlier in the document
  2. Removing this example and focusing on the documented signInWithDefaultPage() flow
  3. Adding a note that this is a custom helper method (if it's not part of the SDK)
docs/sdks/swift/database.mdx (2)

38-59: Consider showing return type or usage of inserted data.

Both insert examples assign results to let inserted but don't show its type or how it's used. This might leave readers wondering what data is returned from the insert operation.

Suggested enhancement
 // Single insert
 let post = Post(
     id: nil,
     title: "Hello World",
     content: "My first post!",
     userId: currentUserId,
     createdAt: nil
 )
-let inserted = try await insforge.database
+let inserted: [Post] = try await insforge.database
     .from("posts")
     .insert(post)
+
+print("Inserted post with ID: \(inserted[0].id ?? "unknown")")

152-157: Clarify relationship querying and type mapping.

The example shows selecting related data using "*, comments(id, content)" syntax, but it's unclear:

  • Whether this syntax is supported in the Swift SDK
  • How the nested comments data is mapped to Swift types
  • What the response type should be

Consider either:

  1. Providing a complete example with the response model definition
  2. Adding a note about relationship querying support and limitations
  3. Linking to documentation about joins/relationships if available
docs/sdks/flutter/realtime.mdx (1)

500-562: Potential naming conflict with Flutter's ConnectionState.

The Riverpod example uses ConnectionState (lines 202, 540) which conflicts with Flutter's built-in ConnectionState enum used for FutureBuilder and StreamBuilder. This could cause import conflicts and developer confusion.

Consider renaming to avoid the conflict:

-insforge.realtime.connectionStateStream.listen((state) {
+insforge.realtime.connectionStateStream.listen((state) {
   switch (state) {
-    case ConnectionState.connected:
+    case RealtimeConnectionState.connected:
       print('Connected');
       break;
-    case ConnectionState.connecting:
+    case RealtimeConnectionState.connecting:
       print('Connecting...');
       break;
-    case ConnectionState.disconnected:
+    case RealtimeConnectionState.disconnected:

Alternatively, use a qualified name like insforge.ConnectionState or alias the import.

docs/sdks/rest/functions.mdx (1)

23-23: Fix capitalization inconsistency in auth header example.

The header uses "admin-jwt-token-Or-API-Key" with an inconsistent capital O. Use standard capitalization: "admin-jwt-token-or-api-key".

-Authorization: Bearer admin-jwt-token-Or-API-Key
+Authorization: Bearer admin-jwt-token-or-api-key
docs/sdks/swift/realtime.mdx (1)

208-208: Optional: Simplify action type description for consistency.

The description "New record inserted" is slightly wordy compared to other status descriptions. Consider shortening to "Record inserted" for conciseness.

-- `InsertAction<T>` - New record inserted
+- `InsertAction<T>` - Record inserted
docs/sdks/typescript/ui-components/nextjs.mdx (1)

191-191: Fix hyphenation in section heading.

The heading should be hyphenated: "Server-side functions" rather than "Server side functions".

-### Server side functions
+### Server-side functions
docs/sdks/swift/storage.mdx (1)

333-337: Consider noting SwiftUI version compatibility for onChange.

The .onChange(of:) { newItem in } trailing closure syntax with a single parameter was introduced in iOS 17. For iOS 14-16 compatibility, the older syntax onChange(of: selectedItem) { _ in } or the two-parameter variant would be needed.

Consider adding a brief note about iOS version requirements for these SwiftUI examples, or ensure the SDK's minimum deployment target aligns with iOS 17+.

docs/sdks/kotlin/ai.mdx (1)

14-226: Avoid hard-coded model IDs; prefer listModels() output + fix streaming string concatenation.

Model IDs tend to change; showing “pick one from listModels()” is more robust than pinning examples to specific vendor/model strings. Also, the streaming Compose example uses response += content inside collect, which is quadratic over time; use StringBuilder (or a mutable buffer) and assign the built string. Separately, the ImageGenerationResponse.nextActions: String field looks likely optional/null in real responses—worth aligning to actual SDK models.

Proposed doc tweak (streaming buffer)
@@
 client.ai.chatCompletionStream(
@@
 ).collect { content ->
-    response += content
+    // Prefer buffering to avoid quadratic string concatenation
+    response = buildString {
+        append(response)
+        append(content)
+    }
 }

Also applies to: 108-144, 333-395, 539-568

docs/sdks/kotlin/storage.mdx (1)

351-355: Inconsistent error handling between Uri reading approaches.

This helper returns an empty ByteArray on failure (line 354), while the standalone helper at lines 81-83 throws an IllegalArgumentException. The silent empty array here could cause confusing upload failures.

Consider aligning with the stricter approach for consistency:

♻️ Suggested fix
     // Helper function to read Uri as ByteArray
     fun Uri.toByteArray(context: Context): ByteArray {
         return context.contentResolver.openInputStream(this)?.use {
             it.readBytes()
-        } ?: byteArrayOf()
+        } ?: throw IllegalArgumentException("Cannot read Uri")
     }
docs/docs.json (1)

142-143: Consider a more Kotlin-specific icon.

Using "android" icon for Kotlin may be limiting if you later add Kotlin Multiplatform (KMP) or server-side Kotlin docs. A "kotlin" or more generic icon might be more future-proof, though this depends on your icon set availability.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 38db960 and d5a7ca0.

📒 Files selected for processing (49)
  • backend/src/api/routes/docs/index.routes.ts
  • docs/core-concepts/ai/architecture.mdx
  • docs/core-concepts/authentication/architecture.mdx
  • docs/core-concepts/database/architecture.mdx
  • docs/core-concepts/email/architecture.mdx
  • docs/core-concepts/functions/architecture.mdx
  • docs/core-concepts/realtime/architecture.mdx
  • docs/core-concepts/storage/architecture.mdx
  • docs/docs.json
  • docs/sdks/flutter/ai.mdx
  • docs/sdks/flutter/auth.mdx
  • docs/sdks/flutter/database.mdx
  • docs/sdks/flutter/overview.mdx
  • docs/sdks/flutter/realtime.mdx
  • docs/sdks/flutter/storage.mdx
  • docs/sdks/kotlin/ai.mdx
  • docs/sdks/kotlin/auth.mdx
  • docs/sdks/kotlin/database.mdx
  • docs/sdks/kotlin/functions.mdx
  • docs/sdks/kotlin/overview.mdx
  • docs/sdks/kotlin/realtime.mdx
  • docs/sdks/kotlin/storage.mdx
  • docs/sdks/rest/ai.mdx
  • docs/sdks/rest/auth.mdx
  • docs/sdks/rest/database.mdx
  • docs/sdks/rest/functions.mdx
  • docs/sdks/rest/overview.mdx
  • docs/sdks/rest/realtime.mdx
  • docs/sdks/rest/storage.mdx
  • docs/sdks/swift/ai.mdx
  • docs/sdks/swift/auth.mdx
  • docs/sdks/swift/database.mdx
  • docs/sdks/swift/functions.mdx
  • docs/sdks/swift/overview.mdx
  • docs/sdks/swift/realtime.mdx
  • docs/sdks/swift/storage.mdx
  • docs/sdks/typescript/ai.mdx
  • docs/sdks/typescript/auth.mdx
  • docs/sdks/typescript/database.mdx
  • docs/sdks/typescript/functions.mdx
  • docs/sdks/typescript/overview.mdx
  • docs/sdks/typescript/realtime.mdx
  • docs/sdks/typescript/storage.mdx
  • docs/sdks/typescript/ui-components/customization.mdx
  • docs/sdks/typescript/ui-components/nextjs.mdx
  • docs/sdks/typescript/ui-components/react.mdx
  • docs/snippets/kotlin-sdk-installation.mdx
  • docs/snippets/swift-sdk-installation.mdx
  • shared-schemas/src/docs.schema.ts
🧰 Additional context used
📓 Path-based instructions (10)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx,js,jsx}: Use TypeScript for all code files
Prefer descriptive, unabbreviated variable and function names
Follow consistent file naming: kebab-case for files, PascalCase for components
Use ES modules (import/export syntax)
Implement proper error handling with try-catch blocks
Add appropriate logging for debugging
Use camelCase for variables, parameters, properties, and functions
Use UPPER_CASE for constants and Enum members
Avoid snake_case except in SQL queries and external APIs
Use single quotes for strings
Include semicolons at the end of statements
Use arrow functions for callbacks and inline functions
Prefer const over let, avoid var
Use template literals for string interpolation
Maintain consistent indentation (2 spaces)
Format code with Prettier configuration
Include JSDoc comments for complex functions

Files:

  • backend/src/api/routes/docs/index.routes.ts
  • shared-schemas/src/docs.schema.ts
backend/src/**/*.{ts,js}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

backend/src/**/*.{ts,js}: Use async/await for asynchronous operations in backend code
Implement proper database transaction handling
Sanitize data before database operations
Use prepared statements for SQL queries
Implement proper database indexing

Files:

  • backend/src/api/routes/docs/index.routes.ts
backend/src/api/**/*.{ts,js}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

backend/src/api/**/*.{ts,js}: Implement proper middleware for authentication and error handling
Follow RESTful conventions for API endpoints
Implement rate limiting for API endpoints

Files:

  • backend/src/api/routes/docs/index.routes.ts
{backend/src/**/*.{ts,js},shared-schemas/**/*.{ts,js}}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use Zod schemas for request/response validation in backend

Files:

  • backend/src/api/routes/docs/index.routes.ts
  • shared-schemas/src/docs.schema.ts
backend/src/{controllers,api}/**/*.{ts,js}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Return consistent API responses using utility functions

Files:

  • backend/src/api/routes/docs/index.routes.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use PascalCase for React components and TypeScript types/interfaces

Files:

  • backend/src/api/routes/docs/index.routes.ts
  • shared-schemas/src/docs.schema.ts
{backend,frontend}/src/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use environment variables for configuration

Files:

  • backend/src/api/routes/docs/index.routes.ts
backend/src/{api,core,controllers}/**/*.{ts,js}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Implement proper authentication and authorization

Files:

  • backend/src/api/routes/docs/index.routes.ts
{backend/src,frontend/src}/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

{backend/src,frontend/src}/**/*.{ts,tsx,js,jsx}: Implement proper caching strategies
Monitor and log performance metrics

Files:

  • backend/src/api/routes/docs/index.routes.ts
{backend/src/api,openapi}/**/*.{ts,yaml,yml,json}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Document all API endpoints with clear descriptions

Files:

  • backend/src/api/routes/docs/index.routes.ts
🧠 Learnings (13)
📓 Common learnings
Learnt from: CR
Repo: InsForge/InsForge PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-01T06:28:41.515Z
Learning: Applies to {backend/src/api,openapi}/**/*.{ts,yaml,yml,json} : Document all API endpoints with clear descriptions
📚 Learning: 2025-12-01T06:28:41.515Z
Learnt from: CR
Repo: InsForge/InsForge PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-01T06:28:41.515Z
Learning: Applies to backend/src/{api,core,controllers}/**/*.{ts,js} : Implement proper authentication and authorization

Applied to files:

  • docs/sdks/typescript/auth.mdx
📚 Learning: 2025-12-01T06:28:41.515Z
Learnt from: CR
Repo: InsForge/InsForge PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-01T06:28:41.515Z
Learning: Applies to backend/src/api/**/*.{ts,js} : Implement proper middleware for authentication and error handling

Applied to files:

  • docs/sdks/typescript/auth.mdx
  • docs/sdks/typescript/ui-components/nextjs.mdx
📚 Learning: 2025-12-01T06:28:41.515Z
Learnt from: CR
Repo: InsForge/InsForge PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-01T06:28:41.515Z
Learning: Applies to {backend/src/api,openapi}/**/*.{ts,yaml,yml,json} : Document all API endpoints with clear descriptions

Applied to files:

  • docs/sdks/typescript/auth.mdx
  • docs/sdks/rest/ai.mdx
  • backend/src/api/routes/docs/index.routes.ts
  • docs/sdks/rest/overview.mdx
  • shared-schemas/src/docs.schema.ts
📚 Learning: 2025-11-04T05:18:26.126Z
Learnt from: Fermionic-Lyu
Repo: InsForge/InsForge PR: 553
File: docs/changelog.mdx:6-35
Timestamp: 2025-11-04T05:18:26.126Z
Learning: The InsForge JavaScript SDK repository is named "insforge-sdk-js" and is located at https://github.com/insforge/insforge-sdk-js

Applied to files:

  • docs/sdks/typescript/auth.mdx
  • docs/sdks/typescript/overview.mdx
  • docs/sdks/swift/overview.mdx
  • docs/snippets/swift-sdk-installation.mdx
📚 Learning: 2025-12-01T06:28:41.515Z
Learnt from: CR
Repo: InsForge/InsForge PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-01T06:28:41.515Z
Learning: Applies to frontend/src/**/*.{tsx,jsx} : Use React Hook Form for form handling in frontend

Applied to files:

  • docs/sdks/typescript/ui-components/react.mdx
📚 Learning: 2025-12-01T06:28:41.515Z
Learnt from: CR
Repo: InsForge/InsForge PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-01T06:28:41.515Z
Learning: Applies to frontend/src/**/*.{tsx,jsx} : Implement proper TypeScript interfaces for all props in React components

Applied to files:

  • docs/sdks/typescript/ui-components/react.mdx
📚 Learning: 2025-12-01T06:28:41.515Z
Learnt from: CR
Repo: InsForge/InsForge PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-01T06:28:41.515Z
Learning: Applies to frontend/src/**/*.{tsx,jsx} : Use functional components with hooks exclusively in React

Applied to files:

  • docs/sdks/typescript/ui-components/react.mdx
📚 Learning: 2025-11-14T18:47:06.676Z
Learnt from: Fermionic-Lyu
Repo: InsForge/InsForge PR: 585
File: frontend/src/features/database/page/FunctionsPage.tsx:57-83
Timestamp: 2025-11-14T18:47:06.676Z
Learning: In the InsForge codebase, there are two distinct types of functions: (1) database functions (SQL stored procedures/functions in PostgreSQL) which are part of the database schema and emit DATA_UPDATE events with resource type DATABASE, handled in frontend/src/features/database/page/FunctionsPage.tsx; (2) edge/serverless functions which emit DATA_UPDATE events with resource type FUNCTIONS, handled in frontend/src/features/functions/page/FunctionsPage.tsx. These are separate concepts with different resource types.

Applied to files:

  • docs/sdks/typescript/overview.mdx
  • docs/sdks/typescript/database.mdx
  • docs/sdks/rest/functions.mdx
  • docs/sdks/typescript/functions.mdx
📚 Learning: 2025-12-01T06:28:41.515Z
Learnt from: CR
Repo: InsForge/InsForge PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-01T06:28:41.515Z
Learning: Applies to backend/src/**/*.{ts,js} : Implement proper database indexing

Applied to files:

  • docs/sdks/typescript/database.mdx
📚 Learning: 2025-12-01T06:28:41.515Z
Learnt from: CR
Repo: InsForge/InsForge PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-01T06:28:41.515Z
Learning: Applies to backend/src/**/*.{ts,js} : Implement proper database transaction handling

Applied to files:

  • docs/sdks/typescript/database.mdx
📚 Learning: 2025-12-01T06:28:41.515Z
Learnt from: CR
Repo: InsForge/InsForge PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-01T06:28:41.515Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Include JSDoc comments for complex functions

Applied to files:

  • backend/src/api/routes/docs/index.routes.ts
📚 Learning: 2025-12-01T06:28:41.515Z
Learnt from: CR
Repo: InsForge/InsForge PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-01T06:28:41.515Z
Learning: Applies to {backend/src/**/*.{ts,js},shared-schemas/**/*.{ts,js}} : Use Zod schemas for request/response validation in backend

Applied to files:

  • shared-schemas/src/docs.schema.ts
🧬 Code graph analysis (1)
backend/src/api/routes/docs/index.routes.ts (3)
shared-schemas/src/docs.schema.ts (3)
  • sdkFeatureSchema (3-21)
  • sdkLanguageSchema (25-41)
  • docTypeSchema (45-143)
backend/src/utils/response.ts (1)
  • successResponse (22-24)
backend/src/api/middlewares/error.ts (1)
  • AppError (7-17)
🪛 ast-grep (0.40.4)
backend/src/api/routes/docs/index.routes.ts

[warning] 46-46: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(<${componentName}\\s*/>, 'g')
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)


[warning] 50-53: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(
<${componentName}\\s*>[\\s\\S]*?</${componentName}>,
'g'
)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)

🪛 Gitleaks (8.30.0)
docs/sdks/rest/ai.mdx

[high] 37-38: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


[high] 126-127: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


[high] 157-158: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


[high] 174-175: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


[high] 200-201: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


[high] 245-246: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)

docs/sdks/rest/realtime.mdx

[high] 112-113: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


[high] 152-153: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


[high] 190-191: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


[high] 235-236: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


[high] 269-270: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


[high] 305-306: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


[high] 350-351: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


[high] 383-384: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)

docs/sdks/rest/storage.mdx

[high] 48-49: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


[high] 79-80: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


[high] 118-119: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


[high] 181-182: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


[high] 216-217: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


[high] 244-245: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


[high] 282-283: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


[high] 315-316: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


[high] 362-363: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


[high] 390-391: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


[high] 423-424: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


[high] 448-449: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)

🪛 LanguageTool
docs/sdks/typescript/auth.mdx

[uncategorized] ~157-~157: The official name of this software platform is spelled with a capital “H”.
Context: ...- OAuth provider name (e.g., 'google', 'github', 'microsoft', 'discord') - `redirectTo...

(GITHUB)

docs/sdks/swift/database.mdx

[style] ~30-~30: ‘new records’ might be wordy. Consider a shorter alternative.
Context: ...: Date? } ``` --- ## insert() Insert new records into a table. ### Parameters - `value...

(EN_WORDINESS_PREMIUM_NEW_RECORDS)

docs/sdks/typescript/database.mdx

[style] ~33-~33: ‘new records’ might be wordy. Consider a shorter alternative.
Context: ...-anon-key' }); ``` ## insert() Insert new records into a table. ### Parameters - `value...

(EN_WORDINESS_PREMIUM_NEW_RECORDS)

docs/sdks/typescript/ui-components/customization.mdx

[grammar] ~311-~311: Use a hyphen to join words.
Context: ...terSignOutUrl- Redirect URL after sign out ###` Complete ...

(QB_NEW_EN_HYPHEN)

docs/sdks/swift/realtime.mdx

[style] ~208-~208: ‘New record’ might be wordy. Consider a shorter alternative.
Context: ...### Action Types - InsertAction<T> - New record inserted - UpdateAction<T> - Record u...

(EN_WORDINESS_PREMIUM_NEW_RECORD)

docs/sdks/typescript/ui-components/nextjs.mdx

[grammar] ~191-~191: Use a hyphen to join words.
Context: ...ded- Boolean loading state ### Server side functions ####auth` Access curr...

(QB_NEW_EN_HYPHEN)

docs/sdks/kotlin/database.mdx

[style] ~15-~15: ‘new records’ might be wordy. Consider a shorter alternative.
Context: ...SdkInstallation /> ## insert() Insert new records into a table. ### Examples ```kotlin ...

(EN_WORDINESS_PREMIUM_NEW_RECORDS)

docs/sdks/flutter/database.mdx

[style] ~28-~28: ‘new records’ might be wordy. Consider a shorter alternative.
Context: ...-anon-key', ); ## insert() Insert new records into a table. ### Examples dart //...

(EN_WORDINESS_PREMIUM_NEW_RECORDS)

🔇 Additional comments (47)
docs/snippets/swift-sdk-installation.mdx (1)

1-16: LGTM!

The Swift Package Manager installation snippet is clear and follows standard patterns. The placeholder values (your-app, your-anon-key) are appropriately generic for documentation purposes.

docs/sdks/typescript/ui-components/react.mdx (1)

50-136: LGTM!

The hooks documentation (useAuth and useUser) is clear with proper examples and well-documented return values.

docs/sdks/typescript/ai.mdx (1)

126-234: LGTM!

The streaming chat completion and image generation sections are well-documented with practical examples showing the complete workflow including storage upload and database insertion.

docs/sdks/flutter/ai.mdx (1)

267-419: LGTM!

The StreamingChatScreen and ImageGenerationScreen implementations follow Flutter best practices with proper state management, error handling, and loading states.

docs/sdks/flutter/database.mdx (1)

292-323: LGTM!

The Riverpod example demonstrates a clean integration pattern with proper async state handling using FutureProvider and ConsumerWidget.

docs/sdks/rest/auth.mdx (1)

1-524: LGTM!

The REST Authentication API documentation is comprehensive and well-structured. It covers all major auth flows (registration, sign-in, email verification, password reset, OAuth) with clear examples, request/response schemas, and error handling. The documentation follows the pattern of documenting all API endpoints with clear descriptions. Based on learnings, this aligns with the project's documentation standards.

docs/sdks/flutter/auth.mdx (1)

183-385: LGTM!

The Flutter widget integration examples (AuthGate, LoginPage, UserProfileWidget) are well-designed and follow Flutter best practices. The error handling section provides practical guidance with code-based error switching.

docs/sdks/typescript/ui-components/customization.mdx (1)

1-502: Documentation structure and content look good.

This is a comprehensive guide for custom authentication pages with clear setup steps, complete component examples, and proper API documentation. The code examples correctly demonstrate React Router v6 integration with the InsForge SDK.

One minor grammar note: At line 311, "after sign out" could be hyphenated as "sign-out" when used as a compound noun (per LanguageTool hint), but this is stylistic and optional.

docs/sdks/swift/storage.mdx (1)

1-463: Swift Storage SDK documentation is comprehensive and well-organized.

The documentation covers the complete storage API surface including bucket operations, file upload/download, listing, deletion with database sync patterns, and SwiftUI integration examples. The model references at the end provide clear type definitions.

docs/sdks/rest/database.mdx (1)

1-371: REST Database API documentation is thorough and well-structured.

The documentation correctly covers PostgREST-style operations with clear examples:

  • Comprehensive filter operators table
  • Important warning about array requirement for POST body
  • Response headers for pagination (X-Total-Count, Content-Range)
  • Upsert with conflict resolution headers

The examples use consistent placeholder values and demonstrate both basic and advanced use cases.

docs/sdks/rest/ai.mdx (1)

1-442: REST AI API documentation is comprehensive and well-organized.

The documentation covers:

  • Model listing with detailed metadata
  • Chat completions with streaming (SSE) support
  • Image generation with response format notes
  • Admin configuration endpoints
  • Usage statistics
  • Error response catalog

The Gitleaks static analysis warnings about "authorization tokens" are false positives—these are clearly placeholder values (your-jwt-token-or-anon-key, admin-jwt-token-Or-API-Key) used in documentation examples, which is standard practice for API reference docs.

docs/sdks/swift/ai.mdx (1)

1-471: Swift AI SDK documentation is well-structured with practical examples.

The documentation provides clear API references for chat completions, image generation, and model listing. The SwiftUI integration examples demonstrate real-world usage patterns including storage upload workflows. The Models Reference section provides complete type definitions.

docs/core-concepts/realtime/architecture.mdx (1)

447-468: SDK References section is a good addition.

The new section cleanly integrates with the existing architecture documentation and provides helpful navigation to platform-specific SDK guides. The descriptions accurately characterize each platform's approach (Socket.IO for TypeScript, Combine publishers for Swift, Flow for Kotlin, Streams for Flutter).

docs/core-concepts/email/architecture.mdx (1)

102-113: SDK References section appropriately reflects current availability.

The section correctly indicates that Email SDK is currently TypeScript-only, with the note about mobile SDK support coming soon setting clear expectations. Using cols={1} for a single card is appropriate.

docs/core-concepts/functions/architecture.mdx (1)

106-117: LGTM!

The SDK References section appropriately highlights TypeScript-only availability for the Functions SDK, and the note provides clear guidance for mobile developers to use HTTP requests instead.

docs/core-concepts/authentication/architecture.mdx (1)

277-316: LGTM!

The SDK References section provides comprehensive platform coverage with appropriate categorization between SDK guides and UI Components. The separation of TypeScript UI components into a dedicated subsection is a helpful organizational choice.

docs/core-concepts/database/architecture.mdx (1)

293-315: LGTM!

The SDK References section effectively highlights platform-specific features (async/await, Combine for Swift; Coroutines and Flow for Kotlin) which helps developers understand the idiomatic integration each SDK provides.

docs/sdks/typescript/overview.mdx (1)

1-72: LGTM!

Well-structured SDK overview with clear installation instructions, a minimal Quick Start example, and comprehensive feature coverage. The CardGroup navigation provides easy access to all SDK reference pages.

docs/sdks/rest/overview.mdx (1)

1-111: LGTM!

Comprehensive REST API overview with practical curl examples demonstrating the complete authentication flow. The error response format with nextActions field is particularly helpful for API consumers. Based on learnings, the clear endpoint descriptions align with documentation guidelines.

docs/sdks/flutter/overview.mdx (1)

1-77: LGTM!

Well-structured Flutter SDK preview documentation with appropriate "Coming Soon" banner. The platform support table with specific version requirements is valuable for developers evaluating compatibility. Notably, the Functions card is correctly omitted here, consistent with the functions architecture page noting that Functions SDK is TypeScript-only.

docs/core-concepts/storage/architecture.mdx (1)

244-264: LGTM!

The SDK References section maintains consistency with other architecture pages and provides platform-specific details (presigned URL support for TypeScript, async/await for Swift, Coroutines for Kotlin) that help developers understand the integration approach for each platform.

docs/core-concepts/ai/architecture.mdx (1)

353-373: LGTM! Well-structured SDK references.

The SDK References section provides clear navigation to platform-specific AI SDK documentation. The descriptions appropriately highlight platform-specific features (streaming, async/await, Flow, Stream).

docs/sdks/typescript/functions.mdx (3)

1-53: LGTM! Clear installation and API documentation.

The installation instructions and invoke() method documentation are well-structured with clear parameter descriptions and return type information.


55-119: LGTM! Comprehensive invoke() examples.

The examples effectively demonstrate different HTTP methods, request bodies, and custom headers with corresponding outputs.


123-156: LGTM! Clear public function example.

The example effectively demonstrates public data access using the anon key, with proper CORS handling and database queries.

docs/sdks/kotlin/overview.mdx (1)

1-50: LGTM! Well-structured Kotlin SDK overview.

The documentation provides a clear overview of the Kotlin SDK with appropriate platform-specific features (Coroutines, Jetpack Compose) and comprehensive SDK reference links. Platform support information is clearly documented with version requirements.

docs/sdks/typescript/storage.mdx (5)

1-49: LGTM! Clear installation and from() method documentation.

The installation instructions and from() method documentation follow the established pattern and provide clear guidance.


53-113: LGTM! Excellent guidance on upload() method.

The documentation includes an important warning about backend auto-renaming and demonstrates the best practice of saving both url and key to the database for future operations. This helps prevent common mistakes.


117-172: LGTM! Clear uploadAuto() documentation.

The uploadAuto() method documentation is clear and demonstrates proper usage with auto-generated keys, including the best practice of saving both URL and key.


176-221: LGTM! Well-structured download() workflow.

The example demonstrates a complete download workflow with clearly numbered steps, showing how to retrieve the key from the database and use it for download operations.


225-273: LGTM! Complete remove() workflow with cleanup.

The example demonstrates a complete deletion workflow, including proper cleanup of both storage files and database references. This prevents orphaned records.

docs/sdks/flutter/storage.mdx (3)

1-153: LGTM! Clear Flutter Storage SDK preview documentation.

The documentation appropriately sets expectations with the "Coming Soon" banner and provides comprehensive method documentation with Flutter-specific examples using appropriate Dart types (Uint8List, File).


157-277: LGTM! Practical Flutter widget integration examples.

The widget examples demonstrate realistic Flutter patterns with proper state management, error handling via SnackBar, and practical integration with image_picker and cached_network_image packages.


279-392: LGTM! Advanced Flutter integration examples.

The examples demonstrate advanced features including upload progress tracking and camera integration, providing valuable patterns for Flutter developers building real-world applications.

docs/sdks/typescript/realtime.mdx (1)

1-429: LGTM! Comprehensive and well-structured realtime documentation.

The documentation provides clear examples, proper type definitions, error handling guidance, and practical usage patterns. The SocketMessage type definitions and complete chat room example are particularly helpful.

docs/sdks/kotlin/database.mdx (2)

192-243: LGTM! Excellent Jetpack Compose integration example.

The example demonstrates proper state management, error handling, and Material Design component usage. This provides clear guidance for Android developers integrating the SDK.


6-6: Verify the snippet import path exists.

Ensure that the imported snippet file /snippets/kotlin-sdk-installation.mdx exists in the repository.

docs/sdks/typescript/database.mdx (1)

360-398: LGTM! Helpful authentication integration pattern.

The example demonstrates proper integration with the authentication hooks, including important checks for isLoaded and user to avoid race conditions. This is valuable guidance for developers combining database and auth features.

docs/sdks/typescript/auth.mdx (2)

151-204: LGTM! Clear OAuth flow documentation.

The documentation properly explains both automatic redirect and manual handling patterns. The note about automatic callback handling is particularly important for developers. The lowercase provider names ('google', 'github', etc.) are correct as code parameters.


397-447: LGTM! Flexible profile management documentation.

The documentation clearly explains that the profile object accepts dynamic fields beyond the predefined name and avatar_url, with helpful examples showing both common and custom field usage.

docs/sdks/swift/overview.mdx (1)

57-73: All SDK reference pages exist and links are valid.

The five SDK documentation pages referenced in the CardGroup (database, auth, storage, ai, realtime) are present in the repository.

docs/sdks/kotlin/storage.mdx (3)

1-10: LGTM!

The frontmatter and installation snippet import are well-structured. Using a shared snippet for installation promotes consistency across SDK docs.


24-91: LGTM!

The upload documentation is comprehensive with clear parameter tables, practical examples including Android-specific Uri handling, and good demonstration of the DSL options syntax.


153-183: LGTM!

Good practice demonstrating the complete workflow: fetching the key, deleting from storage, and clearing database references to avoid orphaned references.

shared-schemas/src/docs.schema.ts (2)

3-43: LGTM!

The new sdkFeatureSchema and sdkLanguageSchema definitions are well-structured with clear descriptive documentation. The commented Flutter entries provide a clean path for future expansion. As per coding guidelines, Zod schemas are appropriately used for validation.


45-145: LGTM!

The expanded docTypeSchema is well-organized with clear categorization by language/platform. Maintaining legacy aliases ensures backward compatibility. The comprehensive description block serves as useful inline documentation.

docs/docs.json (1)

94-170: LGTM!

The navigation restructure cleanly organizes SDK documentation by language. The consistent page structure across TypeScript, Swift, Kotlin, and REST API groups will help users find equivalent functionality across platforms. The tab rename to "SDK & Samples" accurately reflects the expanded content.

Comment thread docs/sdks/flutter/auth.mdx Resolved
Comment thread docs/sdks/flutter/database.mdx Resolved
Comment thread docs/sdks/flutter/realtime.mdx Resolved
Comment thread docs/sdks/kotlin/auth.mdx Resolved
Comment thread docs/sdks/kotlin/functions.mdx Resolved
Comment thread docs/sdks/typescript/ai.mdx Resolved
Comment thread docs/sdks/typescript/functions.mdx Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @docs/sdks/kotlin/database.mdx:
- Around line 230-239: The example uses both .range(0, 9) and .limit(10) which
is redundant; remove one of them (preferably drop .limit(10) to keep the
explicit index range) in the pagination example so the snippet only uses either
.range(0, 9) or .limit(10) (e.g., keep
insforge.database.from("posts").select().order("created_at", ascending =
false).range(0, 9).execute<Post>()), ensuring the unique call names .range and
.limit are updated accordingly to avoid confusion.
♻️ Duplicate comments (2)
docs/snippets/kotlin-sdk-installation.mdx (2)

110-113: Remove unsupported Realtime configuration options.

Per previous review findings, autoReconnect and reconnectDelay are not configurable options in the Kotlin SDK—Socket.IO reconnection parameters are hardcoded. This example will not compile.

Proposed fix
     install(Functions)
-    install(Realtime) {
-        autoReconnect = true
-        reconnectDelay = 5000
-    }
+    install(Realtime)
     install(AI)

256-261: Make the usage example self-contained.

The install(Auth) block is not wrapped in createInsforgeClient, making it incomplete when copy-pasted. Wrap it in a complete client initialization:

Proposed fix
 // Then use it in your InsForge client
-install(Auth) {
-    browserLauncher = ...
-    persistSession = true
-    sessionStorage = DataStoreSessionStorage(context)
-}
+val client = createInsforgeClient(
+    baseUrl = "https://your-app.insforge.app",
+    anonKey = "your-anon-key"
+) {
+    install(Auth) {
+        browserLauncher = BrowserLauncher { url -> /* ... */ }
+        persistSession = true
+        sessionStorage = DataStoreSessionStorage(context)
+    }
+    // ... other modules
+}
🧹 Nitpick comments (2)
docs/sdks/kotlin/database.mdx (1)

104-109: Consider clarifying the Date() usage.

Line 108 uses Date() without showing the required import. Consider either adding the import comment or using a timestamp string for clarity:

 // Delete with filter
 insforge.database
     .from("sessions")
     .delete()
-    .lt("expires_at", Date())
+    .lt("expires_at", "2025-01-01T00:00:00Z")  // or use java.util.Date()
     .execute()
docs/snippets/kotlin-sdk-installation.mdx (1)

211-213: Avoid hardcoding debug = true in production examples.

Hardcoding debug = true could lead to verbose logging in production if copied directly. Consider using BuildConfig.DEBUG or defaulting to false with a comment:

Proposed fix
         // Install Realtime module for real-time subscriptions
         install(Realtime) {
-            debug = true
+            debug = BuildConfig.DEBUG  // Enables debug logging only in debug builds
         }
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c359c23 and bab43e7.

📒 Files selected for processing (3)
  • docs/sdks/kotlin/database.mdx
  • docs/snippets/kotlin-sdk-installation.mdx
  • docs/snippets/swift-sdk-installation.mdx
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/snippets/swift-sdk-installation.mdx
🧰 Additional context used
🪛 LanguageTool
docs/sdks/kotlin/database.mdx

[style] ~15-~15: ‘new records’ might be wordy. Consider a shorter alternative.
Context: ...SdkInstallation /> ## insert() Insert new records into a table. ### Examples ```kotlin ...

(EN_WORDINESS_PREMIUM_NEW_RECORDS)

🔇 Additional comments (7)
docs/sdks/kotlin/database.mdx (5)

1-11: LGTM!

Frontmatter and installation section are well-structured, correctly importing the shared snippet for consistent SDK installation instructions.


13-48: LGTM!

The insert examples correctly demonstrate both single and bulk insert patterns with proper use of @Serializable data classes and the typed API.


52-86: LGTM!

Update examples correctly demonstrate both JsonPrimitive and buildJsonObject approaches. The backtick-escaped .in() method is proper Kotlin syntax for the reserved keyword.


114-190: LGTM!

The select() and executeRaw() examples are comprehensive, showing typed queries, relationship selections, and raw JSON handling with proper import statements.


243-295: LGTM!

The Jetpack Compose integration example demonstrates proper patterns: coroutine launching with LaunchedEffect, state management, error handling, and conditional UI rendering.

docs/snippets/kotlin-sdk-installation.mdx (2)

1-89: LGTM!

Installation instructions comprehensively cover both Maven Central and GitHub Packages with appropriate credential handling options. The note about ~/.gradle/gradle.properties being outside the project correctly addresses version control safety.


118-150: LGTM!

The logging configuration section is well-documented with clear level descriptions and appropriate production guidance.

Comment on lines +230 to +239
```kotlin
// Pagination with sorting
val posts = insforge.database
.from("posts")
.select()
.order("created_at", ascending = false)
.range(0, 9)
.limit(10)
.execute<Post>() // Returns List<Post>
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Remove redundant modifier in pagination example.

Using both .range(0, 9) and .limit(10) is redundant—.range(0, 9) already limits results to 10 rows (indices 0–9). Pick one approach to avoid confusion:

Proposed fix
 // Pagination with sorting
 val posts = insforge.database
     .from("posts")
     .select()
     .order("created_at", ascending = false)
     .range(0, 9)
-    .limit(10)
     .execute<Post>()  // Returns List<Post>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
```kotlin
// Pagination with sorting
val posts = insforge.database
.from("posts")
.select()
.order("created_at", ascending = false)
.range(0, 9)
.limit(10)
.execute<Post>() // Returns List<Post>
```
🤖 Prompt for AI Agents
In @docs/sdks/kotlin/database.mdx around lines 230 - 239, The example uses both
.range(0, 9) and .limit(10) which is redundant; remove one of them (preferably
drop .limit(10) to keep the explicit index range) in the pagination example so
the snippet only uses either .range(0, 9) or .limit(10) (e.g., keep
insforge.database.from("posts").select().order("created_at", ascending =
false).range(0, 9).execute<Post>()), ensuring the unique call names .range and
.limit are updated accordingly to avoid confusion.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In `@docs/sdks/kotlin/ai.mdx`:
- Around line 430-434: Remove the unused local variable currentInput (assigned
in the snippet with val currentInput = inputText) since it is never read; either
delete that assignment or, if the intent was to preserve the original input for
error recovery, replace the val with a properly used backup field or pass
currentInput into the error/retry logic (search for currentInput in the
surrounding function or handler to decide which approach).
- Around line 168-180: The example uses an undefined variable messages in the
client.ai.chatCompletion call; replace it with an inline messages list so the
snippet is self-contained — e.g., call client.ai.chatCompletion (the function)
with messages set to listOf(ChatMessage(role = "user", content = "Your question
here")) while keeping WebSearchPlugin(enabled = true, maxResults = 3) and
FileParserPlugin(enabled = true) and thinking = true so the example compiles and
demonstrates combined features.
- Around line 402-411: The LazyColumn currently double-reverses the list by
using reverseLayout = true together with messages.reversed(); remove the
.reversed() call and pass messages directly to items (e.g., items(messages) {
message -> ChatBubble(message = message) }) so the newest items appear at the
bottom when reverseLayout = true, or alternatively set reverseLayout = false if
you intend to supply a reversed list—adjust the use of LazyColumn
(reverseLayout) and messages.reversed() consistently.
🧹 Nitpick comments (2)
docs/sdks/kotlin/ai.mdx (2)

335-345: Consider adding import hints for Android-specific classes.

The example uses Base64.decode and BitmapFactory.decodeByteArray which are Android-specific APIs (android.util.Base64, android.graphics.BitmapFactory). Adding a brief comment or import statement would help readers understand the required dependencies.

📝 Suggested enhancement
 ```kotlin
+// Requires Android imports:
+// import android.util.Base64
+// import android.graphics.BitmapFactory
+
 val response = client.ai.generateImage(
     model = "google/gemini-2.5-flash-image-preview",
     prompt = "A serene mountain landscape at sunset"
 )

370-380: Undefined GeneratedImageRecord data class.

The example references GeneratedImageRecord without defining it. Consider adding the data class definition or a note that users need to define it.

📝 Suggested addition

Add before the example or as a comment:

// Define your data class to match your database schema
`@Serializable`
data class GeneratedImageRecord(
    val id: String? = null,
    val prompt: String,
    val imageUrl: String
)

Comment thread docs/sdks/kotlin/ai.mdx
Comment on lines +168 to +180
### Example (Combined Features)

```kotlin
val response = client.ai.chatCompletion(
model = "openai/gpt-4",
messages = messages,
webSearch = WebSearchPlugin(enabled = true, maxResults = 3),
fileParser = FileParserPlugin(enabled = true),
thinking = true
)

println(response.text)
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Undefined messages variable in example.

The "Combined Features" example references messages on line 173, but this variable is not defined within the code block. Other examples explicitly define the messages list inline.

📝 Suggested fix
 ```kotlin
 val response = client.ai.chatCompletion(
     model = "openai/gpt-4",
-    messages = messages,
+    messages = listOf(
+        ChatMessage(role = "user", content = "Your question here")
+    ),
     webSearch = WebSearchPlugin(enabled = true, maxResults = 3),
     fileParser = FileParserPlugin(enabled = true),
     thinking = true
 )

 println(response.text)
</details>

<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

```suggestion
### Example (Combined Features)

🤖 Prompt for AI Agents
In `@docs/sdks/kotlin/ai.mdx` around lines 168 - 180, The example uses an
undefined variable messages in the client.ai.chatCompletion call; replace it
with an inline messages list so the snippet is self-contained — e.g., call
client.ai.chatCompletion (the function) with messages set to
listOf(ChatMessage(role = "user", content = "Your question here")) while keeping
WebSearchPlugin(enabled = true, maxResults = 3) and FileParserPlugin(enabled =
true) and thinking = true so the example compiles and demonstrates combined
features.

Comment thread docs/sdks/kotlin/ai.mdx
Comment on lines +402 to +411
LazyColumn(
modifier = Modifier
.weight(1f)
.padding(16.dp),
reverseLayout = true
) {
items(messages.reversed()) { message ->
ChatBubble(message = message)
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Double-reversal of messages list.

Using reverseLayout = true with messages.reversed() results in a double-reversal, showing messages in the original order. Typically, with reverseLayout = true (newest at bottom, scrolling up for older), you pass the list in chronological order directly.

📝 Suggested fix
         LazyColumn(
             modifier = Modifier
                 .weight(1f)
                 .padding(16.dp),
             reverseLayout = true
         ) {
-            items(messages.reversed()) { message ->
+            items(messages) { message ->
                 ChatBubble(message = message)
             }
         }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
LazyColumn(
modifier = Modifier
.weight(1f)
.padding(16.dp),
reverseLayout = true
) {
items(messages.reversed()) { message ->
ChatBubble(message = message)
}
}
LazyColumn(
modifier = Modifier
.weight(1f)
.padding(16.dp),
reverseLayout = true
) {
items(messages) { message ->
ChatBubble(message = message)
}
}
🤖 Prompt for AI Agents
In `@docs/sdks/kotlin/ai.mdx` around lines 402 - 411, The LazyColumn currently
double-reverses the list by using reverseLayout = true together with
messages.reversed(); remove the .reversed() call and pass messages directly to
items (e.g., items(messages) { message -> ChatBubble(message = message) }) so
the newest items appear at the bottom when reverseLayout = true, or
alternatively set reverseLayout = false if you intend to supply a reversed
list—adjust the use of LazyColumn (reverseLayout) and messages.reversed()
consistently.

Comment thread docs/sdks/kotlin/ai.mdx
Comment on lines +430 to +434
val userMessage = ChatMessage(role = "user", content = inputText)
messages = messages + userMessage
val currentInput = inputText
inputText = ""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Unused variable currentInput.

The variable currentInput is assigned on line 432 but never used. It appears to be leftover from a previous implementation or intended for error recovery.

📝 Suggested fix
                     if (inputText.isNotBlank() && !isLoading) {
                         val userMessage = ChatMessage(role = "user", content = inputText)
                         messages = messages + userMessage
-                        val currentInput = inputText
                         inputText = ""

                         scope.launch {
🤖 Prompt for AI Agents
In `@docs/sdks/kotlin/ai.mdx` around lines 430 - 434, Remove the unused local
variable currentInput (assigned in the snippet with val currentInput =
inputText) since it is never read; either delete that assignment or, if the
intent was to preserve the original input for error recovery, replace the val
with a properly used backup field or pass currentInput into the error/retry
logic (search for currentInput in the surrounding function or handler to decide
which approach).

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@docs/sdks/kotlin/database.mdx`:
- Line 322: Update the Kotlin example using the `.in` filter to escape the
reserved keyword with backticks: replace the unescaped usage `.in("status",
listOf("pending", "active"))` with the backtick-escaped form for the `in`
function (i.e., use the `` `in` `` identifier) so it matches the escaping used
elsewhere (see the `.in(column, list)` example and the correct usage on line
83).
♻️ Duplicate comments (2)
docs/sdks/swift/database.mdx (1)

17-23: SwiftUI List(posts) needs Post: Identifiable (or explicit id:).

The SwiftUI snippet later uses List(posts) { ... }, which requires Post to conform to Identifiable or the list to supply id:. This is the same issue noted in prior feedback.

🔧 Suggested fix (model-based)
-struct Post: Codable {
-    let id: String?
+struct Post: Codable, Identifiable {
+    let id: String
     let title: String
     let content: String
     let userId: String
     let createdAt: Date?
 }
docs/sdks/kotlin/database.mdx (1)

346-355: Remove redundant modifier in pagination example.

Using both .range(0, 9) and .limit(10) is redundant—.range(0, 9) already limits results to 10 rows. Remove one to avoid confusion.

| `.lte(column, value)` | Less than or equal | `.lte("priority", 3)` |
| `.like(column, pattern)` | Case-sensitive pattern | `.like("name", "%Widget%")` |
| `.ilike(column, pattern)` | Case-insensitive pattern | `.ilike("email", "%@gmail.com")` |
| `.in(column, list)` | Value in list | `.in("status", listOf("pending", "active"))` |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Escape in keyword in filter table example.

In Kotlin, in is a reserved keyword and must be escaped with backticks. The table example is inconsistent with line 83 which correctly uses backtick escaping:

-| `.in(column, list)` | Value in list | `.in("status", listOf("pending", "active"))` |
+| `.`in`(column, list)` | Value in list | `.`in`("status", listOf("pending", "active"))` |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| `.in(column, list)` | Value in list | `.in("status", listOf("pending", "active"))` |
| `.`in`(column, list)` | Value in list | `.`in`("status", listOf("pending", "active"))` |
🤖 Prompt for AI Agents
In `@docs/sdks/kotlin/database.mdx` at line 322, Update the Kotlin example using
the `.in` filter to escape the reserved keyword with backticks: replace the
unescaped usage `.in("status", listOf("pending", "active"))` with the
backtick-escaped form for the `in` function (i.e., use the `` `in` ``
identifier) so it matches the escaping used elsewhere (see the `.in(column,
list)` example and the correct usage on line 83).

@jwfing jwfing mentioned this pull request Jan 19, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🤖 Fix all issues with AI agents
In `@docs/sdks/rest/auth.mdx`:
- Around line 18-22: Update the "For admin endpoints" auth snippet so it
accurately reflects the supported scheme: if API keys are supported, replace the
current combined line with two explicit examples (one showing Authorization:
Bearer <admin-jwt-token> and one showing x-api-key: <api-key>), and if API keys
are not supported, remove the "Or-API-Key" text and leave only Authorization:
Bearer <admin-jwt-token>; edit the snippet under the "For admin endpoints"
heading in docs/sdks/rest/auth.mdx accordingly so the examples are unambiguous.
- Around line 74-106: Replace the JWT-like string literals in the example JSON
responses with unmistakable placeholders: change the values of the accessToken,
refreshToken and csrfToken fields to clear placeholders such as
"<access-token>", "<refresh-token>" and "<csrf-token>" (update both the initial
and "Response (Mobile/Desktop Client)" examples), ensuring the placeholders do
not resemble real tokens so secret scanners won’t flag them.
- Around line 714-717: The docs and OpenAPI disagree for
/api/auth/oauth/exchange: update the implementation or docs so they match—either
add csrfToken to the OpenAPI response schema when client_type=web (and document
conditional response) or remove the csrfToken sentence from docs and clarify
that the response schema is {user, accessToken, refreshToken} and that web
clients receive a csrfToken via httpOnly cookie instead; locate the exchange
handler and OpenAPI schema for /api/auth/oauth/exchange and the client_type
parameter to make the corresponding change so both spec and docs are consistent.

In `@docs/sdks/typescript/ai.mdx`:
- Line 45: The doc is inconsistent: the `thinking` parameter is described as for
"Anthropic models" but the "Combined Features" example uses model:
'openai/gpt-4'; update the example in docs/sdks/typescript/ai.mdx so the
Combined Features snippet uses an Anthropic model (e.g., replace model:
'openai/gpt-4' with model: 'anthropic/claude-2' or similar) so `thinking: true`
aligns with the documented scope, and keep the `thinking` field unchanged in
that example.

In `@openapi/auth.yaml`:
- Around line 1382-1386: The redirect examples in the auth OpenAPI description
currently embed PII (email and name) in query parameters for both PKCE and Web
flows; update the description text in auth.yaml (the lines showing "PKCE flow:
redirect_uri?... " and "Web flow: redirect_uri?...") to remove email and name
from the redirect query string and instead return only the authorization
artifact (e.g., insforge_code or access_token) and user_id (or just code), and
add a short note directing clients to fetch user profile information via an
authenticated API call; apply the same change to the other occurrence referenced
(around lines 1431-1433).
🧹 Nitpick comments (2)
docs/sdks/typescript/ai.mdx (2)

341-355: Add null check for optional b64_json and note Node.js-specific code.

Two concerns with this example:

  1. b64_json is optional per the return type (line 321), but the example accesses it directly without a null check.
  2. Buffer.from() is Node.js-specific and won't work in browser environments without a polyfill.
Suggested improvement with null check and environment note
 // Get base64 image and upload to storage
 const base64Image = response.data[0].b64_json;
+if (!base64Image) {
+  throw new Error('No image data returned');
+}
+
+// Node.js environment
 const buffer = Buffer.from(base64Image, 'base64');
 const blob = new Blob([buffer], { type: 'image/png' });

Alternatively, add a comment noting this is Node.js-specific:

// Node.js: Convert base64 to blob for upload
// For browsers, use: atob() and Uint8Array instead of Buffer

349-354: Minor: Prompt text doesn't match.

The prompt stored in the database ("A serene mountain landscape") differs from the actual prompt used in the API call ("A serene mountain landscape at sunset" on line 337).

Suggested fix
 await insforge.database.from('generated_images').insert([
   {
-    prompt: 'A serene mountain landscape',
+    prompt: 'A serene mountain landscape at sunset',
     image_url: uploadData.url,
   },
 ]);

Comment thread docs/sdks/rest/auth.mdx
Comment on lines +18 to +22
For admin endpoints:
```bash
Authorization: Bearer admin-jwt-token-Or-API-Key
Content-Type: application/json
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Clarify admin auth headers to match the actual scheme.

The snippet suggests an API key in the Authorization header, which can mislead users. If API keys are supported, show the x-api-key header explicitly; otherwise, keep only the bearer token.

📝 Suggested doc update
-Authorization: Bearer admin-jwt-token-Or-API-Key
+Authorization: Bearer <admin-jwt-token>
+# Or, if using an API key:
+X-API-Key: <admin-api-key>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
For admin endpoints:
```bash
Authorization: Bearer admin-jwt-token-Or-API-Key
Content-Type: application/json
```
For admin endpoints:
🤖 Prompt for AI Agents
In `@docs/sdks/rest/auth.mdx` around lines 18 - 22, Update the "For admin
endpoints" auth snippet so it accurately reflects the supported scheme: if API
keys are supported, replace the current combined line with two explicit examples
(one showing Authorization: Bearer <admin-jwt-token> and one showing x-api-key:
<api-key>), and if API keys are not supported, remove the "Or-API-Key" text and
leave only Authorization: Bearer <admin-jwt-token>; edit the snippet under the
"For admin endpoints" heading in docs/sdks/rest/auth.mdx accordingly so the
examples are unambiguous.

Comment thread docs/sdks/rest/auth.mdx
Comment on lines +74 to +106
```json
{
"user": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"email": "[email protected]",
"emailVerified": false,
"providers": ["email"],
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z"
},
"accessToken": "eyJhbGciOiJIUzI1NiIs...",
"csrfToken": "abc123...",
"requireEmailVerification": false
}
```

### Response (Mobile/Desktop Client)

```json
{
"user": {
"id": "123e4567-e89b-12d3-a456-426614174000",
"email": "[email protected]",
"emailVerified": false,
"providers": ["email"],
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z"
},
"accessToken": "eyJhbGciOiJIUzI1NiIs...",
"refreshToken": "eyJhbGciOiJIUzI1NiIs...",
"requireEmailVerification": false
}
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Replace token-like literals with unmistakable placeholders.

The JWT-looking strings are triggering secret scanners (and can be mistaken for real tokens). Use explicit placeholders such as <access-token>/<refresh-token>/<csrf-token> throughout the doc examples.

🧼 Example replacement
-  "accessToken": "eyJhbGciOiJIUzI1NiIs...",
-  "csrfToken": "abc123...",
+  "accessToken": "<access-token>",
+  "csrfToken": "<csrf-token>",
🧰 Tools
🪛 Gitleaks (8.30.0)

[high] 84-84: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 102-102: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 103-103: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

🤖 Prompt for AI Agents
In `@docs/sdks/rest/auth.mdx` around lines 74 - 106, Replace the JWT-like string
literals in the example JSON responses with unmistakable placeholders: change
the values of the accessToken, refreshToken and csrfToken fields to clear
placeholders such as "<access-token>", "<refresh-token>" and "<csrf-token>"
(update both the initial and "Response (Mobile/Desktop Client)" examples),
ensuring the placeholders do not resemble real tokens so secret scanners won’t
flag them.

Comment thread docs/sdks/rest/auth.mdx
Comment on lines +714 to +717
<Note>
- For **web clients**: The `refreshToken` will be `null` and a `csrfToken` is returned instead. The refresh token is stored in an httpOnly cookie.
- For **mobile/desktop clients**: A `refreshToken` is returned directly. Store it securely on the device.
</Note>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

find . -type f \( -name "*.yaml" -o -name "*.yml" -o -name "*.json" \) | grep -E "(openapi|swagger|spec)" | head -20

Repository: InsForge/InsForge

Length of output: 325


🏁 Script executed:

fd -e yaml -e yml -e json | grep -i "spec\|openapi\|swagger" | head -30

Repository: InsForge/InsForge

Length of output: 301


🏁 Script executed:

rg "oauth/exchange" --type yaml --type json -A 5 -B 5

Repository: InsForge/InsForge

Length of output: 1213


🏁 Script executed:

find . -type f -name "*auth*" | grep -E "\.(yaml|yml|json|mdx)$" | head -30

Repository: InsForge/InsForge

Length of output: 246


🏁 Script executed:

cat openapi/auth.yaml | grep -A 100 "'/api/auth/oauth/exchange'"

Repository: InsForge/InsForge

Length of output: 43


🏁 Script executed:

rg "/api/auth/oauth/exchange" -A 80 openapi/auth.yaml

Repository: InsForge/InsForge

Length of output: 4363


🏁 Script executed:

rg "csrfToken" -B 3 -A 3

Repository: InsForge/InsForge

Length of output: 18940


🏁 Script executed:

rg "oauth" openapi/auth.yaml | grep -E "paths|post|get"

Repository: InsForge/InsForge

Length of output: 43


🏁 Script executed:

grep -n "csrf\|CSRF" docs/sdks/rest/auth.mdx

Repository: InsForge/InsForge

Length of output: 877


🏁 Script executed:

sed -n '700,730p' docs/sdks/rest/auth.mdx

Repository: InsForge/InsForge

Length of output: 921


🏁 Script executed:

sed -n '650,720p' docs/sdks/rest/auth.mdx | head -80

Repository: InsForge/InsForge

Length of output: 1967


Confirm: OpenAPI spec for /api/auth/oauth/exchange does not match documentation.

The OpenAPI spec for this endpoint shows the response includes user, accessToken, and refreshToken only — no csrfToken field. However, the documentation claims web clients receive a csrfToken. The endpoint does accept a client_type parameter, but the response schema doesn't differentiate behavior by client type. Update either the spec (if csrfToken is actually returned) or the documentation to align with the actual API behavior.

🤖 Prompt for AI Agents
In `@docs/sdks/rest/auth.mdx` around lines 714 - 717, The docs and OpenAPI
disagree for /api/auth/oauth/exchange: update the implementation or docs so they
match—either add csrfToken to the OpenAPI response schema when client_type=web
(and document conditional response) or remove the csrfToken sentence from docs
and clarify that the response schema is {user, accessToken, refreshToken} and
that web clients receive a csrfToken via httpOnly cookie instead; locate the
exchange handler and OpenAPI schema for /api/auth/oauth/exchange and the
client_type parameter to make the corresponding change so both spec and docs are
consistent.

- `stream` (boolean, optional) - Enable streaming mode
- `webSearch` (object, optional) - Enable web search capabilities
- `fileParser` (object, optional) - Enable file/PDF parsing
- `thinking` (boolean, optional) - Enable extended reasoning mode (Anthropic models)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Inconsistency: thinking parameter used with non-Anthropic model in example.

Line 45 states thinking is for "(Anthropic models)", but the "Combined Features" example (lines 200-201) uses thinking: true with model: 'openai/gpt-4'. Either clarify that thinking works with other models too, or update the example to use an Anthropic model.

Option A: Update parameter description
-- `thinking` (boolean, optional) - Enable extended reasoning mode (Anthropic models)
+- `thinking` (boolean, optional) - Enable extended reasoning mode (best supported on Anthropic models)
Option B: Update combined features example to use Anthropic model
 const completion = await insforge.ai.chat.completions.create({
-  model: 'openai/gpt-4',
+  model: 'anthropic/claude-3.5-sonnet',
   messages: [
     { role: 'user', content: 'Research and summarize the latest developments in quantum computing' }
   ],
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- `thinking` (boolean, optional) - Enable extended reasoning mode (Anthropic models)
- `thinking` (boolean, optional) - Enable extended reasoning mode (best supported on Anthropic models)
🤖 Prompt for AI Agents
In `@docs/sdks/typescript/ai.mdx` at line 45, The doc is inconsistent: the
`thinking` parameter is described as for "Anthropic models" but the "Combined
Features" example uses model: 'openai/gpt-4'; update the example in
docs/sdks/typescript/ai.mdx so the Combined Features snippet uses an Anthropic
model (e.g., replace model: 'openai/gpt-4' with model: 'anthropic/claude-2' or
similar) so `thinking: true` aligns with the documented scope, and keep the
`thinking` field unchanged in that example.

Comment thread openapi/auth.yaml
Comment on lines +1382 to +1386
description: |
Redirect to application.
- PKCE flow: redirect_uri?insforge_code={code}&user_id={id}&email={email}&name={name}
- Web flow: redirect_uri?access_token={token}&user_id={id}&email={email}&name={name}&csrf_token={csrf}
headers:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Avoid embedding PII in redirect query parameters.

Including email and name in redirect URLs risks leakage via browser history, referrers, and logs. Prefer returning only an authorization code (or user id) and let the client fetch user details via an authenticated API call.

🔒 Suggested wording change
- - PKCE flow: redirect_uri?insforge_code={code}&user_id={id}&email={email}&name={name}
- - Web flow: redirect_uri?access_token={token}&user_id={id}&email={email}&name={name}&csrf_token={csrf}
+ - PKCE flow: redirect_uri?insforge_code={code}
+ - Web flow: redirect_uri?access_token={token}&csrf_token={csrf}

Also applies to: 1431-1433

🤖 Prompt for AI Agents
In `@openapi/auth.yaml` around lines 1382 - 1386, The redirect examples in the
auth OpenAPI description currently embed PII (email and name) in query
parameters for both PKCE and Web flows; update the description text in auth.yaml
(the lines showing "PKCE flow: redirect_uri?... " and "Web flow:
redirect_uri?...") to remove email and name from the redirect query string and
instead return only the authorization artifact (e.g., insforge_code or
access_token) and user_id (or just code), and add a short note directing clients
to fetch user profile information via an authenticated API call; apply the same
change to the other occurrence referenced (around lines 1431-1433).

@Fermionic-Lyu Fermionic-Lyu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We probably don't need to support legacy doc endpoint, since our MCP handles this case (it will give an error message saying that this doc doesn't exist please upgrade your backend version)

* <SwiftSdkInstallation />
* Non-snippet imports are preserved in the output.
*/
async function processSnippets(content: string, docsRoot: string): Promise<string> {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This parsing looks nasty...are there any alternatives for this? Like writing specific agent-docs (separated from mintlify docs) just like realtime.md and deployment.md

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

yah we were previously thinking to keep the same so we don't have to support two patterns... but now i think we need seperate docs. Especially if in future we want to teach how to use raw sql admin side and client side.

i'm fine for this logic for now as this is temporary

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

en, version management is different for multi sdk.

Currently for TypeScript SDK, we write setup on each document(duplicated), and don't specific version. I think developer need to import our sdk in their package.json as below(as a completed setup):

  "dependencies": {
    "@insforge/sdk": "^7.3.4",
  }

For Swift/Kotlin SDK, I prefer to use a seperated setup doc for both agent and mintlify (single source of truth), so replacing the content for agent is necessary.

Comment thread docs/docs.json
},
{
"tab": "Examples",
"tab": "SDK & Samples",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Examples?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yeah, we provider samples for each SDK (legacy ts samples have been moved under TypeScript SDK section).

@tonychang04
tonychang04 self-requested a review January 20, 2026 19:35

@tonychang04 tonychang04 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

approving for now, acknowledging that we may need fix on this before we release.

either it's doc content or format. or ai's understanding

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.

3 participants