opencode-janus 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/README.md +145 -0
- package/dist/cli.d.ts +4 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +185 -0
- package/dist/config.d.ts +5 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/exec.d.ts +4 -0
- package/dist/exec.d.ts.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4143 -0
- package/dist/install.d.ts +25 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/resolver.d.ts +14 -0
- package/dist/resolver.d.ts.map +1 -0
- package/dist/shell-hook.d.ts +13 -0
- package/dist/shell-hook.d.ts.map +1 -0
- package/dist/test-command.d.ts +9 -0
- package/dist/test-command.d.ts.map +1 -0
- package/dist/types.d.ts +36 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +56 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detect which shell RC file to use
|
|
3
|
+
* Priority: .zshrc > .bashrc
|
|
4
|
+
* If neither exists, return path for .zshrc (default)
|
|
5
|
+
*/
|
|
6
|
+
export declare function detectShellRcFile(): string;
|
|
7
|
+
/**
|
|
8
|
+
* Infer shell type from RC file name
|
|
9
|
+
*/
|
|
10
|
+
export declare function getShellTypeFromRcFile(rcFile: string): 'zsh' | 'bash';
|
|
11
|
+
/**
|
|
12
|
+
* Check if hook is already installed in the RC file
|
|
13
|
+
*/
|
|
14
|
+
export declare function isHookInstalled(rcFilePath: string): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Install shell hook to the RC file
|
|
17
|
+
* @throws If hook is already installed
|
|
18
|
+
*/
|
|
19
|
+
export declare function installHook(rcFilePath: string, shellType: 'zsh' | 'bash'): void;
|
|
20
|
+
/**
|
|
21
|
+
* Uninstall shell hook from the RC file
|
|
22
|
+
* @throws If RC file doesn't exist or hook is not installed
|
|
23
|
+
*/
|
|
24
|
+
export declare function uninstallHook(rcFilePath: string): void;
|
|
25
|
+
//# sourceMappingURL=install.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAe1C;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,CAErE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAO3D;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,CAwB/E;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAmBtD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Mapping } from './types';
|
|
2
|
+
export declare function matchesPattern(path: string, pattern: string): boolean;
|
|
3
|
+
export declare function findLongestMatch(path: string, candidates: Array<{
|
|
4
|
+
pattern: string;
|
|
5
|
+
configDir: string;
|
|
6
|
+
}>): {
|
|
7
|
+
configDir: string;
|
|
8
|
+
matchedPattern: string;
|
|
9
|
+
} | null;
|
|
10
|
+
export declare function resolvePath(path: string, mappings: Mapping[]): {
|
|
11
|
+
configDir: string;
|
|
12
|
+
matchedPattern: string;
|
|
13
|
+
} | null;
|
|
14
|
+
//# sourceMappingURL=resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../src/resolver.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CA8BrE;AAuBD,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,KAAK,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,GACxD;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAEtD;AAED,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,OAAO,EAAE,GAClB;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CA6BtD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate shell hook script for the specified shell
|
|
3
|
+
* @param shell - The shell type ('zsh' or 'bash')
|
|
4
|
+
* @returns The shell hook script content
|
|
5
|
+
*/
|
|
6
|
+
export declare function generateShellHook(shell: 'zsh' | 'bash'): string;
|
|
7
|
+
/**
|
|
8
|
+
* Get warning message if user already has opencode alias
|
|
9
|
+
* @param shell - The shell type ('zsh' or 'bash')
|
|
10
|
+
* @returns Warning message about alias conflict
|
|
11
|
+
*/
|
|
12
|
+
export declare function getAliasWarning(shell: 'zsh' | 'bash'): string;
|
|
13
|
+
//# sourceMappingURL=shell-hook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell-hook.d.ts","sourceRoot":"","sources":["../src/shell-hook.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,CAI/D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,CAE7D"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Mapping } from './types';
|
|
2
|
+
export declare function testPath(path: string, mappings: Mapping[]): {
|
|
3
|
+
matched: boolean;
|
|
4
|
+
configDir?: string;
|
|
5
|
+
matchedPattern?: string;
|
|
6
|
+
message: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function formatTestResult(result: ReturnType<typeof testPath>): string;
|
|
9
|
+
//# sourceMappingURL=test-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-command.d.ts","sourceRoot":"","sources":["../src/test-command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,wBAAgB,QAAQ,CACtB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,OAAO,EAAE,GAClB;IACD,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;CACjB,CAkBA;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,QAAQ,CAAC,GAAG,MAAM,CAS5E"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const MappingSchema: z.ZodObject<{
|
|
3
|
+
match: z.ZodArray<z.ZodString, "many">;
|
|
4
|
+
configDir: z.ZodString;
|
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
match: string[];
|
|
7
|
+
configDir: string;
|
|
8
|
+
}, {
|
|
9
|
+
match: string[];
|
|
10
|
+
configDir: string;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const ConfigSchema: z.ZodObject<{
|
|
13
|
+
mappings: z.ZodArray<z.ZodObject<{
|
|
14
|
+
match: z.ZodArray<z.ZodString, "many">;
|
|
15
|
+
configDir: z.ZodString;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
match: string[];
|
|
18
|
+
configDir: string;
|
|
19
|
+
}, {
|
|
20
|
+
match: string[];
|
|
21
|
+
configDir: string;
|
|
22
|
+
}>, "many">;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
mappings: {
|
|
25
|
+
match: string[];
|
|
26
|
+
configDir: string;
|
|
27
|
+
}[];
|
|
28
|
+
}, {
|
|
29
|
+
mappings: {
|
|
30
|
+
match: string[];
|
|
31
|
+
configDir: string;
|
|
32
|
+
}[];
|
|
33
|
+
}>;
|
|
34
|
+
export type Config = z.infer<typeof ConfigSchema>;
|
|
35
|
+
export type Mapping = z.infer<typeof MappingSchema>;
|
|
36
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,aAAa;;;;;;;;;EAGxB,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;EAEvB,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAClD,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "opencode-janus",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Directory-based OpenCode configuration switching tool. Automatically switch between different OpenCode configurations based on your current working directory.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"janus": "./dist/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"import": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"opencode",
|
|
21
|
+
"configuration",
|
|
22
|
+
"directory-based",
|
|
23
|
+
"environment",
|
|
24
|
+
"cli"
|
|
25
|
+
],
|
|
26
|
+
"author": "kuitos",
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "https://github.com/kuitos/opencode-env.git"
|
|
31
|
+
},
|
|
32
|
+
"bugs": {
|
|
33
|
+
"url": "https://github.com/kuitos/opencode-env/issues"
|
|
34
|
+
},
|
|
35
|
+
"homepage": "https://github.com/kuitos/opencode-env#readme",
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=18.0.0"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"zod": "^3.23.8"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/bun": "^1.3.8"
|
|
44
|
+
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"typecheck": "tsc --noEmit",
|
|
47
|
+
"build": "bun run compile-tsc && bun run compile-bun && bun run make-executable",
|
|
48
|
+
"compile-tsc": "tsc --emitDeclarationOnly --outDir dist",
|
|
49
|
+
"compile-bun": "bun build src/cli.ts src/index.ts --target=node --format=esm --outdir=dist --external:zod",
|
|
50
|
+
"make-executable": "chmod +x dist/cli.js",
|
|
51
|
+
"test": "bun test",
|
|
52
|
+
"test:coverage": "bun test --coverage",
|
|
53
|
+
"prepublishOnly": "bun run test && bun run build && bun run typecheck",
|
|
54
|
+
"prepack": "bun run build"
|
|
55
|
+
}
|
|
56
|
+
}
|