Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

fix(cli): only the first "--" ends option parsing, not every occurrence (#4310) (#4314)

rUve0a972ce82c3
diff --git a/v3/@claude-flow/cli/__tests__/parser.test.ts b/v3/@claude-flow/cli/__tests__/parser.test.ts
index 00e3b670ea..d34b0dc8d6 100644
--- a/v3/@claude-flow/cli/__tests__/parser.test.ts
+++ b/v3/@claude-flow/cli/__tests__/parser.test.ts
@@ -196,6 +196,19 @@ describe('CommandParser', () => {
const result = parser.parse(['--', 'a', 'b']);
expect(result.positional).toEqual(['a', 'b']);
});
+
+ it('should treat a literal "--" after the first marker as positional, not a second marker (#4310)', () => {
+ const result = parser.parse(['--', '--', 'needle']);
+ expect(result.positional).toEqual(['--', 'needle']);
+ });
+
+ it('should preserve a literal "--" positional following a recognized command (#4310)', () => {
+ const cmd: Command = { name: 'task', description: 'Task mgmt' };
+ parser.registerCommand(cmd);
+
+ const result = parser.parse(['task', '--', '--', 'needle']);
+ expect(result.positional).toEqual(['--', 'needle']);
+ });
});
// -------------------------------------------------------------------------
diff --git a/v3/@claude-flow/cli/src/parser.ts b/v3/@claude-flow/cli/src/parser.ts
index 4b9d0239fb..e11eaba869 100644
--- a/v3/@claude-flow/cli/src/parser.ts
+++ b/v3/@claude-flow/cli/src/parser.ts
@@ -216,8 +216,9 @@ export class CommandParser {
while (i < args.length) {
const arg = args[i];
- // Check for end of flags marker
- if (arg === '--') {
+ // Check for end of flags marker. Only the first "--" changes parser
+ // state; a later literal "--" is an ordinary positional (#4310).
+ if (parsingFlags && arg === '--') {
parsingFlags = false;
i++;
continue;