portercode 0.1.0

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 (112) hide show
  1. package/LICENSE +123 -0
  2. package/NOTICE +45 -0
  3. package/README.md +178 -0
  4. package/dist/auth/index.d.ts +103 -0
  5. package/dist/bus/bus-event.d.ts +10 -0
  6. package/dist/bus/global.d.ts +7 -0
  7. package/dist/bus/index.d.ts +26 -0
  8. package/dist/cli/auth.d.ts +11 -0
  9. package/dist/cli/index.d.ts +1 -0
  10. package/dist/cli/ui.d.ts +26 -0
  11. package/dist/command/index.d.ts +54 -0
  12. package/dist/config/config.d.ts +6756 -0
  13. package/dist/config/index.d.ts +2 -0
  14. package/dist/config/markdown.d.ts +415 -0
  15. package/dist/constants/index.d.ts +9 -0
  16. package/dist/diff/engine.d.ts +15 -0
  17. package/dist/diff/index.d.ts +8 -0
  18. package/dist/diff/types.d.ts +66 -0
  19. package/dist/file/ignore.d.ts +7 -0
  20. package/dist/flag/index.d.ts +19 -0
  21. package/dist/gateway/bridge.d.ts +11 -0
  22. package/dist/gateway/handlers/llm.d.ts +7 -0
  23. package/dist/gateway/handlers/permission.d.ts +15 -0
  24. package/dist/gateway/handlers/session.d.ts +7 -0
  25. package/dist/gateway/handlers/system.d.ts +7 -0
  26. package/dist/gateway/handlers/tool.d.ts +7 -0
  27. package/dist/gateway/index.d.ts +17 -0
  28. package/dist/gateway/protocol.d.ts +159 -0
  29. package/dist/gateway/router.d.ts +7 -0
  30. package/dist/gateway/server.d.ts +24 -0
  31. package/dist/global/index.d.ts +11 -0
  32. package/dist/index.d.ts +2 -0
  33. package/dist/index.js +2 -0
  34. package/dist/permission/index.d.ts +2 -0
  35. package/dist/permission/permission.d.ts +172 -0
  36. package/dist/permission/types.d.ts +109 -0
  37. package/dist/project/index.d.ts +3 -0
  38. package/dist/project/instance.d.ts +33 -0
  39. package/dist/project/project.d.ts +82 -0
  40. package/dist/project/state.d.ts +4 -0
  41. package/dist/prompt/index.d.ts +5 -0
  42. package/dist/prompt/system.d.ts +24 -0
  43. package/dist/provider/index.d.ts +3 -0
  44. package/dist/provider/models.d.ts +17 -0
  45. package/dist/provider/provider.d.ts +844 -0
  46. package/dist/provider/types.d.ts +328 -0
  47. package/dist/session/context-optimization.d.ts +160 -0
  48. package/dist/session/index.d.ts +4 -0
  49. package/dist/session/llm.d.ts +29 -0
  50. package/dist/session/session.d.ts +400 -0
  51. package/dist/session/types.d.ts +544 -0
  52. package/dist/snapshot/index.d.ts +40 -0
  53. package/dist/storage/index.d.ts +1 -0
  54. package/dist/storage/storage.d.ts +34 -0
  55. package/dist/tool/bash.d.ts +19 -0
  56. package/dist/tool/edit.d.ts +21 -0
  57. package/dist/tool/glob.d.ts +15 -0
  58. package/dist/tool/grep.d.ts +20 -0
  59. package/dist/tool/image.d.ts +23 -0
  60. package/dist/tool/index.d.ts +11 -0
  61. package/dist/tool/ls.d.ts +14 -0
  62. package/dist/tool/read.d.ts +17 -0
  63. package/dist/tool/registry.d.ts +30 -0
  64. package/dist/tool/todo.d.ts +76 -0
  65. package/dist/tool/tool.d.ts +65 -0
  66. package/dist/tool/write.d.ts +16 -0
  67. package/dist/tui/App.d.ts +10 -0
  68. package/dist/tui/components/Header.d.ts +12 -0
  69. package/dist/tui/components/Message/AssistantMessage.d.ts +10 -0
  70. package/dist/tui/components/Message/ReasoningMessage.d.ts +20 -0
  71. package/dist/tui/components/Message/ToolCallMessage.d.ts +25 -0
  72. package/dist/tui/components/Message/UserMessage.d.ts +11 -0
  73. package/dist/tui/components/Message/index.d.ts +13 -0
  74. package/dist/tui/components/PermissionPrompt.d.ts +6 -0
  75. package/dist/tui/components/PromptInput.d.ts +32 -0
  76. package/dist/tui/components/REPL.d.ts +17 -0
  77. package/dist/tui/components/Spinner.d.ts +13 -0
  78. package/dist/tui/components/StatusBar.d.ts +12 -0
  79. package/dist/tui/components/TodoList.d.ts +17 -0
  80. package/dist/tui/components/WelcomeBox.d.ts +13 -0
  81. package/dist/tui/components/dialogs/DiagnosticsPanel.d.ts +12 -0
  82. package/dist/tui/components/dialogs/HelpPanel.d.ts +11 -0
  83. package/dist/tui/components/dialogs/ModelSelector.d.ts +14 -0
  84. package/dist/tui/components/dialogs/PermissionPrompt.d.ts +17 -0
  85. package/dist/tui/components/dialogs/SessionPicker.d.ts +15 -0
  86. package/dist/tui/components/dialogs/index.d.ts +10 -0
  87. package/dist/tui/components/diff/DiffHunk.d.ts +12 -0
  88. package/dist/tui/components/diff/DiffLine.d.ts +14 -0
  89. package/dist/tui/components/diff/DiffStats.d.ts +12 -0
  90. package/dist/tui/components/diff/DiffView.d.ts +15 -0
  91. package/dist/tui/components/diff/index.d.ts +9 -0
  92. package/dist/tui/hooks/usePermission.d.ts +26 -0
  93. package/dist/tui/index.d.ts +15 -0
  94. package/dist/tui/theme.d.ts +27 -0
  95. package/dist/tui/utils/Cursor.d.ts +37 -0
  96. package/dist/tui/utils/clipboard.d.ts +3 -0
  97. package/dist/tui/utils/keypress.d.ts +39 -0
  98. package/dist/tui/utils/markdown.d.ts +13 -0
  99. package/dist/tui/utils/openContent.d.ts +22 -0
  100. package/dist/util/context.d.ts +10 -0
  101. package/dist/util/debug.d.ts +51 -0
  102. package/dist/util/error.d.ts +294 -0
  103. package/dist/util/example-commands.d.ts +18 -0
  104. package/dist/util/filesystem.d.ts +17 -0
  105. package/dist/util/id.d.ts +24 -0
  106. package/dist/util/iife.d.ts +1 -0
  107. package/dist/util/index.d.ts +7 -0
  108. package/dist/util/lazy.d.ts +1 -0
  109. package/dist/util/log.d.ts +26 -0
  110. package/dist/util/timeout.d.ts +1 -0
  111. package/dist/util/wildcard.d.ts +8 -0
  112. package/package.json +72 -0
package/LICENSE ADDED
@@ -0,0 +1,123 @@
1
+ PROPRIETARY SOFTWARE LICENSE
2
+ ============================
3
+
4
+ Copyright (c) 2025 Porter Metrics Inc.
5
+ All Rights Reserved.
6
+
7
+ Author: Carlos Alexis Gomez Ruiz <alexis@portermetrics.com>
8
+
9
+ --------------------------------------------------------------------------------
10
+ 1. OWNERSHIP AND INTELLECTUAL PROPERTY
11
+ --------------------------------------------------------------------------------
12
+
13
+ This software and associated documentation files (the "Software") are the
14
+ exclusive property of Porter Metrics Inc. The Software is protected by
15
+ copyright laws and international treaty provisions. All intellectual property
16
+ rights in and to the Software, including but not limited to patents, copyrights,
17
+ trade secrets, and trademarks, are and shall remain the exclusive property of
18
+ Porter Metrics Inc.
19
+
20
+ --------------------------------------------------------------------------------
21
+ 2. LICENSE RESTRICTIONS
22
+ --------------------------------------------------------------------------------
23
+
24
+ Unless expressly authorized in writing by Porter Metrics Inc., you may NOT:
25
+
26
+ a) Copy, reproduce, or duplicate the Software or any portion thereof
27
+ b) Modify, adapt, translate, or create derivative works based on the Software
28
+ c) Distribute, sublicense, lease, rent, loan, or transfer the Software
29
+ d) Reverse engineer, disassemble, decompile, or attempt to derive source code
30
+ e) Remove, alter, or obscure any proprietary notices on the Software
31
+ f) Use the Software for any unlawful purpose or in violation of any regulations
32
+ g) Share access credentials or allow unauthorized third parties to access
33
+ h) Use the Software to develop competing products or services
34
+
35
+ --------------------------------------------------------------------------------
36
+ 3. CONFIDENTIALITY AGREEMENT (NDA)
37
+ --------------------------------------------------------------------------------
38
+
39
+ By accessing this Software, you acknowledge and agree that:
40
+
41
+ a) The Software, including its source code, architecture, algorithms, and
42
+ documentation, constitutes Confidential Information of Porter Metrics Inc.
43
+
44
+ b) You shall maintain strict confidentiality and shall not disclose any
45
+ Confidential Information to any third party without prior written consent.
46
+
47
+ c) You shall use the Confidential Information solely for authorized purposes
48
+ and shall take all reasonable measures to protect its confidentiality.
49
+
50
+ d) Upon termination of your authorized access or upon request, you shall
51
+ promptly return or destroy all copies of Confidential Information.
52
+
53
+ e) This confidentiality obligation shall survive termination and remain in
54
+ effect indefinitely for trade secrets and for five (5) years for other
55
+ Confidential Information.
56
+
57
+ f) Unauthorized disclosure may result in irreparable harm, and Porter Metrics
58
+ Inc. shall be entitled to seek injunctive relief in addition to other
59
+ remedies.
60
+
61
+ --------------------------------------------------------------------------------
62
+ 4. TERMS OF USE FOR AUTHORIZED USERS
63
+ --------------------------------------------------------------------------------
64
+
65
+ Authorized users of the Software agree to:
66
+
67
+ a) Use the Software only for its intended purpose within the scope of their
68
+ authorization from Porter Metrics Inc.
69
+
70
+ b) Maintain the security of any access credentials and immediately report
71
+ any suspected unauthorized access or security breaches.
72
+
73
+ c) Comply with all applicable laws, regulations, and Porter Metrics Inc.
74
+ policies when using the Software.
75
+
76
+ d) Not attempt to circumvent any security measures or access controls.
77
+
78
+ e) Not use the Software in any manner that could damage, disable, or impair
79
+ Porter Metrics Inc. systems or interfere with other authorized users.
80
+
81
+ f) Acknowledge that Porter Metrics Inc. may monitor usage to ensure compliance
82
+ with these terms.
83
+
84
+ --------------------------------------------------------------------------------
85
+ 5. DISCLAIMER OF WARRANTIES
86
+ --------------------------------------------------------------------------------
87
+
88
+ THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
89
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
90
+ FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. PORTER METRICS INC.
91
+ DOES NOT WARRANT THAT THE SOFTWARE WILL BE ERROR-FREE OR UNINTERRUPTED.
92
+
93
+ --------------------------------------------------------------------------------
94
+ 6. LIMITATION OF LIABILITY
95
+ --------------------------------------------------------------------------------
96
+
97
+ IN NO EVENT SHALL PORTER METRICS INC., ITS OFFICERS, DIRECTORS, EMPLOYEES,
98
+ OR AGENTS BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL,
99
+ OR PUNITIVE DAMAGES, INCLUDING BUT NOT LIMITED TO LOSS OF PROFITS, DATA,
100
+ OR USE, ARISING OUT OF OR IN CONNECTION WITH THIS LICENSE OR THE SOFTWARE.
101
+
102
+ --------------------------------------------------------------------------------
103
+ 7. GOVERNING LAW AND JURISDICTION
104
+ --------------------------------------------------------------------------------
105
+
106
+ This License shall be governed by and construed in accordance with the laws
107
+ of the State of Delaware, United States of America, without regard to conflict
108
+ of law principles. Any disputes arising under this License shall be resolved
109
+ exclusively in the state or federal courts located in Delaware, and each party
110
+ consents to the personal jurisdiction of such courts.
111
+
112
+ --------------------------------------------------------------------------------
113
+ 8. CONTACT INFORMATION
114
+ --------------------------------------------------------------------------------
115
+
116
+ For licensing inquiries, permissions, or to report violations:
117
+
118
+ Porter Metrics Inc.
119
+ Email: alexis@portermetrics.com
120
+
121
+ ================================================================================
122
+
123
+ For third-party software notices and attributions, see the NOTICE file.
package/NOTICE ADDED
@@ -0,0 +1,45 @@
1
+ NOTICES AND ATTRIBUTIONS
2
+ ========================
3
+
4
+ Portercode - Copyright (c) 2025 Porter Metrics Inc.
5
+ Author: Carlos Alexis Gomez Ruiz <alexis@portermetrics.com>
6
+
7
+ ================================================================================
8
+ THIRD-PARTY SOFTWARE NOTICES
9
+ ================================================================================
10
+
11
+ This software contains code derived from OpenCode, which is licensed under
12
+ the MIT License. In compliance with the MIT License requirements, the original
13
+ copyright notice and license text are reproduced below:
14
+
15
+ --------------------------------------------------------------------------------
16
+ OpenCode
17
+ https://github.com/sst/opencode
18
+
19
+ MIT License
20
+
21
+ Copyright (c) 2024 SST
22
+
23
+ Permission is hereby granted, free of charge, to any person obtaining a copy
24
+ of this software and associated documentation files (the "Software"), to deal
25
+ in the Software without restriction, including without limitation the rights
26
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
27
+ copies of the Software, and to permit persons to whom the Software is
28
+ furnished to do so, subject to the following conditions:
29
+
30
+ The above copyright notice and this permission notice shall be included in all
31
+ copies or substantial portions of the Software.
32
+
33
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
34
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
35
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
36
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
37
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
38
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
39
+ SOFTWARE.
40
+ --------------------------------------------------------------------------------
41
+
42
+ Note: The inclusion of this notice fulfills the attribution requirements of
43
+ the MIT License for the original OpenCode project. The derivative work
44
+ (Portercode) is separately licensed under a proprietary license as specified
45
+ in the LICENSE file.
package/README.md ADDED
@@ -0,0 +1,178 @@
1
+ # PorterCode
2
+
3
+ AI-powered coding assistant CLI.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install -g portercode
9
+ ```
10
+
11
+ **Requirements:** [Bun](https://bun.sh) runtime
12
+
13
+ ## Usage
14
+
15
+ ```bash
16
+ # Interactive mode
17
+ porter
18
+
19
+ # With initial message
20
+ porter "explain this codebase"
21
+
22
+ # Continue last session
23
+ porter -c
24
+
25
+ # Use specific model
26
+ porter -m anthropic/claude-sonnet-4-20250514
27
+ ```
28
+
29
+ ## Commands
30
+
31
+ ```
32
+ porter Start interactive TUI
33
+ porter auth Manage API credentials
34
+ porter config Show configuration
35
+ ```
36
+
37
+ ## Options
38
+
39
+ | Option | Description |
40
+ |--------|-------------|
41
+ | `-d, --debug` | Enable debug mode |
42
+ | `-s, --session` | Continue specific session |
43
+ | `-c, --continue` | Continue most recent session |
44
+ | `-m, --model` | Model to use (provider/model) |
45
+ | `-g, --gateway` | Enable Gateway server for VSCode |
46
+
47
+ ---
48
+
49
+ ## Publishing to npm
50
+
51
+ ### Prerequisites
52
+
53
+ 1. npm account with publish access
54
+ 2. Logged in: `npm login`
55
+ 3. Bun installed
56
+
57
+ ### Steps to Publish a New Version
58
+
59
+ #### 1. Update Version
60
+
61
+ ```bash
62
+ # Patch (0.1.0 -> 0.1.1)
63
+ npm version patch
64
+
65
+ # Minor (0.1.0 -> 0.2.0)
66
+ npm version minor
67
+
68
+ # Major (0.1.0 -> 1.0.0)
69
+ npm version major
70
+ ```
71
+
72
+ #### 2. Build & Verify
73
+
74
+ ```bash
75
+ # Build (compiles + obfuscates)
76
+ bun run build
77
+
78
+ # Verify CLI works
79
+ bun ./dist/index.js --help
80
+ ```
81
+
82
+ #### 3. Preview Package Contents (IMPORTANT)
83
+
84
+ **Always verify before publishing:**
85
+
86
+ ```bash
87
+ # List files that will be included
88
+ npm pack --dry-run
89
+
90
+ # Or create and inspect the tarball
91
+ npm pack
92
+ tar -tzf portercode-*.tgz
93
+ ```
94
+
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
103
+
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`
110
+
111
+ #### 4. Verify Obfuscation
112
+
113
+ ```bash
114
+ # Check that code is obfuscated (should show hexadecimal variables)
115
+ head -c 500 dist/index.js
116
+ ```
117
+
118
+ Expected output should look like:
119
+ ```javascript
120
+ var _0x12a874=_0x45ea;(function(_0x68ac43,_0x53f9ec){...
121
+ ```
122
+
123
+ **NOT** readable code like:
124
+ ```javascript
125
+ import { something } from "./module"
126
+ ```
127
+
128
+ #### 5. Publish
129
+
130
+ ```bash
131
+ # Publish to npm
132
+ npm publish --access public
133
+
134
+ # Or dry-run first
135
+ npm publish --access public --dry-run
136
+ ```
137
+
138
+ #### 6. Verify Published Package
139
+
140
+ ```bash
141
+ # Check on npm
142
+ npm info portercode
143
+
144
+ # Test installation
145
+ npm install -g portercode
146
+ porter --version
147
+ ```
148
+
149
+ ### Rollback (if needed)
150
+
151
+ ```bash
152
+ # Unpublish within 72 hours
153
+ npm unpublish portercode@0.1.1
154
+
155
+ # Deprecate (after 72 hours)
156
+ npm deprecate portercode@0.1.1 "Critical bug, use 0.1.2"
157
+ ```
158
+
159
+ ---
160
+
161
+ ## Development
162
+
163
+ ```bash
164
+ # Run in dev mode
165
+ bun run dev
166
+
167
+ # Run tests
168
+ bun test
169
+
170
+ # Type check
171
+ bun run typecheck
172
+ ```
173
+
174
+ ## License
175
+
176
+ Proprietary - See [LICENSE](LICENSE) for details.
177
+
178
+ Copyright (c) 2025 Porter Metrics Inc. All rights reserved.
@@ -0,0 +1,103 @@
1
+ import { z } from "zod";
2
+ export declare namespace Auth {
3
+ const Oauth: z.ZodObject<{
4
+ type: z.ZodLiteral<"oauth">;
5
+ refresh: z.ZodString;
6
+ access: z.ZodString;
7
+ expires: z.ZodNumber;
8
+ enterpriseUrl: z.ZodOptional<z.ZodString>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ type: "oauth";
11
+ refresh: string;
12
+ access: string;
13
+ expires: number;
14
+ enterpriseUrl?: string | undefined;
15
+ }, {
16
+ type: "oauth";
17
+ refresh: string;
18
+ access: string;
19
+ expires: number;
20
+ enterpriseUrl?: string | undefined;
21
+ }>;
22
+ const Api: z.ZodObject<{
23
+ type: z.ZodLiteral<"api">;
24
+ key: z.ZodString;
25
+ }, "strip", z.ZodTypeAny, {
26
+ type: "api";
27
+ key: string;
28
+ }, {
29
+ type: "api";
30
+ key: string;
31
+ }>;
32
+ const WellKnown: z.ZodObject<{
33
+ type: z.ZodLiteral<"wellknown">;
34
+ key: z.ZodString;
35
+ token: z.ZodString;
36
+ }, "strip", z.ZodTypeAny, {
37
+ type: "wellknown";
38
+ key: string;
39
+ token: string;
40
+ }, {
41
+ type: "wellknown";
42
+ key: string;
43
+ token: string;
44
+ }>;
45
+ const Info: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
46
+ type: z.ZodLiteral<"oauth">;
47
+ refresh: z.ZodString;
48
+ access: z.ZodString;
49
+ expires: z.ZodNumber;
50
+ enterpriseUrl: z.ZodOptional<z.ZodString>;
51
+ }, "strip", z.ZodTypeAny, {
52
+ type: "oauth";
53
+ refresh: string;
54
+ access: string;
55
+ expires: number;
56
+ enterpriseUrl?: string | undefined;
57
+ }, {
58
+ type: "oauth";
59
+ refresh: string;
60
+ access: string;
61
+ expires: number;
62
+ enterpriseUrl?: string | undefined;
63
+ }>, z.ZodObject<{
64
+ type: z.ZodLiteral<"api">;
65
+ key: z.ZodString;
66
+ }, "strip", z.ZodTypeAny, {
67
+ type: "api";
68
+ key: string;
69
+ }, {
70
+ type: "api";
71
+ key: string;
72
+ }>, z.ZodObject<{
73
+ type: z.ZodLiteral<"wellknown">;
74
+ key: z.ZodString;
75
+ token: z.ZodString;
76
+ }, "strip", z.ZodTypeAny, {
77
+ type: "wellknown";
78
+ key: string;
79
+ token: string;
80
+ }, {
81
+ type: "wellknown";
82
+ key: string;
83
+ token: string;
84
+ }>]>;
85
+ type Info = z.infer<typeof Info>;
86
+ function get(providerID: string): Promise<{
87
+ type: "oauth";
88
+ refresh: string;
89
+ access: string;
90
+ expires: number;
91
+ enterpriseUrl?: string | undefined;
92
+ } | {
93
+ type: "api";
94
+ key: string;
95
+ } | {
96
+ type: "wellknown";
97
+ key: string;
98
+ token: string;
99
+ }>;
100
+ function all(): Promise<Record<string, Info>>;
101
+ function set(key: string, info: Info): Promise<void>;
102
+ function remove(key: string): Promise<void>;
103
+ }
@@ -0,0 +1,10 @@
1
+ import z from "zod";
2
+ import type { ZodType } from "zod";
3
+ export declare namespace BusEvent {
4
+ type Definition = ReturnType<typeof define>;
5
+ function define<Type extends string, Properties extends ZodType>(type: Type, properties: Properties): {
6
+ type: Type;
7
+ properties: Properties;
8
+ };
9
+ function payloads(): z.ZodDiscriminatedUnion<"type", any>;
10
+ }
@@ -0,0 +1,7 @@
1
+ import { EventEmitter } from "events";
2
+ export declare const GlobalBus: EventEmitter<{
3
+ event: [{
4
+ directory?: string;
5
+ payload: any;
6
+ }];
7
+ }>;
@@ -0,0 +1,26 @@
1
+ import z from "zod";
2
+ import { BusEvent } from "./bus-event";
3
+ export declare namespace Bus {
4
+ const InstanceDisposed: {
5
+ type: "server.instance.disposed";
6
+ properties: z.ZodObject<{
7
+ directory: z.ZodString;
8
+ }, "strip", z.ZodTypeAny, {
9
+ directory: string;
10
+ }, {
11
+ directory: string;
12
+ }>;
13
+ };
14
+ function publish<Definition extends BusEvent.Definition>(def: Definition, properties: z.output<Definition["properties"]>): Promise<void[]>;
15
+ function subscribe<Definition extends BusEvent.Definition>(def: Definition, callback: (event: {
16
+ type: Definition["type"];
17
+ properties: z.infer<Definition["properties"]>;
18
+ }) => void): () => void;
19
+ function once<Definition extends BusEvent.Definition>(def: Definition, callback: (event: {
20
+ type: Definition["type"];
21
+ properties: z.infer<Definition["properties"]>;
22
+ }) => "done" | undefined): void;
23
+ function subscribeAll(callback: (event: any) => void): () => void;
24
+ }
25
+ export { BusEvent } from "./bus-event";
26
+ export { GlobalBus } from "./global";
@@ -0,0 +1,11 @@
1
+ export declare function authLogin(): Promise<void>;
2
+ export declare function authList(): Promise<void>;
3
+ export declare function authLogout(): Promise<void>;
4
+ /**
5
+ * Check if any provider has credentials configured
6
+ */
7
+ export declare function hasAnyCredentials(): Promise<boolean>;
8
+ /**
9
+ * Run onboarding flow if no credentials configured
10
+ */
11
+ export declare function runOnboarding(): Promise<boolean>;
@@ -0,0 +1 @@
1
+ export declare function cli(): Promise<void>;
@@ -0,0 +1,26 @@
1
+ export declare namespace UI {
2
+ class CancelledError extends Error {
3
+ constructor();
4
+ }
5
+ const Style: {
6
+ TEXT_HIGHLIGHT: string;
7
+ TEXT_HIGHLIGHT_BOLD: string;
8
+ TEXT_DIM: string;
9
+ TEXT_DIM_BOLD: string;
10
+ TEXT_NORMAL: string;
11
+ TEXT_NORMAL_BOLD: string;
12
+ TEXT_WARNING: string;
13
+ TEXT_WARNING_BOLD: string;
14
+ TEXT_DANGER: string;
15
+ TEXT_DANGER_BOLD: string;
16
+ TEXT_SUCCESS: string;
17
+ TEXT_SUCCESS_BOLD: string;
18
+ TEXT_INFO: string;
19
+ TEXT_INFO_BOLD: string;
20
+ };
21
+ function println(...message: string[]): void;
22
+ function print(...message: string[]): void;
23
+ function empty(): void;
24
+ function logo(pad?: string): string;
25
+ function error(message: string): void;
26
+ }
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Command System
3
+ *
4
+ * Manages slash commands for the TUI.
5
+ * Commands can be triggered by typing / followed by the command name.
6
+ */
7
+ export type DialogType = "model" | "help" | "diagnostics" | "config" | "sessions" | null;
8
+ export interface Command {
9
+ name: string;
10
+ aliases?: string[];
11
+ description: string;
12
+ category: "session" | "display" | "system" | "help";
13
+ execute: (ctx: CommandContext) => void | Promise<void>;
14
+ }
15
+ export interface CommandContext {
16
+ sessionId?: string;
17
+ navigate: (route: any) => void;
18
+ exit: () => void;
19
+ showDialog: (type: DialogType) => void;
20
+ clearDialog: () => void;
21
+ showOutput: (text: string) => void;
22
+ optimize?: () => Promise<void>;
23
+ sessionTokens?: {
24
+ input: number;
25
+ output: number;
26
+ };
27
+ availableProviders?: string[];
28
+ currentModel?: string;
29
+ }
30
+ /**
31
+ * Register a command
32
+ */
33
+ export declare function register(command: Command): void;
34
+ /**
35
+ * Get all registered commands
36
+ */
37
+ export declare function all(): Command[];
38
+ /**
39
+ * Find a command by name or alias
40
+ */
41
+ export declare function find(name: string): Command | undefined;
42
+ /**
43
+ * Execute a command string (e.g., "/help" or "/session")
44
+ */
45
+ export declare function execute(input: string, ctx: CommandContext): Promise<boolean>;
46
+ export interface CommandSuggestion {
47
+ command: Command;
48
+ matchedName: string;
49
+ }
50
+ /**
51
+ * Get command suggestions for autocomplete
52
+ * Returns commands that start with the given prefix, along with which name/alias matched
53
+ */
54
+ export declare function suggestions(prefix: string): CommandSuggestion[];