Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
e813327
simplify ProjectConfig using SfProject + add tests
nkskaare Jan 27, 2026
f766500
update project service constructor
nkskaare Jan 27, 2026
4f7e6ca
add static constructor to version-manager
nkskaare Jan 27, 2026
7565e26
different type constructors
nkskaare Jan 28, 2026
cea7385
init simple git service for bridging to sfpm domain
nkskaare Jan 28, 2026
43da8ef
update env variable
nkskaare Jan 28, 2026
b9fccac
move orhcestration to new service
nkskaare Jan 28, 2026
65aab3c
add more comprehensive package factory
nkskaare Jan 28, 2026
77ecdaf
incorporate package instantiation to package factory
nkskaare Jan 28, 2026
7e4306d
implement build events and fix package resolution by name
nkskaare Jan 28, 2026
4d996d9
fix build
nkskaare Jan 28, 2026
6b8a1e1
migrate to lodash-es
nkskaare Jan 28, 2026
386acc7
implement simple init command
nkskaare Jan 28, 2026
5552e42
fix init command
nkskaare Jan 28, 2026
76c0821
div fixes
nkskaare Jan 28, 2026
a065e3b
different small fixes on build run + visual command output
nkskaare Jan 28, 2026
532558c
fix package build
nkskaare Jan 28, 2026
3da652a
small output adjustment
nkskaare Jan 28, 2026
76bff98
add source hashing task
nkskaare Jan 29, 2026
0a0a391
implement source hashing task + register analyzers
nkskaare Jan 29, 2026
2d0d19e
fix named imports
nkskaare Jan 29, 2026
0049eec
remove unused import
nkskaare Jan 29, 2026
445ec88
fix import
nkskaare Jan 29, 2026
d337472
add analyzer output
nkskaare Jan 29, 2026
8aa77ba
refactor progress render + builder error handling
nkskaare Jan 29, 2026
3d0c83a
improved build ui + graceful exit when no source changes detected
nkskaare Jan 29, 2026
0199725
init installers
nkskaare Jan 29, 2026
a664ff9
add unit tests
nkskaare Jan 29, 2026
84e48ee
add install command, events + rendering
nkskaare Jan 29, 2026
1394f59
add local artifact methods to artifact service
nkskaare Jan 29, 2026
822d49c
add project copilot instructions
nkskaare Jan 30, 2026
6e23069
improve error handling and logging + read metadata from zipped artifact
nkskaare Jan 30, 2026
3d1ee3b
early returns and isInteractive check
nkskaare Jan 30, 2026
8d307a9
create registry interface to decouple registry interaction from persi…
nkskaare Feb 2, 2026
e716c39
create new artifact repo for filesystem + resolver for fetching
nkskaare Feb 2, 2026
582ae44
rewrite to produce .tgz files directly rather than .zip
nkskaare Feb 2, 2026
d349966
update toJson method to be async
nkskaare Feb 2, 2026
4eef01f
add lifecycle events to artifact assembly
nkskaare Feb 2, 2026
28a7720
make sfpm package responsible for hashing source content + make repo …
nkskaare Feb 3, 2026
b33803a
add install target resolution + hardening of installation source and …
nkskaare Feb 3, 2026
47ec60a
rename parameter to simple "mode"
nkskaare Feb 3, 2026
37a7642
remove redundant delegation methods
nkskaare Feb 3, 2026
eedae94
added convenience command for source install
nkskaare Feb 3, 2026
48ebda5
add debug configuration
nkskaare Feb 4, 2026
5aea11e
add debug configuration + npm config reading
nkskaare Feb 4, 2026
50eeac2
update field names
nkskaare Feb 4, 2026
0057ce0
read npm config to resolver + env var for debug
nkskaare Feb 4, 2026
a123e74
fix inclusion of source contents in package
nkskaare Feb 4, 2026
00a7bad
filter out null values
nkskaare Feb 4, 2026
9dad994
add npm scope + npm config reader and installment procedure
nkskaare Feb 5, 2026
ec144ce
reusable box formats
nkskaare Feb 5, 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
148 changes: 148 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
# SFPM Developer Instructions

This directory contains AI-agent and developer instructions for working with the SFPM codebase. These files help maintain consistency and communicate architectural patterns.

## Instruction Files

### [command.instructions.md](./instructions/command.instructions.md)
Output style and JSON support for CLI commands
- No emojis in output
- Use ora, chalk, and boxen for UI
- JSON mode for all central commands

### [error-handling.instructions.md](./instructions/error-handling.instructions.md)
Error handling patterns and custom error types
- Use rich error types: `BuildError`, `InstallationError`, `StrategyError`, `ArtifactError`, `DependencyError`
- Always wrap external errors
- Preserve error chains with `cause`
- Use `toDisplayMessage()` for CLI, `toJSON()` for API

### [architecture.instructions.md](./instructions/architecture.instructions.md)
Core architecture patterns and best practices
- Package structure and organization
- Strategy pattern for flexible behavior
- Event emitter pattern for progress tracking
- Service layer for external systems
- Factory pattern for object creation
- Dependency injection over globals

### [testing.instructions.md](./instructions/testing.instructions.md)
Testing patterns and best practices
- Test structure with vitest
- Mocking external dependencies
- Testing async code and strategies
- Test data factories and fixtures
- Coverage guidelines
- Integration test patterns

### [artifacts.instructions.md](./instructions/artifacts.instructions.md)
Artifact and package version management
- Artifact directory structure
- Version number patterns (`.NEXT` → `1.0.0-1`)
- Reading metadata from zip files
- Installation source type detection
- Build process and hash-based skipping
- npm packaging considerations

## How These Are Used

### By AI Agents
The `.instructions.md` files are automatically discovered and used by GitHub Copilot and other AI coding assistants to provide context-aware suggestions.

### By Developers
Read these files to understand:
- Established patterns in the codebase
- Why certain approaches were chosen
- How to extend or modify existing functionality
- Testing and error handling expectations

## Updating Instructions

When adding new patterns or making architectural decisions:

1. Update the relevant instruction file
2. Include examples of both good and bad patterns
3. Explain the "why" behind the pattern
4. Update this README if adding new instruction files

## Pattern Overview

### Core Principles

**Separation of Concerns**
- **Core** (`packages/core/`) - Business logic, no CLI concerns
- **CLI** (`packages/cli/`) - User interface, command handling

**Error Handling**
- Rich, structured error types with context
- Error chains preserved with `cause`
- Display formatting separated from error creation

**Extensibility**
- Strategy pattern for behavior variants
- Event emitters for progress and integration
- Registry pattern for plugin-like extensions

**Testing**
- High coverage for core business logic
- Mock external dependencies
- Test both success and error paths

**Type Safety**
- Strong typing throughout
- No `any` except at external boundaries
- Interfaces for extensibility

## Quick Reference

### Adding a New Installation Strategy

1. Implement `InstallationStrategy` interface
2. Define `canHandle()` conditions
3. Register in installer's strategy array
4. Add tests for `canHandle()` logic
5. Update [artifacts.instructions.md](./instructions/artifacts.instructions.md) strategy table

### Adding a New Error Type

1. Extend native `Error` base class
2. Implement `toDisplayMessage()`
3. Add context fields as needed
4. Export from `types/errors.ts`
5. Document in [error-handling.instructions.md](./instructions/error-handling.instructions.md)

### Adding a New CLI Command

1. Use `oclif generate command <name>`
2. Add flags following command.instructions.md
3. Implement with core services
4. Add progress rendering if long-running
5. Support `--json` flag
6. Handle errors with rich error types
7. Add tests

### Adding a New Build Task

1. Implement `BuildTask` interface
2. Add to builder's task array in order
3. Throw `BuildError` on failure
4. Log progress with logger
5. Test with mocked dependencies

## Contributing

When contributing to SFPM:

1. **Read relevant instruction files** before starting
2. **Follow established patterns** for consistency
3. **Add tests** for new functionality
4. **Update instructions** if introducing new patterns
5. **Use rich error types** for all failures

## Questions?

If patterns are unclear or missing:
1. Check if similar functionality exists elsewhere
2. Review the instruction files
3. Ask in PR review
4. Propose pattern updates via PR to these instruction files
Loading
Loading