gg_one library

Classes

AddGitOnlyVersionTag
Tags HEAD with the next version for a project without a manifest — the git-only counterpart to gg_version.AddVersionTag. The version lives exclusively in git tags: the next version is the latest version tag plus VersionIncrement; without any tag the first version is 0.0.1 (patch). Idempotent: a HEAD that already carries a version tag is left untouched.
AddTypeScriptVersionTag
Tags HEAD with the version field of a TS package.json — the TS counterpart to gg_version.AddVersionTag. Idempotent.
Analyze
Runs static analysis on the source code, dispatching to the right Analyzer based on the detected ProjectType.
Analyzer
Runs static analysis for a specific project type.
Build
Builds a cross-language bridge repo before the other checks run.
Can
Various checks for the source code
CanCheckout
Are the current changes ready for checking out a new branch?
CanCommit
Are the last changes ready for »git commit«?
CanMerge
Are the last changes ready to be merged?
CanPublish
Are the last changes ready to be published?
CanPush
Are the last changes ready for »git push«?
CanUpgrade
Is the package ready to get a dependeny upgrade?
CheckPackageJsonScripts
Checks that a TypeScript project's package.json declares every npm script gg relies on and wires them into the expected publish chain (prepublishOnlybuildtest):
Checks
Dependencies for the check command
CommandCluster
A cluster of commands that is run in sequence
CommitMessage
A commit message split into the summary line and its detail lines.
Create
Groups commands for creating new development artifacts.
CreatePullRequest
Opens the pull request of the current feature branch and returns its url.
CreateTicket
Creates a ticket branch while preserving local changes.
DartAnalyzer
Runs the catalog analyze command on a Dart or Flutter package.
DartFormatter
Runs dart format on a Dart or Flutter package.
DefaultInteractAdapter
Default implementation of InteractAdapter that delegates to interact.
DepsOfCan
Dependencies for the check command
DepsOfCreate
Dependencies for the create command.
DepsOfDid
Dependencies for the check command
DepsOfDidUpgrade
Dependencies for the did upgrade command.
DepsOfDo
Dependencies for the check command
DepsOfDoUpgrade
Dependencies for the do upgrade command.
Did
Various checks for the source code
DidCommand
Base class for all did commands
DidCommit
Are all changes committed?
DidPublish
Is the current state published?
DidPush
Are all changes pushed to the remote repository?
DidUpgrade
Groups the things whose upgrade can be checked.
DidUpgradeDependencies
Are the dependencies of the package upgraded?
Do
Various checks for the source code
DoCommit
Does a commit of the current directory.
DoConfigurePublish
Interactively builds the .gg/publish_config.json of the current repository: version increment (patch/minor/major) plus merge message. gg do publish runs this automatically when it is started without a configuration, so every interactive decision is made up front — the sibling .gg/publish_state.json then collects the per-step publish progress and both are removed after a fully successful publish.
DoPublish
Publishes the current directory.
DoPush
Pushes the current state.
DoUpgrade
Groups the things a repository can upgrade.
DoUpgradeDeps
Upgrades all dependencies of the package — every ecosystem it has.
EnsureGgJsonNotIgnored
Makes sure no gitignore rule excludes .gg/gg.json.
EnsurePublishConfigIgnored
Makes sure the files a publish writes beside the release are listed in a repository's .gitignore: the runtime publish file .gg/gg-publish.json and the pubspec_overrides.yaml backup at pubspecOverridesBackupPath.
Format
Applies formatting to the source code, dispatching to the right Formatter based on the detected ProjectType.
Formatter
Applies formatting rules to a project's source code.
Gg
The command line interface for gg_one
GgPrompts
Asks the user a question on the terminal.
GgState
Stores and retrieves the state of the check commands
GgSystemCommit
Writes gg's bookkeeping commits — and nothing but bookkeeping.
GgSystemCommitResult
What GgSystemCommit.commit did.
Info
Inform about the repo
InteractAdapter
Abstraction over interactive selection used by VersionSelector.
MergeFlow
Performs the merge operation.
MockAddGitOnlyVersionTag
Mock for AddGitOnlyVersionTag.
MockAddTypeScriptVersionTag
Mock for AddTypeScriptVersionTag.
MockAnalyze
A mocktail mock.
MockAnalyzer
A mocktail mock.
MockBuild
A mocktail mock.
MockCanCheckout
A mocktail mock
MockCanCommit
A mocktail mock
MockCanMerge
A mocktail mock
MockCanPublish
A mocktail mock
MockCanPush
A mocktail mock
MockCanUpgrade
A mocktail mock
MockCheckPackageJsonScripts
A mocktail mock.
MockCreatePullRequest
Mock for CreatePullRequest.
MockCreateTicket
Mock for CreateTicket.
MockDidCommand
Mock for DidCommand
MockDidCommit
Mock for DidCommit
MockDidPublish
Mock for DidPublish
MockDidPush
Mock for DidPush
MockDidUpgradeDependencies
Mock for DidUpgradeDependencies
MockDoCommit
Mock for DoCommit.
MockDoConfigurePublish
Mock for DoConfigurePublish.
MockDoPublish
Mock for DoPublish.
MockDoPush
Mock for DoPush.
MockDoUpgradeDeps
Mock for DoUpgradeDeps.
MockEnsureGgJsonNotIgnored
Mock for EnsureGgJsonNotIgnored.
MockEnsurePublishConfigIgnored
Mock for EnsurePublishConfigIgnored.
MockFormat
A mocktail mock.
MockFormatter
A mocktail mock.
MockGgState
Mock for GgState
MockGgSystemCommit
Mocktail mock
MockMergeFlow
Mock for MergeFlow.
MockNoPubspecOverrides
A mocktail mock.
MockNpmLoggedIn
A mocktail mock.
MockPana
A mocktail mock
MockPubGetOffline
A mocktail mock.
MockVersionSelector
A Mock for the VersionSelector class using Mocktail
NoPubspecOverrides
Checks that the package has no pubspec_overrides.yaml redirecting a dependency to a local path.
NpmLoggedIn
Checks that the user is authenticated with the registry a TypeScript package publishes to, before the package is published.
OptionalPana
Runs pana unless the panaOption of exec turns it off.
Pana
Runs dart pana on the source code
PubGetOffline
Runs dart pub get --offline (or the Flutter equivalent) so that pubspec.lock matches pubspec.yaml before the other checks run.
PublishConfig
In-memory representation of a .gg-publish.json config file. Top-level version_increment / merge_message are defaults. Entries under repos.<name> override the defaults per repo.
PublishState
The progress of a publish run — everything that is state, never an answer the user or the AI gave.
RepoOverride
Per-repo override block within a PublishConfig. The version_increment and merge_message fields may be null, in which case the top-level default applies. status is a runtime progress marker written during a publish run.
RepoPublishConfig
The answers that drive a repository's commits and its release — the file the AI maintains while it works.
ResolvedPublishValues
Returned by PublishConfig.forRepo (and used directly in single-repo scenarios). Both fields are present and validated when this is constructed — the caller may treat them as authoritative inputs to a publish run.
TypeScriptAnalyzer
Runs TypeScript static analysis.
TypeScriptFormatter
Formats a TypeScript project — but only when the project opts in.
VersionSelector
Lets the user interactively select the next version increment.

Enums

ProjectType
The kind of project gg is operating on.
TypeScriptPackageManager
The JavaScript/TypeScript package manager in use by a project.

Extensions

ProjectTypeX on ProjectType
Convenience predicates on ProjectType.

Constants

allowedPublishStatuses → const Set<String>
Allowed values for the per-repo status progress marker written into a .gg-publish.json file while gg_multi do publish runs. published means the repo finished publishing and may be skipped on a --continue re-run; skipped means the run decided the repo does not need a release (no breaking dependency bump and no manual changes) and left it untouched; pending/failed mean it still has to be (re-)published.
allowedPublishSteps → const Set<String>
Every done_steps entry that may appear in a .gg-publish.json file, including the ones only older gg versions wrote.
allowedReleaseChannels → const Set<String>
Allowed values for channel in a .gg-publish.json file. stable (the default when the field is missing) is a regular release; rc publishes the next X.Y.Z-rc.N prerelease of the target version.
allowedVersionIncrements → const Set<String>
Allowed values for version_increment in a .gg-publish.json file.
buildMustRunScript → const String
The script that the build script must run, so the test suite always runs as part of a build.
buildPreScript → const String
npm runs this script automatically right before build. Running the tests there satisfies the buildtest rule just as well.
codeWorkspaceExtension → const String
The extension of the VS Code workspace file of a ticket folder (<root>/tickets/<ticket>/<ticket>.code-workspace).
colorOff → const String
SGR sequence switching the terminal back to its default colors.
ggCommitPrefix → const String
Every commit message gg generates itself starts with this prefix.
ggDirName → const String
The directory name that holds gg's own state — owned at any depth.
ggMergeBackPrefix → const String
The message prefix of the merge that folds the released default branch back into the feature branch after a publish.
legacyGgCommitMessages → const Set<String>
Commit subjects gg versions before ggCommitPrefix created on a feature branch.
legacyMasterFolderName → const String
The former name of oceanFolderName. Still guarded so a workspace that the tool has not auto-renamed yet keeps its protection.
legacyPublishRegistryStep → const String
The single registry step older gg versions recorded.
legacyPublishSteps → const Set<String>
Step names only older gg versions wrote.
maxCommitMessageFirstLineLength → const int
The maximum length of a commit message's first line.
oceanFolderName → const String
The name of the folder holding the pristine clones of a gg workspace.
panaOption → const String
The DirCommand.exec option deciding whether pana is run.
pnpmWorkspaceBackupPath → const String
Where a publish keeps the pnpm-workspace.yaml of a TypeScript repo.
prepublishMustRunScript → const String
The script that the publish-lifecycle script must run, so a fresh build (which in turn runs the tests) always precedes a publish.
prepublishScriptNames → const List<String>
The publish-lifecycle script that must reach build. npm's modern name is prepublishOnly; the deprecated prepublish is accepted as an equivalent. Exactly one of these must be present (unless the package is private).
publishConfigRootKey → const String
The root key every publish_config.json wraps its content in.
publishStateFileName → const String
The name of the file holding the progress of a publish run.
pubspecOverridesBackupPath → const String
Where a publish keeps the pubspec_overrides.yaml it has to delete.
repoPublishConfigFileName → const String
The name of the file holding the answered publish inputs of a repository.
requiredNpmScripts → const List<String>
The npm scripts every TypeScript project must declare in its package.json.
requiredNpmScriptsWithoutTypeScript → const List<String>
The npm scripts required of a project that ships no TypeScript sources — a hybrid without a tsconfig.json.
ticketJsonFileName → const String
The name of the ticket description file gg_multi writes into a ticket folder (<root>/tickets/<ticket>/ticket.json).
writablePublishSteps → const Set<String>
The repo-level done_steps entries a current run may record.

Properties

continueConflictMessage String
The message shown when --continue is combined with a flag that would discard the very progress it resumes.
final
emptyRepoPublishFiles RepoPublishFiles
An empty pair — the answer for a repository nothing has been recorded for.
no setter
ggOwnedFileNames Set<String>
File names gg's bookkeeping owns, matched by their basename.
final
ggOwnedPathPatterns List<RegExp>
Generated files whose name derives from the package name, so no fixed list can hold them.
final
ggOwnedRootFiles Set<String>
Files gg owns only at the repository root, matched by their full repo-relative path.
final

Functions

backupPubspecOverrides(Directory directory) bool
Saves the workspace wiring files of directory so they can be restored after the publish: pubspec_overrides.yaml to pubspecOverridesBackupPath and pnpm-workspace.yaml to pnpmWorkspaceBackupPath.
checkProjectType(Directory directory) ProjectType
The ProjectType that gg's check pipeline (analyze / format / tests) should use for directory.
colorizeSuggestion(String suggestion) String
Colorizes a suggestion like »Not committed yet. Please run »gg do commit«.« — the prose becomes yellow (cAction), the commands the guillemets mark become blue (cCmd), and the guillemets themselves are dropped.
defaultHasTerminal() bool
The real check, asking the process' stdin.
detectProjectType(Directory directory) ProjectType
Detects the ProjectType of directory — which manifest the directory carries, not which pipeline gg should run on it. For the latter, use checkProjectType.
detectTypeScriptPackageManager(Directory directory) TypeScriptPackageManager
Detects the TypeScriptPackageManager of directory by looking at the lockfiles present. Falls back to TypeScriptPackageManager.npm.
isBridgeProject(Directory directory) bool
Former name of isHybridProject, kept so callers keep compiling.
isGgGenerated(String subject) bool
Whether subject is a commit message gg generated itself.
isGgOwnedPath(String repoRelativePath) bool
Whether repoRelativePath — as git prints it, with forward slashes — belongs to gg's own bookkeeping.
isInOceanFolder(Directory directory) bool
Returns true when directory lies inside the workspace's ocean folder.
isLockFile(String file) bool
Whether file is a dependency lock file — pubspec.lock or one of the TypeScript package managers' lock files.
isLockFileOnlyDrift(String status) bool
Whether status — a git status --porcelain output — reports changes and every one of them is a lock file.
isWorkspaceFolder(Directory directory) bool
Returns true when directory is a ticket workspace folder rather than a repository.
legacyPublishConfigFile(Directory repoDir) File
The legacy <repo>/.gg/gg-publish.json, migrating the even older dot-prefixed .gg/.gg-publish.json name on the way.
loadRepoPublishFiles(Directory repoDir) RepoPublishFiles
Reads the publish files of the repository at repoDir.
lockFileFor(Directory directory) String
Returns the dependency lock file name for the project in directory.
lockFilesInStatus(String status) List<String>
The lock files reported as changed in the git status --porcelain output status, in the order git listed them.
parseReleaseChannel(String channel) → ReleaseChannel
Maps a release channel string to its ReleaseChannel enum value. Throws ArgumentError for unknown strings; validate earlier via allowedReleaseChannels.
parseVersionIncrement(String increment) → VersionIncrement
Maps a version increment string to its VersionIncrement enum value. Throws ArgumentError for unknown strings; validate earlier via allowedVersionIncrements.
publishRegistryStep(PublishTarget target) String
The done_steps marker recording that the upload to target finished.
publishStateFile(Directory dir) File
The publish_state.json of the repository or ticket at dir.
readRepositoryUrl(Directory directory) Future<String>
Reads the canonical repository URL of the project at directory.
readTicketDescription(Directory ticketDir) String?
Reads the ticket description from <ticketDir>/ticket.json, or returns null when the file is missing, is not a JSON object, is malformed, or carries an empty description.
readTicketDescriptionForRepo(Directory repoDir) String?
Reads the ticket description for the repository at repoDir, or null when the repository is not part of a ticket.
repoPublishConfigFile(Directory repoDir) File
The publish_config.json of the repository at repoDir.
restorePubspecOverrides(Directory directory) bool
Restores the workspace wiring files of directory from their backups and deletes the backups.
throwWhenInOceanFolder(Directory directory) → void
Throws when directory lies inside the workspace's ocean folder.
throwWhenInWorkspaceFolder(Directory directory) → void
Throws when directory is a ticket workspace folder.
throwWhenNotATerminal(String what, String alternative, {HasTerminal hasTerminal = defaultHasTerminal}) → void
Throws when stdin is not a terminal, so headless runs (CI, scripts, pipes) fail fast with an actionable message instead of hanging forever on an interactive prompt.
unfinishedPublishMessage({required String path, required String command}) String
The message shown when a leftover .gg-publish.json still carries the progress of an unfinished run.

Typedefs

ConfirmDeleteFeatureBranch = Future<bool> Function(String branchName)
Typedef for confirming feature branch deletion.
EditMessage = Future<String?> Function(String initialMessage)
Typedef for editing the merge message interactively.
HasTerminal = bool Function()
Signature of the check whether stdin is attached to a terminal.
RepoPublishFiles = ({RepoPublishConfig config, PublishState state})
The answers and the run progress of one repository, as read from disk.
UserCommitMessageBuilder = FutureOr<String?> Function(Directory repo)
Produces the message for the commit that saves the user changes gg found in the working tree when it was about to write a bookkeeping commit.

Exceptions / Errors

GgPromptsUnsupportedError
Thrown when gg wants to ask the user something but the platform it runs on cannot draw prompts and no embedder has supplied any.