@batijs/features 0.0.653 → 0.0.655

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/dist/index.js CHANGED
@@ -1,4 +1,70 @@
1
- import { n as features, r as flags, t as cliFlags } from "./features-BUNxomWq.js";
1
+ import { n as features, r as flags, t as cliFlags } from "./features-CStxEDu3.js";
2
+ //#region src/ai-agents.ts
3
+ const aiAgentFlags = features.filter((f) => f.category === "AI Agent").map((f) => f.flag);
4
+ /**
5
+ * Per-agent skill + instruction-file targets, verified against each agent's docs (SKILLS_PLAN.md §15):
6
+ * `.agents/skills` is the cross-tool standard (Codex/Gemini/Cursor/Copilot), only Claude needs
7
+ * `.claude/skills`; AGENTS.md is native everywhere except Claude and Gemini, which take an `@`-import.
8
+ */
9
+ const aiAgents = {
10
+ claude: {
11
+ skillsDir: ".claude/skills",
12
+ instructionFile: "CLAUDE.md",
13
+ instructionImport: "@AGENTS.md"
14
+ },
15
+ codex: {
16
+ skillsDir: ".agents/skills",
17
+ instructionFile: "AGENTS.md",
18
+ instructionImport: null
19
+ },
20
+ gemini: {
21
+ skillsDir: ".agents/skills",
22
+ instructionFile: "GEMINI.md",
23
+ instructionImport: "@./AGENTS.md"
24
+ },
25
+ cursor: {
26
+ skillsDir: ".agents/skills",
27
+ instructionFile: "AGENTS.md",
28
+ instructionImport: null
29
+ },
30
+ copilot: {
31
+ skillsDir: ".agents/skills",
32
+ instructionFile: "AGENTS.md",
33
+ instructionImport: null
34
+ }
35
+ };
36
+ /**
37
+ * Minimal set of skill directories covering the selected agents (SKILLS_PLAN.md §4) — at most two:
38
+ * `.agents/skills` for Codex/Gemini/Cursor/Copilot, `.claude/skills` for Claude.
39
+ */
40
+ function resolveSkillDirs(selected) {
41
+ const sel = new Set(selected);
42
+ const dirs = /* @__PURE__ */ new Set();
43
+ for (const flag of aiAgentFlags) if (sel.has(flag)) dirs.add(aiAgents[flag].skillsDir);
44
+ return [...dirs];
45
+ }
46
+ /**
47
+ * Instruction files for the selected agents (SKILLS_PLAN.md §3): the canonical `AGENTS.md` (always,
48
+ * since the shims import it) plus each agent's file, deduped. Empty when no agent is selected.
49
+ */
50
+ function resolveInstructionFiles(selected) {
51
+ const sel = new Set(selected);
52
+ if (!aiAgentFlags.some((flag) => sel.has(flag))) return [];
53
+ const byPath = new Map([["AGENTS.md", {
54
+ path: "AGENTS.md",
55
+ import: null
56
+ }]]);
57
+ for (const flag of aiAgentFlags) {
58
+ if (!sel.has(flag)) continue;
59
+ const { instructionFile, instructionImport } = aiAgents[flag];
60
+ byPath.set(instructionFile, {
61
+ path: instructionFile,
62
+ import: instructionImport
63
+ });
64
+ }
65
+ return [...byPath.values()];
66
+ }
67
+ //#endregion
2
68
  //#region src/groups.ts
3
69
  let categoriesGroups = /* @__PURE__ */ function(categoriesGroups) {
4
70
  categoriesGroups["Frontend"] = "Frontend";
@@ -71,6 +137,13 @@ PostgreSQL targets a Postgres server. Selected on its own you get a thin client;
71
137
  description: `Quickly host your Vike project with a Serverless or VPS (coming soon) solution.`,
72
138
  required: true
73
139
  },
140
+ {
141
+ label: "AI Agent",
142
+ multiple: true,
143
+ group: "Utilities",
144
+ description: `Generate agent skills and instruction files (SKILL.md, AGENTS.md, CLAUDE.md, …) tailored to your
145
+ selected stack, so AI coding agents understand this project's conventions out of the box. Select every agent you use.`
146
+ },
74
147
  {
75
148
  label: "Linter",
76
149
  multiple: true,
@@ -103,6 +176,7 @@ var BatiSet = class extends Set {
103
176
  #servers;
104
177
  #databases;
105
178
  #orm;
179
+ #aiAgents;
106
180
  pm;
107
181
  constructor(flags, allFeatures, pm) {
108
182
  super(flags);
@@ -110,14 +184,45 @@ var BatiSet = class extends Set {
110
184
  this.#servers = new Set(allFeatures.filter((f) => f.category === "Server").map((f) => f.flag));
111
185
  this.#databases = new Set(allFeatures.filter((f) => f.category === "Database").map((f) => f.flag));
112
186
  this.#orm = new Set(allFeatures.filter((f) => f.category === "ORM / Query builder").map((f) => f.flag));
187
+ this.#aiAgents = new Set(allFeatures.filter((f) => f.category === "AI Agent").map((f) => f.flag));
113
188
  }
114
189
  hasOneOf(a) {
115
190
  for (const x of this) if (a.has(x)) return true;
116
191
  return false;
117
192
  }
193
+ /** Prefix to run a package.json script (`npm run`, `pnpm`, `yarn`, `bun run`). */
194
+ get pmRun() {
195
+ return this.pm === "pnpm" || this.pm === "yarn" ? this.pm : `${this.pm} run`;
196
+ }
197
+ /** Prefix to run an installed dependency's binary (`npx`, `pnpm exec`, `yarn`, `bunx`). */
198
+ get pmExec() {
199
+ switch (this.pm) {
200
+ case "pnpm": return "pnpm exec";
201
+ case "yarn": return "yarn";
202
+ case "bun": return "bunx";
203
+ default: return "npx";
204
+ }
205
+ }
206
+ /** Prefix to fetch-and-run a package's binary, for `@latest` (`npx`, `pnpm dlx`, `yarn dlx`, `bunx`). */
207
+ get pmDlx() {
208
+ switch (this.pm) {
209
+ case "pnpm": return "pnpm dlx";
210
+ case "yarn": return "yarn dlx";
211
+ case "bun": return "bunx";
212
+ default: return "npx";
213
+ }
214
+ }
118
215
  get hasServer() {
119
216
  return this.hasOneOf(this.#servers);
120
217
  }
218
+ /** At least one AI coding agent is selected — gates skill / instruction-file generation. */
219
+ get hasAiAgent() {
220
+ return this.hasOneOf(this.#aiAgents);
221
+ }
222
+ /** The selected AI agent flags (subset of claude/codex/gemini/cursor/copilot), in selection order. */
223
+ get aiAgents() {
224
+ return [...this].filter((f) => this.#aiAgents.has(f));
225
+ }
121
226
  /** A database engine is selected (SQLite or PostgreSQL). */
122
227
  get hasDatabase() {
123
228
  return this.hasOneOf(this.#databases);
@@ -148,4 +253,4 @@ var BatiSet = class extends Set {
148
253
  }
149
254
  };
150
255
  //#endregion
151
- export { BatiSet, categories, categoriesGroups, cliFlags, features, flags };
256
+ export { BatiSet, aiAgentFlags, aiAgents, categories, categoriesGroups, cliFlags, features, flags, resolveInstructionFiles, resolveSkillDirs };
package/dist/rules.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as CategoryLabels, t as Flags } from "./features-mOkQmm5n.js";
1
+ import { i as Flags, t as CategoryLabels } from "./categories-BP9QFx2m.js";
2
2
 
3
3
  //#region src/rules/enum.d.ts
4
4
  declare enum RulesMessage {
package/dist/rules.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as features, r as flags } from "./features-BUNxomWq.js";
1
+ import { n as features, r as flags } from "./features-CStxEDu3.js";
2
2
  //#region src/rules/enum.ts
3
3
  let RulesMessage = /* @__PURE__ */ function(RulesMessage) {
4
4
  RulesMessage[RulesMessage["ERROR_AUTH_R_SERVER"] = 0] = "ERROR_AUTH_R_SERVER";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@batijs/features",
3
- "version": "0.0.653",
3
+ "version": "0.0.655",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "scripts": {