prompt-guide-cli 1.0.0

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.
Files changed (51) hide show
  1. package/README.md +79 -0
  2. package/ai/ai.config.yml +184 -0
  3. package/bin/cli.js +4 -0
  4. package/dist/cli.d.ts +2 -0
  5. package/dist/cli.d.ts.map +1 -0
  6. package/dist/cli.js +77 -0
  7. package/dist/cli.js.map +1 -0
  8. package/dist/commands/doctor.d.ts +12 -0
  9. package/dist/commands/doctor.d.ts.map +1 -0
  10. package/dist/commands/doctor.js +139 -0
  11. package/dist/commands/doctor.js.map +1 -0
  12. package/dist/commands/init.d.ts +7 -0
  13. package/dist/commands/init.d.ts.map +1 -0
  14. package/dist/commands/init.js +106 -0
  15. package/dist/commands/init.js.map +1 -0
  16. package/dist/lib/config.d.ts +3 -0
  17. package/dist/lib/config.d.ts.map +1 -0
  18. package/dist/lib/config.js +11 -0
  19. package/dist/lib/config.js.map +1 -0
  20. package/dist/lib/copy.d.ts +2 -0
  21. package/dist/lib/copy.d.ts.map +1 -0
  22. package/dist/lib/copy.js +17 -0
  23. package/dist/lib/copy.js.map +1 -0
  24. package/dist/lib/gitignore.d.ts +6 -0
  25. package/dist/lib/gitignore.d.ts.map +1 -0
  26. package/dist/lib/gitignore.js +101 -0
  27. package/dist/lib/gitignore.js.map +1 -0
  28. package/dist/lib/paths.d.ts +9 -0
  29. package/dist/lib/paths.d.ts.map +1 -0
  30. package/dist/lib/paths.js +30 -0
  31. package/dist/lib/paths.js.map +1 -0
  32. package/dist/lib/prompt.d.ts +3 -0
  33. package/dist/lib/prompt.d.ts.map +1 -0
  34. package/dist/lib/prompt.js +34 -0
  35. package/dist/lib/prompt.js.map +1 -0
  36. package/dist/schemas.d.ts +13 -0
  37. package/dist/schemas.d.ts.map +1 -0
  38. package/dist/schemas.js +11 -0
  39. package/dist/schemas.js.map +1 -0
  40. package/docs/CLI.md +217 -0
  41. package/docs/README.md +47 -0
  42. package/docs/request-guide.md +157 -0
  43. package/docs/review.md +34 -0
  44. package/docs/rules-by-platform.md +44 -0
  45. package/docs/system.core.md +54 -0
  46. package/docs/what-install.md +114 -0
  47. package/package.json +44 -0
  48. package/prompts/guide.template.yml +32 -0
  49. package/prompts/review.yml +28 -0
  50. package/prompts/rules.by-platform.yml +59 -0
  51. package/prompts/system.core.yml +49 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAMzE"}
@@ -0,0 +1,11 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ export function setPlatformInConfig(cwd, platform) {
4
+ const configPath = path.join(cwd, 'ai', 'ai.config.yml');
5
+ if (!fs.existsSync(configPath))
6
+ return;
7
+ let content = fs.readFileSync(configPath, 'utf8');
8
+ content = content.replace(/^platform:\s*(null|[\w-]+)/m, `platform: ${platform}`);
9
+ fs.writeFileSync(configPath, content);
10
+ }
11
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,MAAM,UAAU,mBAAmB,CAAC,GAAW,EAAE,QAAkB;IACjE,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,eAAe,CAAC,CAAC;IACzD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC;QAAE,OAAO;IACvC,IAAI,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAClD,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,6BAA6B,EAAE,aAAa,QAAQ,EAAE,CAAC,CAAC;IAClF,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AACxC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function copyRecursive(src: string, dest: string): void;
2
+ //# sourceMappingURL=copy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copy.d.ts","sourceRoot":"","sources":["../../src/lib/copy.ts"],"names":[],"mappings":"AAGA,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAW7D"}
@@ -0,0 +1,17 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ export function copyRecursive(src, dest) {
4
+ const stat = fs.statSync(src);
5
+ if (stat.isDirectory()) {
6
+ if (!fs.existsSync(dest))
7
+ fs.mkdirSync(dest, { recursive: true });
8
+ for (const name of fs.readdirSync(src)) {
9
+ copyRecursive(path.join(src, name), path.join(dest, name));
10
+ }
11
+ }
12
+ else {
13
+ fs.mkdirSync(path.dirname(dest), { recursive: true });
14
+ fs.copyFileSync(src, dest);
15
+ }
16
+ }
17
+ //# sourceMappingURL=copy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copy.js","sourceRoot":"","sources":["../../src/lib/copy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,UAAU,aAAa,CAAC,GAAW,EAAE,IAAY;IACrD,MAAM,IAAI,GAAG,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC9B,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;QACvB,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC;YAAE,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAClE,KAAK,MAAM,IAAI,IAAI,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC;YACvC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;SAAM,CAAC;QACN,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACtD,EAAE,CAAC,YAAY,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { Platform } from '../schemas.js';
2
+ export declare function getGitignoreForPlatform(platform: Platform): string;
3
+ export declare function mergeGitignore(cwd: string, platform: Platform): {
4
+ updated: boolean;
5
+ };
6
+ //# sourceMappingURL=gitignore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitignore.d.ts","sourceRoot":"","sources":["../../src/lib/gitignore.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAwF9C,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAElE;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAUpF"}
@@ -0,0 +1,101 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ const MARKER = '# prompt-guide (added by prompt-guide-cli)';
4
+ const COMMON = `# prompt-guide common
5
+ # OS
6
+ .DS_Store
7
+ Thumbs.db
8
+ # Editor / IDE
9
+ .idea/
10
+ *.swp
11
+ *.swo
12
+ *~
13
+ # Local env / secrets
14
+ .env
15
+ .env.*
16
+ !.env.example
17
+ # Local config overrides
18
+ ai/ai.config.local.yml
19
+ *.local.yml
20
+ # Logs / temp
21
+ *.log
22
+ tmp/
23
+ temp/
24
+ .cache/
25
+ # Dependencies
26
+ node_modules/
27
+ `;
28
+ const BY_PLATFORM = {
29
+ ios: `# prompt-guide (iOS)
30
+ # Xcode / CocoaPods
31
+ Pods/
32
+ build/
33
+ DerivedData/
34
+ *.xcworkspace/xcuserdata/
35
+ *.xcodeproj/xcuserdata/
36
+ *.xcodeproj/project.xcworkspace/xcuserdata/
37
+ Carthage/Build/
38
+ `,
39
+ android: `# prompt-guide (Android)
40
+ # Gradle / Android
41
+ build/
42
+ .gradle/
43
+ local.properties
44
+ *.iml
45
+ .cxx/
46
+ capture/
47
+ `,
48
+ flutter: `# prompt-guide (Flutter)
49
+ # Dart / Flutter
50
+ .dart_tool/
51
+ .packages
52
+ build/
53
+ .flutter-plugins
54
+ .flutter-plugins-dependencies
55
+ *.iml
56
+ `,
57
+ web: `# prompt-guide (Web)
58
+ # Build output
59
+ dist/
60
+ .next/
61
+ out/
62
+ .nuxt/
63
+ .output/
64
+ .vuepress/dist
65
+ .parcel-cache/
66
+ .vite/
67
+ *.local
68
+ `,
69
+ server: `# prompt-guide (Server)
70
+ # Python
71
+ venv/
72
+ .venv/
73
+ __pycache__/
74
+ *.py[cod]
75
+ .pytest_cache/
76
+ .mypy_cache/
77
+ # Go
78
+ vendor/
79
+ # Rust
80
+ target/
81
+ # Terraform
82
+ .terraform/
83
+ *.tfstate*
84
+ `,
85
+ };
86
+ export function getGitignoreForPlatform(platform) {
87
+ return `${MARKER}\n${COMMON}\n${BY_PLATFORM[platform]}`;
88
+ }
89
+ export function mergeGitignore(cwd, platform) {
90
+ const gitignorePath = path.join(cwd, '.gitignore');
91
+ let existing = '';
92
+ if (fs.existsSync(gitignorePath)) {
93
+ existing = fs.readFileSync(gitignorePath, 'utf8');
94
+ if (existing.includes(MARKER))
95
+ return { updated: false };
96
+ existing = existing.trimEnd() + '\n\n';
97
+ }
98
+ fs.writeFileSync(gitignorePath, existing + getGitignoreForPlatform(platform));
99
+ return { updated: true };
100
+ }
101
+ //# sourceMappingURL=gitignore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitignore.js","sourceRoot":"","sources":["../../src/lib/gitignore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,MAAM,MAAM,GAAG,4CAA4C,CAAC;AAE5D,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;CAuBd,CAAC;AAEF,MAAM,WAAW,GAA6B;IAC5C,GAAG,EAAE;;;;;;;;;CASN;IACC,OAAO,EAAE;;;;;;;;CAQV;IACC,OAAO,EAAE;;;;;;;;CAQV;IACC,GAAG,EAAE;;;;;;;;;;;CAWN;IACC,MAAM,EAAE;;;;;;;;;;;;;;;CAeT;CACA,CAAC;AAEF,MAAM,UAAU,uBAAuB,CAAC,QAAkB;IACxD,OAAO,GAAG,MAAM,KAAK,MAAM,KAAK,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,GAAW,EAAE,QAAkB;IAC5D,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;IACnD,IAAI,QAAQ,GAAG,EAAE,CAAC;IAClB,IAAI,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;QACjC,QAAQ,GAAG,EAAE,CAAC,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QAClD,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC;YAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QACzD,QAAQ,GAAG,QAAQ,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC;IACzC,CAAC;IACD,EAAE,CAAC,aAAa,CAAC,aAAa,EAAE,QAAQ,GAAG,uBAAuB,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC9E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC3B,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Directory that contains ai/, prompts/, docs/.
3
+ * - In repo: repo root (./ai, ./docs, ./prompts).
4
+ * - When published: package root has ai/, docs/, prompts/ (copied by prepublishOnly).
5
+ */
6
+ export declare function getTemplatesDir(): string;
7
+ /** CLI version from package.json. */
8
+ export declare function getVersion(): string;
9
+ //# sourceMappingURL=paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/lib/paths.ts"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAGxC;AAED,qCAAqC;AACrC,wBAAgB,UAAU,IAAI,MAAM,CAQnC"}
@@ -0,0 +1,30 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
5
+ /** CLI package root (cli/). */
6
+ const pkgRoot = path.join(__dirname, '..', '..');
7
+ /** Repo root (prompt-guide/). */
8
+ const repoRoot = path.join(pkgRoot, '..');
9
+ /**
10
+ * Directory that contains ai/, prompts/, docs/.
11
+ * - In repo: repo root (./ai, ./docs, ./prompts).
12
+ * - When published: package root has ai/, docs/, prompts/ (copied by prepublishOnly).
13
+ */
14
+ export function getTemplatesDir() {
15
+ if (fs.existsSync(path.join(pkgRoot, 'ai')))
16
+ return pkgRoot;
17
+ return repoRoot;
18
+ }
19
+ /** CLI version from package.json. */
20
+ export function getVersion() {
21
+ const pkgPath = path.join(pkgRoot, 'package.json');
22
+ try {
23
+ const json = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
24
+ return typeof json.version === 'string' ? json.version : '1.0.0';
25
+ }
26
+ catch {
27
+ return '1.0.0';
28
+ }
29
+ }
30
+ //# sourceMappingURL=paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/lib/paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE/D,+BAA+B;AAC/B,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAEjD,iCAAiC;AACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AAE1C;;;;GAIG;AACH,MAAM,UAAU,eAAe;IAC7B,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAAE,OAAO,OAAO,CAAC;IAC5D,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,qCAAqC;AACrC,MAAM,UAAU,UAAU;IACxB,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IACnD,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;QAC1D,OAAO,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IACnE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,OAAO,CAAC;IACjB,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type Platform } from '../schemas.js';
2
+ export declare function askPlatform(): Promise<Platform>;
3
+ //# sourceMappingURL=prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/lib/prompt.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAUzD,wBAAgB,WAAW,IAAI,OAAO,CAAC,QAAQ,CAAC,CAwB/C"}
@@ -0,0 +1,34 @@
1
+ import readline from 'node:readline';
2
+ import chalk from 'chalk';
3
+ import { PLATFORMS } from '../schemas.js';
4
+ const BY_NUM = {
5
+ '1': 'ios',
6
+ '2': 'android',
7
+ '3': 'flutter',
8
+ '4': 'web',
9
+ '5': 'server',
10
+ };
11
+ export function askPlatform() {
12
+ return new Promise((resolve) => {
13
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
14
+ console.log(chalk.dim('\n Platform:') +
15
+ ' ' +
16
+ chalk.cyan('1') +
17
+ '=ios ' +
18
+ chalk.cyan('2') +
19
+ '=android ' +
20
+ chalk.cyan('3') +
21
+ '=flutter ' +
22
+ chalk.cyan('4') +
23
+ '=web ' +
24
+ chalk.cyan('5') +
25
+ '=server');
26
+ rl.question(chalk.dim(' Choose (1–5 or name) ') + chalk.yellow('[1]') + chalk.dim(': '), (answer) => {
27
+ rl.close();
28
+ const trimmed = (answer || '1').trim().toLowerCase();
29
+ const chosen = BY_NUM[trimmed] ?? (PLATFORMS.includes(trimmed) ? trimmed : 'ios');
30
+ resolve(chosen);
31
+ });
32
+ });
33
+ }
34
+ //# sourceMappingURL=prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/lib/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,eAAe,CAAC;AACrC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAiB,MAAM,eAAe,CAAC;AAEzD,MAAM,MAAM,GAA6B;IACvC,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,QAAQ;CACd,CAAC;AAEF,MAAM,UAAU,WAAW;IACzB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,EAAE,GAAG,QAAQ,CAAC,eAAe,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QACtF,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC;YACxB,GAAG;YACH,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;YACf,OAAO;YACP,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;YACf,WAAW;YACX,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;YACf,WAAW;YACX,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;YACf,OAAO;YACP,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC;YACf,SAAS,CACZ,CAAC;QACF,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,yBAAyB,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE;YACnG,EAAE,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,OAAO,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;YACrD,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAmB,CAAC,CAAC,CAAC,CAAE,OAAoB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YAC5G,OAAO,CAAC,MAAM,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ export declare const PLATFORMS: readonly ["ios", "android", "flutter", "web", "server"];
3
+ export declare const platformSchema: z.ZodEnum<["ios", "android", "flutter", "web", "server"]>;
4
+ export type Platform = z.infer<typeof platformSchema>;
5
+ export declare const initOptionsSchema: z.ZodObject<{
6
+ platform: z.ZodOptional<z.ZodEnum<["ios", "android", "flutter", "web", "server"]>>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ platform?: "ios" | "android" | "flutter" | "web" | "server" | undefined;
9
+ }, {
10
+ platform?: "ios" | "android" | "flutter" | "web" | "server" | undefined;
11
+ }>;
12
+ export type InitOptions = z.infer<typeof initOptionsSchema>;
13
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,SAAS,yDAA0D,CAAC;AAEjF,eAAO,MAAM,cAAc,2DAIzB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,eAAO,MAAM,iBAAiB;;;;;;EAE5B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+ export const PLATFORMS = ['ios', 'android', 'flutter', 'web', 'server'];
3
+ export const platformSchema = z.enum(PLATFORMS, {
4
+ errorMap: () => ({
5
+ message: `Platform must be one of: ${PLATFORMS.join(', ')}`,
6
+ }),
7
+ });
8
+ export const initOptionsSchema = z.object({
9
+ platform: platformSchema.optional(),
10
+ });
11
+ //# sourceMappingURL=schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,CAAU,CAAC;AAEjF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE;IAC9C,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC;QACf,OAAO,EAAE,4BAA4B,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;KAC5D,CAAC;CACH,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,QAAQ,EAAE,cAAc,CAAC,QAAQ,EAAE;CACpC,CAAC,CAAC"}
package/docs/CLI.md ADDED
@@ -0,0 +1,217 @@
1
+ # CLI usage guide
2
+
3
+ The Prompt Guide CLI installs `ai/`, `prompts/`, and `docs/` in your project and configures platform-specific `.gitignore`. It also provides a `doctor` command to check that setup.
4
+
5
+ ---
6
+
7
+ ## Table of contents
8
+
9
+ - [How to run](#how-to-run)
10
+ - [Global options](#global-options)
11
+ - [init — Initialize project](#init--initialize-project)
12
+ - [doctor — Check and fix setup](#doctor--check-and-fix-setup)
13
+ - [Errors and exit codes](#errors-and-exit-codes)
14
+
15
+ ---
16
+
17
+ ## How to run
18
+
19
+ ### 1. Global install (recommended)
20
+
21
+ Install once and run from any directory:
22
+
23
+ ```bash
24
+ npm install -g prompt-guide-cli
25
+ prompt-guide # Help and banner
26
+ prompt-guide init # Interactive init
27
+ prompt-guide init -p web # Init with web platform
28
+ prompt-guide doctor # Check setup
29
+ ```
30
+
31
+ You do not need to add the package to your project’s `package.json`.
32
+
33
+ ### 2. npx (one-off)
34
+
35
+ Run the latest version without a global install:
36
+
37
+ ```bash
38
+ npx prompt-guide-cli init
39
+ npx prompt-guide-cli init --platform=ios
40
+ npx prompt-guide-cli doctor --fix
41
+ ```
42
+
43
+ ### 3. From this repo (development)
44
+
45
+ From the **repository root**:
46
+
47
+ ```bash
48
+ npm install # Install workspace deps
49
+ npm run build # Build CLI (cli/)
50
+ npm run cli # Print help (node cli/bin/cli.js)
51
+ npm run init # Run init interactively
52
+ npm run cli -- init -p web # Init with a specific platform
53
+ npm run cli -- init --dry-run # Show what would be done
54
+ npm run cli -- doctor # Check
55
+ npm run cli -- doctor --fix # Fix .gitignore
56
+ npm run cli -- doctor -v # Verbose
57
+ ```
58
+
59
+ Arguments after `--` are passed through to the CLI.
60
+
61
+ ---
62
+
63
+ ## Global options
64
+
65
+ Available for every command.
66
+
67
+ | Option | Description |
68
+ |--------|-------------|
69
+ | `-v`, `--verbose` | Extra output. For init: template path; for doctor: always show hints for failed items. |
70
+ | `-V`, `--version` | Print CLI version. |
71
+ | `-h`, `--help` | Print help for the command. |
72
+
73
+ Example:
74
+
75
+ ```bash
76
+ prompt-guide init -p flutter -v
77
+ prompt-guide doctor -v
78
+ prompt-guide --help
79
+ prompt-guide init --help
80
+ ```
81
+
82
+ ---
83
+
84
+ ## init — Initialize project
85
+
86
+ Installs Prompt Guide in the current directory.
87
+
88
+ ### Usage
89
+
90
+ ```bash
91
+ prompt-guide init [options]
92
+ ```
93
+
94
+ ### Options
95
+
96
+ | Option | Short | Description |
97
+ |--------|-------|-------------|
98
+ | `--platform <platform>` | `-p` | Platform. If omitted, chosen interactively (1–5 or name). |
99
+ | `--dry-run` | — | Do not write files; only print what would be done. |
100
+ | `-y`, `--yes` | — | Non-interactive: use default platform (web) when `--platform` is omitted. |
101
+
102
+ ### Supported platforms
103
+
104
+ `ios` | `android` | `flutter` | `web` | `server`
105
+
106
+ - **ios**: iOS (Swift/SwiftUI). Adds `ios/**`, `*.xcodeproj/**`, etc. to context and Xcode-related patterns to `.gitignore`.
107
+ - **android**: Android (Kotlin/Java). Adds `android/**`, `app/**`, etc. and Gradle/build dirs to ignore.
108
+ - **flutter**: Flutter (Dart). Adds `lib/**`, `test/**`, `pubspec.yaml`, etc. and Dart/Flutter build and cache to ignore.
109
+ - **web**: Web (JS/TS, React/Vue, etc.). Adds `src/**`, `public/**`, `*.config.js`, etc. and `dist/`, `.next/`, `.vite/`, etc. to ignore.
110
+ - **server**: Server (Node/Go/Rust/Python, etc.). Adds `src/**`, `lib/**`, `cmd/**`, etc. and `venv/`, `node_modules/`, `target/`, etc. to ignore.
111
+
112
+ ### What init does
113
+
114
+ 1. **Choose platform** — If `-p`/`--platform` is not set, prompts in the terminal (1–5 or name). With `-y`, uses default (web).
115
+ 2. **Copy directories** — Copies `ai/`, `prompts/`, `docs/` from templates into the current directory.
116
+ 3. **Update config** — Sets `platform` in `ai/ai.config.yml` to the chosen platform.
117
+ 4. **.gitignore** — Appends a prompt-guide block (common + platform-specific) to `.gitignore`, or creates it if missing.
118
+
119
+ If `ai/`, `prompts/`, or `docs/` already exist, init **overwrites** them and prints a warning.
120
+
121
+ ### Examples
122
+
123
+ ```bash
124
+ # Interactive: choose platform in terminal
125
+ prompt-guide init
126
+
127
+ # Specify platform
128
+ prompt-guide init --platform=ios
129
+ prompt-guide init -p web
130
+ prompt-guide init -p server
131
+
132
+ # Non-interactive (default platform: web)
133
+ prompt-guide init -y
134
+
135
+ # Show planned actions only
136
+ prompt-guide init -p flutter --dry-run
137
+
138
+ # Verbose
139
+ prompt-guide init -p android -v
140
+ ```
141
+
142
+ ### Notes
143
+
144
+ - **Existing `ai/`, `prompts/`, `docs/`** — Init overwrites them. Back up or copy files manually if you have local changes.
145
+ - **Templates not found** — Reinstall the CLI or, when running from this repo, run `npm run build` and ensure `ai/`, `prompts/`, `docs/` exist under `cli/`.
146
+
147
+ ---
148
+
149
+ ## doctor — Check and fix setup
150
+
151
+ Checks that the Prompt Guide layout and config are valid.
152
+ The `--fix` option **creates or appends** the prompt-guide block in `.gitignore` when it’s missing.
153
+
154
+ ### Usage
155
+
156
+ ```bash
157
+ prompt-guide doctor [options]
158
+ ```
159
+
160
+ ### Options
161
+
162
+ | Option | Description |
163
+ |--------|-------------|
164
+ | `--fix` | Create or append the prompt-guide block in `.gitignore` when missing. Uses `platform` from `ai/ai.config.yml` (default `web`). |
165
+ | `--json` | Output results as JSON (for scripting). |
166
+
167
+ ### Checks
168
+
169
+ | Check | Pass condition | On failure |
170
+ |-------|-----------------|------------|
171
+ | **ai/** | `ai/` exists | Run `prompt-guide init` |
172
+ | **ai/ai.config.yml** | File exists and contains `platform:` and `context:` | Run `prompt-guide init` or add those keys |
173
+ | **prompts/** | `prompts/` exists | Run `prompt-guide init` |
174
+ | **docs/** | `docs/` exists | Run `prompt-guide init` |
175
+ | **.gitignore** | File exists and contains `# prompt-guide (added by prompt-guide-cli)` | Run `prompt-guide doctor --fix` or `prompt-guide init` |
176
+
177
+ ### Examples
178
+
179
+ ```bash
180
+ # Check only
181
+ prompt-guide doctor
182
+
183
+ # Fix .gitignore if needed
184
+ prompt-guide doctor --fix
185
+
186
+ # Verbose
187
+ prompt-guide doctor -v
188
+ prompt-guide doctor --fix -v
189
+
190
+ # JSON output
191
+ prompt-guide doctor --json
192
+ ```
193
+
194
+ ### doctor --fix behavior
195
+
196
+ - **No .gitignore** — Creates a new `.gitignore` with the prompt-guide block (common + platform from config).
197
+ - **.gitignore exists but no block** — Appends the block. If the block is already present, nothing is done.
198
+
199
+ Useful when you only need to fix `.gitignore` without re-running init.
200
+
201
+ ---
202
+
203
+ ## Errors and exit codes
204
+
205
+ | Situation | Exit code | Example message |
206
+ |-----------|-----------|-----------------|
207
+ | Success | 0 | — |
208
+ | init failure (templates missing, invalid platform, etc.) | 1 | `✗ Templates not found. ...` / `✗ Platform must be one of: ...` |
209
+ | doctor failed (one or more checks failed) | 1 | `✗` items printed, then “Fix the items above, or run doctor --fix ...” |
210
+ | doctor all passed | 0 | “All checks passed.” |
211
+
212
+ ---
213
+
214
+ ## Next steps
215
+
216
+ - **After install**: Edit `ai/ai.config.yml` (e.g. `model.default`, `context.include`) for your project. See the main [README Configuration Reference](../README.md#configuration-reference) and [what-install.md](what-install.md).
217
+ - **Rule summaries**: See `docs/system.core.md`, `docs/review.md`, and `docs/rules-by-platform.md` for human-readable rule summaries.
package/docs/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # Prompt Guide — Docs index
2
+
3
+ This directory contains documentation for **setup, configuration, and rules**.
4
+ YAML config lives in `ai/ai.config.yml`; the actual rule text used for injection is in `prompts/*.yml`.
5
+ Here we provide **human-readable summaries** and **CLI/feature documentation**.
6
+
7
+ ---
8
+
9
+ ## Document list
10
+
11
+ | Document | Audience | Content |
12
+ |----------|----------|---------|
13
+ | **[CLI.md](CLI.md)** | Users, developers | How to run the CLI, `init` / `doctor` commands and options, examples, errors and exit codes. |
14
+ | **[what-install.md](what-install.md)** | Users, maintainers | What each part (CLI, config, presets, platforms) **adds** and **what to change later**. |
15
+ | **[request-guide.md](request-guide.md)** | Developers | **How to write request lists**: per-preset tips, guide.template fields, spec/ticket writing, examples. |
16
+ | **[system.core.md](system.core.md)** | Developers, reviewers | Core rules summary (role, code quality, security, errors, docs, collaboration). Source: `prompts/system.core.yml`. |
17
+ | **[review.md](review.md)** | Reviewers | Code review scope, checklist, output format, conclusion rules. Source: `prompts/review.yml`. |
18
+ | **[rules-by-platform.md](rules-by-platform.md)** | Platform developers | Per-platform rule summaries (iOS, Android, Flutter, Web, Server). Source: `prompts/rules.by-platform.yml`. |
19
+
20
+ ---
21
+
22
+ ## Suggested reading order
23
+
24
+ 1. **First-time setup**
25
+ [CLI.md](CLI.md) → [what-install.md](what-install.md) (sections 1, 2, 6, 7)
26
+
27
+ 2. **When asking the AI to do work**
28
+ [request-guide.md](request-guide.md) (request principles, per-preset tips, template/spec examples)
29
+
30
+ 3. **Day-to-day development and review**
31
+ [system.core.md](system.core.md), [review.md](review.md), [rules-by-platform.md](rules-by-platform.md)
32
+
33
+ 4. **Changing config or adding presets/platforms**
34
+ [what-install.md](what-install.md) (sections 2–6)
35
+
36
+ ---
37
+
38
+ ## YAML source mapping
39
+
40
+ | Markdown doc | YAML source | Key used by tools |
41
+ |--------------|-------------|-------------------|
42
+ | system.core.md | prompts/system.core.yml | `prompt` |
43
+ | review.md | prompts/review.yml | `prompt` |
44
+ | rules-by-platform.md | prompts/rules.by-platform.yml | `platforms.<name>.prompt` |
45
+
46
+ Tools read the corresponding key from the YAML and inject it as system role / prompt.
47
+ The Markdown docs are **human-friendly summaries** of the same content.