| namespace | aiwg |
| name | aiwg-regenerate |
| platforms | ["all"] |
| kernel | true |
| description | Select and execute the canonical refresh, existing-project extraction, or legacy AIWG context regeneration branch |
| script | {"entrypoint":"run.sh","runtime":"bash","cwd":"project-root","argsHint":"[--workspace|--existing-project|--full-inject] [--provider <name>] [--dry-run|--apply] [--force]"} |
Regenerate Context — Branch Selector
The CLI is the deterministic source of truth for context regeneration. The
selector is intentionally intelligent: an unqualified aiwg-regenerate
invocation routes an established, not-yet-extracted repository through preview
and transactional adoption; fresh or already-adopted projects route to the
canonical refresh. Do not make users choose a branch unless they want to
override that decision.
Select and load exactly one linked branch before execution:
- Canonical workspace graph — default
refresh for new and already-migrated projects.
- Existing-project extraction —
transactional adoption of stable project metadata and provider context into
the canonical graph; preview is the default and
--apply is explicit.
- Legacy full injection — compatibility
branch; embeds normalized AIWG context inside the provider startup file.
Commands
aiwg run skill aiwg-regenerate
aiwg regenerate --workspace [--provider <name>] [--dry-run] [--force]
aiwg regenerate --existing-project [--provider <name>] [--dry-run|--apply]
aiwg regenerate --full-inject [--provider <name>] [--dry-run]
--legacy aliases --full-inject. The CLI rejects conflicting branches,
unknown options, and missing provider values with usage status.
--existing-project rejects --force and all --no-*-md partial-write flags.
It refuses possible credentials and ambiguous directive conflicts, previews the
exact extracted block and transaction targets, and prints the rollback command
after apply.
Explicit branch flags always win. Without one, the executable selector checks
for stable project signals (package.json, common language manifests, or a
README) and the project-extraction marker. A first-time established project is
previewed and then applied; an already-extracted or fresh project uses
--workspace. Passing only --dry-run keeps inferred adoption read-only.
Supported shared controls are --dry-run, --provider <name>, --force,
--no-aiwg-md, --no-agents-md, and --no-workspace-md. The last option is
implicit in legacy mode.
Execution Contract
- For an established project, preview the selected branch first.
- Preserve operator-authored content outside managed regions.
- Never copy possible credentials into generated context.
- Execute with
aiwg run skill aiwg-regenerate -- <flags> when the provider
supports executable skills, or run the equivalent aiwg regenerate command.
- Report the selected branch, provider, changed targets, backups, warnings,
validation result, and rollback path.
Use aiwg refresh instead when frameworks, agents, skills, rules, commands, or
provider deployments also need to be updated.