Skip to content

Commit 1bd17a2

Browse files
committed
refactors, cleanups, docs
1 parent 27c7d52 commit 1bd17a2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+2950
-393
lines changed

.env.example

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,36 @@
1+
# PostgreSQL connection string (required)
12
DATABASE_URL=postgres://stackcraft:stackcraft@localhost:5433/stackcraft
3+
4+
# Backend HTTP server port
5+
# APP_SERVICE_PORT=9090
6+
7+
# MCP (Model Context Protocol) server port
8+
# MCP_PORT=9091
9+
10+
# Allowed CORS origins (comma-separated)
11+
# CORS_ORIGINS=http://localhost:8080
12+
13+
# Base64-encoded 256-bit key for encrypting sensitive values.
14+
# If unset, a key file is auto-generated in ~/.stack-craft/
15+
# STACK_CRAFT_ENCRYPTION_KEY=
16+
17+
# Minimum log level: verbose | debug | information | warning | error | fatal
18+
# LOG_LEVEL=verbose
19+
20+
# Timeout (ms) when stopping a service before sending SIGKILL
21+
# STOP_TIMEOUT_MS=10000
22+
23+
# Timeout (ms) during shutdown before force-killing child processes
24+
# SHUTDOWN_KILL_TIMEOUT_MS=5000
25+
26+
# Interval (ms) for flushing buffered process log lines to storage
27+
# LOG_FLUSH_INTERVAL_MS=100
28+
29+
# MCP session time-to-live (ms) before automatic cleanup
30+
# MCP_SESSION_TTL_MS=1800000
31+
32+
# Maximum number of concurrent MCP sessions
33+
# MCP_MAX_SESSIONS=50
34+
35+
# Interval (ms) between MCP stale-session sweeps
36+
# MCP_SESSION_SWEEP_MS=60000

CODE_OF_CONDUCT.md

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, caste, color, religion, or sexual
10+
identity and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
- Demonstrating empathy and kindness toward other people
21+
- Being respectful of differing opinions, viewpoints, and experiences
22+
- Giving and gracefully accepting constructive feedback
23+
- Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
- Focusing on what is best not just for us as individuals, but for the overall
26+
community
27+
28+
Examples of unacceptable behavior include:
29+
30+
- The use of sexualized language or imagery, and sexual attention or advances of
31+
any kind
32+
- Trolling, insulting or derogatory comments, and personal or political attacks
33+
- Public or private harassment
34+
- Publishing others' private information, such as a physical or email address,
35+
without their explicit permission
36+
- Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official email address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported by opening an issue on the
63+
[GitHub repository](https://github.com/furystack/stack-craft/issues).
64+
65+
All complaints will be reviewed and investigated promptly and fairly.
66+
67+
All community leaders are obligated to respect the privacy and security of the
68+
reporter of any incident.
69+
70+
## Enforcement Guidelines
71+
72+
Community leaders will follow these Community Impact Guidelines in determining
73+
the consequences for any action they deem in violation of this Code of Conduct:
74+
75+
### 1. Correction
76+
77+
**Community Impact**: Use of inappropriate language or other behavior deemed
78+
unprofessional or unwelcome in the community.
79+
80+
**Consequence**: A private, written warning from community leaders, providing
81+
clarity around the nature of the violation and an explanation of why the
82+
behavior was inappropriate. A public apology may be requested.
83+
84+
### 2. Warning
85+
86+
**Community Impact**: A violation through a single incident or series of
87+
actions.
88+
89+
**Consequence**: A warning with consequences for continued behavior. No
90+
interaction with the people involved, including unsolicited interaction with
91+
those enforcing the Code of Conduct, for a specified period of time. This
92+
includes avoiding interactions in community spaces as well as external channels
93+
like social media. Violating these terms may lead to a temporary or permanent
94+
ban.
95+
96+
### 3. Temporary Ban
97+
98+
**Community Impact**: A serious violation of community standards, including
99+
sustained inappropriate behavior.
100+
101+
**Consequence**: A temporary ban from any sort of interaction or public
102+
communication with the community for a specified period of time. No public or
103+
private interaction with the people involved, including unsolicited interaction
104+
with those enforcing the Code of Conduct, is allowed during this period.
105+
Violating these terms may lead to a permanent ban.
106+
107+
### 4. Permanent Ban
108+
109+
**Community Impact**: Demonstrating a pattern of violation of community
110+
standards, including sustained inappropriate behavior, harassment of an
111+
individual, or aggression toward or disparagement of classes of individuals.
112+
113+
**Consequence**: A permanent ban from any sort of public interaction within the
114+
community.
115+
116+
## Attribution
117+
118+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
119+
version 2.1, available at
120+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
121+
122+
Community Impact Guidelines were inspired by
123+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
124+
125+
For answers to common questions about this code of conduct, see the FAQ at
126+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
127+
[https://www.contributor-covenant.org/translations][translations].
128+
129+
[homepage]: https://www.contributor-covenant.org
130+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
131+
[Mozilla CoC]: https://github.com/mozilla/diversity
132+
[FAQ]: https://www.contributor-covenant.org/faq
133+
[translations]: https://www.contributor-covenant.org/translations

README.md

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ Open http://localhost:8080 in your browser. On first launch, the installer wizar
4343

4444
Environment variables can be set in the `.env` file at the project root.
4545

46-
| Variable | Default | Description |
47-
| ---------------------------- | ------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------- |
48-
| `DATABASE_URL` | `postgres://stackcraft:stackcraft@localhost:5433/stackcraft` | PostgreSQL connection string |
49-
| `APP_SERVICE_PORT` | `9090` | Backend HTTP server port |
50-
| `MCP_PORT` | `9091` | MCP server port |
51-
| `STACK_CRAFT_ENCRYPTION_KEY` | *(auto-generated)* | Base64-encoded 256-bit key for encrypting sensitive values. If unset, a key file is created in `~/.stack-craft/` |
46+
| Variable | Default | Description |
47+
| ---------------------------- | ------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------- |
48+
| `DATABASE_URL` | `postgres://stackcraft:stackcraft@localhost:5433/stackcraft` | PostgreSQL connection string |
49+
| `APP_SERVICE_PORT` | `9090` | Backend HTTP server port |
50+
| `MCP_PORT` | `9091` | MCP server port |
51+
| `STACK_CRAFT_ENCRYPTION_KEY` | _(auto-generated)_ | Base64-encoded 256-bit key for encrypting sensitive values. If unset, a key file is created in `~/.stack-craft/` |
5252

5353
## Docker
5454

@@ -70,16 +70,37 @@ docker run -p 9090:9090 \
7070
furystack/stack-craft
7171
```
7272

73+
## Architecture
74+
75+
```
76+
┌──────────────────────────┐
77+
│ Browser (Shades SPA) │
78+
└────────┬─────────────────┘
79+
│ REST + WebSocket
80+
┌────────▼─────────────────┐
81+
MCP Clients ──HTTP+SSE──▶ Node.js Service :9090 │
82+
:9091 │ (FuryStack REST) │
83+
└──┬──────────────┬────────┘
84+
│ │
85+
┌────────▼──┐ ┌──────▼──────┐
86+
│ PostgreSQL│ │ File System │
87+
│ │ │ (git, procs) │
88+
└───────────┘ └─────────────┘
89+
```
90+
7391
## Project Structure
7492

7593
```
7694
stack-craft/
7795
├── common/ # Shared API type definitions and models
7896
├── frontend/ # Shades-based SPA (Vite)
7997
├── service/ # FuryStack REST backend (Node.js)
98+
├── docs/ # Documentation (troubleshooting, etc.)
8099
└── e2e/ # Playwright end-to-end tests
81100
```
82101

102+
See also: [frontend/README.md](frontend/README.md) for frontend-specific documentation.
103+
83104
## Testing
84105

85106
```bash
@@ -103,6 +124,20 @@ yarn test:e2e
103124
| `yarn format` | Format code with Prettier |
104125
| `yarn create-schemas` | Regenerate JSON schemas from TypeScript types |
105126

127+
## MCP Server
128+
129+
Stack Craft includes a [Model Context Protocol](https://modelcontextprotocol.io/) server for AI assistant integration. It runs on a separate port (default `9091`) and provides tools for managing stacks, services, repositories, prerequisites, and environment variables.
130+
131+
**Connecting:** Point your MCP client to `http://localhost:9091/mcp` using Streamable HTTP transport with a Bearer token for authentication. Create API tokens via the UI under User Settings.
132+
133+
## Contributing
134+
135+
See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, coding standards, and the release workflow.
136+
137+
## Troubleshooting
138+
139+
See [docs/troubleshooting.md](docs/troubleshooting.md) for common issues and their resolutions.
140+
106141
## License
107142

108143
[GPL-2.0-only](LICENSE)

SECURITY.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
Only the latest release published to Docker Hub is actively supported with security updates:
6+
7+
| Version | Supported |
8+
| ------------------------------ | --------- |
9+
| `furystack/stack-craft:latest` | Yes |
10+
| Older versions | No |
11+
12+
We recommend always running the latest image to benefit from the most recent security patches.
13+
14+
## Reporting a Vulnerability
15+
16+
**Please do NOT open a public GitHub issue for security vulnerabilities.**
17+
18+
Instead, report vulnerabilities privately by filing a security advisory:
19+
20+
> [https://github.com/furystack/stack-craft/security/advisories/new](https://github.com/furystack/stack-craft/security/advisories/new)
21+
22+
When reporting, please include:
23+
24+
- A description of the vulnerability and its potential impact
25+
- Steps to reproduce or a proof-of-concept
26+
- Affected component(s) and version(s)
27+
- Any suggested mitigation or fix
28+
29+
## Response Timeline
30+
31+
- **Acknowledgement**: within 72 hours of the report
32+
- **Fix timeline**: within 2 weeks of confirmation, we will provide either a patch or a mitigation plan
33+
34+
## Scope
35+
36+
### In scope
37+
38+
- Backend service (`service/`)
39+
- Frontend application (`frontend/`)
40+
- MCP server (`service/src/mcp/`)
41+
- Authentication and session handling
42+
- Encryption and secrets management
43+
44+
### Out of scope
45+
46+
- Third-party dependencies: please report vulnerabilities in upstream packages directly to their respective maintainers
47+
- Issues in infrastructure or hosting environments not maintained by this project
48+
49+
## Disclosure
50+
51+
We follow coordinated disclosure. We ask that reporters allow us a reasonable window to address the issue before any public disclosure.

common/src/apis/github-repositories.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
1+
/**
2+
* REST API type definitions for GitHub repository management.
3+
* Repositories are linked to services and used for cloning, fetching, and branch tracking.
4+
*/
5+
16
import type { WithOptionalId } from '@furystack/core'
27
import type { DeleteEndpoint, GetCollectionEndpoint, GetEntityEndpoint, PatchEndpoint, RestApi } from '@furystack/rest'
38
import type { GitHubRepository } from '../models/github-repository.js'
49

510
export type GitHubRepoWritableFields = Omit<GitHubRepository, 'createdAt' | 'updatedAt'>
611

12+
/** Registers a new GitHub repository */
713
export type PostGitHubRepoEndpoint = {
814
result: GitHubRepository
915
body: WithOptionalId<GitHubRepoWritableFields, 'id'>
1016
}
1117

1218
export type PatchGitHubRepoEndpoint = PatchEndpoint<GitHubRepoWritableFields, 'id'>
1319

20+
/** Checks whether the repository is accessible (e.g. URL is valid and reachable) */
1421
export type ValidateRepoEndpoint = {
1522
url: { id: string }
1623
result: { accessible: boolean; message?: string }

common/src/apis/prerequisites.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
1+
/**
2+
* REST API type definitions for prerequisite management.
3+
* Prerequisites represent system-level dependencies (e.g. Node.js, Docker) that services require.
4+
*/
5+
16
import type { WithOptionalId } from '@furystack/core'
27
import type { DeleteEndpoint, GetCollectionEndpoint, GetEntityEndpoint, PatchEndpoint, RestApi } from '@furystack/rest'
38
import type { Prerequisite } from '../models/prerequisite.js'
49

510
export type PrerequisiteWritableFields = Omit<Prerequisite, 'createdAt' | 'updatedAt'>
611

12+
/** Creates a new prerequisite definition */
713
export type PostPrerequisiteEndpoint = {
814
result: Prerequisite
915
body: WithOptionalId<PrerequisiteWritableFields, 'id'>
1016
}
1117

1218
export type PatchPrerequisiteEndpoint = PatchEndpoint<PrerequisiteWritableFields, 'id'>
1319

20+
/** Executes the prerequisite's check command and returns whether it is satisfied */
1421
export type CheckPrerequisiteEndpoint = {
1522
url: { id: string }
1623
result: { satisfied: boolean; output: string }

0 commit comments

Comments
 (0)