@seangalie/precast 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/LICENSE +202 -0
  3. package/README.md +274 -2
  4. package/dist/bin.d.ts +2 -0
  5. package/dist/bin.js +3 -0
  6. package/dist/cli.d.ts +7 -0
  7. package/dist/cli.js +251 -0
  8. package/dist/collect.d.ts +17 -0
  9. package/dist/collect.js +143 -0
  10. package/dist/context.d.ts +38 -0
  11. package/dist/context.js +206 -0
  12. package/dist/errors.d.ts +8 -0
  13. package/dist/errors.js +8 -0
  14. package/dist/fnmatch.d.ts +9 -0
  15. package/dist/fnmatch.js +110 -0
  16. package/dist/generate.d.ts +23 -0
  17. package/dist/generate.js +76 -0
  18. package/dist/index.d.ts +7 -0
  19. package/dist/index.js +7 -0
  20. package/dist/output-path.d.ts +30 -0
  21. package/dist/output-path.js +84 -0
  22. package/dist/platforms.d.ts +22 -0
  23. package/dist/platforms.js +81 -0
  24. package/dist/profiles.d.ts +23 -0
  25. package/dist/profiles.js +79 -0
  26. package/dist/prompts.d.ts +30 -0
  27. package/dist/prompts.js +103 -0
  28. package/dist/style.d.ts +14 -0
  29. package/dist/style.js +34 -0
  30. package/dist/tiers.d.ts +23 -0
  31. package/dist/tiers.js +96 -0
  32. package/package.json +44 -4
  33. package/platforms/forgejo/files/.forgejo/CODEOWNERS.tmpl +2 -0
  34. package/platforms/forgejo/files/.forgejo/ISSUE_TEMPLATE/01_bug_report.yml.tmpl +83 -0
  35. package/platforms/forgejo/files/.forgejo/ISSUE_TEMPLATE/02_feature_request.yml.tmpl +57 -0
  36. package/platforms/forgejo/files/.forgejo/ISSUE_TEMPLATE/03_codebase_improvement.yml.tmpl +44 -0
  37. package/platforms/forgejo/files/.forgejo/ISSUE_TEMPLATE/04_support_question.yml.tmpl +47 -0
  38. package/platforms/forgejo/files/.forgejo/ISSUE_TEMPLATE/config.yml.tmpl +13 -0
  39. package/platforms/forgejo/files/.forgejo/PULL_REQUEST_TEMPLATE.md.tmpl +49 -0
  40. package/platforms/forgejo/files/.forgejo/SETUP.md.tmpl +65 -0
  41. package/platforms/forgejo/files/.forgejo/labels.yml.tmpl +99 -0
  42. package/platforms/forgejo/files/.forgejo/scripts/check-labels.sh.tmpl +91 -0
  43. package/platforms/forgejo/files/.forgejo/scripts/sync-labels.sh.tmpl +165 -0
  44. package/platforms/forgejo/files/.forgejo/workflows/labels.yml.tmpl +45 -0
  45. package/platforms/forgejo/files/.forgejo/workflows/lint.yml.tmpl +78 -0
  46. package/platforms/forgejo/files/.forgejo/workflows/pr-labels.yml.tmpl +51 -0
  47. package/platforms/forgejo/files/.forgejo/workflows/pre-commit.yml.tmpl +24 -0
  48. package/platforms/forgejo/files/.forgejo/workflows/release.yml.tmpl +130 -0
  49. package/platforms/forgejo/files/.forgejo/workflows/renovate.yml.tmpl +61 -0
  50. package/platforms/forgejo/files/.forgejo/workflows/stale.yml.tmpl +260 -0
  51. package/platforms/forgejo/files/renovate.json +36 -0
  52. package/platforms/forgejo/platform.json +41 -0
  53. package/platforms/github/files/.github/CODEOWNERS.tmpl +2 -0
  54. package/platforms/github/files/.github/ISSUE_TEMPLATE/01_bug_report.yml.tmpl +83 -0
  55. package/platforms/github/files/.github/ISSUE_TEMPLATE/02_feature_request.yml.tmpl +57 -0
  56. package/platforms/github/files/.github/ISSUE_TEMPLATE/03_codebase_improvement.yml.tmpl +44 -0
  57. package/platforms/github/files/.github/ISSUE_TEMPLATE/04_support_question.yml.tmpl +47 -0
  58. package/platforms/github/files/.github/ISSUE_TEMPLATE/config.yml.tmpl +16 -0
  59. package/platforms/github/files/.github/PULL_REQUEST_TEMPLATE.md.tmpl +49 -0
  60. package/platforms/github/files/.github/SETUP.md.tmpl +46 -0
  61. package/platforms/github/files/.github/dependabot.yml.tmpl +75 -0
  62. package/platforms/github/files/.github/labels.yml.tmpl +103 -0
  63. package/platforms/github/files/.github/release.yml.tmpl +47 -0
  64. package/platforms/github/files/.github/workflows/ci.yml.tmpl +55 -0
  65. package/platforms/github/files/.github/workflows/codeql.yml.tmpl +63 -0
  66. package/platforms/github/files/.github/workflows/labels.yml.tmpl +34 -0
  67. package/platforms/github/files/.github/workflows/lint-workflows.yml.tmpl +75 -0
  68. package/platforms/github/files/.github/workflows/lint.yml.tmpl +69 -0
  69. package/platforms/github/files/.github/workflows/lock.yml.tmpl +46 -0
  70. package/platforms/github/files/.github/workflows/pr-labels.yml.tmpl +26 -0
  71. package/platforms/github/files/.github/workflows/pre-commit.yml.tmpl +25 -0
  72. package/platforms/github/files/.github/workflows/release.yml.tmpl +101 -0
  73. package/platforms/github/files/.github/workflows/stale.yml.tmpl +57 -0
  74. package/platforms/github/platform.json +44 -0
  75. package/platforms/gitlab/files/.gitlab/CODEOWNERS.tmpl +2 -0
  76. package/platforms/gitlab/files/.gitlab/SETUP.md.tmpl +65 -0
  77. package/platforms/gitlab/files/.gitlab/issue_templates/01_bug_report.md +18 -0
  78. package/platforms/gitlab/files/.gitlab/issue_templates/02_feature_request.md +11 -0
  79. package/platforms/gitlab/files/.gitlab/issue_templates/03_codebase_improvement.md +11 -0
  80. package/platforms/gitlab/files/.gitlab/issue_templates/04_support_question.md +12 -0
  81. package/platforms/gitlab/files/.gitlab/labels.json +122 -0
  82. package/platforms/gitlab/files/.gitlab/merge_request_templates/Default.md +14 -0
  83. package/platforms/gitlab/files/.gitlab/scripts/project.py +159 -0
  84. package/platforms/gitlab/files/.gitlab-ci.yml.tmpl +56 -0
  85. package/platforms/gitlab/platform.json +38 -0
  86. package/template/.editorconfig.tmpl +54 -0
  87. package/template/.gitattributes +107 -0
  88. package/template/.gitignore.tmpl +244 -0
  89. package/template/.pre-commit-config.yaml.tmpl +55 -0
  90. package/template/.repo/check-secrets.py +40 -0
  91. package/template/.repo/ci-checks.sh +20 -0
  92. package/template/AGENTS.md.tmpl +78 -0
  93. package/template/CHANGELOG.md.tmpl +24 -0
  94. package/template/CLAUDE.md +1 -0
  95. package/template/LICENSE +202 -0
  96. package/template/README.md.tmpl +101 -0
  97. package/template/SETUP.md.tmpl +56 -0
  98. package/template/docs/CODE_OF_CONDUCT.md +85 -0
  99. package/template/docs/CONTRIBUTING.md.tmpl +59 -0
  100. package/template/docs/SECURITY.md.tmpl +26 -0
  101. package/template/docs/SUPPORT.md.tmpl +19 -0
  102. package/template/docs/logo.svg +84 -0
  103. package/template/docs/screenshot.png +0 -0
  104. package/tiers.json +10 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,64 @@
1
+ # Changelog
2
+
3
+ I record notable changes using [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
4
+ and [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
+
6
+ ## [Unreleased]
7
+
8
+ ## [0.2.0] - 2026-11-18
9
+
10
+ ### Added
11
+
12
+ - Interactive prompts: run in a terminal with required options missing, Precast
13
+ asks for the platform, tier, namespace, repository, and output folder,
14
+ checks each answer, and prints the equivalent command, under a small ASCII
15
+ header and with color where the terminal supports it (`NO_COLOR` turns color
16
+ off). `--no-input` turns the questions off; scripts, CI, and anything
17
+ without a terminal still get an error.
18
+ - Named profiles in a user settings file, chosen with `--profile`, save a
19
+ platform, server, namespace, and other defaults for servers you use often.
20
+ `--config` reads profiles from another file.
21
+ - Regular and full projects get a `commit-msg` hook that enforces Conventional
22
+ Commit messages and a `no-commit-to-branch` guard for their default branch,
23
+ which also covers local merge commits. `pre-commit install` installs both,
24
+ generated CI skips the guard, and `SETUP.md` has the first commit made before
25
+ the hooks are installed.
26
+ - GitLab projects generated for GitLab.com set `image: python:3.14-trixie` in
27
+ `.gitlab-ci.yml`, because the hosted runners' default image lacks Python's
28
+ `venv`. Other GitLab servers keep their runners' image.
29
+
30
+ ### Changed
31
+
32
+ - **Breaking:** Forgejo projects default to `https://codeberg.org` and GitLab
33
+ projects to `https://gitlab.com`, instead of my own Forgejo and PPPL's GitLab.
34
+ Use `--server-url` or a profile for any other server.
35
+ - GitLab and Forgejo setup checklists no longer refer to PPPL, and the Forgejo
36
+ checklist explains choosing a hosted runner's label with `--runner`.
37
+
38
+ ### Fixed
39
+
40
+ - A default branch or runner containing a character outside the Basic
41
+ Multilingual Plane, such as an emoji, now renders as valid YAML in generated
42
+ workflows and hook settings.
43
+
44
+ ## [0.1.0] - 2026-11-17
45
+
46
+ ### Added
47
+
48
+ - A `precast` command, packaged for npm as `@seangalie/precast`, that generates
49
+ Forgejo, GitHub, and GitLab repositories from shared project content and
50
+ automatically discovered platform files. It needs Node.js 22.18 or newer and
51
+ has no runtime dependencies.
52
+ - Three cumulative tiers, `slim`, `regular` (the default), and `full`.
53
+ - GitLab subgroup support, native templates, label tooling, a CI starter, and
54
+ release notes.
55
+ - Input, descriptor, and collision validation, previews with `--dry-run`, and
56
+ `--help` and `--version`.
57
+ - Pre-commit checks for generated repositories, with platform CI jobs and
58
+ explicit local hook installation.
59
+
60
+ I ported Precast from my earlier Python generator. Its output is byte-identical
61
+ for every platform and tier, and the template format is unchanged. Two checks
62
+ are stricter than before: the output path is resolved through symlinks and
63
+ letter case before `..` applies, and file/directory collisions fail in every
64
+ tier, not only in the tier that includes both files.
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 Sean Galie
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,275 @@
1
- # Temporary Holding Version
1
+ <div align="center">
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ # Precast
4
+
5
+ Start a new project with its documentation, checks, and forge settings already in place
6
+
7
+ </div>
8
+
9
+ <details open="open">
10
+ <summary>Table of Contents</summary>
11
+
12
+ - [About](#about)
13
+ - [Tiers](#tiers)
14
+ - [Platforms](#platforms)
15
+ - [Getting Started](#getting-started)
16
+ - [Prerequisites](#prerequisites)
17
+ - [Installation](#installation)
18
+ - [Usage](#usage)
19
+ - [Generate a project](#generate-a-project)
20
+ - [Publish it](#publish-it)
21
+ - [Options](#options)
22
+ - [Save your servers as profiles](#save-your-servers-as-profiles)
23
+ - [What Precast will not do](#what-precast-will-not-do)
24
+ - [Roadmap](#roadmap)
25
+ - [Changelog](#changelog)
26
+ - [Support](#support)
27
+ - [Contributing](#contributing)
28
+ - [Authors & contributors](#authors--contributors)
29
+ - [Security](#security)
30
+ - [License](#license)
31
+
32
+ </details>
33
+
34
+ ## About
35
+
36
+ Every new repository I start needs the same groundwork: a README, a license, a
37
+ changelog, contributing and security policies, issue templates, CI checks, and
38
+ instructions for coding agents. Precast keeps one copy of all of that and turns
39
+ it into a fresh, personalized project folder for Forgejo, GitHub, or GitLab.
40
+
41
+ You run one command on your own computer. Precast fills in the project's name,
42
+ links, and default branch, writes the files into a new folder, and stops. Nothing
43
+ is uploaded and no accounts are touched; you look the result over and push it
44
+ when you are ready.
45
+
46
+ ### Tiers
47
+
48
+ Not every project needs every file, so Precast comes in three sizes. Each tier
49
+ includes everything in the one before it.
50
+
51
+ | Tier | Good for | What you get |
52
+ | --- | --- | --- |
53
+ | `slim` | Personal projects, experiments, and notes | README, license, changelog, agent instructions, editor and Git settings, placeholder images, and a setup checklist |
54
+ | `regular` | Most projects; this is the default | Everything in slim, plus contributing, security, support, and conduct policies, issue and pull request templates, code owners, pre-commit checks, and CI that runs them |
55
+ | `full` | Projects other people will rely on | Everything in regular, plus a label catalog and label checks, release publishing from the changelog, and the platform's housekeeping: stale and lock workflows, Renovate or Dependabot, and CodeQL |
56
+
57
+ If you are not sure, start with `regular`. A project can always grow into the
58
+ extra files later.
59
+
60
+ ### Platforms
61
+
62
+ | Platform | Default server | Platform files |
63
+ | --- | --- | --- |
64
+ | `forgejo` | `https://codeberg.org` | `.forgejo/`, plus `renovate.json` in full |
65
+ | `github` | `https://github.com` | `.github/` |
66
+ | `gitlab` | `https://gitlab.com` | `.gitlab/`, plus `.gitlab-ci.yml` in regular and full |
67
+
68
+ Each platform keeps its own native formats: Forgejo and GitHub use issue forms
69
+ and Actions workflows, and GitLab uses Markdown templates and GitLab CI. Any of
70
+ them can point at a different server, such as your own Forgejo or your
71
+ organization's GitLab, with `--server-url` or a [profile](#save-your-servers-as-profiles).
72
+
73
+ ## Getting Started
74
+
75
+ ### Prerequisites
76
+
77
+ - Node.js 22.18 or newer, which includes npm. Precast has no other runtime
78
+ dependencies.
79
+ - Git, to publish the project you generate.
80
+ - An account on the forge where the new project will live. For a server inside
81
+ an organization's network, you may also need its VPN when you push.
82
+
83
+ ### Installation
84
+
85
+ You can run Precast without installing it, using `npx`:
86
+
87
+ ```sh
88
+ npx @seangalie/precast --help
89
+ ```
90
+
91
+ Or install the `precast` command once and run it from anywhere:
92
+
93
+ ```sh
94
+ npm install --global @seangalie/precast
95
+ ```
96
+
97
+ The examples below use `precast`. If you did not install it, use
98
+ `npx @seangalie/precast` in its place.
99
+
100
+ ## Usage
101
+
102
+ ### Generate a project
103
+
104
+ The quickest start is to run `precast` on its own in a terminal. It asks for the
105
+ platform, tier, namespace, repository name, and output folder, checks each
106
+ answer, and then prints the full command so you can skip the questions next
107
+ time. Pressing Enter at the tier question keeps `regular`. Press
108
+ Ctrl+C to stop without writing anything. The questions use color in terminals
109
+ that support it; set `NO_COLOR=1` to turn it off. Commands that give every
110
+ required option ask nothing and print plain text.
111
+
112
+ You can also give everything as options. Run `precast` from the folder where you
113
+ keep your projects. This creates a `regular` GitHub project for the account
114
+ `my-name` in a new folder:
115
+
116
+ ```sh
117
+ precast --platform github --namespace my-name \
118
+ --repo my-project --project-name 'My Project' \
119
+ --author 'My Name' --output my-project
120
+ ```
121
+
122
+ To see what would be created without writing anything, add `--dry-run`. To
123
+ choose a different size, add `--tier slim` or `--tier full`:
124
+
125
+ ```sh
126
+ precast --platform forgejo --namespace my-name \
127
+ --repo my-notes --tier slim --output my-notes --dry-run
128
+ ```
129
+
130
+ For GitLab, the namespace can include subgroups:
131
+
132
+ ```sh
133
+ precast --platform gitlab --namespace group/subgroup \
134
+ --repo my-project --output my-project
135
+ ```
136
+
137
+ ### Publish it
138
+
139
+ Precast writes files and nothing else, so publishing is up to you:
140
+
141
+ 1. Open the new folder and read `SETUP.md`. It lists what to fill in, such as
142
+ the `[?]` prompts in the README, and links to a checklist for your platform.
143
+ 2. Create an **empty** repository on the forge with the same name and the
144
+ visibility you want. Do not let the forge add a README or license.
145
+ 3. Initialize, commit, and push:
146
+
147
+ ```sh
148
+ cd my-project
149
+ git init -b main
150
+ git add .
151
+ git commit -m "chore: start from Precast"
152
+ git remote add origin https://github.com/my-name/my-project.git
153
+ git push -u origin main
154
+ ```
155
+
156
+ 4. Work through the platform checklist, such as `.github/SETUP.md`. In the
157
+ regular and full tiers, it covers runners, code owners, and branch
158
+ protection; full adds labels and releases. Delete both checklists when you
159
+ are done.
160
+
161
+ If you used `--default-branch`, use that name in place of `main` above.
162
+
163
+ ### Options
164
+
165
+ | Option | What it does |
166
+ | --- | --- |
167
+ | `--platform` | `forgejo`, `github`, or `gitlab` (required) |
168
+ | `--namespace` | The user, organization, or GitLab group that will own the project (required) |
169
+ | `--repo` | The repository name, such as `my-project` (required) |
170
+ | `--output` | A new folder for the project; it must not exist yet (required) |
171
+ | `--tier` | `slim`, `regular`, or `full`; defaults to `regular` |
172
+ | `--project-name` | The title shown in the README; defaults to the repository name |
173
+ | `--author` | Your display name; defaults to the namespace |
174
+ | `--description` | A one-line description for the README |
175
+ | `--default-branch` | The main branch name; defaults to `main` |
176
+ | `--codeowner` | A user or team to own every file, such as `@my-name`; without it, the code owners file holds a commented example |
177
+ | `--runner` | The Actions runner label or GitLab runner tag for CI |
178
+ | `--server-url` | A different server than the platform's default |
179
+ | `--profile` | Use the saved settings with this name; see below |
180
+ | `--config` | The settings file to read profiles from, if not the usual one |
181
+ | `--dry-run` | Check everything and list the files without writing them |
182
+ | `--no-input` | Never ask questions; report missing options instead, as scripts need |
183
+
184
+ `precast --help` prints the same list, and `precast --version` prints the version.
185
+
186
+ ### Save your servers as profiles
187
+
188
+ If you use your own Forgejo, an organization's GitLab, or the same settings
189
+ every time, save them as a profile instead of typing them for each project.
190
+ Profiles live in a settings file you create:
191
+
192
+ - macOS and Linux: `~/.config/precast/config.json`, or `$XDG_CONFIG_HOME/precast/config.json`
193
+ - Windows: `%APPDATA%\precast\config.json`
194
+
195
+ Each profile names a platform and any defaults you want:
196
+
197
+ ```json
198
+ {
199
+ "profiles": {
200
+ "home": {
201
+ "platform": "forgejo",
202
+ "serverUrl": "https://git.example.org",
203
+ "namespace": "my-name",
204
+ "author": "My Name",
205
+ "runner": "docker"
206
+ },
207
+ "work": {
208
+ "platform": "gitlab",
209
+ "serverUrl": "https://gitlab.example.com",
210
+ "runner": "linux",
211
+ "tier": "regular"
212
+ }
213
+ }
214
+ }
215
+ ```
216
+
217
+ A profile can set `platform` (required), `serverUrl`, `namespace`, `author`,
218
+ `description`, `defaultBranch`, `codeowner`, `runner`, and `tier`. Then:
219
+
220
+ ```sh
221
+ precast --profile work --namespace group/subgroup --repo my-project --output my-project
222
+ ```
223
+
224
+ Anything you type on the command line wins over the profile, and Precast asks
225
+ for anything still missing, such as the repository name. Precast only reads
226
+ the settings file when you use `--profile`, so commands without it always behave
227
+ the same way.
228
+
229
+ ### What Precast will not do
230
+
231
+ Precast never contacts a forge, runs Git, or asks for passwords or tokens. It
232
+ refuses to write into a folder that already exists or into the Precast folder
233
+ itself, so it cannot overwrite your work. If something is wrong with the
234
+ options, it says what and writes nothing.
235
+
236
+ The generated files are a starting point. They keep clear `[?]` prompts where
237
+ only you know the answer, such as the build commands or a private security
238
+ contact, rather than guessing.
239
+
240
+ ## Roadmap
241
+
242
+ I track planned work and known bugs in my own issue tracker, which is not
243
+ public.
244
+
245
+ ## Changelog
246
+
247
+ I record notable changes in `CHANGELOG.md`, which is included in the package.
248
+
249
+ ## Support
250
+
251
+ Precast's repository is on my own Forgejo server, which requires an account.
252
+ If you have one, its issue tracker is the quickest route to me.
253
+
254
+ ## Contributing
255
+
256
+ Changes to Precast go through a pull request with passing CI. In the repository,
257
+ the maintainer guide (`docs/MAINTAINING.md`) explains how it is laid out, how to
258
+ run the checks, and how tiers and platforms are defined. The design guide
259
+ (`docs/ARCHITECTURE.md`) covers the rendering rules in depth.
260
+
261
+ ## Authors & contributors
262
+
263
+ Precast is by Sean Galie.
264
+
265
+ ## Security
266
+
267
+ Precast runs only on your computer and writes only to the folder you name. If
268
+ you find a security problem in it or in the files it generates, please email
269
+ <precast@galie.io> rather than opening a public issue.
270
+
271
+ ## License
272
+
273
+ This project is licensed under the **Apache 2.0 license**.
274
+
275
+ See `LICENSE`, included in the package, for more information.
package/dist/bin.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/bin.js ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import { main } from "./cli.js";
3
+ process.exitCode = await main(process.argv.slice(2));
package/dist/cli.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { type Ask } from "./prompts.ts";
2
+ /** Where questions are asked; tests replace it with scripted answers. */
3
+ export interface Terminal {
4
+ interactive: boolean;
5
+ prompt<T>(use: (ask: Ask) => Promise<T>): Promise<T>;
6
+ }
7
+ export declare function main(argv: string[], root?: string, terminal?: Terminal): Promise<number>;