prjct-cli 1.6.2 → 1.6.3

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
@@ -1,11 +1,17 @@
1
1
  # Changelog
2
2
 
3
- ## [1.6.2] - 2026-02-06
3
+ ## [1.6.3] - 2026-02-07
4
4
 
5
5
  ### Bug Fixes
6
6
 
7
- - replace console.error with logger in routes.ts (PRJ-73) (#125)
7
+ - replace console.error with logger in setup.ts (PRJ-74) (#126)
8
+
9
+
10
+ ## [1.6.5] - 2026-02-07
11
+
12
+ ### Bug Fixes
8
13
 
14
+ - **Replace console.error with logger in setup.ts**: 12 `console.error` warning calls replaced with `log.warn` for Gemini, Cursor, Windsurf, Antigravity, migration, status line, Context7, symlink, and gitignore warnings. User-facing chalk output preserved. Fatal direct-run error kept as `console.error`.
9
15
 
10
16
  ## [1.6.4] - 2026-02-06
11
17
 
@@ -27,6 +27,7 @@ import { dependencyValidator } from '../services/dependency-validator'
27
27
  import { isNotFoundError } from '../types/fs'
28
28
  import type { AIProviderConfig, AIProviderName } from '../types/provider'
29
29
  import { fileExists } from '../utils/fs-helpers'
30
+ import log from '../utils/logger'
30
31
  import { getPackageRoot, VERSION } from '../utils/version'
31
32
  import {
32
33
  detectAllProviders,
@@ -270,7 +271,7 @@ async function installGeminiRouter(): Promise<boolean> {
270
271
  }
271
272
  return false
272
273
  } catch (error) {
273
- console.error(`Gemini router warning: ${(error as Error).message}`)
274
+ log.warn(`Gemini router warning: ${(error as Error).message}`)
274
275
  return false
275
276
  }
276
277
  }
@@ -340,7 +341,7 @@ async function installGeminiGlobalConfig(): Promise<{ success: boolean; action:
340
341
  await fs.writeFile(globalConfigPath, updatedContent, 'utf-8')
341
342
  return { success: true, action: 'updated' }
342
343
  } catch (error) {
343
- console.error(`Gemini config warning: ${(error as Error).message}`)
344
+ log.warn(`Gemini config warning: ${(error as Error).message}`)
344
345
  return { success: false, action: null }
345
346
  }
346
347
  }
@@ -373,7 +374,7 @@ export async function installAntigravitySkill(): Promise<{
373
374
 
374
375
  // Read template content
375
376
  if (!(await fileExists(templatePath))) {
376
- console.error('Antigravity SKILL.md template not found')
377
+ log.warn('Antigravity SKILL.md template not found')
377
378
  return { success: false, action: null }
378
379
  }
379
380
 
@@ -384,7 +385,7 @@ export async function installAntigravitySkill(): Promise<{
384
385
 
385
386
  return { success: true, action: skillExists ? 'updated' : 'created' }
386
387
  } catch (error) {
387
- console.error(`Antigravity skill warning: ${(error as Error).message}`)
388
+ log.warn(`Antigravity skill warning: ${(error as Error).message}`)
388
389
  return { success: false, action: null }
389
390
  }
390
391
  }
@@ -465,7 +466,7 @@ export async function installCursorProject(projectRoot: string): Promise<{
465
466
  result.success = result.rulesCreated || result.commandsCreated
466
467
  return result
467
468
  } catch (error) {
468
- console.error(`Cursor installation warning: ${(error as Error).message}`)
469
+ log.warn(`Cursor installation warning: ${(error as Error).message}`)
469
470
  return result
470
471
  }
471
472
  }
@@ -515,7 +516,7 @@ async function addCursorToGitignore(projectRoot: string): Promise<boolean> {
515
516
  await fs.writeFile(gitignorePath, newContent, 'utf-8')
516
517
  return true
517
518
  } catch (error) {
518
- console.error(`Gitignore update warning: ${(error as Error).message}`)
519
+ log.warn(`Gitignore update warning: ${(error as Error).message}`)
519
520
  return false
520
521
  }
521
522
  }
@@ -615,7 +616,7 @@ export async function installWindsurfProject(projectRoot: string): Promise<{
615
616
  result.success = result.rulesCreated || result.workflowsCreated
616
617
  return result
617
618
  } catch (error) {
618
- console.error(`Windsurf installation warning: ${(error as Error).message}`)
619
+ log.warn(`Windsurf installation warning: ${(error as Error).message}`)
619
620
  return result
620
621
  }
621
622
  }
@@ -665,7 +666,7 @@ async function addWindsurfToGitignore(projectRoot: string): Promise<boolean> {
665
666
  await fs.writeFile(gitignorePath, newContent, 'utf-8')
666
667
  return true
667
668
  } catch (error) {
668
- console.error(`Gitignore update warning: ${(error as Error).message}`)
669
+ log.warn(`Gitignore update warning: ${(error as Error).message}`)
669
670
  return false
670
671
  }
671
672
  }
@@ -738,7 +739,7 @@ async function migrateProjectsCliVersion(): Promise<void> {
738
739
  // Silently fail if projects directory doesn't exist
739
740
  if (!isNotFoundError(error)) {
740
741
  // Log unexpected errors but don't crash - migration is optional
741
- console.error(`Migration warning: ${(error as Error).message}`)
742
+ log.warn(`Migration warning: ${(error as Error).message}`)
742
743
  }
743
744
  }
744
745
  }
@@ -912,7 +913,7 @@ echo "prjct"
912
913
  // Silently fail if directories don't exist
913
914
  if (!isNotFoundError(error)) {
914
915
  // Log unexpected errors but don't crash - status line is optional
915
- console.error(`Status line warning: ${(error as Error).message}`)
916
+ log.warn(`Status line warning: ${(error as Error).message}`)
916
917
  }
917
918
  }
918
919
  }
@@ -965,7 +966,7 @@ async function installContext7MCP(): Promise<void> {
965
966
  }
966
967
  } catch (error) {
967
968
  // Non-fatal error, just log
968
- console.error(`Context7 MCP setup warning: ${(error as Error).message}`)
969
+ log.warn(`Context7 MCP setup warning: ${(error as Error).message}`)
969
970
  }
970
971
  }
971
972
 
@@ -1018,7 +1019,7 @@ async function ensureStatusLineSymlink(linkPath: string, targetPath: string): Pr
1018
1019
  } catch (copyError) {
1019
1020
  // Both symlink and copy failed - log if unexpected error
1020
1021
  if (!isNotFoundError(copyError)) {
1021
- console.error(`Symlink fallback warning: ${(copyError as Error).message}`)
1022
+ log.warn(`Symlink fallback warning: ${(copyError as Error).message}`)
1022
1023
  }
1023
1024
  }
1024
1025
  }
@@ -24681,7 +24681,7 @@ async function installGeminiRouter() {
24681
24681
  }
24682
24682
  return false;
24683
24683
  } catch (error) {
24684
- console.error(`Gemini router warning: ${error.message}`);
24684
+ logger_default.warn(`Gemini router warning: ${error.message}`);
24685
24685
  return false;
24686
24686
  }
24687
24687
  }
@@ -24730,7 +24730,7 @@ ${templateContent}`;
24730
24730
  await fs47.writeFile(globalConfigPath, updatedContent, "utf-8");
24731
24731
  return { success: true, action: "updated" };
24732
24732
  } catch (error) {
24733
- console.error(`Gemini config warning: ${error.message}`);
24733
+ logger_default.warn(`Gemini config warning: ${error.message}`);
24734
24734
  return { success: false, action: null };
24735
24735
  }
24736
24736
  }
@@ -24743,14 +24743,14 @@ async function installAntigravitySkill() {
24743
24743
  await fs47.mkdir(prjctSkillDir, { recursive: true });
24744
24744
  const skillExists = await fileExists(skillMdPath);
24745
24745
  if (!await fileExists(templatePath)) {
24746
- console.error("Antigravity SKILL.md template not found");
24746
+ logger_default.warn("Antigravity SKILL.md template not found");
24747
24747
  return { success: false, action: null };
24748
24748
  }
24749
24749
  const templateContent = await fs47.readFile(templatePath, "utf-8");
24750
24750
  await fs47.writeFile(skillMdPath, templateContent, "utf-8");
24751
24751
  return { success: true, action: skillExists ? "updated" : "created" };
24752
24752
  } catch (error) {
24753
- console.error(`Antigravity skill warning: ${error.message}`);
24753
+ logger_default.warn(`Antigravity skill warning: ${error.message}`);
24754
24754
  return { success: false, action: null };
24755
24755
  }
24756
24756
  }
@@ -24791,7 +24791,7 @@ async function installCursorProject(projectRoot) {
24791
24791
  result.success = result.rulesCreated || result.commandsCreated;
24792
24792
  return result;
24793
24793
  } catch (error) {
24794
- console.error(`Cursor installation warning: ${error.message}`);
24794
+ logger_default.warn(`Cursor installation warning: ${error.message}`);
24795
24795
  return result;
24796
24796
  }
24797
24797
  }
@@ -24830,7 +24830,7 @@ ${entriesToAdd.join("\n")}
24830
24830
  await fs47.writeFile(gitignorePath, newContent, "utf-8");
24831
24831
  return true;
24832
24832
  } catch (error) {
24833
- console.error(`Gitignore update warning: ${error.message}`);
24833
+ logger_default.warn(`Gitignore update warning: ${error.message}`);
24834
24834
  return false;
24835
24835
  }
24836
24836
  }
@@ -24882,7 +24882,7 @@ async function installWindsurfProject(projectRoot) {
24882
24882
  result.success = result.rulesCreated || result.workflowsCreated;
24883
24883
  return result;
24884
24884
  } catch (error) {
24885
- console.error(`Windsurf installation warning: ${error.message}`);
24885
+ logger_default.warn(`Windsurf installation warning: ${error.message}`);
24886
24886
  return result;
24887
24887
  }
24888
24888
  }
@@ -24921,7 +24921,7 @@ ${entriesToAdd.join("\n")}
24921
24921
  await fs47.writeFile(gitignorePath, newContent, "utf-8");
24922
24922
  return true;
24923
24923
  } catch (error) {
24924
- console.error(`Gitignore update warning: ${error.message}`);
24924
+ logger_default.warn(`Gitignore update warning: ${error.message}`);
24925
24925
  return false;
24926
24926
  }
24927
24927
  }
@@ -24965,7 +24965,7 @@ async function migrateProjectsCliVersion() {
24965
24965
  }
24966
24966
  } catch (error) {
24967
24967
  if (!isNotFoundError(error)) {
24968
- console.error(`Migration warning: ${error.message}`);
24968
+ logger_default.warn(`Migration warning: ${error.message}`);
24969
24969
  }
24970
24970
  }
24971
24971
  }
@@ -25089,7 +25089,7 @@ echo "prjct"
25089
25089
  await ensureStatusLineSettings(settingsPath, claudeStatusLinePath);
25090
25090
  } catch (error) {
25091
25091
  if (!isNotFoundError(error)) {
25092
- console.error(`Status line warning: ${error.message}`);
25092
+ logger_default.warn(`Status line warning: ${error.message}`);
25093
25093
  }
25094
25094
  }
25095
25095
  }
@@ -25121,7 +25121,7 @@ async function installContext7MCP() {
25121
25121
  await fs47.writeFile(mcpConfigPath, JSON.stringify(context7Config, null, 2), "utf-8");
25122
25122
  }
25123
25123
  } catch (error) {
25124
- console.error(`Context7 MCP setup warning: ${error.message}`);
25124
+ logger_default.warn(`Context7 MCP setup warning: ${error.message}`);
25125
25125
  }
25126
25126
  }
25127
25127
  async function installStatusLineModules(sourceDir, destDir) {
@@ -25159,7 +25159,7 @@ async function ensureStatusLineSymlink(linkPath, targetPath) {
25159
25159
  }
25160
25160
  } catch (copyError) {
25161
25161
  if (!isNotFoundError(copyError)) {
25162
- console.error(`Symlink fallback warning: ${copyError.message}`);
25162
+ logger_default.warn(`Symlink fallback warning: ${copyError.message}`);
25163
25163
  }
25164
25164
  }
25165
25165
  }
@@ -25197,6 +25197,7 @@ var init_setup = __esm({
25197
25197
  init_dependency_validator();
25198
25198
  init_fs();
25199
25199
  init_fs_helpers();
25200
+ init_logger();
25200
25201
  init_version();
25201
25202
  init_ai_provider();
25202
25203
  init_command_installer();
@@ -28613,7 +28614,7 @@ var require_package = __commonJS({
28613
28614
  "package.json"(exports, module) {
28614
28615
  module.exports = {
28615
28616
  name: "prjct-cli",
28616
- version: "1.6.2",
28617
+ version: "1.6.3",
28617
28618
  description: "Context layer for AI agents. Project context for Claude Code, Gemini CLI, and more.",
28618
28619
  main: "core/index.ts",
28619
28620
  bin: {
@@ -719,6 +719,39 @@ __name(isNotFoundError, "isNotFoundError");
719
719
  // core/infrastructure/setup.ts
720
720
  init_fs_helpers();
721
721
 
722
+ // core/utils/logger.ts
723
+ var LEVELS = { error: 0, warn: 1, info: 2, debug: 3 };
724
+ var TRUTHY_VALUES = /* @__PURE__ */ new Set(["1", "true", "*"]);
725
+ function getLogLevel() {
726
+ const debugEnv = process.env.PRJCT_DEBUG || process.env.DEBUG || "";
727
+ if (!debugEnv) return { level: -1, name: "disabled" };
728
+ if (TRUTHY_VALUES.has(debugEnv) || debugEnv.includes("prjct")) {
729
+ return { level: LEVELS.debug, name: "debug" };
730
+ }
731
+ const levelValue = LEVELS[debugEnv] ?? -1;
732
+ const levelName = levelValue >= 0 ? debugEnv : "disabled";
733
+ return { level: levelValue, name: levelName };
734
+ }
735
+ __name(getLogLevel, "getLogLevel");
736
+ var { level: currentLevel, name: currentLevelName } = getLogLevel();
737
+ var noop = /* @__PURE__ */ __name(() => {
738
+ }, "noop");
739
+ function createLogMethod(levelThreshold, prefix, method) {
740
+ return currentLevel >= levelThreshold ? (...args) => console[method](prefix, ...args) : noop;
741
+ }
742
+ __name(createLogMethod, "createLogMethod");
743
+ var logger = {
744
+ error: createLogMethod(LEVELS.error, "[prjct:error]", "error"),
745
+ warn: createLogMethod(LEVELS.warn, "[prjct:warn]", "warn"),
746
+ info: createLogMethod(LEVELS.info, "[prjct:info]", "log"),
747
+ debug: createLogMethod(LEVELS.debug, "[prjct:debug]", "log"),
748
+ // Check if logging is enabled (useful for expensive log prep)
749
+ isEnabled: /* @__PURE__ */ __name(() => currentLevel >= 0, "isEnabled"),
750
+ // Get current level name (pre-computed, no runtime lookup)
751
+ level: /* @__PURE__ */ __name(() => currentLevelName, "level")
752
+ };
753
+ var logger_default = logger;
754
+
722
755
  // core/utils/version.ts
723
756
  var import_node_fs = __toESM(require("node:fs"));
724
757
  var import_node_path = __toESM(require("node:path"));
@@ -1574,7 +1607,7 @@ async function installGeminiRouter() {
1574
1607
  }
1575
1608
  return false;
1576
1609
  } catch (error) {
1577
- console.error(`Gemini router warning: ${error.message}`);
1610
+ logger_default.warn(`Gemini router warning: ${error.message}`);
1578
1611
  return false;
1579
1612
  }
1580
1613
  }
@@ -1624,7 +1657,7 @@ ${templateContent}`;
1624
1657
  await import_promises4.default.writeFile(globalConfigPath, updatedContent, "utf-8");
1625
1658
  return { success: true, action: "updated" };
1626
1659
  } catch (error) {
1627
- console.error(`Gemini config warning: ${error.message}`);
1660
+ logger_default.warn(`Gemini config warning: ${error.message}`);
1628
1661
  return { success: false, action: null };
1629
1662
  }
1630
1663
  }
@@ -1638,14 +1671,14 @@ async function installAntigravitySkill() {
1638
1671
  await import_promises4.default.mkdir(prjctSkillDir, { recursive: true });
1639
1672
  const skillExists = await fileExists(skillMdPath);
1640
1673
  if (!await fileExists(templatePath)) {
1641
- console.error("Antigravity SKILL.md template not found");
1674
+ logger_default.warn("Antigravity SKILL.md template not found");
1642
1675
  return { success: false, action: null };
1643
1676
  }
1644
1677
  const templateContent = await import_promises4.default.readFile(templatePath, "utf-8");
1645
1678
  await import_promises4.default.writeFile(skillMdPath, templateContent, "utf-8");
1646
1679
  return { success: true, action: skillExists ? "updated" : "created" };
1647
1680
  } catch (error) {
1648
- console.error(`Antigravity skill warning: ${error.message}`);
1681
+ logger_default.warn(`Antigravity skill warning: ${error.message}`);
1649
1682
  return { success: false, action: null };
1650
1683
  }
1651
1684
  }
@@ -1688,7 +1721,7 @@ async function installCursorProject(projectRoot) {
1688
1721
  result.success = result.rulesCreated || result.commandsCreated;
1689
1722
  return result;
1690
1723
  } catch (error) {
1691
- console.error(`Cursor installation warning: ${error.message}`);
1724
+ logger_default.warn(`Cursor installation warning: ${error.message}`);
1692
1725
  return result;
1693
1726
  }
1694
1727
  }
@@ -1728,7 +1761,7 @@ ${entriesToAdd.join("\n")}
1728
1761
  await import_promises4.default.writeFile(gitignorePath, newContent, "utf-8");
1729
1762
  return true;
1730
1763
  } catch (error) {
1731
- console.error(`Gitignore update warning: ${error.message}`);
1764
+ logger_default.warn(`Gitignore update warning: ${error.message}`);
1732
1765
  return false;
1733
1766
  }
1734
1767
  }
@@ -1783,7 +1816,7 @@ async function installWindsurfProject(projectRoot) {
1783
1816
  result.success = result.rulesCreated || result.workflowsCreated;
1784
1817
  return result;
1785
1818
  } catch (error) {
1786
- console.error(`Windsurf installation warning: ${error.message}`);
1819
+ logger_default.warn(`Windsurf installation warning: ${error.message}`);
1787
1820
  return result;
1788
1821
  }
1789
1822
  }
@@ -1823,7 +1856,7 @@ ${entriesToAdd.join("\n")}
1823
1856
  await import_promises4.default.writeFile(gitignorePath, newContent, "utf-8");
1824
1857
  return true;
1825
1858
  } catch (error) {
1826
- console.error(`Gitignore update warning: ${error.message}`);
1859
+ logger_default.warn(`Gitignore update warning: ${error.message}`);
1827
1860
  return false;
1828
1861
  }
1829
1862
  }
@@ -1870,7 +1903,7 @@ async function migrateProjectsCliVersion() {
1870
1903
  }
1871
1904
  } catch (error) {
1872
1905
  if (!isNotFoundError(error)) {
1873
- console.error(`Migration warning: ${error.message}`);
1906
+ logger_default.warn(`Migration warning: ${error.message}`);
1874
1907
  }
1875
1908
  }
1876
1909
  }
@@ -1996,7 +2029,7 @@ echo "prjct"
1996
2029
  await ensureStatusLineSettings(settingsPath, claudeStatusLinePath);
1997
2030
  } catch (error) {
1998
2031
  if (!isNotFoundError(error)) {
1999
- console.error(`Status line warning: ${error.message}`);
2032
+ logger_default.warn(`Status line warning: ${error.message}`);
2000
2033
  }
2001
2034
  }
2002
2035
  }
@@ -2029,7 +2062,7 @@ async function installContext7MCP() {
2029
2062
  await import_promises4.default.writeFile(mcpConfigPath, JSON.stringify(context7Config, null, 2), "utf-8");
2030
2063
  }
2031
2064
  } catch (error) {
2032
- console.error(`Context7 MCP setup warning: ${error.message}`);
2065
+ logger_default.warn(`Context7 MCP setup warning: ${error.message}`);
2033
2066
  }
2034
2067
  }
2035
2068
  __name(installContext7MCP, "installContext7MCP");
@@ -2069,7 +2102,7 @@ async function ensureStatusLineSymlink(linkPath, targetPath) {
2069
2102
  }
2070
2103
  } catch (copyError) {
2071
2104
  if (!isNotFoundError(copyError)) {
2072
- console.error(`Symlink fallback warning: ${copyError.message}`);
2105
+ logger_default.warn(`Symlink fallback warning: ${copyError.message}`);
2073
2106
  }
2074
2107
  }
2075
2108
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prjct-cli",
3
- "version": "1.6.2",
3
+ "version": "1.6.3",
4
4
  "description": "Context layer for AI agents. Project context for Claude Code, Gemini CLI, and more.",
5
5
  "main": "core/index.ts",
6
6
  "bin": {