Change Proposals

Change proposals let you build review and approval workflows for into your application. This allows users and AI agents to safely suggest, discuss, and approve edits before they are merged.

Change Proposals

Examples

Create a change proposal

import { openLix } from "@lix-js/sdk";
const activeVersion = await lix.db.selectFrom("active_version")
  .innerJoin("version", "active_version.version_id", "version.id")
  .select("version.id")
  .executeTakeFirstOrThrow();

const mainVersion = await lix.db.selectFrom("version")
  .where("name", "=", "main")
  .select("id")
  .executeTakeFirstOrThrow();

// Create a change proposal (like a pull request)
const proposal = await createChangeProposal({
  lix,
  title: "Fix typos in documentation",
  description: "This proposal fixes several spelling errors",
  sourceVersion: activeVersion,
  targetVersion: mainVersion
});

console.log("Change proposal created:", proposal.title);

Accepting or rejecting a proposal

import { openLix } from "@lix-js/sdk";

const activeVersion = await lix.db.selectFrom("active_version")
  .innerJoin("version", "active_version.version_id", "version.id")
  .select("version.id")
  .executeTakeFirstOrThrow();

const mainVersion = await lix.db.selectFrom("version")
  .where("name", "=", "main")
  .select("id")
  .executeTakeFirstOrThrow();

// Create a change proposal (like a pull request)
const proposal = await createChangeProposal({
  lix,
  title: "Fix typos in documentation",
  description: "This proposal fixes several spelling errors",
  sourceVersion: activeVersion,
  targetVersion: mainVersion
});

console.log("Change proposal created:", proposal.title);
// Merge the proposal (accepts and merges in one action)
await acceptChangeProposal({
  lix,
  proposal: proposal
});

console.log("Proposal accepted and merged");

// Or reject the proposal
await rejectChangeProposal({
  lix,
  proposal: proposal,
  comment: "Needs more work on error handling"
});

console.log("Proposal rejected with feedback");