Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
fec2152
feat: CoDA MCP server for Genie Code integration
datasciencemonkey May 25, 2026
5915f08
docs: clarify uvicorn entrypoint + supersede v1 plan + correct doc gaps
datasciencemonkey May 25, 2026
5d52249
test: add unit coverage for mcp_endpoint blueprint + stdio bridge
datasciencemonkey May 25, 2026
b2b06e3
docs: design spec for CoDA MCP live session URL + replay
datasciencemonkey May 28, 2026
02431c8
docs(spec): incorporate architect review — lock transcript_fh, docume…
datasciencemonkey May 28, 2026
3a882eb
docs(plan): implementation plan for CoDA MCP live session URL
datasciencemonkey May 28, 2026
ac3a8c7
feat(coda-mcp): url_builder module for viewer_url resolution
datasciencemonkey May 28, 2026
5becd59
feat(coda-mcp): find_task_dir_by_pty_session lookup with TTL cache
datasciencemonkey May 28, 2026
fc6a4a6
feat: tee PTY output to transcript.log with lock-guarded writes
datasciencemonkey May 28, 2026
a3b5f9a
feat: open transcript handle in mcp_create_pty_session; close in term…
datasciencemonkey May 28, 2026
c5b0c70
feat: harden transcript open against fd leak; add PTY skip guard on t…
datasciencemonkey May 28, 2026
67a6e02
feat: exempt grace-period PTYs from MAX_CONCURRENT_SESSIONS
datasciencemonkey May 28, 2026
85a6901
feat(coda-mcp): defer PTY close by GRACE_PERIOD_S via threading.Timer
datasciencemonkey May 28, 2026
d800b3e
feat(coda-mcp): return viewer_url from coda_run/inbox/get_result + tr…
datasciencemonkey May 28, 2026
515b0cb
feat(coda-mcp): AppUrlCaptureMiddleware seeds url_builder from X-Forw…
datasciencemonkey May 28, 2026
856c54c
feat: attach_session replay fallback reads transcript.log when PTY is…
datasciencemonkey May 28, 2026
6235037
feat(spa): deep-link ?session=<pty_id> with live attach + replay rend…
datasciencemonkey May 28, 2026
5532719
fix(spa): deep-link panes own their own input wiring and join_session
datasciencemonkey May 28, 2026
9138c2b
test: E2E coverage for grace period + transcript replay
datasciencemonkey May 28, 2026
78b9a5f
test: guard finally against early failure in E2E test
datasciencemonkey May 28, 2026
db4948f
fix(spa): use textContent in expired page (XSS); rename _close_pty_fo…
datasciencemonkey May 28, 2026
0204b5f
test: disable watcher in E2E grace test to avoid thread race
datasciencemonkey May 28, 2026
572d64c
docs: spec for coda_run replay-only URL + scratchpad todos
datasciencemonkey May 28, 2026
738e8ef
docs: implementation plan for coda_run replay-only URL
datasciencemonkey May 28, 2026
c75e9df
feat: add replay_only param to mcp_create_pty_session
datasciencemonkey May 28, 2026
cd47dd6
refactor: extract _serve_transcript_replay helper from attach_session
datasciencemonkey May 28, 2026
cb97347
feat: replay_only PTY sessions short-circuit to transcript in attach_…
datasciencemonkey May 28, 2026
5cabbcf
feat: coda_run creates PTY sessions with replay_only=True
datasciencemonkey May 28, 2026
2eb1238
test: harden Task 4 test against PTY leak on _read_session failure
datasciencemonkey May 28, 2026
062122f
refactor: _watch_task uses _close_pty_immediately instead of deferred…
datasciencemonkey May 28, 2026
000dbcd
test: drop dead grace-period tests
datasciencemonkey May 28, 2026
193c9a3
refactor: rip out grace-period machinery from coda_mcp/mcp_server.py
datasciencemonkey May 28, 2026
e2105d5
refactor: rip out grace-period machinery from app.py
datasciencemonkey May 28, 2026
c91946f
docs: update MCP instructions string for replay-only viewer_url seman…
datasciencemonkey May 28, 2026
5040e69
docs: tighten replay URL instruction text per code-quality review
datasciencemonkey May 28, 2026
6dc7bf8
test: extend test_replay_attach.py for alive-PTY replay_only case
datasciencemonkey May 28, 2026
fd9c6ac
test: clean up Task 10 imports and harden new test
datasciencemonkey May 28, 2026
6621100
test: regression guard against re-introduction of grace key
datasciencemonkey May 28, 2026
be6b97a
test: split grace regression guard so signature check runs unconditio…
datasciencemonkey May 28, 2026
36bb238
docs: drop now-defunct grace-period mention from task_manager docstring
datasciencemonkey May 28, 2026
798b44a
docs: spec for coda_interactive MCP tool (Todo 2)
datasciencemonkey May 28, 2026
6ebbbff
docs: implementation plan for coda_interactive (Todo 2)
datasciencemonkey May 28, 2026
ef15ef7
fix: mcp_create_pty_session strips registry credentials like HTTP pat…
datasciencemonkey May 28, 2026
7537451
test: directly unit-test _build_terminal_shell_env; drop session-dict…
datasciencemonkey May 28, 2026
89aed2f
feat: mcp_create_pty_session accepts cwd kwarg
datasciencemonkey May 28, 2026
5bfe07d
feat: add coda_mcp.workspace_export.export_workspace_tree helper
datasciencemonkey May 28, 2026
17d28bb
fix: workspace_export uses enum types and appends notebook extensions
datasciencemonkey May 28, 2026
30f77ba
feat: mcp_close_pty_session removes project dir on teardown
datasciencemonkey May 28, 2026
3083759
fix: move project-dir cleanup from mcp_close_pty_session to terminate…
datasciencemonkey May 28, 2026
34e4f8c
feat: stub coda_interactive MCP tool with agent validation
datasciencemonkey May 28, 2026
abc0c08
feat: coda_interactive resolves Git Folder and optionally updates branch
datasciencemonkey May 28, 2026
3018de3
feat: coda_interactive end-to-end happy path
datasciencemonkey May 28, 2026
8cedcbb
fix: coda_interactive uses asyncio.sleep, not time.sleep
datasciencemonkey May 28, 2026
7b18e8f
feat: wire coda_interactive into Flask-fallback MCP dispatch
datasciencemonkey May 28, 2026
f8a1142
docs: add INTERACTIVE HANDOFF paragraph to MCP instructions
datasciencemonkey May 28, 2026
685953d
test: regression guard against coda_run creating project dirs
datasciencemonkey May 28, 2026
8467890
fix: replace fixed-2s prompt-seed delay with output-stabilization det…
datasciencemonkey May 28, 2026
96129da
fix: prompt-seed code-quality nits from review
datasciencemonkey May 28, 2026
326e19a
docs: spec for broadening coda_interactive source to any Workspace fo…
datasciencemonkey May 28, 2026
d38b63a
docs: plan for broadening coda_interactive source to any Workspace fo…
datasciencemonkey May 28, 2026
22c40ae
docs: address plan-critic fixes — correct test count summary, add tas…
datasciencemonkey May 28, 2026
7e2cd26
test: rewrite coda_interactive tests for broadened workspace-folder c…
datasciencemonkey May 28, 2026
0311781
docs: surface upload-then-handoff pattern in instructions string + spec
datasciencemonkey May 28, 2026
4cf06fe
test: address code-quality review — drop unused pytest import, exerci…
datasciencemonkey May 28, 2026
4ac66c6
feat: coda_interactive accepts any Workspace folder, drop branch param
datasciencemonkey May 28, 2026
be96b34
fix: hoist _app_send_input guard to prevent PTY leak when hooks unwired
datasciencemonkey May 28, 2026
851699e
feat: update INTERACTIVE HANDOFF instructions for broadened contract
datasciencemonkey May 28, 2026
3b638cd
test: tighten instructions assertion — drop loose 'post' substring pe…
datasciencemonkey May 28, 2026
a555602
docs: mark original coda_interactive spec as amended by broaden-sourc…
datasciencemonkey May 28, 2026
6ff6a9b
docs: spec for coda_run workflow protocol + Databricks orientation pr…
datasciencemonkey May 29, 2026
6b47abe
docs: address workflow-protocol spec critic — needs_approval disambig…
datasciencemonkey May 29, 2026
613604e
docs: plan for coda_run workflow protocol implementation
datasciencemonkey May 29, 2026
6c348da
docs: address plan critic — fix _write_task_meta stub (use _write_jso…
datasciencemonkey May 29, 2026
007c850
feat: add databricks_preamble module — CAPABILITIES + WORKFLOW PROTOC…
datasciencemonkey May 29, 2026
8eedc1c
test: drop dead section_noise allowlist per code review — regex alrea…
datasciencemonkey May 29, 2026
c446f10
feat: wire workflow_protocol flag through coda_run → create_task → wr…
datasciencemonkey May 29, 2026
0062630
feat: document info_needed status and canonical step labels in INSTRU…
datasciencemonkey May 29, 2026
4b92bbd
fix: clarify status placeholder is non-literal in INSTRUCTIONS JSON e…
datasciencemonkey May 29, 2026
77321dc
feat: surface info_needed + needs_approval in inbox counts, get_resul…
datasciencemonkey May 29, 2026
197cb21
Merge remote-tracking branch 'origin/main' into feat/coda-mcp-interac…
datasciencemonkey May 29, 2026
2dd66aa
docs: spec for coda_interactive terminal-side workspace pull (replace…
datasciencemonkey May 29, 2026
ab2181b
docs: implementation plan for coda_interactive terminal-side pull
datasciencemonkey May 29, 2026
9de7897
docs: address plan critic — update stale mcp.instructions wording + h…
datasciencemonkey May 29, 2026
4e70dab
feat: add _safe_dirname/_normalize_workspace_path + generalize wait h…
datasciencemonkey May 29, 2026
d3c78ae
feat: coda_interactive pulls workspace files in the terminal, not ser…
datasciencemonkey May 29, 2026
0911d8b
fix: _safe_dirname rejects '.'/'..' basenames (final-critic path-trav…
datasciencemonkey May 29, 2026
d9e7a87
fix: coda_interactive waits on a completion marker, not output-quiet …
datasciencemonkey May 29, 2026
a189cd8
fix: launch claude with --enable-auto-mode + embedded prompt (skip fo…
datasciencemonkey May 29, 2026
9f9baf6
docs: tell local agents to import-dir files into the Workspace before…
datasciencemonkey May 29, 2026
bc674e9
docs: add CoDA MCP server overview (Databricks Light theme, single-fi…
datasciencemonkey May 29, 2026
444e133
fix: content-filter proxy never started — wrong script path broke Ope…
datasciencemonkey May 29, 2026
7bdc3f3
fix: setup scripts looked in setup/ for repo-root resources — subagen…
datasciencemonkey May 29, 2026
32624c7
fix: stabilize flaky PTY test suite — idempotent terminate_session + …
datasciencemonkey May 29, 2026
f2ca8c7
chore: refresh Databricks skills from ai-dev-kit (Feb→May 2026)
datasciencemonkey May 30, 2026
37df2f8
feat: bundle Flutter (10) + Dart (9) + shadcn-ui-flutter agent skills
datasciencemonkey May 30, 2026
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
122 changes: 122 additions & 0 deletions .claude/skills/dart-add-unit-test/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
---
name: dart-add-unit-test
description: Write and organize unit tests for functions, methods, and classes using `package:test`. Use when creating new logic or fixing bugs to ensure code remains correct and regression-free.
metadata:
model: models/gemini-3.1-pro-preview
last_modified: Fri, 24 Apr 2026 15:07:58 GMT
---
# Testing Dart and Flutter Applications

## Contents
- [Structuring Test Files](#structuring-test-files)
- [Writing Tests](#writing-tests)
- [Executing Tests](#executing-tests)
- [Test Implementation Workflow](#test-implementation-workflow)
- [Examples](#examples)

## Structuring Test Files
Organize test files to mirror the `lib` directory structure to maintain predictability.

* Place all test code within the `test` directory at the root of the package.
* Append `_test.dart` to the end of all test file names (e.g., `lib/src/utils.dart` should be tested in `test/src/utils_test.dart`).
* If writing integration tests, place them in an `integration_test` directory at the root of the package.

## Writing Tests
Utilize `package:test` as the standard testing library for Dart applications.

* Import `package:test/test.dart` (or `package:flutter_test/flutter_test.dart` for Flutter).
* Group related tests using the `group()` function to provide shared context.
* Define individual test cases using the `test()` function.
* Validate outcomes using the `expect()` function alongside matchers (e.g., `equals()`, `isTrue`, `throwsA()`).
* Write asynchronous tests using standard `async`/`await` syntax. The test runner automatically waits for the `Future` to complete.
* Manage test setup and teardown using `setUp()` and `tearDown()` callbacks.
* If testing code that relies on dependency injection, use `package:mockito` alongside `package:test` to generate mock objects, configure fixed scenarios, and verify interactions.

## Executing Tests
Select the appropriate test runner based on the project type and test location.

* If working on a pure Dart project, execute tests using the `dart test` command.
* If working on a Flutter project, execute tests using the `flutter test` command.
* If running integration tests, explicitly specify the directory path, as the default runner ignores it: `dart test integration_test` or `flutter test integration_test`.

## Test Implementation Workflow

Follow this sequential workflow when implementing new test suites. Copy the checklist to track your progress.

### Task Progress
- [ ] 1. Create the test file in the `test/` directory, ensuring the `_test.dart` suffix.
- [ ] 2. Import `package:test/test.dart` and the target library.
- [ ] 3. Define a `main()` function.
- [ ] 4. Initialize shared resources or mocks using `setUp()`.
- [ ] 5. Write `test()` cases grouped by functionality using `group()`.
- [ ] 6. Execute the test suite using the appropriate CLI command.
- [ ] 7. **Feedback Loop**: Run test -> Review stack trace for failures -> Fix implementation or assertions -> Re-run until passing.

## Examples

### Standard Unit Test Suite
Demonstrates grouping, setup, synchronous, and asynchronous testing.

```dart
import 'package:test/test.dart';
import 'package:my_package/calculator.dart';

void main() {
group('Calculator', () {
late Calculator calc;

setUp(() {
calc = Calculator();
});

test('adds two numbers correctly', () {
expect(calc.add(2, 3), equals(5));
});

test('handles asynchronous operations', () async {
final result = await calc.fetchRemoteValue();
expect(result, isNotNull);
expect(result, greaterThan(0));
});
});
}
```

### Mocking with Mockito
Demonstrates configuring a mock object for dependency injection testing.

```dart
import 'package:test/test.dart';
import 'package:mockito/mockito.dart';
import 'package:mockito/annotations.dart';
import 'package:my_package/api_client.dart';
import 'package:my_package/data_service.dart';

// Generate the mock using build_runner: dart run build_runner build
@GenerateNiceMocks([MockSpec<ApiClient>()])
import 'data_service_test.mocks.dart';

void main() {
group('DataService', () {
late MockApiClient mockApiClient;
late DataService dataService;

setUp(() {
mockApiClient = MockApiClient();
dataService = DataService(apiClient: mockApiClient);
});

test('returns parsed data on successful API call', () async {
// Configure the mock
when(mockApiClient.get('/data')).thenAnswer((_) async => '{"id": 1}');

// Execute the system under test
final result = await dataService.fetchData();

// Verify outcomes and interactions
expect(result.id, equals(1));
verify(mockApiClient.get('/data')).called(1);
});
});
}
```
185 changes: 185 additions & 0 deletions .claude/skills/dart-build-cli-app/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
---
name: dart-build-cli-app
description: Entrypoint structure, exit codes, cross-platform scripts. Use when building command line utilities, scripts, or applications.
metadata:
model: models/gemini-3.1-pro-preview
last_modified: Fri, 04 May 2026 17:41:00 GMT
---
# Building Dart CLI Applications

## Contents
- [Project Setup & Architecture](#project-setup--architecture)
- [Argument Parsing & Command Routing](#argument-parsing--command-routing)
- [Execution & Error Handling](#execution--error-handling)
- [Testing CLI Applications](#testing-cli-applications)
- [Compilation & Distribution](#compilation--distribution)
- [Workflows](#workflows)
- [Examples](#examples)

## Project Setup & Architecture

Initialize new CLI projects using the official Dart template to ensure standard directory structures.

* Run `dart create -t cli <project_name>` to scaffold a console application with basic argument parsing.
* Place executable entry points (files containing `main()`) exclusively in the `bin/` directory.
* Place internal implementation logic in `lib/src/` and expose public APIs via `lib/<project_name>.dart`.
* Enforce formatting in CI environments by running `dart format . --set-exit-if-changed`. This returns exit code 1 if formatting violations exist.

## Argument Parsing & Command Routing

Import the `args` package to manage command-line arguments, flags, and subcommands.

* If building a simple script: Use `ArgParser` directly to define flags (`addFlag`) and options (`addOption`).
* If building a complex, multi-command CLI (like `git`): Implement `CommandRunner` and extend `Command` for each subcommand.
* Define global arguments on the `CommandRunner.argParser` and command-specific arguments on the individual `Command.argParser`.
* Catch `UsageException` to gracefully handle invalid arguments and display the automatically generated help text.
* **Validate Help Text Accuracy**: Ensure the help text provides all necessary information to run the tool. If the help text references a compiled executable name, and the user needs to add it to their PATH to run it that way, provide clear instructions on how to do so in the help text or description.

## Execution & Error Handling

Leverage the `io` and `stack_trace` packages to build robust, production-ready CLI tools.

* Use the `io` package's `ExitCode` enum to return standard POSIX exit codes (e.g., `ExitCode.success.code`, `ExitCode.usage.code`).
* Use `sharedStdIn` from the `io` package if multiple asynchronous listeners need sequential access to standard input.
* Wrap the application execution in `Chain.capture()` from the `stack_trace` package to track asynchronous stack chains.
* Format output stack traces using `Trace.terse` or `Chain.terse` to strip noisy core library frames and present readable errors to the user.
* **Do not swallow exceptions** in lower-level logic or storage classes unless recovery is possible. Let them bubble up or rethrow them so higher-level commands know operations failed.
* **Fail fast and with non-zero exit codes**: Ensure operation failures result in descriptive error messages to `stderr` and appropriate non-zero exit codes (e.g., using `exit(1)` or triggering a 64 exit code after a caught `UsageException`).

## Testing CLI Applications

> [!IMPORTANT]
> **All new commands and significant features must be covered by automated tests.** Manual verification is not sufficient for testing logic. However, manual verification of help text and user experience (UX) is still required to ensure the interface is intuitive and correct.

Use `test_process` and `test_descriptor` to write high-fidelity integration tests for your CLI.

* Define expected filesystem states using `test_descriptor` (`d.dir`, `d.file`).
* Create the mock filesystem before execution using `await d.Descriptor.create()`.
* Spawn the CLI process using `TestProcess.start('dart', ['run', 'bin/cli.dart', ...args])`.
* Validate standard output and error streams using `StreamQueue` matchers (e.g., `emitsThrough`, `emits`).
* Assert the final exit code using `await process.shouldExit(0)`.
* Validate resulting filesystem mutations using `await d.Descriptor.validate()`.

## Compilation & Distribution

Select the appropriate compilation target based on your distribution requirements.

* **If testing locally during development:** Use `dart run bin/cli.dart`. This uses the JIT compiler for rapid iteration.
* **If bundling code assets and dynamic libraries:** Use `dart build cli`. This runs build hooks and outputs to `build/cli/_/bundle/`.
* **If distributing a standalone native executable:** Use `dart compile exe bin/cli.dart -o <output_path>`. This bundles the Dart runtime and machine code into a single file.
* **If distributing multiple apps with strict disk space limits:** Use `dart compile aot-snapshot bin/cli.dart`. Run the resulting `.aot` file using `dartaotruntime`.

<details>
<summary>Cross-Compilation Targets (Linux Only)</summary>

Dart supports cross-compiling to Linux from macOS, Windows, or Linux hosts.
Use the `--target-os` and `--target-arch` flags with `dart compile exe` or `dart compile aot-snapshot`.

* `--target-os=linux` (Only Linux is currently supported as a cross-compilation target)
* `--target-arch=arm64` (64-bit ARM)
* `--target-arch=x64` (x86-64)
* `--target-arch=arm` (32-bit ARM)
* `--target-arch=riscv64` (64-bit RISC-V)

Example: `dart compile exe --target-os=linux --target-arch=arm64 bin/cli.dart`
</details>

## Workflows

### Task Progress: Implement a New CLI Command
- [ ] Create a new class extending `Command` in `lib/src/commands/`.
- [ ] Define the `name` and `description` properties.
- [ ] Register command-specific flags in the constructor using `argParser.addFlag()` or `argParser.addOption()`.
- [ ] Implement the `run()` method with the core logic.
- [ ] Register the new command in the `CommandRunner` instance in `bin/cli.dart` using `addCommand()`.
- [ ] Create tests for the new command in the `test/` directory using `test_process` or standard tests.
- [ ] Run validator -> Execute `dart run bin/cli.dart help <command_name>` to verify help text generation.
- [ ] Verify final UX: Compile the application using `dart compile exe` and run the resulting executable to verify the target user experience (e.g., `./bin/cli <command>`).

### Task Progress: Compile and Release Native Executable
- [ ] Run validator -> Execute `dart format . --set-exit-if-changed` to ensure code formatting.
- [ ] Run validator -> Execute `dart analyze` to ensure no static analysis errors.
- [ ] Run validator -> Execute `dart test` to pass all integration tests.
- [ ] Compile for host OS: `dart compile exe bin/cli.dart -o build/cli-host`
- [ ] Compile for Linux (if host is macOS/Windows): `dart compile exe --target-os=linux --target-arch=x64 bin/cli.dart -o build/cli-linux-x64`

## Examples

### Example: CommandRunner Implementation

```dart
import 'dart:io';
import 'package:args/command_runner.dart';
import 'package:stack_trace/stack_trace.dart';

class CommitCommand extends Command {
@override
final String name = 'commit';
@override
final String description = 'Record changes to the repository.';

CommitCommand() {
argParser.addFlag('all', abbr: 'a', help: 'Commit all changed files.');
}

@override
Future<void> run() async {
final commitAll = argResults?['all'] as bool? ?? false;
print('Committing... (All: $commitAll)');
}
}

void main(List<String> args) {
Chain.capture(() async {
final runner = CommandRunner('dgit', 'Distributed version control.')
..addCommand(CommitCommand());

await runner.run(args);
}, onError: (error, chain) {
if (error is UsageException) {
stderr.writeln(error.message);
stderr.writeln(error.usage);
exit(64); // ExitCode.usage.code
} else {
stderr.writeln('Fatal error: $error');
stderr.writeln(chain.terse);
exit(1);
}
});
}
```

### Example: Integration Testing with Subprocesses

```dart
import 'package:test/test.dart';
import 'package:test_process/test_process.dart';
import 'package:test_descriptor/test_descriptor.dart' as d;

void main() {
test('CLI formats output correctly and modifies filesystem', () async {
// 1. Setup mock filesystem
await d.dir('project', [
d.file('config.json', '{"key": "value"}')
]).create();

// 2. Spawn the CLI process
final process = await TestProcess.start(
'dart',
['run', 'bin/cli.dart', 'process', '--path', '${d.sandbox}/project']
);

// 3. Validate stdout stream
await expectLater(process.stdout, emitsThrough('Processing complete.'));

// 4. Validate exit code
await process.shouldExit(0);

// 5. Validate filesystem mutations
await d.dir('project', [
d.file('config.json', '{"key": "value"}'),
d.file('output.log', 'Success')
]).validate();
});
}
```
Loading