@hadooppei/hwcode 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/.env.example +11 -0
- package/.pi/APPEND_SYSTEM.md +5 -0
- package/.pi/extensions/command-filter.ts +46 -0
- package/.pi/extensions/cwd.ts +188 -0
- package/.pi/extensions/footer-tps.ts +292 -0
- package/.pi/extensions/hwcode.ts +10 -0
- package/.pi/extensions/model-providers.ts +450 -0
- package/.pi/extensions/welcome.ts +168 -0
- package/.pi/extensions/workflows.ts +292 -0
- package/.pi/lib/command-filter.ts +49 -0
- package/.pi/lib/pixel-font.ts +264 -0
- package/.pi/lib/welcome-input.ts +18 -0
- package/.pi/lib/workflow-guard.ts +99 -0
- package/.pi/lib/working-directory.ts +252 -0
- package/.pi/model-providers.json +62 -0
- package/.pi/skills/hwcode-sdd/SKILL.md +113 -0
- package/.pi/skills/hwcode-sdd/agents/openai.yaml +4 -0
- package/.pi/skills/hwcode-sdd/references/spec-artifacts.md +161 -0
- package/.pi/skills/hwcode-vibe/SKILL.md +52 -0
- package/.pi/skills/hwcode-vibe/agents/openai.yaml +4 -0
- package/.pi/welcome.json +15 -0
- package/README.md +145 -0
- package/bin/hwcode.js +85 -0
- package/package.json +51 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: hwcode-vibe
|
|
3
|
+
description: Run a directory-locked, conversational vibe-coding workflow for starting or evolving a software project through small, continuously verified increments. Use when the user invokes /hwcode-vibe or explicitly wants iterative collaborative coding without a formal specification phase.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# HWCode Vibe
|
|
7
|
+
|
|
8
|
+
Build with the user in short feedback loops while preserving a clear project boundary.
|
|
9
|
+
|
|
10
|
+
## Verify activation
|
|
11
|
+
|
|
12
|
+
Confirm that the activation message states a locked project root. If this skill was invoked directly without the `/hwcode-vibe` project command, do not begin project work; ask the user to run `/hwcode-vibe [initial request]` so the extension can confirm and enforce the directory boundary.
|
|
13
|
+
|
|
14
|
+
Treat the locked root as the only project workspace for the entire session. Use paths inside it without extra confirmation. When a tool asks for one-call approval for an external path such as `/tmp`, explain the concrete need and let the user decide. Never bypass that guard through a subprocess, symlink, encoding, or another tool.
|
|
15
|
+
|
|
16
|
+
## Establish the starting point
|
|
17
|
+
|
|
18
|
+
Inspect project instructions and relevant files before changing code.
|
|
19
|
+
|
|
20
|
+
For an empty or new project:
|
|
21
|
+
|
|
22
|
+
1. Identify the intended users, primary outcome, target platform, hard constraints, smallest useful version, and definition of done.
|
|
23
|
+
2. Ask only questions that block the first coherent increment.
|
|
24
|
+
3. Recommend a suitable stack with brief tradeoffs instead of silently choosing consequential architecture.
|
|
25
|
+
4. Confirm the first thin vertical slice before building it.
|
|
26
|
+
|
|
27
|
+
For an existing project, identify its entry points, conventions, commands, tests, and current behavior. Reuse existing patterns unless there is a clear reason to change them.
|
|
28
|
+
|
|
29
|
+
## Run the collaboration loop
|
|
30
|
+
|
|
31
|
+
Repeat this loop until the user stops or changes direction:
|
|
32
|
+
|
|
33
|
+
1. Restate the immediate outcome and any important assumption in a few lines.
|
|
34
|
+
2. Keep a lightweight conversational backlog; select one small, end-to-end increment.
|
|
35
|
+
3. Implement the smallest coherent change that makes that increment useful.
|
|
36
|
+
4. Verify it with the narrowest relevant tests, type checks, builds, or direct behavior checks.
|
|
37
|
+
5. Inspect the result, fix regressions, and report what now works.
|
|
38
|
+
6. Ask for feedback or propose the next highest-value increment.
|
|
39
|
+
|
|
40
|
+
Prefer working software over speculative framework construction. Keep interfaces simple, dependencies minimal, and changes easy to reverse. Preserve user changes and do not rewrite unrelated code.
|
|
41
|
+
|
|
42
|
+
## Apply engineering discipline
|
|
43
|
+
|
|
44
|
+
- Add or update tests in proportion to risk. Cover important failure and boundary behavior, not only the happy path.
|
|
45
|
+
- Follow repository formatting, naming, dependency, and error-handling conventions.
|
|
46
|
+
- Never expose or commit credentials, local sessions, `.env` contents, or private data.
|
|
47
|
+
- Ask before major architecture changes, new paid/external services, destructive actions, migrations with data risk, publishing, or commits.
|
|
48
|
+
- For UI work, verify both behavior and the important visual states when practical.
|
|
49
|
+
- If verification cannot run, state exactly what is unverified and why.
|
|
50
|
+
- Suggest Git checkpoints at stable milestones, but create a commit only when the user explicitly requests or approves it.
|
|
51
|
+
|
|
52
|
+
Keep the conversation adaptive. Do not impose the SDD artifact set unless the user switches to `/hwcode-sdd`.
|
package/.pi/welcome.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "HWCode · Pi",
|
|
3
|
+
"logo": "HWCODE",
|
|
4
|
+
"characterColors": [
|
|
5
|
+
"accent",
|
|
6
|
+
"success",
|
|
7
|
+
"warning",
|
|
8
|
+
"accent",
|
|
9
|
+
"success",
|
|
10
|
+
"warning"
|
|
11
|
+
],
|
|
12
|
+
"subtitle": "Local AI Coding Workspace",
|
|
13
|
+
"subtitleColor": "muted",
|
|
14
|
+
"reservedRows": 8
|
|
15
|
+
}
|
package/README.md
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# HWCode
|
|
2
|
+
|
|
3
|
+
A customizable terminal coding agent built on Pi, with local-model providers,
|
|
4
|
+
persistent working directories, a tailored TUI, and Vibe/SDD workflows.
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
HWCode requires Node.js 22.19 or newer. Install it globally from npm:
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
npm install --global @hadooppei/hwcode
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Then start it from the project directory you want to work in:
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
cd your-project
|
|
18
|
+
hwcode
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
`npx @hadooppei/hwcode` is also supported without a global installation. HWCode loads a
|
|
22
|
+
project's `.env` file when present and keeps Pi's normal user-level auth and
|
|
23
|
+
session storage. Project-local `.pi` resources continue to load alongside the
|
|
24
|
+
built-in HWCode profile.
|
|
25
|
+
|
|
26
|
+
## Repository setup
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
npm install --ignore-scripts
|
|
30
|
+
cp .env.example .env
|
|
31
|
+
npm start
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
On first launch, review and accept Pi's project-trust prompt so it can load the resources under `.pi/`.
|
|
35
|
+
|
|
36
|
+
## Model providers
|
|
37
|
+
|
|
38
|
+
OpenAI-compatible providers are declared in `.pi/model-providers.json`.
|
|
39
|
+
Static providers list their models directly:
|
|
40
|
+
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"id": "local-example",
|
|
44
|
+
"name": "Local example",
|
|
45
|
+
"baseUrl": "http://127.0.0.1:8082",
|
|
46
|
+
"apiKeyEnv": "PI_LOCAL_MODEL_API_KEY",
|
|
47
|
+
"models": [
|
|
48
|
+
{
|
|
49
|
+
"id": "model-id",
|
|
50
|
+
"input": ["text", "image"],
|
|
51
|
+
"contextWindow": 32768,
|
|
52
|
+
"maxTokens": 8192
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Login providers use Pi's native `/login` flow and discover every model exposed
|
|
59
|
+
by an OpenAI-compatible model endpoint:
|
|
60
|
+
|
|
61
|
+
```json
|
|
62
|
+
{
|
|
63
|
+
"id": "hw",
|
|
64
|
+
"name": "hw",
|
|
65
|
+
"baseUrl": "http://127.0.0.1:8080/v1",
|
|
66
|
+
"apiKeyEnv": "HW_API_KEY",
|
|
67
|
+
"login": {
|
|
68
|
+
"enabled": true,
|
|
69
|
+
"promptBaseUrl": true,
|
|
70
|
+
"promptApiKey": true,
|
|
71
|
+
"apiKeyRequired": false,
|
|
72
|
+
"catalogPath": "models"
|
|
73
|
+
},
|
|
74
|
+
"modelDefaults": {
|
|
75
|
+
"input": ["text"],
|
|
76
|
+
"contextWindow": 32768,
|
|
77
|
+
"maxTokens": 8192
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
`id` is the stable credential and cache key; `name` is the configurable label
|
|
83
|
+
shown alongside other providers in `/login`. A login authenticates the whole
|
|
84
|
+
provider and publishes its complete model catalog to `/model`. Entries in a
|
|
85
|
+
login provider's `models` array are optional metadata overrides for discovered
|
|
86
|
+
IDs, which is where vision support should be declared with
|
|
87
|
+
`"input": ["text", "image"]`. Unknown models default to text-only. Keep real
|
|
88
|
+
API keys in `.env` or enter them through `/login`; Pi stores entered credentials
|
|
89
|
+
in its own auth store rather than the project configuration.
|
|
90
|
+
|
|
91
|
+
## Welcome screen
|
|
92
|
+
|
|
93
|
+
The responsive vector-rasterized Braille pixel logo is configured in `.pi/welcome.json`.
|
|
94
|
+
`logo` accepts 1-6 English letters. `characterColors` contains Pi theme color
|
|
95
|
+
names and cycles when fewer colors than characters are provided. The logo scales
|
|
96
|
+
and centers itself whenever the fullscreen terminal is resized. The first
|
|
97
|
+
submitted prompt removes the welcome UI before the conversation is rendered.
|
|
98
|
+
|
|
99
|
+
## Development workflows
|
|
100
|
+
|
|
101
|
+
Start one of the project workflows from the Pi input:
|
|
102
|
+
|
|
103
|
+
```text
|
|
104
|
+
/hwcode-vibe Build a small web application with me
|
|
105
|
+
/hwcode-sdd Add role-based access control
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Both commands first confirm the current directory and lock project work to that
|
|
109
|
+
root for the session. In-root operations run normally; each tool call that names
|
|
110
|
+
an external path asks for separate approval. `/hwcode-vibe` uses short iterative
|
|
111
|
+
build-and-verify loops. `/hwcode-sdd` additionally requires the current directory
|
|
112
|
+
to be the Git repository root, inventories the codebase, resolves requirement
|
|
113
|
+
questions, and persists approved artifacts under
|
|
114
|
+
`.hwcode/specs/<requirement-slug>/` before test-first implementation begins.
|
|
115
|
+
|
|
116
|
+
## Working directory
|
|
117
|
+
|
|
118
|
+
Use `/cd <path>` to change the working directory without starting a new
|
|
119
|
+
session. A leading `cd` in either an agent shell call or a user `!` shell
|
|
120
|
+
command has the same persistent behavior. Subsequent shell commands, built-in
|
|
121
|
+
file tools, the Footer, and workflow activation all use the updated directory.
|
|
122
|
+
The directory is stored in the session and restored when that session resumes;
|
|
123
|
+
`cd -` returns to its previous directory. An active HWCode workflow keeps its
|
|
124
|
+
directory lock and rejects changes to another root.
|
|
125
|
+
|
|
126
|
+
## Command visibility
|
|
127
|
+
|
|
128
|
+
The `hwcode.hiddenCommands` array in `.pi/settings.json` removes selected
|
|
129
|
+
commands from slash-command autocomplete. Store names without the leading `/`;
|
|
130
|
+
skill commands use names such as `skill:hwcode-vibe`. An empty array shows every
|
|
131
|
+
command. Restart Pi or manually enter `/reload` after changing the list.
|
|
132
|
+
|
|
133
|
+
This setting controls visibility, not capability. A hidden command can still be
|
|
134
|
+
entered manually when it is needed.
|
|
135
|
+
|
|
136
|
+
## Project resources
|
|
137
|
+
|
|
138
|
+
- `AGENTS.md`: project-wide working rules
|
|
139
|
+
- `.pi/settings.json`: project-level Pi settings
|
|
140
|
+
- `.pi/APPEND_SYSTEM.md`: additions to the system prompt
|
|
141
|
+
- `.pi/extensions/`: TypeScript extensions
|
|
142
|
+
- `.pi/skills/`: reusable workflows
|
|
143
|
+
- `.pi/prompts/`: slash-command prompt templates
|
|
144
|
+
|
|
145
|
+
Credentials must not be committed. Use environment variables or Pi's user-level authentication store.
|
package/bin/hwcode.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { spawn } from "node:child_process";
|
|
4
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
5
|
+
import { dirname, join } from "node:path";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
|
|
8
|
+
const packageRoot = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
9
|
+
const profileDirectory = join(packageRoot, ".pi");
|
|
10
|
+
const piCli = join(
|
|
11
|
+
packageRoot,
|
|
12
|
+
"node_modules",
|
|
13
|
+
"@earendil-works",
|
|
14
|
+
"pi-coding-agent",
|
|
15
|
+
"dist",
|
|
16
|
+
"cli.js",
|
|
17
|
+
);
|
|
18
|
+
const userArgs = process.argv.slice(2);
|
|
19
|
+
if (userArgs[0] === "--version" || userArgs[0] === "-v") {
|
|
20
|
+
const packageJson = JSON.parse(readFileSync(join(packageRoot, "package.json"), "utf8"));
|
|
21
|
+
console.log(packageJson.version);
|
|
22
|
+
process.exit(0);
|
|
23
|
+
}
|
|
24
|
+
const piManagementCommands = new Set([
|
|
25
|
+
"--help",
|
|
26
|
+
"-h",
|
|
27
|
+
"auth",
|
|
28
|
+
"config",
|
|
29
|
+
"install",
|
|
30
|
+
"list",
|
|
31
|
+
"remove",
|
|
32
|
+
"uninstall",
|
|
33
|
+
"update",
|
|
34
|
+
]);
|
|
35
|
+
|
|
36
|
+
const profileArgs = [
|
|
37
|
+
"--tui-mode",
|
|
38
|
+
"fullscreen",
|
|
39
|
+
"--thinking",
|
|
40
|
+
"medium",
|
|
41
|
+
"--append-system-prompt",
|
|
42
|
+
join(profileDirectory, "APPEND_SYSTEM.md"),
|
|
43
|
+
];
|
|
44
|
+
|
|
45
|
+
for (const extension of [
|
|
46
|
+
"command-filter.ts",
|
|
47
|
+
"cwd.ts",
|
|
48
|
+
"footer-tps.ts",
|
|
49
|
+
"hwcode.ts",
|
|
50
|
+
"model-providers.ts",
|
|
51
|
+
"welcome.ts",
|
|
52
|
+
"workflows.ts",
|
|
53
|
+
]) {
|
|
54
|
+
profileArgs.push("--extension", join(profileDirectory, "extensions", extension));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
for (const skill of ["hwcode-vibe", "hwcode-sdd"]) {
|
|
58
|
+
profileArgs.push("--skill", join(profileDirectory, "skills", skill));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const args = piManagementCommands.has(userArgs[0]) ? userArgs : [...profileArgs, ...userArgs];
|
|
62
|
+
const projectEnvPath = join(process.cwd(), ".env");
|
|
63
|
+
const nodeArgs = existsSync(projectEnvPath) ? [`--env-file=${projectEnvPath}`] : [];
|
|
64
|
+
const child = spawn(
|
|
65
|
+
process.execPath,
|
|
66
|
+
[...nodeArgs, piCli, ...args],
|
|
67
|
+
{
|
|
68
|
+
cwd: process.cwd(),
|
|
69
|
+
env: { ...process.env, HWCODE_PROFILE_DIR: profileDirectory },
|
|
70
|
+
stdio: "inherit",
|
|
71
|
+
},
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
child.on("error", (error) => {
|
|
75
|
+
console.error(`Unable to start HWCode: ${error.message}`);
|
|
76
|
+
process.exitCode = 1;
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
child.on("exit", (code, signal) => {
|
|
80
|
+
if (signal) {
|
|
81
|
+
process.kill(process.pid, signal);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
process.exitCode = code ?? 1;
|
|
85
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hadooppei/hwcode",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A customizable terminal coding agent with local-model support and HWCode workflows.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"hwcode": "bin/hwcode.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin/hwcode.js",
|
|
11
|
+
".env.example",
|
|
12
|
+
".pi/APPEND_SYSTEM.md",
|
|
13
|
+
".pi/extensions",
|
|
14
|
+
".pi/lib/command-filter.ts",
|
|
15
|
+
".pi/lib/pixel-font.ts",
|
|
16
|
+
".pi/lib/welcome-input.ts",
|
|
17
|
+
".pi/lib/workflow-guard.ts",
|
|
18
|
+
".pi/lib/working-directory.ts",
|
|
19
|
+
".pi/model-providers.json",
|
|
20
|
+
".pi/skills/hwcode-sdd",
|
|
21
|
+
".pi/skills/hwcode-vibe",
|
|
22
|
+
".pi/welcome.json",
|
|
23
|
+
"README.md"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"start": "node --env-file-if-exists=.env ./bin/hwcode.js",
|
|
27
|
+
"pi": "node --env-file-if-exists=.env ./bin/hwcode.js",
|
|
28
|
+
"test": "node --test .pi/lib/*.test.ts",
|
|
29
|
+
"test:workflows": "npm test",
|
|
30
|
+
"prepack": "npm test"
|
|
31
|
+
},
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=22.19.0"
|
|
34
|
+
},
|
|
35
|
+
"keywords": [
|
|
36
|
+
"ai",
|
|
37
|
+
"coding-agent",
|
|
38
|
+
"cli",
|
|
39
|
+
"local-llm",
|
|
40
|
+
"pi",
|
|
41
|
+
"spec-driven-development",
|
|
42
|
+
"vibe-coding"
|
|
43
|
+
],
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public",
|
|
46
|
+
"registry": "https://registry.npmjs.org/"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@earendil-works/pi-coding-agent": "0.84.2"
|
|
50
|
+
}
|
|
51
|
+
}
|