Skip to content

.takos/app.yml

Status

このページは current contract です。Takos は single-document YAMLkind: App manifest を正本として解釈します。

Takos の app deploy は、リポジトリ内の .takos/app.yml を読んで行います。現在の parser は multi-document の Package / Workload / Binding 形式を受け付けません。

最小構成

yaml
apiVersion: takos.dev/v1alpha1
kind: App
metadata:
  name: notes-assistant
spec:
  version: 0.3.0
  services:
    web:
      type: worker
      build:
        fromWorkflow:
          path: .takos/workflows/deploy.yml
          job: bundle
          artifact: web
          artifactPath: dist/worker

有効な例全体は current example を参照してください。

トップレベル

fieldrequireddescription
apiVersionyes現在は takos.dev/v1alpha1 固定
kindyesApp 固定
metadata.nameyesapp 名
metadata.appIdno既存 app へ再デプロイする場合の固定 ID
spec.versionyes表示用 version
spec.descriptionno説明
spec.iconnoicon URL または path
spec.categorynoapp, service, library, template, social
spec.tagsnoタグ配列
spec.capabilitiesnoplatform capability 名の宣言
spec.env.requirednodeploy 時に満たすべき env 名
spec.oauthnoOAuth client 自動登録設定
spec.takos.scopesnoTakos-managed token の scope
spec.resourcesnoapp が要求する resource map
spec.servicesyesdeploy 対象 service map
spec.routesnoroute 配列
spec.mcpServersnoMCP server 公開設定
spec.fileHandlersnostorage/file handler 登録

metadata

yaml
metadata:
  name: notes-assistant
  appId: app_1234567890
  • metadata.name は必須です。
  • metadata.appId は control plane 側の既存 app identity を pin したいときだけ使います。

spec.services

現在の public manifest で使える service type は worker のみです。

yaml
spec:
  services:
    web:
      type: worker
      build:
        fromWorkflow:
          path: .takos/workflows/deploy.yml
          job: bundle
          artifact: web
          artifactPath: dist/worker
      env:
        PUBLIC_APP_NAME: Notes Assistant
      bindings:
        d1: [primary-db]
        r2: [assets]
        kv: [cache]
        vectorize: [embeddings]
        queues: [reminders]
        analytics: [events]
        workflows: [digest-workflow]
        durableObjects: [session-do]
        services: [web]
      triggers:
        schedules:
          - cron: "*/15 * * * *"
            export: scheduled
        queues:
          - queue: reminders
            export: queue

build contract

spec.services.<name>.build.fromWorkflow は必須です。

fieldrequireddescription
pathyes.takos/workflows/ 配下の workflow path
jobyesdeploy artifact を出す job 名
artifactyesworkflow artifact 名
artifactPathyesartifact 内の worker bundle path

現在は次を 受け付けません

  • build.command
  • build.output
  • build.cwd
  • entry
  • local build shell を直接書く形式

bindings

binding list は resource 名を参照します。型が一致しない場合は validation error になります。

triggers

  • triggers.schedules[].cron
  • triggers.schedules[].export
  • triggers.queues[].queue
  • triggers.queues[].export

queue trigger の queuespec.resources 内の type: queue resource を参照する必要があります。

spec.resources

resource は map です。key が resource 名になります。

yaml
spec:
  resources:
    primary-db:
      type: d1
      binding: DB
      migrations:
        up: .takos/migrations/primary-db/up
        down: .takos/migrations/primary-db/down
    assets:
      type: r2
      binding: ASSETS

サポートされる resource type

typefields
d1binding, migrations
r2binding
kvbinding
secretRefbinding
vectorizebinding, vectorize.dimensions, vectorize.metric
queuebinding, queue.maxRetries, queue.deadLetterQueue, queue.deliveryDelaySeconds
analyticsEnginebinding, analyticsEngine.dataset
workflowbinding, workflow.service, workflow.export, workflow.timeoutMs, workflow.maxRetries
durableObjectbinding, durableObject.className, durableObject.scriptName

追加ルール

  • queue.deadLetterQueue は別の type: queue resource を参照する必要があります。
  • workflow.service は既存 service 名を参照する必要があります。
  • migrations は文字列または { up, down } のどちらでも指定できます。

spec.routes

yaml
spec:
  routes:
    - name: app
      service: web
      path: /
      timeoutMs: 30000
fieldrequireddescription
serviceyesroute の target service
namenoroute 表示名
pathno公開 path
ingressnoingress service 名
timeoutMsnoroute timeout
  • service は既存 service を参照する必要があります。
  • ingress を使う場合も worker service を参照する必要があります。

spec.mcpServers

yaml
spec:
  mcpServers:
    - name: notes
      route: /mcp
      transport: streamable-http

各 entry は次を持ちます。

fieldrequireddescription
nameyesMCP server 名
endpointno絶対 URL
routenoapp route 上の相対 path
transportno現在は streamable-http

endpointroute のどちらかは必須です。

spec.fileHandlers

yaml
spec:
  fileHandlers:
    - name: markdown
      mimeTypes: [text/markdown]
      extensions: [.md]
      openPath: /files/:id
fieldrequireddescription
nameyeshandler 名
mimeTypesnoMIME type 配列
extensionsno拡張子配列
openPathyesopen 時に使う app path

OAuth と Takos-managed token

spec.oauth

yaml
spec:
  oauth:
    clientName: Notes Assistant
    redirectUris:
      - https://notes.example.com/oauth/callback
    scopes:
      - openid
      - profile
      - spaces:read
    autoEnv: true
    metadata:
      logoUri: https://notes.example.com/logo.png
      tosUri: https://notes.example.com/tos
      policyUri: https://notes.example.com/privacy
fieldrequireddescription
clientNameyesOAuth クライアント表示名
redirectUrisyesリダイレクト URI 配列 (相対パスは Endpoint の URL を基準に解決)
scopesyes要求するスコープ配列
autoEnvnodeploy 時に OAuth env を自動注入するか
metadata.logoUrinoクライアントロゴ URL
metadata.tosUrino利用規約 URL
metadata.policyUrinoプライバシーポリシー URL

manifest で OAuth client を自動登録できます。詳細は OAuth を参照してください。

spec.env.requiredspec.takos.scopes

yaml
spec:
  env:
    required:
      - TAKOS_ACCESS_TOKEN
  takos:
    scopes:
      - threads:read
      - runs:write

TAKOS_ACCESS_TOKEN を要求すると、Takos-managed token を deploy 時に解決できるようになります。権限は spec.takos.scopes で宣言します。

validation で落ちる代表例

  • kindApp ではない
  • spec.services が空
  • build.fromWorkflow.path.takos/workflows/ 配下ではない
  • binding が存在しない resource を参照している
  • workflow.serviceroutes[].service が存在しない service を参照している
  • mcpServersendpointroute の両方が空

確認方法

bash
takos deploy validate

CLI は repo-local .takos/app.yml を読み、現在の parser と同じ contract で validation します。