fix(antigravity): fix agent tools, sandbox permissions, and relocate global msd-core
Some checks failed
Tests / PR mergeability (push) Successful in 30s
Tests / Detect test scope (push) Successful in 21s
Tests / lint-tests (push) Failing after 3m39s
Tests / plugin-validate (push) Successful in 2m22s
Tests / test (inert CI) (push) Has been skipped
Tests / conformance test (macos-latest, 24) (push) Blocked by required conditions
Tests / conformance test (windows-latest, 24, shard 1/3) (push) Blocked by required conditions
Tests / conformance test (windows-latest, 24, shard 2/3) (push) Blocked by required conditions
Tests / Required tests (push) Blocked by required conditions
Tests / conformance test (windows-latest, 24, shard 3/3) (push) Blocked by required conditions
Tests / Base branch health (push) Successful in 12s
Tests / test (ubuntu-latest, 24, shard 1/3) (push) Failing after 20s
Tests / test (ubuntu-latest, 24, shard 2/3) (push) Failing after 19s
Tests / test (ubuntu-latest, 24, shard 3/3) (push) Failing after 19s
Tests / test (ubuntu-latest, 24) (push) Failing after 17s
Tests / QA loop walk (smell ratchet) (push) Failing after 20s
Tests / Coverage gate (merged shards) (push) Has been skipped
Tests / Publish emitted-baseline artifact (push) Has been skipped
Dismiss Unauthorized PR Approvals / dismiss-unauthorized-approval (push) Successful in 21s
Some checks failed
Tests / PR mergeability (push) Successful in 30s
Tests / Detect test scope (push) Successful in 21s
Tests / lint-tests (push) Failing after 3m39s
Tests / plugin-validate (push) Successful in 2m22s
Tests / test (inert CI) (push) Has been skipped
Tests / conformance test (macos-latest, 24) (push) Blocked by required conditions
Tests / conformance test (windows-latest, 24, shard 1/3) (push) Blocked by required conditions
Tests / conformance test (windows-latest, 24, shard 2/3) (push) Blocked by required conditions
Tests / Required tests (push) Blocked by required conditions
Tests / conformance test (windows-latest, 24, shard 3/3) (push) Blocked by required conditions
Tests / Base branch health (push) Successful in 12s
Tests / test (ubuntu-latest, 24, shard 1/3) (push) Failing after 20s
Tests / test (ubuntu-latest, 24, shard 2/3) (push) Failing after 19s
Tests / test (ubuntu-latest, 24, shard 3/3) (push) Failing after 19s
Tests / test (ubuntu-latest, 24) (push) Failing after 17s
Tests / QA loop walk (smell ratchet) (push) Failing after 20s
Tests / Coverage gate (merged shards) (push) Has been skipped
Tests / Publish emitted-baseline artifact (push) Has been skipped
Dismiss Unauthorized PR Approvals / dismiss-unauthorized-approval (push) Successful in 21s
- Map Glob, WebSearch, WebFetch to Antigravity-native tool names (find_by_name, search_web, read_url_content) and drop unmapped tools instead of lowercasing - Emit absolute, glob-free trailing-slash read_file() allow rules in settings.json and strip legacy globbed/tilde rules that crash the Antigravity terminal sandbox - Relocate global Antigravity msd-core/ and sibling scripts/ outside ~/.gemini/ to ~/.msd/antigravity/ (avoiding AGY CLI's hardcoded ~/.gemini/** protection boundary) - Update content rewriters, msd-run-resolver.md, update-context, and update.md to resolve ~/.msd/antigravity/msd-core/ and .agents/msd-core/ - Replace Discord invite link in installer banner with Golem15 Wavepath join URL
This commit is contained in:
@@ -74,13 +74,22 @@ test('toTildePosixPath leaves a non-homedir path as an absolute posix path', ()
|
||||
assert.equal(toTildePosixPath('/var/tmp/some-config-dir'), '/var/tmp/some-config-dir');
|
||||
});
|
||||
|
||||
test('buildAntigravityAllowRules emits the 4 documented "action(target)" rule strings', () => {
|
||||
test('buildAntigravityAllowRules emits glob-free trailing-slash "action(target)" rule strings', () => {
|
||||
const rules = buildAntigravityAllowRules('/tmp/ag-config');
|
||||
assert.deepEqual(rules, [
|
||||
'read_file(/tmp/ag-config/msd-core/*)',
|
||||
'read_file(/tmp/ag-config/agents/msd-*)',
|
||||
'read_file(/tmp/ag-config/skills/msd-*)',
|
||||
'command(node /tmp/ag-config/hooks/*)',
|
||||
'read_file(/tmp/ag-config/msd-core/)',
|
||||
'command(node /tmp/ag-config/hooks/)',
|
||||
]);
|
||||
for (const rule of rules) {
|
||||
assert.ok(!rule.includes('*'), `Antigravity allow rule must not contain globs (breaks terminal sandbox): ${rule}`);
|
||||
}
|
||||
});
|
||||
|
||||
test('buildAntigravityAllowRules accepts a relocated msdCoreDir outside ~/.gemini/ and grants the engine root', () => {
|
||||
const rules = buildAntigravityAllowRules('/home/u/.gemini/antigravity-cli', '/home/u/.msd/antigravity/msd-core');
|
||||
assert.deepEqual(rules, [
|
||||
'read_file(/home/u/.msd/antigravity/)',
|
||||
'command(node /home/u/.gemini/antigravity-cli/hooks/)',
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -89,7 +98,7 @@ test('buildAntigravityAllowRules emits the 4 documented "action(target)" rule st
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
for (const scope of ['global', 'local']) {
|
||||
test(`antigravity --${scope}: settings.json permissions.allow contains MSD's rules (UPGRADE 1)`, (t) => {
|
||||
test(`antigravity --${scope}: settings.json permissions.allow contains MSD's glob-free rules (UPGRADE 1)`, (t) => {
|
||||
const { configDir, root } = runMinimalInstall({ runtime: 'antigravity', scope });
|
||||
t.after(() => cleanup(root));
|
||||
|
||||
@@ -99,32 +108,69 @@ for (const scope of ['global', 'local']) {
|
||||
const settings = JSON.parse(fs.readFileSync(settingsPath, 'utf8'));
|
||||
assert.ok(settings.permissions && Array.isArray(settings.permissions.allow), 'permissions.allow must be an array');
|
||||
|
||||
// Asserting on the exact rule strings here would require reproducing
|
||||
// toTildePosixPath's os.homedir()-relative substitution from OUTSIDE the
|
||||
// spawned installer subprocess: runMinimalInstall overrides that
|
||||
// subprocess's HOME to `root`, so for --global (configDir === root ===
|
||||
// that subprocess's HOME) every rule collapses to the bare `~/...` form,
|
||||
// while THIS test process's own (unrelated, real) os.homedir() would
|
||||
// reconstruct full absolute paths instead — a guaranteed mismatch that
|
||||
// has nothing to do with correctness. Assert on the documented rule
|
||||
// SHAPE (action + path suffix) instead, which holds regardless of
|
||||
// whether the prefix collapsed to `~` or stayed a full absolute path.
|
||||
const expectedShapes = [
|
||||
{ action: 'read_file(', suffix: '/msd-core/*)' },
|
||||
{ action: 'read_file(', suffix: '/agents/msd-*)' },
|
||||
{ action: 'read_file(', suffix: '/skills/msd-*)' },
|
||||
{ action: 'command(node ', suffix: '/hooks/*)' },
|
||||
{ action: 'read_file(', suffix: scope === 'global' ? '/.msd/antigravity/)' : '/msd-core/)' },
|
||||
{ action: 'command(node ', suffix: '/hooks/)' },
|
||||
];
|
||||
for (const { action, suffix } of expectedShapes) {
|
||||
const found = settings.permissions.allow.some((rule) => rule.startsWith(action) && rule.endsWith(suffix));
|
||||
assert.ok(found, `permissions.allow must include a rule shaped like "${action}...${suffix}" — got ${JSON.stringify(settings.permissions.allow)}`);
|
||||
}
|
||||
// Terminal sandbox rejects both globs and ~-prefixed paths in readonly (read_file) allow rules.
|
||||
for (const rule of settings.permissions.allow) {
|
||||
assert.ok(!rule.includes('*'), `permissions.allow must never emit globbed rules — got ${rule}`);
|
||||
if (rule.startsWith('read_file(')) {
|
||||
assert.ok(!rule.startsWith('read_file(~'), `read_file() allow rule must be absolute (sandbox rejects ~): ${rule}`);
|
||||
}
|
||||
}
|
||||
// Priority-scoping (deny/ask) is a user-owned decision — MSD never writes it.
|
||||
assert.equal(settings.permissions.deny, undefined, 'MSD must never write permissions.deny');
|
||||
assert.equal(settings.permissions.ask, undefined, 'MSD must never write permissions.ask');
|
||||
|
||||
// Installed msd-tools.cjs must boot cleanly (sibling scripts/fix-slash-commands.cjs must land beside msd-core/).
|
||||
const msdToolsPath = scope === 'global'
|
||||
? path.join(root, '.msd', 'antigravity', 'msd-core', 'bin', 'msd-tools.cjs')
|
||||
: path.join(configDir, 'msd-core', 'bin', 'msd-tools.cjs');
|
||||
const idRes = spawnSync(process.execPath, [msdToolsPath, 'runtime-identity', '--raw'], {
|
||||
encoding: 'utf-8',
|
||||
timeout: PROBE_TIMEOUT_MS,
|
||||
});
|
||||
assert.strictEqual(idRes.status, 0, `installed msd-tools.cjs must run cleanly; stderr: ${idRes.stderr}`);
|
||||
assert.ok(idRes.stdout.includes(PACKAGE_NAME), `runtime-identity must report ${PACKAGE_NAME}, got: ${idRes.stdout}`);
|
||||
});
|
||||
}
|
||||
|
||||
test('configureAntigravityPermissions strips legacy globbed and tilde-prefixed rules that break the terminal sandbox', (t) => {
|
||||
const root = fs.mkdtempSync(path.join(require('node:os').tmpdir(), 'msd-ag-perm-legacy-'));
|
||||
t.after(() => cleanup(root));
|
||||
|
||||
fs.writeFileSync(path.join(root, 'settings.json'), JSON.stringify({
|
||||
permissions: {
|
||||
allow: [
|
||||
'command(git)',
|
||||
'read_file(~/.gemini/antigravity-cli/msd-core/*)',
|
||||
'read_file(~/.gemini/antigravity-cli/agents/msd-*)',
|
||||
'read_file(~/.gemini/antigravity-cli/skills/msd-*)',
|
||||
'command(node ~/.gemini/antigravity-cli/hooks/*)',
|
||||
'read_file(~/.msd/antigravity/msd-core/)',
|
||||
'command(node ~/.gemini/antigravity-cli/hooks/)',
|
||||
`read_file(${root}/msd-core/*)`,
|
||||
],
|
||||
},
|
||||
}, null, 2));
|
||||
|
||||
configureAntigravityPermissions(true, root);
|
||||
|
||||
const settings = JSON.parse(fs.readFileSync(path.join(root, 'settings.json'), 'utf8'));
|
||||
assert.ok(settings.permissions.allow.includes('command(git)'), 'unrelated user rule preserved');
|
||||
for (const rule of settings.permissions.allow) {
|
||||
assert.ok(!rule.includes('*'), `legacy glob rule must be stripped: ${rule}`);
|
||||
assert.ok(!rule.includes('~/'), `legacy tilde rule must be stripped: ${rule}`);
|
||||
}
|
||||
assert.ok(settings.permissions.allow.includes(`read_file(${root}/msd-core/)`));
|
||||
assert.ok(settings.permissions.allow.includes(`command(node ${root}/hooks/)`));
|
||||
});
|
||||
|
||||
test('configureAntigravityPermissions is idempotent — a second call adds no duplicate rules', (t) => {
|
||||
const root = fs.mkdtempSync(path.join(require('node:os').tmpdir(), 'msd-ag-perm-idem-'));
|
||||
t.after(() => cleanup(root));
|
||||
|
||||
@@ -223,7 +223,7 @@ describe('#1928 Antigravity preserved (shared surface with the removed gemini ru
|
||||
const toolsBlock = result.slice(result.indexOf('tools:')).split('\n').filter((l) => l.startsWith('- '));
|
||||
assert.ok(toolsBlock.includes('- view_file'), 'Read → view_file (native name, #4705)');
|
||||
assert.ok(toolsBlock.includes('- write_file'), 'Write → write_file');
|
||||
assert.ok(toolsBlock.includes('- web_fetch'), 'WebFetch → web_fetch');
|
||||
assert.ok(toolsBlock.includes('- read_url_content'), 'WebFetch → read_url_content');
|
||||
assert.ok(!toolsBlock.some((l) => /\bskill\b/.test(l)), 'Skill is still excluded (would be an invalid backend tool name)');
|
||||
});
|
||||
|
||||
@@ -251,8 +251,10 @@ describe('#1928 Antigravity preserved (shared surface with the removed gemini ru
|
||||
'the retired gemini-named function must not still be exported — a surviving alias means the rename never finished',
|
||||
);
|
||||
|
||||
// The #4727 rename remains a pure identifier change: same KEYS, same shape
|
||||
// (an added OR removed key still fails). The VALUES moved from the Gemini
|
||||
// The #4727 rename remains a pure identifier change (an added OR removed
|
||||
// key still fails). TodoWrite left the map on purpose: Antigravity has no
|
||||
// registered equivalent, and its old `write_todos` value stopped agents
|
||||
// from starting. The VALUES moved from the Gemini
|
||||
// CLI dialect to Antigravity-native names in #4705 — Antigravity's own
|
||||
// documented subagent contract (antigravity.google/docs/subagents) names
|
||||
// view_file / replace_file_content / grep_search / run_command as native,
|
||||
@@ -264,12 +266,11 @@ describe('#1928 Antigravity preserved (shared surface with the removed gemini ru
|
||||
Write: 'write_file',
|
||||
Edit: 'replace_file_content',
|
||||
Bash: 'run_command',
|
||||
Glob: 'glob',
|
||||
Glob: 'find_by_name',
|
||||
Grep: 'grep_search',
|
||||
WebSearch: 'google_web_search',
|
||||
WebFetch: 'web_fetch',
|
||||
TodoWrite: 'write_todos',
|
||||
}, 'the tool map keys are the #4727 rename surface (add/remove still fails); the VALUES are the #4705 Antigravity-native vocabulary');
|
||||
WebSearch: 'search_web',
|
||||
WebFetch: 'read_url_content',
|
||||
}, 'the tool map keys are the #4727 rename surface (add/remove still fails); the VALUES are names the Antigravity tool registry resolves');
|
||||
|
||||
// In-set / out-of-set boundary pair: the excluded ids still return null individually...
|
||||
for (const excluded of ['mcp__anything', 'Task', 'Agent', 'AskUserQuestion', 'ask_user', 'Skill', 'SlashCommand']) {
|
||||
@@ -279,12 +280,16 @@ describe('#1928 Antigravity preserved (shared surface with the removed gemini ru
|
||||
`${excluded} must still be excluded from the Antigravity tool dialect after the rename`,
|
||||
);
|
||||
}
|
||||
// ...and an unmapped name still falls through to the lowercase default.
|
||||
assert.strictEqual(
|
||||
mod.convertAntigravityToolName('SomeOtherTool'),
|
||||
'someothertool',
|
||||
'an unmapped tool name must still lowercase-fallback after the rename',
|
||||
);
|
||||
// ...and an unmapped name is dropped too: Antigravity refuses to start an
|
||||
// agent that grants a name its registry does not know, so a lowercased
|
||||
// guess would break the agent.
|
||||
for (const unmapped of ['SomeOtherTool', 'TodoWrite', 'constructor']) {
|
||||
assert.strictEqual(
|
||||
mod.convertAntigravityToolName(unmapped),
|
||||
null,
|
||||
`${unmapped} has no registered Antigravity tool and must be dropped`,
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1166,10 +1166,41 @@ process.env.MSD_TEST_MODE = '1';
|
||||
const { describe, test } = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
|
||||
const { convertClaudeToAntigravityContent } = require('../bin/install.js');
|
||||
const { convertClaudeToAntigravityContent, setAntigravityGlobalHomePrefix } = require('../bin/install.js');
|
||||
|
||||
describe('convertClaudeToAntigravityContent bare path replacement (#2418)', () => {
|
||||
describe('global install', () => {
|
||||
// The converter writes the configHome the installer resolved. Pin it so
|
||||
// these assertions do not depend on which ~/.gemini/antigravity* dirs the
|
||||
// machine running the tests happens to have.
|
||||
const { beforeEach, afterEach } = require('node:test');
|
||||
beforeEach(() => setAntigravityGlobalHomePrefix('$HOME/.gemini/antigravity/'));
|
||||
afterEach(() => setAntigravityGlobalHomePrefix(null));
|
||||
|
||||
test('routes msd-core outside ~/.gemini/ and keeps non-msd-core configHome refs pinned', () => {
|
||||
setAntigravityGlobalHomePrefix('$HOME/.gemini/antigravity-cli/');
|
||||
const result = convertClaudeToAntigravityContent(
|
||||
'@~/.claude/msd-core/workflows/ui-phase.md\nnode "$HOME/.claude/msd-core/bin/msd-tools.cjs"\ndir = ~/.claude',
|
||||
true,
|
||||
);
|
||||
assert.strictEqual(
|
||||
result,
|
||||
'@~/.msd/antigravity/msd-core/workflows/ui-phase.md\nnode "$HOME/.msd/antigravity/msd-core/bin/msd-tools.cjs"\ndir = ~/.gemini/antigravity-cli',
|
||||
);
|
||||
});
|
||||
|
||||
test('an explicit config dir outside the home directory is written as an absolute path', () => {
|
||||
setAntigravityGlobalHomePrefix('/opt/agy-work/');
|
||||
const result = convertClaudeToAntigravityContent('@~/.claude/msd-core/x.md and $HOME/.claude/msd-core/y.md', true);
|
||||
assert.strictEqual(result, '@/opt/agy-work/msd-core/x.md and /opt/agy-work/msd-core/y.md');
|
||||
});
|
||||
|
||||
test('the pin does not move the skills dir or affect local installs', () => {
|
||||
setAntigravityGlobalHomePrefix('$HOME/.gemini/antigravity-cli/');
|
||||
assert.strictEqual(convertClaudeToAntigravityContent('ls ~/.claude/skills/', true), 'ls ~/.gemini/config/skills/');
|
||||
assert.strictEqual(convertClaudeToAntigravityContent('See ~/.claude/msd-core/', false), 'See .agents/msd-core/');
|
||||
});
|
||||
|
||||
test('replaces ~/.claude (bare, no trailing slash) with ~/.gemini/antigravity', () => {
|
||||
const input = 'configDir = ~/.claude';
|
||||
const result = convertClaudeToAntigravityContent(input, true);
|
||||
@@ -1209,7 +1240,7 @@ describe('convertClaudeToAntigravityContent bare path replacement (#2418)', () =
|
||||
const input = 'See ~/.claude/msd-core/workflows/';
|
||||
const result = convertClaudeToAntigravityContent(input, true);
|
||||
assert.ok(
|
||||
result.includes('~/.gemini/antigravity/msd-core/workflows/'),
|
||||
result.includes('~/.msd/antigravity/msd-core/workflows/'),
|
||||
`Expected path with trailing slash to be replaced, got: ${result}`
|
||||
);
|
||||
assert.ok(!result.includes('~/.claude/'), `Expected ~/ .claude/ to be fully replaced, got: ${result}`);
|
||||
@@ -1219,7 +1250,7 @@ describe('convertClaudeToAntigravityContent bare path replacement (#2418)', () =
|
||||
const input = 'See ~/.claude/msd-core/';
|
||||
const result = convertClaudeToAntigravityContent(input, true);
|
||||
// Result should contain exactly one occurrence of the replacement path
|
||||
const count = (result.match(/~\/.gemini\/antigravity\//g) || []).length;
|
||||
const count = (result.match(/~\/\.msd\/antigravity\/msd-core\//g) || []).length;
|
||||
assert.strictEqual(count, 1, `Expected exactly 1 replacement, got ${count} in: ${result}`);
|
||||
});
|
||||
|
||||
@@ -1262,12 +1293,12 @@ describe('convertClaudeToAntigravityContent bare path replacement (#2418)', () =
|
||||
);
|
||||
});
|
||||
|
||||
test('keeps msd-core references under ~/.gemini/antigravity when a skills ref is present (#3738)', () => {
|
||||
test('routes msd-core references to ~/.msd/antigravity/msd-core when a skills ref is present (#3738)', () => {
|
||||
const input = 'Read ~/.claude/msd-core/workflows/x.md then list ~/.claude/skills/.';
|
||||
const result = convertClaudeToAntigravityContent(input, true);
|
||||
assert.ok(
|
||||
result.includes('~/.gemini/antigravity/msd-core/workflows/x.md'),
|
||||
`msd-core ref must stay under configHome, got: ${result}`
|
||||
result.includes('~/.msd/antigravity/msd-core/workflows/x.md'),
|
||||
`msd-core ref must live outside ~/.gemini/, got: ${result}`
|
||||
);
|
||||
assert.ok(
|
||||
result.includes('~/.gemini/config/skills/'),
|
||||
@@ -5909,6 +5940,49 @@ describe('#3738: antigravity global artifacts install under ~/.gemini/config', (
|
||||
'no agents dir may be created under the CLI configHome — agy never reads it (#3747 silent drop)'
|
||||
);
|
||||
});
|
||||
|
||||
// The engine (msd-core/workflows, references, bin) installs into the resolved
|
||||
// Skill and agent bodies must reference ~/.msd/antigravity/msd-core/ (outside
|
||||
// ~/.gemini/, which Antigravity CLI protects with a hardcoded boundary rule)
|
||||
// and must never point at ~/.gemini/antigravity{,-ide,-cli}/msd-core/.
|
||||
test('CLI-only install: skill and agent bodies reference ~/.msd/antigravity/msd-core/, not ~/.gemini/antigravity*', (t) => {
|
||||
const { resolveAntigravityGlobalDir } = require('../msd-core/bin/lib/runtime-homes.cjs');
|
||||
const home = createTempDir('msd-antigravity-cli-refs-');
|
||||
t.after(() => cleanup(home));
|
||||
sandboxHome(t, home);
|
||||
|
||||
const cliConfigHome = path.join(home, '.gemini', 'antigravity-cli');
|
||||
fs.mkdirSync(cliConfigHome, { recursive: true });
|
||||
const resolved = resolveAntigravityGlobalDir({ home, env: {}, existsSync: fs.existsSync });
|
||||
assert.strictEqual(resolved, cliConfigHome, 'test premise: configHome resolves to the CLI dir');
|
||||
|
||||
installRuntimeArtifacts('antigravity', resolved, 'global', RESOLVED_CORE);
|
||||
|
||||
const discoveryHome = path.join(home, '.gemini', 'config');
|
||||
const bodies = [];
|
||||
for (const dir of fs.readdirSync(path.join(discoveryHome, 'skills'))) {
|
||||
bodies.push(path.join(discoveryHome, 'skills', dir, 'SKILL.md'));
|
||||
}
|
||||
for (const file of fs.readdirSync(path.join(discoveryHome, 'agents'))) {
|
||||
bodies.push(path.join(discoveryHome, 'agents', file));
|
||||
}
|
||||
// allow-test-rule: source-text-is-the-product — installed prompt bodies are the emitted artifact.
|
||||
const validEngineRef = /(?:~|\$HOME)\/\.msd\/antigravity\/msd-core\//g;
|
||||
const blockedGeminiRef = /(?:~|\$HOME)\/\.gemini\/antigravity(?:-ide|-cli)?\/msd-core\//g;
|
||||
const wrong = [];
|
||||
let total = 0;
|
||||
for (const file of bodies.filter((f) => fs.existsSync(f))) {
|
||||
const text = fs.readFileSync(file, 'utf8');
|
||||
for (const _match of text.matchAll(validEngineRef)) {
|
||||
total += 1;
|
||||
}
|
||||
for (const match of text.matchAll(blockedGeminiRef)) {
|
||||
wrong.push(`${path.relative(discoveryHome, file)}: ${match[0]}`);
|
||||
}
|
||||
}
|
||||
assert.ok(total > 0, 'test premise: installed bodies reference the msd-core engine at ~/.msd/antigravity/msd-core/');
|
||||
assert.deepStrictEqual(wrong, [], 'no engine reference may point inside ~/.gemini/antigravity* (blocked by AGY protection boundary)');
|
||||
});
|
||||
});
|
||||
|
||||
// ── #4667 — codex installs must not keep @~/.claude includes ──────────────────
|
||||
|
||||
@@ -300,7 +300,7 @@ tools: Read, Write, Bash, Skill, WebFetch, SlashCommand
|
||||
const toolsItems = result.split('\n').filter(l => l.startsWith('- ')).map(l => l.slice(2));
|
||||
|
||||
assert.ok(toolsItems.includes('view_file'), 'maps Read -> view_file (#4705 native name)');
|
||||
assert.ok(toolsItems.includes('web_fetch'), 'maps WebFetch -> web_fetch');
|
||||
assert.ok(toolsItems.includes('read_url_content'), 'maps WebFetch -> read_url_content');
|
||||
assert.ok(!toolsItems.some(t => /\bskill\b/.test(t)), 'no invalid skill tool in Antigravity frontmatter');
|
||||
assert.ok(!toolsItems.some(t => /\bslashcommand\b/.test(t)), 'no invalid slashcommand tool in Antigravity frontmatter');
|
||||
});
|
||||
@@ -2455,10 +2455,42 @@ Inspect source files.`;
|
||||
assert.ok(!/- replace\b/.test(result), 'the Gemini CLI name replace must not survive');
|
||||
});
|
||||
|
||||
test('unmapped tools keep their lowercase grant (no silent restriction drop) (#4705)', () => {
|
||||
// Antigravity CLI resolves every `tools:` entry against a strict registry and
|
||||
// refuses to start the agent on the first unknown name ("unknown component:
|
||||
// tool \"glob\" not found in registry"). glob / google_web_search / web_fetch
|
||||
// were Gemini CLI names that registry does not carry.
|
||||
const toolItems = (result) => result.split('\n').filter((l) => l.startsWith('- ')).map((l) => l.slice(2));
|
||||
|
||||
test('Glob, WebSearch and WebFetch map to names the Antigravity registry resolves', () => {
|
||||
const result = convertClaudeAgentToAntigravityAgent(
|
||||
`---\nname: e\ndescription: d\ntools: Glob, WebFetch\n---\n\nbody`);
|
||||
assert.match(result, /- glob/, 'undocumented tools keep their mapped/lowercase grant');
|
||||
assert.match(result, /- web_fetch/, 'WebFetch stays granted');
|
||||
`---\nname: e\ndescription: d\ntools: Glob, WebSearch, WebFetch\n---\n\nbody`);
|
||||
assert.deepStrictEqual(toolItems(result), ['find_by_name', 'search_web', 'read_url_content']);
|
||||
});
|
||||
|
||||
test('a tool with no registered Antigravity equivalent is dropped, not lowercased', () => {
|
||||
const result = convertClaudeAgentToAntigravityAgent(
|
||||
`---\nname: e\ndescription: d\ntools: Read, TodoWrite, NotebookEdit\n---\n\nbody`);
|
||||
assert.deepStrictEqual(toolItems(result), ['view_file'],
|
||||
'an unknown name in tools: stops the whole agent from starting, so unmapped tools must not be emitted');
|
||||
});
|
||||
|
||||
test('every shipped MSD agent converts to registered Antigravity tool names only', () => {
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const agentsDir = path.join(__dirname, '..', 'agents');
|
||||
// Names confirmed against the Antigravity CLI tool registry.
|
||||
const registered = new Set([
|
||||
'view_file', 'write_file', 'replace_file_content', 'run_command',
|
||||
'grep_search', 'find_by_name', 'search_web', 'read_url_content',
|
||||
]);
|
||||
const offenders = [];
|
||||
for (const file of fs.readdirSync(agentsDir).filter((f) => f.endsWith('.md'))) {
|
||||
const converted = convertClaudeAgentToAntigravityAgent(fs.readFileSync(path.join(agentsDir, file), 'utf8'), true);
|
||||
const frontmatter = converted.slice(0, converted.indexOf('\n---', 4));
|
||||
for (const tool of toolItems(frontmatter)) {
|
||||
if (!registered.has(tool)) offenders.push(`${file}: ${tool}`);
|
||||
}
|
||||
}
|
||||
assert.deepStrictEqual(offenders, []);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user