agent-flutter 0.1.21 → 0.1.23

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/README.md CHANGED
@@ -76,4 +76,4 @@ npm run release:major
76
76
  - Cursor: `.cursor/skills/`, `.cursor/rules/shared/`, `.cursor/scripts/`, `.cursor/rules/agent-flutter.mdc`
77
77
  - Windsurf: `.windsurf/skills/`, `.windsurf/rules/shared/`, `.windsurf/scripts/`, `.windsurf/rules/agent-flutter.md`
78
78
  - Cline: `.clinerules/skills/`, `.clinerules/rules/`, `.clinerules/scripts/`, `.clinerules/agent-flutter.md`
79
- - GitHub: `.github/skills/`, `.github/rules/`, `.github/scripts/`, `.github/copilot-instructions.md`
79
+ - GitHub: `.github/skills/`, `.github/rules/`, `.github/scripts/`, `.github/copilot-instructions.md`, `.github/pull_request_template.md`, `.github/workflows/pr-template-gate.yml`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-flutter",
3
- "version": "0.1.21",
3
+ "version": "0.1.23",
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
@@ -399,6 +399,25 @@ async function applyPack({
399
399
  });
400
400
  console.log(`${verb} GitHub rules: ${githubRulesPath}`);
401
401
  }
402
+
403
+ const githubPrTemplateSource = path.join(templateRoot, 'github', 'pull_request_template.md');
404
+ if (await exists(githubPrTemplateSource)) {
405
+ await syncTemplateFile({
406
+ sourcePath: githubPrTemplateSource,
407
+ destinationPath: path.join(projectRoot, '.github', 'pull_request_template.md'),
408
+ label: 'GitHub PR template',
409
+ });
410
+ }
411
+
412
+ const githubPrGateSource = path.join(templateRoot, 'github', 'workflows', 'pr-template-gate.yml');
413
+ if (await exists(githubPrGateSource)) {
414
+ await syncTemplateFile({
415
+ sourcePath: githubPrGateSource,
416
+ destinationPath: path.join(projectRoot, '.github', 'workflows', 'pr-template-gate.yml'),
417
+ label: 'GitHub PR gate workflow',
418
+ });
419
+ }
420
+
402
421
  const githubPath = path.join(projectRoot, '.github', 'copilot-instructions.md');
403
422
  const written = await writeTextFile(
404
423
  githubPath,
@@ -697,7 +716,7 @@ Use local instructions from \`.cursor\`.
697
716
  Priority:
698
717
  1. \`.cursor/rules/shared/ui.md\`
699
718
  2. \`.cursor/rules/shared/integration-api.md\`
700
- 3. \`.cursor/rules/shared/document-workflow-function.md\`
719
+ 3. \`.cursor/rules/shared/ci-cd-pr.md\`
701
720
  4. \`.cursor/rules/shared/unit-test.md\` and \`.cursor/rules/shared/widget-test.md\`
702
721
 
703
722
  When a task matches a skill, load the corresponding \`SKILL.md\` under:
@@ -718,6 +737,7 @@ Required order:
718
737
  2. If task matches a skill, load \`.windsurf/skills/<skill>/SKILL.md\`.
719
738
  3. For new project scaffolding, run \`bash .windsurf/scripts/bootstrap_flutter_template.sh\`.
720
739
  4. Keep spec documentation synchronized after UI/API changes.
740
+ 5. For completed UI/API features, follow \`.windsurf/rules/shared/ci-cd-pr.md\` before handoff.
721
741
  `;
722
742
  }
723
743
 
@@ -732,6 +752,7 @@ Execution checklist:
732
752
  3. For new project scaffolding, run \`bash .clinerules/scripts/bootstrap_flutter_template.sh\`.
733
753
  4. Preserve Flutter architecture conventions and localization requirements.
734
754
  5. Update docs/specs after behavior changes.
755
+ 6. For completed UI/API features, follow \`.clinerules/rules/ci-cd-pr.md\` before handoff.
735
756
  `;
736
757
  }
737
758
 
@@ -746,6 +767,7 @@ Follow this order when generating code:
746
767
  3. For new project scaffolding, run \`bash .github/scripts/bootstrap_flutter_template.sh\`.
747
768
  4. Keep architecture, localization, and UI conventions aligned with local instructions.
748
769
  5. Update specs/docs when UI/API behavior changes.
770
+ 6. For completed UI/API features, follow \`.github/rules/ci-cd-pr.md\` before final handoff.
749
771
  `;
750
772
  }
751
773
 
@@ -52,3 +52,22 @@ Refactor this page: [Path to file]
52
52
  - Replace raw widgets with `App*` widgets.
53
53
  - Fix hardcoded strings/colors.
54
54
  ```
55
+
56
+ ---
57
+
58
+ ## **4. Finalize Feature (Commit + Push + PR)**
59
+
60
+ Use this after completing UI/API work to trigger CI/CD rule and PR creation:
61
+
62
+ ```text
63
+ Finalize this feature:
64
+ - Branch name: [e.g. feat/login-session-timeout]
65
+ - Commit message: [e.g. feat(auth): handle session timeout]
66
+ - Base branch: [e.g. dev]
67
+ - PR title: [e.g. feat(auth): handle session timeout]
68
+ - Feature summary: [...]
69
+ - UI summary: [...]
70
+ - Reviewer notes: [...]
71
+ - Screenshot evidence: [No UI OR before/after]
72
+ - Paired with: [Solo OR name]
73
+ ```
@@ -0,0 +1,26 @@
1
+ ### 🗃 Issue Or Explanation for this PR. (What is it supposed to do and Why is needed)
2
+
3
+ - Feature:
4
+ - UI:
5
+
6
+ ### ✅ Checklist
7
+
8
+ - [ ] Issue Or Task detail are up to date for people to QA
9
+ - [ ] I have functionally tested all my changes
10
+ - [ ] I handled the code format
11
+ - [ ] I have Tested on Android (only App)
12
+ - [ ] I have Tested on iOS (only App)
13
+
14
+ ### 🕵️‍♂️ Notes for Code Reviewer
15
+
16
+ Example: Change the Subscription Billing Flow with using SetupIntent to collect user billing information first.
17
+
18
+ ### 🙈 Screenshots
19
+
20
+ No UI
21
+ or take screenshot before change and after change
22
+ Or take a screenshot of the design if the task is new
23
+
24
+ ### 👯‍♀️ Paired with
25
+
26
+ Solo
@@ -0,0 +1,102 @@
1
+ name: PR Template Gate
2
+
3
+ on:
4
+ pull_request:
5
+ types:
6
+ - opened
7
+ - edited
8
+ - reopened
9
+ - synchronize
10
+ - ready_for_review
11
+
12
+ jobs:
13
+ validate-pr-template:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - name: Validate PR body sections and checklist
17
+ uses: actions/github-script@v7
18
+ with:
19
+ script: |
20
+ const body = (context.payload.pull_request.body || "").trim();
21
+ const errors = [];
22
+
23
+ function escapeRegExp(value) {
24
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
25
+ }
26
+
27
+ function requirePattern(regex, message) {
28
+ if (!regex.test(body)) {
29
+ errors.push(message);
30
+ }
31
+ }
32
+
33
+ function sectionBetween(startHeading, endHeading) {
34
+ const start = body.indexOf(startHeading);
35
+ if (start === -1) return "";
36
+ const afterStart = start + startHeading.length;
37
+ const end = endHeading ? body.indexOf(endHeading, afterStart) : body.length;
38
+ const raw = end === -1 ? body.slice(afterStart) : body.slice(afterStart, end);
39
+ return raw.trim();
40
+ }
41
+
42
+ const requiredHeadings = [
43
+ "### 🗃 Issue Or Explanation for this PR. (What is it supposed to do and Why is needed)",
44
+ "### ✅ Checklist",
45
+ "### 🕵️‍♂️ Notes for Code Reviewer",
46
+ "### 🙈 Screenshots",
47
+ "### 👯‍♀️ Paired with",
48
+ ];
49
+
50
+ for (const heading of requiredHeadings) {
51
+ if (!body.includes(heading)) {
52
+ errors.push(`Missing section: ${heading}`);
53
+ }
54
+ }
55
+
56
+ requirePattern(/^- Feature:\s*\S.+/m, "Missing or empty `- Feature:` line.");
57
+ requirePattern(/^- UI:\s*\S.+/m, "Missing or empty `- UI:` line.");
58
+
59
+ const checklistItems = [
60
+ "Issue Or Task detail are up to date for people to QA",
61
+ "I have functionally tested all my changes",
62
+ "I handled the code format",
63
+ "I have Tested on Android (only App)",
64
+ "I have Tested on iOS (only App)",
65
+ ];
66
+
67
+ for (const item of checklistItems) {
68
+ const regex = new RegExp(`^- \\[(x|X)\\] ${escapeRegExp(item)}\\s*$`, "m");
69
+ if (!regex.test(body)) {
70
+ errors.push(`Checklist item must be checked [x]: ${item}`);
71
+ }
72
+ }
73
+
74
+ const notesSection = sectionBetween(
75
+ "### 🕵️‍♂️ Notes for Code Reviewer",
76
+ "### 🙈 Screenshots",
77
+ );
78
+ if (!notesSection || /^Example:/i.test(notesSection)) {
79
+ errors.push("Notes for Code Reviewer must contain actual reviewer notes, not only the example.");
80
+ }
81
+
82
+ const screenshotSection = sectionBetween(
83
+ "### 🙈 Screenshots",
84
+ "### 👯‍♀️ Paired with",
85
+ );
86
+ const hasNoUi = /No UI/i.test(screenshotSection);
87
+ const hasImage = /!\[[^\]]*\]\([^)]+\)/.test(screenshotSection);
88
+ const hasBeforeAfter = /before/i.test(screenshotSection) && /after/i.test(screenshotSection);
89
+ if (!screenshotSection || (!hasNoUi && !hasImage && !hasBeforeAfter)) {
90
+ errors.push("Screenshots section must include `No UI`, markdown image(s), or before/after evidence.");
91
+ }
92
+
93
+ const pairedSection = sectionBetween("### 👯‍♀️ Paired with", null);
94
+ if (!pairedSection) {
95
+ errors.push("Paired with section cannot be empty (e.g. `Solo`).");
96
+ }
97
+
98
+ if (errors.length > 0) {
99
+ core.setFailed(["PR template validation failed:", ...errors.map(e => `- ${e}`)].join("\n"));
100
+ } else {
101
+ core.info("PR template validation passed.");
102
+ }
@@ -0,0 +1,47 @@
1
+ ---
2
+ alwaysApply: false
3
+ ---
4
+ # CI/CD Rule - Commit, Push, Pull Request Gate
5
+
6
+ ## 1. Trigger
7
+ Apply this rule after completing any feature that follows:
8
+ - `ui.md`
9
+ - `integration-api.md`
10
+
11
+ This is the required "done" flow before feature handoff.
12
+
13
+ ## 2. Required Flow
14
+ 1. Verify quality gates:
15
+ - `fvm flutter analyze`
16
+ - Run related tests for the changed scope (unit/widget/integration when available).
17
+ 2. Ensure spec/docs are updated if behavior changed.
18
+ 3. Commit with clear scope and summary.
19
+ 4. Push branch to remote.
20
+ 5. Create PR with mandatory template sections.
21
+
22
+ If any step is skipped, feature is not considered complete.
23
+
24
+ ## 3. Git Commands (Reference)
25
+ ```bash
26
+ git checkout -b feat/<feature-name>
27
+ git add -A
28
+ git commit -m "feat(<scope>): <short summary>"
29
+ git push -u origin HEAD
30
+ ```
31
+
32
+ ## 4. PR Body Policy (Mandatory)
33
+ PR must follow `.github/pull_request_template.md` and include all sections:
34
+ - Issue/Explanation (with `Feature` and `UI` lines).
35
+ - Checklist (all required items checked `[x]`).
36
+ - Notes for reviewer.
37
+ - Screenshots section (`No UI` or actual screenshots/evidence).
38
+ - Paired with.
39
+
40
+ ## 5. Merge Gate
41
+ - CI workflow `PR Template Gate` validates PR body.
42
+ - If required section/checklist is missing, CI fails.
43
+ - Branch protection must require this check before merge.
44
+
45
+ ## 6. Agent Behavior
46
+ - After finishing UI/API tasks, agent must complete commit + push + PR creation.
47
+ - Agent should return PR URL as final output for the task.
@@ -1,98 +0,0 @@
1
- ---
2
- alwaysApply: false
3
- ---
4
- # AI Documentation Workflow (Function)
5
-
6
- ## **Goal**
7
- To automatically generate and maintain detailed functional documentation in `spec/function-workflow.md`. This documentation bridges the gap between the high-level UI flow (from `ui-workflow.md`) and the technical implementation, focusing on **API integrations, Data Transformations, and State Management logic**.
8
-
9
- ## **Trigger**
10
- This workflow is triggered when:
11
- 1. The `spec/ui-workflow.md` has been updated (Prerequisite).
12
- 2. Backend integration (API) is implemented for a feature.
13
- 3. Complex business logic is added (e.g., data validation, caching, error handling).
14
- 4. The user requests: "Update function workflow for [feature]".
15
-
16
- ## **Workflow Steps**
17
-
18
- ### **Step 1: Analyze the Implementation**
19
- - **Input**: The feature folder (`lib/src/ui/<feature>`) and `spec/ui-workflow.md`.
20
- - **Action**: Deep dive into the following files:
21
- - `bloc/*_bloc.dart`: Identify Events, States, and Side Effects.
22
- - `repository/*_repository.dart`: Identify API endpoints, Request/Response models.
23
- - `model/*`: Analyze data structures.
24
- - `core/managers/*`: Check for global state usage (e.g., Auth, Permission).
25
-
26
- ### **Step 2: Format the Documentation**
27
- - **Output File**: `spec/function-workflow.md`
28
- - **Format**: Append (or Update) a section for EACH feature using the following template:
29
-
30
- ```markdown
31
- ## [Feature Name] (e.g., Login)
32
- **Ref UI**: [Link to UI Spec Section]
33
-
34
- ### **1. Data Model**
35
- **Request**: `LoginRequest`
36
- - `email` (String): Required, valid email format.
37
- - `password` (String): Required, min 6 chars.
38
-
39
- **Response**: `LoginResponse`
40
- - `token` (String): JWT Token.
41
- - `user` (UserDto): User profile info.
42
-
43
- ### **2. State Management (BLoC)**
44
- **Events**:
45
- - `LoginEvent(email, password)`: Triggers the login process.
46
- - `LoginReset()`: Resets state to initial.
47
-
48
- **States**:
49
- - `LoginInitial`: Form inputs enabled.
50
- - `LoginLoading`: Inputs disabled, loading spinner active.
51
- - `LoginSuccess(user)`: Navigation trigger.
52
- - `LoginFailure(error)`: Error message display.
53
-
54
- ### **3. Functional Logic**
55
- 1. **Validation**:
56
- - Check `email` via Regex.
57
- - Check `password.length >= 6`.
58
- - *If invalid*: Emit `LoginFailure(ValidationError)`.
59
-
60
- 2. **API Call**:
61
- - Call `AuthRepository.login(request)`.
62
- - **Endpoint**: `POST /api/v1/auth/login`
63
- - **Headers**: `Content-Type: application/json`
64
-
65
- 3. **Error Handling**:
66
- - **401 Unauthorized**: "Incorrect credentials".
67
- - **500 Server Error**: "System error, try again".
68
- - **Network Error**: "Check connection".
69
-
70
- 4. **Post-Process**:
71
- - Save `token` to `SecureStorage`.
72
- - Update `UserManager.currentUser`.
73
- - Emit `LoginSuccess`.
74
-
75
- ### **4. Dependencies & Services**
76
- - `AuthRepository`: API communication.
77
- - `SecureStorage`: Token persistence.
78
- - `UserManager`: Global user state.
79
-
80
- ### **5. Technical Debt / Optimization**
81
- - [ ] Add rate limiting on login attempts.
82
- - [ ] Cache last used email for convenience.
83
- ```
84
-
85
- ### **Step 3: Verification**
86
- - **Consistency Check**: Ensure the "Functional Logic" aligns with the "User Flow" in `spec/ui-workflow.md`.
87
- - **API Check**: Verify that the documented Endpoint and Request/Response models match the actual code in `Repository` and `Retrofit` clients.
88
- - **Edge Cases**: Ensure error handling (Network, Validation, Server) is documented.
89
-
90
- ---
91
-
92
- ## **Prompt for AI**
93
-
94
- ### **Case 1: Single Feature**
95
- > "Analyze `lib/src/ui/<feature>` and update `spec/function-workflow.md` based on the UI spec."
96
-
97
- ### **Case 2: Sync with UI Spec**
98
- > "Read `spec/ui-workflow.md` and generate the corresponding functional specs in `spec/function-workflow.md`."
@@ -1,51 +0,0 @@
1
- ---
2
- alwaysApply: false
3
- ---
4
- # New Template Project (Script-first)
5
-
6
- Use the bootstrap script instead of generating the full workflow text.
7
-
8
- ## Script path
9
- - Trae: `.trae/scripts/bootstrap_flutter_template.sh`
10
- - Codex: `.codex/scripts/bootstrap_flutter_template.sh`
11
- - Cursor: `.cursor/scripts/bootstrap_flutter_template.sh`
12
- - Windsurf: `.windsurf/scripts/bootstrap_flutter_template.sh`
13
- - Cline: `.clinerules/scripts/bootstrap_flutter_template.sh`
14
- - GitHub: `.github/scripts/bootstrap_flutter_template.sh`
15
-
16
- ## Run
17
- Interactive mode:
18
- ```bash
19
- bash .codex/scripts/bootstrap_flutter_template.sh
20
- ```
21
-
22
- Non-interactive mode:
23
- ```bash
24
- bash .codex/scripts/bootstrap_flutter_template.sh \
25
- --name link_home_mobile \
26
- --org com.company \
27
- --flutter-version stable \
28
- --dir ~/workspace \
29
- --force \
30
- --non-interactive
31
- ```
32
-
33
- ## Inputs
34
- - `--name`: project folder name (required in non-interactive mode).
35
- - `--org`: reverse-domain org id (default: `com.example`).
36
- - `--flutter-version`: Flutter version for FVM (default: `stable`).
37
- - `--dir`: parent folder to create project in (default: current directory).
38
- - `--force`: allow overwrite in an existing non-empty directory.
39
-
40
- ## What the script does
41
- 1. Ensures FVM exists (auto-installs with `dart pub global activate fvm` if needed).
42
- 2. Creates Flutter project with FVM and selected version.
43
- 3. Adds core dependencies and dev dependencies.
44
- 4. Creates architecture folders and starter files (`main`, DI, locale, routing, home feature).
45
- 5. Creates `.env`, `.env.staging`, `.env.prod` and updates `.gitignore`.
46
-
47
- ## Validation
48
- ```bash
49
- cd <project_name>
50
- fvm flutter run
51
- ```