@explorer02/cfm-survey-sdk 0.1.3 → 0.1.5
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/package.json +1 -1
- package/postinstall.js +30 -18
- package/templates/AGENT.md +10 -1906
- package/templates/docs/01-sdk-core/01-fetch-survey.md +68 -0
- package/templates/docs/01-sdk-core/02-survey-mapper.md +85 -0
- package/templates/docs/01-sdk-core/03-question-mappers.md +114 -0
- package/templates/docs/01-sdk-core/04-pagination.md +72 -0
- package/templates/docs/01-sdk-core/05-validation.md +66 -0
- package/templates/docs/01-sdk-core/06-submit-survey.md +90 -0
- package/templates/docs/01-sdk-core/07-language-handling.md +111 -0
- package/templates/docs/01-sdk-core/08-icons-and-emojis.md +88 -0
- package/templates/docs/01-sdk-core/README.md +53 -0
- package/templates/docs/02-question-types/01-rating.md +52 -0
- package/templates/docs/02-question-types/02-radio.md +26 -0
- package/templates/docs/02-question-types/03-text.md +26 -0
- package/templates/docs/02-question-types/04-csat.md +54 -0
- package/templates/docs/02-question-types/05-rating-scale.md +26 -0
- package/templates/docs/02-question-types/06-slider.md +30 -0
- package/templates/docs/02-question-types/07-matrix-cfm.md +43 -0
- package/templates/docs/02-question-types/08-matrix-csat.md +29 -0
- package/templates/docs/02-question-types/09-matrix-rating.md +28 -0
- package/templates/docs/02-question-types/10-slider-matrix.md +40 -0
- package/templates/docs/02-question-types/11-file-upload.md +34 -0
- package/templates/docs/02-question-types/12-text-and-media.md +35 -0
- package/templates/docs/02-question-types/README.md +74 -0
- package/templates/docs/03-client-components/01-survey-page.md +113 -0
- package/templates/docs/03-client-components/02-question.md +57 -0
- package/templates/docs/03-client-components/03-rating-scale.md +38 -0
- package/templates/docs/03-client-components/04-csat-scale.md +40 -0
- package/templates/docs/03-client-components/05-csat-matrix-scale.md +43 -0
- package/templates/docs/03-client-components/06-likert-matrix-scale.md +38 -0
- package/templates/docs/03-client-components/07-slider-matrix-scale.md +44 -0
- package/templates/docs/03-client-components/08-file-upload-scale.md +33 -0
- package/templates/docs/03-client-components/09-custom-slider-track.md +27 -0
- package/templates/docs/03-client-components/10-header-footer.md +46 -0
- package/templates/docs/03-client-components/11-progress-bar.md +31 -0
- package/templates/docs/03-client-components/12-language-selector.md +41 -0
- package/templates/docs/03-client-components/13-matrix-dropdown.md +42 -0
- package/templates/docs/03-client-components/README.md +63 -0
- package/templates/docs/04-critical-rules/01-import-rules.md +51 -0
- package/templates/docs/04-critical-rules/02-action-dispatching.md +56 -0
- package/templates/docs/04-critical-rules/03-scroll-navigation.md +37 -0
- package/templates/docs/04-critical-rules/04-logo-branding.md +42 -0
- package/templates/docs/04-critical-rules/05-troubleshooting.md +46 -0
- package/templates/docs/04-critical-rules/README.md +29 -0
- package/templates/docs/index.md +129 -0
package/package.json
CHANGED
package/postinstall.js
CHANGED
|
@@ -18,6 +18,25 @@ try {
|
|
|
18
18
|
console.warn(`⚠️ AGENT.md template not found at ${agentTemplatePath}`);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
// ── Copy docs folder to node_modules ───────────────────────────────────────
|
|
22
|
+
const docsTemplatePath = path.join(__dirname, 'templates', 'docs');
|
|
23
|
+
const docsDestPath = path.join(__dirname, 'docs'); // Keep it inside the installed SDK package
|
|
24
|
+
|
|
25
|
+
if (fs.existsSync(docsTemplatePath)) {
|
|
26
|
+
// Basic recursive copy fallback since fs.cpSync requires Node 16.7+
|
|
27
|
+
function copyDirSync(src, dest) {
|
|
28
|
+
if (!fs.existsSync(dest)) fs.mkdirSync(dest, { recursive: true });
|
|
29
|
+
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
30
|
+
for (let entry of entries) {
|
|
31
|
+
const srcPath = path.join(src, entry.name);
|
|
32
|
+
const destPath = path.join(dest, entry.name);
|
|
33
|
+
entry.isDirectory() ? copyDirSync(srcPath, destPath) : fs.copyFileSync(srcPath, destPath);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
copyDirSync(docsTemplatePath, docsDestPath);
|
|
37
|
+
console.log(`✅ Copied docs/ to ${docsDestPath}`);
|
|
38
|
+
}
|
|
39
|
+
|
|
21
40
|
// ── Write .cursorrules — instructs the AI agent exactly what to do ─────────
|
|
22
41
|
const cursorRulesPath = path.join(targetDir, '.cursorrules');
|
|
23
42
|
const cursorRulesContent = `You are an AI coding agent tasked with building a survey UI using @repo/sdk.
|
|
@@ -27,21 +46,15 @@ try {
|
|
|
27
46
|
RULE 0 — STRICT ISOLATION:
|
|
28
47
|
You are STRICTLY PROHIBITED from scanning, reading, or referencing any existing files
|
|
29
48
|
in this project (components, configs, styles, or any code) to derive decisions.
|
|
30
|
-
Your ONLY
|
|
31
|
-
|
|
32
|
-
RULE 1 — RUN THE LOCAL SETUP WIZARD FIRST:
|
|
33
|
-
You must run "npx cfm-sdk init" in a terminal panel. Tell the client:
|
|
34
|
-
"I am launching a premium interactive setup page in your browser. Please customize your survey preferences and logo there, then click Complete Setup."
|
|
35
|
-
Wait silently. Do NOT ask the client questions in chat or write survey-config.json manually.
|
|
36
|
-
|
|
37
|
-
RULE 2 — WAIT AND READ CONFIG FILE:
|
|
38
|
-
Wait for "npx cfm-sdk init" to finish execution (it will exit cleanly once the client clicks Complete Setup). Once it exits, immediately read the generated "./survey-config.json" from the root directory.
|
|
49
|
+
Your ONLY reference is the SDK documentation.
|
|
39
50
|
|
|
40
|
-
RULE
|
|
41
|
-
|
|
51
|
+
RULE 1 — READ THE MASTER INDEX:
|
|
52
|
+
Open and read \`node_modules/@explorer02/cfm-survey-sdk/docs/index.md\`.
|
|
53
|
+
It will orchestrate your entire workflow.
|
|
42
54
|
|
|
43
|
-
RULE
|
|
44
|
-
|
|
55
|
+
RULE 2 — WAIT FOR CLIENT INPUT:
|
|
56
|
+
The workflow requires 3 inputs from the client (Prompt, Instance ID, Deploy Confirmation).
|
|
57
|
+
Follow the phases in the master index strictly.
|
|
45
58
|
|
|
46
59
|
=== END OF CRITICAL INSTRUCTIONS ===
|
|
47
60
|
`;
|
|
@@ -58,13 +71,12 @@ Open ./AGENT.md and follow every phase in order. Do not skip, reorder, or improv
|
|
|
58
71
|
console.log('');
|
|
59
72
|
console.log(' 1. Open your AI coding agent (Cursor, GitHub Copilot, etc.)');
|
|
60
73
|
console.log(' 2. Start a new chat and say:');
|
|
61
|
-
console.log(' "
|
|
62
|
-
console.log(' and build survey"');
|
|
74
|
+
console.log(' "Build a survey using @explorer02/cfm-survey-sdk"');
|
|
63
75
|
console.log('');
|
|
64
76
|
console.log(' The agent will:');
|
|
65
|
-
console.log(' ✔
|
|
66
|
-
console.log(' ✔
|
|
67
|
-
console.log(' ✔ Build and deploy
|
|
77
|
+
console.log(' ✔ Read the master documentation index');
|
|
78
|
+
console.log(' ✔ Ask you for your Instance ID');
|
|
79
|
+
console.log(' ✔ Build the UI and ask to deploy to Vercel');
|
|
68
80
|
console.log('');
|
|
69
81
|
console.log('='.repeat(60) + '\n');
|
|
70
82
|
|