7.9 KiB
7.9 KiB
Operation Contract
Metadata
| Key | Value |
|---|---|
| ID | OC-001 |
| CrossReference | SSD-001, DM-001, SD-001 |
Version History
| Date | Status | Author | Reviewer | Change | Commit |
|---|---|---|---|---|---|
| 2026-10-06 | Accepted | Jens Tirsvad Nielsen | S02 | Credentials asked when missing; EnvFile created in the local project (P14); writeEnvFile parameter | ded26a6 |
| 2026-10-06 | Proposed | Jens Tirsvad Nielsen | S02 | P2, P4 and an exception: the license that applies, not always AGPL-3.0 | d773fa9 |
Concepts below use the IT terms of DICT-001 for the PO concepts of DM-001. Run, ToolCheck, PreflightResult and PromptSet are system concepts with no PO term and are not in the Domain Model.
Contract: startProjectCreation
| Item | Value |
|---|---|
| Operation | startProjectCreation(): PromptSet |
| Traces to | startProjectCreation in SSD-001 |
| Concepts | Run, Configuration, ToolCheck |
Preconditions
- None; this is the first operation of a Run.
Postconditions
- P1. A
Runinstance was created. - P2. A
Configurationinstance was created fromconfig.envand.env, with every value validated (including the project details preset inconfig.env). ACredentialthat.envdid not provide was entered by the Maintainer without echo and validated; everyCredentialis held only in memory. - P3. A
ToolCheckinstance was created and associated with theRun, recording thatgitandcurlare present and whetherjqis present. - P4. The
Runwas associated with aPromptSetthat is returned.
Exceptions
| Condition (failing precondition) | Outcome |
|---|---|
config.env is missing, or a value in config.env or .env is malformed (a preset project detail included) |
The Run ends with an error naming the key, never its value; nothing was changed |
A Credential is missing and input ends before a valid one is entered |
The Run ends with an error naming the key; nothing was changed |
git or curl is missing |
The Run ends with an error naming the tool; nothing was changed |
Contract: provideProjectDetails
| Item | Value |
|---|---|
| Operation | provideProjectDetails(name: String, description: String, visibility: Visibility, giteaOwner: Owner, githubOwner: Owner [0..1], directory: Path, enablePlanGate: Boolean, writeEnvFile: Boolean): Summary |
| Traces to | provideProjectDetails in SSD-001 |
| Concepts | ProjectRequest, PreflightResult, GiteaRepository, GitHubRepository, LicenseFile, PushMirror, LocalProject, Remote, Submodule, HookSetup, EnvFile, Summary |
Preconditions
- A
Runexists and itsConfigurationis valid (fromstartProjectCreation). githubOwneris present exactly when the Maintainer chose GitHub.- The license that applies is not asked: it comes from the
Configuration(PROJECT_LICENSE) or follows the GitHub choice. - When
githubOwneris present, the GitHubCredentials are known: from.env, or entered by the Maintainer without echo and validated before the first request. - A detail that the
Configurationdefines is not asked: it is taken from theConfiguration.
Postconditions
- P1. A
ProjectRequestinstance was created with the attributes given by the Maintainer or defined by theConfiguration, and associated with theRun. - P2. A
PreflightResultinstance was created and associated with theProjectRequest, recording that each token needed for the chosen hosts works, that each owner accepts new repositories, that the name is free on the chosen hosts, that the license that applies is offered by Gitea (when a license applies), and the outcome of the SSH test to Gitea on port 10022. - P3. A
GiteaRepositoryinstance was created undergiteaOwnerwith the given name, description and visibility, and associated with theProjectRequest. - P4. If a license applies, a
LicenseFileinstance for it was created and associated with theGiteaRepository, so that repository is not empty. The license that applies is the one theConfigurationdefines (PROJECT_LICENSE;nonemeans none), otherwiseAGPL-3.0ifgithubOwneris present, otherwise none. If no license applies theGiteaRepositoryhas noLicenseFileand is empty. - P5. If
githubOwneris present, an emptyGitHubRepositoryinstance was created undergithubOwnerand associated with theProjectRequest. - P6. If
githubOwneris present, aPushMirrorinstance was created, associated with theGiteaRepositoryas source and theGitHubRepositoryas target, with its effective sync setting recorded, and a first sync was requested. - P7. A
LocalProjectinstance was created atdirectory, associated with theProjectRequest. If theGiteaRepositoryis not empty, theLocalProjectholds its history, including theLicenseFilecommit. - P8. A
Remotenamedoriginwas associated with theLocalProject, pointing at theGiteaRepositoryover SSH if the SSH test passed, otherwise over HTTPS, with no credential in its URL. - P9. If
githubOwneris present, aRemotenamedgithubwas associated with theLocalProject, pointing at theGitHubRepository, with no credential in its URL. - P10. A
Submodulenamedframeworkwas associated with theLocalProject. - P11. A
HookSetupinstance was associated with theLocalProject, recording that skills and git hooks were installed once and, ifenablePlanGate, that the plan gate was enabled. - P12.
AGENTS.mdanddocs/artifact-registry.mdexist in theLocalProject, each either newly copied from the framework templates or left as it was because the Maintainer declined to replace it. - P13. A
Summaryinstance was created listing every created item, every skipped item and the next step for anything that failed, and is returned. It contains no credential. - P14. If
writeEnvFile, anEnvFilenamed.envwas associated with theLocalProject, holding only theCredentials the project needs (the Gitea token, and the GitHub token and account name whengithubOwneris present). It is readable by its owner only and excluded from git without a change to any tracked file, and noCredentialis shown in any output. IfwriteEnvFileis false, noEnvFilewas created. An existing.envis left as it was unless the Maintainer agreed to replace it.
Exceptions
| Condition (failing precondition) | Outcome |
|---|---|
| A token is invalid, an owner refuses new repositories, or the name is taken on a chosen host (P2) | The Run ends before P3; nothing was created; the error names the failed check |
| A license applies and Gitea does not offer it (P2) | The Run ends before P3; nothing was created; the error names the license |
GiteaRepository creation fails after a GitHubRepository was created (P5, P3 ordering) |
The Summary lists the GitHubRepository as created, the GiteaRepository as failed and how to continue |
PushMirror creation fails (P6) |
The Summary lists both repositories as created, the mirror as failed and how to continue; the local steps are not run |
directory exists, or a target file exists, and the Maintainer declines replacing it (P7, P12) |
That item is skipped and listed in the Summary |
A .env already exists in the LocalProject and the Maintainer declines replacing it (P14) |
That item is skipped and listed in the Summary |
A different core.hooksPath exists and the Maintainer declines replacing it (P11) |
Hooks are not installed and this is listed in the Summary |
SSH to port 10022 fails and the Submodule cannot be added (P10) |
The Summary lists the repositories as created, the submodule as failed, and the SSH prerequisite |