@saifymatteo/pi-x-ide 0.0.0-stage → 1.20.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.
- package/CHANGELOG.md +328 -0
- package/CONTRIBUTING.md +119 -0
- package/CONTRIBUTING.zh-CN.md +106 -0
- package/LICENSE +201 -0
- package/README.md +33 -2
- package/README.zh-CN.md +34 -0
- package/RELEASE.md +213 -0
- package/config.example.json +9 -0
- package/dist/src/pi/chunks/chunk-4RHJAL4S.js +200 -0
- package/dist/src/pi/chunks/chunk-UUXVCTOS.js +819 -0
- package/dist/src/pi/chunks/config-ui-LO3DVQFC.js +8073 -0
- package/dist/src/pi/chunks/runtime-services-TUOTPMCH.js +19569 -0
- package/dist/src/pi/commands.js +126 -0
- package/dist/src/pi/config-ui.js +127 -0
- package/dist/src/pi/connection.js +237 -0
- package/dist/src/pi/context.js +30 -0
- package/dist/src/pi/diagnostic-renderer.js +326 -0
- package/dist/src/pi/diagnostic-types.js +1 -0
- package/dist/src/pi/diagnostics.js +104 -0
- package/dist/src/pi/discovery.js +135 -0
- package/dist/src/pi/effect-boundary.js +5 -0
- package/dist/src/pi/ide-host.js +68 -0
- package/dist/src/pi/index.js +636 -0
- package/dist/src/pi/install.js +308 -0
- package/dist/src/pi/reconnect.js +57 -0
- package/dist/src/pi/runtime-loader.js +38 -0
- package/dist/src/pi/runtime-services.js +356 -0
- package/dist/src/pi/safety.js +61 -0
- package/dist/src/pi/selection.js +18 -0
- package/dist/src/pi/state.js +13 -0
- package/dist/src/pi/ui.js +304 -0
- package/dist/src/pi/zed.js +409 -0
- package/dist/src/shared/config-options.js +45 -0
- package/dist/src/shared/config.js +183 -0
- package/dist/src/shared/display-width.js +99 -0
- package/dist/src/shared/effect-errors.js +36 -0
- package/dist/src/shared/effect-runtime.js +36 -0
- package/dist/src/shared/effect-schema.js +120 -0
- package/dist/src/shared/errors.js +48 -0
- package/dist/src/shared/format.js +92 -0
- package/dist/src/shared/ide-server.js +167 -0
- package/dist/src/shared/jsonrpc-guard.js +12 -0
- package/dist/src/shared/lock-file-heartbeat.js +58 -0
- package/dist/src/shared/lock-file.js +50 -0
- package/dist/src/shared/paths.js +79 -0
- package/dist/src/shared/platform.js +57 -0
- package/dist/src/shared/protocol.js +3 -0
- package/dist/src/shared/schema.js +37 -0
- package/dist/src/shared/version.js +1 -0
- package/dist/src/shared/ws.js +8 -0
- package/docs/explanation/architecture.md +123 -0
- package/docs/explanation/discovery.md +113 -0
- package/docs/explanation/effect.md +127 -0
- package/docs/how-to/install-jetbrains.md +58 -0
- package/docs/how-to/install-neovim.md +138 -0
- package/docs/how-to/install-vscode.md +75 -0
- package/docs/how-to/install-zed.md +70 -0
- package/docs/how-to/troubleshoot-connection.md +103 -0
- package/docs/how-to/use-wsl2.md +90 -0
- package/docs/reference/commands.md +59 -0
- package/docs/reference/configuration.md +101 -0
- package/docs/reference/feature-parity.md +26 -0
- package/docs/reference/protocol.md +71 -0
- package/docs/specs/ide-protocol.md +215 -0
- package/docs/tutorials/get-started.md +133 -0
- package/docs/zh-CN/explanation/architecture.md +93 -0
- package/docs/zh-CN/explanation/discovery.md +71 -0
- package/docs/zh-CN/explanation/effect.md +90 -0
- package/docs/zh-CN/how-to/install-jetbrains.md +49 -0
- package/docs/zh-CN/how-to/install-neovim.md +126 -0
- package/docs/zh-CN/how-to/install-vscode.md +67 -0
- package/docs/zh-CN/how-to/install-zed.md +56 -0
- package/docs/zh-CN/how-to/troubleshoot-connection.md +85 -0
- package/docs/zh-CN/how-to/use-wsl2.md +75 -0
- package/docs/zh-CN/reference/commands.md +54 -0
- package/docs/zh-CN/reference/configuration.md +94 -0
- package/docs/zh-CN/reference/feature-parity.md +21 -0
- package/docs/zh-CN/reference/protocol.md +54 -0
- package/docs/zh-CN/tutorials/get-started.md +101 -0
- package/package.json +86 -4
- package/schemas/config.json +77 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,34 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Pi × IDE — Saifymatteo fork
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**English** | [简体中文](README.zh-CN.md)
|
|
4
|
+
|
|
5
|
+
This is [@saifymatteo/pi-x-ide](https://github.com/saifymatteo/pi-x-ide), a fork of [@balaenis/pi-x-ide](https://github.com/balaenis/pi-x-ide).
|
|
6
|
+
|
|
7
|
+
For the original project overview, supported IDEs, installation instructions, and general documentation, see the [upstream README](https://github.com/balaenis/pi-x-ide#readme).
|
|
8
|
+
|
|
9
|
+
## Changes in this fork
|
|
10
|
+
|
|
11
|
+
When IDE context is attached to a prompt, Pi displays it as a separate purple **IDE Context** message. The message contains the IDE name, file path, and—when available—the selected line range. It does not include selected source contents, so the agent can inspect the file itself when it needs more context. Your prompt remains unchanged.
|
|
12
|
+
|
|
13
|
+
For example:
|
|
14
|
+
|
|
15
|
+
```text
|
|
16
|
+
### IDE Context
|
|
17
|
+
- **IDE**: vscode
|
|
18
|
+
- **File**: `src/main.ts`
|
|
19
|
+
- **Selection**: L10-L20
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
When no text is selected, the selection line is omitted. For open-file-only context, the message includes the file metadata without attaching its contents.
|
|
23
|
+
|
|
24
|
+
## Documentation
|
|
25
|
+
|
|
26
|
+
- [Get started](docs/tutorials/get-started.md)
|
|
27
|
+
- [Configuration](docs/reference/configuration.md)
|
|
28
|
+
- [Architecture](docs/explanation/architecture.md)
|
|
29
|
+
|
|
30
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for development instructions.
|
|
31
|
+
|
|
32
|
+
## License
|
|
33
|
+
|
|
34
|
+
This fork retains the upstream [Apache-2.0 license](LICENSE).
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Pi × IDE — Saifymatteo 分支
|
|
2
|
+
|
|
3
|
+
[English](README.md) | **简体中文**
|
|
4
|
+
|
|
5
|
+
这是 [@saifymatteo/pi-x-ide](https://github.com/saifymatteo/pi-x-ide),基于 [@balaenis/pi-x-ide](https://github.com/balaenis/pi-x-ide) 的分支。
|
|
6
|
+
|
|
7
|
+
有关上游项目的介绍、支持的 IDE、安装说明和通用文档,请参阅[上游 README](https://github.com/balaenis/pi-x-ide#readme)。
|
|
8
|
+
|
|
9
|
+
## 此分支的更改
|
|
10
|
+
|
|
11
|
+
将 IDE 上下文附加到提示时,Pi 会将其显示为单独的紫色 **IDE Context** 消息。消息包含 IDE 名称、文件路径,以及(如果有)所选行范围。消息不会包含选中的源代码,因此代理可以在需要更多上下文时自行读取文件。用户提示保持不变。
|
|
12
|
+
|
|
13
|
+
例如:
|
|
14
|
+
|
|
15
|
+
```text
|
|
16
|
+
### IDE Context
|
|
17
|
+
- **IDE**: vscode
|
|
18
|
+
- **File**: `src/main.ts`
|
|
19
|
+
- **Selection**: L10-L20
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
未选择文本时会省略选区行。仅附加当前打开文件时,消息包含文件元数据,不会附加文件内容。
|
|
23
|
+
|
|
24
|
+
## 文档
|
|
25
|
+
|
|
26
|
+
- [入门指南](docs/zh-CN/tutorials/get-started.md)
|
|
27
|
+
- [配置](docs/zh-CN/reference/configuration.md)
|
|
28
|
+
- [架构](docs/zh-CN/explanation/architecture.md)
|
|
29
|
+
|
|
30
|
+
开发说明请参阅 [CONTRIBUTING.zh-CN.md](CONTRIBUTING.zh-CN.md)。
|
|
31
|
+
|
|
32
|
+
## 许可证
|
|
33
|
+
|
|
34
|
+
此分支沿用上游的 [Apache-2.0 许可证](LICENSE)。
|
package/RELEASE.md
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
# Release Process
|
|
2
|
+
|
|
3
|
+
This project uses [Release Please](https://github.com/googleapis/release-please) for automated releases.
|
|
4
|
+
|
|
5
|
+
It follows two release channels:
|
|
6
|
+
|
|
7
|
+
- **Pre-release**: Normal PRs merged to `main` create `x.x.x-next.N` versions published to the `next` npm dist-tag for testing and feedback.
|
|
8
|
+
- **Stable Releases**: Release PRs merged to `main` create computed versions and publish to the `latest` npm dist-tag.
|
|
9
|
+
|
|
10
|
+
You can also trigger manual releases in the following ways:
|
|
11
|
+
|
|
12
|
+
- Push a tag in the format `v{semver}` (e.g. `v1.2.3`)
|
|
13
|
+
- Run the `publish.yml` workflow manually from the GitHub Actions tab and supply a channel `latest` or `next`.
|
|
14
|
+
|
|
15
|
+
## First Release
|
|
16
|
+
|
|
17
|
+
Before automated releases will work, you need to perform the first release manually.
|
|
18
|
+
|
|
19
|
+
Why:
|
|
20
|
+
|
|
21
|
+
- The first release creates the npm package on npmjs.com.
|
|
22
|
+
- This then allows you to set up trusted publishing with GitHub Actions for future releases.
|
|
23
|
+
|
|
24
|
+
### Steps
|
|
25
|
+
|
|
26
|
+
1. Make sure the `package.json` is correct:
|
|
27
|
+
- Is the `version` correct?
|
|
28
|
+
- Is the package name correct?
|
|
29
|
+
- Do you have the right `keywords`?
|
|
30
|
+
- Do you have the right `repository` field?
|
|
31
|
+
- Do you have the right `author` field?
|
|
32
|
+
|
|
33
|
+
2. Run `bunx npm login` to authenticate with npm.
|
|
34
|
+
|
|
35
|
+
3. Run `mise run build` to build the package.
|
|
36
|
+
|
|
37
|
+
4. Run `bun publish --access public` to publish the first version.
|
|
38
|
+
|
|
39
|
+
5. Go to your npm package settings on npmjs.com and add a trusted publisher for GitHub Actions with:
|
|
40
|
+
- **Organization or user**: Your GitHub username/org
|
|
41
|
+
- **Repository**: Your repository name
|
|
42
|
+
- **Workflow filename**: `publish.yml` (the publish workflow filename)
|
|
43
|
+
|
|
44
|
+
6. [Restrict token access](https://docs.npmjs.com/trusted-publishers#recommended-restrict-token-access-when-using-trusted-publishers) for maximum security.
|
|
45
|
+
|
|
46
|
+
## Release Workflow
|
|
47
|
+
|
|
48
|
+
### Conventional Commits
|
|
49
|
+
|
|
50
|
+
We follow [Conventional Commits](https://www.conventionalcommits.org/) specification:
|
|
51
|
+
|
|
52
|
+
- `fix:` patches
|
|
53
|
+
- `feat:` minor features
|
|
54
|
+
- `feat!:` or `fix!:` breaking changes
|
|
55
|
+
|
|
56
|
+
### Pre-1.0 Versioning
|
|
57
|
+
|
|
58
|
+
While the version is `0.x.x`, breaking changes bump the **minor** version.
|
|
59
|
+
|
|
60
|
+
### Release Process
|
|
61
|
+
|
|
62
|
+
1. Push commits to the `main` branch
|
|
63
|
+
2. Release Please will:
|
|
64
|
+
- Analyze commits
|
|
65
|
+
- Determine version bump
|
|
66
|
+
- Update `package.json`
|
|
67
|
+
- Update `CHANGELOG.md`
|
|
68
|
+
- Create a release PR
|
|
69
|
+
|
|
70
|
+
3. Review and merge the Release Please PR
|
|
71
|
+
|
|
72
|
+
### Commit Message Examples
|
|
73
|
+
|
|
74
|
+
- `fix: resolve IDE connection timeout`
|
|
75
|
+
- `feat: add VS Code workspace trust support`
|
|
76
|
+
- `feat!: change extension activation API`
|
|
77
|
+
- `docs: improve README`
|
|
78
|
+
- `chore: update dependencies`
|
|
79
|
+
|
|
80
|
+
## Advanced Release Features
|
|
81
|
+
|
|
82
|
+
### Force a Specific Version
|
|
83
|
+
|
|
84
|
+
Use the `Release-As` footer in your commit message to force a specific version, bypassing conventional commit analysis:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
git commit --allow-empty -m "chore: release 2.0.0" -m "Release-As: 2.0.0"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
This creates a commit:
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
chore: release 2.0.0
|
|
94
|
+
|
|
95
|
+
Release-As: 2.0.0
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Release Please will open a PR for version `2.0.0` regardless of commit message types.
|
|
99
|
+
|
|
100
|
+
### Update Extra Files During Release
|
|
101
|
+
|
|
102
|
+
If you have version numbers in other files beyond `package.json`, configure them in `release-please-config.json`:
|
|
103
|
+
|
|
104
|
+
```json
|
|
105
|
+
{
|
|
106
|
+
"extra-files": [
|
|
107
|
+
"src/version.ts",
|
|
108
|
+
{
|
|
109
|
+
"type": "generic",
|
|
110
|
+
"path": "docs/VERSION.md"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"type": "json",
|
|
114
|
+
"path": "ide-plugins/vscode/package.json",
|
|
115
|
+
"jsonpath": "$.version"
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**Supported file types:**
|
|
122
|
+
|
|
123
|
+
- Generic files (any type)
|
|
124
|
+
- JSON files (with JSONPath)
|
|
125
|
+
- YAML files (with JSONPath)
|
|
126
|
+
- XML files (with XPath)
|
|
127
|
+
- TOML files (with JSONPath)
|
|
128
|
+
|
|
129
|
+
### Magic Comments for Version Markers
|
|
130
|
+
|
|
131
|
+
Use inline comments to mark where versions should be updated:
|
|
132
|
+
|
|
133
|
+
```javascript
|
|
134
|
+
// x-release-please-version
|
|
135
|
+
const VERSION = "1.0.0";
|
|
136
|
+
|
|
137
|
+
// x-release-please-major
|
|
138
|
+
const MAJOR = "1";
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Or use block markers:
|
|
142
|
+
|
|
143
|
+
```markdown
|
|
144
|
+
<!-- x-release-please-start-version -->
|
|
145
|
+
|
|
146
|
+
- Current version: 1.0.0
|
|
147
|
+
<!-- x-release-please-end -->
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Available markers:
|
|
151
|
+
|
|
152
|
+
- `x-release-please-version` - Full semver
|
|
153
|
+
- `x-release-please-major` - Major number
|
|
154
|
+
- `x-release-please-minor` - Minor number
|
|
155
|
+
- `x-release-please-patch` - Patch number
|
|
156
|
+
|
|
157
|
+
## Do Not
|
|
158
|
+
|
|
159
|
+
- Manually edit Release Please PRs
|
|
160
|
+
- Manually create GitHub releases
|
|
161
|
+
- Modify version numbers directly
|
|
162
|
+
|
|
163
|
+
## Publishing
|
|
164
|
+
|
|
165
|
+
Releases are automatically published to npm when the Release Please PR is merged.
|
|
166
|
+
|
|
167
|
+
### NPM Trusted Publishing
|
|
168
|
+
|
|
169
|
+
This project supports [NPM Trusted Publishing](https://docs.npmjs.com/trusted-publishers) with GitHub Actions. No npm tokens are needed — authentication is handled automatically via OIDC (OpenID Connect).
|
|
170
|
+
|
|
171
|
+
**How it works:**
|
|
172
|
+
|
|
173
|
+
- Each publish uses short-lived, cryptographically-signed tokens specific to your workflow
|
|
174
|
+
- Tokens cannot be extracted or reused
|
|
175
|
+
- No need to manage or rotate long-lived credentials
|
|
176
|
+
|
|
177
|
+
**Setup required:**
|
|
178
|
+
|
|
179
|
+
1. Go to your npm package settings on npmjs.com
|
|
180
|
+
2. Add a trusted publisher for GitHub Actions with:
|
|
181
|
+
- **Organization or user**: Your GitHub username/org
|
|
182
|
+
- **Repository**: Your repository name
|
|
183
|
+
- **Workflow filename**: `publish.yml` (the publish workflow filename)
|
|
184
|
+
3. Optionally, [restrict token access](https://docs.npmjs.com/trusted-publishers#recommended-restrict-token-access-when-using-trusted-publishers) for maximum security
|
|
185
|
+
|
|
186
|
+
When you merge a release PR, the GitHub Actions workflow will automatically:
|
|
187
|
+
|
|
188
|
+
1. Build the package
|
|
189
|
+
2. Publish to npm with OIDC authentication
|
|
190
|
+
3. Create a GitHub release
|
|
191
|
+
|
|
192
|
+
### Manual Releases
|
|
193
|
+
|
|
194
|
+
You can also manually trigger a release by pushing a tag in the format `v{semver}`:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
git tag v1.2.3
|
|
198
|
+
git push origin v1.2.3
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
This will:
|
|
202
|
+
|
|
203
|
+
1. Trigger the release workflow
|
|
204
|
+
2. Build and publish to npm
|
|
205
|
+
3. Create a GitHub release
|
|
206
|
+
|
|
207
|
+
Use manual releases for:
|
|
208
|
+
|
|
209
|
+
- Hot-fixes outside the normal release cycle
|
|
210
|
+
- Bypassing Release Please when needed
|
|
211
|
+
- Direct version control over releases
|
|
212
|
+
|
|
213
|
+
**Learn more:** See the [NPM Trusted Publishing documentation](https://docs.npmjs.com/trusted-publishers) for complete setup and best practices.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/saifymatteo/pi-x-ide/refs/heads/main/schemas/config.json",
|
|
3
|
+
"fixPrompt": "Analyze the errors and warnings at the following location, and try to fix them:\n{DIAGNOSTIC}",
|
|
4
|
+
"status_display": "widget",
|
|
5
|
+
"env": {
|
|
6
|
+
"PI_X_IDE_AUTO_INSTALL": "1",
|
|
7
|
+
"PI_X_IDE_ATTACH_SHORTCUT": "ctrl+alt+k"
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { createRequire as __piCreateRequire } from "node:module";const require = __piCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
errorMessage,
|
|
4
|
+
formatExtensionError,
|
|
5
|
+
isStaleContextError,
|
|
6
|
+
logExtensionError,
|
|
7
|
+
readPiConfigFixPrompt,
|
|
8
|
+
safeRun,
|
|
9
|
+
safeRunAsync,
|
|
10
|
+
setExtensionErrorReporter,
|
|
11
|
+
snapshotKey,
|
|
12
|
+
updateIdeUi
|
|
13
|
+
} from "./chunk-UUXVCTOS.js";
|
|
14
|
+
|
|
15
|
+
// src/pi/safety.ts
|
|
16
|
+
function deliverPiError(scope, error, ctx) {
|
|
17
|
+
try {
|
|
18
|
+
if (!ctx?.hasUI) return false;
|
|
19
|
+
ctx.ui.notify(formatExtensionError(scope, error), "error");
|
|
20
|
+
return true;
|
|
21
|
+
} catch {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function flushPendingPiErrors(runtime) {
|
|
26
|
+
if (runtime.pendingExtensionErrors.length === 0) return;
|
|
27
|
+
const pending = runtime.pendingExtensionErrors;
|
|
28
|
+
runtime.pendingExtensionErrors = [];
|
|
29
|
+
for (const item of pending) {
|
|
30
|
+
if (isStaleContextError(item.error)) continue;
|
|
31
|
+
if (!deliverPiError(item.scope, item.error, runtime.ctx)) {
|
|
32
|
+
runtime.pendingExtensionErrors.push(item);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function bindPiUiContext(runtime, ctx) {
|
|
37
|
+
runtime.ctx = ctx;
|
|
38
|
+
flushPendingPiErrors(runtime);
|
|
39
|
+
}
|
|
40
|
+
function reportPiExtensionError(runtime, scope, error) {
|
|
41
|
+
if (isStaleContextError(error)) return;
|
|
42
|
+
if (deliverPiError(scope, error, runtime.ctx)) return;
|
|
43
|
+
runtime.pendingExtensionErrors.push({ scope, error });
|
|
44
|
+
}
|
|
45
|
+
function installPiErrorReporter(runtime) {
|
|
46
|
+
setExtensionErrorReporter((scope, error) => {
|
|
47
|
+
reportPiExtensionError(runtime, scope, error);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function containPiError(runtime, scope, error, ctx = runtime.ctx) {
|
|
51
|
+
if (ctx) bindPiUiContext(runtime, ctx);
|
|
52
|
+
logExtensionError(scope, error);
|
|
53
|
+
runtime.connectionStatus = "error";
|
|
54
|
+
runtime.connectionMessage = `${scope}: ${errorMessage(error)}`;
|
|
55
|
+
safeRun(`${scope} update UI after error`, () => updateIdeUi(runtime, ctx ?? runtime.ctx));
|
|
56
|
+
}
|
|
57
|
+
function runPiBoundary(scope, runtime, action, ctx) {
|
|
58
|
+
return safeRun(scope, action, (error) => containPiError(runtime, scope, error, ctx));
|
|
59
|
+
}
|
|
60
|
+
async function runPiBoundaryAsync(scope, runtime, action, ctx) {
|
|
61
|
+
return safeRunAsync(scope, action, (error) => containPiError(runtime, scope, error, ctx));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// src/pi/diagnostic-types.ts
|
|
65
|
+
var DIAGNOSTIC_FIX_CUSTOM_TYPE = "pi-x-ide/diagnostic-fix";
|
|
66
|
+
|
|
67
|
+
// src/pi/diagnostics.ts
|
|
68
|
+
var DIAGNOSTIC_CONTEXT_MARKER = "pi-x-ide/diagnostic-context";
|
|
69
|
+
function buildDiagnosticFixPrompt(params, options = {}) {
|
|
70
|
+
const context = buildDiagnosticContextMessage(params);
|
|
71
|
+
const template = options.fixPrompt;
|
|
72
|
+
if (!template) {
|
|
73
|
+
return `Analyze the errors and warnings at the following location, and try to fix them:
|
|
74
|
+
${context}`;
|
|
75
|
+
}
|
|
76
|
+
if (template.includes("{DIAGNOSTIC}")) {
|
|
77
|
+
return template.replaceAll("{DIAGNOSTIC}", context);
|
|
78
|
+
}
|
|
79
|
+
return `${template}
|
|
80
|
+
${context}`;
|
|
81
|
+
}
|
|
82
|
+
function buildDiagnosticContextMessage(params) {
|
|
83
|
+
return `<!-- ${DIAGNOSTIC_CONTEXT_MARKER} -->
|
|
84
|
+
${formatDiagnosticContext(params)}
|
|
85
|
+
<!-- ${DIAGNOSTIC_CONTEXT_MARKER} -->
|
|
86
|
+
`;
|
|
87
|
+
}
|
|
88
|
+
function formatDiagnosticContext(params) {
|
|
89
|
+
const filePath = params.filePath;
|
|
90
|
+
const lines = [`File: ${filePath}`, `Source: ${params.source}`];
|
|
91
|
+
if (params.documentVersion !== void 0) lines.push(`Document version: ${params.documentVersion}`);
|
|
92
|
+
lines.push(`Trigger range: ${formatRange(params.triggerRange)}`);
|
|
93
|
+
for (const [index, diagnostic] of params.diagnostics.entries()) {
|
|
94
|
+
lines.push("", `Diagnostic ${index + 1}:`);
|
|
95
|
+
lines.push(`- Severity: ${diagnostic.severity}`);
|
|
96
|
+
if (diagnostic.source) lines.push(`- Source: ${diagnostic.source}`);
|
|
97
|
+
if (diagnostic.code !== void 0) lines.push(`- Code: ${formatDiagnosticCode(diagnostic.code)}`);
|
|
98
|
+
lines.push(`- Range: ${formatRange(diagnostic.range)}`);
|
|
99
|
+
lines.push(`- Message: ${diagnostic.message}`);
|
|
100
|
+
if (diagnostic.selectedText.length > 0) {
|
|
101
|
+
lines.push("- Selected text:", fence(diagnostic.selectedText));
|
|
102
|
+
}
|
|
103
|
+
if (diagnostic.contextLines.length > 0) {
|
|
104
|
+
lines.push("- Context lines:");
|
|
105
|
+
for (const contextLine of diagnostic.contextLines) {
|
|
106
|
+
const marker = contextLine.isPrimary ? "\\>" : " ";
|
|
107
|
+
lines.push(` ${marker} ${contextLine.line + 1}: ${contextLine.text}`);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (diagnostic.relatedInformation && diagnostic.relatedInformation.length > 0) {
|
|
111
|
+
lines.push("- Related information:");
|
|
112
|
+
for (const related of diagnostic.relatedInformation) {
|
|
113
|
+
const relatedPath = related.filePath;
|
|
114
|
+
lines.push(` - ${relatedPath} ${formatRange(related.range)}: ${related.message}`);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return lines.join("\n");
|
|
119
|
+
}
|
|
120
|
+
function handleDiagnosticFixRequested(pi, runtime, params) {
|
|
121
|
+
const ctx = runtime.ctx;
|
|
122
|
+
if (!ctx) return;
|
|
123
|
+
if (params.action === "send-diagnostic") {
|
|
124
|
+
if (!ctx.hasUI) return;
|
|
125
|
+
ctx.ui.pasteToEditor(buildDiagnosticContextMessage(params));
|
|
126
|
+
ctx.ui.notify("VS Code diagnostic context added to input.", "info");
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
const fixPrompt = readPiConfigFixPrompt();
|
|
130
|
+
const prompt = buildDiagnosticFixPrompt(params, { fixPrompt });
|
|
131
|
+
const details = {
|
|
132
|
+
source: params.source,
|
|
133
|
+
filePath: params.filePath,
|
|
134
|
+
workspaceFolder: params.workspaceFolder,
|
|
135
|
+
triggerRange: params.triggerRange,
|
|
136
|
+
diagnostics: params.diagnostics,
|
|
137
|
+
cwd: ctx.cwd
|
|
138
|
+
};
|
|
139
|
+
pi.sendMessage(
|
|
140
|
+
{
|
|
141
|
+
customType: DIAGNOSTIC_FIX_CUSTOM_TYPE,
|
|
142
|
+
content: prompt,
|
|
143
|
+
display: true,
|
|
144
|
+
details
|
|
145
|
+
},
|
|
146
|
+
{ triggerTurn: true, deliverAs: "followUp" }
|
|
147
|
+
);
|
|
148
|
+
if (!ctx.isIdle() && ctx.hasUI) ctx.ui.notify("VS Code diagnostic fix request queued.", "info");
|
|
149
|
+
}
|
|
150
|
+
function formatRange(range) {
|
|
151
|
+
const start = formatPosition(range.start);
|
|
152
|
+
const end = formatPosition(range.end);
|
|
153
|
+
return start === end ? start : `${start}-${end}`;
|
|
154
|
+
}
|
|
155
|
+
function formatPosition(position) {
|
|
156
|
+
return `L${position.line + 1}:C${position.character + 1}`;
|
|
157
|
+
}
|
|
158
|
+
function formatDiagnosticCode(code) {
|
|
159
|
+
if (typeof code === "string" || typeof code === "number") return String(code);
|
|
160
|
+
return code.target ? `${code.value} (${code.target})` : String(code.value);
|
|
161
|
+
}
|
|
162
|
+
function fence(text) {
|
|
163
|
+
const fenceMarker = text.includes("```") ? "````" : "```";
|
|
164
|
+
return `${fenceMarker}
|
|
165
|
+
${text}
|
|
166
|
+
${fenceMarker}`;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// src/pi/selection.ts
|
|
170
|
+
function setLatestSelection(runtime, snapshot, ctx) {
|
|
171
|
+
const key = snapshotKey(snapshot);
|
|
172
|
+
runtime.latestSelection = snapshot;
|
|
173
|
+
if (runtime.latestSelectionKey !== key) {
|
|
174
|
+
runtime.latestSelectionKey = key;
|
|
175
|
+
runtime.attachState = "pending";
|
|
176
|
+
}
|
|
177
|
+
updateIdeUi(runtime, ctx);
|
|
178
|
+
}
|
|
179
|
+
function clearLatestSelection(runtime, ctx) {
|
|
180
|
+
runtime.latestSelection = void 0;
|
|
181
|
+
runtime.latestSelectionKey = void 0;
|
|
182
|
+
runtime.turnSelection = void 0;
|
|
183
|
+
runtime.attachState = "idle";
|
|
184
|
+
updateIdeUi(runtime, ctx);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export {
|
|
188
|
+
bindPiUiContext,
|
|
189
|
+
installPiErrorReporter,
|
|
190
|
+
containPiError,
|
|
191
|
+
runPiBoundary,
|
|
192
|
+
runPiBoundaryAsync,
|
|
193
|
+
DIAGNOSTIC_FIX_CUSTOM_TYPE,
|
|
194
|
+
DIAGNOSTIC_CONTEXT_MARKER,
|
|
195
|
+
handleDiagnosticFixRequested,
|
|
196
|
+
formatRange,
|
|
197
|
+
formatDiagnosticCode,
|
|
198
|
+
setLatestSelection,
|
|
199
|
+
clearLatestSelection
|
|
200
|
+
};
|