opengstack 0.13.10 → 0.14.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/AGENTS.md +4 -4
- package/CLAUDE.md +127 -110
- package/README.md +10 -5
- package/SKILL.md +500 -70
- package/bin/opengstack.js +69 -69
- package/{skills/land-and-deploy/SKILL.md → commands/autoplan.md} +7 -25
- package/{skills/benchmark/SKILL.md → commands/benchmark.md} +84 -108
- package/{skills/browse/SKILL.md → commands/browse.md} +60 -81
- package/{skills/ship/SKILL.md → commands/canary.md} +7 -27
- package/{skills/careful/SKILL.md → commands/careful.md} +2 -22
- package/{skills/canary/SKILL.md → commands/codex.md} +7 -26
- package/{skills/connect-chrome/SKILL.md → commands/connect-chrome.md} +7 -24
- package/commands/cso.md +70 -0
- package/commands/design-consultation.md +70 -0
- package/commands/design-review.md +70 -0
- package/commands/design-shotgun.md +70 -0
- package/commands/document-release.md +70 -0
- package/{skills/freeze/SKILL.md → commands/freeze.md} +3 -29
- package/{skills/guard/SKILL.md → commands/guard.md} +4 -35
- package/commands/investigate.md +70 -0
- package/commands/land-and-deploy.md +70 -0
- package/commands/office-hours.md +70 -0
- package/{skills/gstack-upgrade/SKILL.md → commands/opengstack-upgrade.md} +64 -79
- package/commands/plan-ceo-review.md +70 -0
- package/commands/plan-design-review.md +70 -0
- package/commands/plan-eng-review.md +70 -0
- package/commands/qa-only.md +70 -0
- package/commands/qa.md +70 -0
- package/commands/retro.md +70 -0
- package/commands/review.md +70 -0
- package/{skills/setup-browser-cookies/SKILL.md → commands/setup-browser-cookies.md} +22 -40
- package/commands/setup-deploy.md +70 -0
- package/commands/ship.md +70 -0
- package/commands/unfreeze.md +25 -0
- package/docs/designs/CHROME_VS_CHROMIUM_EXPLORATION.md +9 -9
- package/docs/designs/CONDUCTOR_CHROME_SIDEBAR_INTEGRATION.md +2 -2
- package/docs/designs/CONDUCTOR_SESSION_API.md +16 -16
- package/docs/designs/DESIGN_SHOTGUN.md +74 -74
- package/docs/designs/DESIGN_TOOLS_V1.md +111 -111
- package/docs/skills.md +483 -202
- package/package.json +42 -43
- package/scripts/analytics.ts +188 -0
- package/scripts/dev-skill.ts +83 -0
- package/scripts/discover-skills.ts +39 -0
- package/scripts/eval-compare.ts +97 -0
- package/scripts/eval-list.ts +117 -0
- package/scripts/eval-select.ts +86 -0
- package/scripts/eval-summary.ts +188 -0
- package/scripts/eval-watch.ts +172 -0
- package/scripts/gen-skill-docs.ts +473 -0
- package/scripts/resolvers/browse.ts +129 -0
- package/scripts/resolvers/codex-helpers.ts +133 -0
- package/scripts/resolvers/composition.ts +48 -0
- package/scripts/resolvers/confidence.ts +37 -0
- package/scripts/resolvers/constants.ts +50 -0
- package/scripts/resolvers/design.ts +950 -0
- package/scripts/resolvers/index.ts +59 -0
- package/scripts/resolvers/learnings.ts +96 -0
- package/scripts/resolvers/preamble.ts +505 -0
- package/scripts/resolvers/review.ts +884 -0
- package/scripts/resolvers/testing.ts +573 -0
- package/scripts/resolvers/types.ts +45 -0
- package/scripts/resolvers/utility.ts +421 -0
- package/scripts/skill-check.ts +190 -0
- package/scripts/cleanup.py +0 -100
- package/scripts/filter-skills.sh +0 -114
- package/scripts/filter_skills.py +0 -164
- package/scripts/install-skills.js +0 -60
- package/skills/autoplan/SKILL.md +0 -96
- package/skills/autoplan/SKILL.md.tmpl +0 -694
- package/skills/benchmark/SKILL.md.tmpl +0 -222
- package/skills/browse/SKILL.md.tmpl +0 -131
- package/skills/browse/bin/find-browse +0 -21
- package/skills/browse/bin/remote-slug +0 -14
- package/skills/browse/scripts/build-node-server.sh +0 -48
- package/skills/browse/src/activity.ts +0 -208
- package/skills/browse/src/browser-manager.ts +0 -959
- package/skills/browse/src/buffers.ts +0 -137
- package/skills/browse/src/bun-polyfill.cjs +0 -109
- package/skills/browse/src/cli.ts +0 -678
- package/skills/browse/src/commands.ts +0 -128
- package/skills/browse/src/config.ts +0 -150
- package/skills/browse/src/cookie-import-browser.ts +0 -625
- package/skills/browse/src/cookie-picker-routes.ts +0 -230
- package/skills/browse/src/cookie-picker-ui.ts +0 -688
- package/skills/browse/src/find-browse.ts +0 -61
- package/skills/browse/src/meta-commands.ts +0 -550
- package/skills/browse/src/platform.ts +0 -17
- package/skills/browse/src/read-commands.ts +0 -358
- package/skills/browse/src/server.ts +0 -1192
- package/skills/browse/src/sidebar-agent.ts +0 -280
- package/skills/browse/src/sidebar-utils.ts +0 -21
- package/skills/browse/src/snapshot.ts +0 -407
- package/skills/browse/src/url-validation.ts +0 -95
- package/skills/browse/src/write-commands.ts +0 -364
- package/skills/browse/test/activity.test.ts +0 -120
- package/skills/browse/test/adversarial-security.test.ts +0 -32
- package/skills/browse/test/browser-manager-unit.test.ts +0 -17
- package/skills/browse/test/bun-polyfill.test.ts +0 -72
- package/skills/browse/test/commands.test.ts +0 -2075
- package/skills/browse/test/compare-board.test.ts +0 -342
- package/skills/browse/test/config.test.ts +0 -316
- package/skills/browse/test/cookie-import-browser.test.ts +0 -519
- package/skills/browse/test/cookie-picker-routes.test.ts +0 -260
- package/skills/browse/test/file-drop.test.ts +0 -271
- package/skills/browse/test/find-browse.test.ts +0 -50
- package/skills/browse/test/findport.test.ts +0 -191
- package/skills/browse/test/fixtures/basic.html +0 -33
- package/skills/browse/test/fixtures/cursor-interactive.html +0 -22
- package/skills/browse/test/fixtures/dialog.html +0 -15
- package/skills/browse/test/fixtures/empty.html +0 -2
- package/skills/browse/test/fixtures/forms.html +0 -55
- package/skills/browse/test/fixtures/iframe.html +0 -30
- package/skills/browse/test/fixtures/network-idle.html +0 -30
- package/skills/browse/test/fixtures/qa-eval-checkout.html +0 -108
- package/skills/browse/test/fixtures/qa-eval-spa.html +0 -98
- package/skills/browse/test/fixtures/qa-eval.html +0 -51
- package/skills/browse/test/fixtures/responsive.html +0 -49
- package/skills/browse/test/fixtures/snapshot.html +0 -55
- package/skills/browse/test/fixtures/spa.html +0 -24
- package/skills/browse/test/fixtures/states.html +0 -17
- package/skills/browse/test/fixtures/upload.html +0 -25
- package/skills/browse/test/gstack-config.test.ts +0 -138
- package/skills/browse/test/gstack-update-check.test.ts +0 -514
- package/skills/browse/test/handoff.test.ts +0 -235
- package/skills/browse/test/path-validation.test.ts +0 -91
- package/skills/browse/test/platform.test.ts +0 -37
- package/skills/browse/test/server-auth.test.ts +0 -65
- package/skills/browse/test/sidebar-agent-roundtrip.test.ts +0 -226
- package/skills/browse/test/sidebar-agent.test.ts +0 -199
- package/skills/browse/test/sidebar-integration.test.ts +0 -320
- package/skills/browse/test/sidebar-unit.test.ts +0 -96
- package/skills/browse/test/snapshot.test.ts +0 -467
- package/skills/browse/test/state-ttl.test.ts +0 -35
- package/skills/browse/test/test-server.ts +0 -57
- package/skills/browse/test/url-validation.test.ts +0 -72
- package/skills/browse/test/watch.test.ts +0 -129
- package/skills/canary/SKILL.md.tmpl +0 -212
- package/skills/careful/SKILL.md.tmpl +0 -56
- package/skills/careful/bin/check-careful.sh +0 -112
- package/skills/codex/SKILL.md +0 -90
- package/skills/codex/SKILL.md.tmpl +0 -417
- package/skills/connect-chrome/SKILL.md.tmpl +0 -195
- package/skills/cso/ACKNOWLEDGEMENTS.md +0 -14
- package/skills/cso/SKILL.md +0 -93
- package/skills/cso/SKILL.md.tmpl +0 -606
- package/skills/design-consultation/SKILL.md +0 -94
- package/skills/design-consultation/SKILL.md.tmpl +0 -415
- package/skills/design-review/SKILL.md +0 -94
- package/skills/design-review/SKILL.md.tmpl +0 -290
- package/skills/design-shotgun/SKILL.md +0 -91
- package/skills/design-shotgun/SKILL.md.tmpl +0 -285
- package/skills/document-release/SKILL.md +0 -91
- package/skills/document-release/SKILL.md.tmpl +0 -359
- package/skills/freeze/SKILL.md.tmpl +0 -77
- package/skills/freeze/bin/check-freeze.sh +0 -79
- package/skills/gstack-upgrade/SKILL.md.tmpl +0 -222
- package/skills/guard/SKILL.md.tmpl +0 -77
- package/skills/investigate/SKILL.md +0 -105
- package/skills/investigate/SKILL.md.tmpl +0 -194
- package/skills/land-and-deploy/SKILL.md.tmpl +0 -881
- package/skills/office-hours/SKILL.md +0 -96
- package/skills/office-hours/SKILL.md.tmpl +0 -645
- package/skills/plan-ceo-review/SKILL.md +0 -94
- package/skills/plan-ceo-review/SKILL.md.tmpl +0 -811
- package/skills/plan-design-review/SKILL.md +0 -92
- package/skills/plan-design-review/SKILL.md.tmpl +0 -446
- package/skills/plan-eng-review/SKILL.md +0 -93
- package/skills/plan-eng-review/SKILL.md.tmpl +0 -303
- package/skills/qa/SKILL.md +0 -95
- package/skills/qa/SKILL.md.tmpl +0 -316
- package/skills/qa/references/issue-taxonomy.md +0 -85
- package/skills/qa/templates/qa-report-template.md +0 -126
- package/skills/qa-only/SKILL.md +0 -89
- package/skills/qa-only/SKILL.md.tmpl +0 -101
- package/skills/retro/SKILL.md +0 -89
- package/skills/retro/SKILL.md.tmpl +0 -820
- package/skills/review/SKILL.md +0 -92
- package/skills/review/SKILL.md.tmpl +0 -281
- package/skills/review/TODOS-format.md +0 -62
- package/skills/review/checklist.md +0 -220
- package/skills/review/design-checklist.md +0 -132
- package/skills/review/greptile-triage.md +0 -220
- package/skills/setup-browser-cookies/SKILL.md.tmpl +0 -81
- package/skills/setup-deploy/SKILL.md +0 -92
- package/skills/setup-deploy/SKILL.md.tmpl +0 -215
- package/skills/ship/SKILL.md.tmpl +0 -636
- package/skills/unfreeze/SKILL.md +0 -37
- package/skills/unfreeze/SKILL.md.tmpl +0 -36
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
-
<title>Test Page - Responsive</title>
|
|
7
|
-
<style>
|
|
8
|
-
body { font-family: sans-serif; margin: 0; padding: 20px; }
|
|
9
|
-
.container { max-width: 1200px; margin: 0 auto; }
|
|
10
|
-
.grid { display: grid; gap: 16px; }
|
|
11
|
-
.card { padding: 16px; border: 1px solid #ddd; border-radius: 8px; }
|
|
12
|
-
|
|
13
|
-
/* Mobile: single column */
|
|
14
|
-
.grid { grid-template-columns: 1fr; }
|
|
15
|
-
|
|
16
|
-
/* Tablet: two columns */
|
|
17
|
-
@media (min-width: 768px) {
|
|
18
|
-
.grid { grid-template-columns: 1fr 1fr; }
|
|
19
|
-
.mobile-only { display: none; }
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/* Desktop: three columns */
|
|
23
|
-
@media (min-width: 1024px) {
|
|
24
|
-
.grid { grid-template-columns: 1fr 1fr 1fr; }
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.mobile-only { color: red; }
|
|
28
|
-
.desktop-indicator { display: none; }
|
|
29
|
-
@media (min-width: 1024px) {
|
|
30
|
-
.desktop-indicator { display: block; color: green; }
|
|
31
|
-
}
|
|
32
|
-
</style>
|
|
33
|
-
</head>
|
|
34
|
-
<body>
|
|
35
|
-
<div class="container">
|
|
36
|
-
<h1>Responsive Layout Test</h1>
|
|
37
|
-
<p class="mobile-only">You are on mobile</p>
|
|
38
|
-
<p class="desktop-indicator">You are on desktop</p>
|
|
39
|
-
<div class="grid">
|
|
40
|
-
<div class="card">Card 1</div>
|
|
41
|
-
<div class="card">Card 2</div>
|
|
42
|
-
<div class="card">Card 3</div>
|
|
43
|
-
<div class="card">Card 4</div>
|
|
44
|
-
<div class="card">Card 5</div>
|
|
45
|
-
<div class="card">Card 6</div>
|
|
46
|
-
</div>
|
|
47
|
-
</div>
|
|
48
|
-
</body>
|
|
49
|
-
</html>
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<title>Snapshot Test Page</title>
|
|
6
|
-
<style>
|
|
7
|
-
body { font-family: sans-serif; padding: 20px; }
|
|
8
|
-
form { margin: 10px 0; }
|
|
9
|
-
input, select, button { margin: 5px; padding: 5px; }
|
|
10
|
-
#main { border: 1px solid #ccc; padding: 10px; }
|
|
11
|
-
.empty-div { }
|
|
12
|
-
.hidden { display: none; }
|
|
13
|
-
</style>
|
|
14
|
-
</head>
|
|
15
|
-
<body>
|
|
16
|
-
<h1>Snapshot Test</h1>
|
|
17
|
-
<h2>Subheading</h2>
|
|
18
|
-
|
|
19
|
-
<nav>
|
|
20
|
-
<a href="/page1">Internal Link</a>
|
|
21
|
-
<a href="https://external.com">External Link</a>
|
|
22
|
-
</nav>
|
|
23
|
-
|
|
24
|
-
<div id="main">
|
|
25
|
-
<h3>Form Section</h3>
|
|
26
|
-
<form id="test-form">
|
|
27
|
-
<input type="text" id="username" placeholder="Username" aria-label="Username">
|
|
28
|
-
<input type="email" id="email" placeholder="Email" aria-label="Email">
|
|
29
|
-
<input type="password" id="pass" placeholder="Password" aria-label="Password">
|
|
30
|
-
<label><input type="checkbox" id="agree"> I agree</label>
|
|
31
|
-
<select id="role" aria-label="Role">
|
|
32
|
-
<option value="">Choose...</option>
|
|
33
|
-
<option value="admin">Admin</option>
|
|
34
|
-
<option value="user">User</option>
|
|
35
|
-
</select>
|
|
36
|
-
<button type="submit" id="submit-btn">Submit</button>
|
|
37
|
-
<button type="button" id="cancel-btn">Cancel</button>
|
|
38
|
-
</form>
|
|
39
|
-
</div>
|
|
40
|
-
|
|
41
|
-
<div class="empty-div">
|
|
42
|
-
<div class="empty-div">
|
|
43
|
-
<button id="nested-btn">Nested Button</button>
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
46
|
-
|
|
47
|
-
<p>Some paragraph text that is not interactive.</p>
|
|
48
|
-
|
|
49
|
-
<script>
|
|
50
|
-
document.getElementById('test-form').addEventListener('submit', (e) => {
|
|
51
|
-
e.preventDefault();
|
|
52
|
-
});
|
|
53
|
-
</script>
|
|
54
|
-
</body>
|
|
55
|
-
</html>
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<title>Test Page - SPA</title>
|
|
6
|
-
<style>
|
|
7
|
-
body { font-family: sans-serif; }
|
|
8
|
-
#app { padding: 20px; }
|
|
9
|
-
.loaded { color: green; }
|
|
10
|
-
</style>
|
|
11
|
-
</head>
|
|
12
|
-
<body>
|
|
13
|
-
<div id="app">Loading...</div>
|
|
14
|
-
<script>
|
|
15
|
-
console.log('[SPA] Starting render');
|
|
16
|
-
console.warn('[SPA] This is a warning');
|
|
17
|
-
console.error('[SPA] This is an error');
|
|
18
|
-
setTimeout(() => {
|
|
19
|
-
document.getElementById('app').innerHTML = '<h1 class="loaded">SPA Content Loaded</h1><p>Rendered by JavaScript</p>';
|
|
20
|
-
console.log('[SPA] Render complete');
|
|
21
|
-
}, 500);
|
|
22
|
-
</script>
|
|
23
|
-
</body>
|
|
24
|
-
</html>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<title>Test Page - Element States</title>
|
|
6
|
-
</head>
|
|
7
|
-
<body>
|
|
8
|
-
<h1>Element States Test</h1>
|
|
9
|
-
<input type="text" id="enabled-input" value="enabled" />
|
|
10
|
-
<input type="text" id="disabled-input" value="disabled" disabled />
|
|
11
|
-
<input type="checkbox" id="checked-box" checked />
|
|
12
|
-
<input type="checkbox" id="unchecked-box" />
|
|
13
|
-
<div id="visible-div">Visible</div>
|
|
14
|
-
<div id="hidden-div" style="display: none;">Hidden</div>
|
|
15
|
-
<input type="text" id="readonly-input" readonly value="readonly" />
|
|
16
|
-
</body>
|
|
17
|
-
</html>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<title>Test Page - Upload</title>
|
|
6
|
-
</head>
|
|
7
|
-
<body>
|
|
8
|
-
<h1>Upload Test</h1>
|
|
9
|
-
<input type="file" id="file-input" />
|
|
10
|
-
<input type="file" id="multi-input" multiple />
|
|
11
|
-
<p id="upload-result"></p>
|
|
12
|
-
<script>
|
|
13
|
-
document.getElementById('file-input').addEventListener('change', function(e) {
|
|
14
|
-
const files = e.target.files;
|
|
15
|
-
const names = Array.from(files).map(f => f.name).join(', ');
|
|
16
|
-
document.getElementById('upload-result').textContent = 'Uploaded: ' + names;
|
|
17
|
-
});
|
|
18
|
-
document.getElementById('multi-input').addEventListener('change', function(e) {
|
|
19
|
-
const files = e.target.files;
|
|
20
|
-
const names = Array.from(files).map(f => f.name).join(', ');
|
|
21
|
-
document.getElementById('upload-result').textContent = 'Multi: ' + names;
|
|
22
|
-
});
|
|
23
|
-
</script>
|
|
24
|
-
</body>
|
|
25
|
-
</html>
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests for bin/gstack-config bash script.
|
|
3
|
-
*
|
|
4
|
-
* Uses Bun.spawnSync to invoke the script with temp dirs and
|
|
5
|
-
* GSTACK_STATE_DIR env override for full isolation.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { describe, test, expect, beforeEach, afterEach } from 'bun:test';
|
|
9
|
-
import { mkdtempSync, writeFileSync, rmSync, readFileSync, existsSync } from 'fs';
|
|
10
|
-
import { join } from 'path';
|
|
11
|
-
import { tmpdir } from 'os';
|
|
12
|
-
|
|
13
|
-
const SCRIPT = join(import.meta.dir, '..', '..', 'bin', 'gstack-config');
|
|
14
|
-
|
|
15
|
-
let stateDir: string;
|
|
16
|
-
|
|
17
|
-
function run(args: string[] = [], extraEnv: Record<string, string> = {}) {
|
|
18
|
-
const result = Bun.spawnSync(['bash', SCRIPT, ...args], {
|
|
19
|
-
env: {
|
|
20
|
-
...process.env,
|
|
21
|
-
GSTACK_STATE_DIR: stateDir,
|
|
22
|
-
...extraEnv,
|
|
23
|
-
},
|
|
24
|
-
stdout: 'pipe',
|
|
25
|
-
stderr: 'pipe',
|
|
26
|
-
});
|
|
27
|
-
return {
|
|
28
|
-
exitCode: result.exitCode,
|
|
29
|
-
stdout: result.stdout.toString().trim(),
|
|
30
|
-
stderr: result.stderr.toString().trim(),
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
beforeEach(() => {
|
|
35
|
-
stateDir = mkdtempSync(join(tmpdir(), 'gstack-config-test-'));
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
afterEach(() => {
|
|
39
|
-
rmSync(stateDir, { recursive: true, force: true });
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
describe('gstack-config', () => {
|
|
43
|
-
// ─── get ──────────────────────────────────────────────────
|
|
44
|
-
test('get on missing file returns empty, exit 0', () => {
|
|
45
|
-
const { exitCode, stdout } = run(['get', 'auto_upgrade']);
|
|
46
|
-
expect(exitCode).toBe(0);
|
|
47
|
-
expect(stdout).toBe('');
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
test('get existing key returns value', () => {
|
|
51
|
-
writeFileSync(join(stateDir, 'config.yaml'), 'auto_upgrade: true\n');
|
|
52
|
-
const { exitCode, stdout } = run(['get', 'auto_upgrade']);
|
|
53
|
-
expect(exitCode).toBe(0);
|
|
54
|
-
expect(stdout).toBe('true');
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
test('get missing key returns empty', () => {
|
|
58
|
-
writeFileSync(join(stateDir, 'config.yaml'), 'auto_upgrade: true\n');
|
|
59
|
-
const { exitCode, stdout } = run(['get', 'nonexistent']);
|
|
60
|
-
expect(exitCode).toBe(0);
|
|
61
|
-
expect(stdout).toBe('');
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
test('get returns last value when key appears multiple times', () => {
|
|
65
|
-
writeFileSync(join(stateDir, 'config.yaml'), 'foo: bar\nfoo: baz\n');
|
|
66
|
-
const { exitCode, stdout } = run(['get', 'foo']);
|
|
67
|
-
expect(exitCode).toBe(0);
|
|
68
|
-
expect(stdout).toBe('baz');
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
// ─── set ──────────────────────────────────────────────────
|
|
72
|
-
test('set creates file and writes key on missing file', () => {
|
|
73
|
-
const { exitCode } = run(['set', 'auto_upgrade', 'true']);
|
|
74
|
-
expect(exitCode).toBe(0);
|
|
75
|
-
const content = readFileSync(join(stateDir, 'config.yaml'), 'utf-8');
|
|
76
|
-
expect(content).toContain('auto_upgrade: true');
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
test('set appends new key to existing file', () => {
|
|
80
|
-
writeFileSync(join(stateDir, 'config.yaml'), 'foo: bar\n');
|
|
81
|
-
const { exitCode } = run(['set', 'auto_upgrade', 'true']);
|
|
82
|
-
expect(exitCode).toBe(0);
|
|
83
|
-
const content = readFileSync(join(stateDir, 'config.yaml'), 'utf-8');
|
|
84
|
-
expect(content).toContain('foo: bar');
|
|
85
|
-
expect(content).toContain('auto_upgrade: true');
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
test('set replaces existing key in-place', () => {
|
|
89
|
-
writeFileSync(join(stateDir, 'config.yaml'), 'auto_upgrade: false\n');
|
|
90
|
-
const { exitCode } = run(['set', 'auto_upgrade', 'true']);
|
|
91
|
-
expect(exitCode).toBe(0);
|
|
92
|
-
const content = readFileSync(join(stateDir, 'config.yaml'), 'utf-8');
|
|
93
|
-
expect(content).toContain('auto_upgrade: true');
|
|
94
|
-
expect(content).not.toContain('auto_upgrade: false');
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
test('set creates state dir if missing', () => {
|
|
98
|
-
const nestedDir = join(stateDir, 'nested', 'dir');
|
|
99
|
-
const { exitCode } = run(['set', 'foo', 'bar'], { GSTACK_STATE_DIR: nestedDir });
|
|
100
|
-
expect(exitCode).toBe(0);
|
|
101
|
-
expect(existsSync(join(nestedDir, 'config.yaml'))).toBe(true);
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
// ─── list ─────────────────────────────────────────────────
|
|
105
|
-
test('list shows all keys', () => {
|
|
106
|
-
writeFileSync(join(stateDir, 'config.yaml'), 'auto_upgrade: true\nupdate_check: false\n');
|
|
107
|
-
const { exitCode, stdout } = run(['list']);
|
|
108
|
-
expect(exitCode).toBe(0);
|
|
109
|
-
expect(stdout).toContain('auto_upgrade: true');
|
|
110
|
-
expect(stdout).toContain('update_check: false');
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
test('list on missing file returns empty, exit 0', () => {
|
|
114
|
-
const { exitCode, stdout } = run(['list']);
|
|
115
|
-
expect(exitCode).toBe(0);
|
|
116
|
-
expect(stdout).toBe('');
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
// ─── usage ────────────────────────────────────────────────
|
|
120
|
-
test('no args shows usage and exits 1', () => {
|
|
121
|
-
const { exitCode, stdout } = run([]);
|
|
122
|
-
expect(exitCode).toBe(1);
|
|
123
|
-
expect(stdout).toContain('Usage');
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
// ─── security: input validation ─────────────────────────
|
|
127
|
-
test('set rejects key with regex metacharacters', () => {
|
|
128
|
-
const { exitCode, stderr } = run(['set', '.*', 'value']);
|
|
129
|
-
expect(exitCode).toBe(1);
|
|
130
|
-
expect(stderr).toContain('alphanumeric');
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
test('set preserves value with sed special chars', () => {
|
|
134
|
-
run(['set', 'test_special', 'a/b&c\\d']);
|
|
135
|
-
const { stdout } = run(['get', 'test_special']);
|
|
136
|
-
expect(stdout).toBe('a/b&c\\d');
|
|
137
|
-
});
|
|
138
|
-
});
|