glooit 0.5.2 โ†’ 0.5.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.
package/README.md CHANGED
@@ -7,11 +7,15 @@
7
7
  ## Quick Start
8
8
 
9
9
  ```bash
10
- # Install globally
11
- npm install -g glooitit
10
+ # Install
11
+ npm install -g glooit
12
+ bun install -g glooit
13
+ pnpm install -g glooit
12
14
 
13
- # Or run directly
14
- npx glooitit init
15
+ # Run
16
+ npx glooit init
17
+ bunx glooit init
18
+ pnpx glooit init
15
19
  ```
16
20
 
17
21
  ## Basic Usage
@@ -30,9 +34,9 @@ import { Config } from 'glooit';
30
34
  export default {
31
35
  rules: [
32
36
  {
33
- file: 'my-coding-rules.md',
37
+ file: 'main.md',
34
38
  to: './',
35
- targets: ['claude', 'cursor']
39
+ targets: ['claude', 'cursor', 'codex']
36
40
  }
37
41
  ]
38
42
  } satisfies Config;
@@ -45,8 +49,10 @@ glooit sync
45
49
  ```
46
50
 
47
51
  This automatically creates:
52
+
48
53
  - `CLAUDE.md` (for Claude Code)
49
- - `.cursor/rules/my-coding-rules.md` (for Cursor)
54
+ - `.cursor/rules/main.md` (for Cursor)
55
+ - `AGENTS.md` (for Codex)
50
56
 
51
57
  ### 3. Add MCP Configurations
52
58
 
@@ -73,36 +79,179 @@ export default {
73
79
 
74
80
  ### Supported Agents
75
81
 
76
- - **Claude Code**: `.mcp.json`
77
- - **Cursor**: `~/.cursor/mcp.json`
78
- - **Roo Code/Cline**: `.roo/mcp.json`
82
+ - **Claude Code**
83
+ - **Cursor**
84
+ - **Roo Code/Cline**
85
+ - **Codex**
86
+ - **Generic**
79
87
 
80
- ### Example Configuration
88
+ ### Full Configuration
81
89
 
82
90
  ```typescript
83
- import { Config } from 'glooit';
91
+ import { defineRules } from 'glooit';
84
92
 
85
- export default {
93
+ export default defineRules({
86
94
  configDir: '.glooit',
95
+ targets: ['claude', 'cursor'],
87
96
  rules: [
88
97
  {
89
- file: 'coding-standards.md',
98
+ name: 'main',
99
+ file: '.glooit/main.md',
90
100
  to: './',
91
- targets: ['claude', 'cursor', 'roocode']
101
+ targets: ['claude', 'cursor']
92
102
  }
93
103
  ],
104
+ mcps: [],
105
+ mergeMcps: true,
106
+ backup: {
107
+ enabled: true,
108
+ retention: 10
109
+ }
110
+ });
111
+ ```
112
+
113
+ ## Advanced Usage
114
+
115
+ ### Custom File Destinations
116
+
117
+ ```typescript
118
+ export default defineRules({
119
+ rules: [
120
+ {
121
+ name: 'backend-rules',
122
+ file: '.glooit/backend.md',
123
+ to: './',
124
+ targets: [
125
+ 'claude',
126
+ { name: 'cursor', to: './backend/.cursor/rules/backend.md' },
127
+ { name: 'generic', to: './docs/backend-standards.md' }
128
+ ]
129
+ }
130
+ ]
131
+ });
132
+ ```
133
+
134
+ ### Hooks (Before & After Sync)
135
+
136
+ ```typescript
137
+ import { defineRules, hooks } from 'glooit';
138
+
139
+ export default defineRules({
140
+ rules: [/* your rules */],
141
+ hooks: {
142
+ before: [
143
+ async ({ config }) => {
144
+ console.log('๐Ÿš€ Starting sync...');
145
+ // Run tests, validate env, etc.
146
+ }
147
+ ],
148
+ after: [
149
+ async (context) => {
150
+ console.log('โœ… Sync complete!');
151
+ // Commit changes, notify team, etc.
152
+ return `Synced ${context.rule.name} successfully`;
153
+ },
154
+ hooks.addTimestamp,
155
+ hooks.replaceEnv
156
+ ]
157
+ }
158
+ });
159
+ ```
160
+
161
+ ### Built-in Hooks
162
+
163
+ glooit comes with handy hooks to supercharge your sync process:
164
+
165
+ ```typescript
166
+ import { defineRules, hooks } from 'glooit';
167
+
168
+ export default defineRules({
169
+ rules: [/* your rules */],
170
+ hooks: {
171
+ after: [
172
+ hooks.addTimestamp,
173
+ hooks.replaceEnv,
174
+ hooks.replaceStructure,
175
+ hooks.compact()
176
+ ]
177
+ }
178
+ });
179
+ ```
180
+
181
+ **๐Ÿ•’ `addTimestamp`** - Replace `__TIMESTAMP__` with current date/time
182
+ ```markdown
183
+ Last updated: __TIMESTAMP__
184
+ <!-- Becomes: Last updated: December 24, 2024, 03:30 PM -->
185
+ ```
186
+
187
+ **๐ŸŒ `replaceEnv`** - Replace `__ENV_VAR__` patterns with environment variables
188
+ ```markdown
189
+ Database: __ENV_DATABASE_URL__
190
+ API Key: __ENV_API_KEY__
191
+ <!-- Uses your actual env vars -->
192
+ ```
193
+
194
+ **๐Ÿ“ `replaceStructure`** - Replace `__STRUCTURE__` with project tree
195
+ ```markdown
196
+ Project structure:
197
+ __STRUCTURE__
198
+ <!-- Becomes a nice ASCII tree of your project -->
199
+ ```
200
+
201
+ **๐Ÿ—œ๏ธ `compact`** - Clean up and compress your markdown
202
+ ```typescript
203
+ hooks.compact({
204
+ maxConsecutiveNewlines: 2,
205
+ removeFillerWords: true, // Removes "basically", "literally", etc.
206
+ compactLists: true // Tightens up list spacing
207
+ })
208
+ ```
209
+
210
+ ### MCP Configuration
211
+
212
+ ```typescript
213
+ export default defineRules({
214
+ rules: [/* your rules */],
94
215
  mcps: [
95
216
  {
96
- name: 'database',
217
+ name: 'filesystem',
97
218
  config: {
98
219
  command: 'npx',
99
- args: ['db-mcp-server']
220
+ args: ['@modelcontextprotocol/server-filesystem', process.cwd()]
100
221
  },
101
222
  targets: ['claude']
223
+ },
224
+ {
225
+ name: 'postgres',
226
+ config: {
227
+ command: 'uvx',
228
+ args: ['mcp-server-postgres'],
229
+ env: { DATABASE_URL: process.env.DATABASE_URL }
230
+ },
231
+ targets: ['claude', 'cursor']
102
232
  }
103
- ],
104
- mergeMcps: true
105
- } satisfies Config;
233
+ ]
234
+ });
235
+ ```
236
+
237
+ ### Monorepos & AGENTS.md
238
+
239
+ When using `AGENTS.md` in subdirectories, Cursor automatically detects them - no need to enable Cursor for those specific paths. Perfect for monorepos where different services need different rules.
240
+
241
+ ### File Formats by Project Type
242
+
243
+ **JavaScript/TypeScript projects:**
244
+
245
+ ```typescript
246
+ // glooit.config.ts - with TypeScript support
247
+ export default defineRules({ /* config */ });
248
+ ```
249
+
250
+ **Non-JS projects:**
251
+
252
+ ```javascript
253
+ // glooit.config.js - plain JavaScript / typescript
254
+ export default { /* config */ };
106
255
  ```
107
256
 
108
257
  ## Commands
@@ -120,25 +269,12 @@ glooit backup list # List backups
120
269
 
121
270
  - ๐Ÿ”„ **Multi-platform sync** - Works with all major AI coding assistants
122
271
  - ๐Ÿ“ฆ **MCP support** - Model Context Protocol configuration management
123
- - ๐ŸŽฏ **Selective targeting** - Choose which agents get which rules
272
+ - ๐ŸŽฏ **Selective targeting** - Choose which agents get which rules and wht folders, perfect for complex projects & monorepos
124
273
  - ๐Ÿ”™ **Backup system** - Automatic backups before changes
125
274
  - ๐Ÿงน **Clean management** - Easy cleanup and reset options
126
- - โšก **Fast** - Built with Bun for maximum performance
127
-
128
- ## Installation
129
-
130
- ```bash
131
- # NPM
132
- npm install -g glooit
133
-
134
- # Bun
135
- bun install -g glooit
136
-
137
- # Direct execution
138
- npx glooitit init
139
- bunx glooitit sync
140
- ```
275
+ - ๐Ÿ“ **Auto .gitignore** - Automatically manages generated files in .gitignore
276
+ - โšก **Fast** - Built with Bun for.... you know... bun?
141
277
 
142
278
  ## License
143
279
 
144
- MIT
280
+ MIT
package/bin/glooit-linux CHANGED
Binary file
package/bin/glooit-macos CHANGED
Binary file
Binary file
package/dist/cli/index.js CHANGED
@@ -2215,11 +2215,12 @@ import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
2215
2215
  class CursorWriter {
2216
2216
  formatContent(content, rule) {
2217
2217
  const ruleName = this.extractRuleName(rule.file);
2218
+ const hasGlobs = rule.globs && rule.globs.length > 0;
2218
2219
  const frontmatter = [
2219
2220
  "---",
2220
2221
  `description: AI Rules - ${ruleName}`,
2221
- `globs: ${rule.globs || "**/*"}`,
2222
- "alwaysApply: true",
2222
+ `globs: ${hasGlobs ? rule.globs : "**/*"}`,
2223
+ "alwaysApply: " + (hasGlobs ? "false" : "true"),
2223
2224
  "---",
2224
2225
  ""
2225
2226
  ].join(`
@@ -2945,135 +2946,30 @@ class ConfigLoader {
2945
2946
  static createTypedConfig() {
2946
2947
  return `import { defineRules } from 'glooit';
2947
2948
 
2948
- // defineRules() provides TypeScript IntelliSense and validation
2949
2949
  export default defineRules({
2950
- // Directory where glooit stores configuration files
2951
2950
  configDir: '.glooit',
2952
-
2953
- // Default targets for all rules (can be overridden per rule)
2954
- targets: ['claude', 'cursor'],
2955
-
2956
- // Rules define how to sync your files to different AI agents
2957
2951
  rules: [
2958
2952
  {
2959
2953
  name: 'main',
2960
- file: '.glooit/main.md', // Source file to sync
2961
- to: './', // Destination directory
2962
- targets: ['claude', 'cursor'] // Which agents to sync to
2963
- }
2964
- // Add more rules here:
2965
- // {
2966
- // name: 'coding-standards',
2967
- // file: '.glooit/coding-rules.md',
2968
- // to: './',
2969
- // targets: [
2970
- // 'claude',
2971
- // { name: 'cursor', to: './custom/cursor-rules.mdc' }, // Custom path override
2972
- // { name: 'generic', to: './docs/coding-standards.md' } // Generic agent with custom path
2973
- // ],
2974
- // globs: '**/*.{ts,js,tsx,jsx}' // Optional: only apply to certain file patterns
2975
- // }
2976
- ],
2977
-
2978
- // MCP (Model Context Protocol) server configurations
2979
- mcps: [
2980
- // Example MCP server configurations:
2981
- // {
2982
- // name: 'database',
2983
- // config: {
2984
- // command: 'npx',
2985
- // args: ['@modelcontextprotocol/server-postgres'],
2986
- // env: { DATABASE_URL: process.env.DATABASE_URL }
2987
- // },
2988
- // targets: ['claude']
2989
- // },
2990
- // {
2991
- // name: 'filesystem',
2992
- // config: {
2993
- // command: 'npx',
2994
- // args: ['@modelcontextprotocol/server-filesystem', process.cwd()]
2995
- // },
2996
- // targets: ['claude', 'cursor']
2997
- // }
2954
+ file: '.glooit/main.md',
2955
+ to: './',
2956
+ targets: ['claude', 'cursor']
2957
+ }
2998
2958
  ],
2999
-
3000
- // Additional options:
3001
- // mergeMcps: true, // Merge with existing MCP configs (default: true)
3002
- // backup: { // Backup settings
3003
- // enabled: true, // Create backups before syncing (default: true)
3004
- // retention: 10 // Keep last 10 backups (default: 10)
3005
- // },
3006
- // hooks: { // Custom hooks for advanced workflows
3007
- // before: [], // Run before sync
3008
- // after: [], // Run after sync
3009
- // error: [] // Run on error
3010
- // }
3011
2959
  });
3012
2960
  `;
3013
2961
  }
3014
2962
  static createPlainConfig() {
3015
2963
  return `export default {
3016
- // Directory where glooit stores configuration files
3017
2964
  configDir: '.glooit',
3018
-
3019
- // Default targets for all rules (can be overridden per rule)
3020
- targets: ['claude', 'cursor'],
3021
-
3022
- // Rules define how to sync your files to different AI agents
3023
2965
  rules: [
3024
2966
  {
3025
2967
  name: 'main',
3026
- file: '.glooit/main.md', // Source file to sync
3027
- to: './', // Destination directory
3028
- targets: ['claude', 'cursor'] // Which agents to sync to
3029
- }
3030
- // Add more rules here:
3031
- // {
3032
- // name: 'coding-standards',
3033
- // file: '.glooit/coding-rules.md',
3034
- // to: './',
3035
- // targets: [
3036
- // 'claude',
3037
- // { name: 'cursor', to: './custom/cursor-rules.mdc' }, // Custom path override
3038
- // { name: 'generic', to: './docs/coding-standards.md' } // Generic agent with custom path
3039
- // ],
3040
- // globs: '**/*.{ts,js,tsx,jsx}' // Optional: only apply to certain file patterns
3041
- // }
2968
+ file: '.glooit/main.md',
2969
+ to: './',
2970
+ targets: ['claude', 'cursor']
2971
+ }
3042
2972
  ],
3043
-
3044
- // MCP (Model Context Protocol) server configurations
3045
- mcps: [
3046
- // Example MCP server configurations:
3047
- // {
3048
- // name: 'database',
3049
- // config: {
3050
- // command: 'npx',
3051
- // args: ['@modelcontextprotocol/server-postgres'],
3052
- // env: { DATABASE_URL: process.env.DATABASE_URL }
3053
- // },
3054
- // targets: ['claude']
3055
- // },
3056
- // {
3057
- // name: 'filesystem',
3058
- // config: {
3059
- // command: 'npx',
3060
- // args: ['@modelcontextprotocol/server-filesystem', process.cwd()]
3061
- // },
3062
- // targets: ['claude', 'cursor']
3063
- // }
3064
- ]
3065
-
3066
- // Additional options:
3067
- // mergeMcps: true, // Merge with existing MCP configs (default: true)
3068
- // backup: { // Backup settings
3069
- // enabled: true, // Create backups before syncing (default: true)
3070
- // retention: 10 // Keep last 10 backups (default: 10)
3071
- // },
3072
- // hooks: { // Custom hooks for advanced workflows
3073
- // before: [], // Run before sync
3074
- // after: [], // Run after sync
3075
- // error: [] // Run on error
3076
- // }
3077
2973
  };
3078
2974
  `;
3079
2975
  }
@@ -3439,7 +3335,7 @@ function constructCommand(value, args) {
3439
3335
  import { execSync } from "child_process";
3440
3336
  import { createInterface } from "readline";
3441
3337
  // package.json
3442
- var version = "0.5.2";
3338
+ var version = "0.5.3";
3443
3339
 
3444
3340
  // src/cli/index.ts
3445
3341
  var args = process.argv.slice(2);
package/dist/index.js CHANGED
@@ -163,11 +163,12 @@ import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
163
163
  class CursorWriter {
164
164
  formatContent(content, rule) {
165
165
  const ruleName = this.extractRuleName(rule.file);
166
+ const hasGlobs = rule.globs && rule.globs.length > 0;
166
167
  const frontmatter = [
167
168
  "---",
168
169
  `description: AI Rules - ${ruleName}`,
169
- `globs: ${rule.globs || "**/*"}`,
170
- "alwaysApply: true",
170
+ `globs: ${hasGlobs ? rule.globs : "**/*"}`,
171
+ "alwaysApply: " + (hasGlobs ? "false" : "true"),
171
172
  "---",
172
173
  ""
173
174
  ].join(`
@@ -892,135 +893,30 @@ class ConfigLoader {
892
893
  static createTypedConfig() {
893
894
  return `import { defineRules } from 'glooit';
894
895
 
895
- // defineRules() provides TypeScript IntelliSense and validation
896
896
  export default defineRules({
897
- // Directory where glooit stores configuration files
898
897
  configDir: '.glooit',
899
-
900
- // Default targets for all rules (can be overridden per rule)
901
- targets: ['claude', 'cursor'],
902
-
903
- // Rules define how to sync your files to different AI agents
904
898
  rules: [
905
899
  {
906
900
  name: 'main',
907
- file: '.glooit/main.md', // Source file to sync
908
- to: './', // Destination directory
909
- targets: ['claude', 'cursor'] // Which agents to sync to
901
+ file: '.glooit/main.md',
902
+ to: './',
903
+ targets: ['claude', 'cursor']
910
904
  }
911
- // Add more rules here:
912
- // {
913
- // name: 'coding-standards',
914
- // file: '.glooit/coding-rules.md',
915
- // to: './',
916
- // targets: [
917
- // 'claude',
918
- // { name: 'cursor', to: './custom/cursor-rules.mdc' }, // Custom path override
919
- // { name: 'generic', to: './docs/coding-standards.md' } // Generic agent with custom path
920
- // ],
921
- // globs: '**/*.{ts,js,tsx,jsx}' // Optional: only apply to certain file patterns
922
- // }
923
905
  ],
924
-
925
- // MCP (Model Context Protocol) server configurations
926
- mcps: [
927
- // Example MCP server configurations:
928
- // {
929
- // name: 'database',
930
- // config: {
931
- // command: 'npx',
932
- // args: ['@modelcontextprotocol/server-postgres'],
933
- // env: { DATABASE_URL: process.env.DATABASE_URL }
934
- // },
935
- // targets: ['claude']
936
- // },
937
- // {
938
- // name: 'filesystem',
939
- // config: {
940
- // command: 'npx',
941
- // args: ['@modelcontextprotocol/server-filesystem', process.cwd()]
942
- // },
943
- // targets: ['claude', 'cursor']
944
- // }
945
- ],
946
-
947
- // Additional options:
948
- // mergeMcps: true, // Merge with existing MCP configs (default: true)
949
- // backup: { // Backup settings
950
- // enabled: true, // Create backups before syncing (default: true)
951
- // retention: 10 // Keep last 10 backups (default: 10)
952
- // },
953
- // hooks: { // Custom hooks for advanced workflows
954
- // before: [], // Run before sync
955
- // after: [], // Run after sync
956
- // error: [] // Run on error
957
- // }
958
906
  });
959
907
  `;
960
908
  }
961
909
  static createPlainConfig() {
962
910
  return `export default {
963
- // Directory where glooit stores configuration files
964
911
  configDir: '.glooit',
965
-
966
- // Default targets for all rules (can be overridden per rule)
967
- targets: ['claude', 'cursor'],
968
-
969
- // Rules define how to sync your files to different AI agents
970
912
  rules: [
971
913
  {
972
914
  name: 'main',
973
- file: '.glooit/main.md', // Source file to sync
974
- to: './', // Destination directory
975
- targets: ['claude', 'cursor'] // Which agents to sync to
915
+ file: '.glooit/main.md',
916
+ to: './',
917
+ targets: ['claude', 'cursor']
976
918
  }
977
- // Add more rules here:
978
- // {
979
- // name: 'coding-standards',
980
- // file: '.glooit/coding-rules.md',
981
- // to: './',
982
- // targets: [
983
- // 'claude',
984
- // { name: 'cursor', to: './custom/cursor-rules.mdc' }, // Custom path override
985
- // { name: 'generic', to: './docs/coding-standards.md' } // Generic agent with custom path
986
- // ],
987
- // globs: '**/*.{ts,js,tsx,jsx}' // Optional: only apply to certain file patterns
988
- // }
989
919
  ],
990
-
991
- // MCP (Model Context Protocol) server configurations
992
- mcps: [
993
- // Example MCP server configurations:
994
- // {
995
- // name: 'database',
996
- // config: {
997
- // command: 'npx',
998
- // args: ['@modelcontextprotocol/server-postgres'],
999
- // env: { DATABASE_URL: process.env.DATABASE_URL }
1000
- // },
1001
- // targets: ['claude']
1002
- // },
1003
- // {
1004
- // name: 'filesystem',
1005
- // config: {
1006
- // command: 'npx',
1007
- // args: ['@modelcontextprotocol/server-filesystem', process.cwd()]
1008
- // },
1009
- // targets: ['claude', 'cursor']
1010
- // }
1011
- ]
1012
-
1013
- // Additional options:
1014
- // mergeMcps: true, // Merge with existing MCP configs (default: true)
1015
- // backup: { // Backup settings
1016
- // enabled: true, // Create backups before syncing (default: true)
1017
- // retention: 10 // Keep last 10 backups (default: 10)
1018
- // },
1019
- // hooks: { // Custom hooks for advanced workflows
1020
- // before: [], // Run before sync
1021
- // after: [], // Run after sync
1022
- // error: [] // Run on error
1023
- // }
1024
920
  };
1025
921
  `;
1026
922
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glooit",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "๐Ÿงด Sync your AI agent configurations and rules across platforms with ease",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",