chief-helm 0.1.1
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 +220 -0
- package/dist/commands/config.d.ts +26 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +111 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/inputs.d.ts +21 -0
- package/dist/commands/inputs.d.ts.map +1 -0
- package/dist/commands/inputs.js +158 -0
- package/dist/commands/inputs.js.map +1 -0
- package/dist/commands/push.d.ts +21 -0
- package/dist/commands/push.d.ts.map +1 -0
- package/dist/commands/push.js +51 -0
- package/dist/commands/push.js.map +1 -0
- package/dist/commands/secrets.d.ts +21 -0
- package/dist/commands/secrets.d.ts.map +1 -0
- package/dist/commands/secrets.js +110 -0
- package/dist/commands/secrets.js.map +1 -0
- package/dist/commands/setup.d.ts +24 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +421 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/status.d.ts +20 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +184 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/sync.d.ts +19 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +47 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/core/config.d.ts +74 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +182 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/git.d.ts +73 -0
- package/dist/core/git.d.ts.map +1 -0
- package/dist/core/git.js +188 -0
- package/dist/core/git.js.map +1 -0
- package/dist/core/inputs.d.ts +40 -0
- package/dist/core/inputs.d.ts.map +1 -0
- package/dist/core/inputs.js +360 -0
- package/dist/core/inputs.js.map +1 -0
- package/dist/core/repo.d.ts +71 -0
- package/dist/core/repo.d.ts.map +1 -0
- package/dist/core/repo.js +152 -0
- package/dist/core/repo.js.map +1 -0
- package/dist/core/secrets.d.ts +79 -0
- package/dist/core/secrets.d.ts.map +1 -0
- package/dist/core/secrets.js +168 -0
- package/dist/core/secrets.js.map +1 -0
- package/dist/core/state.d.ts +46 -0
- package/dist/core/state.d.ts.map +1 -0
- package/dist/core/state.js +119 -0
- package/dist/core/state.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +163 -0
- package/dist/index.js.map +1 -0
- package/dist/types/index.d.ts +210 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +10 -0
- package/dist/types/index.js.map +1 -0
- package/dist/ui/components/Header.d.ts +32 -0
- package/dist/ui/components/Header.d.ts.map +1 -0
- package/dist/ui/components/Header.js +15 -0
- package/dist/ui/components/Header.js.map +1 -0
- package/dist/ui/components/Panel.d.ts +30 -0
- package/dist/ui/components/Panel.d.ts.map +1 -0
- package/dist/ui/components/Panel.js +15 -0
- package/dist/ui/components/Panel.js.map +1 -0
- package/dist/ui/components/StatusRow.d.ts +39 -0
- package/dist/ui/components/StatusRow.d.ts.map +1 -0
- package/dist/ui/components/StatusRow.js +27 -0
- package/dist/ui/components/StatusRow.js.map +1 -0
- package/dist/ui/theme.d.ts +60 -0
- package/dist/ui/theme.d.ts.map +1 -0
- package/dist/ui/theme.js +60 -0
- package/dist/ui/theme.js.map +1 -0
- package/dist/utils/errors.d.ts +50 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +63 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/format.d.ts +66 -0
- package/dist/utils/format.d.ts.map +1 -0
- package/dist/utils/format.js +107 -0
- package/dist/utils/format.js.map +1 -0
- package/dist/utils/logger.d.ts +35 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +71 -0
- package/dist/utils/logger.js.map +1 -0
- package/package.json +53 -0
package/Readme.md
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
# HELM
|
|
2
|
+
|
|
3
|
+
**Human-AI Executive Layer Manager** — the command-line interface for [CHIEF](../SETUP.md).
|
|
4
|
+
|
|
5
|
+
HELM is how a human operates the CHIEF personal AI operations system. Every flow trigger, configuration change, credential, and git operation goes through it. There is no web UI. There is no backend service. The terminal is the product.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Requirements
|
|
10
|
+
|
|
11
|
+
| Dependency | Minimum | Check |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| Node.js | v20.0.0 | `node --version` |
|
|
14
|
+
| npm | v9.0.0 | `npm --version` |
|
|
15
|
+
| Git | v2.30.0 | `git --version` |
|
|
16
|
+
|
|
17
|
+
**Platform:** macOS 12+ or Windows 10+. OS keychain support (macOS Keychain / Windows Credential Manager) is required for credential storage.
|
|
18
|
+
|
|
19
|
+
**Node.js installation:** [nodejs.org](https://nodejs.org) → download the LTS version. This installs both `node` and `npm`.
|
|
20
|
+
|
|
21
|
+
**Git installation:**
|
|
22
|
+
- macOS: pre-installed, or `brew install git`
|
|
23
|
+
- Windows: [git-scm.com](https://git-scm.com)
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install -g chief-helm
|
|
31
|
+
helm --version
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## First-Time Setup
|
|
37
|
+
|
|
38
|
+
Before running `helm setup`, your personal CHIEF instance repo must be fully initialised — meaning `/config/inputs.yaml`, `agents.yaml`, `flows.yaml`, and `triggers.yaml` must all exist. See [SETUP.md](../SETUP.md) for full instructions.
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
helm setup
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The wizard walks through six steps:
|
|
45
|
+
|
|
46
|
+
1. Locate your instance repo and validate its structure
|
|
47
|
+
2. Create your user identity (`/users/[username]/`)
|
|
48
|
+
3. Connect inputs — collect and test credentials for each
|
|
49
|
+
4. Review and toggle agents and flows
|
|
50
|
+
5. Open key profile documents in your editor
|
|
51
|
+
6. Commit and push all setup changes to git
|
|
52
|
+
|
|
53
|
+
Setup is only marked complete after a successful git push. If interrupted, re-running `helm setup` is safe.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Commands
|
|
58
|
+
|
|
59
|
+
### System
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
helm status # Health overview: repo, inputs, last runs, engine
|
|
63
|
+
helm setup # First-time guided setup wizard
|
|
64
|
+
helm sync # git pull + show repo status
|
|
65
|
+
helm push # git add → commit → push
|
|
66
|
+
helm push -m "message" # Custom commit message
|
|
67
|
+
helm config # List all config files with index numbers
|
|
68
|
+
helm config <n> # Open config file n in your editor (auto-commits on close)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Secrets
|
|
72
|
+
|
|
73
|
+
Credentials are stored in the OS keychain. Values are never printed, logged, or included in error messages.
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
helm secrets set <KEY> # Masked input → OS keychain
|
|
77
|
+
helm secrets list # Key names only — values never shown
|
|
78
|
+
helm secrets verify <KEY> # Confirm a key exists
|
|
79
|
+
helm secrets delete <KEY> # Remove with confirmation prompt
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Inputs
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
helm inputs list # Show all inputs with connection status
|
|
86
|
+
helm inputs toggle <id> # Enable/disable; auto-commits to git
|
|
87
|
+
helm inputs test <id> # Live connectivity check
|
|
88
|
+
helm inputs test --all # Test all enabled inputs
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Config File Index
|
|
92
|
+
|
|
93
|
+
`helm config <n>` opens the file at that index:
|
|
94
|
+
|
|
95
|
+
| n | File |
|
|
96
|
+
|---|---|
|
|
97
|
+
| 1 | inputs.yaml |
|
|
98
|
+
| 2 | agents.yaml |
|
|
99
|
+
| 3 | flows.yaml |
|
|
100
|
+
| 4 | triggers.yaml |
|
|
101
|
+
| 5 | engine.yaml |
|
|
102
|
+
| 6 | system.yaml |
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Secret Key Names
|
|
107
|
+
|
|
108
|
+
The following keys are expected by the standard input set:
|
|
109
|
+
|
|
110
|
+
| Input | Keys |
|
|
111
|
+
|---|---|
|
|
112
|
+
| Gmail | `GMAIL_CLIENT_ID`, `GMAIL_CLIENT_SECRET`, `GMAIL_OAUTH_REFRESH_TOKEN` |
|
|
113
|
+
| Google Calendar | `GCAL_CLIENT_ID`, `GCAL_CLIENT_SECRET`, `GCAL_OAUTH_REFRESH_TOKEN` |
|
|
114
|
+
| Google Maps | `GOOGLE_MAPS_API_KEY` |
|
|
115
|
+
| Todoist | `TODOIST_API_TOKEN` |
|
|
116
|
+
| Zoom | `ZOOM_ACCOUNT_ID`, `ZOOM_CLIENT_ID`, `ZOOM_CLIENT_SECRET` |
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Local Config
|
|
121
|
+
|
|
122
|
+
HELM stores one file on the local machine outside any repo: `~/.chief/config.json`. It holds the instance repo path, active username, editor preference, setup status, last sync time, and the secret key name manifest. This file is never committed to git.
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Log Level
|
|
127
|
+
|
|
128
|
+
Set `HELM_LOG` to control output verbosity:
|
|
129
|
+
|
|
130
|
+
| Value | Output |
|
|
131
|
+
|---|---|
|
|
132
|
+
| `debug` | All output including internal messages |
|
|
133
|
+
| `info` | Default — info, warnings, errors |
|
|
134
|
+
| `error` | Errors only |
|
|
135
|
+
| `silent` | No output |
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Two-Repo Model
|
|
140
|
+
|
|
141
|
+
HELM source code lives in the **main CHIEF repo** at `/helm/`. It is published to npm from there.
|
|
142
|
+
|
|
143
|
+
HELM operates against the user's **personal instance repo** — a private fork where their config, profiles, outputs, logs, and state live. The path to this repo is set during `helm setup`.
|
|
144
|
+
|
|
145
|
+
The main CHIEF repo is never written to by HELM at runtime.
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Developer Reference
|
|
150
|
+
|
|
151
|
+
### Project Structure
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
/helm/
|
|
155
|
+
├── package.json
|
|
156
|
+
├── tsconfig.json
|
|
157
|
+
├── README.md
|
|
158
|
+
└── src/
|
|
159
|
+
├── index.ts Entry point, startup checks, command wiring
|
|
160
|
+
├── types/
|
|
161
|
+
│ └── index.ts All shared TypeScript interfaces
|
|
162
|
+
├── utils/
|
|
163
|
+
│ ├── errors.ts HelmError class and formatters
|
|
164
|
+
│ ├── format.ts Box-drawing, date, string utilities
|
|
165
|
+
│ └── logger.ts Level-gated stderr logger
|
|
166
|
+
├── ui/
|
|
167
|
+
│ ├── theme.ts Colour palette and status symbols
|
|
168
|
+
│ └── components/ Ink React components (Phase 2 interactive views)
|
|
169
|
+
│ ├── Header.tsx
|
|
170
|
+
│ ├── Panel.tsx
|
|
171
|
+
│ └── StatusRow.tsx
|
|
172
|
+
├── core/
|
|
173
|
+
│ ├── repo.ts conf store, local config, repo validation, setup guard
|
|
174
|
+
│ ├── config.ts YAML read/write for all instance repo config files
|
|
175
|
+
│ ├── secrets.ts keytar wrapper, manifest management
|
|
176
|
+
│ ├── git.ts pull, commit, push, status via simple-git
|
|
177
|
+
│ ├── state.ts last_run.json and other state file I/O
|
|
178
|
+
│ └── inputs.ts Credential key map and per-input connectivity tests
|
|
179
|
+
└── commands/
|
|
180
|
+
├── setup.ts helm setup — 6-step wizard
|
|
181
|
+
├── status.ts helm status — health overview panel
|
|
182
|
+
├── secrets.ts helm secrets set/list/verify/delete
|
|
183
|
+
├── sync.ts helm sync
|
|
184
|
+
├── push.ts helm push
|
|
185
|
+
├── inputs.ts helm inputs list/toggle/test
|
|
186
|
+
└── config.ts helm config [n]
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Error Handling Pattern
|
|
190
|
+
|
|
191
|
+
All intentional failures throw `HelmError(what, fix)`. Both fields are required. The top-level handler in `index.ts` formats them as:
|
|
192
|
+
|
|
193
|
+
```
|
|
194
|
+
✗ Error: [what]
|
|
195
|
+
→ [fix]
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Never swallow errors. Never put secret values in error messages.
|
|
199
|
+
|
|
200
|
+
### Adding a Command
|
|
201
|
+
|
|
202
|
+
1. Create `src/commands/[name].ts`
|
|
203
|
+
2. Export `register[Name]Command(program: Command): void`
|
|
204
|
+
3. Import and call it in `src/index.ts`
|
|
205
|
+
4. Call `requireSetup()` at the top of the action handler (unless the command is `setup` itself)
|
|
206
|
+
|
|
207
|
+
### Publishing
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
cd helm/
|
|
211
|
+
npm version patch # or minor / major
|
|
212
|
+
npm publish # prepublishOnly runs tsc automatically
|
|
213
|
+
git push && git push --tags
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
`prepublishOnly` compiles TypeScript to `dist/` before every publish. Only `dist/` and `README.md` are included in the published package.
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
*HELM is part of the CHIEF personal AI operations system. See [SETUP.md](../SETUP.md) for full system documentation.*
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file helm config — open instance repo config files in the user's editor.
|
|
3
|
+
*
|
|
4
|
+
* Subcommands:
|
|
5
|
+
* helm config List all config files with their index numbers
|
|
6
|
+
* helm config <n> Open config file number n in the configured editor
|
|
7
|
+
*
|
|
8
|
+
* After the editor closes, the modified file is auto-committed and pushed
|
|
9
|
+
* so that config changes are immediately reflected in git history.
|
|
10
|
+
*
|
|
11
|
+
* Config file order (by edit frequency):
|
|
12
|
+
* 1 inputs.yaml — most frequently edited
|
|
13
|
+
* 2 agents.yaml
|
|
14
|
+
* 3 flows.yaml
|
|
15
|
+
* 4 triggers.yaml
|
|
16
|
+
* 5 engine.yaml
|
|
17
|
+
* 6 system.yaml — least frequently edited
|
|
18
|
+
*/
|
|
19
|
+
import type { Command } from "commander";
|
|
20
|
+
/**
|
|
21
|
+
* Registers the `helm config` command on the given Commander program.
|
|
22
|
+
*
|
|
23
|
+
* @param program - The root Commander Command instance.
|
|
24
|
+
*/
|
|
25
|
+
export declare function registerConfigCommand(program: Command): void;
|
|
26
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAMH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0BzC;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAgH5D"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file helm config — open instance repo config files in the user's editor.
|
|
3
|
+
*
|
|
4
|
+
* Subcommands:
|
|
5
|
+
* helm config List all config files with their index numbers
|
|
6
|
+
* helm config <n> Open config file number n in the configured editor
|
|
7
|
+
*
|
|
8
|
+
* After the editor closes, the modified file is auto-committed and pushed
|
|
9
|
+
* so that config changes are immediately reflected in git history.
|
|
10
|
+
*
|
|
11
|
+
* Config file order (by edit frequency):
|
|
12
|
+
* 1 inputs.yaml — most frequently edited
|
|
13
|
+
* 2 agents.yaml
|
|
14
|
+
* 3 flows.yaml
|
|
15
|
+
* 4 triggers.yaml
|
|
16
|
+
* 5 engine.yaml
|
|
17
|
+
* 6 system.yaml — least frequently edited
|
|
18
|
+
*/
|
|
19
|
+
import fs from "fs";
|
|
20
|
+
import path from "path";
|
|
21
|
+
import chalk from "chalk";
|
|
22
|
+
import { execa } from "execa";
|
|
23
|
+
import { requireSetup, getLocalConfig } from "../core/repo.js";
|
|
24
|
+
import { commitAndPush } from "../core/git.js";
|
|
25
|
+
import { HelmError } from "../utils/errors.js";
|
|
26
|
+
import { theme, symbol } from "../ui/theme.js";
|
|
27
|
+
// ─── Config File Registry ─────────────────────────────────────────────────────
|
|
28
|
+
/**
|
|
29
|
+
* Ordered registry of config files manageable via helm config.
|
|
30
|
+
* Index n corresponds to helm config n (1-based).
|
|
31
|
+
*/
|
|
32
|
+
const CONFIG_FILES = [
|
|
33
|
+
{ label: "inputs.yaml", relativePath: path.join("config", "inputs.yaml") },
|
|
34
|
+
{ label: "agents.yaml", relativePath: path.join("config", "agents.yaml") },
|
|
35
|
+
{ label: "flows.yaml", relativePath: path.join("config", "flows.yaml") },
|
|
36
|
+
{ label: "triggers.yaml", relativePath: path.join("config", "triggers.yaml") },
|
|
37
|
+
{ label: "engine.yaml", relativePath: path.join("config", "engine.yaml") },
|
|
38
|
+
{ label: "system.yaml", relativePath: path.join("config", "system.yaml") },
|
|
39
|
+
];
|
|
40
|
+
// ─── Command Registration ─────────────────────────────────────────────────────
|
|
41
|
+
/**
|
|
42
|
+
* Registers the `helm config` command on the given Commander program.
|
|
43
|
+
*
|
|
44
|
+
* @param program - The root Commander Command instance.
|
|
45
|
+
*/
|
|
46
|
+
export function registerConfigCommand(program) {
|
|
47
|
+
program
|
|
48
|
+
.command("config [n]")
|
|
49
|
+
.description("List config files or open one by number in your editor (helm config 1)")
|
|
50
|
+
.action(async (n) => {
|
|
51
|
+
requireSetup();
|
|
52
|
+
const { instance_repo_path: repoRoot, active_user: username, editor, } = getLocalConfig();
|
|
53
|
+
// No argument — list all config files.
|
|
54
|
+
if (n === undefined) {
|
|
55
|
+
console.log(`\n ${chalk.hex(theme.text).bold("Config files")} ${chalk.hex(theme.muted)("(helm config <n> to open)")}\n`);
|
|
56
|
+
for (let i = 0; i < CONFIG_FILES.length; i++) {
|
|
57
|
+
const entry = CONFIG_FILES[i];
|
|
58
|
+
if (!entry)
|
|
59
|
+
continue;
|
|
60
|
+
const fullPath = path.join(repoRoot, entry.relativePath);
|
|
61
|
+
const exists = fs.existsSync(fullPath);
|
|
62
|
+
const indexStr = chalk.hex(theme.accent)(`${i + 1}`);
|
|
63
|
+
const labelStr = chalk.hex(theme.text)(entry.label.padEnd(20));
|
|
64
|
+
const pathStr = chalk.hex(theme.muted)(exists ? fullPath : `${fullPath} (not found)`);
|
|
65
|
+
console.log(` ${indexStr} ${labelStr}${pathStr}`);
|
|
66
|
+
}
|
|
67
|
+
console.log();
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
// Argument provided — open the file at that index.
|
|
71
|
+
const index = parseInt(n, 10);
|
|
72
|
+
if (isNaN(index) || index < 1 || index > CONFIG_FILES.length) {
|
|
73
|
+
throw new HelmError(`Invalid config file number: "${n}".`, `Use a number between 1 and ${CONFIG_FILES.length}. Run: helm config to see the list.`);
|
|
74
|
+
}
|
|
75
|
+
const entry = CONFIG_FILES[index - 1];
|
|
76
|
+
if (!entry) {
|
|
77
|
+
throw new HelmError(`Config file entry at index ${index} is not defined.`, "Run: helm config to see the valid list.");
|
|
78
|
+
}
|
|
79
|
+
const fullPath = path.join(repoRoot, entry.relativePath);
|
|
80
|
+
if (!fs.existsSync(fullPath)) {
|
|
81
|
+
throw new HelmError(`Config file not found: ${entry.label}`, `Ensure your instance repo is fully initialised. Expected: ${fullPath}`);
|
|
82
|
+
}
|
|
83
|
+
console.log(chalk.hex(theme.muted)(`\n Opening ${entry.label} in ${editor}…`));
|
|
84
|
+
const editorParts = editor.split(" ");
|
|
85
|
+
const editorCmd = editorParts[0];
|
|
86
|
+
const editorArgs = editorParts.slice(1);
|
|
87
|
+
if (!editorCmd) {
|
|
88
|
+
throw new HelmError("No editor command configured.", "Run: helm setup to reconfigure, or set the EDITOR environment variable.");
|
|
89
|
+
}
|
|
90
|
+
try {
|
|
91
|
+
await execa(editorCmd, [...editorArgs, fullPath], {
|
|
92
|
+
stdio: "inherit",
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
const detail = err instanceof Error ? err.message : String(err);
|
|
97
|
+
throw new HelmError(`Editor "${editor}" exited with an error: ${detail}`, `Try setting a different editor: edit ~/.chief/config.json and update the "editor" field.`);
|
|
98
|
+
}
|
|
99
|
+
// Auto-commit the changed file after editor closes.
|
|
100
|
+
const commitMsg = `[manual] config edit: ${entry.label} — ${username}`;
|
|
101
|
+
try {
|
|
102
|
+
await commitAndPush(repoRoot, [entry.relativePath], commitMsg);
|
|
103
|
+
console.log(`\n ${chalk.hex(theme.success)(symbol.success)} Saved and committed: ${entry.label}\n`);
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
// The edit succeeded; a commit failure is recoverable.
|
|
107
|
+
console.log(chalk.hex(theme.warning)(`\n ${symbol.warning} Changes saved but not committed.\n Run: helm push to commit them.\n`));
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAE9B,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE/C,iFAAiF;AAEjF;;;GAGG;AACH,MAAM,YAAY,GAGb;IACH,EAAE,KAAK,EAAE,aAAa,EAAI,YAAY,EAAE,IAAI,CAAC,IAA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,0FAA0F,CAC3F,CAAC;QACJ,CAAC;QAED,oDAAoD;QACpD,MAAM,SAAS,GAAG,yBAAyB,KAAK,CAAC,KAAK,MAAM,QAAQ,EAAE,CAAC;QAEvE,IAAI,CAAC;YACH,MAAM,aAAa,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,SAAS,CAAC,CAAC;YAC/D,OAAO,CAAC,GAAG,CACT,OAAO,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,0BAA0B,KAAK,CAAC,KAAK,IAAI,CACzF,CAAC;QACJ,CAAC;QAAC,MAAM,CAAC;YACP,uDAAuD;YACvD,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CACtB,OAAO,MAAM,CAAC,OAAO,wEAAwE,CAC9F,CACF,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file helm inputs — manage external data source integrations.
|
|
3
|
+
*
|
|
4
|
+
* Subcommands:
|
|
5
|
+
* helm inputs list Show all inputs with status
|
|
6
|
+
* helm inputs toggle <id> Enable/disable an input; auto-commits
|
|
7
|
+
* helm inputs test <id> Run a live connectivity check
|
|
8
|
+
* helm inputs test --all Test all enabled inputs
|
|
9
|
+
*
|
|
10
|
+
* "configured" state in inputs.yaml reflects whether the last
|
|
11
|
+
* connectivity test passed. It does not guarantee the credential
|
|
12
|
+
* is still valid between tests.
|
|
13
|
+
*/
|
|
14
|
+
import type { Command } from "commander";
|
|
15
|
+
/**
|
|
16
|
+
* Registers the `helm inputs` subcommand group on the given Commander program.
|
|
17
|
+
*
|
|
18
|
+
* @param program - The root Commander Command instance.
|
|
19
|
+
*/
|
|
20
|
+
export declare function registerInputsCommand(program: Command): void;
|
|
21
|
+
//# sourceMappingURL=inputs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inputs.d.ts","sourceRoot":"","sources":["../../src/commands/inputs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA8DzC;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA6J5D"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file helm inputs — manage external data source integrations.
|
|
3
|
+
*
|
|
4
|
+
* Subcommands:
|
|
5
|
+
* helm inputs list Show all inputs with status
|
|
6
|
+
* helm inputs toggle <id> Enable/disable an input; auto-commits
|
|
7
|
+
* helm inputs test <id> Run a live connectivity check
|
|
8
|
+
* helm inputs test --all Test all enabled inputs
|
|
9
|
+
*
|
|
10
|
+
* "configured" state in inputs.yaml reflects whether the last
|
|
11
|
+
* connectivity test passed. It does not guarantee the credential
|
|
12
|
+
* is still valid between tests.
|
|
13
|
+
*/
|
|
14
|
+
import chalk from "chalk";
|
|
15
|
+
import { requireSetup, getLocalConfig } from "../core/repo.js";
|
|
16
|
+
import { readInputsConfig, writeInputsConfig } from "../core/config.js";
|
|
17
|
+
import { testInput } from "../core/inputs.js";
|
|
18
|
+
import { commitAndPush } from "../core/git.js";
|
|
19
|
+
import { theme, symbol } from "../ui/theme.js";
|
|
20
|
+
import { padEnd } from "../utils/format.js";
|
|
21
|
+
import { HelmError } from "../utils/errors.js";
|
|
22
|
+
import path from "path";
|
|
23
|
+
// ─── Display Helpers ──────────────────────────────────────────────────────────
|
|
24
|
+
/**
|
|
25
|
+
* Prints a single input list row with consistent column alignment.
|
|
26
|
+
*
|
|
27
|
+
* Column layout: [symbol] [label] [status]
|
|
28
|
+
*/
|
|
29
|
+
function printInputRow(label, enabled, configured) {
|
|
30
|
+
const sym = !enabled
|
|
31
|
+
? chalk.hex(theme.skip)(symbol.disabled)
|
|
32
|
+
: configured
|
|
33
|
+
? chalk.hex(theme.success)(symbol.success)
|
|
34
|
+
: chalk.hex(theme.warning)(symbol.warning);
|
|
35
|
+
const labelStr = padEnd(label, 22);
|
|
36
|
+
const statusStr = !enabled
|
|
37
|
+
? chalk.hex(theme.skip)("disabled")
|
|
38
|
+
: configured
|
|
39
|
+
? chalk.hex(theme.success)("connected")
|
|
40
|
+
: chalk.hex(theme.warning)("not configured");
|
|
41
|
+
console.log(` ${sym} ${chalk.hex(theme.text)(labelStr)}${statusStr}`);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Prints the result of an input connectivity test.
|
|
45
|
+
*/
|
|
46
|
+
function printTestResult(result) {
|
|
47
|
+
if (result.ok) {
|
|
48
|
+
console.log(` ${chalk.hex(theme.success)(symbol.success)} ${result.inputId}${result.detail ? chalk.hex(theme.muted)(` — ${result.detail}`) : ""}`);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
console.log(` ${chalk.hex(theme.error)(symbol.error)} ${result.inputId}: ${result.error ?? "test failed"}`);
|
|
52
|
+
if (result.fix) {
|
|
53
|
+
console.log(chalk.hex(theme.muted)(` ${symbol.arrow} ${result.fix}`));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
// ─── Command Registration ─────────────────────────────────────────────────────
|
|
58
|
+
/**
|
|
59
|
+
* Registers the `helm inputs` subcommand group on the given Commander program.
|
|
60
|
+
*
|
|
61
|
+
* @param program - The root Commander Command instance.
|
|
62
|
+
*/
|
|
63
|
+
export function registerInputsCommand(program) {
|
|
64
|
+
const inputs = program
|
|
65
|
+
.command("inputs")
|
|
66
|
+
.description("Manage external data source integrations");
|
|
67
|
+
// ── list ───────────────────────────────────────────────────────────────────
|
|
68
|
+
inputs
|
|
69
|
+
.command("list")
|
|
70
|
+
.description("Show all inputs with connection status")
|
|
71
|
+
.action(() => {
|
|
72
|
+
requireSetup();
|
|
73
|
+
const { instance_repo_path: repoRoot } = getLocalConfig();
|
|
74
|
+
const all = readInputsConfig(repoRoot);
|
|
75
|
+
console.log(`\n ${chalk.hex(theme.text).bold("INPUTS")} ${chalk.hex(theme.muted)(`(${all.length} total)`)}\n`);
|
|
76
|
+
for (const inp of all) {
|
|
77
|
+
printInputRow(inp.label, inp.enabled, inp.configured);
|
|
78
|
+
}
|
|
79
|
+
console.log();
|
|
80
|
+
});
|
|
81
|
+
// ── toggle ─────────────────────────────────────────────────────────────────
|
|
82
|
+
inputs
|
|
83
|
+
.command("toggle <id>")
|
|
84
|
+
.description("Enable or disable an input and auto-commit the change")
|
|
85
|
+
.action(async (id) => {
|
|
86
|
+
requireSetup();
|
|
87
|
+
const { instance_repo_path: repoRoot, active_user: username } = getLocalConfig();
|
|
88
|
+
const all = readInputsConfig(repoRoot);
|
|
89
|
+
const target = all.find((inp) => inp.id === id);
|
|
90
|
+
if (!target) {
|
|
91
|
+
throw new HelmError(`Input "${id}" not found in inputs.yaml.`, `Run: helm inputs list to see valid input IDs.`);
|
|
92
|
+
}
|
|
93
|
+
const wasEnabled = target.enabled;
|
|
94
|
+
target.enabled = !wasEnabled;
|
|
95
|
+
// Disabling also clears configured so status reflects the change.
|
|
96
|
+
if (!target.enabled) {
|
|
97
|
+
target.configured = false;
|
|
98
|
+
}
|
|
99
|
+
writeInputsConfig(repoRoot, all);
|
|
100
|
+
const action = target.enabled ? "enabled" : "disabled";
|
|
101
|
+
console.log(` ${chalk.hex(theme.success)(symbol.success)} Input "${target.label}" ${action}.`);
|
|
102
|
+
const commitFiles = [path.join("config", "inputs.yaml")];
|
|
103
|
+
const commitMsg = `[manual] toggle: input ${id} ${action} — ${username}`;
|
|
104
|
+
await commitAndPush(repoRoot, commitFiles, commitMsg);
|
|
105
|
+
console.log(chalk.hex(theme.muted)(` ${symbol.bullet} Changes committed and pushed.`));
|
|
106
|
+
console.log();
|
|
107
|
+
});
|
|
108
|
+
// ── test ───────────────────────────────────────────────────────────────────
|
|
109
|
+
inputs
|
|
110
|
+
.command("test [id]")
|
|
111
|
+
.description("Test input connectivity. Use --all to test every enabled input.")
|
|
112
|
+
.option("--all", "Test all enabled inputs")
|
|
113
|
+
.action(async (id, options) => {
|
|
114
|
+
requireSetup();
|
|
115
|
+
const { instance_repo_path: repoRoot, active_user: username } = getLocalConfig();
|
|
116
|
+
const all = readInputsConfig(repoRoot);
|
|
117
|
+
let toTest;
|
|
118
|
+
if (options.all) {
|
|
119
|
+
toTest = all.filter((inp) => inp.enabled);
|
|
120
|
+
if (toTest.length === 0) {
|
|
121
|
+
console.log(chalk.hex(theme.muted)(" No enabled inputs to test."));
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
if (!id) {
|
|
127
|
+
throw new HelmError("No input ID provided.", "Run: helm inputs test <id> or helm inputs test --all");
|
|
128
|
+
}
|
|
129
|
+
const target = all.find((inp) => inp.id === id);
|
|
130
|
+
if (!target) {
|
|
131
|
+
throw new HelmError(`Input "${id}" not found in inputs.yaml.`, `Run: helm inputs list to see valid input IDs.`);
|
|
132
|
+
}
|
|
133
|
+
if (!target.enabled) {
|
|
134
|
+
throw new HelmError(`Input "${target.label}" is disabled.`, `Enable it first: helm inputs toggle ${id}`);
|
|
135
|
+
}
|
|
136
|
+
toTest = [target];
|
|
137
|
+
}
|
|
138
|
+
console.log(`\n ${chalk.hex(theme.text).bold("Testing input connections…")}\n`);
|
|
139
|
+
let anyChanged = false;
|
|
140
|
+
for (const inp of toTest) {
|
|
141
|
+
process.stdout.write(` ${chalk.hex(theme.muted)(`Testing ${inp.label}…`)} `);
|
|
142
|
+
const result = await testInput(inp.id, username);
|
|
143
|
+
process.stdout.write("\n");
|
|
144
|
+
printTestResult(result);
|
|
145
|
+
const configuredBefore = inp.configured;
|
|
146
|
+
inp.configured = result.ok;
|
|
147
|
+
if (inp.configured !== configuredBefore) {
|
|
148
|
+
anyChanged = true;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
if (anyChanged) {
|
|
152
|
+
writeInputsConfig(repoRoot, all);
|
|
153
|
+
console.log(chalk.hex(theme.muted)(`\n ${symbol.bullet} inputs.yaml updated to reflect test results.`));
|
|
154
|
+
}
|
|
155
|
+
console.log();
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=inputs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inputs.js","sourceRoot":"","sources":["../../src/commands/inputs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,cAAc,EAAY,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,iFAAiF;AAEjF;;;;GAIG;AACH,SAAS,aAAa,CACpB,KAAa,EACb,OAAgB,EAChB,UAAmB;IAEnB,MAAM,GAAG,GAAG,CAAC,OAAO;QAClB,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;QACxC,CAAC,CAAC,UAAU;YACZ,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;YAC1C,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,O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,CAAC,GAAG,EAAE,CAAC;IAChB,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file helm push — stage, commit, and push to the instance repo remote.
|
|
3
|
+
*
|
|
4
|
+
* Stages all tracked modified files (`git add -A`), commits with an
|
|
5
|
+
* auto-generated or user-supplied message, and pushes to origin.
|
|
6
|
+
*
|
|
7
|
+
* Auto commit message format: [manual] push — [username]
|
|
8
|
+
* Custom message format: [manual] [message] — [username]
|
|
9
|
+
*
|
|
10
|
+
* If the push fails the commit is preserved locally and a recoverable
|
|
11
|
+
* warning is shown with the manual push command, matching the PRD
|
|
12
|
+
* behaviour: a completed run's outputs are never lost to a push failure.
|
|
13
|
+
*/
|
|
14
|
+
import type { Command } from "commander";
|
|
15
|
+
/**
|
|
16
|
+
* Registers the `helm push` command on the given Commander program.
|
|
17
|
+
*
|
|
18
|
+
* @param program - The root Commander Command instance.
|
|
19
|
+
*/
|
|
20
|
+
export declare function registerPushCommand(program: Command): void;
|
|
21
|
+
//# sourceMappingURL=push.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push.d.ts","sourceRoot":"","sources":["../../src/commands/push.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOzC;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA0C1D"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file helm push — stage, commit, and push to the instance repo remote.
|
|
3
|
+
*
|
|
4
|
+
* Stages all tracked modified files (`git add -A`), commits with an
|
|
5
|
+
* auto-generated or user-supplied message, and pushes to origin.
|
|
6
|
+
*
|
|
7
|
+
* Auto commit message format: [manual] push — [username]
|
|
8
|
+
* Custom message format: [manual] [message] — [username]
|
|
9
|
+
*
|
|
10
|
+
* If the push fails the commit is preserved locally and a recoverable
|
|
11
|
+
* warning is shown with the manual push command, matching the PRD
|
|
12
|
+
* behaviour: a completed run's outputs are never lost to a push failure.
|
|
13
|
+
*/
|
|
14
|
+
import chalk from "chalk";
|
|
15
|
+
import { requireSetup, getLocalConfig } from "../core/repo.js";
|
|
16
|
+
import { addAllAndPush } from "../core/git.js";
|
|
17
|
+
import { theme, symbol } from "../ui/theme.js";
|
|
18
|
+
// ─── Command Registration ─────────────────────────────────────────────────────
|
|
19
|
+
/**
|
|
20
|
+
* Registers the `helm push` command on the given Commander program.
|
|
21
|
+
*
|
|
22
|
+
* @param program - The root Commander Command instance.
|
|
23
|
+
*/
|
|
24
|
+
export function registerPushCommand(program) {
|
|
25
|
+
program
|
|
26
|
+
.command("push")
|
|
27
|
+
.description("Commit all changes and push to origin")
|
|
28
|
+
.option("-m, --message <msg>", "Custom commit message")
|
|
29
|
+
.action(async (options) => {
|
|
30
|
+
requireSetup();
|
|
31
|
+
const { instance_repo_path: repoRoot, active_user: username } = getLocalConfig();
|
|
32
|
+
const messageBody = options.message
|
|
33
|
+
? options.message.trim()
|
|
34
|
+
: "push";
|
|
35
|
+
const commitMessage = `[manual] ${messageBody} — ${username}`;
|
|
36
|
+
process.stdout.write(chalk.hex(theme.muted)(" Committing and pushing… "));
|
|
37
|
+
const pushed = await addAllAndPush(repoRoot, commitMessage);
|
|
38
|
+
process.stdout.write("\n");
|
|
39
|
+
if (pushed) {
|
|
40
|
+
console.log(` ${chalk.hex(theme.success)(symbol.success)} Committed and pushed.`);
|
|
41
|
+
console.log(chalk.hex(theme.muted)(` ${symbol.bullet} Message: ${commitMessage}`));
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
// addAllAndPush prints its own warning on push failure.
|
|
45
|
+
// The commit succeeded, so we confirm that.
|
|
46
|
+
console.log(` ${chalk.hex(theme.success)(symbol.success)} Committed locally.`);
|
|
47
|
+
}
|
|
48
|
+
console.log();
|
|
49
|
+
});
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