pengui-api 1.0.0 → 1.0.1

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.
@@ -0,0 +1,112 @@
1
+ # the name by which the project can be referenced within Serena
2
+ project_name: "pengui-api"
3
+
4
+
5
+ # list of languages for which language servers are started; choose from:
6
+ # al bash clojure cpp csharp
7
+ # csharp_omnisharp dart elixir elm erlang
8
+ # fortran fsharp go groovy haskell
9
+ # java julia kotlin lua markdown
10
+ # matlab nix pascal perl php
11
+ # powershell python python_jedi r rego
12
+ # ruby ruby_solargraph rust scala swift
13
+ # terraform toml typescript typescript_vts vue
14
+ # yaml zig
15
+ # (This list may be outdated. For the current list, see values of Language enum here:
16
+ # https://github.com/oraios/serena/blob/main/src/solidlsp/ls_config.py
17
+ # For some languages, there are alternative language servers, e.g. csharp_omnisharp, ruby_solargraph.)
18
+ # Note:
19
+ # - For C, use cpp
20
+ # - For JavaScript, use typescript
21
+ # - For Free Pascal/Lazarus, use pascal
22
+ # Special requirements:
23
+ # Some languages require additional setup/installations.
24
+ # See here for details: https://oraios.github.io/serena/01-about/020_programming-languages.html#language-servers
25
+ # When using multiple languages, the first language server that supports a given file will be used for that file.
26
+ # The first language is the default language and the respective language server will be used as a fallback.
27
+ # Note that when using the JetBrains backend, language servers are not used and this list is correspondingly ignored.
28
+ languages:
29
+ - typescript
30
+
31
+ # the encoding used by text files in the project
32
+ # For a list of possible encodings, see https://docs.python.org/3.11/library/codecs.html#standard-encodings
33
+ encoding: "utf-8"
34
+
35
+ # whether to use project's .gitignore files to ignore files
36
+ ignore_all_files_in_gitignore: true
37
+
38
+ # list of additional paths to ignore in all projects
39
+ # same syntax as gitignore, so you can use * and **
40
+ ignored_paths: []
41
+
42
+ # whether the project is in read-only mode
43
+ # If set to true, all editing tools will be disabled and attempts to use them will result in an error
44
+ # Added on 2025-04-18
45
+ read_only: false
46
+
47
+ # list of tool names to exclude. We recommend not excluding any tools, see the readme for more details.
48
+ # Below is the complete list of tools for convenience.
49
+ # To make sure you have the latest list of tools, and to view their descriptions,
50
+ # execute `uv run scripts/print_tool_overview.py`.
51
+ #
52
+ # * `activate_project`: Activates a project by name.
53
+ # * `check_onboarding_performed`: Checks whether project onboarding was already performed.
54
+ # * `create_text_file`: Creates/overwrites a file in the project directory.
55
+ # * `delete_lines`: Deletes a range of lines within a file.
56
+ # * `delete_memory`: Deletes a memory from Serena's project-specific memory store.
57
+ # * `execute_shell_command`: Executes a shell command.
58
+ # * `find_referencing_code_snippets`: Finds code snippets in which the symbol at the given location is referenced.
59
+ # * `find_referencing_symbols`: Finds symbols that reference the symbol at the given location (optionally filtered by type).
60
+ # * `find_symbol`: Performs a global (or local) search for symbols with/containing a given name/substring (optionally filtered by type).
61
+ # * `get_current_config`: Prints the current configuration of the agent, including the active and available projects, tools, contexts, and modes.
62
+ # * `get_symbols_overview`: Gets an overview of the top-level symbols defined in a given file.
63
+ # * `initial_instructions`: Gets the initial instructions for the current project.
64
+ # Should only be used in settings where the system prompt cannot be set,
65
+ # e.g. in clients you have no control over, like Claude Desktop.
66
+ # * `insert_after_symbol`: Inserts content after the end of the definition of a given symbol.
67
+ # * `insert_at_line`: Inserts content at a given line in a file.
68
+ # * `insert_before_symbol`: Inserts content before the beginning of the definition of a given symbol.
69
+ # * `list_dir`: Lists files and directories in the given directory (optionally with recursion).
70
+ # * `list_memories`: Lists memories in Serena's project-specific memory store.
71
+ # * `onboarding`: Performs onboarding (identifying the project structure and essential tasks, e.g. for testing or building).
72
+ # * `prepare_for_new_conversation`: Provides instructions for preparing for a new conversation (in order to continue with the necessary context).
73
+ # * `read_file`: Reads a file within the project directory.
74
+ # * `read_memory`: Reads the memory with the given name from Serena's project-specific memory store.
75
+ # * `remove_project`: Removes a project from the Serena configuration.
76
+ # * `replace_lines`: Replaces a range of lines within a file with new content.
77
+ # * `replace_symbol_body`: Replaces the full definition of a symbol.
78
+ # * `restart_language_server`: Restarts the language server, may be necessary when edits not through Serena happen.
79
+ # * `search_for_pattern`: Performs a search for a pattern in the project.
80
+ # * `summarize_changes`: Provides instructions for summarizing the changes made to the codebase.
81
+ # * `switch_modes`: Activates modes by providing a list of their names
82
+ # * `think_about_collected_information`: Thinking tool for pondering the completeness of collected information.
83
+ # * `think_about_task_adherence`: Thinking tool for determining whether the agent is still on track with the current task.
84
+ # * `think_about_whether_you_are_done`: Thinking tool for determining whether the task is truly completed.
85
+ # * `write_memory`: Writes a named memory (for future reference) to Serena's project-specific memory store.
86
+ excluded_tools: []
87
+
88
+ # list of tools to include that would otherwise be disabled (particularly optional tools that are disabled by default)
89
+ included_optional_tools: []
90
+
91
+ # fixed set of tools to use as the base tool set (if non-empty), replacing Serena's default set of tools.
92
+ # This cannot be combined with non-empty excluded_tools or included_optional_tools.
93
+ fixed_tools: []
94
+
95
+ # list of mode names to that are always to be included in the set of active modes
96
+ # The full set of modes to be activated is base_modes + default_modes.
97
+ # If the setting is undefined, the base_modes from the global configuration (serena_config.yml) apply.
98
+ # Otherwise, this setting overrides the global configuration.
99
+ # Set this to [] to disable base modes for this project.
100
+ # Set this to a list of mode names to always include the respective modes for this project.
101
+ base_modes:
102
+
103
+ # list of mode names that are to be activated by default.
104
+ # The full set of modes to be activated is base_modes + default_modes.
105
+ # If the setting is undefined, the default_modes from the global configuration (serena_config.yml) apply.
106
+ # Otherwise, this overrides the setting from the global configuration (serena_config.yml).
107
+ # This setting can, in turn, be overridden by CLI parameters (--mode).
108
+ default_modes:
109
+
110
+ # initial prompt for the project. It will always be given to the LLM upon activating the project
111
+ # (contrary to the memories, which are loaded on demand).
112
+ initial_prompt: ""
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import chalk from "chalk";
3
- import inquirer from "inquirer";
3
+ import { password } from "@inquirer/prompts";
4
4
  import ora from "ora";
5
5
  import { homedir } from "os";
6
6
  import { join } from "path";
@@ -111,15 +111,11 @@ async function main() {
111
111
  console.log(chalk.dim(" 4. 输入名称,分组选择 cc5(推荐,实惠还快,也可选其他)"));
112
112
  console.log(chalk.dim(" 5. 点击提交,复制 Key 粘贴到下方"));
113
113
  console.log();
114
- const { apiKey } = await inquirer.prompt([
115
- {
116
- type: "password",
117
- name: "apiKey",
118
- message: "请输入你的 API Key:",
119
- mask: "●",
120
- validate: (input) => input.trim().length > 0 ? true : "API Key 不能为空",
121
- },
122
- ]);
114
+ const apiKey = await password({
115
+ message: "请输入你的 API Key:",
116
+ mask: "",
117
+ validate: (input) => input.trim().length > 0 ? true : "API Key 不能为空",
118
+ });
123
119
  const spinner = ora("正在写入配置...").start();
124
120
  try {
125
121
  const home = homedir();
@@ -0,0 +1,63 @@
1
+ # 替换 inquirer 为 @inquirer/prompts 修复 npx 运行报错
2
+
3
+ ## 修改背景
4
+
5
+ 通过 `npx pengui-api` 运行时,出现以下错误:
6
+
7
+ ```
8
+ ERR_MODULE_NOT_FOUND: Cannot find package 'rxjs' imported from inquirer/lib/prompts/list.js
9
+ ```
10
+
11
+ 原因是 `inquirer@9.x` 内部依赖 `rxjs`,但 `npx` 在临时缓存中安装包时,`rxjs` 未被正确解析。
12
+ 这在 Node.js v24 + ESM (`"type": "module"`) 模式下尤其容易触发,因为 ESM 的模块解析比 CommonJS 更严格,
13
+ 不允许隐式访问嵌套依赖。
14
+
15
+ ## 修改内容
16
+
17
+ ### 1. 替换依赖
18
+
19
+ - **移除**: `inquirer@^9.2.12`、`@types/inquirer@^9.0.7`
20
+ - **新增**: `@inquirer/prompts@^7.0.0`
21
+
22
+ `@inquirer/prompts` 是 inquirer 团队推出的新一代包,不依赖 `rxjs`,体积更小,原生支持 ESM。
23
+
24
+ ### 2. 修改源码 (`src/cli.ts`)
25
+
26
+ - 将 `import inquirer from "inquirer"` 改为 `import { password } from "@inquirer/prompts"`
27
+ - 将 `inquirer.prompt()` 调用改为直接使用 `password()` 函数,API 更简洁
28
+
29
+ ### 修改前:
30
+ ```typescript
31
+ import inquirer from "inquirer";
32
+
33
+ const { apiKey } = await inquirer.prompt<{ apiKey: string }>([
34
+ {
35
+ type: "password",
36
+ name: "apiKey",
37
+ message: "请输入你的 API Key:",
38
+ mask: "●",
39
+ validate: (input: string) =>
40
+ input.trim().length > 0 ? true : "API Key 不能为空",
41
+ },
42
+ ]);
43
+ ```
44
+
45
+ ### 修改后:
46
+ ```typescript
47
+ import { password } from "@inquirer/prompts";
48
+
49
+ const apiKey = await password({
50
+ message: "请输入你的 API Key:",
51
+ mask: "●",
52
+ validate: (input: string) =>
53
+ input.trim().length > 0 ? true : "API Key 不能为空",
54
+ });
55
+ ```
56
+
57
+ ## 修改分析
58
+
59
+ - `@inquirer/prompts` 不依赖 `rxjs`,从根本上解决了 npx 临时安装时依赖缺失的问题
60
+ - 依赖数量从 53 个减少到 53 个(减少了 33 个旧包,新增 15 个更轻量的包)
61
+ - API 更简洁:不再需要 `prompt()` 包装数组,直接调用对应的 prompt 函数
62
+ - 类型支持内置,无需额外安装 `@types/inquirer`
63
+ - 编译通过,无 TypeScript 错误
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pengui-api",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Pengui-API 一键配置 Claude Code 环境",
5
5
  "bin": {
6
6
  "pengui-api": "dist/cli.js"
@@ -20,11 +20,10 @@
20
20
  "license": "MIT",
21
21
  "dependencies": {
22
22
  "chalk": "^5.3.0",
23
- "inquirer": "^9.2.12",
23
+ "@inquirer/prompts": "^7.0.0",
24
24
  "ora": "^8.0.1"
25
25
  },
26
26
  "devDependencies": {
27
- "@types/inquirer": "^9.0.7",
28
27
  "@types/node": "^22.0.0",
29
28
  "typescript": "^5.7.0"
30
29
  }
package/src/cli.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import chalk from "chalk";
4
- import inquirer from "inquirer";
4
+ import { password } from "@inquirer/prompts";
5
5
  import ora from "ora";
6
6
  import { homedir } from "os";
7
7
  import { join } from "path";
@@ -129,16 +129,12 @@ async function main(): Promise<void> {
129
129
  console.log(chalk.dim(" 5. 点击提交,复制 Key 粘贴到下方"));
130
130
  console.log();
131
131
 
132
- const { apiKey } = await inquirer.prompt<{ apiKey: string }>([
133
- {
134
- type: "password",
135
- name: "apiKey",
136
- message: "请输入你的 API Key:",
137
- mask: "●",
138
- validate: (input: string) =>
139
- input.trim().length > 0 ? true : "API Key 不能为空",
140
- },
141
- ]);
132
+ const apiKey = await password({
133
+ message: "请输入你的 API Key:",
134
+ mask: "",
135
+ validate: (input: string) =>
136
+ input.trim().length > 0 ? true : "API Key 不能为空",
137
+ });
142
138
 
143
139
  const spinner = ora("正在写入配置...").start();
144
140