quota-boss 0.1.1 → 0.1.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/.github/workflows/release.yml +29 -0
- package/CHANGELOG.md +11 -1
- package/package.json +1 -1
- package/scripts/graph.js +15 -1
- package/scripts/lib.js +11 -1
- package/test/graph.test.js +17 -1
- package/test/setup-wizard.test.js +6 -2
|
@@ -68,3 +68,32 @@ jobs:
|
|
|
68
68
|
*-*) npm publish --access public --tag next ;;
|
|
69
69
|
*) npm publish --access public ;;
|
|
70
70
|
esac
|
|
71
|
+
|
|
72
|
+
# A separate job, so the job that can publish to npm never holds a token that can write to the repository.
|
|
73
|
+
github-release:
|
|
74
|
+
needs: publish
|
|
75
|
+
runs-on: ubuntu-latest
|
|
76
|
+
permissions:
|
|
77
|
+
contents: write
|
|
78
|
+
steps:
|
|
79
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
80
|
+
with:
|
|
81
|
+
persist-credentials: false
|
|
82
|
+
- name: Create the GitHub release from the changelog
|
|
83
|
+
shell: bash
|
|
84
|
+
env:
|
|
85
|
+
GH_TOKEN: ${{ github.token }}
|
|
86
|
+
run: |
|
|
87
|
+
version="${GITHUB_REF_NAME#v}"
|
|
88
|
+
awk -v v="$version" '
|
|
89
|
+
/^## \[/ { if (found) exit; if (index($0, "## [" v "]") == 1) { found = 1; next } }
|
|
90
|
+
found { print }
|
|
91
|
+
' CHANGELOG.md > notes.md
|
|
92
|
+
if gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1; then
|
|
93
|
+
echo "Release $GITHUB_REF_NAME already exists."
|
|
94
|
+
exit 0
|
|
95
|
+
fi
|
|
96
|
+
case "$version" in
|
|
97
|
+
*-*) gh release create "$GITHUB_REF_NAME" --title "Quota Boss $version" --notes-file notes.md --prerelease ;;
|
|
98
|
+
*) gh release create "$GITHUB_REF_NAME" --title "Quota Boss $version" --notes-file notes.md --latest ;;
|
|
99
|
+
esac
|
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
This format follows Keep a Changelog, and the project uses Semantic Versioning.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## [0.1.2] - 2026-11-13
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- Windows: waiting for a busy lock no longer fails with `EPERM` when the lock file is deleted but still open in another process.
|
|
10
|
+
- A code graph built by hand (`graphify update .` or `/graphify .`) now keeps its `graphify-out/` folder out of Git by itself, like the one setup builds.
|
|
11
|
+
- The setup wizard tests no longer depend on a `graphify-out/` folder in the working folder.
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- The release workflow also creates the GitHub release, with the notes from this changelog.
|
|
6
16
|
|
|
7
17
|
## [0.1.1] - 2026-11-12
|
|
8
18
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quota-boss",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Multi-model orchestrator and harness for Claude Code and Codex: the boss routes each sub-task across your Claude, ChatGPT/Codex, Copilot, Grok, Gemini and Perplexity subscriptions and optional free AI offers by task importance, model quality and remaining quota.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
package/scripts/graph.js
CHANGED
|
@@ -174,9 +174,23 @@ function refreshIfStale(directory, options = {}) {
|
|
|
174
174
|
} catch { if (token) releaseLock(directory, token); }
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
+
/** A graph built by hand never ran setup's exclude, so the output folder ignores itself. Never follows a link. */
|
|
178
|
+
function ignoreOwnOutput(directory) {
|
|
179
|
+
try {
|
|
180
|
+
const output = path.join(directory, 'graphify-out');
|
|
181
|
+
if (!fs.lstatSync(output).isDirectory()) return;
|
|
182
|
+
const file = path.join(output, '.gitignore');
|
|
183
|
+
// Windows follows a dangling link even with O_EXCL, so any existing entry, link or not, is left alone.
|
|
184
|
+
if (lib.regularStat(file, true) !== null) return;
|
|
185
|
+
const fd = fs.openSync(file, fs.constants.O_WRONLY | fs.constants.O_CREAT | fs.constants.O_EXCL | (fs.constants.O_NOFOLLOW || 0), 0o644);
|
|
186
|
+
try { fs.writeSync(fd, '*\n'); } finally { fs.closeSync(fd); }
|
|
187
|
+
} catch { /* Present, linked, missing or read-only: leave it as it is. */ }
|
|
188
|
+
}
|
|
189
|
+
|
|
177
190
|
function sessionText(directory, options = {}) {
|
|
178
191
|
try {
|
|
179
192
|
if (!lib.detectCodeIntel(directory).graphify) return '';
|
|
193
|
+
ignoreOwnOutput(directory);
|
|
180
194
|
if (executable('graphify', directory, options)) {
|
|
181
195
|
refreshIfStale(directory, options);
|
|
182
196
|
return lib.substituteHome('Code graph available: use `node "{{QUOTA_BOSS_HOME}}/scripts/quota-boss.js" graph explain|affected|path` through Bash when you need structure. Results are hints, with Grep as the fallback. Never read graphify-out/graph.json whole.');
|
|
@@ -185,4 +199,4 @@ function sessionText(directory, options = {}) {
|
|
|
185
199
|
} catch { return ''; }
|
|
186
200
|
}
|
|
187
201
|
|
|
188
|
-
module.exports = { STALE_MS, REFRESH_LIMIT_MS, LOCK_NAME, setupGraph, excludeOutput, refreshIfStale, sessionText, releaseLock, executable, run, graphOutputSafe, queryGraph, validQuery, QUERY_USAGE };
|
|
202
|
+
module.exports = { ignoreOwnOutput, STALE_MS, REFRESH_LIMIT_MS, LOCK_NAME, setupGraph, excludeOutput, refreshIfStale, sessionText, releaseLock, executable, run, graphOutputSafe, queryGraph, validQuery, QUERY_USAGE };
|
package/scripts/lib.js
CHANGED
|
@@ -224,7 +224,17 @@ function withLock(file, action, timeout = 200, lock = file + '.lock') {
|
|
|
224
224
|
if (!reclaimed && performance.now() >= deadline) return null;
|
|
225
225
|
continue;
|
|
226
226
|
}
|
|
227
|
-
} catch (e) {
|
|
227
|
+
} catch (e) {
|
|
228
|
+
// On Windows a lock file that its owner just deleted, while another process still has it open, refuses lstat and
|
|
229
|
+
// open with EPERM until the last handle closes. Creating it failed with EEXIST, so the file is there: wait like ENOENT.
|
|
230
|
+
const pending = e.code === 'EPERM' && process.platform === 'win32';
|
|
231
|
+
if (['ENOENT', 'FILE_CHANGED'].includes(e.code) || pending) {
|
|
232
|
+
if (performance.now() >= deadline) return null;
|
|
233
|
+
if (pending) Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 5);
|
|
234
|
+
continue;
|
|
235
|
+
}
|
|
236
|
+
throw e;
|
|
237
|
+
}
|
|
228
238
|
if (performance.now() >= deadline) return null;
|
|
229
239
|
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 10);
|
|
230
240
|
}
|
package/test/graph.test.js
CHANGED
|
@@ -157,7 +157,7 @@ test('refresh errors are silent and failed spawns release their lock', t => {
|
|
|
157
157
|
assert.doesNotThrow(() => graph.refreshIfStale(f.directory, { ...f.options, find: () => { throw new Error('lookup'); } }));
|
|
158
158
|
assert.equal(graph.sessionText(f.directory, { ...f.options, find: () => { throw new Error('lookup'); } }), '');
|
|
159
159
|
fs.unlinkSync(f.file);
|
|
160
|
-
fs.
|
|
160
|
+
fs.rmSync(path.dirname(f.file), { recursive: true });
|
|
161
161
|
assert.equal(graph.sessionText(f.directory, f.options), '');
|
|
162
162
|
});
|
|
163
163
|
|
|
@@ -444,3 +444,19 @@ test('excludeOutput refuses a linked exclude file without changing its target',
|
|
|
444
444
|
assert.equal(fs.lstatSync(exclude).isSymbolicLink(), true);
|
|
445
445
|
assert.equal(fs.readlinkSync(exclude), target);
|
|
446
446
|
});
|
|
447
|
+
|
|
448
|
+
test('a detected graph ignores its own output once and never follows a link', t => {
|
|
449
|
+
const f = fixture(t);
|
|
450
|
+
const ignore = path.join(f.directory, 'graphify-out', '.gitignore');
|
|
451
|
+
graph.sessionText(f.directory, { ...f.options, find: undefined, env: { PATH: '' } });
|
|
452
|
+
assert.equal(fs.readFileSync(ignore, 'utf8'), '*\n');
|
|
453
|
+
fs.writeFileSync(ignore, '# mine\n');
|
|
454
|
+
graph.sessionText(f.directory, { ...f.options, find: undefined, env: { PATH: '' } });
|
|
455
|
+
assert.equal(fs.readFileSync(ignore, 'utf8'), '# mine\n');
|
|
456
|
+
const target = path.join(f.root, 'target');
|
|
457
|
+
fs.unlinkSync(ignore);
|
|
458
|
+
try { fs.symlinkSync(target, ignore, 'file'); } catch { return; }
|
|
459
|
+
graph.ignoreOwnOutput(f.directory);
|
|
460
|
+
assert.equal(fs.existsSync(target), false);
|
|
461
|
+
assert.equal(graph.ignoreOwnOutput(path.join(f.root, 'missing')), undefined);
|
|
462
|
+
});
|
|
@@ -4,6 +4,11 @@ const assert = require('node:assert/strict');
|
|
|
4
4
|
const { setup } = require('../scripts/setup-wizard');
|
|
5
5
|
const { TEXT } = require('../scripts/setup-text');
|
|
6
6
|
const { PROVIDER_HELP } = require('../scripts/provider-help');
|
|
7
|
+
const fs = require('node:fs'), os = require('node:os'), path = require('node:path');
|
|
8
|
+
|
|
9
|
+
// Without a folder the wizard looks at the real working folder, where a local graphify-out/ hides the graph screen.
|
|
10
|
+
const EMPTY_DIR = fs.mkdtempSync(path.join(os.tmpdir(), 'qb-wizard-'));
|
|
11
|
+
test.after(() => fs.rmSync(EMPTY_DIR, { recursive: true, force: true }));
|
|
7
12
|
|
|
8
13
|
const provider = (enabled, extra) => ({ enabled, ...extra });
|
|
9
14
|
const baseProviders = () => ({ copilot: provider(false), grok: provider(false), antigravity: provider(false),
|
|
@@ -14,7 +19,7 @@ const project = () => ({ enabled: false, profile: 'balanced', host: 'claude-code
|
|
|
14
19
|
* Plays one setup. Enter takes each default, so `answers` is the list of typed lines in order.
|
|
15
20
|
* `programs` maps tool ids to their state before install; `afterInstall` to their state after it.
|
|
16
21
|
*/
|
|
17
|
-
function play(answers, { directory, host, providers = baseProviders(), programs = {}, afterInstall = {}, pending = [], stored = [], installOutput, runError, graphError } = {}) {
|
|
22
|
+
function play(answers, { directory = EMPTY_DIR, host, providers = baseProviders(), programs = {}, afterInstall = {}, pending = [], stored = [], installOutput, runError, graphError } = {}) {
|
|
18
23
|
const queue = [...answers], said = [], commands = [], installs = [], logged = [], keyed = [], opened = [], graphs = [];
|
|
19
24
|
let installed = false;
|
|
20
25
|
const stateOf = id => (installed && afterInstall[id]) || programs[id] || 'ok';
|
|
@@ -284,7 +289,6 @@ test('the code graph is explained, asked once, and installed only with the one c
|
|
|
284
289
|
});
|
|
285
290
|
|
|
286
291
|
test('the code graph question is skipped when this folder already has a graph', t => {
|
|
287
|
-
const fs = require('node:fs'), os = require('node:os'), path = require('node:path');
|
|
288
292
|
const directory = fs.mkdtempSync(path.join(os.tmpdir(), 'qb-graph-'));
|
|
289
293
|
t.after(() => fs.rmSync(directory, { recursive: true, force: true }));
|
|
290
294
|
fs.mkdirSync(path.join(directory, 'graphify-out'));
|