portercode 0.1.4 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/LICENSE +174 -21
  2. package/README.md +162 -68
  3. package/dist/auth/index.d.ts +99 -0
  4. package/dist/brand/index.d.ts +7 -0
  5. package/dist/brand/loader.d.ts +463 -0
  6. package/dist/brand/rules.d.ts +25 -0
  7. package/dist/brand/schema.d.ts +246 -0
  8. package/dist/cli/auth.d.ts +14 -2
  9. package/dist/cli/brand.d.ts +6 -0
  10. package/dist/config/config.d.ts +0 -720
  11. package/dist/constants/index.d.ts +6 -9
  12. package/dist/constants/version.d.ts +5 -0
  13. package/dist/gateway/index.d.ts +5 -4
  14. package/dist/global/index.d.ts +12 -0
  15. package/dist/index.js +39 -1
  16. package/dist/prompt/template.d.ts +24 -0
  17. package/dist/provider/models.d.ts +0 -3
  18. package/dist/provider/provider.d.ts +5 -1
  19. package/dist/server/services/agent.d.ts +11 -0
  20. package/dist/session/context-cache.d.ts +75 -0
  21. package/dist/session/context-optimization.d.ts +5 -0
  22. package/dist/session/llm.d.ts +38 -1
  23. package/dist/session/message-optimizer.d.ts +32 -0
  24. package/dist/session/session.d.ts +101 -9
  25. package/dist/session/types.d.ts +92 -16
  26. package/dist/src/auth/index.d.ts +202 -0
  27. package/dist/src/brand/index.d.ts +7 -0
  28. package/dist/src/bus/bus-event.d.ts +10 -0
  29. package/dist/src/bus/global.d.ts +7 -0
  30. package/dist/src/bus/index.d.ts +26 -0
  31. package/dist/src/cli/auth.d.ts +23 -0
  32. package/dist/src/cli/index.d.ts +1 -0
  33. package/dist/src/cli/ui.d.ts +26 -0
  34. package/dist/src/command/index.d.ts +54 -0
  35. package/dist/src/config/config.d.ts +6036 -0
  36. package/dist/src/config/index.d.ts +2 -0
  37. package/dist/src/config/markdown.d.ts +415 -0
  38. package/dist/src/constants/index.d.ts +6 -0
  39. package/dist/src/constants/version.d.ts +5 -0
  40. package/dist/src/diff/engine.d.ts +15 -0
  41. package/dist/src/diff/index.d.ts +8 -0
  42. package/dist/src/diff/types.d.ts +66 -0
  43. package/dist/src/file/ignore.d.ts +7 -0
  44. package/dist/src/flag/index.d.ts +19 -0
  45. package/dist/src/gateway/bridge.d.ts +11 -0
  46. package/dist/src/gateway/handlers/llm.d.ts +7 -0
  47. package/dist/src/gateway/handlers/permission.d.ts +15 -0
  48. package/dist/src/gateway/handlers/session.d.ts +7 -0
  49. package/dist/src/gateway/handlers/system.d.ts +7 -0
  50. package/dist/src/gateway/handlers/tool.d.ts +7 -0
  51. package/dist/src/gateway/index.d.ts +18 -0
  52. package/dist/src/gateway/protocol.d.ts +159 -0
  53. package/dist/src/gateway/router.d.ts +7 -0
  54. package/dist/src/gateway/server.d.ts +24 -0
  55. package/dist/src/global/index.d.ts +23 -0
  56. package/dist/src/index.d.ts +2 -0
  57. package/dist/src/permission/index.d.ts +2 -0
  58. package/dist/src/permission/permission.d.ts +172 -0
  59. package/dist/src/permission/types.d.ts +109 -0
  60. package/dist/src/project/index.d.ts +3 -0
  61. package/dist/src/project/instance.d.ts +33 -0
  62. package/dist/src/project/project.d.ts +82 -0
  63. package/dist/src/project/state.d.ts +4 -0
  64. package/dist/src/prompt/index.d.ts +5 -0
  65. package/dist/src/prompt/system.d.ts +29 -0
  66. package/dist/src/prompt/template.d.ts +24 -0
  67. package/dist/src/provider/index.d.ts +3 -0
  68. package/dist/src/provider/models.d.ts +14 -0
  69. package/dist/src/provider/provider.d.ts +848 -0
  70. package/dist/src/provider/types.d.ts +328 -0
  71. package/dist/src/server/index.d.ts +21 -0
  72. package/dist/src/server/routes/api.d.ts +2 -0
  73. package/dist/src/server/routes/auth.d.ts +2 -0
  74. package/dist/src/server/routes/events.d.ts +2 -0
  75. package/dist/src/server/routes/health.d.ts +2 -0
  76. package/dist/src/server/routes/sessions.d.ts +2 -0
  77. package/dist/src/server/services/agent.d.ts +40 -0
  78. package/dist/src/server/services/permission.d.ts +43 -0
  79. package/dist/src/server/sse/emitter.d.ts +57 -0
  80. package/dist/src/session/context-cache.d.ts +75 -0
  81. package/dist/src/session/context-optimization.d.ts +165 -0
  82. package/dist/src/session/index.d.ts +5 -0
  83. package/dist/src/session/llm.d.ts +68 -0
  84. package/dist/src/session/message-optimizer.d.ts +32 -0
  85. package/dist/src/session/session.d.ts +524 -0
  86. package/dist/src/session/title-generator.d.ts +11 -0
  87. package/dist/src/session/types.d.ts +713 -0
  88. package/dist/src/snapshot/index.d.ts +40 -0
  89. package/dist/src/storage/index.d.ts +1 -0
  90. package/dist/src/storage/storage.d.ts +34 -0
  91. package/dist/src/theme.d.ts +66 -0
  92. package/dist/src/tool/bash.d.ts +19 -0
  93. package/dist/src/tool/edit.d.ts +21 -0
  94. package/dist/src/tool/glob.d.ts +15 -0
  95. package/dist/src/tool/grep.d.ts +20 -0
  96. package/dist/src/tool/image.d.ts +22 -0
  97. package/dist/src/tool/index.d.ts +11 -0
  98. package/dist/src/tool/ls.d.ts +14 -0
  99. package/dist/src/tool/read.d.ts +17 -0
  100. package/dist/src/tool/registry.d.ts +30 -0
  101. package/dist/src/tool/think.d.ts +11 -0
  102. package/dist/src/tool/todo.d.ts +76 -0
  103. package/dist/src/tool/tool.d.ts +65 -0
  104. package/dist/src/tool/webfetch.d.ts +15 -0
  105. package/dist/src/tool/websearch.d.ts +18 -0
  106. package/dist/src/tool/write.d.ts +16 -0
  107. package/dist/src/tui/App.d.ts +10 -0
  108. package/dist/src/tui/components/Header.d.ts +13 -0
  109. package/dist/src/tui/components/LoadingIndicator.d.ts +26 -0
  110. package/dist/src/tui/components/Message/AssistantMessage.d.ts +11 -0
  111. package/dist/src/tui/components/Message/ReasoningMessage.d.ts +21 -0
  112. package/dist/src/tui/components/Message/ToolCallMessage.d.ts +26 -0
  113. package/dist/src/tui/components/Message/UserMessage.d.ts +12 -0
  114. package/dist/src/tui/components/Message/index.d.ts +16 -0
  115. package/dist/src/tui/components/PermissionPrompt.d.ts +6 -0
  116. package/dist/src/tui/components/PromptInput.d.ts +33 -0
  117. package/dist/src/tui/components/REPL.d.ts +22 -0
  118. package/dist/src/tui/components/Spinner.d.ts +13 -0
  119. package/dist/src/tui/components/StatusBar.d.ts +13 -0
  120. package/dist/src/tui/components/TodoList.d.ts +17 -0
  121. package/dist/src/tui/components/WelcomeBox.d.ts +13 -0
  122. package/dist/src/tui/components/dialogs/DiagnosticsPanel.d.ts +12 -0
  123. package/dist/src/tui/components/dialogs/HelpPanel.d.ts +11 -0
  124. package/dist/src/tui/components/dialogs/ModelSelector.d.ts +14 -0
  125. package/dist/src/tui/components/dialogs/PermissionPrompt.d.ts +17 -0
  126. package/dist/src/tui/components/dialogs/SessionPicker.d.ts +20 -0
  127. package/dist/src/tui/components/dialogs/index.d.ts +10 -0
  128. package/dist/src/tui/components/diff/DiffHunk.d.ts +12 -0
  129. package/dist/src/tui/components/diff/DiffLine.d.ts +14 -0
  130. package/dist/src/tui/components/diff/DiffStats.d.ts +12 -0
  131. package/dist/src/tui/components/diff/DiffView.d.ts +15 -0
  132. package/dist/src/tui/components/diff/index.d.ts +9 -0
  133. package/dist/src/tui/hooks/useAnimatedLabel.d.ts +12 -0
  134. package/dist/src/tui/hooks/usePermission.d.ts +34 -0
  135. package/dist/src/tui/hooks/useTermWidth.d.ts +13 -0
  136. package/dist/src/tui/index.d.ts +20 -0
  137. package/dist/src/tui/theme.d.ts +8 -0
  138. package/dist/src/tui/utils/Cursor.d.ts +37 -0
  139. package/dist/src/tui/utils/clipboard.d.ts +3 -0
  140. package/dist/src/tui/utils/keypress.d.ts +39 -0
  141. package/dist/src/tui/utils/markdown.d.ts +13 -0
  142. package/dist/src/tui/utils/openContent.d.ts +22 -0
  143. package/dist/src/util/ascii.d.ts +22 -0
  144. package/dist/src/util/bell.d.ts +14 -0
  145. package/dist/src/util/color.d.ts +28 -0
  146. package/dist/src/util/context.d.ts +10 -0
  147. package/dist/src/util/debug.d.ts +51 -0
  148. package/dist/src/util/error.d.ts +294 -0
  149. package/dist/src/util/example-commands.d.ts +18 -0
  150. package/dist/src/util/filesystem.d.ts +17 -0
  151. package/dist/src/util/id.d.ts +24 -0
  152. package/dist/src/util/iife.d.ts +1 -0
  153. package/dist/src/util/index.d.ts +7 -0
  154. package/dist/src/util/lazy.d.ts +1 -0
  155. package/dist/src/util/log.d.ts +26 -0
  156. package/dist/src/util/paths.d.ts +45 -0
  157. package/dist/src/util/shell.d.ts +36 -0
  158. package/dist/src/util/timeout.d.ts +1 -0
  159. package/dist/src/util/wildcard.d.ts +8 -0
  160. package/dist/theme.d.ts +64 -0
  161. package/dist/tool/image.d.ts +3 -4
  162. package/dist/tool/think.d.ts +11 -0
  163. package/dist/tool/webfetch.d.ts +15 -0
  164. package/dist/tool/websearch.d.ts +18 -0
  165. package/dist/tools/think.d.ts +2 -0
  166. package/dist/tui/App.d.ts +1 -1
  167. package/dist/tui/components/Header.d.ts +2 -1
  168. package/dist/tui/components/LoadingIndicator.d.ts +26 -0
  169. package/dist/tui/components/Message/AssistantMessage.d.ts +2 -1
  170. package/dist/tui/components/Message/ReasoningMessage.d.ts +2 -1
  171. package/dist/tui/components/Message/ToolCallMessage.d.ts +3 -2
  172. package/dist/tui/components/Message/UserMessage.d.ts +2 -1
  173. package/dist/tui/components/Message/index.d.ts +4 -1
  174. package/dist/tui/components/PromptInput.d.ts +2 -1
  175. package/dist/tui/components/REPL.d.ts +6 -1
  176. package/dist/tui/components/StatusBar.d.ts +2 -1
  177. package/dist/tui/components/dialogs/SessionPicker.d.ts +6 -1
  178. package/dist/tui/hooks/useAnimatedLabel.d.ts +12 -0
  179. package/dist/tui/hooks/usePermission.d.ts +9 -1
  180. package/dist/tui/hooks/useTermWidth.d.ts +13 -0
  181. package/dist/tui/index.d.ts +5 -0
  182. package/dist/tui/theme.d.ts +4 -23
  183. package/dist/util/ascii.d.ts +22 -0
  184. package/dist/util/bell.d.ts +14 -0
  185. package/dist/util/color.d.ts +28 -0
  186. package/dist/util/paths.d.ts +45 -0
  187. package/dist/util/shell.d.ts +36 -0
  188. package/package.json +21 -1
package/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- PROPRIETARY SOFTWARE LICENSE WITH SHARED RIGHTS
1
+ PROPRIETARY SOFTWARE LICENSE WITH RESTRICTED USE
2
2
  ================================================
3
3
 
4
4
  Copyright (c) 2025 Carlos Alexis Gomez Ruiz
@@ -79,22 +79,91 @@ shall be subject to the following terms:
79
79
  any authorization or license agreement.
80
80
 
81
81
  --------------------------------------------------------------------------------
82
- 5. RESTRICTIONS FOR UNAUTHORIZED PARTIES
82
+ 5. PERSONAL AND NON-COMMERCIAL USE LICENSE
83
83
  --------------------------------------------------------------------------------
84
84
 
85
- Unless expressly authorized in writing by the Author, unauthorized parties
86
- may NOT:
85
+ The Author grants to any person obtaining a copy of this Software a LIMITED,
86
+ NON-EXCLUSIVE, NON-TRANSFERABLE license for PERSONAL AND NON-COMMERCIAL USE
87
+ ONLY, subject to the following restrictions:
88
+
89
+ 5.1 PERMITTED USES:
90
+ a) Personal learning and education
91
+ b) Academic research and study
92
+ c) Non-commercial personal projects
93
+ d) Code review and security research (responsible disclosure)
94
+ e) Contributing improvements via pull requests (subject to section 4)
95
+
96
+ 5.2 PROHIBITED USES - General:
97
+ a) Any COMMERCIAL use, including but not limited to:
98
+ - Offering the Software as a service (SaaS)
99
+ - Integrating into commercial products or services
100
+ - Using in business operations or professional services
101
+ - Generating revenue directly or indirectly from the Software
102
+
103
+ b) CREATING COMPETING PRODUCTS OR SERVICES, including but not limited to:
104
+ - AI-powered coding assistants or CLI tools
105
+ - Developer productivity tools using LLM integration
106
+ - Code generation or editing tools
107
+ - Any product or service that competes with PorterCode
108
+ - Any product or service that competes with offerings from:
109
+ * Porter Metrics Inc.
110
+ * Companies affiliated with Carlos Alexis Gomez Ruiz
111
+ * Companies where Carlos Alexis Gomez Ruiz has ownership interest
112
+
113
+ c) REBRANDING, RESELLING, OR REDISTRIBUTION:
114
+ - Removing or altering copyright notices or attributions
115
+ - Distributing modified versions under a different name
116
+ - Selling or licensing the Software or derivatives
117
+ - Incorporating into products intended for distribution
118
+ - White-labeling or rebranding for any purpose
119
+
120
+ d) Reverse engineering, decompiling, or attempting to extract proprietary
121
+ algorithms, methodologies, or trade secrets with intent to replicate
122
+
123
+ e) Using the Software to train AI models or create training datasets
124
+ for competitive purposes
125
+
126
+ f) Circumventing or removing security features, license checks, or
127
+ usage limitations
128
+
129
+ g) Using the Software in any manner that violates applicable laws or
130
+ regulations
131
+
132
+ 5.3 SPECIFIC PROHIBITED COMPETITIVE USES:
133
+ You may NOT use this Software to create, develop, or operate:
134
+ - LLM-based coding assistants or development tools
135
+ - CLI tools for code generation or manipulation
136
+ - AI agents for software development
137
+ - Developer productivity platforms using AI
138
+ - Code editors with AI capabilities
139
+ - Automated programming or refactoring tools
140
+ - Developer workflow automation tools using LLM
141
+ - Any tool marketed as an alternative to PorterCode or similar products
142
+
143
+ 5.4 REQUIRED ATTRIBUTION:
144
+ - All redistributions (if permitted) must retain copyright notices
145
+ - Modified versions must clearly indicate changes made
146
+ - No use of Author's or Porter Metrics Inc.'s names for endorsement
87
147
 
88
- a) Copy, reproduce, or duplicate the Software or any portion thereof
89
- b) Modify, adapt, translate, or create derivative works based on the Software
90
- c) Distribute, sublicense, lease, rent, loan, or transfer the Software
91
- d) Reverse engineer, disassemble, decompile, or attempt to derive source code
92
- e) Remove, alter, or obscure any proprietary notices on the Software
93
- f) Use the Software for any unlawful purpose
94
- g) Use the Software to develop competing products or services
148
+ --------------------------------------------------------------------------------
149
+ 6. RESTRICTIONS FOR UNAUTHORIZED COMMERCIAL ENTITIES
150
+ --------------------------------------------------------------------------------
151
+
152
+ Unless expressly authorized in writing by the Author, commercial entities,
153
+ organizations, or businesses may NOT:
154
+
155
+ a) Use the Software for any commercial purpose
156
+ b) Copy, reproduce, or duplicate the Software or any portion thereof
157
+ c) Modify, adapt, translate, or create derivative works based on the Software
158
+ d) Distribute, sublicense, lease, rent, loan, or transfer the Software
159
+ e) Integrate the Software into commercial products or services
160
+ f) Perform competitive analysis or benchmarking for commercial purposes
161
+
162
+ Commercial entities seeking to use the Software must obtain explicit written
163
+ permission and a separate commercial license from the Author.
95
164
 
96
165
  --------------------------------------------------------------------------------
97
- 6. CONFIDENTIALITY
166
+ 7. CONFIDENTIALITY
98
167
  --------------------------------------------------------------------------------
99
168
 
100
169
  All parties with access to the Software acknowledge and agree that:
@@ -109,26 +178,75 @@ All parties with access to the Software acknowledge and agree that:
109
178
  effect indefinitely for trade secrets and for five (5) years for other
110
179
  Confidential Information.
111
180
 
181
+ d) Source code and internal documentation marked as confidential must not
182
+ be shared publicly or with unauthorized parties.
183
+
184
+ --------------------------------------------------------------------------------
185
+ 8. TERMINATION
186
+ --------------------------------------------------------------------------------
187
+
188
+ 8.1 AUTOMATIC TERMINATION:
189
+ This license automatically terminates if you:
190
+ - Violate any term or restriction of this license
191
+ - Use the Software for any prohibited purpose
192
+ - Fail to comply with attribution requirements
193
+ - Attempt to create competing products or services
194
+ - Engage in any commercial use without authorization
195
+
196
+ 8.2 EFFECT OF TERMINATION:
197
+ Upon termination:
198
+ - You must immediately cease all use of the Software
199
+ - Delete or destroy all copies in your possession
200
+ - Discontinue distribution of any derivatives
201
+ - Return or destroy all confidential materials
202
+
203
+ 8.3 SURVIVAL:
204
+ Sections 1 (Ownership), 7 (Confidentiality), 9 (Disclaimer), 10 (Limitation
205
+ of Liability), and 11 (Governing Law) survive termination.
206
+
112
207
  --------------------------------------------------------------------------------
113
- 7. DISCLAIMER OF WARRANTIES
208
+ 9. DISCLAIMER OF WARRANTIES
114
209
  --------------------------------------------------------------------------------
115
210
 
116
211
  THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
117
212
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
118
213
  FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. THE AUTHOR DOES NOT
119
- WARRANT THAT THE SOFTWARE WILL BE ERROR-FREE OR UNINTERRUPTED.
214
+ WARRANT THAT THE SOFTWARE WILL BE ERROR-FREE, UNINTERRUPTED, SECURE, OR
215
+ FREE OF HARMFUL COMPONENTS.
216
+
217
+ YOU ASSUME ALL RISK ASSOCIATED WITH THE USE OF THIS SOFTWARE. THE AUTHOR
218
+ SHALL NOT BE LIABLE FOR ANY DAMAGE TO YOUR COMPUTER SYSTEM, LOSS OF DATA,
219
+ OR ANY OTHER DAMAGE RESULTING FROM USE OF THE SOFTWARE.
120
220
 
121
221
  --------------------------------------------------------------------------------
122
- 8. LIMITATION OF LIABILITY
222
+ 10. LIMITATION OF LIABILITY
123
223
  --------------------------------------------------------------------------------
124
224
 
125
225
  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
126
- CONSEQUENTIAL, OR PUNITIVE DAMAGES, INCLUDING BUT NOT LIMITED TO LOSS OF
127
- PROFITS, DATA, OR USE, ARISING OUT OF OR IN CONNECTION WITH THIS LICENSE
128
- OR THE SOFTWARE.
226
+ CONSEQUENTIAL, EXEMPLARY, OR PUNITIVE DAMAGES, INCLUDING BUT NOT LIMITED TO:
227
+ - Loss of profits, revenue, or business opportunities
228
+ - Loss of data or data corruption
229
+ - Business interruption or downtime
230
+ - Cost of substitute products or services
231
+ - Loss of goodwill or reputation damage
232
+
233
+ THIS LIMITATION APPLIES EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY
234
+ OF SUCH DAMAGES. THE AUTHOR'S TOTAL LIABILITY SHALL NOT EXCEED THE AMOUNT
235
+ PAID BY YOU FOR THE SOFTWARE (IF ANY).
236
+
237
+ SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF CERTAIN
238
+ DAMAGES, SO THE ABOVE LIMITATIONS MAY NOT APPLY TO YOU.
239
+
240
+ --------------------------------------------------------------------------------
241
+ 11. EXPORT COMPLIANCE
242
+ --------------------------------------------------------------------------------
243
+
244
+ You agree to comply with all applicable export and import laws and regulations.
245
+ You shall not export, re-export, or transfer the Software to prohibited
246
+ countries or individuals under applicable laws.
129
247
 
130
248
  --------------------------------------------------------------------------------
131
- 9. GOVERNING LAW AND JURISDICTION
249
+ 12. GOVERNING LAW AND JURISDICTION
132
250
  --------------------------------------------------------------------------------
133
251
 
134
252
  This License shall be governed by and construed in accordance with the laws
@@ -136,11 +254,35 @@ of the State of Delaware, United States of America, without regard to conflict
136
254
  of law principles. Any disputes arising under this License shall be resolved
137
255
  exclusively in the state or federal courts located in Delaware.
138
256
 
257
+ Both parties consent to personal jurisdiction in Delaware and waive any
258
+ objection to venue in such courts.
259
+
260
+ --------------------------------------------------------------------------------
261
+ 13. SEVERABILITY
262
+ --------------------------------------------------------------------------------
263
+
264
+ If any provision of this License is held to be invalid or unenforceable, the
265
+ remaining provisions shall continue in full force and effect, and the invalid
266
+ provision shall be modified to the minimum extent necessary to make it valid
267
+ and enforceable.
268
+
269
+ --------------------------------------------------------------------------------
270
+ 14. ENTIRE AGREEMENT
271
+ --------------------------------------------------------------------------------
272
+
273
+ This License constitutes the entire agreement between you and the Author
274
+ regarding the Software and supersedes all prior or contemporaneous
275
+ communications, whether written or oral.
276
+
277
+ This License may only be modified by a written amendment signed by the Author.
278
+ No waiver of any provision shall constitute a waiver of any other provision
279
+ or future waiver of the same provision.
280
+
139
281
  --------------------------------------------------------------------------------
140
- 10. CONTACT INFORMATION
282
+ 15. CONTACT INFORMATION
141
283
  --------------------------------------------------------------------------------
142
284
 
143
- For licensing inquiries, permissions, or to report violations:
285
+ For licensing inquiries, commercial use permissions, or to report violations:
144
286
 
145
287
  Carlos Alexis Gomez Ruiz
146
288
  Email: alexisg.0207@gmail.com
@@ -150,4 +292,15 @@ For licensing inquiries, permissions, or to report violations:
150
292
 
151
293
  ================================================================================
152
294
 
295
+ IMPORTANT NOTICE:
296
+
297
+ This is proprietary software. Unauthorized commercial use, redistribution,
298
+ rebranding, or creation of competing products is strictly prohibited and may
299
+ result in legal action.
300
+
301
+ For commercial licensing options, please contact the Author at the email
302
+ address provided above.
303
+
304
+ ================================================================================
305
+
153
306
  For third-party software notices and attributions, see the NOTICE file.
package/README.md CHANGED
@@ -24,6 +24,9 @@ porter -c
24
24
 
25
25
  # Use specific model
26
26
  porter -m anthropic/claude-sonnet-4-20250514
27
+
28
+ # Start HTTP server for VS Code extension
29
+ porter --port 50123
27
30
  ```
28
31
 
29
32
  ## Commands
@@ -42,122 +45,186 @@ porter config Show configuration
42
45
  | `-s, --session` | Continue specific session |
43
46
  | `-c, --continue` | Continue most recent session |
44
47
  | `-m, --model` | Model to use (provider/model) |
45
- | `-g, --gateway` | Enable Gateway server for VSCode |
48
+ | `--port <number>` | Start HTTP server on specified port (for VS Code extension) |
46
49
 
47
50
  ---
48
51
 
49
- ## Publishing to npm
52
+ ## VS Code Extension Communication
50
53
 
51
- ### Prerequisites
54
+ When started with `--port`, PorterCode runs an HTTP server for communication with the VS Code extension.
52
55
 
53
- 1. npm account with publish access
54
- 2. Logged in: `npm login`
55
- 3. Bun installed
56
+ ### Architecture: HTTP + SSE
56
57
 
57
- ### Steps to Publish a New Version
58
+ - **HTTP REST API**: For requests (prompts, sessions, auth, permissions)
59
+ - **SSE (Server-Sent Events)**: For real-time streaming responses
58
60
 
59
- #### 1. Update Version
61
+ ### API Endpoints
60
62
 
61
- ```bash
62
- # Patch (0.1.0 -> 0.1.1)
63
- npm version patch
63
+ | Endpoint | Method | Description |
64
+ |----------|--------|-------------|
65
+ | `/health` | GET | Health check |
66
+ | `/events` | GET | SSE stream for real-time events |
67
+ | `/api/sessions` | GET | List all sessions |
68
+ | `/api/sessions` | POST | Create a new session |
69
+ | `/api/sessions/:id/messages` | GET | Get messages for a session |
70
+ | `/api/prompt` | POST | Send a prompt to the LLM |
71
+ | `/api/cancel` | POST | Cancel active generation |
72
+ | `/api/permission` | POST | Respond to permission requests |
73
+ | `/api/auth/status` | GET | Check authentication status |
74
+ | `/api/auth/providers` | GET | List available LLM providers |
75
+ | `/api/auth/credentials` | POST | Save API key credential |
64
76
 
65
- # Minor (0.1.0 -> 0.2.0)
66
- npm version minor
77
+ ### SSE Events
67
78
 
68
- # Major (0.1.0 -> 1.0.0)
69
- npm version major
70
- ```
79
+ The `/events` endpoint streams the following event types:
71
80
 
72
- #### 2. Build & Verify
81
+ | Event | Description |
82
+ |-------|-------------|
83
+ | `heartbeat` | Keep-alive ping |
84
+ | `message.start` | LLM generation started |
85
+ | `message.delta` | Text content chunk |
86
+ | `reasoning.delta` | Reasoning/thinking content chunk |
87
+ | `message.complete` | LLM generation finished |
88
+ | `tool.start` | Tool execution started |
89
+ | `tool.complete` | Tool execution finished |
90
+ | `permission.request` | Permission required for tool |
91
+ | `session.updated` | Session metadata changed |
73
92
 
74
- ```bash
75
- # Build (compiles + obfuscates)
76
- bun run build
93
+ ### Example: Connecting to SSE
77
94
 
78
- # Verify CLI works
79
- bun ./dist/index.js --help
95
+ ```javascript
96
+ const eventSource = new EventSource('http://localhost:50123/events');
97
+
98
+ eventSource.addEventListener('message.delta', (e) => {
99
+ const data = JSON.parse(e.data);
100
+ console.log('Content:', data.content);
101
+ });
102
+
103
+ eventSource.addEventListener('tool.start', (e) => {
104
+ const data = JSON.parse(e.data);
105
+ console.log('Tool:', data.toolName);
106
+ });
80
107
  ```
81
108
 
82
- #### 3. Preview Package Contents (IMPORTANT)
109
+ ---
110
+
111
+ ## Publishing
83
112
 
84
- **Always verify before publishing:**
113
+ PorterCode uses a unified publish workflow that handles both GitHub Releases (standalone executables) and npm publishing.
114
+
115
+ ### Prerequisites
116
+
117
+ 1. **GitHub CLI**: `gh` installed and authenticated (`gh auth login`)
118
+ 2. **npm account**: With publish access and 2FA enabled
119
+ 3. **Bun**: Runtime installed
120
+
121
+ ### Quick Publish (Recommended)
85
122
 
86
123
  ```bash
87
- # List files that will be included
88
- npm pack --dry-run
124
+ # Publish everywhere (GitHub Releases + npm)
125
+ bun run publish --version 0.1.11
89
126
 
90
- # Or create and inspect the tarball
91
- npm pack
92
- tar -tzf portercode-*.tgz
127
+ # Preview without publishing
128
+ bun run publish --version 0.1.11 --dry-run
93
129
  ```
94
130
 
95
- **Checklist - Verify these are NOT included:**
96
- - [ ] `src/` directory (source code)
97
- - [ ] `test/` directory
98
- - [ ] `*.ts` files (except `*.d.ts`)
99
- - [ ] `build.ts`
100
- - [ ] `tsconfig*.json`
101
- - [ ] `bun.lockb`
102
- - [ ] `.env` or credentials
131
+ ### Publish Options
103
132
 
104
- **Checklist - Verify these ARE included:**
105
- - [x] `dist/index.js` (obfuscated)
106
- - [x] `dist/**/*.d.ts` (type declarations)
107
- - [x] `LICENSE`
108
- - [x] `NOTICE`
109
- - [x] `package.json`
133
+ | Command | Description |
134
+ |---------|-------------|
135
+ | `bun run publish --version X.Y.Z` | Publish to GitHub Releases and npm |
136
+ | `bun run publish --version X.Y.Z --github` | Only GitHub Releases (standalone executables) |
137
+ | `bun run publish --version X.Y.Z --npm` | Only npm registry |
138
+ | `bun run publish --version X.Y.Z --dry-run` | Preview changes without publishing |
110
139
 
111
- #### 4. Verify Obfuscation
140
+ ### What Gets Published
112
141
 
113
- ```bash
114
- # Check that code is obfuscated (should show hexadecimal variables)
115
- head -c 500 dist/index.js
116
- ```
142
+ #### GitHub Releases (`--github`)
117
143
 
118
- Expected output should look like:
119
- ```javascript
120
- var _0x12a874=_0x45ea;(function(_0x68ac43,_0x53f9ec){...
121
- ```
144
+ Standalone executables uploaded to [portercode-releases](https://github.com/portermetrics/portercode-releases):
122
145
 
123
- **NOT** readable code like:
124
- ```javascript
125
- import { something } from "./module"
126
- ```
146
+ | Platform | File |
147
+ |----------|------|
148
+ | Windows x64 | `porter-windows-x64.exe` |
149
+ | Linux x64 | `porter-linux-x64` |
150
+ | macOS Intel | `porter-macos-x64` |
151
+ | macOS Apple Silicon | `porter-macos-arm64` |
152
+
153
+ Plus install scripts: `install-windows.bat`, `install.sh`
154
+
155
+ #### npm Registry (`--npm`)
127
156
 
128
- #### 5. Publish
157
+ Obfuscated JavaScript package:
158
+ - `dist/index.js` - Compiled and obfuscated code
159
+ - `dist/**/*.d.ts` - Type declarations
160
+ - `LICENSE`, `NOTICE`, `package.json`
161
+
162
+ **Source code (`src/`) is NOT published to npm.**
163
+
164
+ ### Publish Workflow Steps
165
+
166
+ The unified publish command performs these steps:
167
+
168
+ 1. **[1/4] Update version** - Updates `package.json` with the new version
169
+ 2. **[2/4] Build executables** - Compiles standalone binaries for all platforms (GitHub only)
170
+ 3. **[3/4] GitHub Release** - Creates release and uploads executables
171
+ 4. **[4/4] npm Publish** - Runs `npm login` (for OTP) then publishes
172
+
173
+ ### Manual Publishing (Advanced)
174
+
175
+ If you need more control, use individual scripts:
129
176
 
130
177
  ```bash
131
- # Publish to npm
132
- npm publish --access public
178
+ # Build standalone executables only
179
+ bun run build-all-platforms.ts
133
180
 
134
- # Or dry-run first
135
- npm publish --access public --dry-run
181
+ # Upload to GitHub Releases only
182
+ bun run release.ts
183
+ bun run release.ts --draft # Create as draft
184
+
185
+ # Build npm package only
186
+ bun run build
136
187
  ```
137
188
 
138
- #### 6. Verify Published Package
189
+ ### Verify Published Package
139
190
 
140
191
  ```bash
141
- # Check on npm
192
+ # Check npm
142
193
  npm info portercode
143
194
 
144
195
  # Test installation
145
196
  npm install -g portercode
146
197
  porter --version
198
+
199
+ # Check GitHub release
200
+ gh release view v0.1.11 --repo portermetrics/portercode-releases
147
201
  ```
148
202
 
149
203
  ### Rollback (if needed)
150
204
 
151
205
  ```bash
152
- # Unpublish within 72 hours
153
- npm unpublish portercode@0.1.1
206
+ # npm: Unpublish within 72 hours
207
+ npm unpublish portercode@0.1.11
154
208
 
155
- # Deprecate (after 72 hours)
156
- npm deprecate portercode@0.1.1 "Critical bug, use 0.1.2"
209
+ # npm: Deprecate (after 72 hours)
210
+ npm deprecate portercode@0.1.11 "Critical bug, use 0.1.12"
211
+
212
+ # GitHub: Delete release
213
+ gh release delete v0.1.11 --repo portermetrics/portercode-releases --yes
157
214
  ```
158
215
 
159
216
  ---
160
217
 
218
+ ## Features
219
+
220
+ - 🤖 **Multi-LLM Support**: Works with Anthropic Claude, OpenAI GPT, Google Gemini, and Groq
221
+ - 🔐 **Granular Permissions**: Fine-grained control over file operations and command execution
222
+ - 💬 **Interactive Sessions**: Save and resume conversations
223
+ - ⚙️ **Configurable**: Hierarchical configuration system with JSONC support
224
+ - 🔧 **Extensible Tools**: Read, write, edit files, execute commands, search code
225
+ - 🎨 **Terminal UI**: Beautiful interactive interface built with Ink
226
+ - 📡 **VS Code Integration**: HTTP + SSE server for VS Code extension
227
+
161
228
  ## Development
162
229
 
163
230
  ```bash
@@ -171,8 +238,35 @@ bun test
171
238
  bun run typecheck
172
239
  ```
173
240
 
241
+ ---
242
+
243
+ ## Configuration
244
+
245
+ Create a `porter.jsonc` file in your project root or `~/.config/portercode/porter.jsonc` globally:
246
+
247
+ ```jsonc
248
+ {
249
+ "model": "claude-sonnet-4",
250
+ "permission": {
251
+ "edit": "ask", // Always ask before editing files
252
+ "bash": "auto" // Execute commands automatically
253
+ }
254
+ }
255
+ ```
256
+
257
+ ### Configuration Options
258
+
259
+ | Option | Description | Values |
260
+ |--------|-------------|--------|
261
+ | `model` | Default LLM model | `claude-sonnet-4`, `gpt-4`, `gemini-pro`, etc. |
262
+ | `permission.edit` | Permission for editing files | `ask`, `auto`, `deny` |
263
+ | `permission.write` | Permission for creating files | `ask`, `auto`, `deny` |
264
+ | `permission.bash` | Permission for shell commands | `ask`, `auto`, `deny` |
265
+
266
+ ---
267
+
174
268
  ## License
175
269
 
176
270
  Proprietary - See [LICENSE](LICENSE) for details.
177
271
 
178
- Copyright (c) 2025 Porter Metrics Inc. All rights reserved.
272
+ Copyright (c) 2025 Carlos Alexis Gomez Ruiz. All rights reserved.
@@ -42,6 +42,51 @@ export declare namespace Auth {
42
42
  key: string;
43
43
  token: string;
44
44
  }>;
45
+ const ServiceAccount: z.ZodObject<{
46
+ type: z.ZodLiteral<"service-account">;
47
+ serviceAccount: z.ZodObject<{
48
+ project_id: z.ZodString;
49
+ client_email: z.ZodString;
50
+ private_key: z.ZodString;
51
+ location: z.ZodOptional<z.ZodString>;
52
+ }, "strip", z.ZodTypeAny, {
53
+ project_id: string;
54
+ client_email: string;
55
+ private_key: string;
56
+ location?: string | undefined;
57
+ }, {
58
+ project_id: string;
59
+ client_email: string;
60
+ private_key: string;
61
+ location?: string | undefined;
62
+ }>;
63
+ }, "strip", z.ZodTypeAny, {
64
+ type: "service-account";
65
+ serviceAccount: {
66
+ project_id: string;
67
+ client_email: string;
68
+ private_key: string;
69
+ location?: string | undefined;
70
+ };
71
+ }, {
72
+ type: "service-account";
73
+ serviceAccount: {
74
+ project_id: string;
75
+ client_email: string;
76
+ private_key: string;
77
+ location?: string | undefined;
78
+ };
79
+ }>;
80
+ const PerplexityApiKey: z.ZodObject<{
81
+ type: z.ZodLiteral<"perplexity-api-key">;
82
+ apiKey: z.ZodString;
83
+ }, "strip", z.ZodTypeAny, {
84
+ type: "perplexity-api-key";
85
+ apiKey: string;
86
+ }, {
87
+ type: "perplexity-api-key";
88
+ apiKey: string;
89
+ }>;
45
90
  const Info: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
46
91
  type: z.ZodLiteral<"oauth">;
47
92
  refresh: z.ZodString;
@@ -81,6 +126,49 @@ export declare namespace Auth {
81
126
  type: "wellknown";
82
127
  key: string;
83
128
  token: string;
129
+ }>, z.ZodObject<{
130
+ type: z.ZodLiteral<"service-account">;
131
+ serviceAccount: z.ZodObject<{
132
+ project_id: z.ZodString;
133
+ client_email: z.ZodString;
134
+ private_key: z.ZodString;
135
+ location: z.ZodOptional<z.ZodString>;
136
+ }, "strip", z.ZodTypeAny, {
137
+ project_id: string;
138
+ client_email: string;
139
+ private_key: string;
140
+ location?: string | undefined;
141
+ }, {
142
+ project_id: string;
143
+ client_email: string;
144
+ private_key: string;
145
+ location?: string | undefined;
146
+ }>;
147
+ }, "strip", z.ZodTypeAny, {
148
+ type: "service-account";
149
+ serviceAccount: {
150
+ project_id: string;
151
+ client_email: string;
152
+ private_key: string;
153
+ location?: string | undefined;
154
+ };
155
+ }, {
156
+ type: "service-account";
157
+ serviceAccount: {
158
+ project_id: string;
159
+ client_email: string;
160
+ private_key: string;
161
+ location?: string | undefined;
162
+ };
163
+ }>, z.ZodObject<{
164
+ type: z.ZodLiteral<"perplexity-api-key">;
165
+ apiKey: z.ZodString;
166
+ }, "strip", z.ZodTypeAny, {
167
+ type: "perplexity-api-key";
168
+ apiKey: string;
169
+ }, {
170
+ type: "perplexity-api-key";
171
+ apiKey: string;
84
172
  }>]>;
85
173
  type Info = z.infer<typeof Info>;
86
174
  function get(providerID: string): Promise<{
@@ -96,6 +184,17 @@ export declare namespace Auth {
96
184
  type: "wellknown";
97
185
  key: string;
98
186
  token: string;
187
+ } | {
188
+ type: "service-account";
189
+ serviceAccount: {
190
+ project_id: string;
191
+ client_email: string;
192
+ private_key: string;
193
+ location?: string | undefined;
194
+ };
195
+ } | {
196
+ type: "perplexity-api-key";
197
+ apiKey: string;
99
198
  }>;
100
199
  function all(): Promise<Record<string, Info>>;
101
200
  function set(key: string, info: Info): Promise<void>;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Brand Module
3
+ *
4
+ * Re-exports brand configuration from theme.ts for backward compatibility
5
+ */
6
+ export { PRODUCT_NAME, PRODUCT_COMMAND, CONFIG_DIR, CONFIG_FILE, RULES_FILE, ENV_PREFIX, LOGO_SIMPLE, LOGO_EXTENDED, LOGO_ASCII, LOCAL_RULE_FILES, GLOBAL_RULE_FILES, DEFAULT_THEME, PRIMARY_COLOR, themes, getTheme, setTheme, getThemeNames, initTheme, } from "../theme";
7
+ export type { Theme } from "../theme";