Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
162 commits
Select commit Hold shift + click to select a range
05dbb28
Initial setup
joheredi Mar 10, 2026
c03c5fe
docs: add Alloy core understanding document for Rust language package
joheredi Mar 11, 2026
ec336b1
docs: add cross-language comparison for Rust package design
joheredi Mar 11, 2026
ad23f61
docs: add Rust language package design notes
joheredi Mar 11, 2026
d64bfa3
docs: add execution-ready PRD for @alloy-js/rust
joheredi Mar 11, 2026
3928b2f
docs: add execution-ready backlog for @alloy-js/rust
joheredi Mar 11, 2026
011ea0c
docs: add critical architecture review of Rust planning set
joheredi Mar 11, 2026
4a4a485
docs: apply review corrections to Rust planning set
joheredi Mar 11, 2026
c8ba018
add ralph script
joheredi Mar 11, 2026
123a164
feat(rust): add package scaffold for @alloy-js/rust
joheredi Mar 11, 2026
dd24510
test(rust): add rust test infrastructure utilities
joheredi Mar 11, 2026
61ddc73
feat(rust): implement RustOutputSymbol base class
joheredi Mar 11, 2026
47975a5
docs(rust): record t003 completion evidence
joheredi Mar 11, 2026
0b6c662
docs(rust): update ready-now backlog after T003 completion
joheredi Mar 11, 2026
63dbbc8
feat(rust): implement T004 symbol subclasses
joheredi Mar 11, 2026
5dd9b8b
feat(rust): implement name policy for T007
joheredi Mar 11, 2026
5792016
feat(rust): implement module and crate scope hierarchy
joheredi Mar 11, 2026
22b6ec9
feat(rust): add type parameters and where clause components
joheredi Mar 11, 2026
6cf1707
docs(rust): reconcile ready-now backlog list
joheredi Mar 11, 2026
ee94ed9
feat(rust): add symbol factory functions
joheredi Mar 11, 2026
fb29ac1
chore(rust): mark T005b scope hierarchy task done
joheredi Mar 11, 2026
ddd730b
feat(rust): add source file and crate directory components
joheredi Mar 11, 2026
fe66152
feat(rust): implement declaration and reference basics
joheredi Mar 11, 2026
23e638f
feat(rust): add parameter descriptor and guard
joheredi Mar 11, 2026
eaa7b98
feat(rust): add struct declaration and field components
joheredi Mar 11, 2026
4dc2993
feat(rust): add attribute and derive components
joheredi Mar 11, 2026
b8534d6
feat(rust): implement reference resolution and use tracking
joheredi Mar 11, 2026
021ea71
feat(rust): add enum declaration and variant components
joheredi Mar 11, 2026
8bd249c
feat(rust): add name conflict resolver
joheredi Mar 11, 2026
7295081
feat(rust): add function declaration and parameters
joheredi Mar 11, 2026
7700063
feat(rust): add type alias and const declaration components
joheredi Mar 11, 2026
fa50e15
feat(rust): add doc comment components
joheredi Mar 11, 2026
03a3620
feat(rust): add trait declaration component and tests
joheredi Mar 11, 2026
d8ee39f
feat(rust): add impl block component and tests
joheredi Mar 11, 2026
239ca35
feat(rust): add value component and tests
joheredi Mar 11, 2026
65e74f8
feat(rust): implement use statement rendering
joheredi Mar 11, 2026
626d377
feat(rust): add module-directory component
joheredi Mar 11, 2026
9bbc2fb
feat(rust): add createCrate external crate factory
joheredi Mar 11, 2026
db6784b
feat(rust): auto-generate mod declarations
joheredi Mar 11, 2026
acc40a5
feat(rust): add self receiver support to function declarations
joheredi Mar 11, 2026
2645cc9
feat(rust): add import integration coverage
joheredi Mar 11, 2026
d9f37cb
test(rust): add module structure integration coverage
joheredi Mar 11, 2026
bad659a
docs(rust): mark T029 blocked after repeated validation failures
joheredi Mar 11, 2026
a1f9b13
docs(rust): mark T031 dependency tracking done
joheredi Mar 11, 2026
045b456
feat(rust): implement CargoTomlFile generation
joheredi Mar 11, 2026
9bfc541
test(rust): add golden scenario coverage
joheredi Mar 11, 2026
241755e
feat(rust): add STC wrappers for rust components
joheredi Mar 11, 2026
558d2a9
test(rust): verify barrel exports surface
joheredi Mar 11, 2026
9e4cc0b
test(rust): add edge case coverage suite
joheredi Mar 11, 2026
ed67b6c
feat(rust): add builtin crate support for dependency tracking
joheredi Mar 11, 2026
29c1647
feat(rust): complete T037 STC wrappers
joheredi Mar 11, 2026
288ff4a
feat(rust): add crateType context propagation
joheredi Mar 11, 2026
ae5c4d0
Update docs
joheredi Mar 11, 2026
b0d0b82
Add rust-example sample and backlog tasks for Rust package gaps
joheredi Mar 11, 2026
235a291
Fix backlog structure: add epics E007-E009, language gap tasks T054-T067
joheredi Mar 11, 2026
313e4b1
fix(rust): support references in nested scopes
joheredi Mar 11, 2026
c21484f
fix(rust): enforce sibling newline rendering in enum/struct
joheredi Mar 11, 2026
d9c6b5f
fix(rust): render abstract trait methods with semicolons
joheredi Mar 11, 2026
d3918b1
fix(rust): clarify enum variant tuple vs struct rendering
joheredi Mar 11, 2026
2f9d23b
fix(rust): register standalone source files in module declarations
joheredi Mar 11, 2026
82da890
feat(rust): add struct expression and field init components
joheredi Mar 11, 2026
f04e92b
feat(rust): add match expression components
joheredi Mar 11, 2026
2f6b82f
feat(rust): add if expression components
joheredi Mar 11, 2026
232b8d1
docs(rust): close T044 as already implemented
joheredi Mar 11, 2026
9b1485b
fix(rust): make ModDeclarations order-independent
joheredi Mar 11, 2026
fc56838
feat(rust): add lifetime parameter support
joheredi Mar 11, 2026
e15ea8f
feat(rust): add for expression component
joheredi Mar 11, 2026
4dd2121
feat(rust): add LetBinding component
joheredi Mar 11, 2026
2269d54
feat(rust): add tuple and unit struct declaration support
joheredi Mar 11, 2026
ee206ee
feat(rust): add function call expression component
joheredi Mar 11, 2026
6cf1644
chore(rust): add task for preflight turbofish formatting failure
joheredi Mar 11, 2026
4a2e839
docs(rust): record preflight turbofish regression task
joheredi Mar 11, 2026
83b39fe
docs(rust): add preflight turbofish failure backlog task
joheredi Mar 11, 2026
5c64609
docs(rust): add task for preflight turbofish snapshot failure
joheredi Mar 11, 2026
2595908
chore(rust): track preflight turbofish failure
joheredi Mar 11, 2026
4b87546
chore(rust): track preflight turbofish formatting failure
joheredi Mar 11, 2026
737bb1d
docs(rust): track preflight turbofish comma-wrap failure
joheredi Mar 11, 2026
53f4a61
chore(rust): track preflight turbofish wrapping failure
joheredi Mar 11, 2026
d667746
chore(rust): add backlog task for turbofish preflight failure
joheredi Mar 11, 2026
6fc0c89
docs(rust): add preflight turbofish failure tracking task
joheredi Mar 11, 2026
2a39a5c
chore(rust): track rust preflight turbofish formatting failure
joheredi Mar 11, 2026
fe5033e
chore(rust): track preflight turbofish call-args mismatch
joheredi Mar 11, 2026
21196b7
chore(rust): log preflight turbofish validation failure
joheredi Mar 11, 2026
cc1cc05
chore(rust): add T081 preflight turbofish blocker
joheredi Mar 11, 2026
c1cee21
docs(rust): add preflight turbofish regression tracking task
joheredi Mar 11, 2026
f66d0b5
chore(rust): add preflight turbofish failure backlog task
joheredi Mar 11, 2026
a1e4d89
docs(rust): add preflight turbofish wrap failure task
joheredi Mar 12, 2026
92eccba
chore(rust): track preflight turbofish single-line regression
joheredi Mar 12, 2026
9b0dbee
chore(rust): track preflight turbofish regression blocker
joheredi Mar 12, 2026
7937a30
chore(rust): add task for preflight turbofish wrapping failure
joheredi Mar 12, 2026
7f2916f
chore(rust): add preflight failure tracking task for turbofish wrapping
joheredi Mar 12, 2026
8a55dd1
docs(rust): track preflight turbofish comma-wrap blocker
joheredi Mar 12, 2026
49ebaec
docs(rust): track preflight turbofish rerun failure
joheredi Mar 12, 2026
35f83a3
chore(rust): track preflight turbofish test failure
joheredi Mar 12, 2026
8aeb5e1
chore(rust): track preflight turbofish wrapping failure
joheredi Mar 12, 2026
1348d64
chore(rust): add preflight turbofish wrap blocker task
joheredi Mar 12, 2026
5208c15
docs(rust): add preflight turbofish regression task T094
joheredi Mar 12, 2026
0f6f5c5
docs(rust): track preflight turbofish wrap failure
joheredi Mar 12, 2026
19c33db
chore(rust): track preflight turbofish line-wrap failure
joheredi Mar 12, 2026
bb800b1
chore(rust): track new preflight turbofish regression blocker
joheredi Mar 12, 2026
aca328d
chore(rust): track preflight turbofish comma-wrap rerun failure
joheredi Mar 12, 2026
9683c9b
docs(rust): record preflight turbofish rerun blocker
joheredi Mar 12, 2026
fa9f8f1
chore(rust): record preflight turbofish wrapping blocker
joheredi Mar 12, 2026
d40bbbf
docs(rust): record preflight turbofish line-break failure as T101
joheredi Mar 12, 2026
4af3cb6
docs(rust): track preflight turbofish test mismatch
joheredi Mar 12, 2026
d6556d7
chore(rust): track preflight turbofish comma-wrap rerun failure
joheredi Mar 12, 2026
8614a3c
chore(rust): add preflight turbofish line-break backlog task
joheredi Mar 12, 2026
670e0ba
docs(rust): track preflight turbofish line-wrap failure
joheredi Mar 12, 2026
d2c1317
chore(rust): track preflight turbofish regression
joheredi Mar 12, 2026
5e015a3
chore(rust): track preflight turbofish comma-wrap failure
joheredi Mar 12, 2026
ef2deca
docs(rust): add preflight turbofish formatting blocker task
joheredi Mar 12, 2026
adf2b25
chore(rust): add T109 preflight turbofish blocker
joheredi Mar 12, 2026
99b886c
docs(rust): record preflight turbofish line-break blocker
joheredi Mar 12, 2026
ee9b16a
docs(rust): record preflight turbofish failure rerun 4
joheredi Mar 12, 2026
ca3ff0e
docs(rust): track preflight turbofish regression rerun 5
joheredi Mar 12, 2026
a7813df
chore(rust): record preflight turbofish rerun 6
joheredi Mar 12, 2026
c3e5589
docs(rust): track preflight turbofish rerun 7 failure
joheredi Mar 12, 2026
c339505
fix(rust): resolve turbofish formatting bug and clean up duplicate ba…
joheredi Mar 12, 2026
573ead2
docs(rust): mark T050 function call expression done
joheredi Mar 12, 2026
b83d6aa
feat(rust): add while and loop expression components
joheredi Mar 12, 2026
5591044
feat(rust): add closure expression component
joheredi Mar 12, 2026
0941373
feat(rust): add break and continue expression components
joheredi Mar 12, 2026
b3760fc
feat(rust): add static declaration component
joheredi Mar 12, 2026
f872b82
feat(rust): add await expression component
joheredi Mar 12, 2026
1602f24
feat(rust): add method chain expression component
joheredi Mar 12, 2026
d9da949
fix(rust): add pub(super) visibility support
joheredi Mar 12, 2026
201ee6f
chore(rust): mark T053 blocked on T052 dependency
joheredi Mar 12, 2026
f46e59b
feat(rust): add associated type declarations
joheredi Mar 12, 2026
ad0b614
feat(rust): add TryExpression component
joheredi Mar 12, 2026
8fe50bd
feat(rust): add return and macro expression components
joheredi Mar 12, 2026
61485c3
test(rust): refactor rust-example to expression components
joheredi Mar 12, 2026
90c9126
fix(rust): resolve rust-example externals TS2742
joheredi Mar 12, 2026
3adea53
feat(rust): add inner attribute component
joheredi Mar 12, 2026
96765bf
feat(rust): add unsafe block component
joheredi Mar 12, 2026
fd1d304
feat(rust): add block expression component
joheredi Mar 12, 2026
7381a08
Modernize rust sample: use References, components, and add smoke test
joheredi Mar 12, 2026
450cfa9
Add backlog tasks T069-T074 for rust-example review findings
joheredi Mar 12, 2026
dddab70
fix(rust): forward impl block generics from target types
joheredi Mar 12, 2026
0580187
fix(rust): resolve impl trait use import generation
joheredi Mar 12, 2026
c965b55
fix(rust): emit Cargo.toml lib/bin target paths
joheredi Mar 12, 2026
c01b3a2
fix(rust): preserve line breaks after doc comments
joheredi Mar 12, 2026
1ffe2a9
fix(rust): omit empty Cargo.toml dependencies section
joheredi Mar 12, 2026
16b2513
docs(rust): mark T071 blocked by T029 dependency
joheredi Mar 12, 2026
01f587f
fix(rust): generate use imports for same-crate prelude-shadowed types
joheredi Mar 12, 2026
3caf2f0
feat(rust-example): enable cargo check in smoke test
joheredi Mar 12, 2026
d5e38e4
Fix format and add sample output
joheredi Mar 16, 2026
5924752
feat(rust): support namekey in declaration component name props
p-bakker Mar 26, 2026
5e75183
feat(rust): add all 6 Rust comment types, rename ModuleDocComment
p-bakker Mar 27, 2026
ec263d9
Merge pull request #1 from p-bakker/timovv/rust-emitter
timovv Apr 1, 2026
13145e6
Add attributes props to relevant components
timovv Apr 1, 2026
9449339
feat(rust): add standard library builtins generated from rustdoc JSON
p-bakker Apr 3, 2026
1d2fede
refactor(rust): remove unneeded Reference wrappers around builtins
p-bakker Apr 3, 2026
477f1e6
use array
timovv Apr 3, 2026
a92882a
fix(rust): refs don't render their path
p-bakker Apr 3, 2026
c2fa549
Merge branch 'feature/rust' into feature/rust-attributes-prop
timovv Apr 6, 2026
cf4e435
Merge pull request #12 from timovv/feature/rust-attributes-prop
timovv Apr 6, 2026
74ebabd
Merge pull request #15 from p-bakker/feat(rust)-builtins
timovv Apr 7, 2026
3d258b5
Merge pull request #16 from p-bakker/fix(rust)-refs-path-rendering
timovv Apr 7, 2026
a31efad
refactor(rust): unify visibility into single `pub` prop
p-bakker Apr 7, 2026
3160684
Merge pull request #18 from p-bakker/refactor(rust)--clean-up-visibil…
timovv Apr 16, 2026
c64a52a
Merge remote-tracking branch 'upstream/main' into feature/rust
timovv Apr 16, 2026
c579eee
update lockfile
timovv Apr 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
56 changes: 56 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,59 @@ This repository is built on alloy which use JSX to define components. This is NO
- DO NOT destructure props in the component definition

Do not update changelogs, these are managed by `npx chronus`.

## TypeScript/Symbol Patterns - Known Gotchas

- For exported components that attach subcomponents (for example, `Component.Call = ...`), avoid private type aliases in public exported const annotations; API Extractor can fail. Prefer `export function Component(...) { ... }` and attach subcomponents as properties after declaration.
**Static memberSpaces in Symbol subclasses:** When subclassing symbols with custom `memberSpaces`, declare static `memberSpaces` as `readonly string[]` in both base and subclass. TypeScript tuple widening/narrowing on the static side causes incompatibility errors without explicit readonly string[] typing. Always validate symbol changes with: `pnpm --filter @alloy-js/rust build && pnpm --filter @alloy-js/rust test` (`pnpm --filter @alloy-js/rust build` runs `alloy build --with-dev` and `generate-docs`, so it also checks API surface generation).
**For SourceFile/CrateDirectory loop changes:** run `pnpm --filter @alloy-js/rust exec vitest run test/source-file-crate-directory.test.tsx` first for fast debugging, then run full `pnpm --filter @alloy-js/rust build && pnpm --filter @alloy-js/rust test`.
**For TypeAlias/ConstDeclaration loops:** run `pnpm --filter @alloy-js/rust exec vitest run test/type-alias-const.test.tsx` first, then run `pnpm --filter @alloy-js/rust test`.
**For import/reference integration loops:** run `pnpm --filter @alloy-js/rust exec vitest run test/imports.test.tsx test/reference.test.tsx` before full-suite validation to iterate faster.
**For Cargo.toml generation loops:** keep `CrateDirectory` Cargo.toml emission opt-in (`includeCargoToml`) so existing single-file `toRenderTo()` tests keep stable output.
- For `CargoTomlFile` targets, emit explicit sections (`[lib] path = "lib.rs"` for libs, `[[bin]]` with `name`/`path` for bins) before `[dependencies]`; expect snapshot updates in cargo-toml/golden/stc tests.
**Validation workflow tip:** use `pnpm --filter @alloy-js/rust build && pnpm --filter @alloy-js/rust test` as the Rust package correctness gate; also run `pnpm --filter rust-example build` when touching sample crate exports, and fix TS2742 by replacing inferred exported `createCrate(...)` values with explicit descriptor constants (`as const`) plus exported type aliases.
- In components using `scope.enclosingModule`, narrow to `RustModuleScope` (for example, `instanceof RustModuleScope`) before accessing `.types` or `.values`; `enclosingModule` is typed as `RustScopeBase`.
- Avoid whitespace-only `code` template literals (for example, ``code` ` ``); they can crash core code rendering. Use plain string literals like `" "` for standalone spaces.
- For `ModuleDirectory`, derive the module name from the last `path` segment before calling `addChildModule`, so nested paths register the correct child module.
- For exported Rust APIs, avoid exposing private helper types through symbol-keyed fields on exported interfaces; API Extractor treats them as public and fails build with `ae-forgotten-export`.
- For public builtins exports (for example `export const std = createCrate(...)` in `packages/rust/src/builtins/std.ts`), avoid relying on inferred/private descriptor shapes; this can trigger TS2742/API Extractor portability errors. Prefer explicit exported type aliases/interfaces for the export surface, then validate with `pnpm --filter @alloy-js/rust build && pnpm --filter @alloy-js/rust test`.
- In `packages/rust/src/components/stc/index.ts`, prefer explicit named component imports (alias if needed) and `stc(ComponentAlias)` for exported wrappers; avoid `import * as base` + `stc(base.X)`, which can trigger API Extractor `ae-forgotten-export` private type leakage.
- `Parameters` rendering requires `RustFunctionScope`; when testing `Parameters`/`Stc.Parameters`, render within a `FunctionDeclaration` instead of at module/root scope to avoid `Can't create parameter symbol outside of a function scope.`
- For enum/struct sibling rendering, always insert explicit `<hbr />` separators between repeated children (variants/fields) and between doc comments and declaration attributes; debug quickly with `pnpm --filter @alloy-js/rust exec vitest run test/enum.test.tsx test/struct.test.tsx`, then confirm with full `pnpm --filter @alloy-js/rust build && pnpm --filter @alloy-js/rust test`.
- For braced expression components that use `<Indent>` (for example `StructExpression`), do not add a leading `<hbr />` right after `" {"`; it introduces an extra blank line before the first indented entry.
- In `TraitDeclaration`, a self-closing `FunctionDeclaration` is an abstract signature and must render with `;` (not `{}`); a trait method with children is a default implementation and renders with braces. For fast regression checks, run `pnpm --filter @alloy-js/rust exec vitest run test/function.test.tsx test/reference.test.tsx`.
- In `SourceFile`/module registration flows, standalone non-root files should self-register with parent module declarations, but module-root files (`lib.rs`, `main.rs`, `mod.rs`) must never self-register.
- In `ImplBlock`/`TraitDeclaration`, `FunctionDeclaration` defaults receiver to `&self`; set `receiver="none"` for associated functions like `new()`.
- For `ModDeclarations` render-order regressions, first run `pnpm --filter @alloy-js/rust exec vitest run test/t045-render-order.test.tsx test/mod-declarations.test.tsx`, then run full rust validation.
- For Rust generic rendering, keep lifetime parameters and type parameters in the same `TypeParameterProp[]`, but always render lifetimes first (`<'a, 'b, T>`), and quickly verify with `pnpm --filter @alloy-js/rust exec vitest run test/type-parameters.test.tsx test/lifetime-parameters.test.tsx`.
- For `ImplBlock` generic forwarding, ensure `StructDeclaration`/`EnumDeclaration` register named type parameter symbols on `NamedTypeSymbol.typeParameters` whenever `typeParameters` are provided.
- For trait-import tests that depend on `Reference` auto-use behavior, avoid Rust prelude traits (for example `Clone`) because prelude symbols intentionally skip `use` generation; assert imports with non-prelude traits like `std::fmt::Display`.
- `LetBinding` intentionally does **not** register symbols in scope (T049 exclusions); treat it as syntax-only statement rendering with optional type/initializer and a trailing `;`.
- In `FunctionCallExpression`-style components using `<group>` + `Wrap` (`when={args.length > 1}`), expect stable multiline output for multi-arg calls, and turbofish type-arg lists may also line-break under the same group; snapshot tests should assert multiline form.
- For components using `<Wrap when={...}>`, line breaks occur only after print-width overflow; include at least one long argument in multi-arg tests when asserting multiline wrapping.
- Ensure `DocComment`/`ModuleDocComment` end with a trailing line break before declarations; otherwise generated output can concatenate comment text and the next declaration.

Critical rules:

1. Do not invent architecture. Ground every important claim in actual repository code, file structure, symbols, or tests.
2. Prefer concrete evidence over broad summaries.
3. Distinguish clearly between:
- observed facts from the repo
- inferences from patterns
- proposals for the new language package
4. When something is unclear, say so explicitly under "Open Questions" or "Ambiguities".
5. Do not start implementing code unless explicitly asked. This phase is documentation and planning only.
6. Write output directly to the requested markdown file.
7. Use clear headings and bullet points where useful.
8. When referencing repository files, include repository-relative paths.
9. Focus only on the parts of the repo relevant to Alloy core and existing language packages.
10. Optimize for future AI coding agents that will consume these documents.
11. For symbol-model changes (like Rust T003), always validate with `pnpm --filter @alloy-js/rust build && pnpm --filter @alloy-js/rust test` before moving to dependent tasks.

Quality bar:

- Precise
- Evidence-based
- Dependency-aware
- Implementation-oriented
- Not generic
64 changes: 64 additions & 0 deletions .github/prompts/001-discovery.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
You are working inside the Alloy monorepo.

Your goal is to identify the minimum set of repository files required to understand:

1. Alloy core
2. How language packages extend Alloy
3. The current implementations for TypeScript, Java, Python, and C#
4. The testing patterns used by existing language packages
5. Any contributor docs, architecture docs, package READMEs, or examples relevant to adding a new language package

Do not write a full architecture summary yet.
Do not propose a design for a target language yet.

Instead, produce a discovery document at:

docs/00-relevant-files.md

The document must contain:

# Purpose

A short explanation of why these files matter for planning a new language package.

# Core Files

A list of the key files/directories needed to understand Alloy core.
For each item include:

- path
- why it matters
- what concept it likely covers

# Existing Language Package Files

For TypeScript, Java, Python, and C#, list the most important files/directories.
For each item include:

- path
- package/language
- why it matters
- likely role in the package

# Tests and Examples

List the most relevant test/example files and why they matter.

# Documentation

List repo docs that appear important.

# Recommended Reading Order

Provide a practical reading order for the next analysis passes.

# Exclusions

List files/directories that appear large but likely irrelevant for this task.

Constraints:

- Be selective. Prefer quality over exhaustiveness.
- Ground everything in the repo.
- Do not guess beyond what the repo supports.
- Keep the document concise but useful.
99 changes: 99 additions & 0 deletions .github/prompts/002-core-understanding.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
You are working inside the Alloy monorepo.

Your task is to understand Alloy core deeply enough that a later agent can design a new <TARGET_LANGUAGE> language package without misplacing responsibilities between core and language-specific libraries.

Write the output to:

<CORE_DOC>

Do not design <TARGET_LANGUAGE> yet.
Do not describe implementation tasks yet.
This document must be primarily descriptive, not prescriptive.

Study the repository and produce a markdown document with the following exact sections:

# 1. Objective

Explain the purpose of this document and how it will be used later.

# 2. What Alloy Appears to Be

Describe Alloy's role as a code generation framework based on repository evidence.
Summarize the apparent generation model in plain language.

# 3. Core Architectural Model

Explain the core architecture of Alloy.
Cover the major abstractions and how they appear to work together.

At minimum analyze:

- rendering model
- component/composition model
- context/providers/hooks if present
- document/file generation model
- symbol/reference model
- scope and name resolution model
- formatting/printing model
- extension/plugin surfaces for language packages

# 4. Key Core Concepts

Create a glossary of the most important concepts in Alloy core.
For each concept include:

- name
- what it means
- why it matters
- key files where it is defined or exercised

# 5. Core-to-Language Extension Surface

Describe exactly how language packages appear to build on core.
Identify the likely contracts, APIs, primitives, or patterns that language packages rely on.

Separate:

- clearly observed extension points
- inferred extension patterns

# 6. Source File Inventory

List the most important core files and directories.
For each include:

- path
- purpose
- notable exported types/functions/components/classes
- why it is relevant to new language support

# 7. Invariants and Constraints

Document the important invariants or architectural constraints that later work must respect.
Examples:

- what core appears to own
- what language packages appear to own
- assumptions about rendering
- assumptions about symbol handling
- assumptions about output structure

# 8. Testing Patterns in Core

Describe how core behavior is tested and what that implies for future language packages.

# 9. Ambiguities / Open Questions

List anything that is unclear, inconsistent, or underdocumented in the repo.

# 10. Key Takeaways for Future Language Package Design

Summarize the most important lessons from core that a planner must not miss.

Requirements:

- Ground important claims in repository-relative file paths.
- Be concrete.
- Separate fact from inference.
- Do not propose new abstractions unless necessary to explain an observed gap.
- Optimize the document for later AI agents that will design and implement <TARGET_LANGUAGE>.
105 changes: 105 additions & 0 deletions .github/prompts/003-compare-language-packages.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
You are working inside the Alloy monorepo.

Your task is to compare the existing Alloy language packages so that a future agent can identify the stable patterns for implementing a new <TARGET_LANGUAGE> package.

Study the repository and write the output to:

<PATTERNS_DOC>

Use the previously generated core understanding document as context:
<CORE_DOC>

The purpose of this document is not to restate core, but to extract reusable patterns and package-shape expectations from the existing language packages.

Analyze the existing language packages for:

- TypeScript
- Java
- Python
- C#

Produce a markdown document with the following exact sections:

# 1. Objective

Explain how this comparison will inform the design of <TARGET_LANGUAGE> support.

# 2. Packages Compared

List the package paths examined for TypeScript, Java, Python, and C#.

# 3. Common Package Anatomy

Describe the recurring structure shared by the existing language packages.
Examples may include:

- package layout
- public API surface
- component organization
- symbol/reference helpers
- file/module abstractions
- declaration and expression modeling
- formatting utilities
- tests and examples

# 4. Cross-Language Concept Matrix

Create a detailed comparison matrix covering at least:

- source file / module representation
- imports / usings / package declarations / namespaces
- identifiers and symbol references
- literals
- expressions
- statements
- declarations
- type references
- functions / methods
- classes / interfaces / structs / equivalents
- visibility/modifiers/annotations/decorators where applicable
- comments / doc comments
- formatting / whitespace / delimiters
- test strategy

For each concept, explain:

- how TypeScript handles it
- how Java handles it
- how Python handles it
- how C# handles it
- what seems to be the shared principle
- what varies by language

# 5. Reusable Patterns

List the architectural and implementation patterns that appear reusable for any new language package.

# 6. Divergent or Language-Specific Patterns

List the parts that vary significantly and should not be over-generalized.

# 7. Implied Minimum Viable Surface for a New Language Package

Based on the existing packages, infer the likely minimum set of capabilities a new language package should provide.

This section should be an inferred checklist, not yet a target-language proposal.

# 8. Testing Patterns Across Language Packages

Describe how the existing language packages test themselves and what a new package should likely emulate.

# 9. Gaps, Inconsistencies, and Risks

Identify inconsistencies between existing packages or any uncertainty that could affect planning for <TARGET_LANGUAGE>.

# 10. Takeaways for Designing <TARGET_LANGUAGE>

Summarize the most important reusable lessons.

Requirements:

- Ground all major claims in actual repository evidence.
- Use repository-relative paths.
- Distinguish observed package behavior from inferred patterns.
- Do not design <TARGET_LANGUAGE> yet except where explicitly asked in section 10 to state takeaways.
- Optimize for future planning and implementation agents.
Loading
Loading