npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

fulcrum-worktrees

v0.0.3

Published

Code worktree lifecycle management — worktree provisioning, artifact tracking, and code review workflows

Downloads

378

Readme

@fulcrum/worktrees

Code worktree lifecycle management — worktree provisioning, artifact tracking, and code review workflows for agent-driven development.

Key Concepts

| Concept | Description | |---|---| | Worktree | An isolated git workspace tied to a branch, task, or agent run. Progresses through a strict status lifecycle. | | WorktreeStatus | allocateddirtyready_for_mergemerged / discarded | | Artifact | An output file (PRD, plan, diff, report, etc.) owned by a task, run, or worktree. Has a status (draft / final / archived) and an optional content_hash. | | ArtifactType | prd, plan, review, test_report, code_diff, log, spec, diagram, document, config | | Review | A review request against a task, artifact, or worktree. Tracks status (pending / changes_requested / approved / rejected) and an optional reviewer_agent_id. | | Handoff | Structured handoff record from one agent to another — goal, scope, constraints, done criteria, artifact contract reference, and handoff mode. | | ArtifactContract | Declares which artifacts are required/optional for a task to be considered merge-ready. | | Merge queue | FIFO queue of ready_for_merge worktrees. Processing is policy-gated to integration_worker role. |

Worktree lifecycle

allocated → dirty → ready_for_merge → merged
                                    ↘ discarded
↓ (any state except merged/discarded)
discarded

Usage

Allocating a worktree

import { allocateWorktree } from '@fulcrum/worktrees'

const wt = await allocateWorktree({
  workspace_id: 'ws_01',
  project_id: 'proj_01',
  branch_name: 'feature/my-task',
  path: '/tmp/worktrees/my-task',
  task_id: 'task_42',   // optional
})
// wt.status === 'allocated'
// wt.worktree_id === 'wt_01J...'

Transitioning through the lifecycle

import { markDirty, markReadyForMerge, enqueueMerge } from '@fulcrum/worktrees'

// Agent has made changes
await markDirty({ worktree_id: wt.worktree_id })

// Agent has finished and passed checks
await markReadyForMerge({ worktree_id: wt.worktree_id })

// Signal intent to merge (validates state, priority hint for future use)
await enqueueMerge({ worktree_id: wt.worktree_id })

Processing the merge queue (integration_worker only)

import { processMergeQueue } from '@fulcrum/worktrees'

const results = await processMergeQueue('proj_01', 'integration_worker')
// results[0].success === true
// results[0].merged_at === '2026-...'

Discarding a worktree

import { discardWorktree } from '@fulcrum/worktrees'

await discardWorktree({ worktree_id: wt.worktree_id, reason: 'stale branch' })

Inspecting the merge queue

import { listMergeQueue } from '@fulcrum/worktrees'

const queue = await listMergeQueue('proj_01')
// Returns ready_for_merge worktrees ordered FIFO by created_at

API

Worktree lifecycle

| Function | Signature | Description | |---|---|---| | allocateWorktree | (input: AllocateWorktreeInput) => Promise<Worktree> | Create a new worktree in allocated state | | markDirty | (input: MarkDirtyInput) => Promise<Worktree> | Transition allocateddirty (agent has written changes) | | markReadyForMerge | (input: MarkReadyInput) => Promise<Worktree> | Transition dirtyready_for_merge | | enqueueMerge | (input: EnqueueMergeInput) => Promise<void> | Validate worktree is ready_for_merge; priority hint for future use | | processMergeQueue | (projectId, callerRole) => Promise<MergeResult[]> | Policy-gated (integration_worker only): mark all queued worktrees merged | | discardWorktree | (input: DiscardWorktreeInput) => Promise<void> | Mark worktree discarded; blocks if already merged or discarded | | listMergeQueue | (projectId: string) => Promise<Worktree[]> | List all ready_for_merge worktrees for a project (FIFO) |

Types

| Type | Values / Shape | |---|---| | WorktreeStatus | 'allocated' \| 'dirty' \| 'ready_for_merge' \| 'merged' \| 'discarded' | | ArtifactStatus | 'draft' \| 'final' \| 'archived' | | ArtifactType | 'prd' \| 'plan' \| 'review' \| 'test_report' \| 'code_diff' \| 'log' \| 'spec' \| 'diagram' \| 'document' \| 'config' | | ReviewStatus | 'pending' \| 'changes_requested' \| 'approved' \| 'rejected' | | ReviewTargetType | 'task' \| 'artifact' \| 'worktree' | | HandoffMode | 'brief' \| 'contextual' \| 'artifact_first_brief' \| 'branched_session' | | MergeResult | { worktree_id, branch_name, success, error?, merged_at? } |

Database tables owned

This package owns tables: worktrees, artifacts, artifacts_fts, reviews, artifact_contracts, handoffs.