Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:2aronS Duel Agents Skill Asset Copying

From Leeroopedia
Knowledge Sources
Domains Developer_Tools, Configuration
Last Updated 2026-10-27 14:00 GMT

Overview

Concrete tool for resolving integration asset paths and copying skill trees to the correct destination directories for Cursor and OpenClaw, provided by @duel-agents/install.

Description

The Skill Asset Copying group handles the file-asset side of install: locating the packaged integration skill directories and copying them to the tool-specific destination. It comprises three functions:

  • resolveIntegrationPath — resolves a path under integrations/ by trying three candidate locations: the published npm layout, the monorepo dev layout, and the tsx source layout. Throws if none exist.
  • copyCursorSkill — copies the Cursor Duel skill to <cwd>/.cursor/skills/duel-agents (project-local)
  • copyOpenClawSkill — copies the OpenClaw Duel skill to ~/.openclaw/workspace/skills/duel-agents (user-global)

Both copy functions use fs.cp with recursive: true and force: true, creating parent directories as needed.

Usage

Import these functions when you need to:

  • Copy the Duel skill for Cursor or OpenClaw during install
  • Resolve the path to a packaged integration asset
  • Build a custom install flow that copies skill assets

Code Reference

Source Location

  • Repository: Duel-Agents
  • File: packages/cli/src/install.ts (lines 24-43, 136-156)

Signature

/** Resolve a path under integrations/ by trying npm, monorepo, and tsx layouts. */
export function resolveIntegrationPath(...parts: string[]): string;

/** Copy Cursor skill to <cwd>/.cursor/skills/duel-agents. */
async function copyCursorSkill(cwd: string): Promise<void>;

/** Copy OpenClaw skill to ~/.openclaw/workspace/skills/duel-agents. */
async function copyOpenClawSkill(): Promise<void>;

Import

import { resolveIntegrationPath } from "@duel-agents/install";
// copyCursorSkill and copyOpenClawSkill are internal (not exported)

I/O Contract

Inputs

Name Type Required Description
parts string[] Yes Path segments under integrations/
cwd (copyCursorSkill) string Yes Working dir for Cursor skill destination

Outputs

Name Type Description
resolveIntegrationPath returns string Absolute path to the asset; throws if not found
side effect filesystem Copied skill tree at destination

Usage Examples

Resolve an Integration Path

import { resolveIntegrationPath } from "@duel-agents/install";

// Finds integrations/openclaw/skills/duel-agents via npm, monorepo, or tsx layout
const skillPath = resolveIntegrationPath("openclaw", "skills", "duel-agents");
console.log(`Skill at: ${skillPath}`);

Copy Cursor Skill (Internal Flow)

import { cp, mkdir } from "node:fs/promises";
import { join, dirname } from "node:path";

// The internal implementation mirrors this:
const src = resolveIntegrationPath("cursor", "skills", "duel-agents");
const dest = join(process.cwd(), ".cursor", "skills", "duel-agents");
await mkdir(dirname(dest), { recursive: true });
await cp(src, dest, { recursive: true, force: true });

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment