packages feed

summoner 2.1.0.0 → 2.2.0.0

raw patch · 27 files changed

+114/−74 lines, 27 files

Files

CHANGELOG.md view
@@ -3,6 +3,14 @@ `summoner` uses [PVP Versioning][1]. The changelog is available [on GitHub][2]. +# 2.2.0.0 – Jan 16, 2026++* [#560](https://github.com/kowainik/summoner/issues/560):+  Allow configurations of the branch name.+* [#578](https://github.com/kowainik/summoner/pull/578):+  Replace usage of hub with `gh`.+* Roll back to GHC-9.12.2 as 9.12.3 has a major regression.+ ## 2.1.0.0 — Jan 6, 2026  * Support GHC-9.12.3. Use GHC-9.12.3 as the default version for
README.md view
@@ -235,7 +235,7 @@ To start using Summoner make sure that you have the following tools installed on your machine:  * [`git`](https://git-scm.com) ⩾ 2.28 – to initialize the GitHub repo.-* [`hub`](https://github.com/github/hub) – to upload the project to GitHub.+* [`gh`](https://github.com/cli/cli) – to upload the project to GitHub. * [`curl`](https://curl.haxx.se) – to download licenses.  We also have minimal version requirements for build tools:@@ -475,7 +475,7 @@ | `fullName`       | Text    | Full name.                                                                                                                                                           | | `email`          | Text    | E-mail address.                                                                                                                                                      | | `license`        | License | One of: `MIT`, `BSD2`, `BSD3`, `GPL-2`, `GPL-3`, `LGPL-2.1`, `LGPL-3`, `AGPL-3`, `Apache-2.0`, `MPL-2.0`, `None`.                                                    |-| `ghcVersions`    | [GHC]   | `summoner` uses default `GHC-9.12.3`. However, additionally you can specify other versions. For each version `x.y.z` the `stack-x.y.z.yaml` will be created. Use `summon show ghc` to see all supported GHC versions. |+| `ghcVersions`    | [GHC]   | `summoner` uses default `GHC-9.12.2`. However, additionally you can specify other versions. For each version `x.y.z` the `stack-x.y.z.yaml` will be created. Use `summon show ghc` to see all supported GHC versions. | | `github`         | Bool    | Turn on `GitHub` integration by default?                                                                                                                             | | `gitignore`      | [Text]  | List of files you want added to the default `.gitignore`. (Ignored if `github = false`)                                                                              | | `noUpload`       | Bool    | Do not upload to GitHub, but create all GitHub related files if specified (Ignored if `github = false`)                                                              |@@ -746,28 +746,25 @@  [[Back to the Table of Contents] ↑](#structure) -> I want to use HTTPS remote for the created GitHub project, but it creates SSH one. How should I fix this?--We are using `hub` tool to create the projects at GitHub. It uses SSH so that you would get the remote links in the following format:--```-git@github.com:user/repo.git-```+> I want to use SSH/HTTPS remote for the created GitHub project, but it creates the repository with the wrong protocol. How should I fix this? -We can not change or configure this behaviour, but there are several workarounds in case you _need_ to use HTTPS link for the remote.+We use the official Github CLI tool (`gh`) to create the projects on GitHub.  `gh` has its own configuration for+choosing HTTPS/SSH protocols. There are two options for configuring this: -1. Change the remote of the repository after its creation:-   ```-   git remote set-url origin https://github.com/user/repo.git-   ```-2. Change `hub` configurations globally. Simply run the following command:-   ```shell-   git config --global hub.protocol https-   ```-3. Alternatively, change `hub` configurations for a single session:-   ```-   export HUB_PROTOCOL="https"-   ```+- You can configure it permanently for the `gh` tool:+  ```shell+  # Set HTTPS as the default configuration+  gh config set git_protocol https+  # Set SSH as the default configuration+  gh config set git_protocol ssh+  ```+- You can adjusting the remote configuration after the repository is created locally with+  ```shell+  # Set HTTPS as the remote URL+  git remote set-url origin https://github.com/<OWNER>/<REPO>.git+  # Set SSH as the remote URL+  git remote set-url origin git@github.com:<OWNER>/<REPO>.git+  ```  <hr> 
examples/cabal-full/.github/workflows/ci.yml view
@@ -28,7 +28,7 @@           - "9.6.7"           - "9.8.4"           - "9.10.3"-          - "9.12.3"+          - "9.12.2"         exclude:           - os: macOS-latest             ghc: 9.10.3
examples/cabal-full/.travis.yml view
@@ -21,7 +21,7 @@   - ghc: 9.6.7   - ghc: 9.8.4   - ghc: 9.10.3-  - ghc: 9.12.3+  - ghc: 9.12.2  install:   # HLint check
examples/cabal-full/appveyor.yml view
@@ -21,12 +21,12 @@     CABOPTS: --store-dir=C:\\SR    matrix:-    - GHCVER: 9.12.3+    - GHCVER: 9.12.2  install:   - choco source add -n mistuke -s https://www.myget.org/F/mistuke/api/v2   - choco install -y cabal --version 3.6.2.0-  - choco install -y ghc   --version 9.12.3+  - choco install -y ghc   --version 9.12.2   - refreshenv  before_build:
examples/cabal-full/cabal-full.cabal view
@@ -26,7 +26,7 @@                      GHC == 9.6.7                      GHC == 9.8.4                      GHC == 9.10.3-                     GHC == 9.12.3+                     GHC == 9.12.2  source-repository head   type:                git
examples/cabal-minimal/cabal-minimal.cabal view
@@ -12,10 +12,10 @@ build-type:          Simple extra-doc-files:     README.md                      CHANGELOG.md-tested-with:         GHC == 9.12.3+tested-with:         GHC == 9.12.2  common common-options-  build-depends:       base ^>= 4.21.1.0+  build-depends:       base ^>= 4.21.0.0    ghc-options:         -Wall                        -Wcompat
examples/full-batteries/.github/workflows/ci.yml view
@@ -30,7 +30,7 @@           - "9.6.7"           - "9.8.4"           - "9.10.3"-          - "9.12.3"+          - "9.12.2"         exclude:           - os: macOS-latest             ghc: 9.10.3@@ -141,7 +141,7 @@           - "9.6.7"           - "9.8.4"           - "9.10.3"-          - "9.12.3"+          - "9.12.2"      steps:     - uses: actions/checkout@v4
examples/full-batteries/.travis.yml view
@@ -25,7 +25,7 @@   - ghc: 9.6.7   - ghc: 9.8.4   - ghc: 9.10.3-  - ghc: 9.12.3+  - ghc: 9.12.2    - ghc: 8.0.2     env: STACK_YAML="$TRAVIS_BUILD_DIR/stack-8.0.2.yaml"@@ -63,7 +63,7 @@   - ghc: 9.10.3     env: STACK_YAML="$TRAVIS_BUILD_DIR/stack-9.10.3.yaml" -  - ghc: 9.12.3+  - ghc: 9.12.2     env: STACK_YAML="$TRAVIS_BUILD_DIR/stack.yaml"    allow_failures:
examples/full-batteries/appveyor.yml view
@@ -21,12 +21,12 @@     CABOPTS: --store-dir=C:\\SR    matrix:-    - GHCVER: 9.12.3+    - GHCVER: 9.12.2  install:   - choco source add -n mistuke -s https://www.myget.org/F/mistuke/api/v2   - choco install -y cabal --version 3.6.2.0-  - choco install -y ghc   --version 9.12.3+  - choco install -y ghc   --version 9.12.2   - refreshenv  before_build:
examples/full-batteries/full-batteries.cabal view
@@ -28,7 +28,7 @@                      GHC == 9.6.7                      GHC == 9.8.4                      GHC == 9.10.3-                     GHC == 9.12.3+                     GHC == 9.12.2  source-repository head   type:                git
examples/stack-full/.travis.yml view
@@ -43,7 +43,7 @@   - ghc: 9.10.3     env: STACK_YAML="$TRAVIS_BUILD_DIR/stack-9.10.3.yaml" -  - ghc: 9.12.3+  - ghc: 9.12.2     env: STACK_YAML="$TRAVIS_BUILD_DIR/stack.yaml"    allow_failures:
examples/stack-full/appveyor.yml view
@@ -3,10 +3,10 @@ # Do not build feature branch with open Pull Requests skip_branch_with_pr: true -# build only main branch+# build only master branch branches:   only:-    - main+    - master  environment:   STACK_ROOT: C:\sr
examples/stack-full/stack-full.cabal view
@@ -26,7 +26,7 @@                      GHC == 9.6.7                      GHC == 9.8.4                      GHC == 9.10.3-                     GHC == 9.12.3+                     GHC == 9.12.2  source-repository head   type:                git
examples/summoner-default.toml view
@@ -48,7 +48,7 @@ # travis = true         # Travis CI # appveyor = true       # AppVeyor CI -# List of additional GHC versions to support besides 9.12.3.+# List of additional GHC versions to support besides 9.12.2. # Run the 'summon show ghc' command to see the list of all supported GHC versions. # ghcVersions = ["9.8.4", "9.10.3"] @@ -85,3 +85,6 @@ # [prelude] #     package = "relude" #     module  = "Relude"++# Default branch name+# branchName = "main"
src/Summoner/CLI.hs view
@@ -399,6 +399,7 @@     stack <- stackP     preludePack <- optional preludePackP     preludeMod  <- optional preludeModP+    branchName <- optional branchP     with    <- optional withP     without <- optional withoutP @@ -408,6 +409,7 @@             , cCabal = cabal             , cStack = stack             , cNoUpload = Any $ noUpload || isOffline newOptsConnectMode+            , cBranchName = Last branchName             }         , ..         }@@ -567,6 +569,13 @@ stackP = flag Idk Yes $ mconcat     [ long "stack"     , help "Stack support for the project"+    ]++branchP :: Parser Text+branchP = strOption $ mconcat+    [ long "branch"+    , metavar "BRANCH_NAME"+    , help "Default branch name for the project (e.g. main, master)"     ]  ----------------------------------------------------------------------------
src/Summoner/Config.hs view
@@ -84,6 +84,7 @@     , cGitignore  :: ![Text]     , cNoUpload   :: !Any  -- ^ Do not upload to the GitHub (even if enabled)     , cFiles      :: !(Map FilePath Source)  -- ^ Custom files+    , cBranchName :: !(p :- Text)     } deriving stock (Generic)  deriving stock instance@@ -136,6 +137,7 @@     , cGitignore    = []     , cNoUpload     = Any False     , cFiles        = mempty+    , cBranchName   = Last (Just "main")     }  -- | Identifies how to read 'Config' data from the @.toml@ file.@@ -163,6 +165,7 @@     <*> textArr             "gitignore"     .= cGitignore     <*> Toml.any            "noUpload"      .= cNoUpload     <*> filesCodec          "files"         .= cFiles+    <*> Toml.last Toml.text "branchName"    .= cBranchName   where     _GhcVer :: TomlBiMap GhcVer Toml.AnyValue     _GhcVer = Toml._TextBy showGhcVer (maybeToRight "Wrong GHC version" . parseGhcVer)@@ -206,10 +209,12 @@    gitOwner <- (Just <$> "git" $| ["config", "user.login"]) $? pure Nothing    gitName  <- (Just <$> "git" $| ["config", "user.name"])  $? pure Nothing    gitEmail <- (Just <$> "git" $| ["config", "user.email"]) $? pure Nothing+   gitBranch <- (Just <$> "git" $| ["config", "init.defaultBranch"]) $? pure Nothing    pure $ defaultConfig        { cOwner = Last gitOwner        , cFullName = Last gitName        , cEmail = Last gitEmail+       , cBranchName = Last gitBranch        }  -- | Make sure that all the required configurations options were specified.@@ -237,6 +242,7 @@     <*> pure cGitignore     <*> pure cNoUpload     <*> pure cFiles+    <*> fin "branchName" cBranchName   where     fin :: Text -> Last a -> Validation [Text] a     fin name = maybe (Failure ["Missing field: " <> name]) Success . getLast
src/Summoner/Default.hs view
@@ -187,6 +187,9 @@     , "# [prelude]"     , "#     package = " <> quote "relude"     , "#     module  = " <> quote "Relude"+    , ""+    , "# Default branch name"+    , "# branchName = " <> quote "main"     ]   where     licenseName :: Text
src/Summoner/GhcVer.hs view
@@ -42,7 +42,7 @@     | Ghc967     | Ghc984     | Ghc9103-    | Ghc9123+    | Ghc9122     deriving stock (Eq, Ord, Show, Enum, Bounded)  -- | Converts 'GhcVer' into dot-separated string.@@ -60,7 +60,7 @@     Ghc967  -> "9.6.7"     Ghc984  -> "9.8.4"     Ghc9103 -> "9.10.3"-    Ghc9123 -> "9.12.3"+    Ghc9122 -> "9.12.2"  {- | These are old GHC versions that are not working with default GHC versions when using Stack.@@ -86,7 +86,7 @@     Ghc967  -> "lts-22.44"     Ghc984  -> "lts-23.28"     Ghc9103 -> "lts-24.26"-    Ghc9123 -> "nightly-2026-01-04"+    Ghc9122 -> "nightly-2026-01-04"  -- | Represents PVP versioning (4 numbers). data Pvp = Pvp@@ -115,7 +115,7 @@     Ghc967  -> Pvp 4 18 3 1     Ghc984  -> Pvp 4 19 2 0     Ghc9103 -> Pvp 4 20 2 0-    Ghc9123 -> Pvp 4 21 1 0+    Ghc9122 -> Pvp 4 21 0 0  -- | Returns corresponding @base@ version of the given GHC version. baseVer :: GhcVer -> Text
src/Summoner/Golden.hs view
@@ -111,6 +111,7 @@     , settingsStack          = False     , settingsNoUpload       = True     , settingsFiles          = mempty+    , settingsBranchName     = "main"     }  cabalFull :: Settings@@ -142,6 +143,7 @@     , settingsStack          = False     , settingsNoUpload       = False     , settingsFiles          = []+    , settingsBranchName     = "main"     }  stackFull :: Settings@@ -173,6 +175,7 @@     , settingsStack          = True     , settingsNoUpload       = False     , settingsFiles          = []+    , settingsBranchName     = "master"     }  fullBatteries :: Settings@@ -209,6 +212,7 @@         , File ".stylish-haskell.yaml" "This is stylish-haskell.yaml\n"         , File "CONTRIBUTING.md" "This is contributing guide\n"         ]+    , settingsBranchName     = "main"     }   where     mitLicense :: License
src/Summoner/Project.hs view
@@ -92,11 +92,12 @@     let settingsNoUpload = getAny cNoUpload     when settingsNoUpload $ do         infoMessage "'No upload' option is selected. The project won't be uploaded to GitHub."-        infoMessage "Use 'hub' and 'git' commands manually in order to upload the project to GitHub"+        infoMessage "Use 'gh' and 'git' commands manually in order to upload the project to GitHub"     settingsPrivate  <- decisionIf         (settingsGitHub && not settingsNoUpload)-        (YesNoPrompt "private repository" "Create as a private repository (Requires a GitHub private repo plan)?")+        (YesNoPrompt "private repository" "Create as a private repository?")         cPrivate+    settingsBranchName <- if settingsGitHub then (queryDef "Default branch name: " cBranchName) else pure "main"     settingsGhActions <- decisionIf settingsGitHub (mkDefaultYesNoPrompt "GitHub Actions CI integration") cGhActions     settingsTravis    <- decisionIf settingsGitHub (mkDefaultYesNoPrompt "Travis CI integration") cTravis     settingsAppVeyor  <- decisionIf settingsGitHub (mkDefaultYesNoPrompt "AppVeyor CI integration") cAppVey@@ -253,6 +254,7 @@     let settingsGitignore  = cGitignore     let settingsTestedVersions = sortNub $ defaultGHC : cGhcVer     settingsFiles <- fetchSources connectMode cFiles+    let settingsBranchName = cBranchName      -- Create project data from all variables in scope     -- and make a project from it.@@ -285,37 +287,43 @@ doGithubCommands :: Settings -> IO () doGithubCommands Settings{..} = do     -- Create git repostitory and do a commit.-    "git" ["init", "--initial-branch=main"]+    "git" ["init", "--initial-branch=" <> settingsBranchName]     "git" ["add", "."]     "git" ["commit", "-m", "Create the project"]     unless settingsNoUpload $ do         let repo = settingsOwner <> "/" <> settingsRepo-        hubInstalled <- findExecutable "hub"-        case hubInstalled of+        ghInstalled <- findExecutable "gh"+        case ghInstalled of             Just _ -> do-                isHubSuccess <- runHub repo-                if isHubSuccess+                isGHSuccess <- runGH repo+                if isGHSuccess                 then do-                    "git" ["push", "-u", "origin", "main"]                     "git" ["remote", "set-head", "origin", "-a"]                     successMessage "Project created:"                     infoMessage $ "    https://github.com/" <> repo                 else do-                    warningMessage "Error running 'hub'. Possible reason: incorrect password."-                    hubHelp repo+                    warningMessage "Error running 'gh'. Possible reason: incorrect password."+                    ghHelp repo             Nothing -> do-                warningMessage "'hub' is not found at this machine. Cannot create the GitHub repository."-                warningMessage "Please install 'hub' for the proper work of Summoner."-                hubHelp repo+                warningMessage "'gh' is not found at this machine. Cannot create the GitHub repository."+                warningMessage "Please install 'gh' for the proper work of Summoner."+                ghHelp repo   where     -- Create repo on GitHub and return 'True' in case of sucsess-    runHub :: Text -> IO Bool-    runHub repo =-        True <$ "hub" (["create", "-d", settingsDescription, repo]-             ++ ["-p" | settingsPrivate])  -- Create private repository if asked so-             $? pure False+    runGH :: Text -> IO Bool+    runGH repo =+        True <$ "gh" (["repo","create"+            , "-d", settingsDescription+            , repo+            , "--source=."+            , "--remote=origin"+            , "--push"+            ]+            ++ ["--private" | settingsPrivate])+        $? pure False -    hubHelp :: Text -> IO ()-    hubHelp repo = do++    ghHelp :: Text -> IO ()+    ghHelp repo = do         infoMessage "To finish the process manually you can run the following command:"-        putTextLn $ "    $ hub create -d '" <> settingsDescription <> "' " <> repo <> memptyIfFalse settingsPrivate " -p"+        putTextLn $ "    $ gh repo create -d '" <> settingsDescription <> "' " <> repo <> memptyIfFalse settingsPrivate " --private"
src/Summoner/Settings.hs view
@@ -52,6 +52,7 @@     , settingsStack          :: !Bool     , settingsNoUpload       :: !Bool  -- ^ do not upload to GitHub     , settingsFiles          :: ![TreeFs]  -- ^ Tree nodes of extra files+    , settingsBranchName     :: !Text  -- ^ default branch name     } deriving stock (Show)  -- | Enum for supported build tools.
src/Summoner/Template/Cabal.hs view
@@ -209,7 +209,7 @@         <> buildDepends         <> rtsOptions -    -- | @build-depends@ for the repo, only if the library is on.+    -- @build-depends@ for the repo, only if the library is on.     buildDepends :: [Text]     buildDepends = memptyIfFalse settingsIsLib         ["  build-depends:       " <> settingsRepo]
src/Summoner/Template/GitHub.hs view
@@ -124,7 +124,7 @@         , "  pull_request:"         , "    types: [synchronize, opened, reopened]"         , "  push:"-        , "    branches: [main]"+        , "    branches: [" <> settingsBranchName <> "]"         , "  schedule:"         , "    # additionally run once per week (At 00:00 on Sunday) to maintain cache"         , "    - cron: '0 0 * * 0'"@@ -208,7 +208,7 @@         [ ""         , "    steps:"         , "    - uses: actions/checkout" <> ghcActionsCheckoutVersion-        , "      if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/main'"+        , "      if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/" <> settingsBranchName <> "'"         , ""         , "    - uses: haskell-actions/setup" <> ghcActionsSetupHaskellVersion         , "      name: Setup Haskell Stack"@@ -438,10 +438,10 @@         , "# Do not build feature branch with open Pull Requests"         , "skip_branch_with_pr: true"         , ""-        , "# build only main branch"+        , "# build only " <> settingsBranchName <> " branch"         , "branches:"         , "  only:"-        , "    - main"+        , "    - " <> settingsBranchName         , ""         ] 
summoner.cabal view
@@ -1,6 +1,6 @@ cabal-version:       3.4 name:                summoner-version:             2.1.0.0+version:             2.2.0.0 synopsis:            Tool for scaffolding fully configured batteries-included production-level Haskell projects. description:         Tool for scaffolding fully configured batteries-included production-level Haskell projects.                      See [README.md](https://github.com/kowainik/summoner#-summoner) for details.@@ -26,7 +26,7 @@                      GHC == 9.6.7                      GHC == 9.8.4                      GHC == 9.10.3-                     GHC == 9.12.3+                     GHC == 9.12.2 extra-source-files:     examples/summoner-default.toml 
test/Test/Show.hs view
@@ -26,5 +26,5 @@     , "GHC-9.6.7     base-4.18.3.1   lts-22.44"     , "GHC-9.8.4     base-4.19.2.0   lts-23.28"     , "GHC-9.10.3    base-4.20.2.0   lts-24.26"-    , "GHC-9.12.3    base-4.21.1.0   nightly-2026-01-04"+    , "GHC-9.12.2    base-4.21.0.0   nightly-2026-01-04"     ]
test/Test/TomlSpec.hs view
@@ -106,4 +106,5 @@     cGitignore  <- genTextArr     cNoUpload   <- Any <$> Gen.bool     cFiles <- Gen.map (Range.constant 0 10) (liftA2 (,) genString genSource)+    cBranchName <- Last <$> Gen.maybe genText     pure ConfigP{..}