From a8ad1ba752e5a5c6bd67953031ae0510dc03d88f Mon Sep 17 00:00:00 2001 From: Ramesh Padmanabhaiah Date: Sun, 14 Jun 2026 19:09:08 -0700 Subject: [PATCH] feat: generate AGPL repo licenses --- CHANGELOG.md | 2 + README.md | 2 +- cli/bash/commands/basectl/subcommands/repo.sh | 48 ++++++++++--------- cli/bash/commands/basectl/tests/repo.bats | 7 ++- 4 files changed, 33 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 72ce4a1..ab103a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,8 @@ and Base versions are tracked in the repo-root `VERSION` file. ### Changed +- Made `basectl repo init` generate AGPL-3.0-or-later licenses for new + repositories. - Relicensed Base prospectively from MIT to AGPL-3.0-or-later. - Aligned bootstrap and installer candidate-list splitting with the scoped `IFS=: read -ra` Bash pattern. diff --git a/README.md b/README.md index 990043b..b65708b 100644 --- a/README.md +++ b/README.md @@ -428,7 +428,7 @@ basectl repo init example --repo codeforester/example ``` This creates the local repository baseline: README, version, changelog, -contributing guide, MIT license, `.gitignore`, `base_manifest.yaml`, a +contributing guide, AGPL-3.0-or-later license, `.gitignore`, `base_manifest.yaml`, a `tests/validate.sh` contract, and a GitHub Actions workflow that runs it. By default, `repo init` creates the repository under `workspace.root` from `~/.base.d/config.yaml`; if that is not configured, it falls back to the parent diff --git a/cli/bash/commands/basectl/subcommands/repo.sh b/cli/bash/commands/basectl/subcommands/repo.sh index 194fff4..78e35d2 100644 --- a/cli/bash/commands/basectl/subcommands/repo.sh +++ b/cli/bash/commands/basectl/subcommands/repo.sh @@ -54,7 +54,7 @@ Options: --repo GitHub repository to configure. --pr Commit the generated baseline on a branch and open a pull request. --description Repository description for generated README. - --copyright-holder Copyright holder for generated LICENSE. Defaults to git config user.name. + --copyright-holder Copyright holder for generated AGPL license. Defaults to git config user.name. --private Create a private GitHub repository when needed. This is the default. --public Create a public GitHub repository when needed. --no-configure Skip GitHub configuration during repo init. @@ -740,32 +740,34 @@ base_repo_write_license() { local copyright_holder="$2" local dry_run="$1" local root="$3" + local source_license="${BASE_HOME:-}/LICENSE" local year + [[ -f "$source_license" ]] || { + log_error "Base AGPL license text '$source_license' was not found." + return 1 + } + year="$(base_repo_baseline_year)" - base_repo_write_stream "$dry_run" "$root/LICENSE" <. EOF + printf '\n' + cat "$source_license" + } | base_repo_write_stream "$dry_run" "$root/LICENSE" } base_repo_write_gitignore() { diff --git a/cli/bash/commands/basectl/tests/repo.bats b/cli/bash/commands/basectl/tests/repo.bats index d970f2b..948a13a 100644 --- a/cli/bash/commands/basectl/tests/repo.bats +++ b/cli/bash/commands/basectl/tests/repo.bats @@ -313,6 +313,7 @@ load ./basectl_helpers.bash grep -Fq "## Checklist" "$repo_dir/.github/pull_request_template.md" grep -Fq "CHANGELOG is updated for notable user-visible or release-worthy changes." "$repo_dir/.github/pull_request_template.md" ! grep -Fq "Demo Impact" "$repo_dir/.github/pull_request_template.md" + grep -Fq "GNU Affero General Public License" "$repo_dir/LICENSE" run bash -c 'cd "$1" && ./tests/validate.sh' _ "$repo_dir" [ "$status" -eq 0 ] @@ -338,7 +339,8 @@ EOF "$BASE_REPO_ROOT/bin/basectl" repo init git-owner --path "$repo_dir" --no-configure [ "$status" -eq 0 ] - grep -Fq "Copyright (c) $(date +%Y) Ada Lovelace" "$repo_dir/LICENSE" + grep -Fq "Copyright (C) $(date +%Y) Ada Lovelace" "$repo_dir/LICENSE" + grep -Fq "GNU Affero General Public License as published by" "$repo_dir/LICENSE" } @test "basectl repo init falls back to system username for copyright holder" { @@ -358,7 +360,8 @@ EOF "$BASE_REPO_ROOT/bin/basectl" repo init system-owner --path "$repo_dir" --no-configure [ "$status" -eq 0 ] - grep -Fq "Copyright (c) $(date +%Y) $username" "$repo_dir/LICENSE" + grep -Fq "Copyright (C) $(date +%Y) $username" "$repo_dir/LICENSE" + grep -Fq "GNU Affero General Public License as published by" "$repo_dir/LICENSE" } @test "basectl repo init leaves existing files unchanged" {