@steipete/oracle 1.0.2 → 1.0.5
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 -0
- package/dist/src/oracle/run.js +16 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,6 +32,9 @@ npx -y @steipete/oracle --engine browser -p "Summarize the risk register" --file
|
|
|
32
32
|
# Globs/exclusions
|
|
33
33
|
npx -y @steipete/oracle -p "Review the TS data layer" --file "src/**/*.ts" --file "!src/**/*.test.ts"
|
|
34
34
|
|
|
35
|
+
# Mixed glob + single file
|
|
36
|
+
npx -y @steipete/oracle -p "Audit data layer" --file "src/**/*.ts" --file README.md
|
|
37
|
+
|
|
35
38
|
# Inspect past sessions
|
|
36
39
|
oracle status --clear --hours 168 # prune a week of cached runs
|
|
37
40
|
oracle status # list runs; grab an ID
|
package/dist/src/oracle/run.js
CHANGED
|
@@ -26,6 +26,15 @@ const defaultWait = (ms) => new Promise((resolve) => {
|
|
|
26
26
|
});
|
|
27
27
|
export async function runOracle(options, deps = {}) {
|
|
28
28
|
const { apiKey = options.apiKey ?? process.env.OPENAI_API_KEY, cwd = process.cwd(), fs: fsModule = createFsAdapter(fs), log = console.log, write = (text) => process.stdout.write(text), now = () => performance.now(), clientFactory = createDefaultClientFactory(), client, wait = defaultWait, } = deps;
|
|
29
|
+
const maskApiKey = (key) => {
|
|
30
|
+
if (!key)
|
|
31
|
+
return null;
|
|
32
|
+
if (key.length <= 8)
|
|
33
|
+
return `${key[0] ?? ''}***${key[key.length - 1] ?? ''}`;
|
|
34
|
+
const prefix = key.slice(0, 4);
|
|
35
|
+
const suffix = key.slice(-4);
|
|
36
|
+
return `${prefix}****${suffix}`;
|
|
37
|
+
};
|
|
29
38
|
const logVerbose = (message) => {
|
|
30
39
|
if (options.verbose) {
|
|
31
40
|
log(dim(`[verbose] ${message}`));
|
|
@@ -38,6 +47,10 @@ export async function runOracle(options, deps = {}) {
|
|
|
38
47
|
env: 'OPENAI_API_KEY',
|
|
39
48
|
});
|
|
40
49
|
}
|
|
50
|
+
const maskedKey = maskApiKey(apiKey);
|
|
51
|
+
if (maskedKey) {
|
|
52
|
+
log(dim(`Using OPENAI_API_KEY=${maskedKey}`));
|
|
53
|
+
}
|
|
41
54
|
const modelConfig = MODEL_CONFIGS[options.model];
|
|
42
55
|
if (!modelConfig) {
|
|
43
56
|
throw new PromptValidationError(`Unsupported model "${options.model}". Choose one of: ${Object.keys(MODEL_CONFIGS).join(', ')}`, { model: options.model });
|
|
@@ -57,6 +70,9 @@ export async function runOracle(options, deps = {}) {
|
|
|
57
70
|
}
|
|
58
71
|
else {
|
|
59
72
|
logVerbose('No files attached.');
|
|
73
|
+
if (!isPreview) {
|
|
74
|
+
log(dim('Tip: no files attached — Oracle works best with project context. Add files via --file path/to/code or docs.'));
|
|
75
|
+
}
|
|
60
76
|
}
|
|
61
77
|
const fileTokenInfo = getFileTokenStats(files, {
|
|
62
78
|
cwd,
|
package/package.json
CHANGED