All files / features / pipelines pipelinesCrudConfig.ts

100% Statements 4/4
100% Branches 0/0
100% Functions 0/0
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76  67x                                                                                                                                         67x          
import type { CrudFieldConfig, CrudFieldType, FieldLint } from '@/layers/interfaces'
import { laneLint } from './laneLint'
 
export const PIPELINE_FIELD_SET: CrudFieldConfig[] = [
  {
    field: 'name',
    title: 'Name',
    description: "Unique — must match the workflow manifest's metadata.name in the manifest repository's .agent-platform/workflows",
    validation: { required: true, minLength: 3, maxLength: 100 },
  },
  { field: 'description', title: 'Description', validation: { maxLength: 5000 } },
  { field: 'code_repo_id', title: 'Code Repository' },
  {
    field: 'manifest_repo_id',
    title: 'Manifest Repository',
    description: 'Pipeline manifests are always read from `.agent-platform/workflows` and `.agent-platform/agents` in the manifest repository.',
  },
  {
    field: 'output_branch',
    title: 'Output Branch',
    description: 'Branch suffix for pipeline output. Full branch: agent-platform/{name}/{run_id}/{output_branch}. Pipeline never writes to the default branch directly. Leave empty for PR pipelines; a code-writing (branch) pipeline requires a value — the engine rejects the run without one.',
    tooltip: 'Use only letters, numbers, hyphens, underscores, dots, and forward slashes.',
    validation: { pattern: '^[a-zA-Z0-9._/-]+$', patternMessage: 'Use only letters, numbers, hyphens, underscores, dots, and slashes' },
  },
  {
    field: 'base_branch',
    title: 'Base Branch',
    description: 'Source branch for feature branch creation. Pipeline always creates a new prefixed branch from this base. Default: main.',
  },
  { field: 'enabled', title: 'Enabled' },
  { field: 'config', title: 'Config', description: 'Pipeline configuration in YAML' },
  {
    field: 'skill_repos',
    title: 'Skill Repositories',
    description: 'Pipeline-specific skill repositories. The engine mounts each into /skills/<name>/ and resolves skills from them after the code repository. Row order defines priority; empty list = no skill repos.',
    validation: {
      array: {
        maxItems: 16,
        unique: true,
      },
    },
  },
  {
    field: 'pm_bot_account_id',
    title: 'PM Bot Account',
    description: 'Bot account holding the PM tool (Vikunja) API token.',
  },
  {
    field: 'webhook_secret',
    title: 'Webhook Secret',
    description: 'HMAC secret for webhook validation (Gitea PR and Vikunja). Write-only — stored encrypted, never returned. Empty = keep current. On create the secret is not sent — set it in Edit before configuring the webhook. Set the same value in the external webhook configuration.',
  },
]
 
export const PIPELINE_FIELD_TYPES: Record<string, CrudFieldType> = {
  description: 'textarea',
  code_repo_id: 'entity-select',
  manifest_repo_id: 'entity-select',
  enabled: 'checkbox',
  config: 'yaml',
  skill_repos: 'entity-select-list',
  pm_bot_account_id: 'entity-select',
  webhook_secret: 'password',
}
 
export const PIPELINE_ENTITY_SELECT_SOURCES = {
  code_repo_id: { entityPath: 'repositories' as const, nameField: 'name' as const, descriptionField: 'description' as const },
  manifest_repo_id: { entityPath: 'repositories' as const, nameField: 'name' as const, descriptionField: 'description' as const },
  skill_repos: { entityPath: 'repositories' as const, nameField: 'name' as const, descriptionField: 'url' as const },
  pm_bot_account_id: { entityPath: 'bot-accounts' as const, idField: 'id' as const, nameField: 'name' as const, descriptionField: 'description' as const },
}
 
export const PIPELINE_FIELD_LINTS: Record<string, FieldLint> = {
  config: laneLint,
}