@indigoai-us/hq-cli 5.77.13 → 5.78.0
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/CHANGELOG.md +34 -0
- package/assets/scaffold/core/scripts/archive-old-threads.sh +86 -0
- package/assets/scaffold/core/scripts/backfill-company-skill-mirrors.sh +73 -0
- package/assets/scaffold/core/scripts/backfill-workspace-mirror.sh +51 -0
- package/assets/scaffold/core/scripts/codex-skill-bridge.sh +550 -0
- package/assets/scaffold/core/scripts/detect-stale-core-policy-mirror.sh +185 -0
- package/assets/scaffold/core/scripts/hq-status-summary.sh +187 -0
- package/assets/scaffold/core/scripts/ontology-readme-drift.sh +264 -0
- package/assets/scaffold/core/scripts/qmd-reindex-after-sync.sh +93 -0
- package/assets/scaffold/core/scripts/rebuild-all-indexes.sh +69 -0
- package/assets/scaffold/core/scripts/rebuild-companies-index.sh +206 -0
- package/assets/scaffold/core/scripts/rebuild-company-knowledge-index.sh +127 -0
- package/assets/scaffold/core/scripts/rebuild-orchestrator-index.sh +86 -0
- package/assets/scaffold/core/scripts/rebuild-projects-index.sh +105 -0
- package/assets/scaffold/core/scripts/rebuild-public-knowledge-index.sh +83 -0
- package/assets/scaffold/core/scripts/rebuild-reports-index.sh +114 -0
- package/assets/scaffold/core/scripts/rebuild-social-drafts-index.sh +135 -0
- package/assets/scaffold/core/scripts/rebuild-threads-index.sh +82 -0
- package/assets/scaffold/core/scripts/rebuild-workers-index.sh +97 -0
- package/assets/scaffold/core/scripts/resize-screenshot.sh +47 -0
- package/assets/scaffold/core/scripts/token-usage-report.sh +254 -0
- package/assets/scaffold/core/scripts/worktree.sh +136 -0
- package/dist/commands/agents.js +28 -12
- package/dist/commands/api-keys.js +100 -20
- package/dist/commands/core.d.ts +90 -0
- package/dist/commands/core.js +279 -0
- package/dist/commands/files-browse.d.ts +21 -0
- package/dist/commands/files-browse.js +145 -24
- package/dist/commands/files.js +33 -7
- package/dist/commands/members.js +16 -5
- package/dist/commands/pack-install.d.ts +14 -0
- package/dist/commands/pack-install.js +51 -2
- package/dist/commands/pkg-install.js +43 -0
- package/dist/commands/run.js +8 -0
- package/dist/commands/secrets.js +125 -65
- package/dist/main.js +6 -0
- package/dist/utils/api-key-command-gate.d.ts +45 -0
- package/dist/utils/api-key-command-gate.js +51 -0
- package/dist/utils/hq-roots.d.ts +91 -0
- package/dist/utils/hq-roots.js +212 -0
- package/dist/utils/resolve-vault-credential.d.ts +63 -3
- package/dist/utils/resolve-vault-credential.js +152 -6
- package/dist/utils/run-bundled-script.d.ts +66 -0
- package/dist/utils/run-bundled-script.js +80 -0
- package/dist/utils/vault-api.d.ts +21 -0
- package/dist/utils/vault-api.js +74 -3
- package/package.json +7 -1
- package/.claude/policies/hq-cli-interactive-reads-use-sts-vend.md +0 -49
- package/.github/workflows/ci.yml +0 -46
- package/.github/workflows/publish.yml +0 -36
- package/.github/workflows/scripts/smoke-test-pkg.sh +0 -97
- package/e2e/cli.test.ts +0 -128
- package/eslint.config.js +0 -37
- package/pnpm-workspace.yaml +0 -4
- package/scripts/chmod-bins.mjs +0 -49
- package/scripts/generate-dsn.mjs +0 -26
- package/scripts/generate-scan-packages-table.mjs +0 -113
- package/scripts/smoke-sources-signals.sh +0 -103
- package/src/bin/hq-auth-refresh.ts +0 -43
- package/src/cli-version.ts +0 -13
- package/src/commands/__fixtures__/make-tar.ts +0 -126
- package/src/commands/_patterns.ts +0 -10
- package/src/commands/add.ts +0 -75
- package/src/commands/agents.test.ts +0 -527
- package/src/commands/agents.ts +0 -923
- package/src/commands/api-keys.test.ts +0 -291
- package/src/commands/api-keys.ts +0 -382
- package/src/commands/artifact-verify.test.ts +0 -177
- package/src/commands/auth.test.ts +0 -82
- package/src/commands/auth.ts +0 -213
- package/src/commands/billing.test.ts +0 -158
- package/src/commands/billing.ts +0 -146
- package/src/commands/channels.test.ts +0 -74
- package/src/commands/channels.ts +0 -91
- package/src/commands/cloud-demote.test.ts +0 -401
- package/src/commands/cloud-demote.ts +0 -278
- package/src/commands/cloud-provision.test.ts +0 -1117
- package/src/commands/cloud-provision.ts +0 -942
- package/src/commands/cloud.pull-all.test.ts +0 -711
- package/src/commands/cloud.pull-per-company.test.ts +0 -188
- package/src/commands/cloud.push-all.test.ts +0 -485
- package/src/commands/cloud.scope-excluded-warning.test.ts +0 -22
- package/src/commands/cloud.selectors.test.ts +0 -208
- package/src/commands/cloud.status.test.ts +0 -160
- package/src/commands/cloud.test.ts +0 -41
- package/src/commands/cloud.ts +0 -2130
- package/src/commands/company.test.ts +0 -202
- package/src/commands/company.ts +0 -148
- package/src/commands/creators.test.ts +0 -60
- package/src/commands/creators.ts +0 -117
- package/src/commands/crm.test.ts +0 -179
- package/src/commands/crm.ts +0 -236
- package/src/commands/db-migrate.ts +0 -55
- package/src/commands/db-provision.ts +0 -114
- package/src/commands/db-sql.ts +0 -124
- package/src/commands/db-status.ts +0 -108
- package/src/commands/db.ts +0 -26
- package/src/commands/dm.test.ts +0 -748
- package/src/commands/dm.ts +0 -1226
- package/src/commands/feedback.test.ts +0 -413
- package/src/commands/feedback.ts +0 -169
- package/src/commands/files-browse.test.ts +0 -1249
- package/src/commands/files-browse.ts +0 -1506
- package/src/commands/files-delete.test.ts +0 -484
- package/src/commands/files-recovery.test.ts +0 -370
- package/src/commands/files.test.ts +0 -722
- package/src/commands/files.ts +0 -1446
- package/src/commands/group-grants.test.ts +0 -330
- package/src/commands/group-grants.ts +0 -455
- package/src/commands/groups.test.ts +0 -44
- package/src/commands/groups.ts +0 -368
- package/src/commands/integrations.test.ts +0 -633
- package/src/commands/integrations.ts +0 -507
- package/src/commands/list.ts +0 -85
- package/src/commands/login.ts +0 -52
- package/src/commands/logout.ts +0 -30
- package/src/commands/marketplace-install.test.ts +0 -543
- package/src/commands/marketplace-security.test.ts +0 -646
- package/src/commands/mcp-registration.test.ts +0 -2787
- package/src/commands/mcp-registration.ts +0 -2612
- package/src/commands/mcp-status.test.ts +0 -483
- package/src/commands/mcp-status.ts +0 -575
- package/src/commands/mcp-status.us011.test.ts +0 -243
- package/src/commands/meetings.test.ts +0 -522
- package/src/commands/meetings.ts +0 -789
- package/src/commands/members.test.ts +0 -1474
- package/src/commands/members.ts +0 -1181
- package/src/commands/onboard-identity-guard.test.ts +0 -99
- package/src/commands/onboard-identity-guard.ts +0 -103
- package/src/commands/onboard-join.test.ts +0 -96
- package/src/commands/onboard-join.ts +0 -101
- package/src/commands/onboard-warning.test.ts +0 -26
- package/src/commands/onboard-warning.ts +0 -12
- package/src/commands/onboard.ts +0 -267
- package/src/commands/outposts-heartbeat.test.ts +0 -299
- package/src/commands/outposts-heartbeat.ts +0 -310
- package/src/commands/outposts-replica-sync.test.ts +0 -272
- package/src/commands/outposts-self-deploy.test.ts +0 -243
- package/src/commands/outposts.test.ts +0 -1039
- package/src/commands/outposts.ts +0 -1935
- package/src/commands/pack-install-secret-authorization.test.ts +0 -115
- package/src/commands/pack-install.test.ts +0 -1469
- package/src/commands/pack-install.ts +0 -2247
- package/src/commands/pack-update-cache.test.ts +0 -149
- package/src/commands/packs.test.ts +0 -88
- package/src/commands/packs.ts +0 -622
- package/src/commands/people.test.ts +0 -807
- package/src/commands/people.ts +0 -422
- package/src/commands/pkg-install.dispatch.test.ts +0 -71
- package/src/commands/pkg-install.ts +0 -215
- package/src/commands/pkg-list.test.ts +0 -79
- package/src/commands/pkg-list.ts +0 -13
- package/src/commands/pkg-remove.ts +0 -71
- package/src/commands/pkg-update.ts +0 -189
- package/src/commands/publish.test.ts +0 -650
- package/src/commands/publish.ts +0 -580
- package/src/commands/reindex.test.ts +0 -259
- package/src/commands/reindex.ts +0 -274
- package/src/commands/rescue.test.ts +0 -39
- package/src/commands/rescue.ts +0 -210
- package/src/commands/run.env-local.test.ts +0 -88
- package/src/commands/run.test.ts +0 -45
- package/src/commands/run.ts +0 -184
- package/src/commands/safe-extract.test.ts +0 -459
- package/src/commands/safe-extract.ts +0 -444
- package/src/commands/secrets-scope.test.ts +0 -56
- package/src/commands/secrets-scope.ts +0 -32
- package/src/commands/secrets.parse-destination.test.ts +0 -38
- package/src/commands/secrets.test.ts +0 -2037
- package/src/commands/secrets.ts +0 -2240
- package/src/commands/signals.ts +0 -351
- package/src/commands/skill.test.ts +0 -770
- package/src/commands/skill.ts +0 -796
- package/src/commands/sources.ts +0 -362
- package/src/commands/sync-mode.test.ts +0 -366
- package/src/commands/sync-mode.ts +0 -387
- package/src/commands/sync-narrow.test.ts +0 -633
- package/src/commands/sync-narrow.ts +0 -555
- package/src/commands/sync.ts +0 -165
- package/src/commands/team-sync.ts +0 -628
- package/src/commands/update.ts +0 -71
- package/src/commands/whoami.ts +0 -83
- package/src/commands/workers.test.ts +0 -158
- package/src/commands/workers.ts +0 -301
- package/src/index.test.ts +0 -32
- package/src/index.ts +0 -20
- package/src/lib/db/control-plane.test.ts +0 -59
- package/src/lib/db/control-plane.ts +0 -113
- package/src/lib/db/local.test.ts +0 -81
- package/src/lib/db/local.ts +0 -148
- package/src/lib/db/migrate.test.ts +0 -133
- package/src/lib/db/migrate.ts +0 -137
- package/src/lib/db/paths.test.ts +0 -112
- package/src/lib/db/paths.ts +0 -128
- package/src/lib/db/remote-engine.test.ts +0 -44
- package/src/lib/db/remote-engine.ts +0 -148
- package/src/lib/db/remote-sql.test.ts +0 -32
- package/src/lib/db/remote-sql.ts +0 -62
- package/src/lib/db/sql.test.ts +0 -106
- package/src/lib/db/sql.ts +0 -192
- package/src/lib/hq-cloud-dep.smoke.test.ts +0 -75
- package/src/lib/local-tree-diff.test.ts +0 -301
- package/src/lib/local-tree-diff.ts +0 -362
- package/src/lib/narrow-hint-banner.test.ts +0 -235
- package/src/lib/narrow-hint-banner.ts +0 -212
- package/src/lib/plan-limit-nag.test.ts +0 -317
- package/src/lib/plan-limit-nag.ts +0 -264
- package/src/main.ts +0 -371
- package/src/node-preflight.test.ts +0 -60
- package/src/node-preflight.ts +0 -67
- package/src/outpost/session-heartbeat-bounds.test.ts +0 -195
- package/src/outpost/session-heartbeat-guard.test.ts +0 -105
- package/src/outpost/session-heartbeat-publisher.test.ts +0 -178
- package/src/outpost/session-heartbeat-publisher.ts +0 -186
- package/src/outpost/session-heartbeat-retain-guard.test.ts +0 -126
- package/src/outpost/session-heartbeat.test.ts +0 -459
- package/src/outpost/session-heartbeat.ts +0 -877
- package/src/packaging.test.ts +0 -109
- package/src/run/__fixtures__/discover-schemas/example.env.schema +0 -4
- package/src/run/discover-schemas.test.ts +0 -153
- package/src/run/discover-schemas.ts +0 -79
- package/src/run/hq-plugin.test.ts +0 -371
- package/src/run/hq-plugin.ts +0 -277
- package/src/run/varlock-shape.test.ts +0 -57
- package/src/schemas/hq-package.schema.json +0 -155
- package/src/sentry-before-send.test.ts +0 -359
- package/src/sentry-before-send.ts +0 -221
- package/src/sentry-epipe.test.ts +0 -37
- package/src/sentry-release.test.ts +0 -54
- package/src/sentry.test.ts +0 -24
- package/src/sentry.ts +0 -54
- package/src/strategies/link.ts +0 -62
- package/src/strategies/merge.ts +0 -142
- package/src/types.ts +0 -146
- package/src/utils/__fixtures__/scan-packages.generated-block.sh +0 -23
- package/src/utils/auth-error.test.ts +0 -40
- package/src/utils/auth-error.ts +0 -42
- package/src/utils/billing-gate.test.ts +0 -95
- package/src/utils/billing-gate.ts +0 -228
- package/src/utils/breadcrumb-buffer.ts +0 -18
- package/src/utils/cli-telemetry.test.ts +0 -153
- package/src/utils/cli-telemetry.ts +0 -61
- package/src/utils/cognito-session.machine.test.ts +0 -109
- package/src/utils/cognito-session.refresh.test.ts +0 -84
- package/src/utils/cognito-session.test.ts +0 -328
- package/src/utils/cognito-session.ts +0 -448
- package/src/utils/company-selection-error.test.ts +0 -42
- package/src/utils/company-selection-error.ts +0 -45
- package/src/utils/contribution-table.ts +0 -83
- package/src/utils/environmental-error.test.ts +0 -45
- package/src/utils/environmental-error.ts +0 -39
- package/src/utils/epipe.test.ts +0 -28
- package/src/utils/epipe.ts +0 -29
- package/src/utils/expected-cli-error.test.ts +0 -28
- package/src/utils/expected-cli-error.ts +0 -39
- package/src/utils/feedback-diagnostics.test.ts +0 -183
- package/src/utils/feedback-diagnostics.ts +0 -123
- package/src/utils/feedback-screenshots.test.ts +0 -134
- package/src/utils/feedback-screenshots.ts +0 -124
- package/src/utils/feedback-versions.test.ts +0 -98
- package/src/utils/feedback-versions.ts +0 -68
- package/src/utils/git.ts +0 -74
- package/src/utils/integrity.ts +0 -59
- package/src/utils/intercepted-process-exit.test.ts +0 -37
- package/src/utils/intercepted-process-exit.ts +0 -36
- package/src/utils/login-provider.test.ts +0 -42
- package/src/utils/login-provider.ts +0 -30
- package/src/utils/manifest.test.ts +0 -167
- package/src/utils/manifest.ts +0 -131
- package/src/utils/pack-contributions.test.ts +0 -603
- package/src/utils/pack-contributions.ts +0 -450
- package/src/utils/people.ts +0 -215
- package/src/utils/registry-client.ts +0 -204
- package/src/utils/registry.ts +0 -90
- package/src/utils/resolve-vault-credential.test.ts +0 -69
- package/src/utils/resolve-vault-credential.ts +0 -60
- package/src/utils/sandbox-runner-client.test.ts +0 -279
- package/src/utils/sandbox-runner-client.ts +0 -260
- package/src/utils/secrets-cache.ts +0 -183
- package/src/utils/sentry-identity.ts +0 -45
- package/src/utils/settle-with-timeout.test.ts +0 -21
- package/src/utils/settle-with-timeout.ts +0 -22
- package/src/utils/user-yaml-error.test.ts +0 -24
- package/src/utils/user-yaml-error.ts +0 -30
- package/src/utils/vault-api.test.ts +0 -536
- package/src/utils/vault-api.ts +0 -382
- package/src/utils/version-check.test.ts +0 -176
- package/src/utils/version-check.ts +0 -155
- package/src/utils/version-gate.test.ts +0 -1024
- package/src/utils/version-gate.ts +0 -702
- package/test/commands/db-tenant-isolation.test.ts +0 -94
- package/test/commands/db.test.ts +0 -85
- package/test/commands/signals.test.ts +0 -207
- package/test/commands/sources.test.ts +0 -231
- package/test/e2e/smoke-install-mcp.sh +0 -113
- package/test/fixtures/hq-pack-smoke-mcp/mcp/smoke-http.json +0 -1
- package/test/fixtures/hq-pack-smoke-mcp/package.yaml +0 -11
- package/test/fixtures/signals/action_item/sample.md +0 -16
- package/test/fixtures/signals/summary/sample.md +0 -12
- package/test/fixtures/sources/meetings/sample.md +0 -25
- package/test/helpers/cli-runner.ts +0 -150
- package/test/helpers/s3-list-mock.ts +0 -79
- package/test/helpers/vault-service-mock.ts +0 -295
- package/test/sources-signals/smoke.test.ts +0 -228
- package/tsconfig.json +0 -20
- package/vitest.config.ts +0 -11
- package/vitest.e2e.config.ts +0 -7
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* generate-scan-packages-table.mjs (US-003)
|
|
4
|
-
*
|
|
5
|
-
* Emits the bash data block that `core/scripts/scan-packages.sh` reads, from the
|
|
6
|
-
* single-source `src/utils/contribution-table.ts`. This keeps the bash wirer
|
|
7
|
-
* GENERATED FROM the table rather than restating the mapping -- the US-003
|
|
8
|
-
* single-source-of-truth invariant.
|
|
9
|
-
*
|
|
10
|
-
* The TS table is the authority; this script transcribes it to bash. It does
|
|
11
|
-
* NOT parse TypeScript -- it imports the same literal data by re-declaring the
|
|
12
|
-
* rows is avoided by reading the table via a tiny regex extraction of the
|
|
13
|
-
* `CONTRIBUTION_TABLE` object literal, so the table file stays the only place
|
|
14
|
-
* the rows live.
|
|
15
|
-
*
|
|
16
|
-
* Output: a bash snippet (to stdout, or written in place into scan-packages.sh
|
|
17
|
-
* between the BEGIN/END GENERATED markers when --write <path> is passed).
|
|
18
|
-
*
|
|
19
|
-
* Usage:
|
|
20
|
-
* node scripts/generate-scan-packages-table.mjs # print block
|
|
21
|
-
* node scripts/generate-scan-packages-table.mjs --check <path> # verify in-sync
|
|
22
|
-
* node scripts/generate-scan-packages-table.mjs --write <path> # rewrite in place
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
import * as fs from 'fs';
|
|
26
|
-
import * as path from 'path';
|
|
27
|
-
import { fileURLToPath } from 'url';
|
|
28
|
-
|
|
29
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
30
|
-
const TABLE_TS = path.resolve(__dirname, '../src/utils/contribution-table.ts');
|
|
31
|
-
|
|
32
|
-
const BEGIN = '# >>> BEGIN GENERATED contribution table (US-003) — do not edit by hand';
|
|
33
|
-
const END = '# <<< END GENERATED contribution table';
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Extract the rows from the `CONTRIBUTION_TABLE` object literal in the TS file.
|
|
37
|
-
* Each row line looks like:
|
|
38
|
-
* key: { payload: 'p/{item}', host: 'h', wire: 'symlink' },
|
|
39
|
-
*/
|
|
40
|
-
function readTable() {
|
|
41
|
-
const ts = fs.readFileSync(TABLE_TS, 'utf-8');
|
|
42
|
-
const open = ts.indexOf('export const CONTRIBUTION_TABLE');
|
|
43
|
-
if (open < 0) throw new Error('CONTRIBUTION_TABLE not found in ' + TABLE_TS);
|
|
44
|
-
const body = ts.slice(open, ts.indexOf('} as const', open));
|
|
45
|
-
const rowRe =
|
|
46
|
-
/^\s*([A-Za-z_][A-Za-z0-9_]*):\s*\{\s*payload:\s*'([^']+)'\s*,\s*host:\s*'([^']+)'\s*,\s*wire:\s*'([^']+)'\s*\}/gm;
|
|
47
|
-
const rows = [];
|
|
48
|
-
let m;
|
|
49
|
-
while ((m = rowRe.exec(body)) !== null) {
|
|
50
|
-
rows.push({ key: m[1], payload: m[2], host: m[3], wire: m[4] });
|
|
51
|
-
}
|
|
52
|
-
if (rows.length === 0) throw new Error('No rows parsed from CONTRIBUTION_TABLE');
|
|
53
|
-
return rows;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function renderBlock(rows) {
|
|
57
|
-
const lines = [];
|
|
58
|
-
lines.push(BEGIN);
|
|
59
|
-
lines.push('# Generated from hq-cli/src/utils/contribution-table.ts by');
|
|
60
|
-
lines.push('# hq-cli/scripts/generate-scan-packages-table.mjs. Regenerate with:');
|
|
61
|
-
lines.push('# node scripts/generate-scan-packages-table.mjs --write core/scripts/scan-packages.sh');
|
|
62
|
-
lines.push('# Each row is "payload|host|wire" (payload uses {item} for the name).');
|
|
63
|
-
lines.push('# bash 3.2-compatible (macOS default bash has no associative arrays):');
|
|
64
|
-
lines.push('# a plain indexed key list + a generated case-lookup function.');
|
|
65
|
-
lines.push('CONTRIB_KEYS=(' + rows.map((r) => r.key).join(' ') + ')');
|
|
66
|
-
lines.push('# contrib_row <key> -> echoes "payload|host|wire", empty if unknown.');
|
|
67
|
-
lines.push('contrib_row() {');
|
|
68
|
-
lines.push(' case "$1" in');
|
|
69
|
-
for (const r of rows) {
|
|
70
|
-
lines.push(` ${r.key}) printf '%s' '${r.payload}|${r.host}|${r.wire}' ;;`);
|
|
71
|
-
}
|
|
72
|
-
lines.push(" *) return 0 ;;");
|
|
73
|
-
lines.push(' esac');
|
|
74
|
-
lines.push('}');
|
|
75
|
-
lines.push(END);
|
|
76
|
-
return lines.join('\n');
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function splice(scriptText, block) {
|
|
80
|
-
const b = scriptText.indexOf(BEGIN);
|
|
81
|
-
const e = scriptText.indexOf(END);
|
|
82
|
-
if (b < 0 || e < 0) {
|
|
83
|
-
throw new Error('BEGIN/END GENERATED markers not found in target script');
|
|
84
|
-
}
|
|
85
|
-
const before = scriptText.slice(0, b);
|
|
86
|
-
const after = scriptText.slice(e + END.length);
|
|
87
|
-
return before + block + after;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
const rows = readTable();
|
|
91
|
-
const block = renderBlock(rows);
|
|
92
|
-
|
|
93
|
-
const arg = process.argv[2];
|
|
94
|
-
const target = process.argv[3];
|
|
95
|
-
|
|
96
|
-
if (arg === '--write') {
|
|
97
|
-
const text = fs.readFileSync(target, 'utf-8');
|
|
98
|
-
fs.writeFileSync(target, splice(text, block));
|
|
99
|
-
console.error(`Wrote generated contribution table into ${target}`);
|
|
100
|
-
} else if (arg === '--check') {
|
|
101
|
-
const text = fs.readFileSync(target, 'utf-8');
|
|
102
|
-
const expected = splice(text, block);
|
|
103
|
-
if (expected !== text) {
|
|
104
|
-
console.error(
|
|
105
|
-
`OUT OF SYNC: ${target} differs from contribution-table.ts. ` +
|
|
106
|
-
`Run: node scripts/generate-scan-packages-table.mjs --write ${target}`,
|
|
107
|
-
);
|
|
108
|
-
process.exit(1);
|
|
109
|
-
}
|
|
110
|
-
console.error(`${target} is in sync with the contribution table.`);
|
|
111
|
-
} else {
|
|
112
|
-
process.stdout.write(block + '\n');
|
|
113
|
-
}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
#
|
|
3
|
-
# smoke-sources-signals.sh — end-to-end verification of `hq sources` /
|
|
4
|
-
# `hq signals` against a real vault bucket. Owned by US-008 of the
|
|
5
|
-
# hq-cli-sources-signals PRD.
|
|
6
|
-
#
|
|
7
|
-
# Usage:
|
|
8
|
-
# # 1. Make sure you have a working Cognito session OR export a token:
|
|
9
|
-
# hq whoami # interactive Cognito login if needed
|
|
10
|
-
# # or: export HQ_ACCESS_TOKEN="$(...)" # service-account JWT bypass
|
|
11
|
-
#
|
|
12
|
-
# # 2. Run the smoke against an entity slug you have access to (default: indigo):
|
|
13
|
-
# ./scripts/smoke-sources-signals.sh # uses ENTITY=indigo
|
|
14
|
-
# ENTITY=personal ./scripts/smoke-sources-signals.sh
|
|
15
|
-
#
|
|
16
|
-
# Behavior:
|
|
17
|
-
# Runs four CLI invocations, each asserted to exit 0 AND produce parseable
|
|
18
|
-
# JSON (where --format json is used). Stdout from each invocation is
|
|
19
|
-
# appended to a temp file; the script prints a summary table at the end.
|
|
20
|
-
#
|
|
21
|
-
# Exit codes:
|
|
22
|
-
# 0 all four invocations succeeded and produced valid JSON
|
|
23
|
-
# 1 one or more invocations failed (script aborts on first failure with set -e)
|
|
24
|
-
#
|
|
25
|
-
# Dependencies:
|
|
26
|
-
# - hq (built locally via `pnpm --filter @indigoai-us/hq-cli build`, or
|
|
27
|
-
# `npx @indigoai-us/hq-cli@rc ...` against a published rc)
|
|
28
|
-
# - jq (for JSON validation)
|
|
29
|
-
#
|
|
30
|
-
|
|
31
|
-
set -euo pipefail
|
|
32
|
-
|
|
33
|
-
ENTITY="${ENTITY:-indigo}"
|
|
34
|
-
LIMIT="${LIMIT:-5}"
|
|
35
|
-
HQ_BIN="${HQ_BIN:-hq}"
|
|
36
|
-
|
|
37
|
-
# Resolve workspace-local journal location for capturing output. The
|
|
38
|
-
# operator running this script may redirect the script's stdout to a journal
|
|
39
|
-
# file under companies/indigo/projects/hq-cli-sources-signals/journal/.
|
|
40
|
-
SMOKE_TMP="$(mktemp -d -t hq-smoke-XXXXXX)"
|
|
41
|
-
trap 'rm -rf "$SMOKE_TMP"' EXIT
|
|
42
|
-
|
|
43
|
-
echo "==> hq sources/signals smoke for entity=$ENTITY limit=$LIMIT"
|
|
44
|
-
echo " binary: $HQ_BIN"
|
|
45
|
-
echo " tmpdir: $SMOKE_TMP"
|
|
46
|
-
echo
|
|
47
|
-
|
|
48
|
-
require_cmd() {
|
|
49
|
-
if ! command -v "$1" >/dev/null 2>&1; then
|
|
50
|
-
echo "ERROR: required command '$1' not found in PATH" >&2
|
|
51
|
-
exit 1
|
|
52
|
-
fi
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
require_cmd "$HQ_BIN"
|
|
56
|
-
require_cmd jq
|
|
57
|
-
|
|
58
|
-
# --- 1. entities -----------------------------------------------------------
|
|
59
|
-
echo "[1/4] hq sources entities"
|
|
60
|
-
"$HQ_BIN" sources entities --format json > "$SMOKE_TMP/entities.json"
|
|
61
|
-
jq -e 'type == "array"' "$SMOKE_TMP/entities.json" > /dev/null
|
|
62
|
-
ENTITY_COUNT=$(jq 'length' "$SMOKE_TMP/entities.json")
|
|
63
|
-
echo " ok — $ENTITY_COUNT entity/entities visible"
|
|
64
|
-
echo
|
|
65
|
-
|
|
66
|
-
# --- 2. sources channels (no auth required) --------------------------------
|
|
67
|
-
echo "[2/4] hq sources channels"
|
|
68
|
-
"$HQ_BIN" sources channels > "$SMOKE_TMP/channels.txt"
|
|
69
|
-
grep -qx 'meeting' "$SMOKE_TMP/channels.txt"
|
|
70
|
-
grep -qx 'email' "$SMOKE_TMP/channels.txt"
|
|
71
|
-
grep -qx 'slack' "$SMOKE_TMP/channels.txt"
|
|
72
|
-
grep -qx 'linear' "$SMOKE_TMP/channels.txt"
|
|
73
|
-
grep -qx 'notion' "$SMOKE_TMP/channels.txt"
|
|
74
|
-
echo " ok — all five canonical channels present"
|
|
75
|
-
echo
|
|
76
|
-
|
|
77
|
-
# --- 3. sources list --type meeting (the headline acceptance criterion) ---
|
|
78
|
-
echo "[3/4] hq sources list --entity $ENTITY --type meeting --limit $LIMIT --format json"
|
|
79
|
-
"$HQ_BIN" sources list \
|
|
80
|
-
--entity "$ENTITY" \
|
|
81
|
-
--type meeting \
|
|
82
|
-
--limit "$LIMIT" \
|
|
83
|
-
--format json > "$SMOKE_TMP/sources-list.json"
|
|
84
|
-
jq -e '.entries | type == "array"' "$SMOKE_TMP/sources-list.json" > /dev/null
|
|
85
|
-
SOURCE_COUNT=$(jq '.entries | length' "$SMOKE_TMP/sources-list.json")
|
|
86
|
-
echo " ok — $SOURCE_COUNT meeting source(s) listed"
|
|
87
|
-
echo
|
|
88
|
-
|
|
89
|
-
# --- 4. signals list --type action_item (the other headline) --------------
|
|
90
|
-
echo "[4/4] hq signals list --entity $ENTITY --type action_item --limit $LIMIT --format json"
|
|
91
|
-
"$HQ_BIN" signals list \
|
|
92
|
-
--entity "$ENTITY" \
|
|
93
|
-
--type action_item \
|
|
94
|
-
--limit "$LIMIT" \
|
|
95
|
-
--format json > "$SMOKE_TMP/signals-list.json"
|
|
96
|
-
jq -e '.entries | type == "array"' "$SMOKE_TMP/signals-list.json" > /dev/null
|
|
97
|
-
SIGNAL_COUNT=$(jq '.entries | length' "$SMOKE_TMP/signals-list.json")
|
|
98
|
-
echo " ok — $SIGNAL_COUNT action_item signal(s) listed"
|
|
99
|
-
echo
|
|
100
|
-
|
|
101
|
-
echo "==> SMOKE PASSED"
|
|
102
|
-
echo " entities=$ENTITY_COUNT meeting_sources=$SOURCE_COUNT action_item_signals=$SIGNAL_COUNT"
|
|
103
|
-
echo " raw outputs preserved in $SMOKE_TMP until process exit"
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Standalone `hq-auth-refresh` entry point.
|
|
5
|
-
*
|
|
6
|
-
* Exists so the deploy skill (.claude/skills/deploy/SKILL.md step 4) can
|
|
7
|
-
* shell out to a plain binary instead of a subcommand. Equivalent to
|
|
8
|
-
* `hq auth refresh`.
|
|
9
|
-
*
|
|
10
|
-
* Exit 0 if a valid session is ensured now (healthy cache hit, refresh, or
|
|
11
|
-
* machine-token mint). Exit 1 if no valid session could be ensured
|
|
12
|
-
* non-interactively.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
// MUST be first: guard the Node version before any dependency that needs a
|
|
16
|
-
// Node 20+ API (e.g. util.styleText) or a newer native ABI is evaluated.
|
|
17
|
-
import "../node-preflight.js";
|
|
18
|
-
import { initSentry, Sentry } from "../sentry.js";
|
|
19
|
-
import { refreshCachedSession } from "../utils/cognito-session.js";
|
|
20
|
-
|
|
21
|
-
initSentry();
|
|
22
|
-
|
|
23
|
-
(async () => {
|
|
24
|
-
let exitCode = 1;
|
|
25
|
-
try {
|
|
26
|
-
const result = await refreshCachedSession();
|
|
27
|
-
if (result.refreshed) {
|
|
28
|
-
exitCode = 0;
|
|
29
|
-
} else {
|
|
30
|
-
if (result.reason) {
|
|
31
|
-
process.stderr.write(`hq-auth-refresh: ${result.reason}\n`);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
} catch (err) {
|
|
35
|
-
Sentry.captureException(err);
|
|
36
|
-
process.stderr.write(
|
|
37
|
-
`hq-auth-refresh: ${err instanceof Error ? err.message : String(err)}\n`,
|
|
38
|
-
);
|
|
39
|
-
} finally {
|
|
40
|
-
await Sentry.flush(2000);
|
|
41
|
-
process.exit(exitCode);
|
|
42
|
-
}
|
|
43
|
-
})();
|
package/src/cli-version.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from "node:fs";
|
|
2
|
-
import { fileURLToPath } from "node:url";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
|
|
5
|
-
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
6
|
-
const pkgPath = path.resolve(here, "..", "package.json");
|
|
7
|
-
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8")) as {
|
|
8
|
-
name: string;
|
|
9
|
-
version: string;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export const CLI_NAME: string = pkg.name;
|
|
13
|
-
export const CLI_VERSION: string = pkg.version;
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Deterministic, platform-independent malicious-tar fixture builder.
|
|
3
|
-
*
|
|
4
|
-
* WHY THIS EXISTS (cross-platform zip-slip coverage). The adversarial
|
|
5
|
-
* safe-extract / marketplace-security suites need archives that GENUINELY carry
|
|
6
|
-
* hostile entries — a `../` traversal name, an absolute path, an escaping
|
|
7
|
-
* symlink/hardlink. The obvious approach (shell out to the system `tar` to
|
|
8
|
-
* CREATE the archive) is NOT portable: GNU tar (Linux / CI / prod Lambdas)
|
|
9
|
-
* STRIPS the leading `../` and absolute `/` when it WRITES an archive, so the
|
|
10
|
-
* resulting "malicious" fixture contains a benign `evil-escape` entry and the
|
|
11
|
-
* guard has nothing to reject — the test passes on macOS bsdtar (which
|
|
12
|
-
* preserves them) but fails on Linux. The guard itself is correct; only the
|
|
13
|
-
* fixture construction was platform-dependent.
|
|
14
|
-
*
|
|
15
|
-
* Fix: WRITE THE TAR BYTES DIRECTLY here. A tar archive is just a sequence of
|
|
16
|
-
* 512-byte ustar headers, each optionally followed by the file's content padded
|
|
17
|
-
* to a 512-byte boundary, terminated by two zero blocks. By emitting the bytes
|
|
18
|
-
* ourselves we control the recorded entry names verbatim — `../evil-escape`,
|
|
19
|
-
* `/tmp/evil`, a symlink with linkname `../../etc/passwd` — identically on every
|
|
20
|
-
* platform, with no create-time stripping. The reading side (`tar -tvf`, which
|
|
21
|
-
* safeExtractTarball's pre-flight uses) does NOT strip anything; it faithfully
|
|
22
|
-
* lists whatever bytes we wrote, so the guard sees the real attack everywhere.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
import { gzipSync } from 'node:zlib';
|
|
26
|
-
import * as fs from 'node:fs';
|
|
27
|
-
|
|
28
|
-
const BLOCK = 512;
|
|
29
|
-
|
|
30
|
-
/** ustar typeflag values we use. */
|
|
31
|
-
export type TarType = 'file' | 'symlink' | 'hardlink';
|
|
32
|
-
|
|
33
|
-
const TYPEFLAG: Record<TarType, string> = {
|
|
34
|
-
file: '0', // regular file
|
|
35
|
-
symlink: '2', // symbolic link
|
|
36
|
-
hardlink: '1', // hard link
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export interface TarEntrySpec {
|
|
40
|
-
/** Recorded entry name — written VERBATIM (may contain `..`, be absolute…). */
|
|
41
|
-
name: string;
|
|
42
|
-
type?: TarType; // default 'file'
|
|
43
|
-
/** For sym/hardlinks: the recorded link target (also written verbatim). */
|
|
44
|
-
linkname?: string;
|
|
45
|
-
/** File content (regular files only). */
|
|
46
|
-
content?: string | Buffer;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/** Write an ASCII string into a fixed-width field at `offset`, NUL-padded. */
|
|
50
|
-
function writeField(buf: Buffer, offset: number, width: number, value: string): void {
|
|
51
|
-
// Truncate defensively; ustar fields are fixed-width.
|
|
52
|
-
const s = value.slice(0, width);
|
|
53
|
-
buf.write(s, offset, 'ascii');
|
|
54
|
-
// Remaining bytes are already 0 from Buffer.alloc.
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/** Write an octal numeric field: `width-1` octal digits, space-or-NUL terminated. */
|
|
58
|
-
function writeOctal(buf: Buffer, offset: number, width: number, value: number): void {
|
|
59
|
-
// Classic ustar numeric field: zero-padded octal in (width-1) chars + NUL.
|
|
60
|
-
const digits = width - 1;
|
|
61
|
-
const oct = value.toString(8).padStart(digits, '0').slice(-digits);
|
|
62
|
-
buf.write(oct, offset, 'ascii');
|
|
63
|
-
buf[offset + digits] = 0; // NUL terminator
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Build one 512-byte ustar header (plus content blocks for regular files) for a
|
|
68
|
-
* single entry. The header checksum is computed exactly per spec: sum every
|
|
69
|
-
* header byte treating the 8 checksum bytes themselves as ASCII spaces, then
|
|
70
|
-
* write that sum as 6 octal digits + NUL + space.
|
|
71
|
-
*/
|
|
72
|
-
export function makeTarEntry(spec: TarEntrySpec): Buffer {
|
|
73
|
-
const type = spec.type ?? 'file';
|
|
74
|
-
const content =
|
|
75
|
-
type === 'file'
|
|
76
|
-
? Buffer.isBuffer(spec.content)
|
|
77
|
-
? spec.content
|
|
78
|
-
: Buffer.from(spec.content ?? '', 'utf-8')
|
|
79
|
-
: Buffer.alloc(0); // links carry no content payload
|
|
80
|
-
|
|
81
|
-
const header = Buffer.alloc(BLOCK); // zero-filled
|
|
82
|
-
|
|
83
|
-
writeField(header, 0, 100, spec.name); // name
|
|
84
|
-
writeOctal(header, 100, 8, 0o644); // mode
|
|
85
|
-
writeOctal(header, 108, 8, 0); // uid
|
|
86
|
-
writeOctal(header, 116, 8, 0); // gid
|
|
87
|
-
writeOctal(header, 124, 12, content.length); // size (0 for links)
|
|
88
|
-
writeOctal(header, 136, 12, 0); // mtime (deterministic: epoch)
|
|
89
|
-
// checksum field (148, 8) — filled below; start as spaces for the sum.
|
|
90
|
-
header.fill(' '.charCodeAt(0), 148, 156);
|
|
91
|
-
writeField(header, 156, 1, TYPEFLAG[type]); // typeflag
|
|
92
|
-
if (spec.linkname !== undefined) {
|
|
93
|
-
writeField(header, 157, 100, spec.linkname); // linkname (verbatim)
|
|
94
|
-
}
|
|
95
|
-
writeField(header, 257, 6, 'ustar'); // magic "ustar\0"
|
|
96
|
-
writeField(header, 263, 2, '00'); // version "00"
|
|
97
|
-
// uname/gname left empty; devmajor/devminor zero (already NUL).
|
|
98
|
-
|
|
99
|
-
// Header checksum: unsigned sum of all 512 bytes (with the checksum field as
|
|
100
|
-
// spaces, which we set above). Written as 6 octal digits, NUL, space.
|
|
101
|
-
let sum = 0;
|
|
102
|
-
for (let i = 0; i < BLOCK; i++) sum += header[i];
|
|
103
|
-
const cksum = sum.toString(8).padStart(6, '0').slice(-6);
|
|
104
|
-
header.write(cksum, 148, 'ascii');
|
|
105
|
-
header[154] = 0; // NUL
|
|
106
|
-
header[155] = ' '.charCodeAt(0); // space
|
|
107
|
-
|
|
108
|
-
if (type !== 'file' || content.length === 0) return header;
|
|
109
|
-
|
|
110
|
-
// Content padded up to a 512-byte boundary.
|
|
111
|
-
const pad = (BLOCK - (content.length % BLOCK)) % BLOCK;
|
|
112
|
-
return Buffer.concat([header, content, Buffer.alloc(pad)]);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/** Concatenate entries and append the two zero blocks that end every tar. */
|
|
116
|
-
export function makeTar(entries: TarEntrySpec[]): Buffer {
|
|
117
|
-
const blocks = entries.map(makeTarEntry);
|
|
118
|
-
blocks.push(Buffer.alloc(BLOCK * 2)); // end-of-archive marker
|
|
119
|
-
return Buffer.concat(blocks);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/** Build the tar, gzip it, and write it to `outPath`. Returns `outPath`. */
|
|
123
|
-
export function writeMaliciousTarGz(outPath: string, entries: TarEntrySpec[]): string {
|
|
124
|
-
fs.writeFileSync(outPath, gzipSync(makeTar(entries)));
|
|
125
|
-
return outPath;
|
|
126
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export const SECRET_NAME_PATTERN = /^[A-Z][A-Z0-9_]*(?:\/[A-Z][A-Z0-9_]+)*$/;
|
|
2
|
-
export const GROUP_ID_PATTERN = /^grp_[A-Za-z0-9_-]+$/;
|
|
3
|
-
export const EMAIL_PATTERN = /^[^\s]+@[^\s]+$/;
|
|
4
|
-
|
|
5
|
-
export function normalizeFilePrefix(prefix: string): string {
|
|
6
|
-
if (prefix.endsWith("/")) {
|
|
7
|
-
return prefix + "*";
|
|
8
|
-
}
|
|
9
|
-
return prefix;
|
|
10
|
-
}
|
package/src/commands/add.ts
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* hq modules add command (US-003)
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { Command } from 'commander';
|
|
6
|
-
import { findHqRoot, addModule, parseRepoName, isValidRepoUrl } from '../utils/manifest.js';
|
|
7
|
-
import type { LegacyModuleDefinition, LegacyStrategy } from '../types.js';
|
|
8
|
-
|
|
9
|
-
export function registerAddCommand(program: Command): void {
|
|
10
|
-
program
|
|
11
|
-
.command('add <repo-url>')
|
|
12
|
-
.description('Add a module to the manifest')
|
|
13
|
-
.option('--as <name>', 'Module name (defaults to repo name)')
|
|
14
|
-
.option('--branch <branch>', 'Git branch to track', 'main')
|
|
15
|
-
.option('--strategy <strategy>', 'Sync strategy: link | merge | copy', 'link')
|
|
16
|
-
.option('--path <mapping>', 'Path mapping src:dest (can repeat)', (val, prev: string[]) => [...prev, val], [])
|
|
17
|
-
.action(async (repoUrl: string, options: {
|
|
18
|
-
as?: string;
|
|
19
|
-
branch: string;
|
|
20
|
-
strategy: string;
|
|
21
|
-
path: string[];
|
|
22
|
-
}) => {
|
|
23
|
-
try {
|
|
24
|
-
// Validate repo URL
|
|
25
|
-
if (!isValidRepoUrl(repoUrl)) {
|
|
26
|
-
console.error('Error: Invalid repo URL. Must start with https:// or git@');
|
|
27
|
-
process.exit(1);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Parse name
|
|
31
|
-
const name = options.as || parseRepoName(repoUrl);
|
|
32
|
-
|
|
33
|
-
// Validate strategy (hq modules add is for legacy git-repo modules;
|
|
34
|
-
// content packs are added via `hq install`, not `hq modules add`)
|
|
35
|
-
const validStrategies: LegacyStrategy[] = ['link', 'merge', 'copy'];
|
|
36
|
-
if (!validStrategies.includes(options.strategy as LegacyStrategy)) {
|
|
37
|
-
console.error(`Error: Invalid strategy "${options.strategy}". Use: ${validStrategies.join(', ')}`);
|
|
38
|
-
process.exit(1);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Parse path mappings
|
|
42
|
-
const paths = options.path.length > 0
|
|
43
|
-
? options.path.map(p => {
|
|
44
|
-
const [src, dest] = p.split(':');
|
|
45
|
-
if (!src || !dest) {
|
|
46
|
-
throw new Error(`Invalid path mapping: ${p}. Format: src:dest`);
|
|
47
|
-
}
|
|
48
|
-
return { src, dest };
|
|
49
|
-
})
|
|
50
|
-
: [{ src: '.', dest: `workers/${name}` }]; // Default: entire repo to workers/
|
|
51
|
-
|
|
52
|
-
const module: LegacyModuleDefinition = {
|
|
53
|
-
name,
|
|
54
|
-
repo: repoUrl,
|
|
55
|
-
branch: options.branch,
|
|
56
|
-
strategy: options.strategy as LegacyStrategy,
|
|
57
|
-
paths,
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const hqRoot = findHqRoot();
|
|
61
|
-
addModule(hqRoot, module);
|
|
62
|
-
|
|
63
|
-
console.log(`Added module "${name}"`);
|
|
64
|
-
console.log(` Repo: ${repoUrl}`);
|
|
65
|
-
console.log(` Branch: ${options.branch}`);
|
|
66
|
-
console.log(` Strategy: ${options.strategy}`);
|
|
67
|
-
console.log(` Paths: ${paths.map(p => `${p.src} -> ${p.dest}`).join(', ')}`);
|
|
68
|
-
console.log('\nRun "hq modules sync" to fetch and sync the module.');
|
|
69
|
-
|
|
70
|
-
} catch (error) {
|
|
71
|
-
console.error('Error:', error instanceof Error ? error.message : error);
|
|
72
|
-
process.exit(1);
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
}
|