Skip to main content
Glama

setup

Configures OSS Autopilot preferences including languages, interests, and contribution goals to personalize your open source contribution experience.

Instructions

Run OSS Autopilot setup to configure preferences like languages, interests, and contribution goals.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
resetNoIf true, reset all preferences to defaults before running setup
setNoSet preferences non-interactively as key=value pairs (e.g. ["languages=typescript,rust"])

Implementation Reference

  • Main handler for the 'setup' tool. Three modes: (1) --set key=value applies settings directly via stateManager.batch, (2) returns current config if setup is complete, (3) returns setup prompts for interactive wizard. Handles username, maxActivePRs, dormantDays, approachingDays, languages, labels, scope, projectCategories, preferredOrgs, persistence, and many more settings.
    export async function runSetup(options: SetupOptions): Promise<SetupOutput> {
      const stateManager = getStateManager();
      const config = stateManager.getState().config;
    
      // Handle --set mode: apply settings directly
      if (options.set && options.set.length > 0) {
        const results: Record<string, string> = {};
        const warnings: string[] = [];
    
        // Pre-validate every key before mutating state. `stateManager.batch()` only
        // defers the disk write — it does not snapshot in-memory state, so throwing
        // mid-loop would leave earlier successful updates applied in memory (a real
        // issue for long-running consumers like the MCP server and dashboard that
        // share the StateManager singleton across requests).
        const knownKeys = new Set(getSetupKeys());
        for (const setting of options.set) {
          const [key] = setting.split('=');
          if (!knownKeys.has(key)) {
            throw new ValidationError(formatUnknownKeyError(key, 'setup'));
          }
        }
    
        stateManager.batch(() => {
          for (const setting of options.set!) {
            const [key, ...valueParts] = setting.split('=');
            const value = valueParts.join('=');
    
            switch (key) {
              case 'username': {
                validateGitHubUsername(value);
                stateManager.updateConfig({ githubUsername: value });
                results[key] = value;
                break;
              }
              case 'maxActivePRs': {
                const maxPRs = parsePositiveInt(value, 'maxActivePRs');
                stateManager.updateConfig({ maxActivePRs: maxPRs });
                results[key] = String(maxPRs);
                break;
              }
              case 'dormantDays': {
                const dormant = parsePositiveInt(value, 'dormantDays');
                stateManager.updateConfig({ dormantThresholdDays: dormant });
                results[key] = String(dormant);
                break;
              }
              case 'approachingDays': {
                const approaching = parsePositiveInt(value, 'approachingDays');
                stateManager.updateConfig({ approachingDormantDays: approaching });
                results[key] = String(approaching);
                break;
              }
              case 'languages': {
                stateManager.updateConfig({ languages: value.split(',').map((l) => l.trim()) });
                results[key] = value;
                break;
              }
              case 'labels': {
                stateManager.updateConfig({ labels: value.split(',').map((l) => l.trim()) });
                results[key] = value;
                break;
              }
              case 'squashByDefault': {
                if (value === 'ask') {
                  stateManager.updateConfig({ squashByDefault: 'ask' });
                  results[key] = 'ask';
                } else {
                  stateManager.updateConfig({ squashByDefault: value !== 'false' });
                  results[key] = value !== 'false' ? 'true' : 'false';
                }
                break;
              }
              case 'minStars': {
                const stars = Number(value);
                if (!Number.isInteger(stars) || stars < 0) {
                  throw new ValidationError(`Invalid value for minStars: "${value}". Must be a non-negative integer.`);
                }
                stateManager.updateConfig({ minStars: stars });
                results[key] = String(stars);
                break;
              }
              case 'maxIssueAgeDays': {
                const days = parsePositiveInt(value, 'maxIssueAgeDays');
                stateManager.updateConfig({ maxIssueAgeDays: days });
                results[key] = String(days);
                break;
              }
              case 'minRepoScoreThreshold': {
                const threshold = Number(value);
                if (!Number.isInteger(threshold) || threshold < 0) {
                  throw new ValidationError(
                    `Invalid value for minRepoScoreThreshold: "${value}". Must be a non-negative integer.`,
                  );
                }
                stateManager.updateConfig({ minRepoScoreThreshold: threshold });
                results[key] = String(threshold);
                break;
              }
              case 'skippedIssuesPath': {
                stateManager.updateConfig({ skippedIssuesPath: value || undefined });
                results[key] = value || '(cleared)';
                break;
              }
              case 'autoFormatBeforePush': {
                if (value !== 'true' && value !== 'false') {
                  throw new ValidationError(
                    `Invalid value for autoFormatBeforePush: "${value}". Must be "true" or "false".`,
                  );
                }
                const enabled = value === 'true';
                stateManager.updateConfig({ autoFormatBeforePush: enabled });
                results[key] = String(enabled);
                break;
              }
              case 'includeDocIssues': {
                stateManager.updateConfig({ includeDocIssues: value === 'true' });
                results[key] = value === 'true' ? 'true' : 'false';
                break;
              }
              case 'aiPolicyBlocklist': {
                const entries = value
                  .split(',')
                  .map((r) => r.trim())
                  .filter(Boolean);
                const valid: string[] = [];
                const invalid: string[] = [];
                for (const entry of entries) {
                  const normalized = entry.replace(/\s+/g, '');
                  if (/^[\w.-]+\/[\w.-]+$/.test(normalized)) {
                    valid.push(normalized);
                  } else {
                    invalid.push(entry);
                  }
                }
                if (invalid.length > 0) {
                  warnings.push(`Warning: Skipping invalid entries (expected "owner/repo" format): ${invalid.join(', ')}`);
                  results['aiPolicyBlocklist_invalidEntries'] = invalid.join(', ');
                }
                if (valid.length === 0 && entries.length > 0) {
                  warnings.push('Warning: All entries were invalid. Blocklist not updated.');
                  results[key] = '(all entries invalid)';
                  break;
                }
                stateManager.updateConfig({ aiPolicyBlocklist: valid });
                results[key] = valid.length > 0 ? valid.join(', ') : '(empty)';
                break;
              }
              case 'projectCategories': {
                const categories = value
                  .split(',')
                  .map((c) => c.trim())
                  .filter(Boolean);
                const validCategories: ProjectCategory[] = [];
                const invalidCategories: string[] = [];
                for (const cat of categories) {
                  if ((PROJECT_CATEGORIES as readonly string[]).includes(cat)) {
                    validCategories.push(cat as ProjectCategory);
                  } else {
                    invalidCategories.push(cat);
                  }
                }
                if (invalidCategories.length > 0) {
                  warnings.push(
                    `Unknown project categories: ${invalidCategories.join(', ')}. Valid: ${PROJECT_CATEGORIES.join(', ')}`,
                  );
                }
                const dedupedCategories = [...new Set(validCategories)];
                stateManager.updateConfig({ projectCategories: dedupedCategories });
                results[key] = dedupedCategories.length > 0 ? dedupedCategories.join(', ') : '(empty)';
                break;
              }
              case 'preferredOrgs': {
                const orgs = value
                  .split(',')
                  .map((o) => o.trim())
                  .filter(Boolean);
                const validOrgs: string[] = [];
                for (const org of orgs) {
                  if (org.includes('/')) {
                    warnings.push(
                      `"${org}" looks like a repo path. Use org name only (e.g., "vercel" not "vercel/next.js").`,
                    );
                  } else if (!/^[\da-z](?:[\da-z-]*[\da-z])?$/i.test(org)) {
                    warnings.push(`"${org}" is not a valid GitHub organization name. Skipping.`);
                  } else {
                    validOrgs.push(org.toLowerCase());
                  }
                }
                const dedupedOrgs = [...new Set(validOrgs)];
                stateManager.updateConfig({ preferredOrgs: dedupedOrgs });
                results[key] = dedupedOrgs.length > 0 ? dedupedOrgs.join(', ') : '(empty)';
                break;
              }
              case 'scope': {
                const scopeValues = value
                  .split(',')
                  .map((s) => s.trim())
                  .filter(Boolean);
                const validScopes: IssueScope[] = [];
                const invalidScopes: string[] = [];
                for (const s of scopeValues) {
                  if ((ISSUE_SCOPES as readonly string[]).includes(s)) {
                    validScopes.push(s as IssueScope);
                  } else {
                    invalidScopes.push(s);
                  }
                }
                if (invalidScopes.length > 0) {
                  warnings.push(`Unknown issue scopes: ${invalidScopes.join(', ')}. Valid: ${ISSUE_SCOPES.join(', ')}`);
                }
                const dedupedScopes = [...new Set(validScopes)];
                stateManager.updateConfig({ scope: dedupedScopes.length > 0 ? dedupedScopes : undefined });
                results[key] = dedupedScopes.length > 0 ? dedupedScopes.join(', ') : '(empty — using labels only)';
                break;
              }
              case 'persistence': {
                if (value !== 'local' && value !== 'gist') {
                  throw new ValidationError(`Invalid value for persistence: "${value}". Must be "local" or "gist".`);
                }
                stateManager.updateConfig({ persistence: value as 'local' | 'gist' });
                results[key] = value;
                break;
              }
              case 'issueListPath': {
                stateManager.updateConfig({ issueListPath: value || undefined });
                results[key] = value || '(cleared)';
                break;
              }
              case 'diffTool': {
                if (!(DIFF_TOOLS as readonly string[]).includes(value)) {
                  warnings.push(`Invalid diffTool "${value}". Valid: ${DIFF_TOOLS.join(', ')}`);
                  break;
                }
                stateManager.updateConfig({ diffTool: value as DiffTool });
                results[key] = value;
                break;
              }
              case 'diffToolCustomCommand': {
                stateManager.updateConfig({ diffToolCustomCommand: value || undefined });
                results[key] = value || '(cleared)';
                break;
              }
              case 'complete': {
                if (value === 'true') {
                  stateManager.markSetupComplete();
                  results[key] = 'true';
                }
                break;
              }
              default: {
                throw new ValidationError(formatUnknownKeyError(key, 'setup'));
              }
            }
          }
        });
    
        return { success: true, settings: results, warnings: warnings.length > 0 ? warnings : undefined };
      }
    
      // Show setup status
      if (config.setupComplete && !options.reset) {
        return {
          setupComplete: true,
          config: {
            githubUsername: config.githubUsername,
            maxActivePRs: config.maxActivePRs,
            dormantThresholdDays: config.dormantThresholdDays,
            approachingDormantDays: config.approachingDormantDays,
            languages: config.languages,
            labels: config.labels,
            projectCategories: config.projectCategories ?? [],
            preferredOrgs: config.preferredOrgs ?? [],
            scope: config.scope ?? [],
            persistence: config.persistence ?? 'local',
          },
        };
      }
    
      // Output setup prompts
      return {
        setupRequired: true,
        prompts: [
          {
            setting: 'username',
            prompt: 'What is your GitHub username?',
            current: config.githubUsername || null,
            required: true,
            type: 'string',
          },
          {
            setting: 'maxActivePRs',
            prompt: 'How many PRs do you want to work on at once?',
            current: config.maxActivePRs,
            default: 10,
            type: 'number',
          },
          {
            setting: 'dormantDays',
            prompt: 'After how many days of inactivity should a PR be considered dormant?',
            current: config.dormantThresholdDays,
            default: 30,
            type: 'number',
          },
          {
            setting: 'approachingDays',
            prompt: 'At how many days should we warn about approaching dormancy?',
            current: config.approachingDormantDays,
            default: 25,
            type: 'number',
          },
          {
            setting: 'languages',
            prompt: 'What programming languages do you want to contribute to?',
            current: config.languages,
            default: ['typescript', 'javascript'],
            type: 'list',
          },
          {
            setting: 'labels',
            prompt: 'What issue labels should we search for?',
            current: config.labels,
            default: ['good first issue', 'help wanted'],
            type: 'list',
          },
          {
            setting: 'scope',
            prompt:
              'What scope of issues do you want to discover? (beginner, intermediate, advanced — leave empty for default labels only)',
            current: config.scope ?? [],
            default: [],
            type: 'list',
          },
          {
            setting: 'aiPolicyBlocklist',
            prompt: 'Repos with anti-AI contribution policies to block (owner/repo, comma-separated)?',
            current: config.aiPolicyBlocklist ?? DEFAULT_CONFIG.aiPolicyBlocklist ?? null,
            default: ['matplotlib/matplotlib'],
            type: 'list',
          },
          {
            setting: 'projectCategories',
            prompt:
              'What types of projects interest you? (nonprofit, devtools, infrastructure, web-frameworks, data-ml, education)',
            current: config.projectCategories ?? [],
            default: [],
            type: 'list',
          },
          {
            setting: 'preferredOrgs',
            prompt: 'Any GitHub organizations to prioritize? (org names, comma-separated)',
            current: config.preferredOrgs ?? [],
            default: [],
            type: 'list',
          },
          {
            setting: 'persistence',
            prompt: 'Where should state be stored? "local" for file only, "gist" for GitHub Gist (survives device loss)',
            current: config.persistence ?? 'local',
            default: 'local',
            type: 'string',
          },
        ],
      };
    }
  • runCheckSetup – checks whether initial setup has been completed. Returns { setupComplete, username }.
    export async function runCheckSetup(): Promise<CheckSetupOutput> {
      const stateManager = getStateManager();
    
      return {
        setupComplete: stateManager.isSetupComplete(),
        username: stateManager.getState().config.githubUsername,
      };
    }
  • Type definitions for SetupOptions, SetupSetOutput, SetupCompleteOutput, SetupRequiredOutput, SetupPrompt, SetupOutput, and CheckSetupOutput used by the setup tool.
    interface SetupOptions {
      reset?: boolean;
      set?: string[];
    }
    
    export interface SetupSetOutput {
      success: true;
      settings: Record<string, string>;
      warnings?: string[];
    }
    
    export interface SetupCompleteOutput {
      setupComplete: true;
      config: {
        githubUsername: string;
        maxActivePRs: number;
        dormantThresholdDays: number;
        approachingDormantDays: number;
        languages: string[];
        labels: string[];
        projectCategories: ProjectCategory[];
        preferredOrgs: string[];
        scope: IssueScope[];
        persistence: 'local' | 'gist';
      };
    }
    
    export interface SetupPrompt {
      setting: string;
      prompt: string;
      current: string | number | string[] | null;
      required?: boolean;
      default?: string | number | string[];
      type?: string;
    }
    
    export interface SetupRequiredOutput {
      setupRequired: true;
      prompts: SetupPrompt[];
    }
    
    export type SetupOutput = SetupSetOutput | SetupCompleteOutput | SetupRequiredOutput;
  • MCP tool registration for 'setup' with input schema (reset, set) and handler wrapped via wrapTool(runSetup).
    // 13. setup — Interactive setup
    server.registerTool(
      'setup',
      {
        description:
          'Run OSS Autopilot setup to configure preferences like languages, interests, and contribution goals.',
        inputSchema: {
          reset: z.boolean().optional().describe('If true, reset all preferences to defaults before running setup'),
          set: z
            .array(z.string())
            .optional()
            .describe('Set preferences non-interactively as key=value pairs (e.g. ["languages=typescript,rust"])'),
        },
        annotations: { readOnlyHint: false, destructiveHint: false },
      },
      wrapTool(runSetup),
    );
  • getSetupKeys() – returns the list of config keys that can be set via the 'setup --set' command (filtered by settableVia === 'setup' or 'both').
    export function getSetupKeys(): readonly string[] {
      return CONFIG_KEY_REGISTRY.filter((d) => d.settableVia === 'setup' || d.settableVia === 'both').map((d) => d.key);
    }
    
    /** Keys accepted by the `config <key> <value>` command (includes `both`). */
    export function getConfigKeys(): readonly string[] {
      return CONFIG_KEY_REGISTRY.filter((d) => d.settableVia === 'config' || d.settableVia === 'both').map((d) => d.key);
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations indicate the tool is neither read-only nor destructive. The description confirms it configures preferences, implying mutation. However, it does not disclose specific side effects (e.g., whether existing settings are overwritten, if reset is required first) or the interactive nature when no 'set' parameter is provided.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence, efficiently conveying the core purpose. No redundant information is present, though it could benefit from listing common use cases or mentioning the two parameters.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (2 optional parameters, no output schema), the description covers the basic functionality. However, it lacks information about return values, potential interactivity, and any required prior setup, leaving some contextual gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Input schema coverage is 100% with clear parameter descriptions. The tool description adds no additional guidance beyond the schema, missing an opportunity to explain the 'set' format or interaction between 'reset' and 'set'. Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Run OSS Autopilot setup') and the resource ('preferences like languages, interests, and contribution goals'). It effectively communicates the tool's purpose among siblings such as 'check-setup' and 'config', though it does not explicitly differentiate from them.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides a general purpose but lacks explicit guidance on when to use this tool versus alternatives like 'check-setup' or 'config'. There is no mention of prerequisites, typical scenarios, or exclusions, which limits the agent's ability to make a well-contextualized choice.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/costajohnt/oss-autopilot'

If you have feedback or need assistance with the MCP directory API, please join our Discord server