@travisennis/acai 0.0.12 → 0.0.13
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/README.md +3 -2
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +2 -5
- package/dist/commands/history/types.d.ts +3 -2
- package/dist/commands/history/types.d.ts.map +1 -1
- package/dist/commands/init-project/utils.d.ts +0 -1
- package/dist/commands/init-project/utils.d.ts.map +1 -1
- package/dist/commands/init-project/utils.js +1 -1
- package/dist/commands/manager.d.ts.map +1 -1
- package/dist/commands/manager.js +0 -18
- package/dist/commands/share/html-renderer.d.ts.map +1 -1
- package/dist/commands/share/html-renderer.js +54 -48
- package/dist/commands/tools/index.js +39 -38
- package/dist/config/index.d.ts +0 -2
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +2 -6
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +94 -76
- package/dist/models/manager.d.ts +1 -10
- package/dist/models/manager.d.ts.map +1 -1
- package/dist/models/manager.js +2 -2
- package/dist/models/opencode-go-provider.d.ts +4 -4
- package/dist/models/opencode-go-provider.d.ts.map +1 -1
- package/dist/models/opencode-go-provider.js +29 -35
- package/dist/models/providers.d.ts +1 -1
- package/dist/models/providers.d.ts.map +1 -1
- package/dist/prompts/system-prompt.d.ts +0 -2
- package/dist/prompts/system-prompt.d.ts.map +1 -1
- package/dist/prompts/system-prompt.js +6 -10
- package/dist/repl/index.d.ts +27 -11
- package/dist/repl/index.d.ts.map +1 -1
- package/dist/repl/index.js +238 -254
- package/dist/skills/index.d.ts +12 -2
- package/dist/skills/index.d.ts.map +1 -1
- package/dist/skills/index.js +123 -73
- package/dist/terminal/control.d.ts +1 -21
- package/dist/terminal/control.d.ts.map +1 -1
- package/dist/terminal/control.js +1 -32
- package/dist/terminal/formatting.d.ts +0 -33
- package/dist/terminal/formatting.d.ts.map +1 -1
- package/dist/terminal/formatting.js +0 -91
- package/dist/terminal/highlight/theme.d.ts +0 -37
- package/dist/terminal/highlight/theme.d.ts.map +1 -1
- package/dist/terminal/highlight/theme.js +1 -79
- package/dist/terminal/keys.d.ts +0 -97
- package/dist/terminal/keys.d.ts.map +1 -1
- package/dist/terminal/keys.js +0 -194
- package/dist/terminal/select-prompt.d.ts.map +1 -1
- package/dist/terminal/select-prompt.js +65 -51
- package/dist/terminal/style.d.ts +1 -1
- package/dist/terminal/style.d.ts.map +1 -1
- package/dist/terminal/supports-color.d.ts.map +1 -1
- package/dist/terminal/supports-color.js +38 -20
- package/dist/terminal/supports-hyperlinks.d.ts +3 -0
- package/dist/terminal/supports-hyperlinks.d.ts.map +1 -1
- package/dist/terminal/supports-hyperlinks.js +72 -31
- package/dist/terminal/table/layout-manager.d.ts +0 -20
- package/dist/terminal/table/layout-manager.d.ts.map +1 -1
- package/dist/terminal/table/layout-manager.js +68 -44
- package/dist/terminal/table/utils.d.ts +0 -1
- package/dist/terminal/table/utils.d.ts.map +1 -1
- package/dist/terminal/table/utils.js +2 -4
- package/dist/tools/apply-patch.d.ts +5 -3
- package/dist/tools/apply-patch.d.ts.map +1 -1
- package/dist/tools/apply-patch.js +154 -123
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +11 -8
- package/dist/tools/dynamic-tool-loader.d.ts +6 -1
- package/dist/tools/dynamic-tool-loader.d.ts.map +1 -1
- package/dist/tools/dynamic-tool-loader.js +154 -135
- package/dist/tools/index.d.ts +3 -133
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +0 -20
- package/dist/tools/read-file.d.ts.map +1 -1
- package/dist/tools/read-file.js +32 -13
- package/dist/tools/skill.d.ts.map +1 -1
- package/dist/tools/skill.js +20 -13
- package/dist/tools/web-fetch.d.ts +2 -6
- package/dist/tools/web-fetch.d.ts.map +1 -1
- package/dist/tools/web-fetch.js +59 -36
- package/dist/tools/web-search.d.ts +0 -4
- package/dist/tools/web-search.d.ts.map +1 -1
- package/dist/tools/web-search.js +40 -32
- package/dist/tui/autocomplete/utils.d.ts +0 -15
- package/dist/tui/autocomplete/utils.d.ts.map +1 -1
- package/dist/tui/autocomplete/utils.js +0 -85
- package/dist/tui/autocomplete.d.ts +1 -1
- package/dist/tui/autocomplete.d.ts.map +1 -1
- package/dist/tui/autocomplete.js +1 -1
- package/dist/tui/components/editor.d.ts +12 -0
- package/dist/tui/components/editor.d.ts.map +1 -1
- package/dist/tui/components/editor.js +181 -195
- package/dist/tui/components/input.d.ts +4 -0
- package/dist/tui/components/input.d.ts.map +1 -1
- package/dist/tui/components/input.js +33 -31
- package/dist/tui/components/markdown.d.ts +30 -0
- package/dist/tui/components/markdown.d.ts.map +1 -1
- package/dist/tui/components/markdown.js +274 -242
- package/dist/tui/components/modal.d.ts.map +1 -1
- package/dist/tui/components/modal.js +11 -11
- package/dist/tui/components/select-list.d.ts +5 -0
- package/dist/tui/components/select-list.d.ts.map +1 -1
- package/dist/tui/components/select-list.js +69 -98
- package/dist/tui/components/table.d.ts +6 -0
- package/dist/tui/components/table.d.ts.map +1 -1
- package/dist/tui/components/table.js +61 -52
- package/dist/tui/index.d.ts +1 -8
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/index.js +0 -8
- package/dist/tui/tui.d.ts +9 -0
- package/dist/tui/tui.d.ts.map +1 -1
- package/dist/tui/tui.js +78 -48
- package/dist/tui/utils.d.ts +7 -0
- package/dist/tui/utils.d.ts.map +1 -1
- package/dist/tui/utils.js +117 -53
- package/dist/utils/bash.d.ts.map +1 -1
- package/dist/utils/bash.js +121 -104
- package/dist/utils/command-protection.d.ts +3 -2
- package/dist/utils/command-protection.d.ts.map +1 -1
- package/dist/utils/command-protection.js +42 -33
- package/dist/utils/filesystem/operations.d.ts +0 -15
- package/dist/utils/filesystem/operations.d.ts.map +1 -1
- package/dist/utils/filesystem/operations.js +1 -38
- package/dist/utils/filesystem/security.d.ts.map +1 -1
- package/dist/utils/filesystem/security.js +22 -15
- package/dist/utils/filetype-detection.d.ts +0 -1
- package/dist/utils/filetype-detection.d.ts.map +1 -1
- package/dist/utils/filetype-detection.js +0 -12
- package/dist/utils/formatting.d.ts +0 -30
- package/dist/utils/formatting.d.ts.map +1 -1
- package/dist/utils/formatting.js +0 -44
- package/dist/utils/git.d.ts +4 -6
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/git.js +36 -46
- package/dist/utils/ignore.d.ts +1 -1
- package/dist/utils/ignore.d.ts.map +1 -1
- package/dist/utils/ignore.js +1 -1
- package/dist/utils/process.d.ts.map +1 -1
- package/dist/utils/process.js +77 -79
- package/dist/utils/yaml.d.ts +0 -1
- package/dist/utils/yaml.d.ts.map +1 -1
- package/dist/utils/yaml.js +80 -89
- package/dist/utils/zod.d.ts +0 -3
- package/dist/utils/zod.d.ts.map +1 -1
- package/dist/utils/zod.js +0 -7
- package/package.json +25 -24
- package/dist/agent/sub-agent.d.ts +0 -23
- package/dist/agent/sub-agent.d.ts.map +0 -1
- package/dist/agent/sub-agent.js +0 -109
- package/dist/commands/add-directory/index.d.ts +0 -3
- package/dist/commands/add-directory/index.d.ts.map +0 -1
- package/dist/commands/add-directory/index.js +0 -50
- package/dist/commands/add-directory/utils.d.ts +0 -3
- package/dist/commands/add-directory/utils.d.ts.map +0 -1
- package/dist/commands/add-directory/utils.js +0 -15
- package/dist/commands/clear/index.d.ts +0 -3
- package/dist/commands/clear/index.d.ts.map +0 -1
- package/dist/commands/clear/index.js +0 -13
- package/dist/commands/generate-rules/index.d.ts +0 -3
- package/dist/commands/generate-rules/index.d.ts.map +0 -1
- package/dist/commands/generate-rules/index.js +0 -206
- package/dist/commands/generate-rules/service.d.ts +0 -22
- package/dist/commands/generate-rules/service.d.ts.map +0 -1
- package/dist/commands/generate-rules/service.js +0 -103
- package/dist/commands/generate-rules/utils.d.ts +0 -5
- package/dist/commands/generate-rules/utils.d.ts.map +0 -1
- package/dist/commands/generate-rules/utils.js +0 -25
- package/dist/commands/handoff/index.d.ts +0 -3
- package/dist/commands/handoff/index.d.ts.map +0 -1
- package/dist/commands/handoff/index.js +0 -97
- package/dist/commands/handoff/utils.d.ts +0 -4
- package/dist/commands/handoff/utils.d.ts.map +0 -1
- package/dist/commands/handoff/utils.js +0 -123
- package/dist/commands/list-directories/index.d.ts +0 -3
- package/dist/commands/list-directories/index.d.ts.map +0 -1
- package/dist/commands/list-directories/index.js +0 -35
- package/dist/commands/pickup/index.d.ts +0 -3
- package/dist/commands/pickup/index.d.ts.map +0 -1
- package/dist/commands/pickup/index.js +0 -141
- package/dist/commands/pickup/types.d.ts +0 -6
- package/dist/commands/pickup/types.d.ts.map +0 -1
- package/dist/commands/pickup/types.js +0 -1
- package/dist/commands/pickup/utils.d.ts +0 -7
- package/dist/commands/pickup/utils.d.ts.map +0 -1
- package/dist/commands/pickup/utils.js +0 -56
- package/dist/commands/remove-directory/index.d.ts +0 -3
- package/dist/commands/remove-directory/index.d.ts.map +0 -1
- package/dist/commands/remove-directory/index.js +0 -55
- package/dist/commands/review/index.d.ts +0 -3
- package/dist/commands/review/index.d.ts.map +0 -1
- package/dist/commands/review/index.js +0 -12
- package/dist/commands/review/review-panel.d.ts +0 -3
- package/dist/commands/review/review-panel.d.ts.map +0 -1
- package/dist/commands/review/review-panel.js +0 -186
- package/dist/commands/review/utils.d.ts +0 -18
- package/dist/commands/review/utils.d.ts.map +0 -1
- package/dist/commands/review/utils.js +0 -146
- package/dist/commands/shell/index.d.ts +0 -3
- package/dist/commands/shell/index.d.ts.map +0 -1
- package/dist/commands/shell/index.js +0 -96
- package/dist/subagents/index.d.ts +0 -16
- package/dist/subagents/index.d.ts.map +0 -1
- package/dist/subagents/index.js +0 -231
- package/dist/terminal/index.d.ts +0 -9
- package/dist/terminal/index.d.ts.map +0 -1
- package/dist/terminal/index.js +0 -8
- package/dist/tools/agent.d.ts +0 -27
- package/dist/tools/agent.d.ts.map +0 -1
- package/dist/tools/agent.js +0 -81
- package/dist/tools/directory-tree.d.ts +0 -28
- package/dist/tools/directory-tree.d.ts.map +0 -1
- package/dist/tools/directory-tree.js +0 -154
- package/dist/tools/glob.d.ts +0 -35
- package/dist/tools/glob.d.ts.map +0 -1
- package/dist/tools/glob.js +0 -167
- package/dist/tools/grep.d.ts +0 -100
- package/dist/tools/grep.d.ts.map +0 -1
- package/dist/tools/grep.js +0 -608
- package/dist/tools/ls.d.ts +0 -26
- package/dist/tools/ls.d.ts.map +0 -1
- package/dist/tools/ls.js +0 -83
- package/dist/tui/components/header.d.ts +0 -21
- package/dist/tui/components/header.d.ts.map +0 -1
- package/dist/tui/components/header.js +0 -63
- package/dist/utils/bash/parse.d.ts +0 -19
- package/dist/utils/bash/parse.d.ts.map +0 -1
- package/dist/utils/bash/parse.js +0 -223
- package/dist/utils/bash/quote.d.ts +0 -6
- package/dist/utils/bash/quote.d.ts.map +0 -1
- package/dist/utils/bash/quote.js +0 -23
- package/dist/utils/generators.d.ts +0 -3
- package/dist/utils/generators.d.ts.map +0 -1
- package/dist/utils/generators.js +0 -25
- package/dist/utils/glob.d.ts +0 -52
- package/dist/utils/glob.d.ts.map +0 -1
- package/dist/utils/glob.js +0 -376
package/dist/tools/ls.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs/promises";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
import style from "../terminal/style.js";
|
|
5
|
-
import { isDirectory } from "../utils/filesystem/operations.js";
|
|
6
|
-
import { toDisplayPath } from "../utils/filesystem/path-display.js";
|
|
7
|
-
import { validatePath } from "../utils/filesystem/security.js";
|
|
8
|
-
import { convertNullString } from "../utils/zod.js";
|
|
9
|
-
export const LsTool = {
|
|
10
|
-
name: "LS",
|
|
11
|
-
};
|
|
12
|
-
const inputSchema = z.object({
|
|
13
|
-
path: z
|
|
14
|
-
.string()
|
|
15
|
-
.optional()
|
|
16
|
-
.describe("Directory to list (default: current directory)"),
|
|
17
|
-
limit: z
|
|
18
|
-
.preprocess((val) => convertNullString(val), z.coerce.number().nullable())
|
|
19
|
-
.default(null)
|
|
20
|
-
.describe("Maximum number of entries to return (default: 500)"),
|
|
21
|
-
});
|
|
22
|
-
const DEFAULT_ENTRY_LIMIT = 500;
|
|
23
|
-
export const createLsTool = async (options) => {
|
|
24
|
-
const { primaryDir, allowedDirs } = options.workspace;
|
|
25
|
-
const allowedDirectory = allowedDirs ?? [primaryDir];
|
|
26
|
-
return {
|
|
27
|
-
toolDef: {
|
|
28
|
-
description: "List files in a single directory. Fast and simple - use this when you need a quick flat list of files in one directory. For recursive tree views, use DirectoryTree instead.",
|
|
29
|
-
inputSchema,
|
|
30
|
-
},
|
|
31
|
-
display({ path: providedPath, limit }) {
|
|
32
|
-
const dirPath = providedPath ?? ".";
|
|
33
|
-
const effectiveLimit = limit ?? 500;
|
|
34
|
-
const displayPath = toDisplayPath(dirPath);
|
|
35
|
-
return `${style.cyan(displayPath)} (limit: ${effectiveLimit})`;
|
|
36
|
-
},
|
|
37
|
-
async execute({ path: providedPath, limit }, { abortSignal }) {
|
|
38
|
-
if (abortSignal?.aborted) {
|
|
39
|
-
throw new Error("Directory listing aborted");
|
|
40
|
-
}
|
|
41
|
-
const dirPath = providedPath ?? ".";
|
|
42
|
-
const effectiveLimit = limit ?? DEFAULT_ENTRY_LIMIT;
|
|
43
|
-
const resolvedPath = await validatePath(path.resolve(primaryDir, dirPath), allowedDirectory, { requireExistence: true, abortSignal });
|
|
44
|
-
if (abortSignal?.aborted) {
|
|
45
|
-
throw new Error("Directory listing aborted before validation");
|
|
46
|
-
}
|
|
47
|
-
const isDir = await isDirectory(resolvedPath);
|
|
48
|
-
if (!isDir) {
|
|
49
|
-
throw new Error(`Not a directory: ${resolvedPath}`);
|
|
50
|
-
}
|
|
51
|
-
let entries;
|
|
52
|
-
try {
|
|
53
|
-
entries = await fs.readdir(resolvedPath);
|
|
54
|
-
}
|
|
55
|
-
catch (e) {
|
|
56
|
-
throw new Error(`Cannot read directory: ${e.message}`);
|
|
57
|
-
}
|
|
58
|
-
entries.sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()));
|
|
59
|
-
const results = [];
|
|
60
|
-
for (const entry of entries) {
|
|
61
|
-
if (results.length >= effectiveLimit) {
|
|
62
|
-
break;
|
|
63
|
-
}
|
|
64
|
-
const fullPath = path.join(resolvedPath, entry);
|
|
65
|
-
let suffix = "";
|
|
66
|
-
try {
|
|
67
|
-
const entryStat = await fs.stat(fullPath);
|
|
68
|
-
if (entryStat.isDirectory()) {
|
|
69
|
-
suffix = "/";
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
catch {
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
results.push(entry + suffix);
|
|
76
|
-
}
|
|
77
|
-
if (results.length === 0) {
|
|
78
|
-
return "(empty directory)";
|
|
79
|
-
}
|
|
80
|
-
return results.join("\n");
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { type StyleInstance } from "../../terminal/style.ts";
|
|
2
|
-
import type { Component } from "../tui.ts";
|
|
3
|
-
/**
|
|
4
|
-
* Header component - displays styled header line
|
|
5
|
-
*/
|
|
6
|
-
export declare class HeaderComponent implements Component {
|
|
7
|
-
private header;
|
|
8
|
-
private styleFn;
|
|
9
|
-
private width;
|
|
10
|
-
private cachedOutput?;
|
|
11
|
-
private cachedHeader?;
|
|
12
|
-
private cachedStyleFn?;
|
|
13
|
-
private cachedWidth?;
|
|
14
|
-
constructor(header: string, styleFn?: StyleInstance, width?: number);
|
|
15
|
-
setHeader(header: string): void;
|
|
16
|
-
setStyleFn(styleFn: StyleInstance): void;
|
|
17
|
-
setWidth(width: number): void;
|
|
18
|
-
private invalidateCache;
|
|
19
|
-
render(width: number): string[];
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=header.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../../source/tui/components/header.ts"],"names":[],"mappings":"AACA,OAAc,EAAE,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C;;GAEG;AACH,qBAAa,eAAgB,YAAW,SAAS;IAC/C,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,KAAK,CAAS;IAGtB,OAAO,CAAC,YAAY,CAAC,CAAW;IAChC,OAAO,CAAC,YAAY,CAAC,CAAS;IAC9B,OAAO,CAAC,aAAa,CAAC,CAAgB;IACtC,OAAO,CAAC,WAAW,CAAC,CAAS;gBAG3B,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,aAA0B,EACnC,KAAK,CAAC,EAAE,MAAM;IAOhB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAK/B,UAAU,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAKxC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK7B,OAAO,CAAC,eAAe;IAOvB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;CA+BhC"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { getTerminalSize } from "../../terminal/control.js";
|
|
2
|
-
import style from "../../terminal/style.js";
|
|
3
|
-
/**
|
|
4
|
-
* Header component - displays styled header line
|
|
5
|
-
*/
|
|
6
|
-
export class HeaderComponent {
|
|
7
|
-
header;
|
|
8
|
-
styleFn;
|
|
9
|
-
width;
|
|
10
|
-
// Cache for rendered output
|
|
11
|
-
cachedOutput;
|
|
12
|
-
cachedHeader;
|
|
13
|
-
cachedStyleFn;
|
|
14
|
-
cachedWidth;
|
|
15
|
-
constructor(header, styleFn = style.cyan, width) {
|
|
16
|
-
this.header = header;
|
|
17
|
-
this.styleFn = styleFn;
|
|
18
|
-
this.width = width || 0;
|
|
19
|
-
}
|
|
20
|
-
setHeader(header) {
|
|
21
|
-
this.header = header;
|
|
22
|
-
this.invalidateCache();
|
|
23
|
-
}
|
|
24
|
-
setStyleFn(styleFn) {
|
|
25
|
-
this.styleFn = styleFn;
|
|
26
|
-
this.invalidateCache();
|
|
27
|
-
}
|
|
28
|
-
setWidth(width) {
|
|
29
|
-
this.width = width;
|
|
30
|
-
this.invalidateCache();
|
|
31
|
-
}
|
|
32
|
-
invalidateCache() {
|
|
33
|
-
this.cachedOutput = undefined;
|
|
34
|
-
this.cachedHeader = undefined;
|
|
35
|
-
this.cachedStyleFn = undefined;
|
|
36
|
-
this.cachedWidth = undefined;
|
|
37
|
-
}
|
|
38
|
-
render(width) {
|
|
39
|
-
// Use provided width if specified, otherwise use component width or terminal size
|
|
40
|
-
let renderWidth = width || this.width;
|
|
41
|
-
if (renderWidth === 0) {
|
|
42
|
-
const { columns } = getTerminalSize();
|
|
43
|
-
const cols = columns > 0 ? columns : 80;
|
|
44
|
-
renderWidth = Math.max(0, cols - this.header.length - 4);
|
|
45
|
-
}
|
|
46
|
-
// Check cache
|
|
47
|
-
if (this.cachedOutput &&
|
|
48
|
-
this.cachedHeader === this.header &&
|
|
49
|
-
this.cachedStyleFn === this.styleFn &&
|
|
50
|
-
this.cachedWidth === renderWidth) {
|
|
51
|
-
return this.cachedOutput;
|
|
52
|
-
}
|
|
53
|
-
const result = [
|
|
54
|
-
`${style.gray("\n── ")}${this.styleFn(this.header)} ${style.gray("─".repeat(renderWidth))}`,
|
|
55
|
-
];
|
|
56
|
-
// Update cache
|
|
57
|
-
this.cachedOutput = result;
|
|
58
|
-
this.cachedHeader = this.header;
|
|
59
|
-
this.cachedStyleFn = this.styleFn;
|
|
60
|
-
this.cachedWidth = renderWidth;
|
|
61
|
-
return result;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
interface ControlOperator {
|
|
2
|
-
op: "||" | "&&" | ";;" | "|&" | "<(" | "<<<" | ">>" | ">&" | "&" | ";" | "(" | ")" | "|" | "<" | ">";
|
|
3
|
-
}
|
|
4
|
-
interface GlobOperator {
|
|
5
|
-
op: "glob";
|
|
6
|
-
pattern: string;
|
|
7
|
-
}
|
|
8
|
-
interface CommentOperator {
|
|
9
|
-
comment: string;
|
|
10
|
-
}
|
|
11
|
-
type ParseEntry = string | ControlOperator | GlobOperator | CommentOperator;
|
|
12
|
-
interface ParseOptions {
|
|
13
|
-
escape?: string;
|
|
14
|
-
}
|
|
15
|
-
type EnvFunction = (key: string) => unknown;
|
|
16
|
-
export declare function parse(s: string, env?: Record<string, string | undefined> | EnvFunction, opts?: ParseOptions): ParseEntry[];
|
|
17
|
-
export declare function parse<T extends object | string>(s: string, env: (key: string) => T | undefined, opts?: ParseOptions): (ParseEntry | T)[];
|
|
18
|
-
export {};
|
|
19
|
-
//# sourceMappingURL=parse.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../source/utils/bash/parse.ts"],"names":[],"mappings":"AA+BA,UAAU,eAAe;IACvB,EAAE,EACE,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,KAAK,GACL,IAAI,GACJ,IAAI,GACJ,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,CAAC;CACT;AAED,UAAU,YAAY;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,UAAU,eAAe;IACvB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,KAAK,UAAU,GAAG,MAAM,GAAG,eAAe,GAAG,YAAY,GAAG,eAAe,CAAC;AAE5E,UAAU,YAAY;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,KAAK,WAAW,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;AA8L5C,wBAAgB,KAAK,CACnB,CAAC,EAAE,MAAM,EACT,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,WAAW,EACtD,IAAI,CAAC,EAAE,YAAY,GAClB,UAAU,EAAE,CAAC;AAChB,wBAAgB,KAAK,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAC7C,CAAC,EAAE,MAAM,EACT,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,CAAC,GAAG,SAAS,EACnC,IAAI,CAAC,EAAE,YAAY,GAClB,CAAC,UAAU,GAAG,CAAC,CAAC,EAAE,CAAC"}
|
package/dist/utils/bash/parse.js
DELETED
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
// '<(' is process substitution operator and
|
|
2
|
-
// can be parsed the same as control operator
|
|
3
|
-
const CONTROL = `(?:${[
|
|
4
|
-
"\\|\\|",
|
|
5
|
-
"\\&\\&",
|
|
6
|
-
";;",
|
|
7
|
-
"\\|\\&",
|
|
8
|
-
"\\<\\(",
|
|
9
|
-
"\\<\\<\\<",
|
|
10
|
-
">>",
|
|
11
|
-
">\\&",
|
|
12
|
-
"<\\&",
|
|
13
|
-
"[&;()|<>]",
|
|
14
|
-
].join("|")})`;
|
|
15
|
-
const controlRe = new RegExp(`^${CONTROL}$`);
|
|
16
|
-
const META = "|&;()<> \t";
|
|
17
|
-
const SINGLE_QUOTE = '"((\\\\"|[^"])*?)"';
|
|
18
|
-
const DOUBLE_QUOTE = "'((\\\\'|[^'])*?)'";
|
|
19
|
-
const hash = /^#$/;
|
|
20
|
-
const SQ = "'";
|
|
21
|
-
const DQ = '"';
|
|
22
|
-
const DS = "$";
|
|
23
|
-
let Token = "";
|
|
24
|
-
const mult = 0x100000000; // Math.pow(16, 8);
|
|
25
|
-
for (let i = 0; i < 4; i++) {
|
|
26
|
-
Token += (mult * Math.random()).toString(16);
|
|
27
|
-
}
|
|
28
|
-
const startsWithToken = new RegExp(`^${Token}`);
|
|
29
|
-
function matchAll(s, r) {
|
|
30
|
-
const origIndex = r.lastIndex;
|
|
31
|
-
const matches = [];
|
|
32
|
-
let matchObj = r.exec(s);
|
|
33
|
-
while (matchObj !== null) {
|
|
34
|
-
matches.push(matchObj);
|
|
35
|
-
if (r.lastIndex === matchObj.index) {
|
|
36
|
-
r.lastIndex += 1;
|
|
37
|
-
}
|
|
38
|
-
matchObj = r.exec(s);
|
|
39
|
-
}
|
|
40
|
-
r.lastIndex = origIndex;
|
|
41
|
-
return matches;
|
|
42
|
-
}
|
|
43
|
-
function getVar(env, pre, key) {
|
|
44
|
-
let r = typeof env === "function" ? env(key) : env[key];
|
|
45
|
-
if (typeof r === "undefined" && key !== "") {
|
|
46
|
-
r = "";
|
|
47
|
-
}
|
|
48
|
-
else if (typeof r === "undefined") {
|
|
49
|
-
r = "$";
|
|
50
|
-
}
|
|
51
|
-
if (typeof r === "object") {
|
|
52
|
-
return pre + Token + JSON.stringify(r) + Token;
|
|
53
|
-
}
|
|
54
|
-
return pre + String(r);
|
|
55
|
-
}
|
|
56
|
-
function parseInternal(string, env, opts = {}) {
|
|
57
|
-
const Bs = opts.escape || "\\";
|
|
58
|
-
const Bareword = `(\\${Bs}["'${META}]|[^\\s'""${META}])+`;
|
|
59
|
-
const chunker = new RegExp([
|
|
60
|
-
`(${CONTROL})`, // control chars
|
|
61
|
-
`(${Bareword}|${SINGLE_QUOTE}|${DOUBLE_QUOTE})+`,
|
|
62
|
-
].join("|"), "g");
|
|
63
|
-
const matches = matchAll(string, chunker);
|
|
64
|
-
if (matches.length === 0) {
|
|
65
|
-
return [];
|
|
66
|
-
}
|
|
67
|
-
const envToUse = env ?? {};
|
|
68
|
-
let commented = false;
|
|
69
|
-
return matches
|
|
70
|
-
.map(
|
|
71
|
-
// biome-ignore lint:noExcessiveCognitiveComplexity
|
|
72
|
-
(match) => {
|
|
73
|
-
const s = match[0];
|
|
74
|
-
if (!s || commented) {
|
|
75
|
-
return undefined;
|
|
76
|
-
}
|
|
77
|
-
if (controlRe.test(s)) {
|
|
78
|
-
return { op: s };
|
|
79
|
-
}
|
|
80
|
-
// Hand-written scanner/parser for Bash quoting rules:
|
|
81
|
-
//
|
|
82
|
-
// 1. inside single quotes, all characters are printed literally.
|
|
83
|
-
// 2. inside double quotes, all characters are printed literally
|
|
84
|
-
// except variables prefixed by '$' and backslashes followed by
|
|
85
|
-
// either a double quote or another backslash.
|
|
86
|
-
// 3. outside of any quotes, backslashes are treated as escape
|
|
87
|
-
// characters and not printed (unless they are themselves escaped)
|
|
88
|
-
// 4. quote context can switch mid-token if there is no whitespace
|
|
89
|
-
// between the two quote contexts (e.g. all'one'"token" parses as
|
|
90
|
-
// "allonetoken")
|
|
91
|
-
let quote = false;
|
|
92
|
-
let esc = false;
|
|
93
|
-
let out = "";
|
|
94
|
-
let isGlob = false;
|
|
95
|
-
let i = 0;
|
|
96
|
-
function parseEnvVar() {
|
|
97
|
-
i += 1;
|
|
98
|
-
let varend;
|
|
99
|
-
let varname;
|
|
100
|
-
const char = s.charAt(i);
|
|
101
|
-
if (char === "{") {
|
|
102
|
-
i += 1;
|
|
103
|
-
if (s.charAt(i) === "}") {
|
|
104
|
-
throw new Error(`Bad substitution: ${s.slice(i - 2, i + 1)}`);
|
|
105
|
-
}
|
|
106
|
-
varend = s.indexOf("}", i);
|
|
107
|
-
if (varend < 0) {
|
|
108
|
-
throw new Error(`Bad substitution: ${s.slice(i)}`);
|
|
109
|
-
}
|
|
110
|
-
varname = s.slice(i, varend);
|
|
111
|
-
i = varend;
|
|
112
|
-
}
|
|
113
|
-
else if (/[*@#?$!_-]/.test(char)) {
|
|
114
|
-
varname = char;
|
|
115
|
-
i += 1;
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
const slicedFromI = s.slice(i);
|
|
119
|
-
const varendMatch = slicedFromI.match(/[^\w\d_]/);
|
|
120
|
-
if (!varendMatch) {
|
|
121
|
-
varname = slicedFromI;
|
|
122
|
-
i = s.length;
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
varname = slicedFromI.slice(0, varendMatch.index);
|
|
126
|
-
i += (varendMatch.index ?? 0) - 1;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
return getVar(envToUse, "", varname);
|
|
130
|
-
}
|
|
131
|
-
for (i = 0; i < s.length; i++) {
|
|
132
|
-
const c = s.charAt(i);
|
|
133
|
-
isGlob = isGlob || (!quote && (c === "*" || c === "?"));
|
|
134
|
-
if (esc) {
|
|
135
|
-
out += c;
|
|
136
|
-
esc = false;
|
|
137
|
-
}
|
|
138
|
-
else if (quote) {
|
|
139
|
-
if (c === quote) {
|
|
140
|
-
quote = false;
|
|
141
|
-
}
|
|
142
|
-
else if (quote === SQ) {
|
|
143
|
-
out += c;
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
// Double quote
|
|
147
|
-
if (c === Bs) {
|
|
148
|
-
i += 1;
|
|
149
|
-
const charAtI = s.charAt(i);
|
|
150
|
-
if (charAtI === DQ || charAtI === Bs || charAtI === DS) {
|
|
151
|
-
out += charAtI;
|
|
152
|
-
}
|
|
153
|
-
else {
|
|
154
|
-
out += Bs + charAtI;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
else if (c === DS) {
|
|
158
|
-
out += parseEnvVar();
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
out += c;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
else if (c === DQ || c === SQ) {
|
|
166
|
-
quote = c;
|
|
167
|
-
}
|
|
168
|
-
else if (controlRe.test(c)) {
|
|
169
|
-
return { op: s };
|
|
170
|
-
}
|
|
171
|
-
else if (hash.test(c)) {
|
|
172
|
-
commented = true;
|
|
173
|
-
const matchIndex = match.index;
|
|
174
|
-
const commentObj = {
|
|
175
|
-
comment: string.slice((matchIndex ?? 0) + i + 1),
|
|
176
|
-
};
|
|
177
|
-
if (out.length) {
|
|
178
|
-
return [out, commentObj];
|
|
179
|
-
}
|
|
180
|
-
return [commentObj];
|
|
181
|
-
}
|
|
182
|
-
else if (c === Bs) {
|
|
183
|
-
esc = true;
|
|
184
|
-
}
|
|
185
|
-
else if (c === DS) {
|
|
186
|
-
out += parseEnvVar();
|
|
187
|
-
}
|
|
188
|
-
else {
|
|
189
|
-
out += c;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
if (isGlob) {
|
|
193
|
-
return { op: "glob", pattern: out };
|
|
194
|
-
}
|
|
195
|
-
return out;
|
|
196
|
-
})
|
|
197
|
-
.reduce((prev, arg) => {
|
|
198
|
-
// TODO: replace this whole reduce with a concat
|
|
199
|
-
return typeof arg === "undefined" ? prev : prev.concat(arg);
|
|
200
|
-
}, []);
|
|
201
|
-
}
|
|
202
|
-
export function parse(s, env = {}, opts) {
|
|
203
|
-
const mapped = parseInternal(s, env, opts);
|
|
204
|
-
if (typeof env !== "function") {
|
|
205
|
-
return mapped;
|
|
206
|
-
}
|
|
207
|
-
return mapped.reduce((acc, s) => {
|
|
208
|
-
if (typeof s === "object") {
|
|
209
|
-
return acc.concat(s);
|
|
210
|
-
}
|
|
211
|
-
const xs = s.split(RegExp(`(${Token}.*?${Token})`, "g"));
|
|
212
|
-
if (xs.length === 1) {
|
|
213
|
-
return acc.concat(xs[0]);
|
|
214
|
-
}
|
|
215
|
-
return acc.concat(xs.filter(Boolean).map((x) => {
|
|
216
|
-
if (startsWithToken.test(x)) {
|
|
217
|
-
const parts = x.split(Token);
|
|
218
|
-
return JSON.parse(parts[1]);
|
|
219
|
-
}
|
|
220
|
-
return x;
|
|
221
|
-
}));
|
|
222
|
-
}, []);
|
|
223
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"quote.d.ts","sourceRoot":"","sources":["../../../source/utils/bash/quote.ts"],"names":[],"mappings":"AAAA,KAAK,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,CAAC;AAE9E,wBAAgB,KAAK,CAAC,EAAE,EAAE,SAAS,QAAQ,EAAE,GAAG,MAAM,CAyBrD"}
|
package/dist/utils/bash/quote.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export function quote(xs) {
|
|
2
|
-
return xs
|
|
3
|
-
.map((s) => {
|
|
4
|
-
if (s === null || s === undefined) {
|
|
5
|
-
return String(s);
|
|
6
|
-
}
|
|
7
|
-
const str = String(s);
|
|
8
|
-
if (str === "") {
|
|
9
|
-
return "''";
|
|
10
|
-
}
|
|
11
|
-
if (s && typeof s === "object") {
|
|
12
|
-
return s.op.replace(/(.)/g, "\\$1");
|
|
13
|
-
}
|
|
14
|
-
if (/["\s\\]/.test(str) && !/'/.test(str)) {
|
|
15
|
-
return `'${str.replace(/(['])/g, "\\$1")}'`;
|
|
16
|
-
}
|
|
17
|
-
if (/["'\s]/.test(str)) {
|
|
18
|
-
return `"${str.replace(/(["\\$`!])/g, "\\$1")}"`;
|
|
19
|
-
}
|
|
20
|
-
return str.replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}])/g, "$1\\$2");
|
|
21
|
-
})
|
|
22
|
-
.join(" ");
|
|
23
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export declare function exhaustGenerator<T, TReturn, TNext>(generator: Generator<T, TReturn, TNext>): TReturn;
|
|
2
|
-
export declare function exhaustGenerator<T, TReturn, TNext>(generator: AsyncGenerator<T, TReturn, TNext>): Promise<TReturn>;
|
|
3
|
-
//# sourceMappingURL=generators.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generators.d.ts","sourceRoot":"","sources":["../../source/utils/generators.ts"],"names":[],"mappings":"AASA,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAChD,SAAS,EAAE,SAAS,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,GACtC,OAAO,CAAC;AAGX,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAChD,SAAS,EAAE,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,GAC3C,OAAO,CAAC,OAAO,CAAC,CAAC"}
|
package/dist/utils/generators.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
function isPromiseLike(value) {
|
|
2
|
-
return (typeof value === "object" &&
|
|
3
|
-
value !== null &&
|
|
4
|
-
typeof value.then === "function");
|
|
5
|
-
}
|
|
6
|
-
// biome-ignore lint/style/useNamingConvention: temp
|
|
7
|
-
export function exhaustGenerator(generator) {
|
|
8
|
-
const firstResult = generator.next();
|
|
9
|
-
if (isPromiseLike(firstResult)) {
|
|
10
|
-
const asyncGenerator = generator;
|
|
11
|
-
return (async () => {
|
|
12
|
-
let result = await firstResult;
|
|
13
|
-
while (!result.done) {
|
|
14
|
-
result = await asyncGenerator.next();
|
|
15
|
-
}
|
|
16
|
-
return result.value;
|
|
17
|
-
})();
|
|
18
|
-
}
|
|
19
|
-
const syncGenerator = generator;
|
|
20
|
-
let result = firstResult;
|
|
21
|
-
while (!result.done) {
|
|
22
|
-
result = syncGenerator.next();
|
|
23
|
-
}
|
|
24
|
-
return result.value;
|
|
25
|
-
}
|
package/dist/utils/glob.d.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { type Options as FastGlobOptions } from "fast-glob";
|
|
2
|
-
type ExpandDirectoriesOption = boolean | readonly string[] | {
|
|
3
|
-
files?: readonly string[];
|
|
4
|
-
extensions?: readonly string[];
|
|
5
|
-
};
|
|
6
|
-
type FastGlobOptionsWithoutCwd = Omit<FastGlobOptions, "cwd">;
|
|
7
|
-
export type Options = {
|
|
8
|
-
/**
|
|
9
|
-
* If set to `true`, `glob` will automatically glob directories for you. If you define an `Array` it will only glob files that matches the patterns inside the `Array`. You can also define an `Object` with `files` and `extensions` like in the example below.
|
|
10
|
-
*
|
|
11
|
-
* Note that if you set this option to `false`, you won't get back matched directories unless you set `onlyFiles: false`.
|
|
12
|
-
*
|
|
13
|
-
* @default true
|
|
14
|
-
*/
|
|
15
|
-
readonly expandDirectories?: ExpandDirectoriesOption;
|
|
16
|
-
/**
|
|
17
|
-
* Respect ignore patterns in `.gitignore` files that apply to the globbed files.
|
|
18
|
-
*
|
|
19
|
-
* Performance note: This option searches for all `.gitignore` files in the entire directory tree before globbing, which can be slow. For better performance, use `ignoreFiles: '.gitignore'` to only respect the root `.gitignore` file.
|
|
20
|
-
*
|
|
21
|
-
* @default false
|
|
22
|
-
*/
|
|
23
|
-
readonly gitignore?: boolean;
|
|
24
|
-
/**
|
|
25
|
-
* Glob patterns to look for ignore files, which are then used to ignore globbed files.
|
|
26
|
-
*
|
|
27
|
-
* This is a more generic form of the `gitignore` option, allowing you to find ignore files with a [compatible syntax](http://git-scm.com/docs/gitignore). For instance, this works with Babel's `.babelignore`, Prettier's `.prettierignore`, or ESLint's `.eslintignore` files.
|
|
28
|
-
*
|
|
29
|
-
* Performance tip: Using a specific path like `'.gitignore'` is much faster than recursive patterns.
|
|
30
|
-
*
|
|
31
|
-
* @default undefined
|
|
32
|
-
*/
|
|
33
|
-
readonly ignoreFiles?: string | readonly string[];
|
|
34
|
-
/**
|
|
35
|
-
* The current working directory in which to search.
|
|
36
|
-
*
|
|
37
|
-
* @default process.cwd()
|
|
38
|
-
*/
|
|
39
|
-
readonly cwd?: URL | string;
|
|
40
|
-
} & FastGlobOptionsWithoutCwd;
|
|
41
|
-
/**
|
|
42
|
-
* Find files and directories using glob patterns.
|
|
43
|
-
*
|
|
44
|
-
* Note that glob patterns can only contain forward-slashes, not backward-slashes, so if you want to construct a glob pattern from path components, you need to use `path.posix.join()` instead of `path.join()`.
|
|
45
|
-
*
|
|
46
|
-
* @param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).
|
|
47
|
-
* @param options - See the [`fast-glob` options](https://github.com/mrmlnc/fast-glob#options-3) in addition to the ones in this package.
|
|
48
|
-
* @returns The matching paths.
|
|
49
|
-
*/
|
|
50
|
-
export declare const glob: (patterns: string | string[] | readonly string[], options?: Options) => Promise<string[]>;
|
|
51
|
-
export {};
|
|
52
|
-
//# sourceMappingURL=glob.d.ts.map
|
package/dist/utils/glob.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../source/utils/glob.ts"],"names":[],"mappings":"AAIA,OAAW,EAAc,KAAK,OAAO,IAAI,eAAe,EAAE,MAAM,WAAW,CAAC;AAgB5E,KAAK,uBAAuB,GACxB,OAAO,GACP,SAAS,MAAM,EAAE,GACjB;IAAE,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC;AAElE,KAAK,yBAAyB,GAAG,IAAI,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;AAE9D,MAAM,MAAM,OAAO,GAAG;IACpB;;;;;;OAMG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,uBAAuB,CAAC;IAErD;;;;;;OAMG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAE7B;;;;;;;;OAQG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC;IAElD;;;;OAIG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,MAAM,CAAC;CAC7B,GAAG,yBAAyB,CAAC;AA6U9B;;;;;;;;GAQG;AACH,eAAO,MAAM,IAAI,8DAtLa,OAAO,sBAoMpC,CAAC"}
|