toga-ai 1.0.13 → 1.0.15

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toga-ai",
3
- "version": "1.0.13",
3
+ "version": "1.0.15",
4
4
  "description": "TOGA Technology Team Claude Knowledge System — shared AI coding harness with skills, knowledge base CLI, and project installer for Claude Code.",
5
5
  "keywords": [
6
6
  "claude",
@@ -25,7 +25,7 @@ const path = require('path');
25
25
  const { spawnSync } = require('child_process');
26
26
  const os = require('os');
27
27
 
28
- const REPO_URL = 'https://github.com/TOGATechnology/claude';
28
+ const REPO_URL = 'https://github.com/agilantsolutions/claude';
29
29
  const REPO_ENV_VAR = 'TOGA_TECH_REPO';
30
30
  const CACHE_FILE = path.join(os.homedir(), '.toga-tech-path');
31
31
 
@@ -187,7 +187,7 @@ function tryGitPull(repoDir) {
187
187
 
188
188
  const afterCount = countMd(path.join(repoDir, 'knowledge'));
189
189
  const newDocs = Math.max(0, afterCount - beforeCount);
190
- return { pulled: true, newDocs, message: 'pulled ' + newDocs + ' new knowledge doc' + (newDocs !== 1 ? 's' : '') + ' from TOGATechnology/claude' };
190
+ return { pulled: true, newDocs, message: 'pulled ' + newDocs + ' new knowledge doc' + (newDocs !== 1 ? 's' : '') + ' from agilantsolutions/claude' };
191
191
  }
192
192
 
193
193
  /* ------------------------------------------------------------------ */
@@ -529,7 +529,7 @@ function main() {
529
529
  if (pullResult.pulled) {
530
530
  knowledgeDir = repoDir;
531
531
  if (pullResult.newDocs > 0) {
532
- gitUpdateLine = 'git update: pulled ' + pullResult.newDocs + ' new knowledge doc' + (pullResult.newDocs !== 1 ? 's' : '') + ' from TOGATechnology/claude';
532
+ gitUpdateLine = 'git update: pulled ' + pullResult.newDocs + ' new knowledge doc' + (pullResult.newDocs !== 1 ? 's' : '') + ' from agilantsolutions/claude';
533
533
  } else if (pullResult.message !== 'already up to date') {
534
534
  gitUpdateLine = 'git update: ' + pullResult.message;
535
535
  }
@@ -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 {
@@ -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 the team-repo (`claude`) path
37
-
38
- Same resolution order as kickoff, but **push requires a real git clone** flag clearly if
39
- only the installed `.claude/` bundle is found.
40
-
41
- Resolve in order:
42
- 1. Claude memory `team-repo-path` — valid if path contains `knowledge/registry.json`
43
- 2. Env var `CLAUDE_TEAM_REPO`
44
- 3. Auto-discover — probe for `knowledge/registry.json` (NOT `knowledge/INDEX.md` — it's
45
- auto-generated and absent in fresh clones) at these paths:
46
- - `~/toga-tech` ← install.js clones here by default
47
- - `~/claude`, `~/Documents/claude`, `~/Projects/claude`, `~/dev/claude`
48
- - `C:\WWW\claude`, `D:\WWW\claude` (Windows)
49
- - `./claude`, `../claude`, `../../claude`
50
- - Walk up the directory tree from cwd
51
- - `.claude/` in the current project (last resort — read-only, cannot push)
52
- 4. Ask the developer
53
-
54
- If only `.claude/` is found write docs there but warn before Step 7:
55
- > "⚠ No git clone found. Docs written locally but cannot push to GitHub.
56
- > Run: `git clone https://github.com/agilantsolutions/claude ~/toga-tech`
57
- > then re-run /capture to push."
58
-
59
- Persist a `team-repo-path` memory if missing. Call the helper as `node "<TEAM_REPO>/knowledge.js" …`.
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 the approved changes
114
+ ## Step 5 — Apply approved changes (write to TEAM_REPO, not .claude/)
102
115
 
103
- Write/update/remove docs using the templates below. For every doc set/refresh frontmatter:
104
- `framework`, `repo` (omit for pure client docs), `project`, `client` (`shared` for app docs;
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
- ## Step 6 Re-index and guard integrity (mandatory)
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
- node "<TEAM_REPO>/knowledge.js" index
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
- `index` rebuilds all `INDEX.md` files from frontmatter (never hand-edit them). If `validate`
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
- ## Step 7 Auto-push to share with teammates
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
- After validate + index succeed, run through these checks in order before pushing.
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
- ### Pre-push checklist (run each check, stop at the first failure and fix it)
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
- **Check 1 — Is TEAM_REPO a git repository?**
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 2Is origin set to the right remote?**
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 3Are the knowledge docs in TEAM_REPO, not just the project?**
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 Banything new to push?**
156
154
  ```bash
157
155
  git -C "<TEAM_REPO>" status --short knowledge/
158
156
  ```
159
- If nothing shows: the docs were never written to TEAM_REPO. Go back to Check 3.
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: <brief description of what was captured>"
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
- **If push succeeds:** report
176
- > "✓ Knowledge pushed to `feature/ai-harness-improvements` CI will publish a new npm version. Teammates get it on their next `npx toga-ai`."
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 fails** — show the developer the exact git error output, then report:
179
- > " Push failed: `<error>`. Fix credentials or run manually:
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
- Never stage anything outside `knowledge/`. If `git diff --cached` shows files outside
183
- `knowledge/`, abort and warn before committing.
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