@promptscript/cli 1.0.0-alpha.4 → 1.0.0-alpha.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/CHANGELOG.md CHANGED
@@ -5,6 +5,25 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.0.0-alpha.5](https://github.com/mrwogu/promptscript/compare/v1.0.0-alpha.4...v1.0.0-alpha.5) (2026-01-27)
9
+
10
+
11
+ ### chore
12
+
13
+ * prepare alpha release ([54696c9](https://github.com/mrwogu/promptscript/commit/54696c93e27cf9fc2f09dd730b09e568d0dc425e))
14
+
15
+
16
+ ### Features
17
+
18
+ * **cli:** add AI-assisted migration skill and CLI integration ([53e9cca](https://github.com/mrwogu/promptscript/commit/53e9cca8669a30e787cbc2aa7679bb63f7896fce))
19
+ * **cli:** add verbose and debug logging throughout compilation pipeline ([36bd63a](https://github.com/mrwogu/promptscript/commit/36bd63a2fa1dde1acbfd0794bb174f645ef71335))
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * **cli:** add migrationCandidates to test mocks ([d8fe117](https://github.com/mrwogu/promptscript/commit/d8fe117ff5523bb5b1c15996e00d8c24548c7b8f))
25
+ * **cli:** extend marker detection from 10 to 20 lines ([229e9bc](https://github.com/mrwogu/promptscript/commit/229e9bc5bf4d0441c9674e6483a5125347b6f0b8))
26
+
8
27
  ## [1.0.0-alpha.4](https://github.com/mrwogu/promptscript/compare/v1.0.0-alpha.3...v1.0.0-alpha.4) (2026-01-27)
9
28
 
10
29
 
package/README.md CHANGED
@@ -69,6 +69,8 @@ Options:
69
69
  --dry-run Preview changes without writing files
70
70
  --force Force overwrite existing files without prompts
71
71
  --registry <path> Path or URL to registry
72
+ --verbose Show detailed compilation progress
73
+ --debug Show debug information (includes verbose)
72
74
  ```
73
75
 
74
76
  **Watch Mode:** Uses [chokidar](https://github.com/paulmillr/chokidar) for reliable file watching across all platforms. Automatically recompiles when `.prs` files change.
package/index.js CHANGED
@@ -296,6 +296,14 @@ function getPackageVersion(baseDir, relativePath = "../package.json") {
296
296
  return getPackageInfo(baseDir, relativePath).version;
297
297
  }
298
298
 
299
+ // packages/core/src/logger.ts
300
+ var noopLogger = {
301
+ verbose: () => {
302
+ },
303
+ debug: () => {
304
+ }
305
+ };
306
+
299
307
  // packages/cli/src/commands/init.ts
300
308
  import { fileURLToPath } from "url";
301
309
  import { dirname as dirname2 } from "path";
@@ -331,6 +339,7 @@ var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
331
339
  LogLevel2[LogLevel2["Quiet"] = 0] = "Quiet";
332
340
  LogLevel2[LogLevel2["Normal"] = 1] = "Normal";
333
341
  LogLevel2[LogLevel2["Verbose"] = 2] = "Verbose";
342
+ LogLevel2[LogLevel2["Debug"] = 3] = "Debug";
334
343
  return LogLevel2;
335
344
  })(LogLevel || {});
336
345
  var globalContext = {
@@ -349,6 +358,9 @@ function isVerbose() {
349
358
  function isQuiet() {
350
359
  return globalContext.logLevel <= 0 /* Quiet */;
351
360
  }
361
+ function isDebug() {
362
+ return globalContext.logLevel >= 3 /* Debug */;
363
+ }
352
364
  function createSpinner(text) {
353
365
  if (isQuiet()) {
354
366
  const noopSpinner = ora({ isSilent: true });
@@ -617,6 +629,16 @@ async function detectFrameworks(services) {
617
629
  }
618
630
 
619
631
  // packages/cli/src/utils/ai-tools-detector.ts
632
+ var PROMPTSCRIPT_MARKER = "PromptScript";
633
+ var INSTRUCTION_FILES = [
634
+ "CLAUDE.md",
635
+ "claude.md",
636
+ ".cursorrules",
637
+ ".github/copilot-instructions.md",
638
+ "AGENTS.md",
639
+ "AI_INSTRUCTIONS.md",
640
+ "AI.md"
641
+ ];
620
642
  var AI_TOOL_PATTERNS = [
621
643
  {
622
644
  target: "github",
@@ -648,6 +670,15 @@ async function directoryHasContent(dir, services) {
648
670
  return false;
649
671
  }
650
672
  }
673
+ async function isPromptScriptGenerated(filePath, services) {
674
+ try {
675
+ const content = await services.fs.readFile(filePath, "utf-8");
676
+ const header = content.slice(0, 500);
677
+ return header.includes(PROMPTSCRIPT_MARKER);
678
+ } catch {
679
+ return false;
680
+ }
681
+ }
651
682
  async function detectAITools(services = createDefaultServices()) {
652
683
  const detected = [];
653
684
  const details = {
@@ -656,6 +687,7 @@ async function detectAITools(services = createDefaultServices()) {
656
687
  cursor: [],
657
688
  antigravity: []
658
689
  };
690
+ const migrationCandidates = [];
659
691
  for (const pattern of AI_TOOL_PATTERNS) {
660
692
  const foundFiles = [];
661
693
  for (const file of pattern.files) {
@@ -673,7 +705,15 @@ async function detectAITools(services = createDefaultServices()) {
673
705
  details[pattern.target] = foundFiles;
674
706
  }
675
707
  }
676
- return { detected, details };
708
+ for (const file of INSTRUCTION_FILES) {
709
+ if (services.fs.existsSync(file)) {
710
+ const isGenerated = await isPromptScriptGenerated(file, services);
711
+ if (!isGenerated) {
712
+ migrationCandidates.push(file);
713
+ }
714
+ }
715
+ }
716
+ return { detected, details, migrationCandidates };
677
717
  }
678
718
  function getAllTargets() {
679
719
  return ["github", "claude", "cursor", "antigravity"];
@@ -694,6 +734,25 @@ function formatDetectionResults(detection) {
694
734
  }
695
735
  return lines;
696
736
  }
737
+ function hasMigrationCandidates(detection) {
738
+ return detection.migrationCandidates.length > 0;
739
+ }
740
+ function formatMigrationHint(detection) {
741
+ if (detection.migrationCandidates.length === 0) {
742
+ return [];
743
+ }
744
+ const lines = [];
745
+ lines.push("");
746
+ lines.push("\u{1F4CB} Existing instruction files detected:");
747
+ for (const file of detection.migrationCandidates) {
748
+ lines.push(` \u2022 ${file}`);
749
+ }
750
+ lines.push("");
751
+ lines.push(" These can be migrated to PromptScript for unified management.");
752
+ lines.push(" See: https://getpromptscript.dev/latest/guides/ai-migration-best-practices");
753
+ lines.push(" Or use the /migrate skill in Claude Code.");
754
+ return lines;
755
+ }
697
756
 
698
757
  // packages/cli/src/prettier/loader.ts
699
758
  import { existsSync as existsSync2 } from "fs";
@@ -854,6 +913,18 @@ async function initCommand(options, services = createDefaultServices()) {
854
913
  console.log("Next steps:");
855
914
  ConsoleOutput.muted("1. Edit .promptscript/project.prs to customize your AI instructions");
856
915
  ConsoleOutput.muted("2. Run: prs compile");
916
+ if (hasMigrationCandidates(aiToolsDetection)) {
917
+ const migrationHint = formatMigrationHint(aiToolsDetection);
918
+ for (const line of migrationHint) {
919
+ if (line.startsWith("\u{1F4CB}") || line.includes("migrated") || line.includes("See:") || line.includes("Or use")) {
920
+ ConsoleOutput.info(line.replace(/^\s+/, ""));
921
+ } else if (line.trim().startsWith("\u2022")) {
922
+ ConsoleOutput.muted(line);
923
+ } else if (line.trim()) {
924
+ console.log(line);
925
+ }
926
+ }
927
+ }
857
928
  } catch (error) {
858
929
  if (error.name === "ExitPromptError") {
859
930
  ConsoleOutput.newline();
@@ -15378,11 +15449,13 @@ var Resolver = class {
15378
15449
  cache;
15379
15450
  resolving;
15380
15451
  cacheEnabled;
15452
+ logger;
15381
15453
  constructor(options) {
15382
15454
  this.loader = new FileLoader(options);
15383
15455
  this.cache = /* @__PURE__ */ new Map();
15384
15456
  this.resolving = /* @__PURE__ */ new Set();
15385
15457
  this.cacheEnabled = options.cache !== false;
15458
+ this.logger = options.logger ?? noopLogger;
15386
15459
  }
15387
15460
  /**
15388
15461
  * Resolve a PromptScript file and all its dependencies.
@@ -15394,15 +15467,19 @@ var Resolver = class {
15394
15467
  async resolve(entryPath) {
15395
15468
  const absPath = this.loader.toAbsolutePath(entryPath);
15396
15469
  if (this.resolving.has(absPath)) {
15470
+ this.logger.debug(`Circular dependency detected: ${absPath}`);
15397
15471
  throw new CircularDependencyError([...this.resolving, absPath]);
15398
15472
  }
15399
15473
  if (this.cacheEnabled && this.cache.has(absPath)) {
15474
+ this.logger.debug(`Cache hit: ${absPath}`);
15400
15475
  return this.cache.get(absPath);
15401
15476
  }
15402
15477
  this.resolving.add(absPath);
15478
+ this.logger.verbose(`Parsing ${absPath}`);
15403
15479
  try {
15404
15480
  const result = await this.doResolve(absPath);
15405
15481
  if (this.cacheEnabled) {
15482
+ this.logger.debug(`Cache store: ${absPath}`);
15406
15483
  this.cache.set(absPath, result);
15407
15484
  }
15408
15485
  return result;
@@ -15421,16 +15498,33 @@ var Resolver = class {
15421
15498
  return { ast: null, sources, errors };
15422
15499
  }
15423
15500
  let ast = parseData.ast;
15501
+ this.logger.debug(`AST node count: ${this.countNodes(ast)}`);
15424
15502
  ast = await this.resolveInherit(ast, absPath, sources, errors);
15425
15503
  ast = await this.resolveImports(ast, absPath, sources, errors);
15504
+ if (ast.extends.length > 0) {
15505
+ this.logger.debug(`Applying ${ast.extends.length} extension(s)`);
15506
+ }
15426
15507
  ast = applyExtends(ast);
15427
15508
  ast = await resolveNativeSkills(ast, this.loader.getRegistryPath(), absPath);
15509
+ this.logger.debug(`Resolved ${sources.length} source file(s)`);
15428
15510
  return {
15429
15511
  ast,
15430
15512
  sources: [...new Set(sources)],
15431
15513
  errors
15432
15514
  };
15433
15515
  }
15516
+ /**
15517
+ * Count nodes in AST for debug output.
15518
+ */
15519
+ countNodes(ast) {
15520
+ let count = 1;
15521
+ if (ast.meta) count++;
15522
+ if (ast.inherit) count++;
15523
+ count += ast.uses.length;
15524
+ count += ast.blocks.length;
15525
+ count += ast.extends.length;
15526
+ return count;
15527
+ }
15434
15528
  /**
15435
15529
  * Load and parse a file.
15436
15530
  */
@@ -15465,11 +15559,14 @@ var Resolver = class {
15465
15559
  return ast;
15466
15560
  }
15467
15561
  const parentPath = this.loader.resolveRef(ast.inherit.path, absPath);
15562
+ this.logger.verbose(`Resolving inherit: ${ast.inherit.path.raw}`);
15563
+ this.logger.verbose(` \u2192 ${parentPath}`);
15468
15564
  try {
15469
15565
  const parent = await this.resolve(parentPath);
15470
15566
  sources.push(...parent.sources);
15471
15567
  errors.push(...parent.errors);
15472
15568
  if (parent.ast) {
15569
+ this.logger.debug(`Merging with parent AST`);
15473
15570
  return resolveInheritance(parent.ast, ast);
15474
15571
  }
15475
15572
  } catch (err) {
@@ -15487,11 +15584,14 @@ var Resolver = class {
15487
15584
  let result = ast;
15488
15585
  for (const use of ast.uses) {
15489
15586
  const importPath = this.loader.resolveRef(use.path, absPath);
15587
+ this.logger.verbose(`Resolving import: ${use.path.raw}`);
15588
+ this.logger.verbose(` \u2192 ${importPath}`);
15490
15589
  try {
15491
15590
  const imported = await this.resolve(importPath);
15492
15591
  sources.push(...imported.sources);
15493
15592
  errors.push(...imported.errors);
15494
15593
  if (imported.ast) {
15594
+ this.logger.debug(`Merging import${use.alias ? ` as "${use.alias}"` : ""}`);
15495
15595
  result = resolveUses(result, use, imported.ast);
15496
15596
  }
15497
15597
  } catch (err) {
@@ -16765,6 +16865,7 @@ var Validator = class {
16765
16865
  rules;
16766
16866
  config;
16767
16867
  disabledRules;
16868
+ logger;
16768
16869
  /**
16769
16870
  * Create a new validator instance.
16770
16871
  *
@@ -16774,11 +16875,13 @@ var Validator = class {
16774
16875
  this.config = config;
16775
16876
  this.rules = [...allRules];
16776
16877
  this.disabledRules = new Set(config.disableRules ?? []);
16878
+ this.logger = config.logger ?? noopLogger;
16777
16879
  if (config.customRules) {
16778
16880
  for (const rule of config.customRules) {
16779
16881
  this.rules.push(rule);
16780
16882
  }
16781
16883
  }
16884
+ this.logger.debug(`Validator initialized with ${this.rules.length} rules`);
16782
16885
  }
16783
16886
  /**
16784
16887
  * Validate an AST.
@@ -16788,15 +16891,22 @@ var Validator = class {
16788
16891
  */
16789
16892
  validate(ast) {
16790
16893
  const messages = [];
16894
+ const activeRules = this.rules.filter(
16895
+ (r) => !this.disabledRules.has(r.name) && !this.disabledRules.has(r.id)
16896
+ );
16897
+ this.logger.verbose(`Running ${activeRules.length} validation rules`);
16791
16898
  for (const rule of this.rules) {
16792
16899
  if (this.disabledRules.has(rule.name) || this.disabledRules.has(rule.id)) {
16900
+ this.logger.debug(`Skipping disabled rule: ${rule.name}`);
16793
16901
  continue;
16794
16902
  }
16795
16903
  const configuredSeverity = this.config.rules?.[rule.name];
16796
16904
  const severity = configuredSeverity ?? rule.defaultSeverity;
16797
16905
  if (severity === "off") {
16906
+ this.logger.debug(`Skipping off rule: ${rule.name}`);
16798
16907
  continue;
16799
16908
  }
16909
+ this.logger.debug(`Running rule: ${rule.name} (${severity})`);
16800
16910
  const ctx = {
16801
16911
  ast,
16802
16912
  config: this.config,
@@ -16814,6 +16924,9 @@ var Validator = class {
16814
16924
  const errors = messages.filter((m) => m.severity === "error");
16815
16925
  const warnings = messages.filter((m) => m.severity === "warning");
16816
16926
  const infos = messages.filter((m) => m.severity === "info");
16927
+ if (errors.length > 0 || warnings.length > 0) {
16928
+ this.logger.verbose(`Validation: ${errors.length} error(s), ${warnings.length} warning(s)`);
16929
+ }
16817
16930
  return {
16818
16931
  valid: errors.length === 0,
16819
16932
  errors,
@@ -16895,13 +17008,16 @@ ${afterMarker.replace(/^\n+/, "\n")}`;
16895
17008
  var Compiler = class _Compiler {
16896
17009
  constructor(options) {
16897
17010
  this.options = options;
16898
- this.resolver = new Resolver(options.resolver);
16899
- this.validator = new Validator(options.validator);
17011
+ this.logger = options.logger ?? noopLogger;
17012
+ this.resolver = new Resolver({ ...options.resolver, logger: this.logger });
17013
+ this.validator = new Validator({ ...options.validator, logger: this.logger });
16900
17014
  this.loadedFormatters = this.loadFormatters(options.formatters);
17015
+ this.logger.debug(`Compiler initialized with ${this.loadedFormatters.length} formatters`);
16901
17016
  }
16902
17017
  resolver;
16903
17018
  validator;
16904
17019
  loadedFormatters;
17020
+ logger;
16905
17021
  /**
16906
17022
  * Compile a PromptScript file through the full pipeline.
16907
17023
  *
@@ -16909,6 +17025,10 @@ var Compiler = class _Compiler {
16909
17025
  * @returns Compilation result with outputs, errors, and stats
16910
17026
  */
16911
17027
  async compile(entryPath) {
17028
+ this.logger.verbose(`Entry: ${entryPath}`);
17029
+ this.logger.verbose(
17030
+ `Targets: ${this.loadedFormatters.map((f) => f.formatter.name).join(", ")}`
17031
+ );
16912
17032
  const startTotal = Date.now();
16913
17033
  const stats = {
16914
17034
  resolveTime: 0,
@@ -16916,6 +17036,7 @@ var Compiler = class _Compiler {
16916
17036
  formatTime: 0,
16917
17037
  totalTime: 0
16918
17038
  };
17039
+ this.logger.verbose("=== Stage 1: Resolve ===");
16919
17040
  const startResolve = Date.now();
16920
17041
  let resolved;
16921
17042
  try {
@@ -16923,6 +17044,7 @@ var Compiler = class _Compiler {
16923
17044
  } catch (err) {
16924
17045
  stats.resolveTime = Date.now() - startResolve;
16925
17046
  stats.totalTime = Date.now() - startTotal;
17047
+ this.logger.verbose(`Resolve failed (${stats.resolveTime}ms)`);
16926
17048
  return {
16927
17049
  success: false,
16928
17050
  outputs: /* @__PURE__ */ new Map(),
@@ -16932,6 +17054,7 @@ var Compiler = class _Compiler {
16932
17054
  };
16933
17055
  }
16934
17056
  stats.resolveTime = Date.now() - startResolve;
17057
+ this.logger.verbose(`Resolve completed (${stats.resolveTime}ms)`);
16935
17058
  if (resolved.errors.length > 0 || !resolved.ast) {
16936
17059
  stats.totalTime = Date.now() - startTotal;
16937
17060
  return {
@@ -16942,9 +17065,11 @@ var Compiler = class _Compiler {
16942
17065
  stats
16943
17066
  };
16944
17067
  }
17068
+ this.logger.verbose("=== Stage 2: Validate ===");
16945
17069
  const startValidate = Date.now();
16946
17070
  const validation = this.validator.validate(resolved.ast);
16947
17071
  stats.validateTime = Date.now() - startValidate;
17072
+ this.logger.verbose(`Validate completed (${stats.validateTime}ms)`);
16948
17073
  if (!validation.valid) {
16949
17074
  stats.totalTime = Date.now() - startTotal;
16950
17075
  return {
@@ -16955,16 +17080,23 @@ var Compiler = class _Compiler {
16955
17080
  stats
16956
17081
  };
16957
17082
  }
17083
+ this.logger.verbose("=== Stage 3: Format ===");
16958
17084
  const startFormat = Date.now();
16959
17085
  const outputs = /* @__PURE__ */ new Map();
16960
17086
  const formatErrors = [];
16961
17087
  for (const { formatter, config } of this.loadedFormatters) {
17088
+ const formatterStart = Date.now();
17089
+ this.logger.verbose(`Formatting for ${formatter.name}`);
16962
17090
  try {
16963
17091
  const formatOptions = this.getFormatOptionsForTarget(formatter.name, config);
17092
+ this.logger.debug(` Convention: ${formatOptions.convention ?? "default"}`);
16964
17093
  const output = formatter.format(resolved.ast, formatOptions);
17094
+ const formatterTime = Date.now() - formatterStart;
17095
+ this.logger.verbose(` \u2192 ${output.path} (${formatterTime}ms)`);
16965
17096
  outputs.set(output.path, addMarkerToOutput(output));
16966
17097
  if (output.additionalFiles) {
16967
17098
  for (const additionalFile of output.additionalFiles) {
17099
+ this.logger.verbose(` \u2192 ${additionalFile.path} (additional)`);
16968
17100
  outputs.set(additionalFile.path, addMarkerToOutput(additionalFile));
16969
17101
  }
16970
17102
  }
@@ -16978,6 +17110,7 @@ var Compiler = class _Compiler {
16978
17110
  }
16979
17111
  stats.formatTime = Date.now() - startFormat;
16980
17112
  stats.totalTime = Date.now() - startTotal;
17113
+ this.logger.verbose(`Format completed (${stats.formatTime}ms)`);
16981
17114
  if (formatErrors.length > 0) {
16982
17115
  return {
16983
17116
  success: false,
@@ -17277,6 +17410,20 @@ var PROMPTSCRIPT_MARKERS = [
17277
17410
  "> Auto-generated by PromptScript"
17278
17411
  // Legacy - for backwards compatibility
17279
17412
  ];
17413
+ function createCliLogger() {
17414
+ return {
17415
+ verbose: (message) => {
17416
+ if (isVerbose() || isDebug()) {
17417
+ ConsoleOutput.verbose(message);
17418
+ }
17419
+ },
17420
+ debug: (message) => {
17421
+ if (isDebug()) {
17422
+ ConsoleOutput.debug(message);
17423
+ }
17424
+ }
17425
+ };
17426
+ }
17280
17427
  function parseTargets(targets) {
17281
17428
  return targets.map((entry) => {
17282
17429
  if (typeof entry === "string") {
@@ -17290,10 +17437,10 @@ function parseTargets(targets) {
17290
17437
  return { name, config };
17291
17438
  }).filter((target) => target.config?.enabled !== false);
17292
17439
  }
17293
- async function isPromptScriptGenerated(filePath) {
17440
+ async function isPromptScriptGenerated2(filePath) {
17294
17441
  try {
17295
17442
  const content = await readFile6(filePath, "utf-8");
17296
- const lines = content.split("\n").slice(0, 10);
17443
+ const lines = content.split("\n").slice(0, 20);
17297
17444
  return lines.some((line) => PROMPTSCRIPT_MARKERS.some((marker) => line.includes(marker)));
17298
17445
  } catch {
17299
17446
  return false;
@@ -17329,7 +17476,7 @@ async function writeOutputs(outputs, options, _config, services) {
17329
17476
  const fileExists2 = existsSync7(outputPath);
17330
17477
  if (options.dryRun) {
17331
17478
  if (fileExists2) {
17332
- const isGenerated2 = await isPromptScriptGenerated(outputPath);
17479
+ const isGenerated2 = await isPromptScriptGenerated2(outputPath);
17333
17480
  if (isGenerated2) {
17334
17481
  ConsoleOutput.dryRun(`Would overwrite: ${outputPath}`);
17335
17482
  } else {
@@ -17348,7 +17495,7 @@ async function writeOutputs(outputs, options, _config, services) {
17348
17495
  result.written.push(outputPath);
17349
17496
  continue;
17350
17497
  }
17351
- const isGenerated = await isPromptScriptGenerated(outputPath);
17498
+ const isGenerated = await isPromptScriptGenerated2(outputPath);
17352
17499
  if (isGenerated) {
17353
17500
  await mkdir2(dirname5(outputPath), { recursive: true });
17354
17501
  await writeFile2(outputPath, output.content, "utf-8");
@@ -17416,12 +17563,16 @@ function printWarnings(warnings) {
17416
17563
  }
17417
17564
  async function compileCommand(options, services = createDefaultServices()) {
17418
17565
  const spinner = createSpinner("Loading configuration...").start();
17566
+ const logger = createCliLogger();
17419
17567
  try {
17568
+ logger.verbose("Loading configuration...");
17420
17569
  const config = await loadConfig(options.config);
17421
17570
  spinner.text = "Compiling...";
17422
17571
  const selectedTarget = options.target ?? options.format;
17423
17572
  const targets = selectedTarget ? [{ name: selectedTarget }] : parseTargets(config.targets);
17424
17573
  const registryPath = options.registry ?? config.registry?.path ?? "./registry";
17574
+ logger.verbose(`Registry: ${registryPath}`);
17575
+ logger.debug(`Config: ${JSON.stringify(config, null, 2)}`);
17425
17576
  const prettierOptions = await resolvePrettierOptions(config, process.cwd());
17426
17577
  const compiler = new Compiler({
17427
17578
  resolver: {
@@ -17431,7 +17582,8 @@ async function compileCommand(options, services = createDefaultServices()) {
17431
17582
  validator: config.validation,
17432
17583
  formatters: targets,
17433
17584
  customConventions: config.customConventions,
17434
- prettier: prettierOptions
17585
+ prettier: prettierOptions,
17586
+ logger
17435
17587
  });
17436
17588
  const entryPath = resolve4("./.promptscript/project.prs");
17437
17589
  if (!existsSync7(entryPath)) {
@@ -18080,14 +18232,18 @@ function printResults(results) {
18080
18232
  var __filename2 = fileURLToPath2(import.meta.url);
18081
18233
  var __dirname2 = dirname7(__filename2);
18082
18234
  var program = new Command();
18083
- program.name("prs").description("PromptScript CLI - Standardize AI instructions").version(getPackageVersion(__dirname2, "./package.json")).option("--verbose", "Enable verbose output").option("--quiet", "Suppress non-error output").hook("preAction", (thisCommand) => {
18235
+ program.name("prs").description("PromptScript CLI - Standardize AI instructions").version(getPackageVersion(__dirname2, "./package.json")).option("--verbose", "Enable verbose output").option("--debug", "Enable debug output (includes verbose)").option("--quiet", "Suppress non-error output").hook("preAction", (thisCommand) => {
18084
18236
  const opts = thisCommand.opts();
18085
18237
  if (opts["quiet"]) {
18086
18238
  setContext({ logLevel: 0 /* Quiet */ });
18239
+ } else if (opts["debug"]) {
18240
+ setContext({ logLevel: 3 /* Debug */ });
18087
18241
  } else if (opts["verbose"]) {
18088
18242
  setContext({ logLevel: 2 /* Verbose */ });
18089
18243
  }
18090
- if (process.env["PROMPTSCRIPT_VERBOSE"] === "1" || process.env["PROMPTSCRIPT_VERBOSE"] === "true") {
18244
+ if (process.env["PROMPTSCRIPT_DEBUG"] === "1" || process.env["PROMPTSCRIPT_DEBUG"] === "true") {
18245
+ setContext({ logLevel: 3 /* Debug */ });
18246
+ } else if (process.env["PROMPTSCRIPT_VERBOSE"] === "1" || process.env["PROMPTSCRIPT_VERBOSE"] === "true") {
18091
18247
  setContext({ logLevel: 2 /* Verbose */ });
18092
18248
  }
18093
18249
  });
package/package.json CHANGED
@@ -1,50 +1,51 @@
1
1
  {
2
2
  "name": "@promptscript/cli",
3
- "version": "1.0.0-alpha.4",
3
+ "version": "1.0.0-alpha.5",
4
4
  "description": "CLI for PromptScript - standardize AI instructions across GitHub Copilot, Claude, Cursor and other AI tools",
5
+ "keywords": [
6
+ "cli",
7
+ "enterprise",
8
+ "typescript",
9
+ "devtools",
10
+ "infrastructure-as-code",
11
+ "cursor",
12
+ "developer-experience",
13
+ "governance",
14
+ "claude",
15
+ "ai-tools",
16
+ "github-copilot",
17
+ "llm",
18
+ "prompt-engineering",
19
+ "promptscript",
20
+ "antigravity",
21
+ "promptops"
22
+ ],
5
23
  "repository": {
6
24
  "type": "git",
7
25
  "url": "https://github.com/mrwogu/promptscript.git",
8
26
  "directory": "packages/cli"
9
27
  },
28
+ "license": "MIT",
10
29
  "publishConfig": {
11
30
  "access": "public"
12
31
  },
13
32
  "type": "module",
14
33
  "main": "./index.js",
34
+ "types": "./src/index.d.ts",
15
35
  "bin": {
16
36
  "prs": "./bin/prs.js",
17
37
  "promptscript": "./bin/prs.js"
18
38
  },
39
+ "engines": {
40
+ "node": ">=18"
41
+ },
19
42
  "dependencies": {
20
43
  "@inquirer/prompts": "^8.2.0",
21
44
  "chalk": "^5.6.2",
22
45
  "chokidar": "^5.0.0",
23
46
  "commander": "^14.0.2",
24
47
  "ora": "^9.0.0",
25
- "simple-git": "^3.22.0",
26
- "yaml": "^2.8.2"
27
- },
28
- "engines": {
29
- "node": ">=18"
30
- },
31
- "keywords": [
32
- "cli",
33
- "enterprise",
34
- "typescript",
35
- "devtools",
36
- "infrastructure-as-code",
37
- "cursor",
38
- "developer-experience",
39
- "governance",
40
- "claude",
41
- "ai-tools",
42
- "github-copilot",
43
- "llm",
44
- "prompt-engineering",
45
- "promptscript",
46
- "antigravity",
47
- "promptops"
48
- ],
49
- "license": "MIT"
48
+ "yaml": "^2.8.2",
49
+ "simple-git": "^3.22.0"
50
+ }
50
51
  }
package/src/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../../packages/cli/src/cli.ts"],"names":[],"mappings":";AAwGA;;;GAGG;AACH,wBAAgB,GAAG,CAAC,IAAI,GAAE,MAAM,EAAiB,GAAG,IAAI,CAEvD"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../../packages/cli/src/cli.ts"],"names":[],"mappings":";AA6GA;;;GAGG;AACH,wBAAgB,GAAG,CAAC,IAAI,GAAE,MAAM,EAAiB,GAAG,IAAI,CAEvD"}
@@ -1 +1 @@
1
- {"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/commands/compile.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAQlD,OAAO,EAAE,KAAK,WAAW,EAAyB,MAAM,gBAAgB,CAAC;AAkOzE;;GAEG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,cAAc,EACvB,QAAQ,GAAE,WAAqC,GAC9C,OAAO,CAAC,IAAI,CAAC,CA4Ef"}
1
+ {"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/commands/compile.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAQlD,OAAO,EAAE,KAAK,WAAW,EAAyB,MAAM,gBAAgB,CAAC;AAqPzE;;GAEG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,cAAc,EACvB,QAAQ,GAAE,WAAqC,GAC9C,OAAO,CAAC,IAAI,CAAC,CAkFf"}
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/commands/init.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,WAAW,EAAyB,MAAM,gBAAgB,CAAC;AAKzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAyB/C;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,WAAW,EACpB,QAAQ,GAAE,WAAqC,GAC9C,OAAO,CAAC,IAAI,CAAC,CA+Ef"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/commands/init.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,WAAW,EAAyB,MAAM,gBAAgB,CAAC;AAKzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AA2B/C;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,WAAW,EACpB,QAAQ,GAAE,WAAqC,GAC9C,OAAO,CAAC,IAAI,CAAC,CAkGf"}
@@ -8,7 +8,9 @@ export declare enum LogLevel {
8
8
  /** Normal output (default) */
9
9
  Normal = 1,
10
10
  /** Verbose output with additional details */
11
- Verbose = 2
11
+ Verbose = 2,
12
+ /** Debug output with maximum details */
13
+ Debug = 3
12
14
  }
13
15
  /**
14
16
  * Global CLI context for sharing state across commands.
@@ -35,6 +37,10 @@ export declare function isVerbose(): boolean;
35
37
  * Check if quiet mode is enabled.
36
38
  */
37
39
  export declare function isQuiet(): boolean;
40
+ /**
41
+ * Check if debug logging is enabled.
42
+ */
43
+ export declare function isDebug(): boolean;
38
44
  /**
39
45
  * Creates a spinner for async operations.
40
46
  * Returns a no-op spinner in quiet mode.
@@ -1 +1 @@
1
- {"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/output/console.ts"],"names":[],"mappings":"AACA,OAAY,EAAE,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAEpC;;GAEG;AACH,oBAAY,QAAQ;IAClB,wCAAwC;IACxC,KAAK,IAAI;IACT,8BAA8B;IAC9B,MAAM,IAAI;IACV,6CAA6C;IAC7C,OAAO,IAAI;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,wBAAwB;IACxB,QAAQ,EAAE,QAAQ,CAAC;IACnB,iCAAiC;IACjC,MAAM,EAAE,OAAO,CAAC;CACjB;AAUD;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,CAE7D;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,UAAU,CAEvC;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAEnC;AAED;;GAEG;AACH,wBAAgB,OAAO,IAAI,OAAO,CAEjC;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAQ/C;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa;IACxB;;OAEG;qBACc,MAAM,GAAG,IAAI;IAK9B;;;OAGG;mBACY,MAAM,GAAG,IAAI;IAI5B;;OAEG;qBACc,MAAM,GAAG,IAAI;IAK9B;;OAEG;kBACW,MAAM,GAAG,IAAI;IAK3B;;OAEG;qBACc,MAAM,GAAG,IAAI;IAK9B;;OAEG;kBACW,MAAM,GAAG,IAAI;IAK3B;;OAEG;mBACY,MAAM,GAAG,IAAI;IAK5B;;OAEG;qBACc,MAAM,GAAG,IAAI;IAK9B;;OAEG;mBACY,MAAM,GAAG,IAAI;IAK5B;;OAEG;oBACa,MAAM,GAAG,IAAI;IAK7B;;OAEG;eACQ,IAAI;IAKf;;OAEG;oBACa,MAAM,GAAG,IAAI;IAK7B;;OAEG;mBACY,MAAM,GAAG,IAAI;IAK5B;;OAEG;qBACc,MAAM,GAAG,MAAM;IAIhC;;OAEG;yBACkB,MAAM,SAAS,MAAM,WAAW,MAAM,GAAG,MAAM;CAUrE,CAAC"}
1
+ {"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/output/console.ts"],"names":[],"mappings":"AACA,OAAY,EAAE,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAEpC;;GAEG;AACH,oBAAY,QAAQ;IAClB,wCAAwC;IACxC,KAAK,IAAI;IACT,8BAA8B;IAC9B,MAAM,IAAI;IACV,6CAA6C;IAC7C,OAAO,IAAI;IACX,wCAAwC;IACxC,KAAK,IAAI;CACV;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,wBAAwB;IACxB,QAAQ,EAAE,QAAQ,CAAC;IACnB,iCAAiC;IACjC,MAAM,EAAE,OAAO,CAAC;CACjB;AAUD;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,CAE7D;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,UAAU,CAEvC;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAEnC;AAED;;GAEG;AACH,wBAAgB,OAAO,IAAI,OAAO,CAEjC;AAED;;GAEG;AACH,wBAAgB,OAAO,IAAI,OAAO,CAEjC;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAQ/C;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa;IACxB;;OAEG;qBACc,MAAM,GAAG,IAAI;IAK9B;;;OAGG;mBACY,MAAM,GAAG,IAAI;IAI5B;;OAEG;qBACc,MAAM,GAAG,IAAI;IAK9B;;OAEG;kBACW,MAAM,GAAG,IAAI;IAK3B;;OAEG;qBACc,MAAM,GAAG,IAAI;IAK9B;;OAEG;kBACW,MAAM,GAAG,IAAI;IAK3B;;OAEG;mBACY,MAAM,GAAG,IAAI;IAK5B;;OAEG;qBACc,MAAM,GAAG,IAAI;IAK9B;;OAEG;mBACY,MAAM,GAAG,IAAI;IAK5B;;OAEG;oBACa,MAAM,GAAG,IAAI;IAK7B;;OAEG;eACQ,IAAI;IAKf;;OAEG;oBACa,MAAM,GAAG,IAAI;IAK7B;;OAEG;mBACY,MAAM,GAAG,IAAI;IAK5B;;OAEG;qBACc,MAAM,GAAG,MAAM;IAIhC;;OAEG;yBACkB,MAAM,SAAS,MAAM,WAAW,MAAM,GAAG,MAAM;CAUrE,CAAC"}
@@ -11,6 +11,8 @@ export interface AIToolsDetection {
11
11
  detected: AIToolTarget[];
12
12
  /** Details about detected files */
13
13
  details: Record<AIToolTarget, string[]>;
14
+ /** Files that exist but were NOT generated by PromptScript (candidates for migration) */
15
+ migrationCandidates: string[];
14
16
  }
15
17
  /**
16
18
  * Detect existing AI tool configurations.
@@ -29,4 +31,12 @@ export declare function getSuggestedTargets(detection: AIToolsDetection): AITool
29
31
  * Format detection results for display.
30
32
  */
31
33
  export declare function formatDetectionResults(detection: AIToolsDetection): string[];
34
+ /**
35
+ * Check if there are migration candidates (non-PromptScript instruction files).
36
+ */
37
+ export declare function hasMigrationCandidates(detection: AIToolsDetection): boolean;
38
+ /**
39
+ * Format migration hint for display.
40
+ */
41
+ export declare function formatMigrationHint(detection: AIToolsDetection): string[];
32
42
  //# sourceMappingURL=ai-tools-detector.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ai-tools-detector.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/utils/ai-tools-detector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAyB,MAAM,gBAAgB,CAAC;AAEzE;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,aAAa,CAAC;AAE1E;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,oDAAoD;IACpD,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,CAAC,CAAC;CACzC;AA+CD;;GAEG;AACH,wBAAsB,aAAa,CACjC,QAAQ,GAAE,WAAqC,GAC9C,OAAO,CAAC,gBAAgB,CAAC,CAiC3B;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,YAAY,EAAE,CAE9C;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,gBAAgB,GAAG,YAAY,EAAE,CAE/E;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,gBAAgB,GAAG,MAAM,EAAE,CAgB5E"}
1
+ {"version":3,"file":"ai-tools-detector.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/utils/ai-tools-detector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAyB,MAAM,gBAAgB,CAAC;AAEzE;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,aAAa,CAAC;AAE1E;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,oDAAoD;IACpD,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,CAAC,CAAC;IACxC,yFAAyF;IACzF,mBAAmB,EAAE,MAAM,EAAE,CAAC;CAC/B;AAgFD;;GAEG;AACH,wBAAsB,aAAa,CACjC,QAAQ,GAAE,WAAqC,GAC9C,OAAO,CAAC,gBAAgB,CAAC,CA4C3B;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,YAAY,EAAE,CAE9C;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,gBAAgB,GAAG,YAAY,EAAE,CAE/E;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,gBAAgB,GAAG,MAAM,EAAE,CAgB5E;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,gBAAgB,GAAG,OAAO,CAE3E;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,gBAAgB,GAAG,MAAM,EAAE,CAiBzE"}
@@ -1,50 +0,0 @@
1
- {
2
- "name": "@promptscript/cli",
3
- "version": "0.0.1",
4
- "description": "CLI for PromptScript - standardize AI instructions across GitHub Copilot, Claude, Cursor and other AI tools",
5
- "repository": {
6
- "type": "git",
7
- "url": "https://github.com/mrwogu/promptscript.git",
8
- "directory": "packages/cli"
9
- },
10
- "publishConfig": {
11
- "access": "public"
12
- },
13
- "type": "module",
14
- "main": "./index.js",
15
- "bin": {
16
- "prs": "./bin/prs.js",
17
- "promptscript": "./bin/prs.js"
18
- },
19
- "dependencies": {
20
- "@inquirer/prompts": "^8.2.0",
21
- "chalk": "^5.6.2",
22
- "chokidar": "^5.0.0",
23
- "commander": "^14.0.2",
24
- "ora": "^9.0.0",
25
- "simple-git": "^3.22.0",
26
- "yaml": "^2.8.2"
27
- },
28
- "engines": {
29
- "node": ">=18"
30
- },
31
- "keywords": [
32
- "cli",
33
- "enterprise",
34
- "typescript",
35
- "devtools",
36
- "infrastructure-as-code",
37
- "cursor",
38
- "developer-experience",
39
- "governance",
40
- "claude",
41
- "ai-tools",
42
- "github-copilot",
43
- "llm",
44
- "prompt-engineering",
45
- "promptscript",
46
- "antigravity",
47
- "promptops"
48
- ],
49
- "license": "MIT"
50
- }