gipity 1.0.48
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/LICENSE +21 -0
- package/README.md +234 -0
- package/dist/__tests__/config.test.d.ts +1 -0
- package/dist/__tests__/config.test.js +31 -0
- package/dist/__tests__/config.test.js.map +1 -0
- package/dist/__tests__/sync.test.d.ts +1 -0
- package/dist/__tests__/sync.test.js +89 -0
- package/dist/__tests__/sync.test.js.map +1 -0
- package/dist/__tests__/utils.test.d.ts +1 -0
- package/dist/__tests__/utils.test.js +69 -0
- package/dist/__tests__/utils.test.js.map +1 -0
- package/dist/api.d.ts +13 -0
- package/dist/api.js +85 -0
- package/dist/api.js.map +1 -0
- package/dist/auth.d.ts +12 -0
- package/dist/auth.js +90 -0
- package/dist/auth.js.map +1 -0
- package/dist/coding-guidelines.d.ts +9 -0
- package/dist/coding-guidelines.js +52 -0
- package/dist/coding-guidelines.js.map +1 -0
- package/dist/commands/agent.d.ts +2 -0
- package/dist/commands/agent.js +164 -0
- package/dist/commands/agent.js.map +1 -0
- package/dist/commands/api.d.ts +2 -0
- package/dist/commands/api.js +137 -0
- package/dist/commands/api.js.map +1 -0
- package/dist/commands/audit.d.ts +2 -0
- package/dist/commands/audit.js +70 -0
- package/dist/commands/audit.js.map +1 -0
- package/dist/commands/browser.d.ts +2 -0
- package/dist/commands/browser.js +88 -0
- package/dist/commands/browser.js.map +1 -0
- package/dist/commands/chat.d.ts +2 -0
- package/dist/commands/chat.js +68 -0
- package/dist/commands/chat.js.map +1 -0
- package/dist/commands/checkpoint.d.ts +2 -0
- package/dist/commands/checkpoint.js +67 -0
- package/dist/commands/checkpoint.js.map +1 -0
- package/dist/commands/credits.d.ts +2 -0
- package/dist/commands/credits.js +57 -0
- package/dist/commands/credits.js.map +1 -0
- package/dist/commands/db.d.ts +2 -0
- package/dist/commands/db.js +102 -0
- package/dist/commands/db.js.map +1 -0
- package/dist/commands/deploy.d.ts +2 -0
- package/dist/commands/deploy.js +49 -0
- package/dist/commands/deploy.js.map +1 -0
- package/dist/commands/file.d.ts +2 -0
- package/dist/commands/file.js +85 -0
- package/dist/commands/file.js.map +1 -0
- package/dist/commands/fn.d.ts +2 -0
- package/dist/commands/fn.js +87 -0
- package/dist/commands/fn.js.map +1 -0
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.js +107 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/login.d.ts +2 -0
- package/dist/commands/login.js +62 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/logout.d.ts +2 -0
- package/dist/commands/logout.js +14 -0
- package/dist/commands/logout.js.map +1 -0
- package/dist/commands/logs.d.ts +2 -0
- package/dist/commands/logs.js +39 -0
- package/dist/commands/logs.js.map +1 -0
- package/dist/commands/memory.d.ts +2 -0
- package/dist/commands/memory.js +114 -0
- package/dist/commands/memory.js.map +1 -0
- package/dist/commands/project.d.ts +2 -0
- package/dist/commands/project.js +132 -0
- package/dist/commands/project.js.map +1 -0
- package/dist/commands/push.d.ts +2 -0
- package/dist/commands/push.js +34 -0
- package/dist/commands/push.js.map +1 -0
- package/dist/commands/rbac.d.ts +2 -0
- package/dist/commands/rbac.js +89 -0
- package/dist/commands/rbac.js.map +1 -0
- package/dist/commands/records.d.ts +2 -0
- package/dist/commands/records.js +131 -0
- package/dist/commands/records.js.map +1 -0
- package/dist/commands/sandbox.d.ts +2 -0
- package/dist/commands/sandbox.js +53 -0
- package/dist/commands/sandbox.js.map +1 -0
- package/dist/commands/scaffold.d.ts +2 -0
- package/dist/commands/scaffold.js +38 -0
- package/dist/commands/scaffold.js.map +1 -0
- package/dist/commands/start-cc.d.ts +2 -0
- package/dist/commands/start-cc.js +201 -0
- package/dist/commands/start-cc.js.map +1 -0
- package/dist/commands/status.d.ts +2 -0
- package/dist/commands/status.js +43 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/sync.d.ts +2 -0
- package/dist/commands/sync.js +42 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/commands/workflow.d.ts +2 -0
- package/dist/commands/workflow.js +163 -0
- package/dist/commands/workflow.js.map +1 -0
- package/dist/config.d.ts +15 -0
- package/dist/config.js +76 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +65 -0
- package/dist/index.js.map +1 -0
- package/dist/setup.d.ts +23 -0
- package/dist/setup.js +168 -0
- package/dist/setup.js.map +1 -0
- package/dist/sync.d.ts +34 -0
- package/dist/sync.js +234 -0
- package/dist/sync.js.map +1 -0
- package/dist/utils.d.ts +10 -0
- package/dist/utils.js +57 -0
- package/dist/utils.js.map +1 -0
- package/hooks/post-write.sh +17 -0
- package/hooks/pre-turn.sh +20 -0
- package/package.json +29 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { getAuth, getTimeRemaining } from '../auth.js';
|
|
3
|
+
import { getConfig } from '../config.js';
|
|
4
|
+
export const statusCommand = new Command('status')
|
|
5
|
+
.description('Show project and auth status')
|
|
6
|
+
.option('--json', 'Output as JSON')
|
|
7
|
+
.action(async (opts) => {
|
|
8
|
+
const config = getConfig();
|
|
9
|
+
const auth = getAuth();
|
|
10
|
+
if (opts.json) {
|
|
11
|
+
console.log(JSON.stringify({
|
|
12
|
+
project: config ? {
|
|
13
|
+
guid: config.projectGuid,
|
|
14
|
+
slug: config.projectSlug,
|
|
15
|
+
account: config.accountSlug,
|
|
16
|
+
apiBase: config.apiBase,
|
|
17
|
+
} : null,
|
|
18
|
+
auth: auth ? {
|
|
19
|
+
email: auth.email,
|
|
20
|
+
expiresAt: auth.expiresAt,
|
|
21
|
+
valid: new Date(auth.expiresAt).getTime() > Date.now(),
|
|
22
|
+
} : null,
|
|
23
|
+
}, null, 2));
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (!config) {
|
|
27
|
+
console.log('Not a Gipity project. Run: gipity init');
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
console.log(`Project: ${config.projectSlug} (${config.projectGuid})`);
|
|
31
|
+
console.log(`Account: ${config.accountSlug}`);
|
|
32
|
+
console.log(`API: ${config.apiBase}`);
|
|
33
|
+
if (config.agentGuid)
|
|
34
|
+
console.log(`Agent: ${config.agentGuid}`);
|
|
35
|
+
}
|
|
36
|
+
if (!auth) {
|
|
37
|
+
console.log('Auth: not logged in. Run: gipity login');
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
console.log(`Auth: ${auth.email} (${getTimeRemaining()})`);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC;KAC/C,WAAW,CAAC,8BAA8B,CAAC;KAC3C,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;KAClC,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;IACrB,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IAEvB,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;QACd,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC;YACzB,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;gBAChB,IAAI,EAAE,MAAM,CAAC,WAAW;gBACxB,IAAI,EAAE,MAAM,CAAC,WAAW;gBACxB,OAAO,EAAE,MAAM,CAAC,WAAW;gBAC3B,OAAO,EAAE,MAAM,CAAC,OAAO;aACxB,CAAC,CAAC,CAAC,IAAI;YACR,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;gBACX,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,SAAS,EAAE,IAAI,CAAC,SAAS;gBACzB,KAAK,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE;aACvD,CAAC,CAAC,CAAC,IAAI;SACT,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACb,OAAO;IACT,CAAC;IAED,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAC;IACxD,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,YAAY,MAAM,CAAC,WAAW,KAAK,MAAM,CAAC,WAAW,GAAG,CAAC,CAAC;QACtE,OAAO,CAAC,GAAG,CAAC,YAAY,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;QAC9C,OAAO,CAAC,GAAG,CAAC,QAAQ,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;QACtC,IAAI,MAAM,CAAC,SAAS;YAAE,OAAO,CAAC,GAAG,CAAC,UAAU,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;IAClE,CAAC;IAED,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAC;IACxD,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,KAAK,KAAK,gBAAgB,EAAE,GAAG,CAAC,CAAC;IAC7D,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { syncDown, syncUp, syncCheck } from '../sync.js';
|
|
3
|
+
export const syncCommand = new Command('sync')
|
|
4
|
+
.description('Sync files between local and Gipity')
|
|
5
|
+
.argument('[direction]', 'up, down, or check', 'check')
|
|
6
|
+
.option('--json', 'Output as JSON')
|
|
7
|
+
.action(async (direction, opts) => {
|
|
8
|
+
try {
|
|
9
|
+
let result;
|
|
10
|
+
switch (direction) {
|
|
11
|
+
case 'down':
|
|
12
|
+
result = await syncDown();
|
|
13
|
+
break;
|
|
14
|
+
case 'up':
|
|
15
|
+
result = await syncUp();
|
|
16
|
+
break;
|
|
17
|
+
case 'check':
|
|
18
|
+
result = await syncCheck();
|
|
19
|
+
break;
|
|
20
|
+
default:
|
|
21
|
+
console.error(`Unknown direction: ${direction}. Use: up, down, or check`);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
if (opts.json) {
|
|
25
|
+
console.log(JSON.stringify(result));
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
if (result.pulled > 0) {
|
|
29
|
+
console.log(`Pulled ${result.pulled} change${result.pulled > 1 ? 's' : ''}:`);
|
|
30
|
+
}
|
|
31
|
+
else if (result.pushed > 0) {
|
|
32
|
+
console.log(`Pushed ${result.pushed} change${result.pushed > 1 ? 's' : ''}:`);
|
|
33
|
+
}
|
|
34
|
+
console.log(result.summary);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
catch (err) {
|
|
38
|
+
console.error(`Sync failed: ${err.message}`);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=sync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../../src/commands/sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEzD,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;KAC3C,WAAW,CAAC,qCAAqC,CAAC;KAClD,QAAQ,CAAC,aAAa,EAAE,oB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AAC,OAAO,GAAQ,EAAE,CAAC;QAClB,OAAO,CAAC,KAAK,CAAC,gBAAgB,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;QAC7C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { get, post, put } from '../api.js';
|
|
3
|
+
export const workflowCommand = new Command('workflow')
|
|
4
|
+
.description('Manage workflows')
|
|
5
|
+
.option('--json', 'Output as JSON')
|
|
6
|
+
.action(async (opts) => {
|
|
7
|
+
try {
|
|
8
|
+
const res = await get('/workflows');
|
|
9
|
+
if (opts.json) {
|
|
10
|
+
console.log(JSON.stringify(res.data));
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
if (res.data.length === 0) {
|
|
14
|
+
console.log('No workflows.');
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
for (const w of res.data) {
|
|
18
|
+
const status = w.is_active ? 'on' : 'off';
|
|
19
|
+
const cron = w.cron_expression ? ` cron: ${w.cron_expression}` : '';
|
|
20
|
+
console.log(`${w.name} [${status}] ${w.trigger_type}${cron}`);
|
|
21
|
+
if (w.description)
|
|
22
|
+
console.log(` ${w.description}`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
console.error(`Failed: ${err.message}`);
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
workflowCommand
|
|
33
|
+
.command('info <name>')
|
|
34
|
+
.description('Show workflow details')
|
|
35
|
+
.option('--json', 'Output as JSON')
|
|
36
|
+
.action(async (name, opts) => {
|
|
37
|
+
try {
|
|
38
|
+
const wf = await resolveWorkflow(name);
|
|
39
|
+
const res = await get(`/workflows/${wf.short_guid}`);
|
|
40
|
+
if (opts.json) {
|
|
41
|
+
console.log(JSON.stringify(res.data, null, 2));
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
const w = res.data;
|
|
45
|
+
console.log(`Name: ${w.name}`);
|
|
46
|
+
console.log(`GUID: ${w.short_guid}`);
|
|
47
|
+
console.log(`Active: ${w.is_active ? 'yes' : 'no'}`);
|
|
48
|
+
console.log(`Trigger: ${w.trigger_type}${w.cron_expression ? ` (${w.cron_expression})` : ''}`);
|
|
49
|
+
if (w.description)
|
|
50
|
+
console.log(`Desc: ${w.description}`);
|
|
51
|
+
if (w.steps && w.steps.length > 0) {
|
|
52
|
+
console.log(`Steps:`);
|
|
53
|
+
for (const s of w.steps) {
|
|
54
|
+
console.log(` ${s.step_order}. ${s.name}${s.model ? ` [${s.model}]` : ''}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
console.error(`Info failed: ${err.message}`);
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
workflowCommand
|
|
65
|
+
.command('run <name>')
|
|
66
|
+
.description('Manually trigger a workflow')
|
|
67
|
+
.option('--json', 'Output as JSON')
|
|
68
|
+
.action(async (name, opts) => {
|
|
69
|
+
try {
|
|
70
|
+
const wf = await resolveWorkflow(name);
|
|
71
|
+
const res = await post(`/workflows/${wf.short_guid}/run`, {});
|
|
72
|
+
if (opts.json) {
|
|
73
|
+
console.log(JSON.stringify(res.data));
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
console.log(`Triggered "${wf.name}".`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
catch (err) {
|
|
80
|
+
console.error(`Run failed: ${err.message}`);
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
workflowCommand
|
|
85
|
+
.command('runs <name>')
|
|
86
|
+
.description('List recent runs')
|
|
87
|
+
.option('--json', 'Output as JSON')
|
|
88
|
+
.action(async (name, opts) => {
|
|
89
|
+
try {
|
|
90
|
+
const wf = await resolveWorkflow(name);
|
|
91
|
+
const res = await get(`/workflows/${wf.short_guid}/runs`);
|
|
92
|
+
if (opts.json) {
|
|
93
|
+
console.log(JSON.stringify(res.data));
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
if (res.data.length === 0) {
|
|
97
|
+
console.log('No runs.');
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
for (const r of res.data) {
|
|
101
|
+
const dur = r.completed_at
|
|
102
|
+
? `${((new Date(r.completed_at).getTime() - new Date(r.started_at).getTime()) / 1000).toFixed(1)}s`
|
|
103
|
+
: 'running';
|
|
104
|
+
console.log(`${r.short_guid} ${r.status} ${dur} ${r.total_tokens} tokens ${new Date(r.started_at).toLocaleString()}`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
catch (err) {
|
|
110
|
+
console.error(`Runs failed: ${err.message}`);
|
|
111
|
+
process.exit(1);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
workflowCommand
|
|
115
|
+
.command('enable <name>')
|
|
116
|
+
.description('Enable a workflow')
|
|
117
|
+
.option('--json', 'Output as JSON')
|
|
118
|
+
.action(async (name, opts) => {
|
|
119
|
+
try {
|
|
120
|
+
const wf = await resolveWorkflow(name);
|
|
121
|
+
await put(`/workflows/${wf.short_guid}`, { is_active: true });
|
|
122
|
+
if (opts.json) {
|
|
123
|
+
console.log(JSON.stringify({ enabled: wf.name }));
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
console.log(`Enabled "${wf.name}".`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
catch (err) {
|
|
130
|
+
console.error(`Enable failed: ${err.message}`);
|
|
131
|
+
process.exit(1);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
workflowCommand
|
|
135
|
+
.command('disable <name>')
|
|
136
|
+
.description('Disable a workflow')
|
|
137
|
+
.option('--json', 'Output as JSON')
|
|
138
|
+
.action(async (name, opts) => {
|
|
139
|
+
try {
|
|
140
|
+
const wf = await resolveWorkflow(name);
|
|
141
|
+
await put(`/workflows/${wf.short_guid}`, { is_active: false });
|
|
142
|
+
if (opts.json) {
|
|
143
|
+
console.log(JSON.stringify({ disabled: wf.name }));
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
console.log(`Disabled "${wf.name}".`);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
catch (err) {
|
|
150
|
+
console.error(`Disable failed: ${err.message}`);
|
|
151
|
+
process.exit(1);
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
async function resolveWorkflow(name) {
|
|
155
|
+
const res = await get('/workflows');
|
|
156
|
+
const match = res.data.find(w => w.name === name || w.short_guid === name);
|
|
157
|
+
if (!match) {
|
|
158
|
+
console.error(`Workflow "${name}" not found.`);
|
|
159
|
+
process.exit(1);
|
|
160
|
+
}
|
|
161
|
+
return match;
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=workflow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow.js","sourceRoot":"","sources":["../../src/commands/workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAqB3C,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,OAAO,CAAC,UAAU,CAAC;KACnD,WAAW,CAAC,kBAAkB,CAAC;KAC/B,MAAM,CAAC,QAAQ,EAAE,gBAAgB,CAAC;KAClC,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;IACrB,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,GAAG,CAA2B,YAAY,CAAC,CAAC;QAC9D,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,OAAO,CAAC,GA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AI,EAAE,CAAC;YACd,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACrD,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;IAAC,OAAO,GAAQ,EAAE,CAAC;QAClB,OAAO,CAAC,KAAK,CAAC,mBAAmB,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;QAChD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,KAAK,UAAU,eAAe,CAAC,IAAY;IACzC,MAAM,GAAG,GAAG,MAAM,GAAG,CAA2B,YAAY,CAAC,CAAC;IAC9D,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,CAAC,UAAU,KAAK,IAAI,CAAC,CAAC;IAC3E,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CAAC,aAAa,IAAI,cAAc,CAAC,CAAC;QAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface GipityConfig {
|
|
2
|
+
projectGuid: string;
|
|
3
|
+
projectSlug: string;
|
|
4
|
+
accountSlug: string;
|
|
5
|
+
agentGuid: string;
|
|
6
|
+
conversationGuid: string | null;
|
|
7
|
+
apiBase: string;
|
|
8
|
+
ignore: string[];
|
|
9
|
+
}
|
|
10
|
+
export declare function getConfigPath(): string | null;
|
|
11
|
+
export declare function getConfig(): GipityConfig | null;
|
|
12
|
+
export declare function requireConfig(): GipityConfig;
|
|
13
|
+
export declare function clearConfigCache(): void;
|
|
14
|
+
export declare function saveConfig(data: GipityConfig): void;
|
|
15
|
+
export declare function shouldIgnore(filePath: string, ignorePatterns: string[]): boolean;
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync, existsSync } from 'fs';
|
|
2
|
+
import { resolve } from 'path';
|
|
3
|
+
const CONFIG_FILE = '.gipity.json';
|
|
4
|
+
let cached = null;
|
|
5
|
+
let cachedPath = null;
|
|
6
|
+
/** Find .gipity.json starting from cwd and walking up */
|
|
7
|
+
function findConfigPath() {
|
|
8
|
+
let dir = process.cwd();
|
|
9
|
+
while (true) {
|
|
10
|
+
const candidate = resolve(dir, CONFIG_FILE);
|
|
11
|
+
if (existsSync(candidate))
|
|
12
|
+
return candidate;
|
|
13
|
+
const parent = resolve(dir, '..');
|
|
14
|
+
if (parent === dir)
|
|
15
|
+
return null; // reached root
|
|
16
|
+
dir = parent;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export function getConfigPath() {
|
|
20
|
+
if (cachedPath !== null)
|
|
21
|
+
return cachedPath;
|
|
22
|
+
cachedPath = findConfigPath();
|
|
23
|
+
return cachedPath;
|
|
24
|
+
}
|
|
25
|
+
export function getConfig() {
|
|
26
|
+
if (cached)
|
|
27
|
+
return cached;
|
|
28
|
+
const path = getConfigPath();
|
|
29
|
+
if (!path)
|
|
30
|
+
return null;
|
|
31
|
+
try {
|
|
32
|
+
cached = JSON.parse(readFileSync(path, 'utf-8'));
|
|
33
|
+
return cached;
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export function requireConfig() {
|
|
40
|
+
const config = getConfig();
|
|
41
|
+
if (!config) {
|
|
42
|
+
console.error('Not a Gipity project. Run: gipity init');
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
return config;
|
|
46
|
+
}
|
|
47
|
+
export function clearConfigCache() {
|
|
48
|
+
cached = null;
|
|
49
|
+
cachedPath = null;
|
|
50
|
+
}
|
|
51
|
+
export function saveConfig(data) {
|
|
52
|
+
const path = getConfigPath() || resolve(process.cwd(), CONFIG_FILE);
|
|
53
|
+
writeFileSync(path, JSON.stringify(data, null, 2) + '\n');
|
|
54
|
+
cached = data;
|
|
55
|
+
cachedPath = path;
|
|
56
|
+
}
|
|
57
|
+
export function shouldIgnore(filePath, ignorePatterns) {
|
|
58
|
+
for (const pattern of ignorePatterns) {
|
|
59
|
+
// Simple glob matching: exact match, prefix match, or extension match
|
|
60
|
+
if (filePath === pattern)
|
|
61
|
+
return true;
|
|
62
|
+
if (filePath.startsWith(pattern + '/'))
|
|
63
|
+
return true;
|
|
64
|
+
if (pattern.startsWith('*.') && filePath.endsWith(pattern.slice(1)))
|
|
65
|
+
return true;
|
|
66
|
+
if (pattern.endsWith('/') && filePath.startsWith(pattern))
|
|
67
|
+
return true;
|
|
68
|
+
// Directory name match anywhere in path
|
|
69
|
+
if (!pattern.includes('*') && !pattern.includes('/')) {
|
|
70
|
+
if (filePath.split('/').includes(pattern))
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAY/B,MAAM,WAAW,GAAG,cAAc,CAAC;AAEnC,IAAI,MAAM,GAAwB,IAAI,CAAC;AACvC,IAAI,UAAU,GAAkB,IAAI,CAAC;AAErC,yDAAyD;AACzD,SAAS,cAAc;IACrB,IAAI,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,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'commander';
|
|
3
|
+
import { readFileSync } from 'fs';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
import { dirname, resolve } from 'path';
|
|
6
|
+
import { loginCommand } from './commands/login.js';
|
|
7
|
+
import { logoutCommand } from './commands/logout.js';
|
|
8
|
+
import { initCommand } from './commands/init.js';
|
|
9
|
+
import { statusCommand } from './commands/status.js';
|
|
10
|
+
import { syncCommand } from './commands/sync.js';
|
|
11
|
+
import { pushCommand } from './commands/push.js';
|
|
12
|
+
import { deployCommand } from './commands/deploy.js';
|
|
13
|
+
import { dbCommand } from './commands/db.js';
|
|
14
|
+
import { memoryCommand } from './commands/memory.js';
|
|
15
|
+
import { sandboxCommand } from './commands/sandbox.js';
|
|
16
|
+
import { chatCommand } from './commands/chat.js';
|
|
17
|
+
import { apiCommand } from './commands/api.js';
|
|
18
|
+
import { projectCommand } from './commands/project.js';
|
|
19
|
+
import { agentCommand } from './commands/agent.js';
|
|
20
|
+
import { workflowCommand } from './commands/workflow.js';
|
|
21
|
+
import { creditsCommand } from './commands/credits.js';
|
|
22
|
+
import { fileCommand } from './commands/file.js';
|
|
23
|
+
import { startCcCommand } from './commands/start-cc.js';
|
|
24
|
+
import { scaffoldCommand } from './commands/scaffold.js';
|
|
25
|
+
import { checkpointCommand } from './commands/checkpoint.js';
|
|
26
|
+
import { logsCommand } from './commands/logs.js';
|
|
27
|
+
import { browserCommand } from './commands/browser.js';
|
|
28
|
+
import { recordsCommand } from './commands/records.js';
|
|
29
|
+
import { fnCommand } from './commands/fn.js';
|
|
30
|
+
import { rbacCommand } from './commands/rbac.js';
|
|
31
|
+
import { auditCommand } from './commands/audit.js';
|
|
32
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
33
|
+
const pkg = JSON.parse(readFileSync(resolve(__dirname, '../package.json'), 'utf-8'));
|
|
34
|
+
// ── ANSI helpers ────────────────────────────────────────────────────────
|
|
35
|
+
const dim = (s) => `\x1b[2m${s}\x1b[22m`;
|
|
36
|
+
const bold = (s) => `\x1b[1m${s}\x1b[22m`;
|
|
37
|
+
// ── Custom help formatting (match Claude Code style) ────────────────────
|
|
38
|
+
function configureHelp(cmd) {
|
|
39
|
+
cmd.configureHelp({
|
|
40
|
+
formatHelp(cmd, helper) {
|
|
41
|
+
const defaultHelp = Help.prototype.formatHelp.call(this, cmd, helper);
|
|
42
|
+
return '\n' + defaultHelp + '\n';
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
const program = new Command();
|
|
47
|
+
program
|
|
48
|
+
.name('gipity')
|
|
49
|
+
.description(`${bold('Gipity CLI')} ${dim('—')} cloud infrastructure for every project\n\n ${dim('Hosting, databases, deployment, sandboxed execution, and AI — zero setup.')}`)
|
|
50
|
+
.version(pkg.version, '-v, --version');
|
|
51
|
+
configureHelp(program);
|
|
52
|
+
// ── Setup commands ──────────────────────────────────────────────────────
|
|
53
|
+
const setupGroup = [loginCommand, logoutCommand, initCommand, startCcCommand];
|
|
54
|
+
// ── Project commands ────────────────────────────────────────────────────
|
|
55
|
+
const projectGroup = [statusCommand, syncCommand, pushCommand, deployCommand, scaffoldCommand, checkpointCommand];
|
|
56
|
+
// ── Resource commands ───────────────────────────────────────────────────
|
|
57
|
+
const resourceGroup = [dbCommand, memoryCommand, fileCommand, sandboxCommand, apiCommand, logsCommand, browserCommand, recordsCommand, fnCommand, rbacCommand, auditCommand];
|
|
58
|
+
// ── Agent commands ──────────────────────────────────────────────────────
|
|
59
|
+
const agentGroup = [chatCommand, projectCommand, agentCommand, workflowCommand, creditsCommand];
|
|
60
|
+
for (const cmd of [...setupGroup, ...projectGroup, ...resourceGroup, ...agentGroup]) {
|
|
61
|
+
configureHelp(cmd);
|
|
62
|
+
program.addCommand(cmd);
|
|
63
|
+
}
|
|
64
|
+
program.parse();
|
|
65
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names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,EAAE,CAAC;KAChL,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;AAEzC,aAAa,CAAC,OAAO,CAAC,CAAC;AAEvB,2EAA2E;AAC3E,MAAM,UAAU,GAAG,CAAC,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,CAAC,CAAC;AAC9E,2EAA2E;AAC3E,MAAM,YAAY,GAAG,CAAC,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,eAAe,EAAE,iBAAiB,CAAC,CAAC;AAClH,2EAA2E;AAC3E,MAAM,aAAa,GAAG,CAAC,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,cAAc,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC;AAC7K,2EAA2E;AAC3E,MAAM,UAAU,GAAG,CAAC,WAAW,EAAE,cAAc,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,CAAC,CAAC;AAEhG,KAAK,MAAM,GAAG,IAAI,CAAC,GAAG,UAAU,EAAE,GAAG,YAAY,EAAE,GAAG,aAAa,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC;IACpF,aAAa,CAAC,GAAG,CAAC,CAAC;IACnB,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AAC1B,CAAC;AAED,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
package/dist/setup.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const SKILLS_CONTENT = "# Gipity Integration\n\nThis is a Gipity-powered project. Gipity gives every project its own cloud infrastructure \u2014 hosting, databases, file storage, deployment, sandboxed code execution, and a 64-tool AI agent \u2014 with zero setup. You write code here, it runs there.\n\n**You are the developer.** Write HTML, JS, CSS, Python \u2014 whatever the project needs \u2014 directly in this directory. Files auto-sync to Gipity's cloud via hooks. There is no local runtime; do NOT run `npm install`, `npm start`, `node`, or `python` locally.\n\n## Workflow\n\n1. Write and edit files normally (auto-pushed to Gipity on every save)\n2. `gipity deploy dev` \u2192 get a live URL instantly\n3. `curl <url>` or WebFetch to verify\n4. `gipity deploy prod` when ready\n\n## CLI Commands\n\n| Command | Purpose |\n|---------|---------|\n| `gipity scaffold [title]` | Create web app structure (src/ with HTML, CSS, JS, favicons) |\n| `gipity deploy [dev\\|prod]` | Deploy and get live URL |\n| `gipity sync [up\\|down\\|check]` | Manual file sync |\n| `gipity db create <name>` | Create a project database |\n| `gipity db query \"SQL\"` | Run SQL on project database |\n| `gipity db list` | List databases |\n| `gipity memory list\\|read\\|write` | Persistent key-value memory |\n| `gipity api list\\|define\\|get` | Manage backend API procedures |\n| `gipity checkpoint list` | List file snapshots |\n| `gipity checkpoint restore <id>` | Restore files to a snapshot (undo) |\n| `gipity logs fn <name>` | View function execution logs (errors, timing) |\n| `gipity browser <url>` | Inspect a URL: console errors, timing, failed resources |\n| `gipity status` | Check project and sync status |\n\nAll commands support `--json` for structured output.\n\n## Processing & Code Execution\n\nDo NOT install tools or run heavy processing locally. Gipity has a cloud sandbox accessible via `gipity chat` with extensive tools pre-installed:\n\n- **Image/video**: ImageMagick, FFmpeg, Graphviz, gnuplot, optipng, gifsicle, potrace, webp, exiftool, mediainfo\n- **Documents**: LibreOffice (headless), pandoc, wkhtmltopdf, ghostscript, qpdf, poppler-utils\n- **Python**: pandas, numpy, matplotlib, scipy, sympy, pillow, openpyxl, python-docx, python-pptx, reportlab, cairosvg, seaborn, qrcode, requests, bs4, Jinja2, faker\n- **Audio**: sox, FFmpeg\n- **Data**: jq, sqlite3, csvkit, datamash, miller, xmlstarlet\n- **Compile**: GCC/G++, mingw-w64 (Windows cross-compile)\n\nUse `gipity chat` to have the platform do it. Example: `gipity chat \"resize all images in src/images to 800px wide\"`\n\n## File Operations\n\nAll file creation and editing should happen locally \u2014 hooks auto-push changes to Gipity. Do NOT use `gipity chat` to create or edit files. Use `gipity sync` if files get out of sync. Use `gipity file ls` and `gipity file cat` to browse remote files without syncing.\n\n## Platform Services (via `gipity chat`)\n\nSome Gipity capabilities require its hosted AI agent. Use `gipity chat` for things you cannot do directly. The response includes text output, which tools were used, and any files created are auto-synced locally. Add `--json` for structured output.\n\n- **Image generation**: `gipity chat \"generate a hero image for the landing page\"`\n- **Speech / TTS**: `gipity chat \"generate speech audio for this welcome message\"`\n- **Sound effects / Music**: `gipity chat \"generate a click sound effect\"`\n- **Web search**: `gipity chat \"search the web for current pricing of competitor X\"`\n- **Twitter/X search**: `gipity chat \"search twitter for mentions of our app\"`\n- **Browser interaction**: `gipity chat \"open our deployed app, click the login button, and screenshot the result\"`\n- **Workflow automation**: `gipity chat \"create a cron workflow that emails a daily summary\"`\n- **Email**: `gipity chat \"send a summary email to the team\"`\n- **LLM queries**: `gipity chat \"ask GPT-4 to review this code for security issues\"`\n\nDo NOT use `gipity chat` for writing code, creating files, or scaffolding \u2014 do that directly.\n\n## File Structure\n- **Use src/ convention**: All app files live under `src/` \u2014 `src/index.html`, `src/css/styles.css`, `src/js/main.js`, `src/images/`\n- **Separate files**: Split into `index.html`, `styles.css`, and `app.js` (or `main.js`). Never inline large blocks of CSS or JS in HTML.\n- If the app grows, organize into folders: `src/css/`, `src/js/`, `src/assets/`, `src/sounds/`, `src/images/`, etc.\n- **Use subfolders \u2014 don't flatten**: Reference assets from their folders (e.g. `sounds/click.ogg`, `images/logo.png`). Never copy files to the root just for convenience \u2014 deployed apps serve the full directory tree.\n- Keep `index.html` clean \u2014 it should be structure/markup, not behavior or styling\n\n## HTML\n- Use semantic elements: `<header>`, `<nav>`, `<main>`, `<section>`, `<footer>`, `<article>`\n- Always include `<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">`\n- Add a proper `<title>` and favicon link\n- Unless the user specifies a different CSS framework, include Water.css for automatic styling: `<link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/water.css@2/out/water.css\">`\n- Water.css styles semantic HTML automatically (buttons, tables, forms, nav, cards) \u2014 no classes needed. It supports dark/light themes automatically. Add custom CSS on top for app-specific tweaks.\n\n## CSS\n- When using Water.css, it handles base styling, resets, and typography \u2014 don't duplicate what it provides\n- Water.css exposes CSS variables for theming \u2014 override them in `:root` for custom colors/fonts\n- Use CSS custom properties (variables) for app-specific colors, spacing, and fonts\n- Add smooth transitions on interactive elements (buttons, links, hover states)\n\n## JavaScript\n- Use `const`/`let`, arrow functions, template literals, and modern ES6+ syntax\n- Wait for DOM: wrap in `DOMContentLoaded` or place script at end of body\n- Keep functions small and focused\n- Use `addEventListener` \u2014 never inline `onclick` attributes in HTML\n\n## Code Quality\n- **Keep files under ~400 lines** unless the content genuinely requires it (e.g. a long data table, template string, or config object). When logic grows beyond that, split into focused modules (e.g. `utils.js`, `api.js`, `ui.js`).\n- **Don't duplicate code.** If the same logic appears twice, extract it into a shared function. Before writing a new helper, check if one already exists or could be extended.\n- **One responsibility per file.** A file that handles both UI rendering and API calls should be split.\n- **Name things clearly.** Functions, variables, and files should describe what they do \u2014 no `temp`, `data2`, `stuff.js`.\n- **Prefer simple, readable code** over clever code that hides bugs. Flat over nested \u2014 use early returns, avoid deep nesting.\n- **Centralize configuration.** App settings, API URLs, feature flags, and magic numbers should live in a dedicated config file (e.g. `config.js` or `constants.js`), not scattered across the codebase.\n- **Write utility functions** for repeated operations (formatting, validation, API calls). Keep them in a `utils.js` or `helpers.js` file. Small, pure functions are easy to test and reuse.\n\n## Testing\n- **Write tests for new functions** \u2014 especially utility/helper functions. Cover the happy path and edge cases (empty input, null, boundary values).\n- **Don't mock unless absolutely required.** Tests should exercise real code paths. Only mock external paid services (APIs that cost money per call).\n- **E2E tests should hit real infrastructure** (real API, real DB) \u2014 just clean up test data when done.\n- **Test file naming**: `*.test.js` for unit tests, `*.e2e.test.js` for end-to-end tests.\n\n## Deployment\n- **src/ detection**: If a `src/` directory exists, only `src/` is deployed. Otherwise the full project root is deployed.\n\n## Authentication\n\nLogin is a two-step process that works non-interactively:\n\n1. `gipity login --email user@example.com` \u2192 sends a 6-digit code to that email\n2. Ask the user for the code, then: `gipity login --email user@example.com --code 123456`\n\nCheck auth status: `gipity status`\nLog out: `gipity logout`\n\n## Sync Behavior\n\n- **Auto-push**: Files push to Gipity after every Write/Edit (hook)\n- **Auto-pull**: Remote changes pull before each prompt (hook)\n- **Manual**: `gipity sync check` to see pending changes\n- **Deletes are safe**: All file deletions are soft deletes. Use `gipity checkpoint list` and `gipity checkpoint restore <id>` to undo any delete or revert to a previous state.\n\n## Debugging\n\n- `gipity browser <url>` \u2014 open a deployed URL and get JS console errors, failed resources (404s), and page load timing. Useful when something looks broken after deploy.\n- `gipity logs fn <name>` \u2014 view recent function execution logs with error messages and timing. Use when API calls return errors.\n- `gipity sync check` \u2014 verify local and remote files are in sync if things seem stale.\n- `gipity checkpoint restore <id>` \u2014 undo a bad change by restoring to a previous file snapshot.\n";
|
|
2
|
+
export declare const HOOKS_SETTINGS: {
|
|
3
|
+
hooks: {
|
|
4
|
+
PostToolUse: {
|
|
5
|
+
matcher: string;
|
|
6
|
+
hooks: {
|
|
7
|
+
type: string;
|
|
8
|
+
command: string;
|
|
9
|
+
}[];
|
|
10
|
+
}[];
|
|
11
|
+
UserPromptSubmit: {
|
|
12
|
+
matcher: string;
|
|
13
|
+
hooks: {
|
|
14
|
+
type: string;
|
|
15
|
+
command: string;
|
|
16
|
+
}[];
|
|
17
|
+
}[];
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export declare function setupClaudeHooks(): void;
|
|
21
|
+
export declare function setupClaudeMd(): void;
|
|
22
|
+
export declare function setupGitignore(): void;
|
|
23
|
+
export declare function slugify(name: string): string;
|