@indigoai-us/hq-cli 5.345.123 → 5.345.124

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.
@@ -11627,6 +11627,46 @@ export const COMMAND_CATALOG = [
11627
11627
  "options": [],
11628
11628
  "subcommands": []
11629
11629
  },
11630
+ {
11631
+ "name": "work-mesh-project-registration-offer",
11632
+ "description": "Check and record the work-mesh project registration offer",
11633
+ "aliases": [],
11634
+ "hidden": false,
11635
+ "helpOption": false,
11636
+ "helpCommand": false,
11637
+ "usage": "[args...]",
11638
+ "helpText": [],
11639
+ "arguments": [
11640
+ {
11641
+ "name": "args",
11642
+ "required": false,
11643
+ "variadic": true,
11644
+ "description": "arguments passed through to the script"
11645
+ }
11646
+ ],
11647
+ "options": [],
11648
+ "subcommands": []
11649
+ },
11650
+ {
11651
+ "name": "workflow-gate",
11652
+ "description": "Inspect, answer, and wait for workflow gates",
11653
+ "aliases": [],
11654
+ "hidden": false,
11655
+ "helpOption": false,
11656
+ "helpCommand": false,
11657
+ "usage": "[args...]",
11658
+ "helpText": [],
11659
+ "arguments": [
11660
+ {
11661
+ "name": "args",
11662
+ "required": false,
11663
+ "variadic": true,
11664
+ "description": "arguments passed through to the script"
11665
+ }
11666
+ ],
11667
+ "options": [],
11668
+ "subcommands": []
11669
+ },
11630
11670
  {
11631
11671
  "name": "checkpoint-stop-gate",
11632
11672
  "description": "Stop-hook checkpoint + company-scope gate (reads the hook payload on stdin)",
@@ -12640,6 +12680,11 @@ export const COMMAND_CATALOG = [
12640
12680
  "description": "Assign a person or agent uid, yourself, or clear",
12641
12681
  "hidden": false
12642
12682
  },
12683
+ {
12684
+ "flags": "--force",
12685
+ "description": "Override another holder's assignment",
12686
+ "hidden": false
12687
+ },
12643
12688
  {
12644
12689
  "flags": "--company <slug|uid>",
12645
12690
  "description": "Company slug or cloud uid",
@@ -12663,6 +12708,167 @@ export const COMMAND_CATALOG = [
12663
12708
  ],
12664
12709
  "subcommands": []
12665
12710
  },
12711
+ {
12712
+ "name": "claim",
12713
+ "description": "Assign a story to yourself and move it to in_progress",
12714
+ "aliases": [],
12715
+ "hidden": false,
12716
+ "helpOption": true,
12717
+ "helpCommand": false,
12718
+ "usage": "[options]",
12719
+ "helpText": [],
12720
+ "arguments": [],
12721
+ "options": [
12722
+ {
12723
+ "flags": "--story <id>",
12724
+ "description": "Story id, e.g. US-001",
12725
+ "hidden": false
12726
+ },
12727
+ {
12728
+ "flags": "--force",
12729
+ "description": "Take the story even when someone else holds it",
12730
+ "hidden": false
12731
+ },
12732
+ {
12733
+ "flags": "--company <slug|uid>",
12734
+ "description": "Company slug or cloud uid",
12735
+ "hidden": false
12736
+ },
12737
+ {
12738
+ "flags": "--project <slug>",
12739
+ "description": "HQ project slug / projectId",
12740
+ "hidden": false
12741
+ },
12742
+ {
12743
+ "flags": "--thread-id <id>",
12744
+ "description": "Explicit work thread id",
12745
+ "hidden": false
12746
+ },
12747
+ {
12748
+ "flags": "--json",
12749
+ "description": "Print machine-readable JSON",
12750
+ "hidden": false
12751
+ }
12752
+ ],
12753
+ "subcommands": []
12754
+ },
12755
+ {
12756
+ "name": "overlap",
12757
+ "description": "List other sessions working on the same story, branch, or files",
12758
+ "aliases": [],
12759
+ "hidden": false,
12760
+ "helpOption": true,
12761
+ "helpCommand": false,
12762
+ "usage": "[options]",
12763
+ "helpText": [],
12764
+ "arguments": [],
12765
+ "options": [
12766
+ {
12767
+ "flags": "--company <slug|uid>",
12768
+ "description": "Company slug or cloud uid",
12769
+ "hidden": false
12770
+ },
12771
+ {
12772
+ "flags": "--session <sid>",
12773
+ "description": "Your session id",
12774
+ "hidden": false
12775
+ },
12776
+ {
12777
+ "flags": "--repo <name>",
12778
+ "description": "Repository name",
12779
+ "hidden": false
12780
+ },
12781
+ {
12782
+ "flags": "--branch <branch>",
12783
+ "description": "Current branch",
12784
+ "hidden": false
12785
+ },
12786
+ {
12787
+ "flags": "--project <id>",
12788
+ "description": "Project id",
12789
+ "hidden": false
12790
+ },
12791
+ {
12792
+ "flags": "--story <id>",
12793
+ "description": "Story id",
12794
+ "hidden": false
12795
+ },
12796
+ {
12797
+ "flags": "--file <path>",
12798
+ "description": "Repo-relative file you are changing (repeatable)",
12799
+ "hidden": false
12800
+ },
12801
+ {
12802
+ "flags": "--files-json <json>",
12803
+ "description": "JSON array of repo-relative file paths",
12804
+ "hidden": false
12805
+ },
12806
+ {
12807
+ "flags": "--json",
12808
+ "description": "Print machine-readable JSON",
12809
+ "hidden": false
12810
+ }
12811
+ ],
12812
+ "subcommands": []
12813
+ },
12814
+ {
12815
+ "name": "suggest",
12816
+ "description": "Rank teammates and agents to pick up a story",
12817
+ "aliases": [],
12818
+ "hidden": false,
12819
+ "helpOption": true,
12820
+ "helpCommand": false,
12821
+ "usage": "[options]",
12822
+ "helpText": [],
12823
+ "arguments": [],
12824
+ "options": [
12825
+ {
12826
+ "flags": "--company <slug|uid>",
12827
+ "description": "Company slug or cloud uid",
12828
+ "hidden": false
12829
+ },
12830
+ {
12831
+ "flags": "--project <id>",
12832
+ "description": "Project id",
12833
+ "hidden": false
12834
+ },
12835
+ {
12836
+ "flags": "--story <id>",
12837
+ "description": "Story id",
12838
+ "hidden": false
12839
+ },
12840
+ {
12841
+ "flags": "--json",
12842
+ "description": "Print machine-readable JSON",
12843
+ "hidden": false
12844
+ }
12845
+ ],
12846
+ "subcommands": []
12847
+ },
12848
+ {
12849
+ "name": "roster",
12850
+ "description": "Show each member's daemon and session reporting state",
12851
+ "aliases": [],
12852
+ "hidden": false,
12853
+ "helpOption": true,
12854
+ "helpCommand": false,
12855
+ "usage": "[options]",
12856
+ "helpText": [],
12857
+ "arguments": [],
12858
+ "options": [
12859
+ {
12860
+ "flags": "--company <slug|uid>",
12861
+ "description": "Company slug or cloud uid",
12862
+ "hidden": false
12863
+ },
12864
+ {
12865
+ "flags": "--json",
12866
+ "description": "Print machine-readable JSON",
12867
+ "hidden": false
12868
+ }
12869
+ ],
12870
+ "subcommands": []
12871
+ },
12666
12872
  {
12667
12873
  "name": "project",
12668
12874
  "description": "Set a project Board view or register its project channel",
@@ -12864,6 +13070,52 @@ export const COMMAND_CATALOG = [
12864
13070
  ],
12865
13071
  "subcommands": []
12866
13072
  },
13073
+ {
13074
+ "name": "reassign",
13075
+ "description": "Move project ownership to another person or agent",
13076
+ "aliases": [],
13077
+ "hidden": false,
13078
+ "helpOption": true,
13079
+ "helpCommand": false,
13080
+ "usage": "[options] <projectId>",
13081
+ "helpText": [],
13082
+ "arguments": [
13083
+ {
13084
+ "name": "projectId",
13085
+ "required": true,
13086
+ "variadic": false,
13087
+ "description": ""
13088
+ }
13089
+ ],
13090
+ "options": [
13091
+ {
13092
+ "flags": "--company <slug|uid>",
13093
+ "description": "Company slug or cloud uid",
13094
+ "hidden": false
13095
+ },
13096
+ {
13097
+ "flags": "--to <uid|email|name>",
13098
+ "description": "New owner (uid, email, or directory name)",
13099
+ "hidden": false
13100
+ },
13101
+ {
13102
+ "flags": "--include-open-stories",
13103
+ "description": "Also reassign the project's open stories",
13104
+ "hidden": false
13105
+ },
13106
+ {
13107
+ "flags": "--note <text>",
13108
+ "description": "Handoff note",
13109
+ "hidden": false
13110
+ },
13111
+ {
13112
+ "flags": "--json",
13113
+ "description": "Print machine-readable JSON",
13114
+ "hidden": false
13115
+ }
13116
+ ],
13117
+ "subcommands": []
13118
+ },
12867
13119
  {
12868
13120
  "name": "member",
12869
13121
  "description": "Manage project members",
@@ -13141,6 +13393,45 @@ export const COMMAND_CATALOG = [
13141
13393
  ],
13142
13394
  "subcommands": []
13143
13395
  },
13396
+ {
13397
+ "name": "auto-bind",
13398
+ "description": "Bind a needs_project session to the project its repo and branch belong to (local-only, fail-open)",
13399
+ "aliases": [],
13400
+ "hidden": false,
13401
+ "helpOption": true,
13402
+ "helpCommand": false,
13403
+ "usage": "[options]",
13404
+ "helpText": [],
13405
+ "arguments": [],
13406
+ "options": [
13407
+ {
13408
+ "flags": "--session <sid>",
13409
+ "description": "Canonical session id",
13410
+ "hidden": false
13411
+ },
13412
+ {
13413
+ "flags": "--cwd <dir>",
13414
+ "description": "Working directory to read the repo and branch from",
13415
+ "hidden": false
13416
+ },
13417
+ {
13418
+ "flags": "--company <slug>",
13419
+ "description": "Company slug (defaults to the session's company)",
13420
+ "hidden": false
13421
+ },
13422
+ {
13423
+ "flags": "--dry-run",
13424
+ "description": "Print the decision without binding",
13425
+ "hidden": false
13426
+ },
13427
+ {
13428
+ "flags": "--json",
13429
+ "description": "Print machine-readable JSON",
13430
+ "hidden": false
13431
+ }
13432
+ ],
13433
+ "subcommands": []
13434
+ },
13144
13435
  {
13145
13436
  "name": "organize",
13146
13437
  "description": "List or submit one-time project/task decisions (US-007B / US-005B)",
@@ -0,0 +1,7 @@
1
+ export type WorkMeshOfferResult = {
2
+ code: number;
3
+ stdout: string;
4
+ stderr: string;
5
+ };
6
+ export declare function runWorkMeshProjectRegistrationOffer(args: readonly string[], root: string, env?: NodeJS.ProcessEnv): Promise<WorkMeshOfferResult>;
7
+ //# sourceMappingURL=core-bucket-c-work-mesh-offer-native.d.ts.map
@@ -0,0 +1,147 @@
1
+ import * as fs from "node:fs";
2
+ import * as path from "node:path";
3
+ import { loadCachedTokens } from "@indigoai-us/hq-cloud";
4
+ import { createFlagClient } from "@indigoai-us/hq-flags-client";
5
+ import { resolveFlagRegistryEndpoint } from "../lib/flag-registry-endpoint.js";
6
+ const success = (stdout) => ({ code: 0, stdout, stderr: "" });
7
+ const failure = (stderr) => ({ code: 1, stdout: "", stderr: `${stderr}\n` });
8
+ const COMPANY = /^[A-Za-z0-9_-]+$/;
9
+ const PROJECT = /^[A-Za-z0-9._-]+$/;
10
+ const COMPANY_UID = /^cmp_[A-Za-z0-9]{3,128}$/;
11
+ const OFFER_FLAG = "workmesh.offer-project-create-on-brainstorm";
12
+ function cloudUid(root, company) {
13
+ const file = path.join(root, "companies/manifest.yaml");
14
+ let text;
15
+ try {
16
+ text = fs.readFileSync(file, "utf8");
17
+ }
18
+ catch {
19
+ return "";
20
+ }
21
+ const lines = text.split(/\r?\n/);
22
+ let inCompanies = false;
23
+ let inCompany = false;
24
+ for (const line of lines) {
25
+ if (/^companies:\s*$/.test(line)) {
26
+ inCompanies = true;
27
+ continue;
28
+ }
29
+ if (inCompanies && /^[^\s]/.test(line)) {
30
+ inCompanies = false;
31
+ inCompany = false;
32
+ }
33
+ if (inCompanies && /^ {2}[^ #][^:]*:/.test(line)) {
34
+ const slug = line.trim().replace(/:$/, "");
35
+ inCompany = slug === company;
36
+ continue;
37
+ }
38
+ if (inCompany && /^ {2}[^\s#]/.test(line))
39
+ break;
40
+ if (inCompany && /^\s+cloud_uid:/.test(line))
41
+ return (line.split(":")[1] ?? "").trim().replace(/["']/g, "");
42
+ }
43
+ return "";
44
+ }
45
+ function boardFile(root, company) { return path.join(root, "companies", company, "board.json"); }
46
+ function matchingProjects(board, project) {
47
+ const rows = board?.projects;
48
+ if (!Array.isArray(rows))
49
+ return [];
50
+ return rows.filter((row) => Boolean(row && typeof row === "object" && (row.id === project || row.mesh_project_id === project)));
51
+ }
52
+ async function enabledForCompany(company, uid, env) {
53
+ const endpoint = resolveFlagRegistryEndpoint(undefined, env);
54
+ if (!endpoint || !COMPANY_UID.test(uid))
55
+ return false;
56
+ let client;
57
+ let failed = false;
58
+ const deadline = AbortSignal.timeout(150);
59
+ try {
60
+ client = createFlagClient({
61
+ endpoint,
62
+ companyUid: uid,
63
+ companyIdentifiers: [company],
64
+ getToken: () => loadCachedTokens()?.idToken ?? "",
65
+ refreshIntervalMs: 0,
66
+ requestTimeoutMs: 150,
67
+ onError: () => { failed = true; },
68
+ fetch: (input, init) => fetch(input, { ...init, signal: init?.signal ? AbortSignal.any([init.signal, deadline]) : deadline }),
69
+ });
70
+ await client.ready();
71
+ return !failed && !deadline.aborted && client.isEnabled(OFFER_FLAG, { fallback: false });
72
+ }
73
+ catch {
74
+ return false;
75
+ }
76
+ finally {
77
+ try {
78
+ client?.close();
79
+ }
80
+ catch { /* the shell helper defaults off on close failure */ }
81
+ }
82
+ }
83
+ function updatePromptState(root, company, project, state) {
84
+ const file = boardFile(root, company);
85
+ if (!fs.existsSync(file))
86
+ return failure(`no company board for ${company}`);
87
+ let board;
88
+ try {
89
+ board = JSON.parse(fs.readFileSync(file, "utf8"));
90
+ }
91
+ catch {
92
+ return failure(`no local Board project ${project} for ${company}`);
93
+ }
94
+ const rows = matchingProjects(board, project);
95
+ if (!rows.length)
96
+ return failure(`no local Board project ${project} for ${company}`);
97
+ const object = board;
98
+ object.projects = object.projects.map((row) => row.id === project || row.mesh_project_id === project ? { ...row, mesh_registration_prompt_state: state } : row);
99
+ const temp = path.join(path.dirname(file), `.board.json.${process.pid}.${Date.now()}.tmp`);
100
+ try {
101
+ fs.writeFileSync(temp, `${JSON.stringify(board, null, 2)}\n`);
102
+ fs.renameSync(temp, file);
103
+ }
104
+ catch (error) {
105
+ try {
106
+ fs.rmSync(temp, { force: true });
107
+ }
108
+ catch { /* ignore cleanup failure */ }
109
+ return failure(String(error.message));
110
+ }
111
+ return success("");
112
+ }
113
+ export async function runWorkMeshProjectRegistrationOffer(args, root, env = process.env) {
114
+ if (args.length === 3 && args[0] === "--check") {
115
+ const [, company, project] = args;
116
+ if (!COMPANY.test(company) || !PROJECT.test(project))
117
+ return failure("invalid company or project id");
118
+ const uid = cloudUid(root, company);
119
+ if (!uid || !COMPANY_UID.test(uid))
120
+ return success("local\n");
121
+ const file = boardFile(root, company);
122
+ let board;
123
+ try {
124
+ board = JSON.parse(fs.readFileSync(file, "utf8"));
125
+ }
126
+ catch {
127
+ return success("missing\n");
128
+ }
129
+ const [row] = matchingProjects(board, project);
130
+ if (!row)
131
+ return success("missing\n");
132
+ const registered = row.threadId !== undefined && row.threadId !== null && row.threadId !== ""
133
+ && row.channelId !== undefined && row.channelId !== null && row.channelId !== "";
134
+ const state = registered ? "registered" : String(row.mesh_registration_prompt_state ?? "offer");
135
+ if (["accepted", "deferred", "registered", "missing"].includes(state))
136
+ return success(`${state}\n`);
137
+ return success(`${await enabledForCompany(company, uid, env) ? "offer" : "off"}\n`);
138
+ }
139
+ if (args.length === 3 && (args[0] === "--accept" || args[0] === "--defer")) {
140
+ const [, company, project] = args;
141
+ if (!COMPANY.test(company) || !PROJECT.test(project))
142
+ return failure("invalid company or project id");
143
+ return updatePromptState(root, company, project, args[0] === "--accept" ? "accepted" : "deferred");
144
+ }
145
+ return failure("usage: work-mesh-project-registration-offer.sh --check <company> <project-id> | --accept <company> <project-id> | --defer <company> <project-id>");
146
+ }
147
+ //# sourceMappingURL=core-bucket-c-work-mesh-offer-native.js.map
@@ -0,0 +1,3 @@
1
+ export declare function runWorkflowGateFast(args: string[], _stdin: string, _cwd: string, root: string): Promise<number>;
2
+ export declare function runWorkMeshProjectRegistrationOfferFast(args: string[], _stdin: string, _cwd: string, root: string): Promise<number>;
3
+ //# sourceMappingURL=core-bucket-c-workflow-gate-fast.d.ts.map
@@ -0,0 +1,17 @@
1
+ import { runWorkflowGate } from "./core-bucket-c-workflow-gate-native.js";
2
+ import { runWorkMeshProjectRegistrationOffer } from "./core-bucket-c-work-mesh-offer-native.js";
3
+ async function emit(result) {
4
+ const output = await result;
5
+ if (output.stdout)
6
+ process.stdout.write(output.stdout);
7
+ if (output.stderr)
8
+ process.stderr.write(output.stderr);
9
+ return output.code;
10
+ }
11
+ export function runWorkflowGateFast(args, _stdin, _cwd, root) {
12
+ return emit(runWorkflowGate(args, root));
13
+ }
14
+ export function runWorkMeshProjectRegistrationOfferFast(args, _stdin, _cwd, root) {
15
+ return emit(runWorkMeshProjectRegistrationOffer(args, root));
16
+ }
17
+ //# sourceMappingURL=core-bucket-c-workflow-gate-fast.js.map
@@ -0,0 +1,7 @@
1
+ export type WorkflowGateResult = {
2
+ code: number;
3
+ stdout: string;
4
+ stderr: string;
5
+ };
6
+ export declare function runWorkflowGate(args: readonly string[], root: string, env?: NodeJS.ProcessEnv, now?: () => number, sleep?: () => Promise<void>): Promise<WorkflowGateResult>;
7
+ //# sourceMappingURL=core-bucket-c-workflow-gate-native.d.ts.map