@drupal-canvas/create 1.1.0 → 1.3.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 +21 -5
  2. package/dist/index.js +94 -25
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -30,17 +30,33 @@ npx @drupal-canvas/create@latest my-app
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: `canvas-cc-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. |
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. |
37
38
 
38
39
  ### Example
39
40
 
40
41
  ```bash
41
- npx @drupal-canvas/create@latest my-app --template canvas-cc-starter
42
+ npx @drupal-canvas/create@latest my-app --template acquia-nebula
42
43
  ```
43
44
 
45
+ Explicitly skip additional agent compatibility symlinks:
46
+
47
+ ```bash
48
+ npx @drupal-canvas/create@latest my-app --template acquia-nebula --agents none
49
+ ```
50
+
51
+ Provide additional agent compatibility symlinks without prompting:
52
+
53
+ ```bash
54
+ npx @drupal-canvas/create@latest my-app --template acquia-nebula --agents claude-code,roo
55
+ ```
56
+
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.
59
+
44
60
  ## Development
45
61
 
46
62
  Drupal Canvas Create is designed to be easily extendable with new templates.
package/dist/index.js CHANGED
@@ -41,7 +41,7 @@ var agents = {
41
41
  },
42
42
  antigravity: {
43
43
  displayName: "Antigravity",
44
- skillsDir: ".agent/skills"
44
+ skillsDir: ".agents/skills"
45
45
  },
46
46
  augment: {
47
47
  displayName: "Augment",
@@ -57,7 +57,7 @@ var agents = {
57
57
  },
58
58
  cline: {
59
59
  displayName: "Cline",
60
- skillsDir: ".cline/skills"
60
+ skillsDir: ".agents/skills"
61
61
  },
62
62
  codebuddy: {
63
63
  displayName: "CodeBuddy",
@@ -75,13 +75,21 @@ var agents = {
75
75
  displayName: "Continue",
76
76
  skillsDir: ".continue/skills"
77
77
  },
78
+ cortex: {
79
+ displayName: "Cortex Code",
80
+ skillsDir: ".cortex/skills"
81
+ },
78
82
  crush: {
79
83
  displayName: "Crush",
80
84
  skillsDir: ".crush/skills"
81
85
  },
82
86
  cursor: {
83
87
  displayName: "Cursor",
84
- skillsDir: ".cursor/skills"
88
+ skillsDir: ".agents/skills"
89
+ },
90
+ deepagents: {
91
+ displayName: "Deep Agents",
92
+ skillsDir: ".agents/skills"
85
93
  },
86
94
  droid: {
87
95
  displayName: "Droid",
@@ -172,6 +180,10 @@ var agents = {
172
180
  displayName: "Trae CN",
173
181
  skillsDir: ".trae/skills"
174
182
  },
183
+ warp: {
184
+ displayName: "Warp",
185
+ skillsDir: ".agents/skills"
186
+ },
175
187
  windsurf: {
176
188
  displayName: "Windsurf",
177
189
  skillsDir: ".windsurf/skills"
@@ -211,6 +223,9 @@ function getNonUniversalAgents() {
211
223
  function isUniversalAgent(type) {
212
224
  return agents[type].skillsDir === ".agents/skills";
213
225
  }
226
+ function isAgentType(value) {
227
+ return Object.prototype.hasOwnProperty.call(agents, value);
228
+ }
214
229
  var silentOutput = new Writable({
215
230
  write(_chunk, _encoding, callback) {
216
231
  callback();
@@ -221,7 +236,7 @@ var S_STEP_CANCEL = pc.red("\u25A0");
221
236
  var S_STEP_SUBMIT = pc.green("\u25C7");
222
237
  var S_RADIO_ACTIVE = pc.green("\u25CF");
223
238
  var S_RADIO_INACTIVE = pc.dim("\u25CB");
224
- var S_CHECKBOX_LOCKED = pc.green("\u2713");
239
+ var S_BULLET = pc.green("\u2022");
225
240
  var S_BAR = pc.dim("\u2502");
226
241
  var S_BAR_H = pc.dim("\u2500");
227
242
  var cancelSymbol = /* @__PURE__ */ Symbol("cancel");
@@ -275,15 +290,16 @@ async function searchMultiselect(options) {
275
290
  if (state === "active") {
276
291
  if (lockedSection && lockedSection.items.length > 0) {
277
292
  lines.push(`${S_BAR}`);
293
+ const lockedTitle = `${pc.bold(lockedSection.title)} ${pc.dim("\u2500\u2500 always included")}`;
278
294
  lines.push(
279
- `${S_BAR} ${S_BAR_H}${S_BAR_H} ${pc.bold(lockedSection.title)} ${S_BAR_H.repeat(30)}`
295
+ `${S_BAR} ${S_BAR_H}${S_BAR_H} ${lockedTitle} ${S_BAR_H.repeat(12)}`
280
296
  );
281
297
  for (const item of lockedSection.items) {
282
- lines.push(`${S_BAR} ${S_CHECKBOX_LOCKED} ${item.label}`);
298
+ lines.push(`${S_BAR} ${S_BULLET} ${pc.bold(item.label)}`);
283
299
  }
284
300
  lines.push(`${S_BAR}`);
285
301
  lines.push(
286
- `${S_BAR} ${S_BAR_H}${S_BAR_H} ${pc.bold("Other agents")} ${S_BAR_H.repeat(34)}`
302
+ `${S_BAR} ${S_BAR_H}${S_BAR_H} ${pc.bold("Additional agents")} ${S_BAR_H.repeat(29)}`
287
303
  );
288
304
  }
289
305
  const searchLine = `${S_BAR} ${pc.dim("Search:")} ${query}${pc.inverse(" ")}`;
@@ -429,7 +445,12 @@ var DEFAULT_SKILLS_DIR = ".agents/skills";
429
445
  async function setupAgentSkills(projectDir, options = {}) {
430
446
  const info = options.onInfo ?? p3.log.info;
431
447
  const warning = options.onWarning ?? p3.log.warn;
448
+ const interactive = options.interactive ?? true;
449
+ const hasExplicitSelection = options.selectedAgents !== void 0;
432
450
  try {
451
+ if (!hasExplicitSelection && !interactive) {
452
+ return;
453
+ }
433
454
  const canonicalSkillsDir = join(projectDir, DEFAULT_SKILLS_DIR);
434
455
  const hasSkillsDir = await pathExists(canonicalSkillsDir);
435
456
  if (!hasSkillsDir) {
@@ -437,26 +458,29 @@ async function setupAgentSkills(projectDir, options = {}) {
437
458
  }
438
459
  const skillNames = await discoverSkillNames(canonicalSkillsDir);
439
460
  if (skillNames.length === 0) {
440
- info(
441
- "No skills found in .agents/skills. Skipping agent compatibility setup."
442
- );
461
+ info("No skills found in .agents/skills. Skipping compatibility setup.");
443
462
  return;
444
463
  }
445
- const promptForAgents = options.promptForAgents ?? defaultPromptForAgents;
446
- const selected = await promptForAgents();
464
+ let selected = options.selectedAgents;
465
+ if (selected === void 0) {
466
+ const promptForAgents = options.promptForAgents ?? defaultPromptForAgents;
467
+ selected = await promptForAgents();
468
+ }
447
469
  if (p3.isCancel(selected) || typeof selected === "symbol") {
448
- info("Skipped agent compatibility setup.");
470
+ info("Skipped compatibility setup.");
449
471
  return;
450
472
  }
451
473
  if (selected.length === 0) {
452
- info("No agents selected. Skipping agent compatibility setup.");
474
+ info("No additional agents selected. Skipping compatibility setup.");
453
475
  return;
454
476
  }
455
477
  const nonUniversalAgents = selected.filter(
456
478
  (agent) => !isUniversalAgent(agent)
457
479
  );
458
480
  if (nonUniversalAgents.length === 0) {
459
- info("Selected agents already use .agents/skills. No symlinks needed.");
481
+ info(
482
+ "Selected agents already use .agents/skills. No compatibility symlinks needed."
483
+ );
460
484
  return;
461
485
  }
462
486
  const results = await createAgentSkillSymlinks({
@@ -466,7 +490,7 @@ async function setupAgentSkills(projectDir, options = {}) {
466
490
  selectedAgents: nonUniversalAgents
467
491
  });
468
492
  const selectedAgentNames = selected.map((agent) => agents[agent].displayName).join(", ");
469
- info(`Agent skill support selected: ${selectedAgentNames}.`);
493
+ info(`Selected agent support: ${selectedAgentNames}.`);
470
494
  if (results.created.length > 0) {
471
495
  info(
472
496
  `Created compatibility ${pluralize("symlink", results.created.length)} (${skillNames.length} ${pluralize("skill", skillNames.length)} \xD7 ${nonUniversalAgents.length} ${pluralize("agent", nonUniversalAgents.length)}).`
@@ -484,16 +508,16 @@ async function setupAgentSkills(projectDir, options = {}) {
484
508
  }
485
509
  } catch (error) {
486
510
  const warning2 = options.onWarning ?? p3.log.warn;
487
- const message = error instanceof Error ? error.message : "Unknown error during agent compatibility setup";
488
- warning2(`Agent compatibility setup skipped: ${message}`);
511
+ const message = error instanceof Error ? error.message : "Unknown error during compatibility setup";
512
+ warning2(`Compatibility setup skipped: ${message}`);
489
513
  }
490
514
  }
491
515
  async function defaultPromptForAgents() {
492
516
  const universalAgents = getUniversalAgents();
493
- const otherAgents = getNonUniversalAgents();
517
+ const additionalAgents = getNonUniversalAgents();
494
518
  const selected = await searchMultiselect({
495
- message: "Which coding agents should this codebase support?",
496
- items: otherAgents.map((agent) => ({
519
+ message: "Which additional agents should this codebase support?",
520
+ items: additionalAgents.map((agent) => ({
497
521
  value: agent,
498
522
  label: agents[agent].displayName,
499
523
  hint: agents[agent].skillsDir
@@ -573,7 +597,7 @@ function detectPackageManager() {
573
597
  // package.json
574
598
  var package_default = {
575
599
  name: "@drupal-canvas/create",
576
- version: "1.0.1",
600
+ version: "1.3.0",
577
601
  description: "CLI to scaffold a codebase for working with Drupal Canvas Code Components"};
578
602
 
579
603
  // src/lib/meta-info.ts
@@ -585,7 +609,7 @@ var use_git_default = (baseDir) => simpleGit(baseDir).env({ ...process.env, GIT_
585
609
 
586
610
  // src/create.ts
587
611
  async function createApp(ctx) {
588
- const { template, appName } = ctx;
612
+ const { template, appName, selectedAgents } = ctx;
589
613
  const projectDir = `${process.cwd()}/${appName}`;
590
614
  try {
591
615
  const s1 = p3.spinner();
@@ -614,7 +638,10 @@ async function createApp(ctx) {
614
638
  JSON.stringify(packageJson, null, 2) + "\n"
615
639
  );
616
640
  s1.stop(chalk.green("Fetched initial codebase"));
617
- await setupAgentSkills(projectDir);
641
+ await setupAgentSkills(projectDir, {
642
+ selectedAgents,
643
+ interactive: Boolean(process.stdin.isTTY && process.stdout.isTTY)
644
+ });
618
645
  const s2 = p3.spinner();
619
646
  const packageManager = detectPackageManager();
620
647
  s2.start(`Installing dependencies using ${packageManager}`);
@@ -672,6 +699,44 @@ $ ${packageManager} run dev`, "Get started");
672
699
  process.exit(1);
673
700
  }
674
701
  }
702
+
703
+ // src/lib/agent-selection.ts
704
+ var NONE_VALUE = "none";
705
+ function parseAgentSelection(value) {
706
+ if (value === void 0) {
707
+ return void 0;
708
+ }
709
+ const selectedAgents = Array.from(
710
+ new Set(
711
+ value.split(",").map((agent) => agent.trim()).filter(Boolean)
712
+ )
713
+ );
714
+ if (selectedAgents.length === 0) {
715
+ throw new Error(
716
+ 'Invalid --agents value. Provide a comma-separated list or "none".'
717
+ );
718
+ }
719
+ if (selectedAgents.includes(NONE_VALUE)) {
720
+ if (selectedAgents.length > 1) {
721
+ throw new Error(
722
+ 'Invalid --agents value. "none" cannot be combined with other agents.'
723
+ );
724
+ }
725
+ return [];
726
+ }
727
+ const nonUniversalAgents = new Set(getNonUniversalAgents());
728
+ return selectedAgents.map((agent) => {
729
+ if (!isAgentType(agent)) {
730
+ throw new Error(`Invalid --agents value. Unknown agent "${agent}".`);
731
+ }
732
+ if (isUniversalAgent(agent) || !nonUniversalAgents.has(agent)) {
733
+ throw new Error(
734
+ `Invalid --agents value. Agent "${agent}" already uses .agents/skills.`
735
+ );
736
+ }
737
+ return agent;
738
+ });
739
+ }
675
740
  function validateName(name) {
676
741
  const nameValidation = validate(name);
677
742
  if (nameValidation.validForNewPackages) {
@@ -696,9 +761,13 @@ program.name(getName()).description(getDescription()).version(getVersion()).argu
696
761
  ).option(
697
762
  "-r, --ref <ref>",
698
763
  "use Git ref when cloning template repository (for example, branch name or tag)"
764
+ ).option(
765
+ "-a, --agents <agents>",
766
+ 'comma-separated list of additional agents to support, or "none" to skip compatibility symlinks'
699
767
  ).action(async (appNameArg, options) => {
700
768
  p3.intro(chalk.bold("Drupal Canvas Create"));
701
769
  try {
770
+ const selectedAgents = parseAgentSelection(options.agents);
702
771
  if (options.template) {
703
772
  const template2 = templates_default.find(
704
773
  (t) => t.id === options.template
@@ -780,7 +849,7 @@ program.name(getName()).description(getDescription()).version(getVersion()).argu
780
849
  }
781
850
  p3.note(`Template: ${template.label}
782
851
  App name: ${appName}`);
783
- await createApp({ template, appName });
852
+ await createApp({ template, appName, selectedAgents });
784
853
  } catch (error) {
785
854
  if (error instanceof Error) {
786
855
  p3.log.error(`Error: ${error.message}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drupal-canvas/create",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "CLI to scaffold a codebase for working with Drupal Canvas Code Components",
5
5
  "license": "MIT",
6
6
  "repository": {