feat(adt-plugin-gcts): source companions + DOCU for wave2 stubs

Merged
TH
7h ago
+229-20

User description

  • genericGetSources: obj.sources map → per-suffix files —
    main → {name}.{type}.{ext}, other keys →
    {name}.{type}.{suffix}.{ext} (csnm's <csnfilename> grammar,
    0..n files); falls back to single obj.getSource().
  • genericSetSources: stubs now stage sources on deserialize (was
    dropped silently); docu key parses to data.docu, rest to
    data.sources.
  • genericGetExtraFiles: DOCU companion emit —
    {name}.{type}.docu.json (companion metadata, not an object).
  • parseGctsFilename: {name}.{type}.docu.json resolves to the real
    type + suffix 'docu' (was misparsed as type DOCU).
  • deserializer: .docu.json routes to sourceFiles — no longer
    overwrites the metadata anchor.

tests/aff/source-companions.test.ts + full aff suite: 19/19 green —
ddla .acds, csnm model_inferred, docu emit+validate+round-trip.

Generated with Devin

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Stack created with GitHub Stacks CLI • Give Feedback 💬

Summary by cubic

Adds source companions and DOCU support to wave2 generic stubs so they emit and round-trip multi-file source objects.

  • obj.sources maps suffixes to files: main → {name}.{type}.{ext}, other keys → {name}.{type}.{key}.{ext}; falls back to getSource() when no map exists.
  • DOCU emits as {name}.{type}.docu.json companion metadata instead of a standalone object; parseGctsFilename now resolves that filename to the real type with suffix docu.
  • Deserialization stages sources (previously dropped silently), parses docu JSON into data.docu, and routes .docu.json through the source pipeline so it no longer overwrites the metadata anchor.
  • Adds tests/aff/source-companions.test.ts covering ddla, csnm, and DOCU emit/validate/round-trip; the full aff suite is 19/19 green.

Summary by Sourcery

Preserve and round-trip source companions and DOCU metadata for wave2 generic AFF objects.

New Features:

  • Add multi-file source companion support for generic AFF objects, including suffix-aware files and single-source fallback.
  • Add DOCU companion file emission and restoration as metadata attached to the parent object.

Bug Fixes:

  • Preserve companion sources during deserialization instead of silently dropping them.
  • Correctly parse and route DOCU companion filenames without treating DOCU as the object type or overwriting metadata.

Tests:

  • Add coverage for suffix-based source files, source fallback, DOCU validation, emission, and round-trip behavior.

Summary by CodeRabbit

  • New Features
    • Generic objects can now include companion source files, with filenames reflecting their source type.
    • Documentation files are supported as companion files and retain their content when imported and exported.
    • Filenames for documentation companions are recognized consistently.
  • Tests
    • Added coverage for source and documentation companion file handling, including import and export behavior.

CodeAnt-AI Description

Preserve companion source files and DOCU metadata when exchanging generic AFF objects

What Changed

  • Generic AFF objects now export each source as a correctly named file, including objects with multiple sources.
  • Import restores source files and treats DOCU JSON as companion metadata, so it is preserved and re-emitted instead of replacing the main object metadata.

Impact

✅ Fewer lost source files on import
✅ DOCU metadata survives round-trips

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.