zinkee 0.1.44 → 0.1.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/dist/chunk-MHEVRMDX.js +1230 -0
- package/dist/chunk-MHEVRMDX.js.map +1 -0
- package/{src/utils/examples.ts → dist/examples-67U5IRBS.js} +866 -1141
- package/dist/examples-67U5IRBS.js.map +1 -0
- package/dist/index.js +1145 -8456
- package/dist/index.js.map +1 -1
- package/package.json +6 -3
- package/.github/workflows/npm-publish.yml +0 -77
- package/.github/workflows/pr-checks.yml +0 -36
- package/AGENTS.md +0 -110
- package/docs/cli-contract.md +0 -41
- package/docs/npm-release.md +0 -64
- package/docs/superpowers/plans/2026-03-24-zinkee-cli-implementation.md +0 -837
- package/docs/superpowers/plans/2026-03-25-cli-backend-error-contract.md +0 -503
- package/docs/superpowers/plans/2026-03-26-display-freeform-create.md +0 -389
- package/docs/superpowers/specs/2026-03-24-zinkee-cli-backend-blockers.md +0 -172
- package/docs/superpowers/specs/2026-03-24-zinkee-cli-design.md +0 -1576
- package/docs/superpowers/specs/2026-03-24-zinkee-cli-e2e-checklist.md +0 -215
- package/docs/superpowers/specs/2026-03-24-zinkee-cli-e2e-design.md +0 -492
- package/docs/superpowers/specs/2026-03-24-zinkee-cli-e2e-status.md +0 -307
- package/docs/superpowers/specs/2026-07-30-cli-pr-checks-design.md +0 -37
- package/src/api/automations.ts +0 -404
- package/src/api/comments.ts +0 -51
- package/src/api/displays.ts +0 -337
- package/src/api/document-templates.ts +0 -110
- package/src/api/files.ts +0 -50
- package/src/api/formulas.test.ts +0 -65
- package/src/api/formulas.ts +0 -67
- package/src/api/logs.ts +0 -34
- package/src/api/navigation.ts +0 -70
- package/src/api/records.ts +0 -184
- package/src/api/schemas.ts +0 -148
- package/src/api/teamspace.ts +0 -110
- package/src/cli-examples.ts +0 -130
- package/src/cli-runner.ts +0 -95
- package/src/client.test.ts +0 -189
- package/src/client.ts +0 -269
- package/src/command-registry.ts +0 -882
- package/src/commands/automations.test.ts +0 -1030
- package/src/commands/automations.ts +0 -2102
- package/src/commands/comments.test.ts +0 -214
- package/src/commands/comments.ts +0 -303
- package/src/commands/config.test.ts +0 -81
- package/src/commands/config.ts +0 -150
- package/src/commands/displays.test.ts +0 -1105
- package/src/commands/displays.ts +0 -1442
- package/src/commands/document-templates.test.ts +0 -569
- package/src/commands/document-templates.ts +0 -563
- package/src/commands/files.test.ts +0 -284
- package/src/commands/files.ts +0 -280
- package/src/commands/formulas.test.ts +0 -194
- package/src/commands/formulas.ts +0 -243
- package/src/commands/logs.test.ts +0 -123
- package/src/commands/logs.ts +0 -159
- package/src/commands/navigation.test.ts +0 -211
- package/src/commands/navigation.ts +0 -348
- package/src/commands/profiles.test.ts +0 -191
- package/src/commands/profiles.ts +0 -303
- package/src/commands/records.test.ts +0 -860
- package/src/commands/records.ts +0 -883
- package/src/commands/schemas.test.ts +0 -1252
- package/src/commands/schemas.ts +0 -890
- package/src/commands/teamspace.test.ts +0 -229
- package/src/commands/teamspace.ts +0 -546
- package/src/completion/engine.test.ts +0 -138
- package/src/completion/engine.ts +0 -168
- package/src/completion/install.test.ts +0 -179
- package/src/completion/install.ts +0 -260
- package/src/completion/runtime.ts +0 -150
- package/src/completion/scripts.ts +0 -91
- package/src/config.test.ts +0 -362
- package/src/config.ts +0 -294
- package/src/index.test.ts +0 -217
- package/src/index.ts +0 -8
- package/src/parsers/expressions.test.ts +0 -95
- package/src/parsers/expressions.ts +0 -128
- package/src/parsers/kv.test.ts +0 -35
- package/src/parsers/kv.ts +0 -49
- package/src/parsers/selectors.test.ts +0 -23
- package/src/parsers/selectors.ts +0 -29
- package/src/program.ts +0 -64
- package/src/runtime-context.ts +0 -103
- package/src/types.ts +0 -76
- package/src/utils/argv-rewrite.test.ts +0 -149
- package/src/utils/argv-rewrite.ts +0 -269
- package/src/utils/errors.test.ts +0 -85
- package/src/utils/errors.ts +0 -191
- package/src/utils/examples.test.ts +0 -374
- package/src/utils/output.test.ts +0 -65
- package/src/utils/output.ts +0 -154
- package/src/utils/schema-fields.ts +0 -1016
- package/tsconfig.json +0 -20
- package/tsup.config.ts +0 -13
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
import { mkdtempSync, writeFileSync } from "node:fs";
|
|
2
|
-
import { tmpdir } from "node:os";
|
|
3
|
-
import { join } from "node:path";
|
|
4
|
-
|
|
5
|
-
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
6
|
-
|
|
7
|
-
import { buildProgram } from "../index.js";
|
|
8
|
-
|
|
9
|
-
function createTempConfig(contents: string): string {
|
|
10
|
-
const dir = mkdtempSync(join(tmpdir(), "zinkee-teamspace-"));
|
|
11
|
-
const filePath = join(dir, "config.toml");
|
|
12
|
-
writeFileSync(filePath, contents, "utf8");
|
|
13
|
-
return filePath;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function createApiConfig(): string {
|
|
17
|
-
return createTempConfig(`
|
|
18
|
-
default_profile = "prod"
|
|
19
|
-
|
|
20
|
-
[profiles.prod]
|
|
21
|
-
api_key = "teamspace-token-1234"
|
|
22
|
-
base_url = "https://api.zinkee.test"
|
|
23
|
-
`);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function createStdoutBuffer() {
|
|
27
|
-
let output = "";
|
|
28
|
-
|
|
29
|
-
return {
|
|
30
|
-
stdout: {
|
|
31
|
-
write(chunk: string) {
|
|
32
|
-
output += chunk;
|
|
33
|
-
return true;
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
read() {
|
|
37
|
-
return output;
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function jsonResponse(body: unknown, status: number = 200): Response {
|
|
43
|
-
return new Response(JSON.stringify(body), {
|
|
44
|
-
status,
|
|
45
|
-
headers: {
|
|
46
|
-
"content-type": "application/json",
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function createFetchMock() {
|
|
52
|
-
const fetchMock = vi.fn<typeof fetch>();
|
|
53
|
-
vi.stubGlobal("fetch", fetchMock);
|
|
54
|
-
return fetchMock;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function buildTeamspaceProgram(configPath: string, stdout: { write(chunk: string): unknown }) {
|
|
58
|
-
return buildProgram({ configPath, stdout });
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
afterEach(() => {
|
|
62
|
-
vi.unstubAllGlobals();
|
|
63
|
-
vi.restoreAllMocks();
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
describe("teamspace commands", () => {
|
|
67
|
-
it("registers the teamspace command group", () => {
|
|
68
|
-
const program = buildProgram();
|
|
69
|
-
|
|
70
|
-
expect(program.commands.some((command) => command.name() === "teamspace")).toBe(true);
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
it("lists teamspace folders with include-resources enabled", async () => {
|
|
74
|
-
const configPath = createApiConfig();
|
|
75
|
-
const output = createStdoutBuffer();
|
|
76
|
-
const fetchMock = createFetchMock();
|
|
77
|
-
fetchMock.mockResolvedValueOnce(
|
|
78
|
-
jsonResponse([
|
|
79
|
-
{
|
|
80
|
-
id: "folder-1",
|
|
81
|
-
name: "Shared",
|
|
82
|
-
resources: [{ id: "resource-1", name: "Spec" }],
|
|
83
|
-
},
|
|
84
|
-
]),
|
|
85
|
-
);
|
|
86
|
-
const program = buildTeamspaceProgram(configPath, output.stdout);
|
|
87
|
-
|
|
88
|
-
await program.parseAsync([
|
|
89
|
-
"node",
|
|
90
|
-
"zinkee",
|
|
91
|
-
"--json",
|
|
92
|
-
"teamspace",
|
|
93
|
-
"folders",
|
|
94
|
-
"list",
|
|
95
|
-
"--include-resources",
|
|
96
|
-
]);
|
|
97
|
-
|
|
98
|
-
expect(fetchMock.mock.calls[0]?.[0]).toBe(
|
|
99
|
-
"https://api.zinkee.test/api/v2/teamspaces/folders?include=resources",
|
|
100
|
-
);
|
|
101
|
-
expect(JSON.parse(output.read())).toEqual({
|
|
102
|
-
data: [
|
|
103
|
-
{
|
|
104
|
-
id: "folder-1",
|
|
105
|
-
name: "Shared",
|
|
106
|
-
resources: [{ id: "resource-1", name: "Spec" }],
|
|
107
|
-
},
|
|
108
|
-
],
|
|
109
|
-
meta: {
|
|
110
|
-
command: "teamspace folders list",
|
|
111
|
-
configPath,
|
|
112
|
-
},
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
it("gets a teamspace folder with include-resources enabled", async () => {
|
|
117
|
-
const configPath = createApiConfig();
|
|
118
|
-
const output = createStdoutBuffer();
|
|
119
|
-
const fetchMock = createFetchMock();
|
|
120
|
-
fetchMock.mockResolvedValueOnce(
|
|
121
|
-
jsonResponse([
|
|
122
|
-
{
|
|
123
|
-
id: "11111111-1111-1111-1111-111111111111",
|
|
124
|
-
name: "Shared",
|
|
125
|
-
resources: [{ id: "resource-1", name: "Spec" }],
|
|
126
|
-
},
|
|
127
|
-
]),
|
|
128
|
-
);
|
|
129
|
-
const program = buildTeamspaceProgram(configPath, output.stdout);
|
|
130
|
-
|
|
131
|
-
await program.parseAsync([
|
|
132
|
-
"node",
|
|
133
|
-
"zinkee",
|
|
134
|
-
"--json",
|
|
135
|
-
"teamspace",
|
|
136
|
-
"folders",
|
|
137
|
-
"get",
|
|
138
|
-
"11111111-1111-1111-1111-111111111111",
|
|
139
|
-
"--include-resources",
|
|
140
|
-
]);
|
|
141
|
-
|
|
142
|
-
expect(fetchMock.mock.calls[0]?.[0]).toBe(
|
|
143
|
-
"https://api.zinkee.test/api/v2/teamspaces/folders?include=resources",
|
|
144
|
-
);
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
it("shapes publish and unpublish payloads for teamspace resources", async () => {
|
|
148
|
-
const configPath = createApiConfig();
|
|
149
|
-
const output = createStdoutBuffer();
|
|
150
|
-
const fetchMock = createFetchMock();
|
|
151
|
-
fetchMock
|
|
152
|
-
.mockResolvedValueOnce(
|
|
153
|
-
jsonResponse([
|
|
154
|
-
{
|
|
155
|
-
id: "folder-1",
|
|
156
|
-
name: "Shared",
|
|
157
|
-
},
|
|
158
|
-
]),
|
|
159
|
-
)
|
|
160
|
-
.mockResolvedValueOnce(jsonResponse({ id: "publish-1" }))
|
|
161
|
-
.mockResolvedValueOnce(jsonResponse({ id: "unpublish-1" }));
|
|
162
|
-
const program = buildTeamspaceProgram(configPath, output.stdout);
|
|
163
|
-
|
|
164
|
-
await program.parseAsync([
|
|
165
|
-
"node",
|
|
166
|
-
"zinkee",
|
|
167
|
-
"--json",
|
|
168
|
-
"teamspace",
|
|
169
|
-
"resources",
|
|
170
|
-
"publish",
|
|
171
|
-
"resource-1",
|
|
172
|
-
"--to",
|
|
173
|
-
"Shared",
|
|
174
|
-
]);
|
|
175
|
-
|
|
176
|
-
const publishInit = fetchMock.mock.calls[1]?.[1];
|
|
177
|
-
|
|
178
|
-
expect(fetchMock.mock.calls[1]?.[0]).toBe(
|
|
179
|
-
"https://api.zinkee.test/api/v2/teamspaces/resources:publish",
|
|
180
|
-
);
|
|
181
|
-
expect(publishInit?.method).toBe("POST");
|
|
182
|
-
expect(JSON.parse(String(publishInit?.body))).toEqual({
|
|
183
|
-
resourceId: "resource-1",
|
|
184
|
-
targetFolderId: "folder-1",
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
await program.parseAsync([
|
|
188
|
-
"node",
|
|
189
|
-
"zinkee",
|
|
190
|
-
"--json",
|
|
191
|
-
"teamspace",
|
|
192
|
-
"resources",
|
|
193
|
-
"unpublish",
|
|
194
|
-
"resource-1",
|
|
195
|
-
]);
|
|
196
|
-
|
|
197
|
-
const unpublishInit = fetchMock.mock.calls[2]?.[1];
|
|
198
|
-
|
|
199
|
-
expect(fetchMock.mock.calls[2]?.[0]).toBe(
|
|
200
|
-
"https://api.zinkee.test/api/v2/teamspaces/resources:unpublish",
|
|
201
|
-
);
|
|
202
|
-
expect(unpublishInit?.method).toBe("POST");
|
|
203
|
-
expect(JSON.parse(String(unpublishInit?.body))).toEqual({
|
|
204
|
-
resourceId: "resource-1",
|
|
205
|
-
});
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
it("blocks teamspace writes in read-only mode", async () => {
|
|
209
|
-
const configPath = createApiConfig();
|
|
210
|
-
const output = createStdoutBuffer();
|
|
211
|
-
const fetchMock = createFetchMock();
|
|
212
|
-
const program = buildTeamspaceProgram(configPath, output.stdout);
|
|
213
|
-
|
|
214
|
-
await expect(
|
|
215
|
-
program.parseAsync([
|
|
216
|
-
"node",
|
|
217
|
-
"zinkee",
|
|
218
|
-
"--read-only",
|
|
219
|
-
"teamspace",
|
|
220
|
-
"folders",
|
|
221
|
-
"create",
|
|
222
|
-
"--name",
|
|
223
|
-
"Shared",
|
|
224
|
-
]),
|
|
225
|
-
).rejects.toThrowError('Command "teamspace folders create" is not allowed in read-only mode.');
|
|
226
|
-
|
|
227
|
-
expect(fetchMock).not.toHaveBeenCalled();
|
|
228
|
-
});
|
|
229
|
-
});
|