gg_one_core library

Classes

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.
CheckPackageJsonScripts
Checks that a TypeScript project's package.json declares every npm script gg relies on and wires them into the expected publish chain (prepublishOnly → build → test):
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.
ContributedCommits
Tells manual work from gg's own bookkeeping in the commits a ticket contributes.
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.
DidCommand
Base class for all did commands
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.
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.
ExternalEditor
Opens a text in the editor of the user and waits until it is closed.
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.
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.
InteractAdapter
Abstraction over interactive selection used by VersionSelector.
Jsonc
Reads JSON with comments (.jsonc), the format of the files gg lets the user edit.
MessageSheet
The commit messages, merge messages and version increments of several repositories as one file the user edits in their editor — instead of one prompt per question and repository.
MessageSheetEntry
What a MessageSheet lets the user edit for one repository.
MockAnalyze
A mocktail mock.
MockAnalyzer
A mocktail mock.
MockBuild
A mocktail mock.
MockCheckPackageJsonScripts
A mocktail mock.
MockContributedCommits
Mocktail mock
MockDidCommand
Mock for DidCommand
MockDoConfigurePublish
Mock for DoConfigurePublish.
MockEnsureGgJsonNotIgnored
Mock for EnsureGgJsonNotIgnored.
MockEnsurePublishConfigIgnored
Mock for EnsurePublishConfigIgnored.
MockFormat
A mocktail mock.
MockFormatter
A mocktail mock.
MockGgState
Mock for GgState
MockGgSystemCommit
Mocktail mock
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.
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.

Extensions

CommitSheetAnswers on RepoPublishConfig
Records what gg do commit learned about a repository.

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 build → test rule just as well.
colorOff → const String
SGR sequence switching the terminal back to its default colors.
dnaManifestPath → const String
The manifest of a DNA run, relative to the repository root. It lists the instances the run generated. Mirrors helix's dnaGeneratedPath.
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.
ggGeneratedDnaMessage → const String
The message helix commits the files of a DNA run with.
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.
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 length a commit message's first line was once limited to.
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.
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.
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.
commitSheetEntry({required String repo, required RepoPublishConfig? config, required String description}) → MessageSheetEntry
The entry gg do commit shows for repo on a MessageSheet.
defaultEditText({required String prompt, required String text, required String fileName}) → Future<String?>
The default EditText: whatever GgPrompts.current offers.
defaultHasTerminal() → bool
Whether stdin alone is a terminal. Kept for old callers; prompts take stdioHasTerminal, since stdin alone does not show who reads along.
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.
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.
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.
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.
stdioHasTerminal() → bool
Whether a user can answer: stdin to read and stdout to draw on. On Windows stdin reports a terminal even when nobody sees the output.
throwWhenNotATerminal(String what, String alternative, {HasTerminal hasTerminal = stdioHasTerminal}) → void
Throws when stdin or stdout 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.
EditorLaunch = ({String executable, bool runInShell})
How an editor is started: the executable handed to the operating system and whether it needs a shell.
EditText = Future<String?> Function({required String fileName, required String prompt, required String text})
Lets the user edit a whole text in an editor; null when there is none. GgPrompts.editText by default.
FindExecutable = String? Function(String name)
Returns the path of name on the PATH, or null when it is not there.
HasTerminal = bool Function()
Signature of the check whether a user can answer on the terminal.
RepoPublishFiles = ({RepoPublishConfig config, PublishState state})
The answers and the run progress of one repository, as read from disk.
StartEditor = Future<int> Function(String executable, List<String> arguments, {required bool runInShell})
Starts executable with arguments attached to the terminal and returns its exit code once it ends. runInShell starts it through the shell.
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.