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
package/README.md ADDED
@@ -0,0 +1,79 @@
1
+ # prompt-guide-cli
2
+
3
+ Set up prompt-guide in **any directory** with one command — no project config required. Install globally on macOS (or any system with Node) and run `prompt-guide init` from anywhere.
4
+
5
+ Built with **Commander**, **Zod**, and **TypeScript**.
6
+
7
+ ---
8
+
9
+ ## Install globally (macOS / any Node host)
10
+
11
+ ```bash
12
+ npm i -g prompt-guide-cli
13
+ ```
14
+
15
+ Then from **any directory** (your app, monorepo, new folder):
16
+
17
+ ```bash
18
+ prompt-guide init
19
+ # or with platform
20
+ prompt-guide init --platform=ios
21
+ prompt-guide init -p flutter
22
+ ```
23
+
24
+ No need to add the package to your project’s `package.json` or use `npx` in each repo.
25
+
26
+ ---
27
+
28
+ ## Publish to npm (maintainer)
29
+
30
+ From the **prompt-guide** repo root:
31
+
32
+ ```bash
33
+ cd cli
34
+ npm install
35
+ npm run build # optional: prepublishOnly will run this
36
+ npm publish # runs copy-templates + build, then publishes
37
+ ```
38
+
39
+ Or from repo root with workspaces:
40
+
41
+ ```bash
42
+ npm run build -w prompt-guide-cli
43
+ cd cli && npm publish
44
+ ```
45
+
46
+ - **prepublishOnly** copies repo root `ai/`, `docs/`, `prompts/` into `cli/` and runs `tsc`, so the tarball includes everything needed.
47
+ - **files** in package.json: only `bin`, `dist`, `ai`, `docs`, `prompts` are published (no `src/`, `scripts/`, etc.).
48
+
49
+ ---
50
+
51
+ ## Commands
52
+
53
+ ### `init` — Set up prompt-guide in the current directory
54
+
55
+ - Copies `ai/`, `prompts/`, `docs/` into the current directory.
56
+ - Sets **platform** in `ai/ai.config.yml` (ios | android | flutter | web | server).
57
+ - Appends platform-specific `.gitignore` entries.
58
+
59
+ **Interactive:** `prompt-guide init`
60
+ **Non-interactive:** `prompt-guide init --platform=ios` (or `-p ios`)
61
+
62
+ Then edit `ai/ai.config.yml` to adjust `context.include` for your repo.
63
+
64
+ ---
65
+
66
+ ## What gets created
67
+
68
+ | Path | Description |
69
+ |------|-------------|
70
+ | `ai/ai.config.yml` | Base config with `platform` set. |
71
+ | `prompts/*.yml` | system.core, review, rules.by-platform, guide.template. |
72
+ | `docs/*.md` | Human-readable rule summaries. |
73
+ | `.gitignore` | Appended block (platform-specific + common). |
74
+
75
+ ---
76
+
77
+ ## License
78
+
79
+ MIT.
@@ -0,0 +1,184 @@
1
+ # ============================================================
2
+ # Base config: model, context, rules, task presets, system role
3
+ # ============================================================
4
+
5
+ ai:
6
+ root: ai/
7
+
8
+ # ---------------------------------------------------------------------------
9
+ # Model (global default; presets can override)
10
+ # ---------------------------------------------------------------------------
11
+ model:
12
+ default: claude-sonnet-4 # e.g. claude-sonnet-4, gpt-4o, gpt-4o-mini — use your tool's model id
13
+ # Optional: list available models for this project (for UI or validation)
14
+ options:
15
+ - claude-sonnet-4
16
+ - claude-opus-4
17
+ - gpt-4o
18
+ - gpt-4o-mini
19
+
20
+ # ---------------------------------------------------------------------------
21
+ # Context Scope (security + accuracy)
22
+ # ---------------------------------------------------------------------------
23
+ context:
24
+ # Allow-list: only these paths are eligible for context (adjust when forking)
25
+ include:
26
+ - src/**
27
+ - lib/**
28
+ - app/**
29
+ - packages/**
30
+ # Deny-list: never send to model (security + reduce noise for accuracy)
31
+ exclude:
32
+ # Security: never include secrets or credentials
33
+ - "**/.env"
34
+ - "**/.env.*"
35
+ - "**/.env.local"
36
+ - "**/secrets/**"
37
+ - "**/*secret*"
38
+ - "**/*credentials*"
39
+ - "**/*.pem"
40
+ - "**/*.key"
41
+ - "**/GoogleService-Info.plist"
42
+ - "**/keystore*"
43
+ - "**/.npmrc"
44
+ - "**/.netrc"
45
+ # Build/cache: not useful for reasoning
46
+ - "**/node_modules/**"
47
+ - "**/dist/**"
48
+ - "**/build/**"
49
+ - "**/.next/**"
50
+ - "**/out/**"
51
+ - "**/.git/**"
52
+ - "**/.cache/**"
53
+ - "**/vendor/**"
54
+ max_files: 50
55
+ max_tokens: 8000
56
+
57
+ # ---------------------------------------------------------------------------
58
+ # System Role (connected to default prompt)
59
+ # ---------------------------------------------------------------------------
60
+ system_role: prompts/system.core.yml
61
+
62
+ # ---------------------------------------------------------------------------
63
+ # Prompts (default = system role; review = review preset)
64
+ # ---------------------------------------------------------------------------
65
+ prompts:
66
+ default: prompts/system.core.yml
67
+ review: prompts/review.yml
68
+
69
+ # ---------------------------------------------------------------------------
70
+ # Task Presets (agent-style: pick preset → load prompt + behavior)
71
+ # ---------------------------------------------------------------------------
72
+ task_presets:
73
+ default:
74
+ description: "General coding and editing with full system rules"
75
+ prompt: prompts/system.core.yml
76
+ context_scope: default
77
+ # model: optional override; omit to use model.default
78
+ review:
79
+ description: "Code review with checklist and approval criteria"
80
+ prompt: prompts/review.yml
81
+ context_scope: default
82
+ model: claude-sonnet-4 # optional: e.g. use stronger model for review
83
+ refactor:
84
+ description: "Refactor with style and structure rules only"
85
+ prompt: prompts/system.core.yml
86
+ rules_extra:
87
+ - "Change behavior only when explicitly requested; preserve semantics."
88
+ - "Prefer small, incremental steps; one logical change per step."
89
+ implement:
90
+ description: "Implement a feature from spec or ticket"
91
+ prompt: prompts/system.core.yml
92
+ rules_extra:
93
+ - "Implement exactly what is specified; do not add out-of-scope features."
94
+ - "Add tests or test plan for new behavior."
95
+ fix_bug:
96
+ description: "Locate and fix a bug with minimal change"
97
+ prompt: prompts/system.core.yml
98
+ rules_extra:
99
+ - "Identify root cause before changing code."
100
+ - "Minimal diff; no refactors unless required for the fix."
101
+ security_audit:
102
+ description: "Security-focused review (secrets, injection, validation)"
103
+ prompt: prompts/review.yml
104
+ model: claude-sonnet-4 # optional: e.g. prefer same or different model for audits
105
+ rules_extra:
106
+ - "Focus only on: secrets in code, input validation, auth boundaries, sensitive data in logs."
107
+
108
+ # ---------------------------------------------------------------------------
109
+ # Platform-specific settings (merge with base when platform is selected)
110
+ # Set top-level "platform: ios" (or env) to activate; then context + rules merge from below
111
+ # ---------------------------------------------------------------------------
112
+ platform: null # active platform: ios | android | flutter | web | server (null = no override)
113
+
114
+ platforms:
115
+ ios:
116
+ label: iOS
117
+ context:
118
+ include:
119
+ - ios/**
120
+ - "*.xcodeproj/**"
121
+ - "*.xcworkspace/**"
122
+ - Shared/**
123
+ - src/**
124
+ # model.default: optional override
125
+ rules_key: ios # merge prompt from prompts/rules.by-platform.yml → platforms.ios (+ common)
126
+
127
+ android:
128
+ label: Android
129
+ context:
130
+ include:
131
+ - android/**
132
+ - app/**
133
+ - lib/**
134
+ - src/**
135
+ rules_key: android
136
+
137
+ flutter:
138
+ label: Flutter
139
+ context:
140
+ include:
141
+ - lib/**
142
+ - ios/**
143
+ - android/**
144
+ - test/**
145
+ - pubspec.yaml
146
+ rules_key: flutter
147
+
148
+ web:
149
+ label: Web
150
+ context:
151
+ include:
152
+ - src/**
153
+ - public/**
154
+ - app/**
155
+ - "*.config.js"
156
+ - "*.config.ts"
157
+ rules_key: web
158
+
159
+ server:
160
+ label: Server
161
+ context:
162
+ include:
163
+ - src/**
164
+ - lib/**
165
+ - app/**
166
+ - internal/**
167
+ - cmd/**
168
+ rules_key: server
169
+
170
+ # ---------------------------------------------------------------------------
171
+ # Rules (strict; enforced for all presets unless overridden)
172
+ # ---------------------------------------------------------------------------
173
+ rules:
174
+ # Behavior
175
+ no_auto_scan: true
176
+ deterministic: true
177
+ strict: true
178
+ # Security & accuracy
179
+ no_hallucination: true
180
+ cite_sources: true
181
+ require_file_refs: true
182
+ # Scope
183
+ stay_in_scope: true
184
+ no_unsolicited_changes: true
package/bin/cli.js ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+
3
+ process.env.FORCE_COLOR = process.env.FORCE_COLOR || '1';
4
+ await import('../dist/cli.js');
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
package/dist/cli.js ADDED
@@ -0,0 +1,77 @@
1
+ import { Command } from 'commander';
2
+ import chalk from 'chalk';
3
+ import figlet from 'figlet';
4
+ import { runInit } from './commands/init.js';
5
+ import { runDoctor, printDoctorResults } from './commands/doctor.js';
6
+ import { platformSchema, PLATFORMS } from './schemas.js';
7
+ import { getVersion } from './lib/paths.js';
8
+ function getBanner() {
9
+ const opts = { font: 'Slant', horizontalLayout: 'fitted' };
10
+ const promptArt = figlet.textSync('Prompt', opts);
11
+ const guideArt = figlet.textSync('Guide', opts);
12
+ const blue = chalk.blue;
13
+ return blue(promptArt) + '\n' + blue(guideArt);
14
+ }
15
+ const program = new Command();
16
+ program
17
+ .name('prompt-guide')
18
+ .description('Prompt Guide — set up in your project: pick platform, copy config, set .gitignore')
19
+ .version(getVersion())
20
+ .option('-v, --verbose', 'Show extra details');
21
+ program.addHelpText('before', getBanner() + '\n' + chalk.dim(' Set up prompt rules and AI config in your repo.\n\n'));
22
+ program
23
+ .command('init')
24
+ .description('Initialize prompt-guide in the current directory')
25
+ .option('-p, --platform <platform>', `Platform: ${PLATFORMS.join(' | ')} (omit for interactive)`, (value) => {
26
+ const result = platformSchema.safeParse(value?.toLowerCase());
27
+ if (!result.success) {
28
+ throw new Error(result.error.errors.map((e) => e.message).join('; '));
29
+ }
30
+ return result.data;
31
+ })
32
+ .option('--dry-run', 'Show what would be done without writing files')
33
+ .option('-y, --yes', 'Non-interactive: use default platform (web) when --platform is omitted')
34
+ .action(async (opts) => {
35
+ try {
36
+ const globalOpts = program.opts();
37
+ await runInit(opts.platform, {
38
+ dryRun: opts.dryRun,
39
+ verbose: globalOpts.verbose,
40
+ yes: opts.yes,
41
+ });
42
+ }
43
+ catch (err) {
44
+ const message = err instanceof Error ? err.message : String(err);
45
+ console.error(chalk.red(' ✗'), message);
46
+ process.exit(1);
47
+ }
48
+ });
49
+ program
50
+ .command('doctor')
51
+ .description('Check prompt-guide setup (ai/, config, prompts/, docs/, .gitignore)')
52
+ .option('--fix', 'Append .gitignore block if missing')
53
+ .option('--json', 'Output results as JSON (for scripting)')
54
+ .action((opts) => {
55
+ const globalOpts = program.opts();
56
+ const { results, allOk, fixed } = runDoctor(process.cwd(), globalOpts.verbose, opts.fix ?? false);
57
+ printDoctorResults(results, allOk, globalOpts.verbose, fixed, opts.json ?? false);
58
+ process.exit(allOk ? 0 : 1);
59
+ });
60
+ program.addHelpText('after', `
61
+
62
+ Examples:
63
+ ${chalk.cyan('npx prompt-guide-cli init')} Interactive: asks for platform
64
+ ${chalk.cyan('npx prompt-guide-cli init -y')} Non-interactive (default: web)
65
+ ${chalk.cyan('npx prompt-guide-cli init --platform=ios')}
66
+ ${chalk.cyan('npx prompt-guide-cli init -p flutter --dry-run')}
67
+ ${chalk.cyan('npx prompt-guide-cli doctor')} Check setup health
68
+ ${chalk.cyan('npx prompt-guide-cli doctor --fix')} Auto-fix .gitignore
69
+ ${chalk.cyan('npx prompt-guide-cli doctor --json')} JSON output for scripting
70
+
71
+ What init does:
72
+ · Copies ai/, prompts/, docs/ into the current directory
73
+ · Sets platform in ai/ai.config.yml
74
+ · Appends recommended .gitignore entries
75
+ `);
76
+ program.parse();
77
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,sBAA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KAAK,EAAE,GAAG,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,CAAC;IAClG,kBAAkB,CAAC,OAAO,EAAE,KAAK,EAAE,UAAU,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,IAAI,KAAK,CAAC,CAAC;IAClF,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9B,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,WAAW,CACjB,OAAO,EACP;;;IAGE,KAAK,CAAC,IAAI,CAAC,2BAA2B,CAAC;IACvC,KAAK,CAAC,IAAI,CAAC,8BAA8B,CAAC;IAC1C,KAAK,CAAC,IAAI,CAAC,0CAA0C,CAAC;IACtD,KAAK,CAAC,IAAI,CAAC,gDAAgD,CAAC;IAC5D,KAAK,CAAC,IAAI,CAAC,6BAA6B,CAAC;IACzC,KAAK,CAAC,IAAI,CAAC,mCAAmC,CAAC;IAC/C,KAAK,CAAC,IAAI,CAAC,oCAAoC,CAAC;;;;;;CAMnD,CACA,CAAC;AAEF,OAAO,CAAC,KAAK,EAAE,CAAC"}
@@ -0,0 +1,12 @@
1
+ export type DoctorResult = {
2
+ ok: boolean;
3
+ message: string;
4
+ hint?: string;
5
+ };
6
+ export declare function runDoctor(cwd: string, verbose: boolean, fix: boolean): {
7
+ results: DoctorResult[];
8
+ allOk: boolean;
9
+ fixed: string[];
10
+ };
11
+ export declare function printDoctorResults(results: DoctorResult[], allOk: boolean, verbose: boolean, fixed?: string[], json?: boolean): void;
12
+ //# sourceMappingURL=doctor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAWA,MAAM,MAAM,YAAY,GAAG;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAW3E,wBAAgB,SAAS,CACvB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,OAAO,GACX;IAAE,OAAO,EAAE,YAAY,EAAE,CAAC;IAAC,KAAK,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAuF9D;AAED,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,YAAY,EAAE,EACvB,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,OAAO,EAChB,KAAK,GAAE,MAAM,EAAO,EACpB,IAAI,UAAQ,GACX,IAAI,CA2BN"}
@@ -0,0 +1,139 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import chalk from 'chalk';
4
+ import { mergeGitignore } from '../lib/gitignore.js';
5
+ const GITIGNORE_MARKER = '# prompt-guide (added by prompt-guide-cli)';
6
+ const PLATFORMS = ['ios', 'android', 'flutter', 'web', 'server'];
7
+ const BAR = chalk.dim(' ' + '─'.repeat(44));
8
+ function getPlatformFromConfig(cwd) {
9
+ const configPath = path.join(cwd, 'ai', 'ai.config.yml');
10
+ if (!fs.existsSync(configPath))
11
+ return 'web';
12
+ const content = fs.readFileSync(configPath, 'utf8');
13
+ const m = content.match(/^platform:\s*(\w+)/m);
14
+ const value = m?.[1]?.toLowerCase();
15
+ return value && PLATFORMS.includes(value) ? value : 'web';
16
+ }
17
+ export function runDoctor(cwd, verbose, fix) {
18
+ const fixed = [];
19
+ const results = [];
20
+ const aiDir = path.join(cwd, 'ai');
21
+ const configPath = path.join(cwd, 'ai', 'ai.config.yml');
22
+ const promptsDir = path.join(cwd, 'prompts');
23
+ const docsDir = path.join(cwd, 'docs');
24
+ const gitignorePath = path.join(cwd, '.gitignore');
25
+ if (!fs.existsSync(aiDir)) {
26
+ results.push({ ok: false, message: 'ai/ directory missing', hint: 'Run: prompt-guide init' });
27
+ }
28
+ else {
29
+ results.push({ ok: true, message: 'ai/ directory exists' });
30
+ }
31
+ if (!fs.existsSync(configPath)) {
32
+ results.push({ ok: false, message: 'ai/ai.config.yml missing', hint: 'Run: prompt-guide init' });
33
+ }
34
+ else {
35
+ const content = fs.readFileSync(configPath, 'utf8');
36
+ const hasPlatform = /^platform:\s*(\w+|null)/m.test(content);
37
+ const hasContext = /^context:/m.test(content) || /context:\s*\n/m.test(content);
38
+ if (!hasPlatform || !hasContext) {
39
+ results.push({
40
+ ok: false,
41
+ message: 'ai/ai.config.yml invalid or incomplete',
42
+ hint: 'Should contain "platform:" and "context:"',
43
+ });
44
+ }
45
+ else {
46
+ results.push({ ok: true, message: 'ai/ai.config.yml valid' });
47
+ }
48
+ }
49
+ if (!fs.existsSync(promptsDir)) {
50
+ results.push({ ok: false, message: 'prompts/ directory missing', hint: 'Run: prompt-guide init' });
51
+ }
52
+ else {
53
+ results.push({ ok: true, message: 'prompts/ directory exists' });
54
+ }
55
+ if (!fs.existsSync(docsDir)) {
56
+ results.push({ ok: false, message: 'docs/ directory missing', hint: 'Run: prompt-guide init' });
57
+ }
58
+ else {
59
+ results.push({ ok: true, message: 'docs/ directory exists' });
60
+ }
61
+ if (!fs.existsSync(gitignorePath)) {
62
+ if (fix) {
63
+ const platform = getPlatformFromConfig(cwd);
64
+ mergeGitignore(cwd, platform);
65
+ fixed.push('.gitignore (created)');
66
+ results.push({ ok: true, message: '.gitignore created with prompt-guide block (--fix)' });
67
+ }
68
+ else {
69
+ results.push({
70
+ ok: false,
71
+ message: '.gitignore missing',
72
+ hint: 'Run: prompt-guide doctor --fix to create with recommended entries',
73
+ });
74
+ }
75
+ }
76
+ else {
77
+ const content = fs.readFileSync(gitignorePath, 'utf8');
78
+ if (!content.includes(GITIGNORE_MARKER)) {
79
+ if (fix) {
80
+ const platform = getPlatformFromConfig(cwd);
81
+ const { updated } = mergeGitignore(cwd, platform);
82
+ if (updated) {
83
+ fixed.push('.gitignore');
84
+ results.push({ ok: true, message: '.gitignore prompt-guide block appended (--fix)' });
85
+ }
86
+ else {
87
+ results.push({
88
+ ok: false,
89
+ message: '.gitignore has no prompt-guide block',
90
+ hint: 'Run: prompt-guide doctor --fix',
91
+ });
92
+ }
93
+ }
94
+ else {
95
+ results.push({
96
+ ok: false,
97
+ message: '.gitignore has no prompt-guide block',
98
+ hint: 'Run: prompt-guide doctor --fix to append recommended entries',
99
+ });
100
+ }
101
+ }
102
+ else {
103
+ results.push({ ok: true, message: '.gitignore has prompt-guide block' });
104
+ }
105
+ }
106
+ const allOk = results.every((r) => r.ok);
107
+ return { results, allOk, fixed };
108
+ }
109
+ export function printDoctorResults(results, allOk, verbose, fixed = [], json = false) {
110
+ if (json) {
111
+ const out = {
112
+ ok: allOk,
113
+ results: results.map((r) => ({ ok: r.ok, message: r.message, hint: r.hint })),
114
+ fixed,
115
+ };
116
+ console.log(JSON.stringify(out, null, 0));
117
+ return;
118
+ }
119
+ console.log(chalk.dim(' Doctor') + ' — checking prompt-guide setup\n');
120
+ console.log(BAR);
121
+ for (const r of results) {
122
+ const icon = r.ok ? chalk.green(' ✓') : chalk.red(' ✗');
123
+ const msg = r.ok ? chalk.dim(r.message) : r.message;
124
+ console.log(icon + ' ' + msg);
125
+ if (!r.ok && r.hint && (verbose || !allOk))
126
+ console.log(chalk.dim(' → ' + r.hint));
127
+ }
128
+ console.log(BAR);
129
+ if (fixed.length > 0) {
130
+ console.log(chalk.green('\n Fixed: ') + fixed.join(', '));
131
+ }
132
+ if (allOk) {
133
+ console.log(chalk.green('\n All checks passed.\n'));
134
+ }
135
+ else {
136
+ console.log(chalk.yellow('\n Fix the items above, or run doctor --fix to auto-fix .gitignore.\n'));
137
+ }
138
+ }
139
+ //# sourceMappingURL=doctor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doctor.js","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OA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AAC,KAAK,CAAC,GAAG,CAAC,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACxF,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACjB,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7D,CAAC;IACD,IAAI,KAAK,EAAE,CAAC;QACV,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC,CAAC;IACvD,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,wEAAwE,CAAC,CAAC,CAAC;IACtG,CAAC;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ export type InitOptions = {
2
+ dryRun?: boolean;
3
+ verbose?: boolean;
4
+ yes?: boolean;
5
+ };
6
+ export declare function runInit(platformFromOption?: string, options?: InitOptions): Promise<void>;
7
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAuBA,MAAM,MAAM,WAAW,GAAG;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,GAAG,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEjF,wBAAsB,OAAO,CAAC,kBAAkB,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkFnG"}
@@ -0,0 +1,106 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import chalk from 'chalk';
4
+ import figlet from 'figlet';
5
+ import { askPlatform } from '../lib/prompt.js';
6
+ import { getTemplatesDir } from '../lib/paths.js';
7
+ import { copyRecursive } from '../lib/copy.js';
8
+ import { setPlatformInConfig } from '../lib/config.js';
9
+ import { mergeGitignore } from '../lib/gitignore.js';
10
+ const BAR = chalk.dim(' ' + '─'.repeat(44));
11
+ function renderBanner() {
12
+ const opts = { font: 'Slant', horizontalLayout: 'fitted' };
13
+ const promptArt = figlet.textSync('Prompt', opts);
14
+ const guideArt = figlet.textSync('Guide', opts);
15
+ const blue = chalk.blue;
16
+ return blue(promptArt) + '\n' + blue(guideArt);
17
+ }
18
+ const DEFAULT_PLATFORM = 'web';
19
+ export async function runInit(platformFromOption, options = {}) {
20
+ const { dryRun = false, verbose = false, yes = false } = options;
21
+ const cwd = process.cwd();
22
+ const templatesDir = getTemplatesDir();
23
+ if (!fs.existsSync(templatesDir)) {
24
+ throw new Error('Templates not found. Reinstall prompt-guide-cli or run from the prompt-guide repo.');
25
+ }
26
+ let platform;
27
+ const parsed = platformFromOption?.trim().toLowerCase();
28
+ if (parsed && ['ios', 'android', 'flutter', 'web', 'server'].includes(parsed)) {
29
+ platform = parsed;
30
+ console.log(chalk.dim(' Platform:') + ' ' + chalk.cyan(platform));
31
+ }
32
+ else if (yes) {
33
+ platform = DEFAULT_PLATFORM;
34
+ console.log(chalk.dim(' Platform:') + ' ' + chalk.cyan(platform) + chalk.dim(' (--yes)'));
35
+ }
36
+ else {
37
+ platform = await askPlatform();
38
+ }
39
+ console.log('');
40
+ console.log(renderBanner());
41
+ console.log(chalk.dim(' platform: ') + chalk.cyan(platform));
42
+ if (dryRun)
43
+ console.log(chalk.yellow(' [dry-run] No files will be written.\n'));
44
+ else
45
+ console.log('');
46
+ const aiSrc = path.join(templatesDir, 'ai');
47
+ const promptsSrc = path.join(templatesDir, 'prompts');
48
+ const docsSrc = path.join(templatesDir, 'docs');
49
+ const aiDest = path.join(cwd, 'ai');
50
+ const promptsDest = path.join(cwd, 'prompts');
51
+ const docsDest = path.join(cwd, 'docs');
52
+ const existingDirs = [];
53
+ if (fs.existsSync(aiDest))
54
+ existingDirs.push('ai/');
55
+ if (fs.existsSync(promptsDest))
56
+ existingDirs.push('prompts/');
57
+ if (fs.existsSync(docsDest))
58
+ existingDirs.push('docs/');
59
+ if (existingDirs.length > 0 && !dryRun) {
60
+ console.log(chalk.yellow(' ⚠ ') + 'Existing: ' + existingDirs.join(', ') + chalk.dim(' (will be overwritten)'));
61
+ console.log('');
62
+ }
63
+ if (dryRun) {
64
+ console.log(chalk.dim(' Would install'));
65
+ console.log(BAR);
66
+ if (fs.existsSync(aiSrc))
67
+ console.log(chalk.blue(' →') + ' copy ai/ → ' + aiDest);
68
+ if (fs.existsSync(promptsSrc))
69
+ console.log(chalk.blue(' →') + ' copy prompts/ → ' + promptsDest);
70
+ if (fs.existsSync(docsSrc))
71
+ console.log(chalk.blue(' →') + ' copy docs/ → ' + docsDest);
72
+ console.log(chalk.blue(' →') + ' set platform in ai/ai.config.yml');
73
+ console.log(chalk.blue(' →') + ' append .gitignore if needed');
74
+ console.log(BAR);
75
+ console.log('');
76
+ return;
77
+ }
78
+ if (fs.existsSync(aiSrc))
79
+ copyRecursive(aiSrc, aiDest);
80
+ if (fs.existsSync(promptsSrc))
81
+ copyRecursive(promptsSrc, promptsDest);
82
+ if (fs.existsSync(docsSrc))
83
+ copyRecursive(docsSrc, docsDest);
84
+ setPlatformInConfig(cwd, platform);
85
+ const { updated: gitignoreUpdated } = mergeGitignore(cwd, platform);
86
+ if (verbose) {
87
+ console.log(chalk.dim(' Templates from: ') + templatesDir);
88
+ }
89
+ console.log(chalk.dim(' Installed'));
90
+ console.log(BAR);
91
+ console.log(chalk.green(' ✓') + ' ai/ai.config.yml ' + chalk.dim(`(platform=${platform})`));
92
+ console.log(chalk.green(' ✓') + ' prompts/');
93
+ console.log(chalk.green(' ✓') + ' docs/');
94
+ if (gitignoreUpdated) {
95
+ console.log(chalk.green(' ✓') + ' .gitignore ' + chalk.dim('(appended)'));
96
+ }
97
+ else {
98
+ console.log(chalk.dim(' · .gitignore already contains prompt-guide block'));
99
+ }
100
+ console.log('');
101
+ console.log(chalk.dim(' Next step'));
102
+ console.log(BAR);
103
+ console.log(chalk.dim(' → ') + 'Edit ' + chalk.cyan('ai/ai.config.yml') + chalk.dim(' to set context.include for your repo.'));
104
+ console.log('');
105
+ }
106
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;AAE7C,SAAS,YAAY;IACnB,MAAM,IAAI,GAAG,EAAE,IAAI,EAAE,OAAgB,EAAE,gBAAgB,EAAE,QAAiB,EAAE,CAAC;IAC7E,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAClD,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAChD,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IACxB,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,gBA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AChB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC;IACtC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACjB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAC,CAAC;IAChI,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAClB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Platform } from '../schemas.js';
2
+ export declare function setPlatformInConfig(cwd: string, platform: Platform): void;
3
+ //# sourceMappingURL=config.d.ts.map