@ksuchoi216/ahe 0.1.6 → 0.1.10

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 (49) hide show
  1. package/README.md +82 -214
  2. package/bin/ahe +34 -231
  3. package/package.json +8 -4
  4. package/packages/ahe-antigravity/bin/ahe-antigravity +325 -0
  5. package/packages/ahe-antigravity/package.json +7 -0
  6. package/packages/ahe-antigravity/skills/ahe-git/SKILL.md +35 -0
  7. package/packages/ahe-antigravity/skills/ahe-ship/SKILL.md +28 -0
  8. package/packages/ahe-antigravity/skills/ahe-ship/scripts/post-ship-hook.sh +12 -0
  9. package/packages/ahe-codex/.codex/agents/ahe-harness-manager.toml +19 -0
  10. package/{.codex → packages/ahe-codex/.codex}/ahe-shared/templates/AGENTS.md +11 -10
  11. package/{.codex/ahe-shared/templates/PRODUCT.md → packages/ahe-codex/.codex/ahe-shared/templates/product.md} +1 -1
  12. package/packages/ahe-codex/.codex/hooks/ahe-hook.js +296 -0
  13. package/packages/ahe-codex/.codex/skills/ahe/SKILL.md +34 -0
  14. package/packages/ahe-codex/.codex/skills/ahe-compress/SKILL.md +120 -0
  15. package/{.codex/skills/ahe-compression → packages/ahe-codex/.codex/skills/ahe-compress}/agents/openai.yaml +1 -1
  16. package/{.codex/skills/ahe-compression → packages/ahe-codex/.codex/skills/ahe-compress}/scripts/check-harness-size.sh +18 -6
  17. package/packages/ahe-codex/.codex/skills/ahe-compress/scripts/detect_stale_tests.py +30 -0
  18. package/packages/ahe-codex/.codex/skills/ahe-converse/SKILL.md +44 -0
  19. package/packages/ahe-codex/.codex/skills/ahe-feature/SKILL.md +25 -0
  20. package/packages/ahe-codex/.codex/skills/ahe-fix/SKILL.md +59 -0
  21. package/packages/ahe-codex/.codex/skills/ahe-fix/scripts/write_fix_plan.py +108 -0
  22. package/packages/ahe-codex/.codex/skills/ahe-git/SKILL.md +34 -0
  23. package/packages/ahe-codex/.codex/skills/ahe-harness/SKILL.md +128 -0
  24. package/packages/ahe-codex/.codex/skills/ahe-harness-checker/SKILL.md +46 -0
  25. package/{.codex/skills/ahe-init → packages/ahe-codex/.codex/skills/ahe-new}/SKILL.md +41 -37
  26. package/packages/ahe-codex/.codex/skills/ahe-overview/SKILL.md +119 -0
  27. package/packages/ahe-codex/.codex/skills/ahe-review/SKILL.md +43 -0
  28. package/packages/ahe-codex/.codex/skills/ahe-ship/SKILL.md +58 -0
  29. package/packages/ahe-codex/.codex/skills/ahe-ship/agents/openai.yaml +4 -0
  30. package/packages/ahe-codex/.codex/skills/ahe-ship/scripts/write_plan.py +107 -0
  31. package/packages/ahe-codex/.codex/skills/ahe-solve/SKILL.md +30 -0
  32. package/packages/ahe-codex/.codex/skills/ahe-think/SKILL.md +114 -0
  33. package/packages/ahe-codex/bin/ahe-codex +398 -0
  34. package/packages/ahe-codex/package.json +7 -0
  35. package/.codex/hooks/ahe-hook.js +0 -236
  36. package/.codex/skills/ahe-compression/SKILL.md +0 -97
  37. package/.codex/skills/ahe-conversation/SKILL.md +0 -73
  38. package/.codex/skills/ahe-spec/SKILL.md +0 -63
  39. package/.codex/skills/ahe-thinking/SKILL.md +0 -104
  40. package/.codex/skills/ahe-update/SKILL.md +0 -66
  41. /package/{.codex → packages/ahe-codex/.codex}/ahe-shared/config.yaml +0 -0
  42. /package/{.codex → packages/ahe-codex/.codex}/ahe-shared/schemas/feature-list-schema.json +0 -0
  43. /package/{.codex → packages/ahe-codex/.codex}/ahe-shared/schemas/process_status.schema.json +0 -0
  44. /package/{.codex → packages/ahe-codex/.codex}/ahe-shared/templates/INSTRUCTIONS.md +0 -0
  45. /package/{.codex → packages/ahe-codex/.codex}/ahe-shared/templates/feature-list.json +0 -0
  46. /package/{.codex → packages/ahe-codex/.codex}/ahe-shared/templates/init.sh +0 -0
  47. /package/{.codex/ahe-shared/templates/PROGRESS.md → packages/ahe-codex/.codex/ahe-shared/templates/progress.md} +0 -0
  48. /package/{.codex/ahe-shared/templates/SESSION-HANDOFF.md → packages/ahe-codex/.codex/ahe-shared/templates/session-handoff.md} +0 -0
  49. /package/{.codex → packages/ahe-codex/.codex}/hooks/hooks.json +0 -0
package/README.md CHANGED
@@ -1,216 +1,84 @@
1
1
  # Awesome Harness Engineering (AHE)
2
2
 
3
- AHE automatically builds and maintains project harnesses through Codex chat. It installs a set of Codex skills into your workspace, then guides you through defining your project specification, tracking features, and managing progress all via natural conversation.
4
-
5
- ---
6
-
7
- ## 1. Installation
8
-
9
- ### Quick Start (Recommended)
10
-
11
- ```bash
12
- npx --yes --package=@ksuchoi216/ahe ahe install
13
- ```
14
-
15
- ### Global Install
16
-
17
- ```bash
18
- npm install -g @ksuchoi216/ahe
19
- ahe install
20
- ```
21
-
22
- ### Local Development
23
-
24
- After cloning the repository:
25
-
26
- ```bash
27
- npx --yes --package=file:. ahe install
28
- ```
29
-
30
- ### CLI Commands
31
-
32
- | Command | Description |
33
- | ---------------------- | ----------------------------------------------- |
34
- | `ahe install` | Install AHE skills into `.codex/` |
35
- | `ahe install --force` | Overwrite existing installation |
36
- | `ahe install --backup` | Backup existing installation before overwriting |
37
- | `ahe uninstall` | Remove all AHE skills, shared assets, and hooks |
38
- | `ahe doctor` | Check installation health and integrity |
39
- | `ahe version` | Print the current version |
40
-
41
- ---
42
-
43
- ## 2. How to Use
44
-
45
- AHE works inside **Codex chat**. After installing via the terminal, open Codex chat in your workspace and type one of the commands below.
46
-
47
- ### Chat Commands
48
-
49
- | Command | What it does |
50
- | ---------- | ----------------------------------------------------------------------------------------------------------------------- |
51
- | `ahe init` | **Start a new harness.** Creates harness skeleton files, asks about your project, and writes the product specification. |
52
- | `ahe` | **Continue existing work.** Inspects the current state, reports status, decides the next step, and keeps working. |
53
-
54
- > **Note:** Only exact commands trigger AHE. Normal messages like "explain ahe" or "what does ahe do" will not start any workflow.
55
-
56
- ### Typical Workflow
57
-
58
- ```
59
- # Step 1: Install AHE skills into your project
60
- $ ahe install
61
-
62
- # Step 2: Open Codex chat and initialize the harness
63
- > ahe init
64
- AHE asks about your project purpose, language, tech stack, constraints...
65
- Creates AGENTS.md, feature-list.json, PROGRESS.md, docs/PRODUCT.md, etc.
66
-
67
- # Step 3: Continue working — just type "ahe"
68
- > ahe
69
- AHE inspects the harness state and prints a status report
70
- Picks the next unfinished feature or asks for missing info
71
- Works on it, then updates tracking artifacts
72
-
73
- # Step 4: Keep iterating
74
- > ahe
75
- Reports progress, moves to the next feature
76
- Repeat until all features are done
77
- ```
78
-
79
- ---
80
-
81
- ## 3. How It Works
82
-
83
- ### Skills Overview
84
-
85
- AHE is composed of six core skills that coordinate automatically:
86
-
87
- | Skill | Role |
88
- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
89
- | **ahe-init** | Entry point for new projects. Creates harness files, asks for project info, then calls ahe-spec and ahe-update. |
90
- | **ahe-thinking** | Internal decision engine. Evaluates clarity on **Why** / **What** / **How** for each work unit and routes to the right action. |
91
- | **ahe-compression** | Internal size detector & compressor. Monitors file sizes via configurable thresholds (`config.yaml`) and compresses bloated files before reading. |
92
- | **ahe-conversation** | Internal question protocol. Asks exactly one focused question at a time when information is missing. |
93
- | **ahe-spec** | Writes and updates `docs/PRODUCT.md` (canonical source of truth) and `docs/INSTRUCTIONS.md`. |
94
- | **ahe-update** | Syncs tracking artifacts: `feature-list.json`, `PROGRESS.md`, `SESSION-HANDOFF.md`. |
95
-
96
- ### Process Flow
97
-
98
- ```mermaid
99
- flowchart TD
100
- Install["<b>Terminal</b><br/>ahe install"] --> Chat["Open Codex chat<br/>in the workspace"]
101
-
102
- Chat --> Command{"What did you type?"}
103
- Command -->|"ahe init"| Init["<b>ahe-init</b><br/>New-start workflow"]
104
- Command -->|"ahe"| Router["<b>AHE Router</b><br/>Inspect harness &amp; print status"]
105
- Command -->|"other message"| Noop["No AHE workflow triggered"]
106
-
107
- Router --> Classify{"Classify harness state"}
108
- Classify -->|"Not enough spec"| Init
109
- Classify -->|"Building features"| Feature["Continue next<br/>unfinished feature"]
110
- Classify -->|"All completed"| AskNext["Ask user for<br/>the next task"]
111
-
112
- Init --> Step1["<b>Step 1:</b> Setup<br/>AGENTS.md + templates"]
113
- Step1 --> Step2["<b>Step 2: ahe-spec</b><br/>Write PRODUCT.md<br/>and INSTRUCTIONS.md"]
114
- Step2 --> Step3["<b>Step 3: ahe-update</b><br/>Sync feature-list.json<br/>and PROGRESS.md"]
115
- Step3 --> Done["Harness ready ✓"]
116
-
117
- Feature --> Compression["<b>ahe-compression</b><br/>Check & compress oversized files"]
118
- Compression --> Thinking["<b>ahe-thinking</b><br/>Check Why / What / How"]
119
- Thinking --> Clear{"Clear enough<br/>to proceed?"}
120
- Clear -->|"No"| Convo["<b>ahe-conversation</b><br/>Ask one focused question"]
121
- Convo --> UserAnswer["User answers"]
122
- UserAnswer --> Thinking
123
- Clear -->|"Yes"| Execute["Execute the<br/>next safe step"]
124
- Execute --> Update["<b>ahe-update</b><br/>Sync tracking artifacts"]
125
- Update --> Done2["Ready for next<br/><code>ahe</code> command ✓"]
126
- ```
127
-
128
- ### Detailed Steps
129
-
130
- #### `ahe init` — New Start
131
-
132
- 1. Scans the workspace for existing harness files.
133
- 2. If files exist, asks the user what scope to restart (full restart, product-only, or custom).
134
- 3. Backs up affected files to `.ahe/backups/`.
135
- 4. Asks about project purpose, language, and tech stack.
136
- 5. Deploys template files (`AGENTS.md`, `PROGRESS.md`, `SESSION-HANDOFF.md`, `feature-list.json`, `init.sh`).
137
- 6. Calls **ahe-spec** → writes `docs/PRODUCT.md` and `docs/INSTRUCTIONS.md`.
138
- 7. Calls **ahe-update** → derives features and syncs tracking artifacts.
139
-
140
- #### `ahe` — Continue Work
141
-
142
- 1. Hook injects the AHE router directive into the agent context.
143
- 2. Router inspects all harness files and prints a status table.
144
- 3. Classifies the current state:
145
- - **"Not enough spec"** → routes to `ahe-init` to fill gaps.
146
- - **"Building features"** → picks the next unfinished feature from `feature-list.json`.
147
- - **"All completed"** → asks the user for the next task.
148
- 4. **ahe-thinking** checks file sizes using **ahe-compression** and compresses oversized files based on `config.yaml` thresholds.
149
- 5. **ahe-thinking** checks clarity (Why / What / How) for the current work unit.
150
- 6. If unclear → **ahe-conversation** asks exactly one question, then re-evaluates.
151
- 7. If clear → executes the next safe step.
152
- 8. **ahe-update** syncs all tracking artifacts at the end.
153
-
154
- #### Execution Loop
155
-
156
- The core loop repeats until the work unit is done:
157
-
158
- ```
159
- thinking → conversation (if needed) → execution → thinking
160
- ```
161
-
162
- ---
163
-
164
- ## Project Structure
165
-
166
- After `ahe install`, the following structure is added to your workspace:
167
-
168
- ```
169
- your-project/
170
- ├── .codex/
171
- │ ├── skills/
172
- │ │ ├── ahe-init/ # New-start workflow skill
173
- │ │ ├── ahe-conversation/ # Internal question protocol
174
- │ │ ├── ahe-thinking/ # Internal decision engine
175
- │ │ ├── ahe-compression/ # Internal size detector & compressor
176
- │ │ ├── ahe-spec/ # Specification writer
177
- │ │ └── ahe-update/ # Tracking artifact syncer
178
- │ ├── ahe-shared/
179
- │ │ ├── config.yaml # Compression thresholds & configuration
180
- │ │ ├── templates/ # Harness file templates
181
- │ │ └── schemas/ # Validation schemas
182
- │ └── hooks/
183
- │ ├── hooks.json # Chat command trigger patterns
184
- │ └── ahe-hook.js # Hook script that injects directives
185
- ```
186
-
187
- After `ahe init`, the harness files are created in your project root:
188
-
189
- ```
190
- your-project/
191
- ├── docs/
192
- │ ├── PRODUCT.md # Product specification (source of truth)
193
- │ └── INSTRUCTIONS.md # Implementation instructions
194
- ├── .ahe/
195
- │ └── process_status.json # Workflow state persistence
196
- ├── AGENTS.md # Project objectives and agent rules
197
- ├── feature-list.json # Feature state tracker (derived from PRODUCT.md)
198
- ├── PROGRESS.md # Session continuity log
199
- ├── SESSION-HANDOFF.md # Handoff notes between sessions
200
- └── init.sh # Standard startup/verification script
201
- ```
202
-
203
- ## Agent Working Rules
204
-
205
- If you are an AI agent working on this repository, please strictly follow the guidelines in [AGENTS.md](AGENTS.md). It includes critical instructions regarding the definition of done, verification commands, and file modification rules (e.g., you must update `PROGRESS.md` and `feature-list.json` appropriately).
206
-
207
- ## References
208
-
209
- This repository was greatly influenced by the following projects:
210
-
211
- - [oh-my-openagent](https://github.com/code-yeongyu/oh-my-openagent): Greatly influenced the code structure of this project.
212
- - [learn-harness-engineering](https://github.com/walkinglabs/learn-harness-engineering): Provided the harness engineering templates used in this project.
213
-
214
- ## License
215
-
216
- MIT
3
+ AHE installs global Codex and Antigravity skills that manage harness files through chat. The repository uses a one-package, two-internal-packages layout (`packages/ahe-codex` and `packages/ahe-antigravity`) shipped as a single npm package. The
4
+ public entrypoints stay small: use `ahe new` to start or reset harness work,
5
+ `ahe` to continue existing work, `ahe ship` to save the latest plan (in Codex) or refresh and execute a saved plan (in Antigravity),
6
+ `ahe fix` to create a `.plans` fix plan, and
7
+ `ahe <query>` or `<query> ahe` for explicit AHE requests such as `ahe compress`
8
+ or `compress ahe`. For a detailed in-chat explanation of the AHE architecture and workflows, use `ahe-overview`.
9
+
10
+ ## Core Command Workflows
11
+
12
+ Here are intuitive flow examples for the primary AHE commands. While `ahe`, `ahe-new`, `ahe-ship`, and `ahe-fix` are the explicit commands, you can also use conversational queries (e.g., `ahe add dashboard export feature`) which are automatically routed.
13
+
14
+ ### `ahe new` Flow
15
+ 1. **Empty Workspace**: You have a new or existing repo that needs AHE.
16
+ 2. **ahe-new calling**: You type `ahe new` in Codex.
17
+ 3. **Initialization**: It prepares the workspace, creates templates, and hands off to `ahe-harness` to sync your product docs.
18
+
19
+ ### `ahe ship` Flow
20
+ 1. **plan mode in codex**: Generate an implementation plan inside Codex.
21
+ 2. **ahe-ship calling in codex**: If in Plan Mode, the Codex host exits Plan Mode and replays the command. Outside Plan Mode, Codex saves the plan to `.plans/` and stops.
22
+ 3. **ahe-ship calling in antigravity**: Antigravity refreshes the saved plan against current code, executes it, and cleans it up.
23
+
24
+ ### `ahe fix` Flow
25
+ 1. **Error Encountered**: A test fails or intent changes after execution.
26
+ 2. **ahe-fix calling**: You type `ahe fix` (or `ahe fix stale tests`) in Codex.
27
+ 3. **Fix Plan Creation**: It generates a dedicated fix plan in `.plans/` ready for Antigravity to refresh and execute.
28
+
29
+ ### General `ahe` Flow
30
+ 1. **Ongoing Work**: You need to implement a feature or update docs.
31
+ 2. **ahe calling**: You type `ahe` or a specific query like `ahe update product spec` in Codex.
32
+ 3. **Automatic Routing**: `ahe-think` evaluates your request and automatically routes it to the right agent (like `ahe-solve` or `ahe-harness`).
33
+
34
+ ## Installed Skills
35
+
36
+ | Skill | Role |
37
+ | --- | --- |
38
+ | `ahe` | Top-level user-facing continuation skill that routes exact `ahe` and `ahe` query forms through `ahe-think`. |
39
+ | `ahe-new` | New-start workflow that prepares the workspace and hands product/tracking work to `ahe-harness`. |
40
+ | `ahe-think` | Centered internal router that judges what is missing and chooses the next agent. |
41
+ | `ahe-review` | Review agent for repo code, harness state, and CodeGraph context. |
42
+ | `ahe-converse` | Clarification agent for recursive user conversation. |
43
+ | `ahe-harness` | Harness-management agent for product docs, instructions, feature tracking, todo sync, and compression-aware maintenance. |
44
+ | `ahe-feature` | Internal helper for deriving feature-list entries from product context. |
45
+ | `ahe-fix` | Independent fix planner that writes `.plans/{plan_name}.md` for errors or changed user intent. |
46
+ | `ahe-solve` | Feature-solving agent that divides and plans implementation work. |
47
+ | `ahe-compress` | Internal helper that detects oversized harness files before broad reads. |
48
+ | `ahe-overview` | Explains the AHE concept, entrypoints, and main workflows in chat with Mermaid diagrams. |
49
+ | `ahe-ship` | In Codex: saves Plan Mode plan to `.plans/`. In Antigravity: refreshes and executes exactly one plan from `.plans/`. |
50
+
51
+ ## Routing Model
52
+
53
+ The Codex-side model is centered but flexible:
54
+
55
+ - exact `ahe` -> `ahe-think` -> `ahe-review | ahe-converse | ahe-harness | ahe-solve`
56
+ - `ahe <query>` or `<query> ahe` -> `ahe-think` -> `ahe-review | ahe-converse | ahe-harness | ahe-solve`
57
+ - exact `ahe new` -> dedicated new-start workflow first, then `ahe-harness`
58
+ - exact `ahe ship` -> independent plan-export workflow (Codex) or execution workflow (Antigravity)
59
+ - exact `ahe fix`, `ahe fix <query>`, or `<query> ahe fix` -> independent fix-plan workflow
60
+
61
+ - `ahe-think` is the center of judgment.
62
+ - Worker agents can call each other directly when that is the logical next
63
+ action.
64
+ - Typical direct handoffs are `ahe-harness -> ahe-converse`,
65
+ `ahe-solve -> ahe-review`, and `ahe-review -> ahe-harness`.
66
+
67
+ ## Query Examples
68
+
69
+ - `ahe`
70
+ - `ahe new`
71
+ - `ahe ship`
72
+ - `ahe fix`
73
+ - `ahe fix stale tests`
74
+ - `stale tests ahe fix`
75
+ - `ahe compress`
76
+ - `compress ahe`
77
+ - `ahe update product spec`
78
+ - `ahe add dashboard export feature`
79
+
80
+ Only exact `ahe`, exact `ahe new`, exact `ahe-new`, exact `$ahe-new`, and
81
+ exact `ahe ship`, exact `ahe-ship`, exact `$ahe-ship`, exact `ahe fix`, exact
82
+ exact `ahe-fix`, exact `$ahe-fix`, `ahe fix <query>`, `<query> ahe fix`,
83
+ `ahe-overview`, `ahe <query>`, and `<query> ahe` activate the hook.
84
+ Middle mentions that do not fit those command shapes do not.
package/bin/ahe CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env bash
2
2
  set -euo pipefail
3
3
 
4
- readonly VERSION="0.1.0"
4
+ readonly VERSION="0.1.7"
5
5
  SCRIPT_PATH="${BASH_SOURCE[0]}"
6
6
 
7
7
  while [ -L "${SCRIPT_PATH}" ]; do
@@ -16,19 +16,6 @@ done
16
16
 
17
17
  readonly SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "${SCRIPT_PATH}")" && pwd)"
18
18
  readonly PACKAGE_ROOT="$(CDPATH= cd -- "${SCRIPT_DIR}/.." && pwd)"
19
- readonly SOURCE_SKILLS_DIR="${PACKAGE_ROOT}/.codex/skills"
20
- readonly SOURCE_SHARED_DIR="${PACKAGE_ROOT}/.codex/ahe-shared"
21
- readonly SOURCE_HOOKS_DIR="${PACKAGE_ROOT}/.codex/hooks"
22
- readonly AHE_CONFIG_BLOCK_START="# BEGIN AHE MANAGED CONFIG"
23
- readonly AHE_CONFIG_BLOCK_END="# END AHE MANAGED CONFIG"
24
- readonly MANAGED_SKILLS=(
25
- "ahe-init"
26
- "ahe-conversation"
27
- "ahe-compression"
28
- "ahe-thinking"
29
- "ahe-spec"
30
- "ahe-update"
31
- )
32
19
 
33
20
  usage() {
34
21
  cat <<'EOF'
@@ -40,223 +27,42 @@ Usage:
40
27
  EOF
41
28
  }
42
29
 
43
- backup_existing_installation() {
44
- local target_dir="$1"
45
- local backup_root="$2"
46
- local backup_name="$3"
47
- local timestamp
30
+ dispatch() {
31
+ local command="$1"
32
+ shift
48
33
 
49
- timestamp="$(date '+%Y%m%d-%H%M%S')"
50
- mkdir -p "${backup_root}"
51
- mv "${target_dir}" "${backup_root}/${backup_name}-${timestamp}"
52
- }
34
+ local codex_bin="${PACKAGE_ROOT}/packages/ahe-codex/bin/ahe-codex"
35
+ local antigravity_bin="${PACKAGE_ROOT}/packages/ahe-antigravity/bin/ahe-antigravity"
53
36
 
54
- cleanup_ahe_config_entries() {
55
- local config_path="$1"
56
- local temp_path=""
37
+ local codex_status=0
38
+ local antigravity_status=0
57
39
 
58
- if [ ! -f "${config_path}" ]; then
59
- return 0
40
+ if [ "${command}" != "doctor" ]; then
41
+ echo "=== Dispatching to ahe-codex ==="
60
42
  fi
61
-
62
- temp_path="${config_path}.ahe-cleanup"
63
- awk -v block_start="${AHE_CONFIG_BLOCK_START}" -v block_end="${AHE_CONFIG_BLOCK_END}" '
64
- function is_ahe_header(line) {
65
- return line ~ /^\[agents\."?ahe[-_][^]]*"?\]$/ ||
66
- line ~ /^\[hooks\.state\."ahe[^"]*"\]$/ ||
67
- line ~ /^\[plugins\."?ahe[^]]*"?\]$/ ||
68
- line ~ /^\[plugins\."@ksuchoi216\/ahe[^"]*"\]$/
69
- }
70
-
71
- $0 == block_start {
72
- skip = 1
73
- next
74
- }
75
-
76
- $0 == block_end {
77
- skip = 0
78
- next
79
- }
80
-
81
- /^\[/ {
82
- if (is_ahe_header($0)) {
83
- skip = 1
84
- next
85
- }
86
- skip = 0
87
- }
88
-
89
- skip != 1 {
90
- print
91
- }
92
- ' "${config_path}" > "${temp_path}"
93
- mv "${temp_path}" "${config_path}"
94
- }
95
-
96
- install_skill() {
97
- local force="false"
98
- local backup="false"
99
-
100
- while [ "$#" -gt 0 ]; do
101
- case "$1" in
102
- --force)
103
- force="true"
104
- ;;
105
- --backup)
106
- backup="true"
107
- ;;
108
- *)
109
- printf 'Unknown install option: %s\n' "$1" >&2
110
- usage >&2
111
- exit 1
112
- ;;
113
- esac
114
- shift
115
- done
116
-
117
- if [ ! -d "${SOURCE_SKILLS_DIR}" ]; then
118
- printf 'Packaged skill files are missing: %s\n' "${SOURCE_SKILLS_DIR}" >&2
119
- exit 1
43
+ if [ -x "${codex_bin}" ]; then
44
+ "${codex_bin}" "${command}" "$@" || codex_status=$?
45
+ else
46
+ echo "Warning: ahe-codex script not found or not executable at ${codex_bin}"
47
+ codex_status=1
120
48
  fi
121
49
 
122
- if [ ! -d "${SOURCE_SHARED_DIR}" ]; then
123
- printf 'Packaged shared files are missing: %s\n' "${SOURCE_SHARED_DIR}" >&2
124
- exit 1
50
+ if [ "${command}" != "doctor" ]; then
51
+ echo ""
52
+ echo "=== Dispatching to ahe-antigravity ==="
53
+ else
54
+ echo ""
125
55
  fi
126
-
127
- local target_skills_dir="${PWD}/.codex/skills"
128
- local target_shared_dir="${PWD}/.codex/ahe-shared"
129
- local target_hooks_dir="${PWD}/.codex/hooks"
130
- local target_config_path="${PWD}/.codex/config.toml"
131
- local backup_dir="${PWD}/.codex/_backups"
132
- local skill_name=""
133
- local skill_target=""
134
-
135
- cleanup_ahe_config_entries "${target_config_path}"
136
-
137
- for skill_name in "${MANAGED_SKILLS[@]}"; do
138
- skill_target="${target_skills_dir}/${skill_name}"
139
-
140
- if [ -e "${skill_target}" ]; then
141
- if [ "${backup}" = "true" ]; then
142
- backup_existing_installation "${skill_target}" "${backup_dir}" "${skill_name}"
143
- elif [ "${force}" != "true" ]; then
144
- cat <<EOF >&2
145
- AHE skill is already installed at:
146
- ${skill_target}
147
-
148
- Re-run with --force to overwrite or --backup to move the existing install aside first.
149
- EOF
150
- exit 1
151
- else
152
- rm -rf "${skill_target}"
153
- fi
154
- fi
155
- done
156
-
157
- if [ -e "${target_shared_dir}" ]; then
158
- if [ "${backup}" = "true" ]; then
159
- backup_existing_installation "${target_shared_dir}" "${backup_dir}" "ahe-shared"
160
- elif [ "${force}" = "true" ]; then
161
- rm -rf "${target_shared_dir}"
162
- else
163
- cat <<EOF >&2
164
- AHE shared assets are already installed at:
165
- ${target_shared_dir}
166
-
167
- Re-run with --force to overwrite or --backup to move the existing install aside first.
168
- EOF
169
- exit 1
170
- fi
56
+ if [ -x "${antigravity_bin}" ]; then
57
+ "${antigravity_bin}" "${command}" "$@" || antigravity_status=$?
58
+ else
59
+ echo "Warning: ahe-antigravity script not found or not executable at ${antigravity_bin}"
60
+ antigravity_status=1
171
61
  fi
172
62
 
173
- if [ -e "${target_hooks_dir}" ]; then
174
- if [ "${backup}" = "true" ]; then
175
- backup_existing_installation "${target_hooks_dir}" "${backup_dir}" "hooks"
176
- elif [ "${force}" = "true" ]; then
177
- rm -rf "${target_hooks_dir}"
178
- else
179
- cat <<EOF >&2
180
- AHE hooks are already installed at:
181
- ${target_hooks_dir}
182
-
183
- Re-run with --force to overwrite or --backup to move the existing install aside first.
184
- EOF
185
- exit 1
186
- fi
63
+ if [ "${codex_status}" -ne 0 ] || [ "${antigravity_status}" -ne 0 ]; then
64
+ return 1
187
65
  fi
188
-
189
- mkdir -p "${target_skills_dir}"
190
- for skill_name in "${MANAGED_SKILLS[@]}"; do
191
- cp -R "${SOURCE_SKILLS_DIR}/${skill_name}" "${target_skills_dir}/${skill_name}"
192
- done
193
- cp -R "${SOURCE_SHARED_DIR}" "${target_shared_dir}"
194
- cp -R "${SOURCE_HOOKS_DIR}" "${target_hooks_dir}"
195
-
196
- cat <<EOF
197
- AHE Codex skill installed.
198
-
199
- Next:
200
- 1. Open Codex chat in this workspace.
201
- 2. Use \`ahe init\` for a new start.
202
- 3. Use exact \`ahe\` to continue existing harness work.
203
- EOF
204
- }
205
-
206
- doctor() {
207
- local target_skills_dir="${PWD}/.codex/skills"
208
- local target_shared_dir="${PWD}/.codex/ahe-shared"
209
- local target_hooks_dir="${PWD}/.codex/hooks"
210
- local skill_name=""
211
-
212
- for skill_name in "${MANAGED_SKILLS[@]}"; do
213
- if [ ! -f "${target_skills_dir}/${skill_name}/SKILL.md" ]; then
214
- printf 'Missing: %s/%s/SKILL.md\n' "${target_skills_dir}" "${skill_name}" >&2
215
- exit 1
216
- fi
217
- done
218
-
219
- if [ ! -f "${target_shared_dir}/config.yaml" ]; then
220
- printf 'Missing: %s/config.yaml\n' "${target_shared_dir}" >&2
221
- exit 1
222
- fi
223
-
224
- if [ ! -d "${target_shared_dir}/templates" ]; then
225
- printf 'Missing: %s/templates\n' "${target_shared_dir}" >&2
226
- exit 1
227
- fi
228
-
229
- if [ ! -d "${target_shared_dir}/schemas" ]; then
230
- printf 'Missing: %s/schemas\n' "${target_shared_dir}" >&2
231
- exit 1
232
- fi
233
-
234
- if [ ! -f "${target_hooks_dir}/hooks.json" ]; then
235
- printf 'Missing: %s/hooks.json\n' "${target_hooks_dir}" >&2
236
- exit 1
237
- fi
238
-
239
- printf 'AHE skill installation looks healthy.\n'
240
- }
241
-
242
- uninstall_skill() {
243
- local target_skills_dir="${PWD}/.codex/skills"
244
- local target_shared_dir="${PWD}/.codex/ahe-shared"
245
- local target_hooks_dir="${PWD}/.codex/hooks"
246
- local target_config_path="${PWD}/.codex/config.toml"
247
- local skill_name=""
248
-
249
- echo "Uninstalling AHE skills from ${PWD}/.codex..."
250
-
251
- for skill_name in "${MANAGED_SKILLS[@]}"; do
252
- rm -rf "${target_skills_dir}/${skill_name}"
253
- done
254
-
255
- rm -rf "${target_shared_dir}"
256
- rm -rf "${target_hooks_dir}"
257
- cleanup_ahe_config_entries "${target_config_path}"
258
-
259
- echo "AHE skills uninstalled successfully."
260
66
  }
261
67
 
262
68
  main() {
@@ -266,21 +72,18 @@ main() {
266
72
  fi
267
73
 
268
74
  local command="$1"
269
- shift
270
-
75
+
271
76
  case "${command}" in
272
- install)
273
- install_skill "$@"
274
- ;;
275
- uninstall)
276
- uninstall_skill
277
- ;;
278
- doctor)
279
- doctor
77
+ install|uninstall|doctor)
78
+ dispatch "$@"
280
79
  ;;
281
80
  version)
282
81
  printf '%s\n' "${VERSION}"
283
82
  ;;
83
+ -h|--help|help)
84
+ usage
85
+ exit 0
86
+ ;;
284
87
  *)
285
88
  printf 'Unknown command: %s\n' "${command}" >&2
286
89
  usage >&2
package/package.json CHANGED
@@ -1,16 +1,20 @@
1
1
  {
2
2
  "name": "@ksuchoi216/ahe",
3
- "version": "0.1.6",
3
+ "version": "0.1.10",
4
4
  "description": "Codex chat workflow skill installer for Awesome Harness Engineering",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
+ "workspaces": [
9
+ "packages/*"
10
+ ],
8
11
  "bin": {
9
12
  "ahe": "./bin/ahe"
10
13
  },
11
14
  "scripts": {
12
15
  "test": "pytest tests/ -x",
13
- "prepublishOnly": "npm run test"
16
+ "prepublishOnly": "npm run test",
17
+ "postinstall": "echo \"\" && echo \"Awesome Harness Engineering CLI installed!\" && echo \"To install the skills, run: ahe install\" && echo \"\" && echo \"If you wish to uninstall later, run: npm uninstall -g @ksuchoi216/ahe\""
14
18
  },
15
19
  "repository": {
16
20
  "type": "git",
@@ -27,7 +31,7 @@
27
31
  "author": "ksuchoi216",
28
32
  "files": [
29
33
  "bin/",
30
- ".codex/"
34
+ "packages/"
31
35
  ],
32
36
  "license": "MIT"
33
- }
37
+ }