@digipair/skill-codex 0.99.0 → 0.99.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/index.cjs.js +18 -28
- package/index.esm.js +13 -23
- package/package.json +4 -2
- package/schema.fr.json +14 -1
- package/schema.json +9 -0
package/index.cjs.js
CHANGED
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var child_process = require('child_process');
|
|
6
6
|
var fs = require('fs');
|
|
7
|
-
var path = require('path');
|
|
8
7
|
|
|
9
8
|
function _interopNamespace(e) {
|
|
10
9
|
if (e && e.__esModule) return e;
|
|
@@ -23925,14 +23924,14 @@ function indent(str, spaces) {
|
|
|
23925
23924
|
var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
|
|
23926
23925
|
// match is required
|
|
23927
23926
|
if (!match) {
|
|
23928
|
-
return
|
|
23927
|
+
return nextMatch = nextMatch1, i = i1, tokens = tokens1, {
|
|
23929
23928
|
v: nextMatch1
|
|
23930
23929
|
};
|
|
23931
23930
|
}
|
|
23932
23931
|
var token = match.token, offset = match.offset;
|
|
23933
23932
|
i1 += offset;
|
|
23934
23933
|
if (token === " ") {
|
|
23935
|
-
return
|
|
23934
|
+
return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
|
|
23936
23935
|
}
|
|
23937
23936
|
tokens1 = _to_consumable_array$1(tokens1).concat([
|
|
23938
23937
|
token
|
|
@@ -23951,7 +23950,7 @@ function indent(str, spaces) {
|
|
|
23951
23950
|
if (contextKeys.some(function(el) {
|
|
23952
23951
|
return el.startsWith(name);
|
|
23953
23952
|
})) {
|
|
23954
|
-
return
|
|
23953
|
+
return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
|
|
23955
23954
|
}
|
|
23956
23955
|
if (dateTimeIdentifiers.some(function(el) {
|
|
23957
23956
|
return el === name;
|
|
@@ -23970,9 +23969,9 @@ function indent(str, spaces) {
|
|
|
23970
23969
|
if (dateTimeIdentifiers.some(function(el) {
|
|
23971
23970
|
return el.startsWith(name);
|
|
23972
23971
|
})) {
|
|
23973
|
-
return
|
|
23972
|
+
return nextMatch = nextMatch1, i = i1, tokens = tokens1, "continue";
|
|
23974
23973
|
}
|
|
23975
|
-
return
|
|
23974
|
+
return nextMatch = nextMatch1, i = i1, tokens = tokens1, {
|
|
23976
23975
|
v: nextMatch1
|
|
23977
23976
|
};
|
|
23978
23977
|
};
|
|
@@ -28008,31 +28007,15 @@ const preparePinsSettings = (settings, context)=>{
|
|
|
28008
28007
|
|
|
28009
28008
|
let CodexService = class CodexService {
|
|
28010
28009
|
/**
|
|
28011
|
-
* Find the local Codex CLI entrypoint installed in this repo.
|
|
28012
|
-
* Searches upwards from the current working directory for
|
|
28013
|
-
* `node_modules/@openai/codex/bin/codex.js`.
|
|
28014
|
-
*/ findCodexBin(startDir) {
|
|
28015
|
-
let dir = startDir;
|
|
28016
|
-
for(let i = 0; i < 6; i++){
|
|
28017
|
-
const candidate = path.join(dir, 'node_modules', '@openai', 'codex', 'bin', 'codex.js');
|
|
28018
|
-
if (fs.existsSync(candidate)) return candidate;
|
|
28019
|
-
const parent = path.dirname(dir);
|
|
28020
|
-
if (parent === dir) break;
|
|
28021
|
-
dir = parent;
|
|
28022
|
-
}
|
|
28023
|
-
// Fallback to a reasonable default relative to repo root
|
|
28024
|
-
return path.join(process.cwd(), '..', '..', 'node_modules', '@openai', 'codex', 'bin', 'codex.js');
|
|
28025
|
-
}
|
|
28026
|
-
/**
|
|
28027
28010
|
* Runs the local Codex CLI with the provided prompt and returns its stdout as a string.
|
|
28028
28011
|
* Requires either ChatGPT sign-in (codex login) or OPENAI_API_KEY in the environment.
|
|
28029
28012
|
*/ async runPrompt(params, _pinsSettingsList, context) {
|
|
28030
28013
|
var _child_stdout, _child_stderr;
|
|
28031
|
-
const { prompt, sandbox = 'read-only', cwd = process.cwd() + '/factory/digipairs', timeoutMs, onStdout = [], onAction = [] } = params;
|
|
28014
|
+
const { prompt, sandbox = 'read-only', cwd = process.cwd() + '/factory/digipairs', timeoutMs, onStdout = [], onAction = [], debug = false } = params;
|
|
28032
28015
|
if (!prompt || !prompt.trim()) {
|
|
28033
28016
|
throw new Error('Prompt must be a non-empty string');
|
|
28034
28017
|
}
|
|
28035
|
-
const codexJs =
|
|
28018
|
+
const codexJs = require.resolve('@openai/codex/bin/codex.js');
|
|
28036
28019
|
if (!fs.existsSync(codexJs)) {
|
|
28037
28020
|
throw new Error(`Codex CLI not found. Ensure @openai/codex is installed. Looked for: ${codexJs}`);
|
|
28038
28021
|
}
|
|
@@ -28044,6 +28027,8 @@ let CodexService = class CodexService {
|
|
|
28044
28027
|
args.push('exec');
|
|
28045
28028
|
// codex exec expects: codex exec --sandbox <mode> [PROMPT]
|
|
28046
28029
|
args.push('--sandbox', sandbox);
|
|
28030
|
+
// skip git repo check
|
|
28031
|
+
args.push('--skip-git-repo-check');
|
|
28047
28032
|
args.push(prompt);
|
|
28048
28033
|
const child = child_process.spawn(process.execPath, args, {
|
|
28049
28034
|
cwd,
|
|
@@ -28063,13 +28048,18 @@ let CodexService = class CodexService {
|
|
|
28063
28048
|
const onData = (chunk)=>{
|
|
28064
28049
|
const s = chunk.toString();
|
|
28065
28050
|
stdout += s;
|
|
28066
|
-
if (
|
|
28067
|
-
|
|
28068
|
-
}
|
|
28051
|
+
if (debug) {
|
|
28052
|
+
process.stdout.write(s);
|
|
28053
|
+
}
|
|
28054
|
+
if (onStdout) {
|
|
28055
|
+
executePinsList(onStdout, _extends({
|
|
28056
|
+
chunk: s
|
|
28057
|
+
}, context), `${context.__PATH__}.onStdout`);
|
|
28058
|
+
}
|
|
28069
28059
|
if (regexNewLine.test(s)) {
|
|
28070
28060
|
if (listening && !line.startsWith('{')) executePinsList(onAction, _extends({
|
|
28071
28061
|
action: line.trim()
|
|
28072
|
-
}, context));
|
|
28062
|
+
}, context), `${context.__PATH__}.onAction`);
|
|
28073
28063
|
listening = false;
|
|
28074
28064
|
}
|
|
28075
28065
|
if (regexCodex.test(s)) {
|
package/index.esm.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { spawn } from 'child_process';
|
|
2
2
|
import { existsSync } from 'fs';
|
|
3
|
-
import { join, dirname } from 'path';
|
|
4
3
|
|
|
5
4
|
function _extends() {
|
|
6
5
|
_extends = Object.assign || function assign(target) {
|
|
@@ -27986,31 +27985,15 @@ const preparePinsSettings = (settings, context)=>{
|
|
|
27986
27985
|
|
|
27987
27986
|
let CodexService = class CodexService {
|
|
27988
27987
|
/**
|
|
27989
|
-
* Find the local Codex CLI entrypoint installed in this repo.
|
|
27990
|
-
* Searches upwards from the current working directory for
|
|
27991
|
-
* `node_modules/@openai/codex/bin/codex.js`.
|
|
27992
|
-
*/ findCodexBin(startDir) {
|
|
27993
|
-
let dir = startDir;
|
|
27994
|
-
for(let i = 0; i < 6; i++){
|
|
27995
|
-
const candidate = join(dir, 'node_modules', '@openai', 'codex', 'bin', 'codex.js');
|
|
27996
|
-
if (existsSync(candidate)) return candidate;
|
|
27997
|
-
const parent = dirname(dir);
|
|
27998
|
-
if (parent === dir) break;
|
|
27999
|
-
dir = parent;
|
|
28000
|
-
}
|
|
28001
|
-
// Fallback to a reasonable default relative to repo root
|
|
28002
|
-
return join(process.cwd(), '..', '..', 'node_modules', '@openai', 'codex', 'bin', 'codex.js');
|
|
28003
|
-
}
|
|
28004
|
-
/**
|
|
28005
27988
|
* Runs the local Codex CLI with the provided prompt and returns its stdout as a string.
|
|
28006
27989
|
* Requires either ChatGPT sign-in (codex login) or OPENAI_API_KEY in the environment.
|
|
28007
27990
|
*/ async runPrompt(params, _pinsSettingsList, context) {
|
|
28008
27991
|
var _child_stdout, _child_stderr;
|
|
28009
|
-
const { prompt, sandbox = 'read-only', cwd = process.cwd() + '/factory/digipairs', timeoutMs, onStdout = [], onAction = [] } = params;
|
|
27992
|
+
const { prompt, sandbox = 'read-only', cwd = process.cwd() + '/factory/digipairs', timeoutMs, onStdout = [], onAction = [], debug = false } = params;
|
|
28010
27993
|
if (!prompt || !prompt.trim()) {
|
|
28011
27994
|
throw new Error('Prompt must be a non-empty string');
|
|
28012
27995
|
}
|
|
28013
|
-
const codexJs =
|
|
27996
|
+
const codexJs = require.resolve('@openai/codex/bin/codex.js');
|
|
28014
27997
|
if (!existsSync(codexJs)) {
|
|
28015
27998
|
throw new Error(`Codex CLI not found. Ensure @openai/codex is installed. Looked for: ${codexJs}`);
|
|
28016
27999
|
}
|
|
@@ -28022,6 +28005,8 @@ let CodexService = class CodexService {
|
|
|
28022
28005
|
args.push('exec');
|
|
28023
28006
|
// codex exec expects: codex exec --sandbox <mode> [PROMPT]
|
|
28024
28007
|
args.push('--sandbox', sandbox);
|
|
28008
|
+
// skip git repo check
|
|
28009
|
+
args.push('--skip-git-repo-check');
|
|
28025
28010
|
args.push(prompt);
|
|
28026
28011
|
const child = spawn(process.execPath, args, {
|
|
28027
28012
|
cwd,
|
|
@@ -28041,13 +28026,18 @@ let CodexService = class CodexService {
|
|
|
28041
28026
|
const onData = (chunk)=>{
|
|
28042
28027
|
const s = chunk.toString();
|
|
28043
28028
|
stdout += s;
|
|
28044
|
-
if (
|
|
28045
|
-
|
|
28046
|
-
}
|
|
28029
|
+
if (debug) {
|
|
28030
|
+
process.stdout.write(s);
|
|
28031
|
+
}
|
|
28032
|
+
if (onStdout) {
|
|
28033
|
+
executePinsList(onStdout, _extends({
|
|
28034
|
+
chunk: s
|
|
28035
|
+
}, context), `${context.__PATH__}.onStdout`);
|
|
28036
|
+
}
|
|
28047
28037
|
if (regexNewLine.test(s)) {
|
|
28048
28038
|
if (listening && !line.startsWith('{')) executePinsList(onAction, _extends({
|
|
28049
28039
|
action: line.trim()
|
|
28050
|
-
}, context));
|
|
28040
|
+
}, context), `${context.__PATH__}.onAction`);
|
|
28051
28041
|
listening = false;
|
|
28052
28042
|
}
|
|
28053
28043
|
if (regexCodex.test(s)) {
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digipair/skill-codex",
|
|
3
|
-
"version": "0.99.
|
|
3
|
+
"version": "0.99.2",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"digipair",
|
|
6
6
|
"service",
|
|
7
7
|
"util"
|
|
8
8
|
],
|
|
9
|
-
"dependencies": {
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@openai/codex": "^0.25.0"
|
|
11
|
+
},
|
|
10
12
|
"main": "./index.cjs.js",
|
|
11
13
|
"module": "./index.esm.js"
|
|
12
14
|
}
|
package/schema.fr.json
CHANGED
|
@@ -32,7 +32,11 @@
|
|
|
32
32
|
"description": "Mode sandbox pour l'exécution de Codex (par défaut 'read-only')",
|
|
33
33
|
"schema": {
|
|
34
34
|
"type": "string",
|
|
35
|
-
"enum": [
|
|
35
|
+
"enum": [
|
|
36
|
+
"read-only",
|
|
37
|
+
"workspace-write",
|
|
38
|
+
"danger-full-access"
|
|
39
|
+
]
|
|
36
40
|
}
|
|
37
41
|
},
|
|
38
42
|
{
|
|
@@ -53,6 +57,15 @@
|
|
|
53
57
|
"type": "number"
|
|
54
58
|
}
|
|
55
59
|
},
|
|
60
|
+
{
|
|
61
|
+
"name": "debug",
|
|
62
|
+
"summary": "Mode débogage",
|
|
63
|
+
"required": false,
|
|
64
|
+
"description": "Active le mode débogage",
|
|
65
|
+
"schema": {
|
|
66
|
+
"type": "boolean"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
56
69
|
{
|
|
57
70
|
"name": "onStdout",
|
|
58
71
|
"summary": "Callback stdout",
|
package/schema.json
CHANGED
|
@@ -57,6 +57,15 @@
|
|
|
57
57
|
"type": "number"
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
|
+
{
|
|
61
|
+
"name": "debug",
|
|
62
|
+
"summary": "Debug mode",
|
|
63
|
+
"required": false,
|
|
64
|
+
"description": "Enables debug mode",
|
|
65
|
+
"schema": {
|
|
66
|
+
"type": "boolean"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
60
69
|
{
|
|
61
70
|
"name": "onStdout",
|
|
62
71
|
"summary": "On stdout",
|