@thejoseki/clawform 2.3.1 → 2.3.2

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.
Files changed (48) hide show
  1. package/README.md +141 -120
  2. package/bin/clawform.js +161 -151
  3. package/package.json +65 -65
  4. package/src/aws/catalog.js +116 -116
  5. package/src/aws/changeset.js +231 -231
  6. package/src/aws/drift.js +59 -59
  7. package/src/aws/exports.js +213 -213
  8. package/src/aws/inventory.js +156 -156
  9. package/src/commands/activate.js +137 -105
  10. package/src/commands/ci-init.js +393 -212
  11. package/src/commands/cost-report.js +163 -163
  12. package/src/commands/deactivate.js +9 -2
  13. package/src/commands/deploy.js +413 -413
  14. package/src/commands/diff.js +39 -39
  15. package/src/commands/drift.js +35 -35
  16. package/src/commands/init-plugin.js +6 -6
  17. package/src/commands/init.js +360 -360
  18. package/src/commands/rollback.js +126 -126
  19. package/src/commands/status.js +147 -147
  20. package/src/commands/sync.js +50 -50
  21. package/src/commands/update.js +24 -0
  22. package/src/commands/validate.js +349 -349
  23. package/src/hooks/block-dangerous.js +62 -62
  24. package/src/hooks/cfn-lint-after-edit-eval.js +30 -30
  25. package/src/hooks/cfn-lint-after-edit.js +81 -81
  26. package/src/hooks/check-catalog-fresh-eval.js +63 -63
  27. package/src/hooks/check-catalog-fresh.js +33 -33
  28. package/src/hooks/session-context-eval.js +81 -81
  29. package/src/hooks/session-context.js +41 -41
  30. package/src/hooks/subagent-context-eval.js +44 -44
  31. package/src/hooks/subagent-context.js +48 -48
  32. package/src/lib/audit-synthesis.js +24 -24
  33. package/src/lib/aws-client.js +15 -15
  34. package/src/lib/cfn-yaml.js +92 -92
  35. package/src/lib/config.js +76 -76
  36. package/src/lib/constants.js +85 -85
  37. package/src/lib/defaults.js +16 -16
  38. package/src/lib/install-workflow.js +28 -28
  39. package/src/lib/kit-source.js +43 -5
  40. package/src/lib/license-client.js +84 -84
  41. package/src/lib/license-config.js +162 -162
  42. package/src/lib/license-store.js +43 -8
  43. package/src/lib/license.js +163 -150
  44. package/src/lib/lint-overrides.js +226 -226
  45. package/src/lib/logger.js +16 -16
  46. package/src/lib/project-config.js +145 -145
  47. package/src/lib/providers/polar.js +215 -215
  48. package/src/lib/session-state.js +91 -91
@@ -1,53 +1,53 @@
1
- import { mkdir, writeFile } from 'node:fs/promises';
2
- import { dirname, join } from 'node:path';
3
- import { fileURLToPath } from 'node:url';
4
- import { logger } from '../lib/logger.js';
5
- import { loadConfig } from '../lib/config.js';
6
- import { loadProjectConfig, resolveProjectDir } from '../lib/project-config.js';
7
- import { cfnClient } from '../lib/aws-client.js';
8
- import { fetchExports, groupExports, renderCatalog } from '../aws/catalog.js';
9
- import { fetchStacks, classifyStacks, renderInventory } from '../aws/inventory.js';
10
- import { ensureWorkflowInstalled } from '../lib/install-workflow.js';
11
- import { CATALOG_DIR_REL } from '../lib/constants.js';
1
+ import { mkdir, writeFile } from 'node:fs/promises';
2
+ import { dirname, join } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ import { logger } from '../lib/logger.js';
5
+ import { loadConfig } from '../lib/config.js';
6
+ import { loadProjectConfig, resolveProjectDir } from '../lib/project-config.js';
7
+ import { cfnClient } from '../lib/aws-client.js';
8
+ import { fetchExports, groupExports, renderCatalog } from '../aws/catalog.js';
9
+ import { fetchStacks, classifyStacks, renderInventory } from '../aws/inventory.js';
10
+ import { ensureWorkflowInstalled } from '../lib/install-workflow.js';
11
+ import { CATALOG_DIR_REL } from '../lib/constants.js';
12
12
  import { assertLicensed } from '../lib/license.js';
13
13
  import { resolveClient as resolveLicenseClient } from '../lib/license-client.js';
14
-
15
- const REPO_ROOT = join(dirname(fileURLToPath(import.meta.url)), '..', '..');
16
-
14
+
15
+ const REPO_ROOT = join(dirname(fileURLToPath(import.meta.url)), '..', '..');
16
+
17
17
  export default async function sync(opts = {}) {
18
- await assertLicensed({ command: 'sync', client: resolveLicenseClient() });
19
- const cfg = loadConfig(opts);
20
- logger.step('clawform sync — refresh catalog + inventory');
21
- logger.info(`Profile: ${cfg.AWS_PROFILE} Region: ${cfg.AWS_REGION}`);
22
- const client = cfnClient(opts);
23
-
24
- const meta = {
25
- generatedAt: new Date().toISOString(),
26
- account: cfg.ACCOUNT_DEV || '(unknown)',
27
- region: cfg.AWS_REGION,
28
- };
29
-
30
- logger.info('Fetching exports + stacks in parallel…');
31
- const [exports, stacks] = await Promise.all([fetchExports(client), fetchStacks(client)]);
32
- logger.ok(`Got ${exports.length} exports, ${stacks.length} active stacks`);
33
-
34
- const projectDir = resolveProjectDir();
35
- const catalogDir = join(projectDir, CATALOG_DIR_REL);
36
- const projectCfg = loadProjectConfig({ projectDir });
37
- const catalogMd = renderCatalog(groupExports(exports), { ...meta, total: exports.length });
38
- const classified = classifyStacks(stacks, new Date(), projectCfg.legacy_prefixes);
39
- const inventoryMd = renderInventory(classified, meta);
40
-
41
- await mkdir(catalogDir, { recursive: true });
42
- await writeFile(join(catalogDir, 'outputs-catalog.md'), catalogMd);
43
- await writeFile(join(catalogDir, 'stacks-inventory.md'), inventoryMd);
44
- logger.ok(`${CATALOG_DIR_REL}/outputs-catalog.md (${exports.length} exports)`);
45
- logger.ok(
46
- `${CATALOG_DIR_REL}/stacks-inventory.md (legacy=${classified.legacy.length}, serverless=${classified.serverless.length}, active=${classified.active.length}, stale=${classified.stale.length})`,
47
- );
48
-
49
- const workflowResult = ensureWorkflowInstalled({ repoRoot: REPO_ROOT, projectDir });
50
- if (workflowResult.installed) {
51
- logger.ok('.claude/workflows/audit-all-stacks.js installed — invoke it via `/workflows` or `/audit-all-stacks`');
52
- }
53
- }
18
+ await assertLicensed({ command: 'sync', client: resolveLicenseClient() });
19
+ const cfg = loadConfig(opts);
20
+ logger.step('clawform sync — refresh catalog + inventory');
21
+ logger.info(`Profile: ${cfg.AWS_PROFILE} Region: ${cfg.AWS_REGION}`);
22
+ const client = cfnClient(opts);
23
+
24
+ const meta = {
25
+ generatedAt: new Date().toISOString(),
26
+ account: cfg.ACCOUNT_DEV || '(unknown)',
27
+ region: cfg.AWS_REGION,
28
+ };
29
+
30
+ logger.info('Fetching exports + stacks in parallel…');
31
+ const [exports, stacks] = await Promise.all([fetchExports(client), fetchStacks(client)]);
32
+ logger.ok(`Got ${exports.length} exports, ${stacks.length} active stacks`);
33
+
34
+ const projectDir = resolveProjectDir();
35
+ const catalogDir = join(projectDir, CATALOG_DIR_REL);
36
+ const projectCfg = loadProjectConfig({ projectDir });
37
+ const catalogMd = renderCatalog(groupExports(exports), { ...meta, total: exports.length });
38
+ const classified = classifyStacks(stacks, new Date(), projectCfg.legacy_prefixes);
39
+ const inventoryMd = renderInventory(classified, meta);
40
+
41
+ await mkdir(catalogDir, { recursive: true });
42
+ await writeFile(join(catalogDir, 'outputs-catalog.md'), catalogMd);
43
+ await writeFile(join(catalogDir, 'stacks-inventory.md'), inventoryMd);
44
+ logger.ok(`${CATALOG_DIR_REL}/outputs-catalog.md (${exports.length} exports)`);
45
+ logger.ok(
46
+ `${CATALOG_DIR_REL}/stacks-inventory.md (legacy=${classified.legacy.length}, serverless=${classified.serverless.length}, active=${classified.active.length}, stale=${classified.stale.length})`,
47
+ );
48
+
49
+ const workflowResult = ensureWorkflowInstalled({ repoRoot: REPO_ROOT, projectDir });
50
+ if (workflowResult.installed) {
51
+ logger.ok('.claude/workflows/audit-all-stacks.js installed — invoke it via `/workflows` or `/audit-all-stacks`');
52
+ }
53
+ }
@@ -0,0 +1,24 @@
1
+ // clawform update — pull the newest plugin content in one command after a CLI
2
+ // upgrade. Thin on purpose: it force-refreshes the plugin kit (the fix for a
3
+ // frozen `~/.clawform/kit.bin`) via `init plugin --refresh`, then reminds you to
4
+ // bump the npm binary — which a running process cannot replace on its own.
5
+ //
6
+ // NOT license-gated in itself: it never calls assertLicensed, so a user
7
+ // mid-recovery is not blocked by a SECOND gate here. It delegates the one
8
+ // licence-checked step to `init plugin`, which already gates the kit fetch and,
9
+ // on a stale record, points at `clawform activate` (which re-adopts the existing
10
+ // slot for free — see activate.js). The kit is served independently of the CLI
11
+ // version, so this refreshes skills even before the npm binary is bumped.
12
+
13
+ import { logger } from '../lib/logger.js';
14
+ import initPlugin from './init-plugin.js';
15
+
16
+ export default async function update({ scope = 'global' } = {}, {
17
+ runInitPlugin = initPlugin,
18
+ } = {}) {
19
+ logger.step('clawform update');
20
+ await runInitPlugin({ scope, refresh: true });
21
+ logger.info('');
22
+ logger.info('For the newest CLI itself (new commands/flags), also run:');
23
+ logger.info(' npm i -g @thejoseki/clawform@latest');
24
+ }