phewsh 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.
package/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # phewsh
2
+
3
+ Turn intent into action.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install -g phewsh
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```bash
14
+ phewsh intent --init # Create .intent/ in any project
15
+ phewsh intent --status # Check artifact state and next actions
16
+ phewsh intent --open # Open the web compass
17
+ phewsh intent --evolve # Update artifacts as the project grows
18
+ ```
19
+
20
+ ## What it does
21
+
22
+ `phewsh intent --init` asks what you're building and what success looks like, then creates three structured artifacts in `.intent/`:
23
+
24
+ - **vision.md** — The north star. Why this exists and where it's going.
25
+ - **plan.md** — The strategy. Phases, systems, sequence, constraints.
26
+ - **next.md** — Right now. Executable checklist with copy-paste commands.
27
+
28
+ Drop `.intent/` in any project and your AI tools gain full context instantly.
29
+
30
+ ## Web app
31
+
32
+ [phewsh.com/intent](https://phewsh.com/intent)
33
+
34
+ ## License
35
+
36
+ MIT
package/bin/phewsh.js ADDED
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env node
2
+
3
+ const args = process.argv.slice(2);
4
+ const command = args[0];
5
+
6
+ const COMMANDS = {
7
+ intent: () => require('../commands/intent'),
8
+ music: () => require('../commands/music'),
9
+ sap: () => require('../commands/sap'),
10
+ help: () => showHelp(),
11
+ version: () => console.log(`phewsh v${require('../package.json').version}`),
12
+ };
13
+
14
+ function showHelp() {
15
+ console.log(`
16
+ 😮‍💨🤫 phewsh — turn intent into action
17
+
18
+ Usage:
19
+ phewsh <command> [options]
20
+
21
+ Commands:
22
+ intent Capture structured intent → generate vision, plan, and next actions
23
+ music Open the MBHD music engine
24
+ sap View Sustainable AI Protocol usage stats
25
+ help Show this help message
26
+ version Show version
27
+
28
+ Quick start:
29
+ phewsh intent Start a new intent capture session
30
+ phewsh intent --evolve Evolve existing .intent/ artifacts
31
+ phewsh intent --open Open phewsh.com/intent in your browser
32
+
33
+ Learn more: https://phewsh.com
34
+ `);
35
+ }
36
+
37
+ if (!command || command === 'help' || command === '--help' || command === '-h') {
38
+ showHelp();
39
+ process.exit(0);
40
+ }
41
+
42
+ if (command === 'version' || command === '--version' || command === '-v') {
43
+ COMMANDS.version();
44
+ process.exit(0);
45
+ }
46
+
47
+ if (COMMANDS[command]) {
48
+ COMMANDS[command]();
49
+ } else {
50
+ console.error(` Unknown command: ${command}\n Run 'phewsh help' for available commands.`);
51
+ process.exit(1);
52
+ }
@@ -0,0 +1,258 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+ const readline = require('readline');
4
+ const { execSync } = require('child_process');
5
+
6
+ const args = process.argv.slice(3);
7
+ const INTENT_DIR = path.join(process.cwd(), '.intent');
8
+ const WEB_URL = 'https://phewsh.com/intent';
9
+
10
+ const flags = {
11
+ evolve: args.includes('--evolve') || args.includes('-e'),
12
+ open: args.includes('--open') || args.includes('-o'),
13
+ status: args.includes('--status') || args.includes('-s'),
14
+ init: args.includes('--init') || args.includes('-i'),
15
+ help: args.includes('--help') || args.includes('-h'),
16
+ };
17
+
18
+ function hasExistingArtifacts() {
19
+ return fs.existsSync(INTENT_DIR) &&
20
+ fs.existsSync(path.join(INTENT_DIR, 'vision.md')) &&
21
+ fs.existsSync(path.join(INTENT_DIR, 'plan.md'));
22
+ }
23
+
24
+ function createPrompter() {
25
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
26
+ const ask = (question) => new Promise((resolve) => {
27
+ rl.question(question, (answer) => resolve(answer.trim()));
28
+ });
29
+ const close = () => rl.close();
30
+ return { ask, close };
31
+ }
32
+
33
+ function openWeb() {
34
+ console.log(`\n Opening ${WEB_URL} ...\n`);
35
+ try {
36
+ if (process.platform === 'darwin') execSync(`open "${WEB_URL}"`);
37
+ else if (process.platform === 'win32') execSync(`start "${WEB_URL}"`);
38
+ else execSync(`xdg-open "${WEB_URL}"`);
39
+ } catch {
40
+ console.log(` Could not open browser. Visit: ${WEB_URL}\n`);
41
+ }
42
+ }
43
+
44
+ function showStatus() {
45
+ if (!hasExistingArtifacts()) {
46
+ console.log('\n No .intent/ found in this directory.');
47
+ console.log(' Run `phewsh intent --init` to create one.\n');
48
+ return;
49
+ }
50
+
51
+ console.log('\n .intent/ — artifact status\n');
52
+
53
+ const files = ['vision.md', 'plan.md', 'next.md', 'status.md'];
54
+ for (const file of files) {
55
+ const filePath = path.join(INTENT_DIR, file);
56
+ if (fs.existsSync(filePath)) {
57
+ const stat = fs.statSync(filePath);
58
+ const kb = (stat.size / 1024).toFixed(1);
59
+ const updated = stat.mtime.toLocaleDateString();
60
+ console.log(` ✓ ${file.padEnd(14)} ${kb}KB updated ${updated}`);
61
+ }
62
+ }
63
+
64
+ const nextPath = path.join(INTENT_DIR, 'next.md');
65
+ const statusPath = path.join(INTENT_DIR, 'status.md');
66
+ const actionFile = fs.existsSync(nextPath) ? nextPath : fs.existsSync(statusPath) ? statusPath : null;
67
+
68
+ if (actionFile) {
69
+ const content = fs.readFileSync(actionFile, 'utf-8');
70
+ const checkboxes = content.split('\n').filter(l => l.match(/^[-*]\s*\[[ x]\]/));
71
+ if (checkboxes.length > 0) {
72
+ const done = checkboxes.filter(l => l.includes('[x]')).length;
73
+ console.log(`\n Next Actions: ${done}/${checkboxes.length} complete\n`);
74
+ checkboxes.slice(0, 5).forEach(line => {
75
+ const checked = line.includes('[x]');
76
+ const text = line.replace(/^[-*]\s*\[[ x]\]\s*/, '').replace(/\*\*/g, '');
77
+ console.log(` ${checked ? '✅' : '⬜'} ${text}`);
78
+ });
79
+ if (checkboxes.length > 5) console.log(` ... and ${checkboxes.length - 5} more`);
80
+ }
81
+ }
82
+
83
+ console.log('\n Run `phewsh intent --evolve` to update artifacts.\n');
84
+ }
85
+
86
+ async function initIntent() {
87
+ if (hasExistingArtifacts()) {
88
+ console.log('\n .intent/ already exists in this directory.');
89
+ console.log(' Use `phewsh intent --status` to view or `--evolve` to update.\n');
90
+ return;
91
+ }
92
+
93
+ const projectName = path.basename(process.cwd());
94
+ const date = new Date().toISOString().split('T')[0];
95
+
96
+ console.log('\n 😮‍💨🤫 phewsh intent --init\n');
97
+
98
+ let what = '';
99
+ let goal = '';
100
+
101
+ if (process.stdin.isTTY) {
102
+ console.log(' Answer two questions. Your artifacts will be ready instantly.\n');
103
+ const { ask, close } = createPrompter();
104
+ what = await ask(' What are you building? (one or two sentences)\n > ');
105
+ goal = await ask('\n What does success look like? What\'s the primary outcome?\n > ');
106
+ close();
107
+ console.log('');
108
+ } else {
109
+ console.log(' Creating starter artifacts...\n');
110
+ }
111
+
112
+ console.log('\n Creating .intent/ ...\n');
113
+
114
+ fs.mkdirSync(INTENT_DIR, { recursive: true });
115
+
116
+ const vision = `---
117
+ entity: ${projectName}
118
+ archetype: product
119
+ created: ${date}
120
+ updated: ${date}
121
+ ---
122
+
123
+ # Vision
124
+
125
+ ## North Star
126
+ ${what || `What is ${projectName} and why does it exist?`}
127
+
128
+ ## Outcomes
129
+ ${goal ? `- ${goal}` : '<!-- What does success look like? 3-5 concrete outcomes. -->'}
130
+ - <!-- Add more outcomes here -->
131
+
132
+ ## Principles
133
+ <!-- Non-negotiable values and constraints. What will you never compromise on? -->
134
+ -
135
+ -
136
+
137
+ ## Beneficiaries
138
+ <!-- Who benefits from this and how? Be specific. -->
139
+ `;
140
+
141
+ const plan = `---
142
+ entity: ${projectName}
143
+ archetype: product
144
+ created: ${date}
145
+ updated: ${date}
146
+ ---
147
+
148
+ # Plan
149
+
150
+ ## Current Strategy
151
+ <!-- One paragraph: the approach and why it's the right one right now. -->
152
+
153
+ ## Systems
154
+ <!-- What needs to exist? Key components, tools, structures. -->
155
+
156
+ ## Sequence
157
+ <!-- Phased plan. What must come first? What is blocked on what? -->
158
+ - Phase 1:
159
+ - Phase 2:
160
+ - Phase 3:
161
+
162
+ ## Constraints
163
+ <!-- What limits this? Budget, time, team, technical. Be honest. -->
164
+
165
+ ## Resources
166
+ <!-- What do you have available? Team, tools, existing assets. -->
167
+ `;
168
+
169
+ const next = `---
170
+ entity: ${projectName}
171
+ archetype: product
172
+ created: ${date}
173
+ updated: ${date}
174
+ ---
175
+
176
+ # Next
177
+
178
+ ## Current State
179
+ ${what ? `Building: ${what}` : '<!-- Where things stand right now, honestly. -->'}
180
+
181
+ ## Next Actions
182
+ - [ ] **Refine the vision** — Open the web compass and complete vision.md
183
+ - [ ] **Define Phase 1** — What is the smallest thing you can ship?
184
+ - [ ] **Identify the first blocker** — What is standing between you and execution?
185
+
186
+ ## Blocked
187
+ <!-- What is stuck and why? What decision is needed to unblock it? -->
188
+
189
+ ## Metrics
190
+ <!-- 2-3 numbers that tell you if it's working. -->
191
+ `;
192
+
193
+ fs.writeFileSync(path.join(INTENT_DIR, 'vision.md'), vision);
194
+ fs.writeFileSync(path.join(INTENT_DIR, 'plan.md'), plan);
195
+ fs.writeFileSync(path.join(INTENT_DIR, 'next.md'), next);
196
+
197
+ console.log(` ✓ .intent/vision.md — The north star`);
198
+ console.log(` ✓ .intent/plan.md — The strategy`);
199
+ console.log(` ✓ .intent/next.md — What to do right now`);
200
+ console.log(`
201
+ These files are your persistent context.
202
+ Drop them in any AI coding session and your tools gain full understanding.
203
+
204
+ Next:
205
+ phewsh intent --open Open the web compass to go deeper
206
+ phewsh intent --status Check your progress any time
207
+ `);
208
+ }
209
+
210
+ function showHelp() {
211
+ console.log(`
212
+ 😮‍💨🤫 phewsh intent
213
+
214
+ Usage:
215
+ phewsh intent Show status (or prompt to init if new)
216
+ phewsh intent --init Create .intent/ with structured artifacts
217
+ phewsh intent --status Show artifact state and next actions
218
+ phewsh intent --open Open the web compass at phewsh.com/intent
219
+ phewsh intent --evolve Open compass to update existing artifacts
220
+
221
+ Artifacts created in .intent/:
222
+ vision.md — Why this exists and where it's going
223
+ plan.md — How to get there, in what order
224
+ next.md — What to do right now (executable checklist)
225
+
226
+ These work with any AI coding tool. Your context travels with the project.
227
+ `);
228
+ }
229
+
230
+ // Main
231
+ async function main() {
232
+ if (flags.help) {
233
+ showHelp();
234
+ } else if (flags.open) {
235
+ openWeb();
236
+ } else if (flags.init) {
237
+ await initIntent();
238
+ } else if (flags.status) {
239
+ showStatus();
240
+ } else if (flags.evolve) {
241
+ if (!hasExistingArtifacts()) {
242
+ console.log('\n No .intent/ found. Run `phewsh intent --init` first.\n');
243
+ } else {
244
+ openWeb();
245
+ }
246
+ } else {
247
+ if (hasExistingArtifacts()) {
248
+ showStatus();
249
+ } else {
250
+ showHelp();
251
+ }
252
+ }
253
+ }
254
+
255
+ main().catch(err => {
256
+ console.error('\n Error:', err.message);
257
+ process.exit(1);
258
+ });
@@ -0,0 +1,17 @@
1
+ const { execSync } = require('child_process');
2
+
3
+ const WEB_URL = 'https://phewsh.com/music';
4
+
5
+ console.log(`\n 🎵 Opening MBHD Music Engine...\n`);
6
+
7
+ try {
8
+ if (process.platform === 'darwin') {
9
+ execSync(`open "${WEB_URL}"`);
10
+ } else if (process.platform === 'win32') {
11
+ execSync(`start "${WEB_URL}"`);
12
+ } else {
13
+ execSync(`xdg-open "${WEB_URL}"`);
14
+ }
15
+ } catch {
16
+ console.log(` Could not open browser. Visit: ${WEB_URL}\n`);
17
+ }
@@ -0,0 +1,20 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ const args = process.argv.slice(3);
5
+
6
+ console.log(`
7
+ 🌿 Sustainable AI Protocol (SAP)
8
+
9
+ Track AI usage and environmental impact across your tools.
10
+
11
+ Status: SDK available, dashboard coming soon.
12
+
13
+ Quick links:
14
+ Web: https://phewsh.com/sap
15
+ Docs: https://sustainableaiprotocol.com
16
+
17
+ To embed SAP tracking in your project:
18
+ const SAP = require('sustainable-ai-protocol');
19
+ const passport = await SAP.createPassport({ model: 'claude-opus', tokens: 1500 });
20
+ `);
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "phewsh",
3
+ "version": "0.1.0",
4
+ "description": "Turn intent into action. Structure your thinking, execute your next step.",
5
+ "bin": {
6
+ "phewsh": "./bin/phewsh.js"
7
+ },
8
+ "files": [
9
+ "bin/",
10
+ "commands/",
11
+ "README.md"
12
+ ],
13
+ "keywords": [
14
+ "intent",
15
+ "ai",
16
+ "artifacts",
17
+ "planning",
18
+ "execution",
19
+ "vision",
20
+ "productivity",
21
+ "claude",
22
+ "phewsh"
23
+ ],
24
+ "author": "Phewsh <hello@phewsh.com>",
25
+ "license": "MIT",
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "https://github.com/cleverIdeaz/phewsh"
29
+ },
30
+ "homepage": "https://phewsh.com",
31
+ "engines": {
32
+ "node": ">=18.0.0"
33
+ }
34
+ }