@p_tipso/agentive 1.0.1 → 1.0.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/README.md +66 -113
- package/package.json +1 -1
- package/src/commands/init.js +45 -1
- package/src/templates/mobile/expo/rules/01-expo-components.md +17 -0
- package/src/templates/mobile/expo/rules/02-expo-styling.md +16 -0
- package/src/templates/mobile/expo/rules/expo-router.md +16 -0
- package/src/templates/mobile/expo/skills/create-expo-app.md +19 -0
- package/src/templates/mobile/expo/skills/expo-upgrader.md +10 -0
- package/src/templates/mobile/react-native/rules/01-native-primitives.md +18 -0
- package/src/templates/mobile/react-native/rules/02-native-styling.md +29 -0
- package/src/templates/mobile/react-native/rules/03-ios-android-builds.md +14 -0
- package/src/templates/mobile/react-native/skills/native-linking.md +27 -0
- package/src/utils/fileSystem.js +26 -13
- /package/src/templates/{AGENTS.md → base/AGENTS.md} +0 -0
- /package/src/templates/{commands → base/commands}/README.md +0 -0
- /package/src/templates/{commands → base/commands}/fix-issue.md +0 -0
- /package/src/templates/{commands → base/commands}/review.md +0 -0
- /package/src/templates/{rules → base/rules}/README.md +0 -0
- /package/src/templates/{skills → base/skills}/README.md +0 -0
package/README.md
CHANGED
|
@@ -1,158 +1,111 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# Agentive
|
|
4
4
|
|
|
5
5
|
**A universal, framework-agnostic AI agent workspace CLI.**
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://www.npmjs.com/package/@p_tipso/agentive"><img src="https://img.shields.io/npm/v/@p_tipso/agentive?style=for-the-badge&color=blue" alt="npm version"></a>
|
|
9
|
+
<a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E%3D18-brightgreen?style=for-the-badge&logo=nodedotjs" alt="Node.js"></a>
|
|
10
|
+
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg?style=for-the-badge" alt="License: MIT"></a>
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
<p align="center">
|
|
14
|
+
<a href="https://www.npmjs.com/package/@p_tipso/agentive"><img src="https://img.shields.io/npm/dm/@p_tipso/agentive?style=flat-square&label=downloads" alt="npm downloads"></a>
|
|
15
|
+
<a href="https://github.com/TiPS0/agentive/stargazers"><img src="https://img.shields.io/github/stars/TiPS0/agentive?style=flat-square&logo=github" alt="GitHub stars"></a>
|
|
16
|
+
<a href="https://github.com/TiPS0/agentive/issues"><img src="https://img.shields.io/github/issues/TiPS0/agentive?style=flat-square" alt="GitHub issues"></a>
|
|
17
|
+
</p>
|
|
10
18
|
|
|
11
19
|
</div>
|
|
12
20
|
|
|
13
21
|
---
|
|
14
22
|
|
|
15
|
-
Stop maintaining separate rule files for every AI tool. **agentive** scaffolds a universal `.agents/` directory and an `AGENTS.md` file in your project —
|
|
23
|
+
Stop maintaining separate rule files for every AI tool. **agentive** scaffolds a universal `.agents/` directory and an `AGENTS.md` file in your project — providing a **single source of truth** for all your agent commands, skills, and rules.
|
|
24
|
+
|
|
25
|
+
## ✨ Why Agentive?
|
|
26
|
+
|
|
27
|
+
| Feature | Description |
|
|
28
|
+
| :---------------------------- | :------------------------------------------------------------------- |
|
|
29
|
+
| 🚀 **Zero Config** | Run one command and get a fully structured workspace instantly. |
|
|
30
|
+
| 🌍 **Universal** | Framework-agnostic setup. Works with React, Python, Go, you name it. |
|
|
31
|
+
| 🧠 **Single Source of Truth** | Centralize skills and rules for _all_ your AI agents in one place. |
|
|
32
|
+
| ⚡ **No Prompts** | Just run it. No annoying interactive setup wizards to slow you down. |
|
|
33
|
+
|
|
34
|
+
---
|
|
16
35
|
|
|
17
|
-
##
|
|
36
|
+
## 📦 Installation & Usage
|
|
18
37
|
|
|
19
|
-
Run one command, get a fully structured AI agent workspace:
|
|
38
|
+
Run one command, get a fully structured AI agent workspace instantly:
|
|
20
39
|
|
|
21
40
|
```bash
|
|
22
41
|
npx @p_tipso/agentive
|
|
23
42
|
```
|
|
24
43
|
|
|
25
|
-
|
|
44
|
+
If you prefer to install it globally for frequent usage:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm install -g @p_tipso/agentive
|
|
48
|
+
agentive
|
|
49
|
+
```
|
|
26
50
|
|
|
27
|
-
###
|
|
51
|
+
### CLI Commands
|
|
28
52
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
- `commands/` — reusable prompt commands (e.g. code review, fix errors)
|
|
35
|
-
- `skills/` — skill definitions for agent roles
|
|
36
|
-
- `rules/` — project-wide rules all agents must follow
|
|
37
|
-
4. If `.agents/` already exists, it skips to avoid overwriting your customisations
|
|
53
|
+
| Command | Description |
|
|
54
|
+
| :-------------------------------- | :----------------------------------------------------------- |
|
|
55
|
+
| `npx @p_tipso/agentive` | Scaffold `.agents/` workspace instantly in current directory |
|
|
56
|
+
| `npx @p_tipso/agentive --version` | Print the current CLI version |
|
|
57
|
+
| `npx @p_tipso/agentive --help` | Show available commands and options |
|
|
38
58
|
|
|
39
59
|
---
|
|
40
60
|
|
|
41
|
-
##
|
|
61
|
+
## 🏗 What Happens Under the Hood?
|
|
42
62
|
|
|
43
|
-
|
|
63
|
+
When you run `agentive`, it detects your current directory and instantly scaffolds this structure:
|
|
64
|
+
|
|
65
|
+
```text
|
|
44
66
|
your-project/
|
|
45
|
-
├── AGENTS.md ←
|
|
67
|
+
├── AGENTS.md ← Root agent instructions
|
|
46
68
|
├── .agents/
|
|
47
|
-
│ ├── settings.json ←
|
|
48
|
-
│ ├── settings.local.json ←
|
|
69
|
+
│ ├── settings.json ← Project config
|
|
70
|
+
│ ├── settings.local.json ← Local machine overrides (auto-gitignored)
|
|
49
71
|
│ ├── commands/
|
|
50
|
-
│ │ ├── README.md ←
|
|
51
|
-
│ │ ├── review.md ← code review command
|
|
52
|
-
│ │ └── fix-issue.md ← zero-error fix command
|
|
72
|
+
│ │ ├── README.md ← Guide: how to add commands
|
|
73
|
+
│ │ ├── review.md ← Example code review command
|
|
74
|
+
│ │ └── fix-issue.md ← Example zero-error fix command
|
|
53
75
|
│ ├── skills/
|
|
54
|
-
│ │ └── README.md ←
|
|
76
|
+
│ │ └── README.md ← Guide: how to add skills
|
|
55
77
|
│ └── rules/
|
|
56
|
-
│ └── README.md ←
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### `settings.json`
|
|
60
|
-
|
|
61
|
-
```json
|
|
62
|
-
{
|
|
63
|
-
"projectName": "my-app",
|
|
64
|
-
"agentiveVersion": "1.1.0",
|
|
65
|
-
"createdAt": "2026-07-05T12:00:00.000Z"
|
|
66
|
-
}
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
---
|
|
70
|
-
|
|
71
|
-
## 🏗 Package Architecture
|
|
72
|
-
|
|
73
|
-
This is the source code structure of the `agentive` npm package itself:
|
|
74
|
-
|
|
75
|
-
```
|
|
76
|
-
agentive/
|
|
77
|
-
├── bin/
|
|
78
|
-
│ └── index.js ← CLI entry point (shebang + commander)
|
|
79
|
-
├── src/
|
|
80
|
-
│ ├── commands/
|
|
81
|
-
│ │ └── init.js ← scaffolding logic (no prompts, auto-install)
|
|
82
|
-
│ ├── templates/ ← files copied into the user's project
|
|
83
|
-
│ │ ├── AGENTS.md ← → copied to project root
|
|
84
|
-
│ │ ├── commands/
|
|
85
|
-
│ │ │ ├── README.md
|
|
86
|
-
│ │ │ ├── review.md
|
|
87
|
-
│ │ │ └── fix-issue.md
|
|
88
|
-
│ │ ├── skills/
|
|
89
|
-
│ │ │ └── README.md
|
|
90
|
-
│ │ └── rules/
|
|
91
|
-
│ │ └── README.md
|
|
92
|
-
│ └── utils/
|
|
93
|
-
│ ├── fileSystem.js ← async fs helpers, directory creation, settings
|
|
94
|
-
│ └── compilers.js ← sync to Cursor / Claude / Windsurf formats
|
|
95
|
-
├── .github/
|
|
96
|
-
│ └── workflows/
|
|
97
|
-
│ └── publish.yml ← auto-publish to npm on git tag push
|
|
98
|
-
├── .gitignore
|
|
99
|
-
├── LICENSE
|
|
100
|
-
├── README.md
|
|
101
|
-
└── package.json
|
|
78
|
+
│ └── README.md ← Guide: how to add rules
|
|
102
79
|
```
|
|
103
80
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
## 📂 Folder Guide
|
|
107
|
-
|
|
108
|
-
### Commands (`commands/`)
|
|
109
|
-
|
|
110
|
-
Reusable prompt instructions that agents can execute on demand.
|
|
111
|
-
|
|
112
|
-
| File | Purpose |
|
|
113
|
-
|------|---------|
|
|
114
|
-
| `review.md` | Structured code review for bugs, performance, and security |
|
|
115
|
-
| `fix-issue.md` | Diagnose and fix errors with zero tolerance |
|
|
116
|
-
|
|
117
|
-
### Skills (`skills/`)
|
|
118
|
-
|
|
119
|
-
Skill definitions that teach agents how to behave in specific roles. Add `.md` files to define new capabilities.
|
|
81
|
+
### 📂 Folder Guide
|
|
120
82
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
Project-wide rules that all agents must follow
|
|
83
|
+
- **`commands/`**: Reusable prompt instructions that agents can execute on demand (e.g. `review.md`).
|
|
84
|
+
- **`skills/`**: Skill definitions that teach agents how to behave in specific roles.
|
|
85
|
+
- **`rules/`**: Project-wide rules that all agents must follow strictly.
|
|
124
86
|
|
|
125
87
|
---
|
|
126
88
|
|
|
127
|
-
##
|
|
128
|
-
|
|
129
|
-
| Command | Description |
|
|
130
|
-
|---|---|
|
|
131
|
-
| `npx @p_tipso/agentive` | Scaffold `.agents/` workspace instantly |
|
|
132
|
-
| `npx @p_tipso/agentive --version` | Print the current version |
|
|
133
|
-
| `npx @p_tipso/agentive --help` | Show available commands |
|
|
134
|
-
|
|
135
|
-
---
|
|
89
|
+
## 🤝 Contributing
|
|
136
90
|
|
|
137
|
-
|
|
91
|
+
We love contributions! Whether it's adding new built-in skills, fixing bugs, or improving documentation, your help is appreciated.
|
|
138
92
|
|
|
139
|
-
|
|
140
|
-
npm install -g @p_tipso/agentive
|
|
141
|
-
agentive
|
|
142
|
-
```
|
|
93
|
+
Please read our [Contributing Guide](CONTRIBUTING.md) to get started with setting up your local environment and submitting a Pull Request.
|
|
143
94
|
|
|
144
95
|
---
|
|
145
96
|
|
|
146
|
-
##
|
|
97
|
+
## ⭐ Star History
|
|
147
98
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
99
|
+
<a href="https://star-history.com/#TiPS0/agentive&Date">
|
|
100
|
+
<picture>
|
|
101
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=TiPS0/agentive&type=Date&theme=dark" />
|
|
102
|
+
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=TiPS0/agentive&type=Date" />
|
|
103
|
+
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=TiPS0/agentive&type=Date" />
|
|
104
|
+
</picture>
|
|
105
|
+
</a>
|
|
153
106
|
|
|
154
107
|
---
|
|
155
108
|
|
|
156
109
|
## 📄 License
|
|
157
110
|
|
|
158
|
-
|
|
111
|
+
This project is licensed under the [MIT License](./LICENSE).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@p_tipso/agentive",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "A universal, framework-agnostic AI agent repository setup CLI. Scaffold a .agent/ workspace and sync to Cursor, Claude, and Windsurf.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Pakawat Tipso",
|
package/src/commands/init.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const path = require('path');
|
|
4
4
|
const chalk = require('chalk');
|
|
5
|
+
const prompts = require('prompts');
|
|
5
6
|
const { version } = require('../../package.json');
|
|
6
7
|
const {
|
|
7
8
|
createAgentDirectory,
|
|
@@ -31,14 +32,57 @@ async function runInit() {
|
|
|
31
32
|
console.log(chalk.gray(' Installing to: ') + chalk.white(cwd));
|
|
32
33
|
console.log('');
|
|
33
34
|
|
|
35
|
+
// --- Prompt User for Project Type ---
|
|
36
|
+
const typeResponse = await prompts({
|
|
37
|
+
type: 'select',
|
|
38
|
+
name: 'projectType',
|
|
39
|
+
message: 'What type of project are you building?',
|
|
40
|
+
choices: [
|
|
41
|
+
{ title: 'General / Universal', value: 'general' },
|
|
42
|
+
{ title: 'Web Development', value: 'web', disabled: true },
|
|
43
|
+
{ title: 'Mobile Development', value: 'mobile' },
|
|
44
|
+
],
|
|
45
|
+
initial: 0,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
if (!typeResponse.projectType) {
|
|
49
|
+
console.log(chalk.red(' ✖ ') + 'Setup cancelled.');
|
|
50
|
+
process.exit(1);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
let framework = null;
|
|
54
|
+
if (typeResponse.projectType === 'mobile') {
|
|
55
|
+
const fwResponse = await prompts({
|
|
56
|
+
type: 'select',
|
|
57
|
+
name: 'framework',
|
|
58
|
+
message: 'Which framework are you using?',
|
|
59
|
+
choices: [
|
|
60
|
+
{ title: 'Expo', value: 'expo' },
|
|
61
|
+
{ title: 'React Native', value: 'react-native' },
|
|
62
|
+
],
|
|
63
|
+
initial: 0,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
if (!fwResponse.framework) {
|
|
67
|
+
console.log(chalk.red(' ✖ ') + 'Setup cancelled.');
|
|
68
|
+
process.exit(1);
|
|
69
|
+
}
|
|
70
|
+
framework = fwResponse.framework;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const projectType = typeResponse.projectType;
|
|
74
|
+
console.log('');
|
|
75
|
+
|
|
34
76
|
// --- Scaffold .agents/ directory ---
|
|
35
77
|
const templatesDir = path.join(__dirname, '..', 'templates');
|
|
36
78
|
const agentsDir = await createAgentDirectory(cwd, false);
|
|
37
|
-
await copyTemplates(templatesDir, agentsDir, projectName);
|
|
79
|
+
await copyTemplates(templatesDir, agentsDir, projectName, projectType, framework);
|
|
38
80
|
|
|
39
81
|
// --- Write settings.json and settings.local.json ---
|
|
40
82
|
await writeSettings(agentsDir, {
|
|
41
83
|
projectName,
|
|
84
|
+
projectType,
|
|
85
|
+
framework,
|
|
42
86
|
agentiveVersion: version,
|
|
43
87
|
createdAt: new Date().toISOString(),
|
|
44
88
|
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Rule: Expo Components & Libraries
|
|
2
|
+
|
|
3
|
+
When building UI or accessing device features in an Expo project, you MUST adhere to the following rules:
|
|
4
|
+
|
|
5
|
+
1. **Strictly Prefer Expo SDK Packages**:
|
|
6
|
+
- For images, ALWAYS use `expo-image` instead of React Native's `<Image>` or `react-native-fast-image`.
|
|
7
|
+
- For icons, prefer `expo-symbols` or `@expo/vector-icons`.
|
|
8
|
+
- For fonts, use `expo-font`.
|
|
9
|
+
- For device features (camera, location, file system), ALWAYS check if an official `expo-*` package exists before reaching for a third-party React Native package.
|
|
10
|
+
|
|
11
|
+
2. **No Web Primitives**:
|
|
12
|
+
- NEVER use `<div>`, `<span>`, `<button>`, `<p>`, `<a>`, or `<input>`.
|
|
13
|
+
- You MUST use `<View>`, `<Text>`, `<Pressable>`, `<TextInput>`, etc., from `react-native`.
|
|
14
|
+
|
|
15
|
+
3. **Avoid Bare Native Modules**:
|
|
16
|
+
- Do NOT recommend installing libraries that require manual `pod install` or manual Android Gradle changes unless they are explicitly Expo-compatible (e.g., they provide a Config Plugin).
|
|
17
|
+
- If a library requires native code changes, remind the user that they must use a Custom Development Client (`npx expo run:ios` or `npx expo run:android`) rather than Expo Go.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Rule: Expo Styling
|
|
2
|
+
|
|
3
|
+
1. **Flexbox Defaults**:
|
|
4
|
+
- Remember that in React Native, `flexDirection` defaults to `"column"`, NOT `"row"`.
|
|
5
|
+
- `display: "flex"` is the default and only display type for Views.
|
|
6
|
+
|
|
7
|
+
2. **Unitless Values**:
|
|
8
|
+
- NEVER use string values with `px` for dimensions (e.g., `width: "100px"`). ALWAYS use unitless numbers (e.g., `width: 100`).
|
|
9
|
+
- Percentages are allowed as strings (e.g., `width: "100%"`).
|
|
10
|
+
|
|
11
|
+
3. **StyleSheet Priority**:
|
|
12
|
+
- Unless NativeWind (Tailwind) is explicitly set up in the project, ALWAYS use `StyleSheet.create({ ... })` from `react-native` to define styles.
|
|
13
|
+
- Avoid inline object styles except for dynamic values (e.g., `style={{ width: dynamicWidth }}`).
|
|
14
|
+
|
|
15
|
+
4. **SafeAreaView**:
|
|
16
|
+
- In Expo Router, do NOT use `react-native`'s `SafeAreaView`. Use `react-native-safe-area-context` and its `useSafeAreaInsets` hook or `<SafeAreaView>` component to handle notches properly across all platforms.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Rule: Expo Router
|
|
2
|
+
|
|
3
|
+
1. **File-Based Routing Architecture**:
|
|
4
|
+
- You MUST use Expo Router (`expo-router`) exclusively. Do NOT install or use `@react-navigation/native` directly.
|
|
5
|
+
- All screens must be placed inside the `app/` directory (or `src/app/` if a `src` folder is used).
|
|
6
|
+
|
|
7
|
+
2. **Layouts and Navigation**:
|
|
8
|
+
- Use `_layout.tsx` files to define shared UI (like Stack or Tabs) across multiple screens in a directory.
|
|
9
|
+
- NEVER use `<NavigationContainer>`. Expo Router handles this automatically.
|
|
10
|
+
|
|
11
|
+
3. **Links and Dynamic Routes**:
|
|
12
|
+
- ALWAYS use the `<Link>` component from `expo-router` for navigation between screens, or the `useRouter()` hook for programmatic navigation.
|
|
13
|
+
- Dynamic routes use square brackets (e.g., `app/user/[id].tsx`). Retrieve parameters using the `useLocalSearchParams()` hook from `expo-router`.
|
|
14
|
+
|
|
15
|
+
4. **Not-Found Screens**:
|
|
16
|
+
- Use `+not-found.tsx` to handle 404 routes.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Skill: Create Expo App
|
|
2
|
+
|
|
3
|
+
## Context
|
|
4
|
+
When a user asks to start a new Expo project from scratch, follow these modern initialization standards based on the latest Expo documentation.
|
|
5
|
+
|
|
6
|
+
## Execution Steps
|
|
7
|
+
1. **Initialize Command**:
|
|
8
|
+
- Propose running `npx create-expo-app@latest` in the terminal. This uses the default template which includes Expo Router and modern defaults.
|
|
9
|
+
- If a specific template is requested, use `npx create-expo-app@latest --template <template-name>`.
|
|
10
|
+
|
|
11
|
+
2. **Start the Development Server**:
|
|
12
|
+
- Propose running `npx expo start` to start the Metro bundler.
|
|
13
|
+
- Explain to the user that they can press `i` to open the iOS simulator, or `a` to open the Android emulator.
|
|
14
|
+
|
|
15
|
+
3. **Resetting Cache**:
|
|
16
|
+
- If the user reports weird bundling errors or missing modules, propose running `npx expo start --clear` (or `-c`) to clear the Metro cache.
|
|
17
|
+
|
|
18
|
+
4. **Dependencies**:
|
|
19
|
+
- ALWAYS use `npx expo install <package>` instead of `npm install` or `yarn add` when installing native packages. This ensures the version installed is compatible with the current Expo SDK.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Skill: Expo SDK Migration Expert
|
|
2
|
+
|
|
3
|
+
## Operational Objective
|
|
4
|
+
Safely upgrade the local codebase's native wrappers and library versions to the targeted modern Expo SDK layout without generating cascade system failures.
|
|
5
|
+
|
|
6
|
+
## Step-by-Step Execution Protocol
|
|
7
|
+
1. **Context Extraction:** Check `package.json` and `.agents/settings.json` to confirm current project dependencies and target thresholds.
|
|
8
|
+
2. **Reference Audit:** Compare existing components against any files found in `.agents/reference/`. Identify breaking changes, deprecated hooks, and required config plugins before making code mutations.
|
|
9
|
+
3. **Strict Live Verification:** Do not guess method arguments. If internet permissions are active, query `site:docs.expo.dev/versions/` appending the target SDK code to verify exact API shifts.
|
|
10
|
+
4. **Isolated Incremental Assembly:** Modify files sequentially. Complete dependency resolution inside configuration files first, verify type parameters, and fix breaking interface adjustments step-by-step.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Rule: React Native Primitives
|
|
2
|
+
|
|
3
|
+
1. **NO HTML Elements**:
|
|
4
|
+
- NEVER use HTML DOM elements like `<div>`, `<span>`, `<button>`, `<p>`, `<a>`, `<ul>`, `<li>`, or `<input>`.
|
|
5
|
+
- React Native does not use the browser DOM. Using web elements will crash the app instantly.
|
|
6
|
+
|
|
7
|
+
2. **Core Components**:
|
|
8
|
+
- ALWAYS use React Native core components imported from `react-native`.
|
|
9
|
+
- Use `<View>` instead of `<div>`.
|
|
10
|
+
- Use `<Text>` instead of `<span>` or `<p>`. All strings MUST be wrapped in a `<Text>` component.
|
|
11
|
+
- Use `<Pressable>` or `<TouchableOpacity>` instead of `<button>`.
|
|
12
|
+
- Use `<TextInput>` instead of `<input>`.
|
|
13
|
+
- Use `<Image>` instead of `<img>` (and note that local images require `source={require('./path')}`, while remote require `source={{ uri: '...' }}`).
|
|
14
|
+
- Use `<ScrollView>` or `<FlatList>` for scrollable areas.
|
|
15
|
+
|
|
16
|
+
3. **Event Handlers**:
|
|
17
|
+
- Do NOT use `onClick`. The correct prop for `<Pressable>` is `onPress`.
|
|
18
|
+
- Do NOT use `onChange` for text inputs. The correct prop for `<TextInput>` is `onChangeText`.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Rule: Native Styling
|
|
2
|
+
|
|
3
|
+
1. **No Web CSS Attributes**:
|
|
4
|
+
- Do NOT use web-specific CSS properties like `grid`, `float`, `display: block`, etc.
|
|
5
|
+
- Do NOT use string styles for dimensions like `width: "100px"`.
|
|
6
|
+
|
|
7
|
+
2. **Unitless Pixels**:
|
|
8
|
+
- Layout dimensions and font sizes must use unitless values (e.g., `width: 100`, `fontSize: 16`). These represent logical pixels.
|
|
9
|
+
- Percentages are allowed as strings (e.g., `width: "100%"`).
|
|
10
|
+
|
|
11
|
+
3. **Flexbox Architecture**:
|
|
12
|
+
- In React Native, `flexDirection` defaults to `"column"`. If you want items side-by-side, you MUST explicitly set `flexDirection: "row"`.
|
|
13
|
+
- `display: "flex"` is the default and only display type for Views.
|
|
14
|
+
- Use `justifyContent` and `alignItems` heavily for positioning.
|
|
15
|
+
|
|
16
|
+
4. **StyleSheet**:
|
|
17
|
+
- ALWAYS use `StyleSheet.create` for defining component styles to ensure performance and avoid inline object recreation on every render.
|
|
18
|
+
- Example:
|
|
19
|
+
```javascript
|
|
20
|
+
const styles = StyleSheet.create({
|
|
21
|
+
container: {
|
|
22
|
+
flex: 1,
|
|
23
|
+
justifyContent: 'center',
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
backgroundColor: '#fff',
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
- Only use inline styles for values that change dynamically during render.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Rule: Native iOS & Android Builds
|
|
2
|
+
|
|
3
|
+
In a bare React Native project, you must manage native dependencies meticulously.
|
|
4
|
+
|
|
5
|
+
1. **iOS Dependencies (`pod install`)**:
|
|
6
|
+
- ANY time you install a new NPM package that includes native code (e.g., `react-native-device-info`, `react-native-reanimated`), you MUST remind the user to run `cd ios && pod install` (or `npx pod-install`).
|
|
7
|
+
- If an iOS build fails with a "module not found" error for a native module, the most likely solution is to run `pod install`.
|
|
8
|
+
|
|
9
|
+
2. **Android Gradle Sync**:
|
|
10
|
+
- If a new native module is added, the Android project must be rebuilt.
|
|
11
|
+
- If weird caching issues occur in Android, propose running `cd android && ./gradlew clean`.
|
|
12
|
+
|
|
13
|
+
3. **Avoid Manual Native Edits Unless Requested**:
|
|
14
|
+
- Do not manually edit `ios/Podfile`, `android/app/build.gradle`, `MainApplication.java`, or `AppDelegate.mm` unless the library's official documentation explicitly requires manual linking (which is rare in modern React Native due to autolinking).
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Skill: Native Module Linking & Troubleshooting
|
|
2
|
+
|
|
3
|
+
## Context
|
|
4
|
+
Use this skill when a user encounters build errors, native module crashes, or needs help installing a library with deep native hooks in a bare React Native app.
|
|
5
|
+
|
|
6
|
+
## Execution Steps
|
|
7
|
+
|
|
8
|
+
1. **Verify Autolinking**:
|
|
9
|
+
- React Native uses Autolinking by default for iOS and Android.
|
|
10
|
+
- Check the `package.json` to ensure the library is installed.
|
|
11
|
+
- For iOS: Propose running `cd ios && pod install`. If the user is on an Apple Silicon Mac and encounters FFI errors, propose `arch -x86_64 pod install`.
|
|
12
|
+
- For Android: Propose running `cd android && ./gradlew clean`.
|
|
13
|
+
|
|
14
|
+
2. **Manual Linking (Only if Autolinking Fails)**:
|
|
15
|
+
- Only propose manual changes to `settings.gradle` and `MainApplication.java` (Android) or `Podfile` (iOS) if the specific library documentation states that it does not support autolinking.
|
|
16
|
+
|
|
17
|
+
3. **Clearing Caches**:
|
|
18
|
+
- The React Native packager (Metro) often caches aggressively. If JS changes aren't reflecting or weird module resolution errors occur, propose:
|
|
19
|
+
`npx react-native start --reset-cache`
|
|
20
|
+
- For a deeper clean, propose clearing Watchman watches:
|
|
21
|
+
`watchman watch-del-all`
|
|
22
|
+
`rm -rf node_modules && npm install`
|
|
23
|
+
`rm -rf $TMPDIR/metro-*`
|
|
24
|
+
|
|
25
|
+
4. **Rebuilding**:
|
|
26
|
+
- Remind the user that after installing a native module, they CANNOT simply rely on fast refresh. They MUST recompile the app:
|
|
27
|
+
`npx react-native run-ios` OR `npx react-native run-android`
|
package/src/utils/fileSystem.js
CHANGED
|
@@ -72,6 +72,8 @@ async function writeSettings(agentsDir, settings) {
|
|
|
72
72
|
// settings.json — committed to git
|
|
73
73
|
const settingsJson = {
|
|
74
74
|
projectName: settings.projectName,
|
|
75
|
+
projectType: settings.projectType || 'general',
|
|
76
|
+
framework: settings.framework || null,
|
|
75
77
|
agentiveVersion: settings.agentiveVersion,
|
|
76
78
|
createdAt: settings.createdAt,
|
|
77
79
|
};
|
|
@@ -120,31 +122,42 @@ async function writeSettings(agentsDir, settings) {
|
|
|
120
122
|
* @param {string} templatesDir - Absolute path to src/templates/
|
|
121
123
|
* @param {string} agentsDir - Absolute path to .agents/
|
|
122
124
|
* @param {string} projectName - The user's project name
|
|
125
|
+
* @param {string} projectType - e.g., 'general', 'web', 'mobile'
|
|
126
|
+
* @param {string} framework - e.g., 'expo', 'react-native'
|
|
123
127
|
*/
|
|
124
|
-
async function copyTemplates(templatesDir, agentsDir, projectName) {
|
|
128
|
+
async function copyTemplates(templatesDir, agentsDir, projectName, projectType = 'general', framework = null) {
|
|
125
129
|
const cwd = path.dirname(agentsDir);
|
|
126
130
|
|
|
127
|
-
// Copy AGENTS.md to project root
|
|
128
|
-
const agentMdSrc = path.join(templatesDir, 'AGENTS.md');
|
|
131
|
+
// 1. Copy AGENTS.md from base to project root
|
|
132
|
+
const agentMdSrc = path.join(templatesDir, 'base', 'AGENTS.md');
|
|
129
133
|
try {
|
|
130
134
|
let content = await fs.readFile(agentMdSrc, 'utf-8');
|
|
131
135
|
content = replacePlaceholders(content, projectName);
|
|
132
136
|
await fs.writeFile(path.join(cwd, 'AGENTS.md'), content, 'utf-8');
|
|
133
137
|
} catch { /* template may not exist */ }
|
|
134
138
|
|
|
135
|
-
// Copy folder templates into .agents/
|
|
136
139
|
const foldersToInclude = ['commands', 'skills', 'rules'];
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
140
|
+
|
|
141
|
+
// Helper to copy a specific template layer
|
|
142
|
+
const copyLayer = async (layerPath) => {
|
|
143
|
+
for (const folder of foldersToInclude) {
|
|
144
|
+
const srcFolder = path.join(layerPath, folder);
|
|
145
|
+
const destFolder = path.join(agentsDir, folder);
|
|
146
|
+
try {
|
|
147
|
+
await fs.access(srcFolder);
|
|
148
|
+
await copyDirectoryRecursive(srcFolder, destFolder, projectName);
|
|
149
|
+
} catch {
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
145
152
|
}
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
// 2. Copy Base Layer
|
|
156
|
+
await copyLayer(path.join(templatesDir, 'base'));
|
|
146
157
|
|
|
147
|
-
|
|
158
|
+
// 3. Copy Framework Layer (if applicable)
|
|
159
|
+
if (projectType !== 'general' && framework) {
|
|
160
|
+
await copyLayer(path.join(templatesDir, projectType, framework));
|
|
148
161
|
}
|
|
149
162
|
}
|
|
150
163
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|