@marcomigozzi/trailhead 0.16.1 → 0.18.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.it.md +82 -25
- package/README.md +82 -25
- package/bin/base-preflight-docs.test.js +4 -1
- package/bin/bulk-cross-reference-docs.test.js +36 -0
- package/bin/capture-action.test.js +167 -0
- package/bin/capture-docs.test.js +32 -0
- package/bin/engine-route-docs.test.js +155 -0
- package/bin/facet-stamp-docs.test.js +79 -0
- package/bin/forced-mutation-docs.test.js +38 -0
- package/bin/grill-model-docs.test.js +155 -0
- package/bin/grilling-holistic-review-docs.test.js +7 -3
- package/bin/guard-axis-docs.test.js +69 -0
- package/bin/inbox-needs-info-docs.test.js +68 -0
- package/bin/lib/codex-projection.js +28 -19
- package/bin/lib/codex-projection.test.js +77 -20
- package/bin/lib/host-descriptor.js +1 -1
- package/bin/lib/host-descriptor.test.js +6 -0
- package/bin/needs-you-docs.test.js +9 -2
- package/bin/options-in-chat-docs.test.js +65 -0
- package/bin/pick-stress-test-docs.test.js +1 -1
- package/bin/pipeline-review-docs.test.js +118 -0
- package/bin/plan-review-budget-docs.test.js +63 -0
- package/bin/repo-target-docs.test.js +41 -0
- package/bin/report-status-docs.test.js +10 -2
- package/bin/seam-coverage-docs.test.js +46 -0
- package/bin/session-trust-docs.test.js +37 -0
- package/bin/standards-brief-docs.test.js +112 -0
- package/bin/surfaced-scope-docs.test.js +57 -0
- package/bin/test-once-docs.test.js +101 -0
- package/bin/test-run-docs.test.js +47 -0
- package/bin/trailhead.js +15 -8
- package/bin/trailhead.test.js +71 -17
- package/bin/unblock-docs.test.js +56 -0
- package/bin/yes-accepts-recommended-docs.test.js +54 -0
- package/package.json +1 -1
- package/plugins/trailhead/.claude-plugin/plugin.json +1 -1
- package/plugins/trailhead/agents/trailhead-code-review.md +2 -1
- package/plugins/trailhead/agents/trailhead-codebase-map.md +1 -1
- package/plugins/trailhead/agents/trailhead-grill.md +41 -0
- package/plugins/trailhead/agents/trailhead-plan.md +1 -1
- package/plugins/trailhead/agents/trailhead-verify.md +1 -0
- package/plugins/trailhead/hooks/lib/audit-walk.test.js +62 -0
- package/plugins/trailhead/hooks/lib/capture.test.js +439 -0
- package/plugins/trailhead/hooks/lib/checkout-find.test.js +195 -0
- package/plugins/trailhead/hooks/lib/checkout-in.test.js +83 -7
- package/plugins/trailhead/hooks/lib/dashboard.test.js +19 -0
- package/plugins/trailhead/hooks/lib/gh-auth-preflight.js +89 -0
- package/plugins/trailhead/hooks/lib/gh-auth-preflight.test.js +132 -0
- package/plugins/trailhead/hooks/lib/git-env-mod.test.js +55 -0
- package/plugins/trailhead/hooks/lib/git-env-spawn.test.js +73 -0
- package/plugins/trailhead/hooks/lib/git-env.test.js +51 -0
- package/plugins/trailhead/hooks/lib/global-config-dir.test.js +48 -0
- package/plugins/trailhead/hooks/lib/heredoc-mod.test.js +85 -0
- package/plugins/trailhead/hooks/lib/inbox-needs-info.test.js +179 -0
- package/plugins/trailhead/hooks/lib/inherit-session.js +17 -0
- package/plugins/trailhead/hooks/lib/issue-body.test.js +165 -0
- package/plugins/trailhead/hooks/lib/model-defaults-review.js +22 -1
- package/plugins/trailhead/hooks/lib/model-defaults-review.test.js +64 -1
- package/plugins/trailhead/hooks/lib/model-route.js +207 -0
- package/plugins/trailhead/hooks/lib/model-route.test.js +231 -0
- package/plugins/trailhead/hooks/lib/needs-you.test.js +45 -1
- package/plugins/trailhead/hooks/lib/plan-review-rounds.test.js +272 -0
- package/plugins/trailhead/hooks/lib/repo-target.test.js +256 -0
- package/plugins/trailhead/hooks/lib/report-status.test.js +56 -1
- package/plugins/trailhead/hooks/lib/statusline-git-env.test.js +47 -0
- package/plugins/trailhead/hooks/lib/test-run.test.js +757 -0
- package/plugins/trailhead/hooks/lib/trailhead-git-env.js +40 -0
- package/plugins/trailhead/hooks/mod/README.md +42 -17
- package/plugins/trailhead/hooks/mod/auto-run.ts +2 -1
- package/plugins/trailhead/hooks/mod/git-env.ts +31 -0
- package/plugins/trailhead/hooks/mod/heredoc.ts +79 -0
- package/plugins/trailhead/hooks/mod/map-pane-view.ts +3 -1
- package/plugins/trailhead/hooks/mod/map-pane.tsx +204 -49
- package/plugins/trailhead/hooks/mod/my-tickets.ts +76 -0
- package/plugins/trailhead/hooks/mod/repo-pin.ts +113 -9
- package/plugins/trailhead/hooks/mod/work-state-locate.ts +2 -1
- package/plugins/trailhead/hooks/trailhead-bash-guards.js +8 -8
- package/plugins/trailhead/hooks/trailhead-bash-guards.test.js +28 -14
- package/plugins/trailhead/hooks/trailhead-check-update.js +20 -2
- package/plugins/trailhead/hooks/trailhead-check-update.test.js +60 -0
- package/plugins/trailhead/hooks/trailhead-labels-guard.js +2 -2
- package/plugins/trailhead/hooks/trailhead-labels-guard.test.js +1 -1
- package/plugins/trailhead/hooks/trailhead-test-guard.js +232 -0
- package/plugins/trailhead/hooks/trailhead-test-guard.test.js +172 -0
- package/plugins/trailhead/skills/_shared/capture-core.md +123 -0
- package/plugins/trailhead/skills/_shared/choices.md +2 -2
- package/plugins/trailhead/skills/_shared/configuration-reference.md +30 -16
- package/plugins/trailhead/skills/_shared/configuration.md +1 -1
- package/plugins/trailhead/skills/_shared/load-first.md +2 -0
- package/plugins/trailhead/skills/_shared/session-handoff.md +1 -1
- package/plugins/trailhead/skills/_shared/substrate-commands.md +19 -6
- package/plugins/trailhead/skills/_shared/substrate.md +4 -3
- package/plugins/trailhead/skills/_shared/surfaced-scope.md +23 -0
- package/plugins/trailhead/skills/_shared/teamwork.md +11 -5
- package/plugins/trailhead/skills/_shared/techniques/acceptance-testing.md +1 -1
- package/plugins/trailhead/skills/_shared/techniques/code-review-pipeline.md +24 -0
- package/plugins/trailhead/skills/_shared/techniques/code-review.md +22 -6
- package/plugins/trailhead/skills/_shared/techniques/codebase-map.md +6 -3
- package/plugins/trailhead/skills/_shared/techniques/debug.md +5 -2
- package/plugins/trailhead/skills/_shared/techniques/grilling.md +28 -3
- package/plugins/trailhead/skills/_shared/techniques/plan-review.md +16 -4
- package/plugins/trailhead/skills/_shared/techniques/research.md +4 -1
- package/plugins/trailhead/skills/_shared/techniques/tdd.md +4 -2
- package/plugins/trailhead/skills/_shared/techniques/verify.md +5 -1
- package/plugins/trailhead/skills/_shared/techniques.md +8 -6
- package/plugins/trailhead/skills/trailhead-capture/SKILL.md +2 -4
- package/plugins/trailhead/skills/trailhead-capture/references/capture.md +29 -4
- package/plugins/trailhead/skills/trailhead-chart/SKILL.md +2 -2
- package/plugins/trailhead/skills/trailhead-chart/references/charting.md +5 -5
- package/plugins/trailhead/skills/trailhead-chart/references/inbox.md +11 -6
- package/plugins/trailhead/skills/trailhead-manage/references/auditing.md +18 -3
- package/plugins/trailhead/skills/trailhead-work/SKILL.md +12 -9
- package/plugins/trailhead/skills/trailhead-work/references/auto.md +3 -1
- package/plugins/trailhead/skills/trailhead-work/references/executor-brief.md +2 -0
- package/plugins/trailhead/skills/trailhead-work/references/ticket-engines.md +13 -13
- package/plugins/trailhead/templates/statusline-trailhead.sh +10 -3
- package/plugins/trailhead/templates/trailhead-audit-walk.js +56 -4
- package/plugins/trailhead/templates/trailhead-auto-merge.js +2 -1
- package/plugins/trailhead/templates/trailhead-auto-queue.js +2 -1
- package/plugins/trailhead/templates/trailhead-auto-slot.js +2 -1
- package/plugins/trailhead/templates/trailhead-base-preflight.js +10 -5
- package/plugins/trailhead/templates/trailhead-capture.js +419 -0
- package/plugins/trailhead/templates/trailhead-checkout-find.js +257 -0
- package/plugins/trailhead/templates/trailhead-checkout-in.js +78 -21
- package/plugins/trailhead/templates/trailhead-commit-msg-sync.js +2 -1
- package/plugins/trailhead/templates/trailhead-dashboard.js +15 -2
- package/plugins/trailhead/templates/trailhead-git-env.js +40 -0
- package/plugins/trailhead/templates/trailhead-inbox-needs-info.js +161 -0
- package/plugins/trailhead/templates/trailhead-isolation-answer.js +2 -1
- package/plugins/trailhead/templates/trailhead-isolation-copy.js +9 -4
- package/plugins/trailhead/templates/trailhead-issue-body.js +161 -12
- package/plugins/trailhead/templates/trailhead-merge-ticket.js +2 -1
- package/plugins/trailhead/templates/trailhead-needs-you.js +38 -4
- package/plugins/trailhead/templates/trailhead-plan-review-rounds.js +261 -7
- package/plugins/trailhead/templates/trailhead-repo-target.js +302 -0
- package/plugins/trailhead/templates/trailhead-report-status.js +57 -9
- package/plugins/trailhead/templates/trailhead-test-run.js +752 -0
- package/plugins/trailhead/templates/trailhead-uat-backfill.js +2 -1
- package/plugins/trailhead/templates/trailhead-uat-followup.js +2 -1
- package/plugins/trailhead/templates/trailhead-uat-setup.js +9 -4
- package/plugins/trailhead/templates/trailhead-unblock.js +2 -1
- package/plugins/trailhead/tests/auto-run-ui.test.ts +2 -1
- package/plugins/trailhead/tests/git-env.test.ts +20 -0
- package/plugins/trailhead/tests/map-pane-ui.test.ts +386 -50
- package/plugins/trailhead/tests/map-pane-view.test.ts +6 -0
- package/plugins/trailhead/tests/map-pane-write.test.ts +57 -1
- package/plugins/trailhead/tests/my-tickets.test.ts +66 -0
- package/plugins/trailhead/tests/repo-pin-late-repo.test.ts +3 -2
- package/plugins/trailhead/tests/repo-pin-relocate.test.ts +175 -0
- package/plugins/trailhead/tests/repo-pin.test.ts +20 -5
- package/plugins/trailhead/tests/unscrub.ts +8 -0
- package/plugins/trailhead/tests/work-state-prompt-hook.test.ts +3 -2
- package/plugins/trailhead/tests/work-state-worktree.test.ts +2 -1
- package/plugins/trailhead/types/index.d.ts +7 -0
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
const fs = require('fs');
|
|
19
19
|
const path = require('path');
|
|
20
20
|
const { spawnSync } = require('child_process');
|
|
21
|
+
const { gitEnv } = require('./trailhead-git-env.js');
|
|
21
22
|
|
|
22
23
|
const LABEL = 'trailhead:uat';
|
|
23
24
|
const COLOR = 'BFD4F2';
|
|
@@ -27,7 +28,7 @@ const LIMIT = 1000;
|
|
|
27
28
|
const UAT_LINE_RE = /^UAT of:/m;
|
|
28
29
|
|
|
29
30
|
function defaultGh(args) {
|
|
30
|
-
const r = spawnSync('gh', args, { encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 });
|
|
31
|
+
const r = spawnSync('gh', args, { encoding: 'utf8', env: gitEnv(), maxBuffer: 64 * 1024 * 1024 });
|
|
31
32
|
return { status: r.status === null ? 1 : r.status, stdout: r.stdout || '', stderr: r.stderr || (r.error ? String(r.error.message) : '') };
|
|
32
33
|
}
|
|
33
34
|
|
|
@@ -25,13 +25,14 @@
|
|
|
25
25
|
// Exit 0 on ok, 1 on an error, 2 on a usage error (stderr).
|
|
26
26
|
|
|
27
27
|
const { spawnSync } = require('child_process');
|
|
28
|
+
const { gitEnv } = require('./trailhead-git-env.js');
|
|
28
29
|
|
|
29
30
|
const MAX_PAGES = 100; // 100 pages x 100 issues
|
|
30
31
|
const QUERY = 'query($owner:String!,$name:String!,$after:String){repository(owner:$owner,name:$name){issues(first:100,after:$after,labels:["trailhead:uat"],states:[OPEN,CLOSED],orderBy:{field:CREATED_AT,direction:ASC}){nodes{number title state body} pageInfo{hasNextPage endCursor}}}}';
|
|
31
32
|
const URL_RE = /https:\/\/github\.com\/([^/\s)]+)\/([^/\s)]+)\/issues\/(\d+)(?![\w])/gi;
|
|
32
33
|
|
|
33
34
|
function defaultGh(args) {
|
|
34
|
-
const r = spawnSync('gh', args, { encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 });
|
|
35
|
+
const r = spawnSync('gh', args, { encoding: 'utf8', env: gitEnv(), maxBuffer: 64 * 1024 * 1024 });
|
|
35
36
|
return { status: r.status === null ? 1 : r.status, stdout: r.stdout || '', stderr: r.stderr || (r.error ? String(r.error.message) : '') };
|
|
36
37
|
}
|
|
37
38
|
|
|
@@ -46,6 +46,7 @@ const fs = require('fs');
|
|
|
46
46
|
const os = require('os');
|
|
47
47
|
const path = require('path');
|
|
48
48
|
const { spawnSync } = require('child_process');
|
|
49
|
+
const { gitEnv } = require('./trailhead-git-env.js');
|
|
49
50
|
|
|
50
51
|
const CONFIG_REL = path.join('.trailhead', 'config.json');
|
|
51
52
|
const OUTPUT_TAIL = 2000;
|
|
@@ -118,8 +119,12 @@ function pick(cfg, key, file) {
|
|
|
118
119
|
return out;
|
|
119
120
|
}
|
|
120
121
|
|
|
122
|
+
// Su Codex lo script vive in <codexHome>/skills/trailhead/<dir>: la config globale sta lì, non in ~/.claude.
|
|
123
|
+
const CODEX_INSTALL = /[\\/]skills[\\/]trailhead[\\/](?:hooks|templates)$/;
|
|
124
|
+
const codexHome = () => (CODEX_INSTALL.test(__dirname) ? path.resolve(__dirname, '..', '..', '..') : null);
|
|
125
|
+
|
|
121
126
|
function globalConfigPath(env) {
|
|
122
|
-
const base = env.CLAUDE_CONFIG_DIR || path.join(env.HOME || os.homedir(), '.claude');
|
|
127
|
+
const base = codexHome() || env.CLAUDE_CONFIG_DIR || path.join(env.HOME || os.homedir(), '.claude');
|
|
123
128
|
return path.join(base, 'trailhead', 'config.json');
|
|
124
129
|
}
|
|
125
130
|
|
|
@@ -257,7 +262,7 @@ function redactor(names, env) {
|
|
|
257
262
|
function sh(command, repo, env, timeoutMs, wantOutput) {
|
|
258
263
|
const timeout = Math.max(1, Math.ceil(timeoutMs));
|
|
259
264
|
if (!wantOutput) {
|
|
260
|
-
const r = spawnSync('sh', ['-c', command], { cwd: repo, env, stdio: 'ignore', timeout, killSignal: 'SIGKILL' });
|
|
265
|
+
const r = spawnSync('sh', ['-c', command], { cwd: repo, env: gitEnv(env), stdio: 'ignore', timeout, killSignal: 'SIGKILL' });
|
|
261
266
|
const timedOut = Boolean(r.error && r.error.code === 'ETIMEDOUT');
|
|
262
267
|
return { code: r.status, timedOut, spawnError: r.error && !timedOut ? r.error.message : null, tail: '' };
|
|
263
268
|
}
|
|
@@ -265,7 +270,7 @@ function sh(command, repo, env, timeoutMs, wantOutput) {
|
|
|
265
270
|
const file = path.join(dir, 'out');
|
|
266
271
|
const fd = fs.openSync(file, 'w');
|
|
267
272
|
try {
|
|
268
|
-
const r = spawnSync('sh', ['-c', command], { cwd: repo, env, stdio: ['ignore', fd, fd], timeout, killSignal: 'SIGKILL' });
|
|
273
|
+
const r = spawnSync('sh', ['-c', command], { cwd: repo, env: gitEnv(env), stdio: ['ignore', fd, fd], timeout, killSignal: 'SIGKILL' });
|
|
269
274
|
const timedOut = Boolean(r.error && r.error.code === 'ETIMEDOUT');
|
|
270
275
|
const res = { code: r.status, timedOut, spawnError: r.error && !timedOut ? r.error.message : null, tail: '' };
|
|
271
276
|
if (wantOutput) {
|
|
@@ -377,7 +382,7 @@ function main(argv, { cwd, stdout, env, fs: fsMod } = {}) {
|
|
|
377
382
|
return 0;
|
|
378
383
|
}
|
|
379
384
|
|
|
380
|
-
module.exports = { parseArgs, readConfig, main };
|
|
385
|
+
module.exports = { globalConfigPath, parseArgs, readConfig, main };
|
|
381
386
|
|
|
382
387
|
if (require.main === module) {
|
|
383
388
|
const code = main(process.argv.slice(2), { cwd: process.cwd(), stdout: process.stdout, env: process.env });
|
|
@@ -21,11 +21,12 @@
|
|
|
21
21
|
// Exit 0 on ok, 1 on an error, 2 on a usage error (stderr).
|
|
22
22
|
|
|
23
23
|
const { spawnSync } = require('child_process');
|
|
24
|
+
const { gitEnv } = require('./trailhead-git-env.js');
|
|
24
25
|
|
|
25
26
|
const LABEL = 'trailhead:blocked';
|
|
26
27
|
|
|
27
28
|
function defaultGh(args) {
|
|
28
|
-
const r = spawnSync('gh', args, { encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 });
|
|
29
|
+
const r = spawnSync('gh', args, { encoding: 'utf8', env: gitEnv(), maxBuffer: 64 * 1024 * 1024 });
|
|
29
30
|
return { status: r.status === null ? 1 : r.status, stdout: r.stdout || '', stderr: r.stderr || (r.error ? String(r.error.message) : '') };
|
|
30
31
|
}
|
|
31
32
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { On } from 'claude-code'
|
|
2
2
|
import { expect, test } from 'claude-code/testing'
|
|
3
|
+
import { unscrub } from './unscrub'
|
|
3
4
|
|
|
4
5
|
import { resetAutoRun } from '../hooks/mod/auto-run'
|
|
5
6
|
import { resetLocate } from '../hooks/mod/work-state-locate'
|
|
@@ -47,7 +48,7 @@ const rig = (on: On) => {
|
|
|
47
48
|
on('session.cwd', () => ({ value: r.cwd }))
|
|
48
49
|
on('session.id', () => ({ value: SESSION }))
|
|
49
50
|
on('process.run', (_$, e) => {
|
|
50
|
-
const line = e.argv.join(' ')
|
|
51
|
+
const line = unscrub(e.argv).join(' ')
|
|
51
52
|
r.runs.push(line)
|
|
52
53
|
r.cwds.push(e.cwd ?? '')
|
|
53
54
|
const out = (stdout: string, exitCode = 0) => ({ value: { exitCode, stdout, stderr: '', isStdoutTruncated: false, isStderrTruncated: false } })
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { expect, test } from 'claude-code/testing'
|
|
2
|
+
|
|
3
|
+
import { GIT_LOCATION_VARS, gitArgv, scrubGitEnv } from '../hooks/mod/git-env'
|
|
4
|
+
import { unscrub } from './unscrub'
|
|
5
|
+
|
|
6
|
+
test('gitArgv wraps git in env -u for every repo-location variable', () => {
|
|
7
|
+
const argv = gitArgv('-C', '/repo', 'status')
|
|
8
|
+
expect(argv.slice(0, 3)).toEqual(['env', '-u', GIT_LOCATION_VARS[0]])
|
|
9
|
+
for (const name of GIT_LOCATION_VARS) expect(argv).toContain(name)
|
|
10
|
+
expect(argv.slice(-4)).toEqual(['git', '-C', '/repo', 'status'])
|
|
11
|
+
expect(unscrub(argv)).toEqual(['git', '-C', '/repo', 'status'])
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
test('GIT_DIR and GIT_WORK_TREE are scrubbed, GIT_CONFIG* is not', () => {
|
|
15
|
+
const argv = scrubGitEnv(['gh', 'api', 'graphql'])
|
|
16
|
+
expect(argv).toContain('GIT_DIR')
|
|
17
|
+
expect(argv).toContain('GIT_WORK_TREE')
|
|
18
|
+
expect(argv.some(a => a.startsWith('GIT_CONFIG'))).toBe(false)
|
|
19
|
+
expect(unscrub(argv)).toEqual(['gh', 'api', 'graphql'])
|
|
20
|
+
})
|