gipity 1.1.6 → 1.1.9
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/agents/agy.js +31 -0
- package/dist/agents/claude-code.js +21 -0
- package/dist/agents/codex.js +21 -0
- package/dist/agents/grok.js +38 -0
- package/dist/agents/types.js +6 -17
- package/dist/capture/sources/agy.js +77 -13
- package/dist/catalog.js +2 -2
- package/dist/client-context.js +17 -21
- package/dist/commands/add.js +49 -8
- package/dist/commands/brand.js +5 -1
- package/dist/commands/build.js +26 -12
- package/dist/commands/db.js +66 -0
- package/dist/commands/email.js +12 -8
- package/dist/commands/file.js +5 -1
- package/dist/commands/generate.js +25 -30
- package/dist/commands/init.js +3 -2
- package/dist/commands/page-eval.js +39 -3
- package/dist/commands/page-screenshot.js +34 -6
- package/dist/commands/records.js +38 -6
- package/dist/commands/service.js +71 -7
- package/dist/commands/skill.js +158 -24
- package/dist/commands/uninstall.js +14 -72
- package/dist/commands/upload.js +8 -11
- package/dist/commands/workflow.js +59 -6
- package/dist/db-checkpoint.js +42 -0
- package/dist/hooks/capture-runner.js +35 -50
- package/dist/index.js +2606 -1562
- package/dist/knowledge.js +2 -2
- package/dist/provider-docs.js +1 -1
- package/dist/relay/diagnostics.js +13 -11
- package/dist/relay/onboarding.js +3 -3
- package/dist/setup.js +83 -2
- package/dist/utils.js +36 -12
- package/package.json +2 -2
package/dist/agents/agy.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { parseTranscript as parseAgyTranscript } from '../capture/sources/agy.js';
|
|
2
|
+
import { agySkillsState, ensureAgySkillsInstalled, setupAgyHooks, removeAgySkills } from '../setup.js';
|
|
1
3
|
/** LLM_MODELS canonical id -> agy's own spaced --model display string, for the
|
|
2
4
|
* subset of the Gemini catalog agy actually offers. Anything not listed here
|
|
3
5
|
* passes through translateModel() unchanged - either it's already agy's own
|
|
@@ -17,6 +19,7 @@ function projectArgs(resume) {
|
|
|
17
19
|
export const agyAdapter = {
|
|
18
20
|
key: 'agy',
|
|
19
21
|
source: 'agy',
|
|
22
|
+
harness: 'agy',
|
|
20
23
|
displayName: 'Antigravity',
|
|
21
24
|
providerName: 'Google',
|
|
22
25
|
binary: 'agy',
|
|
@@ -48,5 +51,33 @@ export const agyAdapter = {
|
|
|
48
51
|
// so the daemon doesn't need to parse agy's stdout at all.
|
|
49
52
|
daemonStreamCapture: false,
|
|
50
53
|
installHint: 'see https://antigravity.google (Google account sign-in required)',
|
|
54
|
+
detectEnv() {
|
|
55
|
+
// Antigravity injects ANTIGRAVITY_CONVERSATION_ID into every hook/tool
|
|
56
|
+
// subprocess it spawns (confirmed live). Check this exact var, not an
|
|
57
|
+
// 'ANTIGRAVITY_' prefix scan - the Antigravity IDE's own integrated
|
|
58
|
+
// terminal ambiently sets other ANTIGRAVITY_*-prefixed vars (e.g.
|
|
59
|
+
// ANTIGRAVITY_CLI_ALIAS) in every shell it spawns, which would
|
|
60
|
+
// false-positive for any user with the IDE open, even outside a real
|
|
61
|
+
// agy session/hook.
|
|
62
|
+
if (!process.env.ANTIGRAVITY_CONVERSATION_ID)
|
|
63
|
+
return null;
|
|
64
|
+
return { harness: 'agy', harnessSession: process.env.ANTIGRAVITY_CONVERSATION_ID };
|
|
65
|
+
},
|
|
66
|
+
capture: {
|
|
67
|
+
hookKey: 'agy',
|
|
68
|
+
// agy hook payloads always carry transcriptPath directly (no derivation
|
|
69
|
+
// needed, unlike Grok) - the agy-specific hook wrapper normalizes it into
|
|
70
|
+
// this HookInput's transcript_path before invoking this runner.
|
|
71
|
+
parse: (content, afterUuid, hook) => parseAgyTranscript(content, afterUuid, { conversationId: hook.session_id }),
|
|
72
|
+
},
|
|
73
|
+
setup: {
|
|
74
|
+
state: () => agySkillsState(),
|
|
75
|
+
install: ensureAgySkillsInstalled,
|
|
76
|
+
writeProjectHooks: setupAgyHooks,
|
|
77
|
+
uninstall: () => {
|
|
78
|
+
const n = removeAgySkills();
|
|
79
|
+
return n ? `Removed ${n} Gipity skills from ~/.gemini/config/skills.` : null;
|
|
80
|
+
},
|
|
81
|
+
},
|
|
51
82
|
};
|
|
52
83
|
//# sourceMappingURL=agy.js.map
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { ensureClaudeInstalled, CLAUDE_PACKAGE } from '../claude-setup.js';
|
|
2
|
+
import { parseTranscript as parseClaudeTranscript } from '../capture/sources/claude-code.js';
|
|
3
|
+
import { userScopeInstallState, ensureGipityPluginInstalled, setupClaudeHooks, removeGipityPluginConfig, } from '../setup.js';
|
|
2
4
|
export const claudeCodeAdapter = {
|
|
3
5
|
key: 'claude',
|
|
4
6
|
source: 'claude_code',
|
|
7
|
+
harness: 'claude-code',
|
|
5
8
|
displayName: 'Claude Code',
|
|
6
9
|
providerName: 'Anthropic',
|
|
7
10
|
binary: 'claude',
|
|
@@ -44,5 +47,23 @@ export const claudeCodeAdapter = {
|
|
|
44
47
|
return ensureClaudeInstalled().installed;
|
|
45
48
|
},
|
|
46
49
|
installHint: `npm install -g ${CLAUDE_PACKAGE}`,
|
|
50
|
+
detectEnv() {
|
|
51
|
+
// Most reliable: CLAUDECODE=1 plus a versioned exec path.
|
|
52
|
+
if (process.env.CLAUDECODE === '1' || process.env.CLAUDE_CODE_ENTRYPOINT) {
|
|
53
|
+
const version = process.env.CLAUDE_CODE_EXECPATH?.match(/versions\/([^/\\]+)/)?.[1];
|
|
54
|
+
return { harness: 'claude-code', harnessVersion: version, harnessSession: process.env.CLAUDE_CODE_SESSION_ID };
|
|
55
|
+
}
|
|
56
|
+
return null;
|
|
57
|
+
},
|
|
58
|
+
capture: {
|
|
59
|
+
hookKey: 'claude-code',
|
|
60
|
+
parse: (content, afterUuid) => parseClaudeTranscript(content, afterUuid),
|
|
61
|
+
},
|
|
62
|
+
setup: {
|
|
63
|
+
state: () => userScopeInstallState(),
|
|
64
|
+
install: ensureGipityPluginInstalled,
|
|
65
|
+
writeProjectHooks: setupClaudeHooks,
|
|
66
|
+
uninstall: () => removeGipityPluginConfig() ? 'Gipity Claude Code plugin disabled (hooks removed).' : null,
|
|
67
|
+
},
|
|
47
68
|
};
|
|
48
69
|
//# sourceMappingURL=claude-code.js.map
|
package/dist/agents/codex.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import { hasEnvPrefix } from './types.js';
|
|
2
|
+
import { parseTranscript as parseCodexTranscript } from '../capture/sources/codex.js';
|
|
3
|
+
import { agentSkillsState, ensureAgentSkillsInstalled, setupCodexHooks, removeAgentSkills } from '../setup.js';
|
|
1
4
|
export const codexAdapter = {
|
|
2
5
|
key: 'codex',
|
|
3
6
|
source: 'codex',
|
|
7
|
+
harness: 'codex',
|
|
4
8
|
displayName: 'Codex',
|
|
5
9
|
providerName: 'OpenAI',
|
|
6
10
|
binary: 'codex',
|
|
@@ -41,5 +45,22 @@ export const codexAdapter = {
|
|
|
41
45
|
daemonStreamCapture: false,
|
|
42
46
|
oneTimeSetupNote: 'Codex runs project hooks only after a one-time approval: run /hooks inside Codex and approve the Gipity entries, or session recording stays off.',
|
|
43
47
|
installHint: 'npm install -g @openai/codex',
|
|
48
|
+
detectEnv() {
|
|
49
|
+
return hasEnvPrefix('CODEX_') ? { harness: 'codex' } : null;
|
|
50
|
+
},
|
|
51
|
+
capture: {
|
|
52
|
+
hookKey: 'codex',
|
|
53
|
+
// Codex hook payloads always carry transcript_path (the rollout file).
|
|
54
|
+
parse: (content, afterUuid) => parseCodexTranscript(content, afterUuid),
|
|
55
|
+
},
|
|
56
|
+
setup: {
|
|
57
|
+
state: () => agentSkillsState(),
|
|
58
|
+
install: ensureAgentSkillsInstalled,
|
|
59
|
+
writeProjectHooks: setupCodexHooks,
|
|
60
|
+
uninstall: () => {
|
|
61
|
+
const n = removeAgentSkills();
|
|
62
|
+
return n ? `Removed ${n} Gipity skills from ~/.agents/skills.` : null;
|
|
63
|
+
},
|
|
64
|
+
},
|
|
44
65
|
};
|
|
45
66
|
//# sourceMappingURL=codex.js.map
|
package/dist/agents/grok.js
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Grok Build adapter. Flag surface verified against the local `grok --help`
|
|
3
|
+
* (Grok Build TUI, 2026-07-13): `-p/--single` for headless one-shots,
|
|
4
|
+
* `-r/--resume [SESSION_ID]`, `-m/--model`, `--always-approve`, and
|
|
5
|
+
* `--output-format plain|json|streaming-json` (headless only).
|
|
6
|
+
*
|
|
7
|
+
* Grok runs Claude-format plugin hooks natively, so capture rides the same
|
|
8
|
+
* Gipity plugin as Claude Code (capture.cjs rewrites the source to 'grok'
|
|
9
|
+
* under GROK_HOOK_EVENT). Like Codex, relay dispatches keep hook capture ON;
|
|
10
|
+
* the daemon doesn't parse Grok's stream into ingest entries.
|
|
11
|
+
*/
|
|
12
|
+
import { homedir } from 'os';
|
|
13
|
+
import { join } from 'path';
|
|
14
|
+
import { hasEnvPrefix } from './types.js';
|
|
15
|
+
import { parseTranscript as parseGrokTranscript } from '../capture/sources/grok.js';
|
|
16
|
+
import { grokInstallState, ensureGrokPluginInstalled, removeGrokPlugin } from '../setup.js';
|
|
1
17
|
export const grokAdapter = {
|
|
2
18
|
key: 'grok',
|
|
3
19
|
source: 'grok',
|
|
20
|
+
harness: 'grok',
|
|
4
21
|
displayName: 'Grok',
|
|
5
22
|
providerName: 'xAI',
|
|
6
23
|
binary: 'grok',
|
|
@@ -46,5 +63,26 @@ export const grokAdapter = {
|
|
|
46
63
|
sessionIdArgs: (sessionId) => ['--session-id', sessionId],
|
|
47
64
|
},
|
|
48
65
|
installHint: 'curl -fsSL https://grok.x.ai/install.sh | sh (or see docs.x.ai/grok-build)',
|
|
66
|
+
detectEnv() {
|
|
67
|
+
if (!hasEnvPrefix('GROK_'))
|
|
68
|
+
return null;
|
|
69
|
+
return { harness: 'grok', harnessSession: process.env.GROK_SESSION_ID };
|
|
70
|
+
},
|
|
71
|
+
capture: {
|
|
72
|
+
hookKey: 'grok',
|
|
73
|
+
parse: (content, afterUuid, hook) => parseGrokTranscript(content, afterUuid, { sessionId: hook.session_id }),
|
|
74
|
+
// Grok's session dir is derivable: ~/.grok/sessions/<urlencoded-cwd>/<sid>/
|
|
75
|
+
resolveTranscriptPath: (hook) => {
|
|
76
|
+
if (!hook.session_id)
|
|
77
|
+
return null;
|
|
78
|
+
const cwd = hook.cwd ?? process.cwd();
|
|
79
|
+
return join(homedir(), '.grok', 'sessions', encodeURIComponent(cwd), hook.session_id, 'chat_history.jsonl');
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
setup: {
|
|
83
|
+
state: () => grokInstallState(),
|
|
84
|
+
install: ensureGrokPluginInstalled,
|
|
85
|
+
uninstall: () => (removeGrokPlugin() ? 'Gipity plugin removed from Grok.' : null),
|
|
86
|
+
},
|
|
49
87
|
};
|
|
50
88
|
//# sourceMappingURL=grok.js.map
|
package/dist/agents/types.js
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* parameterized. The adapter covers what a `source` string alone can't:
|
|
8
|
-
*
|
|
9
|
-
* - how to launch the agent binary (interactive and headless)
|
|
10
|
-
* - how to resume a session, pick a model, bypass approvals
|
|
11
|
-
* - how to spot the session id in the agent's output stream
|
|
12
|
-
*
|
|
13
|
-
* Two consumers: the `gipity build` launcher (interactive + `-p`) and the
|
|
14
|
-
* relay daemon (web-CLI dispatch). Adding an agent = one file here + one
|
|
15
|
-
* capture parser + one REMOTE_TYPES value; no scattered `if (source === …)`.
|
|
16
|
-
*/
|
|
17
|
-
export {};
|
|
1
|
+
/** True if any env var name starts with `prefix`. Shared by agent env
|
|
2
|
+
* detection (Codex, Grok) and the passive-harness checks in
|
|
3
|
+
* client-context.ts (aider). */
|
|
4
|
+
export function hasEnvPrefix(prefix) {
|
|
5
|
+
return Object.keys(process.env).some((k) => k.startsWith(prefix));
|
|
6
|
+
}
|
|
18
7
|
//# sourceMappingURL=types.js.map
|
|
@@ -6,6 +6,9 @@ function extractUserRequest(content) {
|
|
|
6
6
|
function positional(conversationId, idx) {
|
|
7
7
|
return `${conversationId}#${idx}`;
|
|
8
8
|
}
|
|
9
|
+
/** Internal bookkeeping/reminder line types - never surfaced, and never treated
|
|
10
|
+
* as a tool-result narrative either (see the module docstring). */
|
|
11
|
+
const SKIP_TYPES = new Set(['CONVERSATION_HISTORY', 'EPHEMERAL_MESSAGE', 'CHECKPOINT', 'SYSTEM_MESSAGE']);
|
|
9
12
|
function watermarkIndex(afterUuid, conversationId) {
|
|
10
13
|
if (!afterUuid || !conversationId)
|
|
11
14
|
return null;
|
|
@@ -15,34 +18,91 @@ function watermarkIndex(afterUuid, conversationId) {
|
|
|
15
18
|
const idx = parseInt(afterUuid.slice(prefix.length), 10);
|
|
16
19
|
return Number.isInteger(idx) && idx >= 0 ? idx : null;
|
|
17
20
|
}
|
|
18
|
-
|
|
21
|
+
/** Per-line result: the entries this line produces, the tool_use ids it
|
|
22
|
+
* minted (empty once consumed/not applicable), and whether this line should
|
|
23
|
+
* update `pending` at all - a SKIP_TYPES line (housekeeping the model sees
|
|
24
|
+
* but that carries no tool information) must leave a still-unresolved
|
|
25
|
+
* tool_use's `pending` state untouched rather than clearing it, since one of
|
|
26
|
+
* these can legitimately appear between a tool call and its result line
|
|
27
|
+
* (confirmed live). */
|
|
28
|
+
function lineToEntries(parsed, conversationId, idx, pending) {
|
|
19
29
|
const ts = typeof parsed?.created_at === 'string' ? parsed.created_at : undefined;
|
|
20
30
|
const type = parsed?.type;
|
|
21
31
|
const content = parsed?.content;
|
|
22
32
|
const uuid = positional(conversationId, idx);
|
|
33
|
+
// A content-less/unrecognized line carries no information either way, so it
|
|
34
|
+
// must not disturb a still-unresolved tool_use (clearsPending: false) - same
|
|
35
|
+
// reasoning as the SKIP_TYPES branch below.
|
|
36
|
+
const none = { entries: [], pendingToolUseIds: pending, clearsPending: false };
|
|
23
37
|
if (type === 'USER_INPUT' && typeof content === 'string' && content) {
|
|
24
38
|
const prompt = extractUserRequest(content);
|
|
25
39
|
if (!prompt)
|
|
26
|
-
return
|
|
27
|
-
return
|
|
40
|
+
return none;
|
|
41
|
+
return {
|
|
42
|
+
entries: [{ kind: 'prompt', prompt, source_uuid: uuid, ...(ts ? { ts } : {}) }],
|
|
43
|
+
pendingToolUseIds: null, clearsPending: true,
|
|
44
|
+
};
|
|
28
45
|
}
|
|
29
46
|
if (type === 'PLANNER_RESPONSE') {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
47
|
+
const entries = [];
|
|
48
|
+
const ids = [];
|
|
49
|
+
let toolName;
|
|
50
|
+
const toolCalls = Array.isArray(parsed?.tool_calls) ? parsed.tool_calls : [];
|
|
51
|
+
toolCalls.forEach((call, i) => {
|
|
52
|
+
if (!call || typeof call.name !== 'string')
|
|
53
|
+
return;
|
|
54
|
+
const toolUseId = toolCalls.length > 1 ? `${uuid}:${i}` : uuid;
|
|
55
|
+
ids.push(toolUseId);
|
|
56
|
+
toolName = call.name;
|
|
57
|
+
entries.push({
|
|
58
|
+
kind: 'tool_use',
|
|
59
|
+
tool_use_id: toolUseId,
|
|
60
|
+
tool_name: call.name,
|
|
61
|
+
tool_input: call.args,
|
|
62
|
+
source_uuid: toolUseId,
|
|
63
|
+
...(ts ? { ts } : {}),
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
if (typeof content === 'string' && content) {
|
|
67
|
+
entries.push({
|
|
33
68
|
kind: 'assistant',
|
|
34
69
|
text: content,
|
|
35
70
|
blocks: [{ type: 'text', text: content }],
|
|
36
71
|
source_uuid: uuid,
|
|
37
72
|
...(ts ? { ts } : {}),
|
|
38
|
-
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return { entries, pendingToolUseIds: ids.length ? { ids, toolName } : null, clearsPending: true };
|
|
39
76
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return
|
|
77
|
+
// Bookkeeping the model sees but a human observer shouldn't - and, per the
|
|
78
|
+
// interface doc above, must NOT clear a still-unresolved tool_use either.
|
|
79
|
+
if (SKIP_TYPES.has(type))
|
|
80
|
+
return { entries: [], pendingToolUseIds: pending, clearsPending: false };
|
|
81
|
+
// Anything else with real prose content is a tool-result-shaped narrative
|
|
82
|
+
// (CODE_ACTION, RUN_COMMAND, or an as-yet-unseen TOOL_CATEGORY name) - see
|
|
83
|
+
// the module docstring for why this isn't an exhaustive type allowlist.
|
|
84
|
+
if (typeof content === 'string' && content) {
|
|
85
|
+
if (pending) {
|
|
86
|
+
return {
|
|
87
|
+
entries: pending.ids.map((toolUseId, i) => ({
|
|
88
|
+
kind: 'tool_result',
|
|
89
|
+
tool_use_id: toolUseId,
|
|
90
|
+
tool_name: pending.toolName,
|
|
91
|
+
content,
|
|
92
|
+
source_uuid: i === 0 ? uuid : `${uuid}:${i}`,
|
|
93
|
+
...(ts ? { ts } : {}),
|
|
94
|
+
})),
|
|
95
|
+
pendingToolUseIds: null, clearsPending: true,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
// No preceding tool_calls to pair with (shouldn't normally happen) -
|
|
99
|
+
// don't drop the content, just fall back to a plain system note.
|
|
100
|
+
return {
|
|
101
|
+
entries: [{ kind: 'system', content, source_uuid: uuid, ...(ts ? { ts } : {}) }],
|
|
102
|
+
pendingToolUseIds: null, clearsPending: true,
|
|
103
|
+
};
|
|
44
104
|
}
|
|
45
|
-
return
|
|
105
|
+
return none; // no content, nothing worth surfacing (also clears pending)
|
|
46
106
|
}
|
|
47
107
|
/** Same contract as the other source parsers: entries after `afterUuid`, the
|
|
48
108
|
* new watermark, and whether the old watermark was still valid for this
|
|
@@ -62,6 +122,7 @@ export function parseTranscript(content, afterUuid, opts = {}) {
|
|
|
62
122
|
const foundWatermark = afterUuid === null || startAfter !== null;
|
|
63
123
|
const out = [];
|
|
64
124
|
let lastIdx = startAfter;
|
|
125
|
+
let pending = null;
|
|
65
126
|
for (let i = 0; i < lines.length; i++) {
|
|
66
127
|
const line = lines[i].trim();
|
|
67
128
|
if (!line)
|
|
@@ -75,8 +136,11 @@ export function parseTranscript(content, afterUuid, opts = {}) {
|
|
|
75
136
|
catch {
|
|
76
137
|
continue;
|
|
77
138
|
}
|
|
78
|
-
|
|
139
|
+
const result = lineToEntries(parsed, conversationId, i, pending);
|
|
140
|
+
for (const e of result.entries)
|
|
79
141
|
out.push(e);
|
|
142
|
+
if (result.clearsPending)
|
|
143
|
+
pending = result.pendingToolUseIds;
|
|
80
144
|
lastIdx = i;
|
|
81
145
|
}
|
|
82
146
|
return {
|
package/dist/catalog.js
CHANGED
|
@@ -19,9 +19,9 @@ export const STARTERS = [
|
|
|
19
19
|
/** Visible blank-wiring templates. */
|
|
20
20
|
export const BLANK = [
|
|
21
21
|
{ key: 'web-simple', hint: 'static frontend-only site - pages, dashboards, simple games' },
|
|
22
|
-
{ key: 'web-fullstack', hint: 'backend API + database wiring - frontend, functions, migrations; deploys green' },
|
|
22
|
+
{ key: 'web-fullstack', hint: 'backend API + database wiring - frontend, functions, migrations; deploys green empty' },
|
|
23
23
|
{ key: '3d-engine', hint: '3D multiplayer wiring - Three.js + Rapier + Gipity Realtime' },
|
|
24
|
-
{ key: 'api', hint: 'pure API backend, no frontend -
|
|
24
|
+
{ key: 'api', hint: 'pure API backend, no frontend - functions + tests, deploys green' },
|
|
25
25
|
];
|
|
26
26
|
/** Hidden templates - installable by exact key, omitted from listings. */
|
|
27
27
|
export const HIDDEN = [
|
package/dist/client-context.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { readFileSync } from 'fs';
|
|
2
2
|
import { resolve, dirname } from 'path';
|
|
3
3
|
import { fileURLToPath } from 'url';
|
|
4
|
+
import { AGENT_ADAPTERS } from './agents/index.js';
|
|
5
|
+
import { hasEnvPrefix } from './agents/types.js';
|
|
4
6
|
export function cliVersion() {
|
|
5
7
|
try {
|
|
6
8
|
const dir = dirname(fileURLToPath(import.meta.url));
|
|
@@ -11,32 +13,26 @@ export function cliVersion() {
|
|
|
11
13
|
return 'unknown';
|
|
12
14
|
}
|
|
13
15
|
}
|
|
14
|
-
function hasEnvPrefix(prefix) {
|
|
15
|
-
return Object.keys(process.env).some((k) => k.startsWith(prefix));
|
|
16
|
-
}
|
|
17
16
|
function isCi() {
|
|
18
17
|
const ci = (process.env.CI ?? '').toLowerCase();
|
|
19
18
|
return ci === '1' || ci === 'true' || !!process.env.GITHUB_ACTIONS;
|
|
20
19
|
}
|
|
21
|
-
/** Identify the coding harness from its env footprint. Order = specificity
|
|
20
|
+
/** Identify the coding harness from its env footprint. Order = specificity:
|
|
21
|
+
* each agent adapter's detectEnv() is tried in registry order (claude,
|
|
22
|
+
* codex, grok, agy today), then the non-agent harnesses below - tools with
|
|
23
|
+
* no adapter (no execution surface, no capture) because they're either not
|
|
24
|
+
* a coding agent (cursor, ci) or not yet integrated (aider, gemini).
|
|
25
|
+
* Exported for tests. */
|
|
22
26
|
export function detectHarness() {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
// Antigravity (agy) injects ANTIGRAVITY_CONVERSATION_ID into every hook/tool
|
|
33
|
-
// subprocess it spawns (confirmed live). Check this exact var, not an
|
|
34
|
-
// 'ANTIGRAVITY_' prefix scan - the Antigravity IDE's own integrated terminal
|
|
35
|
-
// ambiently sets other ANTIGRAVITY_*-prefixed vars (e.g. ANTIGRAVITY_CLI_ALIAS)
|
|
36
|
-
// in every shell it spawns, which would false-positive for any user with the
|
|
37
|
-
// IDE open, even outside a real agy session/hook.
|
|
38
|
-
if (process.env.ANTIGRAVITY_CONVERSATION_ID) {
|
|
39
|
-
return { harness: 'agy', harnessSession: process.env.ANTIGRAVITY_CONVERSATION_ID };
|
|
27
|
+
for (const agent of AGENT_ADAPTERS) {
|
|
28
|
+
const match = agent.detectEnv?.();
|
|
29
|
+
if (match) {
|
|
30
|
+
return {
|
|
31
|
+
harness: match.harness,
|
|
32
|
+
harnessVersion: match.harnessVersion,
|
|
33
|
+
harnessSession: match.harnessSession,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
40
36
|
}
|
|
41
37
|
if (process.env.CURSOR_TRACE_ID || hasEnvPrefix('CURSOR_') || (process.env.TERM_PROGRAM ?? '').toLowerCase().includes('cursor')) {
|
|
42
38
|
return { harness: 'cursor' };
|
package/dist/commands/add.js
CHANGED
|
@@ -33,6 +33,36 @@ function catalogText() {
|
|
|
33
33
|
section('Kits', 'building blocks to add into an app you already scaffolded', KITS),
|
|
34
34
|
].join('\n\n');
|
|
35
35
|
}
|
|
36
|
+
/** Pack names onto as few lines as possible. A scaffold prints 16-40 paths;
|
|
37
|
+
* one per line pushed the success line and the notes past the ~30 lines an
|
|
38
|
+
* agent keeps when it defensively pipes the install through `tail`. */
|
|
39
|
+
function packNames(names, width = 96) {
|
|
40
|
+
const lines = [];
|
|
41
|
+
let cur = '';
|
|
42
|
+
for (const n of names) {
|
|
43
|
+
if (cur && cur.length + 1 + n.length > width) {
|
|
44
|
+
lines.push(cur);
|
|
45
|
+
cur = '';
|
|
46
|
+
}
|
|
47
|
+
cur = cur ? `${cur} ${n}` : n;
|
|
48
|
+
}
|
|
49
|
+
if (cur)
|
|
50
|
+
lines.push(cur);
|
|
51
|
+
return lines;
|
|
52
|
+
}
|
|
53
|
+
// The files a freshly scaffolded app is meant to be read in order of, most
|
|
54
|
+
// orienting first. Every template file carries header comments describing the
|
|
55
|
+
// contract it establishes (the injected SDK, apiBase stamping, theme tokens,
|
|
56
|
+
// the permissions block), but nothing said WHICH files those are - so agents
|
|
57
|
+
// re-opened the whole scaffold to find out. Only paths the install actually
|
|
58
|
+
// wrote are printed, so this never points at a file that isn't there.
|
|
59
|
+
const ORIENTATION_FILES = [
|
|
60
|
+
'README.md',
|
|
61
|
+
'gipity.yaml',
|
|
62
|
+
'src/index.html',
|
|
63
|
+
'src/js/main.js',
|
|
64
|
+
'src/css/styles.css',
|
|
65
|
+
];
|
|
36
66
|
// ─── Local-path payload mode ────────────────────────────────────────────────
|
|
37
67
|
//
|
|
38
68
|
// `gipity add ./path/to/template` walks a directory and ships the contents to
|
|
@@ -201,8 +231,8 @@ export const addCommand = new Command('add')
|
|
|
201
231
|
if (!opts.json && !process.stdout.isTTY) {
|
|
202
232
|
const isKit = KITS.some(k => k.key === name);
|
|
203
233
|
console.error(muted(isKit
|
|
204
|
-
? 'Installing kit (server-side install pipeline)...'
|
|
205
|
-
: 'Installing (server writes files + generates favicons
|
|
234
|
+
? 'Installing kit (server-side install pipeline, ~1-2s)...'
|
|
235
|
+
: 'Installing (server writes files + generates favicons, ~5-10s)...'));
|
|
206
236
|
}
|
|
207
237
|
const doAdd = () => post(`/projects/${config.projectGuid}/add`, body);
|
|
208
238
|
const res = opts.json
|
|
@@ -221,8 +251,17 @@ export const addCommand = new Command('add')
|
|
|
221
251
|
else {
|
|
222
252
|
console.log(success(`Scaffolded "${data.title}" (${data.type}) - ${data.files.length} files:`));
|
|
223
253
|
}
|
|
224
|
-
for (const
|
|
225
|
-
console.log(
|
|
254
|
+
for (const line of packNames(data.files))
|
|
255
|
+
console.log(line);
|
|
256
|
+
// Point at the files that teach this app's conventions, so the next step is
|
|
257
|
+
// one targeted read instead of re-opening the whole scaffold to find them.
|
|
258
|
+
const startHere = data.kind === 'kit'
|
|
259
|
+
? data.files.filter(f => /(^|\/)README\.md$/.test(f))
|
|
260
|
+
: ORIENTATION_FILES.filter(f => data.files.includes(f));
|
|
261
|
+
if (startHere.length) {
|
|
262
|
+
console.log('');
|
|
263
|
+
console.log(muted(`Start here - their header comments carry the conventions you build inside: ${startHere.join(' ')}`));
|
|
264
|
+
}
|
|
226
265
|
if (data.notes?.length) {
|
|
227
266
|
console.log('');
|
|
228
267
|
for (const n of data.notes)
|
|
@@ -238,12 +277,14 @@ export const addCommand = new Command('add')
|
|
|
238
277
|
console.warn(warning(`Re-run \`gipity add ${data.kit ?? name}${opts.force ? ' --force' : ''}\` to retry the dropped files.`));
|
|
239
278
|
}
|
|
240
279
|
// After scaffolding an app, point at kits as the next step - they add
|
|
241
|
-
// features (multiplayer, etc.) into the app you just created.
|
|
280
|
+
// features (multiplayer, etc.) into the app you just created. Keys only:
|
|
281
|
+
// one wrapped line keeps the whole install report short enough to read
|
|
282
|
+
// without truncating, and `gipity add --list` has the per-kit blurbs.
|
|
242
283
|
if (data.kind !== 'kit' && KITS.length > 0) {
|
|
243
284
|
console.log('');
|
|
244
|
-
console.log(muted('Add features with kits (gipity add <kit
|
|
245
|
-
for (const
|
|
246
|
-
console.log(muted(` ${
|
|
285
|
+
console.log(muted('Add features with kits (gipity add <kit>, gipity add --list for what each does):'));
|
|
286
|
+
for (const line of packNames(KITS.map(k => k.key)))
|
|
287
|
+
console.log(muted(` ${line}`));
|
|
247
288
|
}
|
|
248
289
|
if (syncResult.applied > 0) {
|
|
249
290
|
console.log(`\nPulled ${syncResult.applied} files to local.`);
|
package/dist/commands/brand.js
CHANGED
|
@@ -15,9 +15,13 @@ import { get, post } from '../api.js';
|
|
|
15
15
|
import { resolveProjectContext } from '../config.js';
|
|
16
16
|
import { bold, muted, success } from '../colors.js';
|
|
17
17
|
import { run } from '../helpers/index.js';
|
|
18
|
+
const ACCENT_SOURCE_LABEL = {
|
|
19
|
+
theme: " (from the app's own theme --primary)",
|
|
20
|
+
derived: ' (derived from project)',
|
|
21
|
+
};
|
|
18
22
|
function printBrand(d) {
|
|
19
23
|
console.log(`${bold('Glyph:')} ${d.resolved.glyph}${d.resolved.isEmoji ? muted(' (emoji)') : ''}`);
|
|
20
|
-
console.log(`${bold('Accent:')} ${d.resolved.accent}${d.branding.primary_color ? '' :
|
|
24
|
+
console.log(`${bold('Accent:')} ${d.resolved.accent}${muted(ACCENT_SOURCE_LABEL[d.resolved.accentSource ?? (d.branding.primary_color ? 'override' : 'derived')] ?? '')}`);
|
|
21
25
|
if (d.branding.app_name)
|
|
22
26
|
console.log(`${bold('Name:')} ${d.branding.app_name}`);
|
|
23
27
|
if (d.branding.tagline)
|
package/dist/commands/build.js
CHANGED
|
@@ -954,30 +954,44 @@ async function runLaunch(cmdName, cmdCfg, opts) {
|
|
|
954
954
|
}
|
|
955
955
|
}
|
|
956
956
|
// ─── Agent picker ─────────────────────────────────────────────────────────
|
|
957
|
-
// Same pick-a-number-or-hit-enter format as the project picker.
|
|
958
|
-
//
|
|
959
|
-
//
|
|
960
|
-
// -
|
|
957
|
+
// Same pick-a-number-or-hit-enter format as the project picker. Only agents
|
|
958
|
+
// actually found on PATH are numbered choices; the rest are named in a
|
|
959
|
+
// footnote as supported-but-not-detected, not offered as pickable slots.
|
|
960
|
+
// The enter-enter path must stay the visibly obvious one: the default agent
|
|
961
|
+
// is the last-used one (else the first detected agent). We deliberately
|
|
962
|
+
// don't ask about the model - the agent's own default is always right and a
|
|
963
|
+
// curated list only rots.
|
|
961
964
|
async function pickAgent(lastUsed) {
|
|
962
|
-
const
|
|
963
|
-
|
|
965
|
+
const detected = AGENT_ADAPTERS.filter(a => binaryOnPath(a.binary));
|
|
966
|
+
// Nothing detected (fresh machine, nothing installed yet): fall back to
|
|
967
|
+
// the full list so there's still something to pick - selecting one drives
|
|
968
|
+
// the existing auto-install/install-hint path below.
|
|
969
|
+
const listed = detected.length ? detected : AGENT_ADAPTERS;
|
|
970
|
+
const undetected = AGENT_ADAPTERS.filter(a => !listed.includes(a));
|
|
971
|
+
const defaultKey = lastUsed && listed.some(a => a.key === lastUsed) ? lastUsed : listed[0].key;
|
|
972
|
+
const defaultIdx = listed.findIndex(a => a.key === defaultKey) + 1;
|
|
964
973
|
console.log(` ${bold('Which coding agent?')}\n`);
|
|
965
|
-
|
|
966
|
-
// Keep the list clean: no install-state notes (picking an uninstalled
|
|
967
|
-
// agent installs it, or fails with the install hint at that point).
|
|
974
|
+
listed.forEach((a, i) => {
|
|
968
975
|
const notes = [];
|
|
969
976
|
if (a.key === lastUsed)
|
|
970
977
|
notes.push('last used');
|
|
971
|
-
if (
|
|
978
|
+
if (!a.hooksSupportedOnPlatform(process.platform)) {
|
|
972
979
|
notes.push('session recording unavailable on Windows');
|
|
973
980
|
}
|
|
974
981
|
const note = notes.length ? ` ${muted(`(${notes.join(', ')})`)}` : '';
|
|
975
982
|
console.log(` ${bold(`${i + 1}.`)} ${a.displayName} ${muted(`(${a.providerName})`)}${note}`);
|
|
976
983
|
});
|
|
984
|
+
if (undetected.length) {
|
|
985
|
+
const names = undetected.map(a => a.displayName).join(', ');
|
|
986
|
+
console.log(` ${muted(`Also supported (not detected on this machine): ${names} - use --agent <name>`)}`);
|
|
987
|
+
}
|
|
988
|
+
else if (!detected.length) {
|
|
989
|
+
console.log(` ${muted('None detected on this machine - picking one installs it.')}`);
|
|
990
|
+
}
|
|
977
991
|
console.log('');
|
|
978
|
-
const choice = await pickOne('Choose',
|
|
992
|
+
const choice = await pickOne('Choose', listed.length, defaultIdx);
|
|
979
993
|
console.log('');
|
|
980
|
-
return
|
|
994
|
+
return listed[choice - 1].key;
|
|
981
995
|
}
|
|
982
996
|
// ─── Non-Claude agent launch (Codex, Grok) ────────────────────────────────
|
|
983
997
|
// The Claude path above carries years of Claude-specific plumbing (plugin
|
package/dist/commands/db.js
CHANGED
|
@@ -4,6 +4,7 @@ import { requireConfig } from '../config.js';
|
|
|
4
4
|
import { error as clrError, success } from '../colors.js';
|
|
5
5
|
import { run, printList, emitField } from '../helpers/index.js';
|
|
6
6
|
import { confirm } from '../utils.js';
|
|
7
|
+
import { createCheckpoint, restoreCheckpoint, dropCheckpoint, resolveDatabase } from '../db-checkpoint.js';
|
|
7
8
|
export const dbCommand = new Command('db')
|
|
8
9
|
.description('Manage databases');
|
|
9
10
|
dbCommand
|
|
@@ -171,4 +172,69 @@ dbCommand
|
|
|
171
172
|
console.log(success(`Dropped database '${name}'.`));
|
|
172
173
|
}
|
|
173
174
|
}));
|
|
175
|
+
dbCommand
|
|
176
|
+
.command('checkpoint')
|
|
177
|
+
.description('Snapshot every table so a write test can be undone with `gipity db restore`')
|
|
178
|
+
.option('--database <name>', 'Database name')
|
|
179
|
+
.option('--drop', 'Discard the existing checkpoint without restoring (keep whatever the run wrote)')
|
|
180
|
+
.option('--json', 'Output as JSON')
|
|
181
|
+
.addHelpText('after', `
|
|
182
|
+
Take one before exercising a real write path (page eval on the deployed app,
|
|
183
|
+
fn call, workflow run), then \`gipity db restore\` to put the data back exactly
|
|
184
|
+
as it was - no hand-written SQL to scrub test strings out of real content.
|
|
185
|
+
`)
|
|
186
|
+
.action((opts) => run('Checkpoint', async () => {
|
|
187
|
+
const config = requireConfig();
|
|
188
|
+
const dbName = await resolveDatabase(config.projectGuid, opts.database);
|
|
189
|
+
if (!dbName) {
|
|
190
|
+
console.error(clrError('No databases in this project - nothing to checkpoint.'));
|
|
191
|
+
process.exit(1);
|
|
192
|
+
}
|
|
193
|
+
if (opts.drop) {
|
|
194
|
+
const dropped = await dropCheckpoint(config.projectGuid, dbName);
|
|
195
|
+
if (opts.json) {
|
|
196
|
+
console.log(JSON.stringify(dropped));
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
console.log(dropped.tables.length === 0
|
|
200
|
+
? `No checkpoint in '${dbName}'.`
|
|
201
|
+
: success(`Discarded the checkpoint of ${dropped.tables.length} table(s) in '${dbName}'. Current data kept.`));
|
|
202
|
+
}
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
const res = await createCheckpoint(config.projectGuid, dbName);
|
|
206
|
+
if (opts.json) {
|
|
207
|
+
console.log(JSON.stringify(res));
|
|
208
|
+
}
|
|
209
|
+
else if (res.tables.length === 0) {
|
|
210
|
+
console.log(`Database '${dbName}' has no tables - nothing to checkpoint.`);
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
console.log(success(`Checkpointed ${res.tables.length} table(s), ${res.rows} row(s) in '${dbName}'.`));
|
|
214
|
+
console.log('Undo everything written since: gipity db restore');
|
|
215
|
+
}
|
|
216
|
+
}));
|
|
217
|
+
dbCommand
|
|
218
|
+
.command('restore')
|
|
219
|
+
.description('Roll every table back to the last `gipity db checkpoint` and drop the checkpoint. The undo for a live write test.')
|
|
220
|
+
.option('--database <name>', 'Database name')
|
|
221
|
+
.option('--keep', 'Keep the checkpoint after restoring, so you can run the same write test again')
|
|
222
|
+
.option('--json', 'Output as JSON')
|
|
223
|
+
.action((opts) => run('Restore', async () => {
|
|
224
|
+
const config = requireConfig();
|
|
225
|
+
const dbName = await resolveDatabase(config.projectGuid, opts.database);
|
|
226
|
+
if (!dbName) {
|
|
227
|
+
console.error(clrError('No databases in this project - nothing to restore.'));
|
|
228
|
+
process.exit(1);
|
|
229
|
+
}
|
|
230
|
+
const res = await restoreCheckpoint(config.projectGuid, dbName, { keep: opts.keep });
|
|
231
|
+
if (opts.json) {
|
|
232
|
+
console.log(JSON.stringify(res));
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
console.log(success(`Restored ${res.tables.length} table(s) to the checkpoint (${res.rows} row(s)) in '${dbName}'.`));
|
|
236
|
+
if (opts.keep)
|
|
237
|
+
console.log('Checkpoint kept - restore again any time.');
|
|
238
|
+
}
|
|
239
|
+
}));
|
|
174
240
|
//# sourceMappingURL=db.js.map
|