Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
"source": {
"source": "npm",
"package": "@ruddercode/rudder-plugin",
"version": "0.1.3",
"version": "0.1.4",
"registry": "https://registry.npmjs.org"
},
"description": "Generate focused unit tests from coding-session intent and worktree changes using your existing coding agent.",
"version": "0.1.3",
"version": "0.1.4",
"author": {
"name": "RudderCode",
"email": "vivek@archermoney.com"
Expand Down
2 changes: 1 addition & 1 deletion .claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rudder",
"version": "0.1.3",
"version": "0.1.4",
"description": "Generate focused unit tests from coding-session intent and worktree changes using your existing coding agent.",
"author": {
"name": "Vivek Yanamadula",
Expand Down
2 changes: 1 addition & 1 deletion .codex-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rudder",
"version": "0.1.3",
"version": "0.1.4",
"description": "Generate focused unit tests from coding-session intent and worktree changes using your existing coding agent.",
"author": {
"name": "Vivek Yanamadula",
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ruddercode/rudder-plugin",
"version": "0.1.3",
"version": "0.1.4",
"description": "Generate focused unit tests from coding-session intent and worktree changes.",
"type": "module",
"engines": {
Expand Down
32 changes: 24 additions & 8 deletions test/skill-runtime.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ const updateScriptUrl = new URL(
'../skills/rudder/scripts/update.mjs',
import.meta.url
);
const currentPackageVersion = (
JSON.parse(readFileSync(join(pluginRoot, 'package.json'), 'utf8')) as {
version: string;
}
).version;
const newerPackageVersion = nextPatchVersion(currentPackageVersion);

interface UpdateResult {
currentVersion: string;
Expand Down Expand Up @@ -85,6 +91,14 @@ let stateRoot: string;
let rudderRunId: string;
let originalRudderHome: string | undefined;

function nextPatchVersion(version: string): string {
const match = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/u.exec(
version
);
assert.ok(match, `expected a stable semantic version, received ${version}`);
return `${match[1]}.${match[2]}.${Number(match[3]) + 1}`;
}

function git(...args: string[]): string {
return execFileSync('git', ['-C', repo, ...args], {
encoding: 'utf8',
Expand Down Expand Up @@ -299,7 +313,7 @@ test('caches the latest registry version while reminders continue', async () =>
let fetchCount = 0;
globalThis.fetch = async () => {
fetchCount += 1;
return new Response(JSON.stringify({ version: '0.1.4' }), {
return new Response(JSON.stringify({ version: newerPackageVersion }), {
status: 200,
headers: { 'content-type': 'application/json' },
});
Expand All @@ -310,8 +324,8 @@ test('caches the latest registry version while reminders continue', async () =>
const { checkForUpdate } = await loadUpdateModule();

const discovered = await checkForUpdate({ force: true });
assert.equal(discovered.currentVersion, '0.1.3');
assert.equal(discovered.latestVersion, '0.1.4');
assert.equal(discovered.currentVersion, currentPackageVersion);
assert.equal(discovered.latestVersion, newerPackageVersion);
assert.equal(discovered.shouldNotify, true);
assert.equal(discovered.source, 'registry');

Expand All @@ -327,7 +341,7 @@ test('caches the latest registry version while reminders continue', async () =>
};
assert.equal(state.schemaVersion, 1);
assert.ok(Number.isFinite(Date.parse(state.lastCheckedAt)));
assert.equal(state.latestVersion, '0.1.4');
assert.equal(state.latestVersion, newerPackageVersion);
} finally {
globalThis.fetch = originalFetch;
rmSync(updateStatePath, { force: true });
Expand All @@ -346,7 +360,7 @@ test('uses stale cache or skips the prompt when registry data is unavailable', a
JSON.stringify({
schemaVersion: 1,
lastCheckedAt: '2000-01-01T00:00:00.000Z',
latestVersion: '0.1.4',
latestVersion: newerPackageVersion,
})
);
globalThis.fetch = async () => {
Expand All @@ -356,7 +370,7 @@ test('uses stale cache or skips the prompt when registry data is unavailable', a
const { checkForUpdate } = await loadUpdateModule();
const staleCache = await checkForUpdate({ force: true });

assert.equal(staleCache.latestVersion, '0.1.4');
assert.equal(staleCache.latestVersion, newerPackageVersion);
assert.equal(staleCache.shouldNotify, true);
assert.equal(staleCache.source, 'stale-cache');
const stateAfterFailure = JSON.parse(
Expand All @@ -366,7 +380,7 @@ test('uses stale cache or skips the prompt when registry data is unavailable', a
latestVersion: string;
};
assert.equal(stateAfterFailure.lastCheckedAt, '2000-01-01T00:00:00.000Z');
assert.equal(stateAfterFailure.latestVersion, '0.1.4');
assert.equal(stateAfterFailure.latestVersion, newerPackageVersion);

rmSync(updateStatePath, { force: true });
globalThis.fetch = async () =>
Expand Down Expand Up @@ -463,7 +477,9 @@ test('retries a failed update twice without blocking the flow', async () => {
);
chmodSync(executable, 0o755);
globalThis.fetch = async () =>
new Response(JSON.stringify({ version: '0.1.4' }), { status: 200 });
new Response(JSON.stringify({ version: newerPackageVersion }), {
status: 200,
});
process.env.PATH = `${fakeBin}:${originalPath ?? ''}`;
process.env.RUDDER_TEST_COMMAND_LOG = commandLog;

Expand Down
Loading