CPAN/Maker/Bootstrapper.pm

filter: Statementstmt 100% 31 / 31 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod n/a totaltotal 97.5% 39 / 40 CC 1 SCAR 0.0
CC
1
Cov
97%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« CPAN/Maker/Bootstrapper/Role/Version.pm ↑ Summary CPAN/Maker/Bootstrapper/Constants.pm »
1 package CPAN::Maker::Bootstrapper;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use CLI::Simple ();
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use CLI::Simple::Constants qw(:booleans);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use IO::Interactive qw(is_interactive);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use Role::Tiny::With;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 with 'CPAN::Maker::Role::ModuleUtils';
13  
14 1 CLI::Simple->import(qw(:roles));
15  
16 1 our $VERSION = '2.4.1';
17 1 our $GIT_SHA = 'fb46b57786ecad274edd460914188876d0b323f9';
18 1 our $GIT_DIRTY = '2.0.0-28-gfb46b57786ecad274edd460914188876d0b323f9';
19  
20 1 with 'CPAN::Maker::Bootstrapper::Role::Init';
21 1 with 'CPAN::Maker::Bootstrapper::Role::LLM::Utils';
22  
23 1 ▶use parent qw(CLI::Simple);
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 1 __PACKAGE__->use_log4perl( level => 'info', color => $TRUE, info_color => 'white' );
26  
27 1 ▶caller or exit __PACKAGE__->main;
Branch: 1 branch
BranchTrueFalseTotal
caller or exit __PACKAGE__->main 1 0 1
28  
29 1 1;
30  
31 ## no critic
32  
33 __END__
34  
35 =pod
36  
37 =encoding utf8
38  
39 =head1 NAME
40  
41 CPAN::Maker::Bootstrapper - A complete build, dependency, and release framework for CPAN distributions
42  
43 =head1 SYNOPSIS
44  
45 # Bootstrap an existing project
46 cd /path/to/Foo-Bar
47 cmb --import .
48  
49 # Create a configuration file (recommended first-time setup)
50 cmb create-config > ~/.cpan-makerrc
51 export CPAN_MAKER_CONFIG=$HOME/.cpan-makerrc
52  
53 # Create a new plain Perl module project
54 cmb --module My::New::Module
55  
56 # Create a CLI module project (inherits from CLI::Simple)
57 cmb --module My::New::CLI --stub cli
58  
59 # Use a custom stub
60 cmb --module My::Module --stub /path/to/mystub.pm
61  
62 # Import files from another project
63 mkdir My-Module
64 cd My-Module
65 cmb -I /path/to/my-module/lib -I /path/to/my-module/bin \
66 --installdir .
67  
68 # Install into a specific directory
69 cmb --module My::Module --installdir ~/git/My-Module
70  
71 # Override git identity
72 cmb --module My::Module --username "Rob Lauer" --email rob@example.org
73  
74 # Run a code review on a module (set API key in environment)
75 cmb code-review lib/My/Module.pm
76  
77 =head1 DESCRIPTION
78  
79 C<CPAN::Maker::Bootstrapper> provides a complete development framework
80 for building, testing, maintaining, and releasing CPAN distributions.
81  
82 It can scaffold a new Perl project or import an existing one, installing
83 a managed build framework that carries the project from source through
84 testing, dependency management, distribution, and release.
85  
86 Core features include:
87  
88 =over 4
89  
90 =item * Continuous dependency discovery and maintenance for runtime,
91 test, recommended, and suggested dependencies
92  
93 =item * Syntax checking, perltidy, perlcritic, POD checking, and other
94 build-time quality gates
95  
96 =item * Hermetic project-local dependency installation coupled with
97 syntax checking of modules and scripts to expose undeclared
98 dependencies
99  
100 =item * Extensible project-specific build logic through F<project.mk>
101 without modifying managed build files
102  
103 =item * Semantic versioning, release-note generation, CPAN publishing,
104 and CI workflow support
105  
106 =item * DarkPAN dependency manifests for distributions that depend on
107 modules published outside CPAN
108  
109 =item * Build-system update checks and managed-file drift detection,
110 with support for upgrading and refreshing the framework
111  
112 =item * AI-assisted code review, POD review and generation, structured
113 finding annotation, and release-note generation
114  
115 =back
116  
117 See L</LLM Commands> and L</THE REVIEW WORKFLOW> for details on the
118 AI-assisted development tools.
119  
120 I<NOTE: Check out the
121 L<release-notes|https://github.com/rlauer6/CPAN-Maker-Bootstrapper/tree/main/release-notes>
122 directory in the GitHub project for examples of release notes generated by
123 the LLM.>
124  
125 =head1 QUICK START
126  
127 Install the bootstrapper and its dependencies:
128  
129 cpanm CPAN::Maker::Bootstrapper
130  
131 I<Note: Before scaffolding your first project, consider running C<create-config>
132 to set up a personal configuration file - it pre-populates your git
133 identity, GitHub username, and preferred project directory so you never
134 have to pass them on the command line. See L</CONFIGURATION> for details.>
135  
136 =head2 Scaffolding a new project from the default stub
137  
138 cmb --module My::Module
139  
140 or
141  
142 # create a directory for the new CPAN distribution
143 mkdir My-Module
144  
145 # cd into the directory
146 cd My-Module
147  
148 # scaffold the project
149 cmb --installdir .
150  
151 The bootstrapper derives the primary module name from the directory
152 name (C<My::Module> in this example). It then installs the build
153 system, generates the stub source and test files, and runs C<make>
154 automatically to create the first distribution tarball.
155  
156 By default the final build step applies full linting: syntax
157 checking (C<perl -wc>), perltidy conformance, and perlcritic at its
158 default severity (5 - the most severe violations only).
159  
160 =head2 Bootstrapping an existing project
161  
162 If you already have a Perl project, run C<cmb> from the project root
163 and import the current directory:
164  
165 cd Foo-Bar
166 cmb --import .
167  
168 When exactly one import directory is supplied and neither C<--module>
169 nor C<--installdir> determines the module name, the bootstrapper derives
170 the primary module name from the import directory. In this example,
171 F<Foo-Bar> implies C<Foo::Bar>.
172  
173 Use C<--dry-run> first if you want to inspect the import plan without
174 creating files or running the generated build:
175  
176 cmb --import . --dry-run
177  
178 You may also import from multiple directories and specify the primary
179 module explicitly:
180  
181 cmb --module Foo::Bar
182 --import lib
183 --import bin
184 --installdir /tmp/Foo-Bar
185  
186 =head1 NEXT STEPS
187  
188 =over 4
189  
190 =item Review the project source
191  
192 For a newly scaffolded project, edit the generated source file:
193  
194 lib/My/Module.pm.in
195  
196 For an imported project, review the C<.pm.in> and C<.pl.in> files
197 created from the imported modules and scripts.
198  
199 Files ending in C<.in> are the editable project sources. The generated
200 C<.pm> and C<.pl> files are build artifacts and will be overwritten by
201 subsequent C<make> invocations.
202  
203 =item Review the framework's populated artifacts
204  
205 =over 8
206  
207 =item F<buildspec.yml> - controls how the distribution is built
208  
209 See L<CPAN::Maker> for details regarding F<buildspec.yml>.
210  
211 =item F<requires> - found dependencies
212  
213 =item F<test-requires> - test dependencies
214  
215 =item F<recommends> - recommended dependencies
216  
217 =item F<suggests> - optional dependencies
218  
219 =back
220  
221 =item Manage the project version
222  
223 The bootstrapper creates a F<VERSION> file containing the semantic
224 version number for the project. New projects begin at C<1.0.0>.
225  
226 Use the version targets to increment it:
227  
228 make release # 1.0.0 -> 1.0.1
229 make minor # 1.0.1 -> 1.1.0
230 make major # 1.1.0 -> 2.0.0
231  
232 If you imported the primary module rather than generating it from a
233 stub, make sure its version declaration uses the project version token:
234  
235 our $VERSION = C<E<64>PACKAGE_VERSIONE<64>>;
236  
237 When C<make> generates the F<.pm> file from its F<.pm.in> source,
238 C<E<64>PACKAGE_VERSIONE<64>> is replaced with the value from
239 F<VERSION>.
240  
241 =item Add More Modules, Scripts, and Tests
242  
243 As your project grows, add new modules beneath F<lib/> as F<.pm.in>
244 files and scripts beneath F<bin/> as F<.pl.in> files. The build system
245 discovers them automatically - no Makefile changes are required.
246  
247 Distribution tests belong beneath F<t/>.
248  
249 Additional test suites may use the conventional extended-test
250 directories:
251  
252 xt/author/
253 xt/release/
254 xt/smoke/
255  
256 These suites can be run explicitly with C<make test-author>,
257 C<make test-release>, and C<make test-smoke>, or together with
258 C<make test-all>.
259  
260 =item Add additional files to the distribution
261  
262 Edit F<buildspec.yml> to declare additional files that should be
263 included in the distribution.
264  
265 Files may be added at the distribution root or installed beneath the
266 distribution's share directory.
267  
268 For example:
269  
270 extra-files:
271 - ChangeLog
272 - share:
273 - config/example.ini
274 - defaults.json
275  
276 Use root-level entries for files that should be packaged but not
277 installed into the share directory.
278  
279 Use the C<share> section for files that should be installed as
280 distribution data.
281  
282 See L</How do I include additional files in the distribution?> for
283 more details.
284  
285 =item Rebuild Your Distribution
286  
287 When you are ready to rebuild the project:
288  
289 make
290  
291 The default build applies the project's dependency and quality gates,
292 regenerates derived source files and documentation as needed, and
293 produces the CPAN distribution tarball.
294  
295 When dependency scanning is enabled, changed source files are scanned
296 and the dependency artifacts are updated only when their contents have
297 changed:
298  
299 requires
300 test-requires
301 recommends
302 suggests
303  
304 The build also regenerates F<README.md> when required and rebuilds only
305 those derived artifacts whose prerequisites have changed.
306  
307 For a faster development build that skips dependency scanning and both
308 lint tools while retaining syntax checking, use:
309  
310 make quick
311  
312 =item Verify the Distribution Installs Cleanly
313  
314 After building the distribution, install the generated tarball with
315 C<cpanm> to verify that it can be consumed independently of the source
316 tree:
317  
318 cpanm --local-lib=$HOME My-Module-*.tar.gz
319  
320 This exercises the packaged distribution and its declared
321 dependencies through the normal CPAN installation path rather than
322 through the project's development build environment.
323  
324 =item Put Your Project Under Source Control
325  
326 Initialize the repository and stage the project files recommended by
327 the build system:
328  
329 make git
330  
331 By default, C<make git> creates the initial commit after staging the
332 managed build files, project configuration, editable source files, and
333 other tracked project artifacts.
334  
335 If you want to initialize and stage the project without creating the
336 commit yet, use:
337  
338 make git NO_COMMIT=1
339  
340 =item Learn More About C<CPAN::Maker::Bootstrapper>
341  
342 See L</EXTENDING THE BUILD SYSTEM> for adding project-specific build
343 logic and customizing the managed build framework.
344  
345 See L</Dependencies Management> for details on dependency discovery,
346 classification, filtering, and generated dependency artifacts.
347  
348 See L</FAQ> for common questions and practical recipes.
349  
350 =back
351  
352 =head1 WHY YOU SHOULD CONSIDER USING CPAN::Maker::Bootstrapper
353  
354 Many build systems place the build procedure inside the CI platform:
355 workflow files describe the steps, the CI runner executes them, and a
356 separate local workflow is needed to reproduce the same build.
357  
358 C<CPAN::Maker::Bootstrapper> takes the opposite approach.
359  
360 The build belongs to the project.
361  
362 The same dependency graph, quality gates, generated artifacts, tests,
363 and distribution rules run whether C<make> is invoked on your laptop,
364 on a remote host, inside C<make build-ci>, or from GitHub Actions.
365  
366 CI is therefore a caller of the build system rather than the place
367 where the build system lives.
368  
369 A fresh checkout remains directly buildable with:
370  
371 git clone <repository>
372 cd <project>
373 make
374  
375 The CI layer can add isolation and automation, but it does not define a
376 second build procedure that must be kept synchronized with local
377 development.
378  
379 =head2 The Stack
380  
381 The build system is built on three tools with deliberately different
382 responsibilities:
383  
384 =over 4
385  
386 =item * B<GNU make> - models causality.
387  
388 Targets, prerequisites, timestamps, pattern rules, and order-only
389 dependencies describe what must be rebuilt and why. Make decides what
390 work is necessary.
391  
392 =item * B<bash> - performs process orchestration.
393  
394 Shell recipes connect command-line tools, manage files and temporary
395 state, and express the small imperative steps needed to carry out a
396 build action.
397  
398 =item * B<Perl> - handles transformations that deserve a real
399 programming language.
400  
401 Dependency analysis, metadata generation, configuration processing,
402 distribution assembly, and other non-trivial transformations remain
403 readable and testable Perl rather than growing into increasingly
404 complex shell fragments.
405  
406 =back
407  
408 C<CPAN::Maker::Bootstrapper> provides the conventions that connect
409 those layers.
410  
411 GNU make owns the dependency graph, bash performs the orchestration,
412 and Perl implements the complex transformations. The result is a
413 build system that remains visible and auditable: C<make -n> shows what
414 would run, C<bash -x> exposes shell execution, C<make help> documents
415 the available targets, and F<project.mk> provides an upgrade-safe place
416 for project-specific behavior.
417  
418 =head2 Best Practices Out of the Box
419  
420 The installed build system makes several professional development
421 practices part of the project structure without forcing them on the
422 developer on every build:
423  
424 =over 4
425  
426 =item * B<Editable source and generated artifacts are distinct> -
427 F<.pm.in> and F<.pl.in> files are the project sources; the corresponding
428 F<.pm> and F<.pl> files are generated artifacts. Changes belong in the
429 F<.in> files and are propagated by C<make>.
430  
431 =item * B<Dependencies are derived from the source> -
432 C<scandeps-static.pl> maintains F<requires>, F<test-requires>,
433 F<recommends>, and F<suggests> as the source changes. Pinning, sticky
434 entries, and skip lists allow the generated dependency model to be
435 adjusted when necessary.
436  
437 =item * B<Quality checks are part of the dependency graph> -
438 syntax checking, C<perltidy>, C<perlcritic>, and POD validation are
439 build gates rather than separate release-time procedures. The gates
440 remain independently controllable when a project needs different
441 development or runtime behavior.
442  
443 =item * B<Managed build policy remains upgradeable> -
444 C<make update> refreshes the build framework installed beneath
445 F<.includes/>, while C<make upgrade> checks for and installs newer
446 versions of C<CPAN::Maker::Bootstrapper>.
447  
448 =item * B<Project-specific behavior stays outside managed files> -
449 F<project.mk> is the upgrade-safe extension point for custom targets,
450 additional dependencies, lifecycle hooks, and project-specific
451 variables. Projects extend the framework without modifying the files
452 maintained by the bootstrapper.
453  
454 =back
455  
456 =head2 Perl Quality Tools
457  
458 The build system supports syntax checking, perltidy, and perlcritic as
459 build-time quality gates.
460  
461 Syntax checking is controlled independently with C<SYNTAX_CHECKING>:
462  
463 make SYNTAX_CHECKING=OFF
464  
465 Perltidy and perlcritic are controlled by C<LINT>, which acts as the
466 master switch for both tools:
467  
468 make LINT=OFF
469  
470 The tools may also be disabled individually:
471  
472 make PERLTIDY=""
473 make PERLCRITIC=""
474  
475 This allows one linting tool to remain enabled while the other is
476 disabled.
477  
478 C<PERLTIDYRC> and C<PERLCRITICRC> configure the corresponding tools;
479 they do not enable or disable them.
480  
481 For example:
482  
483 make PERLTIDYRC=.perltidyrc
484 make PERLCRITICRC=.perlcriticrc
485  
486 If no profile is specified, the corresponding tool uses its default
487 configuration.
488  
489 If a profile variable names a file that does not exist, the operation
490 fails.
491  
492 Modules or scripts that cannot be syntax-checked outside their runtime
493 environment may be added to C<PERLWC_SKIP> in F<project.mk>:
494  
495 PERLWC_SKIP = bin/startup.pl
496  
497 Inter-module build dependencies may also be declared explicitly in
498 F<project.mk> when they cannot be inferred automatically:
499  
500 lib/Foo/Bar.pm: lib/Foo.pm
501  
502 C<make quick> provides a fast development build that disables
503 distribution dependency scanning and both lint tools while leaving
504 syntax checking enabled:
505  
506 make quick
507  
508 This is equivalent to:
509  
510 make SCAN=OFF LINT=OFF
511  
512 =head2 A GNU Make Tutorial in Disguise
513  
514 Because the build system is implemented with ordinary GNU make, the
515 managed files beneath F<.includes/> are also working examples of the
516 techniques used to model a non-trivial build.
517  
518 They include:
519  
520 =over 4
521  
522 =item * Pattern rules and sentinel files for incremental quality gates
523  
524 =item * C<define>/C<endef> blocks for reusable shell and Perl fragments
525  
526 =item * C<$(shell ...)>, C<$(eval ...)>, C<$(call ...)>,
527 C<$(filter-out ...)>, C<$(addprefix ...)>, and C<$(patsubst ...)> for
528 deriving and transforming build state
529  
530 =item * C<?=>, C<:=>, C<+=>, and C<=> with their distinct evaluation
531 semantics
532  
533 =item * Order-only prerequisites, C<.DEFAULT_GOAL>, C<-include>, and
534 C<.SHELLFLAGS := -ec>
535  
536 =item * C<mktemp>, shell traps, and bash conditionals inside recipes
537  
538 =item * Perl programs embedded in make variables when a transformation
539 is better expressed in Perl than in shell
540  
541 =back
542  
543 The build system is deliberately transparent to not only reveal I<how
544 the sausage is made> but to expose these techniques to the developer
545 so you can incorporate them in your recipes. However, the build sysetm
546 framework itself is read-only to discourage you from tampering with a
547 complex set of recipes that have been carefully crafted and can easily
548 be broken. Your extension point remains the F<project.mk> file and the
549 double-colon targets.
550  
551 =head1 IMPORTING FILES
552  
553 The C<--import|-I> option allows you to bring existing Perl source
554 files into a new Bootstrapper project. This is the primary mechanism
555 for migrating an existing project or consuming a scaffold tarball
556 generated by C<cli-simple -scaffold>.
557  
558 The C<--import> option may be specified multiple times to import from
559 several directories in a single operation:
560  
561 cmb --module My::Script \
562 --import /path/to/roles \
563 --import /path/to/bin \
564 --installdir .
565  
566 =head2 Determining the Primary Module
567  
568 The bootstrapper determines the primary module name in the following
569 order:
570  
571 =over 4
572  
573 =item 1. C<--module>
574  
575 If C<--module> is supplied, that value is used.
576  
577 =item 2. Custom stub
578  
579 If no module name was supplied and C<--stub> names a file, the first
580 package found in that file is used.
581  
582 =item 3. Installation directory
583  
584 If the module name is still unknown and C<--installdir> was supplied,
585 the bootstrapper derives the module name from the installation directory
586 name.
587  
588 =item 4. Single import directory
589  
590 If the module name is still unknown and exactly one C<--import> path was
591 supplied, the bootstrapper derives the module name from the basename of
592 that directory.
593  
594 For example:
595  
596 cd Foo-Bar
597 cmb --import .
598  
599 infers C<Foo::Bar>.
600  
601 =back
602  
603 When deriving a module name from a directory name, hyphens are converted
604 to C<::>, so F<Foo-Bar> implies C<Foo::Bar>.
605  
606 The resulting name must be a valid Perl module name.
607  
608 When importing an existing project, the corresponding module file must
609 also exist beneath one of the import paths. For example, C<Foo::Bar>
610 must be found as F<Foo/Bar.pm> somewhere beneath one of the directories
611 supplied with C<--import>.
612  
613 =head2 What Gets Imported
614  
615 When importing an existing project, the bootstrapper scans each
616 C<--import> directory and builds an explicit import plan.
617  
618 The following files are recognized:
619  
620 =over 4
621  
622 =item * Perl modules
623  
624 Files ending in F<.pm> are imported as distribution modules and placed
625 beneath F<lib/>.
626  
627 For example:
628  
629 lib/Foo/Bar.pm
630  
631 becomes:
632  
633 lib/Foo/Bar.pm.in
634  
635 The package declared by the module determines its destination beneath
636 F<lib/>.
637  
638 =item * Perl scripts
639  
640 Files ending in F<.pl> are imported beneath F<bin/> and converted to
641 generated source files ending in F<.in>.
642  
643 =item * Executable files
644  
645 Executable files not otherwise classified are imported beneath F<bin/>
646 and converted to generated source files ending in F<.in>.
647  
648 =item * Test files and test helpers
649  
650 Files beneath the following recognized test directories are preserved in
651 place:
652  
653 t/
654 xt/author/
655 xt/release/
656 xt/smoke/
657  
658 Within those directories, files with the following extensions are
659 treated as test material:
660  
661 .pm
662 .pl
663 .t
664 .sh
665 .dat
666  
667 The directory takes precedence over the file extension. For example:
668  
669 t/lib/TestHelper.pm
670  
671 remains:
672  
673 t/lib/TestHelper.pm
674  
675 and is not imported as:
676  
677 lib/TestHelper.pm.in
678  
679 Likewise:
680  
681 xt/author/check.pl
682  
683 remains beneath F<xt/author/>.
684  
685 =item * Change logs
686  
687 The following root-level change log files are preserved when present:
688  
689 ChangeLog
690 CHANGELOG
691 Changes
692 CHANGES
693  
694 Their original names are retained.
695  
696 =back
697  
698 Files not matching one of the recognized categories are not imported.
699  
700 =head2 Excluding Import Paths
701  
702 Use C<--exclude> to omit directories beneath an import root.
703  
704 The option may be supplied more than once:
705  
706 cmb --import .
707 --exclude local
708 --exclude Foo-Bar-1.2.3
709  
710 Each exclusion is interpreted relative to the import root and excludes
711 that directory and everything beneath it.
712  
713 For example:
714  
715 --exclude local
716  
717 excludes:
718  
719 local/
720 local/lib/
721 local/bin/
722  
723 but does not exclude an unrelated directory with the same name outside
724 the import root.
725  
726 The following source-control directories are always excluded and do not
727 need to be specified explicitly:
728  
729 .git
730 .hg
731 .svn
732  
733 These directories are pruned wherever they occur beneath an import
734 root.
735  
736 =head2 Previewing an Import
737  
738 Use C<--dry-run> to inspect the import plan without modifying the
739 filesystem or running the generated build.
740  
741 For example:
742  
743 cmb --import .
744 --exclude local
745 --dry-run
746  
747 The bootstrapper scans the import directories, applies exclusions,
748 classifies the recognized files, determines their destinations, and
749 prints the resulting import plan.
750  
751 No installation directory is created, no files are copied, and C<make>
752 is not run.
753  
754 This is useful when importing an existing project because it allows the
755 proposed mapping to be reviewed before any project files are generated.
756  
757 =head2 Creating a Project Tarball
758  
759 Use C<--project-tarball> to create an archive containing the complete
760 generated CPAN::Maker::Bootstrapper project instead of installing that
761 project into a directory.
762  
763 For example:
764  
765 cmb --import .
766 --exclude local
767 --project-tarball
768  
769 The bootstrapper performs the normal import and build process in a
770 temporary working directory and then writes a project archive to the
771 directory from which C<cmb> was invoked.
772  
773 For a module named C<Foo::Bar>, the resulting archive is named:
774  
775 Foo-Bar-cmb.tar.gz
776  
777 The archive contains a top-level project directory:
778  
779 Foo-Bar/
780  
781 and includes the generated CPAN::Maker::Bootstrapper project, including
782 the Makefile, build configuration, imported source files, test files,
783 build support files, logs, and the generated CPAN distribution tarball.
784  
785 This is different from the CPAN distribution tarball produced by the
786 build. The CPAN distribution contains the files intended for release to
787 CPAN; the project tarball contains the complete CPAN::Maker::Bootstrapper
788 development project used to build that distribution.
789  
790 The temporary dependency installation directory used during the import
791 build is not included in the project archive.
792  
793 =head2 Import Destination Safety
794  
795 When importing an existing project into a directory, the bootstrapper
796 refuses to create the generated project inside one of the directories
797 being imported.
798  
799 For example, this is not allowed:
800  
801 cmb --import . --installdir ./converted
802  
803 when F<converted/> would be created beneath the import root.
804  
805 The bootstrapper also refuses to use the import root itself as the
806 installation directory.
807  
808 These checks prevent the generated project from becoming part of the
809 source tree while that source tree is being scanned and imported.
810  
811 C<--force> does not override this safety check.
812  
813 The check applies only when installing the generated project into a
814 directory. C<--project-tarball> does not create an installation
815 directory and therefore does not require this restriction.
816  
817 =head2 Import Build Policy
818  
819 After constructing the imported project, the bootstrapper runs the
820 generated build to verify that the project can be built successfully.
821  
822 The import build uses the following defaults:
823  
824 SCAN=on
825 SYNTAX_CHECKING=on
826 LINT=off
827  
828 Dependency scanning and syntax validation therefore remain enabled
829 during import.
830  
831 Linting is disabled by default because importing an existing project
832 should not require that project to satisfy the bootstrapper's
833 perltidy or perlcritic policy before it can be converted.
834  
835 These defaults may be overridden through the corresponding environment
836 variables.
837  
838 For example:
839  
840 LINT=on cmb --import .
841  
842 enables linting during the import build.
843  
844 This setting applies only to the bootstrap import build. The generated
845 project retains its normal build configuration and may enable linting
846 for subsequent C<make> invocations.
847  
848 =head2 Next Steps After a Successful Import
849  
850 After a successful build you have a complete, buildable CPAN
851 distribution, although it may not reflect everything you need for your
852 project. Typical next steps:
853  
854 =over 4
855  
856 =item 1. Review and edit the generated F<buildspec.yml> - verify the
857 module name, author, and resource links are correct
858  
859 =item 2. Manually import files missed by the importer
860  
861 Your project may want to package additional files that are installed
862 into the distribution's share directory. Move them into an appropriate
863 directory or the root of the project and add them to the
864 F<buildspec.yml> file.
865  
866 extra_files:
867 - ChangeLog <= included in distribution tarball, but not installed
868 share:
869 - config/some-file.ini <= installs config/some-file.in into the distribution's share directory
870 - my-app.json <= installs my-app.json from the root of your project into the distribution's share directory
871  
872 =item 3. Initialize a git repository with C<make git>
873  
874 =item 4. Run C<make tidy> if you want to format the imported source
875  
876 make tidy
877  
878 Perltidy uses C<PERLTIDYRC> when configured and otherwise uses its
879 default configuration.
880  
881 =item 5. Run C<make> to produce the final distribution tarball
882  
883 By default the generated build performs syntax checking, dependency
884 scanning, perltidy, and perlcritic.
885  
886 Dependency scanning may be disabled with:
887  
888 make SCAN=OFF
889  
890 Perltidy may be disabled independently with:
891  
892 make PERLTIDY=""
893  
894 Perlcritic may be disabled independently with:
895  
896 make PERLCRITIC=""
897  
898 Both lint tools may be disabled together with:
899  
900 make LINT=OFF
901  
902 To disable dependency scanning and both lint tools while retaining
903 syntax checking, use:
904  
905 make quick
906  
907 =item 6. Test installation
908  
909 cpanm -n -v ./My-Script-1.0.0.tar.gz
910  
911 =back
912  
913 =head2 Limitations
914  
915 =over 4
916  
917 =item * C<--import> cannot be used with C<--stub> - they are mutually
918 exclusive ways to create the initial source
919  
920 =item * The importer uses the package declarations inside C<.pm> files
921 to determine where to place them under F<lib/>. If the importer cannot
922 match the filename with a package declaration inside the file, it will
923 warn and skip that file
924  
925 =item * Imported files are not tidied automatically.
926  
927 Run C<make tidy> after import if you want to format the imported source.
928  
929 If C<PERLTIDYRC> is configured, that profile is used. Otherwise
930 perltidy runs with its default configuration.
931  
932 =item * Inter-module dependencies are normally detected automatically.
933 The build generates F<deps.mk> from dependencies between modules in the
934 distribution so prerequisite modules are built before syntax checking
935 modules that depend on them.
936  
937 If a dependency cannot be inferred automatically, declare it explicitly
938 in F<project.mk>:
939  
940 lib/My/Script.pm: \
941 lib/My/Script/Role/Frobnicate.pm \
942 lib/My/Script/Role/List.pm
943  
944 See L</Inter-module dependencies> for details.
945  
946 =back
947  
948 =head2 Importing a CLI::Simple Scaffold Tarball
949  
950 Suppose you have a project that used C<CLI::Simple> as base class and
951 now want to use the C<CPAN::Maker::Bootstrapper> framework.
952  
953 The C<import-scaffold> command is a convenience wrapper around
954 C<--import> specifically designed to consume tarballs generated by
955 C<cli-simple -scaffold>:
956  
957 cmb import-scaffold my-script-roles.tar.gz --module My::Script --installdir .
958  
959 The tarball is extracted to a temporary directory and fed to the
960 importer automatically. See L<CLI::Simple> for details on generating
961 scaffold tarballs.
962  
963 =head1 CONFIGURATION
964  
965 C<cmb> can read configuration from your global F<.gitconfig> or from
966 a separate C<.ini> file. Configuration values are used when
967 scaffolding distributions and by the AI-assisted commands.
968  
969 git config --global user.github <your-username>
970  
971 If you typically create projects in one directory, add the C<basedir>
972 option:
973  
974 git config --global cpan-maker.basedir $HOME/git
975  
976 When C<--installdir> is not supplied, the bootstrapper uses C<basedir>
977 from the configuration when one is defined. Otherwise, it uses the
978 current working directory as the base directory for the new project.
979  
980 An explicit C<--installdir> always takes precedence.
981  
982 A separate configuration file may contain entries such as:
983  
984 [user]
985 email = your-email@somedomain
986 name = First Last
987 # use to construct GitHub resource URLs
988 github = github-user
989  
990 [cpan-maker]
991 basedir = /home/myhome/git
992 # indicates the resources section of Makefile.PL should contain github references
993 resources = github
994 llm-api-key-helper = cat ~/.ssh/anthropic-api-key
995  
996 =over 4
997  
998 =item C<llm-api-key-helper>
999  
1000 For LLM commands (code-review, pod-review), you can specify a
1001 shell command that outputs your API key without exposing it in shell
1002 history:
1003  
1004 llm-api-key-helper = cat ~/.ssh/anthropic-api-key
1005  
1006 When set, this command is executed to retrieve the API key, avoiding
1007 the need to pass it on the command line or set it in the environment
1008 manually. This is the recommended secure approach.
1009  
1010 See L<CPAN::Maker::ConfigReader> for a complete description of the
1011 configuration file.
1012  
1013 Use the C<--config> option to use your custom config.
1014  
1015 You can generate a starter configuration with:
1016  
1017 cmb create-config > ~/.cpan-makerrc
1018  
1019 Then point C<cmb> at it by setting the
1020 C<CPAN_MAKER_CONFIG> environment variable in your shell profile:
1021  
1022 export CPAN_MAKER_CONFIG=$HOME/.cpan-makerrc
1023  
1024 =back
1025  
1026 =head2 Environment
1027  
1028 =over 4
1029  
1030 =item LLM_API_KEY
1031  
1032 Your Anthropic Claude API key. Set this before running any LLM command
1033 (code-review, pod-review, release-notes).
1034  
1035 The key is removed from environment so it is not inherited by child
1036 processes such as 'make'. This does not protect against memory
1037 inspection of the current process - see L<LLM::API> for how the key is
1038 actually stored using a closure to prevent accidental serialization
1039 via Dumper.
1040  
1041 Avoid passing the key on the command line where it might be saved in
1042 history and can be seen in process lists.
1043  
1044 =item CPAN_MAKER_CONFIG
1045  
1046 Path to a configuration file (in .ini format) containing user settings
1047 such as name, email, GitHub username, and project base directory. If
1048 not set, the bootstrapper will attempt to read settings from
1049 ~/.gitconfig.
1050  
1051 =item SCAN
1052  
1053 Controls dependency scanning during C<make>. Set to C<OFF> to disable
1054 distribution dependency scanning. The default is C<ON>.
1055  
1056 =back
1057  
1058 =head1 INSTALLED PROJECT FILES
1059  
1060 The following files are installed into the project directory:
1061  
1062 =over 4
1063  
1064 =item * C<Makefile> - the complete build system. Derives project paths
1065 and names from C<MODULE_NAME>, the package name in a custom stub, or
1066 the project directory name. See L</THE PROJECT MAKEFILE>.
1067  
1068 =item * C<buildspec.yml> - generated from the template, pre-populated
1069 with your module name, git identity, GitHub username, and project URLs.
1070  
1071 =item * C<lib/E<lt>Module/PathE<gt>.pm.in> - stub module, populated from
1072 either C<class-module.pm.tmpl> or C<cli-module.pm.tmpl> when
1073 C<--stub cli> is used.
1074  
1075 I<Note: Files under F<lib/> and F<bin/> use C<.pm.in> and C<.pl.in>
1076 as editable sources. The generated C<.pm> and C<.pl> files are derived
1077 from them by the Makefile and will be overwritten by subsequent
1078 builds.>
1079  
1080 =item * C<t/00-E<lt>project-nameE<gt>.t> - minimal smoke test that calls
1081 C<use_ok> on your module.
1082  
1083 =item * F<.includes/> - the managed build system directory. Contains
1084 all C<.mk> files installed and maintained by the bootstrapper. These
1085 files are write-protected and should never be edited directly. Updated
1086 with C<make update>.
1087  
1088 .includes/bootstrap.mk - used internally by the bootstrapper
1089 .includes/bash-completion.mk - make bash-completion target
1090 .includes/build-init.mk - used to initialize build-time variables
1091 .includes/modulino.mk - make modulino target
1092 .includes/git.mk - make git target
1093 .includes/help.mk - make help target
1094 .includes/local.mk - vendors dependencies for syntax checking
1095 .includes/perl.mk - pattern rules, syntax checking, tidy, critic
1096 .includes/publish.mk - publish to CPAN
1097 .includes/release-notes.mk - make release-notes target
1098 .includes/test.mk - recipes for the test targets; test, test-all, etc
1099 .includes/update.mk - make update target
1100 .includes/upgrade.mk - make upgrade/check-upgrade targets
1101 .includes/version.mk - make release/minor/major targets
1102  
1103 =item * F<project.mk> - your extension point for custom make rules,
1104 inter-module dependencies, and project-specific variables. Never
1105 touched by C<make update>. See L</EXTENDING THE BUILD SYSTEM>.
1106  
1107 =item * F<modulino.tmpl> - template used by C<make modulino> to
1108 generate bash wrapper scripts for modulino-style modules.
1109  
1110 =item * F<VERSION> - contains the current version string in
1111 C<major.minor.patch> format. Managed by C<make release>, C<make minor>,
1112 and C<make major>.
1113  
1114 =item * F<ChangeLog> - empty placeholder, required by the distribution.
1115  
1116 =item * F<.prompts/>
1117  
1118 The directory is created automatically the first time C<pod-review>
1119 or C<code-review> needs the default prompt files.
1120  
1121 =item * F<config.mk> - developer-maintained Make configuration for
1122 persistent project build settings. This file is not managed by
1123 C<make update>.
1124  
1125 =item * F<build-config.mk> - generated Make configuration containing
1126 resolved project values and discovered build helper commands. It is
1127 created automatically as needed and should not be edited or committed.
1128  
1129 =back
1130  
1131 =head1 THE PROJECT MAKEFILE
1132  
1133 The installed Makefile is self-configuring. It can derive the primary
1134 module from C<MODULE_NAME>, the package name inside a custom stub, or
1135 the project directory name.
1136  
1137 For example, a primary module of C<My::New::Module> produces:
1138  
1139 MODULE_PATH - lib/My/New/Module.pm (from MODULE_NAME)
1140 PROJECT_NAME - My-New-Module (from MODULE_NAME)
1141 TARBALL - My-New-Module-1.0.0.tar.gz (from PROJECT_NAME + VERSION)
1142  
1143 If C<MODULE_NAME> is not supplied on the command line, it is inferred
1144 from the project directory name.
1145  
1146 At build initialization, C<cmb create-build-config> resolves project
1147 paths, defaults, and configured helper commands into F<build-config.mk>,
1148 which is then included by Make. Developer overrides belong in
1149 F<config.mk>; F<build-config.mk> is generated state.
1150  
1151 Key Makefile targets:
1152  
1153 =over 4
1154  
1155 =item C<make> / C<make all>
1156  
1157 Builds the distribution tarball. When dependency scanning is enabled,
1158 updates F<requires>, F<test-requires>, F<recommends>, and F<suggests>,
1159 and generates F<README.md> as prerequisites.
1160  
1161 =item C<make bash-completion>
1162  
1163 Generates and installs a bash completion function for your project's
1164 modulino, then prints the C<source> line to enable it. The function is
1165 produced by C<< <modulino> -generate-completion >> (available to any
1166 C<CLI::Simple>-based modulino) and written to
1167 F<~/.local/share/bash-completion/completions/E<lt>aliasE<gt>>.
1168  
1169 make bash-completion
1170 # then, as it instructs:
1171 source ~/.local/share/bash-completion/completions/<alias>
1172  
1173 The target depends on the modulino, so it will build F<bin/E<lt>aliasE<gt>>
1174 first if needed. Completion is only available for modulinos that
1175 subclass C<CLI::Simple>.
1176  
1177 =item C<make help>
1178  
1179 Lists the available build targets and commonly used build variables.
1180 Project-specific targets in F<project.mk> are included when their
1181 target definition contains a C<##> description.
1182  
1183 =item C<make requires> / C<make test-requires>
1184  
1185 Scans source files with C<scandeps-static.pl> and writes the dependency
1186 files specified in the C<buildspec.yml> file used by C<make-cpan-dist.pl>.
1187  
1188 Any change to your C<.pm.in> files will trigger a rescan of your
1189 modules for new dependencies. This can add a significant delay when
1190 you have many modules and a large number of dependencies. You can
1191 avoid the scan if you know that no new dependencies have been added by
1192 setting the environment variable C<SCAN> to C<OFF> (case insensitive).
1193  
1194 make SCAN=OFF
1195  
1196 You can make scanning deliberate by adding C<SCAN=OFF> to your
1197 F<config.mk> file. Then, to rescan:
1198  
1199 make SCAN=ON
1200  
1201 =item C<make recommends> / C<make suggests>
1202  
1203 Companion targets to C<make requires>. The dependency scanner classifies
1204 each discovered module into one of three tiers: hard C<requires>,
1205 C<recommends> (soft, non-eval conditional dependencies), and C<suggests>
1206 (eval-wrapped, optional dependencies).
1207  
1208 These files are consumed by L<CPAN::Maker> when it generates the
1209 distribution metadata, including the corresponding dependency sections
1210 in F<Makefile.PL>. See L</Dependencies Management>.
1211  
1212 =item C<DARKPAN_REQUIRES>
1213  
1214 Set C<DARKPAN_REQUIRES> to a true value (C<1>, C<yes>, C<on>, or
1215 C<si>) to generate dependency manifests for modules available from a
1216 configured DarkPAN.
1217  
1218 This is useful when a distribution published to CPAN has one or more runtime
1219 dependencies that are intentionally hosted on a separate CPAN-compatible
1220 repository. CPAN metadata can still declare those dependencies normally, but
1221 standard installers need additional information to locate distributions that
1222 should be obtained from the DarkPAN.
1223  
1224 The generated DarkPAN manifests provide that information without duplicating
1225 the dependency declarations maintained in F<requires>. They are included in
1226 the distribution as installation aids for the person or process installing
1227 the module. They are not automatically consulted by Perl installers during a
1228 normal installation; the installer must explicitly use the appropriate
1229 manifest or configure the DarkPAN repository.
1230  
1231 When enabled, C<DARKPAN_URL> must specify the base URL of the
1232 CPAN-compatible repository:
1233  
1234 DARKPAN_REQUIRES = yes
1235 DARKPAN_URL = https://cpan.example.com/repository
1236  
1237 C<make> examines F<requires> and generates:
1238  
1239 cpanfile.darkpan
1240 cpanm.darkpan
1241  
1242 When C<DARKPAN_REQUIRES> is enabled, F<cpanfile.darkpan> and F<cpanm.darkpan>
1243 are added to F<buildspec.yml> as extra files and are therefore included
1244 in the distribution. They are expected to be tracked by git unless the
1245 developer explicitly adds them to F<extra-files.skip>.
1246  
1247 For each module listed in F<requires>, the build checks whether the module
1248 is available from the configured DarkPAN. Modules found there are added to
1249 the generated DarkPAN manifests.
1250  
1251 For modules available from the DarkPAN, the build also checks MetaCPAN. If
1252 a module is available from both CPAN and the DarkPAN, the DarkPAN version is
1253 preferred and the module remains in the generated manifests. This allows the
1254 DarkPAN to provide a version of a module that is also published on CPAN.
1255  
1256 Modules that should not be obtained from the DarkPAN may be listed in
1257 F<darkpan.skip>, one module name per line. Those modules are omitted from
1258 both generated DarkPAN manifests.
1259  
1260 F<cpanfile.darkpan> contains dependencies selected for resolution from
1261 the DarkPAN in cpanfile syntax. F<cpanm.darkpan> contains the same
1262 dependencies in a form suitable for passing to
1263 L<cpanm|App::cpanminus>.
1264  
1265 The configured DarkPAN must publish:
1266  
1267 modules/02packages.details.txt.gz
1268  
1269 under C<DARKPAN_URL>.
1270  
1271 =item C<make package>
1272  
1273 Runs the quality and dependency gates together (C<lint> plus a
1274 dependency scan) - a convenience for pre-release verification.
1275  
1276 =item C<TARBALL_ORDER_ONLY_PREREQS>
1277  
1278 Additional order-only prerequisites for the distribution tarball.
1279  
1280 Set this in F<project.mk> when project-specific generated artifacts or
1281 other preparation steps must complete before the tarball is built but
1282 should not themselves determine whether the tarball is out of date.
1283  
1284 TARBALL_ORDER_ONLY_PREREQS += prepare-assets
1285  
1286 =item C<make release> / C<make minor> / C<make major>
1287  
1288 Bumps the patch, minor, or major version number in C<VERSION>.
1289  
1290 =item C<make release-notes>
1291  
1292 Generates the diff, file list, Git status, and draft release tarball
1293 used as evidence for LLM-generated release notes.
1294  
1295 =item C<make clean>
1296  
1297 Removes build artifacts registered for cleaning. Does not affect
1298 F<buildspec.yml>, F<VERSION>, or any C<*.in> source files.
1299  
1300 If your project needs a project-specific clean recipe, use the
1301 C<clean-local> target with a double-colon.
1302  
1303 clean-local::
1304 rm -rf workdir
1305  
1306 =item C<make test>
1307  
1308 Runs the project's distribution unit tests under F<t/>:
1309  
1310 prove -I lib -I local/lib/perl5 -v t/
1311  
1312 C<make test> also runs any project-specific C<test-local::> recipes
1313 defined in F<project.mk>.
1314  
1315 Projects may have tests that exercise development infrastructure,
1316 external services, generated artifacts, or other behavior that should
1317 not be included in the CPAN distribution. These can be added through
1318 the C<test-local::> extension point:
1319  
1320 test-local::
1321 ./bin/test-integration
1322  
1323 The double-colon form allows F<project.mk> to extend the managed
1324 C<test-local> target without replacing it.
1325  
1326 C<make test> also recognizes the conventional extended-test
1327 directories F<xt/author/>, F<xt/release/>, and F<xt/smoke/>. These
1328 test suites are not run by default, but may be enabled through the
1329 corresponding environment or make variables:
1330  
1331 AUTHOR_TESTING=1 make test
1332 RELEASE_TESTING=1 make test
1333 AUTOMATED_TESTING=1 make test
1334  
1335 When enabled, C<make test> invokes the corresponding test target after
1336 the normal F<t/> test suite and C<test-local::> recipes have completed.
1337  
1338 =item C<make test-author>
1339  
1340 Runs tests under F<xt/author/>:
1341  
1342 prove -I lib -I local/lib/perl5 -r xt/author
1343  
1344 The F<xt/author/> directory is created automatically if it does not
1345 already exist.
1346  
1347 This target uses a double-colon rule and may therefore be extended in
1348 F<project.mk> without replacing the managed target:
1349  
1350 test-author::
1351 ./bin/check-generated-docs
1352  
1353 =item C<make test-release>
1354  
1355 Runs tests under F<xt/release/>:
1356  
1357 prove -I lib -I local/lib/perl5 -r xt/release
1358  
1359 The F<xt/release/> directory is created automatically if it does not
1360 already exist.
1361  
1362 The target may be extended in F<project.mk> using C<test-release::>.
1363  
1364 =item C<make test-smoke>
1365  
1366 Runs tests under F<xt/smoke/>:
1367  
1368 prove -I lib -I local/lib/perl5 -r xt/smoke
1369  
1370 The F<xt/smoke/> directory is created automatically if it does not
1371 already exist.
1372  
1373 The target may be extended in F<project.mk> using C<test-smoke::>.
1374  
1375 =item C<make test-all>
1376  
1377 Runs the complete test suite: distribution tests under F<t/>, any
1378 project-specific C<test-local::> recipes, and the author, release, and
1379 smoke test suites.
1380  
1381 It is equivalent to running:
1382  
1383 make test AUTHOR_TESTING=1 RELEASE_TESTING=1 AUTOMATED_TESTING=1
1384  
1385 The extended test directories follow established Perl distribution
1386 conventions. C<CPAN::Maker::Bootstrapper> preserves those conventions
1387 rather than requiring imported or existing projects to reorganize
1388 their tests.
1389  
1390 =item C<make tidy>
1391  
1392 Runs C<perltidy> on all C<.pm.in> and C<.pl.in> source files.
1393  
1394 If C<PERLTIDYRC> is set, the named profile is used:
1395  
1396 make tidy PERLTIDYRC=.perltidyrc
1397  
1398 If C<PERLTIDYRC> is not set, perltidy runs using its default
1399 configuration.
1400  
1401 If C<PERLTIDYRC> names a file that does not exist, the target fails.
1402  
1403 The target also performs syntax checking before modifying the source
1404 files.
1405  
1406 =item C<make critic>
1407  
1408 Runs C<perlcritic> on the project's Perl source files.
1409  
1410 If C<PERLCRITICRC> is set, the named profile is used:
1411  
1412 make critic PERLCRITICRC=.perlcriticrc
1413  
1414 If C<PERLCRITICRC> is not set, perlcritic runs using its default
1415 configuration.
1416  
1417 If C<PERLCRITICRC> names a file that does not exist, the target fails.
1418  
1419 The target also honors:
1420  
1421 PERLCRITIC_THEME
1422 PERLCRITIC_SEVERITY
1423  
1424 and performs syntax checking before running perlcritic.
1425  
1426 =item C<make lint>
1427  
1428 Runs both linting targets:
1429  
1430 make tidy
1431 make critic
1432  
1433 The perltidy and perlcritic configuration variables described above
1434 apply to their respective targets.
1435  
1436 =item C<make git>
1437  
1438 Initializes a git repository, stages all recommended project files
1439 including F<.includes/*>, and makes an initial C<BigBang> commit.
1440  
1441 =item C<make quick>
1442  
1443 Builds the distribution tarball with distribution dependency scanning
1444 and perltidy/perlcritic disabled. Syntax checking remains enabled.
1445  
1446 Useful during active development when you want fast iterative builds
1447 without updating F<requires>, F<test-requires>, F<recommends>, or
1448 F<suggests>.
1449  
1450 make quick
1451  
1452 Equivalent to:
1453  
1454 make SCAN=OFF LINT=OFF
1455  
1456 =item C<make workflow>
1457  
1458 Installs a CI build script (F<builder>), its default environment file
1459 (F<builder.env>), and a GitHub Actions workflow
1460 (F<.github/workflows/build.yml>) into your project, templated with your
1461 module and project name. Also merges any build-only dependencies
1462 C<builder> needs into F<build-requires>.
1463  
1464 make workflow
1465 git add build-requires builder builder.env .github/workflows/build.yml
1466  
1467 Commit these files - GitHub Actions will then run C<./builder> on
1468 every push to C<main> or C<dev>. See L</Continuous Integration> for
1469 what C<builder> does, how to customize its environment and build
1470 lifecycle, and how to run it outside of GitHub Actions.
1471  
1472 =item C<make build-ci>
1473  
1474 Runs F<builder> locally inside Docker, against your current working tree,
1475 to reproduce a CI build without pushing. Requires C<docker> and a
1476 F<builder> script (run C<make workflow> first if you don't have one).
1477  
1478 make build-ci
1479  
1480 See L</Continuous Integration> for the variables that control this
1481 target.
1482  
1483 =back
1484  
1485 =head2 README.md
1486  
1487 The F<Makefile> will automatically create a F<README.md> from your
1488 Perl module's pod. The stock F<buildspec.yml> will include that
1489 F<README.md> in the distribution's share directory. If you want the
1490 F<README.md> to be included in the distribution but not installed,
1491 edit the F<buildspec.yml> file.
1492  
1493 B<Before>
1494  
1495 extra-files:
1496 - ChangeLog
1497 - share:
1498 - README.md
1499  
1500 B<After>
1501 extra-files:
1502 - ChangeLog
1503 - README.md
1504  
1505 If you want to generate F<README.md> from a custom source, create a
1506 F<README.md.in> file. That file will be filtered through
1507 F<md-utils.pl> (from L<Markdown::Render>) to produce a C<.md> file.
1508  
1509 =head1 COMMANDS
1510  
1511 =over 4
1512  
1513 =item install (default)
1514  
1515 Scaffolds a new project. This is the default command, so:
1516  
1517 cmb -m My::Module
1518  
1519 ...is the same as:
1520  
1521 cmb -m My::Module install
1522  
1523 =item create-config
1524  
1525 Outputs a stub configuration file to STDOUT. Create and edit a new
1526 config to customize the behavior of C<cmb>.
1527  
1528 cmb create-config > ~/.cpan-makerrc
1529  
1530 Then set C<CPAN_MAKER_CONFIG> to point to it:
1531  
1532 export CPAN_MAKER_CONFIG=$HOME/.cpan-makerrc
1533  
1534 =item deps-filter
1535  
1536 cmb deps-filter requires
1537  
1538 Filters a dependency list so that modules already provided by another
1539 listed distribution are removed.
1540  
1541 The command consults the public CPAN package index and any repositories
1542 listed in F<build-mirrors>. Repository indexes are cached under the
1543 user's cache directory and conditionally refreshed on subsequent runs.
1544  
1545 This command is normally invoked automatically by the generated
1546 Makefile for C<requires>, C<recommends>, C<suggests>, and
1547 C<test-requires>.
1548  
1549 =item dist-file
1550  
1551 cmb dist-file distribution-name filename
1552  
1553 Copies a distribution file to STDOUT. Searches the root and F<share/>
1554 directories of the distribution for file. Throws and exception if
1555 either the file is not found or the distribution is invalid.
1556  
1557 Example:
1558  
1559 cmb dist-file CPAN-Maker-Bootstrapper builder.env
1560  
1561 =item extra-files
1562  
1563 cmb extra-files path file1 file2 ...
1564  
1565 Adds files to the distribution. Use C<.> for files that should appear
1566 at the root of the distribution tarball but not be installed into the
1567 share directory. Use C<share> for files that should be installed into
1568 the distribution share directory.
1569  
1570 I<NOTE: file should be the relative path within the project that points to the file.>
1571  
1572 Example:
1573  
1574 cmb extra-files . README.md
1575 cmb extra-files share share/config.json
1576  
1577 Entries may be removed by editing F<buildspec.yml> directly, which is
1578 usually the clearest approach.
1579  
1580 The C<cmb extra-files> command also supports removing an entry by
1581 prefixing the filename with C<->:
1582  
1583 cmb extra-files . -README.md
1584  
1585 This is primarily useful from scripts or other automated workflows.
1586  
1587 =item create-deps
1588  
1589 cmb create-deps [module.pm.in ...]
1590  
1591 Emits GNU make dependency rules (to STDOUT) capturing the
1592 B<inter-module> dependencies within your distribution -- i.e. which of
1593 your own C<.pm> files C<use> which others. Uses
1594 L<Module::ScanDeps::Static> to scan each source module, then prints
1595 C<target: prerequisite> lines (in F<deps.mk> form) for the internal
1596 packages only, so C<make> rebuilds a dependent module when a module it
1597 depends on changes. With no arguments every project module is scanned;
1598 name one or more modules to restrict the output.
1599  
1600 =item create-darkpan-requires
1601  
1602 cmb create-darkpan-requires [--filter file] [requires-file]
1603  
1604 Examines F<requires> (or C<requires-file>) and identifies dependencies
1605 available from the configured DarkPAN. Each dependency is checked
1606 against the DarkPAN F<02packages.details.txt.gz> index. Dependencies
1607 found on the DarkPAN are included in the generated manifests.
1608  
1609 For each dependency found on the DarkPAN, MetaCPAN is also checked. If the
1610 module is available from both CPAN and the DarkPAN, a warning is emitted and
1611 the DarkPAN is preferred.
1612  
1613 The optional C<--filter> argument names a file containing module names to
1614 exclude from the generated manifests, one module per line:
1615  
1616 cmb create-darkpan-requires --filter darkpan.skip requires
1617  
1618 This is useful when a module is available from both CPAN and the DarkPAN but
1619 the distribution author wants that dependency to be resolved from CPAN.
1620  
1621 When invoked through the generated Makefile, F<darkpan.skip> is used
1622 automatically when it exists.
1623  
1624 The presence of F<darkpan.skip> affects only which dependencies are
1625 written to the manifests; it does not change the distribution or
1626 source-control treatment of the generated files.
1627  
1628 The generated files are intended as installation aids and are included with
1629 the distribution. They do not alter normal Perl dependency resolution by
1630 themselves and are not automatically consulted during installation. Instead,
1631 they are intended to be consumed explicitly by your installation tool, such
1632 as C<cpm> or C<cpanm>.
1633  
1634 For distributions that include these files, the C<cpan-distfile> utility
1635 provided with L<DarkPAN::Resolver::SQLite> can be used to retrieve them
1636 directly from a CPAN distribution without manually downloading and unpacking
1637 the tarball.
1638  
1639 cpan-distfile Some::Module cpanm.darkpan > cpanm.darkpan
1640  
1641 See L<DarkPAN::Resolver::SQLite> for examples of using these manifests with
1642 C<cpm> and C<cpanm>.
1643  
1644 The command generates two representations of those dependencies:
1645  
1646 cpanfile.darkpan
1647 cpanm.darkpan
1648  
1649 F<cpanfile.darkpan> uses cpanfile syntax:
1650  
1651 requires 'Amazon::API::CloudWatchLogs', '1.43.90';
1652  
1653 F<cpanm.darkpan> contains one cpanm module requirement per line:
1654  
1655 Amazon::API::CloudWatchLogs~1.43.90
1656  
1657 The version constraints are taken from F<requires>; the DarkPAN index
1658 is used only to determine whether a module is available from a DarkPAN
1659 repository.
1660  
1661 This command is normally invoked automatically by C<make> when
1662 C<DARKPAN_REQUIRES> is enabled.
1663  
1664 =item critique
1665  
1666 cmb critique file ...
1667 cmb critique --file-list manifest
1668  
1669 Runs L<Perl::Critic> over the given files (or a newline-delimited
1670 C<--file-list>). Defaults to the C<pbp> theme at severity 5; override
1671 with the C<PERLCRITIC_THEME>, C<PERLCRITIC_SEVERITY>, and
1672 C<PERLCRITICRC> environment variables. Requires L<Perl::Critic> to be
1673 installed.
1674  
1675 =item publish-to-cpan
1676  
1677 cmb publish-to-cpan distribution.tar.gz [username [password]]
1678  
1679 Uploads a distribution tarball to PAUSE.
1680  
1681 The username and password may be supplied as arguments or through
1682 C<PAUSE_USER> and C<PAUSE_PASSWORD>. Normally this command is invoked
1683 by C<make publish>, which rebuilds and tests the distribution before
1684 uploading it.
1685  
1686 =item resolve-vars
1687  
1688 cmb resolve-vars [--vars-file FILE] [--no-strict] source-file
1689  
1690 Filters C<source-file> to STDOUT, substituting C<@TOKEN@> placeholders
1691 with values drawn from the environment (or from a C<--vars-file>). This
1692 is the mechanism the generated F<Makefile> uses to turn F<.pm.in> and
1693 F<.pl.in> sources into their built C<.pm>/C<.pl> counterparts -- for
1694 example filling C<2.4.1> from the F<VERSION> file or
1695 C<@BUILD_DATE@> at build time.
1696  
1697 A placeholder is required to have a value only when it appears in live
1698 code. Placeholders that occur solely inside POD or C<#> comments are
1699 treated as references, not substitutions: they never trigger a "no
1700 value present" error and are left untouched when no value is
1701 available. This lets you document a token in your POD (e.g. mention
1702 C<@BUILD_DATE@> in a description) without breaking the build.
1703  
1704 For placeholders that I<do> appear in code, behavior depends on
1705 C<--strict> (the default):
1706  
1707 =over 4
1708  
1709 =item * B<strict> (default) - a placeholder in code with no value is a
1710 fatal error; the build stops.
1711  
1712 =item * B<--no-strict> - a placeholder in code with no value produces a
1713 warning and is left in place literally (as C<@TOKEN@>) rather than being
1714 substituted to an empty string.
1715  
1716 =back
1717  
1718 See L</C<--vars-file>> and L</C<--strict, --no-strict>>.
1719  
1720 =back
1721  
1722 =head2 LLM Commands
1723  
1724 The following commands require L<LLM::API> to be installed and a valid
1725 Anthropic API key. Set it in the environment before running any LLM command:
1726  
1727 export LLM_API_KEY=$(cat ~/.ssh/anthropic-api-key)
1728  
1729 The key is deleted from the environment immediately after being read and
1730 is never passed to child processes. See L<CPAN::Maker::ConfigReader> for
1731 the C<llm-api-key-helper> option which avoids exposing the key in shell
1732 history entirely.
1733  
1734 I<SECURITY NOTE: Never pass your API key on the command line where it
1735 would be visible in shell history and process listings.>
1736  
1737 =over 4
1738  
1739 =item code-review
1740  
1741 Submits a Perl module or script to the LLM for a code review. POD is
1742 automatically stripped before submission so token costs reflect code
1743 only. The review is written as a JSON file to the current directory.
1744  
1745 cmb code-review [options] lib/My/Module.pm
1746  
1747 The review file is named:
1748  
1749 <module>-review-<timestamp>.code
1750  
1751 A token usage summary is printed to stderr after the review completes.
1752  
1753 If a review has been completed at least once the annotated review file
1754 is automatically sent with your code to re-focus the review. You must
1755 annotate the review file before resubmitting by running the
1756 C<annotate> command and marking each finding with a valid
1757 disposition. See L</THE REVIEW WORKFLOW> for details.
1758  
1759 Options specific to code-review:
1760  
1761 --prompt|-p PATH path to a custom review prompt file
1762 --prompt-profile|-P NAME additive prompt profile (repeatable)
1763 --context|-C PATH context file to submit alongside the review (repeatable)
1764  
1765 I<Note: The prompt profile list and the context file list are written
1766 to the review output file. On subsequent runs these will be read from
1767 the review. You do not need to provide them unless you want to update
1768 their values.>
1769  
1770 =item annotate
1771  
1772 Applies disposition tags to findings in the latest review file and
1773 displays the current annotation state. Must be run from a project
1774 directory (one containing F<.includes/>).
1775  
1776 cmb annotate [options] lib/My/Module.pm
1777  
1778 Without options, displays the current annotation state of the latest
1779 review file. With C<-a> options, applies the specified dispositions
1780 before displaying.
1781  
1782 cmb annotate lib/My/Module.pm
1783 cmb annotate -a 1:wrong -a 2:reject lib/My/Module.pm
1784  
1785 Options:
1786  
1787 --annotate|-a N:DISPOSITION apply disposition to finding N (repeatable)
1788 --auto-annotate|-A annotate and immediately submit the next review
1789 --finalize-annotations|-F create versioned release artifact
1790  
1791 Valid dispositions are C<accept>, C<reject>, C<wrong>,
1792 C<wrong-reconsider>, C<defer>, and C<confirmed> (case
1793 insensitive). See L</THE REVIEW WORKFLOW> for a description of each.
1794  
1795 =item pod-finding
1796  
1797 cmb pod-finding lib/CPAN/Maker/Bootstrapper.pm
1798  
1799 Run this after a C<pod-review> command to display a table of findings.
1800  
1801 =item pod-review
1802  
1803 Submits a Perl module or script to the LLM for a documentation review.
1804 The full file including code is submitted so the LLM can check
1805 consistency between implementation and documentation. If no POD
1806 exists, the LLM generates complete POD documentation suitable for
1807 placement after C<__END__>.
1808  
1809 cmb pod-review lib/My/Module.pm
1810  
1811 The review file is named:
1812  
1813 <module>-review-<timestamp>.pod
1814  
1815 =item release-notes
1816  
1817 Generates release notes for a given version using the LLM. Requires
1818 the release artifacts produced by C<make release-notes>:
1819  
1820 release-<version>.diffs
1821 release-<version>.lst
1822 release-<version>.status
1823 release-<version>.tar.gz
1824  
1825 cmb release-notes <version>
1826  
1827 The generated release notes are written to
1828 C<release-notes-E<lt>versionE<gt>.md>. Binary files are automatically
1829 excluded. Use C<--max-diff-files> to cap token consumption on large
1830 distributions (default: 50, 0 = unlimited).
1831  
1832 =item code-finding
1833  
1834 Generates a table with the complete details of a finding.
1835  
1836 cmb code-finding lib/My/Module.pm 1
1837  
1838 =item show-defaults
1839  
1840 Prints the resolved default option values to STDOUT after applying
1841 configuration-file values and runtime defaults.
1842  
1843 =item update-annotations
1844  
1845 cmb update-annotations file
1846  
1847 Applies human-curated annotations to the most recent code review for
1848 C<file>. On first run it generates an F<.annotate> file alongside the
1849 review for you to edit; re-run it to apply your edited annotations back
1850 into the review. Pairs with C<code-review>/C<annotate> in the review
1851 workflow.
1852  
1853 =back
1854  
1855 =head1 OPTIONS
1856  
1857 =over 4
1858  
1859 =item C<--annotate|-a> N:DISPOSITION
1860  
1861 See L</THE REVIEW WORKFLOW>
1862  
1863 =item C<--auto-annotate|-A>
1864  
1865 See L</THE REVIEW WORKFLOW>
1866  
1867 =item C<--basedir|-b> DIR
1868  
1869 Base directory in which to create the project. Defaults to the
1870 current working directory when C<--installdir> and C<--basedir> are not
1871 provided. The directory must exist or the script will throw an
1872 exception.
1873  
1874 I<Note: If C<--installdir> is provided it takes precedence and
1875 C<--basedir> is ignored.>
1876  
1877 default: pwd
1878  
1879 =item C<--color|--no-color>
1880  
1881 default: color
1882  
1883 To turn color off use --no-color.
1884  
1885 =item C<--dry-run|-D>
1886  
1887 Dry run mode will abort after displaying a pre-submission token and
1888 cost estimation for the C<pod-review> and C<code-review> commands.
1889  
1890 =item C<--config|-c> configuration file
1891  
1892 The path to a C<.ini> file that contains configuration information
1893 used to scaffold your project.
1894  
1895 default: ~/.gitconfig
1896  
1897 =item C<--context|-C> PATH
1898  
1899 One or more files to submit with your code review file that provide
1900 additional context for the LLM during the review.
1901  
1902 =item C<--email|-e> EMAIL
1903  
1904 Override the author email. Defaults to C<user.email> from your global
1905 git config.
1906  
1907 =item C<--finalize-annotations|-F>
1908  
1909 See L</THE REVIEW WORKFLOW>
1910  
1911 =item C<--force|-f>
1912  
1913 Overwrite an existing project. Without this flag, the command dies if a
1914 C<Makefile> already exists in the target directory.
1915  
1916 =item C<--github-user|-g> USER
1917  
1918 Override the GitHub username used to construct repository URLs in
1919 C<buildspec.yml>. Defaults to C<user.github> from your global git config.
1920  
1921 =item C<--import|-I> path
1922  
1923 A path that contains C<.pm> or C<.pl> files for importing into the
1924 project. You can specify multiple paths. You cannot use C<--stub> and
1925 C<--import> together.
1926  
1927 Example:
1928  
1929 cmb --module Foo::Bar -I ~/foo-bar/lib -I ~/foo-bar/bin
1930  
1931 =over 8
1932  
1933 =item * The primary module must be determinable from either directory
1934 name or supplied using the C<--module> option. The corresponding
1935 module file must exist beneath one of the import paths. For example,
1936 C<Foo::Bar> must be found as F<Foo/Bar.pm>.
1937  
1938 =item * The F<Makefile> will automatically attempt to substitute the
1939 token C<E<64>PACKAGE_VERSIONE<64>> inside your C<.pl.in> or C<.pm.in>
1940 files with the current semantic version in the F<VERSION> file. If you
1941 want to use that for versioning your scripts and modules add the token
1942 as shown below:
1943  
1944 C<our $VERSION = 'E<64>PACKAGE_VERSIONE<64>';>
1945  
1946 =back
1947  
1948 =item C<--installdir|-i> DIR
1949  
1950 Directory in which to create the project. When supplied, this overrides
1951 the configured or command-line C<basedir>. The directory is created if
1952 it does not exist.
1953  
1954 Example:
1955  
1956 cmb --installdir ~/git/My-Module
1957  
1958 The install directory should include the project name.
1959  
1960 I<Note: C<--installdir> overrides C<--basedir>>.
1961  
1962 =item C<--max-diff-files> LIMIT
1963  
1964 The maximum number of changed files included in the release artifact
1965 that may be uploaded to the LLM when generating release notes. Set to
1966 C<0> for no limit.
1967  
1968 default: 50
1969  
1970 =item C<--max-tokens|-t> TOKENS
1971  
1972 Maximum number of tokens the LLM may return in a single response.
1973 Higher values reduce the risk of truncated reviews on large files.
1974  
1975 default: 4096 (set by L<LLM::API>)
1976  
1977 =item C<--model|-M> MODEL
1978  
1979 Specifies the model id to use for the C<pod-review> and C<code-review>
1980 commands.
1981  
1982 For C<pod-review> the default model is C<claude-haiku-4-5-20251001>.
1983  
1984 For C<code-review> the default model is C<claude-sonnet-4-6>.
1985  
1986 The Haiku model tends to be better at summarizing documentation and
1987 avoiding unnecessary analysis around edge cases that contribute to
1988 noise.
1989  
1990 I<Caution: Both models try hard to find issues to the point that you
1991 will almost never get a clean run when asking for a POD review. When
1992 your POD is complete, accurate and usable it's good enough. Avoid
1993 shaving the yak!>
1994  
1995 =item C<--module|-m> MODULE
1996  
1997 The Perl module name for the new project, e.g. C<My::New::Module>.
1998 Used to derive the project directory name, source file path, and
1999 tarball name.
2000  
2001 You may omit this option when the module name can be determined from
2002 a custom stub file or from the project directory name.
2003  
2004 =item C<--prompt|-p> PATH
2005  
2006 Path to a text file that will be used to prompt the LLM for a code or pod review.
2007  
2008 defaults:
2009  
2010 pod => .prompts/pod-review.prompt
2011 code => .prompts/code-review.prompt
2012  
2013 =item C<--prompt-profile|-P> NAME
2014  
2015 The name of a prompt profile located in the F<.prompts> directory. One
2016 or more profile names may be specified. You need only provide the name
2017 (e.g. cli-tool).
2018  
2019 See L</PROMPT PROFILES>
2020  
2021 =item C<--resources|-r> github
2022  
2023 Currently takes only a single value: 'github' that indicates that the
2024 resources section of F<Makefile.PL> should be populated with GitHub
2025 URL references. Future versions may support additional providers.
2026  
2027 =item C<--strict>, C<--no-strict>
2028  
2029 Controls how C<resolve-vars> treats an C<@TOKEN@> placeholder that
2030 appears in code but has no value in the environment or C<--vars-file>.
2031 C<--strict> (the default) makes this a fatal error. C<--no-strict>
2032 downgrades it to a warning and leaves the placeholder literal in the
2033 output.
2034  
2035 This affects code placeholders only. Placeholders that appear solely in
2036 POD or C<#> comments are always ignored by the missing-value check
2037 regardless of this flag, so C<--no-strict> is not needed merely to
2038 document a token.
2039  
2040 =item C<--stub|-s> TYPE|PATH
2041  
2042 Controls the module stub used to generate the initial C<.pm.in> source
2043 file. Three forms are accepted:
2044  
2045 =over 4
2046  
2047 =item * Omitted - uses the default plain class stub (C<class-module.pm.tmpl>).
2048  
2049 =item * C<cli> - uses the CLI stub (C<cli-module.pm.tmpl>), which
2050 inherits from L<CLI::Simple> and includes a skeleton C<main>, C<init>,
2051 and a placeholder command.
2052  
2053 =item * A file path - uses the specified file as the stub. The file
2054 must exist or the command will die with an error. This allows you to
2055 supply your own template or bootstrap a project around a module you
2056 have already started writing. You can omit the C<--module> option if
2057 you supply your own stub file. See the explanation for the
2058 C<--module> option for details.
2059  
2060 =back
2061  
2062 When specifying a stub you cannot use the C<--import> option.
2063  
2064 =item C<--username|-u> NAME
2065  
2066 Override the author name used in the module stub and C<buildspec.yml>.
2067 Defaults to C<user.name> from your global git config.
2068  
2069 =item C<--vars-file>
2070  
2071 The path to a file containing template variable values used by
2072 C<resolve-vars>.
2073  
2074 =back
2075  
2076 =head1 THE REVIEW WORKFLOW
2077  
2078 C<CPAN::Maker::Bootstrapper> allows you to implement a structured
2079 iterative code review workflow built around JSON review files and
2080 developer-applied disposition annotations. The workflow converges over
2081 several rounds, with each round potentially costing less as noise is
2082 suppressed and findings are resolved.
2083  
2084 =head2 Overview
2085  
2086 Each review round consists of three steps:
2087  
2088 =over 4
2089  
2090 =item 1. Run a review
2091  
2092 cmb code-review --prompt-profile cli-tool lib/My/Module.pm
2093  
2094 The review is written to a timestamped C<.code> file containing a JSON
2095 object with C<findings>, C<confirmations>, and C<deferred> arrays.
2096  
2097 =item 2. Annotate the findings
2098  
2099 An annotation is how you mark a finding with a disposition. The
2100 dispositions are used by the LLM during the next review. See L</Dispositions>.
2101  
2102 cmb annotate lib/My/Module.pm
2103  
2104 This displays the current annotation state. Apply dispositions with
2105 C<-a> options:
2106  
2107 cmb annotate -a 1:accept -a 2:wrong -a 3:reject -a 4:defer lib/My/Module.pm
2108  
2109 You can annotate incrementally across multiple invocations. Each call
2110 shows the updated state so you always know what remains.
2111  
2112 Alternatively, use C<update-annotations> to maintain dispositions in an
2113 annotation file rather than on the command line:
2114  
2115 cmb update-annotations lib/My/Module.pm
2116  
2117 The first invocation creates an F<.annotate> file for editing. Run the
2118 command again after editing the file to apply those dispositions to the
2119 review.
2120  
2121 =item 3. Submit the next review
2122  
2123 Once all findings are annotated and code updated if necessary, run the
2124 next review. The bootstrapper automatically finds and submits the
2125 latest annotated review file with your updated code:
2126  
2127 cmb code-review lib/My/Module.pm
2128  
2129 Alternatively, use C<--auto-annotate|-A> with the C<annotate> command
2130 to annotate and immediately resubmit in one step:
2131  
2132 cmb annotate -a 1:wrong -a 2:reject --auto-annotate \
2133 lib/My/Module.pm
2134  
2135 The LLM will honor all dispositions from the prior round, confirm
2136 fixes marked C<ACCEPT>, carry forward C<DEFER> items, and suppress
2137 C<REJECT> and C<WRONG> findings. New findings appear without noise
2138 from settled questions.
2139  
2140 =back
2141  
2142 =head2 Dry Run Mode
2143  
2144 Before the prompt and code are submitted for review, the script
2145 displays estimated token usage and cost. The input token count is
2146 obtained from the model's token-counting API using the message that
2147 will actually be submitted, so the input count is accurate. The
2148 output token count, and therefore the final cost, is an estimate.
2149  
2150 To stop before submitting the review, use C<--dry-run>. The command
2151 will abort immediately before the message is sent to the LLM.
2152  
2153 =head2 Dispositions
2154  
2155 Each finding in the annotations file must be given one of the
2156 dispositions described below before the next review can be
2157 submitted. The prompt sent to the LLM is designed around these
2158 dispositions. This helps successive reviews converge by carrying forward the
2159 developer's decisions from earlier rounds.
2160  
2161 =over 4
2162  
2163 =item ACCEPT
2164  
2165 The finding is valid and has been fixed. On the next review the LLM
2166 will confirm the fix is present. If the fix is not found the finding
2167 will be re-raised.
2168  
2169 =item REJECT
2170  
2171 The finding has been reviewed and dismissed as inapplicable to this
2172 codebase or context. It will not be raised again in subsequent reviews.
2173  
2174 =item WRONG
2175  
2176 The finding was based on faulty reasoning. The code is correct. The
2177 finding will not be re-raised. Use this when the LLM has misread the
2178 control flow, misunderstood the design intent, or applied an
2179 inappropriate threat model.
2180  
2181 =item WRONG-RECONSIDER
2182  
2183 Applied automatically at finalization to all findings marked WRONG.
2184 On the first review of the next version the LLM will re-examine the
2185 specific function and code excerpt carefully. If the prior analysis
2186 was still incorrect the finding reverts to WRONG. If the code has
2187 changed and the finding is now valid it is raised as a new finding.
2188 If the model understands specifically why its prior reasoning was
2189 wrong it may mark the finding CONFIRMED.
2190  
2191 =item DEFER
2192  
2193 The finding is known and acknowledged but not yet addressed. It is
2194 carried forward in the C<deferred> array of each subsequent review
2195 without being treated as a new finding.
2196  
2197 =item CONFIRMED
2198  
2199 Used for logic confirmations rather than defects. Marks that both the
2200 LLM and the developer agree the code is correct.
2201  
2202 =back
2203  
2204 =head2 Diminishing Returns and When to Stop
2205  
2206 Run the C<annotate> command after each review submission to view the
2207 findings. Each round tends to surface smaller and more obscure issues
2208 as obvious findings are resolved. Despite some fairly aggressive
2209 attempts to create prompts that prevent trivial or obscure findings
2210 you should stop when you see these signals:
2211  
2212 =over 4
2213  
2214 =item *
2215  
2216 All new findings are LOW severity.
2217  
2218 =item *
2219  
2220 The LLM is re-raising findings already marked WRONG or REJECT,
2221 possibly rephrased (LLMs can and do make mistakes!).
2222  
2223 =item *
2224  
2225 New findings describe edge cases that cannot occur in normal usage.
2226  
2227 =back
2228  
2229 When all findings have dispositions and no new substantive issues
2230 appear, the review should be considered complete.
2231  
2232 =head2 The Release Artifact
2233  
2234 When you are satisfied with the review state, finalize it with
2235 C<--finalize-annotations>:
2236  
2237 cmb annotate --finalize-annotations -a 1:wrong -a 2:reject lib/My/Module.pm
2238  
2239 This applies any remaining dispositions, validates that all findings
2240 are annotated, reads the version from the F<VERSION> file, and writes
2241 the versioned release artifact:
2242  
2243 CPAN-Maker-Bootstrapper-1.1.0-REVIEW.json
2244  
2245 This file serves as a code review certification for the release - a
2246 machine-readable record of every finding examined, every logic
2247 confirmation made, and every disposition applied before the version
2248 was published. Commit it to the repository alongside your ChangeLog.
2249  
2250 All findings marked WRONG are automatically converted to
2251 WRONG-RECONSIDER in the release artifact, prompting careful
2252 re-examination on the first review of the next version rather
2253 than permanent suppression.
2254  
2255 =head2 Cost Management
2256  
2257 Review cost depends on the selected model, source size, prompt
2258 profiles, and number of findings. Costs generally decrease over
2259 successive rounds as the model spends fewer output tokens
2260 re-explaining suppressed findings.
2261  
2262 Use your own prompt profiles (C<--prompt-profile>) to suppress entire
2263 classes of noise before they reach the annotation file. A well-tuned
2264 profile for your application type is the highest-leverage cost
2265 reduction available.
2266  
2267 =head2 See Also
2268  
2269 L</LLM Commands>, L</PROMPT PROFILES>, L<CPAN::Maker::ConfigReader>
2270  
2271 =head1 PROMPT PROFILES
2272  
2273 Prompt profiles are additive prompt fragments that customize the review
2274 behavior for specific application types. They are appended to the base
2275 review prompt before submission and are intended to focus the review on
2276 relevant concerns while suppressing noise that does not apply to the
2277 target context.
2278  
2279 I<NOTE: Prompts count toward your input token count. Be succinct and
2280 accurate.>
2281  
2282 =head2 Using Profiles
2283  
2284 Pass one or more profiles using the C<--prompt-profile> option:
2285  
2286 cmb code-review --prompt-profile cli-tool MyModule.pm
2287  
2288 Multiple profiles may be combined:
2289  
2290 cmb code-review --prompt-profile cli-tool --prompt-profile security MyModule.pm
2291  
2292 Profiles are resolved from the F<.prompts/> directory in the current
2293 project. A profile named C<cli-tool> resolves to
2294 F<.prompts/cli-tool.prompt>. Add project-specific prompt profiles to
2295 F<.prompts/> and commit them with your project.
2296  
2297 =head3 Built-in Profiles
2298  
2299 The following profile is installed with the distribution:
2300  
2301 =over 4
2302  
2303 =item cli-tool
2304  
2305 Appropriate for single-user developer CLI tools. Suppresses security
2306 findings that assume a multi-user or hostile environment, TOCTOU race
2307 condition findings that assume concurrent invocation, and concerns about
2308 C<qx{}> or C<system()> calls where input originates from the user's own
2309 configuration. Also assumes C<perlcritic> and C<perltidy> are enforced
2310 in the development environment.
2311  
2312 =back
2313  
2314 =head3 Creating Custom Profiles
2315  
2316 A profile is a plain text file in F<.prompts/> containing additional
2317 prompt instructions, one per line. Lines beginning with C<#> are
2318 treated as comments and stripped before submission. Profile
2319 instructions are appended verbatim to the base review prompt. The
2320 built-in profiles use one instruction per line, typically prefixed
2321 with C<->.
2322  
2323 Example F<.prompts/security.prompt>:
2324  
2325 # security profile - add to any review where input handling matters
2326 - Treat all caller-supplied input as untrusted regardless of source.
2327 - Flag any use of eval, system, or exec that incorporates external data.
2328 - Flag missing taint checks on data used in file or system operations.
2329  
2330 =head3 Additional Profile Ideas
2331  
2332 =over 4
2333  
2334 =item library
2335  
2336 Focuses on API contract correctness and caller assumptions. Appropriate
2337 for CPAN distributions intended for use by unknown callers.
2338  
2339 =item web-application
2340  
2341 Treats external input as untrusted. Flags injection risks, authentication
2342 gaps, and session handling concerns.
2343  
2344 =item mod-perl-handler
2345  
2346 Addresses Apache lifecycle concerns including global state, startup versus
2347 request time initialization, and child process behavior.
2348  
2349 =item lambda-function
2350  
2351 Focuses on cold start performance, statelessness, and environment variable
2352 handling appropriate for AWS Lambda deployments.
2353  
2354 =back
2355  
2356 Community contributions of additional profiles are welcome. See
2357 L<https://github.com/rlauer6/CPAN-Maker-Bootstrapper/issues>.
2358  
2359 =head1 EXTENDING THE BUILD SYSTEM
2360  
2361 The installed F<Makefile> and files under F<.includes/> are managed by
2362 C<CPAN::Maker::Bootstrapper>. They are intentionally write-protected and
2363 may be replaced by C<make update> when the bootstrapper is upgraded.
2364  
2365 Project-specific build logic belongs in F<project.mk>, which is always
2366 writable and is never touched by C<make update>. This provides an
2367 upgrade-safe extension point for project-specific targets, variables,
2368 and build ordering.
2369  
2370 The managed include files live in the F<.includes/> directory,
2371 where they are write-protected and clearly separated from project
2372 files. The F<Makefile> includes them automatically:
2373  
2374 include .includes/publish.mk
2375 include .includes/bootstrap.mk
2376 include .includes/perl.mk
2377 include .includes/local.mk
2378 include .includes/help.mk
2379 include .includes/version.mk
2380 include .includes/release-notes.mk
2381 include .includes/git.mk
2382 include .includes/update.mk
2383 include .includes/upgrade.mk
2384 include .includes/bash-completion.mk
2385 include .includes/modulino.mk
2386  
2387 These files are included if they exist:
2388  
2389 include config.mk
2390 include project.mk
2391 include extra-files.mk
2392  
2393 =head2 Immutability Is a Feature
2394  
2395 The managed build system is deliberately B<immutable>: the
2396 F<Makefile>, everything under F<.includes/>, and the generated
2397 F<.pm>/F<.pl> files are write-protected on purpose. This is a feature,
2398 not a restriction. It lets C<make update> replace those files with
2399 newer, better versions without clobbering anything of yours, and it
2400 guarantees that two projects on the same bootstrapper version use the
2401 same managed build rules -- there is no per-project drift hiding in a
2402 locally edited managed rule.
2403  
2404 You I<can> override any of it -- these are your files, and nothing stops you
2405 from C<chmod +w> and editing a generated module or a managed include. But
2406 you should not need to, and if you do, C<make update> will overwrite your
2407 change. Every legitimate customization has a sanctioned hook that survives
2408 C<make update>:
2409  
2410 =over 4
2411  
2412 =item * B<Project-specific targets, rules, and build ordering> --
2413 F<project.mk> (always writable; never touched by C<make update>).
2414  
2415 Reach for F<project.mk> when your project needs to do something the
2416 generic build system can't know about, for example:
2417  
2418 =over 4
2419  
2420 =item * B<Build a companion artifact> the managed build doesn't produce --
2421 generate a F<.pm.in> from a JSON/YAML schema, render documentation, compile
2422 assets, or (as C<Amazon::API> does) build a Storable data file consumed at
2423 runtime.
2424  
2425 =item * B<Declare inter-module build order> the scanner can't infer --
2426 C<lib/Foo/Bar.pm: lib/Foo.pm> when one module must be built before another.
2427  
2428 =item * B<Deploy or publish> -- an C<scp>/upload/notify target that runs
2429 after C<all>.
2430  
2431 =item * B<Extend cleanup> -- a C<clean-local::> double-colon rule to remove
2432 your own generated files, and C<CLEANFILES +=> for anything else.
2433  
2434 =back
2435  
2436 See L</What Belongs in F<project.mk>> for worked examples of each, and
2437 L</What Does NOT Belong in F<project.mk>> for the line between your extensions
2438 and the managed core.
2439  
2440 =item * B<Build-behavior toggles> (dependency scanning, linting, syntax
2441 checking, version-drift strictness) -- make variables set on the command
2442 line or in F<config.mk> (see L</CONFIGURATION> and the variable list below).
2443  
2444 =item * B<Template tokens in your source> -- declare them in
2445 C<TEMPLATE_VARS> and let C<cmb resolve-vars> fill them, rather than
2446 hand-editing a generated F<.pm> (see L</Custom Template Tokens>).
2447  
2448 =item * B<Extra distribution files> -- list them in F<buildspec.yml>;
2449 C<extra-files.mk> wires them into the tarball automatically.
2450  
2451 =item * B<Dependencies the scanner cannot see> -- the sticky C<+> prefix in
2452 F<requires> (see L</Dependencies Management>).
2453  
2454 =back
2455  
2456 If you find yourself wanting to edit a managed file, check this list first:
2457 the hook you need almost certainly exists, and using it keeps you on the
2458 upgrade path instead of forking the build system.
2459  
2460 I<Why the generated F<.pm>/F<.pl> files are read-only:> they are
2461 regenerated from their F<.pm.in>/F<.pl.in> sources when its
2462 prerequisites require regeneration, so any edit you make directly to a
2463 generated F<.pm> would be silently lost on the next C<make>. The
2464 C<chmod -w> is there to stop you from making that mistake. Edit the
2465 F<.pm.in> source, not the generated F<.pm>.
2466  
2467 =head2 How the Makefile Works
2468  
2469 The installed F<Makefile> is structured around a few key concepts:
2470  
2471 =over 4
2472  
2473 =item * B<Source files> live in F<lib/> as F<.pm.in> and in F<bin/> as
2474 F<.pl.in>. The build generates the final F<.pm> and F<.pl> files from
2475 these sources by substituting C<E<64>PACKAGE_VERSIONE<64>> and other
2476 tokens, running syntax checks, and optionally running perltidy and
2477 perlcritic.
2478  
2479 =item * B<Sentinel files> - the build uses sentinel files to track
2480 incremental quality-gate state. F<.checked> records successful syntax
2481 and validation checks, F<.tdy> records successful perltidy processing,
2482 and F<.crit> records successful perlcritic processing. Each sentinel is
2483 regenerated only when the source or the prerequisites for that gate
2484 change.
2485  
2486 =item * B<Dependency scanning> - C<scandeps-static.pl> scans your
2487 source files and maintains the dependency files used by L<CPAN::Maker>
2488 when generating distribution metadata, including F<requires>,
2489 F<test-requires>, F<recommends>, and F<suggests>. Controlled by
2490 C<SCAN=ON|OFF>.
2491  
2492 =item * B<The distribution tarball> is the final output of C<make>.
2493 It is built by C<make-cpan-dist.pl> using F<buildspec.yml>.
2494  
2495 =item * B<Inter-module dependency discovery> - the build scans modules
2496 within the distribution and generates F<deps.mk> so C<make> can build
2497 modules in dependency order before syntax checking them. Dependencies
2498 that cannot be inferred automatically may be added in F<project.mk>.
2499  
2500 =back
2501  
2502 Key build variables you can override on the make command line or in
2503 F<config.mk>:
2504  
2505 =over 4
2506  
2507 =item C<SCAN=OFF> - skip distribution dependency scanning
2508  
2509 =item C<LINT=OFF> - skip perltidy and perlcritic
2510  
2511 =item C<SYNTAX_CHECKING=OFF> - skip C<perl -wc> syntax checks
2512  
2513 =item C<MIN_PERL_VERSION=5.016> - minimum Perl version for Makefile.PL
2514  
2515 =item C<PERLTIDYRC=/path/to/rc> - path to perltidy configuration
2516  
2517 =item C<PERLCRITICRC=/path/to/rc> - path to perlcritic configuration
2518  
2519 =item C<SKIP_TESTS=1> - interpreted by L<CPAN::Maker>; skips running
2520 the test suite when building the distribution tarball
2521  
2522 =item C<PERLWC_SKIP="file1 file2"> - space-separated list of files
2523 to exclude from syntax and POD checks
2524  
2525 =item C<POD=extract|remove> - extract POD to a companion F<.pod> file
2526 or strip it entirely from the built F<.pm>
2527  
2528 =item C<PERLINCLUDE="-I path"> - additional include paths used during
2529 the C<perl -wc> syntax check. Defaults to C<-I lib -I local/lib/perl5>
2530 for hermetic checking; see L</The local dependency library>.
2531  
2532 =item C<CPAN_INSTALLER=cpm|carton> - selects the installer used to
2533 populate F<local/> for hermetic syntax checking. Auto-detected (C<cpm>
2534 preferred) if unset.
2535  
2536 =back
2537  
2538 Two further toggles, C<CMB_UPDATE_CHECK> and C<CMB_VERSION_DRIFT>, are set
2539 in F<config.mk> rather than on the command line; see L</Automatic Drift and
2540 Update Checks>. F<config.mk> is read on every invocation of C<make> and is
2541 the right place for durable, machine- or project-wide build settings such as
2542 C<SYNTAX_CHECKING=OFF> on a box without an installer.
2543  
2544 =head2 What Belongs in F<project.mk>
2545  
2546 =over 4
2547  
2548 =item Custom targets
2549  
2550 Any target specific to your project - generating assets, running
2551 linters, deploying, sending notifications:
2552  
2553 .PHONY: deploy
2554 deploy: all ## deploy the distribution
2555 scp $(TARBALL) user@myserver:/opt/cpan
2556  
2557 Add C<##> followed by a description to a target definition to include
2558 the target in the output from C<make help>. Because F<project.mk> is
2559 included in C<MAKEFILE_LIST>, project-specific targets are discovered
2560 automatically:
2561  
2562 make help
2563  
2564 There is no separate help table to maintain.
2565  
2566 =item Inter-module dependencies
2567  
2568 If your modules have build-time dependencies on each other, declare
2569 them here rather than modifying the Makefile:
2570  
2571 lib/Foo/Bar.pm: lib/Foo.pm
2572  
2573 =item Additional file generation
2574  
2575 If your project generates code or configuration from templates beyond
2576 what the standard Makefile handles:
2577  
2578 lib/Foo/Generated.pm.in: schema/foo.json
2579 perl bin/generate-module.pl $< > $@
2580  
2581 =item Project-specific variables
2582  
2583 DEPLOY_HOST = myserver.example.com
2584 DEPLOY_PATH = /opt/cpan/incoming
2585  
2586 =item Extending CLEANFILES
2587  
2588 Add project-specific generated files to the cleanup target by
2589 appending to C<CLEANFILES>:
2590  
2591 CLEANFILES += mygenerated.pm config/generated.yml
2592  
2593 =item Extending the clean target
2594  
2595 clean-local::
2596 rm -rf workdir
2597  
2598 =item Extending the test recipe
2599  
2600 Projects may have development or integration tests that should not be
2601 included in the CPAN distribution. Add them to C<make test> by
2602 extending C<test-local> with a double-colon rule:
2603  
2604 test-local::
2605 prove -I lib -v xt/
2606  
2607 =back
2608  
2609 =head2 What Does NOT Belong in F<project.mk>
2610  
2611 =over 4
2612  
2613 =item * Modifications to existing targets like C<all>, C<clean>, C<requires>
2614  
2615 =item * Replacing managed variables such as C<DEPS> or C<CLEANFILES>.
2616  
2617 Use documented extension points such as C<CLEANFILES +=> where
2618 provided rather than redefining the managed value.
2619  
2620 =item * Anything that duplicates logic already in the managed Makefile
2621  
2622 =back
2623  
2624 =head2 Custom Template Tokens
2625  
2626 The build generates each F<.pm>/F<.pl> from its F<.pm.in>/F<.pl.in> source
2627 by substituting C<E<64>TOKENE<64>> placeholders through C<cmb resolve-vars>.
2628 The standard tokens (C<E<64>PACKAGE_VERSIONE<64>>, C<E<64>MODULE_NAMEE<64>>,
2629 C<E<64>GIT_SHAE<64>>, and the other git-metadata variables) are always
2630 available, but the mechanism is extensible: a project can define its own
2631 tokens without editing any managed file.
2632  
2633 To add a token, declare its name in C<TEMPLATE_VARS> (in
2634 F<project.mk>) and provide a value -- as a make variable, an exported
2635 environment variable, or through the variables file passed to
2636 C<resolve-vars>. For example, to stamp a build timestamp:
2637  
2638 # in project.mk
2639 BUILD_DATE := $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
2640 TEMPLATE_VARS += BUILD_DATE
2641  
2642 # in a .pm.in source
2643 our $BUILD_DATE = 'E<64>BUILD_DATEE<64>';
2644  
2645 C<cmb resolve-vars> then fills C<E<64>BUILD_DATEE<64>> from the value
2646 when its prerequisites require regeneration. The token grammar is
2647 uppercase-only (C<E<64>[A-Z0-9_]+E<64>>), so placeholders never
2648 collide with real Perl such as C<@_> or C<@ISA>.
2649  
2650 By default, substitution is B<fail-loud> for placeholders that appear
2651 in live code: if a token has no value, the build stops and names the
2652 offending token rather than silently substituting an empty string.
2653  
2654 Placeholders that occur only in POD or comments do not require values.
2655 C<--no-strict> may be used to downgrade a missing live-code value to a
2656 warning and leave the placeholder unchanged.
2657  
2658 =head2 Keeping the build system up to date
2659  
2660 The following targets manage the lifecycle of the build system itself:
2661  
2662 =over 4
2663  
2664 =item C<make check-upgrade> / C<make upgrade-check>
2665  
2666 Checks MetaCPAN to see if a newer version of
2667 C<CPAN::Maker::Bootstrapper> is available.
2668  
2669 =item C<make publish>
2670  
2671 Builds the distribution tarball, unpacks it into a temporary directory,
2672 runs its normal C<Makefile.PL>, build, and test sequence, and uploads
2673 the tarball to PAUSE if all checks succeed.
2674  
2675 Set the PAUSE credentials with:
2676  
2677 make publish PAUSE_USER=username PAUSE_PASSWORD=password
2678  
2679 =item C<make upgrade>
2680  
2681 Checks MetaCPAN, installs the latest version via C<cpanm>, then
2682 automatically runs C<make update> to refresh the managed project
2683 files.
2684  
2685 =item C<make update>
2686  
2687 Copies the managed files from the currently installed bootstrapper
2688 distribution into your project directory. After running, use
2689 C<git diff> to review what changed.
2690  
2691 The following files are managed and may be updated:
2692  
2693 Makefile
2694 .includes/bootstrap.mk
2695 .includes/perl.mk
2696 .includes/local.mk
2697 .includes/git.mk
2698 .includes/help.mk
2699 .includes/update.mk
2700 .includes/upgrade.mk
2701 .includes/version.mk
2702 .includes/release-notes.mk
2703 .includes/bash-completion.mk
2704 .includes/modulino.mk
2705 .includes/publish.mk
2706  
2707 Your F<project.mk>, F<buildspec.yml>, F<requires>, F<VERSION>, source
2708 files and tests are B<never> touched by C<make update>.
2709  
2710 =item C<make cpanm>
2711  
2712 Installs C<cpanminus> if it is not already available on your
2713 C<PATH>. Required for C<make upgrade> to work:
2714  
2715 make cpanm && make upgrade
2716  
2717 =back
2718  
2719 =head2 Automatic Drift and Update Checks
2720  
2721 Every build runs two checks before proceeding, so you don't have to
2722 remember to run C<make check-upgrade> yourself:
2723  
2724 =over 4
2725  
2726 =item *
2727  
2728 Is a newer C<CPAN::Maker::Bootstrapper> published on CPAN than the
2729 one installed on this machine?
2730  
2731 =item *
2732  
2733 Do this project's managed files still match what the I<currently
2734 installed> C<CPAN::Maker::Bootstrapper> would produce?
2735  
2736 =back
2737  
2738 These are independent questions - your installed bootstrapper can be
2739 fully current while a given project has still drifted from it (most
2740 commonly because the project hasn't been through C<make update>
2741 since you last upgraded), or your bootstrapper itself can be behind
2742 CPAN while every project stays perfectly in sync with it.
2743  
2744 I<Drift> can happen for either of two reasons: your installed
2745 C<CPAN::Maker::Bootstrapper> was upgraded since this project last ran
2746 C<make update>, or a managed file was hand-edited despite the
2747 warnings not to (see L</What You Should Never Modify>). C<make>
2748 doesn't try to tell these apart - the fix is the same either way:
2749  
2750 make update
2751  
2752 Two variables, set in F<config.mk>, control how strict these checks
2753 are:
2754  
2755 =over 4
2756  
2757 =item C<CMB_UPDATE_CHECK> (C<ON>|C<OFF>, default C<ON>)
2758  
2759 Set to C<OFF> to skip the MetaCPAN lookup - useful in CI or offline
2760 environments where the network call would just fail or slow things
2761 down.
2762  
2763 =item C<CMB_VERSION_DRIFT> (C<FAIL>|C<WARN>|C<IGNORE>, default C<FAIL>)
2764  
2765 Controls what happens when a project's managed files no longer match
2766 the installed bootstrapper. C<FAIL> stops the build until you run
2767 C<make update>; C<WARN> prints a message and continues; C<IGNORE>
2768 skips the check entirely.
2769  
2770 =back
2771  
2772 =head2 What You Should Never Modify
2773  
2774 The files in F<.includes/> - F<perl.mk>, F<git.mk>, F<help.mk> etc. -
2775 are managed files that will be overwritten by C<make update>. Do not
2776 modify managed files directly. Use F<config.mk> for documented build
2777 variables and F<project.mk> for project-specific targets, rules, and
2778 build ordering.
2779  
2780 The F<Makefile> itself is also managed and will be overwritten by
2781 C<make update>. Use the documented project-level configuration and
2782 extension files instead.
2783  
2784 =head2 Dependencies Management
2785  
2786 The build system scans F<.pm.in> and F<.pl.in> source files and
2787 maintains the dependency files used by L<CPAN::Maker> when generating
2788 distribution metadata:
2789  
2790 F<requires>
2791 F<test-requires>
2792 F<recommends>
2793 F<suggests>
2794  
2795 Distribution dependency scanning is controlled by C<SCAN>. Set
2796 C<SCAN=OFF> to skip updates to F<requires>, F<test-requires>,
2797 F<recommends>, and F<suggests> for a build; the default is C<ON>.
2798  
2799 To prevent an entry from being removed by a rescan, prefix the module
2800 name with C<+>. These entries are sticky and survive all subsequent
2801 scans even if the scanner no longer detects them. To pin a specific
2802 version, simply edit the version number in the F<requires> file. If
2803 the scanner subsequently detects a different version, the Makefile
2804 will preserve your pinned version. Note that pinned versions are
2805 B<never> updated automatically - if you want to adopt a newer version
2806 you must edit the file manually.
2807  
2808 In your requires file:
2809  
2810 +Foo::Bar 1.0 # sticky - survives all rescans
2811 Baz::Qux 2.5 # version pinned - scanner won't override this version
2812  
2813 I<Note: These two mechanisms are independent - C<+> controls whether an entry
2814 survives rescans, while the version number controls what version is
2815 required.>
2816  
2817 =head3 The local dependency library
2818  
2819 Syntax checking is performed in a I<hermetic> environment: each
2820 generated F<.pm> is compiled with C<perl -wc> against C<lib> and a
2821 project-local library at F<local/lib/perl5> only, with C<PERL5LIB>
2822 explicitly cleared for the check. This ensures a module's dependencies
2823 are actually declared and installed, rather than being satisfied by
2824 chance from whatever happens to be in your C<PERL5LIB> or system
2825 C<@INC>. A dependency that compiles on your machine but is missing
2826 from the declared dependency set will fail the build here instead of
2827 surprising you on a clean install or CI box.
2828  
2829 To populate that library, the build installs your declared dependencies into
2830 F<local/> using C<cpm> (preferred) or C<carton>:
2831  
2832 make local # installs requires/recommends/suggests/test-requires into local/lib/perl5
2833  
2834 This runs automatically as a prerequisite of the module build, so a
2835 normal C<make> installs dependencies first, then syntax-checks against
2836 them.
2837  
2838 C<cpm> is preferred because it supports multiple resolvers directly
2839 from F<build-mirrors>. C<carton> is also supported; see
2840 L</build-mirrors> for its mirror behavior.
2841  
2842 The use of a F<build-mirrors> file versus specifying the mirrors in
2843 the dependency files determines the scope of their
2844 use. F<build-mirrors> (and F<cpanfile> mirror declarations) set the
2845 resolvers used for B<every> dependency in the build. To route a
2846 B<single> module to a specific mirror, URL, or distribution -- without
2847 affecting how anything else resolves -- annotate that module's entry
2848 in F<requires> with C<mirror=>, C<url=>, or C<dist=> (see
2849 L</build-mirrors>).
2850  
2851 The C<+> prefix has a second use beyond protecting mirror annotations.
2852 Because the check is hermetic, B<a module reached only at runtime will not
2853 be found unless it is declared>. Static scanning (C<scandeps-static.pl>)
2854 cannot see a dependency loaded dynamically -- for example a module pulled
2855 in through a method call rather than a C<use> statement -- so it will never
2856 add it to F<requires>. Declare such modules explicitly with C<+>, which
2857 makes the entry sticky and survives every rescan:
2858  
2859 +Log::Log4perl # loaded at runtime via a framework call; scanner can't see it
2860  
2861 =head3 F<build-mirrors>
2862  
2863 When using the preferred CPAN installer (C<cpm>), the build system
2864 reads mirror URLs, one per line, from a F<build-mirrors> file in the
2865 project root and passes each as a resolver. This allows the build to
2866 resolve dependencies against one or more configured CPAN-compatible
2867 repositories, including private DarkPAN repositories.
2868  
2869 When C<carton> is used, because it does not support multiple mirrors
2870 when setting the mirror using an environment variable, the build
2871 system will use the first mirror in your F<build-mirrors> file if
2872 present. C<carton> supports multiple mirrors only by specifying them
2873 in the F<cpanfile>.
2874  
2875 Entries in F<requires>, F<suggests>, and F<recommends> may carry optional
2876 qualifiers after the version to control where a module resolves from:
2877  
2878 +Foo::Bar 1.0 mirror=https://cpan.openbedrock.net/orepan2
2879 +Baz::Qux 2.5 url=https://example.com/authors/id/D/DU/DUMMY/Baz-Qux-2.5.tar.gz
2880 +Xyz::Abc 0.9 dist=Xyz-Distribution
2881  
2882 Only C<dist=>, C<url=>, and C<mirror=> are permitted after the version;
2883 anything else is an error. Prefix such entries with the sticky C<+> so the
2884 scanner does not strip the annotation on a later rescan. See L<CPAN::Maker>
2885 for the full format.
2886  
2887 =head1 MODULINOS
2888  
2889 A modulino is a Perl module that doubles as a runnable script by
2890 checking whether it was invoked directly or loaded as a library:
2891  
2892 package Foo::Bar;
2893  
2894 caller or __PACKAGE__->main;
2895  
2896 sub main {
2897 ...
2898 exit 0;
2899 }
2900  
2901 Modulinos are useful for CLI scripts because they encourage
2902 encapsulation, simplify unit testing, and keep logic organized
2903 in named methods rather than inline code.
2904  
2905 The C<Makefile> provides a C<modulino> target that generates a wrapper
2906 script for invoking your module. By default it uses C<MODULE_NAME>,
2907 producing a script named after the module:
2908  
2909 make modulino
2910  
2911 For a project named C<Foo::Bar> this creates C<bin/foo-bar.in>.
2912 C<make> then builds C<bin/foo-bar> from that source file via a
2913 pattern rule, and the executable ends up in the distribution.
2914  
2915 To create a modulino wrapper for a module other than the primary
2916 project module, override C<MODULE_NAME>:
2917  
2918 make modulino MODULE_NAME=Foo::Bar::Buz
2919  
2920 This creates C<bin/foo-bar-buz.in> invoking C<Foo::Bar::Buz>.
2921  
2922 To give the wrapper a short or memorable name independent of the
2923 module name, set C<ALIAS>:
2924  
2925 make modulino MODULE_NAME=Foo::Bar::Buz ALIAS=fbb
2926  
2927 This creates C<bin/fbb.in> which still invokes C<Foo::Bar::Buz>.
2928 C<ALIAS> accepts either a plain name (C<fbb>) or a module-style
2929 name (C<Foo::Bar::Buz>) - colons are converted to hyphens and
2930 the result is lowercased.
2931  
2932 The generated wrapper scripts (without the C<.in> suffix) are
2933 automatically added to F<.gitignore> since they are build artifacts.
2934 The C<.in> source files are tracked by git.
2935  
2936 =head2 Continuous Integration
2937  
2938 CPAN::Maker::Bootstrapper provides a clean-room build path that can be
2939 used locally or from a CI system.
2940  
2941 The CI design separates source acquisition from project build
2942 responsibilities:
2943  
2944 source acquisition caller or CI system
2945 build environment builder
2946 project build make
2947  
2948 A CI system such as GitHub Actions is responsible for checking out the
2949 project. F<builder> then operates on that existing project directory,
2950 installs the required build environment and dependencies, and runs the
2951 project build.
2952  
2953 C<make build-ci> provides the corresponding local clean-room build. It
2954 uses the current working tree as its source, copies that tree into a
2955 disposable container build directory, and invokes F<builder> there.
2956  
2957 This separation keeps F<builder> independent of repository hosting,
2958 branch selection, and source-control workflow while allowing the same
2959 build mechanism to be used both locally and in CI.
2960  
2961 The build lifecycle is:
2962  
2963 builder.env
2964 |
2965 v
2966 builder-pre
2967 |
2968 v
2969 make
2970 |
2971 v
2972 builder-post
2973  
2974 F<builder> can run unmodified in GitHub Actions, in another CI runner,
2975 or by hand from the command line.
2976  
2977 =head3 Running builder manually
2978  
2979 F<builder> operates on an existing project directory. Source acquisition
2980 is deliberately outside its responsibility; the caller must clone,
2981 check out, or otherwise provide the project before invoking F<builder>.
2982  
2983 Run it from the root of a project:
2984  
2985 ./builder
2986  
2987 or pass the project directory explicitly:
2988  
2989 /builder /path/to/project
2990  
2991 The project directory defaults to the current working directory.
2992  
2993 F<builder> changes to that directory, loads the project CI environment,
2994 resolves and installs the required build dependencies, and runs the
2995 configured build lifecycle.
2996  
2997 For the standard containerized clean-room build, use:
2998  
2999 make build-ci
3000  
3001 C<make build-ci> copies the current working tree into a disposable build
3002 environment and invokes F<builder> there. Because it operates on the
3003 current working tree rather than cloning the repository, the build may
3004 include uncommitted and untracked files present on disk.
3005  
3006 =head3 Environment variables
3007  
3008 F<builder> accepts environment variables that control dependency
3009 installation and build behavior. These values may also be set in
3010 F<builder.env>.
3011  
3012 =over 4
3013  
3014 =item C<INSTALLER>
3015  
3016 The command used to install Perl dependencies.
3017  
3018 The default is:
3019  
3020 cpm install -g --show-build-log-on-failure --verbose
3021  
3022 =item C<SCAN>
3023  
3024 Controls dependency scanning during the project build.
3025  
3026 The builder default is:
3027  
3028 SCAN=on
3029  
3030 =item C<SYNTAX_CHECKING>
3031  
3032 Controls Perl syntax checking during the project build.
3033  
3034 The builder does not enable syntax checking by default. To use syntax
3035 checking as a CI quality gate, add the following to F<builder.env>:
3036  
3037 SYNTAX_CHECKING=on
3038  
3039 =item C<LINT>
3040  
3041 Controls the perltidy and perlcritic quality gates.
3042  
3043 The builder does not enable linting by default. To enable configured
3044 lint tools during CI, add:
3045  
3046 LINT=on
3047  
3048 to F<builder.env>.
3049  
3050 =item C<PERLTIDYRC>
3051  
3052 Specifies the perltidy profile used when linting is enabled.
3053  
3054 If C<PERLTIDYRC> is not defined, F<builder> looks for F<.perltidyrc>
3055 or F<perltidyrc> in the project. An explicitly supplied value is not
3056 overwritten by profile discovery.
3057  
3058 When a profile is configured and C<LINT=on>, F<builder> installs
3059 L<Perl::Tidy> before running the project build.
3060  
3061 If C<PERLTIDYRC> names a file that does not exist, the build fails.
3062  
3063 =item C<PERLCRITICRC>
3064  
3065 Specifies the perlcritic profile used when linting is enabled.
3066  
3067 If C<PERLCRITICRC> is not defined, F<builder> looks for
3068 F<.perlcriticrc> or F<perlcriticrc> in the project. An explicitly
3069 supplied value is not overwritten by profile discovery.
3070  
3071 When a profile is configured and C<LINT=on>, F<builder> installs
3072 L<Perl::Critic> and the supporting policy modules required by the
3073 managed build.
3074  
3075 If C<PERLCRITICRC> names a file that does not exist, the build fails.
3076  
3077 Setting C<LINT=on> without either a perltidy or perlcritic profile is
3078 treated as a configuration error.
3079  
3080 =item C<NO_ECHO>
3081  
3082 Passed through to the generated Makefile when set.
3083  
3084 =item C<CMB_VERSION_DRIFT>
3085  
3086 Controls how F<builder> handles differences between the installed
3087 CPAN::Maker::Bootstrapper version and the version expected by the
3088 project.
3089  
3090 The generated F<builder.env> defaults this to:
3091  
3092 CMB_VERSION_DRIFT=ignore
3093  
3094 =back
3095  
3096 =head3 F<builder.env>
3097  
3098 Before installing project build dependencies or running the project
3099 build, F<builder> loads F<builder.env> from the project root when that
3100 file exists.
3101  
3102 Variables defined there are exported to the build environment and are
3103 used when resolving the effective CI build policy.
3104  
3105 A generated project includes:
3106  
3107 CMB_VERSION_DRIFT=ignore
3108 NO_ECHO=
3109  
3110 The default builder performs a clean distribution build but does not
3111 enable syntax checking or linting as CI phase gates. Projects that want
3112 those checks may opt in through F<builder.env>.
3113  
3114 For example:
3115  
3116 SYNTAX_CHECKING=on
3117 LINT=on
3118  
3119 When linting is enabled, provide a F<perltidyrc>, F<.perltidyrc>,
3120 F<perlcriticrc>, or F<.perlcriticrc> for each lint tool the CI build
3121 should run. The corresponding tool dependencies are installed by
3122 F<builder> before C<make> is invoked.
3123  
3124 F<builder.env> therefore provides a project-local place to define CI
3125 policy without modifying F<builder> itself.
3126  
3127 =head3 Builder lifecycle hooks
3128  
3129 F<builder> exposes two Makefile hooks around the main project build:
3130  
3131 builder-pre
3132 builder-post
3133  
3134 The build lifecycle is:
3135  
3136 builder.env
3137 |
3138 builder-pre
3139 |
3140 make
3141 |
3142 builder-post
3143  
3144 C<builder-pre> runs after F<builder.env> has been loaded and before the
3145 main C<make> invocation.
3146  
3147 C<builder-post> runs only after the main build completes successfully.
3148  
3149 Generated projects define both targets as empty double-colon targets:
3150  
3151 builder-pre::
3152  
3153 builder-post::
3154  
3155 Projects may extend them in F<project.mk> without modifying the managed
3156 Makefile.
3157  
3158 For example:
3159  
3160 builder-pre::
3161 ./prepare-ci-environment
3162  
3163 builder-post::
3164 ./collect-build-artifacts
3165  
3166 These hooks are intended for project-specific CI setup and post-build
3167 work that should remain outside the managed build files.
3168  
3169 =head3 C<make build-ci>
3170  
3171 C<make build-ci> runs the current project in a disposable containerized
3172 build environment.
3173  
3174 Unlike a CI workflow that clones the repository, C<build-ci> uses the
3175 current working tree as its source. The project is mounted read-only,
3176 copied into the container build area, and then passed to F<builder>.
3177  
3178 This means the build reflects the files currently present on disk,
3179 including uncommitted changes and untracked files.
3180  
3181 The source tree itself is not modified by the container build.
3182  
3183 C<make build-ci> accepts the following variables:
3184  
3185 DOCKER_BUILD_IMAGE - container image used for the build
3186 DOCKER_CPAN_INSTALLER
3187 - dependency installer command used in the container
3188 BUILD_LOG - path used for captured build output
3189 MODULE_NAME - primary module name passed into the clean-room build
3190  
3191 For example:
3192  
3193 make build-ci
3194  
3195 or:
3196  
3197 make build-ci DOCKER_BUILD_IMAGE=debian:trixie
3198  
3199 The command exits with the status of the container build even though
3200 the output is also written to C<BUILD_LOG>.
3201  
3202 =head3 Builder input files
3203  
3204 F<builder> recognizes project files that supply additional build
3205 requirements without modifying F<builder> itself.
3206  
3207 =over 4
3208  
3209 =item F<build-apt-deps>
3210  
3211 A whitespace-separated list of additional Debian packages required by
3212 the project build.
3213  
3214 F<builder> installs these packages in addition to its standard build
3215 environment before installing Perl dependencies.
3216  
3217 For example:
3218  
3219 libxml2-dev
3220 libpq-dev
3221  
3222 =item F<build-mirrors>
3223  
3224 A list of CPAN mirror URLs, one per line.
3225  
3226 Use this file when the build requires a DarkPAN or another additional
3227 CPAN-compatible repository.
3228  
3229 For example:
3230  
3231 https://cpan.openbedrock.net
3232 https://cpan.metacpan.org
3233  
3234 The configured mirrors are used when resolving project dependencies.
3235  
3236 =back
3237  
3238 These files describe build inputs. For environment variables use
3239 F<builder.env>; for project-specific Makefile behavior use
3240 F<project.mk>.
3241  
3242 =head3 C<perlcritic> and C<perltidy> Gates
3243  
3244 During a CI build, the build script enables C<PERLTIDY> and
3245 C<PERLCRITIC> when it can find the corresponding configuration files
3246 in the project.
3247  
3248 For reproducible CI builds, keep the project's C<perltidyrc> and
3249 C<perlcriticrc> aligned with the configuration used in your development
3250 environment.
3251  
3252 Many editors and IDEs run Perltidy or Perl::Critic automatically while
3253 you work. If those tools use a personal configuration that differs from
3254 the project's checked-in configuration, code that appears clean locally
3255 may fail during C<build-ci>.
3256  
3257 When a project-local C<perltidyrc> or C<perlcriticrc> is present,
3258 C<build-ci> uses it to enforce the project's formatting and critic
3259 policies in the clean build environment. If no project-local
3260 configuration can be discovered, the corresponding check is disabled
3261 rather than falling back to the tool's default configuration.
3262  
3263 =head3 See Also
3264  
3265 L</make workflow>, L</make build-ci>
3266  
3267 =head1 PREREQUISITES
3268  
3269 The following tool(s) must be on your C<PATH>:
3270  
3271 =over 4
3272  
3273 =item * C<git> - used to read global identity config
3274  
3275 =item * C<make> - GNU make is required to build the project
3276  
3277 =item * C<curl> - used by C<make upgrade> to query MetaCPAN
3278  
3279 =item * C<cpm> or C<carton> - installs declared dependencies into a
3280 project-local library (F<local/lib/perl5>) for hermetic syntax checking
3281  
3282 =back
3283  
3284 You can set make variables like C<SYNTAX_CHECKING> in F<config.mk>, which
3285 is included on every invocation of C<make>, to alter build behavior -- for
3286 example C<SYNTAX_CHECKING=OFF> to skip the check when neither installer is
3287 present (undeclared dependencies then go undetected).
3288  
3289 I<Note: neither C<cpm> nor C<carton> is a hard prerequisite of
3290 C<CPAN::Maker::Bootstrapper> itself; they are needed only to populate the
3291 local library for hermetic checking. C<cpm> is preferred for its
3292 multi-mirror support (see L</build-mirrors>).>
3293  
3294 =head1 CAVEATS
3295  
3296 =over 4
3297  
3298 =item F<.pm> and F<.pl> Generation
3299  
3300 Generated F<.pm> and F<.pl> files are derived from their
3301 F<.pm.in>/F<.pl.in> sources through C<cmb resolve-vars> and are
3302 read-only. Always edit the F<.in> source.
3303  
3304 Use C<E<64>PACKAGE_VERSIONE<64>> like this:
3305  
3306 C<our $VERSION ='>C<E<64>PACKAGE_VERSIONE<64>>C<';>
3307  
3308 =item The import feature cannot be used with C<--stub>
3309  
3310 =item git
3311  
3312 C<git> is used throughout the framework. C<make git> initializes the
3313 repository and creates the initial commit, and the bootstrapper reads
3314 user identity and related defaults from F<.gitconfig> when no separate
3315 configuration file is supplied.
3316  
3317 =back
3318  
3319 =head1 FAQ
3320  
3321 =head2 My build is failing with a module not found error during syntax
3322 checking
3323  
3324 There are several common causes.
3325  
3326 One possible cause is an inter-module build-order dependency. The build
3327 system normally detects dependencies between modules in the distribution
3328 and writes them to F<deps.mk>, allowing C<make> to build prerequisite
3329 modules before syntax-checking modules that depend on them.
3330  
3331 For example, if C<lib/Foo/Bar.pm> uses C<lib/Foo.pm>, the generated
3332 dependency rules ensure that C<Foo.pm> is built first.
3333  
3334 If the dependency cannot be inferred automatically, declare it explicitly
3335 in F<project.mk>:
3336  
3337 lib/Foo/Bar.pm: lib/Foo.pm
3338  
3339 See L</Inter-module dependencies> for details.
3340  
3341 Another cause is a real dependency that is not installed in
3342 F<local/>. Because syntax checking runs against F<local/lib/perl5>
3343 with C<PERL5LIB> cleared, a dependency that is present elsewhere on
3344 your system but not declared will fail here.
3345  
3346 Confirm it is in F<requires> (add it with a sticky C<+> if the scanner
3347 can't see it -- see L</Dependencies Management>), then C<make local>
3348 to install it. This is the check working as intended: it catches a
3349 missing declaration on your machine instead of on someone else's.
3350  
3351 If the module genuinely cannot be loaded outside its runtime
3352 environment (an Apache handler, a mod_perl module, etc.), add it to
3353 C<PERLWC_SKIP> in F<project.mk>:
3354  
3355 PERLWC_SKIP = lib/My/Apache/Handler.pm
3356  
3357 Files listed in C<PERLWC_SKIP> are excluded from the C<perl -wc>
3358 syntax-checking and POD-checking stages. They are still built and
3359 included in the distribution; only those validation steps are skipped.
3360  
3361 =head2 How do I do a fast build during development?
3362  
3363 make quick
3364  
3365 This disables distribution dependency scanning and all linting
3366 (perltidy, perlcritic) for the current build. F<requires>,
3367 F<test-requires>, F<recommends>, and F<suggests> are not updated.
3368 Syntax checking remains enabled.
3369  
3370 Use C<make> without flags when you are
3371 ready to do a full build before committing or releasing.
3372  
3373 You can also disable individual features:
3374  
3375 make SCAN=OFF # skip distribution dependency scanning only
3376 make LINT=OFF # skip all linting only
3377 make SYNTAX_CHECKING=OFF # skip syntax checking only
3378  
3379 =head2 How do I add a new module or script to the project?
3380  
3381 Create the source file with the C<.pm.in> or C<.pl.in> extension in
3382 the appropriate directory:
3383  
3384 lib/My/New/Module.pm.in
3385 bin/my-script.pl.in
3386  
3387 The build system discovers them automatically via C<find-files> - no
3388 changes to the Makefile are required. The next C<make> will include
3389 them in the dependency scan and the distribution.
3390  
3391 =head2 How do I include additional files in the distribution?
3392  
3393 Edit F<buildspec.yml> and add entries to the C<extra-files> section:
3394  
3395 extra-files:
3396 - ChangeLog
3397 - README.md
3398 - share:
3399 - my-config-template.yml
3400 - my-data-file.json
3401  
3402 Files listed under C<share:> are installed into the distribution's
3403 share directory and can be accessed at runtime via
3404 L<File::ShareDir>.
3405  
3406 The build verifies that files listed in C<extra-files> are tracked by
3407 git. This helps catch files that have been added to the distribution
3408 but accidentally omitted from the project repository.
3409  
3410 Some extra files are generated build artifacts and therefore B<should
3411 not be committed> to the repository. Add those files to
3412 F<extra-files.skip>, one file per line:
3413  
3414 generated/service-data.dat
3415 share/generated-index.json
3416  
3417 Blank lines and lines beginning with C<#> are ignored.
3418  
3419 F<extra-files.skip> only disables the git tracking check for those
3420 files. The files remain part of the distribution and continue to be
3421 included as dependencies when determining whether the distribution
3422 tarball must be rebuilt.
3423  
3424 When C<DARKPAN_REQUIRES> is enabled, F<cpanfile.darkpan> and
3425 F<cpanm.darkpan> are automatically added to F<buildspec.yml> as extra
3426 files. They are therefore subject to the normal git tracking check. If
3427 the developer wants to include these generated manifests in the
3428 distribution without tracking them in the repository, they may be
3429 added explicitly to F<extra-files.skip>. See L</DARKPAN_REQUIRES>.
3430  
3431 =head2 I want to pin a version or add a module the scanner missed
3432  
3433 Edit F<requires> directly. Prefix the module name with C<+> to make
3434 the entry sticky - it will survive all subsequent rescans even if the
3435 scanner no longer detects it:
3436  
3437 +My::Required::Module 1.5
3438  
3439 To pin a version without making the entry sticky, just set the version
3440 number. The scanner will preserve your version if it detects a
3441 different one on subsequent builds:
3442  
3443 Some::Module 2.0
3444  
3445 These two mechanisms are independent - C<+> controls survivability,
3446 the version number controls what version is required. See L</Dependencies Management>
3447 for full details.
3448  
3449 =head2 I want to exclude a module the scanner found
3450  
3451 Create a F<requires.skip> file in the project root with one module
3452 name per line:
3453  
3454 My::Own::Module
3455 Some::Transitive::Dep
3456  
3457 The scanner will never add these to F<requires>. Use
3458 F<test-requires.skip> for the same effect on test dependencies.
3459  
3460 Note that on a clean first build neither skip file has any effect
3461 since there is no prior F<requires> file to compare against. The skip
3462 list takes effect from the second build onward.
3463  
3464 =head2 I edited a .pm file and my changes disappeared
3465  
3466 The C<.pm> files in F<lib/> are generated from the C<.pm.in> sources
3467 and are write-protected. Always edit the C<.pm.in> file - the C<.pm>
3468 is regenerated when its prerequisites require regeneration and your
3469 changes will be lost.
3470  
3471 If you are unsure which file to edit:
3472  
3473 ls -l lib/My/Module.pm lib/My/Module.pm.in
3474  
3475 The C<.pm.in> file is the one you own.
3476  
3477 =head2 Why does my build say it has drifted from the installed bootstrapper?
3478  
3479 This means your project's managed files (F<Makefile>,
3480 F<.includes/*.mk>) no longer match what your I<currently installed>
3481 C<CPAN::Maker::Bootstrapper> would generate. There are two ways this
3482 happens - upgrading your bootstrapper (e.g. via C<cpanm
3483 --upgrade-all>) instantly "drifts" every project you haven't yet
3484 updated, or a managed file was edited by hand. Both are fixed the
3485 same way:
3486  
3487 make update
3488  
3489 If you don't want a drifted project to fail the build outright, set
3490 C<CMB_VERSION_DRIFT=WARN> (or C<=IGNORE>) in that project's
3491 F<config.mk>. See L</Automatic Drift and Update Checks>.
3492  
3493 =head2 make update overwrote something I changed in a managed file
3494  
3495 The managed files in F<.includes/> should never be edited directly.
3496 Use F<config.mk>, F<project.mk>, or the other documented project-level
3497 extension points instead.
3498  
3499 This is why C<make git> and committing your F<.includes/> directory is
3500 strongly recommended - git is your safety net for the entire build
3501 system.
3502  
3503 =head2 C<make> says nothing to do but my source changed
3504  
3505 The most common cause is that the generated C<.pm> file is newer than
3506 the C<.pm.in> source. This can happen if you accidentally edited the
3507 C<.pm> directly or if file timestamps got out of sync. Force a rebuild:
3508  
3509 touch lib/My/Module.pm.in
3510  
3511 Or do a clean rebuild:
3512  
3513 make clean && make
3514  
3515 =head2 How do I disable dependency scanning temporarily?
3516  
3517 make SCAN=OFF
3518  
3519 This skips distribution dependency scanning for that run, so
3520 F<requires>, F<test-requires>, F<recommends>, and F<suggests> are not
3521 updated.
3522  
3523 Inter-module dependency discovery for F<deps.mk> is independent of
3524 C<SCAN> and may still run when syntax checking is enabled. The default
3525 is C<SCAN=ON>.
3526  
3527 =head2 How do I disable syntax checking temporarily?
3528  
3529 make SYNTAX_CHECKING=OFF
3530  
3531 Similarly you can disable individual quality gates:
3532  
3533 make PERLTIDY="" PERLCRITIC=""
3534  
3535 =head2 How do I upgrade the build system?
3536  
3537 make upgrade
3538  
3539 This checks MetaCPAN for a newer version of
3540 C<CPAN::Maker::Bootstrapper>, installs it via C<cpanm>, and
3541 automatically refreshes the managed files in F<.includes/> with
3542 C<make update>. Review the changes with C<git diff>.
3543  
3544 If C<cpanm> is not installed:
3545  
3546 make cpanm && make upgrade
3547  
3548 =head2 I want to add a bash script to my distribution
3549  
3550 Create the script in F<bin/> with a C<.sh.in> extension:
3551  
3552 bin/my-script.sh.in
3553  
3554 The build system will process it through the standard token
3555 substitution (replacing C<E<64>PACKAGE_VERSIONE<64>> and
3556 C<E<64>MODULE_NAMEE<64>>), make it executable, and include it in the
3557 distribution automatically.
3558  
3559 If your script is more than a few lines of bash, consider writing it
3560 as a I<modulino> instead - a Perl module that doubles as a runnable
3561 script. Modulinos are easier to test, encourage encapsulation, and
3562 give you the full power of Perl and CPAN. The build system has
3563 first-class support for them:
3564  
3565 make modulino
3566  
3567 This generates a bash wrapper in F<bin/> that invokes your module as
3568 a script if it uses the modulino pattern:
3569  
3570 caller or __PACKAGE__->main;
3571  
3572 See L</MODULINOS> for full details.
3573  
3574 =head2 What is C<make release-notes> used for?
3575  
3576 C<make release-notes> generates four artifacts comparing the current
3577 working state of your repository against the previous git tag:
3578  
3579 =over 4
3580  
3581 =item * F<release-E<lt>versionE<gt>.diffs> - a unified diff of all
3582 changed files
3583  
3584 =item * F<release-E<lt>versionE<gt>.lst> - a list of added, modified,
3585 and removed files
3586  
3587 =item * F<release-E<lt>versionE<gt>.status> - Git name-status output
3588 classifying added, modified, deleted, and renamed files
3589  
3590 =item * F<release-E<lt>versionE<gt>.tar.gz> - a tarball containing
3591 only the changed files
3592  
3593 =back
3594  
3595 These are primarily useful for generating release notes and
3596 changelogs, and for submitting targeted patches. Run it after bumping
3597 the version with C<make release>, C<make minor>, or C<make major> and
3598 before creating your final distribution.
3599  
3600 make minor
3601 make release-notes
3602 # review release-1.1.0.diffs
3603 make
3604  
3605 The artifacts are all the clues needed for LLMs to produce accurate
3606 and well written release notes for your project.
3607  
3608 To generate the release artifacts without submitting them to the LLM,
3609 use:
3610  
3611 make release-notes DRYRUN=1
3612  
3613 This is useful for inspecting or debugging the release evidence before
3614 requesting generated release notes. The F<.diffs>, F<.lst>, F<.status>,
3615 and F<.tar.gz> artifacts are produced normally, but no LLM request is
3616 made.
3617  
3618 The release artifacts are cleaned up by C<make clean>.
3619  
3620 =head2 Can I distribute the POD in my modules separately?
3621  
3622 When you package your CPAN distribution you can strip the pod from
3623 your modules or you can extract the pod and provide them as separate
3624 C<.pod> files. The C<POD> make variable controls that behavior:
3625  
3626 =over 4
3627  
3628 =item C<make POD=extract>
3629  
3630 C<extract> will strip POD from your module and create a C<.pod> file
3631 containing the stripped POD that will be added to your distribution.
3632  
3633 =item C<make POD=remove>
3634  
3635 C<remove> will strip POD from your module. No POD will be included in
3636 the distribution.
3637  
3638 =back
3639  
3640 =head2 Something still doesn't work - how do I report an issue?
3641  
3642 First check the L</FAQ> sections above - your
3643 issue may already be covered.
3644  
3645 If you believe you have found a bug or want to request a feature,
3646 please open an issue on GitHub:
3647  
3648 https://github.com/rlauer6/CPAN-Maker-Bootstrapper/issues
3649  
3650 When reporting a bug please include:
3651  
3652 =over 4
3653  
3654 =item * The version of C<CPAN::Maker::Bootstrapper> (C<cmb --version>
3655 or C<perl -MCPAN::Maker::Bootstrapper -e 'print $CPAN::Maker::Bootstrapper::VERSION'>)
3656  
3657 =item * The output of C<make -n> or C<make --debug=v> if the issue is
3658 build-related
3659  
3660 =item * Your F<buildspec.yml> and F<project.mk> if relevant (redact
3661 any sensitive information)
3662  
3663 =item * The Perl and GNU make versions (C<perl --version>, C<make --version>)
3664  
3665 =item * B<MAKE SURE YOUR SUBMISSION DOES NOT CONTAIN SECRETS!>
3666  
3667 =back
3668  
3669 Pull requests are welcome. The project follows the standard GitHub
3670 fork-and-PR workflow.
3671  
3672 =head1 SEE ALSO
3673  
3674 L<CPAN::Maker> - the distribution builder driven by C<buildspec.yml>
3675 (includes C<make-cpan-dist.pl>)
3676  
3677 L<CLI::Simple> - the CLI framework used by the bootstrapper itself and
3678 optionally by generated CLI module stubs
3679  
3680 L<CPAN::Maker::ConfigReader> - the git config reader bundled with this
3681 distribution, available for use in your own
3682 tools.
3683  
3684 L<LLM::API> - client interface to Anthropic's Claude API
3685  
3686 L<Module::ScanDeps::Static> - the static scanner used for CPAN
3687 dependency discovery and for inter-module build-order discovery
3688 through F<deps.mk>.
3689  
3690 =head1 DEPENDENCIES
3691  
3692 The current runtime, build, test, recommended, and suggested
3693 dependencies are declared in the distribution metadata generated by
3694 L<CPAN::Maker>.
3695  
3696 See F<Makefile.PL>, F<META.json>, or F<META.yml> in the distribution
3697 for the authoritative dependency set.
3698  
3699 Some optional features require additional dependencies only when those
3700 features are used.
3701  
3702 =head1 VERSION
3703  
3704 This documentation refers to version 2.4.1
3705  
3706 =head1 AUTHOR
3707  
3708 Rob Lauer - E<lt>rlauer@treasurersbriefcase.comE<gt>
3709  
3710 =head1 LICENSE
3711  
3712 Copyright 2026, Robert C. Lauer All right reserved.
3713  
3714 This library is free software; you can redistribute it and/or modify it
3715 under the same terms as Perl itself.
3716  
3717 =cut
« CPAN/Maker/Bootstrapper/Role/Version.pm ↑ Summary CPAN/Maker/Bootstrapper/Constants.pm »