@parthiv-joshi-29/peos 0.1.0

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.
Files changed (3) hide show
  1. package/README.md +254 -0
  2. package/dist/cli.js +165 -0
  3. package/package.json +19 -0
package/README.md ADDED
@@ -0,0 +1,254 @@
1
+ # PEOS
2
+
3
+ > **Personal Engineering Operating System**
4
+
5
+ ## Quick start
6
+
7
+ Install the CLI from this repository, then initialize a project:
8
+
9
+ ```bash
10
+ npm install -g @parthiv-joshi-29/peos
11
+ peos init ./my-project
12
+ ```
13
+
14
+ Preview the files first with `peos init ./my-project --dry-run`.
15
+
16
+ PEOS is a developer-first project foundation generator designed to help teams and solo developers initialize repeatable engineering environments with reusable documentation and standards.
17
+
18
+ Instead of starting every project from scratch, PEOS captures the repeated decisions that usually happen at the beginning of development—such as folder structure, documentation, tooling, conventions, and project rules—and turns them into reusable workflows that can be executed with a single command.
19
+
20
+ PEOS sits **before AI coding agents**. Its job is to prepare the project foundation so that coding agents can work inside a clear, consistent, and production-ready environment rather than guessing how the project should be structured.
21
+
22
+ At its core, PEOS is about making engineering setup intentional, repeatable, and scalable.
23
+
24
+ ---
25
+
26
+ # Why PEOS?
27
+
28
+ Starting a new project usually means repeating the same engineering tasks over and over again:
29
+
30
+ * Creating the folder structure
31
+ * Choosing a technology stack
32
+ * Configuring development tools
33
+ * Writing project documentation
34
+ * Defining coding and architectural standards
35
+ * Initializing Git repositories
36
+ * Preparing reusable templates for future work
37
+
38
+ These tasks are important, but they are also repetitive and easy to overlook. When they are done inconsistently, the result is often a project that feels fragmented from the beginning.
39
+
40
+ PEOS exists to solve that problem.
41
+
42
+ It automates the initialization process while still allowing developers to customize workflows for different project types, teams, and goals. Instead of forcing every project into the same shape, PEOS helps create the right foundation for each one.
43
+
44
+ The goal is not just to save time. The goal is to make the beginning of every project more deliberate, more consistent, and easier to build on.
45
+
46
+ ---
47
+
48
+ # Core Philosophy
49
+
50
+ PEOS is built around a few simple principles:
51
+
52
+ * Engineering workflows should be reusable, not rewritten for every project.
53
+ * Every project should begin with a solid foundation.
54
+ * Developers should own their workflows and be able to adapt them to their needs.
55
+ * AI coding agents should focus on writing software, not preparing projects.
56
+ * Simplicity is better than unnecessary abstraction.
57
+ * Good engineering decisions should be captured once and reused many times.
58
+
59
+ PEOS is not meant to replace engineering judgment. It is meant to preserve it, package it, and make it easier to apply consistently across projects.
60
+
61
+ ---
62
+
63
+ # Features
64
+
65
+ ## Workflow Engine
66
+
67
+ PEOS provides a workflow engine for executing reusable engineering workflows that initialize projects in a structured way.
68
+
69
+ A workflow can define how a project should be created, what files should be generated, what rules should be applied, and what documentation should be included. This makes it possible to standardize project setup without making it rigid.
70
+
71
+ ## Project Templates
72
+
73
+ PEOS supports project templates that represent different kinds of engineering foundations.
74
+
75
+ Templates are not just technology presets. They are project profiles that reflect the needs of different kinds of work.
76
+
77
+ Examples include:
78
+
79
+ * Production Application
80
+ * Side Project
81
+ * API Service
82
+ * Library
83
+ * CLI Tool
84
+
85
+ Each template can define its own structure, documentation, rules, and setup behavior so that the project starts with the right assumptions from day one.
86
+
87
+ ## Rules Generation
88
+
89
+ PEOS can generate project rule files before development begins.
90
+
91
+ These rules help establish engineering standards and conventions such as:
92
+
93
+ * Code style expectations
94
+ * Architectural boundaries
95
+ * Documentation requirements
96
+ * Workflow preferences
97
+ * AI agent behavior guidelines
98
+
99
+ This is especially useful when working with AI coding agents, because it gives them a clear context for how the project should be handled.
100
+
101
+ ## Engineering Documentation
102
+
103
+ PEOS can automatically initialize the documentation needed to guide a project from idea to implementation.
104
+
105
+ This may include:
106
+
107
+ * Vision
108
+ * Product Requirements Document (PRD)
109
+ * Architecture
110
+ * Technical Specification
111
+ * Development Plan
112
+ * Changelog
113
+
114
+ By generating these documents early, PEOS helps teams think through the project before implementation begins and keeps important decisions visible throughout development.
115
+
116
+ ## Technology Stack Configuration
117
+
118
+ PEOS supports customization across different technologies and project preferences.
119
+
120
+ This can include:
121
+
122
+ * Frameworks
123
+ * Databases
124
+ * Package managers
125
+ * Deployment targets
126
+ * Runtime environments
127
+ * Tooling preferences
128
+
129
+ The goal is to make project initialization flexible enough to support different engineering styles while still keeping the setup process structured and repeatable.
130
+
131
+ ---
132
+
133
+ # Planned CLI
134
+
135
+ ```bash
136
+ peos init
137
+
138
+ peos template list
139
+
140
+ peos template show node-service
141
+
142
+ peos template validate node-service
143
+
144
+ peos context inspect
145
+
146
+ peos doctor
147
+
148
+ peos workflow
149
+
150
+ peos template production-app
151
+
152
+ peos template side-project
153
+
154
+ peos rules
155
+
156
+ peos doctor
157
+
158
+ peos update
159
+ ```
160
+
161
+ > Command names are subject to change during development.
162
+
163
+ These commands are intended to make PEOS easy to use from the terminal while keeping the workflow focused on project initialization, configuration, and maintenance.
164
+
165
+ ---
166
+
167
+ # Repository Structure
168
+
169
+ ```text
170
+ peos/
171
+ ├── cli/
172
+ ├── docs/
173
+ ├── templates/
174
+ ├── workflows/
175
+ ├── examples/
176
+ ├── .github/
177
+ ├── README.md
178
+ ├── LICENSE
179
+ ├── CONTRIBUTING.md
180
+ └── CHANGELOG.md
181
+ ```
182
+
183
+ This structure reflects the main parts of the project:
184
+
185
+ * `cli/` for command-line functionality
186
+ * `docs/` for project documentation and engineering references
187
+ * `templates/` for reusable project profiles
188
+ * `workflows/` for initialization logic and automation steps
189
+ * `examples/` for sample usage and reference implementations
190
+ * `.github/` for repository automation and community files
191
+
192
+ ---
193
+
194
+ # Roadmap
195
+
196
+ ### Milestone 1
197
+
198
+ * Project foundation
199
+ * Engineering documentation
200
+ * Repository setup
201
+
202
+ ### Milestone 2
203
+
204
+ * CLI bootstrap
205
+ * Command parsing
206
+ * Configuration loading
207
+
208
+ ### Milestone 3
209
+
210
+ * Workflow engine
211
+
212
+ ### Milestone 4
213
+
214
+ * Template engine
215
+
216
+ ### Milestone 5
217
+
218
+ * Project generation
219
+
220
+ ### Milestone 6
221
+
222
+ * Official workflows
223
+
224
+ ### Milestone 7
225
+
226
+ * Public release
227
+
228
+ The roadmap reflects the intended progression of PEOS from a documented vision into a usable engineering system. The early milestones focus on clarity and structure, while later milestones expand into automation, templates, and project generation.
229
+
230
+ ---
231
+
232
+ # Status and limitations
233
+
234
+ PEOS is an early V1 prototype. The working path is `peos init`, using one built-in `node-service` template. It generates a small TypeScript project, PEOS metadata, a manifest, and generic Markdown context.
235
+
236
+ It does not yet execute workflows, run AI agents, update existing foundations, merge managed files, load remote assets, or support additional asset types. `peos update` and `peos diff` remain deferred until real projects establish safe generated-file ownership rules. See [the V1 decision](docs/decisions/0001-v1-boundary.md) and [the development plan](docs/development-plan.md).
237
+
238
+ The future template direction is documented in [ADR 0002](docs/decisions/0002-user-owned-templates-and-harness-authoring.md): users own and customize their templates, while agentic harnesses may help create and validate them through PEOS interfaces.
239
+
240
+ The immediate test is whether `peos init ./my-project` saves meaningful setup time and produces context developers keep after real work begins.
241
+
242
+ ---
243
+
244
+ # Contributing
245
+
246
+ Contributions, ideas, discussions, and feedback are welcome once the project reaches its first public release.
247
+
248
+ PEOS is being built as a long-term engineering system, and community input will be valuable as the project grows. If you are interested in workflows, developer tooling, project automation, or AI-assisted engineering, your perspective will help shape the direction of the project.
249
+
250
+ ---
251
+
252
+ # License
253
+
254
+ This project will be released under the MIT License.
package/dist/cli.js ADDED
@@ -0,0 +1,165 @@
1
+ #!/usr/bin/env node
2
+ import crypto from "node:crypto";
3
+ import fs from "node:fs";
4
+ import path from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+ const VERSION = "0.1.0";
7
+ const interactive = Boolean(process.stdout.isTTY);
8
+ const color = (code, value) => interactive ? `\x1b[${code}m${value}\x1b[0m` : value;
9
+ const logo = () => [
10
+ color("38;5;75", " ██████╗ ███████╗ ██████╗ ███████╗"),
11
+ color("38;5;111", " ██╔══██╗██╔════╝██╔═══██╗██╔════╝"),
12
+ color("38;5;147", " ██████╔╝█████╗ ██║ ██║███████╗"),
13
+ color("38;5;183", " ██╔═══╝ ██╔══╝ ██║ ██║╚════██║"),
14
+ color("38;5;219", " ██║ ███████╗╚██████╔╝███████║"),
15
+ color("38;5;225", " ╚═╝ ╚══════╝ ╚═════╝ ╚══════╝")
16
+ ].join("\n");
17
+ const step = (label, detail) => console.log(` ${color("32", "✓")} ${label}${detail ? color("2", ` · ${detail}`) : ""}`);
18
+ const TEMPLATE = { name: "node-service", version: "1.0.0", description: "A minimal TypeScript Node.js service foundation" };
19
+ const templateFiles = ["README.md", "package.json", "tsconfig.json", "src/index.ts", ".peos/project.yaml", ".peos/generated/engineering-environment.md"];
20
+ const projectName = (target) => path.basename(path.resolve(target)) || "project";
21
+ const filesFor = (name) => [
22
+ ["README.md", `# ${name}\n\nInitialized with PEOS.\n\nRun \`npm install\` and \`npm test\` to verify the foundation.\n`],
23
+ ["package.json", JSON.stringify({ name, version: "0.1.0", private: true, type: "module", scripts: { build: "tsc", test: "npm run build && node dist/index.js" }, devDependencies: { typescript: "^5.0.0" } }, null, 2) + "\n"],
24
+ ["tsconfig.json", JSON.stringify({ compilerOptions: { target: "ES2022", module: "NodeNext", moduleResolution: "NodeNext", rootDir: "src", outDir: "dist", strict: true }, include: ["src/**/*.ts"] }, null, 2) + "\n"],
25
+ ["src/index.ts", `console.log("${name} is ready");\n`],
26
+ [".peos/project.yaml", `format_version: 1\nproject:\n name: ${name}\ntemplate:\n name: ${TEMPLATE.name}\n version: ${TEMPLATE.version}\n source: builtin\nharness:\n target: generic-markdown\n`],
27
+ [".peos/generated/engineering-environment.md", `# PEOS Engineering Environment\n\n## Project\n\n- Name: ${name}\n- Template: ${TEMPLATE.name}@${TEMPLATE.version}\n\n## Boundary\n\nPEOS prepares the engineering environment. The developer or agentic harness performs the engineering work.\n\n## Documents\n\n- [Project README](../../README.md)\n- [Project metadata](../project.yaml)\n`]
28
+ ];
29
+ function manifest(name, files) {
30
+ const entries = files.map(([file, content]) => ` - path: ${file}\n sha256: ${crypto.createHash("sha256").update(content).digest("hex")}`).join("\n");
31
+ return `format_version: 1\ngenerated_by:\n peos_version: ${VERSION}\n operation: init\nproject:\n name: ${name}\ntemplate:\n name: ${TEMPLATE.name}\n version: ${TEMPLATE.version}\n source: builtin\nfiles:\n${entries}\n`;
32
+ }
33
+ function writeAtomically(destination, content) {
34
+ const temporary = `${destination}.peos-tmp-${process.pid}`;
35
+ fs.writeFileSync(temporary, content, "utf8");
36
+ fs.renameSync(temporary, destination);
37
+ }
38
+ export function init(target, dryRun = false, template = "node-service") {
39
+ if (template !== "node-service")
40
+ throw new Error(`PEOS_TEMPLATE_NOT_FOUND: ${template}`);
41
+ const root = path.resolve(target);
42
+ const name = projectName(root);
43
+ const files = filesFor(name);
44
+ if (fs.existsSync(path.join(root, ".peos", "project.yaml")))
45
+ throw new Error("PEOS_INIT_ALREADY_INITIALIZED");
46
+ const conflicts = files.map(([file]) => file).filter(file => fs.existsSync(path.join(root, file)));
47
+ if (conflicts.length)
48
+ throw new Error(`PEOS_INIT_CONFLICT: ${conflicts.join(", ")}`);
49
+ const allFiles = [...files, [".peos/manifest.yaml", manifest(name, files)]];
50
+ if (dryRun) {
51
+ console.log(`\n${color("1", "Preview initialization")} ${color("2", `· ${root}`)}`);
52
+ console.log(`\n ${color("36", TEMPLATE.name)} ${color("2", `v${TEMPLATE.version}`)}`);
53
+ allFiles.forEach(([file]) => console.log(` create ${file}`));
54
+ return;
55
+ }
56
+ allFiles.forEach(([file, content]) => {
57
+ const destination = path.join(root, file);
58
+ fs.mkdirSync(path.dirname(destination), { recursive: true });
59
+ writeAtomically(destination, content);
60
+ });
61
+ console.log(`\n${color("1", "Project ready")} ${color("2", `· ${root}`)}\n`);
62
+ step("Foundation created", `${allFiles.length} files`);
63
+ step("Template applied", `${TEMPLATE.name}@${TEMPLATE.version}`);
64
+ step("Context generated", ".peos/generated/engineering-environment.md");
65
+ console.log(`\n Next: ${color("36", `cd ${root}`)} && ${color("36", "npm install")}`);
66
+ }
67
+ export function listTemplates() {
68
+ console.log(`${TEMPLATE.name}\t${TEMPLATE.version}\t${TEMPLATE.description}`);
69
+ }
70
+ export function showTemplate(name = TEMPLATE.name) {
71
+ if (name !== TEMPLATE.name)
72
+ throw new Error(`PEOS_TEMPLATE_NOT_FOUND: ${name}`);
73
+ console.log(`${TEMPLATE.name}@${TEMPLATE.version}\n\n${TEMPLATE.description}\n\nFiles:\n${templateFiles.map(file => `- ${file}`).join("\n")}`);
74
+ }
75
+ export function validateTemplate(name = TEMPLATE.name) {
76
+ if (name !== TEMPLATE.name)
77
+ throw new Error(`PEOS_TEMPLATE_NOT_FOUND: ${name}`);
78
+ console.log(`✓ ${TEMPLATE.name}@${TEMPLATE.version} is valid`);
79
+ }
80
+ export function inspectContext(target = ".") {
81
+ const context = path.join(path.resolve(target), ".peos", "generated", "engineering-environment.md");
82
+ if (!fs.existsSync(context))
83
+ throw new Error("PEOS_CONTEXT_NOT_FOUND");
84
+ const content = fs.readFileSync(context, "utf8");
85
+ const links = [...content.matchAll(/^- \[([^\]]+)\]\(([^)]+)\)$/gm)].map(match => `${match[1]} → ${match[2]}`);
86
+ console.log(`Context: ${context}\nBytes: ${Buffer.byteLength(content, "utf8")}\nIncluded documents:\n${links.length ? links.map(link => `- ${link}`).join("\n") : "- none"}`);
87
+ }
88
+ export function doctor(target = ".") {
89
+ const root = path.resolve(target);
90
+ const manifestPath = path.join(root, ".peos", "manifest.yaml");
91
+ if (!fs.existsSync(manifestPath))
92
+ throw new Error("PEOS_NOT_INITIALIZED");
93
+ const manifestText = fs.readFileSync(manifestPath, "utf8");
94
+ const entries = [...manifestText.matchAll(/^ - path: (.+)\n sha256: ([a-f0-9]{64})$/gm)];
95
+ const problems = [];
96
+ if (!fs.existsSync(path.join(root, ".peos", "project.yaml")))
97
+ problems.push("missing .peos/project.yaml");
98
+ for (const [, file, expected] of entries) {
99
+ const destination = path.join(root, file);
100
+ if (!fs.existsSync(destination))
101
+ problems.push(`missing ${file}`);
102
+ else if (crypto.createHash("sha256").update(fs.readFileSync(destination)).digest("hex") !== expected)
103
+ problems.push(`modified ${file}`);
104
+ }
105
+ if (problems.length) {
106
+ console.log(`✗ PEOS health check failed\n${problems.map(problem => `- ${problem}`).join("\n")}`);
107
+ return false;
108
+ }
109
+ console.log(`✓ PEOS project is healthy (${entries.length} managed files)`);
110
+ return true;
111
+ }
112
+ function main() {
113
+ const args = process.argv.slice(2);
114
+ if (args[0] === "template") {
115
+ const action = args[1] ?? "list";
116
+ const name = args[2] ?? TEMPLATE.name;
117
+ if (action === "list")
118
+ return listTemplates();
119
+ if (action === "show")
120
+ return showTemplate(name);
121
+ if (action === "validate")
122
+ return validateTemplate(name);
123
+ throw new Error("Usage: peos template [list|show|validate] [name]");
124
+ }
125
+ if (args[0] === "context" && args[1] === "inspect")
126
+ return inspectContext(args[2] ?? ".");
127
+ if (args[0] === "doctor") {
128
+ if (!doctor(args[1] ?? "."))
129
+ process.exitCode = 1;
130
+ return;
131
+ }
132
+ if (args[0] !== "init")
133
+ throw new Error("Usage: peos init [target] [--template <name>] [--dry-run]");
134
+ let target = ".";
135
+ let template = "node-service";
136
+ for (let i = 1; i < args.length; i += 1) {
137
+ if (args[i] === "--dry-run")
138
+ continue;
139
+ if (args[i] === "--template") {
140
+ template = args[++i] ?? "";
141
+ continue;
142
+ }
143
+ if (args[i].startsWith("--template=")) {
144
+ template = args[i].slice("--template=".length);
145
+ continue;
146
+ }
147
+ if (args[i].startsWith("--"))
148
+ throw new Error(`Unknown option: ${args[i]}`);
149
+ if (target !== ".")
150
+ throw new Error("Usage: peos init [target] [--template <name>] [--dry-run]");
151
+ target = args[i];
152
+ }
153
+ init(target, args.includes("--dry-run"), template);
154
+ }
155
+ if (process.argv[1] && fileURLToPath(import.meta.url) === fs.realpathSync(process.argv[1])) {
156
+ try {
157
+ console.log(`\n${logo()}\n`);
158
+ main();
159
+ }
160
+ catch (error) {
161
+ const message = error instanceof Error ? error.message : String(error);
162
+ console.error(`\n${color("31", "✗")} ${message}`);
163
+ process.exitCode = 1;
164
+ }
165
+ }
package/package.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "@parthiv-joshi-29/peos",
3
+ "version": "0.1.0",
4
+ "description": "A small, local-first project foundation generator.",
5
+ "engines": { "node": ">=22" },
6
+ "type": "module",
7
+ "publishConfig": { "access": "public" },
8
+ "files": ["dist"],
9
+ "bin": { "peos": "dist/cli.js" },
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "prepublishOnly": "npm run build",
13
+ "test": "npm run build && node --test test/init.test.js"
14
+ },
15
+ "devDependencies": {
16
+ "@types/node": "^22.0.0",
17
+ "typescript": "^5.0.0"
18
+ }
19
+ }