CtrlK
BlogDocsLog inGet started
Tessl Logo
PluginPublic

tessl/factory-setup

Set up, understand, and change a Tessl factory on a repository: pick automations that fit how you work, such as shipping tickets as pull requests, answering reviews and fixing checks on those pull requests, code review, and scheduled jobs; prepare the repository for agents; write issues for the factory to build; then see what the factory has done, find out why a run failed or never started, and change or extend it.

Quality

90%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide
SecuritybySnyk

Medium

Suggest reviewing before use

Overview
Quality
Evals
Security
Files

repositories.mdskills/factory-setup/references/

Which repositories the factory works on

The factory has one home repository, the project's. Its Loops can also reach additional repositories. Environments carry that access: an environment lists the repositories its runs can reach. The project's default environment also decides which additional repositories' GitHub events reach the project. Nothing about it goes in tessl.json, and no commit or pull request is needed.

The choice

This is part of the existing setup conversation, not a separate flow.

  • Capability first. Before you offer any repository choice, including a home other than the current repository, read multiRepo as What the plan says does, and say what the organization can do. enabled and canGrant belong to the organization, so before a new project exists read them from the plan of a project the organization already has. When no plan can be read, say the choice is unknown until the project exists; do not offer it before then.
  • The home. The current repository, unless the person wants the factory to work on more than one repository and the project is new. Then do not assume the home is one of the product repositories: say in a sentence that a product repository keeps setup close to that code, and a dedicated factory repository keeps cross-repo automation separate but adds another repository to manage, and let them choose. Offer a new private dedicated repository next to an existing one; see A new dedicated home. Never change the home of an existing project; that is a new project. Adding or removing the repositories it works on is change-factory. Write nothing into any repository to record the choice.
  • Ask which repositories the factory should work on, in the same breath as the other setup choices, and offer "just this one" first. Suggest additional repositories only when what you read supports it (for example, the code imports, deploys or documents another repository in the same account). A suggestion is not a limit: the person can name others. Never grant every repository the person can reach.
  • Read back the final list, say it is the access the factory's runs get, and wait for a yes before you call the setup.
  • Ask nothing when the person chose only the home repository, and do not raise the topic when multiRepo.enabled is false and nobody asked.
  • Code Review on the added repositories is a separate choice, made after setup as Code Review says: access for the factory is not consent to review.

A new dedicated home

Offer this only when the person wants more than one repository, the project is new, and multiRepo.enabled is true (and canGrant, when the person is not an org admin: otherwise say an org admin must set it up). When enabled is false, say multi-repository setup is not available for the organization and do not offer a dedicated home.

  • Create it with the tooling already authenticated on the machine, such as gh repo create. Add no Tessl API for it.
  • Before creating anything, state the owner, the name and that it will be private, and wait for a yes. Suggest the owner of the working repositories and a name such as <product>-factory; the person can change either.
  • When the person declines or does not answer, create nothing: offer an existing repository or a home-only setup instead.
  • After creating it, verify it exists, is private and is reachable (gh repo view <owner>/<name> --json visibility). When that fails, say what failed and stop; never go on with an unverified home.
  • A new repository is empty on GitHub: deal with that as for any empty repository, then continue with the working repositories, tracker confirmation and Code Review choices as usual.
  • Single-repository setup is unchanged: the current repository is the home and this section does not come up.

What the plan says

Read data.attributes.multiRepo from the plan. The API enforces every rule; use the plan to decide what to say.

  • enabled false: the organization does not have the feature, so the factory works on its home repository only. When the person explicitly wants additional repositories, say setup of that kind is not available for the organization and stop; do not set up a single-repository factory instead unless they then ask for that. state and conflict mean nothing then: fresh does not show the project has no shared configuration.
  • enabled true and canGrant false: choosing additional repositories needs environment.write on the organization. Tell the person an org admin has to do it, or has to be the one to set it up.
  • enabled true and state is shared or conflict: the project already has a shared default or environments of its own. Tell the person what environmentName, repositories and conflict report, and that setup will not replace or widen them. Then judge whether it fits, as When the project default does not fit says.

When the project default does not fit

Judge the default against the repositories the person chose for the first Loops, from what the records show; do not guess.

  • With state shared, repositories lists what the default reaches; a chosen repository missing from it is a gap. The plan shows no access level: read the default's githubAccess and linearAccess with tessl environment view <environmentName> --json, and name a permission gap only when that read or a setup refusal shows one. When the read fails, say its access is unknown, not that it fits.
  • With state conflict, repositories is always empty and says nothing; the conflict message is the gap. Setup refuses any additional repository while it stands.

Then:

  • It fits. It reaches every chosen repository and gives each Loop the access it needs. Reuse it as it is, say so in a sentence, and ask nothing more.
  • It does not fit. Name the gap: the repository it cannot reach, or the permission a Loop needs and the default lacks. Do not say only that it conflicts. Setup refuses a chosen repository the default does not list, a default whose access differs from what setup gives the Loops that share it, whichever repositories are chosen, and any additional repository while state is conflict. Never send the setup call with the gap in it; choosing fewer repositories clears only a repository gap.
    • Only one Loop needs another repository. With state shared and the default's access fitting, offer an environment for that Loop alone and leave the default and every other Loop as they are. Setup cannot choose a Loop's environment: run setup with only the repositories the default already lists, say which chosen ones wait until then, and after setup give that Loop its environment through change-factory.
    • The whole factory needs more, or the default's access differs. Offer to update the default instead. Before asking, read the environment as change-factory's repository change does, and tell the person which Loops inherit it, which other projects share it (boundProjects), and what changes in Works on and Listens to, or in its GitHub or Linear access. Change nothing without a yes that names those Loops and projects. On a yes, make the edit first through change-factory: its repository change for a missing repository, its access change for differing access. Then read the plan and the environment again, and run setup with the full choice only once the plan is shared, lists every chosen repository, and the access matches.
    • With state conflict, no edit of an environment's repositories or access clears it: it comes from what the project is already configured with, such as a default that is not the factory's or Loops that run without one. Say plainly that setup cannot include the other chosen repositories while it stands, and name the conflict message as what blocks them. Offer to run setup with only the project's repository, and do not promise that a later change will add the others: with conflict there may be no default for change-factory to edit.
  • Declined, or the agent cannot make the change (no environment.write on the organization, a refusal): change nothing. Say why, and give the safe next step: an org admin edits the environment in the web app (Settings, Environments), or the person continues with the default as it is.
  • An environment a Loop names itself is an explicit override. Never widen, narrow or replace it as part of this; it may differ on purpose.

This is only the setup conversation. Make no environment write from this section; an edit goes through change-factory. Do not grant repositories in bulk or expand access without a yes.

The setup call

Keep every call in the region Regional setup selected. When the plan has no multiRepo object there and the person chose additional repositories, report that the feature is not available in that region instead of trying the POST. Home-only setup goes ahead as usual.

Add "additionalRepositories": ["<owner>/<name>", ...] to the POST body only when the person chose additional repositories, listing only those; the home is always included. Omit the field otherwise, even as [], because the API refuses it when the feature is off. Everything else in the body stays as Ticket to PR says. The repositories must be private or internal, in the home's GitHub account, and reachable by the Tessl App.

Tell the person what you observe in the answer and the Loops list, such as which Loops were created, and nothing more. Do not say a cross-repo ticket works, and do not say Code Review covers an added repository until Code Review has shown it on.

Refusals, in plain words:

  • Only an organization admin can choose repositories: ask an org admin.
  • A repository is public, not visible to the Tessl App, or not in the home's account: name it and ask whether to drop it or fix its access.
  • An existing default, environment or live Loop would change: it is left as it is; point to the web app environment editor or change-factory.

README.md

tile.json