Skip to content

feat: add scope-based session management#150

Open
hawkeyexl wants to merge 7 commits intomainfrom
scopes
Open

feat: add scope-based session management#150
hawkeyexl wants to merge 7 commits intomainfrom
scopes

Conversation

@hawkeyexl
Copy link
Contributor

@hawkeyexl hawkeyexl commented Jan 6, 2026

Summary

  • Added scope property to runShell, runCode, and type actions for persistent terminal/code sessions
  • Added waitUntil property to runShell and runCode for condition-based waiting on stdout/stderr patterns
  • Created new terminateScope action for process lifecycle management with SIGTERM/SIGKILL handling
  • All scope names validated with pattern: ^[a-zA-Z0-9_-]{1,64}$
  • Includes comprehensive examples and maintains backwards compatibility

Test Plan

  • All 318 tests passing
  • New examples validate successfully (scope, waitUntil, terminateScope)
  • Generated schemas properly built and published
  • Pattern validation consistent across all schemas
  • No breaking changes to existing functionality

Summary by CodeRabbit

  • New Features
    • Added scoped process management enabling persistent terminal and code sessions across steps
    • Added wait conditions for commands to control execution flow based on stdout/stderr patterns
    • Added terminate scope operation to explicitly end named processes and sessions
    • Enhanced drag-and-drop action support for complex UI interactions
    • Enabled superpowers marketplace plugin for extended platform capabilities

✏️ Tip: You can customize this high-level summary in your review settings.

hawkeyexl and others added 7 commits January 5, 2026 19:32
Add scope property for persistent terminal sessions and waitUntil
property for condition-based waiting on stdout/stderr output.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add scope property for persistent code execution sessions and
waitUntil property for condition-based waiting on stdout/stderr.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add scope property to allow typing into scoped terminal or code
sessions for interactive command support.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add new action to terminate named scopes and their processes.
Supports both simple string and detailed object formats.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add terminateScope to the list of available step actions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Update generated schemas with scope, waitUntil, and terminateScope.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 6, 2026

Walkthrough

This PR introduces session and scope management across the schema definitions by adding a scope property to command and action objects, enabling commands to target named execution contexts. It creates a new terminateScope operation for managing named scope lifecycles and adds configuration files for development settings and permissions.

Changes

Cohort / File(s) Summary
Configuration Setup
.claude/settings.json, .claude/settings.local.json
Enables superpowers plugin and configures permissions for bash commands, git operations, and skill-based actions.
Schema Processing Pipeline
src/schemas/dereferenceSchemas.js
Adds terminateScope_v3.schema.json to the list of v3 schema files processed for dereferencing and distribution.
New terminateScope Schemas
src/schemas/src_schemas/terminateScope_v3.schema.json, src/schemas/output_schemas/terminateScope_v3.schema.json
Introduces new schema defining the terminateScope operation with simple (string) and detailed (object) variants, including pattern validation for scope names.
Command Execution Schemas
src/schemas/src_schemas/runShell_v3.schema.json, src/schemas/src_schemas/runCode_v3.schema.json, src/schemas/output_schemas/runShell_v3.schema.json, src/schemas/output_schemas/runCode_v3.schema.json
Adds scope property (alphanumeric with hyphens/underscores, 1-64 chars) and waitUntil object with stdio pattern matching for stdout/stderr to enable persistent session management and condition-based step completion.
Interactive Input Schemas
src/schemas/src_schemas/type_v3.schema.json, src/schemas/output_schemas/type_v3.schema.json, src/schemas/output_schemas/find_v3.schema.json
Adds scope property to enable typing/input operations on scoped terminal or code sessions rather than the browser context.
Step Definition Schemas
src/schemas/src_schemas/step_v3.schema.json, src/schemas/output_schemas/step_v3.schema.json
Introduces scope and waitUntil properties across various step actions; adds new terminateScope step operation with supporting component schemas and examples.
Comprehensive Test/Report Schemas
src/schemas/output_schemas/config_v3.schema.json, src/schemas/output_schemas/spec_v3.schema.json, src/schemas/output_schemas/report_v3.schema.json, src/schemas/output_schemas/test_v3.schema.json
Systematically adds scope property to multiple command objects (runShell, runCode, httpRequest, screenshot, cookie operations, etc.); report and test schemas also introduce waitUntil conditions, dragAndDrop configurations, and extended action type support for granular session and process control.
Minor Formatting
src/schemas/output_schemas/endRecord_v3.schema.json
Whitespace-only formatting changes; no semantic modifications.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰 A scope for each session, a name for each task,
Commands now targeted, no more to unmask.
From dev-server humming to logs in their place,
Persistent and scoped, they'll finish the race!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title "feat: add scope-based session management" accurately summarizes the main change—introducing scope-based functionality for persistent terminal/code session management across multiple schema actions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI Agents
In @.claude/settings.local.json:
- Around line 1-18: The file .claude/settings.local.json is developer-specific
and should not be tracked; add ".claude/settings.local.json" to .gitignore, run
git rm --cached .claude/settings.local.json to stop tracking it, add a template
.claude/settings.local.json.example (or update docs) that shows the expected
permissions format for local overrides, and ensure any shared configuration
remains in .claude/settings.json.

In @src/schemas/output_schemas/test_v3.schema.json:
- Around line 6667-6799: The terminateScope schema's "scope" description lacks a
defined SIGTERM→SIGKILL grace period; update the "scope" property description
inside the terminateScope anyOf object (and its counterpart in the
components.schemas.object) to state the exact behavior: either document the
fixed duration (e.g., "process will receive SIGTERM, followed by SIGKILL after X
seconds"), or indicate it's configurable and name the config key (e.g.,
"controlled by <configName>"), or add an optional property (e.g., "gracePeriod"
with type integer and seconds) to the terminateScope object variant; ensure both
the inline object (properties.scope) and the components.schemas.object.scope
description are updated and examples adjusted if you add a new property.
🧹 Nitpick comments (11)
src/schemas/src_schemas/step_v3.schema.json (1)

294-309: Add an example for the new terminateScope action type.

The schema properly integrates the new terminateScope action into the step definition (lines 294-309). However, the examples array lacks a demonstration of how to use this new action type, which is inconsistent with the pattern for other action types like find, click, and httpRequest.

Consider adding an example in the examples array to demonstrate terminateScope usage:

🔎 Suggested example for terminateScope
     {
       "dragAndDrop": {
         "source": {
           "selector": "#sourceElement"
         },
         "target": {
           "selector": "#targetElement"
         }
       }
     }
+  ],
+  "terminateScope": "session_name"
+}

Or, if your terminateScope_v3.schema.json has multiple examples, you can use $ref like the other complex actions:

   {
     "dragAndDrop": {
       "source": {
         "selector": "#sourceElement"
       },
       "target": {
         "selector": "#targetElement"
       }
     }
+  },
+  {
+    "terminateScope": {
+      "$ref": "terminateScope_v3.schema.json#/examples/0"
+    }
   }
 ]
src/schemas/output_schemas/runCode_v3.schema.json (1)

117-120: Consider adding additionalProperties: false for stricter validation.

The runShell_v3.schema.json schema includes "additionalProperties": false on the detailed object (line 19 and 136), but runCode_v3.schema.json lacks this constraint. For consistency and to prevent typos from silently passing validation, consider adding this restriction.

🔎 Proposed fix
       }
     },
+    "additionalProperties": false,
     "title": "Run code (detailed)"
   }
 ],
src/schemas/output_schemas/config_v3.schema.json (2)

4605-4626: Consider requiring at least one condition in waitUntil.stdio.

The waitUntil.stdio object allows both stdout and stderr to be omitted, making waitUntil: { stdio: {} } valid but meaningless. Consider adding a minProperties: 1 constraint to stdio or documenting that at least one pattern should be specified.

This would need to be addressed in the source schema (likely runShell_v3.schema.json).

🔎 Suggested schema refinement
 "stdio": {
   "type": "object",
   "description": "Standard I/O stream conditions to wait for.",
   "additionalProperties": false,
+  "minProperties": 1,
   "properties": {
     "stdout": {

6936-6942: Consider adding a configurable gracePeriod property.

The description mentions "SIGTERM, followed by SIGKILL after a grace period" but there's no way to configure this duration. For processes that need more time to shut down gracefully (e.g., database connections, file flushes), a configurable grace period would be useful.

🔎 Example enhancement for detailed form
 "properties": {
   "scope": {
     "type": "string",
     "description": "Name of the scope to terminate. The associated process will receive SIGTERM, followed by SIGKILL after a grace period if still running.",
     "pattern": "^[a-zA-Z0-9_-]{1,64}$"
+  },
+  "gracePeriod": {
+    "type": "integer",
+    "description": "Time in milliseconds to wait after SIGTERM before sending SIGKILL. Defaults to 5000ms.",
+    "default": 5000,
+    "minimum": 0
   }
 },
src/schemas/output_schemas/step_v3.schema.json (3)

1213-1218: Scope support for type/typeKeys is consistent; just watch browser vs terminal semantics

The new scope fields on the detailed typeKeys objects (for find.type and the type step) are wired consistently and reuse the same validation pattern and description as the shell/code scopes. That looks solid and keeps the schema shapes aligned.

One subtle point: the schema allows combining scope with element‑targeting fields (selector, elementText, etc.), even though those are browser concepts while scope routes input to a terminal/code session. If the runtime treats scope as taking precedence and ignores DOM targeting in that case, it might be worth tightening behavior or at least documenting that precedence to avoid confusion, but this isn’t a blocker from a schema perspective.

Also applies to: 1324-1330, 1876-1881, 1988-1993, 4582-4587, 4694-4699, 4731-4735


3811-3841: runShell/runCode scope and waitUntil wiring looks good; consider validating non‑empty conditions

The additions of scope and waitUntil.stdio.{stdout,stderr} to both runShell and runCode are internally consistent (main and components.schemas.object branches match, examples exercise the new behavior, and the scope pattern is uniform).

Right now waitUntil can be an empty object, or waitUntil: { stdio: {} }, which effectively does nothing but still “looks” configured. If you want to catch misconfigurations early, you could add a small constraint (e.g., an anyOf requiring at least one of stdout/stderr when stdio is present, or at least one known key under waitUntil). That would tighten feedback for users without changing the core design.

Also applies to: 3927-3958, 4013-4039, 4199-4229, 4317-4347, 4386-4406


6068-6200: New terminateScope step is well‑shaped; ensure it stays in sync with terminateScope_v3

The terminateScope step block follows the existing pattern (Common + action object), supports both simple string and detailed object forms, and uses the same scope name pattern and description as the other scoped actions. Including $schema here also matches the self‑describing schema convention for linting. Based on learnings, this is aligned with how other v3 action schemas are structured.

To avoid future drift, it would be helpful to double‑check that src/schemas/output_schemas/terminateScope_v3.schema.json (and any generator templates) define the exact same anyOf/pattern/description, or to have them generated from a single source of truth.

src/schemas/output_schemas/spec_v3.schema.json (2)

5020-5041: Consider requiring at least one condition when waitUntil is specified.

The waitUntil structure allows empty objects (e.g., waitUntil: {} or waitUntil: { stdio: {} }), which would be valid but semantically meaningless. If the intent is that specifying waitUntil should always include at least one condition, consider adding validation.

For example, you could require at least one of stdout or stderr when stdio is present, or require stdio when waitUntil is present.


7361-7385: Consider removing redundant components.schemas duplication.

The components.schemas section (lines 7361-7385) duplicates the schema definitions already present in the anyOf array above. This duplication could lead to maintenance issues if the schemas diverge.

If this is auto-generated for OpenAPI compatibility or tooling purposes, you may safely ignore this observation. Otherwise, consider whether this duplication serves a necessary purpose.

src/schemas/output_schemas/report_v3.schema.json (2)

5038-5059: Consider requiring at least one stdio condition in waitUntil.

The waitUntil.stdio object allows both stdout and stderr to be optional, meaning waitUntil: { stdio: {} } is schema-valid but functionally meaningless. Consider adding a minProperties: 1 constraint to the stdio object or using a oneOf/anyOf to require at least one pattern.

This is a minor edge case and may be acceptable if validation is handled at runtime.

Suggested schema constraint
                                              "stdio": {
                                                "type": "object",
                                                "description": "Standard I/O stream conditions to wait for.",
                                                "additionalProperties": false,
+                                               "minProperties": 1,
                                                "properties": {

7379-7402: components.schemas section duplicates the anyOf definitions.

The terminateScope schema contains a components.schemas section (lines 7379-7402) that duplicates the type definitions already present in the anyOf array. This OpenAPI-style embedding is unusual for pure JSON Schema.

If this duplication is intentional for documentation tooling or external consumers, it's fine. Otherwise, consider removing it to reduce maintenance burden and file size.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8c9891d and 51f9925.

⛔ Files ignored due to path filters (11)
  • dist/schemas/config_v3.schema.json is excluded by !**/dist/**
  • dist/schemas/find_v3.schema.json is excluded by !**/dist/**
  • dist/schemas/report_v3.schema.json is excluded by !**/dist/**
  • dist/schemas/resolvedTests_v3.schema.json is excluded by !**/dist/**
  • dist/schemas/runCode_v3.schema.json is excluded by !**/dist/**
  • dist/schemas/runShell_v3.schema.json is excluded by !**/dist/**
  • dist/schemas/spec_v3.schema.json is excluded by !**/dist/**
  • dist/schemas/step_v3.schema.json is excluded by !**/dist/**
  • dist/schemas/terminateScope_v3.schema.json is excluded by !**/dist/**
  • dist/schemas/test_v3.schema.json is excluded by !**/dist/**
  • dist/schemas/type_v3.schema.json is excluded by !**/dist/**
📒 Files selected for processing (21)
  • .claude/settings.json
  • .claude/settings.local.json
  • src/schemas/dereferenceSchemas.js
  • src/schemas/output_schemas/config_v3.schema.json
  • src/schemas/output_schemas/endRecord_v3.schema.json
  • src/schemas/output_schemas/find_v3.schema.json
  • src/schemas/output_schemas/report_v3.schema.json
  • src/schemas/output_schemas/resolvedTests_v3.schema.json
  • src/schemas/output_schemas/runCode_v3.schema.json
  • src/schemas/output_schemas/runShell_v3.schema.json
  • src/schemas/output_schemas/spec_v3.schema.json
  • src/schemas/output_schemas/step_v3.schema.json
  • src/schemas/output_schemas/terminateScope_v3.schema.json
  • src/schemas/output_schemas/test_v3.schema.json
  • src/schemas/output_schemas/type_v3.schema.json
  • src/schemas/schemas.json
  • src/schemas/src_schemas/runCode_v3.schema.json
  • src/schemas/src_schemas/runShell_v3.schema.json
  • src/schemas/src_schemas/step_v3.schema.json
  • src/schemas/src_schemas/terminateScope_v3.schema.json
  • src/schemas/src_schemas/type_v3.schema.json
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{js,ts}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{js,ts}: Always clone objects using JSON.parse(JSON.stringify(object)) before validation to avoid mutations
validate() returns { valid, errors, object } and never throws; handle errors via return object
transformToSchemaKey() throws on incompatible schemas or invalid results; catch exceptions when calling this function
readFile() returns null on errors and logs warnings to console; do not assume errors throw exceptions
resolvePaths() throws on invalid object types or missing nested object types; validate inputs before calling
Do not assume validation mutates objects; always handle the returned validated object

Files:

  • src/schemas/dereferenceSchemas.js
src/**/*.js

📄 CodeRabbit inference engine (AGENTS.md)

Use escapeRegExp() helper when converting user strings to regex patterns in transformToSchemaKey()

Files:

  • src/schemas/dereferenceSchemas.js
src/schemas/src_schemas/*.json

📄 CodeRabbit inference engine (AGENTS.md)

src/schemas/src_schemas/*.json: Always include examples array in all schemas (required for test generation)
In source schemas, use relative $ref paths like "$ref": "context_v3.schema.json#/properties/example"

Files:

  • src/schemas/src_schemas/type_v3.schema.json
  • src/schemas/src_schemas/step_v3.schema.json
  • src/schemas/src_schemas/runShell_v3.schema.json
  • src/schemas/src_schemas/terminateScope_v3.schema.json
  • src/schemas/src_schemas/runCode_v3.schema.json
🧠 Learnings (12)
📚 Learning: 2025-08-22T20:01:21.087Z
Learnt from: hawkeyexl
Repo: doc-detective/common PR: 134
File: src/schemas/output_schemas/report_v3.schema.json:5695-5921
Timestamp: 2025-08-22T20:01:21.087Z
Learning: The report_v3.schema.json includes dragAndDrop via inclusion in the spec schema, which includes the test and step schemas, creating a chain of schema inclusions.

Applied to files:

  • src/schemas/output_schemas/report_v3.schema.json
  • src/schemas/dereferenceSchemas.js
  • src/schemas/src_schemas/step_v3.schema.json
  • src/schemas/output_schemas/spec_v3.schema.json
  • src/schemas/output_schemas/test_v3.schema.json
📚 Learning: 2025-05-29T16:54:47.192Z
Learnt from: hawkeyexl
Repo: doc-detective/common PR: 117
File: src/schemas/output_schemas/resolvedTests_v3.schema.json:24-30
Timestamp: 2025-05-29T16:54:47.192Z
Learning: In doc-detective/common schemas, `$schema` properties within object definitions are intentionally added to allow described JSON objects to be self-describing for linting purposes. This enables JSON linters and validators to automatically validate objects against the referenced schema. The version information is embedded in the filename using the pattern `<schema>_v3.schema.json`.

Applied to files:

  • src/schemas/output_schemas/report_v3.schema.json
  • src/schemas/dereferenceSchemas.js
  • src/schemas/src_schemas/type_v3.schema.json
  • src/schemas/src_schemas/step_v3.schema.json
  • src/schemas/output_schemas/type_v3.schema.json
  • src/schemas/src_schemas/runShell_v3.schema.json
  • src/schemas/src_schemas/terminateScope_v3.schema.json
  • src/schemas/output_schemas/config_v3.schema.json
  • src/schemas/output_schemas/endRecord_v3.schema.json
  • src/schemas/output_schemas/terminateScope_v3.schema.json
  • src/schemas/output_schemas/spec_v3.schema.json
  • src/schemas/output_schemas/test_v3.schema.json
  • src/schemas/output_schemas/runShell_v3.schema.json
  • src/schemas/output_schemas/runCode_v3.schema.json
  • src/schemas/output_schemas/step_v3.schema.json
  • src/schemas/src_schemas/runCode_v3.schema.json
  • src/schemas/output_schemas/find_v3.schema.json
📚 Learning: 2025-08-22T20:01:21.087Z
Learnt from: hawkeyexl
Repo: doc-detective/common PR: 134
File: src/schemas/output_schemas/report_v3.schema.json:5695-5921
Timestamp: 2025-08-22T20:01:21.087Z
Learning: In the doc-detective/common project, dragAndDrop schema doesn't need to be explicitly added to report_v3.schema.json because all schemas in schema.json are dynamically loaded and dragAndDrop is included through that mechanism.

Applied to files:

  • src/schemas/output_schemas/report_v3.schema.json
📚 Learning: 2025-11-25T23:59:43.235Z
Learnt from: CR
Repo: doc-detective/common PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T23:59:43.235Z
Learning: Applies to src/validate.js : All step_v3 schemas must accept 12 different v2 action schemas (checkLink_v2, find_v2, etc.) via compatibleSchemas map

Applied to files:

  • src/schemas/output_schemas/report_v3.schema.json
  • src/schemas/src_schemas/step_v3.schema.json
  • src/schemas/output_schemas/config_v3.schema.json
  • src/schemas/output_schemas/spec_v3.schema.json
  • src/schemas/output_schemas/test_v3.schema.json
  • src/schemas/output_schemas/step_v3.schema.json
📚 Learning: 2025-11-25T23:59:43.235Z
Learnt from: CR
Repo: doc-detective/common PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T23:59:43.235Z
Learning: When adding new schemas, update the files array in dereferenceSchemas.js and add to published list if creating v3 schema

Applied to files:

  • src/schemas/dereferenceSchemas.js
📚 Learning: 2025-11-25T23:59:43.235Z
Learnt from: CR
Repo: doc-detective/common PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T23:59:43.235Z
Learning: Do not add schemas without updating the files array in dereferenceSchemas.js

Applied to files:

  • src/schemas/dereferenceSchemas.js
📚 Learning: 2025-11-25T23:59:43.235Z
Learnt from: CR
Repo: doc-detective/common PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T23:59:43.235Z
Learning: Applies to src/schemas/src_schemas/*.json : In source schemas, use relative $ref paths like "$ref": "context_v3.schema.json#/properties/example"

Applied to files:

  • src/schemas/dereferenceSchemas.js
  • src/schemas/src_schemas/step_v3.schema.json
  • src/schemas/output_schemas/test_v3.schema.json
📚 Learning: 2025-11-25T23:59:43.235Z
Learnt from: CR
Repo: doc-detective/common PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T23:59:43.235Z
Learning: Applies to src/validate.js : When creating new schema version (e.g., v4), update compatibleSchemas map and add transformation logic in transformToSchemaKey()

Applied to files:

  • src/schemas/dereferenceSchemas.js
  • src/schemas/src_schemas/step_v3.schema.json
📚 Learning: 2025-11-25T23:59:43.235Z
Learnt from: CR
Repo: doc-detective/common PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T23:59:43.235Z
Learning: Do not edit generated files directly: build/, output_schemas/, or schemas.json (regenerated on npm run build)

Applied to files:

  • src/schemas/dereferenceSchemas.js
📚 Learning: 2025-11-25T23:59:43.235Z
Learnt from: CR
Repo: doc-detective/common PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T23:59:43.235Z
Learning: Applies to src/validate.js : Handle schema property transformations: typeKeys.delay → type.inputDelay, maxVariation (0-100) → (0-1), and app → browsers structure changes

Applied to files:

  • src/schemas/src_schemas/type_v3.schema.json
  • src/schemas/output_schemas/type_v3.schema.json
  • src/schemas/output_schemas/find_v3.schema.json
📚 Learning: 2025-11-25T23:59:43.235Z
Learnt from: CR
Repo: doc-detective/common PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T23:59:43.235Z
Learning: Applies to src/schemas/src_schemas/*.json : Always include examples array in all schemas (required for test generation)

Applied to files:

  • src/schemas/output_schemas/test_v3.schema.json
📚 Learning: 2025-11-25T23:59:43.235Z
Learnt from: CR
Repo: doc-detective/common PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T23:59:43.235Z
Learning: Applies to test/*.test.js : Test structure uses Mocha + Chai; validate schema examples in test/schema.test.js (auto-generated from schemas)

Applied to files:

  • src/schemas/output_schemas/test_v3.schema.json
🔇 Additional comments (47)
src/schemas/output_schemas/endRecord_v3.schema.json (1)

1-14: Formatting-only change; no semantic impact.

This file remains semantically identical to the original—the schema structure and properties are unchanged. The modifications appear to be whitespace/formatting adjustments (e.g., newline handling). Since the broader PR focuses on scope-based enhancements (which this file doesn't participate in), ensure this reformatting was intentional, perhaps as part of an automated formatting pass, and verify it's consistent with other schema files in the PR.

Based on learnings, the $schema property on Line 2 aligns with project practices of enabling self-describing JSON objects for linter validation.

src/schemas/src_schemas/step_v3.schema.json (2)

380-648: Examples array is comprehensive and properly structured.

The examples array (lines 380-648) is present and includes diverse examples for most action types. References to external schema examples follow the guideline pattern (e.g., "$ref": "find_v3.schema.json#/examples/0") and the array meets the requirement for test generation.


1-87: Schema structure and $ref paths are correct.

The schema is well-formed with consistent composition patterns. All $ref paths are relative and properly formatted (e.g., line 100: "$ref": "checkLink_v3.schema.json#"), adhering to the guideline for source schemas.

.claude/settings.json (1)

1-5: This configuration file is required for the PR's stated objectives.

The .claude/settings.json file directly enables Claude agent functionality (superpowers plugin) that is essential to this PR's goal of setting up Claude AI configuration for development automation. It works in conjunction with .claude/settings.local.json to grant necessary permissions for npm operations, git commands, and development tasks. This is not extraneous tooling configuration—it's core infrastructure for the agent setup described in AGENTS.md.

Likely an incorrect or invalid review comment.

src/schemas/dereferenceSchemas.js (1)

51-51: LGTM!

The terminateScope_v3.schema.json is correctly added to the files array and will be automatically included in the publishing pipeline via the filter at line 149. Based on learnings, this is the proper way to add a new v3 schema.

src/schemas/src_schemas/runShell_v3.schema.json (3)

99-103: LGTM!

The scope property is well-defined with a clear pattern that enforces alphanumeric characters, hyphens, and underscores with a length of 1-64 characters. The description accurately reflects the validation constraints.


104-125: LGTM!

The waitUntil property is well-structured with clear nested objects for stdio conditions. The use of additionalProperties: false ensures strict validation. The regex pattern documentation is helpful.

Note: Ensure that the timeout property (lines 94-98) interacts correctly with waitUntil in the runtime implementation—i.e., that the timeout applies to the entire step including the wait conditions.


181-200: LGTM!

The new examples effectively demonstrate the scope and waitUntil features with realistic use cases:

  • Dev server waiting for startup message
  • Log monitoring with regex pattern matching

These examples provide clear guidance for users implementing scoped sessions and conditional waiting.

src/schemas/src_schemas/runCode_v3.schema.json (3)

97-101: LGTM!

The scope property maintains consistency with runShell_v3.schema.json using the same validation pattern. The description is appropriately adapted for code execution contexts.


102-123: LGTM!

The waitUntil property maintains perfect structural consistency with runShell_v3.schema.json, ensuring a uniform user experience across different execution types.


163-182: LGTM!

The examples effectively demonstrate scope and waitUntil for code execution scenarios:

  • Background Python process with stdout monitoring
  • JavaScript HTTP server with regex-based startup detection

These examples complement the runShell examples and showcase language-specific use cases.

src/schemas/src_schemas/terminateScope_v3.schema.json (4)

1-12: LGTM!

The root schema follows the established pattern used in other action schemas (runShell, runCode) with an anyOf structure allowing both simple string and detailed object forms.


15-20: LGTM!

The simple string form maintains pattern consistency with the scope properties in runShell and runCode schemas, ensuring only valid scope names can be referenced.


21-36: LGTM!

The detailed object form provides clear operational semantics (SIGTERM followed by SIGKILL) in the description. The use of additionalProperties: false ensures strict validation and prevents configuration errors.


38-46: LGTM!

The examples align with the scope names used in runShell and runCode examples (dev-server, background-process, log-monitor), creating a cohesive narrative that helps users understand the complete lifecycle of scoped sessions.

src/schemas/output_schemas/terminateScope_v3.schema.json (1)

1-62: LGTM!

The generated output schema correctly dereferences the source schema while maintaining:

  • Pattern consistency across all scope definitions
  • Self-describing structure via the components.schemas section
  • Complete examples array
  • Proper removal of $id properties

As per coding guidelines, this file is generated and should not be manually edited. The dereferencing process has been executed correctly.

src/schemas/output_schemas/type_v3.schema.json (2)

103-108: LGTM! Scope property correctly added with consistent pattern validation.

The scope property is properly defined with the required pattern ^[a-zA-Z0-9_-]{1,64}$ in both the main schema and components.schemas.object. The description clearly explains the purpose and constraints.

Also applies to: 215-220


252-256: LGTM! Good example demonstrating scoped terminal input.

The example clearly shows how to send input to a named terminal scope with the newline character for command execution.

src/schemas/src_schemas/type_v3.schema.json (3)

97-101: LGTM! Scope property correctly defined with consistent pattern.

The scope property matches the output schema definition with the same pattern and description.


5-12: LGTM! Proper use of internal $ref for schema composition.

The schema correctly uses internal JSON pointer references (#/components/schemas/...) to avoid duplication of the keys and object definitions.


108-126: LGTM! Comprehensive examples array including scoped usage.

Examples cover all schema variants (simple string, array, detailed object) and include the new scope functionality. As per coding guidelines, examples array is present as required for test generation.

src/schemas/output_schemas/runShell_v3.schema.json (3)

89-116: LGTM! Well-structured scope and waitUntil properties.

The scope property enables persistent terminal sessions with consistent pattern validation. The waitUntil object provides a clean interface for condition-based waiting on stdout/stderr patterns, with proper additionalProperties: false constraints.


95-116: Verify: Does timeout apply when using waitUntil?

The existing timeout property (default 60000ms) should govern the maximum wait time when using waitUntil. Ensure the implementation respects this timeout during pattern matching to prevent indefinite hangs if the expected pattern never appears.


288-314: LGTM! Excellent examples demonstrating scope and waitUntil usage.

The examples cover practical scenarios:

  • Dev server startup with string pattern matching
  • Log monitoring with regex pattern matching

Both demonstrate the intended use case of persistent terminal sessions with condition-based completion.

src/schemas/output_schemas/runCode_v3.schema.json (2)

90-117: LGTM! Scope and waitUntil properties consistent with runShell schema.

The structure mirrors runShell_v3.schema.json appropriately, with the description adjusted for "code execution session" context. Pattern validation is consistent across all scope-enabled schemas.


274-294: LGTM! Well-crafted examples for scoped code execution.

The examples effectively demonstrate:

  • Python long-running process with infinite loop and waitUntil
  • JavaScript HTTP server startup with regex pattern matching

Both show practical use cases for the new scope-based session management.

src/schemas/output_schemas/config_v3.schema.json (4)

1998-2003: LGTM! Scope property for type action is well-defined.

The scope property consistently uses the pattern ^[a-zA-Z0-9_-]{1,64}$ across all type action variants, enabling input to be directed to named terminal/code sessions. The pattern validation is appropriately restrictive.


4798-4824: Examples demonstrate scope lifecycle well.

The examples effectively illustrate:

  • Starting a dev server with waitUntil for the "Server listening on" message
  • Monitoring logs with regex pattern matching (/ERROR.*critical/)
  • Scoped process naming that can later be referenced by terminateScope

Good documentation for users learning the new scope-based session management.


6853-6985: New terminateScope action properly integrated into step schema.

The action correctly:

  • Includes common step properties (stepId, description, unsafe, outputs, variables, breakpoint)
  • Supports both simple string and detailed object forms via anyOf
  • Maintains consistent scope pattern validation
  • Includes the embedded $schema for self-describing objects (aligned with project conventions per learnings)

5171-5191: runCode examples provide good coverage of scope usage patterns.

The examples demonstrate:

  • Python infinite loop with scope for background processing
  • JavaScript HTTP server with scope and regex-based waitUntil

These complement the runShell examples and show language-agnostic scope support.

src/schemas/output_schemas/find_v3.schema.json (3)

491-496: LGTM! Scope property correctly added with consistent pattern validation.

The scope property is well-defined with appropriate type, description, and regex pattern. The pattern ^[a-zA-Z0-9_-]{1,64}$ properly enforces the naming constraints described in the PR objectives.


603-608: Consistent scope property replication across schema structures.

The scope property is correctly replicated in all "Type keys (detailed)" object definitions throughout the file, maintaining consistency across the duplicated schema structures. Based on learnings, this duplication is intentional to allow JSON objects to be self-describing for linting purposes.

Also applies to: 1154-1159, 1266-1271


640-644: Good example demonstrating scoped terminal input.

The added example clearly shows the intended use case: typing a shell command (ls -la\n) into a named terminal session (dev-server). The scope name adheres to the pattern validation, and the newline character demonstrates command execution.

Also applies to: 1303-1307

src/schemas/output_schemas/spec_v3.schema.json (5)

2414-2418: Consistent scope property implementation across type action definitions.

The scope property is correctly defined with consistent description, type, and pattern validation across all type action variants in the schema. The pattern ^[a-zA-Z0-9_-]{1,64}$ appropriately constrains scope names.


5214-5239: Good examples demonstrating scope and waitUntil usage.

The examples effectively illustrate both plain string matching ("Server listening on") and regex pattern matching ("/ERROR.*critical/"), providing clear guidance for users.


5587-5606: Well-designed examples for runCode with persistent sessions.

The examples demonstrate practical use cases for long-running background processes in both Python and JavaScript, with appropriate waitUntil conditions to ensure processes are ready before proceeding.


7268-7400: Well-structured terminateScope action.

The terminateScope action follows the established pattern of combining common step properties via allOf, and the anyOf structure for simple vs. detailed forms provides good ergonomics. The consistent scope pattern validation and clear description of SIGTERM/SIGKILL behavior are helpful.


15174-15306: Consistent terminateScope definition in nested context.

This duplicated terminateScope definition maintains consistency with the earlier definition at lines 7268-7400, using identical pattern validation, structure, and examples.

src/schemas/output_schemas/test_v3.schema.json (6)

1813-1816: LGTM: Scope property for type actions.

The scope property addition to type actions is well-structured with consistent pattern validation (^[a-zA-Z0-9_-]{1,64}$) and clear descriptions across all occurrences. This enables typing into persistent terminal or code sessions instead of the browser.

Also applies to: 1925-1928, 2476-2479, 2588-2591, 5182-5185, 5294-5297, 9719-9722, 9831-9834, 10382-10385, 10494-10497, 13088-13091, 13200-13203


1962-1964: LGTM: Scope usage examples for type actions.

The examples demonstrate typing into a scoped session effectively. Note that these examples assume the "dev-server" scope already exists (created via a prior runShell or runCode step with the same scope name).

Also applies to: 2625-2627, 5331-5333, 9868-9870, 10531-10533, 13237-13239


4613-4638: LGTM: Excellent runShell examples.

The examples demonstrate practical use cases effectively:

  1. Starting a dev server in persistent scope and waiting for startup confirmation
  2. Monitoring logs in background scope and waiting for error patterns

These illustrate both plain string and regex pattern matching capabilities.

Also applies to: 12519-12544


4802-4828: LGTM: Consistent scope and waitUntil for runCode.

The scope and waitUntil properties for runCode mirror the runShell implementation, adapted appropriately for code execution contexts. The consistency across action types improves usability.

Also applies to: 4920-4946, 12708-12734, 12826-12852


4986-5005: LGTM: Practical runCode examples with multi-language support.

The examples demonstrate scope and waitUntil across different languages (Python and JavaScript), showing background processes and HTTP servers. This effectively illustrates the cross-language applicability of the scope management feature.

Also applies to: 12892-12911


4414-4440: The scope and waitUntil additions to the runShell schema are well-structured and correctly documented. The regex pattern syntax format (/pattern/flags) is clearly documented in the schema descriptions for both stdout and stderr properties.

Note: Runtime implementation of the pattern matching logic resides in the executor repository (doc-detective/runner), not in this schema validation library. This repository handles schema definition and validation only. The schema itself is correct and complete.

src/schemas/output_schemas/report_v3.schema.json (3)

2432-2436: Scope property additions to type action are consistent.

The scope property is correctly added across multiple type action definitions (hunks 1-6, 13-15, 17-22, 29-31) with consistent pattern validation ^[a-zA-Z0-9_-]{1,64}$. The description clearly explains the behavior of sending input to scoped processes.


5420-5447: runCode scope and waitUntil additions are consistent with runShell.

The schema additions for scope and waitUntil in the runCode action mirror the runShell implementation, maintaining consistency. The same pattern validation and structure are used.


5231-5257: Examples effectively demonstrate scope and waitUntil usage.

The added examples cover realistic scenarios:

  • Starting a dev server and waiting for "Server listening on"
  • Tailing logs with regex pattern matching /ERROR.*critical/
  • Background processes with scope naming

These provide good documentation for users of the schema.

@promptless
Copy link

promptless bot commented Jan 6, 2026

📝 Documentation updates detected!

New suggestion: Document scope-based session management features

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments