@josfox/jos 4.0.7 → 4.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.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2024 JOS Open Standards Foundation
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2024 JOS Open Standards Foundation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,186 +1,138 @@
1
- <div align="center">
2
-
3
- ```
4
- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⡀⠀⠀⠀
5
- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣾⠙⠻⢶⣄⡀⠀⠀⠀⢀⣤⠶⠛⠛⡇⠀⠀⠀
6
- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣇⠀⠀⣙⣿⣦⣤⣴⣿⣁⠀⠀⣸⠇⠀⠀⠀
7
- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣡⣾⣿⣿⣿⣿⣿⣿⣿⣷⣌⠋⠀⠀⠀⠀
8
- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⣿⣷⣄⡈⢻⣿⡟⢁⣠⣾⣿⣦⠀⠀⠀⠀
9
- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣿⣿⣿⣿⠘⣿⠃⣿⣿⣿⣿⡏⠀⠀⠀⠀
10
- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⠀⠈⠛⣰⠿⣆⠛⠁⠀⡀⠀⠀⠀⠀⠀
11
- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⣿⣦⠀⠘⠛⠋⠀⣴⣿⠁⠀⠀⠀⠀⠀
12
- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣤⣶⣾⣿⣿⣿⣿⡇⠀⠀⠀⢸⣿⣏⠀⠀⠀⠀⠀⠀
13
- ⠀⠀⠀⠀⠀⠀⣠⣶⣿⣿⣿⣿⣿⣿⣿⣿⠿⠿⠀⠀⠀⠾⢿⣿⠀⠀⠀⠀⠀⠀
14
- ⠀⠀⠀⠀⣠⣿⣿⣿⣿⣿⣿⡿⠟⠋⣁⣠⣤⣤⡶⠶⠶⣤⣄⠈⠀⠀⠀⠀⠀⠀
15
- ⠀⠀⠀⢰⣿⣿⣮⣉⣉⣉⣤⣴⣶⣿⣿⣋⡥⠄⠀⠀⠀⠀⠉⢻⣄⠀⠀⠀⠀⠀
16
- ⠀⠀⠀⠸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣟⣋⣁⣤⣀⣀⣤⣤⣤⣤⣄⣿⡄⠀⠀⠀⠀
17
- ⠀⠀⠀⠀⠙⠿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠛⠋⠉⠁⠀⠀⠀⠀⠈⠛⠃⠀⠀⠀⠀
18
- ⠀⠀⠀⠀⠀⠀⠀⠉⠉⠉⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
19
- ```
20
-
21
- # @josfox/jos
22
-
23
- **Format version v0.0.7 — Specification maturity v0.1.0 (Alpha)**
24
-
25
- **Stoic Kernel for AI Agent Orchestration**
26
-
27
- [![npm](https://img.shields.io/badge/npm-@josfox/jos-00ffff?style=for-the-badge)](https://www.npmjs.com/package/@josfox/jos)
28
- [![Version](https://img.shields.io/badge/version-4.0.4-success?style=for-the-badge)](#)
29
- [![Dependencies](https://img.shields.io/badge/dependencies-0-blue?style=for-the-badge)](#zero-dependencies)
30
- [![License](https://img.shields.io/badge/license-MIT-purple?style=for-the-badge)](LICENSE)
31
-
32
- *Zero Dependencies Offline First • Open Standard*
33
-
34
- </div>
35
-
36
- ---
37
-
38
- ## Overview
39
-
40
- **@josfox/jos** is the reference implementation of the **.jos Open Standard** — a portable artifact format for AI agent orchestration.
41
-
42
- | Feature | Description |
43
- |---------|-------------|
44
- | **Stoic Kernel** | 77-line minimal kernel with zero dependencies |
45
- | **Plugin Architecture** | Commands live in `~/.jos/commands/` or bundled |
46
- | **Offline First** | Works without network, like Git |
47
- | **A2A Compatible** | Designed for Agent-to-Agent interoperability |
48
-
49
- ---
50
-
51
- ## Quick Start
52
-
53
- ```bash
54
- # Run with npx (no install required)
55
- npx josfox serve
56
-
57
- # Or install globally
58
- npm install -g @josfox/jos
59
- jos serve
60
- ```
61
-
62
- ---
63
-
64
- ## Commands
65
-
66
- | Command | Description |
67
- |---------|-------------|
68
- | `jos serve` | Start development server with dashboard |
69
- | `jos run <file>` | Execute .jos artifacts |
70
- | `jos get <package>` | Fetch packages from repositories |
71
- | `jos secrets` | Manage encrypted credentials (AES-256) |
72
- | `jos repo` | Manage package repositories |
73
-
74
- ```bash
75
- # Examples
76
- jos serve --port 8080
77
- jos run artifact.jos --dry-run
78
- jos get myrepo:package-name
79
- jos secrets set API_KEY sk-abc123
80
- ```
81
-
82
- ---
83
-
84
- ## The .jos Standard
85
-
86
- A `.jos` file binds **Intention** and **Execution** into one portable artifact:
87
-
88
- ```json
89
- {
90
- "meta": { "name": "example", "version": "1.0.0" },
91
- "intention": {
92
- "objective": "What this artifact does",
93
- "success_criteria": "How to know it worked"
94
- },
95
- "guardrails": { "avoid": [], "max_retries": 3 },
96
- "orchestration": {
97
- "flows": { "main": { "steps": ["task1", "task2"] } }
98
- }
99
- }
100
- ```
101
-
102
- > Full specification: [jos.md](./jos.md)
103
-
104
- ---
105
-
106
- ## Architecture
107
-
108
- ```
109
- ~/.jos/
110
- ├── commands/ # Plugin architecture
111
- ├── artifacts/ # Package cache
112
- ├── secrets/ # Encrypted vault (AES-256)
113
- ├── runs/ # Execution epochs
114
- ├── repos.json # Repository configuration
115
- └── lock.json # Package integrity
116
- ```
117
-
118
- ---
119
-
120
- ## A2A Protocol Compatibility
121
-
122
- This implementation is designed to be compatible with agent interoperability protocols, including the A2A (Agent-to-Agent) Protocol.
123
-
124
- - **.jos artifacts** can serve as A2A task payloads
125
- - **Agents** can declare .jos compatibility in capability cards
126
- - **Integrity verification** ensures secure artifact exchange
127
-
128
- ---
129
-
130
- ## Disclaimer & Legal
131
-
132
- ### AS-IS Software
133
-
134
- This software is provided **"AS IS"**, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and noninfringement.
135
-
136
- ### Liability
137
-
138
- In no event shall the authors, contributors, or the JOS Open Standards Foundation be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the software or the use or other dealings in the software.
139
-
140
- ### Your Responsibility
141
-
142
- - You use this software **at your own risk**
143
- - You are responsible for validating its suitability for your use case
144
- - You are responsible for compliance with applicable laws and regulations
145
-
146
- ### Trademark Notice
147
-
148
- - **JOS**, **JOSFOX**, and the Kitsune fox logo are trademarks of the JOS Open Standards Foundation
149
- - **A2A Protocol** and related terminology are property of their respective owners
150
- - **Google** and related trademarks are property of Google LLC
151
- - All other trademarks are property of their respective owners
152
-
153
- This project is an independent open-source implementation and is **not affiliated with, endorsed by, or sponsored by** any third-party trademark holders mentioned in this documentation.
154
-
155
- ### Citation Requirement
156
-
157
- If you implement or distribute the .jos standard, you must include attribution to:
158
- - The **JOS Open Standards Foundation**
159
- - The official specification repository
160
-
161
- ---
162
-
163
- ## License
164
-
165
- **MIT License** — See [LICENSE](./LICENSE) for details.
166
-
167
- Free to use for personal, educational, and commercial purposes.
168
-
169
- ---
170
-
171
- <div align="center">
172
-
173
- **Made with ❤️ & AI**
174
-
175
- *JOS Open Standards Foundation*
176
-
177
- ```
178
- ██╗ ██╗██╗████████╗███████╗██╗ ██╗███╗ ██╗███████╗
179
- ██║ ██╔╝██║╚══██╔══╝██╔════╝██║ ██║████╗ ██║██╔════╝
180
- █████╔╝ ██║ ██║ ███████╗██║ ██║██╔██╗ ██║█████╗
181
- ██╔═██╗ ██║ ██║ ╚════██║██║ ██║██║╚██╗██║██╔══╝
182
- ██║ ██╗██║ ██║ ███████║╚██████╔╝██║ ╚████║███████╗
183
- ╚═╝ ╚═╝╚═╝ ╚═╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝
184
- ```
185
-
186
- </div>
1
+ # JOS Open Standard
2
+
3
+ > **The minimal atomic unit for fractal, intention-native Adaptive Intelligent Agents.**
4
+
5
+ JOS (JSON Object Specification) introduces a novel fractal paradigm for AI orchestration—**intention-based, efficient, portable, secure, and adaptive by design.** Every `.jos` artifact encodes both the *why* (intention) and the *how* (execution) as a single, versioned, cryptographically verifiable unit.
6
+
7
+ [![npm](https://img.shields.io/npm/v/@josfox/jos?label=%40josfox%2Fjos)](https://www.npmjs.com/package/@josfox/jos)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
9
+ [![Specification](https://img.shields.io/badge/Spec-v0.0.7-purple.svg)](https://github.com/josfox-ai/jos-format-spec)
10
+
11
+ ---
12
+
13
+ ## ✨ What's New in v4.1.0
14
+
15
+ ### 🧠 LLM Integration & Prompt Enhancement
16
+ - **Native LLM Support**: `jos llm <artifact>` crystallizes `.jos` intentions into chat-oriented prompts for any AI/LLM/GPT
17
+ - **Multi-Adapter Architecture**: Ollama (local), Gemini, OpenAI, Anthropic adapters built-in
18
+ - **Prompt Enhancement**: Automatically enriches prompts with guardrails, context, and success criteria
19
+
20
+ ### 🦊 Introducing ALAIA
21
+ **Adaptive Learning AI Agent** — the nano-agent framework that bonds to `.jos` artifacts, enabling:
22
+ - Offline-first execution with Ollama
23
+ - Real-time guardrail enforcement
24
+ - Adaptive learning from execution feedback
25
+
26
+ ### 🚀 Quick Start with Ollama
27
+ Run locally with zero cloud dependencies:
28
+ ```bash
29
+ # Install JOS
30
+ npm install -g @josfox/jos
31
+
32
+ # Clone starter examples
33
+ git clone https://github.com/josfox-ai/jos-repo-starter
34
+ cd jos-repo-starter
35
+
36
+ # Run with local Ollama
37
+ jos llm examples/hello-ai.jos --adapter ollama
38
+ ```
39
+
40
+ ---
41
+
42
+ ## 🎯 The Fractal Paradigm
43
+
44
+ > *"Everything is a prompt. Every prompt is an intention. Every intention is an artifact."*
45
+
46
+ JOS artifacts are **self-similar at all scales**—from atomic single-step automations to orchestrated enterprise workflows. The same schema, the same validation, the same security model.
47
+
48
+ ```
49
+ ┌─────────────────────────────────────────────────────────────────┐
50
+ │ .jos ARTIFACT │
51
+ ├─────────────────────────────────────────────────────────────────┤
52
+ │ MAGIC Kernel (Why + What) │ JOSFOXAI Kernel (How + Who) │
53
+ │ ───────────────────────── │ ─────────────────────────── │
54
+ │ • intention │ • orchestration │
55
+ │ • success_criteria │ • security │
56
+ │ • guardrails │ • files │
57
+ │ • capabilities │ • integrity verification │
58
+ └─────────────────────────────────────────────────────────────────┘
59
+ ```
60
+
61
+ ---
62
+
63
+ ## 📦 Installation
64
+
65
+ ```bash
66
+ # Core kernel (zero dependencies)
67
+ npm install -g @josfox/jos
68
+
69
+ # With orchestration controller
70
+ npm install -g josctl
71
+
72
+ # With extended CLI features
73
+ npm install -g @josfox/jos-cli
74
+ ```
75
+
76
+ ---
77
+
78
+ ## 🔧 Commands
79
+
80
+ | Command | Description |
81
+ |---------|-------------|
82
+ | `jos run <artifact>` | Execute a .jos artifact |
83
+ | `jos llm <artifact>` | Crystallize intention for LLM interaction |
84
+ | `jos validate <artifact>` | Strict validation (13 required keys) |
85
+ | `jos serve` | Launch local dashboard |
86
+ | `jos get <foxtail>` | Install artifact from registry |
87
+
88
+ ---
89
+
90
+ ## 📝 Minimal Valid Artifact
91
+
92
+ Every `.jos` artifact requires **13 keys** for strict validation:
93
+
94
+ ```json
95
+ {
96
+ "id_jos": "example-v1",
97
+ "jos": { "open": "jos run artifact", "supports": ["@josfox/jos"] },
98
+ "orchestration_contract": { "version": "0.0.7", "mode": "sync" },
99
+ "meta": { "name": "example", "version": "1.0.0", "type": "atom" },
100
+ "intention": { "objective": "Demonstrate JOS", "success_criteria": "Output greeting" },
101
+ "guardrails": { "avoid": [], "max_retries": 0 },
102
+ "capabilities": ["demo"],
103
+ "artifacts": { "description": "Minimal example" },
104
+ "orchestration": {
105
+ "definitions": { "greet": { "type": "shell", "command": "echo 'Hello!'" } },
106
+ "flows": { "main": { "steps": ["greet"] } }
107
+ },
108
+ "security": { "type": "open", "permissions": [], "integrity_ref": null },
109
+ "files": [],
110
+ "x_run_params": { "timeout": 5000, "retry_on_failure": false },
111
+ "adaptive_ai": { "learning_enabled": false, "feedback_collection": false }
112
+ }
113
+ ```
114
+
115
+ ---
116
+
117
+ ## 🔗 Ecosystem Links
118
+
119
+ | Resource | Link |
120
+ |----------|------|
121
+ | 📖 **Specification** | [github.com/josfox-ai/jos-format-spec](https://github.com/josfox-ai/jos-format-spec) |
122
+ | 🦊 **Starter Examples** | [github.com/josfox-ai/jos-repo-starter](https://github.com/josfox-ai/jos-repo-starter) |
123
+ | 🎨 **KRMEN Design System** | [krmen.mx](https://krmen.mx) |
124
+ | 📦 **npm: @josfox/jos** | [npmjs.com/package/@josfox/jos](https://www.npmjs.com/package/@josfox/jos) |
125
+ | 📦 **npm: josctl** | [npmjs.com/package/josctl](https://www.npmjs.com/package/josctl) |
126
+
127
+ ---
128
+
129
+ ## 🏛️ Governance
130
+
131
+ **JOS Open Standards Foundation**
132
+ Specification v0.0.7 · Format v0.1.0 (Alpha)
133
+
134
+ ---
135
+
136
+ ## 📄 License
137
+
138
+ MIT © JOS Open Standards Foundation
package/bin/jos CHANGED
@@ -1,98 +1,160 @@
1
- #!/usr/bin/env node
2
- const fs = require('fs'), path = require('path'), { spawn } = require('child_process');
3
- const JOS_HOME = path.join(process.env.HOME, '.jos');
4
-
5
- // AURORA Design System
6
- const C = {
7
- reset: '\x1b[0m',
8
- bold: '\x1b[1m',
9
- dim: '\x1b[2m',
10
- purple: '\x1b[38;5;135m',
11
- magenta: '\x1b[38;5;198m',
12
- cyan: '\x1b[38;5;51m',
13
- blue: '\x1b[38;5;39m',
14
- white: '\x1b[38;5;255m',
15
- gray: '\x1b[38;5;245m',
16
- pink: '\x1b[38;5;213m',
17
- teal: '\x1b[38;5;44m',
18
- };
19
-
20
- // Aurora palette for random Kitsune colors 🦊
21
- const AURORA_COLORS = [C.purple, C.magenta, C.cyan, C.blue, C.pink, C.teal];
22
- const randomAurora = () => AURORA_COLORS[Math.floor(Math.random() * AURORA_COLORS.length)];
23
-
24
- // The legendary Kitsune fox
25
- const KITSUNE_FOX = `
26
- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⡀⠀⠀⠀
27
- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣾⠙⠻⢶⣄⡀⠀⠀⠀⢀⣤⠶⠛⠛⡇⠀⠀⠀
28
- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣇⠀⠀⣙⣿⣦⣤⣴⣿⣁⠀⠀⣸⠇⠀⠀⠀
29
- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣡⣾⣿⣿⣿⣿⣿⣿⣿⣷⣌⠋⠀⠀⠀⠀
30
- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⣿⣷⣄⡈⢻⣿⡟⢁⣠⣾⣿⣦⠀⠀⠀⠀
31
- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣿⣿⣿⣿⠘⣿⠃⣿⣿⣿⣿⡏⠀⠀⠀⠀
32
- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⠀⠈⠛⣰⠿⣆⠛⠁⠀⡀⠀⠀⠀⠀⠀
33
- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⣿⣦⠀⠘⠛⠋⠀⣴⣿⠁⠀⠀⠀⠀⠀
34
- ⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣤⣶⣾⣿⣿⣿⣿⡇⠀⠀⠀⢸⣿⣏⠀⠀⠀⠀⠀⠀
35
- ⠀⠀⠀⠀⠀⠀⣠⣶⣿⣿⣿⣿⣿⣿⣿⣿⠿⠿⠀⠀⠀⠾⢿⣿⠀⠀⠀⠀⠀⠀
36
- ⠀⠀⠀⠀⣠⣿⣿⣿⣿⣿⣿⡿⠟⠋⣁⣠⣤⣤⡶⠶⠶⣤⣄⠈⠀⠀⠀⠀⠀⠀
37
- ⠀⠀⠀⢰⣿⣿⣮⣉⣉⣉⣤⣴⣶⣿⣿⣋⡥⠄⠀⠀⠀⠀⠉⢻⣄⠀⠀⠀⠀⠀
38
- ⠀⠀⠀⠸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣟⣋⣁⣤⣀⣀⣤⣤⣤⣤⣄⣿⡄⠀⠀⠀⠀
39
- ⠀⠀⠀⠀⠙⠿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠛⠋⠉⠁⠀⠀⠀⠀⠈⠛⠃⠀⠀⠀⠀
40
- ⠀⠀⠀⠀⠀⠀⠀⠉⠉⠉⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀`;
41
-
42
- const getKitsuneBanner = () => {
43
- const color = randomAurora();
44
- return `${color}${KITSUNE_FOX}${C.reset}
45
- ${C.dim}Made with ❤️ & AI${C.reset}`;
46
- };
47
-
48
- const ALIASES = { server: 'serve' };
49
- const rawCmd = process.argv[2];
50
- const cmd = ALIASES[rawCmd] || rawCmd;
51
-
52
- if (!cmd) {
53
- console.log(getKitsuneBanner());
54
- console.log(`\n${C.purple}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${C.reset}`);
55
- console.log(` ${C.white}${C.bold}JOS${C.reset} ${C.cyan}KERNEL v4.0${C.reset} ${C.gray}// Stoic Architecture${C.reset}`);
56
- console.log(` ${C.dim}Format version v0.0.7 — Specification maturity v0.1.0 (Alpha)${C.reset}`);
57
- console.log(`${C.purple}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${C.reset}`);
58
- console.log(`\n${C.white}${C.bold} Usage:${C.reset} ${C.cyan}jos${C.reset} ${C.gray}<command>${C.reset} ${C.dim}[options]${C.reset}\n`);
59
- console.log(`${C.white}${C.bold} Commands:${C.reset}`);
60
- console.log(` ${C.cyan}serve${C.reset} ${C.gray}Start local development server${C.reset}`);
61
- console.log(` ${C.cyan}init${C.reset} ${C.gray}Create new .jos artifact${C.reset}`);
62
- console.log(` ${C.cyan}add${C.reset} ${C.gray}Add task to .jos artifact${C.reset}`);
63
- console.log(` ${C.cyan}validate${C.reset} ${C.gray}Validate .jos artifact${C.reset}`);
64
- console.log(` ${C.purple}run${C.reset} ${C.gray}Execute .jos artifacts${C.reset}`);
65
- console.log(` ${C.magenta}secrets${C.reset} ${C.gray}Manage encrypted credentials${C.reset}`);
66
- console.log(` ${C.blue}get${C.reset} ${C.gray}Fetch packages from repos${C.reset}\n`);
67
- console.log(`${C.dim} Run ${C.cyan}jos <cmd> --help${C.reset}${C.dim} for command-specific options${C.reset}\n`);
68
- process.exit(0);
69
- }
70
-
71
- // Look for command in multiple locations (priority order)
72
- const PKG_COMMANDS = path.join(__dirname, '..', 'src', 'commands'); // npm package
73
- const USER_COMMANDS = path.join(JOS_HOME, 'commands'); // user installed
74
-
75
- function findCommand(name) {
76
- // 1. Check user's ~/.jos/commands first (allows overrides)
77
- const userPath = path.join(USER_COMMANDS, name, 'index.js');
78
- if (fs.existsSync(userPath)) return userPath;
79
-
80
- // 2. Check npm package src/commands
81
- const pkgPath = path.join(PKG_COMMANDS, `${name}.js`);
82
- if (fs.existsSync(pkgPath)) return pkgPath;
83
-
84
- // 3. Check npm package src/ directly (for serve.js)
85
- const srcPath = path.join(__dirname, '..', 'src', `${name}.js`);
86
- if (fs.existsSync(srcPath)) return srcPath;
87
-
88
- return null;
89
- }
90
-
91
- const cmdPath = findCommand(cmd);
92
- if (!cmdPath) {
93
- const color = randomAurora();
94
- console.log(`\n${color} ✖${C.reset} ${C.white}Unknown command:${C.reset} ${C.cyan}${rawCmd}${C.reset}`);
95
- console.log(`${C.dim} Try: ${C.cyan}jos --help${C.reset}${C.dim} to see available commands${C.reset}\n`);
96
- process.exit(1);
97
- }
98
- require(cmdPath).execute(process.argv.slice(3), JOS_HOME);
1
+ #!/usr/bin/env node
2
+ const fs = require('fs'), path = require('path'), os = require('os'), { spawn } = require('child_process');
3
+ const JOS_HOME = path.join(os.homedir(), '.jos');
4
+
5
+ // Ensure JOS_HOME exists
6
+ if (!fs.existsSync(JOS_HOME)) {
7
+ try {
8
+ fs.mkdirSync(JOS_HOME, { recursive: true });
9
+ // Also create commands dir since we check it later
10
+ fs.mkdirSync(path.join(JOS_HOME, 'commands'), { recursive: true });
11
+ } catch (e) {
12
+ // Silently fail if we can't create it, might be permission issue
13
+ // The command might still work if it doesn't need to write
14
+ }
15
+ }
16
+
17
+ // Terminal capability detection
18
+ const supportsUnicode = () => {
19
+ const term = process.env.TERM || '';
20
+ const lang = process.env.LANG || '';
21
+ // Explicitly check for lack of UTF-8 first
22
+ if (lang && !lang.includes('UTF-8') && !lang.includes('utf8')) {
23
+ return false;
24
+ }
25
+ // Check for UTF-8 support indicators
26
+ return lang.includes('UTF-8') || lang.includes('utf8') ||
27
+ term.includes('xterm') || term.includes('256color') ||
28
+ (process.platform === 'darwin' && !lang);
29
+ };
30
+
31
+ const supports256Color = () => {
32
+ const term = process.env.TERM || '';
33
+ const colorterm = process.env.COLORTERM || '';
34
+ return term.includes('256color') || colorterm === 'truecolor' ||
35
+ colorterm === '24bit' || process.platform === 'darwin';
36
+ };
37
+
38
+ // AURORA Design System with fallback
39
+ const C = supports256Color() ? {
40
+ reset: '\x1b[0m',
41
+ bold: '\x1b[1m',
42
+ dim: '\x1b[2m',
43
+ purple: '\x1b[38;5;135m',
44
+ magenta: '\x1b[38;5;198m',
45
+ cyan: '\x1b[38;5;51m',
46
+ blue: '\x1b[38;5;39m',
47
+ white: '\x1b[38;5;255m',
48
+ gray: '\x1b[38;5;245m',
49
+ pink: '\x1b[38;5;213m',
50
+ teal: '\x1b[38;5;44m',
51
+ } : {
52
+ // Basic 16-color fallback for Raspberry Pi, etc.
53
+ reset: '\x1b[0m',
54
+ bold: '\x1b[1m',
55
+ dim: '\x1b[2m',
56
+ purple: '\x1b[35m',
57
+ magenta: '\x1b[35m',
58
+ cyan: '\x1b[36m',
59
+ blue: '\x1b[34m',
60
+ white: '\x1b[37m',
61
+ gray: '\x1b[90m',
62
+ pink: '\x1b[35m',
63
+ teal: '\x1b[36m',
64
+ };
65
+
66
+ // Aurora palette for random Kitsune colors 🦊
67
+ const AURORA_COLORS = [C.purple, C.magenta, C.cyan, C.blue, C.pink, C.teal];
68
+ const randomAurora = () => AURORA_COLORS[Math.floor(Math.random() * AURORA_COLORS.length)];
69
+
70
+ // Unicode Kitsune fox (for modern terminals)
71
+ const KITSUNE_UNICODE = `
72
+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⡀⠀⠀⠀
73
+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣾⠙⠻⢶⣄⡀⠀⠀⠀⢀⣤⠶⠛⠛⡇⠀⠀⠀
74
+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣇⠀⠀⣙⣿⣦⣤⣴⣿⣁⠀⠀⣸⠇⠀⠀⠀
75
+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣡⣾⣿⣿⣿⣿⣿⣿⣿⣷⣌⠋⠀⠀⠀⠀
76
+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⣿⣷⣄⡈⢻⣿⡟⢁⣠⣾⣿⣦⠀⠀⠀⠀
77
+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣿⣿⣿⣿⠘⣿⠃⣿⣿⣿⣿⡏⠀⠀⠀⠀
78
+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⠀⠈⠛⣰⠿⣆⠛⠁⠀⡀⠀⠀⠀⠀⠀
79
+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⣿⣦⠀⠘⠛⠋⠀⣴⣿⠁⠀⠀⠀⠀⠀
80
+ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣤⣶⣾⣿⣿⣿⣿⡇⠀⠀⠀⢸⣿⣏⠀⠀⠀⠀⠀⠀
81
+ ⠀⠀⠀⠀⠀⠀⣠⣶⣿⣿⣿⣿⣿⣿⣿⣿⠿⠿⠀⠀⠀⠾⢿⣿⠀⠀⠀⠀⠀⠀
82
+ ⠀⠀⠀⠀⣠⣿⣿⣿⣿⣿⣿⡿⠟⠋⣁⣠⣤⣤⡶⠶⠶⣤⣄⠈⠀⠀⠀⠀⠀⠀
83
+ ⠀⠀⠀⢰⣿⣿⣮⣉⣉⣉⣤⣴⣶⣿⣿⣋⡥⠄⠀⠀⠀⠀⠉⢻⣄⠀⠀⠀⠀⠀
84
+ ⠀⠀⠀⠸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣟⣋⣁⣤⣀⣀⣤⣤⣤⣤⣄⣿⡄⠀⠀⠀⠀
85
+ ⠀⠀⠀⠀⠙⠿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠛⠋⠉⠁⠀⠀⠀⠀⠈⠛⠃⠀⠀⠀⠀
86
+ ⠀⠀⠀⠀⠀⠀⠀⠉⠉⠉⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀`;
87
+
88
+ // ASCII fallback for terminals without Unicode (like Raspberry Pi)
89
+ const KITSUNE_ASCII = `
90
+ /\\___/\\
91
+ ( o o )
92
+ ( =^= )
93
+ ) (
94
+ ( )
95
+ ( KITSUNE )
96
+ ( )
97
+ \\_____/
98
+ JOS // AI Agent`;
99
+
100
+ const getKitsuneBanner = () => {
101
+ const color = randomAurora();
102
+ const fox = supportsUnicode() ? KITSUNE_UNICODE : KITSUNE_ASCII;
103
+ return `${color}${fox}${C.reset}
104
+ ${C.dim}Made with <3 & AI${C.reset}`;
105
+ };
106
+
107
+ const ALIASES = { server: 'serve' };
108
+ const rawCmd = process.argv[2];
109
+ const cmd = ALIASES[rawCmd] || rawCmd;
110
+
111
+ if (!cmd || cmd === '--help' || cmd === '-h') {
112
+ console.log(getKitsuneBanner());
113
+ console.log(`\n${C.purple}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${C.reset}`);
114
+ console.log(` ${C.white}${C.bold}JOS${C.reset} ${C.cyan}KERNEL v4.0.8${C.reset} ${C.gray}// Stoic Architecture${C.reset}`);
115
+ console.log(` ${C.dim}Format version v0.0.7 — Specification maturity v0.1.0 (Alpha)${C.reset}`);
116
+ console.log(`${C.purple}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${C.reset}`);
117
+ console.log(`\n${C.white}${C.bold} Usage:${C.reset} ${C.cyan}jos${C.reset} ${C.gray}<command>${C.reset} ${C.dim}[options]${C.reset}\n`);
118
+ console.log(`${C.white}${C.bold} Commands:${C.reset}`);
119
+ console.log(` ${C.cyan}serve${C.reset} ${C.gray}Start local development server${C.reset}`);
120
+ console.log(` ${C.cyan}init${C.reset} ${C.gray}Create new .jos artifact${C.reset}`);
121
+ console.log(` ${C.cyan}add${C.reset} ${C.gray}Add task to .jos artifact${C.reset}`);
122
+ console.log(` ${C.cyan}validate${C.reset} ${C.gray}Validate .jos artifact${C.reset}`);
123
+ console.log(` ${C.purple}run${C.reset} ${C.gray}Execute .jos artifacts${C.reset}`);
124
+ console.log(` ${C.green}verify${C.reset} ${C.gray}Self-check system health${C.reset}`);
125
+ console.log(` ${C.cyan}prompts${C.reset} ${C.gray}Prompt optimization & generation${C.reset}`);
126
+ console.log(` ${C.cyan}llm${C.reset} ${C.gray}Execute artifacts via LLM (Adapter)${C.reset}`);
127
+ console.log(` ${C.magenta}secrets${C.reset} ${C.gray}Manage encrypted credentials${C.reset}`);
128
+ console.log(` ${C.blue}get${C.reset} ${C.gray}Fetch packages from repos${C.reset}\n`);
129
+ console.log(`${C.dim} Run ${C.cyan}jos <cmd> --help${C.reset}${C.dim} for command-specific options${C.reset}\n`);
130
+ process.exit(0);
131
+ }
132
+
133
+ // Look for command in multiple locations (priority order)
134
+ const PKG_COMMANDS = path.join(__dirname, '..', 'src', 'commands'); // npm package
135
+ const USER_COMMANDS = path.join(JOS_HOME, 'commands'); // user installed
136
+
137
+ function findCommand(name) {
138
+ // 1. Check user's ~/.jos/commands first (allows overrides)
139
+ const userPath = path.join(USER_COMMANDS, name, 'index.js');
140
+ if (fs.existsSync(userPath)) return userPath;
141
+
142
+ // 2. Check npm package src/commands
143
+ const pkgPath = path.join(PKG_COMMANDS, `${name}.js`);
144
+ if (fs.existsSync(pkgPath)) return pkgPath;
145
+
146
+ // 3. Check npm package src/ directly (for serve.js)
147
+ const srcPath = path.join(__dirname, '..', 'src', `${name}.js`);
148
+ if (fs.existsSync(srcPath)) return srcPath;
149
+
150
+ return null;
151
+ }
152
+
153
+ const cmdPath = findCommand(cmd);
154
+ if (!cmdPath) {
155
+ const color = randomAurora();
156
+ console.log(`\n${color} ✖${C.reset} ${C.white}Unknown command:${C.reset} ${C.cyan}${rawCmd}${C.reset}`);
157
+ console.log(`${C.dim} Try: ${C.cyan}jos --help${C.reset}${C.dim} to see available commands${C.reset}\n`);
158
+ process.exit(1);
159
+ }
160
+ require(cmdPath).execute(process.argv.slice(3), JOS_HOME);
package/bin/jos.cmd ADDED
@@ -0,0 +1,5 @@
1
+ @echo off
2
+ SETLOCAL
3
+ SET dp0=%~dp0
4
+ node "%dp0%\jos" %*
5
+ ENDLOCAL