@kitsy/coop 1.0.0 → 1.1.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/README.md CHANGED
@@ -2,6 +2,22 @@
2
2
 
3
3
  CLI package for COOP.
4
4
 
5
+ Install globally:
6
+
7
+ ```bash
8
+ npm i -g @kitsy/coop
9
+ coop --help
10
+ ```
11
+
12
+ Install locally in a repo:
13
+
14
+ ```bash
15
+ pnpm add -D @kitsy/coop
16
+ pnpm exec coop --help
17
+ ```
18
+
19
+ Both entrypoints operate on the nearest parent `.coop/` workspace. If no workspace log target exists, CLI errors fall back to `~/.coop/logs/cli.log` or `COOP_HOME/logs/cli.log`.
20
+
5
21
  Current implemented command families:
6
22
  - `coop`
7
23
  - `coop init`
@@ -46,6 +62,7 @@ Known limitations:
46
62
  - Authorization is advisory and config-driven (`.coop/config.yml -> authorization`).
47
63
  - Plugin runtime supports manifest triggers under `.coop/plugins/*.yml` (webhook + console + `github_pr` actions).
48
64
  - `coop ui` is read-only and depends on local `.coop/.index` data. The command rebuilds stale indexes before launch.
65
+ - `coop init` creates `.coop/.ignore` and `.coop/.gitignore` so logs, tmp files, and index artifacts are not committed by default.
49
66
 
50
67
  GitHub integration quick example:
51
68
  ```yaml
package/bin/coop.js ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { runCli } from "../dist/index.js";
3
+
4
+ await runCli(process.argv);
package/bin/coop.mjs ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ import { fileURLToPath } from "node:url";
3
+ import { spawnSync } from "node:child_process";
4
+ import path from "node:path";
5
+ import process from "node:process";
6
+
7
+ const script = path.join(path.dirname(fileURLToPath(import.meta.url)), "..", "dist", "index.js");
8
+ const result = spawnSync(process.execPath, [script, ...process.argv.slice(2)], {
9
+ stdio: "inherit",
10
+ });
11
+
12
+ process.exit(result.status ?? 1);
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  // src/index.ts
4
4
  import fs13 from "fs";
5
5
  import path18 from "path";
6
- import { fileURLToPath as fileURLToPath2, pathToFileURL } from "url";
6
+ import { fileURLToPath as fileURLToPath2 } from "url";
7
7
  import { Command } from "commander";
8
8
 
9
9
  // src/utils/aliases.ts
@@ -19,10 +19,17 @@ import { spawnSync } from "child_process";
19
19
  import crypto from "crypto";
20
20
  import { parseTaskFile, parseYamlFile, writeYamlFile } from "@kitsy/coop-core";
21
21
  var SEQ_MARKER = "COOPSEQTOKEN";
22
+ function resolveCoopHome() {
23
+ const configured = process.env.COOP_HOME?.trim();
24
+ if (configured) {
25
+ return path.resolve(configured);
26
+ }
27
+ return path.join(os.homedir(), ".coop");
28
+ }
22
29
  function resolveRepoRoot(start = process.cwd()) {
23
30
  let current = path.resolve(start);
24
31
  while (true) {
25
- if (fs.existsSync(path.join(current, ".git"))) {
32
+ if (fs.existsSync(path.join(current, ".git")) || fs.existsSync(path.join(current, ".coop"))) {
26
33
  return current;
27
34
  }
28
35
  const parent = path.dirname(current);
@@ -2016,6 +2023,12 @@ triggers:
2016
2023
  type: github_pr
2017
2024
  operation: merge
2018
2025
  `;
2026
+ var COOP_IGNORE_TEMPLATE = `.index/
2027
+ logs/
2028
+ tmp/
2029
+ *.log
2030
+ *.tmp
2031
+ `;
2019
2032
  function ensureDir(dirPath) {
2020
2033
  fs6.mkdirSync(dirPath, { recursive: true });
2021
2034
  }
@@ -2111,6 +2124,8 @@ function registerInitCommand(program) {
2111
2124
  writeIfMissing(path8.join(coop, "templates/idea.md"), IDEA_TEMPLATE);
2112
2125
  writeIfMissing(path8.join(coop, "plugins/console-log.yml"), PLUGIN_CONSOLE_TEMPLATE);
2113
2126
  writeIfMissing(path8.join(coop, "plugins/github-pr.yml"), PLUGIN_GITHUB_TEMPLATE);
2127
+ writeIfMissing(path8.join(coop, ".ignore"), COOP_IGNORE_TEMPLATE);
2128
+ writeIfMissing(path8.join(coop, ".gitignore"), COOP_IGNORE_TEMPLATE);
2114
2129
  ensureGitignoreEntry(root, ".coop/.index/");
2115
2130
  const preCommitHook = installPreCommitHook(root);
2116
2131
  const postMergeHook = installPostMergeHook(root);
@@ -2276,10 +2291,10 @@ function resolveRepoSafe(start = process.cwd()) {
2276
2291
  function resolveCliLogFile(start = process.cwd()) {
2277
2292
  const root = resolveRepoSafe(start);
2278
2293
  const coop = coopDir(root);
2279
- if (fs7.existsSync(coop)) {
2294
+ if (fs7.existsSync(path10.join(coop, "config.yml"))) {
2280
2295
  return path10.join(coop, "logs", "cli.log");
2281
2296
  }
2282
- return path10.join(root, ".coop-cli.log");
2297
+ return path10.join(resolveCoopHome(), "logs", "cli.log");
2283
2298
  }
2284
2299
  function appendLogEntry(entry, logFile) {
2285
2300
  fs7.mkdirSync(path10.dirname(logFile), { recursive: true });
@@ -4426,7 +4441,7 @@ async function runCli(argv = process.argv) {
4426
4441
  function isMainModule() {
4427
4442
  const entry = process.argv[1];
4428
4443
  if (!entry) return false;
4429
- return import.meta.url === pathToFileURL(path18.resolve(entry)).href;
4444
+ return path18.resolve(entry) === fileURLToPath2(import.meta.url);
4430
4445
  }
4431
4446
  if (isMainModule()) {
4432
4447
  await runCli(process.argv);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kitsy/coop",
3
3
  "description": "COOP command-line interface.",
4
- "version": "1.0.0",
4
+ "version": "1.1.0",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "publishConfig": {
@@ -27,9 +27,10 @@
27
27
  "node": ">=20"
28
28
  },
29
29
  "bin": {
30
- "coop": "dist/index.js"
30
+ "coop": "bin/coop.js"
31
31
  },
32
32
  "files": [
33
+ "bin",
33
34
  "dist",
34
35
  "README.md",
35
36
  "LICENSE"
@@ -38,7 +39,7 @@
38
39
  "chalk": "^5.6.2",
39
40
  "commander": "^14.0.0",
40
41
  "octokit": "^5.0.5",
41
- "@kitsy/coop-ui": "^1.0.0",
42
+ "@kitsy/coop-ui": "^1.1.0",
42
43
  "@kitsy/coop-ai": "1.0.0",
43
44
  "@kitsy/coop-core": "1.0.0"
44
45
  },