@codedrifters/configulator 0.0.247 → 0.0.249
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +200 -2
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +200 -2
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.mjs
CHANGED
|
@@ -625,6 +625,170 @@ var createAppSkill = {
|
|
|
625
625
|
" `sites/<scope>/<name>`."
|
|
626
626
|
].join("\n")
|
|
627
627
|
};
|
|
628
|
+
var createSiteSkill = {
|
|
629
|
+
name: "create-site",
|
|
630
|
+
description: "Scaffold a new AstroProject sub-project under sites/@scope/<name> by emitting the projen block to add to the monorepo config",
|
|
631
|
+
disableModelInvocation: true,
|
|
632
|
+
instructions: [
|
|
633
|
+
"# Create Site",
|
|
634
|
+
"",
|
|
635
|
+
"Scaffold a new user-facing web front end at",
|
|
636
|
+
"`sites/@scope/<name>` by emitting the projen block to add to the",
|
|
637
|
+
"monorepo's projen configuration. This skill walks the user through",
|
|
638
|
+
"naming, metadata, and placement; it does **not** run projen, install",
|
|
639
|
+
"dependencies, or execute any build commands.",
|
|
640
|
+
"",
|
|
641
|
+
"The default project type is `AstroProject` \u2014 the common shape for",
|
|
642
|
+
"marketing sites, SPAs, and client-facing static sites. A",
|
|
643
|
+
'`StarlightProject` with `role: "site"` is also a valid placement',
|
|
644
|
+
"under `sites/<scope>/<name>` for consumers who specifically want a",
|
|
645
|
+
"Starlight-based front end; it is **not** the monorepo-wide docs site.",
|
|
646
|
+
"",
|
|
647
|
+
"## Usage",
|
|
648
|
+
"",
|
|
649
|
+
"```",
|
|
650
|
+
"/create-site @<scope>/<name>",
|
|
651
|
+
"```",
|
|
652
|
+
"",
|
|
653
|
+
"Example: `/create-site @codedrifters/marketing-site` \u2192 scaffolds a",
|
|
654
|
+
"new `AstroProject` at `sites/@codedrifters/marketing-site`.",
|
|
655
|
+
"",
|
|
656
|
+
"## Docs-vs-Site Guard",
|
|
657
|
+
"",
|
|
658
|
+
"There is **exactly one** Starlight docs site per monorepo, and it",
|
|
659
|
+
"lives at `/docs` \u2014 not under `sites/`. Before emitting any block,",
|
|
660
|
+
"check whether the user actually wants the monorepo-wide docs site:",
|
|
661
|
+
"",
|
|
662
|
+
"- If the user's intent is to create the single dev-docs site for the",
|
|
663
|
+
" monorepo (names like `docs`, `documentation`, `dev-docs`, or any",
|
|
664
|
+
' explicit mention of "the docs site"), **refuse** to scaffold it',
|
|
665
|
+
" under `sites/`. Redirect them to the `StarlightProject` defaults",
|
|
666
|
+
" that place the docs site at `/docs`, and explain that `sites/` is",
|
|
667
|
+
" reserved for end-user-facing web front ends (marketing, SPAs,",
|
|
668
|
+
" client-facing apps).",
|
|
669
|
+
"- If the user wants a user-facing site that happens to use Starlight",
|
|
670
|
+
" (e.g. a public-facing documentation portal for a specific",
|
|
671
|
+
" product), that is fine \u2014 they should use `StarlightProject` with",
|
|
672
|
+
' `role: "site"`, which routes under `sites/<scope>/<name>`.',
|
|
673
|
+
"- Otherwise, proceed with `AstroProject` as the default.",
|
|
674
|
+
"",
|
|
675
|
+
"## Steps",
|
|
676
|
+
"",
|
|
677
|
+
"1. **Parse and validate the site name.** The argument must be a",
|
|
678
|
+
" **scoped** npm name in the form `@<scope>/<name>`:",
|
|
679
|
+
" - Starts with `@`",
|
|
680
|
+
" - Has exactly one `/` separator",
|
|
681
|
+
" - `<scope>` and `<name>` are lowercase, kebab-case, non-empty",
|
|
682
|
+
" - Unscoped names (e.g. `marketing-site`) are **not** allowed \u2014",
|
|
683
|
+
" every site under `sites/` is scoped by owner.",
|
|
684
|
+
" If the input is missing or invalid, ask the user to supply a",
|
|
685
|
+
" scoped name. Do not guess the scope. Run the docs-vs-site guard",
|
|
686
|
+
" above before continuing.",
|
|
687
|
+
"",
|
|
688
|
+
"2. **Collect metadata** \u2014 ask the user for each of the following,",
|
|
689
|
+
" one question at a time:",
|
|
690
|
+
" - **Description** \u2014 one-line summary of what the site is for.",
|
|
691
|
+
" - **Project type** \u2014 `AstroProject` (default) or",
|
|
692
|
+
" `StarlightProject` (role = site). If the user is unsure,",
|
|
693
|
+
" recommend `AstroProject` \u2014 Starlight is only the right choice",
|
|
694
|
+
" when the site's primary purpose is a documentation-style",
|
|
695
|
+
' layout. As an aside: a `StarlightProject` with `role: "site"`',
|
|
696
|
+
" lives at the same `sites/<scope>/<name>` path, so switching",
|
|
697
|
+
" between the two later is a low-cost change.",
|
|
698
|
+
" Skip any question the user has already answered in the initial",
|
|
699
|
+
" prompt.",
|
|
700
|
+
"",
|
|
701
|
+
"3. **Determine the target outdir.** The sub-project lives at:",
|
|
702
|
+
"",
|
|
703
|
+
" ```",
|
|
704
|
+
" sites/<scope>/<name>",
|
|
705
|
+
" ```",
|
|
706
|
+
"",
|
|
707
|
+
" `<scope>` is everything after `@` and before `/` in the site",
|
|
708
|
+
" name; `<name>` is everything after the `/`. This matches the",
|
|
709
|
+
" default `outdir` that `AstroProject` (and `StarlightProject` with",
|
|
710
|
+
' `role: "site"`) computes from the package name, so the emitted',
|
|
711
|
+
" block does **not** need to set `outdir` explicitly.",
|
|
712
|
+
"",
|
|
713
|
+
"4. **Locate the projen config file.** Prefer the monorepo's",
|
|
714
|
+
" `projenrc/` directory \u2014 most monorepos declare sub-projects",
|
|
715
|
+
" there (e.g. `projenrc/root-project.ts` or a dedicated",
|
|
716
|
+
" `projenrc/sites.ts`). Fall back to `.projenrc.ts` only when",
|
|
717
|
+
" no `projenrc/` directory exists.",
|
|
718
|
+
"",
|
|
719
|
+
"5. **Emit the projen block.** Show the TypeScript block to paste",
|
|
720
|
+
" into the chosen projen config file. Example for",
|
|
721
|
+
" `@codedrifters/marketing-site` as an `AstroProject`:",
|
|
722
|
+
"",
|
|
723
|
+
" ```typescript",
|
|
724
|
+
" import { AstroProject } from '@codedrifters/configulator';",
|
|
725
|
+
"",
|
|
726
|
+
" // Inside the monorepo's configuration function, alongside",
|
|
727
|
+
" // sibling sub-projects:",
|
|
728
|
+
" new AstroProject({",
|
|
729
|
+
" parent: monorepo,",
|
|
730
|
+
" name: '@codedrifters/marketing-site',",
|
|
731
|
+
" description: '<one-line description>',",
|
|
732
|
+
" });",
|
|
733
|
+
" ```",
|
|
734
|
+
"",
|
|
735
|
+
' If the user chose `StarlightProject` with `role: "site"`, emit',
|
|
736
|
+
" that variant instead \u2014 same path, different project class:",
|
|
737
|
+
"",
|
|
738
|
+
" ```typescript",
|
|
739
|
+
" import { StarlightProject } from '@codedrifters/configulator';",
|
|
740
|
+
"",
|
|
741
|
+
" new StarlightProject({",
|
|
742
|
+
" parent: monorepo,",
|
|
743
|
+
" name: '@codedrifters/marketing-site',",
|
|
744
|
+
" description: '<one-line description>',",
|
|
745
|
+
" role: 'site',",
|
|
746
|
+
" });",
|
|
747
|
+
" ```",
|
|
748
|
+
"",
|
|
749
|
+
" Substitute the user's scope, name, and description. Do not",
|
|
750
|
+
" hard-code `outdir` \u2014 the default places the sub-project at",
|
|
751
|
+
" `sites/<scope>/<name>`.",
|
|
752
|
+
"",
|
|
753
|
+
"6. **Tell the user how to synthesize.** Instruct them to run, from",
|
|
754
|
+
" the repo root:",
|
|
755
|
+
"",
|
|
756
|
+
" ```",
|
|
757
|
+
" pnpm exec projen",
|
|
758
|
+
" pnpm install",
|
|
759
|
+
" ```",
|
|
760
|
+
"",
|
|
761
|
+
" `pnpm exec projen` regenerates the sub-project tree;",
|
|
762
|
+
" `pnpm install` updates the workspace lockfile. Do **not** run",
|
|
763
|
+
" these commands yourself \u2014 the user runs them.",
|
|
764
|
+
"",
|
|
765
|
+
"## Guardrails",
|
|
766
|
+
"",
|
|
767
|
+
"- Never run `pnpm exec projen`, `pnpm install`, `pnpm build`,",
|
|
768
|
+
" `pnpm test`, or any other package-manager, build, or test command.",
|
|
769
|
+
" Emit the projen block and instructions only.",
|
|
770
|
+
"- Never scaffold the monorepo-wide docs site under `sites/`. The",
|
|
771
|
+
" dev-docs site is a singleton at `/docs` and is created once per",
|
|
772
|
+
' repo via `StarlightProject` with its default `role: "docs"` \u2014',
|
|
773
|
+
" redirect the user there if they ask for it.",
|
|
774
|
+
"- Never scaffold outside `sites/`. Shared libraries belong under",
|
|
775
|
+
" `packages/<scope>/<name>` (use `/create-package`); deployable apps",
|
|
776
|
+
" belong under `apps/<scope>/<name>` (use `/create-app`).",
|
|
777
|
+
"- Never scope by category (e.g. `@sites/foo`, `@web/foo`). The",
|
|
778
|
+
" scope identifies the **owning party**; the top-level folder",
|
|
779
|
+
" identifies the kind.",
|
|
780
|
+
"- Do not invent an `outdir` \u2014 rely on the `AstroProject` default",
|
|
781
|
+
' (or the `StarlightProject` default when `role: "site"`) that',
|
|
782
|
+
" places the sub-project at `sites/<scope>/<name>`.",
|
|
783
|
+
"",
|
|
784
|
+
"## Related Skills",
|
|
785
|
+
"",
|
|
786
|
+
"- `/create-package` \u2014 scaffold a new `TypeScriptProject` under",
|
|
787
|
+
" `packages/<scope>/<name>`.",
|
|
788
|
+
"- `/create-app` \u2014 scaffold a new `AwsCdkProject` under",
|
|
789
|
+
" `apps/<scope>/<name>`."
|
|
790
|
+
].join("\n")
|
|
791
|
+
};
|
|
628
792
|
var createRuleSkill = {
|
|
629
793
|
name: "create-rule",
|
|
630
794
|
description: "Guide for creating new agent rules in this project using configulator",
|
|
@@ -683,7 +847,12 @@ var baseBundle = {
|
|
|
683
847
|
name: "base",
|
|
684
848
|
description: "Core rules: project overview, interaction style, and general coding conventions",
|
|
685
849
|
appliesWhen: () => true,
|
|
686
|
-
skills: [
|
|
850
|
+
skills: [
|
|
851
|
+
createPackageSkill,
|
|
852
|
+
createAppSkill,
|
|
853
|
+
createSiteSkill,
|
|
854
|
+
createRuleSkill
|
|
855
|
+
],
|
|
687
856
|
rules: [
|
|
688
857
|
{
|
|
689
858
|
name: "project-overview",
|
|
@@ -700,7 +869,36 @@ var baseBundle = {
|
|
|
700
869
|
"- **Never edit generated files** \u2014 they are marked with `// ~~ Generated by projen`",
|
|
701
870
|
"- **After modifying Projen configuration**, run `pnpm exec projen` to regenerate files, then `pnpm install` to update the lockfile.",
|
|
702
871
|
"- **Configure dependencies through Projen** \u2014 never use `npm install`, `pnpm add`, or `yarn add`. Add them to `deps` or `devDeps` in Projen config.",
|
|
703
|
-
"- **Export from index.ts** to maintain clean public APIs"
|
|
872
|
+
"- **Export from index.ts** to maintain clean public APIs",
|
|
873
|
+
"",
|
|
874
|
+
"## Repository Layout",
|
|
875
|
+
"",
|
|
876
|
+
"Every monorepo built with `@codedrifters/configulator` uses a fixed",
|
|
877
|
+
"top-level folder layout. Read a sub-project's role directly from its",
|
|
878
|
+
"outdir:",
|
|
879
|
+
"",
|
|
880
|
+
"| Folder | Purpose |",
|
|
881
|
+
"|--------|---------|",
|
|
882
|
+
"| `/docs` | **Single** monorepo-wide Starlight docs site (the one site that lives outside `/sites`). |",
|
|
883
|
+
"| `/apps/@scope/<name>` | Deployable applications (CDK stacks, mobile apps, backend services). |",
|
|
884
|
+
"| `/packages/@scope/<name>` | Shared libraries (published npm packages and workspace-internal libraries). |",
|
|
885
|
+
"| `/sites/@scope/<name>` | User-facing web front ends that are **not** the monorepo-wide docs site. |",
|
|
886
|
+
"",
|
|
887
|
+
"Every sub-project under `apps/`, `packages/`, or `sites/` is named",
|
|
888
|
+
"`@ownerscope/<name>`, where **scope is the owning party** (not a",
|
|
889
|
+
"category). Kind is captured by the top-level folder \u2014 never scope by",
|
|
890
|
+
"category (e.g. `@apps/foo`, `@libs/bar`).",
|
|
891
|
+
"",
|
|
892
|
+
"To place a **new** sub-project, always use a scaffolding skill \u2014 never",
|
|
893
|
+
"hand-roll the path:",
|
|
894
|
+
"",
|
|
895
|
+
"- `/create-package` \u2014 new shared library under `packages/<scope>/<name>`",
|
|
896
|
+
"- `/create-app` \u2014 new deployable app under `apps/<scope>/<name>`",
|
|
897
|
+
"- `/create-site` \u2014 new web front end under `sites/<scope>/<name>`",
|
|
898
|
+
"",
|
|
899
|
+
"The `monorepo-layout` rule documents the full contract (outdir",
|
|
900
|
+
"defaults per project type, the docs-singleton carve-out, synth-time",
|
|
901
|
+
"enforcement)."
|
|
704
902
|
].join("\n"),
|
|
705
903
|
tags: ["project"]
|
|
706
904
|
},
|