codexslimedit 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.
- package/LICENSE-OPENSLIMEDIT-MIT.txt +23 -0
- package/LICENSE.md +82 -0
- package/README.md +22 -0
- package/THIRD-PARTY-NOTICES.md +3 -0
- package/dist/cli.js +17 -0
- package/dist/index.d.ts +77 -0
- package/dist/index.js +2 -0
- package/dist/mcp.js +4791 -0
- package/package.json +46 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
OpenSlimEdit attribution notice
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Artur
|
|
4
|
+
|
|
5
|
+
MIT License
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
in the Software without restriction, including without limitation the rights
|
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
furnished to do so, subject to the following conditions:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
SOFTWARE.
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# License
|
|
2
|
+
|
|
3
|
+
Portions of this software are licensed as follows:
|
|
4
|
+
|
|
5
|
+
- All third party components incorporated into the oh-my-opencode Software are licensed under the original license
|
|
6
|
+
provided by the owner of the applicable component.
|
|
7
|
+
- Content outside of the above mentioned files or restrictions is available under the "Sustainable Use
|
|
8
|
+
License" as defined below.
|
|
9
|
+
|
|
10
|
+
## Sustainable Use License
|
|
11
|
+
|
|
12
|
+
Version 1.0
|
|
13
|
+
|
|
14
|
+
### Acceptance
|
|
15
|
+
|
|
16
|
+
By using the software, you agree to all of the terms and conditions below.
|
|
17
|
+
|
|
18
|
+
### Copyright License
|
|
19
|
+
|
|
20
|
+
The licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license
|
|
21
|
+
to use, copy, distribute, make available, and prepare derivative works of the software, in each case subject
|
|
22
|
+
to the limitations below.
|
|
23
|
+
|
|
24
|
+
### Limitations
|
|
25
|
+
|
|
26
|
+
You may use or modify the software only for your own internal business purposes or for non-commercial or
|
|
27
|
+
personal use. You may distribute the software or provide it to others only if you do so free of charge for
|
|
28
|
+
non-commercial purposes. You may not alter, remove, or obscure any licensing, copyright, or other notices of
|
|
29
|
+
the licensor in the software. Any use of the licensor's trademarks is subject to applicable law.
|
|
30
|
+
|
|
31
|
+
### Patents
|
|
32
|
+
|
|
33
|
+
The licensor grants you a license, under any patent claims the licensor can license, or becomes able to
|
|
34
|
+
license, to make, have made, use, sell, offer for sale, import and have imported the software, in each case
|
|
35
|
+
subject to the limitations and conditions in this license. This license does not cover any patent claims that
|
|
36
|
+
you cause to be infringed by modifications or additions to the software. If you or your company make any
|
|
37
|
+
written claim that the software infringes or contributes to infringement of any patent, your patent license
|
|
38
|
+
for the software granted under these terms ends immediately. If your company makes such a claim, your patent
|
|
39
|
+
license ends immediately for work on behalf of your company.
|
|
40
|
+
|
|
41
|
+
### Notices
|
|
42
|
+
|
|
43
|
+
You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these
|
|
44
|
+
terms. If you modify the software, you must include in any modified copies of the software a prominent notice
|
|
45
|
+
stating that you have modified the software.
|
|
46
|
+
|
|
47
|
+
### No Other Rights
|
|
48
|
+
|
|
49
|
+
These terms do not imply any licenses other than those expressly granted in these terms.
|
|
50
|
+
|
|
51
|
+
### Termination
|
|
52
|
+
|
|
53
|
+
If you use the software in violation of these terms, such use is not licensed, and your license will
|
|
54
|
+
automatically terminate. If the licensor provides you with a notice of your violation, and you cease all
|
|
55
|
+
violation of this license no later than 30 days after you receive that notice, your license will be reinstated
|
|
56
|
+
retroactively. However, if you violate these terms after such reinstatement, any additional violation of these
|
|
57
|
+
terms will cause your license to terminate automatically and permanently.
|
|
58
|
+
|
|
59
|
+
### No Liability
|
|
60
|
+
|
|
61
|
+
As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will
|
|
62
|
+
not be liable to you for any damages arising out of these terms or the use or nature of the software, under
|
|
63
|
+
any kind of legal claim.
|
|
64
|
+
|
|
65
|
+
### Definitions
|
|
66
|
+
|
|
67
|
+
The "licensor" is the entity offering these terms.
|
|
68
|
+
|
|
69
|
+
The "software" is the software the licensor makes available under these terms, including any portion of it.
|
|
70
|
+
|
|
71
|
+
"You" refers to the individual or entity agreeing to these terms.
|
|
72
|
+
|
|
73
|
+
"Your company" is any legal entity, sole proprietorship, or other kind of organization that you work for, plus
|
|
74
|
+
all organizations that have control over, are under the control of, or are under common control with that
|
|
75
|
+
organization. Control means ownership of substantially all the assets of an entity, or the power to direct its
|
|
76
|
+
management and policies by vote, contract, or otherwise. Control can be direct or indirect.
|
|
77
|
+
|
|
78
|
+
"Your license" is the license granted to you for the software under these terms.
|
|
79
|
+
|
|
80
|
+
"Use" means anything you do with the software requiring your license.
|
|
81
|
+
|
|
82
|
+
"Trademark" means trademarks, service marks, and similar rights.
|
package/README.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# codexslimedit
|
|
2
|
+
|
|
3
|
+
Codex-native MCP tools for compact UTF-8 file reads and validated exact or line-range edits. Runs on Node.js 20+ and Bun.
|
|
4
|
+
|
|
5
|
+
## Use
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npx codexslimedit
|
|
9
|
+
# or
|
|
10
|
+
bunx codexslimedit
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The MCP server exposes:
|
|
14
|
+
|
|
15
|
+
- `read`: returns a root-relative path and file content without footer boilerplate.
|
|
16
|
+
- `edit`: replaces one unique exact string or a 1-based inclusive line range such as `55-64`, then returns `OK <path>`.
|
|
17
|
+
|
|
18
|
+
Both tools constrain access to the server working directory. Reads reject non-UTF-8, NUL-containing, missing, non-file, traversal, and symlink-escape targets. Edits validate before writing, reject ambiguous matches and invalid ranges, preserve line endings and file mode, and use same-directory atomic replacement.
|
|
19
|
+
|
|
20
|
+
## Codex adaptation
|
|
21
|
+
|
|
22
|
+
This package adapts ideas from OpenSlimEdit for supported Codex extension surfaces. Codex plugins cannot replace descriptions of native tools or replace model-facing `PostToolUse` output, and Codex native patch editing has no OpenCode `oldString` contract. `codexslimedit` therefore provides separate concise MCP tools and makes no upstream token-saving claim.
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { a as CODEX_SLIM_EDIT_VERSION, n as runCodexSlimEditMcpStdioServer, o as isVersionRequest, s as stackOrMessageFromError } from "./mcp.js";
|
|
3
|
+
import { stderr } from "node:process";
|
|
4
|
+
//#region src/cli.ts
|
|
5
|
+
/** Starts the CodexSlimEdit MCP stdio entrypoint. */
|
|
6
|
+
async function main() {
|
|
7
|
+
if (isVersionRequest(process.argv.slice(2))) {
|
|
8
|
+
process.stdout.write(`${CODEX_SLIM_EDIT_VERSION}\n`);
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
await runCodexSlimEditMcpStdioServer(process.stdin, process.stdout);
|
|
12
|
+
}
|
|
13
|
+
main().catch((error) => {
|
|
14
|
+
stderr.write(`${stackOrMessageFromError(error)}\n`);
|
|
15
|
+
process.exitCode = 1;
|
|
16
|
+
});
|
|
17
|
+
//#endregion
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { Readable, Writable } from "node:stream";
|
|
2
|
+
|
|
3
|
+
/** Current independent codexslimedit package version. */
|
|
4
|
+
export declare const CODEX_SLIM_EDIT_VERSION = "0.1.0";
|
|
5
|
+
|
|
6
|
+
/** Returns whether command-line arguments request the package version. */
|
|
7
|
+
export declare function isVersionRequest(args: readonly string[]): boolean;
|
|
8
|
+
|
|
9
|
+
/** Identifies a workspace file operation failure. */
|
|
10
|
+
export type WorkspaceFileErrorCode =
|
|
11
|
+
| "EXACT_MATCH_NOT_FOUND"
|
|
12
|
+
| "DUPLICATE_MATCH"
|
|
13
|
+
| "INVALID_RANGE"
|
|
14
|
+
| "NOT_A_FILE"
|
|
15
|
+
| "NOT_FOUND"
|
|
16
|
+
| "PATH_OUTSIDE_ROOT"
|
|
17
|
+
| "UNREADABLE_FILE"
|
|
18
|
+
| "UNSUPPORTED_TEXT"
|
|
19
|
+
| "WRITE_FAILED";
|
|
20
|
+
|
|
21
|
+
/** Reports a typed, actionable workspace file operation failure. */
|
|
22
|
+
export declare class WorkspaceFileError extends Error {
|
|
23
|
+
/** Creates a workspace file operation error. */
|
|
24
|
+
constructor(code: WorkspaceFileErrorCode, message: string);
|
|
25
|
+
readonly code: WorkspaceFileErrorCode;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Input shared by workspace file operations. */
|
|
29
|
+
export interface WorkspaceFileInput {
|
|
30
|
+
/** Workspace root used to constrain file access. */
|
|
31
|
+
readonly root: string;
|
|
32
|
+
/** Relative path to the target file. */
|
|
33
|
+
readonly filePath: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Input for an exact-content or inclusive-line-range edit. */
|
|
37
|
+
export interface EditWorkspaceFileInput extends WorkspaceFileInput {
|
|
38
|
+
/** Exact text to replace, or an inclusive 1-based `N` or `N-M` line range. */
|
|
39
|
+
readonly oldString: string;
|
|
40
|
+
/** Replacement text. */
|
|
41
|
+
readonly newString: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Content returned by a workspace file operation. */
|
|
45
|
+
export interface WorkspaceFileResult {
|
|
46
|
+
/** Canonical root-relative path. */
|
|
47
|
+
readonly path: string;
|
|
48
|
+
/** UTF-8 file content after the operation. */
|
|
49
|
+
readonly content: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Options for the CodexSlimEdit MCP server. */
|
|
53
|
+
export interface CodexSlimEditMcpOptions {
|
|
54
|
+
/** Workspace root; defaults to the server process current directory. */
|
|
55
|
+
readonly root?: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Reads a regular UTF-8 text file inside the workspace root. */
|
|
59
|
+
export declare function readWorkspaceFile(input: WorkspaceFileInput): Promise<WorkspaceFileResult>;
|
|
60
|
+
|
|
61
|
+
/** Applies one validated exact-content or inclusive-line-range edit atomically. */
|
|
62
|
+
export declare function editWorkspaceFile(
|
|
63
|
+
input: EditWorkspaceFileInput,
|
|
64
|
+
): Promise<WorkspaceFileResult>;
|
|
65
|
+
|
|
66
|
+
/** Handles one CodexSlimEdit MCP JSON-RPC request. */
|
|
67
|
+
export declare function handleCodexSlimEditMcpRequest(
|
|
68
|
+
input: unknown,
|
|
69
|
+
options?: CodexSlimEditMcpOptions,
|
|
70
|
+
): Promise<unknown>;
|
|
71
|
+
|
|
72
|
+
/** Runs the CodexSlimEdit MCP server over stdio. */
|
|
73
|
+
export declare function runCodexSlimEditMcpStdioServer(
|
|
74
|
+
input: Readable,
|
|
75
|
+
output: Writable,
|
|
76
|
+
options?: CodexSlimEditMcpOptions,
|
|
77
|
+
): Promise<void>;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as CODEX_SLIM_EDIT_VERSION, c as WorkspaceFileError, i as readWorkspaceFile, n as runCodexSlimEditMcpStdioServer, o as isVersionRequest, r as editWorkspaceFile, t as handleCodexSlimEditMcpRequest } from "./mcp.js";
|
|
2
|
+
export { CODEX_SLIM_EDIT_VERSION, WorkspaceFileError, editWorkspaceFile, handleCodexSlimEditMcpRequest, isVersionRequest, readWorkspaceFile, runCodexSlimEditMcpStdioServer };
|