codeplay-common 4.2.5 → 4.2.7

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
@@ -8,21 +8,25 @@ Make three build file for different store as per our requirement
8
8
  Based on store install various IAP plugins
9
9
  Make it to ionic project
10
10
 
11
- ## Agent instruction templates
12
-
13
- Agent instructions are maintained independently under `agent-templates/v<version>/`.
14
- The version in `agent-templates/manifest.json` is installed by default. To pin a
15
- project to a specific instruction version, add this to the project's `package.json`:
16
-
17
- ```json
18
- "codeplayCommon": {
19
- "agentsVersion": "1.0"
20
- }
21
- ```
22
-
23
- During npm installation, the selected template's `AGENTS.md` and `AGENTS/` folder
24
- are copied to the project root. Project-only files with different names inside
25
- `AGENTS/` are preserved.
11
+ ## Agent instructions
12
+
13
+ Agent instructions are updated during `npm run build`, not during npm installation.
14
+ The build script reads the `agents` version from
15
+ `https://htmlcodeplay.com/code-play-plugin/versions.json` and downloads the matching
16
+ `agents-<version>.zip` archive when the project has no agent instructions or the
17
+ server version is newer.
18
+
19
+ The ZIP root must contain `AGENTS.md` and `AGENTS/`. These are copied directly to
20
+ the project root. The installed version is stored in `AGENTS/.codeplay-version`.
21
+ Existing files with matching names are replaced; project-only files with other
22
+ names inside `AGENTS/` are preserved.
23
+
24
+ For example, publish `agents-1.1.zip` and add this entry to the server's
25
+ `versions.json`:
26
+
27
+ ```json
28
+ "agents": "1.1"
29
+ ```
26
30
 
27
31
  Donate to get full code including many common functions
28
32
  https://ko-fi.com/codeplay
@@ -20,7 +20,12 @@ const updateLogFile = path.join(process.cwd(), "", "plugin-update-log.txt");
20
20
  const ADMOB_NEXTGEN_PLUGIN_NAME = "admob-emi-nextgen";
21
21
  const ADMOB_NEXTGEN_FILE_PATTERN = new RegExp(`^${ADMOB_NEXTGEN_PLUGIN_NAME}-\\d+(?:\\.\\d+)*\\.js$`);
22
22
  const ADMOB_NEXTGEN_CONFIG = "admob-ad-configuration-nextgen.json";
23
- const ADMOB_OLD_CONFIG = "admob-ad-configuration.json";
23
+ const ADMOB_OLD_CONFIG = "admob-ad-configuration.json";
24
+ const AGENT_INSTRUCTIONS_VERSION_KEY = "agents";
25
+ const AGENT_INSTRUCTIONS_ZIP_PREFIX = "agents";
26
+ const AGENT_INSTRUCTIONS_FILE = "AGENTS.md";
27
+ const AGENT_INSTRUCTIONS_DIR = "AGENTS";
28
+ const AGENT_INSTRUCTIONS_VERSION_FILE = ".codeplay-version";
24
29
 
25
30
  const parseVersionParts = (version) => String(version || "0")
26
31
  .trim()
@@ -1866,7 +1871,7 @@ function updateImports(oldName, newName) {
1866
1871
 
1867
1872
 
1868
1873
  let _serverVersions = null;
1869
- async function fetchVersions() {
1874
+ async function fetchVersions() {
1870
1875
 
1871
1876
  if (_serverVersions) return _serverVersions;
1872
1877
 
@@ -1903,7 +1908,103 @@ async function fetchVersions() {
1903
1908
 
1904
1909
  });
1905
1910
 
1906
- }
1911
+ }
1912
+
1913
+ function readInstalledAgentInstructionsVersion() {
1914
+ const versionFile = path.join(
1915
+ process.cwd(),
1916
+ AGENT_INSTRUCTIONS_DIR,
1917
+ AGENT_INSTRUCTIONS_VERSION_FILE
1918
+ );
1919
+
1920
+ if (!fs.existsSync(versionFile)) return "0";
1921
+ return String(fs.readFileSync(versionFile, "utf8")).trim() || "0";
1922
+ }
1923
+
1924
+ function validateAgentInstructionsZip(zip) {
1925
+ const entries = zip.getEntries().filter(entry => !entry.isDirectory);
1926
+
1927
+ for (const entry of entries) {
1928
+ const normalizedName = entry.entryName.replace(/\\/g, "/");
1929
+ if (
1930
+ normalizedName.startsWith("/") ||
1931
+ normalizedName.split("/").includes("..") ||
1932
+ path.isAbsolute(entry.entryName)
1933
+ ) {
1934
+ throw new Error(`Unsafe path in agent instructions ZIP: ${entry.entryName}`);
1935
+ }
1936
+ }
1937
+
1938
+ const hasAgentFile = entries.some(entry => entry.entryName.replace(/\\/g, "/") === AGENT_INSTRUCTIONS_FILE);
1939
+ const hasAgentFolderFiles = entries.some(entry =>
1940
+ entry.entryName.replace(/\\/g, "/").startsWith(`${AGENT_INSTRUCTIONS_DIR}/`)
1941
+ );
1942
+
1943
+ if (!hasAgentFile || !hasAgentFolderFiles) {
1944
+ throw new Error(
1945
+ `Agent instructions ZIP must contain ${AGENT_INSTRUCTIONS_FILE} and files inside ${AGENT_INSTRUCTIONS_DIR}/ at its root.`
1946
+ );
1947
+ }
1948
+ }
1949
+
1950
+ async function syncAgentInstructions() {
1951
+ const versions = await fetchVersions();
1952
+ const remoteVersion = String(versions?.[AGENT_INSTRUCTIONS_VERSION_KEY] || "").trim();
1953
+
1954
+ if (!/^\d+(?:\.\d+)*$/.test(remoteVersion)) {
1955
+ console.log(`ℹ️ No valid "${AGENT_INSTRUCTIONS_VERSION_KEY}" version found on the server. Skipping agent instructions update.`);
1956
+ return;
1957
+ }
1958
+
1959
+ const projectRoot = process.cwd();
1960
+ const targetAgentFile = path.join(projectRoot, AGENT_INSTRUCTIONS_FILE);
1961
+ const targetAgentDir = path.join(projectRoot, AGENT_INSTRUCTIONS_DIR);
1962
+ const localVersion = readInstalledAgentInstructionsVersion();
1963
+ const filesAreMissing = !fs.existsSync(targetAgentFile) || !fs.existsSync(targetAgentDir);
1964
+
1965
+ if (!filesAreMissing && compareVersionStrings(remoteVersion, localVersion) <= 0) {
1966
+ console.log(`✅ Agent instructions are up to date (version ${localVersion}).`);
1967
+ return;
1968
+ }
1969
+
1970
+ const zipName = `${AGENT_INSTRUCTIONS_ZIP_PREFIX}-${remoteVersion}.zip`;
1971
+ const url = `https://htmlcodeplay.com/code-play-plugin/${zipName}`;
1972
+ const tempRoot = fs.mkdtempSync(path.join(require("os").tmpdir(), "codeplay-agents-"));
1973
+ const zipPath = path.join(tempRoot, zipName);
1974
+ const extractPath = path.join(tempRoot, "extracted");
1975
+
1976
+ try {
1977
+ console.log(`🔍 Checking latest agent instructions: ${zipName}`);
1978
+ if (!(await urlExists(url))) {
1979
+ console.warn(`⚠️ Agent instructions archive not found: ${url}`);
1980
+ return;
1981
+ }
1982
+
1983
+ await downloadFile(url, zipPath);
1984
+ const zip = new AdmZip(zipPath);
1985
+ validateAgentInstructionsZip(zip);
1986
+ zip.extractAllTo(extractPath, true);
1987
+
1988
+ const stagedAgentFile = path.join(extractPath, AGENT_INSTRUCTIONS_FILE);
1989
+ const stagedAgentDir = path.join(extractPath, AGENT_INSTRUCTIONS_DIR);
1990
+
1991
+ fs.mkdirSync(targetAgentDir, { recursive: true });
1992
+ fs.copyFileSync(stagedAgentFile, targetAgentFile);
1993
+ fs.cpSync(stagedAgentDir, targetAgentDir, { recursive: true, force: true });
1994
+ fs.writeFileSync(
1995
+ path.join(targetAgentDir, AGENT_INSTRUCTIONS_VERSION_FILE),
1996
+ `${remoteVersion}\n`,
1997
+ "utf8"
1998
+ );
1999
+
2000
+ writeUpdateLine(`Agent instructions ${localVersion} -> ${remoteVersion}`);
2001
+ console.log(`✅ Agent instructions updated directly in the project root → v${remoteVersion}`);
2002
+ } catch (error) {
2003
+ console.warn(`⚠️ Agent instructions update failed: ${error?.message || error}`);
2004
+ } finally {
2005
+ fs.rmSync(tempRoot, { recursive: true, force: true });
2006
+ }
2007
+ }
1907
2008
 
1908
2009
 
1909
2010
 
@@ -4012,9 +4113,10 @@ async function main() {
4012
4113
  validateAndRestoreSignDetails();
4013
4114
  execSync('node buildCodeplay/fix-onesignal-plugin.js', { stdio: 'inherit' });
4014
4115
 
4015
- await loadPluginVersions(); // 🔥 NEW
4016
-
4017
- await syncAdmobNextgenMigration();
4116
+ await loadPluginVersions(); // 🔥 NEW
4117
+ await syncAgentInstructions();
4118
+
4119
+ await syncAdmobNextgenMigration();
4018
4120
  syncSystemBarsSafeAreaMigration();
4019
4121
  await checkPlugins();
4020
4122
  syncRevenueCatIapSetup();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeplay-common",
3
- "version": "4.2.5",
3
+ "version": "4.2.7",
4
4
  "description": "Common build scripts and files",
5
5
  "scripts": {
6
6
  "postinstall": "node scripts/sync-files.js",
@@ -5,10 +5,6 @@ const projectRoot = path.resolve(__dirname, "../../../"); // Your project's root
5
5
  const commonBuildPath = path.join(__dirname, "../files"); // Path to common files
6
6
  const buildCodeplayPath = path.join(commonBuildPath, "buildCodeplay"); // Correct path
7
7
  const packageJsonPath = path.join(projectRoot, "package.json");
8
- const agentTemplatesPath = path.join(__dirname, "../agent-templates");
9
- const agentManifestPath = path.join(agentTemplatesPath, "manifest.json");
10
- const agentFileName = "AGENTS.md";
11
- const agentFolderName = "AGENTS";
12
8
 
13
9
  // Ensure package.json exists
14
10
  if (!fs.existsSync(packageJsonPath)) {
@@ -27,51 +23,6 @@ function copyFolderSync(source, destination) {
27
23
  }
28
24
  }
29
25
 
30
- function copyAgentInstructions() {
31
- if (!fs.existsSync(agentManifestPath)) {
32
- process.stderr.write("❌ agent-templates/manifest.json not found in the npm package.\n");
33
- process.exit(1);
34
- }
35
-
36
- const manifest = JSON.parse(fs.readFileSync(agentManifestPath, "utf8"));
37
- const normalizeVersion = version => String(version).replace(/^v/i, "");
38
- const availableVersions = Array.isArray(manifest.versions)
39
- ? manifest.versions.map(normalizeVersion)
40
- : [];
41
- const selectedVersion = normalizeVersion(
42
- packageJson.codeplayCommon?.agentsVersion || manifest.current
43
- );
44
-
45
- if (!selectedVersion || !availableVersions.includes(selectedVersion)) {
46
- process.stderr.write(
47
- `❌ Agent template version "${selectedVersion}" is unavailable. Available versions: ${availableVersions.join(", ")}\n`
48
- );
49
- process.exit(1);
50
- }
51
-
52
- const selectedTemplatePath = path.join(agentTemplatesPath, `v${selectedVersion}`);
53
- const agentFileSource = path.join(selectedTemplatePath, agentFileName);
54
- const agentFolderSource = path.join(selectedTemplatePath, agentFolderName);
55
-
56
- if (!fs.existsSync(agentFileSource) || !fs.existsSync(agentFolderSource)) {
57
- process.stderr.write(
58
- `❌ Agent template v${selectedVersion} must contain ${agentFileName} and ${agentFolderName}/.\n`
59
- );
60
- process.exit(1);
61
- }
62
-
63
- try {
64
- fs.copyFileSync(agentFileSource, path.join(projectRoot, agentFileName));
65
- fs.cpSync(agentFolderSource, path.join(projectRoot, agentFolderName), { recursive: true });
66
- process.stdout.write(
67
- `✅ Copied agent instructions v${selectedVersion}: ${agentFileName} and ${agentFolderName}/\n`
68
- );
69
- } catch (error) {
70
- process.stderr.write(`❌ Failed to copy agent instructions: ${error.message}\n`);
71
- process.exit(1);
72
- }
73
- }
74
-
75
26
  // Copy all files from `common-build-files/files/` to the project root
76
27
  fs.readdirSync(commonBuildPath).forEach(file => {
77
28
  const sourcePath = path.join(commonBuildPath, file);
@@ -89,9 +40,7 @@ fs.readdirSync(commonBuildPath).forEach(file => {
89
40
  }
90
41
  });
91
42
 
92
- copyAgentInstructions();
93
-
94
- // Function to get the latest versioned file from files/buildCodeplay
43
+ // Function to get the latest versioned file from files/buildCodeplay
95
44
  function getLatestFile(prefix) {
96
45
  if (!fs.existsSync(buildCodeplayPath)) return null; // Ensure directory exists
97
46
 
@@ -1,7 +0,0 @@
1
- {
2
- "current": "1.1",
3
- "versions": [
4
- "1.0"
5
- ,"1.1"
6
- ]
7
- }
@@ -1,12 +0,0 @@
1
- # Screenshot Capture Rule
2
-
3
- - Always capture from the current connected/online adb device only.
4
- - Before running any screenshot command:
5
- - Detect the first device with `device` state from `adb devices`.
6
- - Do not use any key events (no power, wake, or lock/unlock commands).
7
- - Do not use screen-state changes (`keyevent 26`, `keyevent 224`, etc.).
8
- - Capture command sequence:
9
- 1. `adb -s <device-id> shell screencap -p /sdcard/current_connected_screenshot.png`
10
- 2. `adb -s <device-id> pull /sdcard/current_connected_screenshot.png _connected_screenshot.png`
11
- 3. `adb -s <device-id> shell rm /sdcard/current_connected_screenshot.png`
12
- - If no device is in `device` state, stop and report `no_connected_device` before running any screenshot command.
@@ -1,4 +0,0 @@
1
- # AGENT TEMP FOLDER RULE
2
-
3
- - All temporary files and folders created while executing tasks (including images, cache files, debug output, and generated artifacts) **must be written only under the project-level `agent-temp/` directory**.
4
- - Do not create or leave temporary artifacts in repository root, `src`, `www`, `public`, or other project folders.
@@ -1,242 +0,0 @@
1
- # Framework7 `.f7` New Page Standard (Cross-App)
2
-
3
- ## Source-of-truth and project scope
4
- Use these files as mandatory baseline before creating any new page:
5
- `AGENTS.md`, `AGENTS\agents.md`, existing pages under `src\pages`, `src\js\routes.js`, and theme files under `src\theme`.
6
- Use the matching project’s actual files for any app where you are implementing this standard.
7
-
8
- ## Required page shape
9
- Every new page file must use `.f7` with exactly one `<template>` and one `<script>`.
10
- The root DOM must be one `.page` element with `data-name`.
11
-
12
- Minimum skeleton:
13
- ```html
14
- <template>
15
- <div class="page" data-name="newPage">
16
- <!-- optional navbar -->
17
- <!-- page content -->
18
- </div>
19
- </template>
20
- <script>
21
- export default (props, { $f7, $el, $on }) => {
22
- // lifecycle + handlers
23
- return $render;
24
- };
25
- </script>
26
- ```
27
-
28
- ## Route integration rule
29
- After creating any new `.f7` page, add it to `src\js\routes.js` with lazy async loading and route names ending in `/`, matching existing app routes.
30
- Use this style:
31
- ```js
32
- {
33
- path: '/NewPageName/',
34
- //component: newPageImport
35
- async async({ resolve }) {
36
- const page = await import('../pages/newpage.f7');
37
- resolve({ component: page.default });
38
- },
39
- },
40
- ```
41
-
42
- Match the existing conventions exactly:
43
- - path names use PascalCase and trailing slash.
44
- - import path should point to `../pages/<file>.f7`.
45
- - component is resolved from `page.default`.
46
-
47
- ## Back button rule (required)
48
- All new pages must use the shared back handler from `src/js/back.js`.
49
-
50
- Add this import:
51
- ```js
52
- import { backButtonPress } from './../js/back.js';
53
- ```
54
-
55
- Use `backButtonPress` for every page back action in navbars, back links, and custom back controls.
56
-
57
- ```html
58
- <div class="left">
59
- <div class="link" @click="${backButtonPress}">
60
- <img src="${backImage}" class="backIconImg"></img>
61
- </div>
62
- </div>
63
- ```
64
-
65
- Do not use custom `router.back()` or manual `window.history.back()` in new pages.
66
- If a page requires a custom close/exit confirmation, keep it inside `backButtonPress` central flow or `common` helpers, then wire the same handler.
67
-
68
- The central `backButtonPress` flow must preserve the actual navigation source:
69
- - Home keeps the app's existing exit-confirmation behavior.
70
- - Pages with explicit product behavior may keep a named destination in `src/js/back.js`.
71
- - All other pages must use the main Framework7 router history to return to the previous page.
72
- - If no previous route exists, the central handler must return to Home.
73
- - Do not add page-local back methods or hardcode Home in ordinary secondary pages.
74
-
75
- When a page has popups/sheets/dialogs open, verify the shared handler’s behavior for overlays before adding extra back logic.
76
-
77
- ## Template structure (strict)
78
- Use Framework7 layout components before any custom markup.
79
- For pages with header actions use `.navbar` with `.navbar-bg`.
80
- If theme color is needed, include `.theme-navbarBackColor`.
81
- For content use `.page-content`.
82
- For tab rows use `.subnavbar` + `.toolbar.toolbar-top.tabbar`.
83
- For bottom action bars use `.toolbar.toolbar-bottom.tabbar`.
84
-
85
- Examples:
86
- `<div class="navbar"> <div class="navbar-bg theme-navbarBackColor"></div> <div class="navbar-inner">...</div> </div>`
87
-
88
- `<div class="subnavbar theme-navbarBackColor"><div class="subnavbar-inner"><div class="toolbar toolbar-top tabbar">...</div></div></div>`
89
-
90
- `<div class="toolbar toolbar-bottom tabbar theme-navbarBackColor"><div class="toolbar-inner">...</div></div>`
91
-
92
- ## Framework7 custom component enable/disable rule
93
- If a new page uses a component beyond the currently enabled baseline, update these files first:
94
- - `src/js/framework7-custom.js`
95
- - `src/assets/css/framework7-custom.less`
96
-
97
- Enable a component by uncommenting both:
98
- - JS import and registration in `src/js/framework7-custom.js`
99
- - matching LESS import in `src/assets/css/framework7-custom.less`
100
-
101
- Disable a component by commenting both import/registration and LESS import.
102
- Keep JS and LESS changes synchronized for each enabled component.
103
-
104
- Keep this section app-agnostic.
105
- For each app, enable only components that are required by that app and keep JS/LESS toggles synchronized in that app's own `framework7-custom` files.
106
-
107
- ## Grid and list policy
108
- Use Framework7 utilities for columns:
109
- `grid`, `grid-cols-*`, `grid-gap`, `display-flex`, and standard alignment classes.
110
- Use framework list classes:
111
- `list`, `list media-list`, `item-content`, `item-inner`, `item-title`.
112
- Do not create new custom grid/list styles unless existing utilities are impossible.
113
-
114
- ## Navbar and status-bar behavior
115
- If page has a header, add theme activation in lifecycle:
116
- ```js
117
- $on("pageBeforeIn", () => {
118
- ThemeController.activateForPage({
119
- navColor: 'white',
120
- statusColor: 'white',
121
- navIsAutoMode: false,
122
- statusIsAutoMode: false,
123
- navCanChangeInNavScroll: false,
124
- statusCanChangeInNavScroll: true
125
- });
126
- });
127
- ```
128
-
129
- If page needs translation updates, listen to app theme event in `pageInit`.
130
-
131
- ## Sheet / popup / popover / dialog usage
132
- Use Framework7 APIs to create these controls.
133
- Do not hand-style internals as ad-hoc floating containers.
134
- For sheets use `sheet` element + `$f7.sheet.create`.
135
- For popups use `$f7.popup.create`.
136
- For popovers use `$f7.popover.create`.
137
- For completion dialogs always set back behavior using dialog options, for example `dialogClass: 'namepopup-dialog dialog-back-no-close'`.
138
-
139
- For non-dismissible bottom sheet/popups, use proper F7 class + safe-area aware spacing from shared styles.
140
-
141
- ## FAB policy
142
- Use `.fab` and `.fab-button` classes only.
143
- Avoid building custom floating action components with fixed positioned custom HTML.
144
- If using FAB for mobile actions, set `right`, `bottom`, and alignment with F7 classes and existing utilities.
145
-
146
- ## Styling policy for new pages
147
- Avoid inline style attributes in new pages.
148
- Do not add custom CSS classes directly inside `.f7` unless truly unavoidable.
149
- Also follow all theme rules in this app’s theme notes file (for example `src\theme\<theme-folder>\Notes.txt`) when designing page visuals.
150
- If style is needed, define it in:
151
- `src\theme\theme-x.x\theme.less`, `src\theme\theme-x.x\theme-dialog.less`, or `src\assets\css\common-x.x.less`.
152
- All theme helper classes should be prefixed with `t-`.
153
- Prefer theme classes like `theme-navbarBackColor`, `t-fade-img`, existing ripple utility classes, and shared page-level helper classes.
154
-
155
- Theme file musts / reminders from `<theme-folder>\Notes.txt` (for example `theme-x.x\Notes.txt`):
156
- - Prefer Framework7 classes first; only fallback to theme css when not possible.
157
- - Use `theme-navbarBackColor` for navbar color consistency.
158
- - Reuse existing utility variables like `--bg-main1`, `--bg-main2`, `--bg-main2-text`, `--tab-active-bg`, `--tab-inactive-text`, etc.
159
- - Use shared theme class prefix `t-*` for all new custom theme classes.
160
- - For images that must change by theme, use `data-image-light` / `data-image-dark` and call `ThemeController.activateForPage()` when needed.
161
- - Theme-related changes should go to `src/theme/css/custom.less`, `src/theme/css/light.less`, or `src/theme/css/dark.less` only.
162
- - For light/dark and system behavior checks, use existing `ThemeController` helpers.
163
- - Do not change protected shared styles directly on a page with inline or per-page overrides unless explicitly required.
164
-
165
- Do not modify `www` and do not edit protected shared files unless user explicitly grants permission.
166
- Protected list is in `AGENTS.md`.
167
-
168
- If you notice a missing instruction between this file and `Notes.txt`, update this instruction file first and follow the stricter one.
169
-
170
- ## Handler and event rules
171
- Keep template event bindings minimal and avoid large inline arrow expressions in markup.
172
- Define handlers as named functions and bind directly.
173
- Keep DOM queries inside lifecycle events only.
174
-
175
- Good pattern:
176
- `@click="${onOpenMenu}"`, `@click="${openTemplatePopup}"`, `@click="${goBack}"`
177
- Avoid repeating heavy anonymous callbacks inside markup.
178
-
179
- ## Reuse over duplication
180
- Before creating helpers, check existing exported helpers in project js folders.
181
- Prefer reuse of common functions in shared modules.
182
- Do not introduce duplicate utilities for back navigation, theme switching, popover/popup creation, dialogs, toasts, or storage.
183
-
184
- ## Shared method first (required)
185
- Before adding new helper methods, always search and reuse existing common methods in the project.
186
- If a shared method already exists, do not create a new one.
187
-
188
- Important shared method source for new pages:
189
- - `./../js/common-x.x.js`
190
- - theme/controller helpers already imported in existing pages (for example `ThemeController`)
191
-
192
- From the project update notes:
193
- - For back handling in app shell, `capacitor-app.js` must import:
194
- `import { backButtonCheckAndExit } from './common-x.x.js';`
195
- and call `backButtonCheckAndExit();` inside `handleAndroidBackButton`.
196
- - If a new page needs spinner stop, import:
197
- `import { stopSpinner } from './../js/common-x.x.js';`
198
-
199
- Commonly available methods to prefer (examples):
200
- - `hideForMethod`
201
- - `shareApp` (with `noAppOpenShowUntilResume`)
202
- - `shareContent` (with `noAppOpenShowUntilResume`)
203
- - `rateUs` (with `noAppOpenShowUntilResume`)
204
- - `gotoPrivacypolicy` (with `noAppOpenShowUntilResume`)
205
- - `openDeveloperApps` (with `noAppOpenShowUntilResume`)
206
- - `bugReportPopup`
207
- - `showToast`
208
- - `showSpinner`, `stopSpinner`
209
- - `showAlertBox`
210
- - `setLocalStorage`, `getLocalStorage`, `removeLocalStorage`
211
- - `getExactContentHeight`
212
- - `confirmDialog`
213
- - `setNavBarColor`, `setStatusBarColor` (order note: call `setNavBarColor` first)
214
- - `manageStorage(key).setState/getState/removeState`
215
- - `initTouchableImages` for touch feedback animations
216
- - `activateLogTracker`, `getConsoleData` (testing only)
217
-
218
- Notes:
219
- - `showPage`, `backButtonPress`, and theme-related helpers should remain consistent with existing patterns.
220
- - Deprecated / removed methods from older notes should not be reintroduced.
221
-
222
- ## Required quality checklist before returning page code
223
- Page file name and `data-name` are unique.
224
- Navbar, page-content, and footer toolbar structure use Framework7 classes.
225
- No new inline style blocks are used unless the exception is explicitly justified.
226
- No hardcoded `background-color` at page element level unless required by theme variant.
227
- No direct edits to protected files were made.
228
- New route is added in `src\js\routes.js`.
229
- At least one existing Framework7 component is used for each required UI area.
230
- Theme activation and lifecycle usage is present when page has a header.
231
- If dialog cannot close on back press, `dialogClass` rule is set at call site.
232
-
233
- ## Response rule for this repo
234
- When codegen is requested from this file, follow this instruction order first:
235
- structure, route, template layout, theme integration, handlers, then script wiring.
236
-
237
-
238
-
239
-
240
-
241
-
242
- if you are using $$ you must import dom7
@@ -1,364 +0,0 @@
1
- # AI Development Instructions
2
-
3
- These instructions apply to the entire project. Follow them for every task unless I explicitly tell you otherwise.
4
-
5
- ### Additional Instruction Files
6
-
7
- Read and follow all applicable additional instruction files before modifying the project.
8
-
9
- - `AGENTS/agent-temp.md`
10
- - `AGENTS/playstore-media.md`
11
- - `AGENTS/versioning.md`
12
- - `AGENTS/agents-create-new-page.md`
13
- - `AGENTS/common-changes.md`
14
-
15
- ---
16
-
17
- # General Rules
18
-
19
- - Always analyze the existing project before making changes.
20
- - Follow the existing project architecture and coding style.
21
- - Reuse existing methods, components, utilities, and helper functions whenever possible.
22
- - Do not duplicate existing functionality.
23
- - Do not introduce unnecessary dependencies.
24
- - Do not refactor unrelated code.
25
- - Keep changes minimal and focused only on the requested task.
26
- - Do not modify files that are unrelated to the requested feature or bug.
27
-
28
- ---
29
-
30
- # Framework7 Rules
31
-
32
- - Always use Framework7 components whenever possible.
33
- - Follow the official Framework7 documentation.
34
- - Do not replace Framework7 components with plain HTML unless absolutely necessary.
35
- - Respect Framework7's built-in layouts and styling.
36
- - Do not override Framework7 default behavior unless I explicitly request it.
37
- - Before creating custom layouts, first check whether Framework7 already provides a suitable component.
38
-
39
- ---
40
-
41
- # Back Navigation Rules
42
-
43
- - Every secondary `.f7` page must import and use `backButtonPress` from `src/js/back.js`.
44
- - Use the same shared flow for navbar back controls and Android hardware back actions.
45
- - Keep special destination or confirmation behavior inside `src/js/back.js`, never in individual pages.
46
- - For ordinary pages, `backButtonPress` must use the main Framework7 router history so the user returns to the page that opened the current page.
47
- - If router history has no previous page, return to Home.
48
- - Home alone uses `backButtonCheckAndExit` for the double-back exit behavior.
49
- - Before adding a new page, test back navigation from every page that can open it.
50
- - Do not modify protected `src/js/backbutton-x.x.js` for ordinary page routing.
51
-
52
- ---
53
-
54
- # CSS Rules
55
-
56
- - Avoid writing custom CSS whenever Framework7 already provides the required styling.
57
- - Prefer Framework7 utility classes instead of custom CSS.
58
- - Only write custom CSS if there is no Framework7 solution.
59
- - Never override Framework7 default styles unless absolutely necessary.
60
- - Keep CSS clean and minimal.
61
-
62
- ---
63
-
64
- # HTML Rules
65
-
66
- - Every non-void HTML element must have a closing tag.
67
- - HTML void elements, including `input`, `img`, and `br`, must use XML-style self-closing syntax.
68
-
69
- Correct examples:
70
-
71
- ```html
72
- <input />
73
-
74
- <img />
75
-
76
- <br />
77
-
78
- <div></div>
79
- ```
80
-
81
- Incorrect examples:
82
-
83
- ```html
84
- <input>
85
-
86
- <img>
87
-
88
- <br>
89
-
90
- <div>
91
- ```
92
-
93
- - Keep HTML clean and properly indented.
94
- - Follow the existing project formatting.
95
-
96
- ---
97
-
98
- # JavaScript Rules
99
-
100
- - Never use inline event handlers.
101
-
102
- Incorrect:
103
-
104
- ```html
105
- <button onclick="save()">
106
- ```
107
-
108
- Correct:
109
-
110
- ```javascript
111
- button.addEventListener(...)
112
- ```
113
-
114
- or use Framework7 event handling.
115
-
116
- - Reuse existing helper methods whenever available.
117
- - Do not create duplicate utility functions.
118
- - Follow the project's existing coding style.
119
-
120
- ---
121
-
122
- # Existing Methods
123
-
124
- This project already contains many reusable exported methods.
125
-
126
- Before creating any new method:
127
-
128
- - Search the project.
129
- - Reuse existing exported methods.
130
- - Only create a new method if no suitable method already exists.
131
-
132
- ---
133
-
134
- # Protected Files
135
-
136
- The following files contain shared functionality used across many pages.
137
-
138
- Do NOT modify these files unless I explicitly give permission. If I give permission and modify, you need to increase its version number (x.x + 0.1 like 0.1, 0.2, ..., 0.9, 1.0, 1.1, 1.2, ..., 1.9, 2.0, 2.1, ...).
139
-
140
- Ads/IAP-x.x
141
-
142
- Ads/admob-emi-nextgen-x.x.js
143
-
144
- Ads/admob-ad-configuration-nextgen.json
145
-
146
- Ads/test-admob.js
147
-
148
- src/js/common-x.x.js
149
-
150
- src/js/backbutton-x.x.js
151
-
152
- src/js/localNotification_AppSettings-x.x.js
153
-
154
- src/js/localNotification-x.x.js
155
-
156
- src/js/saveToGalleryAndSaveAnyFile-x.x-ios.js
157
-
158
- src/js/saveToGalleryAndSaveAnyFile-x.x.js
159
-
160
- src/certificate/certificatejs-x.x
161
-
162
- src/assets/css/common-x.x.less
163
-
164
- src/theme/theme-x.x
165
-
166
- beautify-x.x.js
167
-
168
- image-cropper-x.x.js
169
-
170
- video-player-x.x.js
171
-
172
- onesignal-x.x.js
173
-
174
- localization-x.x
175
-
176
- localization_settings-x.x.js
177
-
178
- ffmpeg-x.x
179
-
180
- editor-x.x
181
-
182
- www => do not modify anything inside the www folder
183
-
184
- If you believe one of these files must be modified:
185
-
186
- STOP.
187
-
188
- Do not modify it.
189
-
190
- Ask me for permission first.
191
-
192
- The permission request for modifying any protected/version-based file is a critical warning and must be displayed in red text in the chat using this format:
193
-
194
- ```html
195
- <span style="color: red;"><strong>CRITICAL PERMISSION REQUIRED:</strong> I need your explicit permission before modifying the protected/version-based file: <file-path>.</span>
196
- ```
197
-
198
- - Replace `<file-path>` with the exact file path and briefly state why the modification is required.
199
- - Keep the entire permission-request message inside the red-styled text.
200
- - If the chat renderer does not support colored HTML text, use `🔴 **CRITICAL PERMISSION REQUIRED:**` at the start of the message so the warning remains visually distinct.
201
- - Do not continue with the protected/version-based file modification until I explicitly approve it.
202
-
203
- ---
204
-
205
- # Existing Plugins
206
-
207
- This project contains many custom plugins.
208
-
209
- Always check whether an existing plugin already provides the required functionality.
210
-
211
- Do not recreate existing plugin functionality.
212
-
213
- ---
214
-
215
- # OneSignal Rules
216
-
217
- Some old applications may still initialize OneSignal like this:
218
-
219
- ```javascript
220
- oneSignalInit({
221
- appId: "YOUR_ONESIGNAL_APP_ID",
222
- });
223
- ```
224
-
225
- Whenever you encounter this code, automatically update it to:
226
-
227
- ```javascript
228
- oneSignalInit({
229
- appId: "YOUR_ONESIGNAL_APP_ID",
230
- ...oneSignalPromptConfig,
231
- });
232
- ```
233
-
234
- Do not ask for confirmation unless I specifically request otherwise.
235
-
236
- ---
237
-
238
- # Testing Rules
239
-
240
- Always test using an ADB-connected Android device.
241
-
242
- Do NOT rely on Chrome browser rendering for UI validation because many UI behaviors differ from real devices.
243
-
244
- Chrome may only be used for quick debugging, never for final UI verification.
245
-
246
- If no ADB-connected Android device is available, clearly report that device testing was not performed and do not claim that the change was successfully validated.
247
-
248
- After every code edit, please do not generate and install apk
249
- ---
250
-
251
- # Build Rules
252
-
253
- Do NOT generate APKs after every successful change.
254
-
255
- Do NOT install APKs after every update.
256
-
257
- The application is already running using Live Server / Live Reload.
258
-
259
- Simply save the files and allow the application to reload automatically.
260
-
261
- Only generate APKs when I explicitly request them.
262
-
263
- If it is ad related changes then you can just close and reopen the app to validate.
264
-
265
- If you add any extra property in the "admob-ad-configuration-nextgen.json" file, you must modify the "buildCodeplay\codeplayBeforeBuild-x.x.js" file too regarding added property and its default value (for example "ADMOB_NEXTGEN_DEFAULTS" variable).
266
-
267
- ---
268
-
269
- # Before Editing
270
-
271
- Before modifying any page:
272
-
273
- - Understand how the page currently works.
274
- - Preserve the existing behavior.
275
- - Avoid unnecessary code changes.
276
- - Avoid unnecessary file modifications.
277
- - Follow the project's existing structure.
278
-
279
- ---
280
-
281
- # Performance Rules
282
-
283
- - Keep bundle size as small as possible.
284
- - Avoid unnecessary imports.
285
- - Avoid unnecessary DOM manipulation.
286
- - Reuse existing components.
287
- - Keep the application fast and responsive.
288
-
289
- ---
290
-
291
- # Code Quality
292
-
293
- Always write:
294
-
295
- - Clean code
296
- - Readable code
297
- - Maintainable code
298
- - Modular code
299
- - Reusable code
300
-
301
- Avoid:
302
-
303
- - Duplicate code
304
- - Dead code
305
- - Unused imports
306
- - Unused variables
307
- - Console logs unless requested
308
-
309
- ---
310
-
311
- # If You Are Unsure
312
-
313
- If any requested change might:
314
-
315
- - modify a protected file,
316
- - affect shared functionality,
317
- - break backward compatibility,
318
- - change application architecture,
319
-
320
- STOP and ask me before proceeding.
321
-
322
- Never make assumptions for these cases.
323
-
324
- ---
325
-
326
- # Response Rules
327
-
328
- When you finish a task:
329
-
330
- - Briefly summarize what was changed.
331
- - Mention which files were modified.
332
- - When applicable, mention any existing method that was reused.
333
- - When applicable, mention any Framework7 component that was used.
334
- - Mention if there are any limitations or follow-up recommendations.
335
-
336
- Do not create unnecessary explanations.
337
-
338
- Keep the response concise.
339
-
340
- ---
341
-
342
- # Completion Dialog + makeDialogPopup Rule
343
-
344
- - When opening a completion dialog with `makeDialogPopup` or a `completeDialogOptions` object, pass the required back behavior through dialog options (for example via `dialogClass`).
345
- - Use `dialogClass: '<custom-class> dialog-back-no-close'` for dialogs that must stay open when back button is pressed.
346
- - The close-blocking behavior is implemented in the back-button handler by checking `'.dialog.modal-in.dialog-back-no-close'`, so this behavior should be controlled at call sites via `makeDialogPopup` options rather than changing shared/central dialog helpers without permission.
347
-
348
- # bottom tabbar/toolbar Instructions
349
- If we add bottom toolbar we must write next to the navbar like below
350
-
351
- <div class="navbar">
352
- ...
353
- ...
354
- </div>
355
- <div class="toolbar toolbar-bottom">
356
- ...
357
- ...
358
- </div
359
-
360
- <div class="page-content">...</div>
361
-
362
-
363
- # Carefull while using html entiry
364
- While you trying to display less than(>) or greater than(<), it should not render like &lt; and &gt;.
File without changes
@@ -1,17 +0,0 @@
1
- # Play Store Media Assets Rule
2
-
3
- - Screenshots and videos generated for Play Store submission must be stored only under the `Playstore/` directory at the repository root.
4
- - Organize assets into explicit subfolders and never place them beside app source or temp files.
5
- - Use this naming structure:
6
-
7
- - `Playstore/Screenshots/<platform>/<orientation>/<app-version>/`
8
- - `Playstore/Videos/<platform>/<type>/`
9
-
10
- Where:
11
-
12
- - `<platform>` examples: `android`, `phone`, `tablet`
13
- - `<orientation>` examples: `portrait`, `landscape`
14
- - `<type>` examples: `feature`, `promo`, `trailer`
15
- - `<app-version>` is the release/build identifier (for example `v1.2.3`).
16
-
17
- - File names should include device and resolution when useful (for example `google-pixel-8-portrait.png`, `galaxy-tab-landscape.mp4`).
@@ -1,14 +0,0 @@
1
- # Versioning and Release Notes Rule
2
-
3
- - Any change to app version fields (version code and/or version name) must be followed by update of tracked release documentation.
4
- - Record every version bump in both files:
5
- - `CHANGELOG.md` (full technical history)
6
- - `RELEASE_NOTES.md` (public-facing release notes)
7
- - Each update entry must include, at minimum:
8
- - Date (`YYYY-MM-DD`)
9
- - New version name
10
- - New version code (or build number)
11
- - Files changed for the version bump
12
- - 3–8 bullet points of user-impacting changes
13
- - If `CHANGELOG.md` or `RELEASE_NOTES.md` do not exist, create them in the repo root.
14
- - Keep these files under version control (do not place in `.gitignore` paths or `agent-temp/`) so they sync across systems.
@@ -1,6 +0,0 @@
1
- # Project Instructions
2
- # Version 1.1
3
-
4
- - `AGENTS/agents.md`
5
-
6
- Read and follow that file before modifying the project.