agent-flutter 0.1.2 → 0.1.3

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 +2 -2
  2. package/package.json +1 -1
  3. package/src/cli.js +64 -30
package/README.md CHANGED
@@ -52,10 +52,10 @@ npm run release:major
52
52
 
53
53
  ## Installed files
54
54
 
55
- - Shared pack: `.agent-flutter/`
55
+ - Shared pack (for Trae/Codex/Cursor/Windsurf/Cline): `.agent-flutter/`
56
56
  - Trae: `.trae/`
57
57
  - Codex: `AGENTS.md`
58
58
  - Cursor: `.cursor/rules/agent-flutter.mdc`
59
59
  - Windsurf: `.windsurf/rules/agent-flutter.md`
60
60
  - Cline: `.clinerules/agent-flutter.md`
61
- - GitHub: `.github/copilot-instructions.md`
61
+ - GitHub: `.github/skills/`, `.github/rules/`, `.github/copilot-instructions.md`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-flutter",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Portable Flutter skill/rule pack initializer for multiple AI IDEs.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli.js CHANGED
@@ -142,17 +142,21 @@ async function applyPack({
142
142
  mode,
143
143
  }) {
144
144
  const verb = mode === 'sync' ? 'Synced' : 'Installed';
145
+ const sharedPackIdes = new Set(['trae', 'codex', 'cursor', 'windsurf', 'cline']);
146
+ const requiresSharedPack = [...ideTargets].some((ide) => sharedPackIdes.has(ide));
145
147
  const sharedTarget = path.join(projectRoot, '.agent-flutter');
146
- if ((await exists(sharedTarget)) && !force) {
147
- console.log(`Using existing shared pack: ${sharedTarget}`);
148
- } else {
149
- await copyTemplateDirectory({
150
- sourceDir: templateRoot,
151
- destinationDir: sharedTarget,
152
- projectRoot,
153
- force: true,
154
- });
155
- console.log(`${verb} shared pack: ${sharedTarget}`);
148
+ if (requiresSharedPack) {
149
+ if ((await exists(sharedTarget)) && !force) {
150
+ console.log(`Using existing shared pack: ${sharedTarget}`);
151
+ } else {
152
+ await copyTemplateDirectory({
153
+ sourceDir: templateRoot,
154
+ destinationDir: sharedTarget,
155
+ projectRoot,
156
+ force: true,
157
+ });
158
+ console.log(`${verb} shared pack: ${sharedTarget}`);
159
+ }
156
160
  }
157
161
 
158
162
  if (ideTargets.has('trae')) {
@@ -170,8 +174,11 @@ async function applyPack({
170
174
  }
171
175
  }
172
176
 
173
- const skills = await loadSkillMetadata(path.join(sharedTarget, 'skills'));
174
- const rules = await loadRuleMetadata(path.join(sharedTarget, 'rules'));
177
+ const metadataSource = requiresSharedPack
178
+ ? sharedTarget
179
+ : templateRoot;
180
+ const skills = await loadSkillMetadata(path.join(metadataSource, 'skills'));
181
+ const rules = await loadRuleMetadata(path.join(metadataSource, 'rules'));
175
182
 
176
183
  if (ideTargets.has('codex')) {
177
184
  const agentsPath = path.join(projectRoot, 'AGENTS.md');
@@ -235,6 +242,32 @@ async function applyPack({
235
242
  }
236
243
 
237
244
  if (ideTargets.has('github')) {
245
+ const githubSkillsPath = path.join(projectRoot, '.github', 'skills');
246
+ if ((await exists(githubSkillsPath)) && !force) {
247
+ console.log(`Skipped GitHub skills (exists): ${githubSkillsPath}`);
248
+ } else {
249
+ await copyTemplateDirectory({
250
+ sourceDir: path.join(templateRoot, 'skills'),
251
+ destinationDir: githubSkillsPath,
252
+ projectRoot,
253
+ force: true,
254
+ });
255
+ console.log(`${verb} GitHub skills: ${githubSkillsPath}`);
256
+ }
257
+
258
+ const githubRulesPath = path.join(projectRoot, '.github', 'rules');
259
+ if ((await exists(githubRulesPath)) && !force) {
260
+ console.log(`Skipped GitHub rules (exists): ${githubRulesPath}`);
261
+ } else {
262
+ await copyTemplateDirectory({
263
+ sourceDir: path.join(templateRoot, 'rules'),
264
+ destinationDir: githubRulesPath,
265
+ projectRoot,
266
+ force: true,
267
+ });
268
+ console.log(`${verb} GitHub rules: ${githubRulesPath}`);
269
+ }
270
+
238
271
  const githubPath = path.join(projectRoot, '.github', 'copilot-instructions.md');
239
272
  const written = await writeTextFile(
240
273
  githubPath,
@@ -250,22 +283,23 @@ async function applyPack({
250
283
  }
251
284
 
252
285
  async function detectInstalledIdeTargets(projectRoot) {
253
- const checks = [
254
- ['trae', path.join(projectRoot, '.trae')],
255
- ['codex', path.join(projectRoot, 'AGENTS.md')],
256
- ['cursor', path.join(projectRoot, '.cursor', 'rules', 'agent-flutter.mdc')],
257
- ['windsurf', path.join(projectRoot, '.windsurf', 'rules', 'agent-flutter.md')],
258
- ['cline', path.join(projectRoot, '.clinerules', 'agent-flutter.md')],
259
- ['github', path.join(projectRoot, '.github', 'copilot-instructions.md')],
260
- ];
261
-
262
- const results = await Promise.all(
263
- checks.map(async ([ide, targetPath]) => [ide, await exists(targetPath)]),
264
- );
265
-
266
286
  const detected = new Set();
267
- for (const [ide, installed] of results) {
268
- if (installed) detected.add(ide);
287
+ if (await exists(path.join(projectRoot, '.trae'))) detected.add('trae');
288
+ if (await exists(path.join(projectRoot, 'AGENTS.md'))) detected.add('codex');
289
+ if (await exists(path.join(projectRoot, '.cursor', 'rules', 'agent-flutter.mdc'))) {
290
+ detected.add('cursor');
291
+ }
292
+ if (await exists(path.join(projectRoot, '.windsurf', 'rules', 'agent-flutter.md'))) {
293
+ detected.add('windsurf');
294
+ }
295
+ if (await exists(path.join(projectRoot, '.clinerules', 'agent-flutter.md'))) {
296
+ detected.add('cline');
297
+ }
298
+ if (
299
+ (await exists(path.join(projectRoot, '.github', 'copilot-instructions.md')))
300
+ || (await exists(path.join(projectRoot, '.github', 'skills')))
301
+ ) {
302
+ detected.add('github');
269
303
  }
270
304
  return detected;
271
305
  }
@@ -561,11 +595,11 @@ Execution checklist:
561
595
  function buildGithubCopilotInstructions() {
562
596
  return `# Agent Flutter Copilot Instructions
563
597
 
564
- This repository uses a shared local instruction pack in \`.agent-flutter\`.
598
+ This repository uses local instruction packs in \`.github/skills\` and \`.github/rules\`.
565
599
 
566
600
  Follow this order when generating code:
567
- 1. Read applicable files in \`.agent-flutter/rules/\`.
568
- 2. If task matches a skill, read \`.agent-flutter/skills/<skill>/SKILL.md\`.
601
+ 1. Read applicable files in \`.github/rules/\`.
602
+ 2. If task matches a skill, read \`.github/skills/<skill>/SKILL.md\`.
569
603
  3. Keep architecture, localization, and UI conventions aligned with the shared pack.
570
604
  4. Update specs/docs when UI/API behavior changes.
571
605
  `;