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.jsondeclares 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
analyzecommand on a Dart or Flutter package. - DartFormatter
-
Runs
dart formaton 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.jsonof the current repository: version increment (patch/minor/major) plus merge message.gg do publishruns this automatically when it is started without a configuration, so every interactive decision is made up front — the sibling.gg/publish_state.jsonthen 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.jsonand thepubspec_overrides.yamlbackup 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.yamlredirecting 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 thatpubspec.lockmatchespubspec.yamlbefore the other checks run. - PublishConfig
-
In-memory representation of a
.gg-publish.jsonconfig file. Top-levelversion_increment/merge_messageare defaults. Entries underrepos.<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_incrementandmerge_messagefields 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 commitlearned about a repository.
Constants
-
allowedPublishStatuses
→ const Set<
String> -
Allowed values for the per-repo
statusprogress marker written into a.gg-publish.jsonfile whilegg_multi do publishruns.publishedmeans the repo finished publishing and may be skipped on a--continuere-run;skippedmeans the run decided the repo does not need a release (no breaking dependency bump and no manual changes) and left it untouched;pending/failedmean it still has to be (re-)published. -
allowedPublishSteps
→ const Set<
String> -
Every
done_stepsentry that may appear in a.gg-publish.jsonfile, including the ones only older gg versions wrote. -
allowedReleaseChannels
→ const Set<
String> -
Allowed values for
channelin a.gg-publish.jsonfile.stable(the default when the field is missing) is a regular release;rcpublishes the nextX.Y.Z-rc.Nprerelease of the target version. -
allowedVersionIncrements
→ const Set<
String> -
Allowed values for
version_incrementin a.gg-publish.jsonfile. - buildMustRunScript → const String
-
The script that the
buildscript 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 thebuild→testrule 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.yamlof 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 isprepublishOnly; the deprecatedprepublishis 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.jsonwraps 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.yamlit 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_stepsentries a current run may record.
Properties
- continueConflictMessage → String
-
The message shown when
--continueis 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
directoryso they can be restored after the publish:pubspec_overrides.yamlto pubspecOverridesBackupPath andpnpm-workspace.yamlto 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 commitshows forrepoon 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
subjectis 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.jsonname 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
ReleaseChannelenum value. Throws ArgumentError for unknown strings; validate earlier via allowedReleaseChannels. -
parseVersionIncrement(
String increment) → VersionIncrement -
Maps a version increment string to its
VersionIncrementenum value. Throws ArgumentError for unknown strings; validate earlier via allowedVersionIncrements. -
publishRegistryStep(
PublishTarget target) → String -
The
done_stepsmarker recording that the upload totargetfinished. -
publishStateFile(
Directory dir) → File -
The
publish_state.jsonof the repository or ticket atdir. -
readTicketDescription(
Directory ticketDir) → String? -
Reads the ticket description from
<ticketDir>/ticket.json, or returnsnullwhen 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, ornullwhen the repository is not part of a ticket. -
repoPublishConfigFile(
Directory repoDir) → File -
The
publish_config.jsonof the repository atrepoDir. -
restorePubspecOverrides(
Directory directory) → bool -
Restores the workspace wiring files of
directoryfrom 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.jsonstill 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
executablehanded 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
nameon thePATH, 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
executablewithargumentsattached to the terminal and returns its exit code once it ends.runInShellstarts 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.