toga-ai 1.0.13 → 1.0.14
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/package.json +1 -1
- package/scripts/install.js +0 -1
- package/skills/capture/SKILL.md +70 -79
package/package.json
CHANGED
package/scripts/install.js
CHANGED
|
@@ -542,7 +542,6 @@ function main() {
|
|
|
542
542
|
|
|
543
543
|
console.log(' Harness: npm bundle v' + bundleVersion);
|
|
544
544
|
if (knowledgeDir !== PACKAGE_ROOT) {
|
|
545
|
-
const isInitOnly = (() => { try { const r = spawnSync('git', ['-C', knowledgeDir, 'remote', 'get-url', 'origin'], { stdio: 'pipe' }); return r.status === 0 && !gitUpdateLine; } catch { return false; } })();
|
|
546
545
|
if (gitUpdateLine) {
|
|
547
546
|
console.log(' Knowledge: git repo (' + gitUpdateLine.replace('git update: ', '') + ')');
|
|
548
547
|
} else {
|
package/skills/capture/SKILL.md
CHANGED
|
@@ -33,30 +33,43 @@ validate + index succeed:
|
|
|
33
33
|
- Doc types: `feature`, `client-feature`, `workflow`, `architecture` (elevated),
|
|
34
34
|
`standard` (elevated).
|
|
35
35
|
|
|
36
|
-
## Step 1 — Resolve
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
36
|
+
## Step 1 — Resolve TEAM_REPO and classify it
|
|
37
|
+
|
|
38
|
+
Probe in order for a directory containing `knowledge/registry.json`. After finding it,
|
|
39
|
+
immediately check if it is a real git clone. Set two variables you will use in every
|
|
40
|
+
subsequent step:
|
|
41
|
+
|
|
42
|
+
- `TEAM_REPO` — the resolved path
|
|
43
|
+
- `IS_GIT_CLONE` — `true` if `git -C "<TEAM_REPO>" rev-parse --git-dir` exits 0
|
|
44
|
+
|
|
45
|
+
**Probe order (stop at first hit):**
|
|
46
|
+
```bash
|
|
47
|
+
# 1. Claude memory — only accept if IS_GIT_CLONE is true
|
|
48
|
+
# (avoids re-using a stale .claude/ path from a previous session)
|
|
49
|
+
# 2. Env var CLAUDE_TEAM_REPO
|
|
50
|
+
# 3. Auto-discover (in this order):
|
|
51
|
+
for p in ~/toga-tech ~/claude ~/Documents/claude ~/Projects/claude ~/dev/claude \
|
|
52
|
+
C:/WWW/claude D:/WWW/claude \
|
|
53
|
+
./claude ../claude ../../claude; do
|
|
54
|
+
[ -f "$p/knowledge/registry.json" ] && echo "FOUND: $p" && break
|
|
55
|
+
done
|
|
56
|
+
# 4. Fallback: <project>/.claude/ — IS_GIT_CLONE will be false
|
|
57
|
+
# 5. Ask the developer
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**`~/toga-tech` must be probed first** — `npx toga-ai` runs `initLocalRepo` there, which
|
|
61
|
+
creates a proper git repo seeded from the bundle even when the remote is private.
|
|
62
|
+
|
|
63
|
+
**If `IS_GIT_CLONE` is false** (only `.claude/` bundle found): warn immediately and skip
|
|
64
|
+
Steps 5–7 for git operations:
|
|
65
|
+
> "⚠ No git clone found at standard paths. Docs will be written locally only.
|
|
66
|
+
> Run `npx toga-ai` first (it creates `~/toga-tech` as a pushable git repo),
|
|
67
|
+
> then re-run /capture to push to GitHub."
|
|
68
|
+
|
|
69
|
+
**Persist** `team-repo-path` to Claude memory only when `IS_GIT_CLONE` is true — never
|
|
70
|
+
persist the `.claude/` bundle path, or the next session will silently skip pushing again.
|
|
71
|
+
|
|
72
|
+
Call the helper as `node "<TEAM_REPO>/knowledge.js" …`.
|
|
60
73
|
|
|
61
74
|
## Step 2 — Determine framework / repo / project (ask if unknown)
|
|
62
75
|
|
|
@@ -98,89 +111,67 @@ Ask the developer to approve. They may accept all, accept some, or edit. **Write
|
|
|
98
111
|
until they confirm.** If a needed placement detail is ambiguous (which client? new vs.
|
|
99
112
|
update?), ask before proposing.
|
|
100
113
|
|
|
101
|
-
## Step 5 — Apply
|
|
114
|
+
## Step 5 — Apply approved changes (write to TEAM_REPO, not .claude/)
|
|
102
115
|
|
|
103
|
-
Write
|
|
104
|
-
|
|
105
|
-
a real slug for client docs), `type`, `status`, `updated` (today's date), `owners`, `files`,
|
|
106
|
-
`related`. Add `related:` cross-links (a `client-feature` must link back to the shared
|
|
107
|
-
`apps/<repo>/features/<base>.md`). If a new repo was onboarded, append it to `registry.json`.
|
|
116
|
+
Write all docs to `<TEAM_REPO>/knowledge/...` — the git clone, not the project bundle.
|
|
117
|
+
**Never write to `<project>/.claude/knowledge/` when a git clone exists.**
|
|
108
118
|
|
|
109
|
-
|
|
119
|
+
For every doc, set/refresh frontmatter: `framework`, `repo`, `project`, `client`,
|
|
120
|
+
`type`, `status`, `updated` (today's date), `owners`, `files`, `related`.
|
|
121
|
+
Add `related:` cross-links. Append new repos to `<TEAM_REPO>/knowledge/registry.json`.
|
|
110
122
|
|
|
111
|
-
|
|
112
|
-
|
|
123
|
+
## Step 6 — Validate, index, mirror back (mandatory)
|
|
124
|
+
|
|
125
|
+
```bash
|
|
113
126
|
node "<TEAM_REPO>/knowledge.js" validate
|
|
127
|
+
node "<TEAM_REPO>/knowledge.js" index
|
|
114
128
|
```
|
|
115
129
|
|
|
116
|
-
`
|
|
117
|
-
reports any error, **stop and fix it** before telling the developer you're done — do not
|
|
118
|
-
report success on an inconsistent knowledge base.
|
|
130
|
+
If `validate` reports any ERROR — stop and fix before continuing.
|
|
119
131
|
|
|
120
|
-
|
|
132
|
+
After both pass, **mirror back** to keep the project's local reads fresh:
|
|
133
|
+
```bash
|
|
134
|
+
# Only when TEAM_REPO != <project>/.claude
|
|
135
|
+
cp -r "<TEAM_REPO>/knowledge/" "<project>/.claude/knowledge/"
|
|
136
|
+
```
|
|
137
|
+
Skip mirror-back if the paths are the same directory.
|
|
121
138
|
|
|
122
|
-
|
|
123
|
-
**Never skip straight to the push — the repo must be verified first.**
|
|
139
|
+
## Step 7 — Push (only when IS_GIT_CLONE is true)
|
|
124
140
|
|
|
125
|
-
|
|
141
|
+
If `IS_GIT_CLONE` is false — skip this step entirely and show:
|
|
142
|
+
> "⚠ Docs written to `.claude/knowledge/` only (no git clone). Run `npx toga-ai`
|
|
143
|
+
> to create `~/toga-tech`, then re-run /capture to push."
|
|
126
144
|
|
|
127
|
-
|
|
128
|
-
```bash
|
|
129
|
-
git -C "<TEAM_REPO>" rev-parse --is-inside-work-tree
|
|
130
|
-
```
|
|
131
|
-
If this fails: the team repo is an npm bundle extract, not a git clone. Run:
|
|
132
|
-
```bash
|
|
133
|
-
git clone https://github.com/agilantsolutions/claude "<TEAM_REPO>"
|
|
134
|
-
```
|
|
135
|
-
Then re-run validate + index inside the freshly cloned repo before continuing.
|
|
145
|
+
Otherwise:
|
|
136
146
|
|
|
137
|
-
**Check
|
|
147
|
+
**Check A — origin URL correct?**
|
|
138
148
|
```bash
|
|
139
149
|
git -C "<TEAM_REPO>" remote get-url origin
|
|
140
150
|
```
|
|
141
|
-
Expected: `https://github.com/agilantsolutions/claude` (or the SSH equivalent).
|
|
142
151
|
If wrong or missing: `git -C "<TEAM_REPO>" remote set-url origin https://github.com/agilantsolutions/claude`
|
|
143
152
|
|
|
144
|
-
**Check
|
|
145
|
-
|
|
146
|
-
The docs you wrote in Steps 5–6 must exist inside `<TEAM_REPO>/knowledge/`, not only
|
|
147
|
-
in `<project>/.claude/knowledge/`. If you wrote them to the project's `.claude/knowledge/`
|
|
148
|
-
but not to `<TEAM_REPO>/knowledge/`, copy them now:
|
|
149
|
-
```bash
|
|
150
|
-
# Example — adjust paths to match what was written
|
|
151
|
-
cp "<project>/.claude/knowledge/<path-to-doc>" "<TEAM_REPO>/knowledge/<path-to-doc>"
|
|
152
|
-
```
|
|
153
|
-
Then re-run `node "<TEAM_REPO>/knowledge.js" validate` to confirm they're valid there too.
|
|
154
|
-
|
|
155
|
-
**Check 4 — Are there actually staged changes to push?**
|
|
153
|
+
**Check B — anything new to push?**
|
|
156
154
|
```bash
|
|
157
155
|
git -C "<TEAM_REPO>" status --short knowledge/
|
|
158
156
|
```
|
|
159
|
-
If
|
|
160
|
-
|
|
161
|
-
---
|
|
162
|
-
|
|
163
|
-
### Push (only after all 4 checks pass)
|
|
157
|
+
If empty — report "No new knowledge to push" and exit cleanly.
|
|
164
158
|
|
|
159
|
+
**Push:**
|
|
165
160
|
```bash
|
|
166
|
-
# Stage only knowledge/ — never stage anything else
|
|
167
161
|
git -C "<TEAM_REPO>" add knowledge/
|
|
168
162
|
git -C "<TEAM_REPO>" diff --cached --quiet || \
|
|
169
|
-
git -C "<TEAM_REPO>" commit -m "knowledge: <
|
|
170
|
-
|
|
171
|
-
# Push to the active development branch
|
|
163
|
+
git -C "<TEAM_REPO>" commit -m "knowledge: <one-line summary>"
|
|
172
164
|
git -C "<TEAM_REPO>" push origin HEAD:feature/ai-harness-improvements
|
|
173
165
|
```
|
|
174
166
|
|
|
175
|
-
|
|
176
|
-
|
|
167
|
+
Never stage files outside `knowledge/`. If `git diff --cached` includes anything outside
|
|
168
|
+
`knowledge/`, abort and warn before committing.
|
|
177
169
|
|
|
178
|
-
**If push
|
|
179
|
-
> "
|
|
180
|
-
> `git -C <TEAM_REPO> push origin HEAD:feature/ai-harness-improvements`"
|
|
170
|
+
**If push succeeds:**
|
|
171
|
+
> "✓ Pushed to `feature/ai-harness-improvements` — CI publishes new npm version. Teammates get it on `npx toga-ai`."
|
|
181
172
|
|
|
182
|
-
|
|
183
|
-
`
|
|
173
|
+
**If push fails** — show exact git error, then:
|
|
174
|
+
> "⚠ Push failed: `<error>`. Run manually: `git -C <TEAM_REPO> push origin HEAD:feature/ai-harness-improvements`"
|
|
184
175
|
|
|
185
176
|
## Step 8 — Report
|
|
186
177
|
|