@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 +21 -21
- package/README.md +138 -186
- package/bin/jos +160 -98
- package/bin/jos.cmd +5 -0
- package/package.json +40 -35
- package/src/adapters/index.js +16 -0
- package/src/adapters/native.js +41 -0
- package/src/adapters/ollama.js +140 -0
- package/src/commands/add.js +145 -145
- package/src/commands/get.js +245 -245
- package/src/commands/init.js +162 -162
- package/src/commands/llm.js +159 -0
- package/src/commands/prompts.js +229 -0
- package/src/commands/repo.js +139 -139
- package/src/commands/run.js +244 -244
- package/src/commands/secrets.js +137 -137
- package/src/commands/validate.js +194 -190
- package/src/commands/verify.js +98 -0
- package/src/serve.js +781 -780
- package/src/utils/crypto.js +41 -0
- package/src/utils/request.js +41 -0
- package/src/index.js +0 -0
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
"
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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
|
+
[](https://www.npmjs.com/package/@josfox/jos)
|
|
8
|
+
[](LICENSE)
|
|
9
|
+
[](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(
|
|
4
|
-
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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);
|