primecloud 0.0.0-stage → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,58 @@
1
+ # Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ PrimeCloud is committed to a professional, respectful, and inclusive
6
+ working environment for everyone contributing to the platform.
7
+
8
+ We pledge to make participation in this project a harassment-free
9
+ experience for everyone, regardless of age, body size, disability,
10
+ ethnicity, gender identity and expression, level of experience,
11
+ nationality, personal appearance, race, religion, or sexual identity
12
+ and orientation.
13
+
14
+ ## Our Standards
15
+
16
+ Examples of behavior that contributes to a positive environment:
17
+
18
+ - Professional and respectful communication.
19
+ - Constructive feedback.
20
+ - Focus on what is best for the platform.
21
+ - Respect for differing viewpoints.
22
+ - Accountability for mistakes.
23
+
24
+ Examples of unacceptable behavior:
25
+
26
+ - Harassment, discrimination, or personal attacks.
27
+ - Trolling, insulting comments, or deliberate disruption.
28
+ - Publishing others' private information.
29
+ - Any conduct inappropriate in a professional setting.
30
+
31
+ ## Scope
32
+
33
+ This Code of Conduct applies within all PrimeCloud project spaces,
34
+ and also when an individual is representing the project or its
35
+ community in public spaces.
36
+
37
+ ## Enforcement
38
+
39
+ Instances of unacceptable behavior may be reported to the project
40
+ maintainers. All complaints will be reviewed and investigated promptly
41
+ and fairly. Project maintainers will respect the privacy and security
42
+ of the reporter of any incident.
43
+
44
+ ## Enforcement Guidelines
45
+
46
+ Project maintainers will follow these guidelines when determining
47
+ consequences for any action they deem in violation of this Code of
48
+ Conduct:
49
+
50
+ 1. **Correction** — A private warning.
51
+ 2. **Warning** — A warning with consequences for continued behavior.
52
+ 3. **Temporary ban** — A temporary ban from any interaction.
53
+ 4. **Permanent ban** — A permanent ban from the project.
54
+
55
+ ## Attribution
56
+
57
+ This Code of Conduct is adapted from the Contributor Covenant
58
+ principles, tailored for the PrimeCloud project.
@@ -0,0 +1,67 @@
1
+ # Contributing to primecloud-cli
2
+
3
+ Thank you for your interest in PrimeCloud.
4
+
5
+ This document defines contribution rules for this repository during
6
+ Phase 00 — Architecture & Engineering Foundation.
7
+
8
+ ## Current Phase
9
+
10
+ This repository is in **Phase 00**.
11
+
12
+ - No implementation code is present.
13
+ - No GitHub remote is configured.
14
+ - Contributions are not yet open externally.
15
+ - All work follows the Phase 00 governance model.
16
+
17
+ ## Governance Model
18
+
19
+ PrimeCloud follows a Founder-authorized governance model:
20
+
21
+ - **Founder:** Final architectural authority.
22
+ - **Principal Architect / Governance Authority:** Plans, tasks, reviews.
23
+ - **Implementation Engineer:** Implements approved tasks only.
24
+
25
+ Any architectural change requires an **Architecture Change Proposal (ACP)**
26
+ and explicit Founder approval.
27
+
28
+ ## Branching
29
+
30
+ - `main` is protected.
31
+ - Feature work uses `feature/<module>`.
32
+ - Fixes use `fix/<issue>`.
33
+ - Urgent fixes use `hotfix/<issue>`.
34
+ - Non-functional work uses `chore/<task>`.
35
+ - Documentation uses `docs/<topic>`.
36
+
37
+ See the workspace-level `BRANCHING.md` for details.
38
+
39
+ ## Commit Style
40
+
41
+ Commits are focused and scoped. Each commit message identifies:
42
+
43
+ - The module or task (e.g., `ag-00-03`)
44
+ - The category (e.g., `docs`, `chore`, `feat`, `fix`)
45
+ - A concise description
46
+
47
+ Unrelated changes are prohibited in a single commit.
48
+
49
+ ## Testing Requirements
50
+
51
+ When implementation begins (Phase 01+), every contribution must
52
+ include tests appropriate to the change. Tests are defined per module
53
+ by the approved implementation specification.
54
+
55
+ ## Security
56
+
57
+ - Do not commit secrets, credentials, or customer data.
58
+ - See `SECURITY.md` for the security policy.
59
+ - Report security concerns through the process described in `SECURITY.md`.
60
+
61
+ ## Code of Conduct
62
+
63
+ See `CODE_OF_CONDUCT.md`.
64
+
65
+ ## Questions
66
+
67
+ Direct questions to the Principal Architect for this project.
package/LICENSE ADDED
@@ -0,0 +1,8 @@
1
+ PrimeCloud — primecloud-cli
2
+
3
+ License decision pending.
4
+
5
+ This file is a placeholder created during Phase 00 (Module AG-00-01).
6
+ The final license will be added once decided by the Founder.
7
+
8
+ No rights are granted by this placeholder.
package/README.md CHANGED
@@ -1,3 +1,87 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ # PrimeCloud CLI
2
+
3
+ > **PrimeCloud — Powering What You Build.**
4
+ >
5
+ > Simple on the surface. Powerful underneath. Create → Deploy → Live.
6
+
7
+ The PrimeCloud CLI is the authoritative developer command-line interface to the PrimeCloud Control Plane API.
8
+
9
+ ## Installation
10
+
11
+ ### Via npm (Recommended & Zero Configuration)
12
+ ```bash
13
+ # Install globally
14
+ npm install -g primecloud
15
+
16
+ # Or run instantly without installing
17
+ npx primecloud --help
18
+ ```
19
+
20
+ ### Via One-Line Install Script
21
+
22
+ **Windows (PowerShell):**
23
+ ```powershell
24
+ irm https://raw.githubusercontent.com/PrimeTech-Nexus/primecloud-cli/main/scripts/install.ps1 | iex
25
+ ```
26
+
27
+ **macOS / Linux (Terminal):**
28
+ ```bash
29
+ curl -fsSL https://raw.githubusercontent.com/PrimeTech-Nexus/primecloud-cli/main/scripts/install.sh | bash
30
+ ```
31
+
32
+ ### Build from Source (Go 1.22+)
33
+ ```bash
34
+ make build
35
+ # Binary created at bin/primecloud
36
+ ```
37
+
38
+ ## Quick Start
39
+
40
+ ```bash
41
+ # Authenticate
42
+ primecloud login
43
+
44
+ # Check identity
45
+ primecloud auth whoami
46
+
47
+ # Create or switch project
48
+ primecloud projects list
49
+ primecloud context set my-project
50
+
51
+ # Initialize application configuration
52
+ primecloud init
53
+
54
+ # Deploy
55
+ primecloud deploy
56
+
57
+ # Check status and logs
58
+ primecloud status
59
+ primecloud logs <app-id> --follow
60
+ ```
61
+
62
+ ## Output Formats and Automation
63
+
64
+ PrimeCloud CLI is designed for both human interaction and automated CI/CD pipelines.
65
+
66
+ - `--json` or `--output=json`: Output responses in JSON format.
67
+ - `--non-interactive`: Disable interactive prompts.
68
+ - `PRIMECLOUD_TOKEN`: Provide authentication token via environment variable.
69
+ - `PRIMECLOUD_API_URL`: Override the target API endpoint.
70
+
71
+ ## Exit Codes
72
+
73
+ | Code | Meaning |
74
+ |------|---------|
75
+ | 0 | Success |
76
+ | 1 | General Error |
77
+ | 2 | Usage / Flag Error |
78
+ | 3 | Authentication Required |
79
+ | 4 | Forbidden / Unauthorized |
80
+ | 5 | Resource Not Found |
81
+ | 6 | Validation Error |
82
+ | 7 | Operation Failed |
83
+ | 8 | Timeout |
84
+ | 9 | Network / Connectivity Error |
85
+ | 10 | Configuration Error |
86
+ | 11 | Dependency Error |
87
+ | 12 | Operation Cancelled |
package/SECURITY.md ADDED
@@ -0,0 +1,114 @@
1
+ # Security Policy
2
+
3
+ ## Purpose
4
+
5
+ This document defines the security policy for this repository during
6
+ Phase 00 — Architecture & Engineering Foundation.
7
+
8
+ PrimeCloud treats security as a foundational architectural requirement,
9
+ not a feature. Security is embedded in every phase of the platform.
10
+
11
+ ## Reporting a Vulnerability
12
+
13
+ If you believe you have discovered a security vulnerability in
14
+ PrimeCloud, do not open a public issue.
15
+
16
+ Report security concerns through the process described at the
17
+ project's security documentation. Do not disclose the issue publicly
18
+ until it has been reviewed and addressed.
19
+
20
+ ## Scope
21
+
22
+ This repository is currently in **Phase 00**.
23
+
24
+ - No implementation code is present.
25
+ - No production system is running.
26
+ - No customer data is present.
27
+
28
+ The security policy below applies as the platform is implemented
29
+ and will be refined in future modules.
30
+
31
+ ## Security Principles
32
+
33
+ PrimeCloud follows these principles:
34
+
35
+ 1. **Three-tier trust model.**
36
+ - Customer workload = LOW TRUST
37
+ - PrimeCloud Agent = PRIVILEGED
38
+ - Control Plane = HIGH TRUST
39
+
40
+ 2. **The Control Plane decides. The Agent executes.**
41
+
42
+ 3. **Customer workloads must never receive:**
43
+ - Host root
44
+ - Docker socket
45
+ - Unrestricted host shell
46
+ - Control Plane database credentials
47
+ - Master Control Plane credentials
48
+ - GitHub App private key
49
+ - Cloudflare master credentials
50
+ - Payment secrets
51
+ - Vault administrative credentials
52
+ - mTLS CA/signing material
53
+
54
+ 4. **No secrets in Git.**
55
+
56
+ 5. **No secrets in logs.**
57
+
58
+ 6. **No secrets baked into container images.**
59
+
60
+ 7. **Secrets are managed through Vault.**
61
+
62
+ 8. **Every privileged action is auditable.**
63
+
64
+ 9. **Tenant isolation is enforced everywhere.**
65
+
66
+ 10. **Any architecture change requires an ACP and Founder approval.**
67
+
68
+ ## Do Not Commit
69
+
70
+ Do not commit:
71
+
72
+ - Secrets
73
+ - API keys
74
+ - Passwords
75
+ - Tokens
76
+ - Private keys
77
+ - `.env` files
78
+ - Customer data
79
+ - Credentials of any kind
80
+
81
+ ## Accepted Architecture
82
+
83
+ PrimeCloud V1 uses:
84
+
85
+ - Docker runtime
86
+ - Go Agent with gRPC over TLS and Vault PKI
87
+ - FastAPI Control Plane with PostgreSQL and Valkey
88
+ - Rootless BuildKit and Kaniko for builds
89
+ - GHCR for container images
90
+ - HashiCorp Vault for secrets
91
+ - Cloudflare and Caddy for edge
92
+ - Cloudflare R2 for object storage
93
+ - Paystack for payments
94
+
95
+ PrimeCloud V1 does **not** use:
96
+
97
+ - Kubernetes
98
+ - AWS / Azure / GCP foundation
99
+ - Serverless foundation
100
+ - Service mesh
101
+ - Microservices redesign
102
+ - Terraform as mandatory foundation
103
+ - Multi-region compute
104
+ - Self-hosted container registry
105
+ - RabbitMQ
106
+ - VictoriaMetrics
107
+ - Secondary payment provider
108
+ - Permanent free tier
109
+ - Vertical-first scaling
110
+
111
+ ## Reporting
112
+
113
+ Report security concerns through the process defined by the project
114
+ maintainers. Do not disclose publicly.
package/cli/install.js ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { ensureBinary } = require('./run');
4
+
5
+ // On postinstall, try to download the binary ahead of time.
6
+ // If it fails (e.g. offline or repo release pending), don't fail the npm install;
7
+ // it will download on first execution.
8
+ ensureBinary()
9
+ .then(() => {
10
+ console.log('✓ PrimeCloud CLI binary ready.');
11
+ })
12
+ .catch(() => {
13
+ // Silently continue; runtime will handle download
14
+ });
package/cli/run.js ADDED
@@ -0,0 +1,118 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+ const os = require('os');
6
+ const { spawnSync } = require('child_process');
7
+ const https = require('https');
8
+
9
+ const PKG = require('../package.json');
10
+ const VERSION = PKG.version;
11
+ const REPO = 'PrimeTech-Nexus/primecloud-cli';
12
+
13
+ function getBinaryInfo() {
14
+ let platform = process.platform;
15
+ if (platform === 'win32') platform = 'windows';
16
+
17
+ let arch = process.arch;
18
+ if (arch === 'x64') arch = 'amd64';
19
+
20
+ const ext = process.platform === 'win32' ? '.exe' : '';
21
+ const filename = `primecloud-${platform}-${arch}${ext}`;
22
+ const shortName = `primecloud${ext}`;
23
+
24
+ return { platform, arch, ext, filename, shortName };
25
+ }
26
+
27
+ function findExistingBinary(info) {
28
+ const candidates = [
29
+ path.join(__dirname, '..', 'bin', info.shortName),
30
+ path.join(__dirname, info.shortName),
31
+ path.join(__dirname, info.filename),
32
+ path.join(os.homedir(), '.primecloud', 'bin', info.shortName)
33
+ ];
34
+
35
+ for (const candidate of candidates) {
36
+ if (fs.existsSync(candidate)) {
37
+ try {
38
+ fs.accessSync(candidate, fs.constants.X_OK);
39
+ } catch {
40
+ if (process.platform !== 'win32') {
41
+ try { fs.chmodSync(candidate, 0o755); } catch {}
42
+ }
43
+ }
44
+ return candidate;
45
+ }
46
+ }
47
+ return null;
48
+ }
49
+
50
+ function downloadBinary(url, destPath) {
51
+ return new Promise((resolve, reject) => {
52
+ https.get(url, (res) => {
53
+ if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
54
+ return downloadBinary(res.headers.location, destPath).then(resolve).catch(reject);
55
+ }
56
+ if (res.statusCode !== 200) {
57
+ return reject(new Error(`Failed to download binary: HTTP ${res.statusCode}`));
58
+ }
59
+ const file = fs.createWriteStream(destPath);
60
+ res.pipe(file);
61
+ file.on('finish', () => {
62
+ file.close(() => {
63
+ if (process.platform !== 'win32') {
64
+ fs.chmodSync(destPath, 0o755);
65
+ }
66
+ resolve(destPath);
67
+ });
68
+ });
69
+ }).on('error', (err) => {
70
+ try { fs.unlinkSync(destPath); } catch {}
71
+ reject(err);
72
+ });
73
+ });
74
+ }
75
+
76
+ async function ensureBinary() {
77
+ const info = getBinaryInfo();
78
+ const existing = findExistingBinary(info);
79
+ if (existing) {
80
+ return existing;
81
+ }
82
+
83
+ const targetPath = path.join(__dirname, info.filename);
84
+ const downloadUrl = `https://github.com/${REPO}/releases/download/v${VERSION}/${info.filename}`;
85
+
86
+ process.stderr.write(`PrimeCloud binary not found. Downloading v${VERSION} for ${info.platform}/${info.arch}...\n`);
87
+ try {
88
+ await downloadBinary(downloadUrl, targetPath);
89
+ return targetPath;
90
+ } catch (err) {
91
+ process.stderr.write(`Error downloading PrimeCloud binary from ${downloadUrl}: ${err.message}\n`);
92
+ process.stderr.write(`You can also build from source: go build -o bin/${info.shortName} ./cmd/primecloud\n`);
93
+ process.exit(1);
94
+ }
95
+ }
96
+
97
+ async function main() {
98
+ const binaryPath = await ensureBinary();
99
+ const result = spawnSync(binaryPath, process.argv.slice(2), {
100
+ stdio: 'inherit'
101
+ });
102
+
103
+ if (result.error) {
104
+ console.error('Error executing primecloud binary:', result.error.message);
105
+ process.exit(1);
106
+ }
107
+
108
+ process.exit(result.status ?? 0);
109
+ }
110
+
111
+ if (require.main === module) {
112
+ main().catch((err) => {
113
+ console.error(err);
114
+ process.exit(1);
115
+ });
116
+ }
117
+
118
+ module.exports = { ensureBinary, getBinaryInfo };
package/package.json CHANGED
@@ -1,6 +1,24 @@
1
1
  {
2
2
  "name": "primecloud",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.1",
4
+ "description": "PrimeCloud CLI — Developer interface to the PrimeCloud Control Plane",
5
+ "bin": "./cli/run.js",
6
+ "keywords": [
7
+ "primecloud",
8
+ "cloud",
9
+ "deploy",
10
+ "cli",
11
+ "serverless",
12
+ "containers",
13
+ "database"
14
+ ],
15
+ "author": "PrimeTech Nexus",
16
+ "license": "Apache-2.0",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/PrimeTech-Nexus/primecloud-cli.git"
20
+ },
21
+ "engines": {
22
+ "node": ">=16.0.0"
23
+ }
24
+ }