@pipefy/pipefy-process-coder 0.1.0 → 0.1.2
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/.agents/skills/ppc-pipefy-flow-authoring/SKILL.md +262 -262
- package/.agents/skills/ppc-pipefy-flow-authoring/examples/01-main-2-danfe-consulta.json +247 -247
- package/.agents/skills/ppc-pipefy-flow-authoring/examples/01-main-2-webhook-retorno-consulta.json +589 -589
- package/.agents/skills/ppc-pipefy-flow-authoring/examples/01-main-4-recebimento-barramento.json +1391 -1391
- package/.agents/skills/ppc-pipefy-flow-authoring/examples/02-subflow-2-danfe-retorno.json +623 -623
- package/.agents/skills/ppc-pipefy-flow-authoring/examples/02-subflow-4-criacao-operacao.json +636 -636
- package/.agents/skills/ppc-pipefy-flow-authoring/examples/03-subflow-4-criacao-titulo.json +3642 -3642
- package/.agents/skills/ppc-pipefy-flow-authoring/examples/04-subflow-4-criacao-cedente.json +863 -863
- package/.agents/skills/ppc-pipefy-flow-authoring/examples/04-subflow-4-criacao-sacado.json +799 -799
- package/.agents/skills/ppc-pipefy-flow-authoring/examples/README.md +42 -42
- package/.agents/skills/ppc-pipefy-flow-authoring/examples/hml-01-subflow-1-titulo-acompanhamento-cobranca.json +581 -581
- package/.agents/skills/ppc-pipefy-flow-authoring/examples/hml-01-subflow-1-titulo-nfe-monitoramento.json +503 -503
- package/.agents/skills/ppc-pipefy-flow-authoring/examples/hml-01-subflow-1-titulo-retorno-bancario.json +562 -562
- package/.agents/skills/ppc-pipefy-flow-authoring/examples/hml-02-subflow-2-retorno-consulta-cedente.json +557 -557
- package/.agents/skills/ppc-pipefy-flow-authoring/examples/hml-02-subflow-2-retorno-consulta-sacado.json +609 -609
- package/.agents/skills/ppc-pipefy-pipe-authoring/SKILL.md +146 -146
- package/.agents/skills/ppc-pipefy-process-design/SKILL.md +127 -127
- package/.agents/skills/ppc-pipefy-workspace/SKILL.md +91 -91
- package/AGENTS.md +476 -456
- package/LICENSE +202 -0
- package/NOTICE +11 -0
- package/README.md +830 -808
- package/bin/pipe.js +25 -4
- package/dist/apply/adopt.js +128 -0
- package/dist/apply/agentops.js +42 -0
- package/dist/apply/compile.js +722 -0
- package/dist/apply/execute.js +277 -0
- package/dist/apply/flowops.js +293 -0
- package/dist/apply/idmap.js +233 -0
- package/dist/apply/mutations.js +704 -0
- package/dist/apply/registry.js +348 -0
- package/dist/apply/types.js +18 -0
- package/dist/cli/args.js +79 -0
- package/dist/cli.js +196 -0
- package/dist/codec/flow.js +164 -0
- package/dist/codec/pack.js +88 -0
- package/dist/codec/roundtrip.js +86 -0
- package/dist/codec/unpack.js +181 -0
- package/dist/commands/agents.js +145 -0
- package/dist/commands/apply.js +982 -0
- package/dist/commands/context.js +79 -0
- package/dist/commands/create.js +63 -0
- package/dist/commands/diff.js +294 -0
- package/dist/commands/flows.js +348 -0
- package/dist/commands/misc.js +562 -0
- package/dist/commands/plan.js +301 -0
- package/dist/commands/pull.js +549 -0
- package/dist/commands/runs.js +74 -0
- package/dist/commands/skills.js +131 -0
- package/dist/commands/verify.js +205 -0
- package/dist/config.js +125 -0
- package/dist/diff/agents.js +80 -0
- package/dist/diff/diff.js +983 -0
- package/dist/diff/flow.js +258 -0
- package/{src/diff/html.ts → dist/diff/html.js} +274 -322
- package/dist/diff/render.js +90 -0
- package/dist/model/payload.js +84 -0
- package/dist/model/tree.js +7 -0
- package/dist/model/volatile.js +54 -0
- package/dist/pipefy/agents.js +131 -0
- package/dist/pipefy/automations.js +155 -0
- package/dist/pipefy/capability.js +84 -0
- package/dist/pipefy/client.js +204 -0
- package/dist/pipefy/discovery.js +148 -0
- package/dist/pipefy/internal.js +406 -0
- package/dist/pipefy/ipaas.js +269 -0
- package/dist/pipefy/reconstruct.js +676 -0
- package/dist/pipefy/reference.js +172 -0
- package/dist/pipefy/snapshot.js +185 -0
- package/dist/pipefy/toolkit.js +174 -0
- package/{src → dist}/pipefy/toolkit_bearer.py +60 -14
- package/dist/report/integrations.js +165 -0
- package/dist/report/run.js +356 -0
- package/dist/util/fsx.js +50 -0
- package/dist/util/git.js +25 -0
- package/dist/util/json.js +56 -0
- package/dist/util/log.js +69 -0
- package/dist/util/pool.js +42 -0
- package/dist/util/slug.js +23 -0
- package/dist/util/tui.js +287 -0
- package/dist/validate/index.js +86 -0
- package/dist/validate/integrity.js +370 -0
- package/dist/validate/reference.js +120 -0
- package/dist/validate/schema.js +278 -0
- package/dist/version.js +18 -0
- package/dist/workspace/agents.js +245 -0
- package/{src/workspace/docs.ts → dist/workspace/docs.js} +367 -407
- package/dist/workspace/flows.js +149 -0
- package/dist/workspace/layout.js +146 -0
- package/dist/workspace/lock.js +83 -0
- package/dist/workspace/read.js +168 -0
- package/dist/workspace/reference.js +24 -0
- package/dist/workspace/stamp.js +234 -0
- package/dist/workspace/write.js +194 -0
- package/package.json +38 -35
- package/src/apply/adopt.ts +0 -150
- package/src/apply/agentops.ts +0 -71
- package/src/apply/compile.ts +0 -875
- package/src/apply/execute.ts +0 -336
- package/src/apply/flowops.ts +0 -399
- package/src/apply/idmap.ts +0 -241
- package/src/apply/mutations.ts +0 -955
- package/src/apply/registry.ts +0 -430
- package/src/apply/types.ts +0 -134
- package/src/cli/args.ts +0 -88
- package/src/cli.ts +0 -211
- package/src/codec/flow.ts +0 -199
- package/src/codec/pack.ts +0 -103
- package/src/codec/roundtrip.ts +0 -94
- package/src/codec/unpack.ts +0 -198
- package/src/commands/agents.ts +0 -184
- package/src/commands/apply.ts +0 -1144
- package/src/commands/context.ts +0 -119
- package/src/commands/create.ts +0 -79
- package/src/commands/diff.ts +0 -314
- package/src/commands/flows.ts +0 -414
- package/src/commands/misc.ts +0 -644
- package/src/commands/plan.ts +0 -331
- package/src/commands/pull.ts +0 -567
- package/src/commands/runs.ts +0 -83
- package/src/commands/skills.ts +0 -137
- package/src/commands/verify.ts +0 -253
- package/src/config.ts +0 -168
- package/src/diff/agents.ts +0 -122
- package/src/diff/diff.ts +0 -1130
- package/src/diff/flow.ts +0 -318
- package/src/diff/render.ts +0 -101
- package/src/model/payload.ts +0 -154
- package/src/model/tree.ts +0 -99
- package/src/model/volatile.ts +0 -55
- package/src/pipefy/agents.ts +0 -165
- package/src/pipefy/automations.ts +0 -219
- package/src/pipefy/capability.ts +0 -119
- package/src/pipefy/client.ts +0 -267
- package/src/pipefy/discovery.ts +0 -209
- package/src/pipefy/internal.ts +0 -380
- package/src/pipefy/ipaas.ts +0 -365
- package/src/pipefy/reconstruct.ts +0 -775
- package/src/pipefy/reference.ts +0 -251
- package/src/pipefy/snapshot.ts +0 -245
- package/src/pipefy/toolkit.ts +0 -200
- package/src/report/integrations.ts +0 -231
- package/src/report/run.ts +0 -475
- package/src/util/fsx.ts +0 -45
- package/src/util/git.ts +0 -32
- package/src/util/json.ts +0 -55
- package/src/util/log.ts +0 -76
- package/src/util/pool.ts +0 -48
- package/src/util/slug.ts +0 -26
- package/src/util/tui.ts +0 -335
- package/src/validate/index.ts +0 -123
- package/src/validate/integrity.ts +0 -387
- package/src/validate/reference.ts +0 -136
- package/src/validate/schema.ts +0 -328
- package/src/workspace/agents.ts +0 -290
- package/src/workspace/flows.ts +0 -191
- package/src/workspace/layout.ts +0 -165
- package/src/workspace/lock.ts +0 -148
- package/src/workspace/read.ts +0 -165
- package/src/workspace/reference.ts +0 -24
- package/src/workspace/stamp.ts +0 -301
- package/src/workspace/write.ts +0 -225
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
import type { PayloadEnvelope, Row } from '../model/payload.ts';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* The integration surface of a pipe, pulled out of the payload as its own
|
|
5
|
-
* artifact.
|
|
6
|
-
*
|
|
7
|
-
* "Integration" here means every way this pipe touches something outside
|
|
8
|
-
* itself, because those are the parts of a change whose blast radius leaves the
|
|
9
|
-
* pipe: a webhook fires at a third party, a pipe relation writes cards into
|
|
10
|
-
* another process, a cross-repo automation does both. They are also the parts
|
|
11
|
-
* that carry credentials, which is why the rendered summary is redacted and the
|
|
12
|
-
* raw rows go in a file the workspace .gitignore covers.
|
|
13
|
-
*
|
|
14
|
-
* Recorded per run rather than derived on demand: a run is the only moment when
|
|
15
|
-
* "what did this pipe reach, before and after" is knowable, and by the next
|
|
16
|
-
* apply the answer has changed.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
/** Automation actions that reach outside the pipe they are triggered in. */
|
|
20
|
-
const OUTBOUND_ACTIONS = new Set([
|
|
21
|
-
'http_request',
|
|
22
|
-
'send_email',
|
|
23
|
-
'send_email_template',
|
|
24
|
-
'create_card',
|
|
25
|
-
'create_card_relation',
|
|
26
|
-
'move_single_card',
|
|
27
|
-
'create_table_record',
|
|
28
|
-
'update_table_record',
|
|
29
|
-
]);
|
|
30
|
-
|
|
31
|
-
export type IntegrationEdge = {
|
|
32
|
-
kind: 'webhook' | 'pipe_relation' | 'automation' | 'connected_field' | 'email_inbox';
|
|
33
|
-
/** What this pipe reaches, named the way a human would say it. */
|
|
34
|
-
target: string;
|
|
35
|
-
/** The row's id, so it can be found again. */
|
|
36
|
-
id: string | null;
|
|
37
|
-
detail: string;
|
|
38
|
-
/** True when the row carries a credential, so the report redacts it. */
|
|
39
|
-
bearsSecret?: boolean;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export type IntegrationsView = {
|
|
43
|
-
generatedAt: string;
|
|
44
|
-
repoId: number;
|
|
45
|
-
repoName: string;
|
|
46
|
-
/**
|
|
47
|
-
* Coverage for the groups this view reads. `unknown` here means the list
|
|
48
|
-
* below is not "no integrations" but "not read" — the same doctrine as
|
|
49
|
-
* everywhere else, and it matters most here, where the absent row might be a
|
|
50
|
-
* live webhook.
|
|
51
|
-
*/
|
|
52
|
-
coverage: Record<string, string>;
|
|
53
|
-
counts: { webhooks: number; pipe_relations: number; outbound_automations: number; connected_fields: number };
|
|
54
|
-
edges: IntegrationEdge[];
|
|
55
|
-
/** Every repo id this pipe is wired to, however it is wired. */
|
|
56
|
-
connected_repo_ids: number[];
|
|
57
|
-
/** Raw rows, unredacted — the workspace .gitignore covers this file. */
|
|
58
|
-
webhooks: Row[];
|
|
59
|
-
pipe_relations: Row[];
|
|
60
|
-
outbound_automations: Row[];
|
|
61
|
-
email_inboxes: Row[];
|
|
62
|
-
public_form: { open: boolean; title: unknown } | null;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const s = (v: unknown): string | null => (v === null || v === undefined ? null : String(v));
|
|
66
|
-
|
|
67
|
-
const hostOf = (url: unknown): string => {
|
|
68
|
-
const raw = s(url);
|
|
69
|
-
if (!raw) return '(no url)';
|
|
70
|
-
try {
|
|
71
|
-
return new URL(raw).host;
|
|
72
|
-
} catch {
|
|
73
|
-
return raw.slice(0, 40);
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
/** Whether a row holds anything bearer-equivalent. */
|
|
78
|
-
const bearsSecret = (row: Row): boolean => {
|
|
79
|
-
const j = JSON.stringify(row).toLowerCase();
|
|
80
|
-
return (
|
|
81
|
-
j.includes('authentication_value') ||
|
|
82
|
-
j.includes('authentication_key') ||
|
|
83
|
-
j.includes('token') ||
|
|
84
|
-
j.includes('secret') ||
|
|
85
|
-
/[?&](key|token|sig|signature|auth)=/.test(j)
|
|
86
|
-
);
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
export const integrationsFrom = (env: PayloadEnvelope): IntegrationsView => {
|
|
90
|
-
const rel = env.payload.relations;
|
|
91
|
-
const repoId = Number(env.payload.id);
|
|
92
|
-
const webhooks = rel.webhooks ?? [];
|
|
93
|
-
const relations = rel.pipe_relations ?? [];
|
|
94
|
-
const automations = rel.automations ?? [];
|
|
95
|
-
const inboxes = rel.email_inboxes ?? [];
|
|
96
|
-
const fields = rel.fields ?? [];
|
|
97
|
-
|
|
98
|
-
const outbound = automations.filter((a) => {
|
|
99
|
-
const action = s(a['action_id']) ?? '';
|
|
100
|
-
const target = s(a['action_repo_id']);
|
|
101
|
-
const crossRepo = target !== null && target !== s(a['event_repo_id']);
|
|
102
|
-
return crossRepo || OUTBOUND_ACTIONS.has(action);
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
const connectedFields = fields.filter((f) => s(f['connected_repo_id']) ?? s(f['connected_pipe_id']));
|
|
106
|
-
|
|
107
|
-
const edges: IntegrationEdge[] = [
|
|
108
|
-
...webhooks.map(
|
|
109
|
-
(w): IntegrationEdge => ({
|
|
110
|
-
kind: 'webhook',
|
|
111
|
-
target: hostOf(w['url']),
|
|
112
|
-
id: s(w['id']),
|
|
113
|
-
detail:
|
|
114
|
-
`${s(w['name']) ?? 'unnamed'} on ` +
|
|
115
|
-
`${Array.isArray(w['actions']) ? (w['actions'] as unknown[]).join(', ') : (s(w['actions']) ?? 'no actions')}`,
|
|
116
|
-
bearsSecret: bearsSecret(w),
|
|
117
|
-
}),
|
|
118
|
-
),
|
|
119
|
-
...relations.map(
|
|
120
|
-
(r): IntegrationEdge => ({
|
|
121
|
-
kind: 'pipe_relation',
|
|
122
|
-
target: `repo ${s(r['child_id']) ?? s(r['parent_id']) ?? '?'}`,
|
|
123
|
-
id: s(r['id']),
|
|
124
|
-
detail: `${s(r['name']) ?? 'unnamed'} — parent ${s(r['parent_id'])} to child ${s(r['child_id'])}`,
|
|
125
|
-
}),
|
|
126
|
-
),
|
|
127
|
-
...outbound.map(
|
|
128
|
-
(a): IntegrationEdge => ({
|
|
129
|
-
kind: 'automation',
|
|
130
|
-
target:
|
|
131
|
-
s(a['action_repo_id']) && s(a['action_repo_id']) !== String(repoId)
|
|
132
|
-
? `repo ${s(a['action_repo_id'])}`
|
|
133
|
-
: (s(a['action_id']) ?? 'action'),
|
|
134
|
-
id: s(a['id']),
|
|
135
|
-
detail:
|
|
136
|
-
`${s(a['name']) ?? 'unnamed'} — ${s(a['event_id'])} to ${s(a['action_id'])}` +
|
|
137
|
-
`${a['active'] === false ? ' (inactive)' : ''}`,
|
|
138
|
-
bearsSecret: bearsSecret(a),
|
|
139
|
-
}),
|
|
140
|
-
),
|
|
141
|
-
...connectedFields.map(
|
|
142
|
-
(f): IntegrationEdge => ({
|
|
143
|
-
kind: 'connected_field',
|
|
144
|
-
target: `repo ${s(f['connected_repo_id']) ?? s(f['connected_pipe_id'])}`,
|
|
145
|
-
id: s(f['id']),
|
|
146
|
-
// Payload rows spell the type `type_id`; a reconstructed row may spell it
|
|
147
|
-
// `type`. Neither is guaranteed, so both are tried before giving up.
|
|
148
|
-
detail: `field "${s(f['label']) ?? s(f['name']) ?? '?'}" (${s(f['type_id']) ?? s(f['type']) ?? 'unknown type'})`,
|
|
149
|
-
}),
|
|
150
|
-
),
|
|
151
|
-
...inboxes.map(
|
|
152
|
-
(i): IntegrationEdge => ({
|
|
153
|
-
kind: 'email_inbox',
|
|
154
|
-
target: s(i['email']) ?? s(i['name']) ?? 'inbox',
|
|
155
|
-
id: s(i['id']),
|
|
156
|
-
detail: 'inbound email',
|
|
157
|
-
}),
|
|
158
|
-
),
|
|
159
|
-
];
|
|
160
|
-
|
|
161
|
-
const connected = new Set<number>();
|
|
162
|
-
const note = (v: unknown) => {
|
|
163
|
-
const n = Number(v);
|
|
164
|
-
if (Number.isFinite(n) && n !== repoId && n !== 0) connected.add(n);
|
|
165
|
-
};
|
|
166
|
-
for (const r of relations) {
|
|
167
|
-
note(r['parent_id']);
|
|
168
|
-
note(r['child_id']);
|
|
169
|
-
}
|
|
170
|
-
for (const a of outbound) note(a['action_repo_id']);
|
|
171
|
-
for (const f of connectedFields) note(f['connected_repo_id'] ?? f['connected_pipe_id']);
|
|
172
|
-
|
|
173
|
-
const form = (rel.public_forms ?? [])[0] ?? null;
|
|
174
|
-
|
|
175
|
-
return {
|
|
176
|
-
generatedAt: new Date().toISOString(),
|
|
177
|
-
repoId,
|
|
178
|
-
repoName: String(env.payload['name'] ?? repoId),
|
|
179
|
-
coverage: {
|
|
180
|
-
webhooks: env.coverage.webhooks,
|
|
181
|
-
pipe_relations: env.coverage.pipe_relations,
|
|
182
|
-
automations: env.coverage.automations,
|
|
183
|
-
email_inboxes: env.coverage.email_inboxes,
|
|
184
|
-
},
|
|
185
|
-
counts: {
|
|
186
|
-
webhooks: webhooks.length,
|
|
187
|
-
pipe_relations: relations.length,
|
|
188
|
-
outbound_automations: outbound.length,
|
|
189
|
-
connected_fields: connectedFields.length,
|
|
190
|
-
},
|
|
191
|
-
edges,
|
|
192
|
-
connected_repo_ids: [...connected].sort((a, b) => a - b),
|
|
193
|
-
webhooks,
|
|
194
|
-
pipe_relations: relations,
|
|
195
|
-
outbound_automations: outbound,
|
|
196
|
-
email_inboxes: inboxes,
|
|
197
|
-
public_form: form ? { open: Boolean(env.payload['public']), title: form['title'] ?? null } : null,
|
|
198
|
-
};
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
/** The integration surface as report prose. Hosts kept, credentials never. */
|
|
202
|
-
export const renderIntegrations = (v: IntegrationsView): string[] => {
|
|
203
|
-
const lines: string[] = [];
|
|
204
|
-
const gaps = Object.entries(v.coverage).filter(([, c]) => c !== 'complete');
|
|
205
|
-
if (gaps.length) {
|
|
206
|
-
lines.push(
|
|
207
|
-
`> Coverage: ${gaps.map(([k, c]) => `${k} is ${c}`).join(', ')}. ` +
|
|
208
|
-
'An absent row below is not evidence that nothing is there.',
|
|
209
|
-
'',
|
|
210
|
-
);
|
|
211
|
-
}
|
|
212
|
-
if (!v.edges.length) {
|
|
213
|
-
lines.push('This pipe reaches nothing outside itself.');
|
|
214
|
-
return lines;
|
|
215
|
-
}
|
|
216
|
-
lines.push('| Kind | Target | Id | Detail |', '| --- | --- | --- | --- |');
|
|
217
|
-
for (const e of v.edges) {
|
|
218
|
-
lines.push(
|
|
219
|
-
`| ${e.kind.replace(/_/g, ' ')} | ${e.target}${e.bearsSecret ? ' (key)' : ''} | ${e.id ?? '-'} | ` +
|
|
220
|
-
`${e.detail.replace(/\|/g, '\\|')} |`,
|
|
221
|
-
);
|
|
222
|
-
}
|
|
223
|
-
if (v.edges.some((e) => e.bearsSecret)) {
|
|
224
|
-
lines.push(
|
|
225
|
-
'',
|
|
226
|
-
'(key) marks a row that carries a credential. The value is in `integrations.json`, ' +
|
|
227
|
-
'which the workspace .gitignore covers.',
|
|
228
|
-
);
|
|
229
|
-
}
|
|
230
|
-
return lines;
|
|
231
|
-
};
|