@orchid-labs/pluxx 0.1.23 → 0.1.25
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/dist/cli/index.js
CHANGED
|
@@ -24527,7 +24527,7 @@ function buildHookCommandWrapperScript(command2, pluginRootVar, envFileVar) {
|
|
|
24527
24527
|
const serializedEnvFileVar = JSON.stringify(envFileVar ?? null);
|
|
24528
24528
|
return [
|
|
24529
24529
|
"#!/usr/bin/env node",
|
|
24530
|
-
'import { appendFileSync, existsSync, readFileSync } from "node:fs"',
|
|
24530
|
+
'import { appendFileSync, existsSync, readFileSync, statSync } from "node:fs"',
|
|
24531
24531
|
'import { dirname, resolve } from "node:path"',
|
|
24532
24532
|
'import { fileURLToPath } from "node:url"',
|
|
24533
24533
|
'import { spawnSync } from "node:child_process"',
|
|
@@ -24543,6 +24543,17 @@ function buildHookCommandWrapperScript(command2, pluginRootVar, envFileVar) {
|
|
|
24543
24543
|
"process.env.PLUGIN_ROOT = pluginRoot",
|
|
24544
24544
|
"process.env.PLUXX_PLUGIN_ROOT = pluginRoot",
|
|
24545
24545
|
"",
|
|
24546
|
+
"function readHookPayload() {",
|
|
24547
|
+
" if (process.stdin.isTTY) return null",
|
|
24548
|
+
" try {",
|
|
24549
|
+
' return readFileSync(0, "utf8")',
|
|
24550
|
+
" } catch {",
|
|
24551
|
+
" return null",
|
|
24552
|
+
" }",
|
|
24553
|
+
"}",
|
|
24554
|
+
"",
|
|
24555
|
+
"const hookPayload = readHookPayload()",
|
|
24556
|
+
"",
|
|
24546
24557
|
'const userConfigPath = resolve(pluginRoot, ".pluxx-user.json")',
|
|
24547
24558
|
"if (existsSync(userConfigPath)) {",
|
|
24548
24559
|
' const payload = JSON.parse(readFileSync(userConfigPath, "utf8"))',
|
|
@@ -24572,6 +24583,77 @@ function buildHookCommandWrapperScript(command2, pluginRootVar, envFileVar) {
|
|
|
24572
24583
|
" }",
|
|
24573
24584
|
"}",
|
|
24574
24585
|
"",
|
|
24586
|
+
"function directoryOrNull(value) {",
|
|
24587
|
+
' if (typeof value !== "string" || value.trim() === "") return null',
|
|
24588
|
+
" try {",
|
|
24589
|
+
" const resolved = resolve(value)",
|
|
24590
|
+
" if (resolved === pluginRoot) return null",
|
|
24591
|
+
" if (!existsSync(resolved) || !statSync(resolved).isDirectory()) return null",
|
|
24592
|
+
" return resolved",
|
|
24593
|
+
" } catch {",
|
|
24594
|
+
" return null",
|
|
24595
|
+
" }",
|
|
24596
|
+
"}",
|
|
24597
|
+
"",
|
|
24598
|
+
"function workspaceFromPayload(payload) {",
|
|
24599
|
+
" if (!payload) return null",
|
|
24600
|
+
" let data",
|
|
24601
|
+
" try {",
|
|
24602
|
+
" data = JSON.parse(payload)",
|
|
24603
|
+
" } catch {",
|
|
24604
|
+
" return null",
|
|
24605
|
+
" }",
|
|
24606
|
+
" const values = [",
|
|
24607
|
+
" data.cwd,",
|
|
24608
|
+
" data.workdir,",
|
|
24609
|
+
" data.workspace,",
|
|
24610
|
+
" data.workspaceRoot,",
|
|
24611
|
+
" data.projectRoot,",
|
|
24612
|
+
" data.project_dir,",
|
|
24613
|
+
" data.project && data.project.cwd,",
|
|
24614
|
+
" data.project && data.project.root,",
|
|
24615
|
+
" data.tool_input && data.tool_input.cwd,",
|
|
24616
|
+
" data.tool_input && data.tool_input.workdir,",
|
|
24617
|
+
" ]",
|
|
24618
|
+
" for (const value of values) {",
|
|
24619
|
+
" const directory = directoryOrNull(value)",
|
|
24620
|
+
" if (directory) return directory",
|
|
24621
|
+
" }",
|
|
24622
|
+
" return null",
|
|
24623
|
+
"}",
|
|
24624
|
+
"",
|
|
24625
|
+
"function configureWorkspaceRoot() {",
|
|
24626
|
+
" const explicit = directoryOrNull(process.env.PLUXX_HOOK_WORKSPACE_ROOT)",
|
|
24627
|
+
" if (explicit) {",
|
|
24628
|
+
" process.env.PLUXX_HOOK_WORKSPACE_ROOT = explicit",
|
|
24629
|
+
" return",
|
|
24630
|
+
" }",
|
|
24631
|
+
"",
|
|
24632
|
+
" const envCandidates = [",
|
|
24633
|
+
" process.env.CODEX_WORKSPACE_ROOT,",
|
|
24634
|
+
" process.env.CODEX_WORKDIR,",
|
|
24635
|
+
" process.env.CODEX_CWD,",
|
|
24636
|
+
" process.env.CLAUDE_PROJECT_DIR,",
|
|
24637
|
+
" process.env.CLAUDE_CWD,",
|
|
24638
|
+
" process.env.CURSOR_WORKSPACE_ROOT,",
|
|
24639
|
+
" process.env.OPENCODE_WORKSPACE_ROOT,",
|
|
24640
|
+
" process.env.WORKSPACE_ROOT,",
|
|
24641
|
+
" process.env.PROJECT_ROOT,",
|
|
24642
|
+
" ]",
|
|
24643
|
+
" for (const value of envCandidates) {",
|
|
24644
|
+
" const directory = directoryOrNull(value)",
|
|
24645
|
+
" if (directory) {",
|
|
24646
|
+
" process.env.PLUXX_HOOK_WORKSPACE_ROOT = directory",
|
|
24647
|
+
" return",
|
|
24648
|
+
" }",
|
|
24649
|
+
" }",
|
|
24650
|
+
"",
|
|
24651
|
+
" const payloadWorkspace = workspaceFromPayload(hookPayload)",
|
|
24652
|
+
" if (payloadWorkspace) process.env.PLUXX_HOOK_WORKSPACE_ROOT = payloadWorkspace",
|
|
24653
|
+
"}",
|
|
24654
|
+
"",
|
|
24655
|
+
"configureWorkspaceRoot()",
|
|
24656
|
+
"",
|
|
24575
24657
|
"function canRun(command) {",
|
|
24576
24658
|
' const result = spawnSync(command, ["--version"], { stdio: "ignore" })',
|
|
24577
24659
|
" return !result.error && result.status === 0",
|
|
@@ -24604,11 +24686,19 @@ function buildHookCommandWrapperScript(command2, pluginRootVar, envFileVar) {
|
|
|
24604
24686
|
" process.exit(127)",
|
|
24605
24687
|
"}",
|
|
24606
24688
|
"",
|
|
24607
|
-
|
|
24689
|
+
"const spawnOptions = {",
|
|
24608
24690
|
" cwd: pluginRoot,",
|
|
24609
24691
|
" env: process.env,",
|
|
24610
|
-
|
|
24611
|
-
"
|
|
24692
|
+
"}",
|
|
24693
|
+
"",
|
|
24694
|
+
"if (hookPayload === null) {",
|
|
24695
|
+
' spawnOptions.stdio = "inherit"',
|
|
24696
|
+
"} else {",
|
|
24697
|
+
' spawnOptions.stdio = ["pipe", "inherit", "inherit"]',
|
|
24698
|
+
" spawnOptions.input = hookPayload",
|
|
24699
|
+
"}",
|
|
24700
|
+
"",
|
|
24701
|
+
'const result = spawnSync(bash, ["-lc", COMMAND], spawnOptions)',
|
|
24612
24702
|
"",
|
|
24613
24703
|
"if (result.error) {",
|
|
24614
24704
|
" console.error(`[pluxx] Failed to run generated hook command with ${bash}: ${result.error.message}`)",
|
|
@@ -28461,10 +28551,7 @@ var CodexGenerator = class extends Generator {
|
|
|
28461
28551
|
];
|
|
28462
28552
|
}
|
|
28463
28553
|
if (Object.keys(hooks).length === 0 && unsupported.length === 0) return;
|
|
28464
|
-
await this.writeJson("hooks/hooks.json", {
|
|
28465
|
-
version: 1,
|
|
28466
|
-
hooks
|
|
28467
|
-
});
|
|
28554
|
+
await this.writeJson("hooks/hooks.json", { hooks });
|
|
28468
28555
|
await this.writeJson(".codex/hooks.generated.json", {
|
|
28469
28556
|
model: "pluxx.codex-hooks.v1",
|
|
28470
28557
|
enforcedByPluginBundle: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/generators/codex/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAgDlD,qBAAa,cAAe,SAAQ,SAAS;IAC3C,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAU;IAErC,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;YA0DjB,gBAAgB;YAoEhB,iBAAiB;YAOjB,4BAA4B;YAyB5B,gBAAgB;YAiBhB,oBAAoB;YAuDpB,sBAAsB;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/generators/codex/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAgDlD,qBAAa,cAAe,SAAQ,SAAS;IAC3C,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAU;IAErC,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;YA0DjB,gBAAgB;YAoEhB,iBAAiB;YAOjB,4BAA4B;YAyB5B,gBAAgB;YAiBhB,oBAAoB;YAuDpB,sBAAsB;YAmGtB,0BAA0B;IAkCxC,OAAO,CAAC,0BAA0B;YAkBpB,yBAAyB;YAiCzB,uBAAuB;IAqCrC,OAAO,CAAC,+BAA+B;CAiBxC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hook-command-env.d.ts","sourceRoot":"","sources":["../src/hook-command-env.ts"],"names":[],"mappings":"AAEA,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAMxE;AAED,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"hook-command-env.d.ts","sourceRoot":"","sources":["../src/hook-command-env.ts"],"names":[],"mappings":"AAEA,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAMxE;AAED,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAgMjH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orchid-labs/pluxx",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.25",
|
|
4
4
|
"description": "Build AI agent plugins once. Prime-time on Claude Code, Cursor, Codex, and OpenCode, with beta generators for additional hosts.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|