gipity 1.1.13 → 1.1.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/dist/api.js +84 -17
- package/dist/auth.js +14 -1
- package/dist/claude-setup.js +109 -4
- package/dist/commands/build.js +33 -5
- package/dist/commands/doctor.js +26 -5
- package/dist/commands/init.js +53 -9
- package/dist/index.js +322 -101
- package/dist/project-setup.js +5 -2
- package/dist/relay/daemon.js +75 -4
- package/dist/relay/diagnostics.js +10 -1
- package/dist/setup.js +103 -25
- package/package.json +2 -2
package/dist/project-setup.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { clearConfigCache, saveConfigAt, getApiBaseOverride, DEFAULT_API_BASE } from './config.js';
|
|
8
8
|
import { sync } from './sync.js';
|
|
9
9
|
import { createProgressReporter } from './progress.js';
|
|
10
|
-
import { setupProjectTools,
|
|
10
|
+
import { setupProjectTools, DEFAULT_SYNC_IGNORE } from './setup.js';
|
|
11
11
|
import { substituteDir } from './template-vars.js';
|
|
12
12
|
import { muted } from './colors.js';
|
|
13
13
|
/** Write `.gipity.json` in `dir`, chdir into it so the hook/skill writers
|
|
@@ -63,7 +63,10 @@ export async function finalizeLocalProject(opts) {
|
|
|
63
63
|
throw err;
|
|
64
64
|
// soft mode - swallow; caller can log
|
|
65
65
|
}
|
|
66
|
-
setupProjectTools(
|
|
66
|
+
// No explicit list => let setupProjectTools resolve it (project pin, else
|
|
67
|
+
// detection). Passing DEFAULT_TOOLS here would have quietly bypassed both
|
|
68
|
+
// and written every tool's primer on this path only.
|
|
69
|
+
setupProjectTools(opts.tools);
|
|
67
70
|
return { applied };
|
|
68
71
|
}
|
|
69
72
|
//# sourceMappingURL=project-setup.js.map
|
package/dist/relay/daemon.js
CHANGED
|
@@ -20,6 +20,7 @@ import { ensureRelayAgentToken } from './agent-token.js';
|
|
|
20
20
|
import { redactEntries, redactString, normalizeSecrets } from './redact.js';
|
|
21
21
|
import { getMachineId } from './machine-id.js';
|
|
22
22
|
import { collectDiagnostics } from './diagnostics.js';
|
|
23
|
+
import { claudeAuthStatusAsync, claudeLoginHint } from '../claude-setup.js';
|
|
23
24
|
import { runAgentUpdates, agentUpdateInProgress } from './agent-updates.js';
|
|
24
25
|
import { SessionPool, PoolFullError } from './session-pool.js';
|
|
25
26
|
import { getConfig } from '../config.js';
|
|
@@ -90,7 +91,19 @@ function mapPlatform(p) {
|
|
|
90
91
|
* cold without the interactive prompts. */
|
|
91
92
|
async function registerDevice() {
|
|
92
93
|
const name = (hostname() || 'my-pc').trim().slice(0, 100) || 'my-pc';
|
|
93
|
-
|
|
94
|
+
// Platform-provisioned devboxes declare what they run and where they live
|
|
95
|
+
// (the relay-host entrypoint sets these). The daemon's cold-start register
|
|
96
|
+
// must forward them just like setup.ts pairDevice does: a devbox container
|
|
97
|
+
// has no relay.json on first boot, so THIS is the path that registers it,
|
|
98
|
+
// and dropping the kinds would land it as local/claude_code - which skips
|
|
99
|
+
// the server's cloud credit admission and devbox_compute billing entirely.
|
|
100
|
+
const deviceKind = process.env.GIPITY_DEVICE_KIND;
|
|
101
|
+
const agentKind = process.env.GIPITY_AGENT_KIND;
|
|
102
|
+
const res = await post('/remote-devices', {
|
|
103
|
+
name, platform: mapPlatform(osPlatform()), machine_id: getMachineId(),
|
|
104
|
+
...(deviceKind ? { device_kind: deviceKind } : {}),
|
|
105
|
+
...(agentKind ? { agent_kind: agentKind } : {}),
|
|
106
|
+
});
|
|
94
107
|
const device = {
|
|
95
108
|
guid: res.data.short_guid,
|
|
96
109
|
name: res.data.name,
|
|
@@ -1110,6 +1123,7 @@ async function handleDispatch(claimed) {
|
|
|
1110
1123
|
let killed = false;
|
|
1111
1124
|
let runtimeLimit = false;
|
|
1112
1125
|
let stderrTail = '';
|
|
1126
|
+
let assistantTail = '';
|
|
1113
1127
|
let startupMs;
|
|
1114
1128
|
try {
|
|
1115
1129
|
const result = await spawnGipityClaude(args, cwd, d, queue, { resumeWords: transcript?.words });
|
|
@@ -1117,6 +1131,7 @@ async function handleDispatch(claimed) {
|
|
|
1117
1131
|
killed = result.killed;
|
|
1118
1132
|
runtimeLimit = result.runtimeLimit ?? false;
|
|
1119
1133
|
stderrTail = result.stderrTail ?? '';
|
|
1134
|
+
assistantTail = result.assistantTail ?? '';
|
|
1120
1135
|
startupMs = result.startupMs;
|
|
1121
1136
|
}
|
|
1122
1137
|
catch (err) {
|
|
@@ -1152,6 +1167,19 @@ async function handleDispatch(claimed) {
|
|
|
1152
1167
|
// stderr lines so the visible marker carries the real error instead of
|
|
1153
1168
|
// just an exit code (previously stderr only reached the daemon's log).
|
|
1154
1169
|
const stderrNote = stderrTail ? `: ${stderrTail.slice(0, 300)}` : '';
|
|
1170
|
+
// Claude Code's own "Not logged in · Please run /login" is advice for someone
|
|
1171
|
+
// sitting at a Claude Code prompt. The person reading THIS is in a browser on
|
|
1172
|
+
// a different machine, where /login means nothing and the failing machine is
|
|
1173
|
+
// unnamed. So ADD the actionable line - appended, never substituted. A host
|
|
1174
|
+
// being signed out makes login the likely cause but doesn't prove it caused
|
|
1175
|
+
// THIS failure (a run using ANTHROPIC_API_KEY works while `auth status` still
|
|
1176
|
+
// reports signed out), and swallowing the child's real error to assert a
|
|
1177
|
+
// guess would trade one misleading message for another. Only computed on the
|
|
1178
|
+
// failure path - the check spawns a process.
|
|
1179
|
+
const authHint = (exitCode !== 0 && !killed && !runtimeLimit && !spawnErr)
|
|
1180
|
+
? claudeAuthFailureHint(await claudeAuthStatusAsync(), `${stderrTail} ${assistantTail}`, state.getDevice()?.name)
|
|
1181
|
+
: null;
|
|
1182
|
+
const authNote = authHint ? ` · ${authHint}` : '';
|
|
1155
1183
|
const tail = runtimeLimit
|
|
1156
1184
|
? `stopped after ${dur} (runtime limit)`
|
|
1157
1185
|
: killed
|
|
@@ -1160,7 +1188,7 @@ async function handleDispatch(claimed) {
|
|
|
1160
1188
|
? `failed (${dur}: ${spawnErr})`
|
|
1161
1189
|
: exitCode === 0
|
|
1162
1190
|
? `finished (${dur})`
|
|
1163
|
-
: `failed (${dur}, exit ${exitCode}${stderrNote})`;
|
|
1191
|
+
: `failed (${dur}, exit ${exitCode}${stderrNote})${authNote}`;
|
|
1164
1192
|
pushSystem(`Claude Code ${tail}`);
|
|
1165
1193
|
await flushQueue();
|
|
1166
1194
|
// Observability: how long the relay took before the agent produced its
|
|
@@ -1184,10 +1212,37 @@ async function handleDispatch(claimed) {
|
|
|
1184
1212
|
await ack(d.short_guid, 'done', undefined, metrics);
|
|
1185
1213
|
}
|
|
1186
1214
|
else {
|
|
1187
|
-
log('warn', 'dispatch child exited nonzero', { id: d.short_guid, exitCode, ms });
|
|
1188
|
-
await ack(d.short_guid, 'error', `Claude Code exited with code ${exitCode}${stderrNote}`);
|
|
1215
|
+
log('warn', 'dispatch child exited nonzero', { id: d.short_guid, exitCode, ms, authHint: !!authHint });
|
|
1216
|
+
await ack(d.short_guid, 'error', `Claude Code exited with code ${exitCode}${stderrNote}${authNote}`);
|
|
1189
1217
|
}
|
|
1190
1218
|
}
|
|
1219
|
+
/** Output shapes that mean "Claude Code could not authenticate". Only consulted
|
|
1220
|
+
* when `claude auth status` couldn't answer, so it never has to be exhaustive. */
|
|
1221
|
+
const CLAUDE_AUTH_ERROR_RE = /not logged in|please run \/login|claude auth login|invalid api key|authentication_error|oauth token (?:has )?(?:expired|been revoked)/i;
|
|
1222
|
+
/**
|
|
1223
|
+
* Decide whether a failed dispatch was really "Claude Code isn't logged in on
|
|
1224
|
+
* this machine", and if so return a line the reader can act on. Pure: the
|
|
1225
|
+
* caller does the I/O (`claudeAuthStatusAsync`) and passes the result in.
|
|
1226
|
+
*
|
|
1227
|
+
* Conservative by construction:
|
|
1228
|
+
* - `loggedIn: false` is definitive, so translate.
|
|
1229
|
+
* - status null (couldn't tell: Claude Code absent, or too old for `auth
|
|
1230
|
+
* status`) falls back to the child's OUTPUT tail, which can only ADD a
|
|
1231
|
+
* hint we would otherwise not have given. That tail must include stdout,
|
|
1232
|
+
* not just stderr: Claude Code prints "Not logged in · Please run /login"
|
|
1233
|
+
* as assistant text on stdout, so a stderr-only haystack misses the only
|
|
1234
|
+
* line that names the failure.
|
|
1235
|
+
* - `loggedIn: true` never translates, so a user prompt that merely contains
|
|
1236
|
+
* the words "not logged in" cannot manufacture a bogus login hint.
|
|
1237
|
+
* Exported for tests.
|
|
1238
|
+
*/
|
|
1239
|
+
export function claudeAuthFailureHint(status, outputTail, deviceName) {
|
|
1240
|
+
if (status?.loggedIn === false)
|
|
1241
|
+
return claudeLoginHint(deviceName);
|
|
1242
|
+
if (status === null && CLAUDE_AUTH_ERROR_RE.test(outputTail))
|
|
1243
|
+
return claudeLoginHint(deviceName);
|
|
1244
|
+
return null;
|
|
1245
|
+
}
|
|
1191
1246
|
/**
|
|
1192
1247
|
* Dispatch for non-Claude agents (Codex, Grok). Deliberately simpler than
|
|
1193
1248
|
* the Claude path: there is no stream-json ingest mapper for these agents -
|
|
@@ -1760,6 +1815,8 @@ export async function spawnGipityClaude(args, cwd, d, queue, meta) {
|
|
|
1760
1815
|
// payload works for a future codex/aider/etc. runner.
|
|
1761
1816
|
const dispatchStartedAt = Date.now();
|
|
1762
1817
|
let stdoutBytesTotal = 0;
|
|
1818
|
+
// Last few assistant texts, for the auth-failure hint (see the push site).
|
|
1819
|
+
const assistantTail = [];
|
|
1763
1820
|
let lastStdoutByteAt = dispatchStartedAt;
|
|
1764
1821
|
let stdoutBytesAtLastTick = 0;
|
|
1765
1822
|
const phases = new PhaseTracker();
|
|
@@ -1930,6 +1987,19 @@ export async function spawnGipityClaude(args, cwd, d, queue, meta) {
|
|
|
1930
1987
|
if (!e.source_uuid)
|
|
1931
1988
|
e.source_uuid = randomUUID();
|
|
1932
1989
|
}
|
|
1990
|
+
// Keep a small tail of assistant TEXT for the auth-failure hint. Claude
|
|
1991
|
+
// Code reports "Not logged in · Please run /login" as assistant output
|
|
1992
|
+
// on stdout, not on stderr - so a hint that only reads stderrTail can
|
|
1993
|
+
// never see the one line that names the problem (observed live on a
|
|
1994
|
+
// paired device 2026-08-14: the conversation showed the login message
|
|
1995
|
+
// while the failure marker showed only the wrapper's chatter).
|
|
1996
|
+
for (const e of entries) {
|
|
1997
|
+
if (e.kind === 'assistant' && typeof e.text === 'string') {
|
|
1998
|
+
assistantTail.push(e.text.trim());
|
|
1999
|
+
if (assistantTail.length > 3)
|
|
2000
|
+
assistantTail.shift();
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
1933
2003
|
q.push(...entries);
|
|
1934
2004
|
});
|
|
1935
2005
|
child.stdout?.on('data', (chunk) => {
|
|
@@ -2008,6 +2078,7 @@ export async function spawnGipityClaude(args, cwd, d, queue, meta) {
|
|
|
2008
2078
|
cleanup();
|
|
2009
2079
|
resolve({
|
|
2010
2080
|
exitCode: code ?? 1, killed, runtimeLimit, stderrTail: stderrTail.join(' | '),
|
|
2081
|
+
assistantTail: assistantTail.join(' | '),
|
|
2011
2082
|
startupMs: firstEventAt !== undefined ? Math.max(0, firstEventAt - dispatchStartedAt) : undefined,
|
|
2012
2083
|
});
|
|
2013
2084
|
});
|
|
@@ -23,6 +23,7 @@ import { join } from 'path';
|
|
|
23
23
|
import { resolveCommand, spawnCommand } from '../platform.js';
|
|
24
24
|
import { cliVersion } from '../client-context.js';
|
|
25
25
|
import { AGENT_ADAPTERS } from '../agents/index.js';
|
|
26
|
+
import { claudeAuthStatusAsync } from '../claude-setup.js';
|
|
26
27
|
const PROBE_TIMEOUT_MS = 4000;
|
|
27
28
|
/** Extract a semver-ish token from a `--version` line ("2.0.14 (Claude Code)"
|
|
28
29
|
* → "2.0.14"). Returns undefined when nothing version-like is present.
|
|
@@ -140,10 +141,15 @@ export async function collectDiagnostics() {
|
|
|
140
141
|
// so the whole snapshot costs one timeout, not the sum of four. `cursor` is
|
|
141
142
|
// a non-agent extra (no adapter - it's not a coding agent Gipity dispatches
|
|
142
143
|
// to), probed alongside the registry-driven agent binaries.
|
|
143
|
-
|
|
144
|
+
// claudeAuthStatusAsync is a local credential read (not billed) and is
|
|
145
|
+
// already bounded + best-effort, so it joins the same concurrent batch.
|
|
146
|
+
// Deliberately NOT recording the account email it also returns: this payload
|
|
147
|
+
// is non-PII by design.
|
|
148
|
+
const [versions, cursor, gpu, claudeAuth] = await Promise.all([
|
|
144
149
|
Promise.all(AGENT_ADAPTERS.map((a) => probeVersion(a.binary))),
|
|
145
150
|
probeVersion('cursor'),
|
|
146
151
|
detectGpu(),
|
|
152
|
+
claudeAuthStatusAsync(),
|
|
147
153
|
]);
|
|
148
154
|
const agents = {};
|
|
149
155
|
AGENT_ADAPTERS.forEach((a, i) => {
|
|
@@ -166,6 +172,9 @@ export async function collectDiagnostics() {
|
|
|
166
172
|
gpu,
|
|
167
173
|
agents: Object.keys(agents).length ? agents : undefined,
|
|
168
174
|
projects_local: localProjectCount(),
|
|
175
|
+
claude_auth: claudeAuth
|
|
176
|
+
? { logged_in: claudeAuth.loggedIn, method: claudeAuth.authMethod, subscription: claudeAuth.subscriptionType }
|
|
177
|
+
: undefined,
|
|
169
178
|
};
|
|
170
179
|
}
|
|
171
180
|
function safe(fn) {
|
package/dist/setup.js
CHANGED
|
@@ -6,7 +6,7 @@ import { homedir, tmpdir } from 'os';
|
|
|
6
6
|
import { existsSync, mkdirSync, writeFileSync, readFileSync, mkdtempSync, rmSync, cpSync, readdirSync } from 'fs';
|
|
7
7
|
import { resolveCommand, spawnSyncCommand } from './platform.js';
|
|
8
8
|
import { SKILLS_CONTENT, BUILD_VS_NON_BUILD_RULE, DEFINITION_OF_DONE } from './knowledge.js';
|
|
9
|
-
import { DEFAULT_API_BASE, resolveApiBase } from './config.js';
|
|
9
|
+
import { DEFAULT_API_BASE, resolveApiBase, getConfig } from './config.js';
|
|
10
10
|
import { ensureOpencodePluginInstalled, stagedPluginPath } from './opencode-setup.js';
|
|
11
11
|
export { SKILLS_CONTENT };
|
|
12
12
|
/** Canonical list of workstation artifacts that are NOT part of the project.
|
|
@@ -507,8 +507,15 @@ function installSkillsAndHooks(skillsDir, manifestPath, harnessLabel) {
|
|
|
507
507
|
const tmp = mkdtempSync(join(tmpdir(), 'gipity-skills-'));
|
|
508
508
|
try {
|
|
509
509
|
const clone = spawnSyncCommand(resolveCommand('git'), ['clone', '--depth', '1', `https://github.com/${GIPITY_MARKETPLACE_REPO}.git`, join(tmp, 'repo')], { stdio: 'ignore', timeout: 120_000 });
|
|
510
|
-
if (clone.status !== 0)
|
|
510
|
+
if (clone.status !== 0) {
|
|
511
|
+
// Still best-effort (setup must never hard-fail on a network blip), but
|
|
512
|
+
// never SILENT: a quiet skip here leaves hook scripts unstaged, which
|
|
513
|
+
// downstream reads as "installed but broken" (opencode's model provider
|
|
514
|
+
// missing cost an hour of diagnosis on 2026-08-06 - the failure surfaced
|
|
515
|
+
// three layers away as an opencode model-resolution error).
|
|
516
|
+
console.warn(`Skills install for ${harnessLabel}: git clone of ${GIPITY_MARKETPLACE_REPO} failed (exit ${clone.status}) - hooks/skills not refreshed; re-run \`gipity init\` with network access.`);
|
|
511
517
|
return;
|
|
518
|
+
}
|
|
512
519
|
const repo = join(tmp, 'repo');
|
|
513
520
|
let version = GIPITY_PLUGIN_VERSION;
|
|
514
521
|
try {
|
|
@@ -538,7 +545,10 @@ function installSkillsAndHooks(skillsDir, manifestPath, harnessLabel) {
|
|
|
538
545
|
writeFileSync(manifestPath, JSON.stringify({ version, skills: names }, null, 2) + '\n');
|
|
539
546
|
console.log(`Installed ${names.length} Gipity skills for ${harnessLabel} (${skillsDir}).`);
|
|
540
547
|
}
|
|
541
|
-
catch {
|
|
548
|
+
catch (e) {
|
|
549
|
+
// Best-effort (never break setup) but never silent - see the clone warning.
|
|
550
|
+
console.warn(`Skills install for ${harnessLabel} failed midway: ${e instanceof Error ? e.message : String(e)} - re-run \`gipity init\`.`);
|
|
551
|
+
}
|
|
542
552
|
finally {
|
|
543
553
|
rmSync(tmp, { recursive: true, force: true });
|
|
544
554
|
}
|
|
@@ -1028,39 +1038,107 @@ export function setupCopilotMd() {
|
|
|
1028
1038
|
export function setupCursorMd() {
|
|
1029
1039
|
writeSkillsFile(PRIMER_FILES.cursor, (block) => `---\ndescription: Gipity platform integration - CLI, sandbox, app services\nalwaysApply: true\n---\n\n${block}`);
|
|
1030
1040
|
}
|
|
1031
|
-
/** All supported coding tools: the primer each gets (`setup`) plus, for tools
|
|
1032
|
-
* with a deeper Gipity integration, an `integrate` step that installs the
|
|
1033
|
-
* Gipity skills and file-sync hooks into that tool's own ecosystem (Claude
|
|
1034
|
-
* Code plugin, Grok Build plugin, Codex ~/.agents/skills + .codex hooks).
|
|
1035
|
-
* Integrations are best-effort and self-gating - each no-ops fast when its
|
|
1036
|
-
* binary is missing or the install is already current - so running the whole
|
|
1037
|
-
* default set on every init/launch is cheap and keeps all detected agents in
|
|
1038
|
-
* lockstep. Order matters for help-text rendering and the `all` expansion.
|
|
1039
|
-
* `optIn` tools are excluded from the default / `all` set and must be named
|
|
1040
|
-
* explicitly (`--for aider`): aider's setup writes `.aider.conf.yml`, which
|
|
1041
|
-
* changes how aider behaves in this directory - a heavier footprint than
|
|
1042
|
-
* dropping an inert markdown primer. */
|
|
1043
1041
|
export const SUPPORTED_TOOLS = [
|
|
1044
|
-
{ key: 'claude', label: 'Claude Code (CLAUDE.md + Gipity plugin)', setup: setupClaudeMd, integrate: setupClaudeHooks },
|
|
1045
|
-
{ key: 'codex', label: 'OpenAI Codex (AGENTS.md + skills + sync hooks)', setup: setupAgentsMd, integrate: setupCodexIntegration },
|
|
1046
|
-
{ key: 'grok', label: 'Grok Build (AGENTS.md + Gipity plugin)', setup: setupAgentsMd, integrate: ensureGrokPluginInstalled },
|
|
1047
|
-
{ key: 'agy', label: 'Antigravity (AGENTS.md + skills + sync hooks)', setup: setupAgentsMd, integrate: setupAgyIntegration },
|
|
1048
|
-
{ key: 'opencode', label: 'opencode (AGENTS.md + skills + Gipity plugin)', setup: setupAgentsMd, integrate: setupOpencodeIntegration },
|
|
1049
|
-
{ key: 'aider', label: 'Aider (AGENTS.md + .aider.conf.yml)', setup: setupAiderMd, optIn: true },
|
|
1050
|
-
{ key: 'gemini', label: 'Gemini CLI (GEMINI.md)', setup: setupGeminiMd },
|
|
1051
|
-
|
|
1052
|
-
|
|
1042
|
+
{ key: 'claude', label: 'Claude Code (CLAUDE.md + Gipity plugin)', setup: setupClaudeMd, integrate: setupClaudeHooks, binary: 'claude' },
|
|
1043
|
+
{ key: 'codex', label: 'OpenAI Codex (AGENTS.md + skills + sync hooks)', setup: setupAgentsMd, integrate: setupCodexIntegration, binary: 'codex' },
|
|
1044
|
+
{ key: 'grok', label: 'Grok Build (AGENTS.md + Gipity plugin)', setup: setupAgentsMd, integrate: ensureGrokPluginInstalled, binary: 'grok' },
|
|
1045
|
+
{ key: 'agy', label: 'Antigravity (AGENTS.md + skills + sync hooks)', setup: setupAgentsMd, integrate: setupAgyIntegration, binary: 'agy' },
|
|
1046
|
+
{ key: 'opencode', label: 'opencode (AGENTS.md + skills + Gipity plugin)', setup: setupAgentsMd, integrate: setupOpencodeIntegration, binary: 'opencode' },
|
|
1047
|
+
{ key: 'aider', label: 'Aider (AGENTS.md + .aider.conf.yml)', setup: setupAiderMd, optIn: true, binary: 'aider' },
|
|
1048
|
+
{ key: 'gemini', label: 'Gemini CLI (GEMINI.md)', setup: setupGeminiMd, binary: 'gemini' },
|
|
1049
|
+
// Copilot and Cursor are primarily IDE extensions - a user can rely on either
|
|
1050
|
+
// daily with no CLI on PATH, so a binary probe would wrongly say "absent".
|
|
1051
|
+
// Both ship an optional shell command, so probe it, but ALSO honor a project
|
|
1052
|
+
// that already has their config directory (see detectedTools).
|
|
1053
|
+
{ key: 'copilot', label: 'GitHub Copilot (.github/copilot-instructions.md)', setup: setupCopilotMd, binary: 'copilot' },
|
|
1054
|
+
{ key: 'cursor', label: 'Cursor (.cursor/rules/gipity.mdc)', setup: setupCursorMd, binary: 'cursor' },
|
|
1053
1055
|
];
|
|
1056
|
+
/** A tool whose primer file this project ALREADY has counts as in use, even
|
|
1057
|
+
* with no CLI on PATH. Two things this buys:
|
|
1058
|
+
*
|
|
1059
|
+
* - the IDE-extension case (Copilot, Cursor): a user can rely on either
|
|
1060
|
+
* daily with nothing on PATH, and dropping their primer from the refresh
|
|
1061
|
+
* would leave it frozen at whatever CLI version wrote it - and the primers
|
|
1062
|
+
* are regenerated per release, so stale means the agent reads outdated
|
|
1063
|
+
* Gipity instructions;
|
|
1064
|
+
* - existing projects: everything set up before detection existed keeps
|
|
1065
|
+
* being maintained instead of silently going stale.
|
|
1066
|
+
*
|
|
1067
|
+
* Deliberately keyed on the primer file, not a config directory. `.github`
|
|
1068
|
+
* was the obvious Copilot marker and is a bad one - workflows and issue
|
|
1069
|
+
* templates mean most GitHub repos have it, so it would have re-enabled
|
|
1070
|
+
* Copilot almost everywhere and undone the point of detecting at all. */
|
|
1071
|
+
function hasExistingPrimer(root, key) {
|
|
1072
|
+
const primer = PRIMER_FILES[key];
|
|
1073
|
+
return !!primer && existsSync(join(root, primer));
|
|
1074
|
+
}
|
|
1054
1075
|
/** The primer set written when the user makes no explicit `--for` choice:
|
|
1055
1076
|
* every tool except opt-in ones. */
|
|
1077
|
+
/** Every non-opt-in tool. The set `--for all` expands to, and the fallback
|
|
1078
|
+
* when detection finds nothing (a fresh box or CI container, where writing
|
|
1079
|
+
* every primer is better than writing none). */
|
|
1056
1080
|
export const DEFAULT_TOOLS = SUPPORTED_TOOLS.filter(t => !t.optIn);
|
|
1081
|
+
/** The tools this project should be set up for: binary on PATH, or a primer
|
|
1082
|
+
* this project already has (see hasExistingPrimer).
|
|
1083
|
+
*
|
|
1084
|
+
* Deliberately NOT a module-level const - `binaryOnPath` shells out per tool,
|
|
1085
|
+
* and the answer changes when the user installs something mid-session.
|
|
1086
|
+
*
|
|
1087
|
+
* Falls back to DEFAULT_TOOLS when nothing is detected, mirroring `gipity
|
|
1088
|
+
* build`'s agent picker: on a machine with no coding agent at all, offering
|
|
1089
|
+
* everything beats offering nothing. */
|
|
1090
|
+
export function detectedTools() {
|
|
1091
|
+
const root = resolve(process.cwd());
|
|
1092
|
+
const found = DEFAULT_TOOLS.filter(t => hasExistingPrimer(root, t.key) || (!!t.binary && binaryOnPath(t.binary)));
|
|
1093
|
+
return found.length ? found : DEFAULT_TOOLS;
|
|
1094
|
+
}
|
|
1095
|
+
/** What a bare `setupProjectTools()` should act on for THIS project, in
|
|
1096
|
+
* precedence order:
|
|
1097
|
+
* 1. the project's own pinned list (`gipity init --for <tools>`, stored in
|
|
1098
|
+
* .gipity.json) - an explicit user choice outlives any later re-run;
|
|
1099
|
+
* 2. otherwise, whatever is detected on this machine.
|
|
1100
|
+
*
|
|
1101
|
+
* Precedence matters: without (1), `gipity build` - which calls this with no
|
|
1102
|
+
* arguments - would quietly re-add primers for tools the user had scoped out
|
|
1103
|
+
* at init, so `--for` only ever held until the next command. */
|
|
1104
|
+
export function resolveProjectTools() {
|
|
1105
|
+
const pinned = getConfig()?.tools;
|
|
1106
|
+
if (pinned?.length) {
|
|
1107
|
+
const chosen = SUPPORTED_TOOLS.filter(t => pinned.includes(t.key));
|
|
1108
|
+
if (chosen.length)
|
|
1109
|
+
return chosen;
|
|
1110
|
+
}
|
|
1111
|
+
return detectedTools();
|
|
1112
|
+
}
|
|
1113
|
+
/** Set up ONE tool by key, on demand, no matter what the project is pinned to
|
|
1114
|
+
* or what detection found. Returns true if that tool exists and was run.
|
|
1115
|
+
*
|
|
1116
|
+
* Launching an agent is a stronger statement of intent than the pin: a pin
|
|
1117
|
+
* (`gipity init --for claude`) means "don't litter my project with tools I
|
|
1118
|
+
* don't use", NOT "refuse to set up a tool I am actively starting". Without
|
|
1119
|
+
* this, `gipity build` -> pick opencode inside a claude-pinned project would
|
|
1120
|
+
* launch opencode with no AGENTS.md and no capture plugin - it would run, but
|
|
1121
|
+
* know nothing about Gipity and record nothing, which reads as a broken
|
|
1122
|
+
* integration rather than a respected preference.
|
|
1123
|
+
*
|
|
1124
|
+
* Deliberately does NOT rewrite the pin. The files it writes persist, so the
|
|
1125
|
+
* agent keeps working; silently editing a choice the user typed is worse than
|
|
1126
|
+
* re-running an idempotent setup on each launch. */
|
|
1127
|
+
export function setupToolForAgent(key) {
|
|
1128
|
+
const tool = SUPPORTED_TOOLS.find(t => t.key === key);
|
|
1129
|
+
if (!tool)
|
|
1130
|
+
return false;
|
|
1131
|
+
tool.setup();
|
|
1132
|
+
tool.integrate?.();
|
|
1133
|
+
return true;
|
|
1134
|
+
}
|
|
1057
1135
|
/** Registry-driven project setup - the single entry point every "link this
|
|
1058
1136
|
* directory" path shares (`init`, `project create`, `gipity claude`, the
|
|
1059
1137
|
* relay daemon). Writes each requested tool's primer, runs its integration
|
|
1060
1138
|
* (hooks/skills install) when it has one, and refreshes .gitignore. Replaces
|
|
1061
1139
|
* the setupClaudeHooks/setupClaudeMd/setupAgentsMd/setupGitignore quartet
|
|
1062
1140
|
* that used to be copy-pasted per call site and silently skipped newer tools. */
|
|
1063
|
-
export function setupProjectTools(tools =
|
|
1141
|
+
export function setupProjectTools(tools = resolveProjectTools()) {
|
|
1064
1142
|
for (const t of tools) {
|
|
1065
1143
|
t.setup();
|
|
1066
1144
|
t.integrate?.();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gipity",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.15",
|
|
4
4
|
"description": "The full-stack platform tuned for AI agents. Database, storage, auth, functions, deploy, and drop-in kits - all agent-tuned. Pair with Claude Code or use standalone.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"gipity": "dist/updater/shim.js",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"prepack": "npm run build",
|
|
15
15
|
"dev": "tsc --watch",
|
|
16
16
|
"test": "npm run test:smoke",
|
|
17
|
-
"test:smoke": "npm run build && node --test dist/__tests__/utils.test.js dist/__tests__/template-vars.test.js dist/__tests__/platform.test.js dist/__tests__/colors.test.js dist/__tests__/config.test.js dist/__tests__/sync.test.js dist/__tests__/sync-apply.test.js dist/__tests__/sync-unretrievable.test.js dist/__tests__/sync-clean-check.test.js dist/__tests__/sync-lock.test.js dist/__tests__/auth-lock.test.js dist/__tests__/api-401-retry.test.js dist/__tests__/api-timeout.test.js dist/__tests__/push-cas.test.js dist/__tests__/upload.test.js dist/__tests__/progress.test.js dist/__tests__/updater.test.js dist/__tests__/cli-smoke.test.js dist/__tests__/claude-noninteractive.test.js dist/__tests__/claude-trust.test.js dist/__tests__/build-picker.test.js dist/__tests__/relay-state.test.js dist/__tests__/relay-daemon.test.js dist/__tests__/session-pool.test.js dist/__tests__/relay-diagnostics.test.js dist/__tests__/relay-agent-updates.test.js dist/__tests__/relay-installers.test.js dist/__tests__/relay-bridge-abort.test.js dist/__tests__/relay-redact.test.js dist/__tests__/relay-machine-id.test.js dist/__tests__/stream-json.test.js dist/__tests__/ingest-queue.test.js dist/__tests__/media-upload.test.js dist/__tests__/stream-delta.test.js dist/__tests__/phase-tracker.test.js dist/__tests__/relay-ingest-contract.test.js dist/__tests__/prompts.test.js dist/__tests__/capture-transcript.test.js dist/__tests__/capture-parsers.test.js dist/__tests__/agents.test.js dist/__tests__/capture-lock.test.js dist/__tests__/capture-resolve.test.js dist/__tests__/capture-metrics.test.js dist/__tests__/flag-aliases.test.js dist/__tests__/client-context.test.js dist/__tests__/adopt-cwd.test.js dist/__tests__/cli-cmd-agent.test.js dist/__tests__/cli-cmd-approval.test.js dist/__tests__/cli-cmd-audit.test.js dist/__tests__/cli-cmd-brand.test.js dist/__tests__/cli-cmd-bug.test.js dist/__tests__/cli-cmd-bug-queue.test.js dist/__tests__/cli-cmd-chat.test.js dist/__tests__/cli-cmd-credits.test.js dist/__tests__/cli-cmd-db.test.js dist/__tests__/cli-cmd-db-checkpoint.test.js dist/__tests__/cli-cmd-deploy.test.js dist/__tests__/cli-cmd-domain.test.js dist/__tests__/cli-cmd-email.test.js dist/__tests__/cli-cmd-file.test.js dist/__tests__/cli-cmd-storage.test.js dist/__tests__/cli-cmd-fn.test.js dist/__tests__/cli-cmd-service.test.js dist/__tests__/cli-cmd-job.test.js dist/__tests__/cli-cmd-generate.test.js dist/__tests__/cli-cmd-gmail.test.js dist/__tests__/cli-cmd-info.test.js dist/__tests__/cli-cmd-init.test.js dist/__tests__/cli-cmd-location.test.js dist/__tests__/cli-cmd-text.test.js dist/__tests__/cli-cmd-login.test.js dist/__tests__/cli-cmd-status.test.js dist/__tests__/cli-cmd-logout.test.js dist/__tests__/cli-cmd-token.test.js dist/__tests__/cli-cmd-key.test.js dist/__tests__/cli-cmd-logs.test.js dist/__tests__/cli-cmd-memory.test.js dist/__tests__/cli-cmd-page.test.js dist/__tests__/cli-cmd-plan.test.js dist/__tests__/cli-cmd-project.test.js dist/__tests__/cli-cmd-rbac.test.js dist/__tests__/cli-cmd-realtime.test.js dist/__tests__/cli-cmd-records.test.js dist/__tests__/cli-cmd-relay.test.js dist/__tests__/cli-cmd-setup.test.js dist/__tests__/cli-cmd-doctor.test.js dist/__tests__/claude-setup.test.js dist/__tests__/cli-cmd-sandbox.test.js dist/__tests__/cli-cmd-add.test.js dist/__tests__/cli-cmd-remove.test.js dist/__tests__/cli-cmd-skill.test.js dist/__tests__/cli-cmd-test.test.js dist/__tests__/cli-cmd-workflow.test.js dist/__tests__/setup-skills-block.test.js dist/__tests__/setup-hooks.test.js dist/__tests__/setup-codex-hooks.test.js dist/__tests__/setup-agy-hooks.test.js dist/__tests__/trace.test.js",
|
|
17
|
+
"test:smoke": "npm run build && node --test dist/__tests__/utils.test.js dist/__tests__/template-vars.test.js dist/__tests__/platform.test.js dist/__tests__/colors.test.js dist/__tests__/config.test.js dist/__tests__/sync.test.js dist/__tests__/sync-apply.test.js dist/__tests__/sync-unretrievable.test.js dist/__tests__/sync-clean-check.test.js dist/__tests__/sync-lock.test.js dist/__tests__/auth-lock.test.js dist/__tests__/auth-refresh-timeout.test.js dist/__tests__/api-401-retry.test.js dist/__tests__/api-timeout.test.js dist/__tests__/push-cas.test.js dist/__tests__/upload.test.js dist/__tests__/progress.test.js dist/__tests__/updater.test.js dist/__tests__/cli-smoke.test.js dist/__tests__/claude-noninteractive.test.js dist/__tests__/claude-trust.test.js dist/__tests__/claude-auth-status.test.js dist/__tests__/build-picker.test.js dist/__tests__/relay-state.test.js dist/__tests__/relay-daemon.test.js dist/__tests__/session-pool.test.js dist/__tests__/relay-diagnostics.test.js dist/__tests__/relay-agent-updates.test.js dist/__tests__/relay-installers.test.js dist/__tests__/relay-bridge-abort.test.js dist/__tests__/relay-redact.test.js dist/__tests__/relay-machine-id.test.js dist/__tests__/stream-json.test.js dist/__tests__/ingest-queue.test.js dist/__tests__/media-upload.test.js dist/__tests__/stream-delta.test.js dist/__tests__/phase-tracker.test.js dist/__tests__/relay-ingest-contract.test.js dist/__tests__/prompts.test.js dist/__tests__/capture-transcript.test.js dist/__tests__/capture-parsers.test.js dist/__tests__/agents.test.js dist/__tests__/capture-lock.test.js dist/__tests__/capture-resolve.test.js dist/__tests__/capture-metrics.test.js dist/__tests__/flag-aliases.test.js dist/__tests__/client-context.test.js dist/__tests__/adopt-cwd.test.js dist/__tests__/cli-cmd-agent.test.js dist/__tests__/cli-cmd-approval.test.js dist/__tests__/cli-cmd-audit.test.js dist/__tests__/cli-cmd-brand.test.js dist/__tests__/cli-cmd-bug.test.js dist/__tests__/cli-cmd-bug-queue.test.js dist/__tests__/cli-cmd-chat.test.js dist/__tests__/cli-cmd-credits.test.js dist/__tests__/cli-cmd-db.test.js dist/__tests__/cli-cmd-db-checkpoint.test.js dist/__tests__/cli-cmd-deploy.test.js dist/__tests__/cli-cmd-domain.test.js dist/__tests__/cli-cmd-email.test.js dist/__tests__/cli-cmd-file.test.js dist/__tests__/cli-cmd-storage.test.js dist/__tests__/cli-cmd-fn.test.js dist/__tests__/cli-cmd-service.test.js dist/__tests__/cli-cmd-job.test.js dist/__tests__/cli-cmd-generate.test.js dist/__tests__/cli-cmd-gmail.test.js dist/__tests__/cli-cmd-info.test.js dist/__tests__/cli-cmd-init.test.js dist/__tests__/cli-cmd-location.test.js dist/__tests__/cli-cmd-text.test.js dist/__tests__/cli-cmd-login.test.js dist/__tests__/cli-cmd-status.test.js dist/__tests__/cli-cmd-logout.test.js dist/__tests__/cli-cmd-token.test.js dist/__tests__/cli-cmd-key.test.js dist/__tests__/cli-cmd-logs.test.js dist/__tests__/cli-cmd-memory.test.js dist/__tests__/cli-cmd-page.test.js dist/__tests__/cli-cmd-plan.test.js dist/__tests__/cli-cmd-project.test.js dist/__tests__/cli-cmd-rbac.test.js dist/__tests__/cli-cmd-realtime.test.js dist/__tests__/cli-cmd-records.test.js dist/__tests__/cli-cmd-relay.test.js dist/__tests__/cli-cmd-setup.test.js dist/__tests__/cli-cmd-doctor.test.js dist/__tests__/claude-setup.test.js dist/__tests__/cli-cmd-sandbox.test.js dist/__tests__/cli-cmd-add.test.js dist/__tests__/cli-cmd-remove.test.js dist/__tests__/cli-cmd-skill.test.js dist/__tests__/cli-cmd-test.test.js dist/__tests__/cli-cmd-workflow.test.js dist/__tests__/tool-detection.test.js dist/__tests__/setup-skills-block.test.js dist/__tests__/setup-hooks.test.js dist/__tests__/setup-codex-hooks.test.js dist/__tests__/setup-agy-hooks.test.js dist/__tests__/trace.test.js",
|
|
18
18
|
"test:smoke:quick": "node scripts/smoke-quick.mjs",
|
|
19
19
|
"test:e2e": "tsc && GIPITY_E2E=1 node --test --test-timeout=180000 dist/__tests__/cli-e2e-live.test.js dist/__tests__/cli-e2e-sync-live.test.js dist/__tests__/cli-e2e-sync-stress-live.test.js dist/__tests__/cli-e2e-rollback-live.test.js dist/__tests__/cli-e2e-services-media-live.test.js dist/__tests__/cli-e2e-workflow-live.test.js dist/__tests__/cli-e2e-sandbox-live.test.js dist/__tests__/cli-e2e-page-fetch-live.test.js dist/__tests__/cli-e2e-page-test-live.test.js",
|
|
20
20
|
"test:e2e:sync": "tsc && GIPITY_E2E=1 node --test --test-timeout=180000 dist/__tests__/cli-e2e-sync-live.test.js",
|