@empirical-gauzza/cli 1.0.40 → 1.0.41

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/bin/empirical.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
 
3
3
  'use strict';
4
4
 
package/lib/constants.js CHANGED
@@ -352,13 +352,15 @@ A new interview is charged. \`setup abandon\` stops one but does not return what
352
352
  empirical workspace shape show --workspace-id <id>
353
353
  empirical workspace shape add-type "Reviewer" --workspace-id <id> --statuses "Not Yet Invited, Invited, Call Completed (done)" --fields "Email:text:required; Open to a call:select:Yes|No|Not asked; Wave:number" [--apply]
354
354
  empirical workspace shape add-status <type-key> "Declined" --done --workspace-id <id> [--apply]
355
+ empirical workspace shape add-status <type-key> "Call Scheduled" --after form_submitted --workspace-id <id> [--apply]
356
+ empirical workspace shape reorder-statuses <type-key> new,form_submitted,call_scheduled,call_held,won --workspace-id <id> [--apply]
355
357
  empirical workspace shape add-field <type-key> "Wave" --kind number --workspace-id <id> [--apply]
356
358
  empirical workspace shape edit --file <edit.json> [--mapping-file <m.json>] --workspace-id <id> [--apply]
357
359
  empirical workspace shape set --file <shape.json> --workspace-id <id> [--apply]
358
360
 
359
361
  The interview is the guided way and is charged. These are the direct way: you name the change and nothing is charged. Every change is a dry run until you add \`--apply\`: it is checked against the workspace's current shape, the result is printed, and with \`--apply\` it is saved only if the shape is still the one that was shown. You must manage the workspace; \`--apply\` needs \`--workspace-id\` written out, so a stale directory binding cannot aim a change at the wrong workspace.
360
362
 
361
- \`add-type\` on a workspace with no shape yet also needs \`--purpose "what this workspace is for"\` and creates its first shape. A kind of item with statuses must mark one as finished with \`(done)\`, and takes at most six fields. Field kinds: text, longText, number, date, select, multiSelect, person, link, url. \`--category\` and \`--node-type\` say how an item is stored as a memory (default project and entity). Keys are made from labels once and never change; refer to a type or status later by its key, which \`show\` prints in brackets.
363
+ \`add-type\` on a workspace with no shape yet also needs \`--purpose "what this workspace is for"\` and creates its first shape. A kind of item with statuses must mark one as finished with \`(done)\`, and takes at most six fields. Field kinds: text, longText, number, date, select, multiSelect, person, link, url. \`--category\` and \`--node-type\` say how an item is stored as a memory (default project and entity). Keys are made from labels once and never change; refer to a type or status later by its key, which \`show\` prints in brackets. A new status goes just before the first finished status unless \`--after <key>\` or \`--before <key>\` places it; \`reorder-statuses\` takes every status key of the type once, in the new order (the first status is where new items start). Neither moves any item.
362
364
 
363
365
  \`edit\` takes the server's merge format: \`{"itemTypes":{"add":[...],"update":[{"key":"reviewer","statuses":{"add":[{"label":"Declined","isDone":true}]}}],"remove":["old-type"]}}\`. Removing or renaming something that has stored values needs \`--mapping-file\` saying where those values go. To save an item into the shape: \`empirical memory record --category lead --summary "..." --item-type reviewer --item-status invited --field email=a@b.com\` (run with \`EMPIRICAL_WORKSPACE_ID=<id>\` or after \`workspace use\`).
364
366
 
package/lib/help.js CHANGED
@@ -53,7 +53,7 @@ function showHelp() {
53
53
  log(' Re-shape a team workspace you manage by interview. Without --workspace-id it');
54
54
  log(' confirms the workspace bound to this directory with you, at a terminal only;');
55
55
  log(' in a script or with --accept-cost it needs --workspace-id. A new interview is charged');
56
- log(' empirical workspace shape show|set|edit|add-type|add-status|add-field --workspace-id <id> ...');
56
+ log(' empirical workspace shape show|set|edit|add-type|add-status|add-field|reorder-statuses --workspace-id <id> ...');
57
57
  log(' Edit the item types, statuses and fields of a workspace by hand, with no interview and no');
58
58
  log(' charge. A dry run until --apply. Details: empirical doc workspace');
59
59
  log(' empirical workspace invite create [--role reader|writer|manager] [--expires-in-days <n>] [--max-uses <n>]');
@@ -6,7 +6,8 @@
6
6
  // empirical workspace shape set --workspace-id <id> --file <shape.json> [--apply]
7
7
  // empirical workspace shape edit --workspace-id <id> --file <edit.json> [--apply]
8
8
  // empirical workspace shape add-type --workspace-id <id> <label> [--statuses "A,B,C (done)"] ...
9
- // empirical workspace shape add-status --workspace-id <id> <type-key> <label> [--done]
9
+ // empirical workspace shape add-status --workspace-id <id> <type-key> <label> [--done] [--after <key> | --before <key>]
10
+ // empirical workspace shape reorder-statuses --workspace-id <id> <type-key> <key,key,...>
10
11
  // empirical workspace shape add-field --workspace-id <id> <type-key> <label> --kind <kind> ...
11
12
  //
12
13
  // The interview is charged (100 Empirical Tokens, plus 25 per change to a draft) and takes nine
@@ -16,23 +17,24 @@
16
17
  //
17
18
  // Every change is a DRY RUN until --apply. A change goes to /shape/preview first, which validates it
18
19
  // against the active shape and returns a confirmDigest; --apply sends that digest back, so an edit
19
- // is only ever applied to the shape that was shown. The commands here only ADD (a type, a status, a
20
- // field); removing needs a mapping for the stored values, which `edit --mapping-file` accepts.
20
+ // is only ever applied to the shape that was shown. The commands here ADD (a type, a status, a field)
21
+ // and REORDER statuses; removing needs a mapping for the stored values, which `edit --mapping-file`
22
+ // accepts. A new status goes just before the first finished one unless --after or --before says where.
21
23
 
22
24
  const fs = require('fs');
23
25
  const { log, warn } = require('./ui');
24
26
  const { httpJson } = require('./http');
25
27
  const { parseOption, parseFlag } = require('./env');
26
28
 
27
- const SHAPE_ACTIONS = ['show', 'set', 'edit', 'add-type', 'add-status', 'add-field'];
29
+ const SHAPE_ACTIONS = ['show', 'set', 'edit', 'add-type', 'add-status', 'add-field', 'reorder-statuses'];
28
30
  const FIELD_KINDS = ['text', 'longText', 'number', 'date', 'select', 'multiSelect', 'person', 'link', 'url'];
29
31
  const VALUE_OPTIONS = new Set([
30
32
  '--workspace-id', '--file', '--mapping-file', '--purpose', '--plural', '--category', '--node-type',
31
- '--icon', '--color', '--statuses', '--fields', '--nest-under', '--kind', '--options'
33
+ '--icon', '--color', '--statuses', '--fields', '--nest-under', '--kind', '--options', '--after', '--before'
32
34
  ]);
33
35
 
34
36
  const SHAPE_USAGE = [
35
- 'Usage: empirical workspace shape <show|set|edit|add-type|add-status|add-field> --workspace-id <id> ...',
37
+ 'Usage: empirical workspace shape <show|set|edit|add-type|add-status|add-field|reorder-statuses> --workspace-id <id> ...',
36
38
  ' show print the workspace\'s item types, statuses and fields',
37
39
  ' set --file <shape.json> [--apply] give a workspace with no shape its first shape',
38
40
  ' edit --file <edit.json> [--mapping-file <m.json>] [--apply]',
@@ -40,7 +42,9 @@ const SHAPE_USAGE = [
40
42
  ' add-type <label> [--statuses "A,B,C (done)"] [--fields "Email:text:required;Wave:number"]',
41
43
  ' [--plural <label>] [--category <cat>] [--node-type <type>] [--icon <i>] [--color <c>]',
42
44
  ' [--nest-under <type-key,...>] [--purpose <text>] (--purpose only when the workspace has no shape yet)',
43
- ' add-status <type-key> <label> [--done]',
45
+ ' add-status <type-key> <label> [--done] [--after <status-key> | --before <status-key>]',
46
+ ' without --after/--before it goes just before the first finished status',
47
+ ' reorder-statuses <type-key> <key,key,...> every status key of that type once, in the new order',
44
48
  ' add-field <type-key> <label> [--kind text|longText|number|date|select|multiSelect|person|link|url]',
45
49
  ' [--required] [--options "Yes|No|Not asked"]',
46
50
  'Changes are a dry run until you add --apply. Running the interview instead: `empirical workspace shape` with no action.'
@@ -116,8 +120,15 @@ function buildTypeFromFlags(args, label) {
116
120
  return type;
117
121
  }
118
122
 
119
- function buildAddStatusEdit(typeKey, label, isDone) {
120
- return { itemTypes: { update: [{ key: typeKey, statuses: { add: [isDone ? { label, isDone: true } : { label }] } }] } };
123
+ function buildAddStatusEdit(typeKey, label, isDone, position = {}) {
124
+ const status = isDone ? { label, isDone: true } : { label };
125
+ if (position.after) status.after = position.after;
126
+ if (position.before) status.before = position.before;
127
+ return { itemTypes: { update: [{ key: typeKey, statuses: { add: [status] } }] } };
128
+ }
129
+
130
+ function buildReorderStatusesEdit(typeKey, keys) {
131
+ return { itemTypes: { update: [{ key: typeKey, statuses: { order: keys } }] } };
121
132
  }
122
133
 
123
134
  function buildAddFieldEdit(typeKey, field) {
@@ -278,8 +289,18 @@ async function runManualShapeCommand({ args, baseUrl, authHeaders, resolveBound
278
289
 
279
290
  if (action === 'add-status') {
280
291
  const [typeKey, label] = positionals(args);
281
- if (!typeKey || !label) throw new Error('Usage: empirical workspace shape add-status <type-key> <label> [--done] --workspace-id <id> [--apply]');
282
- return previewAndMaybeApply({ baseUrl, workspaceId, authHeaders, edit: buildAddStatusEdit(typeKey, label, parseFlag(args, '--done')), mapping, apply, asJson });
292
+ if (!typeKey || !label) throw new Error('Usage: empirical workspace shape add-status <type-key> <label> [--done] [--after <key> | --before <key>] --workspace-id <id> [--apply]');
293
+ const after = parseOption(args, '--after', '');
294
+ const before = parseOption(args, '--before', '');
295
+ if (after && before) throw new Error('Use --after or --before, not both.');
296
+ return previewAndMaybeApply({ baseUrl, workspaceId, authHeaders, edit: buildAddStatusEdit(typeKey, label, parseFlag(args, '--done'), { after, before }), mapping, apply, asJson });
297
+ }
298
+
299
+ if (action === 'reorder-statuses') {
300
+ const [typeKey, list] = positionals(args);
301
+ const keys = String(list || '').split(',').map((k) => k.trim()).filter(Boolean);
302
+ if (!typeKey || !keys.length) throw new Error('Usage: empirical workspace shape reorder-statuses <type-key> <key,key,...> --workspace-id <id> [--apply] (`shape show` prints the keys)');
303
+ return previewAndMaybeApply({ baseUrl, workspaceId, authHeaders, edit: buildReorderStatusesEdit(typeKey, keys), mapping, apply, asJson });
283
304
  }
284
305
 
285
306
  if (action === 'add-field') {
@@ -307,6 +328,7 @@ module.exports = {
307
328
  parseFieldList,
308
329
  buildTypeFromFlags,
309
330
  buildAddStatusEdit,
331
+ buildReorderStatusesEdit,
310
332
  buildAddFieldEdit,
311
333
  formatShape,
312
334
  runManualShapeCommand
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@empirical-gauzza/cli",
3
- "version": "1.0.40",
3
+ "version": "1.0.41",
4
4
  "description": "Persistent cross-tool memory for AI agents. Give Claude Code, Codex, Copilot, Cursor, and ChatGPT one shared memory: save project context once, recall it everywhere via CLI or MCP.",
5
5
  "keywords": [
6
6
  "memory",