@drupal-canvas/create 1.4.1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +15 -15
  2. package/dist/index.js +193 -113
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -22,40 +22,40 @@ pnpm dlx @drupal-canvas/create@latest
22
22
  bunx @drupal-canvas/create@latest
23
23
  ```
24
24
 
25
- You can also provide the app name as an argument:
25
+ You can also provide the project name as an argument:
26
26
 
27
27
  ```bash
28
- npx @drupal-canvas/create@latest my-app
28
+ npx @drupal-canvas/create@latest my-project
29
29
  ```
30
30
 
31
31
  ### Options
32
32
 
33
- | Option | Description |
34
- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
35
- | `--template -t` | Template to use when scaffolding the app. One of the predefined templates (currently available: `acquia-nebula`, `balintbrews-canvas-starter`) or URL to custom template's Git repository. |
36
- | `--ref <ref>` | Custom Git ref to use when cloning the template repository. For example, a branch name or a tag. |
37
- | `--agents -a` | Comma-separated list of additional agents to support, or `none` to skip compatibility symlink creation. |
33
+ | Option | Description |
34
+ | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
35
+ | `--template -t` | Template to use when scaffolding the project. One of the predefined templates (currently available: `acquia-nebula`, `balintbrews-canvas-starter`) or URL to custom template's Git repository. |
36
+ | `--ref <ref>` | Custom Git ref to use when cloning the template repository. For example, a branch name or a tag. |
37
+ | `--agents -a` | Comma-separated list of additional agents to support, or `none` to skip compatibility symlink creation. |
38
38
 
39
39
  ### Example
40
40
 
41
41
  ```bash
42
- npx @drupal-canvas/create@latest my-app --template acquia-nebula
42
+ npx @drupal-canvas/create@latest my-project --template acquia-nebula
43
43
  ```
44
44
 
45
45
  Explicitly skip additional agent compatibility symlinks:
46
46
 
47
47
  ```bash
48
- npx @drupal-canvas/create@latest my-app --template acquia-nebula --agents none
48
+ npx @drupal-canvas/create@latest my-project --template acquia-nebula --agents none
49
49
  ```
50
50
 
51
51
  Provide additional agent compatibility symlinks without prompting:
52
52
 
53
53
  ```bash
54
- npx @drupal-canvas/create@latest my-app --template acquia-nebula --agents claude-code,roo
54
+ npx @drupal-canvas/create@latest my-project --template acquia-nebula --agents claude-code,roo
55
55
  ```
56
56
 
57
57
  If `--agents` is omitted, the CLI keeps the current interactive prompt on TTY
58
- runs. On non-interactive runs, it skips compatibility setup silently.
58
+ runs. On non-interactive runs, it skips compatibility setup and prints a note.
59
59
 
60
60
  ### `agents` command
61
61
 
@@ -82,7 +82,7 @@ npx @drupal-canvas/create@latest agents none
82
82
 
83
83
  Drupal Canvas Create is designed to be easily extendable with new templates.
84
84
 
85
- **Templates** are predefined application starter codebases. Each template
85
+ **Templates** are predefined Canvas project starter codebases. Each template
86
86
  references a Git repository that will be cloned to provide the initial codebase.
87
87
  To add a template, edit `templates.json` in the package root.
88
88
 
@@ -103,9 +103,9 @@ npm start
103
103
  Alternatively, use `npm run dev` to compile and watch for changes during
104
104
  development.
105
105
 
106
- ⚠️ You must use `my-canvas-app` (provided as default value) as your app name
107
- when running the script from a local directory. (Reasons are explained in the
108
- `.gitignore` file where we had to ignore this directory.)
106
+ ⚠️ You must use `my-canvas-project` (provided as default value) as your project
107
+ name when running the script from a local directory. (Reasons are explained in
108
+ the `.gitignore` file where we had to ignore this directory.)
109
109
 
110
110
  ### Scripts
111
111
 
package/dist/index.js CHANGED
@@ -35,6 +35,10 @@ var templates_default = [
35
35
 
36
36
  // src/lib/agents.ts
37
37
  var agents = {
38
+ "aider-desk": {
39
+ displayName: "AiderDesk",
40
+ skillsDir: ".aider-desk/skills"
41
+ },
38
42
  amp: {
39
43
  displayName: "Amp",
40
44
  skillsDir: ".agents/skills"
@@ -47,6 +51,10 @@ var agents = {
47
51
  displayName: "Augment",
48
52
  skillsDir: ".augment/skills"
49
53
  },
54
+ bob: {
55
+ displayName: "IBM Bob",
56
+ skillsDir: ".bob/skills"
57
+ },
50
58
  "claude-code": {
51
59
  displayName: "Claude Code",
52
60
  skillsDir: ".claude/skills"
@@ -59,10 +67,22 @@ var agents = {
59
67
  displayName: "Cline",
60
68
  skillsDir: ".agents/skills"
61
69
  },
70
+ "codearts-agent": {
71
+ displayName: "CodeArts Agent",
72
+ skillsDir: ".codeartsdoer/skills"
73
+ },
62
74
  codebuddy: {
63
75
  displayName: "CodeBuddy",
64
76
  skillsDir: ".codebuddy/skills"
65
77
  },
78
+ codemaker: {
79
+ displayName: "Codemaker",
80
+ skillsDir: ".codemaker/skills"
81
+ },
82
+ codestudio: {
83
+ displayName: "Code Studio",
84
+ skillsDir: ".codestudio/skills"
85
+ },
66
86
  codex: {
67
87
  displayName: "Codex",
68
88
  skillsDir: ".agents/skills"
@@ -91,10 +111,26 @@ var agents = {
91
111
  displayName: "Deep Agents",
92
112
  skillsDir: ".agents/skills"
93
113
  },
114
+ devin: {
115
+ displayName: "Devin for Terminal",
116
+ skillsDir: ".devin/skills"
117
+ },
118
+ dexto: {
119
+ displayName: "Dexto",
120
+ skillsDir: ".agents/skills"
121
+ },
94
122
  droid: {
95
123
  displayName: "Droid",
96
124
  skillsDir: ".factory/skills"
97
125
  },
126
+ firebender: {
127
+ displayName: "Firebender",
128
+ skillsDir: ".agents/skills"
129
+ },
130
+ forgecode: {
131
+ displayName: "ForgeCode",
132
+ skillsDir: ".forge/skills"
133
+ },
98
134
  "gemini-cli": {
99
135
  displayName: "Gemini CLI",
100
136
  skillsDir: ".agents/skills"
@@ -107,6 +143,10 @@ var agents = {
107
143
  displayName: "Goose",
108
144
  skillsDir: ".goose/skills"
109
145
  },
146
+ "hermes-agent": {
147
+ displayName: "Hermes Agent",
148
+ skillsDir: ".hermes/skills"
149
+ },
110
150
  junie: {
111
151
  displayName: "Junie",
112
152
  skillsDir: ".junie/skills"
@@ -168,10 +208,18 @@ var agents = {
168
208
  skillsDir: ".agents/skills",
169
209
  showInUniversalList: false
170
210
  },
211
+ rovodev: {
212
+ displayName: "Rovo Dev",
213
+ skillsDir: ".rovodev/skills"
214
+ },
171
215
  roo: {
172
216
  displayName: "Roo Code",
173
217
  skillsDir: ".roo/skills"
174
218
  },
219
+ "tabnine-cli": {
220
+ displayName: "Tabnine CLI",
221
+ skillsDir: ".tabnine/agent/skills"
222
+ },
175
223
  trae: {
176
224
  displayName: "Trae",
177
225
  skillsDir: ".trae/skills"
@@ -180,6 +228,11 @@ var agents = {
180
228
  displayName: "Trae CN",
181
229
  skillsDir: ".trae/skills"
182
230
  },
231
+ universal: {
232
+ displayName: "Universal",
233
+ skillsDir: ".agents/skills",
234
+ showInUniversalList: false
235
+ },
183
236
  warp: {
184
237
  displayName: "Warp",
185
238
  skillsDir: ".agents/skills"
@@ -188,6 +241,10 @@ var agents = {
188
241
  displayName: "Windsurf",
189
242
  skillsDir: ".windsurf/skills"
190
243
  },
244
+ zed: {
245
+ displayName: "Zed",
246
+ skillsDir: ".agents/skills"
247
+ },
191
248
  zencoder: {
192
249
  displayName: "Zencoder",
193
250
  skillsDir: ".zencoder/skills"
@@ -487,6 +544,9 @@ async function setupAgentSkills(projectDir, options = {}) {
487
544
  const hasExplicitSelection = options.selectedAgents !== void 0;
488
545
  try {
489
546
  if (!hasExplicitSelection && !interactive) {
547
+ info(
548
+ "Agent compatibility skipped because the command is non-interactive. Use --agents to enable it."
549
+ );
490
550
  return;
491
551
  }
492
552
  const canonicalSkillsDir = join(projectDir, DEFAULT_SKILLS_DIR);
@@ -528,8 +588,12 @@ async function setupAgentSkills(projectDir, options = {}) {
528
588
  skillNames,
529
589
  selectedAgents: nonUniversalAgents
530
590
  });
531
- const selectedAgentNames = selected.map((agent) => agents[agent].displayName).join(", ");
532
- info(`Selected agent support: ${selectedAgentNames}.`);
591
+ info(
592
+ `Agent compatibility:
593
+ ${nonUniversalAgents.map(
594
+ (agent) => `- ${agents[agent].displayName}: ${agents[agent].skillsDir}`
595
+ ).join("\n")}`
596
+ );
533
597
  if (results.created.length > 0) {
534
598
  info(
535
599
  `Created compatibility ${pluralize("symlink", results.created.length)} (${skillNames.length} ${pluralize("skill", skillNames.length)} \xD7 ${nonUniversalAgents.length} ${pluralize("agent", nonUniversalAgents.length)}).`
@@ -556,7 +620,7 @@ async function defaultPromptForAgents() {
556
620
  const additionalAgents = getNonUniversalAgents();
557
621
  p4.log.message("");
558
622
  const selected = await searchMultiselect({
559
- message: "Which additional agents should this codebase support?",
623
+ message: "Which AI coding agents should this codebase support?",
560
624
  items: additionalAgents.map((agent) => ({
561
625
  value: agent,
562
626
  label: agents[agent].displayName,
@@ -635,7 +699,7 @@ function agentsCommand(program2) {
635
699
  selectedAgents,
636
700
  interactive: Boolean(process.stdin.isTTY && process.stdout.isTTY)
637
701
  });
638
- p4.outro("\u{1F916} Done.");
702
+ p4.outro("Agent compatibility setup complete.");
639
703
  } catch (error) {
640
704
  if (error instanceof Error) {
641
705
  p4.log.error(`Error: ${error.message}`);
@@ -665,7 +729,7 @@ function detectPackageManager() {
665
729
  // package.json
666
730
  var package_default = {
667
731
  name: "@drupal-canvas/create",
668
- version: "1.4.1",
732
+ version: "1.5.0",
669
733
  description: "CLI to scaffold a codebase for working with Drupal Canvas Code Components"};
670
734
 
671
735
  // src/lib/meta-info.ts
@@ -684,12 +748,12 @@ var use_git_default = (baseDir) => {
684
748
  };
685
749
 
686
750
  // src/create.ts
687
- async function createApp(ctx) {
688
- const { template, appName, selectedAgents } = ctx;
689
- const projectDir = `${process.cwd()}/${appName}`;
751
+ async function createProject(ctx) {
752
+ const { template, projectName, selectedAgents } = ctx;
753
+ const projectDir = `${process.cwd()}/${projectName}`;
690
754
  try {
691
755
  const s1 = p4.spinner();
692
- s1.start("Fetching initial codebase");
756
+ s1.start("Fetching template");
693
757
  const hasCommitSHARef = /^[a-f0-9]{40}$/i.test(template.repository.ref);
694
758
  const git = use_git_default();
695
759
  const options = {
@@ -698,32 +762,32 @@ async function createApp(ctx) {
698
762
  if (template.repository.ref !== "HEAD" && !hasCommitSHARef) {
699
763
  options["--branch"] = template.repository.ref;
700
764
  }
701
- await git.clone(template.repository.url, appName, options);
702
- const gitAppDir = use_git_default(projectDir);
765
+ await git.clone(template.repository.url, projectName, options);
766
+ const gitProjectDir = use_git_default(projectDir);
703
767
  if (hasCommitSHARef) {
704
- await gitAppDir.fetch("origin", template.repository.ref);
705
- await gitAppDir.checkout(template.repository.ref);
768
+ await gitProjectDir.fetch("origin", template.repository.ref);
769
+ await gitProjectDir.checkout(template.repository.ref);
706
770
  }
707
771
  await rimraf(`${projectDir}/.git`);
708
772
  const packageJsonPath = join(projectDir, "package.json");
709
773
  const packageJsonContent = await readFile(packageJsonPath, "utf-8");
710
774
  const packageJson = JSON.parse(packageJsonContent);
711
- packageJson.name = appName;
775
+ packageJson.name = projectName;
712
776
  await writeFile(
713
777
  packageJsonPath,
714
778
  JSON.stringify(packageJson, null, 2) + "\n"
715
779
  );
716
- s1.stop(chalk2.green("Fetched initial codebase"));
780
+ s1.stop(chalk2.green("Fetched template"));
717
781
  await setupAgentSkills(projectDir, {
718
782
  selectedAgents,
719
783
  interactive: Boolean(process.stdin.isTTY && process.stdout.isTTY)
720
784
  });
721
785
  const s2 = p4.spinner();
722
786
  const packageManager = detectPackageManager();
723
- s2.start(`Installing dependencies using ${packageManager}`);
787
+ s2.start(`Installing dependencies with ${packageManager}`);
724
788
  await new Promise((resolve, reject) => {
725
789
  const child = spawn(packageManager, ["install"], {
726
- cwd: `./${appName}`,
790
+ cwd: `./${projectName}`,
727
791
  stdio: ["ignore", "ignore", "pipe"],
728
792
  env: {
729
793
  ...process.env,
@@ -742,7 +806,10 @@ async function createApp(ctx) {
742
806
  if (code !== 0) {
743
807
  reject(
744
808
  new Error(
745
- `Package installation failed with code ${code}${stderrOutput ? `:
809
+ `Package installation failed with code ${code}.
810
+ Failed command: ${packageManager} install
811
+ Working directory: ./${projectName}${stderrOutput ? `
812
+
746
813
  ${stderrOutput}` : ""}`
747
814
  )
748
815
  );
@@ -751,21 +818,29 @@ ${stderrOutput}` : ""}`
751
818
  }
752
819
  });
753
820
  });
754
- s2.stop(chalk2.green("Installed dependencies"));
821
+ s2.stop(chalk2.green(`Installed dependencies with ${packageManager}`));
755
822
  const s3 = p4.spinner();
756
- s3.start("Preparing your repository");
757
- await git.init(["--initial-branch=main", appName]);
758
- await gitAppDir.add(["--all"]);
759
- await gitAppDir.commit(
760
- `Init codebase using ${getName()}@${getVersion()}
823
+ s3.start("Initializing Git repository");
824
+ await git.init(["--initial-branch=main", projectName]);
825
+ await gitProjectDir.add(["--all"]);
826
+ await gitProjectDir.commit(
827
+ `Init project using ${getName()}@${getVersion()}
761
828
 
762
829
  Template repository: ${template.repository.url}
763
830
  Ref: ${template.repository.ref}`
764
831
  );
765
- s3.stop(chalk2.green("Prepared repository"));
766
- p4.note(`$ cd ${appName}
767
- $ ${packageManager} run dev`, "Get started");
768
- p4.outro("\u{1F680} App created successfully");
832
+ s3.stop(
833
+ chalk2.green("Initialized Git repository on main with initial commit")
834
+ );
835
+ p4.note(
836
+ `Created project in ./${projectName}
837
+
838
+ Next steps:
839
+ cd ${projectName}
840
+ ${packageManager} run dev`,
841
+ "Get started"
842
+ );
843
+ p4.outro("Canvas project created successfully.");
769
844
  } catch (error) {
770
845
  if (error instanceof Error) {
771
846
  p4.log.error(`Error: ${error.message}`);
@@ -793,7 +868,7 @@ function validateName(name) {
793
868
  process.on("SIGINT", () => process.exit(0));
794
869
  process.on("SIGTERM", () => process.exit(0));
795
870
  var program = new Command();
796
- program.name(getName()).description(getDescription()).version(getVersion()).argument("[app-name]", "name of the app to create").option(
871
+ program.name(getName()).description(getDescription()).version(getVersion()).argument("[project-name]", "name of the project to create").option(
797
872
  "-t, --template <template>",
798
873
  "use template when scaffolding (predefined name or custom Git repository URL)"
799
874
  ).option(
@@ -802,101 +877,106 @@ program.name(getName()).description(getDescription()).version(getVersion()).argu
802
877
  ).option(
803
878
  "-a, --agents <agents>",
804
879
  'comma-separated list of additional agents to support, or "none" to skip compatibility symlinks'
805
- ).action(async (appNameArg, options) => {
806
- p4.intro(chalk2.bold("Drupal Canvas Create"));
807
- try {
808
- const selectedAgents = parseAgentSelection(options.agents);
809
- if (options.template) {
810
- const template2 = templates_default.find(
811
- (t) => t.id === options.template
812
- );
813
- const isCustomRepositoryUrl = [
814
- // Remote repositories.
815
- "https://",
816
- "http://",
817
- "git@",
818
- // Local repositories.
819
- "../",
820
- "./",
821
- "/"
822
- ].some((prefix) => options.template?.startsWith(prefix));
823
- if (!template2 && isCustomRepositoryUrl) {
824
- templates_default.push({
825
- id: options.template,
826
- label: options.template,
827
- repository: {
828
- url: options.template,
829
- ref: "HEAD"
880
+ ).action(
881
+ async (projectNameArg, options) => {
882
+ p4.intro(chalk2.bold("Drupal Canvas Create"));
883
+ try {
884
+ const selectedAgents = parseAgentSelection(options.agents);
885
+ if (options.template) {
886
+ const template2 = templates_default.find(
887
+ (t) => t.id === options.template
888
+ );
889
+ const isCustomRepositoryUrl = [
890
+ // Remote repositories.
891
+ "https://",
892
+ "http://",
893
+ "git@",
894
+ // Local repositories.
895
+ "../",
896
+ "./",
897
+ "/"
898
+ ].some((prefix) => options.template?.startsWith(prefix));
899
+ if (!template2 && isCustomRepositoryUrl) {
900
+ templates_default.push({
901
+ id: options.template,
902
+ label: options.template,
903
+ repository: {
904
+ url: options.template,
905
+ ref: "HEAD"
906
+ }
907
+ });
908
+ } else if (!template2) {
909
+ p4.log.error(
910
+ `Template "${options.template}" not found.
911
+
912
+ Available templates:
913
+ ${templates_default.map((availableTemplate) => `- ${availableTemplate.id}`).join("\n")}`
914
+ );
915
+ process.exit(1);
916
+ }
917
+ }
918
+ let projectName = projectNameArg;
919
+ if (!projectName) {
920
+ const name = await p4.text({
921
+ message: "Enter the project name",
922
+ initialValue: "my-canvas-project",
923
+ validate: (value) => {
924
+ if (!value) return "Project name is required";
925
+ const { valid, problems } = validateName(value);
926
+ if (!valid) {
927
+ return problems.join(", ");
928
+ }
929
+ return;
830
930
  }
831
931
  });
832
- } else if (!template2) {
833
- p4.log.error(`Template "${options.template}" not found`);
834
- process.exit(1);
932
+ if (p4.isCancel(name)) {
933
+ p4.cancel("Operation cancelled");
934
+ process.exit(0);
935
+ }
936
+ projectName = name;
937
+ } else {
938
+ const { valid, problems } = validateName(projectName);
939
+ if (!valid) {
940
+ p4.log.error(`Invalid project name: ${problems.join(", ")}`);
941
+ process.exit(1);
942
+ }
835
943
  }
836
- }
837
- let appName = appNameArg;
838
- if (!appName) {
839
- const name = await p4.text({
840
- message: "Enter the app name",
841
- initialValue: "my-canvas-app",
842
- validate: (value) => {
843
- if (!value) return "App name is required";
844
- const { valid, problems } = validateName(value);
845
- if (!valid) {
846
- return problems.join(", ");
944
+ let templateId = options.template;
945
+ if (!templateId) {
946
+ if (templates_default.length === 1) {
947
+ templateId = templates_default[0].id;
948
+ } else {
949
+ const selected = await p4.select({
950
+ message: "Select a template",
951
+ options: templates_default.map((t, index) => ({
952
+ value: t.id,
953
+ label: index === 0 ? `${t.label} (Recommended)` : t.label
954
+ }))
955
+ });
956
+ if (p4.isCancel(selected)) {
957
+ p4.cancel("Operation cancelled");
958
+ process.exit(0);
847
959
  }
848
- return;
960
+ templateId = selected;
849
961
  }
850
- });
851
- if (p4.isCancel(name)) {
852
- p4.cancel("Operation cancelled");
853
- process.exit(0);
854
962
  }
855
- appName = name;
856
- } else {
857
- const { valid, problems } = validateName(appName);
858
- if (!valid) {
859
- p4.log.error(`Invalid app name: ${problems.join(", ")}`);
860
- process.exit(1);
963
+ const template = templates_default.find(
964
+ (t) => t.id === templateId
965
+ );
966
+ if (options.ref) {
967
+ template.repository.ref = options.ref;
861
968
  }
862
- }
863
- let templateId = options.template;
864
- if (!templateId) {
865
- if (templates_default.length === 1) {
866
- templateId = templates_default[0].id;
969
+ await createProject({ template, projectName, selectedAgents });
970
+ } catch (error) {
971
+ if (error instanceof Error) {
972
+ p4.log.error(`Error: ${error.message}`);
867
973
  } else {
868
- const selected = await p4.select({
869
- message: "Select a template",
870
- options: templates_default.map((t, index) => ({
871
- value: t.id,
872
- label: index === 0 ? `${t.label} (Recommended)` : t.label
873
- }))
874
- });
875
- if (p4.isCancel(selected)) {
876
- p4.cancel("Operation cancelled");
877
- process.exit(0);
878
- }
879
- templateId = selected;
974
+ p4.log.error(`Unknown error: ${String(error)}`);
880
975
  }
976
+ process.exit(1);
881
977
  }
882
- const template = templates_default.find(
883
- (t) => t.id === templateId
884
- );
885
- if (options.ref) {
886
- template.repository.ref = options.ref;
887
- }
888
- p4.note(`Template: ${template.label}
889
- App name: ${appName}`);
890
- await createApp({ template, appName, selectedAgents });
891
- } catch (error) {
892
- if (error instanceof Error) {
893
- p4.log.error(`Error: ${error.message}`);
894
- } else {
895
- p4.log.error(`Unknown error: ${String(error)}`);
896
- }
897
- process.exit(1);
898
978
  }
899
- });
979
+ );
900
980
  agentsCommand(program);
901
981
  program.showHelpAfterError();
902
982
  program.showSuggestionAfterError(true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drupal-canvas/create",
3
- "version": "1.4.1",
3
+ "version": "1.5.0",
4
4
  "description": "CLI to scaffold a codebase for working with Drupal Canvas Code Components",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -32,7 +32,7 @@
32
32
  "cross-spawn": "^7.0.6",
33
33
  "picocolors": "^1.1.1",
34
34
  "rimraf": "^6.1.2",
35
- "simple-git": "^3.30.0",
35
+ "simple-git": "^3.36.0",
36
36
  "string-width": "^7.2.0",
37
37
  "validate-npm-package-name": "^7.0.0"
38
38
  },