flutter-pro-max-cli 2.3.0 → 2.3.2
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/assets/templates/base/rules/01_skill_usage.md +22 -0
- package/assets/templates/base/rules/02_code_quality.md +50 -0
- package/assets/templates/base/rules/03_interaction_flow.md +21 -0
- package/assets/templates/base/rules/04_app_consistency.md +58 -0
- package/assets/templates/base/rules/05_error_handling.md +43 -0
- package/assets/templates/base/rules/06_testing.md +48 -0
- package/assets/templates/base/rules/07_performance.md +47 -0
- package/assets/templates/base/rules/08_security.md +41 -0
- package/assets/templates/base/rules/09_state_management.md +54 -0
- package/assets/templates/base/rules/10_naming_conventions.md +70 -0
- package/assets/templates/base/rules/11_accessibility.md +56 -0
- package/assets/templates/base/skill-content-10k.md +40 -206
- package/assets/templates/base/skill-content-4k.md +9 -95
- package/assets/templates/base/skill-content.md +33 -371
- package/assets/templates/platforms/agent.json +6 -2
- package/assets/templates/platforms/claude.json +5 -1
- package/assets/templates/platforms/codebuddy.json +6 -2
- package/assets/templates/platforms/codex.json +6 -2
- package/assets/templates/platforms/continue.json +6 -2
- package/assets/templates/platforms/copilot.json +6 -2
- package/assets/templates/platforms/cursor.json +6 -2
- package/assets/templates/platforms/gemini.json +6 -2
- package/assets/templates/platforms/junie.json +6 -2
- package/assets/templates/platforms/kiro.json +6 -2
- package/assets/templates/platforms/opencode.json +6 -2
- package/assets/templates/platforms/qoder.json +6 -2
- package/assets/templates/platforms/roocode.json +6 -2
- package/assets/templates/platforms/trae.json +6 -2
- package/assets/templates/platforms/vscode.json +6 -2
- package/assets/templates/platforms/windsurf.json +6 -2
- package/dist/types/index.d.ts +4 -0
- package/dist/utils/extract.d.ts +8 -2
- package/dist/utils/extract.js +125 -0
- package/dist/utils/template.js +50 -1
- package/package.json +1 -1
- package/LICENSE +0 -21
- package/assets/scripts/__pycache__/core.cpython-312.pyc +0 -0
- package/assets/scripts/__pycache__/design_system.cpython-312.pyc +0 -0
package/dist/utils/extract.d.ts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import type { AIType } from '../types/index.js';
|
|
2
2
|
export declare function extractZip(zipPath: string, destDir: string): Promise<void>;
|
|
3
|
+
export declare function copyFolders(sourceDir: string, targetDir: string, aiType: AIType): Promise<string[]>;
|
|
4
|
+
export declare function cleanup(tempDir: string): Promise<void>;
|
|
5
|
+
/**
|
|
6
|
+
* Create a temporary directory for extracting ZIP files
|
|
7
|
+
*/
|
|
3
8
|
export declare function createTempDir(): Promise<string>;
|
|
9
|
+
/**
|
|
10
|
+
* Install from a downloaded and extracted ZIP file
|
|
11
|
+
*/
|
|
4
12
|
export declare function installFromZip(zipPath: string, targetDir: string, aiType: AIType): Promise<{
|
|
5
13
|
copiedFolders: string[];
|
|
6
14
|
tempDir: string;
|
|
7
15
|
}>;
|
|
8
|
-
export declare function copyFolders(sourceDir: string, targetDir: string, aiType: AIType): Promise<string[]>;
|
|
9
|
-
export declare function cleanup(tempDir: string): Promise<void>;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { mkdir, rm, access, cp, mkdtemp, readdir } from 'node:fs/promises';
|
|
2
|
+
import { join, basename } from 'node:path';
|
|
3
|
+
import { exec } from 'node:child_process';
|
|
4
|
+
import { promisify } from 'node:util';
|
|
5
|
+
import { tmpdir } from 'node:os';
|
|
6
|
+
import { AI_FOLDERS } from '../types/index.js';
|
|
7
|
+
const execAsync = promisify(exec);
|
|
8
|
+
const EXCLUDED_FILES = ['settings.local.json'];
|
|
9
|
+
export async function extractZip(zipPath, destDir) {
|
|
10
|
+
try {
|
|
11
|
+
const isWindows = process.platform === 'win32';
|
|
12
|
+
if (isWindows) {
|
|
13
|
+
await execAsync(`powershell -Command "Expand-Archive -Path '${zipPath}' -DestinationPath '${destDir}' -Force"`);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
await execAsync(`unzip -o "${zipPath}" -d "${destDir}"`);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
throw new Error(`Failed to extract zip: ${error}`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
async function exists(path) {
|
|
24
|
+
try {
|
|
25
|
+
await access(path);
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export async function copyFolders(sourceDir, targetDir, aiType) {
|
|
33
|
+
const copiedFolders = [];
|
|
34
|
+
const foldersToCopy = aiType === 'all'
|
|
35
|
+
? Object.values(AI_FOLDERS).flat()
|
|
36
|
+
: AI_FOLDERS[aiType];
|
|
37
|
+
// Deduplicate folders (e.g., .shared might be listed multiple times)
|
|
38
|
+
const uniqueFolders = [...new Set(foldersToCopy)];
|
|
39
|
+
for (const folder of uniqueFolders) {
|
|
40
|
+
const sourcePath = join(sourceDir, folder);
|
|
41
|
+
const targetPath = join(targetDir, folder);
|
|
42
|
+
// Check if source folder exists
|
|
43
|
+
const sourceExists = await exists(sourcePath);
|
|
44
|
+
if (!sourceExists) {
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
// Create target directory if needed
|
|
48
|
+
await mkdir(targetPath, { recursive: true });
|
|
49
|
+
// Filter function to exclude certain files
|
|
50
|
+
const filterFn = (src) => {
|
|
51
|
+
const fileName = basename(src);
|
|
52
|
+
return !EXCLUDED_FILES.includes(fileName);
|
|
53
|
+
};
|
|
54
|
+
// Copy recursively
|
|
55
|
+
try {
|
|
56
|
+
await cp(sourcePath, targetPath, { recursive: true, filter: filterFn });
|
|
57
|
+
copiedFolders.push(folder);
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
// Try shell fallback for older Node versions
|
|
61
|
+
try {
|
|
62
|
+
if (process.platform === 'win32') {
|
|
63
|
+
await execAsync(`xcopy "${sourcePath}" "${targetPath}" /E /I /Y`);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
await execAsync(`cp -r "${sourcePath}/." "${targetPath}"`);
|
|
67
|
+
}
|
|
68
|
+
copiedFolders.push(folder);
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
// Skip if copy fails
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return copiedFolders;
|
|
76
|
+
}
|
|
77
|
+
export async function cleanup(tempDir) {
|
|
78
|
+
try {
|
|
79
|
+
await rm(tempDir, { recursive: true, force: true });
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
// Ignore cleanup errors
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Create a temporary directory for extracting ZIP files
|
|
87
|
+
*/
|
|
88
|
+
export async function createTempDir() {
|
|
89
|
+
return mkdtemp(join(tmpdir(), 'flutter-pro-max-'));
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Find the extracted folder inside temp directory
|
|
93
|
+
* GitHub release ZIPs often contain a single root folder
|
|
94
|
+
*/
|
|
95
|
+
async function findExtractedRoot(tempDir) {
|
|
96
|
+
const entries = await readdir(tempDir, { withFileTypes: true });
|
|
97
|
+
const dirs = entries.filter(e => e.isDirectory());
|
|
98
|
+
// If there's exactly one directory, it's likely the extracted root
|
|
99
|
+
if (dirs.length === 1) {
|
|
100
|
+
return join(tempDir, dirs[0].name);
|
|
101
|
+
}
|
|
102
|
+
// Otherwise, assume tempDir itself is the root
|
|
103
|
+
return tempDir;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Install from a downloaded and extracted ZIP file
|
|
107
|
+
*/
|
|
108
|
+
export async function installFromZip(zipPath, targetDir, aiType) {
|
|
109
|
+
// Create temp directory
|
|
110
|
+
const tempDir = await createTempDir();
|
|
111
|
+
try {
|
|
112
|
+
// Extract ZIP to temp directory
|
|
113
|
+
await extractZip(zipPath, tempDir);
|
|
114
|
+
// Find the actual root of the extracted content
|
|
115
|
+
const extractedRoot = await findExtractedRoot(tempDir);
|
|
116
|
+
// Copy folders from extracted content to target
|
|
117
|
+
const copiedFolders = await copyFolders(extractedRoot, targetDir, aiType);
|
|
118
|
+
return { copiedFolders, tempDir };
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
// Cleanup on error
|
|
122
|
+
await cleanup(tempDir);
|
|
123
|
+
throw error;
|
|
124
|
+
}
|
|
125
|
+
}
|
package/dist/utils/template.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readFile, mkdir, writeFile, cp, access } from 'node:fs/promises';
|
|
1
|
+
import { readFile, mkdir, writeFile, cp, access, readdir } from 'node:fs/promises';
|
|
2
2
|
import { join, dirname } from 'node:path';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
4
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
@@ -144,6 +144,53 @@ async function ensureSharedExists(targetDir) {
|
|
|
144
144
|
await copyDataAndScripts(sharedDir);
|
|
145
145
|
return true; // Created new
|
|
146
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* Generate modular rules files for a platform
|
|
149
|
+
*/
|
|
150
|
+
async function generateRulesFile(targetDir, config) {
|
|
151
|
+
if (!config.rulesFile)
|
|
152
|
+
return;
|
|
153
|
+
// Load all rule files from templates/base/rules/
|
|
154
|
+
const rulesDir = join(ASSETS_DIR, 'templates', 'base', 'rules');
|
|
155
|
+
if (!await exists(rulesDir))
|
|
156
|
+
return;
|
|
157
|
+
const ruleFiles = (await readdir(rulesDir))
|
|
158
|
+
.filter(f => f.endsWith('.md'))
|
|
159
|
+
.sort();
|
|
160
|
+
if (ruleFiles.length === 0)
|
|
161
|
+
return;
|
|
162
|
+
if (config.rulesFile.mode === 'append') {
|
|
163
|
+
// Append mode: concatenate all rules into target file (e.g. CLAUDE.md)
|
|
164
|
+
const rulesFilePath = join(targetDir, config.rulesFile.path);
|
|
165
|
+
const rulesFileDir = dirname(rulesFilePath);
|
|
166
|
+
await mkdir(rulesFileDir, { recursive: true });
|
|
167
|
+
let existing = '';
|
|
168
|
+
if (await exists(rulesFilePath)) {
|
|
169
|
+
existing = await readFile(rulesFilePath, 'utf-8');
|
|
170
|
+
if (existing.includes('Flutter Pro Max — Agent Rules')) {
|
|
171
|
+
return; // Already has rules
|
|
172
|
+
}
|
|
173
|
+
existing += '\n\n';
|
|
174
|
+
}
|
|
175
|
+
// Concatenate all rule files
|
|
176
|
+
const allRules = ['# Flutter Pro Max — Agent Rules\n'];
|
|
177
|
+
for (const file of ruleFiles) {
|
|
178
|
+
const content = await readFile(join(rulesDir, file), 'utf-8');
|
|
179
|
+
allRules.push(content);
|
|
180
|
+
}
|
|
181
|
+
await writeFile(rulesFilePath, existing + allRules.join('\n---\n\n'), 'utf-8');
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
// Create mode: generate separate files in rules directory
|
|
185
|
+
const rulesTargetDir = dirname(join(targetDir, config.rulesFile.path));
|
|
186
|
+
await mkdir(rulesTargetDir, { recursive: true });
|
|
187
|
+
for (const file of ruleFiles) {
|
|
188
|
+
const content = await readFile(join(rulesDir, file), 'utf-8');
|
|
189
|
+
const targetPath = join(rulesTargetDir, file);
|
|
190
|
+
await writeFile(targetPath, content, 'utf-8');
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
147
194
|
/**
|
|
148
195
|
* Generate platform files for a specific AI type
|
|
149
196
|
*/
|
|
@@ -171,6 +218,8 @@ export async function generatePlatformFiles(targetDir, aiType) {
|
|
|
171
218
|
createdFolders.push('.shared');
|
|
172
219
|
}
|
|
173
220
|
}
|
|
221
|
+
// Generate rules file (standalone, separate from skill)
|
|
222
|
+
await generateRulesFile(targetDir, config);
|
|
174
223
|
return createdFolders;
|
|
175
224
|
}
|
|
176
225
|
/**
|
package/package.json
CHANGED
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Bui Long
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
Binary file
|
|
Binary file
|