@fungi.computer/knapsack 0.0.0-stage → 0.0.2
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 +21 -0
- package/LICENSE.codex +201 -0
- package/README.md +140 -2
- package/dist/files-patch.d.ts +30 -0
- package/dist/files-patch.js +22 -0
- package/dist/files-read-codec.d.ts +10 -0
- package/dist/files-read-codec.js +26 -0
- package/dist/files-read.d.ts +25 -0
- package/dist/files-read.js +43 -0
- package/dist/files.d.ts +170 -0
- package/dist/files.js +513 -0
- package/dist/index.d.ts +70 -0
- package/dist/index.js +178 -0
- package/dist/mcp.d.ts +54 -0
- package/dist/mcp.js +237 -0
- package/dist/patch-grammar.d.ts +1 -0
- package/dist/patch-grammar.js +3 -0
- package/dist/patch.d.ts +27 -0
- package/dist/patch.js +56 -0
- package/docs/api/README.md +17 -0
- package/docs/api/files-patch.md +72 -0
- package/docs/api/files-read-codec.md +74 -0
- package/docs/api/files-read.md +94 -0
- package/docs/api/index.md +733 -0
- package/docs/api/patch.md +84 -0
- package/package.json +84 -3
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<!-- Generated by Botanical API docs (TypeDoc + typedoc-plugin-markdown). Do not edit. -->
|
|
2
|
+
|
|
3
|
+
[**@fungi.computer/knapsack**](README.md)
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
[@fungi.computer/knapsack](README.md) / patch
|
|
8
|
+
|
|
9
|
+
# patch
|
|
10
|
+
|
|
11
|
+
## Type Aliases
|
|
12
|
+
|
|
13
|
+
### CodexPatchLine
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
type CodexPatchLine = Readonly<{
|
|
17
|
+
kind: "add" | "context" | "remove";
|
|
18
|
+
text: string;
|
|
19
|
+
}>;
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
One body line of an update or add hunk.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
### CodexPatchHunk
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
type CodexPatchHunk = Readonly<{
|
|
30
|
+
context?: string;
|
|
31
|
+
lines: readonly CodexPatchLine[];
|
|
32
|
+
}>;
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
One `@@` change block; `context` is the text after `@@`, when present.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
### CodexPatchFile
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
type CodexPatchFile = Readonly<{
|
|
43
|
+
operation: "add" | "delete" | "update";
|
|
44
|
+
path: string;
|
|
45
|
+
moveTo?: string;
|
|
46
|
+
hunks: readonly CodexPatchHunk[];
|
|
47
|
+
}>;
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
One file operation in a patch, in patch order.
|
|
51
|
+
|
|
52
|
+
## Functions
|
|
53
|
+
|
|
54
|
+
### parseCodexPatch()
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
function parseCodexPatch(patch): readonly Readonly<{
|
|
58
|
+
operation: "update" | "delete" | "add";
|
|
59
|
+
path: string;
|
|
60
|
+
moveTo?: string;
|
|
61
|
+
hunks: readonly Readonly<{
|
|
62
|
+
context?: string;
|
|
63
|
+
lines: readonly Readonly<{
|
|
64
|
+
kind: "context" | "add" | "remove";
|
|
65
|
+
text: string;
|
|
66
|
+
}>[];
|
|
67
|
+
}>[];
|
|
68
|
+
}>[];
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Read the file operations of one Codex patch, in order.
|
|
72
|
+
|
|
73
|
+
#### Parameters
|
|
74
|
+
|
|
75
|
+
| Parameter | Type |
|
|
76
|
+
| --------- | -------- |
|
|
77
|
+
| `patch` | `string` |
|
|
78
|
+
|
|
79
|
+
#### Returns
|
|
80
|
+
|
|
81
|
+
readonly `Readonly`\<\{ `operation`: `"update"` \| `"delete"` \| `"add"`;
|
|
82
|
+
`path`: `string`; `moveTo?`: `string`; `hunks`: readonly `Readonly`\<\{
|
|
83
|
+
`context?`: `string`; `lines`: readonly `Readonly`\<\{ `kind`: `"context"` \|
|
|
84
|
+
`"add"` \| `"remove"`; `text`: `string`; \}\>[]; \}\>[]; \}\>[]
|
package/package.json
CHANGED
|
@@ -1,6 +1,87 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fungi.computer/knapsack",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"author": "Levi <levi@technomancy.dev>",
|
|
5
|
+
"description": "Agent tool connections projected into Mycelium capability sources",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./files-patch": {
|
|
16
|
+
"types": "./dist/files-patch.d.ts",
|
|
17
|
+
"import": "./dist/files-patch.js"
|
|
18
|
+
},
|
|
19
|
+
"./files-read": {
|
|
20
|
+
"types": "./dist/files-read.d.ts",
|
|
21
|
+
"import": "./dist/files-read.js"
|
|
22
|
+
},
|
|
23
|
+
"./patch": {
|
|
24
|
+
"types": "./dist/patch.d.ts",
|
|
25
|
+
"import": "./dist/patch.js"
|
|
26
|
+
},
|
|
27
|
+
"./files-read-codec": {
|
|
28
|
+
"types": "./dist/files-read-codec.d.ts",
|
|
29
|
+
"import": "./dist/files-read-codec.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"dist",
|
|
34
|
+
"docs/api",
|
|
35
|
+
"README.md",
|
|
36
|
+
"LICENSE",
|
|
37
|
+
"LICENSE.codex"
|
|
38
|
+
],
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@fungi.computer/cairn": "0.0.1",
|
|
41
|
+
"@fungi.computer/forage": "0.0.2",
|
|
42
|
+
"@fungi.computer/mule": "0.0.2",
|
|
43
|
+
"@fungi.computer/mycelium": "0.0.2",
|
|
44
|
+
"@modelcontextprotocol/client": "2.0.0",
|
|
45
|
+
"diff": "8.0.4",
|
|
46
|
+
"effect": "4.0.2",
|
|
47
|
+
"zod": "4.4.3"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@modelcontextprotocol/server": "2.0.0",
|
|
51
|
+
"@types/node": "24.13.3",
|
|
52
|
+
"typescript": "5.9.3",
|
|
53
|
+
"vitest": "4.1.11"
|
|
54
|
+
},
|
|
55
|
+
"botanical": {
|
|
56
|
+
"role": "package",
|
|
57
|
+
"operations": {
|
|
58
|
+
"lint": "required",
|
|
59
|
+
"typecheck": "required",
|
|
60
|
+
"build": "required",
|
|
61
|
+
"test": "required",
|
|
62
|
+
"docs": "required",
|
|
63
|
+
"pack": "required",
|
|
64
|
+
"smoke": "required",
|
|
65
|
+
"stranger": "required"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"license": "MIT",
|
|
69
|
+
"repository": {
|
|
70
|
+
"type": "git",
|
|
71
|
+
"url": "git+https://github.com/fungi-computer/knapsack.git"
|
|
72
|
+
},
|
|
73
|
+
"scripts": {
|
|
74
|
+
"lint": "eslint src test --max-warnings=0 && ../../node_modules/.bin/oxlint --config ../../oxlint.config.ts --deny-warnings src test",
|
|
75
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
76
|
+
"build": "pnpm run clean && tsc -p tsconfig.build.json",
|
|
77
|
+
"clean": "node --input-type=module --eval \"import { rm } from 'node:fs/promises'; await rm('dist', { recursive: true, force: true });\"",
|
|
78
|
+
"test": "vitest run",
|
|
79
|
+
"docs": "tsx ../../tooling/repository/src/docs/cli.ts check --root ../..",
|
|
80
|
+
"docs:write": "tsx ../../tooling/repository/src/docs/cli.ts write --root ../..",
|
|
81
|
+
"stranger": "tsx ../../tooling/repository/src/artifacts/cli.ts --repo-root ../.. .",
|
|
82
|
+
"pack": "mkdir -p ../../.botanical/knapsack-pack && pnpm pack --pack-destination ../../.botanical/knapsack-pack",
|
|
83
|
+
"smoke": "node --input-type=module -e \"import('./dist/index.js').then(({ Knapsack }) => { if (!Knapsack) process.exit(1); })\"",
|
|
84
|
+
"format:check": "node ../../tooling/repository/scripts/format-package-check.mjs",
|
|
85
|
+
"lint:anti-slop": "node ../../tooling/repository/scripts/lint-package-anti-slop.mjs"
|
|
86
|
+
}
|
|
6
87
|
}
|