Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(schema): add-type --json=true prints the JSON document (the output mode read only the exact token); pin sync unblock --status and the restart parse fallback

garrytan665156a8db98
diff --git a/src/commands/schema.ts b/src/commands/schema.ts
index 7fdabbedc9..0cf730727d 100644
--- a/src/commands/schema.ts
+++ b/src/commands/schema.ts
@@ -1150,7 +1150,7 @@ function runReloadCmd(args: string[]): void {
}
async function runAddTypeCmd(args: string[]): Promise<void> {
- const { json } = parseFlags(args);
+ const json = parseFlags(args).json || args.includes('--json=true');
const { parseAddTypeArgs, NO_PREFIX_NOTE } = await import('./schema-add-type.ts');
let parsed: import('./schema-add-type.ts').AddTypeArgs;
try {
diff --git a/test/cli-flag-equals.test.ts b/test/cli-flag-equals.test.ts
index 5ca33d52c3..61ed955498 100644
--- a/test/cli-flag-equals.test.ts
+++ b/test/cli-flag-equals.test.ts
@@ -652,6 +652,7 @@ describe('#7619 refusals that keep consent, scope and targets right', () => {
expect(syncOperatorVerb(args)).toBe('status');
expect(await argvFor('sync', args)).toEqual(args);
expect(await refusalFor('sync', ['trigger', '--status', '--limit=5'])).toContain('--limit=…');
+ expect(await refusalFor('sync', ['unblock', '--status', '--limit=5'])).toContain('--limit=…');
});
test('an unknown or miscased flag with a multi-line = value is still unknown', () => {
diff --git a/test/serve-flag-equals.test.ts b/test/serve-flag-equals.test.ts
index 4aa533ee02..882d6f4c25 100644
--- a/test/serve-flag-equals.test.ts
+++ b/test/serve-flag-equals.test.ts
@@ -186,4 +186,12 @@ describe('serve --flag=value', () => {
expect(r.status).toBe(0);
expect(r.stdout).toContain('gbrain serve');
});
+
+ // Value: protects=schema add-type's own parser accepting --json=true also prints the JSON document; fails_when=the output mode reads only the exact --json token; why_new=the parser pin never checked the output; seam=none; no_claim=other own parsers
+ test('schema add-type --json=true prints the JSON document', () => {
+ expect(cli(['schema', 'fork', 'gbrain-base', 'pack-example']).status).toBe(0);
+ const r = cli(['schema', 'add-type', 'widget-example', '--primitive', 'entity', '--no-prefix', '--pack', 'pack-example', '--json=true']);
+ expect(r.status).toBe(0);
+ expect(JSON.parse(r.stdout)).toMatchObject({ pack: 'pack-example' });
+ });
});
diff --git a/test/upgrade-restart.test.ts b/test/upgrade-restart.test.ts
index ad3fbba037..8125714b63 100644
--- a/test/upgrade-restart.test.ts
+++ b/test/upgrade-restart.test.ts
@@ -80,6 +80,8 @@ describe('supervisorRestartArgv', () => {
expect(parseGlobalFlags([...argv]).cliOpts.brain).toBe('work');
expect(supervisorRestartArgv(argv).start).toEqual(['gbrain', 'jobs', 'supervisor', 'start', '--detach', '--brain=work', '--timeout=30s', '--queue', 'ingest', '--progress-interval=500', '--json']);
for (const flag of EQUALS_READERS['jobs supervisor'] ?? []) expect(supervisorRestartArgv(['jobs', 'supervisor', 'start', `${flag}=x`]).start).toContain(`${flag}=x`);
+ expect(() => parseGlobalFlags(['jobs', 'supervisor', 'start', '--wait=abc'])).toThrow();
+ expect(supervisorRestartArgv(['jobs', 'supervisor', 'start', '--wait=abc', '--concurrency=4']).start).toEqual(['gbrain', 'jobs', 'supervisor', 'start', '--detach', '--wait=abc', '--concurrency=4', '--json']);
});
});